Public report of vectorize-io/hindsight, published 17 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 17 November 2026, 05:29 UTC · Survey ID cd_0bed50245b404c1890caf0c8b8c840df
vectorize-io/hindsight
Measured 17 November 2026, 05:26 UTC, at code version b92ceb1
CAI scoreAt riskUp 1.5 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 454,011 lines of product code in 64 projects, tests not counted · Estimated rebuild effort: about 4.5 person-years · Weakest lens: Production Readiness, 34.8
Findings by how serious they are
527 critical2249 serious353 minor
11 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
17 November 2026, 05:26 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
91of 91 dimensions measured by tools.
3109of 3129 findings point to an exact file and line, so you can open each one in the code. The other 20 concern the repository as a whole, such as missing documentation.
91dimensions across 8 lenses, read from 454,011 lines of product code in 64 projects.
vectorize-io/hindsight is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back because we found no automated security scanning of the code, its secrets or its dependencies, and it has uses of packages that aren't listed. It scores 45.5 out of 100, which the At risk rating leaves unchanged.
Production Readiness, at 34.8, is the weakest lens and counts most in the score. The best first steps are adding automated security scanning and tidying the declared packages, each worth about 5.1 points. Raising Production Readiness to 70 would lift the score to about 54.1.
391 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Twenty-nine secrets can leak from the build pipeline, and fifteen weaknesses in the code could be used by an attacker. Pinning each tool to an exact version, limiting each secret to its own step and fixing the weaknesses the scanner points to would close these risks. Updating the vulnerable packages would fix the 11 packages with a known security hole, and the 14 unsafe settings in infrastructure or container files need changing to safe values. The 20 labels or groups of fields with no name need connecting to their fields or naming.
The product code is 454,011 lines, about €660,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Production Readiness rose from 34.8 to 70, the lowest score rated Strong, the score would rise from 45.5 to about 54.1.
Code composition: what the lines of code are
Product code 61%Tests 39%
New since the last survey: 454 findings
These 454 critical or serious findings weren't in the previous survey, on 5 November 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · FunctionTooLong: knowledge-write-dialogs.KnowledgeAddDocumentDialog hindsight-control-plane/src/components/knowledge-write-dialogs.tsx
God Classes · FileTooLong: consolidation/consolidator.py hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py
God Classes · FileTooLong: hindsight_client/hindsight_client.py hindsight-clients/python/hindsight_client/hindsight_client.py
God Classes · FunctionTooLong: knowledge-search-panel.KnowledgeSearchPanel hindsight-control-plane/src/components/knowledge-search-panel.tsx
God Classes · TooManyMethods: Hindsight hindsight-clients/python/hindsight_client/hindsight_client.py
God Classes · FileTooLong: knowledge/service.py hindsight-api-slim/hindsight_api/knowledge/service.py
God Classes · FunctionTooLong: observation-tree-view.ObservationTreeView REDACTED
God Classes · FunctionTooLong: knowledge-document-dialog.KnowledgeDocumentDialog hindsight-control-plane/src/components/knowledge-document-dialog.tsx
God Classes · FileTooLong: components/pages-view.tsx hindsight-control-plane/src/components/pages-view.tsx
God Classes · FunctionTooLong: knowledge-search-trace.KnowledgeSearchTraceView hindsight-control-plane/src/components/knowledge-search-trace.tsx
God Classes · FunctionTooLong: knowledge-bank-config-view.KnowledgeBankConfigView hindsight-control-plane/src/components/knowledge-bank-config-view.tsx
God Classes · TooManyMethods: KnowledgeService hindsight-api-slim/hindsight_api/knowledge/service.py
God Classes · FileTooLong: knowledge/routes.py hindsight-api-slim/hindsight_api/knowledge/routes.py
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 917 findings
These 917 critical or serious findings were in the previous survey, on 5 November 2026, and are gone from this one. The first 100 are listed here.
€220,000 to €1,100,000, for 3,645 to 11,565 hours of work, about 4.5 person-years for 2 to 9 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.7 at a score of 46. 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
Large: 454,011 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
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.
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
Raises the score by about 5.1 points · Medium effort · Dependency Hygiene
3
Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail.
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 €660,000 to build again, about 4.5 person-years of work. Its weakest lens is Production Readiness, at 34.8 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
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. Of all the actions in this report, it raises the score most for the work it takes: about 5.1 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 597,411 lines over the last 90 days, which is about 2,422,834 lines a year. At that pace, the extra work comes to an estimated 314.8 to 1888.7 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
996 modules, with 777 dependencies between them. 4 loops run through 8 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 956 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.
3 pairs of types, where a type in hindsight-api-slim.hindsight_api.engine.llm_interface uses a type in hindsight-api-slim.hindsight_api.engine.response_models.
hindsight-api-slim.hindsight_api.engine.llm_interface uses hindsight-api-slim.hindsight_api.engine.response_models, so a change to hindsight-api-slim.hindsight_api.engine.response_models can break hindsight-api-slim.hindsight_api.engine.llm_interface, while a change to hindsight-api-slim.hindsight_api.engine.llm_interface can't break hindsight-api-slim.hindsight_api.engine.response_models.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.llm_interface uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-api-slim.hindsight_api.engine.memories.base uses a type in hindsight-api-slim.hindsight_api.engine.response_models.
hindsight-api-slim.hindsight_api.engine.memories.base uses hindsight-api-slim.hindsight_api.engine.response_models, so a change to hindsight-api-slim.hindsight_api.engine.response_models can break hindsight-api-slim.hindsight_api.engine.memories.base, while a change to hindsight-api-slim.hindsight_api.engine.memories.base can't break hindsight-api-slim.hindsight_api.engine.response_models.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memories.base uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-api-slim.hindsight_api.engine.memories.base uses a type in hindsight-api-slim.hindsight_api.extensions.base.
hindsight-api-slim.hindsight_api.engine.memories.base uses hindsight-api-slim.hindsight_api.extensions.base, so a change to hindsight-api-slim.hindsight_api.extensions.base can break hindsight-api-slim.hindsight_api.engine.memories.base, while a change to hindsight-api-slim.hindsight_api.engine.memories.base can't break hindsight-api-slim.hindsight_api.extensions.base.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memories.base uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.engine.memory_engine uses hindsight-api-slim.hindsight_api.config, so a change to hindsight-api-slim.hindsight_api.config can break hindsight-api-slim.hindsight_api.engine.memory_engine, while a change to hindsight-api-slim.hindsight_api.engine.memory_engine can't break hindsight-api-slim.hindsight_api.config.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memory_engine uses a module listed above it, which is the healthy direction.
2 pairs of types, where a type in hindsight-api-slim.hindsight_api.engine.memory_engine uses a type in hindsight-api-slim.hindsight_api.engine.db.base.
hindsight-api-slim.hindsight_api.engine.memory_engine uses hindsight-api-slim.hindsight_api.engine.db.base, so a change to hindsight-api-slim.hindsight_api.engine.db.base can break hindsight-api-slim.hindsight_api.engine.memory_engine, while a change to hindsight-api-slim.hindsight_api.engine.memory_engine can't break hindsight-api-slim.hindsight_api.engine.db.base.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memory_engine uses a module listed above it, which is the healthy direction.
5 pairs of types, where a type in hindsight-api-slim.hindsight_api.engine.memory_engine uses a type in hindsight-api-slim.hindsight_api.engine.response_models.
hindsight-api-slim.hindsight_api.engine.memory_engine uses hindsight-api-slim.hindsight_api.engine.response_models, so a change to hindsight-api-slim.hindsight_api.engine.response_models can break hindsight-api-slim.hindsight_api.engine.memory_engine, while a change to hindsight-api-slim.hindsight_api.engine.memory_engine can't break hindsight-api-slim.hindsight_api.engine.response_models.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memory_engine uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-api-slim.hindsight_api.engine.retain uses a type in hindsight-api-slim.hindsight_api.engine.response_models.
hindsight-api-slim.hindsight_api.engine.retain uses hindsight-api-slim.hindsight_api.engine.response_models, so a change to hindsight-api-slim.hindsight_api.engine.response_models can break hindsight-api-slim.hindsight_api.engine.retain, while a change to hindsight-api-slim.hindsight_api.engine.retain can't break hindsight-api-slim.hindsight_api.engine.response_models.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.retain uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-api-slim.hindsight_api.engine.search uses a type in hindsight-api-slim.hindsight_api.engine.response_models.
hindsight-api-slim.hindsight_api.engine.search uses hindsight-api-slim.hindsight_api.engine.response_models, so a change to hindsight-api-slim.hindsight_api.engine.response_models can break hindsight-api-slim.hindsight_api.engine.search, while a change to hindsight-api-slim.hindsight_api.engine.search can't break hindsight-api-slim.hindsight_api.engine.response_models.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.search uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-clients.python.hindsight_client.hindsight_client uses a type in hindsight-clients.python.hindsight_client_api.api.banks_api.
hindsight-clients.python.hindsight_client.hindsight_client uses hindsight-clients.python.hindsight_client_api.api.banks_api, so a change to hindsight-clients.python.hindsight_client_api.api.banks_api can break hindsight-clients.python.hindsight_client.hindsight_client, while a change to hindsight-clients.python.hindsight_client.hindsight_client can't break hindsight-clients.python.hindsight_client_api.api.banks_api.
Position
Below the diagonal: hindsight-clients.python.hindsight_client.hindsight_client uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-clients.python.hindsight_client.hindsight_client uses a type in hindsight-clients.python.hindsight_client_api.api.documents_api.
hindsight-clients.python.hindsight_client.hindsight_client uses hindsight-clients.python.hindsight_client_api.api.documents_api, so a change to hindsight-clients.python.hindsight_client_api.api.documents_api can break hindsight-clients.python.hindsight_client.hindsight_client, while a change to hindsight-clients.python.hindsight_client.hindsight_client can't break hindsight-clients.python.hindsight_client_api.api.documents_api.
Position
Below the diagonal: hindsight-clients.python.hindsight_client.hindsight_client uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-clients.python.hindsight_client.hindsight_client uses a type in hindsight-clients.python.hindsight_client_api.api.knowledge_base_api.
hindsight-clients.python.hindsight_client.hindsight_client uses hindsight-clients.python.hindsight_client_api.api.knowledge_base_api, so a change to hindsight-clients.python.hindsight_client_api.api.knowledge_base_api can break hindsight-clients.python.hindsight_client.hindsight_client, while a change to hindsight-clients.python.hindsight_client.hindsight_client can't break hindsight-clients.python.hindsight_client_api.api.knowledge_base_api.
Position
Below the diagonal: hindsight-clients.python.hindsight_client.hindsight_client uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-clients.python.hindsight_client.hindsight_client uses a type in hindsight-clients.python.hindsight_client_api.api.memory_api.
hindsight-clients.python.hindsight_client.hindsight_client uses hindsight-clients.python.hindsight_client_api.api.memory_api, so a change to hindsight-clients.python.hindsight_client_api.api.memory_api can break hindsight-clients.python.hindsight_client.hindsight_client, while a change to hindsight-clients.python.hindsight_client.hindsight_client can't break hindsight-clients.python.hindsight_client_api.api.memory_api.
Position
Below the diagonal: hindsight-clients.python.hindsight_client.hindsight_client uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-clients.python.hindsight_client.hindsight_client uses a type in hindsight-clients.python.hindsight_client_api.api.mental_models_api.
hindsight-clients.python.hindsight_client.hindsight_client uses hindsight-clients.python.hindsight_client_api.api.mental_models_api, so a change to hindsight-clients.python.hindsight_client_api.api.mental_models_api can break hindsight-clients.python.hindsight_client.hindsight_client, while a change to hindsight-clients.python.hindsight_client.hindsight_client can't break hindsight-clients.python.hindsight_client_api.api.mental_models_api.
Position
Below the diagonal: hindsight-clients.python.hindsight_client.hindsight_client uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-clients.python.hindsight_client.hindsight_client uses a type in hindsight-clients.python.hindsight_client_api.api.pages_api.
hindsight-clients.python.hindsight_client.hindsight_client uses hindsight-clients.python.hindsight_client_api.api.pages_api, so a change to hindsight-clients.python.hindsight_client_api.api.pages_api can break hindsight-clients.python.hindsight_client.hindsight_client, while a change to hindsight-clients.python.hindsight_client.hindsight_client can't break hindsight-clients.python.hindsight_client_api.api.pages_api.
Position
Below the diagonal: hindsight-clients.python.hindsight_client.hindsight_client uses a module listed above it, which is the healthy direction.
hindsight-control-plane.src.lib.api uses hindsight-control-plane.src.components.mental-models-view, so a change to hindsight-control-plane.src.components.mental-models-view can break hindsight-control-plane.src.lib.api, while a change to hindsight-control-plane.src.lib.api can't break hindsight-control-plane.src.components.mental-models-view.
Position
Below the diagonal: hindsight-control-plane.src.lib.api uses a module listed above it, which is the healthy direction.
hindsight-integrations.ai-sdk.src.tools uses hindsight-control-plane.src.components.mental-models-view, so a change to hindsight-control-plane.src.components.mental-models-view can break hindsight-integrations.ai-sdk.src.tools, while a change to hindsight-integrations.ai-sdk.src.tools can't break hindsight-control-plane.src.components.mental-models-view.
Position
Below the diagonal: hindsight-integrations.ai-sdk.src.tools uses a module listed above it, which is the healthy direction.
26→32 hindsight-integrations.ai-sdk.src.tools uses hindsight-clients.typescript.srcpart of a loop✕
Connections
1 pair of types, where a type in hindsight-integrations.ai-sdk.src.tools uses a type in hindsight-clients.typescript.src.
hindsight-integrations.ai-sdk.src.tools uses hindsight-clients.typescript.src, so a change to hindsight-clients.typescript.src can break hindsight-integrations.ai-sdk.src.tools, while a change to hindsight-integrations.ai-sdk.src.tools can't break hindsight-clients.typescript.src.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
hindsight-api-slim.hindsight_api uses hindsight-api-slim.hindsight_api.config, so a change to hindsight-api-slim.hindsight_api.config can break hindsight-api-slim.hindsight_api, while a change to hindsight-api-slim.hindsight_api can't break hindsight-api-slim.hindsight_api.config.
Position
Below the diagonal: hindsight-api-slim.hindsight_api uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api uses hindsight-api-slim.hindsight_api.engine.memory_engine, so a change to hindsight-api-slim.hindsight_api.engine.memory_engine can break hindsight-api-slim.hindsight_api, while a change to hindsight-api-slim.hindsight_api can't break hindsight-api-slim.hindsight_api.engine.memory_engine.
Position
Below the diagonal: hindsight-api-slim.hindsight_api uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.engine.memories.pg uses hindsight-api-slim.hindsight_api.engine.db.base, so a change to hindsight-api-slim.hindsight_api.engine.db.base can break hindsight-api-slim.hindsight_api.engine.memories.pg, while a change to hindsight-api-slim.hindsight_api.engine.memories.pg can't break hindsight-api-slim.hindsight_api.engine.db.base.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memories.pg uses a module listed above it, which is the healthy direction.
14 pairs of types, where a type in hindsight-api-slim.hindsight_api.engine.memories.pg uses a type in hindsight-api-slim.hindsight_api.engine.memories.base.
hindsight-api-slim.hindsight_api.engine.memories.pg uses hindsight-api-slim.hindsight_api.engine.memories.base, so a change to hindsight-api-slim.hindsight_api.engine.memories.base can break hindsight-api-slim.hindsight_api.engine.memories.pg, while a change to hindsight-api-slim.hindsight_api.engine.memories.pg can't break hindsight-api-slim.hindsight_api.engine.memories.base.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memories.pg uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-api-slim.hindsight_api.engine.memories.postgres uses a type in hindsight-api-slim.hindsight_api.engine.response_models.
hindsight-api-slim.hindsight_api.engine.memories.postgres uses hindsight-api-slim.hindsight_api.engine.response_models, so a change to hindsight-api-slim.hindsight_api.engine.response_models can break hindsight-api-slim.hindsight_api.engine.memories.postgres, while a change to hindsight-api-slim.hindsight_api.engine.memories.postgres can't break hindsight-api-slim.hindsight_api.engine.response_models.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memories.postgres uses a module listed above it, which is the healthy direction.
15 pairs of types, where a type in hindsight-api-slim.hindsight_api.engine.memories.postgres uses a type in hindsight-api-slim.hindsight_api.engine.memories.base.
hindsight-api-slim.hindsight_api.engine.memories.postgres uses hindsight-api-slim.hindsight_api.engine.memories.base, so a change to hindsight-api-slim.hindsight_api.engine.memories.base can break hindsight-api-slim.hindsight_api.engine.memories.postgres, while a change to hindsight-api-slim.hindsight_api.engine.memories.postgres can't break hindsight-api-slim.hindsight_api.engine.memories.base.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.memories.postgres uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in hindsight-api-slim.hindsight_api.engine.providers uses a type in hindsight-api-slim.hindsight_api.engine.response_models.
hindsight-api-slim.hindsight_api.engine.providers uses hindsight-api-slim.hindsight_api.engine.response_models, so a change to hindsight-api-slim.hindsight_api.engine.response_models can break hindsight-api-slim.hindsight_api.engine.providers, while a change to hindsight-api-slim.hindsight_api.engine.providers can't break hindsight-api-slim.hindsight_api.engine.response_models.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.providers uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-api-slim.hindsight_api.engine.providers uses a type in hindsight-api-slim.hindsight_api.engine.llm_interface.
hindsight-api-slim.hindsight_api.engine.providers uses hindsight-api-slim.hindsight_api.engine.llm_interface, so a change to hindsight-api-slim.hindsight_api.engine.llm_interface can break hindsight-api-slim.hindsight_api.engine.providers, while a change to hindsight-api-slim.hindsight_api.engine.providers can't break hindsight-api-slim.hindsight_api.engine.llm_interface.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine.providers uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in hindsight-api-slim.hindsight_api.knowledge.service uses a type in hindsight-api-slim.hindsight_api.engine.memory_engine.
hindsight-api-slim.hindsight_api.knowledge.service uses hindsight-api-slim.hindsight_api.engine.memory_engine, so a change to hindsight-api-slim.hindsight_api.engine.memory_engine can break hindsight-api-slim.hindsight_api.knowledge.service, while a change to hindsight-api-slim.hindsight_api.knowledge.service can't break hindsight-api-slim.hindsight_api.engine.memory_engine.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.knowledge.service uses a module listed above it, which is the healthy direction.
hindsight-clients.typescript.src uses hindsight-control-plane.src.components.mental-models-view, so a change to hindsight-control-plane.src.components.mental-models-view can break hindsight-clients.typescript.src, while a change to hindsight-clients.typescript.src can't break hindsight-control-plane.src.components.mental-models-view.
Position
Below the diagonal: hindsight-clients.typescript.src uses a module listed above it, which is the healthy direction.
hindsight-clients.typescript.src uses hindsight-control-plane.src.lib.api, so a change to hindsight-control-plane.src.lib.api can break hindsight-clients.typescript.src, while a change to hindsight-clients.typescript.src can't break hindsight-control-plane.src.lib.api.
Position
Below the diagonal: hindsight-clients.typescript.src uses a module listed above it, which is the healthy direction.
hindsight-clients.typescript.src uses hindsight-integrations.ai-sdk.src.tools, so a change to hindsight-integrations.ai-sdk.src.tools can break hindsight-clients.typescript.src, while a change to hindsight-clients.typescript.src can't break hindsight-integrations.ai-sdk.src.tools.
Position
Below the diagonal: hindsight-clients.typescript.src uses a module listed above it, which is the healthy direction.
hindsight-control-plane.src.components uses hindsight-control-plane.src.components.page-search-result, so a change to hindsight-control-plane.src.components.page-search-result can break hindsight-control-plane.src.components, while a change to hindsight-control-plane.src.components can't break hindsight-control-plane.src.components.page-search-result.
Position
Below the diagonal: hindsight-control-plane.src.components uses a module listed above it, which is the healthy direction.
hindsight-control-plane.src.components uses hindsight-control-plane.src.lib.api, so a change to hindsight-control-plane.src.lib.api can break hindsight-control-plane.src.components, while a change to hindsight-control-plane.src.components can't break hindsight-control-plane.src.lib.api.
Position
Below the diagonal: hindsight-control-plane.src.components uses a module listed above it, which is the healthy direction.
hindsight-control-plane.src.lib uses hindsight-control-plane.src.components.mental-models-view, so a change to hindsight-control-plane.src.components.mental-models-view can break hindsight-control-plane.src.lib, while a change to hindsight-control-plane.src.lib can't break hindsight-control-plane.src.components.mental-models-view.
Position
Below the diagonal: hindsight-control-plane.src.lib uses a module listed above it, which is the healthy direction.
hindsight-control-plane.src.lib uses hindsight-control-plane.src.lib.observations-config, so a change to hindsight-control-plane.src.lib.observations-config can break hindsight-control-plane.src.lib, while a change to hindsight-control-plane.src.lib can't break hindsight-control-plane.src.lib.observations-config.
Position
Below the diagonal: hindsight-control-plane.src.lib uses a module listed above it, which is the healthy direction.
hindsight-control-plane.src.lib uses hindsight-control-plane.src.lib.api, so a change to hindsight-control-plane.src.lib.api can break hindsight-control-plane.src.lib, while a change to hindsight-control-plane.src.lib can't break hindsight-control-plane.src.lib.api.
Position
Below the diagonal: hindsight-control-plane.src.lib uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.engine uses hindsight-api-slim.hindsight_api.config, so a change to hindsight-api-slim.hindsight_api.config can break hindsight-api-slim.hindsight_api.engine, while a change to hindsight-api-slim.hindsight_api.engine can't break hindsight-api-slim.hindsight_api.config.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.engine uses hindsight-api-slim.hindsight_api.engine.db.base, so a change to hindsight-api-slim.hindsight_api.engine.db.base can break hindsight-api-slim.hindsight_api.engine, while a change to hindsight-api-slim.hindsight_api.engine can't break hindsight-api-slim.hindsight_api.engine.db.base.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.engine uses hindsight-api-slim.hindsight_api.engine.llm_interface, so a change to hindsight-api-slim.hindsight_api.engine.llm_interface can break hindsight-api-slim.hindsight_api.engine, while a change to hindsight-api-slim.hindsight_api.engine can't break hindsight-api-slim.hindsight_api.engine.llm_interface.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.engine uses hindsight-api-slim.hindsight_api.engine.memories.base, so a change to hindsight-api-slim.hindsight_api.engine.memories.base can break hindsight-api-slim.hindsight_api.engine, while a change to hindsight-api-slim.hindsight_api.engine can't break hindsight-api-slim.hindsight_api.engine.memories.base.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.engine uses hindsight-api-slim.hindsight_api.engine.memory_engine, so a change to hindsight-api-slim.hindsight_api.engine.memory_engine can break hindsight-api-slim.hindsight_api.engine, while a change to hindsight-api-slim.hindsight_api.engine can't break hindsight-api-slim.hindsight_api.engine.memory_engine.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.engine uses hindsight-api-slim.hindsight_api.engine.memories.postgres, so a change to hindsight-api-slim.hindsight_api.engine.memories.postgres can break hindsight-api-slim.hindsight_api.engine, while a change to hindsight-api-slim.hindsight_api.engine can't break hindsight-api-slim.hindsight_api.engine.memories.postgres.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.engine uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.knowledge uses hindsight-api-slim.hindsight_api.engine.memory_engine, so a change to hindsight-api-slim.hindsight_api.engine.memory_engine can break hindsight-api-slim.hindsight_api.knowledge, while a change to hindsight-api-slim.hindsight_api.knowledge can't break hindsight-api-slim.hindsight_api.engine.memory_engine.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.knowledge uses a module listed above it, which is the healthy direction.
hindsight-api-slim.hindsight_api.knowledge uses hindsight-api-slim.hindsight_api.knowledge.service, so a change to hindsight-api-slim.hindsight_api.knowledge.service can break hindsight-api-slim.hindsight_api.knowledge, while a change to hindsight-api-slim.hindsight_api.knowledge can't break hindsight-api-slim.hindsight_api.knowledge.service.
Position
Below the diagonal: hindsight-api-slim.hindsight_api.knowledge uses a module listed above it, which is the healthy direction.
hindsight-integrations.chat.src.types uses hindsight-control-plane.src.components.mental-models-view, so a change to hindsight-control-plane.src.components.mental-models-view can break hindsight-integrations.chat.src.types, while a change to hindsight-integrations.chat.src.types can't break hindsight-control-plane.src.components.mental-models-view.
Position
Below the diagonal: hindsight-integrations.chat.src.types uses a module listed above it, which is the healthy direction.
hindsight-integrations.chat.src.types uses hindsight-integrations.ai-sdk.src.tools, so a change to hindsight-integrations.ai-sdk.src.tools can break hindsight-integrations.chat.src.types, while a change to hindsight-integrations.chat.src.types can't break hindsight-integrations.ai-sdk.src.tools.
Position
Below the diagonal: hindsight-integrations.chat.src.types uses a module listed above it, which is the healthy direction.
hindsight-integrations.chat.src.types uses hindsight-clients.typescript.src, so a change to hindsight-clients.typescript.src can break hindsight-integrations.chat.src.types, while a change to hindsight-integrations.chat.src.types can't break hindsight-clients.typescript.src.
Position
Below the diagonal: hindsight-integrations.chat.src.types uses a module listed above it, which is the healthy direction.
hindsight-integrations.coding-agents.src uses hindsight-clients.typescript.src, so a change to hindsight-clients.typescript.src can break hindsight-integrations.coding-agents.src, while a change to hindsight-integrations.coding-agents.src can't break hindsight-clients.typescript.src.
Position
Below the diagonal: hindsight-integrations.coding-agents.src uses a module listed above it, which is the healthy direction.
hindsight-integrations.coding-agents.src.core uses hindsight-control-plane.src.lib.observations-config, so a change to hindsight-control-plane.src.lib.observations-config can break hindsight-integrations.coding-agents.src.core, while a change to hindsight-integrations.coding-agents.src.core can't break hindsight-control-plane.src.lib.observations-config.
Position
Below the diagonal: hindsight-integrations.coding-agents.src.core uses a module listed above it, which is the healthy direction.
hindsight-integrations.coding-agents.src.core uses hindsight-clients.typescript.src, so a change to hindsight-clients.typescript.src can break hindsight-integrations.coding-agents.src.core, while a change to hindsight-integrations.coding-agents.src.core can't break hindsight-clients.typescript.src.
Position
Below the diagonal: hindsight-integrations.coding-agents.src.core uses a module listed above it, which is the healthy direction.
hindsight-integrations.openclaw.src uses hindsight-integrations.ai-sdk.src.tools, so a change to hindsight-integrations.ai-sdk.src.tools can break hindsight-integrations.openclaw.src, while a change to hindsight-integrations.openclaw.src can't break hindsight-integrations.ai-sdk.src.tools.
Position
Below the diagonal: hindsight-integrations.openclaw.src uses a module listed above it, which is the healthy direction.
hindsight-integrations.openclaw.src uses hindsight-clients.typescript.src, so a change to hindsight-clients.typescript.src can break hindsight-integrations.openclaw.src, while a change to hindsight-integrations.openclaw.src can't break hindsight-clients.typescript.src.
Position
Below the diagonal: hindsight-integrations.openclaw.src uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 50.3 · Adequate · gated by D1, D2, R10, X4 ·
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
525
High / Critical
A02:2025 — Security Misconfiguration
73
High / Critical
A03:2025 — Software Supply Chain Failures
63
High / Critical
A07:2025 — Authentication Failures
6
High / Critical
Roadmap
Top priorities: 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; Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies; Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Add a SAST step to CI running what this repository's stack ships: bandit, `semgrep --config=p/python`, or CodeQL's python pack — so a security regression fails the build instead of landing.
Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail.
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
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 — 527
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 — 2249
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 — 353
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 11
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 91 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 1.0, 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 — 91 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, 3109 of 3129 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.
D4 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 414 duplicated block group(s) on this row were found in the languages this pass could tokenize, and they do NOT cover all of this repository's production source: .go (71,006 lines, 16% of production source) went unread, because no language model this pass could load exposed a clone-unit token stream for those file kinds. Duplication in that source is UNMEASURED — its absence from the count above is a gap in this analyzer's language coverage, not a finding that the code is free of duplication.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: this repository's production source spans .ts, .tsx, .py, .go, and our analyzer cannot run the .py, .go test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 49.3% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 2,821 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 1,128 test source file(s) (.py, .go, .rs) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Python REDACTED/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its crate dependencies. Nothing was read about its Python dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
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 — 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. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — 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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — 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. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — 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. D22's deterministic call-shape rules are gated per language (docs/plans/deterministic-engine.md, P5; C# and each NeutralApiArms arm pass): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — 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 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.
D31 IaC & Container Security — 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. Docker/docker-compose/pg_search/Dockerfile carries no `FROM` instruction, so it declares no build stage and every REDACTED rule this engine owns — the runtime-hardening, key-material, mutable-clone, no-op-shim, build-context, trust-anchor, install-guard, setuid and world-writable-path rules — is outside its own premise there and returned nothing. That silence is deliberate and correct: with no base image there is no image to reason about. It is reported here because it is NOT the same fact as a clean file, and coverage is stated as 69 of 70 Infrastructure-as-Code manifest(s) fully judged rather than as 100%. The vendor scanners (trivy, checkov) do read these files and their findings above stand; only this engine's own stage-keyed rules are absent. No owner action: a build file with no FROM is a legitimate include fragment.
D32 Data Compliance (PII/GDPR) — 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. `hindsight-control-plane/src/components/data-view.tsx`, `hindsight-control-plane/src/lib/i18n/api-errors.ts`, `hindsight-control-plane/src/lib/observations-config.ts`, `hindsight-docs/docusaurus.config.ts`, `hindsight-integrations/coding-agents/src/core/config.ts`, … (+1 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
D41 Kernel & Syscall Confinement — 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. Helm/hindsight/templates/api-deployment.yaml:3, REDACTED:3, REDACTED:3, helm/hindsight/templates/tei-embedding-deployment.yaml:3, helm/hindsight/templates/tei-reranker-deployment.yaml:3, helm/hindsight/templates/worker-statefulset.yaml:3 did not read as a pod spec (a templated manifest such as Helm's that is not YAML until rendered, or a workload whose pod spec this check does not locate), so the seccomp/AppArmor profile in force there was not judged and no row about them can appear on this card.
AC1 Text alternatives — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 4 script file(s) building 91 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx, hindsight-docs/src/components/constellation/Constellation.tsx, hindsight-control-plane/src/lib/page-download.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 155 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 4 script file(s) building 91 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx, hindsight-docs/src/components/constellation/Constellation.tsx, hindsight-control-plane/src/lib/page-download.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 155 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 57 further occurrence(s) are not listed individually; the score already reflects all 97.
AC3 Page structure — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 4 script file(s) building 91 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx, hindsight-docs/src/components/constellation/Constellation.tsx, hindsight-control-plane/src/lib/page-download.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 155 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
AC4 Keyboard semantics — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 4 script file(s) building 91 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx, hindsight-docs/src/components/constellation/Constellation.tsx, hindsight-control-plane/src/lib/page-download.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 155 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
AC5 ARIA correctness — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 4 script file(s) building 91 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx, hindsight-docs/src/components/constellation/Constellation.tsx, hindsight-control-plane/src/lib/page-download.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 155 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
AC6 Visual & motion safety — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 4 script file(s) building 91 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx, hindsight-docs/src/components/constellation/Constellation.tsx, hindsight-control-plane/src/lib/page-download.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 155 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (REDACTED). compose up failed (exit 1 — a container did not start, exited, or never became healthy) — network hindsight-network declared as external, but could not be found; runtime evidence skipped.
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.
C2 Access Controls — 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 authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — 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 audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — 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 retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — 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 data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
GD1 Unfinished & placeholder code — not measured this run — 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, Scala, Rust and Java source only, and this repository's Go, 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, Scala and Rust source only, and this repository's Go, 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.
R10 Code Duplication — 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. 287 further occurrence(s) are not listed individually; the score already reflects all 327.
R2 Cyclomatic Complexity — 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. 184 further occurrence(s) are not listed individually; the score already reflects all 224.
R3 Large Files — 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. 12 further occurrence(s) are not listed individually; the score already reflects all 52.
R4 Test Coverage — 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. 151 further occurrence(s) are not listed individually; the score already reflects all 191.
X1 Async correctness — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 86 further occurrence(s) are not listed individually; the score already reflects all 126.
X12 Unreachable branch — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X13 Undrained process stream — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X17 Uncapped recursion over a caller-supplied document — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X2 Cancellation propagation — 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. 25 further occurrence(s) are not listed individually; the score already reflects all 65.
X21 Side-effecting pattern guard — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X23 Unguarded diagnostic materialisation — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X24 Document value interpolated into markup unescaped — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X25 Inert configuration knob — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X26 Unsynchronised callback handoff — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X27 Collection changed while being enumerated — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
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. 239 further occurrence(s) are not listed individually; the score already reflects all 279.
X4 Structured logging — 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. 870 further occurrence(s) are not listed individually; the score already reflects all 910.
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. 18 further occurrence(s) are not listed individually; the score already reflects all 58.
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.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
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.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
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.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D22 Internal API Consistency: API consistency compares the call shapes of members that play the same role on the exposed C# surface: whether the API suits its callers is not measured, and surfaces in other languages are not measured.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (REDACTED, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
308 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was chinese_temporal_periods.extract_chinese_period at 310. A further 1 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being history.importLocalHistory at 16 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: hindsight-integrations/coding-agents/src/core/history.ts (history.importLocalHistory at 16). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 294 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 240 down to 240 or less in Cyclomatic Complexity — start with chinese_temporal_periods.extract_chinese_period (cyclomatic 310). — Refactoring it lifts Cyclomatic Complexity from 3.6 to about 4.0/10.
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.
+ 474 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 16 bodies over 120 down to 120 or less in Cognitive Complexity — start with chinese_temporal_periods.extract_chinese_period (cognitive 419), constellation.Constellation (cognitive 362), MemoryEngine._search_with_retries (cognitive 357). — 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 16 together lifts Cognitive Complexity from 2.0 to about 3.0/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.7 / 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.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 83 FileTooLong finding(s) in God Classes — start with REDACTED (2), REDACTED (2), cli.py (2). — One of this dimension's main actionable groups (83 warning-level).
Resolve the 68 FunctionTooLong finding(s) in God Classes — start with bank-config-view.tsx (5), mental-models-view.tsx (4), mental-model-detail-modal.tsx (3). — One of this dimension's main actionable groups (68 warning-level).
Resolve the 16 TooManyMethods finding(s) in God Classes — start with memory_engine.py, base.py, postgres.py. — One of this dimension's main actionable groups (16 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
414 duplicated block group(s) detected. 4.4 % of the production lines (20,070 of 454,011) are in a reported copy. A further 180 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 8 of the 594 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. Measured on part of this repository only: .go (16% of production source) was not exposed to the token comparison, so duplication there is unmeasured and is not in this count.
+ 261 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 26 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with http.py (3), chinese_temporal_periods.py (3), cli.py (2). — One of this dimension's main actionable groups (26 warning-level).
Resolve the 22 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with tools.py (3), REDACTED (3), chinese_temporal_periods.py (2). — One of this dimension's main actionable groups (22 warning-level).
Resolve the 17 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with mcp_tools.py (4), chinese_temporal_periods.py (2), config.py (2). — One of this dimension's main actionable groups (17 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling9.6 / 10Stronggated by 3 serious findings✓ 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.
64 production modules (Cargo+npm+Go+Python+Deno), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 3 module(s) off the main sequence, with abstractness counted on 56 of the 64 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
Off the main sequence: hindsight-client (Python) · ×3
What to do
Resolve the 3 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 2 Low cohesion finding(s) in Cohesion (LCOM4) — start with base.py, configuration.py. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
Detailed fixes: d7_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Stronggated by 5 serious findings✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
12 skipped (10 with a documented reason), 2 zero-assertion, 1 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 2821 tests. Measured on the JavaScript/TypeScript suite only — at least 1,128 test source file(s) (.py, .go, .rs) went unread, so its test quality is unmeasured and is not in these counts.
Skipped test: set HINDSIGHT_DCODE_E2E=1 with dcode installed to run the isolated CLI smoke test · ×2hindsight-integrations/coding-agents/src/dcode-plugin.e2e.test.ts:59
No assertions: omits tags when none are given and includes context/timestamp when present · ×2hindsight-integrations/zapier/test/creates.test.js:31
Fixed-sleep synchronisation: waits for an in-flight write-back, and gives up after its boundhindsight-integrations/coding-agents/src/core/runtime.test.ts:394
Mock-dominated test: waits for the shared SessionStart decision before the first reflect · ×34hindsight-integrations/coding-agents/src/cline.test.ts:36
Resolve the 2 Skipped test finding(s) in Test Quality — start with dcode-plugin.e2e.test.ts, harness.e2e.test.ts. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 No assertions finding(s) in Test Quality — start with creates.test.js, docs-freshness.test.ts. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 Fixed-sleep synchronisation finding(s) in Test Quality — start with runtime.test.ts. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.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.
0 flaky across 3 measured tier(s). JavaScript/TypeScript (vitest via `npm ci --ignore-scripts` in hindsight-all-npm/ (11 tests); jest via `npm ci --ignore-scripts` in hindsight-clients/typescript/ (151 tests); vitest via `npm ci --ignore-scripts` in hindsight-control-plane/ (424 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/ai-sdk/ (32 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/chat/ (28 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/cloudflare-oauth-proxy/ (50 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/coding-agents/ (1407 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/eliza/ (45 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/eve/ (59 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/flowise/ (18 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/n8n/ (23 tests); vitest via `npm ci --ignore-scripts` in hindsight-integrations/nemoclaw/ (36 tests)): measured (0 flaky); Python (43 distributions): measured (0 flaky); Go (github.com/vectorize-io/hindsight/hindsight-clients/go): measured (0 flaky).
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
0 outdated, 0 author-deprecated direct Go module(s), 0 pinning or checksum defect(s). Whether any of these modules is UNMAINTAINED is not graded — proxy.golang.org publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, not a registry one. Known CVEs in this module graph are D30's question, read from REDACTED and go.sum there.
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 278 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository commits no REDACTED, so its graph was resolved here: its manifests' `[dependencies]` and `[build-dependencies]` closed over the crates.io index, each crate at the newest release its requirement admits (what a fresh `cargo generate-lockfile` picks, not a graph the repository has pinned). Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under MIT, which is its own choice and is not judged here. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares a Python REDACTED/requirements.txt (pip/uv/Poetry) and package.json, and the licences of those dependency graphs were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: hindsight-api-slim/hindsight_api/engine/memory_engine.py (280×198=55440); hindsight-api-slim/hindsight_api/config.py (111×165=18315); hindsight-api-slim/hindsight_api/engine/reflect/agent.py (49×126=6174) Repeated repair below the complexity floor: hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py (15 of 23 changes were fixes); hindsight-api-slim/hindsight_api/engine/db/ops.py (12 of 15 changes were fixes); hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py (11 of 16 changes were fixes)
Resolve the 96 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (3), REDACTED (2), cli.py (2). — One of this dimension's main actionable groups (96 warning-level).
Resolve the 48 Repeated repair finding(s) in Churn × Complexity Hotspots — start with ops_postgresql.py, ops.py, ops_oracle.py. — One of this dimension's main actionable groups (48 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor7.3 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
203 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is hindsight-api-slim/hindsight_api/engine/memories/base.py. Counted over 780 of the 1695 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 · ×3
Further sole-owners (lower concentration)
What to do
Resolve the 3 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (3 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 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.
221 deducted task-comment markers across 454011 LoC (0.0/KLoC) → score 9.9. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
TodoComment repeated across 199 fileshindsight-clients/python/hindsight_client_api/models/add_background_request.py:46
TodoComment repeated across 14 fileshindsight-clients/python/hindsight_client_api/models/map_field_input.py:123
What to do
Resolve the 8 TodoComment finding(s) in Explicit Debt — start with index.tsx (6), api_client.py, test_oracle_http_integration.py. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 1 TodoComment repeated across 199 files finding(s) in Explicit Debt — start with add_background_request.py. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 TodoComment repeated across 14 files finding(s) in Explicit Debt — start with map_field_input.py. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
4 naming inconsistencies among 72 declarations measured against a convention their peers follow.
`BankLlmHealthResponse` spells `Llm` where 25 names in the project spell it `LLM`hindsight-api-slim/hindsight_api/api/http.py:3305
`BankLlmHealthInfo` spells `Llm` where 25 names in the project spell it `LLM`hindsight-api-slim/hindsight_api/engine/memory_engine.py:516
`ExtensionAPI` spells `API` where 43 names in the project spell it `Api`hindsight-integrations/coding-agents/src/harness/pi-extension.ts:81
`MoltbotPluginAPI` spells `API` where 43 names in the project spell it `Api`hindsight-integrations/openclaw/src/types.ts:12
What to do
Resolve the 1 `BankLlmHealthResponse` spells `Llm` where 25 names in the project spell… finding(s) in Naming Consistency — start with http.py. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `BankLlmHealthInfo` spells `Llm` where 25 names in the project spell it… finding(s) in Naming Consistency — start with memory_engine.py. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `ExtensionAPI` spells `API` where 43 names in the project spell it `Api` finding(s) in Naming Consistency — start with pi-extension.ts. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D22 · Internal API Consistency10.0 / 10Exemplary○ Nothing flagged
What it measures: Whether the internal API surface is consistent and coherent.
Method: Call-shape rules (A1-A9) over the structured code model of the intentionally exposed C# surface: members of one type, overloads of one name and the same slot across sibling types are compared, and a member that makes a caller use a different convention for the same kind of operation is flagged. Deterministic, no model. Advisory.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
5 of 64 build units (Cargo, Go, Python, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion · ×5REDACTED:1
What to do
Resolve the 5 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with package.json (3), REDACTED (2). — One of this dimension's main actionable groups (5 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
5 finding(s): 0 critical, 5 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
REDACTED
What to do
Resolve the 3 High secret finding(s) in Secrets (history) — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
Resolve the 2 REDACTED finding(s) in Secrets (history) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
525 finding(s): 0 critical, 448 high, 23 medium, 54 low. 391 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 42 file(s) — `REDACTED` (line 131), `REDACTED`, `helm/hindsight/templates/api-model-cache-pvc.yaml`, `helm/hindsight/templates/api-service.yaml`, `REDACTED`, … (+37 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 5 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 17 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 26 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (21), REDACTED (3), REDACTED. — One of this dimension's main actionable groups (26 issue-level).
Resolve the 14 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (14). — One of this dimension's main actionable groups (14 issue-level).
No action in Static Analysis (SAST) — all 391 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 (391 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.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 36 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (24), REDACTED (10), REDACTED. — One of this dimension's main actionable groups (36 warning-level).
Resolve the 10 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (8), REDACTED (2). — One of this dimension's main actionable groups (10 issue-level).
Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 45 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (30), REDACTED (6), REDACTED (4). — One of this dimension's main actionable groups (45 warning-level).
Resolve the 14 High IaC finding(s) in IaC & Container Security — start with REDACTED (6), REDACTED (4), REDACTED. — One of this dimension's main actionable groups (14 issue-level).
Resolve the 14 Low IaC finding(s) in IaC & Container Security — start with REDACTED (8), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (14 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
54 of 780 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is hindsight-integrations/superagent/hindsight_superagent/middleware.py. Counted over 780 of the 1695 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with middleware.py. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 53 Orphaned file finding(s) in Knowledge Freshness — start with config.py (13), tools.py (5), content.py (2). — One of this dimension's main actionable groups (53 recommendation-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 6 Change coupling finding(s) in Change Coupling — start with ops_oracle.py (2), retain-hook.ts, n9i0j1k2l3m4_learnings_and_pinned_reflections.py. — One of this dimension's main actionable groups (6 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 3 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 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 warning-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether Kubernetes workloads restrict network EGRESS with a NetworkPolicy (or Cilium policy), limiting where a compromised pod can send data or reach a command-and-control server. Presence of committed egress-restricting policy, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn — language-agnostic): Kubernetes workloads gate applicability; credits a NetworkPolicy / Cilium policy that restricts egress (policyTypes: [Egress] / egress rules). Reward-leaning (neutral floor climbing to 10, never a deduction — baseline misconfigs stay with D31). Deterministic.
What it measures: Whether Kubernetes workloads confine the kernel boundary — a seccomp profile (RuntimeDefault/Localhost) plus an AppArmor/SELinux mandatory-access-control layer — shrinking the syscall attack surface a container escape would use. Presence of committed confinement config, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a seccomp profile (RuntimeDefault/Localhost) and an AppArmor/SELinux MAC layer. Reward-leaning (neutral floor climbing to 10); NotApplicable without workloads. Deterministic.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 2 platform declaration(s) and 50 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives5.3 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. (×2) — hindsight-control-plane/src/components/constellation.tsx:1666, hindsight-docs/src/components/constellation/Constellation.tsx:1617
An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative. (×2) — hindsight-control-plane/src/components/constellation.tsx:1620, hindsight-docs/src/components/constellation/Constellation.tsx:1571
Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation). (×2) — hindsight-control-plane/src/components/knowledge-document-dialog.tsx:257, hindsight-control-plane/src/components/knowledge-passage.tsx:140
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels4.6 / 10Weak✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×8) — hindsight-control-plane/src/components/audit-logs-view.tsx:205, hindsight-control-plane/src/components/audit-logs-view.tsx:418, hindsight-control-plane/src/components/bank-config-view.tsx:1099, …
This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it. (×3) — hindsight-control-plane/src/components/audit-logs-view.tsx:392, hindsight-control-plane/src/components/audit-logs-view.tsx:405, hindsight-control-plane/src/components/bank-operations-view.tsx:624
This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×20) — hindsight-control-plane/src/components/bank-config-view.tsx:1814, hindsight-control-plane/src/components/bank-profile-view.tsx:318, hindsight-control-plane/src/components/bank-profile-view.tsx:670, …
This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed. (×7) — hindsight-control-plane/src/components/bank-config-view.tsx:2270, hindsight-control-plane/src/components/bank-config-view.tsx:2337, hindsight-control-plane/src/components/bank-profile-view.tsx:757, …
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). — hindsight-control-plane/src/components/bank-config-view.tsx:2385
This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — hindsight-control-plane/src/components/bank-profile-view.tsx:681
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
A page with no <title> gives no name in the tab, history or screen-reader page list. Declare it the way this router does — Next App Router `export const metadata = { title }`, React Router/Remix `export function meta`, TanStack Start `head`, or a Helmet/Head component. — hindsight-control-plane/src/app/[locale]/layout.tsx:66
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. (×2) — hindsight-control-plane/src/components/pages-view.tsx:833, hindsight-docs/src/pages/templates/index.tsx:240
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). — hindsight-control-plane/src/lib/page-download.tsx:104
An empty <title> gives no page name in the tab, history or screen-reader page list. Put descriptive text in the <title>. — hindsight-control-plane/src/lib/page-download.tsx:104
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×2) — hindsight-control-plane/src/lib/page-download.tsx:104, hindsight-docs/static/mental-model-refresh-flow.html:2
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}. (×12) — hindsight-control-plane/src/components/bank-config-view.tsx:1769, hindsight-control-plane/src/components/bank-config-view.tsx:2812, hindsight-control-plane/src/components/data-view.tsx:1524, …
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×5) — REDACTED:242, REDACTED:265, REDACTED:323, …
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
<input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2). (×3) — hindsight-control-plane/src/components/edit-memory-form.tsx:177, REDACTED:547, hindsight-control-plane/src/components/pages-view.tsx:559
This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade. — hindsight-control-plane/src/components/memory-defense-section.tsx:285
<div> moves — its inline style sets `transition: transform 0.35s ease` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — hindsight-docs/src/components/ImageCarousel.tsx:25
<button> moves — its inline style sets `transition: width 0.25s ease, background 0.25s ease` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — hindsight-docs/src/components/ImageCarousel.tsx:92
`.env-editor textarea` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — hindsight-embed/hindsight_embed/control_center/ui/src/style.css:148, hindsight-embed/hindsight_embed/control_center/static/assets/index-Bti1AEAP.css:1
`[class*="searchInput"]` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — hindsight-docs/src/css/custom.css:1397
`.hindsight-chat__sync-btn.is-syncing svg` moves (`animation: hindsight-spin 0.9s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-integrations/obsidian/styles.css:66
`.cardImage` moves (`transition: transform 0.4s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/theme/BlogListPage/styles.module.css:228
`.card` moves (`transition: box-shadow 0.2s ease, transform 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. (×2) — hindsight-docs/src/pages/templates/index.module.css:210, hindsight-docs/src/components/CookbookGrid.module.css:103
`.submitButton` moves (`transition: opacity 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. (×2) — hindsight-docs/src/pages/templates/index.module.css:565, hindsight-docs/src/pages/integrations/index.module.css:188
`.compactCard` moves (`transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/pages/integrations/index.module.css:300
`.navbar::after` moves (`animation: hindsight-scroll-progress linear both`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/css/custom.css:188
`div[class*="announcementBar"]::before` moves (`animation: shimmer 4s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/css/custom.css:1298
`.track` moves (`animation: scrollLeft 60s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/components/IntegrationsBanner.module.css:23
`.card` moves (`transition: border-color 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/components/ModelProviderSearch.module.css:102
`.summary::before` moves (`transition: transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/components/ProviderSetup.module.css:28
`.focusIn` moves (`animation: focusIn 0.6s ease forwards`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/components/ProviderSetup.module.css:59
`.play` moves (`transition: transform 0.15s ease,
box-shadow 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-docs/src/components/YouTubeVideo.module.css:47
`.animate-logo-tumble` moves (`animation: logo-tumble 1400ms cubic-bezier(0.4, -0.15, 0.3, 1.3) infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-control-plane/src/app/globals.css:476
`.animate-logo-flip` moves (`animation: logo-flip 1200ms cubic-bezier(0.45, 0, 0.25, 1) infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — hindsight-control-plane/src/app/globals.css:532
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`DataAccessOps` declares 39 abstract methods: `bulk_upsert_chunks`, `lock_document_for_write`, `insert_facts_batch`, `delete_unit_links`, `bulk_insert_links`, `bulk_insert_entities`, `fetch_missing_entity_ids`, `bulk_reassert_entities`, `bulk_insert_unit_entities`, `fetch_unit_dates`, `fetch_temporal_neighbors`, `build_entity_expansion_cte`, `build_semantic_causal_cte`, `expand_observations`, `build_tag_listing_parts`, `create_bank_vector_indexes`, `drop_bank_vector_indexes`, `get_entity_resolution_strategy`, `create_webhook`, `list_webhooks_for_bank`, `count_webhooks_for_bank`, `get_webhooks_for_dispatch`, `update_webhook`, `delete_webhook`, `list_webhook_deliveries`, `insert_webhook_delivery_task`, `enqueue_graph_maintenance`, `claim_graph_maintenance_batch`, `finish_graph_maintenance_batch`, `release_entity_postings`, `restore_entity_postings`, `claim_entity_maintenance_batch`, `prune_orphan_entities`, `prune_stale_cooccurrences`, `fetch_reconcilable_batch_parents`, `prune_terminal_operations`, `claim_tasks`, `fetch_foldable_retain_peers`, `mark_operations_processing`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — hindsight-api-slim/hindsight_api/engine/db/ops.py:338
`MemoryEngineInterface` declares 29 abstract methods: `health_check`, `retain_batch_async`, `recall_async`, `reflect_async`, `list_banks`, `get_bank_profile`, `ensure_bank_profile`, `get_bank_config`, `update_bank_config`, `reset_bank_config`, `update_bank_disposition`, `set_bank_mission`, `delete_bank`, `list_memory_units`, `get_graph_data`, `list_documents`, `get_document`, `delete_document`, `get_chunk`, `list_entities`, `get_bank_stats`, `get_bank_freshness`, `check_bank_llm`, `get_entity`, `list_operations`, `cancel_operation`, `delete_operation`, `update_bank`, `submit_async_retain`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — hindsight-api-slim/hindsight_api/engine/interface.py:37
`MemoriesExtension` declares 29 abstract methods: `insert_facts`, `delete_facts`, `delete_document`, `recall_unified`, `get_memories`, `scan_memories`, `count_memories`, `list_tags`, `find_unconsolidated`, `mark_consolidated`, `entity_memory_counts`, `entities_for_units`, `entity_map_for_units`, `resolve_entity_names`, `any_memory_updated_since`, `newest_memory_updated_at`, `list_memory_units`, `get_memory_unit`, `get_archived_memory`, `invalidate_memory`, `set_invalidation_reason`, `restore_memory`, `set_memory_embedding`, `list_entities`, `graph_units`, `graph_entity_rows`, `graph_direct_links`, `observations_for_sources`, `delete_stale_observations`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — hindsight-api-slim/hindsight_api/engine/memories/base.py:1135
`SQLDialect` declares 26 abstract methods: `param`, `cast`, `vector_distance`, `vector_similarity`, `json_extract_text`, `json_contains`, `json_merge`, `text_search_score`, `text_search_order`, `similarity`, `upsert`, `bulk_unnest`, `limit_offset`, `returning`, `ilike`, `array_any`, `array_all`, `array_contains`, `for_update_skip_locked`, `generate_uuid`, `greatest`, `current_timestamp`, `array_agg`, `build_semantic_arm`, `build_bm25_arm`, `prepare_bm25_text`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — hindsight-api-slim/hindsight_api/engine/sql/base.py:29
`KnowledgeStore` declares 16 abstract methods: `ensure_ready`, `get_documents`, `put_documents`, `list_documents`, `set_statuses`, `stage_passages`, `replace_passages`, `list_passages`, `passage_ranges`, `delete_documents`, `delete_some_documents`, `media_keys`, `derived_documents`, `search`, `bank_stats`, `timeseries`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — hindsight-api-slim/hindsight_api/knowledge/store.py:213
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies — a domain aggregate fused to a persistence ORM (Django/SQLAlchemy) on its own declaration (active-record) couples the domain to infrastructure. The clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
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.
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 — `hindsight-docs/guides/2026-04-21-guide-building-multi-agent-systems-with-shared-memory.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 repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Only 37/53 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `hindsight-cli`, `hindsight-control-plane`, `hindsight-integrations/cursor` and 11 more.
`REDACTED` reports through `console.*` at line 138 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:138
`hindsight-integrations/coding-agents/src/core/config.ts` reports through `console.*` at line 702 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — hindsight-integrations/coding-agents/src/core/config.ts:702
`hindsight-integrations/coding-agents/src/core/config.ts` reports through `console.*` at line 856 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — hindsight-integrations/coding-agents/src/core/config.ts:856
`hindsight-integrations/coding-agents/src/core/template.ts` reports through `console.*` at line 22 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — hindsight-integrations/coding-agents/src/core/template.ts:22
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
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 9 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:4
`hindsight-all-npm/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — hindsight-all-npm/package.json:43
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.
Do you agree with this assessment?
P5 · DR & Backup7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
What to do
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`http.DefaultClient` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — hindsight-clients/go/client.go:95
`reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — hindsight-clients/rust/src/lib.rs:46
What to do
Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail.
Give every client a whole-request bound: `reqwest::Client::builder().timeout(Duration::from_secs(10))` (never `reqwest::get` or `Client::new()`, which have none), ureq's `timeout_global`, or wrap the call in `tokio::time::timeout`; add retry with back-off (`reqwest-retry`'s `RetryTransientMiddleware`, `backoff`) around dependencies that fail.
Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.
Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. 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.
`transfer_examples` is async and calls requests.delete — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs. — hindsight-docs/examples/api/memory-banks.py:115
`fs.readFileSync` in `loadContent` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — hindsight-docs/plugins/integration-changelogs/index.js:35, hindsight-docs/plugins/integration-changelogs/index.js:54
`fs.readdirSync` in `loadContent` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-docs/plugins/integration-changelogs/index.js:45
`fs.mkdirSync` in `postBuild` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-docs/plugins/renamed-docs/index.js:34
`fs.writeFileSync` in `postBuild` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-docs/plugins/renamed-docs/index.js:35
`existsSync` in `maybeAutoUpdate` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-integrations/coding-agents/src/core/auto-update.ts:389
`existsSync` in `runHook` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-integrations/coding-agents/src/core/hook.ts:493
`existsSync` in `handler` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-integrations/coding-agents/src/core/page-tools.ts:180
`execFileSync` in `gitSyncNote` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-integrations/coding-agents/src/core/session-start.ts:122
`writeFileSync` in `child.once("spawn")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-integrations/coding-agents/src/core/survey.ts:460
`readFileSync` in `read` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-integrations/coding-agents/src/harness/registry.ts:24
`existsSync` in `runCli` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — hindsight-integrations/openclaw/src/backfill.ts:438
What to do
Python: await the async equivalent (asyncio.sleep, an async HTTP client such as httpx.AsyncClient or aiohttp, asyncio.create_subprocess_exec), or move the blocking call off the loop with `await asyncio.to_thread(...)`; never call asyncio.run inside a coroutine — await the coroutine.
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety9.4 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
Do you agree with this assessment?
R10 · Code Duplication3.9 / 10Weak✓ Tool-verified
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
29 duplicated blocks under hindsight-control-plane/src/app/api/ have copies in at least two of the sibling directories auth, banks, documents, entities, files, graph (+9 more sibling(s) not listed) — 23 of them are reported below, and 6 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 29 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 29 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 29 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — hindsight-control-plane/src/app/api/banks/[bankId]/mental-models/[mentalModelId]/history/route.ts:24
19 duplicated blocks under hindsight-control-plane/src/ have copies in at least two of the sibling directories app, components, lib — 10 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 19 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 19 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 19 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — hindsight-control-plane/src/components/mental-models-view.tsx:90
16 duplicated blocks under hindsight-control-plane/src/app/api/banks/[bankId]/ have copies in at least two of the sibling directories aliases, attachments, audit-logs, clone, consolidate, consolidation-recover (+11 more sibling(s) not listed) — 13 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 16 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — hindsight-control-plane/src/app/api/banks/[bankId]/directives/route.ts:5
7 duplicated blocks under the repository root have copies in at least two of the sibling directories hindsight-all-npm, hindsight-clients, hindsight-control-plane, hindsight-docs, hindsight-integrations — 2 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 7 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — hindsight-control-plane/src/components/constellation.tsx:3
7 of the duplicated blocks reported below have copies in at least two of the sibling directories ai-sdk, chat, coding-agents, eliza, eve, obsidian (+2 more sibling(s) not listed) under hindsight-integrations/. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — hindsight-integrations/ai-sdk/src/tools/index.ts:14
5 duplicated blocks under hindsight-docs/src/ have copies in at least two of the sibling directories components, data, pages, theme — 2 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 5 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — hindsight-docs/src/components/ModelProviderSearch.tsx:88
hindsight-control-plane/src/components/constellation.tsx:3 · hindsight-docs/src/components/constellation/Constellation.tsx:1 — these 2 files are line-for-line copies of one another — 1076 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — hindsight-control-plane/src/components/constellation.tsx:3
hindsight-control-plane/src/components/webhooks-view.tsx:693 · hindsight-control-plane/src/components/webhooks-view.tsx:884 — the two spans are one implementation copied and then locally edited — 857 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-control-plane/src/components/webhooks-view.tsx:693
hindsight-control-plane/src/components/mental-models-view.tsx:776 · hindsight-control-plane/src/components/mental-models-view.tsx:957 — the two spans are one implementation copied and then locally edited — 770 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-control-plane/src/components/mental-models-view.tsx:776
hindsight-control-plane/src/components/bank-stats-view.tsx:1075 · hindsight-control-plane/src/components/knowledge-bank-home.tsx:121 — the two spans are one implementation copied and then locally edited — 567 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-control-plane/src/components/bank-stats-view.tsx:1075
hindsight-integrations/ai-sdk/src/tools/index.ts:14 · hindsight-integrations/chat/src/types.ts:9 — the two spans are one implementation copied and then locally edited — 368 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-integrations/ai-sdk/src/tools/index.ts:14
hindsight-control-plane/src/components/memory-detail-modal.tsx:322 · hindsight-control-plane/src/components/memory-detail-modal.tsx:633 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — hindsight-control-plane/src/components/memory-detail-modal.tsx:322
hindsight-control-plane/src/components/knowledge-banks-list.tsx:316 · hindsight-control-plane/src/components/knowledge-documents-view.tsx:430 — the two spans are one implementation copied and then locally edited — 381 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-control-plane/src/components/knowledge-banks-list.tsx:316
hindsight-control-plane/src/components/mental-model-diagnostics-view.tsx:44 · hindsight-control-plane/src/components/think-view.tsx:614 — the two spans are one implementation copied and then locally edited — 323 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-control-plane/src/components/mental-model-diagnostics-view.tsx:44
hindsight-docs/src/pages/integrations/index.tsx:167 · hindsight-docs/src/pages/templates/index.tsx:170 — the two spans are one implementation copied and then locally edited — 402 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-docs/src/pages/integrations/index.tsx:167
hindsight-control-plane/src/components/data-view.tsx:1129 · hindsight-control-plane/src/components/mental-models-view.tsx:503 — the 2 copies are spread across 2 files, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — hindsight-control-plane/src/components/data-view.tsx:1129
hindsight-control-plane/src/components/ui/alert-dialog.tsx:9 · hindsight-control-plane/src/components/ui/dialog.tsx:11 — the two spans are one implementation copied and then locally edited — 317 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-control-plane/src/components/ui/alert-dialog.tsx:9
hindsight-control-plane/src/components/entities-view.tsx:399 · hindsight-control-plane/src/components/webhooks-view.tsx:635 — the 2 copies are spread across 2 files, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — hindsight-control-plane/src/components/entities-view.tsx:399
hindsight-control-plane/src/components/documents-view.tsx:1869 · hindsight-control-plane/src/components/entities-view.tsx:402 · hindsight-control-plane/src/components/ui/pagination.tsx:31 · hindsight-control-plane/src/components/webhooks-view.tsx:638 — the 4 copies are spread across 4 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — hindsight-control-plane/src/components/documents-view.tsx:1869
hindsight-integrations/chat/src/types.ts:4 · hindsight-integrations/eliza/src/client.ts:10 — the two spans are one implementation copied and then locally edited — 243 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-integrations/chat/src/types.ts:4
hindsight-integrations/coding-agents/src/installer.ts:601 · hindsight-integrations/coding-agents/src/installer.ts:1833 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — hindsight-integrations/coding-agents/src/installer.ts:601
hindsight-control-plane/src/app/api/banks/[bankId]/directives/route.ts:5 · hindsight-control-plane/src/app/api/banks/[bankId]/mental-models/route.ts:5 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — hindsight-control-plane/src/app/api/banks/[bankId]/directives/route.ts:5
hindsight-control-plane/src/components/bank-config-view.tsx:1144 · hindsight-control-plane/src/components/bank-config-view.tsx:1261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — hindsight-control-plane/src/components/bank-config-view.tsx:1144
hindsight-integrations/eve/src/client.ts:14 · hindsight-integrations/paperclip/src/client.ts:9 — the two spans are one implementation copied and then locally edited — 280 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-integrations/eve/src/client.ts:14
hindsight-control-plane/src/app/api/memories/[memoryId]/history/route.ts:5 · hindsight-control-plane/src/app/api/memories/[memoryId]/route.ts:5 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — hindsight-control-plane/src/app/api/memories/[memoryId]/history/route.ts:5
hindsight-control-plane/src/components/memory-detail-modal.tsx:104 · hindsight-control-plane/src/components/mental-model-detail-modal.tsx:862 — the two spans are one implementation copied and then locally edited — 250 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-control-plane/src/components/memory-detail-modal.tsx:104
hindsight-control-plane/src/app/api/banks/[bankId]/aliases/route.ts:43 · hindsight-control-plane/src/app/api/banks/[bankId]/directives/route.ts:63 · hindsight-control-plane/src/app/api/banks/[bankId]/mental-models/route.ts:71 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — hindsight-control-plane/src/app/api/banks/[bankId]/aliases/route.ts:43
hindsight-control-plane/src/app/api/banks/[bankId]/audit-logs/route.ts:5 · hindsight-control-plane/src/app/api/banks/[bankId]/audit-logs/stats/route.ts:5 · hindsight-control-plane/src/app/api/banks/[bankId]/llm-requests/route.ts:5 · hindsight-control-plane/src/app/api/banks/[bankId]/llm-requests/stats/route.ts:5 — the 4 copies are spread across 4 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — hindsight-control-plane/src/app/api/banks/[bankId]/audit-logs/route.ts:5
hindsight-control-plane/src/app/api/banks/[bankId]/route.ts:6 · hindsight-control-plane/src/app/api/banks/[bankId]/route.ts:43 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — hindsight-control-plane/src/app/api/banks/[bankId]/route.ts:6
hindsight-control-plane/src/components/search-debug-view.tsx:281 · hindsight-control-plane/src/components/think-view.tsx:203 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — hindsight-control-plane/src/components/search-debug-view.tsx:281
hindsight-control-plane/src/app/api/pages/folders/route.ts:5 · hindsight-control-plane/src/app/api/pages/route.ts:5 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — hindsight-control-plane/src/app/api/pages/folders/route.ts:5
hindsight-control-plane/src/components/audit-logs-view.tsx:481 · hindsight-control-plane/src/components/llm-requests-view.tsx:1283 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — hindsight-control-plane/src/components/audit-logs-view.tsx:481
hindsight-control-plane/src/app/api/banks/[bankId]/directives/[directiveId]/route.ts:58 · hindsight-control-plane/src/app/api/banks/[bankId]/mental-models/[mentalModelId]/route.ts:58 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — hindsight-control-plane/src/app/api/banks/[bankId]/directives/[directiveId]/route.ts:58
hindsight-control-plane/src/components/audit-logs-view.tsx:429 · hindsight-control-plane/src/components/llm-requests-view.tsx:1211 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — hindsight-control-plane/src/components/audit-logs-view.tsx:429
hindsight-control-plane/src/components/mental-models-view.tsx:90 · hindsight-control-plane/src/lib/api.ts:312 — the two spans are one implementation copied and then locally edited — 177 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-control-plane/src/components/mental-models-view.tsx:90
hindsight-control-plane/src/components/document-chunk-modal.tsx:112 · hindsight-control-plane/src/components/document-chunk-modal.tsx:177 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases. — hindsight-control-plane/src/components/document-chunk-modal.tsx:112
hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:160 · hindsight-integrations/coding-agents/src/core/transcript.ts:65 — the two spans are one implementation copied and then locally edited — 258 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:160
hindsight-control-plane/src/app/api/documents/chunks/route.ts:5 · hindsight-control-plane/src/app/api/documents/history/route.ts:5 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — hindsight-control-plane/src/app/api/documents/chunks/route.ts:5
hindsight-control-plane/src/components/data-view.tsx:810 · hindsight-control-plane/src/components/entities-view.tsx:278 · hindsight-control-plane/src/components/mental-models-view.tsx:356 — the 3 copies are spread across 3 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — hindsight-control-plane/src/components/data-view.tsx:810
hindsight-control-plane/src/components/search-debug-view.tsx:1030 · hindsight-control-plane/src/components/search-debug-view.tsx:1137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — hindsight-control-plane/src/components/search-debug-view.tsx:1030
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
hindsight-docs/src/theme/Navbar/Content/index.tsx:8 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — hindsight-docs/src/theme/Navbar/Content/index.tsx:8
hindsight-docs/src/theme/Navbar/Layout/index.tsx:4 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — hindsight-docs/src/theme/Navbar/Layout/index.tsx:4
hindsight-docs/src/theme/Navbar/MobileSidebar/Header/index.tsx:2 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — hindsight-docs/src/theme/Navbar/MobileSidebar/Header/index.tsx:2
hindsight-docs/src/theme/Navbar/MobileSidebar/Layout/index.tsx:3 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — hindsight-docs/src/theme/Navbar/MobileSidebar/Layout/index.tsx:3
hindsight-docs/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx:3 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — hindsight-docs/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx:3
hindsight-docs/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx:3 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — hindsight-docs/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx:3
hindsight-docs/src/theme/Navbar/MobileSidebar/Toggle/index.tsx:2 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — hindsight-docs/src/theme/Navbar/MobileSidebar/Toggle/index.tsx:2
hindsight-docs/src/theme/Navbar/MobileSidebar/index.tsx:2 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — hindsight-docs/src/theme/Navbar/MobileSidebar/index.tsx:2
What to do
Fix the listed violations: import through public entries (package exports / slice index), never reach into another layer or package's internals.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
(anonymous) has cyclomatic complexity 106 and cognitive complexity 185; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/constellation.tsx:590
(anonymous) has cyclomatic complexity 100 and cognitive complexity 179; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-docs/src/components/constellation/Constellation.tsx:592
DocumentsView has cyclomatic complexity 89 and cognitive complexity 81; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/documents-view.tsx:715
BankPage has cyclomatic complexity 83 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:104
(anonymous) has cyclomatic complexity 80 and cognitive complexity 97; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3023
(anonymous) has cyclomatic complexity 71 and cognitive complexity 79; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2726
DataView has cyclomatic complexity 65 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/data-view.tsx:115
MemoryDetailModal has cyclomatic complexity 64 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/memory-detail-modal.tsx:78
updateBankConfig has cyclomatic complexity 63 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-clients/typescript/src/index.ts:923
getPluginConfig has cyclomatic complexity 61 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2118
BankSelectorInner has cyclomatic complexity 57 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/bank-selector.tsx:129
ThinkView has cyclomatic complexity 54 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/think-view.tsx:72
BankOperationsView has cyclomatic complexity 52 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/bank-operations-view.tsx:143
buildSessionStartContext has cyclomatic complexity 47 and cognitive complexity 122; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/core/session-start.ts:170
resolveConfig has cyclomatic complexity 46 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/core/config.ts:589
PagesView has cyclomatic complexity 43 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/pages-view.tsx:101
updateTooltip has cyclomatic complexity 41 and cognitive complexity 66; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×2) — hindsight-control-plane/src/components/constellation.tsx:1242, hindsight-docs/src/components/constellation/Constellation.tsx:1199
buildHookOutput has cyclomatic complexity 39 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/core/hook.ts:233
resolveAndCacheIdentity has cyclomatic complexity 38 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1432
(anonymous) has cyclomatic complexity 37 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-docs/src/components/SkillBanner.tsx:38
BankConfigView has cyclomatic complexity 36 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/bank-config-view.tsx:467
SearchDebugView has cyclomatic complexity 36 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/search-debug-view.tsx:109
readPyValue has cyclomatic complexity 35 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/core/transcript-dcode.ts:49
ConfigurationTab has cyclomatic complexity 34 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/mental-model-detail-modal.tsx:1348
StalenessBadge has cyclomatic complexity 33 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/staleness-badge.tsx:42
writeSession has cyclomatic complexity 32 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/core/chat.ts:316
readCodexTranscript has cyclomatic complexity 31 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/core/transcript-codex.ts:195
SpanDetails has cyclomatic complexity 30 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/llm-requests-view.tsx:359
runCli has cyclomatic complexity 28 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/openclaw/src/backfill.ts:436
flushRetainQueue has cyclomatic complexity 28 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:418
getIdentitySkipReason has cyclomatic complexity 28 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1531
runHook has cyclomatic complexity 28 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/core/hook.ts:425
MentalModelDetailModal has cyclomatic complexity 28 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/mental-model-detail-modal.tsx:824
start has cyclomatic complexity 27 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2324
run has cyclomatic complexity 27 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/installer.ts:2421
ObservationTreeView has cyclomatic complexity 27 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:356
diffLines has cyclomatic complexity 26 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/components/mental-model-detail-modal.tsx:430
main has cyclomatic complexity 26 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-integrations/coding-agents/src/deepen.ts:114
fetchApi has cyclomatic complexity 26 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — hindsight-control-plane/src/lib/api.ts:521
Do you agree with this assessment?
R3 · Large Files5.9 / 10Adequate✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
REDACTED has 3590 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
hindsight-control-plane/src/components/bank-config-view.tsx has 3000 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/bank-config-view.tsx:1
hindsight-control-plane/src/lib/api.ts has 2672 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/lib/api.ts:1
hindsight-integrations/coding-agents/src/installer.ts has 2476 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/coding-agents/src/installer.ts:1
hindsight-control-plane/src/components/documents-view.tsx has 2339 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/documents-view.tsx:1
hindsight-clients/typescript/src/index.ts has 2183 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-clients/typescript/src/index.ts:1
hindsight-control-plane/src/components/bank-selector.tsx has 1778 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/bank-selector.tsx:1
hindsight-control-plane/src/components/constellation.tsx has 1669 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/constellation.tsx:1
hindsight-docs/src/components/constellation/Constellation.tsx has 1622 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-docs/src/components/constellation/Constellation.tsx:1
hindsight-control-plane/src/components/mental-model-detail-modal.tsx has 1548 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/mental-model-detail-modal.tsx:1
hindsight-control-plane/src/components/data-view.tsx has 1520 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/data-view.tsx:1
hindsight-control-plane/src/components/prompt-preview-dialog.tsx has 1274 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/prompt-preview-dialog.tsx:1
hindsight-control-plane/src/components/bank-stats-view.tsx has 1271 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/bank-stats-view.tsx:1
hindsight-control-plane/src/components/search-debug-view.tsx has 1269 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/search-debug-view.tsx:1
hindsight-control-plane/src/components/llm-requests-view.tsx has 1250 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/llm-requests-view.tsx:1
hindsight-integrations/coding-agents/src/core/hindsight.ts has 1233 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/coding-agents/src/core/hindsight.ts:1
hindsight-control-plane/src/components/mental-models-view.tsx has 1188 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/mental-models-view.tsx:1
hindsight-control-plane/src/components/pages-view.tsx has 1151 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/pages-view.tsx:1
hindsight-control-plane/src/components/webhooks-view.tsx has 1143 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/webhooks-view.tsx:1
hindsight-control-plane/src/components/bank-operations-view.tsx has 1115 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/bank-operations-view.tsx:1
hindsight-control-plane/src/components/think-view.tsx has 1015 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/think-view.tsx:1
hindsight-control-plane/src/components/bank-profile-view.tsx has 960 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/bank-profile-view.tsx:1
hindsight-integrations/coding-agents/src/core/config.ts has 932 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/coding-agents/src/core/config.ts:1
hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx has 923 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:1
hindsight-control-plane/src/components/memory-detail-modal.tsx has 855 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/memory-detail-modal.tsx:1
hindsight-integrations/coding-agents/src/harness/hook-lifecycle.ts has 782 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/coding-agents/src/harness/hook-lifecycle.ts:1
hindsight-integrations/coding-agents/src/core/missions.ts has 724 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/coding-agents/src/core/missions.ts:1
REDACTED has 669 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
hindsight-integrations/openclaw/src/backfill.ts has 631 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/openclaw/src/backfill.ts:1
hindsight-control-plane/src/components/mental-model-trigger-fields.tsx has 618 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/mental-model-trigger-fields.tsx:1
hindsight-control-plane/src/components/knowledge-documents-view.tsx has 611 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/knowledge-documents-view.tsx:1
hindsight-control-plane/src/components/audit-logs-view.tsx has 539 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/audit-logs-view.tsx:1
hindsight-integrations/openclaw/src/setup.ts has 519 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/openclaw/src/setup.ts:1
hindsight-control-plane/src/components/entities-view.tsx has 517 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/entities-view.tsx:1
hindsight-control-plane/src/components/knowledge-document-dialog.tsx has 509 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/knowledge-document-dialog.tsx:1
hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx has 502 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx:1
hindsight-control-plane/src/components/knowledge-write-dialogs.tsx has 498 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/knowledge-write-dialogs.tsx:1
hindsight-control-plane/src/components/banks-overview.tsx has 496 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-control-plane/src/components/banks-overview.tsx:1
hindsight-integrations/coding-agents/src/core/history.ts has 486 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/coding-agents/src/core/history.ts:1
hindsight-integrations/coding-agents/src/core/hook.ts has 482 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — hindsight-integrations/coding-agents/src/core/hook.ts:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage6.2 / 10Adequate✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×40) — hindsight-control-plane/src/components/documents-view.tsx:1, hindsight-control-plane/src/components/bank-selector.tsx:1, hindsight-docs/src/components/constellation/Constellation.tsx:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
55 outdated package(s); JS/npm CVEs scored in D30
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
The package in `hindsight-control-plane` declares the lint script `lint` (`eslint .`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `hindsight-control-plane` (or the workspace's task runner). — hindsight-control-plane/package.json:19
The package in `hindsight-integrations/n8n` declares the lint script `lint` (`eslint nodes credentials --ext .ts`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `hindsight-integrations/n8n` (or the workspace's task runner). — hindsight-integrations/n8n/package.json:24
Do you agree with this assessment?
R7 · Dead Code8.6 / 10Strong✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 246 application, 99 tooling and 268 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/MemoryConstellation.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — hindsight-docs/src/components/constellation/Constellation.tsx
no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×20) — hindsight-docs/src/components/SkillBanner.tsx, hindsight-docs/src/components/HomeFlow.tsx, hindsight-docs/src/components/CookbookGrid.tsx, …
no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/HomeFlow.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — hindsight-docs/src/components/CodingAgentsChart.tsx
no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/ModelProviderSearch.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it (×2) — hindsight-docs/src/data/modelProviders.ts, hindsight-docs/src/components/ProviderSetup.tsx
no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 4 in-repo import(s) from 4 other file(s) do name it (hindsight-docs/src/components/LLMProviderCapabilities.tsx, hindsight-docs/src/components/LLMProvidersTable.tsx, hindsight-docs/src/components/SupportedGrids.tsx and 1 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — hindsight-docs/src/data/llmProviders.tsx
no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/HomeHero.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it (×2) — hindsight-docs/src/components/MemoryConstellation.tsx, hindsight-docs/src/components/useGitHubStars.ts
no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/lib/integration-groups.ts) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — hindsight-docs/src/lib/coding-agent-harnesses.ts
no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/SupportedGrids.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — hindsight-docs/src/components/IconGrid.tsx
Nothing imports this binding — it is safe to review for removal. (×5) — hindsight-control-plane/src/i18n/navigation.ts:4, hindsight-control-plane/src/i18n/navigation.ts:4, hindsight-control-plane/src/i18n/navigation.ts:4, …
This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. — hindsight-control-plane/tests/lib/retain-strategy-config.test.ts:10
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
Imported but not declared in any reachable package.json — installs work only by hoisting accident. (×4) — hindsight-docs/src/theme/BlogListPage/index.tsx:8, hindsight-docs/plugins/dev-light/index.js:1, hindsight-docs/scripts/check-templates.mjs:13, …
Imported only as a TYPE and declared in no reachable package.json. The import is erased at compile time, so nothing is installed and no runtime resolution depends on it — but type-checking a clean clone will fail. Declare the typings it resolves through (or the package itself) in the owning package.json. — hindsight-docs/sidebars-integrations.ts:1
Declared in hindsight-integrations/coding-agents/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. — hindsight-integrations/coding-agents/package.json:102
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — Only what this repository's own non-C# files could be read for was assessed — and because this repository commits the configuration that serves its own HTTP surface, that configuration could be read in full for the security response headers it sets. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
Set: Content-Security-Policy, X-Content-Type-Options. Missing: Strict-Transport-Security, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each. (−1.0 on this card.) — docker/docker-compose/nginx/nginx.conf:21
What to do
Add Strict-Transport-Security, X-Frame-Options beside the headers already set; Content-Security-Policy is the one that pays for itself first, then Strict-Transport-Security, then nosniff and a frame policy.
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.
The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception. (×3) — hindsight-integrations/vapi/hindsight_vapi/webhook.py:199, hindsight-integrations/pipecat/hindsight_pipecat/memory.py:143, hindsight-clients/python/hindsight_client/hindsight_client.py:460
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?
X17 · Uncapped recursion over a caller-supplied document1.4 / 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.
`collectDocIds` is exported and takes `value: unknown` from its caller, and it calls itself at line 13 (`collectDocIds`) with a piece of `value` (and at line 17) — and nowhere in `collectDocIds` 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. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectDocIds` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-integrations/obsidian/src/reflect-util.ts:13
`schemaToFields` is exported, takes a document from its caller (line 171) and hands it to `schemaToNode`, which calls itself at line 159 (`schemaToNode`) with a piece of `prop` — and nowhere in `schemaToNode` 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. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `schemaToNode` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-control-plane/src/lib/response-schema.ts:159
`from_dict` is public and takes `obj: Optional[Dict[str, Any]]` from its caller, and it calls itself at line 115 (`self.from_dict`) with a piece of `obj` — and nowhere in `from_dict` 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 `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. (×2) — hindsight-clients/python/hindsight_client_api/models/map_field_input.py:115, hindsight-clients/python/hindsight_client_api/models/map_field_output.py:115
`from_dict` is public and takes `obj: Optional[Dict[str, Any]]` from its caller, and it calls itself at line 107 (`self.from_dict`) with a piece of `obj` — and nowhere in `from_dict` 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 `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-clients/python/hindsight_client_api/models/observation_tree_folder.py:107
`from_dict` is public and takes `obj: Optional[Dict[str, Any]]` from its caller, and it calls itself at line 160 (`self.from_dict`) with a piece of `obj` — and nowhere in `from_dict` 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 `from_dict` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-clients/python/hindsight_client_api/models/page_node.py:160
`sanitize_value` is public and takes `value: Any` from its caller, and it calls itself at line 308 (`sanitize_value`) with a piece of `value` (and at line 322, line 323, line 331) — and nowhere in `sanitize_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 `sanitize_value` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:308
`member_for_metadata` is public, takes a document from its caller (line 179) and hands it to `_metadata_matches`, which calls itself at line 79 (`_metadata_matches`) with a piece of `actual` — and nowhere in `_metadata_matches` 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 `_metadata_matches` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-api-slim/hindsight_api/engine/multi_llm.py:79
`resolve` is public and takes `value: Any` from its caller, and it calls itself at line 110 (`self.resolve`) with a piece of `value` (and at line 120) — and nowhere in `resolve` 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 `resolve` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-api-slim/hindsight_api/engine/reflect/presentation.py:110
`resolve` is public, takes a document from its caller (line 101) and hands it to `_resolve_prose`, which calls itself at line 138 (`self._resolve_prose`) with a piece of `value` (and at line 140) — and nowhere in `_resolve_prose` 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 `_resolve_prose` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-api-slim/hindsight_api/engine/reflect/presentation.py:138
`fingerprint` is public, takes a document from its caller (line 97) and hands it to `_strip_titles`, which calls itself at line 270 (`_strip_titles`) with a piece of `node` (and at line 273) — and nowhere in `_strip_titles` 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 `_strip_titles` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-api-slim/hindsight_api/engine/providers/gemini_cache.py:270
`__init__` is public, takes a document from its caller (line 178) and hands it to `_iter_models`, which calls itself at line 134 (`_iter_models`) with a piece of `annotation` — and nowhere in `_iter_models` 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 `_iter_models` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — hindsight-api-slim/hindsight_api/api/http.py:134
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 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 async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 19/83 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`fetchBankStats` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — hindsight-integrations/openclaw/src/backfill.ts:356
`patchBankConfig` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — hindsight-integrations/openclaw/src/bank-defaults.ts:123
`api` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — hindsight-embed/hindsight_embed/control_center/ui/src/api.js:24
`exportDocuments` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — hindsight-control-plane/src/lib/api.ts:2219
`importDocuments` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — hindsight-control-plane/src/lib/api.ts:2251
`uploadFiles` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — hindsight-control-plane/src/lib/api.ts:2284
`GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`. (×17) — hindsight-control-plane/src/app/api/stats/[agentId]/memories-timeseries/route.ts:5, hindsight-control-plane/src/app/api/pages/tree/route.ts:6, hindsight-control-plane/src/app/api/pages/search/route.ts:6, …
`POST` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`. (×8) — hindsight-control-plane/src/app/api/pages/route.ts:5, hindsight-control-plane/src/app/api/pages/folders/route.ts:5, hindsight-control-plane/src/app/api/files/retain/route.ts:5, …
`PATCH` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`. (×4) — hindsight-control-plane/src/app/api/pages/nodes/[nodeId]/route.ts:9, hindsight-control-plane/src/app/api/memories/[memoryId]/route.ts:59, hindsight-control-plane/src/app/api/documents/route.ts:71, …
`DELETE` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`. (×2) — hindsight-control-plane/src/app/api/pages/nodes/[nodeId]/route.ts:51, hindsight-control-plane/src/app/api/banks/[bankId]/webhooks/[webhookId]/route.ts:28
`POST` holds an AbortSignal but calls `retainBatch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `retainBatch(…, { signal })`. — hindsight-control-plane/src/app/api/memories/retain/route.ts:5
`forward` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`. — REDACTED:85
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
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 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 2043 is called with an argument built by `sum(len(t) for t in turns_to_retain)` (line 2047), 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. — REDACTED:2043
`debug` at line 424 is called with an argument built by `exposed.filter((schema) => schema.name?.startsWith("hindsight_"))` (line 427), whose cost grows with the collection it walks. JavaScript 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 `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — hindsight-integrations/coding-agents/src/dsh.ts:424
`debug` at line 67 is called with an argument built by `JSON.stringify(err)` (line 67), whose cost grows with the collection it walks. JavaScript 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 `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — hindsight-integrations/coding-agents/src/harness/plugin-entry.ts:67
`debug` at line 209 is called with an argument built by `list(configurable_tenant.keys())` (line 209), 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. — hindsight-api-slim/hindsight_api/config_resolver.py:209
`debug` at line 258 is called with an argument built by `list(bank_overrides.keys())` (line 258), 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. — hindsight-api-slim/hindsight_api/config_resolver.py:258
`debug` at line 1063 is called with an argument built by `list(filtered.keys())` (line 1063), 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. — hindsight-api-slim/hindsight_api/config_resolver.py:1063
`debug` at line 1659 is called with an argument built by `"…".join(log_buffer)` (line 1659), 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. — hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1659
`debug` at line 1799 is called with an argument built by `"…".join(log_buffer)` (line 1799), 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. — hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1799
What to do
Each finding names the diagnostic call and the expression inside its argument whose cost scales with a collection. Confirm from the two that the argument is built before the call — that is JavaScript's evaluation order, not a guess — then put the construction behind the level check the logger offers (`if (logger.isLevelEnabled('debug'))` for pino and winston, `isDebugEnabled()` for log4js, the repository's own debug flag where it has one), or hand the logger the object and a format string (`logger.debug({ payload }, 'raw request')`) so the serialising happens only when the line is written. Moving the call is not the fix: it is the join/projection/stringify in the argument that is paid, wherever the call sits. 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 unescaped5.4 / 10Adequate✓ Tool-verified
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.
`name` is text this program did not author, and it is written into the text of an element through Handlebars' raw `{{{ }}}` output with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — hindsight-cli/about.hbs:10
`text` is text this program did not author, and it is written into the text of an element through Handlebars' raw `{{{ }}}` output with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — hindsight-cli/about.hbs:15
`nodeColor` is text this program did not author, and it is written into a script or style context through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute. (×4) — hindsight-control-plane/src/components/constellation.tsx:1293, hindsight-control-plane/src/components/constellation.tsx:1345, hindsight-docs/src/components/constellation/Constellation.tsx:1247, …
`occurredDisplay` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — hindsight-control-plane/src/components/constellation.tsx:1315, hindsight-docs/src/components/constellation/Constellation.tsx:1269
`fmtTs(mentionedAt)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — hindsight-control-plane/src/components/constellation.tsx:1319, hindsight-docs/src/components/constellation/Constellation.tsx:1273
`proofCount` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — hindsight-control-plane/src/components/constellation.tsx:1323, hindsight-docs/src/components/constellation/Constellation.tsx:1277
`node.id` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. (×2) — hindsight-control-plane/src/components/constellation.tsx:1351, hindsight-docs/src/components/constellation/Constellation.tsx:1305
`location.origin` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — hindsight-control-plane/src/lib/page-download.tsx:104
`fullText` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — hindsight-docs/src/components/constellation/Constellation.tsx:1252
`context` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — hindsight-docs/src/components/constellation/Constellation.tsx:1258
`String(documentId).slice(0,12)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — hindsight-docs/src/components/constellation/Constellation.tsx:1281
`ent` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — hindsight-docs/src/components/constellation/Constellation.tsx:1290
What to do
Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
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.
`buildSessionStartContext` accepts `args.stateDir` from the caller and keeps it in `stateDir` on line 189, where only it can read the value — but nothing ever reads `stateDir`. Setting `args.stateDir` therefore changes nothing: every caller gets the same behaviour whatever they pass, and nothing reports that the option was ignored. Read `stateDir` where the behaviour it configures is decided — or, if the behaviour genuinely is fixed, remove `args.stateDir` from the accepted options so callers stop setting a knob that does nothing. — hindsight-integrations/coding-agents/src/core/session-start.ts:189
What to do
Each finding names the spans that disagree — the knob the caller supplies and the site that ignores it, whether by re-spelling its default, by falling back under the wrong key, by parsing with no format provider at all, or by printing under whatever culture the host supplies. Confirm from those spans, then decide which of the two the type meant: read the knob at the named site, or drop the knob so the signature stops advertising something the type cannot feel. Leaving both is the one option that cannot be right.
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 `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. 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. Whether a `for … range` leaves the slice or map it is walking alone — Go raises nothing, but the walk and the collection part: a range evaluates its slice once, so an element appended in the body is never visited and a removal by reslicing (`s = append(s[:i], s[i+1:]...)`, `slices.Delete`) shifts the next element under the index, which is then skipped while the last is read twice; a reslice, a reassignment or a sort leaves every later `s[i]` naming another element; and a map's order is unspecified, so deleting another key (or clearing the map) changes from run to run which entries the loop still sees.
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.
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.
`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. (×12) — hindsight-integrations/superagent/hindsight_superagent/__init__.py:37, hindsight-integrations/openhands/hindsight_openhands/openhands_config.py:87, hindsight-integrations/omo/scripts/lib/client.py:76, …
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. (×25) — hindsight-integrations/paperclip/src/worker.ts:221, REDACTED:982, hindsight-integrations/openclaw/src/retain-queue.ts:147, …
`.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×2) — REDACTED:2912, REDACTED:3343
An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch. — REDACTED:1037
What to do
Swallowed exception (caught, then discarded)
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.
`warning` at line 228 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/vapi/hindsight_vapi/webhook.py:228
`warning` at line 239 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/vapi/hindsight_vapi/webhook.py:239
`error` at line 187 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/strands/hindsight_strands/tools.py:187
`error` at line 221 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/strands/hindsight_strands/tools.py:221
`error` at line 246 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/strands/hindsight_strands/tools.py:246
`error` at line 116 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/smolagents/hindsight_smolagents/tools.py:116
`error` at line 188 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/smolagents/hindsight_smolagents/tools.py:188
`error` at line 242 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/smolagents/hindsight_smolagents/tools.py:242
`error` at line 121 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:121
`error` at line 152 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:152
`error` at line 174 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:174
`warning` at line 232 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/pipecat/hindsight_pipecat/memory.py:232
`warning` at line 243 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/pipecat/hindsight_pipecat/memory.py:243
`debug` at line 235 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:235
`debug` at line 248 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:248
`error` at line 302 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:302
`error` at line 325 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:325
`error` at line 346 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:346
`error` at line 368 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:368
`debug` at line 147 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:147
`debug` at line 151 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:151
`debug` at line 164 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:164
`debug` at line 167 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:167
`error` at line 248 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:248
`error` at line 265 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:265
`error` at line 282 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:282
`error` at line 301 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:301
`error` at line 318 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:318
`error` at line 335 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:335
`info` at line 502 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:502
`warning` at line 508 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:508
`warning` at line 524 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:524
`debug` at line 1072 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:1072
`debug` at line 1076 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:1076
`debug` at line 1102 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:1102
`info` at line 1113 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:1113
`error` at line 1115 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:1115
`info` at line 1174 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:1174
`debug` at line 1234 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:1234
`info` at line 1246 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.info("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.info("order moved", order_id=order_id, status=status)` with structlog. — hindsight-integrations/litellm/hindsight_litellm/__init__.py:1246
Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
~0.9 `!` null assertions per 1k TypeScript source lines — 91 assertion(s) across the 99067 source line(s) of the 482 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: hindsight-control-plane/src/components/constellation.tsx (13), hindsight-docs/src/components/constellation/Constellation.tsx (12), hindsight-integrations/coding-agents/src/deepen.ts (8). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
What to do
The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 4 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
Not included — 31 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AX1 Captive dependencies — Not applicable: this repository's Go imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's 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; Rust with no dependency-injection crate has no container to hand one lifetime's instance to another — every value is owned by the code that builds it, and the borrow checker rejects a longer-lived value keeping a borrow of a shorter-lived one; this repository's TypeScript 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 Go request handler (a net/http, Gin, Echo, Fiber or fasthttp handler, or a gRPC service method) is declared as a method or function, and no handler function literal writes a value captured from outside it, so no state is shared between request goroutines. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — compose up failed (exit 1 — a container did not start, exited, or never became healthy) — network hindsight-network declared as external, but could not be found; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
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.
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. 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"]`.
D25 ADR Conformance — None of 0 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
D27 Navigability — symbol resolution incomplete — navigability not assessed
D32 Data Compliance (PII/GDPR) — 6 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D42 Runtime Threat Enforcement — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
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, Scala, Rust and Java, 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
P9 Domain vs controller coverage — coverage data present for 13 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — X16 reached only 24% of this repository's production lines — python (277,944 lines), go (71,006 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — X29 reached only 24% of this repository's production lines — python (277,944 lines), go (71,006 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
AC2 · Forms & labels· <label> that labels no control · ×20
<label> that labels no control hindsight-control-plane/src/components/bank-config-view.tsx:1814— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-profile-view.tsx:318— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-profile-view.tsx:670— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-profile-view.tsx:875— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-profile-view.tsx:883— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-profile-view.tsx:892— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1135— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1350— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1363— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1381— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1425— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1443— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1456— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1490— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1534— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1545— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1557— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1610— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1624— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control hindsight-control-plane/src/components/bank-selector.tsx:1713— This <label> has no htmlFor and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label htmlFor="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×15
Click handler on a non-interactive <div> hindsight-control-plane/src/components/bank-config-view.tsx:1769— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/bank-config-view.tsx:2812— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/data-view.tsx:1524— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/data-view.tsx:1541— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> REDACTED:242— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> REDACTED:265— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/pages-view.tsx:670— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/pages-view.tsx:1059— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/search-debug-view.tsx:786— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/search-debug-view.tsx:854— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/search-debug-view.tsx:920— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/search-debug-view.tsx:1058— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/search-debug-view.tsx:1182— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-control-plane/src/components/think-view.tsx:827— A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
Click handler on a non-interactive <div> hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx:372— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC1 · Text alternatives· <img> without a text alternative · ×2
<img> without a text alternative hindsight-control-plane/src/components/constellation.tsx:1620— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative hindsight-docs/src/components/constellation/Constellation.tsx:1571— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
AC4 · Keyboard semantics· Click handler on a non-interactive <li> · ×2
Click handler on a non-interactive <li> REDACTED:323— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
Click handler on a non-interactive <li> hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx:313— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC2 · Forms & labels· <button> with no accessible text · ×1
<button> with no accessible text hindsight-control-plane/src/components/bank-config-view.tsx:2385— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC2 · Forms & labels· <input> without a programmatic label · ×1
<input> without a programmatic label hindsight-control-plane/src/components/bank-profile-view.tsx:681— This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC3 · Page structure· Document without a <title> · ×1
Document without a <title> hindsight-control-plane/src/app/[locale]/layout.tsx:66— A page with no <title> gives no name in the tab, history or screen-reader page list. Declare it the way this router does — Next App Router `export const metadata = { title }`, React Router/Remix `export function meta`, TanStack Start `head`, or a Helmet/Head component.
<html> without a lang hindsight-control-plane/src/lib/page-download.tsx:104— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
AC3 · Page structure· Document <title> is empty · ×1
Document <title> is empty hindsight-control-plane/src/lib/page-download.tsx:104— An empty <title> gives no page name in the tab, history or screen-reader page list. Put descriptive text in the <title>.
Orphaned knowledge hindsight-integrations/superagent/hindsight_superagent/middleware.py:1— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Unlisted import '@docusaurus/plugin-content-blog' hindsight-docs/src/theme/BlogListPage/index.tsx:8— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import '@rspack/core' hindsight-docs/plugins/dev-light/index.js:1— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'ajv' hindsight-docs/scripts/check-templates.mjs:13— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Unlisted import 'esbuild' hindsight-integrations/coding-agents/src/core/git-stderr.test.ts:6— Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Hotspot: hindsight-api-slim/hindsight_api/engine/memory_engine.py hindsight-api-slim/hindsight_api/engine/memory_engine.py:10104— hindsight-api-slim/hindsight_api/engine/memory_engine.py changed 280 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 198 in MemoryEngine._search_with_retries at line 10104. 159 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/memory_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: hindsight-api-slim/hindsight_api/config.py hindsight-api-slim/hindsight_api/config.py:4931— hindsight-api-slim/hindsight_api/config.py changed 111 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 165 in HindsightConfig._read_env at line 4931. 37 of those changes were fix/bug commits, and the other 74 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/config.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: hindsight-api-slim/hindsight_api/engine/reflect/agent.py hindsight-api-slim/hindsight_api/engine/reflect/agent.py:547— hindsight-api-slim/hindsight_api/engine/reflect/agent.py changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 126 in agent._run_reflect_agent_inner at line 547. 37 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/reflect/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: REDACTED REDACTED:2287— REDACTED changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 198 in index.default at line 2287. 16 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01: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: hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2937— hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 98 in fact_extraction.extract_facts_from_contents_batch_api at line 2937. 34 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.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: hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1619— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py changed 59 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 71 in orchestrator.retain_batch at line 1619. 45 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/retain/orchestrator.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: hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:2711— hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py changed 52 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in consolidator._process_memory_batch at line 2711. 34 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.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: hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1219— hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 79 in OpenAICompatibleLLM.call at line 1219. 27 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.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: hindsight-clients/typescript/src/index.ts hindsight-clients/typescript/src/index.ts:923— hindsight-clients/typescript/src/index.ts changed 46 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in HindsightClient.updateBankConfig at line 923. 13 of those changes were fix/bug commits, and the other 33 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-clients/typescript/src/index.ts`: 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: hindsight-control-plane/src/components/documents-view.tsx hindsight-control-plane/src/components/documents-view.tsx:715— hindsight-control-plane/src/components/documents-view.tsx changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 180 in documents-view.DocumentsView at line 715. 3 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-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-control-plane/src/components/documents-view.tsx`: 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: hindsight-control-plane/src/components/bank-selector.tsx hindsight-control-plane/src/components/bank-selector.tsx:129— hindsight-control-plane/src/components/bank-selector.tsx changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 163 in bank-selector.BankSelectorInner at line 129. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-control-plane/src/components/bank-selector.tsx`: 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: hindsight-cli/src/main.rs hindsight-cli/src/main.rs:1516— hindsight-cli/src/main.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 90 in hindsight_cli::run at line 1516. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-cli/src/main.rs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: hindsight-control-plane/src/components/bank-config-view.tsx hindsight-control-plane/src/components/bank-config-view.tsx:467— hindsight-control-plane/src/components/bank-config-view.tsx changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 94 in bank-config-view.BankConfigView at line 467. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-control-plane/src/components/bank-config-view.tsx`: 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: hindsight-api-slim/hindsight_api/mcp_tools.py hindsight-api-slim/hindsight_api/mcp_tools.py:651— hindsight-api-slim/hindsight_api/mcp_tools.py changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in mcp_tools.register_mcp_tools at line 651. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/mcp_tools.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: hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:104— hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 104 in page.BankPage at line 104. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx`: 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: hindsight-control-plane/src/lib/api.ts hindsight-control-plane/src/lib/api.ts:521— hindsight-control-plane/src/lib/api.ts changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in ControlPlaneClient.fetchApi at line 521. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-control-plane/src/lib/api.ts`: 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: hindsight-control-plane/src/components/pages-view.tsx hindsight-control-plane/src/components/pages-view.tsx:101— hindsight-control-plane/src/components/pages-view.tsx changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 119 in pages-view.PagesView at line 101. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-control-plane/src/components/pages-view.tsx`: 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: hindsight-api-slim/hindsight_api/engine/cross_encoder.py hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2863— hindsight-api-slim/hindsight_api/engine/cross_encoder.py changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in cross_encoder._create_cross_encoder_backend at line 2863. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/cross_encoder.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: hindsight-control-plane/src/components/bank-operations-view.tsx hindsight-control-plane/src/components/bank-operations-view.tsx:143— hindsight-control-plane/src/components/bank-operations-view.tsx changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 139 in bank-operations-view.BankOperationsView at line 143. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-control-plane/src/components/bank-operations-view.tsx`: 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: hindsight-api-slim/hindsight_api/engine/embeddings.py hindsight-api-slim/hindsight_api/engine/embeddings.py:2583— hindsight-api-slim/hindsight_api/engine/embeddings.py changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in embeddings._create_embeddings at line 2583. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/embeddings.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: hindsight-clients/python/hindsight_client/hindsight_client.py hindsight-clients/python/hindsight_client/hindsight_client.py:1029— hindsight-clients/python/hindsight_client/hindsight_client.py changed 50 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in Hindsight._acreate_bank at line 1029. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-clients/python/hindsight_client/hindsight_client.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: hindsight-api-slim/hindsight_api/engine/reflect/prompts.py hindsight-api-slim/hindsight_api/engine/reflect/prompts.py:203— hindsight-api-slim/hindsight_api/engine/reflect/prompts.py changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in prompts.build_system_prompt_for_tools at line 203. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/reflect/prompts.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: hindsight-api-slim/hindsight_api/engine/llm_wrapper.py hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:921— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py changed 36 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in LLMProvider.__init__ at line 921. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/llm_wrapper.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: hindsight-api-slim/hindsight_api/engine/transfer/importer.py hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1232— hindsight-api-slim/hindsight_api/engine/transfer/importer.py changed 33 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in importer._restore_bank at line 1232. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/transfer/importer.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: hindsight-control-plane/src/components/data-view.tsx hindsight-control-plane/src/components/data-view.tsx:115— hindsight-control-plane/src/components/data-view.tsx changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 175 in data-view.DataView 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-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-control-plane/src/components/data-view.tsx`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
FileTooLong: engine/memory_engine.py hindsight-api-slim/hindsight_api/engine/memory_engine.py— FileTooLong — 11191 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 10691 over it, 22.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: api/http.py hindsight-api-slim/hindsight_api/api/http.py— FileTooLong — 7222 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 6722 over it, 14.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: hindsight_api/config.py hindsight-api-slim/hindsight_api/config.py— FileTooLong — 3964 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3464 over it, 7.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: retain/orchestrator.py hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py— FileTooLong — 2806 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2306 over it, 5.61× 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: hindsight_api/mcp_tools.py hindsight-api-slim/hindsight_api/mcp_tools.py— FileTooLong — 2527 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2027 over it, 5.05× 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: components/bank-config-view.tsx hindsight-control-plane/src/components/bank-config-view.tsx— FileTooLong — 2483 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1983 over it, 4.97× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 2413 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1913 over it, 4.83× 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: memories/base.py hindsight-api-slim/hindsight_api/engine/memories/base.py— FileTooLong — 2156 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1656 over it, 4.31× 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: components/documents-view.tsx hindsight-control-plane/src/components/documents-view.tsx— FileTooLong — 1999 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1499 over it, 4.00× 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: consolidation/consolidator.py hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py— FileTooLong — 1886 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1386 over it, 3.77× 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: lib/api.ts hindsight-control-plane/src/lib/api.ts— FileTooLong — 1858 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: ControlPlaneClient (520-2820). The bar is 500 significant lines; this is 1358 over it, 3.72× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: hindsight_client/hindsight_client.py hindsight-clients/python/hindsight_client/hindsight_client.py— FileTooLong — 1823 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1323 over it, 3.65× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: engine/cross_encoder.py hindsight-api-slim/hindsight_api/engine/cross_encoder.py— FileTooLong — 1762 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1262 over it, 3.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: engine/embeddings.py hindsight-api-slim/hindsight_api/engine/embeddings.py— FileTooLong — 1708 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1208 over it, 3.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: retain/fact_extraction.py hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py— FileTooLong — 1623 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1123 over it, 3.25× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/main.rs hindsight-cli/src/main.rs— FileTooLong — 1615 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1115 over it, 3.23× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: reflect/agent.py hindsight-api-slim/hindsight_api/engine/reflect/agent.py— FileTooLong — 1605 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1105 over it, 3.21× 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: components/bank-selector.tsx hindsight-control-plane/src/components/bank-selector.tsx— FileTooLong — 1563 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1063 over it, 3.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: knowledge/service.py hindsight-api-slim/hindsight_api/knowledge/service.py— FileTooLong — 1516 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1016 over it, 3.03× 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 — 1493 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 993 over it, 2.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: src/installer.ts hindsight-integrations/coding-agents/src/installer.ts— FileTooLong — 1490 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 990 over it, 2.98× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: memories/postgres.py hindsight-api-slim/hindsight_api/engine/memories/postgres.py— FileTooLong — 1451 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 951 over it, 2.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: engine/chinese_temporal_periods.py hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py— FileTooLong — 1446 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 946 over it, 2.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: REDACTED hindsight-clients/typescript/src/index.ts— FileTooLong — 1427 significant lines (blank, comment-only and punctuation-only lines excluded), about 81% of them inside a single declaration: HindsightClient (349-2191). The bar is 500 significant lines; this is 927 over it, 2.85× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: components/mental-model-detail-modal.tsx hindsight-control-plane/src/components/mental-model-detail-modal.tsx— FileTooLong — 1321 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 821 over it, 2.64× 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.
FunctionTooLong: constellation.Constellation hindsight-control-plane/src/components/constellation.tsx:267— FunctionTooLong — Constellation runs 1137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1037 over it, 11.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: Constellation.Constellation hindsight-docs/src/components/constellation/Constellation.tsx:289— FunctionTooLong — Constellation runs 1091 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 991 over it, 10.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: search-debug-view.SearchDebugView hindsight-control-plane/src/components/search-debug-view.tsx:109— FunctionTooLong — SearchDebugView runs 1020 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 920 over it, 10.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: bank-config-view.BankConfigView hindsight-control-plane/src/components/bank-config-view.tsx:467— FunctionTooLong — BankConfigView runs 901 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 801 over it, 9.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: think-view.ThinkView hindsight-control-plane/src/components/think-view.tsx:72— FunctionTooLong — ThinkView runs 853 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 753 over it, 8.53× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: data-view.DataView hindsight-control-plane/src/components/data-view.tsx:115— FunctionTooLong — DataView runs 845 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 745 over it, 8.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: hindsight_cli::run hindsight-cli/src/main.rs:1516— FunctionTooLong — hindsight_cli::run runs 784 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 684 over it, 7.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: webhooks-view.WebhooksView hindsight-control-plane/src/components/webhooks-view.tsx:310— FunctionTooLong — WebhooksView runs 765 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 665 over it, 7.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: memory-detail-modal.MemoryDetailModal hindsight-control-plane/src/components/memory-detail-modal.tsx:78— FunctionTooLong — MemoryDetailModal runs 707 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 607 over it, 7.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: page.BankPage hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:104— FunctionTooLong — BankPage runs 697 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 597 over it, 6.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mental-models-view.MentalModelsView hindsight-control-plane/src/components/mental-models-view.tsx:132— FunctionTooLong — MentalModelsView runs 459 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 359 over it, 4.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: entities-view.EntitiesView hindsight-control-plane/src/components/entities-view.tsx:51— FunctionTooLong — EntitiesView runs 414 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 314 over it, 4.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mental-model-detail-modal.MentalModelDetailModal hindsight-control-plane/src/components/mental-model-detail-modal.tsx:824— FunctionTooLong — MentalModelDetailModal runs 410 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 310 over it, 4.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: bank-profile-view.BankProfileView hindsight-control-plane/src/components/bank-profile-view.tsx:130— FunctionTooLong — BankProfileView runs 405 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 305 over it, 4.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: app.App hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx:34— FunctionTooLong — App runs 404 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 304 over it, 4.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: knowledge-write-dialogs.KnowledgeAddDocumentDialog hindsight-control-plane/src/components/knowledge-write-dialogs.tsx:83— FunctionTooLong — KnowledgeAddDocumentDialog runs 382 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 282 over it, 3.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: knowledge-search-panel.KnowledgeSearchPanel hindsight-control-plane/src/components/knowledge-search-panel.tsx:64— FunctionTooLong — KnowledgeSearchPanel runs 357 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 257 over it, 3.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: data-view.TimelineView hindsight-control-plane/src/components/data-view.tsx:1227— FunctionTooLong — TimelineView runs 307 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 207 over it, 3.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: observation-tree-view.ObservationTreeView REDACTED:356— FunctionTooLong — ObservationTreeView runs 292 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 192 over it, 2.92× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: tools.createHindsightTools hindsight-integrations/openclaw/src/tools.ts:106— FunctionTooLong — createHindsightTools runs 278 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 178 over it, 2.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: bank-config-view.ConsolidationStrategiesPanel hindsight-control-plane/src/components/bank-config-view.tsx:2687— FunctionTooLong — ConsolidationStrategiesPanel runs 257 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 157 over it, 2.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: audit-logs-view.AuditLogsView hindsight-control-plane/src/components/audit-logs-view.tsx:289— FunctionTooLong — AuditLogsView runs 245 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 145 over it, 2.45× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: home-view.HomeView hindsight-control-plane/src/components/home-view.tsx:51— FunctionTooLong — HomeView runs 230 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 130 over it, 2.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mental-model-detail-modal.ConfigurationTab hindsight-control-plane/src/components/mental-model-detail-modal.tsx:1348— FunctionTooLong — ConfigurationTab runs 226 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 126 over it, 2.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: knowledge-document-dialog.KnowledgeDocumentDialog hindsight-control-plane/src/components/knowledge-document-dialog.tsx:295— FunctionTooLong — KnowledgeDocumentDialog runs 212 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Repeated repair: hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1645— hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py changed 23 times in last 90 days and 15 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is PostgreSQLOps._claim_consolidation_tasks at line 1645), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(graph-maintenance): stop queue-row locks from convoying same-bank writers (#6417) (#6472)”; “fix(oracle): a link to a memory deleted mid-retain no longer fails the batch (#6440) (#6467)”; “fix: flaky tests, and the production bugs behind four of them (11 issues) (#6460)”; “fix(entities): keep mention_count exact under concurrent deletes and edits of one memory (#6233)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.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.
Repeated repair: hindsight-api-slim/hindsight_api/engine/db/ops.py hindsight-api-slim/hindsight_api/engine/db/ops.py:307— hindsight-api-slim/hindsight_api/engine/db/ops.py changed 15 times in last 90 days and 12 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is UpdatedWindow.clause at line 307), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(graph-maintenance): stop queue-row locks from convoying same-bank writers (#6417) (#6472)”; “fix(oracle): a link to a memory deleted mid-retain no longer fails the batch (#6440) (#6467)”; “fix(entities): keep mention_count exact under concurrent deletes and edits of one memory (#6233)”; “fix(worker): avoid per-parent startup recovery for healthy batches (#5178)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/db/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.
Repeated repair: hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1322— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py changed 16 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is OracleOps._claim_consolidation_tasks at line 1322), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(graph-maintenance): stop queue-row locks from convoying same-bank writers (#6417) (#6472)”; “fix(oracle): a link to a memory deleted mid-retain no longer fails the batch (#6440) (#6467)”; “fix(entities): keep mention_count exact under concurrent deletes and edits of one memory (#6233)”; “fix(worker): avoid per-parent startup recovery for healthy batches (#5178)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/db/ops_oracle.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.
Repeated repair: hindsight-integrations/coding-agents/src/core/runtime.ts hindsight-integrations/coding-agents/src/core/runtime.ts:168— hindsight-integrations/coding-agents/src/core/runtime.ts changed 14 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is RuntimeCore.onPrompt at line 168), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): strip host-injected tags from the prompt before recall/reflect (#6491)”; “fix(coding-agents): survey starts from every host again; keep terminal-manager env and color codes out (#6287)”; “fix(coding-agents): inject the memory block into the user message, not the system prompt (#6053)”; “fix(coding-agents): keep retained sessions whole across pi runs, failed ops, exits and side sessions (#5508)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/core/runtime.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-integrations/coding-agents/src/core/survey.ts hindsight-integrations/coding-agents/src/core/survey.ts:353— hindsight-integrations/coding-agents/src/core/survey.ts changed 12 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is survey.startCodebaseSurvey at line 353), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): run the codebase survey only under the host's own CLI (#6378)”; “fix(coding-agents): survey starts from every host again; keep terminal-manager env and color codes out (#6287)”; “fix(coding-agents): launch the codebase survey on Windows and stop retrying forever (#6054)”; “fix(coding-agents): small retain, recall and survey fixes (#6050)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/core/survey.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-integrations/hermes/embedded.py hindsight-integrations/hermes/embedded.py:378— hindsight-integrations/hermes/embedded.py changed 9 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is embedded._build_embedded_profile_env at line 378), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(hermes): tell the launched daemon where the user's database is (#6093) (#6299)”; “fix(hermes): report the provider unavailable when hindsight_client can't import (#6063) (#6292)”; “fix(hermes): six small plugin bugs (#6000)”; “fix(hermes,embed): local_embedded daemon start, restarts and Windows launch (#5360)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/hermes/embedded.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.
Repeated repair: hindsight-api-slim/hindsight_api/engine/sql/postgresql.py hindsight-api-slim/hindsight_api/engine/sql/postgresql.py:353— hindsight-api-slim/hindsight_api/engine/sql/postgresql.py changed 11 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is PostgreSQLDialect.build_bm25_arm at line 353), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(recall): build the VectorChord BM25 query once per search, not once per row (#5408) (#6373)”; “fix(recall): break BM25 score ties on id so repeated recalls return the same list (#6143)”; “fix(oracle): knowledge-page search with an Oracle Text index (#4804)”; “fix(knowledge): normalize knowledge-page search scores onto 0..1 (#4512)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/sql/postgresql.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.
Repeated repair: hindsight-api-slim/hindsight_api/engine/reflect/tools_schema.py hindsight-api-slim/hindsight_api/engine/reflect/tools_schema.py:405— hindsight-api-slim/hindsight_api/engine/reflect/tools_schema.py changed 10 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is tools_schema.get_reflect_tools at line 405), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(refresh): delta edits keep table rows, drop departed members, and refuse spilled operations (#6171)”; “fix(reflect): return whole knowledge pages up to a token budget, not one page under 4k (#5787) (#6009)”; “fix(reflect): answer once — free turns signal answer_ready instead of writing a discarded answer (#5832) (#5916)”; “fix(reflect): keep memory ids out of document-mode text (#5833) (#5837)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/reflect/tools_schema.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.
Repeated repair: hindsight-api-slim/hindsight_api/worker/main.py hindsight-api-slim/hindsight_api/worker/main.py:247— hindsight-api-slim/hindsight_api/worker/main.py changed 9 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is main.main at line 247), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(api): a redirected stdout on Windows no longer stops the server at start-up (#6458) (#6508)”; “fix(worker): SIGTERM stops claiming at once and the drain fits the grace period (#6021) (#6377)”; “fix(worker): shutdown no longer waits out a long maintenance job (#6092)”; “fix(worker): one SIGTERM runs the graceful shutdown instead of force-exiting (#5747)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/worker/main.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.
Repeated repair: hindsight-api-slim/hindsight_api/engine/query_analyzer.py hindsight-api-slim/hindsight_api/engine/query_analyzer.py:541— hindsight-api-slim/hindsight_api/engine/query_analyzer.py changed 9 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is TransformerQueryAnalyzer._extract_with_rules at line 541), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(recall): support dateparser 1.5.0 temporal search (#6359) (#6464)”; “fix(models): ONNX loaders no longer crash-loop startup next to a local model build (#6105)”; “fix(local-models): build local torch models one at a time, download in parallel (#4420) (#5609)”; “fix(recall): anchor the default temporal window on UTC, not the server clock (#4356)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/query_analyzer.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.
Repeated repair: hindsight-integrations/coding-agents/src/core/git.ts hindsight-integrations/coding-agents/src/core/git.ts:385— hindsight-integrations/coding-agents/src/core/git.ts changed 8 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is git.appendGitLog at line 385), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): small retain, recall and survey fixes (#6050)”; “fix(coding-agents): append only new commits to the git-log document (#5711)”; “fix(coding-agents): Windows hooks and spawns, pi session cwd, git log parsing (#5511)”; “fix(coding-agents): keep the git log when HEAD is behind the commit it was written at (#4766)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/core/git.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-api-slim/hindsight_api/engine/memories/pg/writes.py hindsight-api-slim/hindsight_api/engine/memories/pg/writes.py:32— hindsight-api-slim/hindsight_api/engine/memories/pg/writes.py changed 13 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is writes.insert_facts at line 32), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(graph-maintenance): stop queue-row locks from convoying same-bank writers (#6417) (#6472)”; “fix(consolidation): rebuild the VectorChord keyword index on observation rewrites and folds (#5299) (#5991)”; “fix(graph): allow relinking past observation sweep source locks (#4734)”; “fix(engine): close the remaining delete/re-ingest deadlocks from #4251 (#4414)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/memories/pg/writes.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.
Repeated repair: hindsight-api-slim/hindsight_api/engine/llm_interface.py hindsight-api-slim/hindsight_api/engine/llm_interface.py:38— hindsight-api-slim/hindsight_api/engine/llm_interface.py changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is LLMToolChoice.__post_init__ at line 38), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(llm): a logged-out LLM no longer crashes startup; failover skips it (#6108)”; “fix(reflect): answer once — free turns signal answer_ready instead of writing a discarded answer (#5832) (#5916)”; “fix(retain): fail once on a rejected LLM key instead of replaying it (#5644) (#5749)”; “fix(llm): let each multi-LLM chain member build its own prompt cache (#5245)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/llm_interface.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.
Repeated repair: hindsight-api-slim/hindsight_api/engine/local_device.py hindsight-api-slim/hindsight_api/engine/local_device.py:146— hindsight-api-slim/hindsight_api/engine/local_device.py changed 8 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is local_device.select_local_device at line 146), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(local-models): return freed heap pages to the OS on Windows too (#5478) (#6365)”; “fix(models): ONNX loaders no longer crash-loop startup next to a local model build (#6105)”; “fix(local-models): build local torch models one at a time, download in parallel (#4420) (#5609)”; “fix(packaging): install mlx only on Apple Silicon (#4520)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/local_device.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.
Repeated repair: hindsight-integrations/coding-agents/src/core/retain-hook.ts hindsight-integrations/coding-agents/src/core/retain-hook.ts:180— hindsight-integrations/coding-agents/src/core/retain-hook.ts changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is retain-hook.runRetainHook at line 180), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): memory injection on long prompts, empty first recalls, dsh repeats and Grok Build (#5514)”; “fix(coding-agents): Windows hooks and spawns, pi session cwd, git log parsing (#5511)”; “fix(coding-agents): append a Codex continuation rollout instead of replacing the session document (#4711)”; “fix(coding-agents): gate append on bank text storage (#4727)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/core/retain-hook.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-integrations/hermes/settings.py hindsight-integrations/hermes/settings.py:257— hindsight-integrations/hermes/settings.py changed 10 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is settings._discover_cwd_bank_id at line 257), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(llm): refresh provider default models to newer, cheaper ones (#6442) (#6589)”; “fix(hermes): default observation_scopes to shared so observations merge across sessions (#5629)”; “fix(hermes): batch of small plugin bugs from #4662 (#5534)”; “fix(hermes): six plugin bugs that need no behaviour change (#5523)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/hermes/settings.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.
Repeated repair: hindsight-integrations/coding-agents/src/mcp-server.ts hindsight-integrations/coding-agents/src/mcp-server.ts:83— hindsight-integrations/coding-agents/src/mcp-server.ts changed 9 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is mcp-server.resolveProjectCwd at line 83), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): bind Cursor MCP to the open workspace (#4530)”; “fix(coding-agents): annotate MCP tool safety (#3818)”; “fix(coding-agents): tolerate empty tool discovery (#3626)”; “fix(coding-agents): name the calling harness in every MCP registration (#3612)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/mcp-server.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-integrations/coding-agents/src/harness/pi-extension.ts hindsight-integrations/coding-agents/src/harness/pi-extension.ts:218— hindsight-integrations/coding-agents/src/harness/pi-extension.ts changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is pi-extension.createPiExtension.<returned closure> at line 218), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): pi custom-message runs no longer throw; auto-update reads npm 12 (#6214)”; “fix(coding-agents): inject the memory block into the user message, not the system prompt (#6053)”; “fix(coding-agents): keep retained sessions whole across pi runs, failed ops, exits and side sessions (#5508)”; “fix(coding-agents): Windows hooks and spawns, pi session cwd, git log parsing (#5511)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/harness/pi-extension.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-embed/hindsight_embed/profile_manager.py hindsight-embed/hindsight_embed/profile_manager.py:388— hindsight-embed/hindsight_embed/profile_manager.py changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is ProfileManager.create_profile at line 388), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(embed): apply --profile when the CLI runs via python -m (#5694)”; “fix(embed): strip dotenv quotes when reading profile .env files (#5301) (#5642)”; “fix(embed): use the resolved profile for CLI commands (#5205)”; “fix(embed): forward every HINDSIGHT_* var to the daemon instead of a whitelist (#4094) (#4119)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-embed/hindsight_embed/profile_manager.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.
Repeated repair: hindsight-integrations/coding-agents/src/dsh.ts hindsight-integrations/coding-agents/src/dsh.ts:352— hindsight-integrations/coding-agents/src/dsh.ts changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is dsh.toDshParameters at line 352), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): a session saves each turn once, across bank moves and forks (#6052)”; “fix(coding-agents): memory injection on long prompts, empty first recalls, dsh repeats and Grok Build (#5514)”; “fix(coding-agents): emit a V4-compatible dsh recall source (#4639)”; “fix(coding-agents): a transient 404 no longer disables knowledge pages for the process (#4607) (#4712)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/dsh.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-embed/hindsight_embed/control_center/service.py hindsight-embed/hindsight_embed/control_center/service.py:226— hindsight-embed/hindsight_embed/control_center/service.py changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is service.save_llm_config at line 226), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(embed): control center Unicode profiles, unhealthy-daemon stop, safe delete (#6193)”; “fix(embed): keep the user's HINDSIGHT_API_DATABASE_URL instead of replacing it with pg0 (#6158)”; “fix(embed): strip dotenv quotes when reading profile .env files (#5301) (#5642)”; “fix(embed): forward every HINDSIGHT_* var to the daemon instead of a whitelist (#4094) (#4119)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-embed/hindsight_embed/control_center/service.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.
Repeated repair: hindsight-integrations/coding-agents/src/core/bank.ts hindsight-integrations/coding-agents/src/core/bank.ts:300— hindsight-integrations/coding-agents/src/core/bank.ts changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is bank.deriveBankId at line 300), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): scope knowledge pages to the bank, not the session's cwd (#4146) (#4184)”; “fix(coding-agents): stop a failed git probe from forking a worktree into its own bank (#3981)”; “fix(integrations): resolve bare-hub project names (#3741)”; “fix(coding-agents): hide Windows child processes (#3736)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/core/bank.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-integrations/coding-agents/src/harness/opencode2.ts hindsight-integrations/coding-agents/src/harness/opencode2.ts:153— hindsight-integrations/coding-agents/src/harness/opencode2.ts changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is opencode2.wireOpencode2Runtime at line 153), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): run the codebase survey only under the host's own CLI (#6378)”; “fix(coding-agents): inject the memory block into the user message, not the system prompt (#6053)”; “fix(coding-agents): include skill path for opencode2 (#4737)”; “fix(coding-agents): a transient 404 no longer disables knowledge pages for the process (#4607) (#4712)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/harness/opencode2.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: hindsight-api-slim/hindsight_api/engine/memories/pg/retain.py hindsight-api-slim/hindsight_api/engine/memories/pg/retain.py:287— hindsight-api-slim/hindsight_api/engine/memories/pg/retain.py changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is retain.relabel_document_memories at line 287), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(retain): keep label-derived tags after their label group leaves the config (#6336) (#6465)”; “fix(retain): two concurrent retains of the same content store each fact once (#6337) (#6433)”; “fix: flaky tests — lock-order deadlocks, EvalPlanQual error, background-write races (#6225)”; “fix(retain): don't mark facts edited when an unchanged document is re-sent (#5630)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-api-slim/hindsight_api/engine/memories/pg/retain.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.
Repeated repair: hindsight-integrations/coding-agents/src/core/retain-cursor.ts hindsight-integrations/coding-agents/src/core/retain-cursor.ts:195— hindsight-integrations/coding-agents/src/core/retain-cursor.ts changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is retain-cursor.planRetain at line 195), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(coding-agents): a session saves each turn once, across bank moves and forks (#6052)”; “fix(coding-agents): keep retained sessions whole across pi runs, failed ops, exits and side sessions (#5508)”; “fix(coding-agents): append a Codex continuation rollout instead of replacing the session document (#4711)”; “fix(coding-agents): concise extraction by default, configurable and synced; cache append support (#4560) (#4602)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 22:05:11 +01:00' --until='2026-11-16 22:05:11 +01:00' --full-history --no-merges -- hindsight-integrations/coding-agents/src/core/retain-cursor.ts`: 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.
R4 · Test Coverage· No test reaches this file · ×40
No test reaches this file hindsight-control-plane/src/components/documents-view.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/bank-selector.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-docs/src/components/constellation/Constellation.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/search-debug-view.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/webhooks-view.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/bank-profile-view.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/audit-logs-view.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/entities-view.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/knowledge-document-dialog.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-docs/src/components/constellation/mock-bank.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-docs/sidebars.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/memory-defense-section.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-integrations/obsidian/src/chat-view.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/home-view.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-integrations/obsidian/src/main.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/src/components/document-history.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-docs/src/pages/integrations/index.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-docs/src/pages/templates/index.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-docs/src/components/SkillBanner.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-docs/src/theme/BlogListPage/index.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-integrations/obsidian/src/settings.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-control-plane/scripts/find-untranslated.ts:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file hindsight-docs/src/components/CodingAgentsChart.tsx:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
+ 15 more in this group — see findings.md.
X2 · Cancellation propagation· Async function without AbortSignal · ×39
Async function without AbortSignal: fetchBankStats hindsight-integrations/openclaw/src/backfill.ts:356— `fetchBankStats` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: patchBankConfig hindsight-integrations/openclaw/src/bank-defaults.ts:123— `patchBankConfig` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: api hindsight-embed/hindsight_embed/control_center/ui/src/api.js:24— `api` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: exportDocuments hindsight-control-plane/src/lib/api.ts:2219— `exportDocuments` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: importDocuments hindsight-control-plane/src/lib/api.ts:2251— `importDocuments` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: uploadFiles hindsight-control-plane/src/lib/api.ts:2284— `uploadFiles` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/stats/[agentId]/memories-timeseries/route.ts:5— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: POST hindsight-control-plane/src/app/api/pages/route.ts:5— `POST` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/pages/tree/route.ts:6— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/pages/search/route.ts:6— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: PATCH hindsight-control-plane/src/app/api/pages/nodes/[nodeId]/route.ts:9— `PATCH` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: DELETE hindsight-control-plane/src/app/api/pages/nodes/[nodeId]/route.ts:51— `DELETE` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: POST hindsight-control-plane/src/app/api/pages/folders/route.ts:5— `POST` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/pages/export/route.ts:5— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/pages/[pageId]/route.ts:5— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: POST hindsight-control-plane/src/app/api/memories/retain/route.ts:5— `POST` holds an AbortSignal but calls `retainBatch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `retainBatch(…, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/memories/[memoryId]/route.ts:5— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: PATCH hindsight-control-plane/src/app/api/memories/[memoryId]/route.ts:59— `PATCH` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/memories/[memoryId]/history/route.ts:5— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: forward REDACTED:85— `forward` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: POST hindsight-control-plane/src/app/api/files/retain/route.ts:5— `POST` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/files/download/route.ts:11— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: PATCH hindsight-control-plane/src/app/api/documents/route.ts:71— `PATCH` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: GET hindsight-control-plane/src/app/api/documents/transfer/route.ts:17— `GET` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
Async function without AbortSignal: POST hindsight-control-plane/src/app/api/documents/transfer/route.ts:147— `POST` holds an AbortSignal but calls `fetch(…)` without it, so its caller's cancellation never reaches that call and it runs to its end after whatever wanted it has given up. Hand the signal on: `fetch(…, { signal })`.
+ 14 more in this group — see findings.md.
D30 · Dependency Vulnerabilities· Medium CVE · ×36
hindsight_cli::commands::explore::run_app (cognitive 99) hindsight-cli/src/commands/explore.rs:1529— hindsight_cli::commands::explore::run_app has cognitive complexity 99 (threshold 15). Drivers by points: if/else 15 (77 pts), match/switch 4 (20 pts), boolean chains 1, loops 1 (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::memory::retain_files (cognitive 57) hindsight-cli/src/commands/memory.rs:567— hindsight_cli::commands::memory::retain_files has cognitive complexity 57 (threshold 15). Drivers by points: if/else 21 (39 pts), loops 7 (17 pts), boolean chains 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::bank::consolidate (cognitive 50) hindsight-cli/src/commands/bank.rs:652— hindsight_cli::commands::bank::consolidate has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (40 pts), match/switch 3 (8 pts), loops 1 (2 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::memory::get (cognitive 47) hindsight-cli/src/commands/memory.rs:193— hindsight_cli::commands::memory::get has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 1 (5 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::bank::stats (cognitive 40) hindsight-cli/src/commands/bank.rs:99— hindsight_cli::commands::bank::stats has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 5 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::memory::list (cognitive 37) hindsight-cli/src/commands/memory.rs:110— hindsight_cli::commands::memory::list has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 2 (6 pts), loops 1 (4 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.
hindsight_cli::handle_profile (cognitive 35) hindsight-cli/src/main.rs:2578— hindsight_cli::handle_profile has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 1 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 17). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hindsight_cli::run (cognitive 32) hindsight-cli/src/main.rs:1516— hindsight_cli::run has cognitive complexity 32 (threshold 15). Drivers by points: match/switch 14 (28 pts), if/else 4 (nesting depth added 14). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
hindsight_cli::commands::bank::graph (cognitive 30) hindsight-cli/src/commands/bank.rs:408— hindsight_cli::commands::bank::graph has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 1 (4 pts), match/switch 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
hindsight_cli::errors::format_error_message (cognitive 30) hindsight-cli/src/errors.rs:60— hindsight_cli::errors::format_error_message has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
hindsight_cli::commands::bank::config (cognitive 29) hindsight-cli/src/commands/bank.rs:830— hindsight_cli::commands::bank::config has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (9 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::directive::list (cognitive 27) hindsight-cli/src/commands/directive.rs:12— hindsight_cli::commands::directive::list has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 1 (4 pts), match/switch 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.
hindsight_cli::commands::mental_model::list (cognitive 27) hindsight-cli/src/commands/mental_model.rs:205— hindsight_cli::commands::mental_model::list has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 1 (4 pts), match/switch 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
hindsight_cli::commands::mental_model::history (cognitive 27) hindsight-cli/src/commands/mental_model.rs:640— hindsight_cli::commands::mental_model::history has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 1 (5 pts), match/switch 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
hindsight_cli::commands::memory::clear (cognitive 25) hindsight-cli/src/commands/memory.rs:741— hindsight_cli::commands::memory::clear has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::mental_model::apply_trigger_update (cognitive 25) hindsight-cli/src/commands/mental_model.rs:135— hindsight_cli::commands::mental_model::apply_trigger_update has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
hindsight_cli::ui::print_search_results (cognitive 25) hindsight-cli/src/ui.rs:209— hindsight_cli::ui::print_search_results has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
hindsight_cli::commands::bank::set_config (cognitive 24) hindsight-cli/src/commands/bank.rs:882— hindsight_cli::commands::bank::set_config has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19 (20 pts), loops 1 (3 pts), match/switch 1 (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.
hindsight_cli::commands::webhook::list (cognitive 23) hindsight-cli/src/commands/webhook.rs:12— hindsight_cli::commands::webhook::list has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::handle_configure (cognitive 22) hindsight-cli/src/main.rs:2444— hindsight_cli::handle_configure has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::health::health (cognitive 22) hindsight-cli/src/commands/health.rs:19— hindsight_cli::commands::health::health has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::pages::search (cognitive 21) hindsight-cli/src/commands/pages.rs:292— hindsight_cli::commands::pages::search has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (4 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::operation::list (cognitive 20) hindsight-cli/src/commands/operation.rs:22— hindsight_cli::commands::operation::list has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (9 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_cli::commands::bank::delete (cognitive 19) hindsight-cli/src/commands/bank.rs:483— hindsight_cli::commands::bank::delete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (hindsight_cli::commands::bank::clear_observations) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
hindsight_cli::commands::bank::clear_observations (cognitive 19) hindsight-cli/src/commands/bank.rs:776— hindsight_cli::commands::bank::clear_observations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (hindsight_cli::commands::bank::delete) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Swallowed exception (empty catch) hindsight-integrations/paperclip/src/worker.ts:221— 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) REDACTED:982— 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) REDACTED:2912— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) REDACTED:3343— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) hindsight-integrations/openclaw/src/retain-queue.ts: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) hindsight-integrations/openclaw/src/retain-queue.ts:159— 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) hindsight-integrations/omo/scripts/lib/client.py:65— 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) hindsight-integrations/litellm/hindsight_litellm/__init__.py:540— 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) hindsight-integrations/litellm/hindsight_litellm/__init__.py:746— 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) hindsight-integrations/litellm/hindsight_litellm/_async.py:107— 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) REDACTED:1037— An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
Swallowed exception (empty catch) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:246— 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) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:399— 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) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:517— 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) hindsight-integrations/haystack/hindsight_haystack/tools.py:81— 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) hindsight-integrations/haystack/hindsight_haystack/tools.py:85— 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) REDACTED:65— 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) REDACTED:135— 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) hindsight-integrations/cursor/scripts/retain.py:66— 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) hindsight-integrations/cursor/scripts/session_start.py:58— 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) hindsight-integrations/cursor/scripts/lib/client.py:65— 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) hindsight-integrations/coding-agents/src/antigravity-statusline.ts:41— 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) hindsight-integrations/coding-agents/src/deepen.ts:283— 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) REDACTED:270— 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) hindsight-integrations/coding-agents/src/core/auto-update.ts:213— 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 (8 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:285— hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:285-292 | hindsight-api-slim/hindsight_api/alembic/versions/b7c4d8e9f1a2_add_chunks_table.py:35-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 both call sites, so a change lands once.
Duplicated block (8 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:5295— hindsight-api-slim/hindsight_api/api/http.py:5295-5302 | hindsight-api-slim/hindsight_api/api/http.py:7457-7465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:7457` it begins part-way through the construct above it, so those 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, `hindsight-api-slim/hindsight_api/api/http.py:5294` calls `_attach_to_memories`, `get` and `hindsight-api-slim/hindsight_api/api/http.py:7457` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:6778— hindsight-api-slim/hindsight_api/api/http.py:6778-6785 | hindsight-api-slim/hindsight_api/api/http.py:7379-7386 — both copies are in the same file, so extract the 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) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1172— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1172-1179 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1209-1216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1172` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1310— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1310-1317 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1408-1415 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1800— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1800-1807 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1824-1831 — both copies are in the same file, so extract the 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) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:815— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:815-822 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:949-956 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py:661— hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py:661-668 | REDACTED:217-224 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1114— hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1114-1121 | hindsight-api-slim/hindsight_api/engine/providers/openai_responses_llm.py:260-267 — 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 `hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1114` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) hindsight-api-slim/hindsight_api/engine/search/tags.py:407— hindsight-api-slim/hindsight_api/engine/search/tags.py:407-414 | hindsight-api-slim/hindsight_api/engine/search/tags.py:419-426 — both copies are in the same file, so extract the 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 (8 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:1091— hindsight-api-slim/hindsight_api/mcp_tools.py:1091-1098 | hindsight-api-slim/hindsight_api/mcp_tools.py:1216-1223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:1091` it does not close everything it opens, so those exact lines 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) hindsight-embed/hindsight_embed/cli.py:1514— hindsight-embed/hindsight_embed/cli.py:1514-1521 | hindsight-embed/hindsight_embed/cli.py:1538-1545 — both copies are in the same file, so extract the block into 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) hindsight-integrations/cursor/scripts/lib/state.py:38— hindsight-integrations/cursor/scripts/lib/state.py:38-45 | hindsight-integrations/omo/scripts/lib/state.py:39-46 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/state.py` and `hindsight-integrations/omo/scripts/lib/state.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) hindsight-integrations/litellm/hindsight_litellm/__init__.py:458— hindsight-integrations/litellm/hindsight_litellm/__init__.py:458-465 | REDACTED:393-400 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) hindsight-integrations/omo/scripts/lib/state.py:84— hindsight-integrations/omo/scripts/lib/state.py:84-91 | hindsight-integrations/omo/scripts/lib/state.py:98-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 `hindsight-integrations/omo/scripts/lib/state.py:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/pipecat/hindsight_pipecat/memory.py:116— hindsight-integrations/pipecat/hindsight_pipecat/memory.py:116-123 | hindsight-integrations/vapi/hindsight_vapi/webhook.py:117-124 — before extracting anything, compare `hindsight-integrations/pipecat/hindsight_pipecat/memory.py` and `hindsight-integrations/vapi/hindsight_vapi/webhook.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:10247— hindsight-api-slim/hindsight_api/api/http.py:10247-10254 | hindsight-api-slim/hindsight_api/api/http.py:10366-10373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:10247` it begins part-way through the construct above it, so those exact lines 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) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:484— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:484-491 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:96-103 — 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) hindsight-api-slim/hindsight_api/engine/providers/litellm_llm.py:78— hindsight-api-slim/hindsight_api/engine/providers/litellm_llm.py:78-85 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:500-507 — 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 (8 lines × 2) hindsight-integrations/agno/hindsight_agno/tools.py:177— hindsight-integrations/agno/hindsight_agno/tools.py:177-186 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:92-99 — before extracting anything, compare `hindsight-integrations/agno/hindsight_agno/tools.py` and `hindsight-integrations/smolagents/hindsight_smolagents/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/github-copilot/hindsight_copilot/cli.py:48— hindsight-integrations/github-copilot/hindsight_copilot/cli.py:48-55 | hindsight-integrations/openhands/hindsight_openhands/cli.py:52-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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) hindsight-integrations/pipecat/hindsight_pipecat/memory.py:236— hindsight-integrations/pipecat/hindsight_pipecat/memory.py:236-243 | hindsight-integrations/vapi/hindsight_vapi/webhook.py:232-239 — before extracting anything, compare `hindsight-integrations/pipecat/hindsight_pipecat/memory.py` and `hindsight-integrations/vapi/hindsight_vapi/webhook.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) hindsight-api-slim/hindsight_api/engine/bank_aliases.py:51— hindsight-api-slim/hindsight_api/engine/bank_aliases.py:51-58 | hindsight-api-slim/hindsight_api/engine/bank_info_cache.py:59-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. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) hindsight-cli/src/commands/fs/format.rs:218— hindsight-cli/src/commands/fs/format.rs:218-225 | hindsight-cli/src/commands/fs/format.rs:261-268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/fs/format.rs:218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) hindsight-cli/src/commands/explore.rs:1225— hindsight-cli/src/commands/explore.rs:1225-1232 | hindsight-cli/src/commands/explore.rs:1390-1400 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/explore.rs:1225` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) hindsight-api-slim/hindsight_api/engine/bank_templates.py:532— hindsight-api-slim/hindsight_api/engine/bank_templates.py:532-537 | hindsight-api-slim/hindsight_api/engine/bank_templates.py:652-657 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1503— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1503-1508 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1572-1578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1572` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1148— hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1148-1154 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1329-1334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1148` it begins part-way through the construct above it, so those exact lines 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) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1053— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1053-1058 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1171-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 (6 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1173— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1173-1178 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1359-1367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1173` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 2) hindsight-embed/hindsight_embed/cli.py:1250— hindsight-embed/hindsight_embed/cli.py:1250-1255 | hindsight-embed/hindsight_embed/cli.py:1294-1299 — both copies are in the same file, so extract the block into 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) hindsight-embed/hindsight_embed/daemon_embed_manager.py:1104— hindsight-embed/hindsight_embed/daemon_embed_manager.py:1104-1109 | hindsight-embed/hindsight_embed/daemon_embed_manager.py:1135-1140 — both copies are in the same file, so extract the block into 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) hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:133— hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:133-138 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:226-231 — both copies are in the same file, so extract the 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:462— REDACTED:462-467 | REDACTED:542-547 — both copies are in the same file, so extract the block into 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) REDACTED:479— REDACTED:479-484 | REDACTED:560-565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) REDACTED:773— REDACTED:773-778 | REDACTED:808-813 — both copies are in the same file, so extract the block into 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) hindsight-integrations/pipecat/hindsight_pipecat/memory.py:159— hindsight-integrations/pipecat/hindsight_pipecat/memory.py:159-164 | hindsight-integrations/pipecat/hindsight_pipecat/memory.py:194-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1546— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1546-1551 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1553-1558 — both copies are in the same file, so extract the 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) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:82— hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:82-87 | hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:90-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. The matched lines also transfer control out of the body holding them, 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:46— REDACTED:46-51 | hindsight-api-slim/hindsight_api/alembic/versions/f2a6d8c4b1e9_drop_stale_global_memory_units_vector_index.py:48-53 — 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) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1113— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1113-1118 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1500-1505 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) hindsight-dev/hindsight_dev/cli_coverage_check.py:142— hindsight-dev/hindsight_dev/cli_coverage_check.py:142-147 | hindsight-dev/hindsight_dev/client_coverage_check.py:362-367 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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) hindsight-integrations/haystack/hindsight_haystack/tools.py:251— hindsight-integrations/haystack/hindsight_haystack/tools.py:251-256 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:225-230 — before extracting anything, compare `hindsight-integrations/haystack/hindsight_haystack/tools.py` and `hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/cursor/scripts/lib/client.py:128— hindsight-integrations/cursor/scripts/lib/client.py:128-137 | hindsight-integrations/omo/scripts/lib/client.py:130-135 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/client.py` and `hindsight-integrations/omo/scripts/lib/client.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:97— hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:97-102 | hindsight-integrations/strands/hindsight_strands/tools.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.
Duplicated block (6 lines × 2) hindsight-cli/src/config.rs:156— hindsight-cli/src/config.rs:156-161 | hindsight-cli/src/config.rs:278-283 — both copies are in the same file, so extract the block into 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) hindsight-cli/src/commands/explore.rs:1060— hindsight-cli/src/commands/explore.rs:1060-1065 | hindsight-cli/src/commands/explore.rs:1248-1253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/explore.rs:1060` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×19
Untrusted text written into markup unescaped hindsight-cli/about.hbs:10— `name` is text this program did not author, and it is written into the text of an element through Handlebars' raw `{{{ }}}` output with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-cli/about.hbs:15— `text` is text this program did not author, and it is written into the text of an element through Handlebars' raw `{{{ }}}` output with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-control-plane/src/components/constellation.tsx:1293— `nodeColor` is text this program did not author, and it is written into a script or style context through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute.
Untrusted text written into markup unescaped hindsight-control-plane/src/components/constellation.tsx:1315— `occurredDisplay` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-control-plane/src/components/constellation.tsx:1319— `fmtTs(mentionedAt)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-control-plane/src/components/constellation.tsx:1323— `proofCount` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-control-plane/src/components/constellation.tsx:1345— `nodeColor` is text this program did not author, and it is written into a script or style context through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute.
Untrusted text written into markup unescaped hindsight-control-plane/src/components/constellation.tsx:1351— `node.id` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-control-plane/src/lib/page-download.tsx:104— `location.origin` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1247— `nodeColor` is text this program did not author, and it is written into a script or style context through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1252— `fullText` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1258— `context` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1269— `occurredDisplay` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1273— `fmtTs(mentionedAt)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1277— `proofCount` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1281— `String(documentId).slice(0,12)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1290— `ent` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1299— `nodeColor` is text this program did not author, and it is written into a script or style context through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. A script or style context needs its own escaping (or a JSON serialiser that escapes `<`); better, pass the value through a data attribute.
Untrusted text written into markup unescaped hindsight-docs/src/components/constellation/Constellation.tsx:1305— `node.id` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×18
Animation without a prefers-reduced-motion guard hindsight-docs/src/components/ImageCarousel.tsx:25— <div> moves — its inline style sets `transition: transform 0.35s ease` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard hindsight-docs/src/components/ImageCarousel.tsx:92— <button> moves — its inline style sets `transition: width 0.25s ease, background 0.25s ease` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
Animation without a prefers-reduced-motion guard hindsight-integrations/obsidian/styles.css:66— `.hindsight-chat__sync-btn.is-syncing svg` moves (`animation: hindsight-spin 0.9s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/theme/BlogListPage/styles.module.css:228— `.cardImage` moves (`transition: transform 0.4s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/pages/templates/index.module.css:210— `.card` moves (`transition: box-shadow 0.2s ease, transform 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/pages/templates/index.module.css:565— `.submitButton` moves (`transition: opacity 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/pages/integrations/index.module.css:188— `.submitButton` moves (`transition: opacity 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/pages/integrations/index.module.css:300— `.compactCard` moves (`transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/css/custom.css:188— `.navbar::after` moves (`animation: hindsight-scroll-progress linear both`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/css/custom.css:1298— `div[class*="announcementBar"]::before` moves (`animation: shimmer 4s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/components/CookbookGrid.module.css:103— `.card` moves (`transition: box-shadow 0.2s ease, transform 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/components/IntegrationsBanner.module.css:23— `.track` moves (`animation: scrollLeft 60s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/components/ModelProviderSearch.module.css:102— `.card` moves (`transition: border-color 0.15s ease, transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/components/ProviderSetup.module.css:28— `.summary::before` moves (`transition: transform 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/components/ProviderSetup.module.css:59— `.focusIn` moves (`animation: focusIn 0.6s ease forwards`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-docs/src/components/YouTubeVideo.module.css:47— `.play` moves (`transition: transform 0.15s ease,
box-shadow 0.15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-control-plane/src/app/globals.css:476— `.animate-logo-tumble` moves (`animation: logo-tumble 1400ms cubic-bezier(0.4, -0.15, 0.3, 1.3) infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard hindsight-control-plane/src/app/globals.css:532— `.animate-logo-flip` moves (`animation: logo-flip 1200ms cubic-bezier(0.45, 0, 0.25, 1) infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:5205— hindsight-api-slim/hindsight_api/api/http.py:5205-5213 | hindsight-api-slim/hindsight_api/api/http.py:6248-6257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:5205` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:801— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:801-809 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:919-927 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:801` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:936— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:936-944 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:961-969 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:936` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/engine/providers/anthropic_llm.py:503— hindsight-api-slim/hindsight_api/engine/providers/anthropic_llm.py:503-511 | hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py:609-617 — 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 `hindsight-api-slim/hindsight_api/engine/providers/anthropic_llm.py:503` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:1030— hindsight-api-slim/hindsight_api/mcp_tools.py:1030-1038 | hindsight-api-slim/hindsight_api/mcp_tools.py:1154-1162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:1030` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:2058— hindsight-api-slim/hindsight_api/mcp_tools.py:2058-2066 | hindsight-api-slim/hindsight_api/mcp_tools.py:2125-2133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:2058` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:2234— hindsight-api-slim/hindsight_api/mcp_tools.py:2234-2242 | hindsight-api-slim/hindsight_api/mcp_tools.py:2287-2295 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:2234` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:3161— hindsight-api-slim/hindsight_api/mcp_tools.py:3161-3169 | hindsight-api-slim/hindsight_api/mcp_tools.py:3218-3226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:3161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) hindsight-extensions/static-keys-tenant/hindsight_ext_static_keys_tenant/extension.py:340— hindsight-extensions/static-keys-tenant/hindsight_ext_static_keys_tenant/extension.py:340-348 | hindsight-extensions/supabase-tenant/hindsight_ext_supabase_tenant/extension.py:420-428 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2083— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2083-2091 | hindsight-api-slim/hindsight_api/engine/embeddings.py:771-779 — 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 `hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2083` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) hindsight-integrations/cursor/scripts/lib/config.py:113— hindsight-integrations/cursor/scripts/lib/config.py:113-121 | hindsight-integrations/omo/scripts/lib/config.py:90-98 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/config.py` and `hindsight-integrations/omo/scripts/lib/config.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-embed/hindsight_embed/cli.py:1534— hindsight-embed/hindsight_embed/cli.py:1534-1542 | hindsight-embed/hindsight_embed/cli.py:1556-1564 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:87— hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:87-95 | hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:91-99 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py` and `hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/cursor/scripts/lib/config.py:101— hindsight-integrations/cursor/scripts/lib/config.py:101-109 | hindsight-integrations/omo/scripts/lib/config.py:78-86 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/config.py` and `hindsight-integrations/omo/scripts/lib/config.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/cursor/scripts/lib/state.py:49— hindsight-integrations/cursor/scripts/lib/state.py:49-57 | hindsight-integrations/omo/scripts/lib/state.py:50-58 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/state.py` and `hindsight-integrations/omo/scripts/lib/state.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-cli/src/commands/explore.rs:1025— hindsight-cli/src/commands/explore.rs:1025-1033 | hindsight-cli/src/commands/explore.rs:1386-1394 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/explore.rs:1025` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) hindsight-cli/src/commands/bank.rs:514— hindsight-cli/src/commands/bank.rs:514-522 | hindsight-cli/src/commands/bank.rs:807-815 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/bank.rs:514` it begins part-way through the construct above it, so those exact lines 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) hindsight-api-slim/hindsight_api/api/http.py:6082— hindsight-api-slim/hindsight_api/api/http.py:6082-6088 | hindsight-api-slim/hindsight_api/api/http.py:9137-9143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:6082` it begins part-way through the construct above it, so those exact lines 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) hindsight-api-slim/hindsight_api/api/http.py:6498— hindsight-api-slim/hindsight_api/api/http.py:6498-6504 | hindsight-api-slim/hindsight_api/api/http.py:6529-6535 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/api/http.py:9293— hindsight-api-slim/hindsight_api/api/http.py:9293-9299 | hindsight-api-slim/hindsight_api/api/http.py:9357-9363 — both copies are in the same file, so extract the 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 (7 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:11777— hindsight-api-slim/hindsight_api/engine/memory_engine.py:11777-11783 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:12689-12695 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2402— hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2402-2408 | hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2437-2443 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/engine/retain/bank_utils.py:656— hindsight-api-slim/hindsight_api/engine/retain/bank_utils.py:656-663 | hindsight-api-slim/hindsight_api/engine/retain/bank_utils.py:966-972 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/metrics.py:1350— hindsight-api-slim/hindsight_api/metrics.py:1350-1356 | hindsight-api-slim/hindsight_api/metrics.py:1360-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. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/metrics.py:1350` it begins part-way through the construct above it, so those exact lines 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) hindsight-dev/hindsight_dev/cli_coverage_check.py:75— hindsight-dev/hindsight_dev/cli_coverage_check.py:75-81 | hindsight-dev/hindsight_dev/client_coverage_check.py:73-79 — 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, `hindsight-dev/hindsight_dev/cli_coverage_check.py:82` calls `add` and `hindsight-dev/hindsight_dev/client_coverage_check.py:80` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) hindsight-integrations/ag2/hindsight_ag2/tools.py:162— hindsight-integrations/ag2/hindsight_ag2/tools.py:162-168 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:145-151 — 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) hindsight-integrations/cursor/scripts/lib/client.py:32— hindsight-integrations/cursor/scripts/lib/client.py:32-38 | hindsight-integrations/omo/scripts/lib/client.py:18-24 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/client.py` and `hindsight-integrations/omo/scripts/lib/client.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (7 lines × 2) hindsight-system-evals/hindsight_system_evals/corpus.py:448— hindsight-system-evals/hindsight_system_evals/corpus.py:448-454 | hindsight-system-evals/hindsight_system_evals/sources.py:317-323 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) hindsight-integrations/github-copilot/hindsight_copilot/cli.py:71— hindsight-integrations/github-copilot/hindsight_copilot/cli.py:71-77 | hindsight-integrations/openhands/hindsight_openhands/cli.py:67-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. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `CopilotConfig` in one and `OpenHandsConfig` 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 × 2) hindsight-api-slim/hindsight_api/engine/transfer/export.py:687— hindsight-api-slim/hindsight_api/engine/transfer/export.py:687-693 | hindsight-api-slim/hindsight_api/engine/transfer/export.py:1032-1038 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/engine/temporal_periods.py:84— hindsight-api-slim/hindsight_api/engine/temporal_periods.py:84-90 | hindsight-api-slim/hindsight_api/engine/temporal_periods.py:108-114 — both copies are in the same file, so extract the 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 (7 lines × 2) hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:173— hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:173-179 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:168-174 — before extracting anything, compare `hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py` and `hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) hindsight-cli/src/main.rs:2461— hindsight-cli/src/main.rs:2461-2467 | hindsight-cli/src/main.rs:2502-2508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/main.rs:2461` it begins part-way through the construct above it, so those exact lines 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) hindsight-system-tests/hindsight_system_tests/stub_server.py:107— hindsight-system-tests/hindsight_system_tests/stub_server.py:107-113 | hindsight-system-tests/hindsight_system_tests/stub_server.py:193-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-system-tests/hindsight_system_tests/stub_server.py:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
TooManyMethods: MemoryEngine hindsight-api-slim/hindsight_api/engine/memory_engine.py:2961— TooManyMethods — 285 methods. The bar is 30 methods; this is 255 over it, 9.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MemoriesExtension hindsight-api-slim/hindsight_api/engine/memories/base.py:1135— TooManyMethods — 191 methods. The bar is 30 methods; this is 161 over it, 6.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PostgresMemories hindsight-api-slim/hindsight_api/engine/memories/postgres.py:84— TooManyMethods — 155 methods. The bar is 30 methods; this is 125 over it, 5.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Hindsight hindsight-clients/python/hindsight_client/hindsight_client.py:213— TooManyMethods — 107 methods. The bar is 30 methods; this is 77 over it, 3.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ControlPlaneClient hindsight-control-plane/src/lib/api.ts:520— TooManyMethods — 104 methods. The bar is 30 methods; this is 74 over it, 3.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: HindsightMemoryProvider REDACTED:515— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: HindsightClient hindsight-clients/typescript/src/index.ts:349— TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PostgreSQLOps hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:108— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WorkerPoller hindsight-api-slim/hindsight_api/worker/poller.py:374— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: KnowledgeService hindsight-api-slim/hindsight_api/knowledge/service.py:522— TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OracleOps hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:34— TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DaemonEmbedManager hindsight-embed/hindsight_embed/daemon_embed_manager.py:273— TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DataAccessOps hindsight-api-slim/hindsight_api/engine/db/ops.py:338— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: HindsightCallback REDACTED:91— TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OperationValidatorExtension hindsight-api-slim/hindsight_api/extensions/operation_validator.py:909— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: HindsightClient hindsight-integrations/coding-agents/src/core/hindsight.ts:375— TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (11 lines × 2) hindsight-api-slim/hindsight_api/engine/memories/pg/links.py:549— hindsight-api-slim/hindsight_api/engine/memories/pg/links.py:549-559 | hindsight-api-slim/hindsight_api/engine/memories/pg/links.py:914-924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memories/pg/links.py:549` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:5495— hindsight-api-slim/hindsight_api/engine/memory_engine.py:5495-5505 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:6089-6099 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memory_engine.py:5495` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:13163— hindsight-api-slim/hindsight_api/engine/memory_engine.py:13163-13173 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:13335-13345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1406— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1406-1416 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4556-4566 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4556` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:1556— hindsight-api-slim/hindsight_api/mcp_tools.py:1556-1566 | hindsight-api-slim/hindsight_api/mcp_tools.py:1652-1662 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:1556` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:3760— hindsight-api-slim/hindsight_api/mcp_tools.py:3760-3770 | hindsight-api-slim/hindsight_api/mcp_tools.py:3865-3875 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:3760` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) hindsight-integrations/cursor/scripts/lib/bank.py:40— hindsight-integrations/cursor/scripts/lib/bank.py:40-50 | hindsight-integrations/omo/scripts/lib/bank.py:84-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/cursor/scripts/lib/bank.py:40` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) hindsight-integrations/litellm/hindsight_litellm/__init__.py:585— hindsight-integrations/litellm/hindsight_litellm/__init__.py:585-595 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:641-651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1100— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1100-1110 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1487-1497 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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) hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:61— hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:61-75 | hindsight-api-slim/hindsight_api/engine/transfer/export.py:182-192 — 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) hindsight-integrations/cursor/scripts/lib/client.py:78— hindsight-integrations/cursor/scripts/lib/client.py:78-91 | hindsight-integrations/omo/scripts/lib/client.py:88-98 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/client.py` and `hindsight-integrations/omo/scripts/lib/client.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 `timeout` to `int = DEFAULT_TIMEOUT` in one and `int = 5` 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 (11 lines × 2) hindsight-cli/src/commands/explore.rs:976— hindsight-cli/src/commands/explore.rs:976-990 | hindsight-cli/src/commands/explore.rs:1180-1190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) hindsight-cli/src/commands/explore.rs:1001— hindsight-cli/src/commands/explore.rs:1001-1013 | hindsight-cli/src/commands/explore.rs:1369-1379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/explore.rs:1001` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) hindsight-cli/src/commands/explore.rs:1009— hindsight-cli/src/commands/explore.rs:1009-1019 | hindsight-cli/src/commands/explore.rs:1205-1215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/explore.rs:1009` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) hindsight-cli/src/commands/bank.rs:935— hindsight-cli/src/commands/bank.rs:935-945 | hindsight-cli/src/commands/bank.rs:959-969 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/bank.rs:935` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (10 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:6197— hindsight-api-slim/hindsight_api/api/http.py:6197-6206 | hindsight-api-slim/hindsight_api/api/http.py:9541-9550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:6197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:6701— hindsight-api-slim/hindsight_api/api/http.py:6701-6710 | hindsight-api-slim/hindsight_api/api/http.py:6744-6753 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:6701` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:7851— hindsight-api-slim/hindsight_api/api/http.py:7851-7860 | hindsight-api-slim/hindsight_api/api/http.py:9658-9667 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:7851` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:621— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:621-630 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:632-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4551— hindsight-api-slim/hindsight_api/engine/memory_engine.py:4551-4560 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4685-4694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) REDACTED:339— REDACTED:339-348 | REDACTED:382-391 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1404— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1404-1413 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4737-4746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1404` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:3769— hindsight-api-slim/hindsight_api/mcp_tools.py:3769-3778 | hindsight-api-slim/hindsight_api/mcp_tools.py:3809-3818 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:3769` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) hindsight-integrations/cursor/scripts/retain.py:202— hindsight-integrations/cursor/scripts/retain.py:202-211 | hindsight-integrations/omo/scripts/retain.py:73-82 — 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 `hindsight-integrations/cursor/scripts/retain.py:202` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) REDACTED:973— REDACTED:973-982 | REDACTED:1601-1610 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) hindsight-integrations/litellm/hindsight_litellm/__init__.py:601— hindsight-integrations/litellm/hindsight_litellm/__init__.py:601-610 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:1348-1357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) hindsight-integrations/litellm/hindsight_litellm/__init__.py:657— hindsight-integrations/litellm/hindsight_litellm/__init__.py:657-666 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:1430-1439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py:388— hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py:388-397 | hindsight-integrations/github-copilot/hindsight_copilot/cli.py:141-150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:258— hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:258-267 | hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:243-252 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `skew_seconds` to `int = _CODEX_TOKEN_REFRESH_SKEW_SECONDS` in one and `int = _NOUS_TOKEN_REFRESH_SKEW_SECONDS` 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 × 2) hindsight-cli/src/commands/explore.rs:1037— hindsight-cli/src/commands/explore.rs:1037-1046 | hindsight-cli/src/commands/explore.rs:1390-1400 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/explore.rs:1037` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Sync-over-async blocking hindsight-docs/examples/api/memory-banks.py:115— `transfer_examples` is async and calls requests.delete — a blocking call inside async code stalls the event loop — every other task on it waits for as long as it runs.
Sync-over-async blocking hindsight-docs/plugins/integration-changelogs/index.js:35— `fs.readFileSync` in `loadContent` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-docs/plugins/integration-changelogs/index.js:45— `fs.readdirSync` in `loadContent` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-docs/plugins/integration-changelogs/index.js:54— `fs.readFileSync` in `loadContent` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-docs/plugins/renamed-docs/index.js:34— `fs.mkdirSync` in `postBuild` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-docs/plugins/renamed-docs/index.js:35— `fs.writeFileSync` in `postBuild` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-integrations/coding-agents/src/core/auto-update.ts:389— `existsSync` in `maybeAutoUpdate` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-integrations/coding-agents/src/core/hook.ts:493— `existsSync` in `runHook` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-integrations/coding-agents/src/core/page-tools.ts:180— `existsSync` in `handler` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-integrations/coding-agents/src/core/session-start.ts:122— `execFileSync` in `gitSyncNote` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-integrations/coding-agents/src/core/survey.ts:460— `writeFileSync` in `child.once("spawn")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-integrations/coding-agents/src/harness/registry.ts:24— `readFileSync` in `read` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking hindsight-integrations/openclaw/src/backfill.ts:438— `existsSync` in `runCli` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Duplicated block (15 lines × 2) hindsight-api-slim/hindsight_api/admin/cli.py:1502— hindsight-api-slim/hindsight_api/admin/cli.py:1502-1516 | hindsight-api-slim/hindsight_api/admin/cli.py:1562-1576 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1439— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1439-1453 | hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1726-1740 — both copies are in the same file, so extract the 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, `hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1467` calls `get_config` and `hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1744` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4502— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4502-4516 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4774-4788 — both copies are in the same file, so extract the block into 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) REDACTED:892— REDACTED:892-906 | REDACTED:1286-1302 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:892` it does not close everything it opens, so those 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 (15 lines × 2) hindsight-dev/hindsight_dev/generate_changelog.py:425— hindsight-dev/hindsight_dev/generate_changelog.py:425-439 | hindsight-dev/hindsight_dev/generate_changelog.py:450-464 — both copies are in the same file, so extract the 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, `hindsight-dev/hindsight_dev/generate_changelog.py:449` calls `removeprefix` and `hindsight-dev/hindsight_dev/generate_changelog.py:424` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) hindsight-integrations/cursor/scripts/lib/content.py:259— hindsight-integrations/cursor/scripts/lib/content.py:259-273 | hindsight-integrations/omo/scripts/lib/content.py:174-188 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/content.py` and `hindsight-integrations/omo/scripts/lib/content.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py:129— hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py:129-143 | hindsight-integrations/github-copilot/hindsight_copilot/mcp_config.py:105-119 — before extracting anything, compare `hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py` and `hindsight-integrations/github-copilot/hindsight_copilot/mcp_config.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/litellm/hindsight_litellm/__init__.py:912— hindsight-integrations/litellm/hindsight_litellm/__init__.py:912-926 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:972-986 — both copies are in the same file, so extract the 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) REDACTED:863— REDACTED:863-877 | REDACTED:925-939 — both copies are in the same file, so extract the 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) REDACTED:139— REDACTED:139-153 | REDACTED:175-189 — 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 (15 lines × 2) REDACTED:92— REDACTED:92-106 | REDACTED:51-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) hindsight-docs/examples/api/recall.go:13— hindsight-docs/examples/api/recall.go:13-27 | hindsight-docs/examples/api/reflect.go:13-27 — 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 `hindsight-docs/examples/api/recall.go:13` it does not close everything it opens, so those exact lines 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) hindsight-api-slim/hindsight_api/api/http.py:7269— hindsight-api-slim/hindsight_api/api/http.py:7269-7280 | hindsight-api-slim/hindsight_api/api/http.py:7343-7354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:7269` it begins part-way through the construct above it, so those 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) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4739— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4739-4750 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4789-4800 — both copies are in the same file, so extract the block into 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) hindsight-dev/hindsight_dev/generate_changelog.py:988— hindsight-dev/hindsight_dev/generate_changelog.py:988-999 | hindsight-dev/hindsight_dev/generate_changelog.py:1083-1094 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-dev/hindsight_dev/generate_changelog.py:1083` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 2) hindsight-integrations/agno/hindsight_agno/tools.py:270— hindsight-integrations/agno/hindsight_agno/tools.py:270-281 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:232-243 — before extracting anything, compare `hindsight-integrations/agno/hindsight_agno/tools.py` and `hindsight-integrations/smolagents/hindsight_smolagents/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/dify/tools/recall.py:19— hindsight-integrations/dify/tools/recall.py:19-30 | hindsight-integrations/dify/tools/reflect.py:19-31 — 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 (12 lines × 2) hindsight-integrations/github-copilot/hindsight_copilot/instructions.py:57— hindsight-integrations/github-copilot/hindsight_copilot/instructions.py:57-68 | hindsight-integrations/openhands/hindsight_openhands/agents_md.py:56-67 — before extracting anything, compare `hindsight-integrations/github-copilot/hindsight_copilot/instructions.py` and `hindsight-integrations/openhands/hindsight_openhands/agents_md.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (12 lines × 2) hindsight-integrations/github-copilot/hindsight_copilot/instructions.py:72— hindsight-integrations/github-copilot/hindsight_copilot/instructions.py:72-83 | hindsight-integrations/openhands/hindsight_openhands/agents_md.py:71-82 — before extracting anything, compare `hindsight-integrations/github-copilot/hindsight_copilot/instructions.py` and `hindsight-integrations/openhands/hindsight_openhands/agents_md.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:236— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:236-247 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:389-400 — both copies are in the same file, so extract the block into 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) hindsight-dev/hindsight_dev/cli_coverage_check.py:117— hindsight-dev/hindsight_dev/cli_coverage_check.py:117-128 | hindsight-dev/hindsight_dev/client_coverage_check.py:109-120 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-dev/hindsight_dev/cli_coverage_check.py:115` calls `isinstance`, `ValueError` and `hindsight-dev/hindsight_dev/client_coverage_check.py:108` 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 (12 lines × 2) hindsight-integrations/cursor/scripts/lib/state.py:61— hindsight-integrations/cursor/scripts/lib/state.py:61-72 | hindsight-integrations/omo/scripts/lib/state.py:62-73 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/state.py` and `hindsight-integrations/omo/scripts/lib/state.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) hindsight-integrations/haystack/hindsight_haystack/tools.py:200— hindsight-integrations/haystack/hindsight_haystack/tools.py:200-211 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:174-185 — before extracting anything, compare `hindsight-integrations/haystack/hindsight_haystack/tools.py` and `hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (12 lines × 2) hindsight-cli/src/commands/bank.rs:1233— hindsight-cli/src/commands/bank.rs:1233-1244 | hindsight-cli/src/commands/memory.rs:827-838 — 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 `hindsight-cli/src/commands/bank.rs:1233` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×12
Recursive walk over a caller-supplied document has no depth cap hindsight-integrations/obsidian/src/reflect-util.ts:13— `collectDocIds` is exported and takes `value: unknown` from its caller, and it calls itself at line 13 (`collectDocIds`) with a piece of `value` (and at line 17) — and nowhere in `collectDocIds` 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. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectDocIds` 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 hindsight-control-plane/src/lib/response-schema.ts:159— `schemaToFields` is exported, takes a document from its caller (line 171) and hands it to `schemaToNode`, which calls itself at line 159 (`schemaToNode`) with a piece of `prop` — and nowhere in `schemaToNode` 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. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `schemaToNode` 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 hindsight-clients/python/hindsight_client_api/models/map_field_input.py:115— `from_dict` is public and takes `obj: Optional[Dict[str, Any]]` from its caller, and it calls itself at line 115 (`self.from_dict`) with a piece of `obj` — and nowhere in `from_dict` 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 `from_dict` 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 hindsight-clients/python/hindsight_client_api/models/map_field_output.py:115— `from_dict` is public and takes `obj: Optional[Dict[str, Any]]` from its caller, and it calls itself at line 115 (`self.from_dict`) with a piece of `obj` — and nowhere in `from_dict` 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 `from_dict` 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 hindsight-clients/python/hindsight_client_api/models/observation_tree_folder.py:107— `from_dict` is public and takes `obj: Optional[Dict[str, Any]]` from its caller, and it calls itself at line 107 (`self.from_dict`) with a piece of `obj` — and nowhere in `from_dict` 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 `from_dict` 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 hindsight-clients/python/hindsight_client_api/models/page_node.py:160— `from_dict` is public and takes `obj: Optional[Dict[str, Any]]` from its caller, and it calls itself at line 160 (`self.from_dict`) with a piece of `obj` — and nowhere in `from_dict` 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 `from_dict` 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 hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:308— `sanitize_value` is public and takes `value: Any` from its caller, and it calls itself at line 308 (`sanitize_value`) with a piece of `value` (and at line 322, line 323, line 331) — and nowhere in `sanitize_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 `sanitize_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 hindsight-api-slim/hindsight_api/engine/multi_llm.py:79— `member_for_metadata` is public, takes a document from its caller (line 179) and hands it to `_metadata_matches`, which calls itself at line 79 (`_metadata_matches`) with a piece of `actual` — and nowhere in `_metadata_matches` 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 `_metadata_matches` 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 hindsight-api-slim/hindsight_api/engine/reflect/presentation.py:110— `resolve` is public and takes `value: Any` from its caller, and it calls itself at line 110 (`self.resolve`) with a piece of `value` (and at line 120) — and nowhere in `resolve` 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 `resolve` 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 hindsight-api-slim/hindsight_api/engine/reflect/presentation.py:138— `resolve` is public, takes a document from its caller (line 101) and hands it to `_resolve_prose`, which calls itself at line 138 (`self._resolve_prose`) with a piece of `value` (and at line 140) — and nowhere in `_resolve_prose` 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 `_resolve_prose` 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 hindsight-api-slim/hindsight_api/engine/providers/gemini_cache.py:270— `fingerprint` is public, takes a document from its caller (line 97) and hands it to `_strip_titles`, which calls itself at line 270 (`_strip_titles`) with a piece of `node` (and at line 273) — and nowhere in `_strip_titles` 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 `_strip_titles` 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 hindsight-api-slim/hindsight_api/api/http.py:134— `__init__` is public, takes a document from its caller (line 178) and hands it to `_iter_models`, which calls itself at line 134 (`_iter_models`) with a piece of `annotation` — and nowhere in `_iter_models` 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 `_iter_models` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Swallowed exception (caught, then discarded) hindsight-integrations/superagent/hindsight_superagent/__init__.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) hindsight-integrations/openhands/hindsight_openhands/openhands_config.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) hindsight-integrations/omo/scripts/lib/client.py:76— `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) REDACTED:53— `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) hindsight-integrations/langgraph/hindsight_langgraph/__init__.py:75— `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) REDACTED:263— `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) REDACTED:631— `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) hindsight-integrations/hermes/embedded.py:154— `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) hindsight-integrations/hermes/embedded.py:279— `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) hindsight-integrations/hermes/settings.py:165— `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) REDACTED:285— `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) hindsight-integrations/cursor/scripts/lib/daemon.py:68— `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.
AC2 · Forms & labels· <Select> field component without a label · ×11
<Select> field component without a label hindsight-control-plane/src/components/audit-logs-view.tsx:205— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label hindsight-control-plane/src/components/audit-logs-view.tsx:392— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
<Select> field component without a label hindsight-control-plane/src/components/audit-logs-view.tsx:405— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
<Select> field component without a label hindsight-control-plane/src/components/audit-logs-view.tsx:418— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label hindsight-control-plane/src/components/bank-config-view.tsx:1099— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label hindsight-control-plane/src/components/bank-config-view.tsx:2497— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label hindsight-control-plane/src/components/bank-config-view.tsx:3133— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label hindsight-control-plane/src/components/bank-operations-view.tsx:624— This select is named only by the placeholder of its value part. Nothing is typed into a select, so the placeholder does not vanish on input: it is shown as the trigger's text until a value is chosen, and then the chosen value replaces it — so at no point does the control state what the choice is for, and the trigger's role (combobox) takes its name from the author, not from that text. Name it: an aria-label on the trigger, or an id on the trigger with a <label htmlFor> pointing at it.
<Select> field component without a label hindsight-control-plane/src/components/bank-selector.tsx:1385— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label hindsight-control-plane/src/components/bank-selector.tsx:1561— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Select> field component without a label hindsight-control-plane/src/components/bank-selector.tsx:1627— This UI-library field component has no label / aria-label / aria-labelledby / id, and nothing written inside it here carries one either (a name prop is the form-submission key, not a label; an id alone, wherever it is set, names nothing until a label points at it). The text inside it does not stand in for one: these compound APIs render a trigger with role="combobox" (or role="button"), and those roles take their name from the AUTHOR, not from their content — so the words on screen never reach the accessibility tree as a name. Name it whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
hindsight_cli::run (cyclomatic 90) hindsight-cli/src/main.rs:1516— hindsight_cli::run has cyclomatic complexity 90 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hindsight_cli::commands::explore::run_app (cyclomatic 41) hindsight-cli/src/commands/explore.rs:1529— hindsight_cli::commands::explore::run_app 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.
hindsight_cli::commands::memory::retain_files (cyclomatic 24) hindsight-cli/src/commands/memory.rs:567— hindsight_cli::commands::memory::retain_files 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.
hindsight_cli::errors::format_error_message (cyclomatic 23) hindsight-cli/src/errors.rs:60— hindsight_cli::errors::format_error_message 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.
hindsight_cli::commands::bank::set_config (cyclomatic 20) hindsight-cli/src/commands/bank.rs:882— hindsight_cli::commands::bank::set_config 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.
hindsight_cli::commands::memory::get (cyclomatic 20) hindsight-cli/src/commands/memory.rs:193— hindsight_cli::commands::memory::get 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.
hindsight_cli::commands::bank::consolidate (cyclomatic 19) hindsight-cli/src/commands/bank.rs:652— hindsight_cli::commands::bank::consolidate 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.
hindsight_cli::commands::mental_model::apply_trigger_update (cyclomatic 18) hindsight-cli/src/commands/mental_model.rs:135— hindsight_cli::commands::mental_model::apply_trigger_update 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.
hindsight_cli::commands::explore::render_control_bar (cyclomatic 17) hindsight-cli/src/commands/explore.rs:758— hindsight_cli::commands::explore::render_control_bar has cyclomatic complexity 17 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
hindsight_cli::handle_profile (cyclomatic 16) hindsight-cli/src/main.rs:2578— hindsight_cli::handle_profile has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Duplicated block (13 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:6439— hindsight-api-slim/hindsight_api/api/http.py:6439-6451 | hindsight-api-slim/hindsight_api/api/http.py:7240-7252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:6439` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:10260— hindsight-api-slim/hindsight_api/api/http.py:10260-10272 | hindsight-api-slim/hindsight_api/api/http.py:10386-10398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:10260` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1931— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1931-1943 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3698-3710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:1628— hindsight-api-slim/hindsight_api/mcp_tools.py:1628-1640 | hindsight-api-slim/hindsight_api/mcp_tools.py:1722-1734 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py:415— hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py:415-427 | hindsight-integrations/github-copilot/hindsight_copilot/cli.py:156-168 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py:413` calls `add_argument` and `hindsight-integrations/github-copilot/hindsight_copilot/cli.py:155` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) hindsight-integrations/langgraph/hindsight_langgraph/tools.py:182— hindsight-integrations/langgraph/hindsight_langgraph/tools.py:182-194 | hindsight-integrations/strands/hindsight_strands/tools.py:216-228 — 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 (13 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:752— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:752-764 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:821-833 — both copies are in the same file, so extract the 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 (13 lines × 2) hindsight-system-evals/hindsight_system_evals/refresh_cost.py:635— hindsight-system-evals/hindsight_system_evals/refresh_cost.py:635-647 | hindsight-system-evals/hindsight_system_evals/retrieval.py:189-201 — 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 (13 lines × 2) hindsight-integrations/cursor/scripts/lib/client.py:55— hindsight-integrations/cursor/scripts/lib/client.py:55-67 | hindsight-integrations/omo/scripts/lib/client.py:55-67 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/client.py` and `hindsight-integrations/omo/scripts/lib/client.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) hindsight-api-slim/hindsight_api/engine/memories/pg/counts.py:129— hindsight-api-slim/hindsight_api/engine/memories/pg/counts.py:129-142 | hindsight-api-slim/hindsight_api/engine/memories/pg/transfer.py:456-468 — 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.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×9
Members sharing a duplicated core (4 members, 50+ identical tokens) hindsight-api-slim/hindsight_api/engine/db/oracle.py:1157— hindsight-api-slim/hindsight_api/engine/db/oracle.py:1157-1194 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1267-1306 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1309-1348 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1351-1398 — 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) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4103— hindsight-api-slim/hindsight_api/engine/memory_engine.py:4103-4158 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4161-4220 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4223-4284 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4287-4362 — 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) hindsight-api-slim/hindsight_api/engine/memory_engine.py:14639— hindsight-api-slim/hindsight_api/engine/memory_engine.py:14639-14773 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:14914-14969 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:19827-20165 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:22266-22348 — 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) hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:279— hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:279-320 | hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:259-303 | REDACTED:316-350 | REDACTED:354-391 — 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) hindsight-integrations/aider/hindsight_aider/config.py:103— hindsight-integrations/aider/hindsight_aider/config.py:103-128 | hindsight-integrations/devin-desktop/hindsight_devin_desktop/config.py:69-95 | hindsight-integrations/github-copilot/hindsight_copilot/config.py:51-76 | hindsight-integrations/openhands/hindsight_openhands/config.py:52-77 — 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) hindsight-integrations/litellm/hindsight_litellm/__init__.py:558— hindsight-integrations/litellm/hindsight_litellm/__init__.py:558-610 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:614-666 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:1268-1357 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:1361-1439 — 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) hindsight-cli/src/commands/bank.rs:489— hindsight-cli/src/commands/bank.rs:489-535 | hindsight-cli/src/commands/bank.rs:782-828 | hindsight-cli/src/commands/directive.rs:219-261 | hindsight-cli/src/commands/mental_model.rs:449-491 — 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) hindsight-cli/src/commands/bank.rs:1100— hindsight-cli/src/commands/bank.rs:1100-1125 | hindsight-cli/src/commands/document.rs:342-387 | hindsight-cli/src/commands/memory.rs:848-884 | hindsight-cli/src/commands/operation.rs:192-217 — 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) hindsight-cli/src/commands/explore.rs:973— hindsight-cli/src/commands/explore.rs:973-1098 | hindsight-cli/src/commands/explore.rs:1105-1175 | hindsight-cli/src/commands/explore.rs:1177-1274 | hindsight-cli/src/commands/explore.rs:1276-1470 — 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 (5 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1158— hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1158-1162 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1336-1340 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/engine/providers/cursor_llm.py:402— hindsight-api-slim/hindsight_api/engine/providers/cursor_llm.py:402-406 | hindsight-api-slim/hindsight_api/engine/providers/xai_oauth_llm.py:734-738 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) hindsight-dev/hindsight_dev/cli_coverage_check.py:110— hindsight-dev/hindsight_dev/cli_coverage_check.py:110-114 | hindsight-dev/hindsight_dev/client_coverage_check.py:104-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) hindsight-embed/hindsight_embed/cli.py:594— hindsight-embed/hindsight_embed/cli.py:594-598 | hindsight-embed/hindsight_embed/cli.py:775-780 — both copies are in the same file, so extract the block into 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) hindsight-dev/hindsight_dev/cli_coverage_check.py:58— hindsight-dev/hindsight_dev/cli_coverage_check.py:58-62 | hindsight-dev/hindsight_dev/client_coverage_check.py:51-55 — 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) hindsight-integrations/cursor/scripts/lib/state.py:30— hindsight-integrations/cursor/scripts/lib/state.py:30-34 | hindsight-integrations/omo/scripts/lib/state.py:31-35 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/state.py` and `hindsight-integrations/omo/scripts/lib/state.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/cursor/scripts/lib/state.py:30` it does not close everything it opens, so those exact lines 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) hindsight-integrations/github-copilot/hindsight_copilot/cli.py:40— hindsight-integrations/github-copilot/hindsight_copilot/cli.py:40-44 | hindsight-integrations/openhands/hindsight_openhands/cli.py:44-48 — 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 `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 `config` to `CopilotConfig` in one and `OpenHandsConfig` 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 × 2) hindsight-embed/hindsight_embed/daemon_embed_manager.py:1065— hindsight-embed/hindsight_embed/daemon_embed_manager.py:1065-1069 | hindsight-embed/hindsight_embed/daemon_embed_manager.py:1355-1359 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) hindsight-cli/src/commands/bank.rs:455— hindsight-cli/src/commands/bank.rs:455-459 | hindsight-cli/src/commands/memory.rs:169-173 — 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.
TodoComment hindsight-docs/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx:7— // TODO temporary casting until ThemeConfig type is improved — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment hindsight-docs/src/theme/Navbar/Content/index.tsx:19— // TODO temporary casting until ThemeConfig type is improved — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment hindsight-docs/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx:15— // TODO how can the order be defined for mobile? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment hindsight-docs/src/theme/Navbar/MobileSidebar/Layout/index.tsx:7— // TODO Docusaurus v4: remove temporary inert workaround — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment hindsight-docs/src/theme/Navbar/Content/index.tsx:105— // TODO stop hardcoding items? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment hindsight-docs/src/theme/Navbar/Content/index.tsx:123— // TODO stop hardcoding items? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment hindsight-clients/python/hindsight_client_api/api_client.py:64— # TODO remove as only py3 is supported? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment hindsight-api-slim/tests/test_oracle_http_integration.py:343— # TODO: Tags should appear via document_tags, but HTTP endpoint may not — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×8
Edited copy of a member (10 corresponding lines) hindsight-api-slim/hindsight_api/knowledge/embedders.py:576— hindsight-api-slim/hindsight_api/knowledge/embedders.py:576-586 | hindsight-api-slim/hindsight_api/knowledge/embedders.py:636-645 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) hindsight-system-evals/hindsight_system_evals/server.py:236— hindsight-system-evals/hindsight_system_evals/server.py:236-245 | hindsight-system-tests/hindsight_system_tests/server.py:324-335 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) hindsight-system-evals/hindsight_system_evals/refresh_cost.py:665— hindsight-system-evals/hindsight_system_evals/refresh_cost.py:665-674 | hindsight-system-evals/hindsight_system_evals/retrieval.py:426-438 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) hindsight-api-slim/hindsight_api/engine/embeddings.py:1520— hindsight-api-slim/hindsight_api/engine/embeddings.py:1520-1538 | hindsight-api-slim/hindsight_api/engine/embeddings.py:1659-1668 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) hindsight-api-slim/hindsight_api/config.py:2596— hindsight-api-slim/hindsight_api/config.py:2596-2611 | hindsight-api-slim/hindsight_api/config.py:2615-2624 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) hindsight-api-slim/hindsight_api/__init__.py:72— hindsight-api-slim/hindsight_api/__init__.py:72-83 | hindsight-api-slim/hindsight_api/main.py:71-80 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:9060— hindsight-api-slim/hindsight_api/engine/memory_engine.py:9060-9076 | hindsight-api-slim/hindsight_api/knowledge/store.py:801-810 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) hindsight-api-slim/hindsight_api/engine/response_models.py:1235— hindsight-api-slim/hindsight_api/engine/response_models.py:1235-1244 | hindsight-api-slim/hindsight_api/mcp_tools.py:258-269 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (16 lines × 2) hindsight-api-slim/hindsight_api/config_resolver.py:116— hindsight-api-slim/hindsight_api/config_resolver.py:116-131 | hindsight-api-slim/hindsight_api/config_resolver.py:1064-1079 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:384— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:384-399 | hindsight-api-slim/hindsight_api/engine/embeddings.py:409-424 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4114— hindsight-api-slim/hindsight_api/engine/memory_engine.py:4114-4129 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4300-4315 — both copies are in the same file, so extract the 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, `hindsight-api-slim/hindsight_api/engine/memory_engine.py:4113` calls `get` and `hindsight-api-slim/hindsight_api/engine/memory_engine.py:4299` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:20087— hindsight-api-slim/hindsight_api/engine/memory_engine.py:20087-20102 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:22310-22325 — both copies are in the same file, so extract the 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 (16 lines × 2) hindsight-api-slim/hindsight_api/engine/sql/oracle.py:240— hindsight-api-slim/hindsight_api/engine/sql/oracle.py:240-255 | hindsight-api-slim/hindsight_api/engine/sql/postgresql.py:336-351 — 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 (16 lines × 2) hindsight-embed/hindsight_embed/cli.py:1229— hindsight-embed/hindsight_embed/cli.py:1229-1244 | hindsight-embed/hindsight_embed/cli.py:1268-1283 — both copies are in the same file, so extract the 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 (16 lines × 2) hindsight-integrations/omo/demo.py:173— hindsight-integrations/omo/demo.py:173-188 | hindsight-integrations/omo/demo.py:228-243 — both copies are in the same file, so extract the 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, `hindsight-integrations/omo/demo.py:223` calls `success`, `step`, `sleep` and `hindsight-integrations/omo/demo.py:172` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2) hindsight-dev/hindsight_dev/sync_cookbook.py:298— hindsight-dev/hindsight_dev/sync_cookbook.py:298-313 | hindsight-dev/hindsight_dev/sync_cookbook.py:388-403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-dev/hindsight_dev/sync_cookbook.py:298` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:5460— hindsight-api-slim/hindsight_api/api/http.py:5460-5473 | hindsight-api-slim/hindsight_api/api/http.py:5522-5535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:5460` it begins part-way through the construct above it, so those 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 lines × 2) hindsight-api-slim/hindsight_api/engine/db/oracle.py:1286— hindsight-api-slim/hindsight_api/engine/db/oracle.py:1286-1299 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1326-1339 — both copies are in the same file, so extract the block into 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) hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:251— hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:251-264 | hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py:159-172 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2611— hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2611-2624 | hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2626-2639 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2611` it begins part-way through the construct above it, so those 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 lines × 2) hindsight-api-slim/hindsight_api/engine/transfer/export.py:787— hindsight-api-slim/hindsight_api/engine/transfer/export.py:787-800 | hindsight-api-slim/hindsight_api/engine/transfer/export.py:1103-1116 — both copies are in the same file, so extract the block into 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) hindsight-dev/hindsight_dev/sync_cookbook.py:471— hindsight-dev/hindsight_dev/sync_cookbook.py:471-484 | hindsight-dev/hindsight_dev/sync_cookbook.py:495-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-dev/hindsight_dev/sync_cookbook.py:471` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) hindsight-integrations/omo/demo.py:213— hindsight-integrations/omo/demo.py:213-226 | hindsight-integrations/omo/demo.py:269-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) hindsight-integrations/haystack/hindsight_haystack/tools.py:214— hindsight-integrations/haystack/hindsight_haystack/tools.py:214-227 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:188-201 — before extracting anything, compare `hindsight-integrations/haystack/hindsight_haystack/tools.py` and `hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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.
Boundary violation [package:third-party-deep-import] hindsight-docs/src/theme/Navbar/Content/index.tsx:8— hindsight-docs/src/theme/Navbar/Content/index.tsx:8 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] hindsight-docs/src/theme/Navbar/Layout/index.tsx:4— hindsight-docs/src/theme/Navbar/Layout/index.tsx:4 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] hindsight-docs/src/theme/Navbar/MobileSidebar/Header/index.tsx:2— hindsight-docs/src/theme/Navbar/MobileSidebar/Header/index.tsx:2 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] hindsight-docs/src/theme/Navbar/MobileSidebar/Layout/index.tsx:3— hindsight-docs/src/theme/Navbar/MobileSidebar/Layout/index.tsx:3 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] hindsight-docs/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx:3— hindsight-docs/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx:3 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] hindsight-docs/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx:3— hindsight-docs/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx:3 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] hindsight-docs/src/theme/Navbar/MobileSidebar/Toggle/index.tsx:2— hindsight-docs/src/theme/Navbar/MobileSidebar/Toggle/index.tsx:2 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
Boundary violation [package:third-party-deep-import] hindsight-docs/src/theme/Navbar/MobileSidebar/index.tsx:2— hindsight-docs/src/theme/Navbar/MobileSidebar/index.tsx:2 imports @docusaurus/theme-common/internal, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
AC2 · Forms & labels· <Textarea> field component without a label · ×7
<Textarea> field component without a label hindsight-control-plane/src/components/bank-config-view.tsx:2270— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label hindsight-control-plane/src/components/bank-config-view.tsx:2337— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label hindsight-control-plane/src/components/bank-profile-view.tsx:757— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label hindsight-control-plane/src/components/bank-profile-view.tsx:884— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label hindsight-control-plane/src/components/bank-selector.tsx:1155— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label hindsight-control-plane/src/components/bank-selector.tsx:1459— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
<Textarea> field component without a label hindsight-control-plane/src/components/bank-selector.tsx:1701— This UI-library field component is named only by a placeholder — a placeholder is not a label (it vanishes as soon as the user types, and many assistive technologies ignore it). Give it a real name whichever way this library supports: a label prop, an aria-label, or an id on the rendered control with a <label htmlFor> pointing at it. For a group of controls, name the group itself (aria-label, or a fieldset with a legend) — labelling each item leaves the set unnamed.
Duplicated block (18 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:8540— hindsight-api-slim/hindsight_api/api/http.py:8540-8557 | hindsight-api-slim/hindsight_api/api/http.py:10217-10236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:8540` it begins part-way through the construct above it, so those exact lines 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) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1218— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1218-1235 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1288-1305 — both copies are in the same file, so extract the 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 (18 lines × 2) hindsight-api-slim/hindsight_api/engine/embeddings.py:1093— hindsight-api-slim/hindsight_api/engine/embeddings.py:1093-1110 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1039-1056 — 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 `hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1039` it begins part-way through the construct above it, so those exact lines 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) hindsight-integrations/agno/hindsight_agno/tools.py:232— hindsight-integrations/agno/hindsight_agno/tools.py:232-249 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:169-186 — before extracting anything, compare `hindsight-integrations/agno/hindsight_agno/tools.py` and `hindsight-integrations/smolagents/hindsight_smolagents/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/haystack/hindsight_haystack/tools.py:230— hindsight-integrations/haystack/hindsight_haystack/tools.py:230-247 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:204-221 — before extracting anything, compare `hindsight-integrations/haystack/hindsight_haystack/tools.py` and `hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (18 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1182— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1182-1199 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1604-1621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1623` calls `get` and `hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1203` 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 (18 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1517— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1517-1534 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1853-1878 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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.
Change coupling: ops_oracle.py ↔ ops_postgresql.py hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1— `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` change together 100% of the time (30 of the 30 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 30 shared commits counted here, the most recent 3 are `84c14301` fix(oracle): a link to a memory deleted mid-retain no longer fails th…; `b801b694` fix(entities): keep mention_count exact under concurrent deletes and …; `2004c4fe` feat(extensions): operation runs - each operation's wall time and whe… — run `git show` on any of them.
Change coupling: ops_oracle.py ↔ graph.py hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1— `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `84c14301` fix(oracle): a link to a memory deleted mid-retain no longer fails th…; `b801b694` fix(entities): keep mention_count exact under concurrent deletes and …; `64a98aa5` fix(entities): give mention_count back when the mentions go (#4291) (… — run `git show` on any of them.
Change coupling: retain-hook.ts ↔ session-start.ts hindsight-integrations/coding-agents/src/core/retain-hook.ts:1— `hindsight-integrations/coding-agents/src/core/retain-hook.ts` and `hindsight-integrations/coding-agents/src/core/session-start.ts` change together 60% of the time (9 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `87a9d036` fix(coding-agents): memory injection on long prompts, empty first rec…; `cdaf0e5a` fix(coding-agents): Windows hooks and spawns, pi session cwd, git log…; `c23e9885` fix(coding-agents): stop a failed git probe from forking a worktree i… — run `git show` on any of them.
Change coupling: n9i0j1k2l3m4_learnings_and_pinned_reflections.py ↔ config.py hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:1— `hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py` and `hindsight-api-slim/hindsight_api/config.py` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `16f80769` feat(api): add pg_search tokenizer configuration (#1776); `4cd260b6` feat(api): add ParadeDB pg_search as Citus-compatible BM25 backend (#…; `e4422a9b` Add AlloyDB ScaNN vector index support (#1459) — run `git show` on any of them.
Change coupling: link_expansion.py ↔ retrieval.py hindsight-api-slim/hindsight_api/engine/memories/pg/link_expansion.py:1— `hindsight-api-slim/hindsight_api/engine/memories/pg/link_expansion.py` and `hindsight-api-slim/hindsight_api/engine/search/retrieval.py` change together 53% of the time (10 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 `3650a6e1` docs(recall): say that the created_after/created_before window filter… (at that commit the file was still `hindsight-api-slim/hindsight_api/engine/search/link_expansion_retrieval.py`); `bda7ffd2` fix(recall): apply the created_after/created_before window to graph e… (at that commit the file was still `hindsight-api-slim/hindsight_api/engine/search/link_expansion_retrieval.py`); `b475f5cc` perf: eliminate redundant graph seed and UUID scans (#2968) (at that commit the file was still `hindsight-api-slim/hindsight_api/engine/search/link_expansion_retrieval.py`) — run `git show` on any of them.
Change coupling: 5a366d414dce_initial_schema.py ↔ config.py hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:1— `hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py` and `hindsight-api-slim/hindsight_api/config.py` change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `16f80769` feat(api): add pg_search tokenizer configuration (#1776); `4cd260b6` feat(api): add ParadeDB pg_search as Citus-compatible BM25 backend (#…; `cb04cb79` feat(bm25): configurable native language + opt-in pgroonga backend (#… — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×6
Edited copy of a member (21 corresponding lines) hindsight-api-slim/hindsight_api/engine/storage/__init__.py:125— hindsight-api-slim/hindsight_api/engine/storage/__init__.py:125-158 | hindsight-api-slim/hindsight_api/knowledge/store.py:1247-1267 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:282— hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:282-302 | hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:305-325 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) hindsight-cli/src/commands/bank.rs:1224— hindsight-cli/src/commands/bank.rs:1224-1244 | hindsight-cli/src/commands/memory.rs:818-838 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py:453— hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py:453-477 | hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py:487-507 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) hindsight-api-slim/hindsight_api/admin/cli.py:1651— hindsight-api-slim/hindsight_api/admin/cli.py:1651-1671 | hindsight-api-slim/hindsight_api/admin/cli.py:1717-1740 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/base.py:3875— hindsight-api-slim/hindsight_api/engine/memories/base.py:3875-3895 | hindsight-api-slim/hindsight_api/engine/memories/base.py:4060-4081 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (19 lines × 2) hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:502— hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:502-520 | hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:734-752 — 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 `hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:502` it begins part-way through the construct above it, so those exact lines 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) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3005— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3005-3023 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4345-4363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3005` it begins part-way through the construct above it, so those exact lines 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) hindsight-api-slim/hindsight_api/mcp_tools.py:1281— hindsight-api-slim/hindsight_api/mcp_tools.py:1281-1299 | hindsight-api-slim/hindsight_api/mcp_tools.py:1419-1437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:1281` it does not close everything it opens, so those exact lines 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) hindsight-api-slim/hindsight_api/mcp_tools.py:1607— hindsight-api-slim/hindsight_api/mcp_tools.py:1607-1625 | hindsight-api-slim/hindsight_api/mcp_tools.py:1701-1719 — both copies are in the same file, so extract the block into 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) hindsight-dev/hindsight_dev/sync_cookbook.py:579— hindsight-dev/hindsight_dev/sync_cookbook.py:579-597 | hindsight-dev/hindsight_dev/sync_cookbook.py:600-618 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py:107— hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py:107-125 | hindsight-integrations/github-copilot/hindsight_copilot/mcp_config.py:83-101 — before extracting anything, compare `hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py` and `hindsight-integrations/github-copilot/hindsight_copilot/mcp_config.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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· Edited copy of a member (25 corresponding lines) · ×5
Edited copy of a member (25 corresponding lines) hindsight-dev/hindsight_dev/cli_coverage_check.py:100— hindsight-dev/hindsight_dev/cli_coverage_check.py:100-128 | hindsight-dev/hindsight_dev/client_coverage_check.py:96-120 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) hindsight-dev/hindsight_dev/cli_coverage_check.py:66— hindsight-dev/hindsight_dev/cli_coverage_check.py:66-96 | hindsight-dev/hindsight_dev/client_coverage_check.py:68-92 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) hindsight-api-slim/hindsight_api/engine/embeddings.py:1569— hindsight-api-slim/hindsight_api/engine/embeddings.py:1569-1605 | hindsight-api-slim/hindsight_api/engine/embeddings.py:1694-1718 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/2071c7518f88_add_memory_links_bank_id_index.py:61— hindsight-api-slim/hindsight_api/alembic/versions/2071c7518f88_add_memory_links_bank_id_index.py:61-91 | hindsight-api-slim/hindsight_api/alembic/versions/c4e8a1b7d2f6_memory_units_bank_updated_at_index.py:68-92 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) hindsight-api-slim/hindsight_api/worker/poller.py:1118— hindsight-api-slim/hindsight_api/worker/poller.py:1118-1144 | hindsight-api-slim/hindsight_api/worker/poller.py:1175-1199 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×5
Edited copy of a member (28 corresponding lines) hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py:388— hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py:388-427 | hindsight-integrations/github-copilot/hindsight_copilot/cli.py:141-168 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:553— hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:553-580 | hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:584-618 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) REDACTED:955— REDACTED:955-982 | REDACTED:1585-1613 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:12822— hindsight-api-slim/hindsight_api/engine/memory_engine.py:12822-12849 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:17052-17089 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) hindsight-api-slim/hindsight_api/engine/retain/link_creation.py:47— hindsight-api-slim/hindsight_api/engine/retain/link_creation.py:47-81 | hindsight-api-slim/hindsight_api/engine/retain/link_creation.py:87-114 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×5
Edited copy of a member (15 corresponding lines) hindsight-api-slim/hindsight_api/engine/remote_retry.py:235— hindsight-api-slim/hindsight_api/engine/remote_retry.py:235-249 | hindsight-api-slim/hindsight_api/engine/remote_retry.py:259-273 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py:76— hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py:76-90 | hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py:60-74 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) hindsight-integrations/haystack/hindsight_haystack/tools.py:276— hindsight-integrations/haystack/hindsight_haystack/tools.py:276-290 | hindsight-integrations/haystack/hindsight_haystack/tools.py:293-310 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/a9b8c7d6e5f4_add_knowledge_pages.py:38— hindsight-api-slim/hindsight_api/alembic/versions/a9b8c7d6e5f4_add_knowledge_pages.py:38-77 | hindsight-api-slim/hindsight_api/alembic/versions/f3a5b7c9d1e2_drop_memory_units_bm25_matview.py:42-56 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) hindsight-integrations/haystack/hindsight_haystack/tools.py:259— hindsight-integrations/haystack/hindsight_haystack/tools.py:259-273 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:235-249 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×5
Edited copy of a member (14 corresponding lines) hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:137— hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:137-151 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:154-167 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) hindsight-api-slim/hindsight_api/engine/parsers/iris.py:139— hindsight-api-slim/hindsight_api/engine/parsers/iris.py:139-152 | hindsight-api-slim/hindsight_api/engine/parsers/llama_parse.py:140-153 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) hindsight-integrations/aider/hindsight_aider/bank.py:22— hindsight-integrations/aider/hindsight_aider/bank.py:22-36 | hindsight-integrations/devin-desktop/hindsight_devin_desktop/project.py:29-42 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) hindsight-cli/src/commands/explore.rs:694— hindsight-cli/src/commands/explore.rs:694-707 | hindsight-cli/src/commands/explore.rs:709-722 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) hindsight-embed/hindsight_embed/control_center/lifecycle.py:126— hindsight-embed/hindsight_embed/control_center/lifecycle.py:126-139 | hindsight-embed/hindsight_embed/daemon_embed_manager.py:807-820 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×5
Edited copy of a member (9 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/base.py:4604— hindsight-api-slim/hindsight_api/engine/memories/base.py:4604-4625 | hindsight-api-slim/hindsight_api/engine/memories/base.py:4630-4638 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:2052— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:2052-2060 | hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:2068-2078 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:5722— hindsight-api-slim/hindsight_api/engine/memory_engine.py:5722-5730 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:5733-5754 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/transfer.py:344— hindsight-api-slim/hindsight_api/engine/memories/pg/transfer.py:344-361 | hindsight-api-slim/hindsight_api/engine/transfer/export.py:466-474 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/engine_curation.py:238— hindsight-api-slim/hindsight_api/engine/memories/pg/engine_curation.py:238-246 | hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py:302-331 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×5
Edited copies of one member (3 members, 11+ corresponding lines) hindsight-integrations/agent-framework/hindsight_agent_framework/provider.py:192— hindsight-integrations/agent-framework/hindsight_agent_framework/provider.py:192-203 | hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:226-236 | hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:239-249 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/b3c4d5e6f7g8_add_temporal_date_indexes.py:39— hindsight-api-slim/hindsight_api/alembic/versions/b3c4d5e6f7g8_add_temporal_date_indexes.py:39-60 | hindsight-api-slim/hindsight_api/alembic/versions/d2e3f4a5b6c7_add_memory_links_expansion_indexes.py:51-74 | hindsight-api-slim/hindsight_api/alembic/versions/d4e5f6g7h8i9_gin_source_memory_ids_fastupdate_off.py:35-45 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/c2d3e4f5g6h7_add_audit_log_table.py:32— hindsight-api-slim/hindsight_api/alembic/versions/c2d3e4f5g6h7_add_audit_log_table.py:32-54 | hindsight-api-slim/hindsight_api/alembic/versions/e4f5a6b7c8d9_add_webhooks_tables.py:29-56 | hindsight-api-slim/hindsight_api/alembic/versions/g2a3b4c5d6e7_add_tags_column.py:31-41 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/banks.py:114— hindsight-api-slim/hindsight_api/engine/memories/pg/banks.py:114-124 | hindsight-api-slim/hindsight_api/engine/memories/pg/expand.py:29-41 | hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:282-292 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/consolidation.py:53— hindsight-api-slim/hindsight_api/engine/memories/pg/consolidation.py:53-63 | hindsight-api-slim/hindsight_api/engine/memories/pg/expand.py:47-57 | hindsight-api-slim/hindsight_api/engine/memories/pg/retain.py:208-218 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (24 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1079— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1079-1102 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1509-1532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) hindsight-integrations/omo/scripts/recall.py:73— hindsight-integrations/omo/scripts/recall.py:73-96 | hindsight-integrations/omo/scripts/retain.py:100-123 — 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 (24 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/a1d3f5b7c9e2_widen_remaining_bank_id_to_text.py:62— hindsight-api-slim/hindsight_api/alembic/versions/a1d3f5b7c9e2_widen_remaining_bank_id_to_text.py:62-85 | hindsight-api-slim/hindsight_api/alembic/versions/c3e5a7b9d1f4_widen_history_bank_id_to_text.py:52-75 — 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 (24 lines × 2) hindsight-integrations/pipecat/hindsight_pipecat/config.py:38— hindsight-integrations/pipecat/hindsight_pipecat/config.py:38-61 | hindsight-integrations/vapi/hindsight_vapi/config.py:38-61 — before extracting anything, compare `hindsight-integrations/pipecat/hindsight_pipecat/config.py` and `hindsight-integrations/vapi/hindsight_vapi/config.py` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (24 lines × 2) hindsight-cli/src/commands/bank.rs:292— hindsight-cli/src/commands/bank.rs:292-315 | hindsight-cli/src/commands/bank.rs:361-384 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/bank.rs:292` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:8266— hindsight-api-slim/hindsight_api/api/http.py:8266-8288 | hindsight-api-slim/hindsight_api/api/http.py:8312-8334 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:8266` it begins part-way through the construct above it, so those 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 (23 lines × 2) hindsight-integrations/cursor/scripts/lib/bank.py:78— hindsight-integrations/cursor/scripts/lib/bank.py:78-100 | hindsight-integrations/omo/scripts/lib/bank.py:119-141 — 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 `hindsight-integrations/cursor/scripts/lib/bank.py:78` it does not close everything it opens, so those 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 (23 lines × 2) hindsight-integrations/langgraph/hindsight_langgraph/tools.py:301— hindsight-integrations/langgraph/hindsight_langgraph/tools.py:301-323 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:298-320 — before extracting anything, compare `hindsight-integrations/langgraph/hindsight_langgraph/tools.py` and `hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 86 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:884— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:884-906 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1314-1336 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23 lines × 2) hindsight-integrations/omo/scripts/recall.py:31— hindsight-integrations/omo/scripts/recall.py:31-53 | hindsight-integrations/omo/scripts/retain.py:29-51 — 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 (21 lines × 2) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:639— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:639-659 | hindsight-api-slim/hindsight_api/engine/embeddings.py:888-908 — 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 `hindsight-api-slim/hindsight_api/engine/cross_encoder.py:639` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:9971— hindsight-api-slim/hindsight_api/engine/memory_engine.py:9971-9991 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:10002-10022 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:964— hindsight-api-slim/hindsight_api/engine/reflect/agent.py:964-984 | hindsight-api-slim/hindsight_api/engine/reflect/agent.py:1546-1566 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/reflect/agent.py:964` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (21 lines × 2) hindsight-integrations/github-copilot/hindsight_copilot/config.py:56— hindsight-integrations/github-copilot/hindsight_copilot/config.py:56-76 | hindsight-integrations/openhands/hindsight_openhands/config.py:57-77 — before extracting anything, compare `hindsight-integrations/github-copilot/hindsight_copilot/config.py` and `hindsight-integrations/openhands/hindsight_openhands/config.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (21 lines × 2) REDACTED:948— REDACTED:948-968 | REDACTED:980-1000 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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) hindsight-api-slim/hindsight_api/api/http.py:6937— hindsight-api-slim/hindsight_api/api/http.py:6937-6945 | hindsight-api-slim/hindsight_api/api/http.py:7461-7469 | hindsight-api-slim/hindsight_api/api/http.py:8448-8456 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/api/http.py:6937` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2201— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2201-2209 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2315-2323 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2596-2604 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2591` calls `get` and `hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2196` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 3) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1881— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1881-1892 | hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:161-169 | hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:443-454 — 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 lines × 3) hindsight-integrations/devin-desktop/hindsight_devin_desktop/config.py:83— hindsight-integrations/devin-desktop/hindsight_devin_desktop/config.py:83-91 | hindsight-integrations/github-copilot/hindsight_copilot/config.py:64-72 | hindsight-integrations/openhands/hindsight_openhands/config.py:65-73 — before extracting anything, compare `hindsight-integrations/github-copilot/hindsight_copilot/config.py` and `hindsight-integrations/openhands/hindsight_openhands/config.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1436— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1436-1445 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1448-1456 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1457-1465 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1436` it begins part-way through the construct above it, so those 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 (7 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:7478— hindsight-api-slim/hindsight_api/api/http.py:7478-7492 | hindsight-api-slim/hindsight_api/api/http.py:9162-9168 | hindsight-api-slim/hindsight_api/api/http.py:9500-9506 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/api/http.py:7478` it begins part-way through the construct above it, so those 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) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:848— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:848-854 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1311-1317 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1409-1415 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:848` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 3) hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:292— hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:292-298 | REDACTED:337-343 | REDACTED:380-386 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 3) hindsight-integrations/autogen/hindsight_autogen/tools.py:168— hindsight-integrations/autogen/hindsight_autogen/tools.py:168-174 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:177-183 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:144-150 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/tools.py` and `hindsight-integrations/langgraph/hindsight_langgraph/tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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:86— REDACTED:86-92 | REDACTED:139-145 | REDACTED:103-109 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:83` calls `_vector_index_using_clause` and `REDACTED:137` 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.
ClassTooLong: ControlPlaneClient hindsight-control-plane/src/lib/api.ts:520— ClassTooLong — 1467 significant lines (blank, comment-only and punctuation-only lines excluded), 104 methods. The bar is 400 significant lines; this is 1067 over it, 3.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: HindsightClient hindsight-clients/typescript/src/index.ts:349— ClassTooLong — 1157 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods. The bar is 400 significant lines; this is 757 over it, 2.89× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Constellation hindsight-docs/src/components/constellation/Constellation.tsx:1— ClassTooLong — 1091 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 691 over it, 2.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: HindsightClient hindsight-integrations/coding-agents/src/core/hindsight.ts:375— ClassTooLong — 510 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 110 over it, 1.28× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×4
Edited copy of a member (31 corresponding lines) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:952— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:952-1234 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:917-1096 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/cursor_llm.py:339— hindsight-api-slim/hindsight_api/engine/providers/cursor_llm.py:339-369 | hindsight-api-slim/hindsight_api/engine/providers/github_copilot_llm.py:637-678 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) hindsight-integrations/haystack/hindsight_haystack/tools.py:828— hindsight-integrations/haystack/hindsight_haystack/tools.py:828-867 | hindsight-integrations/haystack/hindsight_haystack/tools.py:877-907 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:8380— hindsight-api-slim/hindsight_api/engine/memory_engine.py:8380-8416 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:8425-8455 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×4
Edited copy of a member (20 corresponding lines) hindsight-dev/hindsight_dev/generate_changelog.py:372— hindsight-dev/hindsight_dev/generate_changelog.py:372-391 | hindsight-dev/hindsight_dev/generate_changelog.py:395-416 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:328— hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:328-347 | hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:350-369 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) hindsight-dev/hindsight_dev/generate_changelog.py:420— hindsight-dev/hindsight_dev/generate_changelog.py:420-439 | hindsight-dev/hindsight_dev/generate_changelog.py:443-464 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:242— hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:242-264 | hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py:153-172 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×4
Edited copy of a member (7 corresponding lines) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1679— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1679-1690 | hindsight-api-slim/hindsight_api/engine/search/decision_reranker.py:156-162 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) hindsight-integrations/continue/hindsight_continue/_client.py:25— hindsight-integrations/continue/hindsight_continue/_client.py:25-42 | hindsight-integrations/aider/hindsight_aider/_client.py:21-27 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) hindsight-integrations/cursor/scripts/lib/state.py:20— hindsight-integrations/cursor/scripts/lib/state.py:20-26 | hindsight-integrations/omo/scripts/lib/state.py:19-27 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) hindsight-cli/src/commands/mental_model.rs:27— hindsight-cli/src/commands/mental_model.rs:27-33 | hindsight-cli/src/commands/pages.rs:30-36 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×4
Edited copy of a member (16 corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:238— hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:238-255 | hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:225-240 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) hindsight-integrations/cursor/scripts/lib/client.py:103— hindsight-integrations/cursor/scripts/lib/client.py:103-123 | hindsight-integrations/omo/scripts/lib/client.py:110-125 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:598— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:598-613 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:865-886 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/fireworks_llm.py:259— hindsight-api-slim/hindsight_api/engine/providers/fireworks_llm.py:259-276 | hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py:1005-1020 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×4
Edited copy of a member (8 corresponding lines) hindsight-integrations/pipecat/hindsight_pipecat/memory.py:115— hindsight-integrations/pipecat/hindsight_pipecat/memory.py:115-126 | hindsight-integrations/vapi/hindsight_vapi/webhook.py:117-124 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) hindsight-integrations/pipecat/hindsight_pipecat/memory.py:156— hindsight-integrations/pipecat/hindsight_pipecat/memory.py:156-166 | hindsight-integrations/pipecat/hindsight_pipecat/memory.py:193-200 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) hindsight-integrations/cursor/scripts/lib/daemon.py:62— hindsight-integrations/cursor/scripts/lib/daemon.py:62-69 | hindsight-integrations/omo/scripts/lib/client.py:70-77 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) hindsight-api-slim/hindsight_api/worker/poller.py:766— hindsight-api-slim/hindsight_api/worker/poller.py:766-773 | hindsight-api-slim/hindsight_api/worker/poller.py:1712-1746 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (17 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:20079— hindsight-api-slim/hindsight_api/engine/memory_engine.py:20079-20095 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:20099-20115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:134— hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:134-150 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:181-197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:134` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) hindsight-integrations/pipecat/hindsight_pipecat/memory.py:217— hindsight-integrations/pipecat/hindsight_pipecat/memory.py:217-233 | hindsight-integrations/vapi/hindsight_vapi/webhook.py:213-229 — before extracting anything, compare `hindsight-integrations/pipecat/hindsight_pipecat/memory.py` and `hindsight-integrations/vapi/hindsight_vapi/webhook.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-api-slim/hindsight_api/alembic/versions/c3f7a1b9d2e4_backfill_observation_search_vector.py:91— hindsight-api-slim/hindsight_api/alembic/versions/c3f7a1b9d2e4_backfill_observation_search_vector.py:91-112 | hindsight-api-slim/hindsight_api/alembic/versions/p4q5r6s7t8u9_configurable_bm25_language.py:94-110 — 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 (12 lines × 3) hindsight-integrations/agent-framework/hindsight_agent_framework/_client.py:38— hindsight-integrations/agent-framework/hindsight_agent_framework/_client.py:38-49 | hindsight-integrations/haystack/hindsight_haystack/_client.py:34-45 | hindsight-integrations/llamaindex/hindsight_llamaindex/_client.py:39-50 — 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 (12 lines × 3) hindsight-integrations/autogen/hindsight_autogen/tools.py:120— hindsight-integrations/autogen/hindsight_autogen/tools.py:120-131 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:101-112 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:133-144 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/tools.py` and `hindsight-integrations/google-adk/hindsight_google_adk/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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, `hindsight-integrations/langgraph/hindsight_langgraph/tools.py:132` calls `_resolve_bank_id` and `hindsight-integrations/autogen/hindsight_autogen/tools.py:119` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 3) hindsight-integrations/devin-desktop/hindsight_devin_desktop/managed_block.py:25— hindsight-integrations/devin-desktop/hindsight_devin_desktop/managed_block.py:25-36 | hindsight-integrations/github-copilot/hindsight_copilot/instructions.py:38-49 | hindsight-integrations/openhands/hindsight_openhands/agents_md.py:37-48 — before extracting anything, compare `hindsight-integrations/github-copilot/hindsight_copilot/instructions.py` and `hindsight-integrations/openhands/hindsight_openhands/agents_md.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-cli/src/commands/directive.rs:244— hindsight-cli/src/commands/directive.rs:244-258 | hindsight-cli/src/commands/mental_model.rs:474-488 | hindsight-cli/src/commands/pages.rs:450-461 — before extracting anything, compare `hindsight-cli/src/commands/directive.rs` and `hindsight-cli/src/commands/mental_model.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-cli/src/commands/directive.rs:244` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:16728— hindsight-api-slim/hindsight_api/engine/memory_engine.py:16728-16737 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:16751-16761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memory_engine.py:16751` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) hindsight-api-slim/hindsight_api/engine/reflect/observations.py:48— hindsight-api-slim/hindsight_api/engine/reflect/observations.py:48-58 | hindsight-api-slim/hindsight_api/engine/reflect/observations.py:79-88 — both copies are in the same file, so extract the 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–11 lines × 2) hindsight-cli/src/commands/explore.rs:1075— hindsight-cli/src/commands/explore.rs:1075-1084 | hindsight-cli/src/commands/explore.rs:1426-1436 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/explore.rs:1075` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) hindsight-cli/src/commands/mental_model.rs:14— hindsight-cli/src/commands/mental_model.rs:14-24 | hindsight-cli/src/commands/pages.rs:46-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 4) hindsight-api-slim/hindsight_api/api/http.py:6576— hindsight-api-slim/hindsight_api/api/http.py:6576-6582 | hindsight-api-slim/hindsight_api/api/http.py:6618-6624 | hindsight-api-slim/hindsight_api/api/http.py:6666-6673 | hindsight-api-slim/hindsight_api/api/http.py:7152-7158 — 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 `hindsight-api-slim/hindsight_api/api/http.py:6666` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 4) hindsight-api-slim/hindsight_api/mcp_tools.py:1030— hindsight-api-slim/hindsight_api/mcp_tools.py:1030-1036 | hindsight-api-slim/hindsight_api/mcp_tools.py:1091-1097 | hindsight-api-slim/hindsight_api/mcp_tools.py:1154-1160 | hindsight-api-slim/hindsight_api/mcp_tools.py:1216-1222 — 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 `hindsight-api-slim/hindsight_api/mcp_tools.py:1030` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 4) hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:303— hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:303-309 | hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:290-296 | REDACTED:335-341 | REDACTED:378-384 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 4) hindsight-integrations/devin-desktop/hindsight_devin_desktop/cascade_hooks.py:58— hindsight-integrations/devin-desktop/hindsight_devin_desktop/cascade_hooks.py:58-64 | hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py:122-128 | hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py:97-103 | hindsight-integrations/github-copilot/hindsight_copilot/mcp_config.py:73-79 — before extracting anything, compare `hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py` and `hindsight-integrations/github-copilot/hindsight_copilot/mcp_config.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Focus outline removed inline hindsight-control-plane/src/components/edit-memory-form.tsx:177— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline REDACTED:547— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
Focus outline removed inline hindsight-control-plane/src/components/pages-view.tsx:559— <input> takes keyboard focus, and its outline-none utility removes the focus ring with no focus-state ring, shadow, border or outline utility in its place. Add one (e.g. focus-visible:ring-2).
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×3
Focus outline removed in CSS without a :focus replacement hindsight-embed/hindsight_embed/control_center/ui/src/style.css:148— `.env-editor textarea` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement hindsight-embed/hindsight_embed/control_center/static/assets/index-Bti1AEAP.css:1— `.env-editor textarea` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement hindsight-docs/src/css/custom.css:1397— `[class*="searchInput"]` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (5 members, 50+ identical tokens) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:712— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:712-751 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1855-1910 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2183-2232 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2296-2343 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2576-2630 — 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) hindsight-integrations/ag2/hindsight_ag2/tools.py:49— hindsight-integrations/ag2/hindsight_ag2/tools.py:49-214 | hindsight-integrations/autogen/hindsight_autogen/tools.py:57-235 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:57-233 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:68-234 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:60-225 — 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) hindsight-integrations/agno/hindsight_agno/tools.py:298— hindsight-integrations/agno/hindsight_agno/tools.py:298-345 | hindsight-integrations/composio/hindsight_composio/tools.py:256-303 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:196-247 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:332-379 | hindsight-integrations/strands/hindsight_strands/tools.py:268-321 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×3
Edited copy of a member (23 corresponding lines) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:458— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:458-499 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2050-2072 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) hindsight-integrations/cursor/scripts/lib/content.py:223— hindsight-integrations/cursor/scripts/lib/content.py:223-245 | hindsight-integrations/cursor/scripts/lib/content.py:249-273 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:175— hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:175-197 | hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:201-240 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×3
Edited copy of a member (26 corresponding lines) REDACTED:751— REDACTED:751-778 | REDACTED:788-813 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:884— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:884-909 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1314-1339 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:1550— hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:1550-1578 | hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:1586-1611 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×3
Edited copy of a member (22 corresponding lines) hindsight-system-evals/hindsight_system_evals/refresh_cost.py:626— hindsight-system-evals/hindsight_system_evals/refresh_cost.py:626-647 | hindsight-system-evals/hindsight_system_evals/retrieval.py:179-201 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) hindsight-integrations/agno/hindsight_agno/tools.py:217— hindsight-integrations/agno/hindsight_agno/tools.py:217-252 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:168-189 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:15946— hindsight-api-slim/hindsight_api/engine/memory_engine.py:15946-15969 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:21992-22013 — 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· Edited copy of a member (19 corresponding lines) · ×3
Edited copy of a member (19 corresponding lines) hindsight-api-slim/hindsight_api/admin/cli.py:1502— hindsight-api-slim/hindsight_api/admin/cli.py:1502-1520 | hindsight-api-slim/hindsight_api/admin/cli.py:1621-1647 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) hindsight-api-slim/hindsight_api/engine/reflect/retractions.py:91— hindsight-api-slim/hindsight_api/engine/reflect/retractions.py:91-109 | hindsight-api-slim/hindsight_api/engine/reflect/retractions.py:113-134 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:17233— hindsight-api-slim/hindsight_api/engine/memory_engine.py:17233-17251 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:21890-21909 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×3
Edited copy of a member (13 corresponding lines) hindsight-api-slim/hindsight_api/knowledge/store.py:764— hindsight-api-slim/hindsight_api/knowledge/store.py:764-776 | hindsight-api-slim/hindsight_api/knowledge/store.py:813-825 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1110— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1110-1122 | hindsight-api-slim/hindsight_api/engine/decision_model.py:232-247 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:588— hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:588-614 | hindsight-api-slim/hindsight_api/engine/memories/pg/retain.py:392-404 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×3
Edited copy of a member (12 corresponding lines) hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py:151— hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py:151-162 | hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py:226-238 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:390— hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:390-405 | hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:408-419 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) hindsight-api-slim/hindsight_api/engine/parsers/iris.py:44— hindsight-api-slim/hindsight_api/engine/parsers/iris.py:44-57 | hindsight-api-slim/hindsight_api/engine/parsers/llama_parse.py:65-76 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×3
Edited copy of a member (11 corresponding lines) hindsight-api-slim/hindsight_api/api/http.py:3768— hindsight-api-slim/hindsight_api/api/http.py:3768-3778 | hindsight-api-slim/hindsight_api/mcp_tools.py:2587-2598 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) hindsight-api-slim/hindsight_api/config.py:429— hindsight-api-slim/hindsight_api/config.py:429-439 | hindsight-api-slim/hindsight_api/config.py:459-472 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:210— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:210-220 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:323-359 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×3
Edited copy of a member (4 corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/d3f8a1c6e9b2_oracle_index_composite_foreign_keys.py:47— hindsight-api-slim/hindsight_api/alembic/versions/d3f8a1c6e9b2_oracle_index_composite_foreign_keys.py:47-52 | hindsight-api-slim/hindsight_api/alembic/versions/d4f8b1c6e903_add_bank_alias_is_primary.py:61-64 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) hindsight-system-evals/hindsight_system_evals/answers.py:61— hindsight-system-evals/hindsight_system_evals/answers.py:61-64 | hindsight-system-evals/hindsight_system_evals/sources.py:432-445 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/a9b8c7d6e5f4_add_knowledge_pages.py:81— hindsight-api-slim/hindsight_api/alembic/versions/a9b8c7d6e5f4_add_knowledge_pages.py:81-84 | hindsight-api-slim/hindsight_api/alembic/versions/d4f8b1c6e903_add_bank_alias_is_primary.py:44-51 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (34 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1398— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1398-1431 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1734-1767 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (34 lines × 2) hindsight-integrations/haystack/hindsight_haystack/tools.py:137— hindsight-integrations/haystack/hindsight_haystack/tools.py:137-170 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:101-134 — before extracting anything, compare `hindsight-integrations/haystack/hindsight_haystack/tools.py` and `hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (34 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1121— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1121-1154 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1508-1541 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (32 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1483— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1483-1514 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1819-1850 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (32 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3286— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3286-3317 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3782-3813 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3782` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (32 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:1054— hindsight-api-slim/hindsight_api/mcp_tools.py:1054-1085 | hindsight-api-slim/hindsight_api/mcp_tools.py:1113-1144 — both copies are in the same file, so extract the 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 (22 lines × 2) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1474— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1474-1495 | hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1743-1764 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:4014— hindsight-api-slim/hindsight_api/mcp_tools.py:4014-4035 | hindsight-api-slim/hindsight_api/mcp_tools.py:4072-4093 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:4014` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1904— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1904-1925 | hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:273-294 — 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 (20–21 lines × 2) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2183— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2183-2202 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2296-2316 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20–21 lines × 2) hindsight-integrations/litellm/hindsight_litellm/__init__.py:1164— hindsight-integrations/litellm/hindsight_litellm/__init__.py:1164-1183 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:1236-1256 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/litellm/hindsight_litellm/__init__.py:1164` it does not close everything it opens, so those 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, `hindsight-integrations/litellm/hindsight_litellm/__init__.py:1234` calls `debug` and `hindsight-integrations/litellm/hindsight_litellm/__init__.py:1162` 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 (20–21 lines × 2) hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:120— hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:120-140 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:151-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–14 lines × 2) hindsight-all/hindsight/embedded.py:177— hindsight-all/hindsight/embedded.py:177-190 | hindsight-all/hindsight/embedded.py:194-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–14 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:8756— hindsight-api-slim/hindsight_api/api/http.py:8756-8768 | hindsight-api-slim/hindsight_api/api/http.py:8958-8971 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:8756` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) hindsight-cli/src/commands/memory.rs:129— hindsight-cli/src/commands/memory.rs:129-142 | hindsight-cli/src/commands/tag.rs:27-39 — 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 `hindsight-cli/src/commands/memory.rs:129` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 4) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1878— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1878-1885 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2200-2207 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2314-2321 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2595-2602 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2591` calls `get` and `hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2196` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 4) hindsight-integrations/aider/hindsight_aider/config.py:105— hindsight-integrations/aider/hindsight_aider/config.py:105-112 | hindsight-integrations/devin-desktop/hindsight_devin_desktop/config.py:71-78 | hindsight-integrations/github-copilot/hindsight_copilot/config.py:53-60 | hindsight-integrations/openhands/hindsight_openhands/config.py:54-61 — before extracting anything, compare `hindsight-integrations/github-copilot/hindsight_copilot/config.py` and `hindsight-integrations/openhands/hindsight_openhands/config.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 4) hindsight-cli/src/commands/bank.rs:1109— hindsight-cli/src/commands/bank.rs:1109-1116 | hindsight-cli/src/commands/document.rs:369-378 | hindsight-cli/src/commands/memory.rs:868-875 | hindsight-cli/src/commands/operation.rs:201-208 — before extracting anything, compare `hindsight-cli/src/commands/memory.rs` and `hindsight-cli/src/commands/operation.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/bank.rs:1109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:5465— hindsight-api-slim/hindsight_api/api/http.py:5465-5472 | hindsight-api-slim/hindsight_api/api/http.py:5527-5534 | hindsight-api-slim/hindsight_api/api/http.py:5558-5565 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/api/http.py:5464` calls `_attach_to_memories` and `hindsight-api-slim/hindsight_api/api/http.py:5557` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:6345— hindsight-api-slim/hindsight_api/api/http.py:6345-6352 | hindsight-api-slim/hindsight_api/api/http.py:8280-8287 | hindsight-api-slim/hindsight_api/api/http.py:8326-8333 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/api/http.py:6345` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) hindsight-cli/src/commands/bank.rs:113— hindsight-cli/src/commands/bank.rs:113-123 | hindsight-cli/src/commands/bank.rs:424-434 | hindsight-cli/src/commands/chunk.rs:24-31 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/bank.rs:113` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 3) hindsight-cli/src/commands/bank.rs:141— hindsight-cli/src/commands/bank.rs:141-150 | hindsight-cli/src/commands/bank.rs:154-163 | hindsight-cli/src/commands/bank.rs:167-176 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-cli/src/commands/bank.rs:178` calls `is_empty` and `hindsight-cli/src/commands/bank.rs:152` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 3) hindsight-cli/src/commands/directive.rs:26— hindsight-cli/src/commands/directive.rs:26-35 | hindsight-cli/src/commands/mental_model.rs:219-228 | hindsight-cli/src/commands/tag.rs:31-42 — before extracting anything, compare `hindsight-cli/src/commands/directive.rs` and `hindsight-cli/src/commands/mental_model.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-cli/src/commands/directive.rs:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) hindsight-cli/src/commands/document.rs:297— hindsight-cli/src/commands/document.rs:297-306 | hindsight-cli/src/commands/memory.rs:720-729 | hindsight-cli/src/commands/operation.rs:164-173 — before extracting anything, compare `hindsight-cli/src/commands/memory.rs` and `hindsight-cli/src/commands/operation.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/document.rs:297` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Off the main sequence: hindsight-client (Python) — hindsight-client (Python): abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: hindsight-api-slim — hindsight-api-slim: abstractness 0.02, instability 0.00, distance 0.98 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
Off the main sequence: hindsight-embed — hindsight-embed: abstractness 0.03, instability 0.00, distance 0.97 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
AC1 · Text alternatives· <canvas> without a text alternative · ×2
<canvas> without a text alternative hindsight-control-plane/src/components/constellation.tsx:1666— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative hindsight-docs/src/components/constellation/Constellation.tsx:1617— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
AC1 · Text alternatives· <video> without a captions track · ×2
<video> without a captions track hindsight-control-plane/src/components/knowledge-document-dialog.tsx:257— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
<video> without a captions track hindsight-control-plane/src/components/knowledge-passage.tsx:140— Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
AC3 · Page structure· Heading level jumps from h1 to h3 · ×2
Heading level jumps from h1 to h3 hindsight-control-plane/src/components/pages-view.tsx:833— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
Heading level jumps from h1 to h3 hindsight-docs/src/pages/templates/index.tsx:240— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC3 · Page structure· Page without a main landmark · ×2
Page without a main landmark hindsight-control-plane/src/lib/page-download.tsx:104— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark hindsight-docs/static/mental-model-refresh-flow.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Skipped test: set HINDSIGHT_DCODE_E2E=1 with dcode installed to run the isolated CLI smoke test hindsight-integrations/coding-agents/src/dcode-plugin.e2e.test.ts:59— Skipped — switched off by it.skip
Skipped test: set HINDSIGHT_HARNESS_E2E=1 to run locally with host credentials hindsight-integrations/coding-agents/src/harness.e2e.test.ts:47— Skipped — switched off by it.skip
No assertions: omits tags when none are given and includes context/timestamp when present hindsight-integrations/zapier/test/creates.test.js:31— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: is up to date with the README hindsight-integrations/coding-agents/src/docs-freshness.test.ts:23— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×2
REDACTED
REDACTED
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×2
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (48 corresponding lines) · ×2
Edited copy of a member (48 corresponding lines) hindsight-cli/src/commands/bank.rs:289— hindsight-cli/src/commands/bank.rs:289-336 | hindsight-cli/src/commands/bank.rs:349-405 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (48 corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/05867433a58c_add_banks_with_attachments_in_window_routine.py:70— hindsight-api-slim/hindsight_api/alembic/versions/05867433a58c_add_banks_with_attachments_in_window_routine.py:70-117 | hindsight-api-slim/hindsight_api/alembic/versions/b2429c65cc20_banks_needing_consolidation_hybrid_probe.py:102-168 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×2
Edited copy of a member (36 corresponding lines) hindsight-integrations/haystack/hindsight_haystack/tools.py:133— hindsight-integrations/haystack/hindsight_haystack/tools.py:133-170 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:99-134 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:23173— hindsight-api-slim/hindsight_api/engine/memory_engine.py:23173-23208 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:23285-23321 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×2
Edited copy of a member (42 corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py:634— hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py:634-679 | REDACTED:194-235 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (42 corresponding lines) hindsight-integrations/cursor/scripts/lib/bank.py:33— hindsight-integrations/cursor/scripts/lib/bank.py:33-74 | hindsight-integrations/omo/scripts/lib/bank.py:67-115 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (55 corresponding lines) · ×2
Edited copy of a member (55 corresponding lines) hindsight-api-slim/hindsight_api/engine/retain/entity_labels.py:125— hindsight-api-slim/hindsight_api/engine/retain/entity_labels.py:125-179 | hindsight-api-slim/hindsight_api/engine/retain/entity_labels.py:194-258 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (55 corresponding lines) REDACTED:823— REDACTED:823-877 | REDACTED:885-939 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (54 corresponding lines) · ×2
Edited copy of a member (54 corresponding lines) hindsight-integrations/litellm/hindsight_litellm/__init__.py:1138— hindsight-integrations/litellm/hindsight_litellm/__init__.py:1138-1191 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:1200-1264 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (54 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:8474— hindsight-api-slim/hindsight_api/engine/memory_engine.py:8474-8532 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:8542-8595 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×2
Edited copy of a member (34 corresponding lines) hindsight-cli/src/commands/explore.rs:465— hindsight-cli/src/commands/explore.rs:465-498 | hindsight-cli/src/commands/explore.rs:500-533 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) hindsight-cli/src/commands/entity.rs:12— hindsight-cli/src/commands/entity.rs:12-52 | hindsight-cli/src/commands/entity.rs:60-93 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×2
Edited copy of a member (33 corresponding lines) hindsight-cli/src/commands/document.rs:17— hindsight-cli/src/commands/document.rs:17-62 | hindsight-cli/src/commands/document.rs:203-235 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/consolidation.py:160— hindsight-api-slim/hindsight_api/engine/memories/pg/consolidation.py:160-192 | hindsight-api-slim/hindsight_api/engine/memories/pg/consolidation.py:280-317 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×2
Edited copy of a member (18 corresponding lines) hindsight-system-evals/hindsight_system_evals/delta_updates.py:345— hindsight-system-evals/hindsight_system_evals/delta_updates.py:345-362 | hindsight-system-evals/hindsight_system_evals/pages.py:145-166 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) hindsight-api-slim/hindsight_api/admin/cli.py:510— hindsight-api-slim/hindsight_api/admin/cli.py:510-527 | hindsight-api-slim/hindsight_api/admin/cli.py:536-560 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×2
Edited copy of a member (30 corresponding lines) hindsight-api-slim/hindsight_api/mcp_tools.py:1745— hindsight-api-slim/hindsight_api/mcp_tools.py:1745-1777 | hindsight-api-slim/hindsight_api/mcp_tools.py:4448-4477 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) REDACTED:416— REDACTED:416-445 | REDACTED:488-517 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×2
Edited copy of a member (27 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:23121— hindsight-api-slim/hindsight_api/engine/memory_engine.py:23121-23163 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:23219-23245 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:622— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:622-648 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:945-983 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×2
Edited copy of a member (6 corresponding lines) hindsight-api-slim/hindsight_api/knowledge/service.py:1695— hindsight-api-slim/hindsight_api/knowledge/service.py:1695-1700 | hindsight-api-slim/hindsight_api/knowledge/service.py:1710-1716 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) hindsight-system-tests/hindsight_system_tests/rulebook.py:66— hindsight-system-tests/hindsight_system_tests/rulebook.py:66-75 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:592-597 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×2
Edited copy of a member (5 corresponding lines) hindsight-api-slim/hindsight_api/engine/sql/postgresql.py:229— hindsight-api-slim/hindsight_api/engine/sql/postgresql.py:229-233 | hindsight-api-slim/hindsight_api/knowledge/store.py:434-438 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py:233— hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py:233-237 | REDACTED:236-244 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (59–60 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2347— hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2347-2406 | hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:3340-3398 — both copies are in the same file, so extract the 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, `hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2408` calls `warning` and `hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:3400` 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 (59–60 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:2406— hindsight-api-slim/hindsight_api/mcp_tools.py:2406-2465 | hindsight-api-slim/hindsight_api/mcp_tools.py:2479-2537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:2406` it begins part-way through the construct above it, so those 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, `hindsight-api-slim/hindsight_api/mcp_tools.py:2478` calls `_ToolError` and `hindsight-api-slim/hindsight_api/mcp_tools.py:2406` 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 (41 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:1361— hindsight-api-slim/hindsight_api/mcp_tools.py:1361-1401 | hindsight-api-slim/hindsight_api/mcp_tools.py:1497-1537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (41 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1036— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1036-1076 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1466-1506 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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 (31 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:1180— hindsight-api-slim/hindsight_api/mcp_tools.py:1180-1210 | hindsight-api-slim/hindsight_api/mcp_tools.py:1240-1270 — both copies are in the same file, so extract the 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 (31 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1200— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1200-1230 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1623-1653 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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, `hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1622` calls `get` and `hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1199` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (25–28 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:24698— hindsight-api-slim/hindsight_api/engine/memory_engine.py:24698-24722 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:24761-24788 — both copies are in the same file, so extract the 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 (25–28 lines × 2) hindsight-integrations/autogen/hindsight_autogen/tools.py:140— hindsight-integrations/autogen/hindsight_autogen/tools.py:140-167 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:118-142 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/tools.py` and `hindsight-integrations/google-adk/hindsight_google_adk/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/autogen/hindsight_autogen/tools.py:140` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–28 lines × 2) hindsight-integrations/ag2/hindsight_ag2/tools.py:128— hindsight-integrations/ag2/hindsight_ag2/tools.py:128-155 | hindsight-integrations/ag2/hindsight_ag2/tools.py:168-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27–28 lines × 2) hindsight-integrations/google-adk/hindsight_google_adk/tools.py:110— hindsight-integrations/google-adk/hindsight_google_adk/tools.py:110-137 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:148-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (23–25 lines × 3) hindsight-api-slim/hindsight_api/mcp_tools.py:2349— hindsight-api-slim/hindsight_api/mcp_tools.py:2349-2371 | hindsight-api-slim/hindsight_api/mcp_tools.py:2413-2437 | hindsight-api-slim/hindsight_api/mcp_tools.py:2485-2509 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/mcp_tools.py:2349` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23–25 lines × 3) hindsight-api-slim/hindsight_api/mcp_tools.py:2372— hindsight-api-slim/hindsight_api/mcp_tools.py:2372-2394 | hindsight-api-slim/hindsight_api/mcp_tools.py:2439-2463 | hindsight-api-slim/hindsight_api/mcp_tools.py:2511-2535 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/mcp_tools.py:2372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–24 lines × 2) hindsight-integrations/cursor/scripts/lib/content.py:57— hindsight-integrations/cursor/scripts/lib/content.py:57-80 | hindsight-integrations/omo/scripts/lib/content.py:99-116 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/content.py` and `hindsight-integrations/omo/scripts/lib/content.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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, `hindsight-integrations/cursor/scripts/lib/content.py:91` calls `formatMemories` and `hindsight-integrations/omo/scripts/lib/content.py:121` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18–24 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:821— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:821-838 | hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:960-983 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:821` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (22–23 lines × 2) hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:203— hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:203-224 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:194-216 — before extracting anything, compare `hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py` and `hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22–23 lines × 2) hindsight-integrations/cursor/scripts/retain.py:295— hindsight-integrations/cursor/scripts/retain.py:295-317 | hindsight-integrations/omo/scripts/retain.py:162-183 — 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–22 lines × 2) hindsight-api-slim/hindsight_api/engine/embeddings.py:2004— hindsight-api-slim/hindsight_api/engine/embeddings.py:2004-2024 | hindsight-api-slim/hindsight_api/engine/embeddings.py:2095-2116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21–22 lines × 2) hindsight-integrations/omo/demo.py:165— hindsight-integrations/omo/demo.py:165-185 | hindsight-integrations/omo/demo.py:270-291 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–21 lines × 2) hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:164— hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:164-184 | hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:256-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–21 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:168— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:168-188 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:346-362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/a2b3c4d5e6f7_add_text_signals_column.py:98— hindsight-api-slim/hindsight_api/alembic/versions/a2b3c4d5e6f7_add_text_signals_column.py:98-117 | hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:302-321 — 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 `hindsight-api-slim/hindsight_api/alembic/versions/a2b3c4d5e6f7_add_text_signals_column.py:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1882— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1882-1901 | hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:444-463 — 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 `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 (12–17 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:93— hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:93-104 | hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:152-168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:152` it begins part-way through the construct above it, so those exact lines 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–17 lines × 2) hindsight-cli/src/commands/directive.rs:54— hindsight-cli/src/commands/directive.rs:54-70 | hindsight-cli/src/commands/pages.rs:343-354 — 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 `hindsight-cli/src/commands/directive.rs:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–17 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3250— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3250-3266 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3761-3776 — both copies are in the same file, so extract the 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 (16–17 lines × 2) hindsight-integrations/cursor/scripts/session_start.py:148— hindsight-integrations/cursor/scripts/session_start.py:148-164 | hindsight-integrations/omo/scripts/recall.py:110-125 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-integrations/cursor/scripts/session_start.py:165` calls `_write_recall_status`, `str` and `hindsight-integrations/omo/scripts/recall.py:126` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 4) hindsight-clients/python/hindsight_client/hindsight_client.py:743— hindsight-clients/python/hindsight_client/hindsight_client.py:743-758 | hindsight-clients/python/hindsight_client/hindsight_client.py:835-850 | hindsight-clients/python/hindsight_client/hindsight_client.py:1012-1027 | hindsight-clients/python/hindsight_client/hindsight_client.py:3165-3180 — 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 `hindsight-clients/python/hindsight_client/hindsight_client.py:743` it begins part-way through the construct above it, so those exact lines 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 × 4) hindsight-cli/src/commands/bank.rs:494— hindsight-cli/src/commands/bank.rs:494-509 | hindsight-cli/src/commands/bank.rs:787-802 | hindsight-cli/src/commands/directive.rs:224-239 | hindsight-cli/src/commands/mental_model.rs:454-469 — before extracting anything, compare `hindsight-cli/src/commands/directive.rs` and `hindsight-cli/src/commands/mental_model.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-cli/src/commands/bank.rs:494` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (15–16 lines × 2) hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:343— hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:343-357 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:17163-17178 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15–16 lines × 2) hindsight-integrations/cursor/scripts/session_start.py:172— hindsight-integrations/cursor/scripts/session_start.py:172-187 | hindsight-integrations/omo/scripts/recall.py:149-163 — 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 before the matched lines, `hindsight-integrations/cursor/scripts/session_start.py:171` calls `_write_recall_status` and `hindsight-integrations/omo/scripts/recall.py:148` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 4) hindsight-api-slim/hindsight_api/engine/memory_engine.py:3232— hindsight-api-slim/hindsight_api/engine/memory_engine.py:3232-3244 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3342-3354 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3403-3415 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3465-3477 — 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 `hindsight-api-slim/hindsight_api/engine/memory_engine.py:3232` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 4) hindsight-cli/src/commands/memory.rs:852— hindsight-cli/src/commands/memory.rs:852-864 | hindsight-cli/src/commands/operation.rs:231-243 | hindsight-cli/src/commands/pages.rs:432-445 | hindsight-cli/src/commands/webhook.rs:173-185 — before extracting anything, compare `hindsight-cli/src/commands/memory.rs` and `hindsight-cli/src/commands/operation.rs` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 34 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-cli/src/commands/memory.rs:852` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 2) hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:329— hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:329-340 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:17148-17160 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12–13 lines × 2) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1432— hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1432-1444 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1849-1860 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1432` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 4) hindsight-api-slim/hindsight_api/api/http.py:10264— hindsight-api-slim/hindsight_api/api/http.py:10264-10273 | hindsight-api-slim/hindsight_api/api/http.py:10297-10306 | hindsight-api-slim/hindsight_api/api/http.py:10390-10399 | hindsight-api-slim/hindsight_api/api/http.py:10433-10442 — 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 `hindsight-api-slim/hindsight_api/api/http.py:10264` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 4) hindsight-integrations/agno/hindsight_agno/tools.py:243— hindsight-integrations/agno/hindsight_agno/tools.py:243-252 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:179-188 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:180-189 | hindsight-integrations/strands/hindsight_strands/tools.py:213-222 — before extracting anything, compare `hindsight-integrations/agno/hindsight_agno/tools.py` and `hindsight-integrations/smolagents/hindsight_smolagents/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8–9 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:7635— hindsight-api-slim/hindsight_api/api/http.py:7635-7642 | hindsight-api-slim/hindsight_api/api/http.py:7740-7748 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:7740` it begins part-way through the construct above it, so those 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–9 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:8207— hindsight-api-slim/hindsight_api/api/http.py:8207-8215 | hindsight-api-slim/hindsight_api/api/http.py:8236-8243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:8207` it begins part-way through the construct above it, so those 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 (6 lines × 3) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:817— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:817-822 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:951-956 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2444-2449 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 3) hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py:320— hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py:320-325 | hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py:147-152 | hindsight-integrations/github-copilot/hindsight_copilot/mcp_config.py:123-128 — before extracting anything, compare `hindsight-integrations/devin-desktop/hindsight_devin_desktop/mcp_config.py` and `hindsight-integrations/github-copilot/hindsight_copilot/mcp_config.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 × 4) hindsight-api-slim/hindsight_api/alembic/versions/b5a4c3e2f1d8_add_graph_maintenance_queue.py:65— hindsight-api-slim/hindsight_api/alembic/versions/b5a4c3e2f1d8_add_graph_maintenance_queue.py:65-77 | hindsight-api-slim/hindsight_api/alembic/versions/c4f7a91b2d38_add_entity_maintenance_queue.py:77-89 | hindsight-api-slim/hindsight_api/alembic/versions/c8d1e4f7a20b_add_bank_aliases.py:75-83 | hindsight-api-slim/hindsight_api/alembic/versions/o1a2b3c4d5e6_oracle_baseline.py:445-457 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
Duplicated block (9 lines × 4) hindsight-cli/src/commands/bank.rs:319— hindsight-cli/src/commands/bank.rs:319-327 | hindsight-cli/src/commands/bank.rs:388-396 | hindsight-cli/src/commands/directive.rs:189-200 | hindsight-cli/src/commands/mental_model.rs:419-430 — before extracting anything, compare `hindsight-cli/src/commands/directive.rs` and `hindsight-cli/src/commands/mental_model.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-cli/src/commands/bank.rs:319` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Low cohesion: DatabaseConnection (LCOM4 4) hindsight-api-slim/hindsight_api/engine/db/base.py:35— DatabaseConnection's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Configuration (LCOM4 4) hindsight-clients/python/hindsight_client_api/configuration.py:132— Configuration's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Outbound HTTP without resilience hindsight-clients/go/client.go:95— `http.DefaultClient` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience hindsight-clients/rust/src/lib.rs:46— `reqwest::Client::builder(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
R10 · Code Duplication· Duplicated block with local edits (61 matched lines × 2 locations) · ×2
Duplicated block with local edits (61 matched lines × 2 locations) hindsight-control-plane/src/components/knowledge-banks-list.tsx:316— hindsight-control-plane/src/components/knowledge-banks-list.tsx:316 · hindsight-control-plane/src/components/knowledge-documents-view.tsx:430 — the two spans are one implementation copied and then locally edited — 381 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block with local edits (61 matched lines × 2 locations) hindsight-control-plane/src/components/mental-model-diagnostics-view.tsx:44— hindsight-control-plane/src/components/mental-model-diagnostics-view.tsx:44 · hindsight-control-plane/src/components/think-view.tsx:614 — the two spans are one implementation copied and then locally edited — 323 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (43 lines × 2 locations) hindsight-control-plane/src/app/api/banks/[bankId]/directives/route.ts:5— hindsight-control-plane/src/app/api/banks/[bankId]/directives/route.ts:5 · hindsight-control-plane/src/app/api/banks/[bankId]/mental-models/route.ts:5 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (43 lines × 2 locations) hindsight-control-plane/src/components/bank-config-view.tsx:1144— hindsight-control-plane/src/components/bank-config-view.tsx:1144 · hindsight-control-plane/src/components/bank-config-view.tsx:1261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (34 lines × 2 locations) hindsight-control-plane/src/app/api/pages/folders/route.ts:5— hindsight-control-plane/src/app/api/pages/folders/route.ts:5 · hindsight-control-plane/src/app/api/pages/route.ts:5 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (34 lines × 2 locations) hindsight-control-plane/src/components/audit-logs-view.tsx:481— hindsight-control-plane/src/components/audit-logs-view.tsx:481 · hindsight-control-plane/src/components/llm-requests-view.tsx:1283 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (26 lines × 2 locations) hindsight-control-plane/src/app/api/documents/chunks/route.ts:5— hindsight-control-plane/src/app/api/documents/chunks/route.ts:5 · hindsight-control-plane/src/app/api/documents/history/route.ts:5 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (26 lines × 2 locations) hindsight-control-plane/src/components/search-debug-view.tsx:1030— hindsight-control-plane/src/components/search-debug-view.tsx:1030 · hindsight-control-plane/src/components/search-debug-view.tsx:1137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Complex function updateTooltip (cyclomatic 41, cognitive 66) hindsight-control-plane/src/components/constellation.tsx:1242— updateTooltip has cyclomatic complexity 41 and cognitive complexity 66; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function updateTooltip (cyclomatic 41, cognitive 66) hindsight-docs/src/components/constellation/Constellation.tsx:1199— updateTooltip has cyclomatic complexity 41 and cognitive complexity 66; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R6 · Tooling· This package's lint script runs in no CI job · ×2
This package's lint script runs in no CI job hindsight-control-plane/package.json:19— The package in `hindsight-control-plane` declares the lint script `lint` (`eslint .`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `hindsight-control-plane` (or the workspace's task runner).
This package's lint script runs in no CI job hindsight-integrations/n8n/package.json:24— The package in `hindsight-integrations/n8n` declares the lint script `lint` (`eslint nodes credentials --ext .ts`), but no step of this repository's CI runs it, by name, through another script, a Makefile target or a workspace runner, and no CI step runs the linter over the package itself. The rules it sets are enforced nowhere a pull request can fail. Run it in CI: a step that runs `npm run lint` in `hindsight-integrations/n8n` (or the workspace's task runner).
Dead file (~83 LoC) hindsight-docs/src/components/HomeBenchmarks.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~83 LoC) hindsight-docs/src/components/IntegrationsBanner.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
X1 · Async correctness· Task from `asyncio.create_task` is not kept · ×2
Task from `asyncio.create_task` is not kept hindsight-integrations/vapi/hindsight_vapi/webhook.py:199— The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
Task from `asyncio.create_task` is not kept hindsight-integrations/pipecat/hindsight_pipecat/memory.py:143— The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
Low contrast Tailwind colour pair (3.8:1) hindsight-control-plane/src/components/memory-defense-section.tsx:285— This element's Tailwind text/background colour utilities fall below the 4.5:1 WCAG AA minimum for normal text. Pick a darker or lighter shade.
chinese_temporal_periods.extract_chinese_period (cyclomatic 310) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:97— chinese_temporal_periods.extract_chinese_period has cyclomatic complexity 310 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MemoryEngine._search_with_retries (cyclomatic 198) hindsight-api-slim/hindsight_api/engine/memory_engine.py:10104— MemoryEngine._search_with_retries has cyclomatic complexity 198 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
documents-view.DocumentsView (cyclomatic 180) hindsight-control-plane/src/components/documents-view.tsx:715— documents-view.DocumentsView has cyclomatic complexity 180 (threshold 15). Of this number, 80 points are the body's own statements and 100 belong to 33 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
data-view.DataView (cyclomatic 175) hindsight-control-plane/src/components/data-view.tsx:115— data-view.DataView has cyclomatic complexity 175 (threshold 15). Of this number, 75 points are the body's own statements and 100 belong to 37 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HindsightConfig._read_env (cyclomatic 165) hindsight-api-slim/hindsight_api/config.py:4931— HindsightConfig._read_env has cyclomatic complexity 165 (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.
bank-operations-view.BankOperationsView (cyclomatic 139) hindsight-control-plane/src/components/bank-operations-view.tsx:143— bank-operations-view.BankOperationsView has cyclomatic complexity 139 (threshold 15). Of this number, 50 points are the body's own statements and 89 belong to 23 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
agent._run_reflect_agent_inner (cyclomatic 126) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:547— agent._run_reflect_agent_inner has cyclomatic complexity 126 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pages-view.PagesView (cyclomatic 119) hindsight-control-plane/src/components/pages-view.tsx:101— pages-view.PagesView has cyclomatic complexity 119 (threshold 15). Of this number, 41 points are the body's own statements and 78 belong to 38 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
think-view.ThinkView (cyclomatic 117) hindsight-control-plane/src/components/think-view.tsx:72— think-view.ThinkView has cyclomatic complexity 117 (threshold 15). Of this number, 72 points are the body's own statements and 45 belong to 14 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
page.BankPage (cyclomatic 104) hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:104— page.BankPage has cyclomatic complexity 104 (threshold 15). Of this number, 72 points are the body's own statements and 32 belong to 15 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MemoryEngine._execute_mental_model_refresh (cyclomatic 100) hindsight-api-slim/hindsight_api/engine/memory_engine.py:18511— MemoryEngine._execute_mental_model_refresh has cyclomatic complexity 100 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fact_extraction.extract_facts_from_contents_batch_api (cyclomatic 98) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2937— fact_extraction.extract_facts_from_contents_batch_api has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MemoryEngine.__init__ (cyclomatic 95) hindsight-api-slim/hindsight_api/engine/memory_engine.py:2972— MemoryEngine.__init__ has cyclomatic complexity 95 (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.
bank-config-view.BankConfigView (cyclomatic 94) hindsight-control-plane/src/components/bank-config-view.tsx:467— bank-config-view.BankConfigView has cyclomatic complexity 94 (threshold 15). Of this number, 26 points are the body's own statements and 68 belong to 35 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
memory-detail-modal.MemoryDetailModal (cyclomatic 93) hindsight-control-plane/src/components/memory-detail-modal.tsx:78— memory-detail-modal.MemoryDetailModal has cyclomatic complexity 93 (threshold 15). Of this number, 61 points are the body's own statements and 32 belong to 13 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fact_extraction._extract_facts_from_chunk (cyclomatic 84) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2081— fact_extraction._extract_facts_from_chunk has cyclomatic complexity 84 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MemoryEngine.update_memory_unit (cyclomatic 83) hindsight-api-slim/hindsight_api/engine/memory_engine.py:13004— MemoryEngine.update_memory_unit has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
app.App (cyclomatic 82) hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx:34— app.App has cyclomatic complexity 82 (threshold 15). Of this number, 21 points are the body's own statements and 61 belong to 18 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OpenAICompatibleLLM.call (cyclomatic 79) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1219— OpenAICompatibleLLM.call has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hindsight_litellm._inject_memories (cyclomatic 77) hindsight-integrations/litellm/hindsight_litellm/__init__.py:229— hindsight_litellm._inject_memories has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MemoryEngine.reflect_async (cyclomatic 76) hindsight-api-slim/hindsight_api/engine/memory_engine.py:16147— MemoryEngine.reflect_async has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent 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.do_profile_command (cyclomatic 73) hindsight-embed/hindsight_embed/cli.py:1049— cli.do_profile_command has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
orchestrator.retain_batch (cyclomatic 71) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1619— orchestrator.retain_batch has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.default::runRetain (cyclomatic 71) REDACTED:3017— index.default::runRetain has cyclomatic complexity 71 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (index.default) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
webhooks-view.WebhooksView (cyclomatic 69) hindsight-control-plane/src/components/webhooks-view.tsx:310— webhooks-view.WebhooksView has cyclomatic complexity 69 (threshold 15). Of this number, 26 points are the body's own statements and 43 belong to 21 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MemoryEngine.update_mental_model (cyclomatic 68) hindsight-api-slim/hindsight_api/engine/memory_engine.py:19807— MemoryEngine.update_mental_model 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.
consolidator._process_memory_batch (cyclomatic 64) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:2711— consolidator._process_memory_batch has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HindsightClient.updateBankConfig (cyclomatic 62) hindsight-clients/typescript/src/index.ts:923— HindsightClient.updateBankConfig has cyclomatic complexity 62 (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.
entities-view.EntitiesView (cyclomatic 62) hindsight-control-plane/src/components/entities-view.tsx:51— entities-view.EntitiesView has cyclomatic complexity 62 (threshold 15). Of this number, 20 points are the body's own statements and 42 belong to 14 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
search-debug-view.SearchDebugView (cyclomatic 61) hindsight-control-plane/src/components/search-debug-view.tsx:109— search-debug-view.SearchDebugView 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. This shape REPEATS in the file: one other method here (search-debug-view.SearchDebugView::runSearch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
bank-selector.BankSelectorInner (cyclomatic 59) hindsight-control-plane/src/components/bank-selector.tsx:129— bank-selector.BankSelectorInner has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (bank-selector.BankSelectorInner::handleCreateDocument) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
index.getPluginConfig (cyclomatic 59) REDACTED:2118— index.getPluginConfig 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.
mental-models-view.MentalModelsView (cyclomatic 57) hindsight-control-plane/src/components/mental-models-view.tsx:132— mental-models-view.MentalModelsView has cyclomatic complexity 57 (threshold 15). Of this number, 18 points are the body's own statements and 39 belong to 17 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MemoryEngine._run_retain_execution (cyclomatic 55) hindsight-api-slim/hindsight_api/engine/memory_engine.py:7598— MemoryEngine._run_retain_execution 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.
MemoryEngine.recall_async (cyclomatic 50) hindsight-api-slim/hindsight_api/engine/memory_engine.py:9573— MemoryEngine.recall_async has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
orchestrator._streaming_retain_batch (cyclomatic 50) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:2660— orchestrator._streaming_retain_batch has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
banks-overview.BanksOverview (cyclomatic 50) hindsight-control-plane/src/components/banks-overview.tsx:87— banks-overview.BanksOverview has cyclomatic complexity 50 (threshold 15). Of this number, 24 points are the body's own statements and 26 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
knowledge-search-panel.KnowledgeSearchPanel (cyclomatic 50) hindsight-control-plane/src/components/knowledge-search-panel.tsx:64— knowledge-search-panel.KnowledgeSearchPanel has cyclomatic complexity 50 (threshold 15). Of this number, 24 points are the body's own statements and 26 belong to 12 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EntityResolver._resolve_from_candidates (cyclomatic 48) hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:1163— EntityResolver._resolve_from_candidates has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GeminiLLM.call (cyclomatic 48) hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py:343— GeminiLLM.call has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mental-model-detail-modal.MentalModelDetailModal (cyclomatic 47) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:824— mental-model-detail-modal.MentalModelDetailModal has cyclomatic complexity 47 (threshold 15). Of this number, 26 points are the body's own statements and 21 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
curation.list_memory_units (cyclomatic 45) hindsight-api-slim/hindsight_api/engine/memories/pg/curation.py:36— curation.list_memory_units 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.
knowledge-write-dialogs.KnowledgeAddDocumentDialog (cyclomatic 45) hindsight-control-plane/src/components/knowledge-write-dialogs.tsx:83— knowledge-write-dialogs.KnowledgeAddDocumentDialog has cyclomatic complexity 45 (threshold 15). Of this number, 18 points are the body's own statements and 27 belong to 14 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
migrations.ensure_text_search_extension (cyclomatic 43) REDACTED:1207— migrations.ensure_text_search_extension 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.
MemoryEngine._dispatch_task (cyclomatic 42) hindsight-api-slim/hindsight_api/engine/memory_engine.py:5218— MemoryEngine._dispatch_task 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.
MemoryEngine.retain_batch_async (cyclomatic 42) hindsight-api-slim/hindsight_api/engine/memory_engine.py:7072— MemoryEngine.retain_batch_async 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.
mcp_tools.register_mcp_tools (cyclomatic 42) hindsight-api-slim/hindsight_api/mcp_tools.py:651— mcp_tools.register_mcp_tools has cyclomatic complexity 42 (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.
HindsightCallback._plan_store (cyclomatic 42) REDACTED:568— HindsightCallback._plan_store 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.
knowledge-documents-view.KnowledgeDocumentsView (cyclomatic 42) hindsight-control-plane/src/components/knowledge-documents-view.tsx:169— knowledge-documents-view.KnowledgeDocumentsView has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 14 of the 42 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 242, a function literal at line 214, a function literal at line 491, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
observation-tree-view.ObservationTreeView (cyclomatic 42) REDACTED:356— observation-tree-view.ObservationTreeView has cyclomatic complexity 42 (threshold 15). Of this number, 28 points are the body's own statements and 14 belong to 9 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.default (cyclomatic 42) REDACTED:2287— index.default has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (index.default::runRetain) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OpenAICompatibleLLM._call_ollama_native (cyclomatic 40) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1708— OpenAICompatibleLLM._call_ollama_native 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.
bank-profile-view.BankProfileView (cyclomatic 40) hindsight-control-plane/src/components/bank-profile-view.tsx:130— bank-profile-view.BankProfileView has cyclomatic complexity 40 (threshold 15). Of this number, 20 points are the body's own statements and 20 belong to 9 function items inside it that branch. 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.
consolidator._run_consolidation_job (cyclomatic 39) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:1886— consolidator._run_consolidation_job 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.
AnthropicLLM.call (cyclomatic 39) hindsight-api-slim/hindsight_api/engine/providers/anthropic_llm.py:318— AnthropicLLM.call 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.
config.resolveConfig (cyclomatic 38) hindsight-integrations/coding-agents/src/core/config.ts:589— config.resolveConfig has cyclomatic complexity 38 (threshold 15). Of this number, 36 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
KnowledgeService._within_budget (cyclomatic 37) hindsight-api-slim/hindsight_api/knowledge/service.py:1846— KnowledgeService._within_budget 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.
wrappers.recall (cyclomatic 37) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:105— wrappers.recall has cyclomatic complexity 37 (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.
SkillBanner.extractMarkdown::processNode (cyclomatic 37) hindsight-docs/src/components/SkillBanner.tsx:38— SkillBanner.extractMarkdown::processNode has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
transcript-dcode.readPyValue (cyclomatic 37) hindsight-integrations/coding-agents/src/core/transcript-dcode.ts:49— transcript-dcode.readPyValue has cyclomatic complexity 37 (threshold 15). Of this number, 35 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
KnowledgeService._process_batch (cyclomatic 36) hindsight-api-slim/hindsight_api/knowledge/service.py:1202— KnowledgeService._process_batch 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.
session-start.buildSessionStartContext (cyclomatic 36) hindsight-integrations/coding-agents/src/core/session-start.ts:170— session-start.buildSessionStartContext has cyclomatic complexity 36 (threshold 15). Of this number, 33 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
chat.writeSession (cyclomatic 36) hindsight-integrations/coding-agents/src/core/chat.ts:316— chat.writeSession has cyclomatic complexity 36 (threshold 15). Of this number, 29 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MemoryEngine.delete_bank (cyclomatic 35) hindsight-api-slim/hindsight_api/engine/memory_engine.py:12408— MemoryEngine.delete_bank 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.
llm-requests-view.LLMRequestChart (cyclomatic 35) hindsight-control-plane/src/components/llm-requests-view.tsx:655— llm-requests-view.LLMRequestChart has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 10 of the 35 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 676, renderChart, a function literal at line 734, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
hook.buildHookOutput (cyclomatic 35) hindsight-integrations/coding-agents/src/core/hook.ts:233— hook.buildHookOutput 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.
MCPMiddleware.__call__ (cyclomatic 34) hindsight-api-slim/hindsight_api/api/mcp.py:421— MCPMiddleware.__call__ has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
bank_templates.apply_bank_template_manifest (cyclomatic 33) hindsight-api-slim/hindsight_api/engine/bank_templates.py:484— bank_templates.apply_bank_template_manifest has cyclomatic complexity 33 (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.
MemoryEngine.update_document (cyclomatic 33) hindsight-api-slim/hindsight_api/engine/memory_engine.py:11807— MemoryEngine.update_document has cyclomatic complexity 33 (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.
MemoryEngine.update_page_node (cyclomatic 33) hindsight-api-slim/hindsight_api/engine/memory_engine.py:21222— MemoryEngine.update_page_node 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.
prompts.build_system_prompt_for_tools (cyclomatic 33) hindsight-api-slim/hindsight_api/engine/reflect/prompts.py:203— prompts.build_system_prompt_for_tools has cyclomatic complexity 33 (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.
orchestrator._try_delta_retain (cyclomatic 33) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3983— orchestrator._try_delta_retain 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.
staleness-badge.StalenessBadge (cyclomatic 33) hindsight-control-plane/src/components/staleness-badge.tsx:42— staleness-badge.StalenessBadge 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.
prompt-preview-dialog.PromptPreviewDialog (cyclomatic 33) hindsight-control-plane/src/components/prompt-preview-dialog.tsx:1030— prompt-preview-dialog.PromptPreviewDialog has cyclomatic complexity 33 (threshold 15). Of this number, 21 points are the body's own statements and 12 belong to 9 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HindsightConfig.validate (cyclomatic 32) hindsight-api-slim/hindsight_api/config.py:4692— HindsightConfig.validate 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.
cross_encoder._create_cross_encoder_backend (cyclomatic 32) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2863— cross_encoder._create_cross_encoder_backend 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.
ClaudeCodeLLM.call (cyclomatic 32) hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:322— ClaudeCodeLLM.call 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.
OpenAICompatibleLLM.__init__ (cyclomatic 32) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:901— OpenAICompatibleLLM.__init__ 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.
delta_ops.apply_operations (cyclomatic 32) hindsight-api-slim/hindsight_api/engine/reflect/delta_ops.py:614— delta_ops.apply_operations 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.
CrossEncoderReranker._rerank (cyclomatic 32) hindsight-api-slim/hindsight_api/engine/search/reranking.py:409— CrossEncoderReranker._rerank 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.
tools.createHindsightTools (cyclomatic 32) hindsight-integrations/openclaw/src/tools.ts:106— tools.createHindsightTools has cyclomatic complexity 32 (threshold 15). Of this number, 28 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
recall.retrieve_semantic_bm25_combined_sql (cyclomatic 31) hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:29— recall.retrieve_semantic_bm25_combined_sql 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.
tools.tool_expand (cyclomatic 31) hindsight-api-slim/hindsight_api/engine/reflect/tools.py:629— tools.tool_expand 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.
data-view.TimelineView (cyclomatic 31) hindsight-control-plane/src/components/data-view.tsx:1227— data-view.TimelineView has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 1269, a function literal at line 1288, a function literal at line 1540, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
transcript-codex.readCodexTranscript (cyclomatic 31) hindsight-integrations/coding-agents/src/core/transcript-codex.ts:195— transcript-codex.readCodexTranscript has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConfigResolver.validate_bank_config_updates (cyclomatic 30) hindsight-api-slim/hindsight_api/config_resolver.py:487— ConfigResolver.validate_bank_config_updates 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.
recall.retrieve_temporal_combined_sql (cyclomatic 30) hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:382— recall.retrieve_temporal_combined_sql 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.
MemoryEngine.submit_async_retain (cyclomatic 30) hindsight-api-slim/hindsight_api/engine/memory_engine.py:23730— MemoryEngine.submit_async_retain 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.
migrations.ensure_vector_extension (cyclomatic 30) REDACTED:842— migrations.ensure_vector_extension 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.
mental-model-detail-modal.ConfigurationTab (cyclomatic 30) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:1348— mental-model-detail-modal.ConfigurationTab has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
home-view.HomeView (cyclomatic 30) hindsight-control-plane/src/components/home-view.tsx:51— home-view.HomeView has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 89, 160, 136, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.resolveAndCacheIdentity (cyclomatic 30) REDACTED:1432— index.resolveAndCacheIdentity 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.
embeddings._create_embeddings (cyclomatic 29) hindsight-api-slim/hindsight_api/engine/embeddings.py:2583— embeddings._create_embeddings 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.
MemoryEngine.refresh_mental_model (cyclomatic 29) hindsight-api-slim/hindsight_api/engine/memory_engine.py:19412— MemoryEngine.refresh_mental_model 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.
schema-builder-dialog.SchemaBuilderDialog (cyclomatic 29) hindsight-control-plane/src/components/schema-builder-dialog.tsx:177— schema-builder-dialog.SchemaBuilderDialog has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 5 of the 29 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 196, switchTo, handleApply, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
MaintenanceLoop._run_scheduled_mm_refresh (cyclomatic 28) hindsight-api-slim/hindsight_api/engine/maintenance.py:643— MaintenanceLoop._run_scheduled_mm_refresh 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.
CodexLLM.call (cyclomatic 28) hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:559— CodexLLM.call 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.
PostgresKnowledgeStore.search (cyclomatic 28) hindsight-api-slim/hindsight_api/knowledge/store.py:858— PostgresKnowledgeStore.search 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.
main.main (cyclomatic 28) hindsight-api-slim/hindsight_api/main.py:278— main.main 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.
DaemonEmbedManager._start_daemon_locked (cyclomatic 28) hindsight-embed/hindsight_embed/daemon_embed_manager.py:940— DaemonEmbedManager._start_daemon_locked 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.
_WrappedCompletions.create (cyclomatic 28) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1181— _WrappedCompletions.create 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.
retain_capabilities.run_case (cyclomatic 28) hindsight-system-evals/hindsight_system_evals/retain_capabilities.py:161— retain_capabilities.run_case 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.
hook.runHook (cyclomatic 28) hindsight-integrations/coding-agents/src/core/hook.ts:425— hook.runHook 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.
installer.run (cyclomatic 28) hindsight-integrations/coding-agents/src/installer.ts:2421— installer.run has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_FactBatchResponse.to_actions (cyclomatic 27) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:987— _FactBatchResponse.to_actions 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.
LLMProvider.__init__ (cyclomatic 27) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:921— LLMProvider.__init__ 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.
MemoryEngine.delete_memory_unit (cyclomatic 27) hindsight-api-slim/hindsight_api/engine/memory_engine.py:12027— MemoryEngine.delete_memory_unit 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.
memory_engine._assemble_graph_data (cyclomatic 27) hindsight-api-slim/hindsight_api/engine/memory_engine.py:2752— memory_engine._assemble_graph_data 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.
LiteLLMLLM.call (cyclomatic 27) hindsight-api-slim/hindsight_api/engine/providers/litellm_llm.py:313— LiteLLMLLM.call 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._prune_round (cyclomatic 27) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:1928— agent._prune_round 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.
temporal_periods._extract_non_chinese_period (cyclomatic 27) hindsight-api-slim/hindsight_api/engine/temporal_periods.py:70— temporal_periods._extract_non_chinese_period 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.
importer._restore_bank (cyclomatic 27) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1232— importer._restore_bank 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.
setup.run_setup (cyclomatic 27) hindsight-integrations/hermes/setup.py:111— setup.run_setup 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.
config.set_defaults (cyclomatic 27) hindsight-integrations/litellm/hindsight_litellm/config.py:389— config.set_defaults 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.
llm-requests-view.TraceDialog (cyclomatic 27) hindsight-control-plane/src/components/llm-requests-view.tsx:493— llm-requests-view.TraceDialog has cyclomatic complexity 27 (threshold 15). Of this number, 14 points are the body's own statements and 13 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.getIdentitySkipReason (cyclomatic 27) REDACTED:1531— index.getIdentitySkipReason 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.
backfill.parseArgs (cyclomatic 27) hindsight-integrations/openclaw/src/backfill.ts:91— backfill.parseArgs has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
MemoryEngine.update_bank (cyclomatic 26) hindsight-api-slim/hindsight_api/engine/memory_engine.py:22967— MemoryEngine.update_bank 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.
CodexAuthManager.refresh_tokens (cyclomatic 26) hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:356— CodexAuthManager.refresh_tokens 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.
_WrappedAnthropicMessages.create (cyclomatic 26) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1603— _WrappedAnthropicMessages.create 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.
wrappers.reflect (cyclomatic 26) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:301— wrappers.reflect has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
llm-requests-view.LLMRequestsView (cyclomatic 26) hindsight-control-plane/src/components/llm-requests-view.tsx:1012— llm-requests-view.LLMRequestsView has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 11 of the 26 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 1033, a function literal at line 1250, handleStatusFilterChange, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
entity-labels-editor.MapFieldsEditor (cyclomatic 26) hindsight-control-plane/src/components/entity-labels-editor.tsx:61— entity-labels-editor.MapFieldsEditor has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 4 of the 26 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 122, a function literal at line 160, updateField, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
mental-model-detail-modal.diffLines (cyclomatic 26) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:430— mental-model-detail-modal.diffLines 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.
knowledge-bank-config-view.KnowledgeBankConfigView (cyclomatic 26) hindsight-control-plane/src/components/knowledge-bank-config-view.tsx:93— knowledge-bank-config-view.KnowledgeBankConfigView has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 4 of the 26 points are its own statements and the rest belongs to 15 function items inside it that branch (bandsRow, a function literal at line 110, save, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
backfill.runCli (cyclomatic 26) hindsight-integrations/openclaw/src/backfill.ts:436— backfill.runCli 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.
MemoryEngine.get_operation_status (cyclomatic 25) hindsight-api-slim/hindsight_api/engine/memory_engine.py:22520— MemoryEngine.get_operation_status 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.
orchestrator._delta_store_owned_write (cyclomatic 25) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1239— orchestrator._delta_store_owned_write 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.
cli.do_ui (cyclomatic 25) hindsight-embed/hindsight_embed/cli.py:673— cli.do_ui 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.
audit-logs-view.AuditLogsView (cyclomatic 25) hindsight-control-plane/src/components/audit-logs-view.tsx:289— audit-logs-view.AuditLogsView has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
document-history.DocumentHistory (cyclomatic 25) hindsight-control-plane/src/components/document-history.tsx:56— document-history.DocumentHistory has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (chip, a function literal at line 199, idRow, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
mental-model-detail-modal.BasedOnDiff (cyclomatic 25) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:578— mental-model-detail-modal.BasedOnDiff has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 5 function items inside it that branch (renderFact, a function literal at line 590, a function literal at line 666, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.flushRetainQueue (cyclomatic 25) REDACTED:418— index.flushRetainQueue 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.
index.prepareRetentionTranscript (cyclomatic 25) REDACTED:3658— index.prepareRetentionTranscript 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.
HindsightConfig.decision_model_config (cyclomatic 24) hindsight-api-slim/hindsight_api/config.py:6333— HindsightConfig.decision_model_config 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.
documents.retag_document_memories (cyclomatic 24) hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:433— documents.retag_document_memories 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.
MemoryEngine.search_pages (cyclomatic 24) hindsight-api-slim/hindsight_api/engine/memory_engine.py:20951— MemoryEngine.search_pages 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.
structured_doc.document_from_sections (cyclomatic 24) hindsight-api-slim/hindsight_api/engine/reflect/structured_doc.py:385— structured_doc.document_from_sections 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.
WorkerPoller._execute_task_inner (cyclomatic 24) hindsight-api-slim/hindsight_api/worker/poller.py:1309— WorkerPoller._execute_task_inner 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.
retain.run_retain (cyclomatic 24) hindsight-integrations/omo/scripts/retain.py:54— retain.run_retain 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.
llm-requests-view.SpanDetails (cyclomatic 24) hindsight-control-plane/src/components/llm-requests-view.tsx:359— llm-requests-view.SpanDetails 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.
knowledge-document-dialog.KnowledgeDocumentDialog (cyclomatic 24) hindsight-control-plane/src/components/knowledge-document-dialog.tsx:295— knowledge-document-dialog.KnowledgeDocumentDialog has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ControlPlaneClient.fetchApi (cyclomatic 24) hindsight-control-plane/src/lib/api.ts:521— ControlPlaneClient.fetchApi 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.
mock-bank.buildMockBank (cyclomatic 24) hindsight-docs/src/components/constellation/mock-bank.ts:335— mock-bank.buildMockBank has cyclomatic complexity 24 (threshold 15). Of this number, 18 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
HindsightConfig.log_config (cyclomatic 23) hindsight-api-slim/hindsight_api/config.py:6426— HindsightConfig.log_config 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.
LLMTraceRecorder.record_llm_call (cyclomatic 23) hindsight-api-slim/hindsight_api/engine/llm_trace.py:775— LLMTraceRecorder.record_llm_call 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.
llm_wrapper.create_llm_provider (cyclomatic 23) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:531— llm_wrapper.create_llm_provider 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.
MemoryEngine.initialize (cyclomatic 23) hindsight-api-slim/hindsight_api/engine/memory_engine.py:6346— MemoryEngine.initialize 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.
openai_compatible_llm._rate_limit_retry_at (cyclomatic 23) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:803— openai_compatible_llm._rate_limit_retry_at 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.
export.stream_export_bank (cyclomatic 23) hindsight-api-slim/hindsight_api/engine/transfer/export.py:536— export.stream_export_bank has cyclomatic complexity 23 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
importer._import_document_batch (cyclomatic 23) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1603— importer._import_document_batch 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.
ModelCallRecorder.record_llm_call (cyclomatic 23) hindsight-api-slim/hindsight_api/extensions/model_call.py:152— ModelCallRecorder.record_llm_call 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.
Hindsight._acreate_bank (cyclomatic 23) hindsight-clients/python/hindsight_client/hindsight_client.py:1029— Hindsight._acreate_bank 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.
cli.do_daemon (cyclomatic 23) hindsight-embed/hindsight_embed/cli.py:467— cli.do_daemon 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.
HindsightMemoryProvider._apply_connection_settings (cyclomatic 23) REDACTED:1457— HindsightMemoryProvider._apply_connection_settings 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.
consolidation.run_scenario (cyclomatic 23) hindsight-system-evals/hindsight_system_evals/consolidation.py:336— consolidation.run_scenario 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.
bank-config-view.BankAliasRows (cyclomatic 23) hindsight-control-plane/src/components/bank-config-view.tsx:2047— bank-config-view.BankAliasRows has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 8 function items inside it that branch (promote, add, remove, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
transcript-kimi.readKimiWire (cyclomatic 23) hindsight-integrations/coding-agents/src/core/transcript-kimi.ts:162— transcript-kimi.readKimiWire has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
deepen.main (cyclomatic 23) hindsight-integrations/coding-agents/src/deepen.ts:114— deepen.main 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.
consolidator._consolidate_batch_with_llm (cyclomatic 22) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:3949— consolidator._consolidate_batch_with_llm 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.
curation.get_memory_unit (cyclomatic 22) hindsight-api-slim/hindsight_api/engine/memories/pg/curation.py:319— curation.get_memory_unit 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.
MemoryEngine.delete_memory_units (cyclomatic 22) hindsight-api-slim/hindsight_api/engine/memory_engine.py:12190— MemoryEngine.delete_memory_units 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.
text_passages.split_into_passages (cyclomatic 22) hindsight-api-slim/hindsight_api/knowledge/text_passages.py:193— text_passages.split_into_passages 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.
sync_cookbook.extract_tags_from_readme (cyclomatic 22) hindsight-dev/hindsight_dev/sync_cookbook.py:121— sync_cookbook.extract_tags_from_readme 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.
route.forward (cyclomatic 22) REDACTED:85— route.forward 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.
bank-config-view.ConsolidationStrategiesPanel (cyclomatic 22) hindsight-control-plane/src/components/bank-config-view.tsx:2687— bank-config-view.ConsolidationStrategiesPanel has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 2809, a function literal at line 2711, a function literal at line 2717, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
constellation.Constellation::drawLabel (cyclomatic 22) hindsight-control-plane/src/components/constellation.tsx:1113— constellation.Constellation::drawLabel 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.
mental-model-trigger-fields.triggerFormFromTrigger (cyclomatic 22) hindsight-control-plane/src/components/mental-model-trigger-fields.tsx:52— mental-model-trigger-fields.triggerFormFromTrigger 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.
pages-view.TreeRow (cyclomatic 22) hindsight-control-plane/src/components/pages-view.tsx:1024— pages-view.TreeRow has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Constellation.Constellation::drawLabel (cyclomatic 22) hindsight-docs/src/components/constellation/Constellation.tsx:1080— Constellation.Constellation::drawLabel 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.
transcript-codebuddy-ide.readCodebuddyIdeTranscript (cyclomatic 22) hindsight-integrations/coding-agents/src/core/transcript-codebuddy-ide.ts:111— transcript-codebuddy-ide.readCodebuddyIdeTranscript 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.
cli._run_repair_bank (cyclomatic 21) hindsight-api-slim/hindsight_api/admin/cli.py:737— cli._run_repair_bank 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.
memory_engine._iter_raw_sub_batches (cyclomatic 21) hindsight-api-slim/hindsight_api/engine/memory_engine.py:1420— memory_engine._iter_raw_sub_batches 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.
XaiOAuthLLM.call (cyclomatic 21) hindsight-api-slim/hindsight_api/engine/providers/xai_oauth_llm.py:692— XaiOAuthLLM.call 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.
agent._execute_tool (cyclomatic 21) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2563— agent._execute_tool 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.
embedders.create_knowledge_embedder (cyclomatic 21) hindsight-api-slim/hindsight_api/knowledge/embedders.py:753— embedders.create_knowledge_embedder 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.
WorkerPoller._log_progress_if_due (cyclomatic 21) hindsight-api-slim/hindsight_api/worker/poller.py:2146— WorkerPoller._log_progress_if_due has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
sidebar.Sidebar (cyclomatic 21) hindsight-control-plane/src/components/sidebar.tsx:78— sidebar.Sidebar has cyclomatic complexity 21 (threshold 15). Of this number, 12 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
bank-context.BankProvider (cyclomatic 21) hindsight-control-plane/src/lib/bank-context.tsx:65— bank-context.BankProvider has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 90, 115, 164, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
transcript-qwen.collectQwenTurns (cyclomatic 21) hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:197— transcript-qwen.collectQwenTurns 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.
installer.configureServer (cyclomatic 21) hindsight-integrations/coding-agents/src/installer.ts:1033— installer.configureServer 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.
reflect-util.groundedNotes (cyclomatic 21) hindsight-integrations/obsidian/src/reflect-util.ts:83— reflect-util.groundedNotes has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to one function item inside it that branches (indexTrace). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
frontmatter.normalizeNote (cyclomatic 21) hindsight-integrations/obsidian/src/frontmatter.ts:46— frontmatter.normalizeNote 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.
index.deriveBankId (cyclomatic 21) REDACTED:1643— index.deriveBankId has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
OracleConnection._read_returning_values (cyclomatic 20) hindsight-api-slim/hindsight_api/engine/db/oracle.py:1076— OracleConnection._read_returning_values 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.
LLMProvider._call (cyclomatic 20) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1381— LLMProvider._call 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.
MemoryEngine._submit_async_operation (cyclomatic 20) hindsight-api-slim/hindsight_api/engine/memory_engine.py:23378— MemoryEngine._submit_async_operation 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.
fact_extraction._build_labels_prompt_section (cyclomatic 20) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:1419— fact_extraction._build_labels_prompt_section 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.
llm_request.bind_llm_request (cyclomatic 20) hindsight-api-slim/hindsight_api/extensions/llm_request.py:205— llm_request.bind_llm_request 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.
cli._do_configure_interactive (cyclomatic 20) hindsight-embed/hindsight_embed/cli.py:342— cli._do_configure_interactive 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.
content._extract_message_blocks (cyclomatic 20) hindsight-integrations/cursor/scripts/lib/content.py:121— content._extract_message_blocks 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.
daemon._ensure_daemon_running (cyclomatic 20) hindsight-integrations/cursor/scripts/lib/daemon.py:127— daemon._ensure_daemon_running 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.
retain.main (cyclomatic 20) hindsight-integrations/cursor/scripts/retain.py:158— retain.main 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.
HindsightOpenAI._recall_memories (cyclomatic 20) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:951— HindsightOpenAI._recall_memories has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (HindsightAnthropic._recall_memories) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
HindsightAnthropic._recall_memories (cyclomatic 20) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1381— HindsightAnthropic._recall_memories has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (HindsightOpenAI._recall_memories) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SafeHindsight.__init__ (cyclomatic 20) hindsight-integrations/superagent/hindsight_superagent/middleware.py:84— SafeHindsight.__init__ 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.
find-untranslated.isSkippable (cyclomatic 20) hindsight-control-plane/scripts/find-untranslated.ts:49— find-untranslated.isSkippable 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.
route.GET (cyclomatic 20) hindsight-control-plane/src/app/api/list/route.ts:16— route.GET 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.
page-search-dialog.PageSearchDialog (cyclomatic 20) hindsight-control-plane/src/components/page-search-dialog.tsx:56— page-search-dialog.PageSearchDialog has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
response-schema.validateResponseSchema (cyclomatic 20) hindsight-control-plane/src/lib/response-schema.ts:54— response-schema.validateResponseSchema 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.
missions.codingBankManifest (cyclomatic 20) hindsight-integrations/coding-agents/src/core/missions.ts:715— missions.codingBankManifest 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.
HindsightClient.seedPages (cyclomatic 20) hindsight-integrations/coding-agents/src/core/hindsight.ts:1040— HindsightClient.seedPages 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.
setup.parseCliArgs (cyclomatic 20) hindsight-integrations/openclaw/src/setup.ts:107— setup.parseCliArgs has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
MemoryEngine._handle_refresh_mental_model (cyclomatic 19) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4999— MemoryEngine._handle_refresh_mental_model 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.
MemoryEngine._handle_webhook_delivery (cyclomatic 19) hindsight-api-slim/hindsight_api/engine/memory_engine.py:5622— MemoryEngine._handle_webhook_delivery 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.
MemoryEngine.get_observation_history (cyclomatic 19) hindsight-api-slim/hindsight_api/engine/memory_engine.py:14223— MemoryEngine.get_observation_history has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
CodexLLM._parse_sse_stream (cyclomatic 19) hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:922— CodexLLM._parse_sse_stream 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.
importer._restore_rows (cyclomatic 19) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:646— importer._restore_rows 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.
cli_coverage_check.main (cyclomatic 19) hindsight-dev/hindsight_dev/cli_coverage_check.py:178— cli_coverage_check.main 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.
llm.detect_llm_config (cyclomatic 19) hindsight-integrations/cursor/scripts/lib/llm.py:42— llm.detect_llm_config 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.
hindsight_litellm._format_messages_for_storage (cyclomatic 19) hindsight-integrations/litellm/hindsight_litellm/__init__.py:830— hindsight_litellm._format_messages_for_storage 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.
route.GET (cyclomatic 19) hindsight-control-plane/src/app/api/documents/transfer/route.ts:17— route.GET 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.
bank-profile-view.DirectiveFormDialog (cyclomatic 19) hindsight-control-plane/src/components/bank-profile-view.tsx:788— bank-profile-view.DirectiveFormDialog has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 4 function items inside it that branch (handleSubmit, a function literal at line 809, handleClose, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
prompt-preview-dialog.ExtractionPanel (cyclomatic 19) hindsight-control-plane/src/components/prompt-preview-dialog.tsx:809— prompt-preview-dialog.ExtractionPanel has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
session-start.runSessionStartHook (cyclomatic 19) hindsight-integrations/coding-agents/src/core/session-start.ts:417— session-start.runSessionStartHook 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.
config_resolver._validate_recall_budget_updates (cyclomatic 18) hindsight-api-slim/hindsight_api/config_resolver.py:967— config_resolver._validate_recall_budget_updates 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.
MaintenanceLoop._run_reconcile (cyclomatic 18) hindsight-api-slim/hindsight_api/engine/maintenance.py:534— MaintenanceLoop._run_reconcile 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.
documents.list_documents (cyclomatic 18) hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:625— documents.list_documents 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.
MemoryEngine._handle_file_convert_retain (cyclomatic 18) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4625— MemoryEngine._handle_file_convert_retain 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.
ChatGPTAuth._refresh (cyclomatic 18) hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py:857— ChatGPTAuth._refresh 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.
tools.tool_search_mental_models (cyclomatic 18) hindsight-api-slim/hindsight_api/engine/reflect/tools.py:130— tools.tool_search_mental_models 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.
fact_extraction._extract_map_entities (cyclomatic 18) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:55— fact_extraction._extract_map_entities 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.
importer._iter_json_array (cyclomatic 18) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:235— importer._iter_json_array 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.
migrations.run_migrations (cyclomatic 18) REDACTED:412— migrations.run_migrations 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.
generate_changelog.generate_changelog_entry (cyclomatic 18) hindsight-dev/hindsight_dev/generate_changelog.py:937— generate_changelog.generate_changelog_entry 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.
cli.main (cyclomatic 18) hindsight-embed/hindsight_embed/cli.py:1425— cli.main has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StaticKeysTenantExtension.__init__ (cyclomatic 18) hindsight-extensions/static-keys-tenant/hindsight_ext_static_keys_tenant/extension.py:123— StaticKeysTenantExtension.__init__ 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.
HindsightStorage.__init__ (cyclomatic 18) hindsight-integrations/crewai/hindsight_crewai/storage.py:66— HindsightStorage.__init__ 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.
HindsightMemoryService.__init__ (cyclomatic 18) hindsight-integrations/google-adk/hindsight_google_adk/memory.py:80— HindsightMemoryService.__init__ 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.
session.run_session (cyclomatic 18) hindsight-system-evals/hindsight_system_evals/coding_agents/session.py:43— session.run_session 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.
bank.derive_bank_id (cyclomatic 18) hindsight-integrations/omo/scripts/lib/bank.py:66— bank.derive_bank_id has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App::enter_view (cyclomatic 18) hindsight-cli/src/commands/explore.rs:535— App::enter_view 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.
find-untranslated.scanFile::visit (cyclomatic 18) hindsight-control-plane/scripts/find-untranslated.ts:149— find-untranslated.scanFile::visit 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.
route.GET (cyclomatic 18) hindsight-control-plane/src/app/api/graph/route.ts:5— route.GET 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.
document-chunk-modal.DocumentChunkModal (cyclomatic 18) hindsight-control-plane/src/components/document-chunk-modal.tsx:23— document-chunk-modal.DocumentChunkModal has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mental-model-trigger-fields.triggerFromForm (cyclomatic 18) hindsight-control-plane/src/components/mental-model-trigger-fields.tsx:104— mental-model-trigger-fields.triggerFromForm has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mental-model-trigger-fields.MentalModelTriggerFields (cyclomatic 18) hindsight-control-plane/src/components/mental-model-trigger-fields.tsx:277— mental-model-trigger-fields.MentalModelTriggerFields has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 6 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
memory-defense-section.MemoryDefenseSection (cyclomatic 18) hindsight-control-plane/src/components/memory-defense-section.tsx:94— memory-defense-section.MemoryDefenseSection has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 111, a function literal at line 160, performSave, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
prompt-preview-dialog.BlockCard (cyclomatic 18) hindsight-control-plane/src/components/prompt-preview-dialog.tsx:379— prompt-preview-dialog.BlockCard 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.
search-debug-view.SearchDebugView::runSearch (cyclomatic 18) hindsight-control-plane/src/components/search-debug-view.tsx:223— search-debug-view.SearchDebugView::runSearch 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. This shape REPEATS in the file: one other method here (search-debug-view.SearchDebugView) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
traecode-mcp.registerTraecodeWorkspaceMcp (cyclomatic 18) hindsight-integrations/coding-agents/src/core/traecode-mcp.ts:235— traecode-mcp.registerTraecodeWorkspaceMcp 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.
zstd-frames.scanZstdFrames (cyclomatic 18) hindsight-integrations/coding-agents/src/core/zstd-frames.ts:20— zstd-frames.scanZstdFrames 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.
installer.prepareDcodeMarketplace (cyclomatic 18) hindsight-integrations/coding-agents/src/installer.ts:1619— installer.prepareDcodeMarketplace has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
session-file.parseSessionFile (cyclomatic 18) hindsight-integrations/openclaw/src/session-file.ts:48— session-file.parseSessionFile 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.
index.extractStructuredBlocks (cyclomatic 18) REDACTED:3826— index.extractStructuredBlocks 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.
reembed.reembed_schema (cyclomatic 17) hindsight-api-slim/hindsight_api/admin/reembed.py:422— reembed.reembed_schema 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.
consolidator.preview_consolidation_strategies (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:4250— consolidator.preview_consolidation_strategies 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.
OnnxEmbeddings.initialize (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/embeddings.py:598— OnnxEmbeddings.initialize 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.
graph._relink_batch (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py:732— graph._relink_batch 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.
MemoryEngine.attachments_for_memories (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/memory_engine.py:8881— MemoryEngine.attachments_for_memories 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.
MemoryEngine._row_to_mental_model (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/memory_engine.py:21785— MemoryEngine._row_to_mental_model 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.
NousAuthManager.refresh_tokens (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:326— NousAuthManager.refresh_tokens 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.
delta_ops.parse_delta_operation_list (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/reflect/delta_ops.py:364— delta_ops.parse_delta_operation_list 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.
fact_extraction.extract_facts_from_contents (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:3584— fact_extraction.extract_facts_from_contents 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.
vector_index_health.plan_bank_vector_indexes (cyclomatic 17) hindsight-api-slim/hindsight_api/engine/vector_index_health.py:225— vector_index_health.plan_bank_vector_indexes 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.
WorkerPoller._claim_batch_on_conn (cyclomatic 17) hindsight-api-slim/hindsight_api/worker/poller.py:671— WorkerPoller._claim_batch_on_conn 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.
HindsightMemoryProvider.initialize (cyclomatic 17) REDACTED:1284— HindsightMemoryProvider.initialize 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.
consolidation._check_snapshot (cyclomatic 17) hindsight-system-evals/hindsight_system_evals/consolidation.py:218— consolidation._check_snapshot 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.
demo.main (cyclomatic 17) hindsight-integrations/omo/demo.py:143— demo.main has cyclomatic complexity 17 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
recall.main (cyclomatic 17) hindsight-integrations/omo/scripts/recall.py:56— recall.main has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.main (cyclomatic 17) hindsight-control-plane/bin/cli.js:26— cli.main has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
page.KnowledgeBankPage (cyclomatic 17) hindsight-control-plane/src/app/[locale]/knowledge-banks/[bankId]/page.tsx:44— page.KnowledgeBankPage has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
route.POST (cyclomatic 17) hindsight-control-plane/src/app/api/reflect/route.ts:6— route.POST 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.
bank-config-view.RetainStrategiesPanel (cyclomatic 17) hindsight-control-plane/src/components/bank-config-view.tsx:1676— bank-config-view.RetainStrategiesPanel has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
bank-selector.BankSelectorInner::handleCreateDocument (cyclomatic 17) hindsight-control-plane/src/components/bank-selector.tsx:530— bank-selector.BankSelectorInner::handleCreateDocument 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. This shape REPEATS in the file: one other method here (bank-selector.BankSelectorInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
documents-view.DocumentRetainTraces (cyclomatic 17) hindsight-control-plane/src/components/documents-view.tsx:306— documents-view.DocumentRetainTraces has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 314, 359, 340, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
documents-view.InvalidatedFactsSection (cyclomatic 17) hindsight-control-plane/src/components/documents-view.tsx:524— documents-view.InvalidatedFactsSection has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 566, 531). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
edit-memory-form.EditMemoryForm (cyclomatic 17) hindsight-control-plane/src/components/edit-memory-form.tsx:51— edit-memory-form.EditMemoryForm has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 180, a function literal at line 202, addEntity, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
format.formatMemoriesAsSystemPrompt (cyclomatic 17) hindsight-integrations/chat/src/format.ts:12— format.formatMemoriesAsSystemPrompt 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.
transcript-cursor.readCursorTranscript (cyclomatic 17) hindsight-integrations/coding-agents/src/core/transcript-cursor.ts:37— transcript-cursor.readCursorTranscript 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.
transcript-pi.renderMessage (cyclomatic 17) hindsight-integrations/coding-agents/src/core/transcript-pi.ts:44— transcript-pi.renderMessage 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.
cli.repair_bank (cyclomatic 16) hindsight-api-slim/hindsight_api/admin/cli.py:908— cli.repair_bank 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.
config._parse_llm_members (cyclomatic 16) hindsight-api-slim/hindsight_api/config.py:3040— config._parse_llm_members 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.
bank_templates.validate_bank_template (cyclomatic 16) hindsight-api-slim/hindsight_api/engine/bank_templates.py:432— bank_templates.validate_bank_template 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.
TypeSafeCrossEncoder._rank (cyclomatic 16) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1422— TypeSafeCrossEncoder._rank 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.
LLMProvider._call_with_tools (cyclomatic 16) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1690— LLMProvider._call_with_tools 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.
MemoryEngine._check_retain_writes (cyclomatic 16) hindsight-api-slim/hindsight_api/engine/memory_engine.py:3859— MemoryEngine._check_retain_writes 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.
MemoryEngine.list_directives (cyclomatic 16) hindsight-api-slim/hindsight_api/engine/memory_engine.py:22019— MemoryEngine.list_directives 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.
ToolResultPresenter.present (cyclomatic 16) hindsight-api-slim/hindsight_api/engine/reflect/presentation.py:143— ToolResultPresenter.present 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.
fact_extraction._build_extraction_prompt_and_schema (cyclomatic 16) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:1597— fact_extraction._build_extraction_prompt_and_schema 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.
sync_cookbook.update_cookbook_index (cyclomatic 16) hindsight-dev/hindsight_dev/sync_cookbook.py:460— sync_cookbook.update_cookbook_index 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.
tools.register_hindsight_tools (cyclomatic 16) hindsight-integrations/composio/hindsight_composio/tools.py:90— tools.register_hindsight_tools 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.
retain.read_transcript (cyclomatic 16) hindsight-integrations/cursor/scripts/retain.py:98— retain.read_transcript 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.
_HindsightToolBackend.__init__ (cyclomatic 16) hindsight-integrations/haystack/hindsight_haystack/tools.py:103— _HindsightToolBackend.__init__ 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.
HindsightMemoryProvider._recall (cyclomatic 16) REDACTED:1685— HindsightMemoryProvider._recall 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.
hindsight_litellm._store_conversation_from_text (cyclomatic 16) hindsight-integrations/litellm/hindsight_litellm/__init__.py:1137— hindsight_litellm._store_conversation_from_text 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.
hindsight_litellm._store_conversation (cyclomatic 16) hindsight-integrations/litellm/hindsight_litellm/__init__.py:1194— hindsight_litellm._store_conversation 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.
metric.transcript_credits (cyclomatic 16) hindsight-system-evals/hindsight_system_evals/coding_agents/metric.py:96— metric.transcript_credits 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.
bank-config-view.RetainStrategyForm (cyclomatic 16) hindsight-control-plane/src/components/bank-config-view.tsx:1561— bank-config-view.RetainStrategyForm has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tag-filter-input.TagFilterInput::handleKeyDown (cyclomatic 16) hindsight-control-plane/src/components/tag-filter-input.tsx:115— tag-filter-input.TagFilterInput::handleKeyDown 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.
mental-model-detail-modal.diffTokensInline (cyclomatic 16) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:387— mental-model-detail-modal.diffTokensInline 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.
pending-uploads.pendingUploadsFromOperations (cyclomatic 16) hindsight-control-plane/src/lib/pending-uploads.ts:37— pending-uploads.pendingUploadsFromOperations has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SkillBanner.SkillBanner (cyclomatic 16) hindsight-docs/src/components/SkillBanner.tsx:110— SkillBanner.SkillBanner has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 145, 158, 117, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
index.BlogListPage (cyclomatic 16) hindsight-docs/src/theme/BlogListPage/index.tsx:100— index.BlogListPage has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 113, a function literal at line 138, a function literal at line 122, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
transcript-qwen.renderLine (cyclomatic 16) hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:137— transcript-qwen.renderLine 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.
install-ui.createInstallerUi.select (cyclomatic 16) REDACTED:209— install-ui.createInstallerUi.select has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
installer.stripUnmarkedGrokEntries (cyclomatic 16) hindsight-integrations/coding-agents/src/installer.ts:1352— installer.stripUnmarkedGrokEntries has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SyncEngine.ingestFile (cyclomatic 16) hindsight-integrations/obsidian/src/sync.ts:135— SyncEngine.ingestFile 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.
D10 · Test Quality· Fixed-sleep synchronisation · ×1
Fixed-sleep synchronisation: waits for an in-flight write-back, and gives up after its bound hindsight-integrations/coding-agents/src/core/runtime.test.ts:394— This test starts work it did not wait for (`done`, still running when the sleep starts) and then orders itself against it with `new Promise((r) => setTimeout(r, 10))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
TodoComment repeated across 199 files hindsight-clients/python/hindsight_client_api/models/add_background_request.py:46— The identical TodoComment appears in 199 files (199 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 199 independent debts. Fix the systemic cause once rather than file-by-file. Text: "# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
TodoComment repeated across 14 files hindsight-clients/python/hindsight_client_api/models/map_field_input.py:123— The identical TodoComment appears in 14 files (14 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 14 independent debts. Fix the systemic cause once rather than file-by-file. Text: "# TODO: Rewrite to not use raise_errors". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
chinese_temporal_periods.extract_chinese_period (cognitive 419) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:97— chinese_temporal_periods.extract_chinese_period has cognitive complexity 419 (threshold 15). Drivers by points: if/else 268 (354 pts), ternaries 21 (42 pts), boolean chains 23 (nesting depth added 107). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
constellation.Constellation (cognitive 362) hindsight-control-plane/src/components/constellation.tsx:267— constellation.Constellation has cognitive complexity 362 (threshold 15). Drivers by points: if/else 87 (149 pts), ternaries 53 (88 pts), boolean chains 63, loops 32 (60 pts), error handling 1 (2 pts) (nesting depth added 126). Most of this is not in the body itself: 12 of the 362 points are its own statements and the rest belongs to 31 function items inside it that branch (a function literal at line 590, a function literal at line 1242, a function literal at line 343, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
MemoryEngine._search_with_retries (cognitive 357) hindsight-api-slim/hindsight_api/engine/memory_engine.py:10104— MemoryEngine._search_with_retries has cognitive complexity 357 (threshold 15). Drivers by points: if/else 100 (200 pts), loops 28 (70 pts), ternaries 33 (48 pts), boolean chains 35, error handling 3 (4 pts) (nesting depth added 158). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Constellation.Constellation (cognitive 345) hindsight-docs/src/components/constellation/Constellation.tsx:289— Constellation.Constellation has cognitive complexity 345 (threshold 15). Drivers by points: if/else 90 (156 pts), ternaries 44 (71 pts), loops 31 (59 pts), boolean chains 57, error handling 1 (2 pts) (nesting depth added 122). Most of this is not in the body itself: 10 of the 345 points are its own statements and the rest belongs to 27 function items inside it that branch (a function literal at line 592, a function literal at line 1199, a function literal at line 364, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
agent._run_reflect_agent_inner (cognitive 296) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:547— agent._run_reflect_agent_inner has cognitive complexity 296 (threshold 15). Drivers by points: if/else 64 (185 pts), boolean chains 39, loops 10 (32 pts), ternaries 7 (21 pts), error handling 6 (19 pts) (nesting depth added 170). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fact_extraction._extract_facts_from_chunk (cognitive 272) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2081— fact_extraction._extract_facts_from_chunk has cognitive complexity 272 (threshold 15). Drivers by points: if/else 52 (184 pts), ternaries 12 (40 pts), loops 6 (26 pts), boolean chains 11, error handling 3 (11 pts) (nesting depth added 188). 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.
fact_extraction.extract_facts_from_contents_batch_api (cognitive 269) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2937— fact_extraction.extract_facts_from_contents_batch_api has cognitive complexity 269 (threshold 15). Drivers by points: if/else 55 (179 pts), loops 14 (36 pts), ternaries 6 (26 pts), boolean chains 17, error handling 3 (11 pts) (nesting depth added 174). 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.
documents-view.DocumentsView (cognitive 258) hindsight-control-plane/src/components/documents-view.tsx:715— documents-view.DocumentsView has cognitive complexity 258 (threshold 15). Drivers by points: ternaries 46 (124 pts), boolean chains 75, if/else 33 (44 pts), error handling 13, loops 2 (nesting depth added 89). Of this number, 110 points are the body's own statements and 148 belong to 33 function items inside it that branch. 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.
OpenAICompatibleLLM.call (cognitive 194) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1219— OpenAICompatibleLLM.call has cognitive complexity 194 (threshold 15). Drivers by points: if/else 44 (112 pts), error handling 10 (33 pts), ternaries 8 (29 pts), boolean chains 19, loops 1 (nesting depth added 112). 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.
MemoryEngine._execute_mental_model_refresh (cognitive 173) hindsight-api-slim/hindsight_api/engine/memory_engine.py:18511— MemoryEngine._execute_mental_model_refresh has cognitive complexity 173 (threshold 15). Drivers by points: if/else 52 (102 pts), boolean chains 26, ternaries 11 (24 pts), error handling 5 (15 pts), loops 4 (6 pts) (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
data-view.DataView (cognitive 167) hindsight-control-plane/src/components/data-view.tsx:115— data-view.DataView has cognitive complexity 167 (threshold 15). Drivers by points: boolean chains 61, if/else 45 (56 pts), ternaries 14 (41 pts), error handling 6, loops 3 (nesting depth added 38). Of this number, 76 points are the body's own statements and 91 belong to 37 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightConfig._read_env (cognitive 164) hindsight-api-slim/hindsight_api/config.py:4931— HindsightConfig._read_env has cognitive complexity 164 (threshold 15). Drivers by points: boolean chains 147, ternaries 10, 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.
bank-operations-view.BankOperationsView (cognitive 144) hindsight-control-plane/src/components/bank-operations-view.tsx:143— bank-operations-view.BankOperationsView has cognitive complexity 144 (threshold 15). Drivers by points: ternaries 27 (59 pts), boolean chains 51, if/else 24 (25 pts), error handling 7 (8 pts), loops 1 (nesting depth added 34). Of this number, 45 points are the body's own statements and 99 belong to 23 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_litellm._inject_memories (cognitive 143) hindsight-integrations/litellm/hindsight_litellm/__init__.py:229— hindsight_litellm._inject_memories has cognitive complexity 143 (threshold 15). Drivers by points: if/else 38 (81 pts), ternaries 13 (32 pts), boolean chains 18, loops 4 (8 pts), error handling 3 (4 pts) (nesting depth added 67). 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.
MemoryEngine._run_retain_execution (cognitive 138) hindsight-api-slim/hindsight_api/engine/memory_engine.py:7598— MemoryEngine._run_retain_execution has cognitive complexity 138 (threshold 15). Drivers by points: if/else 27 (78 pts), loops 12 (30 pts), ternaries 5 (14 pts), boolean chains 8, error handling 3 (8 pts) (nesting depth added 83). 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.
orchestrator.retain_batch (cognitive 131) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1619— orchestrator.retain_batch has cognitive complexity 131 (threshold 15). Drivers by points: if/else 36 (79 pts), loops 9 (21 pts), boolean chains 15, ternaries 7 (12 pts), error handling 2 (4 pts) (nesting depth added 62). 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.
MemoryEngine.reflect_async (cognitive 120) hindsight-api-slim/hindsight_api/engine/memory_engine.py:16147— MemoryEngine.reflect_async has cognitive complexity 120 (threshold 15). Drivers by points: if/else 31 (68 pts), boolean chains 19, ternaries 15 (16 pts), loops 7 (13 pts), error handling 3 (4 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pages-view.PagesView (cognitive 118) hindsight-control-plane/src/components/pages-view.tsx:101— pages-view.PagesView has cognitive complexity 118 (threshold 15). Drivers by points: boolean chains 41, ternaries 26 (39 pts), if/else 30, error handling 5, loops 2 (3 pts) (nesting depth added 14). Of this number, 48 points are the body's own statements and 70 belong to 38 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli.do_profile_command (cognitive 117) hindsight-embed/hindsight_embed/cli.py:1049— cli.do_profile_command has cognitive complexity 117 (threshold 15). Drivers by points: if/else 33 (64 pts), boolean chains 18, error handling 7 (14 pts), ternaries 5 (14 pts), loops 3 (7 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.update_memory_unit (cognitive 116) hindsight-api-slim/hindsight_api/engine/memory_engine.py:13004— MemoryEngine.update_memory_unit has cognitive complexity 116 (threshold 15). Drivers by points: if/else 35 (52 pts), ternaries 16 (28 pts), boolean chains 24, error handling 5 (10 pts), loops 1 (2 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.
memory-detail-modal.MemoryDetailModal (cognitive 116) hindsight-control-plane/src/components/memory-detail-modal.tsx:78— memory-detail-modal.MemoryDetailModal has cognitive complexity 116 (threshold 15). Drivers by points: ternaries 15 (60 pts), boolean chains 41, if/else 9, error handling 6 (nesting depth added 45). Of this number, 93 points are the body's own statements and 23 belong to 13 function items inside it that branch. 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.
EntityResolver._resolve_from_candidates (cognitive 114) hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:1163— EntityResolver._resolve_from_candidates has cognitive complexity 114 (threshold 15). Drivers by points: if/else 28 (71 pts), loops 7 (17 pts), ternaries 4 (16 pts), boolean chains 10 (nesting depth added 65). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.__init__ (cognitive 107) hindsight-api-slim/hindsight_api/engine/memory_engine.py:2972— MemoryEngine.__init__ has cognitive complexity 107 (threshold 15). Drivers by points: boolean chains 48, if/else 38 (47 pts), ternaries 9 (11 pts), loops 1 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
consolidator._process_memory_batch (cognitive 104) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:2711— consolidator._process_memory_batch has cognitive complexity 104 (threshold 15). Drivers by points: if/else 32 (59 pts), loops 13 (27 pts), boolean chains 9, ternaries 6 (7 pts), error handling 1 (2 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.update_mental_model (cognitive 101) hindsight-api-slim/hindsight_api/engine/memory_engine.py:19807— MemoryEngine.update_mental_model has cognitive complexity 101 (threshold 15). Drivers by points: if/else 38 (59 pts), boolean chains 22, ternaries 8 (20 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.
bank-config-view.BankConfigView (cognitive 101) hindsight-control-plane/src/components/bank-config-view.tsx:467— bank-config-view.BankConfigView has cognitive complexity 101 (threshold 15). Drivers by points: ternaries 31 (33 pts), if/else 28 (29 pts), boolean chains 27, error handling 11, loops 1 (nesting depth added 3). Of this number, 26 points are the body's own statements and 75 belong to 35 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GeminiLLM.call (cognitive 99) hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py:343— GeminiLLM.call has cognitive complexity 99 (threshold 15). Drivers by points: if/else 32 (72 pts), boolean chains 15, error handling 4 (8 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sync_cookbook.extract_tags_from_readme (cognitive 99) hindsight-dev/hindsight_dev/sync_cookbook.py:121— sync_cookbook.extract_tags_from_readme has cognitive complexity 99 (threshold 15). Drivers by points: if/else 13 (73 pts), loops 4 (22 pts), boolean chains 3, error handling 1 (nesting depth added 78). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
session-start.buildSessionStartContext (cognitive 92) hindsight-integrations/coding-agents/src/core/session-start.ts:170— session-start.buildSessionStartContext has cognitive complexity 92 (threshold 15). Drivers by points: if/else 20 (67 pts), boolean chains 7, ternaries 2 (7 pts), loops 1 (6 pts), error handling 3 (5 pts) (nesting depth added 59). Of this number, 89 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OpenAICompatibleLLM._call_ollama_native (cognitive 89) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1708— OpenAICompatibleLLM._call_ollama_native has cognitive complexity 89 (threshold 15). Drivers by points: if/else 22 (45 pts), error handling 8 (22 pts), ternaries 4 (13 pts), boolean chains 8, loops 1 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript-dcode.readPyValue (cognitive 86) hindsight-integrations/coding-agents/src/core/transcript-dcode.ts:49— transcript-dcode.readPyValue has cognitive complexity 86 (threshold 15). Drivers by points: if/else 27 (63 pts), ternaries 4 (14 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 48). Of this number, 84 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
delta_ops.apply_operations (cognitive 85) hindsight-api-slim/hindsight_api/engine/reflect/delta_ops.py:614— delta_ops.apply_operations has cognitive complexity 85 (threshold 15). Drivers by points: if/else 31 (83 pts), boolean chains 1, loops 1 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
app.App (cognitive 85) hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx:34— app.App has cognitive complexity 85 (threshold 15). Drivers by points: if/else 22 (31 pts), boolean chains 29, ternaries 13 (16 pts), error handling 9 (nesting depth added 12). Of this number, 19 points are the body's own statements and 66 belong to 18 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.default::runRetain (cognitive 84) REDACTED:3017— index.default::runRetain has cognitive complexity 84 (threshold 15). Drivers by points: if/else 37 (50 pts), boolean chains 17, ternaries 12 (15 pts), error handling 2 (nesting depth added 16). 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. This shape REPEATS in the file: one other method here (index.default) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
MemoryEngine.retain_batch_async (cognitive 81) hindsight-api-slim/hindsight_api/engine/memory_engine.py:7072— MemoryEngine.retain_batch_async has cognitive complexity 81 (threshold 15). Drivers by points: if/else 27 (51 pts), loops 6 (12 pts), boolean chains 7, ternaries 2 (7 pts), error handling 2 (4 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
orchestrator._streaming_retain_batch (cognitive 81) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:2660— orchestrator._streaming_retain_batch has cognitive complexity 81 (threshold 15). Drivers by points: if/else 29 (46 pts), boolean chains 16, error handling 4 (8 pts), ternaries 4 (8 pts), loops 2 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.recall_async (cognitive 79) hindsight-api-slim/hindsight_api/engine/memory_engine.py:9573— MemoryEngine.recall_async has cognitive complexity 79 (threshold 15). Drivers by points: if/else 31 (50 pts), error handling 5 (14 pts), boolean chains 11, ternaries 2 (3 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
page.BankPage (cognitive 76) hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:104— page.BankPage has cognitive complexity 76 (threshold 15). Drivers by points: boolean chains 43, if/else 15 (17 pts), ternaries 8, error handling 7, loops 1 (nesting depth added 2). Of this number, 45 points are the body's own statements and 31 belong to 15 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
think-view.ThinkView (cognitive 76) hindsight-control-plane/src/components/think-view.tsx:72— think-view.ThinkView has cognitive complexity 76 (threshold 15). Drivers by points: boolean chains 63, if/else 6, ternaries 3 (4 pts), error handling 3 (nesting depth added 1). Of this number, 55 points are the body's own statements and 21 belong to 14 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AnthropicLLM.call (cognitive 75) hindsight-api-slim/hindsight_api/engine/providers/anthropic_llm.py:318— AnthropicLLM.call has cognitive complexity 75 (threshold 15). Drivers by points: if/else 24 (47 pts), error handling 5 (11 pts), boolean chains 8, ternaries 3 (5 pts), loops 3 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KnowledgeService._within_budget (cognitive 75) hindsight-api-slim/hindsight_api/knowledge/service.py:1846— KnowledgeService._within_budget has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (45 pts), ternaries 3 (11 pts), loops 6 (10 pts), boolean chains 9 (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.
HindsightCallback._plan_store (cognitive 75) REDACTED:568— HindsightCallback._plan_store has cognitive complexity 75 (threshold 15). Drivers by points: if/else 24 (50 pts), boolean chains 11, loops 4 (11 pts), ternaries 1 (3 pts) (nesting depth added 35). 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.
mental-model-detail-modal.MentalModelDetailModal (cognitive 74) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:824— mental-model-detail-modal.MentalModelDetailModal has cognitive complexity 74 (threshold 15). Drivers by points: ternaries 14 (44 pts), boolean chains 17, if/else 7, error handling 6 (nesting depth added 30). Of this number, 54 points are the body's own statements and 20 belong to 9 function items inside it that branch. 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.
CodexLLM.call (cognitive 73) hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:559— CodexLLM.call has cognitive complexity 73 (threshold 15). Drivers by points: if/else 18 (37 pts), error handling 8 (25 pts), ternaries 3 (7 pts), boolean chains 2, loops 2 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
webhooks-view.WebhooksView (cognitive 70) hindsight-control-plane/src/components/webhooks-view.tsx:310— webhooks-view.WebhooksView has cognitive complexity 70 (threshold 15). Drivers by points: boolean chains 24, ternaries 20 (24 pts), if/else 16, error handling 6 (nesting depth added 4). Of this number, 26 points are the body's own statements and 44 belong to 21 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ClaudeCodeLLM.call (cognitive 67) hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:322— ClaudeCodeLLM.call has cognitive complexity 67 (threshold 15). Drivers by points: if/else 15 (36 pts), error handling 5 (11 pts), ternaries 4 (9 pts), loops 4 (8 pts), boolean chains 3 (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.
_WrappedAnthropicMessages.create (cognitive 67) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1603— _WrappedAnthropicMessages.create has cognitive complexity 67 (threshold 15). Drivers by points: if/else 21 (52 pts), loops 3 (11 pts), boolean chains 4 (nesting depth added 39). 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.
staleness-badge.StalenessBadge (cognitive 67) hindsight-control-plane/src/components/staleness-badge.tsx:42— staleness-badge.StalenessBadge has cognitive complexity 67 (threshold 15). Drivers by points: ternaries 22 (58 pts), boolean chains 6, if/else 3 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
consolidator._run_consolidation_job (cognitive 66) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:1886— consolidator._run_consolidation_job has cognitive complexity 66 (threshold 15). Drivers by points: if/else 19 (29 pts), loops 12 (28 pts), boolean chains 6, ternaries 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
recall.retrieve_temporal_combined_sql (cognitive 66) hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:382— recall.retrieve_temporal_combined_sql has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (39 pts), loops 6 (12 pts), ternaries 4 (12 pts), boolean chains 3 (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.
_WrappedCompletions.create (cognitive 66) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1181— _WrappedCompletions.create has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (50 pts), loops 3 (10 pts), boolean chains 6 (nesting depth added 37). 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.
curation.list_memory_units (cognitive 65) hindsight-api-slim/hindsight_api/engine/memories/pg/curation.py:36— curation.list_memory_units has cognitive complexity 65 (threshold 15). Drivers by points: ternaries 19 (35 pts), if/else 19 (23 pts), boolean chains 3, error handling 1 (2 pts), loops 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
banks-overview.BanksOverview (cognitive 63) hindsight-control-plane/src/components/banks-overview.tsx:87— banks-overview.BanksOverview has cognitive complexity 63 (threshold 15). Drivers by points: ternaries 11 (22 pts), boolean chains 20, if/else 15 (17 pts), error handling 2 (3 pts), loops 1 (nesting depth added 14). Of this number, 23 points are the body's own statements and 40 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.delete_bank (cognitive 62) hindsight-api-slim/hindsight_api/engine/memory_engine.py:12408— MemoryEngine.delete_bank has cognitive complexity 62 (threshold 15). Drivers by points: if/else 23 (41 pts), ternaries 4 (8 pts), loops 2 (5 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bank-selector.BankSelectorInner (cognitive 62) hindsight-control-plane/src/components/bank-selector.tsx:129— bank-selector.BankSelectorInner has cognitive complexity 62 (threshold 15). Drivers by points: boolean chains 61, ternaries 35 (58 pts), if/else 41 (47 pts), error handling 5 (7 pts), loops 3 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (bank-selector.BankSelectorInner::handleCreateDocument) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
HindsightClient.updateBankConfig (cognitive 61) hindsight-clients/typescript/src/index.ts:923— HindsightClient.updateBankConfig has cognitive complexity 61 (threshold 15). Drivers by points: if/else 61. 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.
index.default (cognitive 61) REDACTED:2287— index.default has cognitive complexity 61 (threshold 15). Drivers by points: if/else 102 (136 pts), boolean chains 49, ternaries 27 (36 pts), error handling 8 (10 pts), loops 1, match/switch 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (index.default::runRetain) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LiteLLMLLM.call (cognitive 60) hindsight-api-slim/hindsight_api/engine/providers/litellm_llm.py:313— LiteLLMLLM.call has cognitive complexity 60 (threshold 15). Drivers by points: if/else 18 (38 pts), error handling 5 (11 pts), ternaries 3 (6 pts), boolean chains 4, loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mental-models-view.MentalModelsView (cognitive 60) hindsight-control-plane/src/components/mental-models-view.tsx:132— mental-models-view.MentalModelsView has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 15 (24 pts), if/else 13 (17 pts), boolean chains 14, error handling 4, loops 1 (nesting depth added 13). Of this number, 22 points are the body's own statements and 38 belong to 17 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.do_daemon (cognitive 59) hindsight-embed/hindsight_embed/cli.py:467— cli.do_daemon has cognitive complexity 59 (threshold 15). Drivers by points: if/else 26 (50 pts), error handling 2 (6 pts), loops 1 (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.
MemoryEngine.get_operation_status (cognitive 58) hindsight-api-slim/hindsight_api/engine/memory_engine.py:22520— MemoryEngine.get_operation_status has cognitive complexity 58 (threshold 15). Drivers by points: ternaries 12 (33 pts), if/else 8 (17 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
migrations.ensure_text_search_extension (cognitive 58) REDACTED:1207— migrations.ensure_text_search_extension has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (38 pts), ternaries 4 (9 pts), boolean chains 8, loops 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.getPluginConfig (cognitive 58) REDACTED:2118— index.getPluginConfig has cognitive complexity 58 (threshold 15). Drivers by points: ternaries 32, boolean chains 26. 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.
entities-view.EntitiesView (cognitive 57) hindsight-control-plane/src/components/entities-view.tsx:51— entities-view.EntitiesView has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 19, loops 4 (5 pts), ternaries 4 (5 pts), error handling 4 (nesting depth added 9). Most of this is not in the body itself: 10 of the 57 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 223, a function literal at line 194, loadEntities, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
knowledge-documents-view.KnowledgeDocumentsView (cognitive 57) hindsight-control-plane/src/components/knowledge-documents-view.tsx:169— knowledge-documents-view.KnowledgeDocumentsView has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 12 (30 pts), if/else 12 (13 pts), boolean chains 12, error handling 2 (nesting depth added 19). Of this number, 22 points are the body's own statements and 35 belong to 11 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine._dispatch_task (cognitive 53) hindsight-api-slim/hindsight_api/engine/memory_engine.py:5218— MemoryEngine._dispatch_task has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 7, error handling 6, ternaries 1 (4 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.
KnowledgeService._process_batch (cognitive 53) hindsight-api-slim/hindsight_api/knowledge/service.py:1202— KnowledgeService._process_batch has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 9, error handling 4 (7 pts), loops 5 (7 pts), ternaries 3 (5 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.
search-debug-view.SearchDebugView (cognitive 53) hindsight-control-plane/src/components/search-debug-view.tsx:109— search-debug-view.SearchDebugView has cognitive complexity 53 (threshold 15). Drivers by points: boolean chains 63, if/else 11, ternaries 3, 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. This shape REPEATS in the file: one other method here (search-debug-view.SearchDebugView::runSearch) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DaemonEmbedManager._start_daemon_locked (cognitive 52) hindsight-embed/hindsight_embed/daemon_embed_manager.py:940— DaemonEmbedManager._start_daemon_locked has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (38 pts), error handling 4 (6 pts), loops 3 (5 pts), boolean chains 2, 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.
ConfigResolver.validate_bank_config_updates (cognitive 51) hindsight-api-slim/hindsight_api/config_resolver.py:487— ConfigResolver.validate_bank_config_updates has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (29 pts), error handling 5 (11 pts), ternaries 2 (6 pts), boolean chains 3, loops 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.
_FactBatchResponse.to_actions (cognitive 50) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:987— _FactBatchResponse.to_actions has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 7, loops 4 (7 pts), ternaries 2 (5 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
knowledge-write-dialogs.KnowledgeAddDocumentDialog (cognitive 50) hindsight-control-plane/src/components/knowledge-write-dialogs.tsx:83— knowledge-write-dialogs.KnowledgeAddDocumentDialog has cognitive complexity 50 (threshold 15). Drivers by points: boolean chains 15, ternaries 9 (12 pts), if/else 10, loops 5 (10 pts), error handling 2 (3 pts) (nesting depth added 9). Of this number, 19 points are the body's own statements and 31 belong to 14 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
recall.retrieve_semantic_bm25_combined_sql (cognitive 49) hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:29— recall.retrieve_semantic_bm25_combined_sql has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (30 pts), ternaries 8 (10 pts), boolean chains 4, loops 3 (4 pts), error handling 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._prune_round (cognitive 49) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:1928— agent._prune_round has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 6 (11 pts), boolean chains 6, ternaries 1 (3 pts), error handling 2 (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.
migrations.ensure_vector_extension (cognitive 48) REDACTED:842— migrations.ensure_vector_extension has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 6, loops 2, ternaries 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript-codex.readCodexTranscript (cognitive 48) hindsight-integrations/coding-agents/src/core/transcript-codex.ts:195— transcript-codex.readCodexTranscript has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 8, error handling 2 (5 pts), ternaries 1 (3 pts), loops 2 (nesting depth added 21). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
observation-tree-view.ObservationTreeView (cognitive 47) REDACTED:356— observation-tree-view.ObservationTreeView has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 13 (21 pts), boolean chains 14, if/else 7 (9 pts), loops 2 (3 pts) (nesting depth added 11). Of this number, 30 points are the body's own statements and 17 belong to 9 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bank_templates._apply_bank_template_resources (cognitive 46) hindsight-api-slim/hindsight_api/engine/bank_templates.py:709— bank_templates._apply_bank_template_resources has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 6 (24 pts), if/else 8 (18 pts), loops 2 (4 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.
documents.retag_document_memories (cognitive 46) hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:433— documents.retag_document_memories has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 7 (13 pts), boolean chains 3, 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.
XaiOAuthLLM.call (cognitive 46) hindsight-api-slim/hindsight_api/engine/providers/xai_oauth_llm.py:692— XaiOAuthLLM.call has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 5 (13 pts), error handling 2 (5 pts), boolean chains 4, loops 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.
hook.buildHookOutput (cognitive 46) hindsight-integrations/coding-agents/src/core/hook.ts:233— hook.buildHookOutput has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 6 (11 pts), boolean chains 10, error handling 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.
cli._run_repair_bank (cognitive 45) hindsight-api-slim/hindsight_api/admin/cli.py:737— cli._run_repair_bank has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 9 (19 pts), if/else 6 (17 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.update_page_node (cognitive 45) hindsight-api-slim/hindsight_api/engine/memory_engine.py:21222— MemoryEngine.update_page_node has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 9, loops 2 (5 pts), ternaries 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_engine._iter_raw_sub_batches (cognitive 45) hindsight-api-slim/hindsight_api/engine/memory_engine.py:1420— memory_engine._iter_raw_sub_batches has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 3 (8 pts), ternaries 2 (7 pts), boolean chains 6 (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.
memory_engine._assemble_graph_data (cognitive 45) hindsight-api-slim/hindsight_api/engine/memory_engine.py:2752— memory_engine._assemble_graph_data has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 14 (28 pts), if/else 4 (8 pts), loops 6 (7 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodexLLM._parse_sse_stream (cognitive 45) hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:922— CodexLLM._parse_sse_stream has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (31 pts), ternaries 1 (6 pts), boolean chains 4, error handling 1 (3 pts), loops 1 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
orchestrator._try_delta_retain (cognitive 45) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3983— orchestrator._try_delta_retain has cognitive complexity 45 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 8, ternaries 3 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CrossEncoderReranker._rerank (cognitive 45) hindsight-api-slim/hindsight_api/engine/search/reranking.py:409— CrossEncoderReranker._rerank has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 5 (9 pts), boolean chains 8, loops 2, error handling 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.
prompt-preview-dialog.PromptPreviewDialog (cognitive 45) hindsight-control-plane/src/components/prompt-preview-dialog.tsx:1030— prompt-preview-dialog.PromptPreviewDialog has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 12 (29 pts), if/else 6 (9 pts), boolean chains 7 (nesting depth added 20). Of this number, 23 points are the body's own statements and 22 belong to 9 function literals inside it that branch. 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.
mental-model-detail-modal.diffLines (cognitive 44) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:430— mental-model-detail-modal.diffLines has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 4 (14 pts), loops 6 (9 pts), boolean chains 6 (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.
MCPMiddleware.__call__ (cognitive 43) hindsight-api-slim/hindsight_api/api/mcp.py:421— MCPMiddleware.__call__ has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (24 pts), ternaries 7 (10 pts), boolean chains 5, error handling 3 (4 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MaintenanceLoop._run_scheduled_mm_refresh (cognitive 43) hindsight-api-slim/hindsight_api/engine/maintenance.py:643— MaintenanceLoop._run_scheduled_mm_refresh has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 6 (12 pts), boolean chains 5, error handling 3 (4 pts), loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.submit_async_retain (cognitive 43) hindsight-api-slim/hindsight_api/engine/memory_engine.py:23730— MemoryEngine.submit_async_retain has cognitive complexity 43 (threshold 15). Drivers by points: if/else 19 (31 pts), ternaries 4 (5 pts), boolean chains 3, error handling 2, loops 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.
tools.tool_expand (cognitive 43) hindsight-api-slim/hindsight_api/engine/reflect/tools.py:629— tools.tool_expand has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 7, loops 3 (4 pts), error handling 1 (2 pts), ternaries 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.
text_passages.split_into_passages (cognitive 43) hindsight-api-slim/hindsight_api/knowledge/text_passages.py:193— text_passages.split_into_passages has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 3 (11 pts), boolean chains 8, loops 2 (4 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.
frontmatter.normalizeNote (cognitive 43) hindsight-integrations/obsidian/src/frontmatter.ts:46— frontmatter.normalizeNote has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (34 pts), boolean chains 7, loops 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.
cli.do_ui (cognitive 42) hindsight-embed/hindsight_embed/cli.py:673— cli.do_ui has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 8, error handling 2 (6 pts), loops 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
consolidation.run_scenario (cognitive 42) hindsight-system-evals/hindsight_system_evals/consolidation.py:336— consolidation.run_scenario has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 6 (9 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript-codebuddy-ide.readCodebuddyIdeTranscript (cognitive 42) hindsight-integrations/coding-agents/src/core/transcript-codebuddy-ide.ts:111— transcript-codebuddy-ide.readCodebuddyIdeTranscript has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (26 pts), ternaries 3 (6 pts), loops 3 (5 pts), boolean chains 3, error handling 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.
MemoryEngine.initialize (cognitive 41) hindsight-api-slim/hindsight_api/engine/memory_engine.py:6346— MemoryEngine.initialize has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (33 pts), loops 1 (4 pts), boolean chains 2, error handling 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
export.stream_export_bank (cognitive 41) hindsight-api-slim/hindsight_api/engine/transfer/export.py:536— export.stream_export_bank has cognitive complexity 41 (threshold 15). Drivers by points: loops 15 (32 pts), if/else 5 (6 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 19). 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.
mcp_tools.register_mcp_tools (cognitive 41) hindsight-api-slim/hindsight_api/mcp_tools.py:651— mcp_tools.register_mcp_tools has cognitive complexity 41 (threshold 15). Drivers by points: if/else 40, ternaries 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.
transcript-kimi.readKimiWire (cognitive 41) hindsight-integrations/coding-agents/src/core/transcript-kimi.ts:162— transcript-kimi.readKimiWire has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 6, ternaries 1 (3 pts), loops 1 (nesting depth added 19). Of this number, 39 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
deepen.main (cognitive 41) hindsight-integrations/coding-agents/src/deepen.ts:114— deepen.main has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (27 pts), error handling 2 (4 pts), ternaries 2 (4 pts), boolean chains 3, 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.
HindsightConfig.validate (cognitive 40) hindsight-api-slim/hindsight_api/config.py:4692— HindsightConfig.validate has cognitive complexity 40 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 5, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fact_extraction._extract_map_entities (cognitive 40) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:55— fact_extraction._extract_map_entities has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 3 (7 pts), ternaries 2 (6 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
memory_defense.apply_redaction (cognitive 40) hindsight-api-slim/hindsight_api/extensions/memory_defense.py:262— memory_defense.apply_redaction has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 3 (6 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
content._extract_message_blocks (cognitive 40) hindsight-integrations/cursor/scripts/lib/content.py:121— content._extract_message_blocks has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 2 (5 pts), boolean chains 4, ternaries 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.
wrappers.recall (cognitive 40) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:105— wrappers.recall has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 12, ternaries 12, if/else 7 (10 pts), error handling 3 (4 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
tools.createHindsightTools (cognitive 40) hindsight-integrations/openclaw/src/tools.ts:106— tools.createHindsightTools has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 9 (10 pts), boolean chains 7, error handling 4 (nesting depth added 9). Of this number, 36 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.update_document (cognitive 39) hindsight-api-slim/hindsight_api/engine/memory_engine.py:11807— MemoryEngine.update_document has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 13, error handling 3 (6 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
hindsight_litellm._format_messages_for_storage (cognitive 39) hindsight-integrations/litellm/hindsight_litellm/__init__.py:830— hindsight_litellm._format_messages_for_storage has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 3 (7 pts), boolean chains 3, ternaries 1 (3 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.
App::enter_view (cognitive 39) hindsight-cli/src/commands/explore.rs:535— App::enter_view has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (33 pts), match/switch 2 (6 pts) (nesting depth added 25). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ControlPlaneClient.fetchApi (cognitive 39) hindsight-control-plane/src/lib/api.ts:521— ControlPlaneClient.fetchApi has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 8, error handling 3 (7 pts), ternaries 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.refresh_mental_model (cognitive 38) hindsight-api-slim/hindsight_api/engine/memory_engine.py:19412— MemoryEngine.refresh_mental_model has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 10, ternaries 3 (6 pts), error handling 1 (2 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.
importer._restore_bank (cognitive 38) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1232— importer._restore_bank has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 5 (10 pts), boolean chains 6, ternaries 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.
retain_capabilities.run_case (cognitive 38) hindsight-system-evals/hindsight_system_evals/retain_capabilities.py:161— retain_capabilities.run_case has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 9 (10 pts), boolean chains 5, ternaries 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.
chat.writeSession (cognitive 38) hindsight-integrations/coding-agents/src/core/chat.ts:316— chat.writeSession has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 12 (15 pts), if/else 11 (13 pts), boolean chains 9, loops 1 (nesting depth added 5). Of this number, 31 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
zstd-frames.scanZstdFrames (cognitive 38) hindsight-integrations/coding-agents/src/core/zstd-frames.ts:20— zstd-frames.scanZstdFrames has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (25 pts), ternaries 4 (10 pts), loops 2 (3 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.
installer.run (cognitive 38) hindsight-integrations/coding-agents/src/installer.ts:2421— installer.run has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 4 (7 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 11). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bank_templates.apply_bank_template_manifest (cognitive 37) hindsight-api-slim/hindsight_api/engine/bank_templates.py:484— bank_templates.apply_bank_template_manifest has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 11, ternaries 5 (7 pts), loops 4, error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
consolidator._consolidate_batch_with_llm (cognitive 37) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:3949— consolidator._consolidate_batch_with_llm has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 2 (3 pts), ternaries 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OracleConnection._read_returning_values (cognitive 37) hindsight-api-slim/hindsight_api/engine/db/oracle.py:1076— OracleConnection._read_returning_values has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (19 pts), error handling 3 (9 pts), boolean chains 5, ternaries 2 (3 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.
MemoryEngine._submit_async_operation (cognitive 37) hindsight-api-slim/hindsight_api/engine/memory_engine.py:23378— MemoryEngine._submit_async_operation has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (22 pts), ternaries 4 (8 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
prompts.build_system_prompt_for_tools (cognitive 37) hindsight-api-slim/hindsight_api/engine/reflect/prompts.py:203— prompts.build_system_prompt_for_tools has cognitive complexity 37 (threshold 15). Drivers by points: if/else 25 (27 pts), ternaries 5 (8 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
structured_doc.document_from_sections (cognitive 37) hindsight-api-slim/hindsight_api/engine/reflect/structured_doc.py:385— structured_doc.document_from_sections has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 7, loops 4 (6 pts), error handling 1 (2 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.
orchestrator._delta_store_owned_write (cognitive 37) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1239— orchestrator._delta_store_owned_write has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 4 (7 pts), boolean chains 6, error handling 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
importer._import_document_batch (cognitive 37) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1603— importer._import_document_batch has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 6 (9 pts), boolean chains 5, ternaries 2 (4 pts), error handling 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.
mock-bank.buildMockBank (cognitive 37) hindsight-docs/src/components/constellation/mock-bank.ts:335— mock-bank.buildMockBank has cognitive complexity 37 (threshold 15). Drivers by points: loops 13 (18 pts), if/else 6 (16 pts), boolean chains 3 (nesting depth added 15). Of this number, 27 points are the body's own statements and 10 belong to 2 function literals inside it that branch. 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.
HindsightClient.seedPages (cognitive 37) hindsight-integrations/coding-agents/src/core/hindsight.ts:1040— HindsightClient.seedPages has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 3, loops 2, 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.
backfill.runCli (cognitive 37) hindsight-integrations/openclaw/src/backfill.ts:436— backfill.runCli has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 4 (7 pts), loops 4 (6 pts), boolean chains 5, error handling 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.
openai_compatible_llm._rate_limit_retry_at (cognitive 36) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:803— openai_compatible_llm._rate_limit_retry_at has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fact_extraction._build_labels_prompt_section (cognitive 36) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:1419— fact_extraction._build_labels_prompt_section has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 3 (10 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bank-profile-view.BankProfileView (cognitive 36) hindsight-control-plane/src/components/bank-profile-view.tsx:130— bank-profile-view.BankProfileView has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 14, if/else 10, error handling 5 (6 pts), ternaries 5 (6 pts) (nesting depth added 2). Of this number, 16 points are the body's own statements and 20 belong to 9 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
llm-requests-view.LLMRequestChart (cognitive 36) hindsight-control-plane/src/components/llm-requests-view.tsx:655— llm-requests-view.LLMRequestChart has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 14 (19 pts), boolean chains 11, if/else 4, error handling 1, loops 1 (nesting depth added 5). Most of this is not in the body itself: 9 of the 36 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 676, a function literal at line 734, renderChart, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
config.resolveConfig (cognitive 36) hindsight-integrations/coding-agents/src/core/config.ts:589— config.resolveConfig has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 23, ternaries 13. Of this number, 34 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MemoryEngine.delete_memory_units (cognitive 35) hindsight-api-slim/hindsight_api/engine/memory_engine.py:12190— MemoryEngine.delete_memory_units has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 4 (8 pts), loops 6, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sync_cookbook.update_cookbook_index (cognitive 35) hindsight-dev/hindsight_dev/sync_cookbook.py:460— sync_cookbook.update_cookbook_index has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 4 (8 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.
cli.main (cognitive 35) hindsight-embed/hindsight_embed/cli.py:1425— cli.main has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (32 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
knowledge-search-panel.KnowledgeSearchPanel (cognitive 35) hindsight-control-plane/src/components/knowledge-search-panel.tsx:64— knowledge-search-panel.KnowledgeSearchPanel has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 12, ternaries 11 (12 pts), if/else 10, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to 12 function items inside it that branch (search, setMediaFile, a function literal at line 87, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
index.prepareRetentionTranscript (cognitive 35) REDACTED:3658— index.prepareRetentionTranscript has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 6, loops 2 (3 pts), ternaries 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.
MemoryEngine.update_bank (cognitive 34) hindsight-api-slim/hindsight_api/engine/memory_engine.py:22967— MemoryEngine.update_bank has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 6, error handling 1 (2 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.
CodexAuthManager.refresh_tokens (cognitive 34) hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:356— CodexAuthManager.refresh_tokens has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 6, error handling 3 (4 pts), loops 1, ternaries 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.
WorkerPoller._execute_task_inner (cognitive 34) hindsight-api-slim/hindsight_api/worker/poller.py:1309— WorkerPoller._execute_task_inner has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 5 (6 pts), boolean chains 5, ternaries 3 (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.
setup.run_setup (cognitive 34) hindsight-integrations/hermes/setup.py:111— setup.run_setup has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 5 (9 pts), boolean chains 6, 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.
bank_templates.validate_bank_template (cognitive 33) hindsight-api-slim/hindsight_api/engine/bank_templates.py:432— bank_templates.validate_bank_template has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.delete_memory_unit (cognitive 33) hindsight-api-slim/hindsight_api/engine/memory_engine.py:12027— MemoryEngine.delete_memory_unit has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 4 (8 pts), boolean chains 6, ternaries 4 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PostgresKnowledgeStore.search (cognitive 33) hindsight-api-slim/hindsight_api/knowledge/store.py:858— PostgresKnowledgeStore.search has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (18 pts), loops 4 (7 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
retain.run_retain (cognitive 33) hindsight-integrations/omo/scripts/retain.py:54— retain.run_retain has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 5, loops 2 (3 pts), error handling 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installer.configureServer (cognitive 33) hindsight-integrations/coding-agents/src/installer.ts:1033— installer.configureServer has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
observation_tree._split_misc (cognitive 32) hindsight-api-slim/hindsight_api/engine/observation_tree.py:488— observation_tree._split_misc has cognitive complexity 32 (threshold 15). Drivers by points: loops 5 (14 pts), ternaries 2 (9 pts), if/else 3 (7 pts), boolean chains 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
temporal_periods._extract_non_chinese_period (cognitive 32) hindsight-api-slim/hindsight_api/engine/temporal_periods.py:70— temporal_periods._extract_non_chinese_period has cognitive complexity 32 (threshold 15). Drivers by points: if/else 25 (31 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
main.main (cognitive 32) hindsight-api-slim/hindsight_api/main.py:278— main.main has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18, boolean chains 5, ternaries 3 (5 pts), error handling 2 (4 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli._do_configure_interactive (cognitive 32) hindsight-embed/hindsight_embed/cli.py:342— cli._do_configure_interactive has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (25 pts), ternaries 3 (5 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.
home-view.HomeView (cognitive 32) hindsight-control-plane/src/components/home-view.tsx:51— home-view.HomeView has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 13, if/else 10, ternaries 6 (8 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 9 of the 32 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 89, 160, 136, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
transcript-qwen.collectQwenTurns (cognitive 32) hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:197— transcript-qwen.collectQwenTurns has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 5, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.extractStructuredBlocks (cognitive 32) REDACTED:3826— index.extractStructuredBlocks has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 4 (11 pts), boolean chains 4, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
consolidator.preview_consolidation_strategies (cognitive 31) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:4250— consolidator.preview_consolidation_strategies has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 6 (10 pts), ternaries 3 (6 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.
importer._restore_rows (cognitive 31) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:646— importer._restore_rows has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 5, loops 2 (3 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.
cli_coverage_check.main (cognitive 31) hindsight-dev/hindsight_dev/cli_coverage_check.py:178— cli_coverage_check.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 9 (14 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.
content._extract_text_content (cognitive 31) hindsight-integrations/cursor/scripts/lib/content.py:325— content._extract_text_content has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
schema-builder-dialog.SchemaBuilderDialog (cognitive 31) hindsight-control-plane/src/components/schema-builder-dialog.tsx:177— schema-builder-dialog.SchemaBuilderDialog has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 6, ternaries 5 (6 pts), error handling 3 (nesting depth added 3). Most of this is not in the body itself: 4 of the 31 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 196, switchTo, handleApply, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
knowledge-document-dialog.KnowledgeDocumentDialog (cognitive 31) hindsight-control-plane/src/components/knowledge-document-dialog.tsx:295— knowledge-document-dialog.KnowledgeDocumentDialog has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 7 (14 pts), boolean chains 10, if/else 4 (5 pts), error handling 2 (nesting depth added 8). Of this number, 22 points are the body's own statements and 9 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteTEICrossEncoder._async_request_with_retry (cognitive 30) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:590— RemoteTEICrossEncoder._async_request_with_retry has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (19 pts), error handling 4 (8 pts), boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cross_encoder._create_cross_encoder_backend (cognitive 30) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2863— cross_encoder._create_cross_encoder_backend has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.search_pages (cognitive 30) hindsight-api-slim/hindsight_api/engine/memory_engine.py:20951— MemoryEngine.search_pages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 7 (9 pts), boolean chains 8 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GitHubCopilotLLM.call (cognitive 30) hindsight-api-slim/hindsight_api/engine/providers/github_copilot_llm.py:540— GitHubCopilotLLM.call has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 2 (5 pts), error handling 2 (4 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.
transcript-workbuddy.readWorkbuddyTranscript (cognitive 30) hindsight-integrations/coding-agents/src/core/transcript-workbuddy.ts:121— transcript-workbuddy.readWorkbuddyTranscript has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.flushRetainQueue (cognitive 30) REDACTED:418— index.flushRetainQueue has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 6, ternaries 3 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tools_via_schema.as_text_messages (cognitive 29) hindsight-api-slim/hindsight_api/engine/providers/tools_via_schema.py:269— tools_via_schema.as_text_messages has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, error handling 1 (5 pts), loops 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.
source_facts.select_source_facts_within_budget (cognitive 29) hindsight-api-slim/hindsight_api/engine/source_facts.py:31— source_facts.select_source_facts_within_budget has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 4 (8 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.
llm-requests-view.LLMRequestsView (cognitive 29) hindsight-control-plane/src/components/llm-requests-view.tsx:1012— llm-requests-view.LLMRequestsView has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 12, ternaries 8 (10 pts), if/else 4 (6 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 1033, a function literal at line 1250, handleStatusFilterChange, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
transcript-cursor.readCursorTranscript (cognitive 29) hindsight-integrations/coding-agents/src/core/transcript-cursor.ts:37— transcript-cursor.readCursorTranscript has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 6, loops 2 (5 pts), error handling 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.
index.getIdentitySkipReason (cognitive 29) REDACTED:1531— index.getIdentitySkipReason has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 11, ternaries 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.
embeddings._create_embeddings (cognitive 28) hindsight-api-slim/hindsight_api/engine/embeddings.py:2583— embeddings._create_embeddings has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent._execute_tool (cognitive 28) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2563— agent._execute_tool has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
importer._iter_json_array (cognitive 28) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:235— importer._iter_json_array has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 7, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WorkerPoller._claim_batch_on_conn (cognitive 28) hindsight-api-slim/hindsight_api/worker/poller.py:671— WorkerPoller._claim_batch_on_conn has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StaticKeysTenantExtension.__init__ (cognitive 28) hindsight-extensions/static-keys-tenant/hindsight_ext_static_keys_tenant/extension.py:123— StaticKeysTenantExtension.__init__ has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 3, ternaries 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hooks._extract_result_from_transcript (cognitive 28) hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/hooks.py:44— hooks._extract_result_from_transcript has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 3, error handling 2 (3 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.
consolidation._check_twins (cognitive 28) hindsight-system-evals/hindsight_system_evals/consolidation.py:296— consolidation._check_twins has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (23 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
llm-requests-view.TraceDialog (cognitive 28) hindsight-control-plane/src/components/llm-requests-view.tsx:493— llm-requests-view.TraceDialog has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, ternaries 7 (8 pts), if/else 5 (6 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 512, 509, 523, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
mental-model-detail-modal.ConfigurationTab (cognitive 28) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:1348— mental-model-detail-modal.ConfigurationTab has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 17 (19 pts), boolean chains 9 (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.
prompt-preview-dialog.ExtractionPanel (cognitive 28) hindsight-control-plane/src/components/prompt-preview-dialog.tsx:809— prompt-preview-dialog.ExtractionPanel has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 13 (23 pts), boolean chains 5 (nesting depth added 10). Of this number, 25 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript-grok.readGrokTranscript (cognitive 28) hindsight-integrations/coding-agents/src/core/transcript-grok.ts:39— transcript-grok.readGrokTranscript has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 2 (6 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config_resolver._validate_recall_budget_updates (cognitive 27) hindsight-api-slim/hindsight_api/config_resolver.py:967— config_resolver._validate_recall_budget_updates has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 5, loops 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graph._relink_batch (cognitive 27) hindsight-api-slim/hindsight_api/engine/memories/pg/graph.py:732— graph._relink_batch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 2 (4 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.get_observation_history (cognitive 27) hindsight-api-slim/hindsight_api/engine/memory_engine.py:14223— MemoryEngine.get_observation_history has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 6 (9 pts), error handling 2 (4 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CursorLLM.call (cognitive 27) hindsight-api-slim/hindsight_api/engine/providers/cursor_llm.py:378— CursorLLM.call has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 4 (9 pts), ternaries 2 (5 pts), boolean chains 1, 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.
fact_extraction.extract_facts_from_contents (cognitive 27) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:3584— fact_extraction.extract_facts_from_contents has cognitive complexity 27 (threshold 15). Drivers by points: loops 6 (10 pts), ternaries 2 (8 pts), if/else 5 (6 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fusion.reciprocal_rank_fusion (cognitive 27) hindsight-api-slim/hindsight_api/engine/search/fusion.py:29— fusion.reciprocal_rank_fusion has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (15 pts), ternaries 2 (6 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wrappers.reflect (cognitive 27) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:301— wrappers.reflect has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 7, error handling 3 (4 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.
hook.runHook (cognitive 27) hindsight-integrations/coding-agents/src/core/hook.ts:425— hook.runHook has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 9, 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.
retain.read_transcript (cognitive 26) hindsight-integrations/cursor/scripts/retain.py:98— retain.read_transcript has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 4, error handling 2 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightMemoryProvider._apply_connection_settings (cognitive 26) REDACTED:1457— HindsightMemoryProvider._apply_connection_settings has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, ternaries 5 (6 pts), if/else 5, error handling 2 (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.
hindsight_litellm._format_conversation_for_storage (cognitive 26) hindsight-integrations/litellm/hindsight_litellm/__init__.py:997— hindsight_litellm._format_conversation_for_storage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 4, loops 1 (4 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
config.set_defaults (cognitive 26) hindsight-integrations/litellm/hindsight_litellm/config.py:389— config.set_defaults has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 20, if/else 4, boolean chains 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
knowledge-bank-config-view.KnowledgeBankConfigView (cognitive 26) hindsight-control-plane/src/components/knowledge-bank-config-view.tsx:93— knowledge-bank-config-view.KnowledgeBankConfigView has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 7, if/else 3, error handling 1 (nesting depth added 3). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 15 function items inside it that branch (bandsRow, save, a function literal at line 280, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
history.dshHistory (cognitive 26) hindsight-integrations/coding-agents/src/core/history.ts:332— history.dshHistory has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 3 (8 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 14). Of this number, 23 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightConfig.decision_model_config (cognitive 25) hindsight-api-slim/hindsight_api/config.py:6333— HindsightConfig.decision_model_config has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 11, error handling 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.
consolidator._build_observations_for_llm (cognitive 25) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:3809— consolidator._build_observations_for_llm has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
entity_resolver._find_intrabatch_similar_pairs (cognitive 25) hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:219— entity_resolver._find_intrabatch_similar_pairs has cognitive complexity 25 (threshold 15). Drivers by points: loops 7 (11 pts), if/else 4 (9 pts), ternaries 1 (4 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.
links._prepare_entities_for_resolution (cognitive 25) hindsight-api-slim/hindsight_api/engine/memories/pg/links.py:239— links._prepare_entities_for_resolution has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 5 (7 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
writes.insert_facts (cognitive 25) hindsight-api-slim/hindsight_api/engine/memories/pg/writes.py:32— writes.insert_facts has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (7 pts), error handling 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine._handle_webhook_delivery (cognitive 25) hindsight-api-slim/hindsight_api/engine/memory_engine.py:5622— MemoryEngine._handle_webhook_delivery has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 5 (8 pts), boolean chains 2, 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.
tools.tool_search_mental_models (cognitive 25) hindsight-api-slim/hindsight_api/engine/reflect/tools.py:130— tools.tool_search_mental_models has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 7 (9 pts), boolean chains 5, 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.
vector_index_health.plan_bank_vector_indexes (cognitive 25) hindsight-api-slim/hindsight_api/engine/vector_index_health.py:225— vector_index_health.plan_bank_vector_indexes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
embedders.create_knowledge_embedder (cognitive 25) hindsight-api-slim/hindsight_api/knowledge/embedders.py:753— embedders.create_knowledge_embedder has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 10 (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.
WorkerPoller._poll_loop (cognitive 25) hindsight-api-slim/hindsight_api/worker/poller.py:1994— WorkerPoller._poll_loop has cognitive complexity 25 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 3 (8 pts), error handling 2 (4 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.
WorkerPoller._log_progress_if_due (cognitive 25) hindsight-api-slim/hindsight_api/worker/poller.py:2146— WorkerPoller._log_progress_if_due has cognitive complexity 25 (threshold 15). Drivers by points: loops 6 (8 pts), if/else 5 (6 pts), error handling 3 (5 pts), ternaries 4, boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client_coverage_check.check_client (cognitive 25) hindsight-dev/hindsight_dev/client_coverage_check.py:141— client_coverage_check.check_client has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 6 (10 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.
llm.detect_llm_config (cognitive 25) hindsight-integrations/cursor/scripts/lib/llm.py:42— llm.detect_llm_config has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, ternaries 1 (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.
metric.transcript_credits (cognitive 25) hindsight-system-evals/hindsight_system_evals/coding_agents/metric.py:96— metric.transcript_credits has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 6, loops 2 (3 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.
consolidation._check_snapshot (cognitive 25) hindsight-system-evals/hindsight_system_evals/consolidation.py:218— consolidation._check_snapshot has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, 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.
demo.main (cognitive 25) hindsight-integrations/omo/demo.py:143— demo.main has cognitive complexity 25 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 11 (nesting depth added 7). 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.
bank.derive_bank_id (cognitive 25) hindsight-integrations/omo/scripts/lib/bank.py:66— bank.derive_bank_id has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 7, ternaries 3 (7 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.
document-chunk-modal.DocumentChunkModal (cognitive 25) hindsight-control-plane/src/components/document-chunk-modal.tsx:23— document-chunk-modal.DocumentChunkModal has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 7, if/else 4 (5 pts), error handling 1 (nesting depth added 7). Of this number, 18 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
data-view.TimelineView (cognitive 25) hindsight-control-plane/src/components/data-view.tsx:1227— data-view.TimelineView has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 6, match/switch 2 (nesting depth added 1). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 1540, a function literal at line 1309, a function literal at line 1248, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
document-history.DocumentHistory (cognitive 25) hindsight-control-plane/src/components/document-history.tsx:56— document-history.DocumentHistory has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 9, if/else 5, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (chip, a function literal at line 199, a function literal at line 119, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
page-search-dialog.PageSearchDialog (cognitive 25) hindsight-control-plane/src/components/page-search-dialog.tsx:56— page-search-dialog.PageSearchDialog has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (11 pts), boolean chains 8, if/else 5, error handling 1 (nesting depth added 6). Of this number, 14 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
knowledge-banks-list.KnowledgeBanksList (cognitive 25) hindsight-control-plane/src/components/knowledge-banks-list.tsx:262— knowledge-banks-list.KnowledgeBanksList has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (21 pts), boolean chains 2, error handling 1, if/else 1 (nesting depth added 13). Of this number, 18 points are the body's own statements and 7 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
check-code-parity.checkFile (cognitive 25) hindsight-docs/scripts/check-code-parity.mjs:51— check-code-parity.checkFile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
transcript.readClaudeTranscript (cognitive 25) hindsight-integrations/coding-agents/src/core/transcript.ts:80— transcript.readClaudeTranscript has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 2 (3 pts), error handling 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.
transcript-dsh.readDshEvents (cognitive 25) hindsight-integrations/coding-agents/src/core/transcript-dsh.ts:73— transcript-dsh.readDshEvents has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript-pi.renderMessage (cognitive 25) hindsight-integrations/coding-agents/src/core/transcript-pi.ts:44— transcript-pi.renderMessage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reflect-util.groundedNotes (cognitive 25) hindsight-integrations/obsidian/src/reflect-util.ts:83— reflect-util.groundedNotes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (6 pts), ternaries 2 (5 pts), boolean chains 3 (nesting depth added 9). Most of this is not in the body itself: 12 of the 25 points are its own statements and the rest belongs to one function item inside it that branches (indexTrace). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
reembed.reembed_schema (cognitive 24) hindsight-api-slim/hindsight_api/admin/reembed.py:422— reembed.reembed_schema has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 5 (8 pts), boolean chains 4 (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.
HindsightConfig.log_config (cognitive 24) hindsight-api-slim/hindsight_api/config.py:6426— HindsightConfig.log_config has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 11, 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.
OracleConnection.fetchval (cognitive 24) hindsight-api-slim/hindsight_api/engine/db/oracle.py:1350— OracleConnection.fetchval has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (7 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LLMProvider._call (cognitive 24) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1381— LLMProvider._call has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 15 (19 pts), if/else 3 (4 pts), error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
LLMProvider.call_with_tools (cognitive 24) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1569— LLMProvider.call_with_tools has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (9 pts), error handling 2 (6 pts), ternaries 3 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
documents.list_documents (cognitive 24) hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:625— documents.list_documents has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 6 (7 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.
MemoryEngine._handle_refresh_mental_model (cognitive 24) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4999— MemoryEngine._handle_refresh_mental_model has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (6 pts), boolean chains 5, error handling 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.
entity_labels.build_labels_model (cognitive 24) hindsight-api-slim/hindsight_api/engine/retain/entity_labels.py:193— entity_labels.build_labels_model has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tag_resolution._resolve_leaf (cognitive 24) hindsight-api-slim/hindsight_api/engine/search/tag_resolution.py:120— tag_resolution._resolve_leaf has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 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.
tags.filter_results_by_tags (cognitive 24) hindsight-api-slim/hindsight_api/engine/search/tags.py:242— tags.filter_results_by_tags has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routes.trace_response (cognitive 24) hindsight-api-slim/hindsight_api/knowledge/routes.py:393— routes.trace_response has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (21 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon._ensure_daemon_running (cognitive 24) hindsight-integrations/cursor/scripts/lib/daemon.py:127— daemon._ensure_daemon_running has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 4, loops 2, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightMemoryProvider._wait_for_server_retain_ops (cognitive 24) REDACTED:1220— HindsightMemoryProvider._wait_for_server_retain_ops has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (3 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.
hindsight_litellm._store_conversation (cognitive 24) hindsight-integrations/litellm/hindsight_litellm/__init__.py:1194— hindsight_litellm._store_conversation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 4 (5 pts), boolean chains 2, 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.
session.run_session (cognitive 24) hindsight-system-evals/hindsight_system_evals/coding_agents/session.py:43— session.run_session has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (4 pts), boolean chains 3, error handling 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.
ScriptedDecisionModel.answer (cognitive 24) hindsight-system-evals/hindsight_system_evals/orchestration.py:48— ScriptedDecisionModel.answer has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audit-logs-view.AuditLogsView (cognitive 24) hindsight-control-plane/src/components/audit-logs-view.tsx:289— audit-logs-view.AuditLogsView has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, ternaries 6 (7 pts), if/else 4, error handling 2 (nesting depth added 1). Of this number, 12 points are the body's own statements and 12 belong to 6 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mental-model-trigger-fields.triggerFormFromTrigger (cognitive 24) hindsight-control-plane/src/components/mental-model-trigger-fields.tsx:52— mental-model-trigger-fields.triggerFormFromTrigger has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12 (15 pts), boolean chains 9 (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.
MaintenanceLoop._run_reconcile (cognitive 23) hindsight-api-slim/hindsight_api/engine/maintenance.py:534— MaintenanceLoop._run_reconcile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, error handling 3 (4 pts), ternaries 2 (4 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.
MemoriesExtension.retag_document_memories (cognitive 23) hindsight-api-slim/hindsight_api/engine/memories/base.py:3277— MemoriesExtension.retag_document_memories has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
curation.get_memory_unit (cognitive 23) hindsight-api-slim/hindsight_api/engine/memories/pg/curation.py:319— curation.get_memory_unit has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 16 (18 pts), if/else 4, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
reads.any_memory_updated_since_batch (cognitive 23) hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:741— reads.any_memory_updated_since_batch has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 5 (7 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine._row_to_mental_model (cognitive 23) hindsight-api-slim/hindsight_api/engine/memory_engine.py:21785— MemoryEngine._row_to_mental_model has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 3 (8 pts), ternaries 5, boolean chains 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
OpenAIResponsesLLM._run_with_retries (cognitive 23) hindsight-api-slim/hindsight_api/engine/providers/openai_responses_llm.py:355— OpenAIResponsesLLM._run_with_retries has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 3 (6 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
entity_labels._build_map_fields_model (cognitive 23) hindsight-api-slim/hindsight_api/engine/retain/entity_labels.py:124— entity_labels._build_map_fields_model has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
orchestrator._build_retain_params (cognitive 23) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:663— orchestrator._build_retain_params has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, ternaries 1 (4 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.
fusion.interleave_fusion (cognitive 23) hindsight-api-slim/hindsight_api/engine/search/fusion.py:112— fusion.interleave_fusion has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 4 (6 pts), boolean chains 2, 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.
ModelCallRecorder.record_llm_call (cognitive 23) hindsight-api-slim/hindsight_api/extensions/model_call.py:152— ModelCallRecorder.record_llm_call has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, ternaries 10 (11 pts), if/else 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.
HindsightMemoryProvider._recall (cognitive 23) REDACTED:1685— HindsightMemoryProvider._recall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightOpenAI._recall_memories (cognitive 23) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:951— HindsightOpenAI._recall_memories has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 2 (3 pts), boolean chains 2, error handling 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. This shape REPEATS in the file: one other method here (HindsightAnthropic._recall_memories) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
HindsightAnthropic._recall_memories (cognitive 23) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1381— HindsightAnthropic._recall_memories has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 2 (3 pts), boolean chains 2, error handling 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. This shape REPEATS in the file: one other method here (HindsightOpenAI._recall_memories) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
format.formatMemoriesAsSystemPrompt (cognitive 23) hindsight-integrations/chat/src/format.ts:12— format.formatMemoriesAsSystemPrompt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (7 pts), loops 3 (7 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
git-layout.probeOnce (cognitive 23) hindsight-integrations/coding-agents/src/core/git-layout.ts:131— git-layout.probeOnce has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 2 (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.
usage.readUsage (cognitive 23) hindsight-integrations/coding-agents/src/core/usage.ts:199— usage.readUsage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (6 pts), error handling 2 (5 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.
index.findInboundMetaBlocks (cognitive 23) REDACTED:958— index.findInboundMetaBlocks has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (8 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
consolidator._parse_consolidation_strategies (cognitive 22) hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:1361— consolidator._parse_consolidation_strategies has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, 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.
TypeSafeCrossEncoder._rank (cognitive 22) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1422— TypeSafeCrossEncoder._rank has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteTEIEmbeddings._request_with_retry (cognitive 22) hindsight-api-slim/hindsight_api/engine/embeddings.py:869— RemoteTEIEmbeddings._request_with_retry has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LLMTraceRecorder.record_llm_call (cognitive 22) hindsight-api-slim/hindsight_api/engine/llm_trace.py:775— LLMTraceRecorder.record_llm_call has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10, boolean chains 6, if/else 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LLMProvider.__init__ (cognitive 22) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:921— LLMProvider.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 2 (3 pts), boolean chains 2, error handling 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.
llm_wrapper.sanitize_value (cognitive 22) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:270— llm_wrapper.sanitize_value has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (8 pts), loops 2 (4 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.
MemoryEngine._check_retain_writes (cognitive 22) hindsight-api-slim/hindsight_api/engine/memory_engine.py:3859— MemoryEngine._check_retain_writes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, 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.
observation_tree._name_children (cognitive 22) hindsight-api-slim/hindsight_api/engine/observation_tree.py:306— observation_tree._name_children has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, 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.
llm_debug._message_preview (cognitive 22) hindsight-api-slim/hindsight_api/engine/providers/llm_debug.py:99— llm_debug._message_preview has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 2 (4 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.
OpenAICompatibleLLM.__init__ (cognitive 22) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:901— OpenAICompatibleLLM.__init__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (13 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, 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.
xai_oauth_auth.poll_device_token (cognitive 22) REDACTED:508— xai_oauth_auth.poll_device_token has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 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.
ToolResultPresenter.present (cognitive 22) hindsight-api-slim/hindsight_api/engine/reflect/presentation.py:143— ToolResultPresenter.present has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
llm_request.bind_llm_request (cognitive 22) hindsight-api-slim/hindsight_api/extensions/llm_request.py:205— llm_request.bind_llm_request has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9, ternaries 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.do_control (cognitive 22) hindsight-embed/hindsight_embed/cli.py:931— cli.do_control has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 1 (3 pts), loops 1 (2 pts), ternaries 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.
config.load_config (cognitive 22) hindsight-integrations/aider/hindsight_aider/config.py:102— config.load_config has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), error handling 1 (2 pts), ternaries 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_litellm._store_conversation_from_text (cognitive 22) hindsight-integrations/litellm/hindsight_litellm/__init__.py:1137— hindsight_litellm._store_conversation_from_text has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 5 (7 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
metric.read_usage_stats (cognitive 22) hindsight-system-evals/hindsight_system_evals/coding_agents/metric.py:138— metric.read_usage_stats has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
route.GET (cognitive 22) hindsight-control-plane/src/app/api/documents/transfer/route.ts:17— route.GET has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, loops 2, error handling 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.
route.forward (cognitive 22) REDACTED:85— route.forward has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, 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.
bank-config-view.BankAliasRows (cognitive 22) hindsight-control-plane/src/components/bank-config-view.tsx:2047— bank-config-view.BankAliasRows has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 7, error handling 3, ternaries 2 (3 pts) (nesting depth added 1). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 8 function items inside it that branch (add, promote, remove, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
mental-model-detail-modal.BasedOnDiff (cognitive 22) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:578— mental-model-detail-modal.BasedOnDiff has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, ternaries 6 (9 pts), if/else 2 (3 pts), loops 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 5 function items inside it that branch (renderFact, a function literal at line 590, a function literal at line 666, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
HindsightClient.drain (cognitive 22) hindsight-integrations/coding-agents/src/core/hindsight.ts:775— HindsightClient.drain has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 10). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 791). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
transcript-zcode.readZcodeTranscript (cognitive 22) hindsight-integrations/coding-agents/src/core/transcript-zcode.ts:47— transcript-zcode.readZcodeTranscript has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (6 pts), boolean chains 3, error handling 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.
install-ui.createInstallerUi.select (cognitive 22) REDACTED:209— install-ui.createInstallerUi.select has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3 (4 pts), loops 2 (3 pts), ternaries 3, boolean chains 1 (nesting depth added 7). Of this number, 17 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installer.stripUnmarkedGrokEntries (cognitive 22) hindsight-integrations/coding-agents/src/installer.ts:1352— installer.stripUnmarkedGrokEntries has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 6). Of this number, 19 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
setup.runSetup (cognitive 22) hindsight-integrations/nemoclaw/src/setup.ts:31— setup.runSetup has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
index.resolveAndCacheIdentity (cognitive 22) REDACTED:1432— index.resolveAndCacheIdentity has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), ternaries 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
db_utils.acquire_with_retry (cognitive 21) hindsight-api-slim/hindsight_api/engine/db_utils.py:125— db_utils.acquire_with_retry has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 1 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OnnxEmbeddings.initialize (cognitive 21) hindsight-api-slim/hindsight_api/engine/embeddings.py:598— OnnxEmbeddings.initialize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 4 (5 pts), boolean chains 2, ternaries 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.
MultiLLMProvider._dispatch (cognitive 21) hindsight-api-slim/hindsight_api/engine/multi_llm.py:196— MultiLLMProvider._dispatch has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 4 (8 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bank_utils.list_banks (cognitive 21) hindsight-api-slim/hindsight_api/engine/retain/bank_utils.py:582— bank_utils.list_banks has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (6 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.
fact_extraction._iter_image_aware_chunks (cognitive 21) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:695— fact_extraction._iter_image_aware_chunks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (3 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.
fact_extraction._build_extraction_prompt_and_schema (cognitive 21) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:1597— fact_extraction._build_extraction_prompt_and_schema has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 3 (7 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
importer._replay_documents (cognitive 21) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:445— importer._replay_documents has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 4 (8 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.
MetricsCollector._refresh_backlog (cognitive 21) hindsight-api-slim/hindsight_api/metrics.py:1280— MetricsCollector._refresh_backlog has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (7 pts), error handling 3 (6 pts), ternaries 3 (6 pts), boolean chains 1, if/else 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.
hindsight_client._recall_response_to_prompt_string (cognitive 21) hindsight-clients/python/hindsight_client/__init__.py:95— hindsight_client._recall_response_to_prompt_string has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli_coverage_check.load_operations (cognitive 21) hindsight-dev/hindsight_dev/cli_coverage_check.py:65— cli_coverage_check.load_operations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client_coverage_check.load_openapi_operations (cognitive 21) hindsight-dev/hindsight_dev/client_coverage_check.py:67— client_coverage_check.load_openapi_operations has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
settings._discover_cwd_bank_id (cognitive 21) hindsight-integrations/hermes/settings.py:257— settings._discover_cwd_bank_id has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (4 pts), boolean chains 3, 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.
bank-config-view.ConsolidationStrategiesPanel (cognitive 21) hindsight-control-plane/src/components/bank-config-view.tsx:2687— bank-config-view.ConsolidationStrategiesPanel has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, ternaries 7, if/else 5. Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 2809, a function literal at line 2711, a function literal at line 2717, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
middleware.middleware (cognitive 21) hindsight-control-plane/src/middleware.ts:26— middleware.middleware has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
missions.codingBankManifest (cognitive 21) hindsight-integrations/coding-agents/src/core/missions.ts:715— missions.codingBankManifest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (5 pts), boolean chains 4, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
transcript-antigravity.readAntigravityTranscript (cognitive 21) hindsight-integrations/coding-agents/src/core/transcript-antigravity.ts:16— transcript-antigravity.readAntigravityTranscript has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (12 pts), boolean chains 3, if/else 2 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript-dcode.readDcodeTranscript (cognitive 21) hindsight-integrations/coding-agents/src/core/transcript-dcode.ts:166— transcript-dcode.readDcodeTranscript has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
history.dcodeHistory (cognitive 21) hindsight-integrations/coding-agents/src/core/history.ts:271— history.dcodeHistory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (3 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OracleOps._claim_consolidation_tasks (cognitive 20) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1322— OracleOps._claim_consolidation_tasks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PostgreSQLOps._claim_consolidation_tasks (cognitive 20) hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1645— PostgreSQLOps._claim_consolidation_tasks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LLMProvider._call_with_tools (cognitive 20) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1690— LLMProvider._call_with_tools has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 11 (15 pts), if/else 3 (4 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.
base.build_fact_records (cognitive 20) hindsight-api-slim/hindsight_api/engine/memories/base.py:674— base.build_fact_records has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 7, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MemoryEngine.attachments_for_memories (cognitive 20) hindsight-api-slim/hindsight_api/engine/memory_engine.py:8881— MemoryEngine.attachments_for_memories has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, 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.
observation_tree.build_observation_tree (cognitive 20) hindsight-api-slim/hindsight_api/engine/observation_tree.py:527— observation_tree.build_observation_tree has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, 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.
delta_ops.parse_delta_operation_list (cognitive 20) hindsight-api-slim/hindsight_api/engine/reflect/delta_ops.py:364— delta_ops.parse_delta_operation_list has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
prompts.split_context_history (cognitive 20) hindsight-api-slim/hindsight_api/engine/reflect/prompts.py:741— prompts.split_context_history has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fact_extraction.extract_facts_from_text (cognitive 20) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2713— fact_extraction.extract_facts_from_text has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 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.
orchestrator._streaming_store_owned_retain (cognitive 20) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1101— orchestrator._streaming_store_owned_retain has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (5 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightCallback._extract_user_query (cognitive 20) REDACTED:280— HindsightCallback._extract_user_query has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mental-model-detail-modal.diffTokensInline (cognitive 20) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:387— mental-model-detail-modal.diffTokensInline has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (6 pts), ternaries 2 (6 pts), boolean chains 4, if/else 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.
mental-model-trigger-fields.triggerFromForm (cognitive 20) hindsight-control-plane/src/components/mental-model-trigger-fields.tsx:104— mental-model-trigger-fields.triggerFromForm has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10 (12 pts), boolean chains 5, error handling 1 (2 pts), if/else 1 (nesting depth added 3). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
bank-context.BankProvider (cognitive 20) hindsight-control-plane/src/lib/bank-context.tsx:65— bank-context.BankProvider has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, error handling 2, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 20 points belong to 7 function literals inside it that branch (lines 90, 115, 129, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
pending-uploads.pendingUploadsFromOperations (cognitive 20) hindsight-control-plane/src/lib/pending-uploads.ts:37— pending-uploads.pendingUploadsFromOperations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (nesting depth added 6). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
response-schema.validateResponseSchema (cognitive 20) hindsight-control-plane/src/lib/response-schema.ts:54— response-schema.validateResponseSchema has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, 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.
transcript-qwen.renderLine (cognitive 20) hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:137— transcript-qwen.renderLine has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, ternaries 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript-droid.readDroidTranscript (cognitive 20) hindsight-integrations/coding-agents/src/core/transcript-droid.ts:71— transcript-droid.readDroidTranscript has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, error handling 1 (2 pts), ternaries 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.
Hindsight.execute (cognitive 20) hindsight-integrations/n8n/nodes/Hindsight/Hindsight.node.ts:214— Hindsight.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oracle._rewrite_pg_to_oracle (cognitive 19) hindsight-api-slim/hindsight_api/engine/db/oracle.py:344— oracle._rewrite_pg_to_oracle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
links.compute_semantic_links_within_batch (cognitive 19) hindsight-api-slim/hindsight_api/engine/memories/pg/links.py:751— links.compute_semantic_links_within_batch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
links._write_causal_links_batch (cognitive 19) hindsight-api-slim/hindsight_api/engine/memories/pg/links.py:978— links._write_causal_links_batch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
ChatGPTAuth._refresh (cognitive 19) hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py:857— ChatGPTAuth._refresh has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), 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.
GitHubCopilotLLM._invoke (cognitive 19) hindsight-api-slim/hindsight_api/engine/providers/github_copilot_llm.py:407— GitHubCopilotLLM._invoke has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, error handling 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.
openai_responses_llm._to_responses_content (cognitive 19) hindsight-api-slim/hindsight_api/engine/providers/openai_responses_llm.py:101— openai_responses_llm._to_responses_content has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 4 (7 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bank_utils._bank_rows (cognitive 19) hindsight-api-slim/hindsight_api/engine/retain/bank_utils.py:933— bank_utils._bank_rows has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 5 (7 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
structured_output.validate_response_schema (cognitive 19) hindsight-api-slim/hindsight_api/engine/structured_output.py:201— structured_output.validate_response_schema has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, 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.
media.split_media (cognitive 19) hindsight-api-slim/hindsight_api/knowledge/media.py:444— media.split_media has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (7 pts), boolean chains 4, 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.
text_passages._sentences (cognitive 19) hindsight-api-slim/hindsight_api/knowledge/text_passages.py:106— text_passages._sentences has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
migrations.run_migrations (cognitive 19) REDACTED:412— migrations.run_migrations has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 5, boolean chains 3, 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.
Hindsight._acreate_bank (cognitive 19) hindsight-clients/python/hindsight_client/hindsight_client.py:1029— Hindsight._acreate_bank has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19. 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.
generate_changelog.build_changelog_markdown (cognitive 19) hindsight-dev/hindsight_dev/generate_changelog.py:836— generate_changelog.build_changelog_markdown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (5 pts), ternaries 2 (5 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.
generate_changelog.generate_changelog_entry (cognitive 19) hindsight-dev/hindsight_dev/generate_changelog.py:937— generate_changelog.generate_changelog_entry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, ternaries 4 (5 pts), loops 3, boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HindsightStorage.search (cognitive 19) hindsight-integrations/crewai/hindsight_crewai/storage.py:207— HindsightStorage.search has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 1, loops 1, 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.
retain.main (cognitive 19) hindsight-integrations/cursor/scripts/retain.py:158— retain.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, error handling 4, loops 1, ternaries 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.
HindsightCallback._format_memories (cognitive 19) REDACTED:326— HindsightCallback._format_memories has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 2 (4 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.
SafeHindsight.__init__ (cognitive 19) hindsight-integrations/superagent/hindsight_superagent/middleware.py:84— SafeHindsight.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 17, boolean chains 1, if/else 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.
recall.main (cognitive 19) hindsight-integrations/omo/scripts/recall.py:56— recall.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), error handling 4 (5 pts), boolean chains 3, loops 1 (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.
find-untranslated.isSkippable (cognitive 19) hindsight-control-plane/scripts/find-untranslated.ts:49— find-untranslated.isSkippable has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5 (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.
find-untranslated.scanFile::visit (cognitive 19) hindsight-control-plane/scripts/find-untranslated.ts:149— find-untranslated.scanFile::visit has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bank-config-view.RetainStrategiesPanel (cognitive 19) hindsight-control-plane/src/components/bank-config-view.tsx:1676— bank-config-view.RetainStrategiesPanel has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (10 pts), boolean chains 5, if/else 4 (nesting depth added 3). Of this number, 11 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
entity-labels-editor.MapFieldsEditor (cognitive 19) hindsight-control-plane/src/components/entity-labels-editor.tsx:61— entity-labels-editor.MapFieldsEditor has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, ternaries 6 (7 pts), loops 2 (nesting depth added 1). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 122, a function literal at line 160, updateField, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
util.binOnPath (cognitive 19) hindsight-integrations/coding-agents/src/core/util.ts:18— util.binOnPath has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 5). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
legacy.detectLegacyClaudePlugin (cognitive 19) hindsight-integrations/coding-agents/src/core/legacy.ts:42— legacy.detectLegacyClaudePlugin has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 6). Of this number, 12 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.buildAnthropicStructuredMessages (cognitive 19) REDACTED:3773— index.buildAnthropicStructuredMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadConfig (cognitive 19) hindsight-integrations/zed/src/config.js:40— loadConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), boolean chains 2, error handling 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.
mcp._coerce_string_json (cognitive 18) hindsight-api-slim/hindsight_api/api/mcp.py:302— mcp._coerce_string_json has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (6 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UnknownParamsRoute._collect_ignored (cognitive 18) hindsight-api-slim/hindsight_api/api/unknown_params.py:174— UnknownParamsRoute._collect_ignored has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
config._parse_llm_members (cognitive 18) hindsight-api-slim/hindsight_api/config.py:3040— config._parse_llm_members has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 2 (4 pts), ternaries 1 (2 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.
MemoriesExtension.recall_chunks (cognitive 18) hindsight-api-slim/hindsight_api/engine/memories/base.py:3001— MemoriesExtension.recall_chunks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (6 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.
MemoryEngine._handle_file_convert_retain (cognitive 18) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4625— MemoryEngine._handle_file_convert_retain has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, error handling 3 (5 pts), boolean chains 3 (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.
MemoryEngine.extract_dry_run (cognitive 18) hindsight-api-slim/hindsight_api/engine/memory_engine.py:13817— MemoryEngine.extract_dry_run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, loops 3 (4 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.
MemoryEngine.list_llm_requests (cognitive 18) hindsight-api-slim/hindsight_api/engine/memory_engine.py:14620— MemoryEngine.list_llm_requests has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MemoryEngine.delete_page_node (cognitive 18) hindsight-api-slim/hindsight_api/engine/memory_engine.py:21394— MemoryEngine.delete_page_node has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
prompt_preview._partition (cognitive 18) hindsight-api-slim/hindsight_api/engine/prompt_preview.py:180— prompt_preview._partition has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, 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.
AnthropicLLM._translate_batch_body (cognitive 18) hindsight-api-slim/hindsight_api/engine/providers/anthropic_llm.py:604— AnthropicLLM._translate_batch_body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 1 (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.
agent._count_messages_tokens (cognitive 18) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:440— agent._count_messages_tokens has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
structured_doc.promote_embedded_headings (cognitive 18) hindsight-api-slim/hindsight_api/engine/reflect/structured_doc.py:324— structured_doc.promote_embedded_headings has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (8 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
attachment_store.reclaim_unreferenced_attachments (cognitive 18) hindsight-api-slim/hindsight_api/engine/retain/attachment_store.py:373— attachment_store.reclaim_unreferenced_attachments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
media.pack_lines (cognitive 18) hindsight-api-slim/hindsight_api/knowledge/media.py:346— media.pack_lines has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli_coverage_check.load_manifest (cognitive 18) hindsight-dev/hindsight_dev/cli_coverage_check.py:99— cli_coverage_check.load_manifest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
generate_changelog.get_new_migrations (cognitive 18) hindsight-dev/hindsight_dev/generate_changelog.py:302— generate_changelog.get_new_migrations has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 1, 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.
cli._remove_hooks (cognitive 18) hindsight-integrations/cursor/hindsight_cursor/cli.py:231— cli._remove_hooks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hindsight_litellm._wrapped_completion (cognitive 18) hindsight-integrations/litellm/hindsight_litellm/__init__.py:557— hindsight_litellm._wrapped_completion has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, error handling 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. This shape REPEATS in the file: one other method here (hindsight_litellm._wrapped_acompletion) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
hindsight_litellm._wrapped_acompletion (cognitive 18) hindsight-integrations/litellm/hindsight_litellm/__init__.py:613— hindsight_litellm._wrapped_acompletion has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, error handling 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. This shape REPEATS in the file: one other method here (hindsight_litellm._wrapped_completion) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
answers.ask (cognitive 18) hindsight-system-evals/hindsight_system_evals/answers.py:67— answers.ask has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, loops 2 (3 pts), ternaries 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.
run.main (cognitive 18) hindsight-system-evals/hindsight_system_evals/coding_agents/run.py:71— run.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, loops 1, ternaries 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.
refresh_cost.summary_table (cognitive 18) hindsight-system-evals/hindsight_system_evals/refresh_cost.py:523— refresh_cost.summary_table has cognitive complexity 18 (threshold 15). Drivers by points: loops 6 (9 pts), ternaries 3 (6 pts), if/else 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.
content.prepare_retention_transcript (cognitive 18) hindsight-integrations/omo/scripts/lib/content.py:140— content.prepare_retention_transcript has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
find-untranslated.main (cognitive 18) hindsight-control-plane/scripts/find-untranslated.ts:193— find-untranslated.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 5 (6 pts), ternaries 4 (6 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.
page.KnowledgeBankPage (cognitive 18) hindsight-control-plane/src/app/[locale]/knowledge-banks/[bankId]/page.tsx:44— page.KnowledgeBankPage has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 4, if/else 1 (2 pts), error handling 1 (nesting depth added 3). Of this number, 12 points are the body's own statements and 6 belong to 5 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
route.GET (cognitive 18) hindsight-control-plane/src/app/api/graph/route.ts:5— route.GET has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, ternaries 2, error handling 1, 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.
memory-defense-section.MemoryDefenseSection (cognitive 18) hindsight-control-plane/src/components/memory-defense-section.tsx:94— memory-defense-section.MemoryDefenseSection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, error handling 2, ternaries 2 (nesting depth added 1). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 111, a function literal at line 160, performSave, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
retain-strategy-config.serializeRetainStrategies (cognitive 18) hindsight-control-plane/src/lib/retain-strategy-config.ts:39— retain-strategy-config.serializeRetainStrategies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 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.
sync-coding-agents-doc.build (cognitive 18) hindsight-docs/scripts/sync-coding-agents-doc.mjs:70— sync-coding-agents-doc.build has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1, ternaries 1 (nesting depth added 9). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightClient.resyncInitiativeTriggers (cognitive 18) hindsight-integrations/coding-agents/src/core/hindsight.ts:1157— HindsightClient.resyncInitiativeTriggers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
status.syncStatus (cognitive 18) hindsight-integrations/coding-agents/src/core/status.ts:60— status.syncStatus has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (6 pts), boolean chains 4, ternaries 4, error handling 1 (2 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.
installer.prepareDcodeMarketplace (cognitive 18) hindsight-integrations/coding-agents/src/installer.ts:1619— installer.prepareDcodeMarketplace has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, error handling 2 (4 pts) (nesting depth added 4). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
HindsightEmbedded._ensure_started (cognitive 17) hindsight-all/hindsight/embedded.py:175— HindsightEmbedded._ensure_started has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
5a366d414dce_initial_schema._detect_text_search_extension (cognitive 17) hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:98— 5a366d414dce_initial_schema._detect_text_search_extension has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 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.
n9i0j1k2l3m4_learnings_and_pinned_reflections._detect_text_search_extension (cognitive 17) hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:102— n9i0j1k2l3m4_learnings_and_pinned_reflections._detect_text_search_extension has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), error handling 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.
http._attach_to_memories (cognitive 17) hindsight-api-slim/hindsight_api/api/http.py:1162— http._attach_to_memories has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BankStatsCache.get_or_load (cognitive 17) hindsight-api-slim/hindsight_api/engine/bank_stats_cache.py:87— BankStatsCache.get_or_load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
OracleConnection.executemany (cognitive 17) hindsight-api-slim/hindsight_api/engine/db/oracle.py:1196— OracleConnection.executemany has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 2 (5 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oracle._convert_row_from_oracle (cognitive 17) hindsight-api-slim/hindsight_api/engine/db/oracle.py:223— oracle._convert_row_from_oracle has cognitive complexity 17 (threshold 15). Drivers by points: error handling 2 (7 pts), if/else 2 (5 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EntityResolver.flush_pending_stats (cognitive 17) hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:545— EntityResolver.flush_pending_stats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (4 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transfer.iter_archived_memories (cognitive 17) hindsight-api-slim/hindsight_api/engine/memories/pg/transfer.py:364— transfer.iter_archived_memories has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 3, 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.
MemoryEngine.get_chunk (cognitive 17) hindsight-api-slim/hindsight_api/engine/memory_engine.py:14344— MemoryEngine.get_chunk has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 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.
NousAuthManager.refresh_tokens (cognitive 17) hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:326— NousAuthManager.refresh_tokens has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, error handling 3, 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.
tools_via_schema.calls_from_reply (cognitive 17) hindsight-api-slim/hindsight_api/engine/providers/tools_via_schema.py:151— tools_via_schema.calls_from_reply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (6 pts), boolean chains 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.
fact_extraction._split_chunk_for_output_retry (cognitive 17) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:328— fact_extraction._split_chunk_for_output_retry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fact_extraction._append_map_fields_prompt (cognitive 17) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:1379— fact_extraction._append_map_fields_prompt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
orchestrator._streaming_session_retain (cognitive 17) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:995— orchestrator._streaming_session_retain has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, 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.
KnowledgeService._embed_round (cognitive 17) hindsight-api-slim/hindsight_api/knowledge/service.py:1557— KnowledgeService._embed_round has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 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.
LLMSpanRecorder.record_llm_call (cognitive 17) hindsight-api-slim/hindsight_api/tracing.py:444— LLMSpanRecorder.record_llm_call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, loops 1 (2 pts), boolean chains 1, error handling 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.
WorkerPoller.shutdown_graceful (cognitive 17) hindsight-api-slim/hindsight_api/worker/poller.py:2078— WorkerPoller.shutdown_graceful has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DaemonEmbedManager._find_api_command (cognitive 17) hindsight-embed/hindsight_embed/daemon_embed_manager.py:493— DaemonEmbedManager._find_api_command has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightStorage.__init__ (cognitive 17) hindsight-integrations/crewai/hindsight_crewai/storage.py:66— HindsightStorage.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9, boolean chains 7, if/else 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.
cli.cmd_init (cognitive 17) hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py:236— cli.cmd_init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
config.load_config (cognitive 17) hindsight-integrations/devin-desktop/hindsight_devin_desktop/config.py:68— config.load_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts), ternaries 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.
HindsightMemoryService.__init__ (cognitive 17) hindsight-integrations/google-adk/hindsight_google_adk/memory.py:80— HindsightMemoryService.__init__ has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 12, boolean chains 4, if/else 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.
HindsightMemoryProvider._settle_retain_ops (cognitive 17) REDACTED:1128— HindsightMemoryProvider._settle_retain_ops has cognitive complexity 17 (threshold 15). Drivers by points: error handling 3 (7 pts), if/else 3 (7 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightMemoryProvider.initialize (cognitive 17) REDACTED:1284— HindsightMemoryProvider.initialize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, loops 1, ternaries 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.
hindsight_litellm.completion (cognitive 17) hindsight-integrations/litellm/hindsight_litellm/__init__.py:1267— hindsight_litellm.completion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, error handling 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. This shape REPEATS in the file: one other method here (hindsight_litellm.acompletion) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
hindsight_litellm.acompletion (cognitive 17) hindsight-integrations/litellm/hindsight_litellm/__init__.py:1360— hindsight_litellm.acompletion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, error handling 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. This shape REPEATS in the file: one other method here (hindsight_litellm.completion) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
HindsightMemoryService._extract_last_user_message (cognitive 17) hindsight-integrations/pipecat/hindsight_pipecat/memory.py:155— HindsightMemoryService._extract_last_user_message has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 1 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SafeHindsight.retain_batch (cognitive 17) hindsight-integrations/superagent/hindsight_superagent/middleware.py:309— SafeHindsight.retain_batch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), error handling 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.
SafeHindsight.aclose (cognitive 17) hindsight-integrations/superagent/hindsight_superagent/middleware.py:503— SafeHindsight.aclose has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diagnose_page.diagnose (cognitive 17) hindsight-system-evals/hindsight_system_evals/debug/diagnose_page.py:62— diagnose_page.diagnose has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (9 pts), boolean chains 4, if/else 3 (4 pts) (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
waiting.wait_until_settled (cognitive 17) hindsight-system-evals/hindsight_system_evals/waiting.py:41— waiting.wait_until_settled has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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.
cli.main (cognitive 17) hindsight-control-plane/bin/cli.js:26— cli.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, loops 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: 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.
route.GET (cognitive 17) hindsight-control-plane/src/app/api/list/route.ts:16— route.GET has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, ternaries 5, error handling 1, 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.
bank-profile-view.DirectiveFormDialog (cognitive 17) hindsight-control-plane/src/components/bank-profile-view.tsx:788— bank-profile-view.DirectiveFormDialog has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, boolean chains 5, ternaries 4 (5 pts), error handling 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (handleSubmit, a function literal at line 809, handleClose, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
bank-selector.BankSelectorInner::handleCreateDocument (cognitive 17) hindsight-control-plane/src/components/bank-selector.tsx:530— bank-selector.BankSelectorInner::handleCreateDocument has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 1, error handling 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. This shape REPEATS in the file: one other method here (bank-selector.BankSelectorInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
documents-view.DocumentRetainTraces (cognitive 17) hindsight-control-plane/src/components/documents-view.tsx:306— documents-view.DocumentRetainTraces has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (5 pts), ternaries 3, error handling 1, loops 1 (nesting depth added 1). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 314, 359, 340, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
edit-memory-form.EditMemoryForm (cognitive 17) hindsight-control-plane/src/components/edit-memory-form.tsx:51— edit-memory-form.EditMemoryForm has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (10 pts), if/else 4, boolean chains 3 (nesting depth added 2). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 180, a function literal at line 202, addEntity, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
search-debug-view.SearchDebugView::runSearch (cognitive 17) hindsight-control-plane/src/components/search-debug-view.tsx:223— search-debug-view.SearchDebugView::runSearch has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 4, ternaries 2, 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. This shape REPEATS in the file: one other method here (search-debug-view.SearchDebugView) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
sidebar.Sidebar (cognitive 17) hindsight-control-plane/src/components/sidebar.tsx:78— sidebar.Sidebar has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, ternaries 7, if/else 2. Of this number, 9 points are the body's own statements and 8 belong to 3 function items inside it that branch. 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.
HindsightClient.listPages::walk (cognitive 17) hindsight-integrations/coding-agents/src/core/hindsight.ts:962— HindsightClient.listPages::walk has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
transcript.renderLine (cognitive 17) hindsight-integrations/coding-agents/src/core/transcript.ts:50— transcript.renderLine has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, 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.
traecode-mcp.registerTraecodeWorkspaceMcp (cognitive 17) hindsight-integrations/coding-agents/src/core/traecode-mcp.ts:235— traecode-mcp.registerTraecodeWorkspaceMcp has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 3, ternaries 2 (3 pts), error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
transcript-opencode.renderMessage (cognitive 17) hindsight-integrations/coding-agents/src/core/transcript-opencode.ts:42— transcript-opencode.renderMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, 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.
install-ui.createInstallerUi.outro (cognitive 17) REDACTED:301— install-ui.createInstallerUi.outro has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 6 (7 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
session-file.parseSessionFile (cognitive 17) hindsight-integrations/openclaw/src/session-file.ts:48— session-file.parseSessionFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, ternaries 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.
index.deriveBankId (cognitive 17) REDACTED:1643— index.deriveBankId has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (6 pts), ternaries 3, loops 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: 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.
backfill.applyDrainResults (cognitive 17) hindsight-integrations/openclaw/src/backfill.ts:250— backfill.applyDrainResults has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
5a366d414dce_initial_schema._detect_vector_extension (cognitive 16) hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:33— 5a366d414dce_initial_schema._detect_vector_extension has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 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.
n9i0j1k2l3m4_learnings_and_pinned_reflections._detect_vector_extension (cognitive 16) hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:40— n9i0j1k2l3m4_learnings_and_pinned_reflections._detect_vector_extension has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 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.
triage.triage_facts (cognitive 16) hindsight-api-slim/hindsight_api/engine/consolidation/triage.py:193— triage.triage_facts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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.
db_utils.retry_with_backoff (cognitive 16) hindsight-api-slim/hindsight_api/engine/db_utils.py:68— db_utils.retry_with_backoff has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FactRecord.metadata_bag (cognitive 16) hindsight-api-slim/hindsight_api/engine/memories/base.py:611— FactRecord.metadata_bag has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 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.
transfer.import_observations (cognitive 16) hindsight-api-slim/hindsight_api/engine/memories/pg/transfer.py:521— transfer.import_observations has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), 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.
MemoryEngine.close (cognitive 16) hindsight-api-slim/hindsight_api/engine/memory_engine.py:6888— MemoryEngine.close has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), error handling 2 (3 pts), boolean chains 1, loops 1 (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.
MemoryEngine.delete_document (cognitive 16) hindsight-api-slim/hindsight_api/engine/memory_engine.py:11616— MemoryEngine.delete_document has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 3 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MemoryEngine.list_directives (cognitive 16) hindsight-api-slim/hindsight_api/engine/memory_engine.py:22019— MemoryEngine.list_directives has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
memory_engine.validate_sql_schema (cognitive 16) hindsight-api-slim/hindsight_api/engine/memory_engine.py:622— memory_engine.validate_sql_schema has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (13 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.
memory_engine._page_rows_in_tag_scope (cognitive 16) hindsight-api-slim/hindsight_api/engine/memory_engine.py:2182— memory_engine._page_rows_in_tag_scope has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
agent._with_cited_handles (cognitive 16) hindsight-api-slim/hindsight_api/engine/reflect/agent.py:2294— agent._with_cited_handles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 1 (4 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.
retractions.partition_retracted (cognitive 16) hindsight-api-slim/hindsight_api/engine/reflect/retractions.py:112— retractions.partition_retracted has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 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.
fact_storage.handle_document_tracking (cognitive 16) hindsight-api-slim/hindsight_api/engine/retain/fact_storage.py:191— fact_storage.handle_document_tracking has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tags._build_group_clause (cognitive 16) hindsight-api-slim/hindsight_api/engine/search/tags.py:380— tags._build_group_clause has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tags._match_group (cognitive 16) hindsight-api-slim/hindsight_api/engine/search/tags.py:503— tags._match_group has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
temporal_language_detection.best_language (cognitive 16) hindsight-api-slim/hindsight_api/engine/temporal_language_detection.py:190— temporal_language_detection.best_language has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (6 pts), if/else 3 (5 pts), loops 2 (3 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.
export.stream_export_documents (cognitive 16) hindsight-api-slim/hindsight_api/engine/transfer/export.py:282— export.stream_export_documents has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 6, boolean chains 2 (nesting depth added 3). 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.
export._stream_attachments (cognitive 16) hindsight-api-slim/hindsight_api/engine/transfer/export.py:723— export._stream_attachments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), loops 3 (5 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
importer._remap_based_on_ids (cognitive 16) hindsight-api-slim/hindsight_api/engine/transfer/importer.py:2051— importer._remap_based_on_ids has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 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.
LocalGemmaEmbedder.embed_query (cognitive 16) hindsight-api-slim/hindsight_api/knowledge/embedders.py:209— LocalGemmaEmbedder.embed_query has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mcp_tools.build_content_dict (cognitive 16) hindsight-api-slim/hindsight_api/mcp_tools.py:539— mcp_tools.build_content_dict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 2 (4 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.
profiling._emit (cognitive 16) hindsight-api-slim/hindsight_api/profiling.py:140— profiling._emit has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (6 pts), loops 4, error handling 2 (3 pts), if/else 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenAPICompatibilityChecker._check_response_compatibility (cognitive 16) hindsight-dev/hindsight_dev/check_openapi_compatibility.py:131— OpenAPICompatibilityChecker._check_response_compatibility has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 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.
client_coverage_check.load_manifest (cognitive 16) hindsight-dev/hindsight_dev/client_coverage_check.py:95— client_coverage_check.load_manifest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bank.derive_bank_id (cognitive 16) hindsight-integrations/cursor/scripts/lib/bank.py:32— bank.derive_bank_id has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (4 pts), ternaries 3 (4 pts), loops 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.
daemon.get_api_url (cognitive 16) hindsight-integrations/cursor/scripts/lib/daemon.py:72— daemon.get_api_url has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hermes._fetch_hindsight_api_version (cognitive 16) REDACTED:190— hermes._fetch_hindsight_api_version has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (6 pts), if/else 4 (5 pts), boolean chains 2, 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.
settings._normalize_observation_scopes (cognitive 16) hindsight-integrations/hermes/settings.py:153— settings._normalize_observation_scopes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 1 (3 pts), boolean chains 2, ternaries 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
HindsightCallback._inject_memories_into_messages (cognitive 16) REDACTED:364— HindsightCallback._inject_memories_into_messages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HindsightCallback.log_pre_api_call (cognitive 16) REDACTED:817— HindsightCallback.log_pre_api_call has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (HindsightCallback.async_log_pre_api_call) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
HindsightCallback.async_log_pre_api_call (cognitive 16) REDACTED:879— HindsightCallback.async_log_pre_api_call has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (HindsightCallback.log_pre_api_call) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
HindsightOpenAI._store_conversation (cognitive 16) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1104— HindsightOpenAI._store_conversation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 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. This shape REPEATS in the file: one other method here (HindsightAnthropic._store_conversation) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
HindsightAnthropic._store_conversation (cognitive 16) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1534— HindsightAnthropic._store_conversation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 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. This shape REPEATS in the file: one other method here (HindsightOpenAI._store_conversation) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
server.provider_environment (cognitive 16) hindsight-system-evals/hindsight_system_evals/server.py:111— server.provider_environment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compact-markdown.normalizeMarkdown (cognitive 16) hindsight-control-plane/src/components/compact-markdown.tsx:17— compact-markdown.normalizeMarkdown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tag-filter-input.TagFilterInput::handleKeyDown (cognitive 16) hindsight-control-plane/src/components/tag-filter-input.tsx:115— tag-filter-input.TagFilterInput::handleKeyDown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 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.
llm-requests-view.SpanDetails (cognitive 16) hindsight-control-plane/src/components/llm-requests-view.tsx:359— llm-requests-view.SpanDetails has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 14, 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.
pages-view.TreeRow (cognitive 16) hindsight-control-plane/src/components/pages-view.tsx:1024— pages-view.TreeRow has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, ternaries 5 (7 pts) (nesting depth added 2). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
prompt-preview-dialog.BlockCard (cognitive 16) hindsight-control-plane/src/components/prompt-preview-dialog.tsx:379— prompt-preview-dialog.BlockCard has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
response-schema.schemaToNode (cognitive 16) hindsight-control-plane/src/lib/response-schema.ts:140— response-schema.schemaToNode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sync-hermes-doc.build (cognitive 16) hindsight-docs/scripts/sync-hermes-doc.mjs:62— sync-hermes-doc.build has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.BlogListPage (cognitive 16) hindsight-docs/src/theme/BlogListPage/index.tsx:100— index.BlogListPage has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, ternaries 5 (6 pts), if/else 4 (nesting depth added 1). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 113, a function literal at line 138, a function literal at line 122, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
config.resolveCustomPages (cognitive 16) hindsight-integrations/coding-agents/src/core/config.ts:449— config.resolveCustomPages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config.readEnvConfig (cognitive 16) hindsight-integrations/coding-agents/src/core/config.ts:839— config.readEnvConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 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.
session-start.runSessionStartHook (cognitive 16) hindsight-integrations/coding-agents/src/core/session-start.ts:417— session-start.runSessionStartHook has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 5, 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.
MethodTooLong: HindsightSettingTab.display hindsight-integrations/obsidian/src/settings.ts:63— MethodTooLong — display runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
TooManyFields: App hindsight-cli/src/commands/explore.rs:80— TooManyFields — 35 stored fields beside 24 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D30 · Dependency Vulnerabilities· Medium vulnerability · ×1
D4 · Code Duplication· Near-duplicate member family (5 members, 15 shared lines) · ×1
Near-duplicate member family (5 members, 15 shared lines) hindsight-integrations/autogen/hindsight_autogen/tools.py:57— hindsight-integrations/autogen/hindsight_autogen/tools.py:57-235 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:57-233 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:47-195 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:68-234 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:60-225 — These 5 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 27 shared lines) · ×1
Near-duplicate member family (4 members, 27 shared lines) hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:40— hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:40-128 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:132-194 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:35-88 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:92-136 — These 4 members are variants of one another: a block of 27 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Near-duplicate member pair (74 shared lines) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1395— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1395-1567 | hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1702-1823 — These two members are variants of one another: 74 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (39 shared lines) hindsight-api-slim/hindsight_api/mcp_tools.py:1024— hindsight-api-slim/hindsight_api/mcp_tools.py:1024-1145 | hindsight-api-slim/hindsight_api/mcp_tools.py:1149-1271 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (16 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (16 members, 50+ identical tokens) hindsight-api-slim/hindsight_api/engine/memories/postgres.py:147— hindsight-api-slim/hindsight_api/engine/memories/postgres.py:147-253 | hindsight-api-slim/hindsight_api/engine/memories/postgres.py:647-667 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1651-2271 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:2696-3927 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4016-4670 | hindsight-clients/python/hindsight_client/hindsight_client.py:689-758 | hindsight-clients/python/hindsight_client/hindsight_client.py:782-850 | hindsight-clients/python/hindsight_client/hindsight_client.py:971-1027 | hindsight-clients/python/hindsight_client/hindsight_client.py:1145-1199 | hindsight-clients/python/hindsight_client/hindsight_client.py:3109-3180 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:260-315 | hindsight-integrations/haystack/hindsight_haystack/tools.py:548-620 | hindsight-integrations/haystack/hindsight_haystack/tools.py:724-764 | hindsight-integrations/litellm/hindsight_litellm/config.py:258-386 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:369-441 | hindsight-integrations/superagent/hindsight_superagent/config.py:86-118 — These 16 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 16 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 16 times.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (8 members, 50+ identical tokens) hindsight-integrations/agent-framework/hindsight_agent_framework/_client.py:29— hindsight-integrations/agent-framework/hindsight_agent_framework/_client.py:29-49 | hindsight-integrations/autogen/hindsight_autogen/_client.py:25-45 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/_client.py:21-41 | hindsight-integrations/haystack/hindsight_haystack/_client.py:25-45 | hindsight-integrations/langgraph/hindsight_langgraph/_client.py:23-44 | hindsight-integrations/llamaindex/hindsight_llamaindex/_client.py:30-50 | hindsight-integrations/openai-agents/hindsight_openai_agents/_client.py:21-41 | hindsight-integrations/superagent/hindsight_superagent/_client.py:28-43 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (7 members, 50+ identical tokens) hindsight-integrations/ag2/hindsight_ag2/_client.py:23— hindsight-integrations/ag2/hindsight_ag2/_client.py:23-39 | hindsight-integrations/agno/hindsight_agno/tools.py:48-64 | hindsight-integrations/composio/hindsight_composio/tools.py:71-87 | hindsight-integrations/google-adk/hindsight_google_adk/_client.py:30-46 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:34-50 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:33-49 | hindsight-integrations/strands/hindsight_strands/tools.py:85-101 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Edited copy of a member (159 corresponding lines) · ×1
Edited copy of a member (159 corresponding lines) hindsight-embed/hindsight_embed/cli.py:468— hindsight-embed/hindsight_embed/cli.py:468-670 | hindsight-embed/hindsight_embed/cli.py:674-832 — These two members are one piece of code written twice and then edited apart: 159 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (112 corresponding lines) · ×1
Edited copy of a member (112 corresponding lines) hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:68— hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:68-179 | hindsight-integrations/strands/hindsight_strands/tools.py:119-251 — These two members are one piece of code written twice and then edited apart: 112 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (127 corresponding lines) · ×1
Edited copy of a member (127 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:838— hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:838-964 | hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:975-1109 — These two members are one piece of code written twice and then edited apart: 127 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (145 corresponding lines) · ×1
Edited copy of a member (145 corresponding lines) hindsight-api-slim/hindsight_api/mcp_tools.py:2002— hindsight-api-slim/hindsight_api/mcp_tools.py:2002-2185 | hindsight-api-slim/hindsight_api/mcp_tools.py:2189-2333 — These two members are one piece of code written twice and then edited apart: 145 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (126 corresponding lines) · ×1
Edited copy of a member (126 corresponding lines) hindsight-api-slim/hindsight_api/mcp_tools.py:3002— hindsight-api-slim/hindsight_api/mcp_tools.py:3002-3127 | hindsight-api-slim/hindsight_api/mcp_tools.py:3131-3268 — These two members are one piece of code written twice and then edited apart: 126 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (84 corresponding lines) · ×1
Edited copy of a member (84 corresponding lines) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1182— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1182-1272 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1604-1687 — These two members are one piece of code written twice and then edited apart: 84 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (81 corresponding lines) · ×1
Edited copy of a member (81 corresponding lines) hindsight-api-slim/hindsight_api/webhooks/manager.py:77— hindsight-api-slim/hindsight_api/webhooks/manager.py:77-157 | hindsight-api-slim/hindsight_api/webhooks/manager.py:160-246 — These two members are one piece of code written twice and then edited apart: 81 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (74 corresponding lines) · ×1
Edited copy of a member (74 corresponding lines) hindsight-api-slim/hindsight_api/mcp_tools.py:1847— hindsight-api-slim/hindsight_api/mcp_tools.py:1847-1931 | hindsight-api-slim/hindsight_api/mcp_tools.py:3334-3407 — These two members are one piece of code written twice and then edited apart: 74 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (79 corresponding lines) · ×1
Edited copy of a member (79 corresponding lines) hindsight-api-slim/hindsight_api/mcp_tools.py:3558— hindsight-api-slim/hindsight_api/mcp_tools.py:3558-3651 | hindsight-api-slim/hindsight_api/mcp_tools.py:4127-4205 — These two members are one piece of code written twice and then edited apart: 79 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 46+ corresponding lines) · ×1
Edited copies of one member (3 members, 46+ corresponding lines) hindsight-cli/src/commands/directive.rs:17— hindsight-cli/src/commands/directive.rs:17-70 | hindsight-cli/src/commands/mental_model.rs:210-255 | hindsight-cli/src/commands/mental_model.rs:646-697 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 46 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (59 corresponding lines) · ×1
Edited copy of a member (59 corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:305— hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:305-363 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:17129-17187 — These two members are one piece of code written twice and then edited apart: 59 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (72 corresponding lines) · ×1
Edited copy of a member (72 corresponding lines) hindsight-integrations/langgraph/hindsight_langgraph/tools.py:252— hindsight-integrations/langgraph/hindsight_langgraph/tools.py:252-323 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:243-320 — These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1602— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1602-1657 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1986-2048 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 44+ corresponding lines) · ×1
Edited copies of one member (3 members, 44+ corresponding lines) hindsight-cli/src/commands/directive.rs:166— hindsight-cli/src/commands/directive.rs:166-209 | hindsight-cli/src/commands/mental_model.rs:374-439 | hindsight-cli/src/commands/pages.rs:369-416 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 44 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 51+ corresponding lines) · ×1
Edited copies of one member (5 members, 51+ corresponding lines) hindsight-api-slim/hindsight_api/mcp_tools.py:1935— hindsight-api-slim/hindsight_api/mcp_tools.py:1935-1998 | hindsight-api-slim/hindsight_api/mcp_tools.py:2469-2537 | hindsight-api-slim/hindsight_api/mcp_tools.py:3655-3711 | hindsight-api-slim/hindsight_api/mcp_tools.py:4000-4058 | hindsight-api-slim/hindsight_api/mcp_tools.py:4394-4444 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 51 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1516— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1516-1564 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1567-1612 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 54+ corresponding lines) · ×1
Edited copies of one member (3 members, 54+ corresponding lines) hindsight-api-slim/hindsight_api/mcp_tools.py:2823— hindsight-api-slim/hindsight_api/mcp_tools.py:2823-2880 | hindsight-api-slim/hindsight_api/mcp_tools.py:2884-2937 | hindsight-api-slim/hindsight_api/mcp_tools.py:2941-2998 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 54 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 51+ corresponding lines) · ×1
Edited copies of one member (6 members, 51+ corresponding lines) hindsight-api-slim/hindsight_api/mcp_tools.py:2337— hindsight-api-slim/hindsight_api/mcp_tools.py:2337-2395 | hindsight-api-slim/hindsight_api/mcp_tools.py:3272-3325 | hindsight-api-slim/hindsight_api/mcp_tools.py:3491-3549 | hindsight-api-slim/hindsight_api/mcp_tools.py:4062-4118 | hindsight-api-slim/hindsight_api/mcp_tools.py:4629-4679 | hindsight-api-slim/hindsight_api/mcp_tools.py:4683-4740 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 51 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 36+ corresponding lines) · ×1
Edited copies of one member (3 members, 36+ corresponding lines) hindsight-cli/src/commands/operation.rs:227— hindsight-cli/src/commands/operation.rs:227-262 | hindsight-cli/src/commands/pages.rs:426-464 | hindsight-cli/src/commands/webhook.rs:169-204 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 36 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:24698— hindsight-api-slim/hindsight_api/engine/memory_engine.py:24698-24736 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:24761-24806 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 29+ corresponding lines) · ×1
Edited copies of one member (5 members, 29+ corresponding lines) hindsight-cli/src/commands/bank.rs:6— hindsight-cli/src/commands/bank.rs:6-37 | hindsight-cli/src/commands/document.rs:288-316 | hindsight-cli/src/commands/memory.rs:711-739 | hindsight-cli/src/commands/operation.rs:27-63 | hindsight-cli/src/commands/operation.rs:155-183 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 34+ corresponding lines) · ×1
Edited copies of one member (4 members, 34+ corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:86— hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:86-119 | hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:123-171 | hindsight-api-slim/hindsight_api/alembic/versions/e1b2c3d4f5a6_drop_unused_indexes.py:88-125 | hindsight-api-slim/hindsight_api/alembic/versions/k7b1c2d3e4f5_add_knowledge_banks.py:41-140 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/a2b3c4d5e6f7_add_text_signals_column.py:49— hindsight-api-slim/hindsight_api/alembic/versions/a2b3c4d5e6f7_add_text_signals_column.py:49-84 | hindsight-api-slim/hindsight_api/alembic/versions/a2b3c4d5e6f7_add_text_signals_column.py:91-119 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:22156— hindsight-api-slim/hindsight_api/engine/memory_engine.py:22156-22191 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:22357-22388 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) hindsight-api-slim/hindsight_api/engine/memory_engine.py:16856— hindsight-api-slim/hindsight_api/engine/memory_engine.py:16856-16897 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:16970-17004 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (49 corresponding lines) · ×1
Edited copy of a member (49 corresponding lines) hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:675— hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:675-748 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:759-807 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 34+ corresponding lines) · ×1
Edited copies of one member (3 members, 34+ corresponding lines) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1864— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1864-1901 | hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:142-184 | hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:430-463 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 14+ corresponding lines) · ×1
Edited copies of one member (4 members, 14+ corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:540— hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:540-557 | hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py:323-341 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1103-1121 | hindsight-api-slim/hindsight_api/engine/providers/openai_responses_llm.py:254-267 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 20+ corresponding lines) · ×1
Edited copies of one member (3 members, 20+ corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/c9a1b2d3e4f5_add_invalidated_memory_units.py:51— hindsight-api-slim/hindsight_api/alembic/versions/c9a1b2d3e4f5_add_invalidated_memory_units.py:51-90 | hindsight-api-slim/hindsight_api/alembic/versions/g2h3i4j5k6l7_remove_opinion_fact_type.py:32-51 | hindsight-api-slim/hindsight_api/alembic/versions/g2h3i4j5k6l7_remove_opinion_fact_type.py:55-85 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 23+ corresponding lines) · ×1
Edited copies of one member (4 members, 23+ corresponding lines) hindsight-cli/src/commands/bank.rs:73— hindsight-cli/src/commands/bank.rs:73-97 | hindsight-cli/src/commands/bank.rs:1070-1092 | hindsight-cli/src/commands/directive.rs:79-103 | hindsight-cli/src/commands/mental_model.rs:264-288 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×1
Edited copy of a member (17 corresponding lines) hindsight-integrations/pipecat/hindsight_pipecat/memory.py:46— hindsight-integrations/pipecat/hindsight_pipecat/memory.py:46-62 | hindsight-integrations/vapi/hindsight_vapi/webhook.py:59-75 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×1
Edited copies of one member (3 members, 7+ corresponding lines) hindsight-clients/python/hindsight_client/hindsight_client.py:3024— hindsight-clients/python/hindsight_client/hindsight_client.py:3024-3030 | hindsight-clients/python/hindsight_client/hindsight_client.py:3432-3440 | hindsight-clients/python/hindsight_client/hindsight_client.py:3465-3471 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×1
Edited copy of a member (24 corresponding lines) REDACTED:948— REDACTED:948-971 | REDACTED:980-1003 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 14+ corresponding lines) · ×1
Edited copies of one member (3 members, 14+ corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:328— hindsight-api-slim/hindsight_api/engine/providers/codex_auth.py:328-350 | hindsight-api-slim/hindsight_api/engine/providers/nous_auth.py:311-324 | hindsight-api-slim/hindsight_api/engine/providers/xai_oauth_llm.py:944-963 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/anthropic_llm.py:66— hindsight-api-slim/hindsight_api/engine/providers/anthropic_llm.py:66-80 | hindsight-api-slim/hindsight_api/engine/structured_output.py:95-117 | hindsight-api-slim/hindsight_api/engine/structured_output.py:138-156 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×1
Edited copies of one member (3 members, 18+ corresponding lines) hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:300— hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:300-320 | hindsight-api-slim/hindsight_api/engine/providers/litellm_llm.py:188-205 | hindsight-api-slim/hindsight_api/engine/providers/litellm_router_llm.py:174-191 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (47 corresponding lines) · ×1
Edited copy of a member (47 corresponding lines) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:787— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:787-838 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1119-1165 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 58+ corresponding lines) · ×1
Edited copies of one member (3 members, 58+ corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/a7b8c9d0e1f2_split_history_into_own_tables.py:49— hindsight-api-slim/hindsight_api/alembic/versions/a7b8c9d0e1f2_split_history_into_own_tables.py:49-138 | hindsight-api-slim/hindsight_api/alembic/versions/e2f4a6c8b0d1_add_attachments.py:73-130 | hindsight-api-slim/hindsight_api/alembic/versions/o0j1k2l3m4n5_migrate_mental_models_data.py:35-92 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 58 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 13+ corresponding lines) · ×1
Edited copies of one member (4 members, 13+ corresponding lines) REDACTED:456— REDACTED:456-468 | REDACTED:473-485 | REDACTED:533-548 | REDACTED:551-566 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×1
Edited copies of one member (4 members, 15+ corresponding lines) REDACTED:198— REDACTED:198-212 | REDACTED:215-234 | REDACTED:237-251 | REDACTED:254-271 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 34+ corresponding lines) · ×1
Edited copies of one member (5 members, 34+ corresponding lines) hindsight-integrations/agent-framework/hindsight_agent_framework/config.py:55— hindsight-integrations/agent-framework/hindsight_agent_framework/config.py:55-90 | hindsight-integrations/composio/hindsight_composio/config.py:57-90 | hindsight-integrations/google-adk/hindsight_google_adk/config.py:60-98 | hindsight-integrations/haystack/hindsight_haystack/config.py:55-90 | hindsight-integrations/llamaindex/hindsight_llamaindex/config.py:55-90 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 16+ corresponding lines) · ×1
Edited copies of one member (3 members, 16+ corresponding lines) hindsight-integrations/agno/hindsight_agno/tools.py:189— hindsight-integrations/agno/hindsight_agno/tools.py:189-214 | hindsight-integrations/agno/hindsight_agno/tools.py:255-281 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:102-117 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 29+ corresponding lines) · ×1
Edited copies of one member (3 members, 29+ corresponding lines) hindsight-clients/python/hindsight_client/hindsight_client.py:1663— hindsight-clients/python/hindsight_client/hindsight_client.py:1663-1691 | hindsight-clients/python/hindsight_client/hindsight_client.py:1923-1952 | hindsight-clients/python/hindsight_client/hindsight_client.py:2108-2148 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 5+ corresponding lines) · ×1
Edited copies of one member (3 members, 5+ corresponding lines) hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:324— hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:324-346 | hindsight-api-slim/hindsight_api/engine/memories/pg/engine_curation.py:119-123 | hindsight-api-slim/hindsight_api/engine/memories/pg/engine_curation.py:175-194 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 7+ corresponding lines) · ×1
Edited copies of one member (4 members, 7+ corresponding lines) hindsight-api-slim/hindsight_api/api/http.py:342— hindsight-api-slim/hindsight_api/api/http.py:342-348 | REDACTED:222-234 | hindsight-api-slim/hindsight_api/worker/backpressure.py:45-63 | hindsight-api-slim/hindsight_api/worker/backpressure.py:100-116 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 4+ corresponding lines) · ×1
Edited copies of one member (5 members, 4+ corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/a8c1e4f7b0d3_add_operation_retention_indexes.py:43— hindsight-api-slim/hindsight_api/alembic/versions/a8c1e4f7b0d3_add_operation_retention_indexes.py:43-46 | hindsight-api-slim/hindsight_api/alembic/versions/b3c4d5e6f7g8_add_temporal_date_indexes.py:64-68 | hindsight-api-slim/hindsight_api/alembic/versions/d2e3f4a5b6c7_add_memory_links_expansion_indexes.py:78-81 | hindsight-api-slim/hindsight_api/alembic/versions/d4e5f6g7h8i9_gin_source_memory_ids_fastupdate_off.py:49-56 | hindsight-api-slim/hindsight_api/alembic/versions/e9b2c7d1f3a4_drop_entity_memory_links.py:37-68 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 3+ corresponding lines) · ×1
Edited copies of one member (4 members, 3+ corresponding lines) hindsight-all/hindsight/server.py:24— hindsight-all/hindsight/server.py:24-29 | REDACTED:181-183 | hindsight-api-slim/hindsight_api/engine/providers/llamacpp_llm.py:56-59 | hindsight-system-tests/hindsight_system_tests/server.py:47-49 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×1
Edited copy of a member (3 corresponding lines) hindsight-api-slim/hindsight_api/alembic/versions/2071c7518f88_add_memory_links_bank_id_index.py:95— hindsight-api-slim/hindsight_api/alembic/versions/2071c7518f88_add_memory_links_bank_id_index.py:95-97 | hindsight-api-slim/hindsight_api/alembic/versions/c4e8a1b7d2f6_memory_units_bank_updated_at_index.py:96-98 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (86–88 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1698— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1698-1783 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1801-1888 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1698` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (60–83 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1233— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1233-1315 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1572-1631 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (82 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:952— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:952-1033 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1382-1463 — both copies are in the same file, so extract the 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 (60–73 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1330— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1330-1389 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1653-1725 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (59–65 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:3932— hindsight-api-slim/hindsight_api/mcp_tools.py:3932-3996 | hindsight-api-slim/hindsight_api/mcp_tools.py:4332-4390 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:3932` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (22–62 lines × 4) hindsight-integrations/litellm/hindsight_litellm/__init__.py:558— hindsight-integrations/litellm/hindsight_litellm/__init__.py:558-579 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:614-635 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:1268-1329 | hindsight-integrations/litellm/hindsight_litellm/__init__.py:1361-1411 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-integrations/litellm/hindsight_litellm/__init__.py:581` calls `_is_model_excluded`, `_original_completion` and `hindsight-integrations/litellm/hindsight_litellm/__init__.py:1332` 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 (59–62 lines × 2) hindsight-api-slim/hindsight_api/webhooks/manager.py:98— hindsight-api-slim/hindsight_api/webhooks/manager.py:98-156 | hindsight-api-slim/hindsight_api/webhooks/manager.py:181-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/webhooks/manager.py:181` it does not close everything it opens, so those 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/webhooks/manager.py:97` calls `acquire` and `hindsight-api-slim/hindsight_api/webhooks/manager.py:180` 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 (58–59 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:99— hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:99-157 | hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:103-160 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py` and `hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (56–57 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:178— hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:178-234 | hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:255-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:178` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (47–51 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:4213— hindsight-api-slim/hindsight_api/mcp_tools.py:4213-4263 | hindsight-api-slim/hindsight_api/mcp_tools.py:4271-4317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:4213` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (51 lines × 2) hindsight-clients/python/hindsight_client/hindsight_client.py:514— hindsight-clients/python/hindsight_client/hindsight_client.py:514-564 | hindsight-clients/python/hindsight_client/hindsight_client.py:1305-1355 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (47–50 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:34— hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:34-83 | hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:41-87 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py` and `hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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, `hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:34` calls `_get_schema_prefix`, `get_main_option` and `hindsight-api-slim/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py:30` 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 (50 lines × 2) hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1111— hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1111-1160 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:1541-1590 — both copies are in the same file, so extract the 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 (35–49 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:2771— hindsight-api-slim/hindsight_api/mcp_tools.py:2771-2819 | hindsight-api-slim/hindsight_api/mcp_tools.py:4410-4444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (42–48 lines × 5) hindsight-integrations/ag2/hindsight_ag2/tools.py:49— hindsight-integrations/ag2/hindsight_ag2/tools.py:49-96 | hindsight-integrations/autogen/hindsight_autogen/tools.py:57-98 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:57-98 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:68-111 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:60-101 — before extracting anything, compare `hindsight-integrations/ag2/hindsight_ag2/tools.py` and `hindsight-integrations/autogen/hindsight_autogen/tools.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/ag2/hindsight_ag2/tools.py:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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: `FunctionTool` names `agents.tool` in one and `autogen_core.tools` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (47–48 lines × 2) hindsight-system-evals/hindsight_system_evals/waiting.py:48— hindsight-system-evals/hindsight_system_evals/waiting.py:48-94 | hindsight-system-tests/hindsight_system_tests/waiting.py:40-87 — before extracting anything, compare `hindsight-system-evals/hindsight_system_evals/waiting.py` and `hindsight-system-tests/hindsight_system_tests/waiting.py` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (44–47 lines × 2) hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:918— hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:918-964 | hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:1066-1109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memories/pg/entity_resolver.py:918` it begins part-way through the construct above it, so those 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 (38–46 lines × 2) hindsight-integrations/litellm/hindsight_litellm/__init__.py:835— hindsight-integrations/litellm/hindsight_litellm/__init__.py:835-872 | REDACTED:628-673 — 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 (44 lines × 3) hindsight-integrations/agno/hindsight_agno/tools.py:298— hindsight-integrations/agno/hindsight_agno/tools.py:298-341 | hindsight-integrations/composio/hindsight_composio/tools.py:256-299 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:332-375 — before extracting anything, compare `hindsight-integrations/agno/hindsight_agno/tools.py` and `hindsight-integrations/composio/hindsight_composio/tools.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 (30–43 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/k7b1c2d3e4f5_add_knowledge_banks.py:71— hindsight-api-slim/hindsight_api/alembic/versions/k7b1c2d3e4f5_add_knowledge_banks.py:71-113 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:62-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/alembic/versions/k7b1c2d3e4f5_add_knowledge_banks.py:71` it begins part-way through the construct above it, so those 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 (37–40 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:3034— hindsight-api-slim/hindsight_api/mcp_tools.py:3034-3073 | hindsight-api-slim/hindsight_api/mcp_tools.py:3166-3202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:3034` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (33–39 lines × 2) REDACTED:39— REDACTED:39-77 | REDACTED:81-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:39` it does not close everything it opens, so those 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 (37–39 lines × 2) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1529— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1529-1567 | hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1787-1823 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1529` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15–38 lines × 3) hindsight-api-slim/hindsight_api/engine/memory_engine.py:22707— hindsight-api-slim/hindsight_api/engine/memory_engine.py:22707-22721 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:22777-22814 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:22921-22943 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/engine/memory_engine.py:22707` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25–38 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:5239— hindsight-api-slim/hindsight_api/api/http.py:5239-5276 | hindsight-api-slim/hindsight_api/api/http.py:7421-7445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:5239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35–38 lines × 2) hindsight-api-slim/hindsight_api/mcp_tools.py:3086— hindsight-api-slim/hindsight_api/mcp_tools.py:3086-3123 | hindsight-api-slim/hindsight_api/mcp_tools.py:3223-3257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/mcp_tools.py:3086` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (21–34 lines × 3) hindsight-api-slim/hindsight_api/alembic/versions/k7b1c2d3e4f5_add_knowledge_banks.py:68— hindsight-api-slim/hindsight_api/alembic/versions/k7b1c2d3e4f5_add_knowledge_banks.py:68-96 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:55-88 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:105-125 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py` and `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-api-slim/hindsight_api/alembic/versions/k7b1c2d3e4f5_add_knowledge_banks.py:68` it begins part-way through the construct above it, so those 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 (20–34 lines × 3) hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:52— hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:52-73 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:158-191 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:101-120 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py` and `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:52` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:123` calls `execute` and `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:191` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (26–34 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:238— hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:238-271 | hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:314-339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:238` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (33–34 lines × 2) hindsight-integrations/autogen/hindsight_autogen/tools.py:129— hindsight-integrations/autogen/hindsight_autogen/tools.py:129-162 | hindsight-integrations/autogen/hindsight_autogen/tools.py:175-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (33 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1441— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1441-1473 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1777-1809 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (28–33 lines × 2) hindsight-integrations/autogen/hindsight_autogen/tools.py:104— hindsight-integrations/autogen/hindsight_autogen/tools.py:104-136 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:87-114 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/tools.py` and `hindsight-integrations/google-adk/hindsight_google_adk/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/autogen/hindsight_autogen/tools.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. 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: `FunctionTool` names `autogen_core.tools` in one and `google.adk.tools` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (20–33 lines × 2) hindsight-integrations/cursor/scripts/lib/content.py:183— hindsight-integrations/cursor/scripts/lib/content.py:183-215 | hindsight-integrations/omo/scripts/lib/content.py:146-165 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/content.py` and `hindsight-integrations/omo/scripts/lib/content.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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–32 lines × 4) hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:248— hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:248-277 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:52-69 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:158-189 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:101-120 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py` and `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-api-slim/hindsight_api/alembic/versions/n9i0j1k2l3m4_learnings_and_pinned_reflections.py:248` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:123` calls `execute` and `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:190` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (27–31 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4132— hindsight-api-slim/hindsight_api/engine/memory_engine.py:4132-4158 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4332-4362 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29–30 lines × 2) hindsight-integrations/langgraph/hindsight_langgraph/tools.py:142— hindsight-integrations/langgraph/hindsight_langgraph/tools.py:142-171 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:184-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (30 lines × 2) REDACTED:823— REDACTED:823-852 | REDACTED:885-914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, 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–29 lines × 2) hindsight-embed/hindsight_embed/cli.py:642— hindsight-embed/hindsight_embed/cli.py:642-670 | hindsight-embed/hindsight_embed/cli.py:806-832 — both copies are in the same file, so extract the 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–28 lines × 2) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1532— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1532-1559 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1587-1609 — both copies are in the same file, so extract the 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 (28 lines × 2) hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1605— hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py:1605-1632 | hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py:1990-2017 — before extracting anything, compare `hindsight-api-slim/hindsight_api/engine/db/ops_oracle.py` and `hindsight-api-slim/hindsight_api/engine/db/ops_postgresql.py` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 360 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 (24–28 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2411— hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2411-2438 | hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:3400-3423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20–27 lines × 3) hindsight-api-slim/hindsight_api/mcp_tools.py:2768— hindsight-api-slim/hindsight_api/mcp_tools.py:2768-2794 | hindsight-api-slim/hindsight_api/mcp_tools.py:4407-4426 | hindsight-api-slim/hindsight_api/mcp_tools.py:4638-4658 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/mcp_tools.py:2768` it does not close everything it opens, so those exact lines 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–27 lines × 2) hindsight-integrations/autogen/hindsight_autogen/tools.py:186— hindsight-integrations/autogen/hindsight_autogen/tools.py:186-212 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:156-179 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/tools.py` and `hindsight-integrations/google-adk/hindsight_google_adk/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/autogen/hindsight_autogen/tools.py:186` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26–27 lines × 2) hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:133— hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:133-159 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:176-201 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16–26 lines × 3) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4132— hindsight-api-slim/hindsight_api/engine/memory_engine.py:4132-4152 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4205-4220 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4332-4357 — all 3 copies are in the same file, so extract the block into one function there and call 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 (26 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:21919— hindsight-api-slim/hindsight_api/engine/memory_engine.py:21919-21944 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:21956-21981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24–26 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:24284— hindsight-api-slim/hindsight_api/engine/memory_engine.py:24284-24309 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:24423-24446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memory_engine.py:24284` it begins part-way through the construct above it, so those 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 (22–24 lines × 3) hindsight-integrations/ag2/hindsight_ag2/tools.py:181— hindsight-integrations/ag2/hindsight_ag2/tools.py:181-202 | hindsight-integrations/autogen/hindsight_autogen/tools.py:192-215 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:159-181 — before extracting anything, compare `hindsight-integrations/ag2/hindsight_ag2/tools.py` and `hindsight-integrations/autogen/hindsight_autogen/tools.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/ag2/hindsight_ag2/tools.py:181` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 3) hindsight-integrations/autogen/hindsight_autogen/tools.py:145— hindsight-integrations/autogen/hindsight_autogen/tools.py:145-168 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:120-143 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:142-165 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/tools.py` and `hindsight-integrations/google-adk/hindsight_google_adk/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23–24 lines × 2) hindsight-integrations/strands/hindsight_strands/tools.py:184— hindsight-integrations/strands/hindsight_strands/tools.py:184-207 | hindsight-integrations/strands/hindsight_strands/tools.py:218-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–22 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:4190— hindsight-api-slim/hindsight_api/engine/memory_engine.py:4190-4211 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:4257-4276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memory_engine.py:4190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-api-slim/hindsight_api/engine/memory_engine.py:4212` calls `_get_backend` and `hindsight-api-slim/hindsight_api/engine/memory_engine.py:4277` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–21 lines × 9) hindsight-api-slim/hindsight_api/alembic/versions/a7b8c9d0e1f2_split_history_into_own_tables.py:146— hindsight-api-slim/hindsight_api/alembic/versions/a7b8c9d0e1f2_split_history_into_own_tables.py:146-151 | hindsight-api-slim/hindsight_api/alembic/versions/g2h3i4j5k6l7_remove_opinion_fact_type.py:35-43 | hindsight-api-slim/hindsight_api/alembic/versions/h3c4d5e6f7g8_mental_models_v4.py:104-113 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:44-53 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:92-107 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:136-146 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:39-59 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:96-106 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:116-136 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py` and `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-api-slim/hindsight_api/alembic/versions/h3c4d5e6f7g8_mental_models_v4.py:104` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-api-slim/hindsight_api/alembic/versions/g2h3i4j5k6l7_remove_opinion_fact_type.py:43` calls `execute` and `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:53` 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–21 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:10219— hindsight-api-slim/hindsight_api/api/http.py:10219-10239 | hindsight-api-slim/hindsight_api/api/http.py:10269-10280 | hindsight-api-slim/hindsight_api/api/http.py:10302-10313 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/api/http.py:10219` it does not close everything it opens, so those exact lines 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–21 lines × 3) hindsight-api-slim/hindsight_api/engine/memories/pg/link_expansion.py:69— hindsight-api-slim/hindsight_api/engine/memories/pg/link_expansion.py:69-85 | hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:145-165 | hindsight-api-slim/hindsight_api/engine/memories/pg/recall.py:429-445 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (18–21 lines × 2) hindsight-api-slim/hindsight_api/admin/cli.py:1654— hindsight-api-slim/hindsight_api/admin/cli.py:1654-1671 | hindsight-api-slim/hindsight_api/admin/cli.py:1720-1740 — both copies are in the same file, so extract the 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–20 lines × 3) hindsight-api-slim/hindsight_api/admin/cli.py:1591— hindsight-api-slim/hindsight_api/admin/cli.py:1591-1607 | hindsight-api-slim/hindsight_api/admin/cli.py:1651-1667 | hindsight-api-slim/hindsight_api/admin/cli.py:1717-1736 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/admin/cli.py:1591` it does not close everything it opens, so those 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 (19–20 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:9462— hindsight-api-slim/hindsight_api/api/http.py:9462-9481 | hindsight-api-slim/hindsight_api/api/http.py:9519-9537 | hindsight-api-slim/hindsight_api/api/http.py:9639-9658 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19–20 lines × 2) hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:482— hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:482-501 | hindsight-api-slim/hindsight_api/engine/providers/codex_llm.py:714-732 — 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 `hindsight-api-slim/hindsight_api/engine/providers/claude_code_llm.py:482` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 3) hindsight-integrations/autogen/hindsight_autogen/tools.py:110— hindsight-integrations/autogen/hindsight_autogen/tools.py:110-128 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:91-109 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:114-132 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/tools.py` and `hindsight-integrations/google-adk/hindsight_google_adk/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 4) hindsight-integrations/ag2/hindsight_ag2/tools.py:188— hindsight-integrations/ag2/hindsight_ag2/tools.py:188-205 | hindsight-integrations/autogen/hindsight_autogen/tools.py:201-218 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:168-184 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:206-223 — before extracting anything, compare `hindsight-integrations/ag2/hindsight_ag2/tools.py` and `hindsight-integrations/autogen/hindsight_autogen/tools.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 90 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-integrations/langgraph/hindsight_langgraph/tools.py:205` calls `_resolve_bank_id` and `hindsight-integrations/ag2/hindsight_ag2/tools.py:187` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17–18 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:5990— hindsight-api-slim/hindsight_api/engine/memory_engine.py:5990-6007 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:6021-6037 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memory_engine.py:5990` it begins part-way through the construct above it, so those exact lines 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–17 lines × 2) hindsight-api-slim/hindsight_api/engine/db/oracle.py:1538— hindsight-api-slim/hindsight_api/engine/db/oracle.py:1538-1554 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1558-1572 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–17 lines × 2) hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1099— hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1099-1115 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:964-976 — 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 `hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:1099` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–17 lines × 2) hindsight-api-slim/hindsight_api/engine/memory_engine.py:5900— hindsight-api-slim/hindsight_api/engine/memory_engine.py:5900-5916 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:6072-6085 — both copies are in the same file, so extract the 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 (14–16 lines × 4) hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:51— hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:51-66 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:157-172 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:75-88 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:100-113 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py` and `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 3) hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1792— hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1792-1816 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4401-4416 | hindsight-integrations/superagent/hindsight_superagent/config.py:103-118 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1792` it begins part-way through the construct above it, so those 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 (10–16 lines × 2) hindsight-api-slim/hindsight_api/config.py:2557— hindsight-api-slim/hindsight_api/config.py:2557-2572 | hindsight-api-slim/hindsight_api/config.py:2576-2585 — both copies are in the same file, so extract the 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–16 lines × 2) hindsight-integrations/cursor/scripts/lib/content.py:89— hindsight-integrations/cursor/scripts/lib/content.py:89-104 | hindsight-integrations/omo/scripts/lib/content.py:120-131 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/content.py` and `hindsight-integrations/omo/scripts/lib/content.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 88 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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, `hindsight-integrations/cursor/scripts/lib/content.py:110` calls `formatCurrentTimeForRecall` and `hindsight-integrations/omo/scripts/lib/content.py:136` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 17) hindsight-api-slim/hindsight_api/engine/memories/postgres.py:182— hindsight-api-slim/hindsight_api/engine/memories/postgres.py:182-196 | hindsight-api-slim/hindsight_api/engine/memories/postgres.py:653-667 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:1792-1816 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:2253-2267 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:3436-3450 | hindsight-api-slim/hindsight_api/engine/retain/orchestrator.py:4401-4415 | hindsight-clients/python/hindsight_client/hindsight_client.py:743-757 | hindsight-clients/python/hindsight_client/hindsight_client.py:835-849 | hindsight-clients/python/hindsight_client/hindsight_client.py:1012-1026 | hindsight-clients/python/hindsight_client/hindsight_client.py:1185-1199 | hindsight-clients/python/hindsight_client/hindsight_client.py:3165-3179 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:295-309 | hindsight-integrations/haystack/hindsight_haystack/tools.py:596-610 | hindsight-integrations/haystack/hindsight_haystack/tools.py:731-745 | hindsight-integrations/litellm/hindsight_litellm/config.py:351-365 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:414-428 | hindsight-integrations/superagent/hindsight_superagent/config.py:103-117 — before extracting anything, compare `hindsight-integrations/haystack/hindsight_haystack/tools.py` and `hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 109 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memories/postgres.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.
Duplicated block (15 lines × 5) hindsight-integrations/autogen/hindsight_autogen/tools.py:155— hindsight-integrations/autogen/hindsight_autogen/tools.py:155-169 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py:157-171 | hindsight-integrations/google-adk/hindsight_google_adk/tools.py:130-144 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:164-178 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:152-166 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/tools.py` and `hindsight-integrations/google-adk/hindsight_google_adk/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 200 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-integrations/langgraph/hindsight_langgraph/tools.py:163` calls `_resolve_bank_id` and `hindsight-integrations/autogen/hindsight_autogen/tools.py:154` 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 (15 lines × 3) hindsight-api-slim/hindsight_api/engine/memory_engine.py:3230— hindsight-api-slim/hindsight_api/engine/memory_engine.py:3230-3244 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3340-3354 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3463-3477 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/engine/memory_engine.py:3230` it does not close everything it opens, so those exact lines 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–15 lines × 2) hindsight-api-slim/hindsight_api/admin/cli.py:989— hindsight-api-slim/hindsight_api/admin/cli.py:989-1000 | hindsight-api-slim/hindsight_api/admin/cli.py:1369-1383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–15 lines × 2) hindsight-api-slim/hindsight_api/api/http.py:6616— hindsight-api-slim/hindsight_api/api/http.py:6616-6628 | hindsight-api-slim/hindsight_api/api/http.py:6664-6678 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:6616` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–15 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2329— hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2329-2343 | hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:3320-3329 — both copies are in the same file, so extract the 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, `hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:3316` calls `get` and `hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2328` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–15 lines × 2) hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2454— hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:2454-2468 | hindsight-api-slim/hindsight_api/engine/retain/fact_extraction.py:3433-3446 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (29 lines × 2) hindsight-integrations/cursor/scripts/lib/config.py:125— hindsight-integrations/cursor/scripts/lib/config.py:125-153 | hindsight-integrations/omo/scripts/lib/config.py:102-130 — before extracting anything, compare `hindsight-integrations/cursor/scripts/lib/config.py` and `hindsight-integrations/omo/scripts/lib/config.py` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (12–14 lines × 5) hindsight-integrations/autogen/hindsight_autogen/_client.py:34— hindsight-integrations/autogen/hindsight_autogen/_client.py:34-45 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/_client.py:30-41 | hindsight-integrations/langgraph/hindsight_langgraph/_client.py:33-44 | hindsight-integrations/openai-agents/hindsight_openai_agents/_client.py:30-41 | hindsight-integrations/superagent/hindsight_superagent/_client.py:30-43 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/_client.py` and `hindsight-integrations/openai-agents/hindsight_openai_agents/_client.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 `api_key` to `str | None` in one and `Optional[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 (13–14 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:7956— hindsight-api-slim/hindsight_api/api/http.py:7956-7969 | hindsight-api-slim/hindsight_api/api/http.py:7990-8002 | hindsight-api-slim/hindsight_api/api/http.py:8020-8032 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/api/http.py:7956` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 6) hindsight-api-slim/hindsight_api/engine/memory_engine.py:3203— hindsight-api-slim/hindsight_api/engine/memory_engine.py:3203-3215 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3251-3263 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3305-3317 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3361-3373 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3436-3448 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:3484-3496 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/memory_engine.py:3203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 6) hindsight-integrations/ag2/hindsight_ag2/_client.py:27— hindsight-integrations/ag2/hindsight_ag2/_client.py:27-39 | hindsight-integrations/agno/hindsight_agno/tools.py:52-64 | hindsight-integrations/composio/hindsight_composio/tools.py:75-87 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:38-50 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:37-49 | hindsight-integrations/strands/hindsight_strands/tools.py:89-100 — before extracting anything, compare `hindsight-integrations/agno/hindsight_agno/tools.py` and `hindsight-integrations/composio/hindsight_composio/tools.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `api_key` to `Optional[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 (13 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:6173— hindsight-api-slim/hindsight_api/api/http.py:6173-6185 | hindsight-api-slim/hindsight_api/api/http.py:6269-6281 | hindsight-api-slim/hindsight_api/api/http.py:6309-6321 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/api/http.py:6173` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–13 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:8792— hindsight-api-slim/hindsight_api/api/http.py:8792-8802 | hindsight-api-slim/hindsight_api/api/http.py:8897-8909 | hindsight-api-slim/hindsight_api/api/http.py:8980-8991 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/api/http.py:8792` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–13 lines × 2) hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1408— hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1408-1420 | hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:1490-1499 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–13 lines × 2) hindsight-dev/hindsight_dev/cli_coverage_check.py:84— hindsight-dev/hindsight_dev/cli_coverage_check.py:84-94 | hindsight-dev/hindsight_dev/client_coverage_check.py:80-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-dev/hindsight_dev/cli_coverage_check.py:82` calls `add` and `hindsight-dev/hindsight_dev/client_coverage_check.py:79` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 6) hindsight-integrations/ag2/hindsight_ag2/_client.py:23— hindsight-integrations/ag2/hindsight_ag2/_client.py:23-34 | hindsight-integrations/agno/hindsight_agno/tools.py:48-59 | hindsight-integrations/composio/hindsight_composio/tools.py:71-82 | hindsight-integrations/google-adk/hindsight_google_adk/_client.py:30-41 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:34-45 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:33-44 — before extracting anything, compare `hindsight-integrations/ag2/hindsight_ag2/_client.py` and `hindsight-integrations/google-adk/hindsight_google_adk/_client.py` as WHOLE FILES: 82% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 `api_key` to `Optional[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 (12 lines × 4) hindsight-api-slim/hindsight_api/engine/db/oracle.py:1160— hindsight-api-slim/hindsight_api/engine/db/oracle.py:1160-1171 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1267-1278 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1309-1320 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1351-1362 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (10–12 lines × 4) hindsight-api-slim/hindsight_api/engine/memory_engine.py:14699— hindsight-api-slim/hindsight_api/engine/memory_engine.py:14699-14708 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:14934-14943 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:20091-20102 | hindsight-api-slim/hindsight_api/engine/memory_engine.py:22312-22323 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6–12 lines × 3) hindsight-api-slim/hindsight_api/api/http.py:8691— hindsight-api-slim/hindsight_api/api/http.py:8691-8696 | hindsight-api-slim/hindsight_api/api/http.py:8797-8808 | hindsight-api-slim/hindsight_api/api/http.py:8904-8915 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-api-slim/hindsight_api/api/http.py:8797` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–12 lines × 2) hindsight-integrations/litellm/hindsight_litellm/__init__.py:892— hindsight-integrations/litellm/hindsight_litellm/__init__.py:892-901 | hindsight-integrations/litellm/hindsight_litellm/wrappers.py:730-741 — 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 (11 lines × 8) hindsight-integrations/agent-framework/hindsight_agent_framework/_client.py:29— hindsight-integrations/agent-framework/hindsight_agent_framework/_client.py:29-44 | hindsight-integrations/autogen/hindsight_autogen/_client.py:25-40 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/_client.py:21-36 | hindsight-integrations/haystack/hindsight_haystack/_client.py:25-40 | hindsight-integrations/langgraph/hindsight_langgraph/_client.py:23-39 | hindsight-integrations/llamaindex/hindsight_llamaindex/_client.py:30-45 | hindsight-integrations/openai-agents/hindsight_openai_agents/_client.py:21-36 | hindsight-integrations/superagent/hindsight_superagent/_client.py:28-38 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/_client.py` and `hindsight-integrations/openai-agents/hindsight_openai_agents/_client.py` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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 `api_key` to `Optional[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 (11 lines × 5) hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:87— hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:87-98 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:51-63 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:157-169 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:75-85 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:100-110 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py` and `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:87` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 4) hindsight-api-slim/hindsight_api/mcp_tools.py:1076— hindsight-api-slim/hindsight_api/mcp_tools.py:1076-1086 | hindsight-api-slim/hindsight_api/mcp_tools.py:1135-1145 | hindsight-api-slim/hindsight_api/mcp_tools.py:1201-1211 | hindsight-api-slim/hindsight_api/mcp_tools.py:1261-1271 — 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.
Duplicated block (9–11 lines × 3) hindsight-api-slim/hindsight_api/engine/db/oracle.py:995— hindsight-api-slim/hindsight_api/engine/db/oracle.py:995-1003 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1014-1024 | hindsight-api-slim/hindsight_api/engine/db/oracle.py:1036-1047 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/engine/db/oracle.py:993` calls `join` and `hindsight-api-slim/hindsight_api/engine/db/oracle.py:1036` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9–11 lines × 2) hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/hooks.py:173— hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/hooks.py:173-183 | hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py:287-295 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 6) hindsight-api-slim/hindsight_api/api/http.py:8541— hindsight-api-slim/hindsight_api/api/http.py:8541-8558 | hindsight-api-slim/hindsight_api/api/http.py:8986-8996 | hindsight-api-slim/hindsight_api/api/http.py:10218-10236 | hindsight-api-slim/hindsight_api/api/http.py:10268-10277 | hindsight-api-slim/hindsight_api/api/http.py:10301-10310 | hindsight-api-slim/hindsight_api/api/http.py:10394-10404 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/api/http.py:8541` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/api/http.py:10266` calls `HTTPException` and `hindsight-api-slim/hindsight_api/api/http.py:10217` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 5) hindsight-integrations/agno/hindsight_agno/tools.py:336— hindsight-integrations/agno/hindsight_agno/tools.py:336-345 | hindsight-integrations/composio/hindsight_composio/tools.py:294-303 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:236-245 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:370-379 | hindsight-integrations/strands/hindsight_strands/tools.py:306-315 — before extracting anything, compare `hindsight-integrations/agno/hindsight_agno/tools.py` and `hindsight-integrations/composio/hindsight_composio/tools.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:713— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:713-721 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2195-2203 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2308-2317 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–10 lines × 2) hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:142— hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:142-151 | hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:159-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 5) hindsight-integrations/agno/hindsight_agno/tools.py:242— hindsight-integrations/agno/hindsight_agno/tools.py:242-250 | hindsight-integrations/autogen/hindsight_autogen/tools.py:169-177 | hindsight-integrations/langgraph/hindsight_langgraph/tools.py:178-186 | hindsight-integrations/smolagents/hindsight_smolagents/tools.py:179-187 | hindsight-integrations/strands/hindsight_strands/tools.py:212-220 — before extracting anything, compare `hindsight-integrations/agno/hindsight_agno/tools.py` and `hindsight-integrations/smolagents/hindsight_smolagents/tools.py` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 138 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, 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–9 lines × 4) hindsight-api-slim/hindsight_api/api/http.py:8639— hindsight-api-slim/hindsight_api/api/http.py:8639-8647 | hindsight-api-slim/hindsight_api/api/http.py:8691-8696 | hindsight-api-slim/hindsight_api/api/http.py:8797-8805 | hindsight-api-slim/hindsight_api/api/http.py:8904-8912 — 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 `hindsight-api-slim/hindsight_api/api/http.py:8639` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-api-slim/hindsight_api/api/http.py:8696` calls `_internal_error`, `post` and `hindsight-api-slim/hindsight_api/api/http.py:8647` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8–9 lines × 3) hindsight-integrations/devin-desktop/hindsight_devin_desktop/config.py:73— hindsight-integrations/devin-desktop/hindsight_devin_desktop/config.py:73-81 | hindsight-integrations/github-copilot/hindsight_copilot/config.py:55-62 | hindsight-integrations/openhands/hindsight_openhands/config.py:56-63 — before extracting anything, compare `hindsight-integrations/github-copilot/hindsight_copilot/config.py` and `hindsight-integrations/openhands/hindsight_openhands/config.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7–9 lines × 2) hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1718— hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1718-1726 | hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1738-1744 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/engine/chinese_temporal_periods.py:1738` it begins part-way through the construct above it, so those 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 (7–8 lines × 2) hindsight-dev/hindsight_dev/cli_coverage_check.py:103— hindsight-dev/hindsight_dev/cli_coverage_check.py:103-110 | hindsight-dev/hindsight_dev/client_coverage_check.py:247-253 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 12) hindsight-api-slim/hindsight_api/api/http.py:5466— hindsight-api-slim/hindsight_api/api/http.py:5466-5472 | hindsight-api-slim/hindsight_api/api/http.py:5528-5534 | hindsight-api-slim/hindsight_api/api/http.py:5559-5565 | hindsight-api-slim/hindsight_api/api/http.py:6346-6352 | hindsight-api-slim/hindsight_api/api/http.py:6779-6785 | hindsight-api-slim/hindsight_api/api/http.py:7274-7280 | hindsight-api-slim/hindsight_api/api/http.py:7348-7354 | hindsight-api-slim/hindsight_api/api/http.py:7380-7386 | hindsight-api-slim/hindsight_api/api/http.py:8281-8287 | hindsight-api-slim/hindsight_api/api/http.py:8327-8333 | hindsight-api-slim/hindsight_api/api/http.py:9263-9269 | hindsight-api-slim/hindsight_api/api/http.py:9328-9335 — all 12 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/api/http.py:5464` calls `_attach_to_memories` and `hindsight-api-slim/hindsight_api/api/http.py:5557` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 9) hindsight-api-slim/hindsight_api/api/http.py:5296— hindsight-api-slim/hindsight_api/api/http.py:5296-5302 | hindsight-api-slim/hindsight_api/api/http.py:6870-6876 | hindsight-api-slim/hindsight_api/api/http.py:6935-6941 | hindsight-api-slim/hindsight_api/api/http.py:7309-7315 | hindsight-api-slim/hindsight_api/api/http.py:7459-7465 | hindsight-api-slim/hindsight_api/api/http.py:7973-7979 | hindsight-api-slim/hindsight_api/api/http.py:8006-8012 | hindsight-api-slim/hindsight_api/api/http.py:8036-8042 | hindsight-api-slim/hindsight_api/api/http.py:8446-8452 — all 9 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/api/http.py:5294` calls `_attach_to_memories`, `get` and `hindsight-api-slim/hindsight_api/api/http.py:7457` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 7) hindsight-api-slim/hindsight_api/alembic/versions/a7b8c9d0e1f2_split_history_into_own_tables.py:146— hindsight-api-slim/hindsight_api/alembic/versions/a7b8c9d0e1f2_split_history_into_own_tables.py:146-150 | hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:87-98 | hindsight-api-slim/hindsight_api/alembic/versions/g2h3i4j5k6l7_remove_opinion_fact_type.py:35-42 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:44-51 | hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:136-145 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:39-57 | hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py:96-101 — before extracting anything, compare `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py` and `hindsight-api-slim/hindsight_api/alembic/versions/t5o6p7q8r9s0_rename_mental_models_to_observations.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the 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 `hindsight-api-slim/hindsight_api/alembic/versions/a7c2e9f41b60_attachment_belongs_to_document.py:87` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `hindsight-api-slim/hindsight_api/alembic/versions/g2h3i4j5k6l7_remove_opinion_fact_type.py:44` calls `execute` and `hindsight-api-slim/hindsight_api/alembic/versions/p1k2l3m4n5o6_new_knowledge_architecture.py:53` 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 × 5) hindsight-api-slim/hindsight_api/engine/cross_encoder.py:717— hindsight-api-slim/hindsight_api/engine/cross_encoder.py:717-721 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:1877-1881 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2199-2203 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2313-2317 | hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2594-2598 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2591` calls `get` and `hindsight-api-slim/hindsight_api/engine/cross_encoder.py:714` 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 (36 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/a1b2c3d4e5f6_add_file_storage_table.py:27— hindsight-api-slim/hindsight_api/alembic/versions/a1b2c3d4e5f6_add_file_storage_table.py:27-80 | hindsight-api-slim/hindsight_api/alembic/versions/q2l3m4n5o6p7_fix_mental_model_fact_type.py:25-60 — 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 `hindsight-api-slim/hindsight_api/alembic/versions/q2l3m4n5o6p7_fix_mental_model_fact_type.py:25` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 3) hindsight-api-slim/hindsight_api/alembic/versions/a2v3w4x5y6z7_add_last_refreshed_source_query.py:26— hindsight-api-slim/hindsight_api/alembic/versions/a2v3w4x5y6z7_add_last_refreshed_source_query.py:26-48 | hindsight-api-slim/hindsight_api/alembic/versions/b3w4x5y6z7a8_add_structured_content_to_mental_models.py:32-54 | hindsight-api-slim/hindsight_api/alembic/versions/c3d4e5f6g7h8_add_history_to_mental_models.py:21-40 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/alembic/versions/a2v3w4x5y6z7_add_last_refreshed_source_query.py:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28 lines × 3) hindsight-api-slim/hindsight_api/alembic/versions/a3b4c5d6e7f8_add_consolidation_failed_at_to_memory_units.py:25— hindsight-api-slim/hindsight_api/alembic/versions/a3b4c5d6e7f8_add_consolidation_failed_at_to_memory_units.py:25-62 | hindsight-api-slim/hindsight_api/alembic/versions/h3i4j5k6l7m8_merge_heads_and_add_unit_entities_index.py:25-52 | hindsight-api-slim/hindsight_api/alembic/versions/s4n5o6p7q8r9_add_consolidated_at_to_memory_units.py:25-63 — 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 (108 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/b2d4f6a8c1e3_repair_maintenance_routines_public.py:52— hindsight-api-slim/hindsight_api/alembic/versions/b2d4f6a8c1e3_repair_maintenance_routines_public.py:52-159 | hindsight-api-slim/hindsight_api/alembic/versions/c7e9f1a3b5d2_maintenance_routines_skip_vanished_schemas.py:46-161 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (21 lines × 3) hindsight-api-slim/hindsight_api/alembic/versions/b3c4d5e6f7a8_add_content_hash_to_chunks.py:21— hindsight-api-slim/hindsight_api/alembic/versions/b3c4d5e6f7a8_add_content_hash_to_chunks.py:21-42 | hindsight-api-slim/hindsight_api/alembic/versions/b57a7c9e0d13_add_bank_stats_cache.py:30-61 | hindsight-api-slim/hindsight_api/alembic/versions/z1u2v3w4x5y6_add_observation_tags_to_memory_units.py:25-45 — 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 (31 lines × 3) hindsight-api-slim/hindsight_api/alembic/versions/b8d3f1a6c2e4_add_mental_models_last_refresh_failed_at.py:28— hindsight-api-slim/hindsight_api/alembic/versions/b8d3f1a6c2e4_add_mental_models_last_refresh_failed_at.py:28-58 | hindsight-api-slim/hindsight_api/alembic/versions/d4f6a8c2e1b3_drop_archive_embedding_column.py:43-93 | hindsight-api-slim/hindsight_api/alembic/versions/e7c3a9f1b2d5_drop_archive_search_vector_column.py:46-96 — 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 (44 lines × 2) hindsight-api-slim/hindsight_api/alembic/versions/k6f7g8h9i0j1_add_directive_subtype.py:25— hindsight-api-slim/hindsight_api/alembic/versions/k6f7g8h9i0j1_add_directive_subtype.py:25-68 | hindsight-api-slim/hindsight_api/alembic/versions/w8r9s0t1u2v3_fix_mental_models_pk_isolation.py:27-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/alembic/versions/k6f7g8h9i0j1_add_directive_subtype.py:25` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 4) hindsight-api-slim/hindsight_api/alembic/versions/m8h9i0j1k2l3_mental_model_id_to_text.py:25— hindsight-api-slim/hindsight_api/alembic/versions/m8h9i0j1k2l3_mental_model_id_to_text.py:25-51 | hindsight-api-slim/hindsight_api/alembic/versions/r3m4n5o6p7q8_add_reflect_response_to_reflections.py:26-57 | hindsight-api-slim/hindsight_api/alembic/versions/u6p7q8r9s0t1_mental_models_text_id.py:24-51 | hindsight-api-slim/hindsight_api/alembic/versions/y0t1u2v3w4x5_add_result_metadata_gin_index.py:29-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `hindsight-api-slim/hindsight_api/alembic/versions/r3m4n5o6p7q8_add_reflect_response_to_reflections.py:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25 lines × 2) hindsight-api-slim/hindsight_api/daemon.py:49— hindsight-api-slim/hindsight_api/daemon.py:49-73 | hindsight-embed/hindsight_embed/daemon_embed_manager.py:190-224 — 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 `hindsight-embed/hindsight_embed/daemon_embed_manager.py:190` it does not close everything it opens, so those 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 (32 lines × 7) hindsight-integrations/ag2/hindsight_ag2/config.py:49— hindsight-integrations/ag2/hindsight_ag2/config.py:49-80 | hindsight-integrations/agno/hindsight_agno/config.py:50-81 | hindsight-integrations/crewai/hindsight_crewai/config.py:50-81 | hindsight-integrations/langgraph/hindsight_langgraph/config.py:49-80 | hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/config.py:50-81 | hindsight-integrations/smolagents/hindsight_smolagents/config.py:50-81 | hindsight-integrations/strands/hindsight_strands/config.py:50-81 — before extracting anything, compare `hindsight-integrations/ag2/hindsight_ag2/config.py` and `hindsight-integrations/langgraph/hindsight_langgraph/config.py` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (30 lines × 3) hindsight-integrations/autogen/hindsight_autogen/config.py:55— hindsight-integrations/autogen/hindsight_autogen/config.py:55-84 | hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/config.py:55-84 | hindsight-integrations/openai-agents/hindsight_openai_agents/config.py:55-84 — before extracting anything, compare `hindsight-integrations/autogen/hindsight_autogen/config.py` and `hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/config.py` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 × 4) hindsight-cli/src/commands/explore.rs:1081— hindsight-cli/src/commands/explore.rs:1081-1085 | hindsight-cli/src/commands/explore.rs:1158-1162 | hindsight-cli/src/commands/explore.rs:1257-1261 | hindsight-cli/src/commands/explore.rs:1433-1437 — 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 `hindsight-cli/src/commands/explore.rs:1081` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) hindsight-cli/src/commands/bank.rs:917— hindsight-cli/src/commands/bank.rs:917-927 | hindsight-cli/src/commands/bank.rs:929-939 | hindsight-cli/src/commands/bank.rs:953-963 — all 3 copies are in the same file, so extract the block into one function there and call 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 `hindsight-cli/src/commands/bank.rs:917` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) hindsight-docs/examples/api/directives.go:14— hindsight-docs/examples/api/directives.go:14-86 | hindsight-docs/examples/api/memories.go:15-142 | hindsight-docs/examples/api/memory-banks.go:17-314 | hindsight-docs/examples/api/mental-models.go:15-245 | hindsight-docs/examples/api/observation-tree.go:16-109 | hindsight-docs/examples/api/pages.go:15-145 — 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 (12–20 lines × 2) hindsight-docs/examples/api/memories.py:17— hindsight-docs/examples/api/memories.py:17-36 | hindsight-docs/examples/api/observation-tree.py:17-28 — 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 (15–18 lines × 2) hindsight-docs/examples/api/main-methods.go:13— hindsight-docs/examples/api/main-methods.go:13-27 | hindsight-docs/examples/api/retain.go:14-31 — 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 `hindsight-docs/examples/api/main-methods.go:13` it does not close everything it opens, so those exact lines 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 × 6) hindsight-docs/examples/api/directives.go:15— hindsight-docs/examples/api/directives.go:15-23 | hindsight-docs/examples/api/memories.go:16-24 | hindsight-docs/examples/api/memory-banks.go:18-26 | hindsight-docs/examples/api/mental-models.go:16-24 | hindsight-docs/examples/api/observation-tree.go:17-25 | hindsight-docs/examples/api/pages.go:16-24 — 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 6 call sites, so a change lands once.
P12 · CI test-gate honesty· CI test gate excludes suites by filter · ×1
CI test gate excludes suites by filter REDACTED:615— `npm test` drops 2 test(s) in 2 file(s) (e.g. `hindsight-integrations/coding-agents/src/dcode-plugin.e2e.test.ts`, `hindsight-integrations/coding-agents/src/harness.e2e.test.ts`), and no other gate runs them before merge. Run what it excludes in another job before merge (a complementary selection), or remove the exclusion.
Duplication concentrated across 15 sibling directories (29 clone groups) hindsight-control-plane/src/app/api/banks/[bankId]/mental-models/[mentalModelId]/history/route.ts:24— 29 duplicated blocks under hindsight-control-plane/src/app/api/ have copies in at least two of the sibling directories auth, banks, documents, entities, files, graph (+9 more sibling(s) not listed) — 23 of them are reported below, and 6 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 29 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 29 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 29 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 3 sibling directories (19 clone groups) hindsight-control-plane/src/components/mental-models-view.tsx:90— 19 duplicated blocks under hindsight-control-plane/src/ have copies in at least two of the sibling directories app, components, lib — 10 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 19 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 19 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 19 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 17 sibling directories (16 clone groups) hindsight-control-plane/src/app/api/banks/[bankId]/directives/route.ts:5— 16 duplicated blocks under hindsight-control-plane/src/app/api/banks/[bankId]/ have copies in at least two of the sibling directories aliases, attachments, audit-logs, clone, consolidate, consolidation-recover (+11 more sibling(s) not listed) — 13 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 16 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 5 sibling directories (7 clone groups) hindsight-control-plane/src/components/constellation.tsx:3— 7 duplicated blocks under the repository root have copies in at least two of the sibling directories hindsight-all-npm, hindsight-clients, hindsight-control-plane, hindsight-docs, hindsight-integrations — 2 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 7 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 8 sibling directories (7 clone groups) hindsight-integrations/ai-sdk/src/tools/index.ts:14— 7 of the duplicated blocks reported below have copies in at least two of the sibling directories ai-sdk, chat, coding-agents, eliza, eve, obsidian (+2 more sibling(s) not listed) under hindsight-integrations/. That concentration is one structural fact, not 7 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 7 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplication concentrated across 4 sibling directories (5 clone groups) hindsight-docs/src/components/ModelProviderSearch.tsx:88— 5 duplicated blocks under hindsight-docs/src/ have copies in at least two of the sibling directories components, data, pages, theme — 2 of them are reported below, and 3 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 5 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 5 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 5 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Wholesale file copy (1076 identical lines × 2 files) hindsight-control-plane/src/components/constellation.tsx:3— hindsight-control-plane/src/components/constellation.tsx:3 · hindsight-docs/src/components/constellation/Constellation.tsx:1 — these 2 files are line-for-line copies of one another — 1076 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (154 matched lines × 2 locations) · ×1
Duplicated block with local edits (154 matched lines × 2 locations) hindsight-control-plane/src/components/webhooks-view.tsx:693— hindsight-control-plane/src/components/webhooks-view.tsx:693 · hindsight-control-plane/src/components/webhooks-view.tsx:884 — the two spans are one implementation copied and then locally edited — 857 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (124 matched lines × 2 locations) · ×1
Duplicated block with local edits (124 matched lines × 2 locations) hindsight-control-plane/src/components/mental-models-view.tsx:776— hindsight-control-plane/src/components/mental-models-view.tsx:776 · hindsight-control-plane/src/components/mental-models-view.tsx:957 — the two spans are one implementation copied and then locally edited — 770 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (114 matched lines × 2 locations) · ×1
Duplicated block with local edits (114 matched lines × 2 locations) hindsight-control-plane/src/components/bank-stats-view.tsx:1075— hindsight-control-plane/src/components/bank-stats-view.tsx:1075 · hindsight-control-plane/src/components/knowledge-bank-home.tsx:121 — the two spans are one implementation copied and then locally edited — 567 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (71 matched lines × 2 locations) · ×1
Duplicated block with local edits (71 matched lines × 2 locations) hindsight-integrations/ai-sdk/src/tools/index.ts:14— hindsight-integrations/ai-sdk/src/tools/index.ts:14 · hindsight-integrations/chat/src/types.ts:9 — the two spans are one implementation copied and then locally edited — 368 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (69 lines × 2 locations) hindsight-control-plane/src/components/memory-detail-modal.tsx:322— hindsight-control-plane/src/components/memory-detail-modal.tsx:322 · hindsight-control-plane/src/components/memory-detail-modal.tsx:633 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication· Duplicated block with local edits (57 matched lines × 2 locations) · ×1
Duplicated block with local edits (57 matched lines × 2 locations) hindsight-docs/src/pages/integrations/index.tsx:167— hindsight-docs/src/pages/integrations/index.tsx:167 · hindsight-docs/src/pages/templates/index.tsx:170 — the two spans are one implementation copied and then locally edited — 402 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (51 lines × 2 locations) hindsight-control-plane/src/components/data-view.tsx:1129— hindsight-control-plane/src/components/data-view.tsx:1129 · hindsight-control-plane/src/components/mental-models-view.tsx:503 — the 2 copies are spread across 2 files, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
R10 · Code Duplication· Duplicated block with local edits (50 matched lines × 2 locations) · ×1
Duplicated block with local edits (50 matched lines × 2 locations) hindsight-control-plane/src/components/ui/alert-dialog.tsx:9— hindsight-control-plane/src/components/ui/alert-dialog.tsx:9 · hindsight-control-plane/src/components/ui/dialog.tsx:11 — the two spans are one implementation copied and then locally edited — 317 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (49 lines × 2 locations) hindsight-control-plane/src/components/entities-view.tsx:399— hindsight-control-plane/src/components/entities-view.tsx:399 · hindsight-control-plane/src/components/webhooks-view.tsx:635 — the 2 copies are spread across 2 files, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
Duplicated block (45 lines × 4 locations) hindsight-control-plane/src/components/documents-view.tsx:1869— hindsight-control-plane/src/components/documents-view.tsx:1869 · hindsight-control-plane/src/components/entities-view.tsx:402 · hindsight-control-plane/src/components/ui/pagination.tsx:31 · hindsight-control-plane/src/components/webhooks-view.tsx:638 — the 4 copies are spread across 4 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication· Duplicated block with local edits (45 matched lines × 2 locations) · ×1
Duplicated block with local edits (45 matched lines × 2 locations) hindsight-integrations/chat/src/types.ts:4— hindsight-integrations/chat/src/types.ts:4 · hindsight-integrations/eliza/src/client.ts:10 — the two spans are one implementation copied and then locally edited — 243 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (44 lines × 2 locations) hindsight-integrations/coding-agents/src/installer.ts:601— hindsight-integrations/coding-agents/src/installer.ts:601 · hindsight-integrations/coding-agents/src/installer.ts:1833 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication· Duplicated block with local edits (43 matched lines × 2 locations) · ×1
Duplicated block with local edits (43 matched lines × 2 locations) hindsight-integrations/eve/src/client.ts:14— hindsight-integrations/eve/src/client.ts:14 · hindsight-integrations/paperclip/src/client.ts:9 — the two spans are one implementation copied and then locally edited — 280 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (42 lines × 2 locations) hindsight-control-plane/src/app/api/memories/[memoryId]/history/route.ts:5— hindsight-control-plane/src/app/api/memories/[memoryId]/history/route.ts:5 · hindsight-control-plane/src/app/api/memories/[memoryId]/route.ts:5 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (39 matched lines × 2 locations) · ×1
Duplicated block with local edits (39 matched lines × 2 locations) hindsight-control-plane/src/components/memory-detail-modal.tsx:104— hindsight-control-plane/src/components/memory-detail-modal.tsx:104 · hindsight-control-plane/src/components/mental-model-detail-modal.tsx:862 — the two spans are one implementation copied and then locally edited — 250 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (38 lines × 3 locations) hindsight-control-plane/src/app/api/banks/[bankId]/aliases/route.ts:43— hindsight-control-plane/src/app/api/banks/[bankId]/aliases/route.ts:43 · hindsight-control-plane/src/app/api/banks/[bankId]/directives/route.ts:63 · hindsight-control-plane/src/app/api/banks/[bankId]/mental-models/route.ts:71 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (37 lines × 4 locations) hindsight-control-plane/src/app/api/banks/[bankId]/audit-logs/route.ts:5— hindsight-control-plane/src/app/api/banks/[bankId]/audit-logs/route.ts:5 · hindsight-control-plane/src/app/api/banks/[bankId]/audit-logs/stats/route.ts:5 · hindsight-control-plane/src/app/api/banks/[bankId]/llm-requests/route.ts:5 · hindsight-control-plane/src/app/api/banks/[bankId]/llm-requests/stats/route.ts:5 — the 4 copies are spread across 4 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (36 lines × 2 locations) hindsight-control-plane/src/app/api/banks/[bankId]/route.ts:6— hindsight-control-plane/src/app/api/banks/[bankId]/route.ts:6 · hindsight-control-plane/src/app/api/banks/[bankId]/route.ts:43 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35 lines × 2 locations) hindsight-control-plane/src/components/search-debug-view.tsx:281— hindsight-control-plane/src/components/search-debug-view.tsx:281 · hindsight-control-plane/src/components/think-view.tsx:203 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (33 lines × 2 locations) hindsight-control-plane/src/app/api/banks/[bankId]/directives/[directiveId]/route.ts:58— hindsight-control-plane/src/app/api/banks/[bankId]/directives/[directiveId]/route.ts:58 · hindsight-control-plane/src/app/api/banks/[bankId]/mental-models/[mentalModelId]/route.ts:58 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (32 lines × 2 locations) hindsight-control-plane/src/components/audit-logs-view.tsx:429— hindsight-control-plane/src/components/audit-logs-view.tsx:429 · hindsight-control-plane/src/components/llm-requests-view.tsx:1211 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication· Duplicated block with local edits (32 matched lines × 2 locations) · ×1
Duplicated block with local edits (32 matched lines × 2 locations) hindsight-control-plane/src/components/mental-models-view.tsx:90— hindsight-control-plane/src/components/mental-models-view.tsx:90 · hindsight-control-plane/src/lib/api.ts:312 — the two spans are one implementation copied and then locally edited — 177 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (31 lines × 2 locations) hindsight-control-plane/src/components/document-chunk-modal.tsx:112— hindsight-control-plane/src/components/document-chunk-modal.tsx:112 · hindsight-control-plane/src/components/document-chunk-modal.tsx:177 — all 2 copies are in the same file, and the CITED SPAN is a run of DECLARATIONS inside a construct — the members of a type, or the entries of an object or array literal — with no statement anywhere in it. Do not read this as an extract-a-helper row: nothing here executes, so there is no call site, and a call expression cannot stand where a member declaration or a literal's entry was. What repeats is a SHAPE, and which shape decides the move. Where the copies declare the same members, the repetition is a missing common ancestor: give it a base type, an interface both extend, a generic instantiated twice, or — where the copies are a literal's entries rather than a type's members — one shared constant each site spreads or refers to, so the set is written once. Where they declare DIFFERENT members and only the form is shared — a decorator and its options, an annotation, a registration table's keys — the form is prescribed by a framework or a schema rather than copied, and the only collapse available is to generate the declarations from that schema; where you do not own the generator, this is the cost of the framework and there is nothing to extract. Check which of the two it is before acting: these copies still drift apart the first time only one of them is edited, which is why the repetition is reported, but the sentence to act on is not the same in both cases.
R10 · Code Duplication· Duplicated block with local edits (31 matched lines × 2 locations) · ×1
Duplicated block with local edits (31 matched lines × 2 locations) hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:160— hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:160 · hindsight-integrations/coding-agents/src/core/transcript.ts:65 — the two spans are one implementation copied and then locally edited — 258 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (26 lines × 3 locations) hindsight-control-plane/src/components/data-view.tsx:810— hindsight-control-plane/src/components/data-view.tsx:810 · hindsight-control-plane/src/components/entities-view.tsx:278 · hindsight-control-plane/src/components/mental-models-view.tsx:356 — the 3 copies are spread across 3 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Complex function (anonymous) (cyclomatic 106, cognitive 185) hindsight-control-plane/src/components/constellation.tsx:590— (anonymous) has cyclomatic complexity 106 and cognitive complexity 185; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 100, cognitive 179) hindsight-docs/src/components/constellation/Constellation.tsx:592— (anonymous) has cyclomatic complexity 100 and cognitive complexity 179; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function DocumentsView (cyclomatic 89, cognitive 81) hindsight-control-plane/src/components/documents-view.tsx:715— DocumentsView has cyclomatic complexity 89 and cognitive complexity 81; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function BankPage (cyclomatic 83, cognitive 67) hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:104— BankPage has cyclomatic complexity 83 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 80, cognitive 97) REDACTED:3023— (anonymous) has cyclomatic complexity 80 and cognitive complexity 97; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 71, cognitive 79) REDACTED:2726— (anonymous) has cyclomatic complexity 71 and cognitive complexity 79; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function DataView (cyclomatic 65, cognitive 55) hindsight-control-plane/src/components/data-view.tsx:115— DataView has cyclomatic complexity 65 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function MemoryDetailModal (cyclomatic 64, cognitive 55) hindsight-control-plane/src/components/memory-detail-modal.tsx:78— MemoryDetailModal has cyclomatic complexity 64 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function updateBankConfig (cyclomatic 63, cognitive 62) hindsight-clients/typescript/src/index.ts:923— updateBankConfig has cyclomatic complexity 63 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getPluginConfig (cyclomatic 61, cognitive 60) REDACTED:2118— getPluginConfig has cyclomatic complexity 61 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function BankSelectorInner (cyclomatic 57, cognitive 52) hindsight-control-plane/src/components/bank-selector.tsx:129— BankSelectorInner has cyclomatic complexity 57 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ThinkView (cyclomatic 54, cognitive 47) hindsight-control-plane/src/components/think-view.tsx:72— ThinkView has cyclomatic complexity 54 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function BankOperationsView (cyclomatic 52, cognitive 41) hindsight-control-plane/src/components/bank-operations-view.tsx:143— BankOperationsView has cyclomatic complexity 52 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function buildSessionStartContext (cyclomatic 47, cognitive 122) hindsight-integrations/coding-agents/src/core/session-start.ts:170— buildSessionStartContext has cyclomatic complexity 47 and cognitive complexity 122; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function resolveConfig (cyclomatic 46, cognitive 44) hindsight-integrations/coding-agents/src/core/config.ts:589— resolveConfig has cyclomatic complexity 46 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function PagesView (cyclomatic 43, cognitive 38) hindsight-control-plane/src/components/pages-view.tsx:101— PagesView has cyclomatic complexity 43 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function buildHookOutput (cyclomatic 39, cognitive 55) hindsight-integrations/coding-agents/src/core/hook.ts:233— buildHookOutput has cyclomatic complexity 39 and cognitive complexity 55; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function resolveAndCacheIdentity (cyclomatic 38, cognitive 31) REDACTED:1432— resolveAndCacheIdentity has cyclomatic complexity 38 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 37, cognitive 14) hindsight-docs/src/components/SkillBanner.tsx:38— (anonymous) has cyclomatic complexity 37 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function BankConfigView (cyclomatic 36, cognitive 35) hindsight-control-plane/src/components/bank-config-view.tsx:467— BankConfigView has cyclomatic complexity 36 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function SearchDebugView (cyclomatic 36, cognitive 28) hindsight-control-plane/src/components/search-debug-view.tsx:109— SearchDebugView has cyclomatic complexity 36 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function readPyValue (cyclomatic 35, cognitive 84) hindsight-integrations/coding-agents/src/core/transcript-dcode.ts:49— readPyValue has cyclomatic complexity 35 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ConfigurationTab (cyclomatic 34, cognitive 32) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:1348— ConfigurationTab has cyclomatic complexity 34 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function StalenessBadge (cyclomatic 33, cognitive 43) hindsight-control-plane/src/components/staleness-badge.tsx:42— StalenessBadge has cyclomatic complexity 33 and cognitive complexity 43; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function writeSession (cyclomatic 32, cognitive 33) hindsight-integrations/coding-agents/src/core/chat.ts:316— writeSession has cyclomatic complexity 32 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function readCodexTranscript (cyclomatic 31, cognitive 48) hindsight-integrations/coding-agents/src/core/transcript-codex.ts:195— readCodexTranscript has cyclomatic complexity 31 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function SpanDetails (cyclomatic 30, cognitive 25) hindsight-control-plane/src/components/llm-requests-view.tsx:359— SpanDetails has cyclomatic complexity 30 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function runCli (cyclomatic 28, cognitive 42) hindsight-integrations/openclaw/src/backfill.ts:436— runCli has cyclomatic complexity 28 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function flushRetainQueue (cyclomatic 28, cognitive 33) REDACTED:418— flushRetainQueue has cyclomatic complexity 28 and cognitive complexity 33; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getIdentitySkipReason (cyclomatic 28, cognitive 32) REDACTED:1531— getIdentitySkipReason has cyclomatic complexity 28 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function runHook (cyclomatic 28, cognitive 28) hindsight-integrations/coding-agents/src/core/hook.ts:425— runHook has cyclomatic complexity 28 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function MentalModelDetailModal (cyclomatic 28, cognitive 27) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:824— MentalModelDetailModal has cyclomatic complexity 28 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function start (cyclomatic 27, cognitive 45) REDACTED:2324— start has cyclomatic complexity 27 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function run (cyclomatic 27, cognitive 37) · ×1
Complex function run (cyclomatic 27, cognitive 37) hindsight-integrations/coding-agents/src/installer.ts:2421— run has cyclomatic complexity 27 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function ObservationTreeView (cyclomatic 27, cognitive 27) REDACTED:356— ObservationTreeView has cyclomatic complexity 27 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function diffLines (cyclomatic 26, cognitive 47) hindsight-control-plane/src/components/mental-model-detail-modal.tsx:430— diffLines has cyclomatic complexity 26 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function main (cyclomatic 26, cognitive 47) · ×1
Complex function main (cyclomatic 26, cognitive 47) hindsight-integrations/coding-agents/src/deepen.ts:114— main has cyclomatic complexity 26 and cognitive complexity 47; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function fetchApi (cyclomatic 26, cognitive 40) hindsight-control-plane/src/lib/api.ts:521— fetchApi has cyclomatic complexity 26 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
REDACTED: 3590 lines of code REDACTED:1— REDACTED has 3590 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/bank-config-view.tsx · ×1
hindsight-control-plane/src/components/bank-config-view.tsx: 3000 lines of code hindsight-control-plane/src/components/bank-config-view.tsx:1— hindsight-control-plane/src/components/bank-config-view.tsx has 3000 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/lib/api.ts · ×1
hindsight-control-plane/src/lib/api.ts: 2672 lines of code hindsight-control-plane/src/lib/api.ts:1— hindsight-control-plane/src/lib/api.ts has 2672 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/coding-agents/src/installer.ts · ×1
hindsight-integrations/coding-agents/src/installer.ts: 2476 lines of code hindsight-integrations/coding-agents/src/installer.ts:1— hindsight-integrations/coding-agents/src/installer.ts has 2476 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/documents-view.tsx · ×1
hindsight-control-plane/src/components/documents-view.tsx: 2339 lines of code hindsight-control-plane/src/components/documents-view.tsx:1— hindsight-control-plane/src/components/documents-view.tsx has 2339 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-clients/typescript/src/index.ts · ×1
hindsight-clients/typescript/src/index.ts: 2183 lines of code hindsight-clients/typescript/src/index.ts:1— hindsight-clients/typescript/src/index.ts has 2183 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/bank-selector.tsx · ×1
hindsight-control-plane/src/components/bank-selector.tsx: 1778 lines of code hindsight-control-plane/src/components/bank-selector.tsx:1— hindsight-control-plane/src/components/bank-selector.tsx has 1778 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/constellation.tsx · ×1
hindsight-control-plane/src/components/constellation.tsx: 1669 lines of code hindsight-control-plane/src/components/constellation.tsx:1— hindsight-control-plane/src/components/constellation.tsx has 1669 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-docs/src/components/constellation/Constellation.tsx · ×1
hindsight-docs/src/components/constellation/Constellation.tsx: 1622 lines of code hindsight-docs/src/components/constellation/Constellation.tsx:1— hindsight-docs/src/components/constellation/Constellation.tsx has 1622 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/mental-model-detail-modal.tsx · ×1
hindsight-control-plane/src/components/mental-model-detail-modal.tsx: 1548 lines of code hindsight-control-plane/src/components/mental-model-detail-modal.tsx:1— hindsight-control-plane/src/components/mental-model-detail-modal.tsx has 1548 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/data-view.tsx · ×1
hindsight-control-plane/src/components/data-view.tsx: 1520 lines of code hindsight-control-plane/src/components/data-view.tsx:1— hindsight-control-plane/src/components/data-view.tsx has 1520 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/prompt-preview-dialog.tsx · ×1
hindsight-control-plane/src/components/prompt-preview-dialog.tsx: 1274 lines of code hindsight-control-plane/src/components/prompt-preview-dialog.tsx:1— hindsight-control-plane/src/components/prompt-preview-dialog.tsx has 1274 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/bank-stats-view.tsx · ×1
hindsight-control-plane/src/components/bank-stats-view.tsx: 1271 lines of code hindsight-control-plane/src/components/bank-stats-view.tsx:1— hindsight-control-plane/src/components/bank-stats-view.tsx has 1271 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/search-debug-view.tsx · ×1
hindsight-control-plane/src/components/search-debug-view.tsx: 1269 lines of code hindsight-control-plane/src/components/search-debug-view.tsx:1— hindsight-control-plane/src/components/search-debug-view.tsx has 1269 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/llm-requests-view.tsx · ×1
hindsight-control-plane/src/components/llm-requests-view.tsx: 1250 lines of code hindsight-control-plane/src/components/llm-requests-view.tsx:1— hindsight-control-plane/src/components/llm-requests-view.tsx has 1250 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/coding-agents/src/core/hindsight.ts · ×1
hindsight-integrations/coding-agents/src/core/hindsight.ts: 1233 lines of code hindsight-integrations/coding-agents/src/core/hindsight.ts:1— hindsight-integrations/coding-agents/src/core/hindsight.ts has 1233 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/mental-models-view.tsx · ×1
hindsight-control-plane/src/components/mental-models-view.tsx: 1188 lines of code hindsight-control-plane/src/components/mental-models-view.tsx:1— hindsight-control-plane/src/components/mental-models-view.tsx has 1188 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/pages-view.tsx · ×1
hindsight-control-plane/src/components/pages-view.tsx: 1151 lines of code hindsight-control-plane/src/components/pages-view.tsx:1— hindsight-control-plane/src/components/pages-view.tsx has 1151 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/webhooks-view.tsx · ×1
hindsight-control-plane/src/components/webhooks-view.tsx: 1143 lines of code hindsight-control-plane/src/components/webhooks-view.tsx:1— hindsight-control-plane/src/components/webhooks-view.tsx has 1143 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/bank-operations-view.tsx · ×1
hindsight-control-plane/src/components/bank-operations-view.tsx: 1115 lines of code hindsight-control-plane/src/components/bank-operations-view.tsx:1— hindsight-control-plane/src/components/bank-operations-view.tsx has 1115 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/think-view.tsx · ×1
hindsight-control-plane/src/components/think-view.tsx: 1015 lines of code hindsight-control-plane/src/components/think-view.tsx:1— hindsight-control-plane/src/components/think-view.tsx has 1015 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/bank-profile-view.tsx · ×1
hindsight-control-plane/src/components/bank-profile-view.tsx: 960 lines of code hindsight-control-plane/src/components/bank-profile-view.tsx:1— hindsight-control-plane/src/components/bank-profile-view.tsx has 960 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/coding-agents/src/core/config.ts · ×1
hindsight-integrations/coding-agents/src/core/config.ts: 932 lines of code hindsight-integrations/coding-agents/src/core/config.ts:1— hindsight-integrations/coding-agents/src/core/config.ts has 932 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx · ×1
hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx: 923 lines of code hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx:1— hindsight-control-plane/src/app/[locale]/banks/[bankId]/page.tsx has 923 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/memory-detail-modal.tsx · ×1
hindsight-control-plane/src/components/memory-detail-modal.tsx: 855 lines of code hindsight-control-plane/src/components/memory-detail-modal.tsx:1— hindsight-control-plane/src/components/memory-detail-modal.tsx has 855 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/coding-agents/src/harness/hook-lifecycle.ts · ×1
hindsight-integrations/coding-agents/src/harness/hook-lifecycle.ts: 782 lines of code hindsight-integrations/coding-agents/src/harness/hook-lifecycle.ts:1— hindsight-integrations/coding-agents/src/harness/hook-lifecycle.ts has 782 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/coding-agents/src/core/missions.ts · ×1
hindsight-integrations/coding-agents/src/core/missions.ts: 724 lines of code hindsight-integrations/coding-agents/src/core/missions.ts:1— hindsight-integrations/coding-agents/src/core/missions.ts has 724 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 669 lines of code REDACTED:1— REDACTED has 669 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/openclaw/src/backfill.ts · ×1
hindsight-integrations/openclaw/src/backfill.ts: 631 lines of code hindsight-integrations/openclaw/src/backfill.ts:1— hindsight-integrations/openclaw/src/backfill.ts has 631 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/mental-model-trigger-fields.tsx · ×1
hindsight-control-plane/src/components/mental-model-trigger-fields.tsx: 618 lines of code hindsight-control-plane/src/components/mental-model-trigger-fields.tsx:1— hindsight-control-plane/src/components/mental-model-trigger-fields.tsx has 618 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/knowledge-documents-view.tsx · ×1
hindsight-control-plane/src/components/knowledge-documents-view.tsx: 611 lines of code hindsight-control-plane/src/components/knowledge-documents-view.tsx:1— hindsight-control-plane/src/components/knowledge-documents-view.tsx has 611 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/audit-logs-view.tsx · ×1
hindsight-control-plane/src/components/audit-logs-view.tsx: 539 lines of code hindsight-control-plane/src/components/audit-logs-view.tsx:1— hindsight-control-plane/src/components/audit-logs-view.tsx has 539 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/openclaw/src/setup.ts · ×1
hindsight-integrations/openclaw/src/setup.ts: 519 lines of code hindsight-integrations/openclaw/src/setup.ts:1— hindsight-integrations/openclaw/src/setup.ts has 519 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/entities-view.tsx · ×1
hindsight-control-plane/src/components/entities-view.tsx: 517 lines of code hindsight-control-plane/src/components/entities-view.tsx:1— hindsight-control-plane/src/components/entities-view.tsx has 517 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/knowledge-document-dialog.tsx · ×1
hindsight-control-plane/src/components/knowledge-document-dialog.tsx: 509 lines of code hindsight-control-plane/src/components/knowledge-document-dialog.tsx:1— hindsight-control-plane/src/components/knowledge-document-dialog.tsx has 509 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx · ×1
hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx: 502 lines of code hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx:1— hindsight-embed/hindsight_embed/control_center/ui/src/app.jsx has 502 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/knowledge-write-dialogs.tsx · ×1
hindsight-control-plane/src/components/knowledge-write-dialogs.tsx: 498 lines of code hindsight-control-plane/src/components/knowledge-write-dialogs.tsx:1— hindsight-control-plane/src/components/knowledge-write-dialogs.tsx has 498 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-control-plane/src/components/banks-overview.tsx · ×1
hindsight-control-plane/src/components/banks-overview.tsx: 496 lines of code hindsight-control-plane/src/components/banks-overview.tsx:1— hindsight-control-plane/src/components/banks-overview.tsx has 496 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/coding-agents/src/core/history.ts · ×1
hindsight-integrations/coding-agents/src/core/history.ts: 486 lines of code hindsight-integrations/coding-agents/src/core/history.ts:1— hindsight-integrations/coding-agents/src/core/history.ts has 486 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· hindsight-integrations/coding-agents/src/core/hook.ts · ×1
hindsight-integrations/coding-agents/src/core/hook.ts: 482 lines of code hindsight-integrations/coding-agents/src/core/hook.ts:1— hindsight-integrations/coding-agents/src/core/hook.ts has 482 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Dead file (~1774 LoC) hindsight-docs/src/components/constellation/Constellation.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/MemoryConstellation.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~245 LoC) hindsight-docs/src/components/SkillBanner.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~231 LoC) hindsight-docs/src/components/CodingAgentsChart.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/HomeFlow.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~202 LoC) hindsight-docs/src/components/HomeFlow.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~176 LoC) hindsight-docs/src/data/modelProviders.ts— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/ModelProviderSearch.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~136 LoC) hindsight-docs/src/components/CookbookGrid.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~129 LoC) hindsight-docs/src/lib/integration-groups.ts— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~127 LoC) hindsight-docs/src/components/ModelProviderSearch.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~119 LoC) hindsight-docs/src/components/HomeHero.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~116 LoC) hindsight-docs/src/components/ImageCarousel.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~110 LoC) REDACTED— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~106 LoC) hindsight-integrations/coding-agents/src/core/sync.ts— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~86 LoC) hindsight-docs/src/data/llmProviders.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 4 in-repo import(s) from 4 other file(s) do name it (hindsight-docs/src/components/LLMProviderCapabilities.tsx, hindsight-docs/src/components/LLMProvidersTable.tsx, hindsight-docs/src/components/SupportedGrids.tsx and 1 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~85 LoC) hindsight-docs/src/components/MemoryConstellation.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/HomeHero.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~70 LoC) hindsight-docs/src/lib/coding-agent-harnesses.ts— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/lib/integration-groups.ts) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~68 LoC) hindsight-docs/src/lib/integrations.ts— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~64 LoC) hindsight-docs/src/components/ZoomableMedia.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~59 LoC) hindsight-docs/src/components/useGitHubStars.ts— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/HomeHero.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~56 LoC) hindsight-docs/src/components/ProviderSetup.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/ModelProviderSearch.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~53 LoC) hindsight-docs/src/components/YouTubeVideo.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~41 LoC) hindsight-docs/src/components/IconGrid.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), but 1 in-repo import(s) from 1 other file(s) do name it (hindsight-docs/src/components/SupportedGrids.tsx) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
Dead file (~36 LoC) hindsight-docs/src/components/LLMProviderCapabilities.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~32 LoC) hindsight-docs/src/components/LLMProvidersTable.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~25 LoC) hindsight-docs/src/components/PageHero.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~22 LoC) hindsight-docs/src/components/SupportedGrids.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~18 LoC) hindsight-integrations/coding-agents/src/core/attribution.ts— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~15 LoC) hindsight-docs/src/components/Figure.tsx— no import path from any entry point (246 application, 99 tooling, 268 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Unlisted import '@docusaurus/plugin-content-docs' hindsight-docs/sidebars-integrations.ts:1— Imported only as a TYPE and declared in no reachable package.json. The import is erased at compile time, so nothing is installed and no runtime resolution depends on it — but type-checking a clean clone will fail. Declare the typings it resolves through (or the package itself) in the owning package.json.
Unused dependency '@opencode-ai/sdk' hindsight-integrations/coding-agents/package.json:102— Declared in hindsight-integrations/coding-agents/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
X1 · Async correctness· Task from `loop.create_task` is not kept · ×1
Task from `loop.create_task` is not kept hindsight-clients/python/hindsight_client/hindsight_client.py:460— The task this creates is not kept anywhere. The event loop holds only a weak reference to its tasks, so a task nobody references can be garbage-collected before it finishes (Python's documentation for `asyncio.create_task`: save a reference to the result); and nothing ever awaits it, so an exception it raises is never handled — it surfaces, if at all, as "Task exception was never retrieved" in a log. Keep the task: `await` it, gather it, start it in an `asyncio.TaskGroup` (`async with asyncio.TaskGroup() as tg: tg.create_task(…)`), or, for genuine fire-and-forget, add it to a set and `task.add_done_callback(tasks.discard)` with a callback that also reads its exception.
X25 · Inert configuration knob· Option is kept and never read · ×1
Option is kept and never read hindsight-integrations/coding-agents/src/core/session-start.ts:189— `buildSessionStartContext` accepts `args.stateDir` from the caller and keeps it in `stateDir` on line 189, where only it can read the value — but nothing ever reads `stateDir`. Setting `args.stateDir` therefore changes nothing: every caller gets the same behaviour whatever they pass, and nothing reports that the option was ignored. Read `stateDir` where the behaviour it configures is decided — or, if the behaviour genuinely is fixed, remove `args.stateDir` from the accepted options so callers stop setting a knob that does nothing.
Orphaned file hindsight-integrations/llamaindex/hindsight_llamaindex/tools.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 hindsight-integrations/openai-agents/hindsight_openai_agents/tools.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 hindsight-integrations/cursor/scripts/lib/content.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 hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.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 hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.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 REDACTED: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 hindsight-integrations/omo/demo.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 hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/hooks.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 hindsight-integrations/ag2/hindsight_ag2/tools.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 hindsight-integrations/autogen/hindsight_autogen/tools.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 hindsight-integrations/cursor/scripts/session_start.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 hindsight-integrations/openhands/hindsight_openhands/cli.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 hindsight-integrations/omo/scripts/retain.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 hindsight-integrations/github-copilot/hindsight_copilot/cli.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 hindsight-integrations/cursor/scripts/lib/config.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 hindsight-integrations/omo/scripts/recall.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 hindsight-integrations/omo/scripts/lib/content.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 hindsight-api-slim/hindsight_api/alembic/versions/b8c9d0e1f2a3_vchord_cosine_opclass.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 hindsight-integrations/openclaw/src/bank-defaults.ts: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 hindsight-integrations/cursor/scripts/lib/llm.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 hindsight-integrations/continue/hindsight_continue/server.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 hindsight-integrations/cursor/scripts/lib/rules_file.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 hindsight-integrations/continue/hindsight_continue/config.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 hindsight-integrations/openhands/hindsight_openhands/openhands_config.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 hindsight-integrations/continue/hindsight_continue/provider.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.
Duplicated predicate hindsight-control-plane/src/components/data-view.tsx:408— `!Number.isFinite(minT) || !Number.isFinite(maxT) || maxT === minT` appears character-identically in 2 files — hindsight-control-plane/src/components/data-view.tsx, hindsight-control-plane/src/components/entities-view.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/constellation.tsx:737— `(ax < -margin && bx < -margin) || (ax > W + margin && bx > W + margin) || (ay < -margin && by < -margin) || (ay > H + margin && by > H + mar…` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/zapier/authentication.js:20— `(bundle.authData && bundle.authData.apiUrl) || DEFAULT_API_URL` appears character-identically in 2 files — hindsight-integrations/zapier/authentication.js, hindsight-integrations/zapier/utils.js. 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 hindsight-control-plane/src/components/constellation.tsx:439— `(ck != null && clusterColorFn?.(ck)) || nodeColorFn?.(node) || node.color || DEFAULT_NODE_COLOR` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/flowise/nodes/tools/HindsightRecall/HindsightRecall.ts:89— `(nodeData.inputs?.bankId as string) || ""` appears character-identically in 3 files — hindsight-integrations/flowise/nodes/tools/HindsightRecall/HindsightRecall.ts, hindsight-integrations/flowise/nodes/tools/HindsightReflect/HindsightReflect.ts, hindsight-integrations/flowise/nodes/tools/HindsightRetain/HindsightRetain.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/flowise/nodes/tools/HindsightRecall/HindsightRecall.ts:90— `(nodeData.inputs?.budget as string) || "mid"` appears character-identically in 2 files — hindsight-integrations/flowise/nodes/tools/HindsightRecall/HindsightRecall.ts, hindsight-integrations/flowise/nodes/tools/HindsightReflect/HindsightReflect.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/coding-agents/src/core/transcript-droid.ts:54— `b.type === "text" && typeof b.text === "string"` appears character-identically in 2 files — hindsight-integrations/coding-agents/src/core/transcript-droid.ts, hindsight-integrations/coding-agents/src/core/transcript.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/coding-agents/src/core/transcript-droid.ts:57— `b.type === "tool_use" && typeof b.name === "string"` appears character-identically in 2 files — hindsight-integrations/coding-agents/src/core/transcript-droid.ts, hindsight-integrations/coding-agents/src/core/transcript.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/bank-selector.tsx:823— `bank.last_write_at || bank.last_document_at` appears character-identically in 2 files — hindsight-control-plane/src/components/bank-selector.tsx, hindsight-control-plane/src/components/banks-overview.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/coding-agents/src/core/status.ts:87— `behind !== null && (!best || behind < best.behind)` appears character-identically in 2 files — hindsight-integrations/coding-agents/src/core/status.ts, hindsight-integrations/coding-agents/src/deepen.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/coding-agents/src/core/transcript-pi.ts:59— `block.type === "text" && typeof block.text === "string"` appears character-identically in 2 files — hindsight-integrations/coding-agents/src/core/transcript-pi.ts, hindsight-integrations/openclaw/src/session-file.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/coding-agents/src/core/transcript-cursor.ts:31— `block?.type === "text" && typeof block.text === "string"` appears character-identically in 3 files — hindsight-integrations/coding-agents/src/core/transcript-cursor.ts, hindsight-integrations/coding-agents/src/core/transcript-dsh.ts, hindsight-integrations/coding-agents/src/core/transcript-kimi.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/app/api/recall/route.ts:8— `body.bank_id || body.agent_id || "default"` appears character-identically in 2 files — hindsight-control-plane/src/app/api/recall/route.ts, hindsight-control-plane/src/app/api/reflect/route.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/constellation.tsx:527— `clusterColorFn?.(key) || DEFAULT_NODE_COLOR` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/constellation.tsx:991— `compactLabels || zoom > 0.5 || isNeighbor` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/zed/src/config.js:54— `data && typeof data === "object" && !Array.isArray(data)` appears character-identically in 2 files — hindsight-integrations/zed/src/config.js, hindsight-integrations/zed/src/zedSettings.js. 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 hindsight-control-plane/src/components/constellation.tsx:1398— `dx < 3 && dy < 3 && stateRef.current.hoverIndex >= 0` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/constellation.tsx:1333— `entities.length > 0 && !(entities.length === 1 && entities[0] === "None")` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:48— `error instanceof Error && error.name === "AbortError"` appears character-identically in 2 files — REDACTED, 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 hindsight-integrations/flowise/nodes/tools/HindsightRecall/HindsightRecall.ts:85— `getCredentialParam("apiUrl", credentialData, nodeData) || "https://api.hindsight.vectorize.io"` appears character-identically in 3 files — hindsight-integrations/flowise/nodes/tools/HindsightRecall/HindsightRecall.ts, hindsight-integrations/flowise/nodes/tools/HindsightReflect/HindsightReflect.ts, hindsight-integrations/flowise/nodes/tools/HindsightRetain/HindsightRetain.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/constellation.tsx:516— `groupColorFn?.(key) || DEFAULT_NODE_COLOR` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/constellation.tsx:438— `groupColorFn?.(nodeGroupList[0]) || DEFAULT_NODE_COLOR` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/constellation.tsx:1054— `heatLegendEndpoints || [t("legendFew"), t("legendMany")]` appears character-identically in 2 files — hindsight-control-plane/src/components/constellation.tsx, hindsight-docs/src/components/constellation/Constellation.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-control-plane/src/components/mental-model-detail-modal.tsx:414— `j > 0 && (i === 0 || dp[i][j - 1] >= dp[i - 1][j])` appears character-identically in 2 files — hindsight-control-plane/src/components/mental-model-detail-modal.tsx, hindsight-control-plane/src/components/observation-history-view.tsx. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate hindsight-integrations/coding-agents/src/core/transcript-qwen.ts:213— `line.type !== "user" && line.type !== "assistant"` appears character-identically in 2 files — hindsight-integrations/coding-agents/src/core/transcript-qwen.ts, hindsight-integrations/coding-agents/src/core/transcript.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Interpolated log message defeats structured logging hindsight-integrations/vapi/hindsight_vapi/webhook.py:228— `warning` at line 228 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/vapi/hindsight_vapi/webhook.py:239— `warning` at line 239 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/strands/hindsight_strands/tools.py:187— `error` at line 187 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/strands/hindsight_strands/tools.py:221— `error` at line 221 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/strands/hindsight_strands/tools.py:246— `error` at line 246 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/smolagents/hindsight_smolagents/tools.py:116— `error` at line 116 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/smolagents/hindsight_smolagents/tools.py:188— `error` at line 188 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/smolagents/hindsight_smolagents/tools.py:242— `error` at line 242 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:121— `error` at line 121 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:152— `error` at line 152 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:174— `error` at line 174 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/pipecat/hindsight_pipecat/memory.py:232— `warning` at line 232 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/pipecat/hindsight_pipecat/memory.py:243— `warning` at line 243 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.warning("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.warning("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:235— `debug` at line 235 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:248— `debug` at line 248 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:302— `error` at line 302 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:325— `error` at line 325 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:346— `error` at line 346 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/memory.py:368— `error` at line 368 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:147— `debug` at line 147 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:151— `debug` at line 151 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:164— `debug` at line 164 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:167— `debug` at line 167 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.debug("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.debug("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:248— `error` at line 248 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Interpolated log message defeats structured logging hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py:265— `error` at line 265 is handed an f-string as its message, so the logger receives one finished string — the values in it cannot be queried, filtered or aggregated as fields, every occurrence reads as a different message, and the string is built even when the record is filtered out. Pass the values beside a constant message instead: `logger.error("order %s moved to %s", order_id, status)` with the standard library's `logging`, which keeps the message and its arguments apart on the record, or `log.error("order moved", order_id=order_id, status=status)` with structlog.
Mock-dominated test: waits for the shared SessionStart decision before the first reflect hindsight-integrations/coding-agents/src/cline.test.ts:36— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: skips subagent sessions the parent conversation already covers hindsight-integrations/coding-agents/src/dsh.test.ts:163— This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: stores nothing when the session journal is empty and the reply is too hindsight-integrations/coding-agents/src/journal-harnesses.test.ts:174— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: honors retainSessions: false without even building a client hindsight-integrations/coding-agents/src/journal-harnesses.test.ts:181— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: handles a custom-message run, which has no prompt, without throwing (#5592) hindsight-integrations/coding-agents/src/harness/pi-extension.test.ts:50— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: waits for the shared SessionStart decision before the first reflect hindsight-integrations/coding-agents/src/harness/pi-extension.test.ts:74— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: writes back the converted transcript on agent_end hindsight-integrations/coding-agents/src/harness/pi-extension.test.ts:94— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: does not write back an empty exchange hindsight-integrations/coding-agents/src/harness/pi-extension.test.ts:158— This test sets up 3 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: remembers a confirmed append capability, so a failed probe on a later Stop still appends (#4560) hindsight-integrations/coding-agents/src/core/chat.test.ts:296— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: collapses a concurrent burst onto a single start hindsight-integrations/coding-agents/src/core/daemon.test.ts:126— This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: starts again once the previous attempt has settled hindsight-integrations/coding-agents/src/core/daemon.test.ts:149— This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: spends what is left of its own budget after joining hindsight-integrations/coding-agents/src/core/daemon.test.ts:168— This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: shares injectTimeoutMs=%s across page search and recall after reflect times out hindsight-integrations/coding-agents/src/core/hook.test.ts:297— This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: does not write again when the session ended without new turns hindsight-integrations/coding-agents/src/core/retain-hook.test.ts:696— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a failed write is not silently skipped by the next one — it is replayed hindsight-integrations/coding-agents/src/core/retain-hook.test.ts:731— This test sets up 3 test doubles (for example `vi.mock/jest.mock of an imported module`) against 1 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: writes the transcript back by default hindsight-integrations/coding-agents/src/core/retain-hook.test.ts:811— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: applies an event gate before building a client hindsight-integrations/coding-agents/src/core/retain-hook.test.ts:817— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: retainSessions: false -> no write-back, and no client is even built hindsight-integrations/coding-agents/src/core/retain-hook.test.ts:834— This test sets up 3 test doubles (for example `a double assigned in a shared setup`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: a banks.<id> override turns write-back back on under a global opt-out hindsight-integrations/coding-agents/src/core/retain-hook.test.ts:868— This test sets up 4 test doubles (for example `vi.mock/jest.mock of an imported module`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: configures the bank itself only when the deepen engine is not started hindsight-integrations/coding-agents/src/core/session-start.test.ts:69— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: threads the ASKING harness to the background seed (not the config loader's default) — #3247 hindsight-integrations/coding-agents/src/core/session-start.test.ts:142— This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: >= threshold since the latest reachable baseline -> re-surveys + records a new baseline hindsight-integrations/coding-agents/src/core/session-start.test.ts:567— This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: applies retain attribution to survey baseline markers hindsight-integrations/coding-agents/src/core/session-start.test.ts:588— This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: < threshold -> no re-survey, no new baseline hindsight-integrations/coding-agents/src/core/session-start.test.ts:616— This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Mock-dominated test: no baseline yet (upgrade from a pre-feature bank) -> records HEAD as baseline, does NOT survey hindsight-integrations/coding-agents/src/core/session-start.test.ts:634— This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
Silent fallback default on parse failure hindsight-api-slim/hindsight_api/api/http.py:61— `_parse_metadata` 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 hindsight-api-slim/hindsight_api/engine/memories/base.py:205— `document_attachment_filenames` returns `{}` 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 hindsight-api-slim/hindsight_api/engine/memories/pg/documents.py:94— `_attachment_ids_of` returns `[]` 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 hindsight-api-slim/hindsight_api/engine/memories/pg/reads.py:142— `_decode_page_token` 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.
Silent fallback default on parse failure hindsight-api-slim/hindsight_api/engine/memory_engine.py:20527— `_stored_trigger` 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 hindsight-api-slim/hindsight_api/engine/memory_engine.py:21627— `_cited_fact_ids` 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 hindsight-api-slim/hindsight_api/engine/providers/fireworks_llm.py:379— `_to_int` returns `0` when `(ValueError, TypeError)` 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 hindsight-api-slim/hindsight_api/engine/providers/gemini_llm.py:67— `_to_int` returns `0` when `(ValueError, TypeError)` 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 hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1158— `_remap_causal_link_snapshot` 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 hindsight-api-slim/hindsight_api/worker/poller.py:234— `_updated_row_count` 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.
Silent fallback default on parse failure hindsight-dev/benchmarks/document_evolution/judge.py:98— `_ask` 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 hindsight-dev/benchmarks/multimodal_retain/judge.py:77— `_ask_once` returns `{}` when `(json.JSONDecodeError, 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 hindsight-embed/hindsight_embed/control_center/server.py:66— `_read_body` 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 hindsight-integrations/cursor/scripts/lib/client.py:22— `_plugin_version` returns `'0.0.0'` when `(OSError, 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:157— `_recall` returns `[]` when `(json.JSONDecodeError, AttributeError)` 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:99— `_plugin_version` returns `'0.0.0'` when `(OSError, 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 hindsight-integrations/hermes/settings.py:308— `_template_fields` returns `set()` 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.
redundant comment hindsight-control-plane/src/components/bank-profile-view.tsx:157— "Clear observations state" repeats the code it sits on: 3 of its 3 words (clear, observations, state) are already in `const [showClearObservationsDialog, setShowClearObservationsDialog] = useState(false);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-control-plane/src/components/documents-view.tsx:775— "Tag editing state" repeats the code it sits on: 3 of its 3 words (tag, editing, state) are already in `const [editingTags, setEditingTags] = useState(false);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-control-plane/src/components/documents-view.tsx:780— "Content editing state" repeats the code it sits on: 3 of its 3 words (content, editing, state) are already in `const [editingContent, setEditingContent] = useState(false);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-control-plane/src/components/documents-view.tsx:978— "Handle page change" repeats the code it sits on: 3 of its 3 words (handle, page, change) are already in `const handlePageChange = (newPage: number) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-control-plane/src/components/entities-view.tsx:146— "Handle page change" repeats the code it sits on: 3 of its 3 words (handle, page, change) are already in `const handlePageChange = (newPage: number) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-control-plane/src/components/think-view.tsx:741— "Mental models are in based_on.mental_models" repeats the code it sits on: 3 of its 3 words (mental, models, based) are already in `const mentalModelFacts = result.based_on?.mental_models || [];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-control-plane/src/components/webhooks-view.tsx:326— "Edit dialog state" repeats the code it sits on: 3 of its 3 words (edit, dialog, state) are already in `const [editDialogOpen, setEditDialogOpen] = useState(false);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-control-plane/src/components/webhooks-view.tsx:334— "Deliveries dialog state" repeats the code it sits on: 3 of its 3 words (deliveries, dialog, state) are already in `const [deliveriesDialogOpen, setDeliveriesDialogOpen] = useState(false);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-integrations/cloudflare-oauth-proxy/src/auth.test.ts:130— "Provider was called with the request" repeats the code it sits on: 3 of its 3 words (provider, called, request) are already in `expect(env.OAUTH_PROVIDER.parseAuthRequest).toHaveBeenCalledTimes(1);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment hindsight-integrations/nemoclaw/src/setup.ts:139— "Step 4 — Restart gateway" repeats the code it sits on: 3 of its 3 words (step, restart, gateway) are already in `step(4, "Restarting OpenClaw gateway...");`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment REDACTED:2449— "Start the embedded server" repeats the code it sits on: 3 of its 3 words (start, embedded, server) are already in `debug("[Hindsight] Starting embedded server...");`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
X7 · Silent fallback defaults· Pending state with no failure state · ×11
Pending state with no failure state hindsight-control-plane/src/components/bank-profile-view.tsx:282— The view draws `<Card>` under `loading && ! profile`, but `loading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/bank-profile-view.tsx:522— The view draws `<>` under `isClearingObservations`, but `isClearingObservations` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/bank-profile-view.tsx:570— The view draws `<Spinner size="sm" class="mr-1"/>` under `deletingDirective`, but `deletingDirective` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/bank-profile-view.tsx:915— The view draws `<Spinner size="sm" class="mr-1"/>` under `submitting`, but `submitting` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/entities-view.tsx:308— The view draws `<div class="flex items-center justify-center py-20">` under `graphLoading`, but `graphLoading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/entities-view.tsx:350— The view draws `<div class="flex items-center justify-center py-20">` under `loading`, but `loading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/entities-view.tsx:524— The view draws `<div class="py-8 text-center">` under `loadingMemories`, but `loadingMemories` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/home-view.tsx:177— The view draws `<div class="flex items-center justify-center py-32">` under `loading`, but `loading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/memory-defense-section.tsx:194— The view draws `<div class="flex items-center justify-center py-12">` under `loading`, but `loading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/memory-defense-section.tsx:236— The view draws `<div class="flex justify-end items-center gap-2 text-xs text-muted-foreground">` under `saving`, but `saving` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Pending state with no failure state hindsight-control-plane/src/components/search-debug-view.tsx:499— The view draws `<Card>` under `loading`, but `loading` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
Silent fallback default in catch hindsight-api-slim/hindsight_api/engine/bank_info_cache.py:78— `_schema` 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 hindsight-api-slim/hindsight_api/engine/local_device.py:195— `resolve_model_device_type` swallows every exception into `return 'cpu'` — 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 hindsight-api-slim/hindsight_api/engine/providers/openai_compatible_llm.py:289— `_response_to_dict` 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 hindsight-api-slim/hindsight_api/metrics.py:60— `memories_backend_for` 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 REDACTED:439— `_get_git_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 hindsight-integrations/agno/hindsight_agno/tools.py:343— `memory_instructions` 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 hindsight-integrations/composio/hindsight_composio/tools.py:301— `memory_instructions` 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 REDACTED:298— `main` 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:631— `unavailable_reason` 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 hindsight-integrations/pydantic-ai/hindsight_pydantic_ai/tools.py:243— `_instructions` (in `memory_instructions`) 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 hindsight-integrations/smolagents/hindsight_smolagents/tools.py:377— `memory_instructions` 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.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×8
Diagnostic log message is built whether or not it is wanted REDACTED:2043— `debug` at line 2043 is called with an argument built by `sum(len(t) for t in turns_to_retain)` (line 2047), 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.
Diagnostic log message is built whether or not it is wanted hindsight-integrations/coding-agents/src/dsh.ts:424— `debug` at line 424 is called with an argument built by `exposed.filter((schema) => schema.name?.startsWith("hindsight_"))` (line 427), whose cost grows with the collection it walks. JavaScript 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 `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted hindsight-integrations/coding-agents/src/harness/plugin-entry.ts:67— `debug` at line 67 is called with an argument built by `JSON.stringify(err)` (line 67), whose cost grows with the collection it walks. JavaScript 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 `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
Diagnostic log message is built whether or not it is wanted hindsight-api-slim/hindsight_api/config_resolver.py:209— `debug` at line 209 is called with an argument built by `list(configurable_tenant.keys())` (line 209), 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.
Diagnostic log message is built whether or not it is wanted hindsight-api-slim/hindsight_api/config_resolver.py:258— `debug` at line 258 is called with an argument built by `list(bank_overrides.keys())` (line 258), 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.
Diagnostic log message is built whether or not it is wanted hindsight-api-slim/hindsight_api/config_resolver.py:1063— `debug` at line 1063 is called with an argument built by `list(filtered.keys())` (line 1063), 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.
Diagnostic log message is built whether or not it is wanted hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1659— `debug` at line 1659 is called with an argument built by `"…".join(log_buffer)` (line 1659), 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.
Diagnostic log message is built whether or not it is wanted hindsight-api-slim/hindsight_api/engine/transfer/importer.py:1799— `debug` at line 1799 is called with an argument built by `"…".join(log_buffer)` (line 1799), 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.
Fat interface: DataAccessOps (39 abstract methods) hindsight-api-slim/hindsight_api/engine/db/ops.py:338— `DataAccessOps` declares 39 abstract methods: `bulk_upsert_chunks`, `lock_document_for_write`, `insert_facts_batch`, `delete_unit_links`, `bulk_insert_links`, `bulk_insert_entities`, `fetch_missing_entity_ids`, `bulk_reassert_entities`, `bulk_insert_unit_entities`, `fetch_unit_dates`, `fetch_temporal_neighbors`, `build_entity_expansion_cte`, `build_semantic_causal_cte`, `expand_observations`, `build_tag_listing_parts`, `create_bank_vector_indexes`, `drop_bank_vector_indexes`, `get_entity_resolution_strategy`, `create_webhook`, `list_webhooks_for_bank`, `count_webhooks_for_bank`, `get_webhooks_for_dispatch`, `update_webhook`, `delete_webhook`, `list_webhook_deliveries`, `insert_webhook_delivery_task`, `enqueue_graph_maintenance`, `claim_graph_maintenance_batch`, `finish_graph_maintenance_batch`, `release_entity_postings`, `restore_entity_postings`, `claim_entity_maintenance_batch`, `prune_orphan_entities`, `prune_stale_cooccurrences`, `fetch_reconcilable_batch_parents`, `prune_terminal_operations`, `claim_tasks`, `fetch_foldable_retain_peers`, `mark_operations_processing`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: MemoryEngineInterface (29 abstract methods) hindsight-api-slim/hindsight_api/engine/interface.py:37— `MemoryEngineInterface` declares 29 abstract methods: `health_check`, `retain_batch_async`, `recall_async`, `reflect_async`, `list_banks`, `get_bank_profile`, `ensure_bank_profile`, `get_bank_config`, `update_bank_config`, `reset_bank_config`, `update_bank_disposition`, `set_bank_mission`, `delete_bank`, `list_memory_units`, `get_graph_data`, `list_documents`, `get_document`, `delete_document`, `get_chunk`, `list_entities`, `get_bank_stats`, `get_bank_freshness`, `check_bank_llm`, `get_entity`, `list_operations`, `cancel_operation`, `delete_operation`, `update_bank`, `submit_async_retain`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: MemoriesExtension (29 abstract methods) hindsight-api-slim/hindsight_api/engine/memories/base.py:1135— `MemoriesExtension` declares 29 abstract methods: `insert_facts`, `delete_facts`, `delete_document`, `recall_unified`, `get_memories`, `scan_memories`, `count_memories`, `list_tags`, `find_unconsolidated`, `mark_consolidated`, `entity_memory_counts`, `entities_for_units`, `entity_map_for_units`, `resolve_entity_names`, `any_memory_updated_since`, `newest_memory_updated_at`, `list_memory_units`, `get_memory_unit`, `get_archived_memory`, `invalidate_memory`, `set_invalidation_reason`, `restore_memory`, `set_memory_embedding`, `list_entities`, `graph_units`, `graph_entity_rows`, `graph_direct_links`, `observations_for_sources`, `delete_stale_observations`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: SQLDialect (26 abstract methods) hindsight-api-slim/hindsight_api/engine/sql/base.py:29— `SQLDialect` declares 26 abstract methods: `param`, `cast`, `vector_distance`, `vector_similarity`, `json_extract_text`, `json_contains`, `json_merge`, `text_search_score`, `text_search_order`, `similarity`, `upsert`, `bulk_unnest`, `limit_offset`, `returning`, `ilike`, `array_any`, `array_all`, `array_contains`, `for_update_skip_locked`, `generate_uuid`, `greatest`, `current_timestamp`, `array_agg`, `build_semantic_arm`, `build_bm25_arm`, `prepare_bm25_text`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: KnowledgeStore (16 abstract methods) hindsight-api-slim/hindsight_api/knowledge/store.py:213— `KnowledgeStore` declares 16 abstract methods: `ensure_ready`, `get_documents`, `put_documents`, `list_documents`, `set_statuses`, `stage_passages`, `replace_passages`, `list_passages`, `passage_ranges`, `delete_documents`, `delete_some_documents`, `media_keys`, `derived_documents`, `search`, `bank_stats`, `timeseries`. Counted over its `@abstractmethod`s (and abstract properties), once per name; concrete methods are helpers an implementer inherits, not a burden, and `_`-prefixed members are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×5
Projects may be oversized for their cohesion REDACTED:1— `hindsight-api-slim` (165852 LoC, 1399 module-visible types across 24 directories) overshoots its size bounds. 5 of 64 build unit(s) (Cargo, Go, Python, npm) overshoot their size bounds, lowering Project Cohesion to 8.4/10. 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.
Projects may be oversized for their cohesion hindsight-clients/python/REDACTED:1— `hindsight-clients/python` (56035 LoC, 251 module-visible types across 4 directories) overshoots its size bounds. 5 of 64 build unit(s) (Cargo, Go, Python, npm) overshoot their size bounds, lowering Project Cohesion to 8.4/10. 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.
Projects may be oversized for their cohesion hindsight-control-plane/package.json:1— `hindsight-control-plane` (50106 LoC, 312 module-visible types across 88 directories) overshoots its size bounds. 5 of 64 build unit(s) (Cargo, Go, Python, npm) overshoot their size bounds, lowering Project Cohesion to 8.4/10. 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.
Projects may be oversized for their cohesion hindsight-docs/package.json:1— `hindsight-docs` (13428 LoC, 99 module-visible types across 41 directories) overshoots its size bounds. 5 of 64 build unit(s) (Cargo, Go, Python, npm) overshoot their size bounds, lowering Project Cohesion to 8.4/10. 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.
Projects may be oversized for their cohesion hindsight-integrations/coding-agents/package.json:1— `hindsight-integrations/coding-agents` (19628 LoC, 165 module-visible types across 4 directories) overshoots its size bounds. 5 of 64 build unit(s) (Cargo, Go, Python, npm) overshoot their size bounds, lowering Project Cohesion to 8.4/10. 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.
P2 · Observability· Console output used as the logging channel · ×4
Console output used as the logging channel REDACTED:138— `REDACTED` reports through `console.*` at line 138 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel hindsight-integrations/coding-agents/src/core/config.ts:702— `hindsight-integrations/coding-agents/src/core/config.ts` reports through `console.*` at line 702 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel hindsight-integrations/coding-agents/src/core/config.ts:856— `hindsight-integrations/coding-agents/src/core/config.ts` reports through `console.*` at line 856 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel hindsight-integrations/coding-agents/src/core/template.ts:22— `hindsight-integrations/coding-agents/src/core/template.ts` reports through `console.*` at line 22 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 183 significant file(s) lose their only recent owner: hindsight-api-slim/hindsight_api/engine/memories/base.py, REDACTED, hindsight-control-plane/src/lib/api.ts, hindsight-api-slim/hindsight_api/engine/memories/postgres.py, hindsight-control-plane/src/components/constellation.tsx, hindsight-control-plane/src/components/search-debug-view.tsx, hindsight-control-plane/src/components/pages-view.tsx, hindsight-api-slim/hindsight_api/engine/providers/chatgpt_auth.py (+175 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 7 significant file(s) lose their only recent owner: hindsight-integrations/eve/src/config.ts, hindsight-integrations/obsidian/src/node/json-index.ts, hindsight-api-slim/hindsight_api/alembic/versions/86f7a033d372_repair_mental_models_subtype_at_head.py, hindsight-integrations/obsidian/src/reflect-util.ts, hindsight-integrations/eve/src/auto-memory.ts, hindsight-integrations/roo-code/hindsight_roo_code/install.py, hindsight-integrations/paperclip/src/bank.ts. Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 4 significant file(s) lose their only recent owner: hindsight-integrations/devin-desktop/hindsight_devin_desktop/cli.py, hindsight-integrations/devin-desktop/hindsight_devin_desktop/rules.py, hindsight-integrations/aider/hindsight_aider/runner.py, hindsight-integrations/devin-desktop/hindsight_devin_desktop/config.py. Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 8 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (203 single-owned of 780 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 780 of the 1695 production source files in this repository met that bar). They are anonymized user #4 (2 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)), anonymized user #9 (1 file(s)) (+2 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: hindsight-dev/benchmarks/micro/entity_resolver_bench.py, hindsight-dev/benchmarks/micro/semantic_within_batch.py, hindsight-api-slim/hindsight_api/alembic/versions/7c2e5a9d1f40_entities_bank_scoped_trgm_index.py, hindsight-api-slim/hindsight_api/alembic/versions/c3f7a1b9d2e4_backfill_observation_search_vector.py, hindsight-api-slim/hindsight_api/alembic/versions/9f8e7d6c5b4a_memory_links_deferrable_fk.py, hindsight-api-slim/hindsight_api/alembic/versions/2071c7518f88_add_memory_links_bank_id_index.py, hindsight-api-slim/hindsight_api/alembic/versions/a1d3f5b7c9e2_widen_remaining_bank_id_to_text.py, hindsight-integrations/openclaw/src/session-file.ts (+1 more).
D21 · Naming Consistency· `BankLlmHealthResponse` spells `Llm` where 25 names in the project spell it `LLM` · ×1
`BankLlmHealthResponse` spells `Llm` where 25 names in the project spell it `LLM` hindsight-api-slim/hindsight_api/api/http.py:3305— 25 of 27 names in project hindsight-api-slim spell the token `LLM` (25 of 27; unit: names in project hindsight-api-slim containing `LLM`). Peers: hindsight-api-slim.hindsight_api.api.http.ReflectLLMCall (hindsight-api-slim/hindsight_api/api/http.py:1831); hindsight-api-slim.hindsight_api.engine.consolidation.consolidator._BatchLLMResult (hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:1134); hindsight-api-slim.hindsight_api.engine.cross_encoder.LiteLLMCrossEncoder (hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2125); hindsight-api-slim.hindsight_api.engine.embeddings.LiteLLMEmbeddings (hindsight-api-slim/hindsight_api/engine/embeddings.py:1721); hindsight-api-slim.hindsight_api.engine.llm_wrapper.ConfiguredLLMProvider (hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:2018). Rename to `BankLLMHealthResponse`. [rule N6]
D21 · Naming Consistency· `BankLlmHealthInfo` spells `Llm` where 25 names in the project spell it `LLM` · ×1
`BankLlmHealthInfo` spells `Llm` where 25 names in the project spell it `LLM` hindsight-api-slim/hindsight_api/engine/memory_engine.py:516— 25 of 27 names in project hindsight-api-slim spell the token `LLM` (25 of 27; unit: names in project hindsight-api-slim containing `LLM`). Peers: hindsight-api-slim.hindsight_api.api.http.ReflectLLMCall (hindsight-api-slim/hindsight_api/api/http.py:1831); hindsight-api-slim.hindsight_api.engine.consolidation.consolidator._BatchLLMResult (hindsight-api-slim/hindsight_api/engine/consolidation/consolidator.py:1134); hindsight-api-slim.hindsight_api.engine.cross_encoder.LiteLLMCrossEncoder (hindsight-api-slim/hindsight_api/engine/cross_encoder.py:2125); hindsight-api-slim.hindsight_api.engine.embeddings.LiteLLMEmbeddings (hindsight-api-slim/hindsight_api/engine/embeddings.py:1721); hindsight-api-slim.hindsight_api.engine.llm_wrapper.ConfiguredLLMProvider (hindsight-api-slim/hindsight_api/engine/llm_wrapper.py:2018). Rename to `BankLLMHealthInfo`. [rule N6]
D21 · Naming Consistency· `ExtensionAPI` spells `API` where 43 names in the project spell it `Api` · ×1
`ExtensionAPI` spells `API` where 43 names in the project spell it `Api` hindsight-integrations/coding-agents/src/harness/pi-extension.ts:81— 43 of 45 names in project hindsight spell the token `Api` (43 of 45; unit: names in project hindsight containing `Api`). Peers: ControlPlaneClient.fetchApi (hindsight-control-plane/src/lib/api.ts:521); bank-url.bankApi (hindsight-control-plane/src/lib/bank-url.ts:22); bank-url.bankStatsApi (hindsight-control-plane/src/lib/bank-url.ts:27); bank-url.memoryApi (hindsight-control-plane/src/lib/bank-url.ts:32); bank-url.documentApi (hindsight-control-plane/src/lib/bank-url.ts:44). Rename to `ExtensionApi`. [rule N6]
D21 · Naming Consistency· `MoltbotPluginAPI` spells `API` where 43 names in the project spell it `Api` · ×1
`MoltbotPluginAPI` spells `API` where 43 names in the project spell it `Api` hindsight-integrations/openclaw/src/types.ts:12— 43 of 45 names in project hindsight spell the token `Api` (43 of 45; unit: names in project hindsight containing `Api`). Peers: ControlPlaneClient.fetchApi (hindsight-control-plane/src/lib/api.ts:521); bank-url.bankApi (hindsight-control-plane/src/lib/bank-url.ts:22); bank-url.bankStatsApi (hindsight-control-plane/src/lib/bank-url.ts:27); bank-url.memoryApi (hindsight-control-plane/src/lib/bank-url.ts:32); bank-url.documentApi (hindsight-control-plane/src/lib/bank-url.ts:44). Rename to `MoltbotPluginApi`. [rule N6]
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 53 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: hindsight-integrations/llamaindex/hindsight_llamaindex/tools.py, hindsight-integrations/openai-agents/hindsight_openai_agents/tools.py, hindsight-integrations/cursor/scripts/lib/content.py, hindsight-integrations/devin-desktop/hindsight_devin_desktop/devin_local.py, hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/tools.py, REDACTED, hindsight-integrations/omo/demo.py, hindsight-integrations/claude-agent-sdk/hindsight_claude_agent_sdk/hooks.py (and 45 more) (54 orphaned of 780 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 780 of the 1695 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D40 · Network Egress Confinement· No network policy · ×1
No network policy — No Kubernetes NetworkPolicy (or Cilium policy) found. Without one, every pod can talk to every other pod and reach out to the internet by default. Add a default-deny policy and open only the flows you need.
M2 · Architecture documentation· ADRs not easily discoverable · ×1
ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `hindsight-docs/guides/2026-04-21-guide-building-multi-agent-systems-with-shared-memory.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.
Logging is not universal — Only 37/53 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `hindsight-cli`, `hindsight-control-plane`, `hindsight-integrations/cursor` and 11 more.
No SAST REDACTED:4— 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 9 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.
No dependency-update automation hindsight-all-npm/package.json:43— `hindsight-all-npm/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
Unused export 'ingestGit' hindsight-integrations/coding-agents/src/core/git.ts:141— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused export 'DCODE_THREADS_SCHEMA_VERSION' · ×1
Unused export 'DCODE_THREADS_SCHEMA_VERSION' hindsight-integrations/coding-agents/src/core/history.ts:250— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused module-local declaration 'baseValues' · ×1
Unused module-local declaration 'baseValues' hindsight-control-plane/tests/lib/retain-strategy-config.test.ts:10— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
Security headers incomplete docker/docker-compose/nginx/nginx.conf:21— Set: Content-Security-Policy, X-Content-Type-Options. Missing: Strict-Transport-Security, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each. (−1.0 on this card.)
X2 · Cancellation propagation· Not all async functions that make a request accept an AbortSignal · ×1
Not all async functions that make a request accept an AbortSignal — Only 19/83 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Null assertions (`!`) override strict null checking — ~0.9 `!` null assertions per 1k TypeScript source lines — 91 assertion(s) across the 99067 source line(s) of the 482 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: hindsight-control-plane/src/components/constellation.tsx (13), hindsight-docs/src/components/constellation/Constellation.tsx (12), hindsight-integrations/coding-agents/src/deepen.ts (8). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
Silent fallback default on Err hindsight-cli/src/commands/explore.rs:1102— `format_memory_details_json` turns every `Err` into `"Unable to render memory details".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Subsumed condition operand hindsight-cli/tests/integration_test.rs:164— `stdout.contains("-t")` can never decide this `&&` — every value satisfying `stdout.contains("--timestamp")` also satisfies `stdout.contains("-t")`, so the `&&` chain is already decided by the former. The expression is equivalent to the chain without it, which means it is narrower than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/harness.e2e.test.ts:25— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/harness.e2e.test.ts:42— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/installer.test.ts:1043— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/installer.test.ts:1106— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/core/git.gitlog.test.ts:503— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/core/survey.test.ts:264— Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/core/traecode-mcp.test.ts:344— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/core/traecode-mcp.test.ts:353— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/core/traecode-mcp.test.ts:358— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
Skipped (documented): (unnamed test) hindsight-integrations/coding-agents/src/core/traecode-mcp.test.ts:438— Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
doc comments repeat the names hindsight-integrations/ai-sdk/src/tools/index.ts:43— 0 of 0 documented parameters and 2 of 36 summaries in `@vectorize-io/hindsight-ai-sdk` only repeat the member or parameter name (e.g. "Chunk data" for `ChunkData`). Delete the restating tags, or add what the name does not say.
doc comments repeat the names hindsight-integrations/chat/src/types.ts:47— 0 of 0 documented parameters and 1 of 44 summaries in `@vectorize-io/hindsight-chat` only repeat the member or parameter name (e.g. "Reflect fact." for `ReflectFact`). Delete the restating tags, or add what the name does not say.
doc comments repeat the names hindsight-clients/typescript/src/index.ts:1199— 0 of 5 documented parameters and 6 of 186 summaries in `@vectorize-io/hindsight-client` only repeat the member or parameter name (e.g. "Delete a bank." for `deleteBank`). Delete the restating tags, or add what the name does not say.
doc comments repeat the names hindsight-control-plane/src/lib/api.ts:655— 0 of 3 documented parameters and 17 of 550 summaries in `@vectorize-io/hindsight-control-plane` only repeat the member or parameter name (e.g. "Create a new bank" for `createBank`). Delete the restating tags, or add what the name does not say.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 6 file(s) — `hindsight-control-plane/src/components/data-view.tsx`, `hindsight-control-plane/src/lib/i18n/api-errors.ts`, `hindsight-control-plane/src/lib/observations-config.ts`, `hindsight-docs/docusaurus.config.ts`, `hindsight-integrations/coding-agents/src/core/config.ts`, … (+1 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
runtime-hardening: not applicable — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
Run 01a1e7f8-bc08-70f4-b2fc-443aeee59b63 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 527 · Warnings: 2249 · Recommendations: 339 · Info: 14 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 05:26 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.