Public report of JohnnyFiv3r/Core-Memory, published 8 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.2). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 8 November 2026, 00:53 UTC · Survey ID cd_e344f8234fbe4959bd09829a61b87277
JohnnyFiv3r/Core-Memory
Measured 8 November 2026, 00:53 UTC, at code version b3857ff
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
Down 1 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A medium codebase: 84,748 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 0.9 person-years · Weakest lens: Maturity, 50
Findings by how serious they are
27 critical1122 serious98 minor
12 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
8 November 2026, 00:53 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
64of 64 dimensions measured by tools.
1234of 1247 findings point to an exact file and line, so you can open each one in the code. The other 13 concern the repository as a whole, such as missing documentation.
64dimensions across 6 lenses, read from 84,748 lines of product code in 2 projects.
JohnnyFiv3r/Core-Memory falls short of our standard for production because the documentation refers to links that don't exist. It scores 58 out of 100 and is rated Adequate, and all 27 of its critical findings are security problems in the build pipeline and in its code.
Maturity, at 50, is the weakest lens and counts most in the score. The best first step for the work it takes is fixing the two parts of the code only one person knows, worth about 5 points. Bringing the documentation in line with the code comes next, worth about 7 points. Raising Maturity to 70 would lift the score to about 65.
Twenty-one pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Five pipeline steps install packages that can change without warning, and one weakness in the code could be used by an attacker. Pinning each tool to an exact version, pinning what the pipeline installs and fixing the weaknesses the scanner points to would close these risks.
The product code is 84,748 lines, about €140,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
€46,000 to €230,000, for 762 to 2,418 hours of work, about 0.9 person-years for 1 to 2 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.8 at a score of 58. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Medium: 84,748 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 2 Off-boarding risk finding(s) in Bus Factor.
Raises the score by about 5 points · Low effort · Bus Factor
2
Reconcile the README with reality: docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/quickstart.md`, but `docs/reports/docs/integrations/springai/quickstart.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/integration-guide.md`, but `docs/reports/docs/integrations/springai/integration-guide.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/api-reference.md`, but `docs/reports/docs/integrations/springai/api-reference.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `CONTRIBUTING.md`, but `docs/reports/CONTRIBUTING.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/public_surface.md`, but `docs/reports/docs/public_surface.md` does not exist.
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.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €140,000 to build again, about 0.9 person-years of work. Its weakest lens is Maturity, at 50 (Adequate). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. Of all the actions in this report, it raises the score most for the work it takes: about 5 points for low effort, because it clears the 2 Bus Factor findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.7 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 6% to 13% on every change. The history of the code shows how much it changes: about 153,821 lines over the last 90 days, which is about 623,830 lines a year. At that pace, the extra work comes to an estimated 88.3 to 529.6 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
90 modules, with 31 dependencies between them. Every module uses only modules listed above it, so there are no loops.
The table shows the 40 modules with the most connections; 50 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
core_memory uses core_memory.persistence.store, so a change to core_memory.persistence.store can break core_memory, while a change to core_memory can't break core_memory.persistence.store.
Position
Below the diagonal: core_memory uses a module listed above it, which is the healthy direction.
core_memory uses core_memory.provider_config, so a change to core_memory.provider_config can break core_memory, while a change to core_memory can't break core_memory.provider_config.
Position
Below the diagonal: core_memory uses a module listed above it, which is the healthy direction.
core_memory.cli uses core_memory.persistence.store, so a change to core_memory.persistence.store can break core_memory.cli, while a change to core_memory.cli can't break core_memory.persistence.store.
Position
Below the diagonal: core_memory.cli uses a module listed above it, which is the healthy direction.
core_memory.entity uses core_memory.entity.speaker_resolver, so a change to core_memory.entity.speaker_resolver can break core_memory.entity, while a change to core_memory.entity can't break core_memory.entity.speaker_resolver.
Position
Below the diagonal: core_memory.entity uses a module listed above it, which is the healthy direction.
43 pairs of types, where a type in core_memory.integrations.http uses a type in core_memory.integrations.http.server. 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, so a change to core_memory.integrations.http.server can break core_memory.integrations.http, while a change to core_memory.integrations.http can't break core_memory.integrations.http.server.
Position
Below the diagonal: core_memory.integrations.http uses a module listed above it, which is the healthy direction.
core_memory.integrations.neo4j uses core_memory.integrations.neo4j.config, so a change to core_memory.integrations.neo4j.config can break core_memory.integrations.neo4j, while a change to core_memory.integrations.neo4j can't break core_memory.integrations.neo4j.config.
Position
Below the diagonal: core_memory.integrations.neo4j uses a module listed above it, which is the healthy direction.
core_memory.integrations.neo4j.client uses core_memory.integrations.neo4j.config, so a change to core_memory.integrations.neo4j.config can break core_memory.integrations.neo4j.client, while a change to core_memory.integrations.neo4j.client can't break core_memory.integrations.neo4j.config.
Position
Below the diagonal: core_memory.integrations.neo4j.client uses a module listed above it, which is the healthy direction.
core_memory.integrations.pydanticai uses core_memory.schema.semantic_tasks, so a change to core_memory.schema.semantic_tasks can break core_memory.integrations.pydanticai, while a change to core_memory.integrations.pydanticai can't break core_memory.schema.semantic_tasks.
Position
Below the diagonal: core_memory.integrations.pydanticai uses a module listed above it, which is the healthy direction.
core_memory.integrations.pydanticai.semantic_tasks uses core_memory.schema.semantic_tasks, so a change to core_memory.schema.semantic_tasks can break core_memory.integrations.pydanticai.semantic_tasks, while a change to core_memory.integrations.pydanticai.semantic_tasks can't break core_memory.schema.semantic_tasks.
Position
Below the diagonal: core_memory.integrations.pydanticai.semantic_tasks uses a module listed above it, which is the healthy direction.
core_memory.integrations.remote uses core_memory.schema.semantic_tasks, so a change to core_memory.schema.semantic_tasks can break core_memory.integrations.remote, while a change to core_memory.integrations.remote can't break core_memory.schema.semantic_tasks.
Position
Below the diagonal: core_memory.integrations.remote uses a module listed above it, which is the healthy direction.
core_memory.integrations.remote.semantic_tasks uses core_memory.schema.semantic_tasks, so a change to core_memory.schema.semantic_tasks can break core_memory.integrations.remote.semantic_tasks, while a change to core_memory.integrations.remote.semantic_tasks can't break core_memory.schema.semantic_tasks.
Position
Below the diagonal: core_memory.integrations.remote.semantic_tasks uses a module listed above it, which is the healthy direction.
core_memory.persistence uses core_memory.persistence.backend, so a change to core_memory.persistence.backend can break core_memory.persistence, while a change to core_memory.persistence can't break core_memory.persistence.backend.
Position
Below the diagonal: core_memory.persistence uses a module listed above it, which is the healthy direction.
core_memory.persistence uses core_memory.schema.semantic_tasks, so a change to core_memory.schema.semantic_tasks can break core_memory.persistence, while a change to core_memory.persistence can't break core_memory.schema.semantic_tasks.
Position
Below the diagonal: core_memory.persistence uses a module listed above it, which is the healthy direction.
core_memory.persistence.graph.graphiti_backend uses core_memory.persistence.backend, so a change to core_memory.persistence.backend can break core_memory.persistence.graph.graphiti_backend, while a change to core_memory.persistence.graph.graphiti_backend can't break core_memory.persistence.backend.
Position
Below the diagonal: core_memory.persistence.graph.graphiti_backend uses a module listed above it, which is the healthy direction.
core_memory.persistence.graph.kuzu_backend uses core_memory.persistence.backend, so a change to core_memory.persistence.backend can break core_memory.persistence.graph.kuzu_backend, while a change to core_memory.persistence.graph.kuzu_backend can't break core_memory.persistence.backend.
Position
Below the diagonal: core_memory.persistence.graph.kuzu_backend uses a module listed above it, which is the healthy direction.
core_memory.persistence.graph.neo4j_backend uses core_memory.persistence.backend, so a change to core_memory.persistence.backend can break core_memory.persistence.graph.neo4j_backend, while a change to core_memory.persistence.graph.neo4j_backend can't break core_memory.persistence.backend.
Position
Below the diagonal: core_memory.persistence.graph.neo4j_backend uses a module listed above it, which is the healthy direction.
core_memory.persistence.graph.protocol uses core_memory.persistence.backend, so a change to core_memory.persistence.backend can break core_memory.persistence.graph.protocol, while a change to core_memory.persistence.graph.protocol can't break core_memory.persistence.backend.
Position
Below the diagonal: core_memory.persistence.graph.protocol uses a module listed above it, which is the healthy direction.
core_memory.policy uses core_memory.policy.association_inference_v21, so a change to core_memory.policy.association_inference_v21 can break core_memory.policy, while a change to core_memory.policy can't break core_memory.policy.association_inference_v21.
Position
Below the diagonal: core_memory.policy uses a module listed above it, which is the healthy direction.
core_memory.policy uses core_memory.provider_config, so a change to core_memory.provider_config can break core_memory.policy, while a change to core_memory.policy can't break core_memory.provider_config.
Position
Below the diagonal: core_memory.policy uses a module listed above it, which is the healthy direction.
core_memory.policy uses core_memory.schema.semantic_tasks, so a change to core_memory.schema.semantic_tasks can break core_memory.policy, while a change to core_memory.policy can't break core_memory.schema.semantic_tasks.
Position
Below the diagonal: core_memory.policy uses a module listed above it, which is the healthy direction.
core_memory.policy.semantic_task_runtime uses core_memory.schema.semantic_tasks, so a change to core_memory.schema.semantic_tasks can break core_memory.policy.semantic_task_runtime, while a change to core_memory.policy.semantic_task_runtime can't break core_memory.schema.semantic_tasks.
Position
Below the diagonal: core_memory.policy.semantic_task_runtime uses a module listed above it, which is the healthy direction.
core_memory.retrieval uses core_memory.retrieval.contracts, so a change to core_memory.retrieval.contracts can break core_memory.retrieval, while a change to core_memory.retrieval can't break core_memory.retrieval.contracts.
Position
Below the diagonal: core_memory.retrieval uses a module listed above it, which is the healthy direction.
core_memory.retrieval uses core_memory.retrieval.lexical, so a change to core_memory.retrieval.lexical can break core_memory.retrieval, while a change to core_memory.retrieval can't break core_memory.retrieval.lexical.
Position
Below the diagonal: core_memory.retrieval uses a module listed above it, which is the healthy direction.
core_memory.retrieval uses core_memory.retrieval.vector_backend, so a change to core_memory.retrieval.vector_backend can break core_memory.retrieval, while a change to core_memory.retrieval can't break core_memory.retrieval.vector_backend.
Position
Below the diagonal: core_memory.retrieval uses a module listed above it, which is the healthy direction.
core_memory.retrieval.tools uses core_memory.persistence.store, so a change to core_memory.persistence.store can break core_memory.retrieval.tools, while a change to core_memory.retrieval.tools can't break core_memory.persistence.store.
Position
Below the diagonal: core_memory.retrieval.tools uses a module listed above it, which is the healthy direction.
core_memory.runtime uses core_memory.runtime.state, so a change to core_memory.runtime.state can break core_memory.runtime, while a change to core_memory.runtime can't break core_memory.runtime.state.
Position
Below the diagonal: core_memory.runtime uses a module listed above it, which is the healthy direction.
core_memory.runtime.ingest uses core_memory.persistence.store, so a change to core_memory.persistence.store can break core_memory.runtime.ingest, while a change to core_memory.runtime.ingest can't break core_memory.persistence.store.
Position
Below the diagonal: core_memory.runtime.ingest uses a module listed above it, which is the healthy direction.
core_memory.runtime.ingest uses core_memory.runtime.ingest.source_events, so a change to core_memory.runtime.ingest.source_events can break core_memory.runtime.ingest, while a change to core_memory.runtime.ingest can't break core_memory.runtime.ingest.source_events.
Position
Below the diagonal: core_memory.runtime.ingest uses a module listed above it, which is the healthy direction.
core_memory.runtime.turn uses core_memory.schema.turn_receipt, so a change to core_memory.schema.turn_receipt can break core_memory.runtime.turn, while a change to core_memory.runtime.turn can't break core_memory.schema.turn_receipt.
Position
Below the diagonal: core_memory.runtime.turn uses a module listed above it, which is the healthy direction.
core_memory.schema uses core_memory.schema.turn, so a change to core_memory.schema.turn can break core_memory.schema, while a change to core_memory.schema can't break core_memory.schema.turn.
Position
Below the diagonal: core_memory.schema uses a module listed above it, which is the healthy direction.
core_memory.persistence.graph uses core_memory.persistence.graph.protocol, so a change to core_memory.persistence.graph.protocol can break core_memory.persistence.graph, while a change to core_memory.persistence.graph can't break core_memory.persistence.graph.protocol.
Position
Below the diagonal: core_memory.persistence.graph uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 69% · 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
A05:2025 — Injection
46
High / Critical
A03:2025 — Software Supply Chain Failures
7
Medium
Roadmap
Top priorities: Reconcile the README with reality: docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/quickstart.md`, but `docs/reports/docs/integrations/springai/quickstart.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/integration-guide.md`, but `docs/reports/docs/integrations/springai/integration-guide.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/api-reference.md`, but `docs/reports/docs/integrations/springai/api-reference.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `CONTRIBUTING.md`, but `docs/reports/CONTRIBUTING.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/public_surface.md`, but `docs/reports/docs/public_surface.md` does not exist; Resolve the 2 Off-boarding risk finding(s) in Bus Factor; 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.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 2 Off-boarding risk finding(s) in Bus Factor.
Reconcile the README with reality: docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/quickstart.md`, but `docs/reports/docs/integrations/springai/quickstart.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/integration-guide.md`, but `docs/reports/docs/integrations/springai/integration-guide.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/api-reference.md`, but `docs/reports/docs/integrations/springai/api-reference.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `CONTRIBUTING.md`, but `docs/reports/CONTRIBUTING.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/public_surface.md`, but `docs/reports/docs/public_surface.md` does not exist.
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.
Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Enforce authorization at every handler — a guard on each route, or a global authentication guard/middleware with explicit public opt-outs, so protected-by-default is demonstrable.
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 — 1122
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 — 98
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 12
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 64 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 64 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, 1234 of 1247 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT 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 — 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. This repository's 1 shipped Python distribution(s) across 1 manifest(s) WERE read; what went unanswered is the currency half, because it grades an EXACT pin against the newest release and every declaration here is a floor or a range — which installs the newest release it admits and so cannot be behind one. So pypi.org was never asked. This is a true statement about the repository, and the healthy one, NOT a gap on our side: no reader we could write would find a currency question here.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 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 an ADMISSION gap, not an environment fault: no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
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; osv was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that osv is free of known-vulnerable dependencies. osv: the scanner produced no output at all, so no dependency was actually scanned. This is reported as a measurement gap rather than a clean pass. osv-scanner documents exit 128 as "no package sources found" — but this scan only invoked it because the tree declares a source it supports (`pom.xml` and the resolved lockfiles among them), so the tool's report and this repository disagree. Check that those sources are reachable from the directory the scan ran in before concluding anything is missing. If this tree really does commit only range-pinned manifests, commit the lockfile your package manager produces — but only where your ecosystem HAS one and commits it: Maven has none at all (osv-scanner reads `pom.xml` directly) and Gradle writes one only under opt-in dependency locking, while a published Composer package and a published Dart library both deliberately exclude theirs. In those three, generate one in CI before the scan instead — a resolved dependency list or an SBOM fed to the scanner.
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; osv was not, so this dimension's score covers less than the dependency surface this repository declares, and nothing here is evidence that osv is free of known-vulnerable dependencies. osv: the scanner produced no output at all, so no dependency was actually scanned. This is reported as a measurement gap rather than a clean pass. osv-scanner documents exit 128 as "no package sources found" — but this scan only invoked it because the tree declares a source it supports (`pom.xml` and the resolved lockfiles among them), so the tool's report and this repository disagree. Check that those sources are reachable from the directory the scan ran in before concluding anything is missing. If this tree really does commit only range-pinned manifests, commit the lockfile your package manager produces — but only where your ecosystem HAS one and commits it: Maven has none at all (osv-scanner reads `pom.xml` directly) and Gradle writes one only under opt-in dependency locking, while a published Composer package and a published Dart library both deliberately exclude theirs. In those three, generate one in CI before the scan instead — a resolved dependency list or an SBOM fed to the scanner.
AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via ToolchainServer (.). the service exited before it opened a port — `/tmp/wd-venv/bin/python -m uvicorn 'core_memory.integrations.http.server:app' --host 127.0.0.1 --port 8000`: File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _l…; runtime evidence skipped (launch chosen because core_memory/integrations/http/server.py defines the FastAPI application 'app' at module level).
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 218 further occurrence(s) are not listed individually; the score already reflects all 258.
X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X7 Silent fallback defaults — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 26 further occurrence(s) are not listed individually; the score already reflects all 66.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
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 — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
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 publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
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
Bring the 29 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with candidates.decide_dreamer_candidate (cyclomatic 204), management.maintain (cyclomatic 173), canonical.search_request (cyclomatic 150). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 29 together lifts Cyclomatic Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 415 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 49 bodies over 60 down to 60 or less in Cognitive Complexity — start with candidates.decide_dreamer_candidate (cognitive 359), management.maintain (cognitive 186), canonical.search_request (cognitive 180). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 49 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God 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, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 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.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
2 production modules (npm+Python), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence, with abstractness counted on 1 of the 2 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
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 71 Hotspot finding(s) in Churn × Complexity Hotspots — start with __init__.py (3), runner.py (2), side_effect_queue.py. — One of this dimension's main actionable groups (71 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 Factor6.1 / 10Adequate✓ 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.
139 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: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
0 of 1 evaluated ADRs have a defect readable from the log itself (a missing or empty section, no title, a single option, consequences with no cost, no status, a missing enforcement field, a status the log contradicts, a dangling link, an unlinked second decision on one question, a date that is no calendar day). How well each record argues its case is not measured.
1 of 2 build units (Python) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D27 · Navigability7.9 / 10Strong✓ Tool-verified
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
100 % of calls cross a namespace and 1 % go through an interface, but 59 % of collaborators are co-located — so following a call takes several hops. Baseline: small — navigation cost is tolerated.
Scattered collaborators
What to do
Resolve the 1 Scattered collaborators finding(s) in Navigability. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d27_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
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
REDACTED
REDACTED
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 5 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (5 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
No action in Static Analysis (SAST) — all 21 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (21 issue-level, 0 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 and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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. osv was not scanned (osv: 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.
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.
5 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.
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.
Resolve the 4 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (4 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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. osv was not scanned (osv: 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.
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 Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Only 2 place(s) refuse an unauthorized caller — too few to demonstrate default-deny across handlers.
What to do
Enforce authorization at every handler — a guard on each route, or a global authentication guard/middleware with explicit public opt-outs, so protected-by-default is demonstrable.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Add a README to the 1 of 1 project(s) that lack one — worth up to 2 pts.
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 project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/quickstart.md`, but `docs/reports/docs/integrations/springai/quickstart.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/reports/readme-oss-rewrite-draft.md:231
docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/integration-guide.md`, but `docs/reports/docs/integrations/springai/integration-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/reports/readme-oss-rewrite-draft.md:232
docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/api-reference.md`, but `docs/reports/docs/integrations/springai/api-reference.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/reports/readme-oss-rewrite-draft.md:233
docs/reports/readme-oss-rewrite-draft.md links to `CONTRIBUTING.md`, but `docs/reports/CONTRIBUTING.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/reports/readme-oss-rewrite-draft.md:341
docs/reports/readme-oss-rewrite-draft.md links to `docs/public_surface.md`, but `docs/reports/docs/public_surface.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/reports/readme-oss-rewrite-draft.md:342
docs/reports/readme-oss-rewrite-draft.md links to `docs/index.md`, but `docs/reports/docs/index.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/reports/readme-oss-rewrite-draft.md:343
What to do
Reconcile the README with reality: docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/quickstart.md`, but `docs/reports/docs/integrations/springai/quickstart.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/integration-guide.md`, but `docs/reports/docs/integrations/springai/integration-guide.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/api-reference.md`, but `docs/reports/docs/integrations/springai/api-reference.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `CONTRIBUTING.md`, but `docs/reports/CONTRIBUTING.md` does not exist; docs/reports/readme-oss-rewrite-draft.md links to `docs/public_surface.md`, but `docs/reports/docs/public_surface.md` does not exist.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability8.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
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. — REDACTED:19
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
Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document1.8 / 10Critical✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`drop_unknown_agent_authored_updates_v1` is public, takes a document from its caller (line 610) and hands it to `_validate_json_value`, which calls itself at line 537 (`_validate_json_value`) with a piece of `value` (and at line 553) — and nowhere in `_validate_json_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_validate_json_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — core_memory/schema/agent_authored_updates.py:537
`drop_unknown_agent_authored_updates_v1` is public, takes a document from its caller (line 610) and hands it to `_drop_unknown_json_value`, which calls itself at line 581 (`_drop_unknown_json_value`) with a piece of `schema` (and at line 588, line 604) — and nowhere in `_drop_unknown_json_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_drop_unknown_json_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — core_memory/schema/agent_authored_updates.py:581
`verify_semantic_task_output` is public, takes a document from its caller (line 182) and hands it to `_find_forbidden_mutation_keys`, which calls itself at line 77 (`_find_forbidden_mutation_keys`) with a piece of `value` (and at line 80) — and nowhere in `_find_forbidden_mutation_keys` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_find_forbidden_mutation_keys` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — core_memory/policy/semantic_task_verifier.py:77
`repaired_field_paths` is public, takes a document from its caller (line 256) and hands it to `_leaf_paths`, which calls itself at line 205 (`_leaf_paths`) with a piece of `value` (and at line 210) — and nowhere in `_leaf_paths` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_leaf_paths` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — core_memory/policy/turn_memory_authoring.py:205
`remove_source_beads_for_store` is public, takes a document from its caller (line 474) and hands it to `_stable_ref`, which calls itself at line 49 (`_stable_ref`) with a piece of `value` — and nowhere in `_stable_ref` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_stable_ref` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — core_memory/persistence/store_management_ops.py:49
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back. Also whether a `finally` that gives the primitive back unconditionally can run in a state where the method does not hold it: after a timed wait whose result was discarded, after an acquire inside the `try` that can fail, after the body already released it, or never, because a `return` left between the acquire and the `try`.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`debug` at line 204 is called with an argument built by `sorted(dropped)` (line 204), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on. — core_memory/schema/models.py:204
What to do
In Python, put the construction behind the logger's own check (`if logger.isEnabledFor(logging.DEBUG):`), or pass the collection itself with a `%s` placeholder (`logger.debug("Items %s", items)`) so the logging module renders it only when the record is emitted. The placeholder alone is not the fix when the argument is still built first: it defers the formatting, not a `json.dumps`, a `join` or a comprehension in the argument, and an f-string defers nothing at all.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×8) — plugins/openclaw-core-memory-bridge/index.js:47, plugins/openclaw-core-memory-bridge/index.js:147, plugins/openclaw-core-memory-bridge/index.js:195, …
`except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×32) — core_memory/transcript_ingest.py:436, core_memory/transcript_ingest.py:541, core_memory/write_pipeline/continuity_injection.py:55, …
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
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.
Unscored — 4 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
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.
X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 52 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 — Not applicable: this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads.
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — the service exited before it opened a port — `/tmp/wd-venv/bin/python -m uvicorn 'core_memory.integrations.http.server:app' --host 127.0.0.1 --port 8000`: File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _l…; runtime evidence skipped (launch chosen because core_memory/integrations/http/server.py defines the FastAPI application 'app' at module level) This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential in a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or MongoEngine model, a migration or a SQL schema — and no database or data-store client (Django ORM, SQLAlchemy, psycopg, PyMongo, …) in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, first_name, date_of_birth, phone, …) or stored credential on a Django, SQLAlchemy, SQLModel, Peewee, Tortoise or mongoengine model, in a migration or in a SQL schema — and no database or data-store client (django.db, sqlalchemy, psycopg2, pymongo, sqlite3, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
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 — Dependency currency not established — no declaration carries an exact pin to grade
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.
D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; Python, html not measured.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (core_memory), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py source were not judged.
D25 ADR Conformance — None of 1 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
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.
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 1 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 39 value object(s)
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`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
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
X2 Cancellation propagation — no C# was loaded; this repository's Python was read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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, and the most complex body those changes touched has 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, and the most complex body those changes touched has 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, and the most complex body those changes touched has 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, and the most complex body those changes touched has 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 8 times in last 90 days, and the most complex body those changes touched has 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, and the most complex body those changes touched has 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 16 times in last 90 days, and the most complex body those changes touched has 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, and the most complex body those changes touched has 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: REDACTED REDACTED:1546— REDACTED changed 12 times in last 90 days, and the most complex body those changes touched has 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: benchmarks/causal_continuity/reporting.py benchmarks/causal_continuity/reporting.py:93— benchmarks/causal_continuity/reporting.py changed 10 times in last 90 days, and the most complex body those changes touched has 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: 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, and the most complex body those changes touched has 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/runtime/passes/enrichment.py core_memory/runtime/passes/enrichment.py:115— core_memory/runtime/passes/enrichment.py changed 10 times in last 90 days, and the most complex body those changes touched has 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/soul/dreamer_bridge.py core_memory/soul/dreamer_bridge.py:536— core_memory/soul/dreamer_bridge.py changed 13 times in last 90 days, and the most complex body those changes touched has 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/retrieval/agent.py core_memory/retrieval/agent.py:817— core_memory/retrieval/agent.py changed 17 times in last 90 days, and the most complex body those changes touched has 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/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, and the most complex body those changes touched has 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, and the most complex body those changes touched has 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, and the most complex body those changes touched has 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/schema/models.py core_memory/schema/models.py:310— core_memory/schema/models.py changed 12 times in last 90 days, and the most complex body those changes touched has 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/soul/summary.py core_memory/soul/summary.py:603— core_memory/soul/summary.py changed 7 times in last 90 days, and the most complex body those changes touched has 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/integrations/api.py core_memory/integrations/api.py:349— core_memory/integrations/api.py changed 8 times in last 90 days, and the most complex body those changes touched has 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/transcript_ingest.py core_memory/transcript_ingest.py:192— core_memory/transcript_ingest.py changed 7 times in last 90 days, and the most complex body those changes touched has 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/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, and the most complex body those changes touched has 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, and the most complex body those changes touched has 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 18 times in last 90 days, and the most complex body those changes touched has 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.
Hotspot: core_memory/retrieval/contracts.py core_memory/retrieval/contracts.py:306— core_memory/retrieval/contracts.py changed 7 times in last 90 days, and the most complex body those changes touched has 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.
Swallowed exception (caught, then discarded) core_memory/transcript_ingest.py:436— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/transcript_ingest.py:541— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/write_pipeline/continuity_injection.py:55— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/temporal/resolution.py:18— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/assembly_depth.py:50— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/assembly_depth.py:131— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/identity_value_signals.py:32— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/store.py:94— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/store.py:164— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/summary.py:62— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/summary.py:87— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/summary.py:474— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/summary.py:536— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/summary.py:1084— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/soul/tension_signals.py:24— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/schema/promotion.py:328— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/engine.py:716— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/turn/turn_flow.py:145— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/turn/turn_flow.py:543— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/session/session_enrichment_delta.py:95— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/session/session_enrichment_delta.py:271— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/session/session_enrichment_delta.py:358— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/session/session_start_flow.py:110— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/queue/compaction_queue.py:37— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) core_memory/runtime/queue/side_effect_queue.py:163— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
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.
Swallowed exception (empty catch) plugins/openclaw-core-memory-bridge/index.js:47— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) plugins/openclaw-core-memory-bridge/index.js:147— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) plugins/openclaw-core-memory-bridge/index.js:195— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) core_memory/write_pipeline/tokenizer.py:113— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) core_memory/soul/summary.py:74— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) core_memory/runtime/engine.py:700— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) core_memory/runtime/turn/turn_quality.py:74— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) core_memory/runtime/queue/side_effect_queue.py:174— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
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.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×5
Recursive walk over a caller-supplied document has no depth cap core_memory/schema/agent_authored_updates.py:537— `drop_unknown_agent_authored_updates_v1` is public, takes a document from its caller (line 610) and hands it to `_validate_json_value`, which calls itself at line 537 (`_validate_json_value`) with a piece of `value` (and at line 553) — and nowhere in `_validate_json_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_validate_json_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap core_memory/schema/agent_authored_updates.py:581— `drop_unknown_agent_authored_updates_v1` is public, takes a document from its caller (line 610) and hands it to `_drop_unknown_json_value`, which calls itself at line 581 (`_drop_unknown_json_value`) with a piece of `schema` (and at line 588, line 604) — and nowhere in `_drop_unknown_json_value` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_drop_unknown_json_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap core_memory/policy/semantic_task_verifier.py:77— `verify_semantic_task_output` is public, takes a document from its caller (line 182) and hands it to `_find_forbidden_mutation_keys`, which calls itself at line 77 (`_find_forbidden_mutation_keys`) with a piece of `value` (and at line 80) — and nowhere in `_find_forbidden_mutation_keys` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_find_forbidden_mutation_keys` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap core_memory/policy/turn_memory_authoring.py:205— `repaired_field_paths` is public, takes a document from its caller (line 256) and hands it to `_leaf_paths`, which calls itself at line 205 (`_leaf_paths`) with a piece of `value` (and at line 210) — and nowhere in `_leaf_paths` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_leaf_paths` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap core_memory/persistence/store_management_ops.py:49— `remove_source_beads_for_store` is public, takes a document from its caller (line 474) and hands it to `_stable_ref`, which calls itself at line 49 (`_stable_ref`) with a piece of `value` — and nowhere in `_stable_ref` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `_stable_ref` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
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:1— `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:1— `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 plugins/openclaw-core-memory-bridge/package.json:6— plugins/openclaw-core-memory-bridge/package.json declares dependencies that no committed lockfile resolves — there is no package-lock.json / yarn.lock / pnpm-lock.yaml / bun.lock beside it, and no locked workspace above it names it — so its installs aren't reproducible (SSDF PW.4.4). Commit its package manager's lockfile (or add it to the locked workspace) and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
Silent fallback default in catch benchmarks/causal/runner.py:30— `_repo_commit` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/causal_continuity/reproducibility.py:26— `_repo_commit` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/causal_continuity/t5.py:135— `_read_beads` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/locomo/ingest.py:104— `_read_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/locomo/runner.py:52— `_repo_sha` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/locomo_like/runner.py:136— `_latest_turn_bead_id` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/locomo_like/runner.py:163— `_repo_commit` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/locomo_like/runner.py:436— `_load_dreamer_candidates` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/longmemeval/runner.py:28— `_repo_sha` swallows every exception into `return 'unknown'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch benchmarks/longmemeval/runner.py:78— `_read_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/association/edge_lifecycle.py:44— `_read_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/association/slo.py:45— `_active_shared_tag_ratio` swallows every exception into `return 0.0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/config/settings.py:42— `_load_yaml` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/graph/junctions.py:37— `_read_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/graph/roadmap.py:61— `_read_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/graph/roadmap.py:68— `_file_digest` swallows every exception into `return 'missing'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/graph/root_cause.py:124— `_read_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/graph/traversal.py:33— `_recency_factor` swallows every exception into `return 0.5` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/graph/worldlines.py:42— `_read_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/integrations/api.py:284— `_safe_load_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/integrations/mcp/tools/status.py:24— `_advertised_tools_count` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch REDACTED:206— `_collect_prune_keep_assoc_ids` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/persistence/calibration.py:71— `_judge_prior_by_edge_key` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/persistence/myelination_rewards.py:105— `_read_index` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch core_memory/persistence/turn_archive.py:55— `_read_idx` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Duplicated predicate REDACTED:1000— `"decision" in types or "precedent" in types` appears character-identically in 2 files — REDACTED, core_memory/retrieval/tools/memory_reason.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/retrieval/pipeline/__init__.py:34— `(facets.get("incident_ids") or [None])[0] or ""` appears character-identically in 2 files — core_memory/retrieval/pipeline/__init__.py, core_memory/retrieval/pipeline/canonical.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:1128— `_auto_configure_embedding_provider_from_keys() or "gemini"` appears character-identically in 2 files — REDACTED, core_memory/runtime/post_write/bead_commit.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:25— `a.get("normalized_label") or a.get("label") or ""` appears character-identically in 2 files — REDACTED, core_memory/runtime/dreamer/candidates.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/persistence/backend.py:184— `a.get("source_bead") == bead_id or a.get("target_bead") == bead_id` appears character-identically in 3 files — core_memory/persistence/backend.py, core_memory/persistence/store_autonomy_ops.py, core_memory/schema/promotion.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/association/crawler_contract.py:98— `a.get("source_bead") or a.get("source_bead_id") or ""` appears character-identically in 4 files — core_memory/association/crawler_contract.py, core_memory/association/health.py, REDACTED, core_memory/retrieval/rerank.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/association/crawler_contract.py:99— `a.get("target_bead") or a.get("target_bead_id") or ""` appears character-identically in 4 files — core_memory/association/crawler_contract.py, core_memory/association/health.py, REDACTED, core_memory/retrieval/rerank.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/graph/roadmap.py:529— `alternative in edge.get("alternatives") or []` appears character-identically in 2 files — core_memory/graph/roadmap.py, core_memory/retrieval/roadmap_planner.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/persistence/calibration.py:74— `assoc in index.get("associations") or []` appears character-identically in 4 files — core_memory/persistence/calibration.py, core_memory/retrieval/agent.py, core_memory/runtime/associations/coverage.py, core_memory/soul/summary.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/graph/root_cause.py:188— `assoc.get("relationship") or assoc.get("rel")` appears character-identically in 2 files — core_memory/graph/root_cause.py, core_memory/persistence/backend.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/persistence/graph/kuzu_backend.py:106— `assoc.get("relationship") or assoc.get("rel_type") or ""` appears character-identically in 2 files — core_memory/persistence/graph/kuzu_backend.py, core_memory/persistence/graph/neo4j_backend.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/graph/root_cause.py:186— `assoc.get("source_bead") or assoc.get("source_bead_id")` appears character-identically in 3 files — core_memory/graph/root_cause.py, core_memory/retrieval/agent.py, core_memory/runtime/associations/coverage.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/association/edge_lifecycle.py:49— `assoc.get("source_bead") or assoc.get("source_bead_id") or ""` appears character-identically in 13 files — core_memory/association/edge_lifecycle.py, core_memory/graph/traversal.py, core_memory/graph/worldlines.py, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/graph/root_cause.py:187— `assoc.get("target_bead") or assoc.get("target_bead_id")` appears character-identically in 3 files — core_memory/graph/root_cause.py, core_memory/retrieval/agent.py, core_memory/runtime/associations/coverage.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/association/crawler_contract.py:721— `assoc.get("target_bead") or assoc.get("target_bead_id") or ""` appears character-identically in 14 files — core_memory/association/crawler_contract.py, core_memory/association/edge_lifecycle.py, core_memory/graph/traversal.py, core_memory/graph/worldlines.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/retrieval/roadmap_planner.py:120— `association in index.get("associations") or []` appears character-identically in 2 files — core_memory/retrieval/roadmap_planner.py, core_memory/runtime/goals/progress.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/runtime/goals/progress.py:132— `association.get("source_bead") or association.get("source_bead_id")` appears character-identically in 2 files — core_memory/runtime/goals/progress.py, core_memory/runtime/turn/reauthoring.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/runtime/goals/progress.py:128— `association.get("target_bead") or association.get("target_bead_id")` appears character-identically in 2 files — core_memory/runtime/goals/progress.py, core_memory/runtime/turn/reauthoring.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/runtime/passes/enrichment.py:202— `auto_apply.get("created_bead_ids") or []` appears character-identically in 2 files — core_memory/runtime/passes/enrichment.py, core_memory/runtime/turn/turn_flow.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/runtime/passes/enrichment.py:204— `auto_apply.get("current_turn_bead_id") or ""` appears character-identically in 2 files — core_memory/runtime/passes/enrichment.py, core_memory/runtime/turn/turn_flow.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:26— `b.get("normalized_label") or b.get("label") or ""` appears character-identically in 2 files — REDACTED, core_memory/runtime/dreamer/candidates.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/retrieval/pipeline/search.py:98— `b.get("title") or b.get("snapshot_title") or ""` appears character-identically in 2 files — core_memory/retrieval/pipeline/search.py, core_memory/retrieval/tools/memory_reason.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/persistence/store_retrieval_context.py:31— `bead.get("promoted_at") or bead.get("created_at") or ""` appears character-identically in 2 files — core_memory/persistence/store_retrieval_context.py, core_memory/retrieval/context_recall.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/runtime/passes/enrichment.py:351— `bool(md.get("used_memory")) or bool(context_beads)` appears character-identically in 2 files — core_memory/runtime/passes/enrichment.py, core_memory/runtime/turn/turn_flow.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate core_memory/runtime/dreamer/eval.py:176— `candidate.get("relationship_signal") or candidate.get("relationship_raw") or candidate.get("relationship") or ""` appears character-identically in 2 files — core_memory/runtime/dreamer/eval.py, core_memory/runtime/dreamer/longitudinal.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Silent fallback default on parse failure core_memory/config/feature_flags.py:51— `default_adjacent_turns` returns `0` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure core_memory/config/feature_flags.py:72— `agent_crawler_max_attempts` returns `2` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure core_memory/config/feature_flags.py:100— `agent_min_semantic_associations_after_first` returns `1` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure REDACTED:812— `_recency_factor` returns `1.0` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure core_memory/integrations/mcp/tools/ingest_slack.py:32— `_slack_ts_to_iso` returns `''` when `(ValueError, OSError, OverflowError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure core_memory/persistence/archive_index.py:20— `_read_index` returns `{}` when `json.JSONDecodeError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure core_memory/retrieval/causal_recall.py:473— `_causal_trigger_min_edges` returns `2` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure core_memory/retrieval/chunk_evidence.py:64— `_integer` returns `0` when `(TypeError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
README/code drift docs/reports/readme-oss-rewrite-draft.md:231— docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/quickstart.md`, but `docs/reports/docs/integrations/springai/quickstart.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/reports/readme-oss-rewrite-draft.md:232— docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/integration-guide.md`, but `docs/reports/docs/integrations/springai/integration-guide.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/reports/readme-oss-rewrite-draft.md:233— docs/reports/readme-oss-rewrite-draft.md links to `docs/integrations/springai/api-reference.md`, but `docs/reports/docs/integrations/springai/api-reference.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/reports/readme-oss-rewrite-draft.md:341— docs/reports/readme-oss-rewrite-draft.md links to `CONTRIBUTING.md`, but `docs/reports/CONTRIBUTING.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/reports/readme-oss-rewrite-draft.md:342— docs/reports/readme-oss-rewrite-draft.md links to `docs/public_surface.md`, but `docs/reports/docs/public_surface.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
README/code drift docs/reports/readme-oss-rewrite-draft.md:343— docs/reports/readme-oss-rewrite-draft.md links to `docs/index.md`, but `docs/reports/docs/index.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
Orphaned file core_memory/persistence/metrics_ops.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core_memory/config/loader.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core_memory/persistence/encryption.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core_memory/persistence/archive_index.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file core_memory/runtime/observability/observability.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 134 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 (+126 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.
Thin authorization enforcement — Only 2 place(s) refuse an unauthorized caller — too few to demonstrate default-deny across handlers.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 1 of 2 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (83024 LoC, 493 module-visible types across 58 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
Scattered collaborators — 100 % of calls cross a namespace and only 59 % of collaborators are co-located — group each feature's code into a vertical slice so a call's collaborators sit together.
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 5 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, example/demo and scaffolding-template 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, core_memory/persistence/archive_index.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.
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 REDACTED:19— 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.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×1
Diagnostic log message is built whether or not it is wanted core_memory/schema/models.py:204— `debug` at line 204 is called with an argument built by `sorted(dropped)` (line 204), whose cost grows with the collection it walks. Python evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isEnabledFor(logging.DEBUG)` test, no debug flag, no `lambda` the logger calls only when the level is on.
Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency — This repository's Python dependencies were read: 1 shipped distribution(s) across 1 manifest(s) (23 development or optional declaration(s) excluded, because a consumer does not install them). Whether any of them is behind its current release is the dependency-CURRENCY question, and no declaration here carries an EXACT pin to ask it about — every one is a floor or a range, which installs the newest release it admits and therefore cannot be behind one. That is a healthy declaration style, NOT a defect and NOT a gap in this analyzer; there is simply no currency question to answer. This is NOT a finding that these dependencies are current or healthy. Lockfiles are deliberately not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock): the four disagree about dev/optional membership, and misreading one would charge a test-only package a consumer never receives. Known CVEs in the same dependency graph are a separate question, reported under D30.
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 01a1b8a5-0aac-79f7-b5bd-d7a0fb4364ed · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 27 · Warnings: 1122 · Recommendations: 97 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 08-11-2026 @ 00:53 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.