Find similar functions
find_similarFind functions that already do what you are about to write, and places this project has built the same thing twice. Pass functions with one entry per new or edited function (name and file when it is already indexed, one plain sentence when it is not) and each entry comes back with the closest functions in other files. Omit functions for a whole-project audit that groups the functions describing the same behaviour. Matching reads how the index describes a function rather than its body, and every row carries the file and line span of the function it names. For one concept rather than a set of functions, use search_by_intent.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Audit only: compare the functions under this repo-relative directory or file prefix, matched on whole segments (`lib` covers `lib/a.ts`, never `library/a.ts`). In a monorepo the service's directory is part of the path. | |
| repo | No | Your repo as owner/repo (git remote) or just the repo name. Resolves which Carrick project to query. | |
| limit | No | Ceiling on groups per page in the audit mode (default 20, max 50). A page is cut to what one response holds, so it can come back shorter; `clusters_note` states what this page holds and `next_offset` continues it. | |
| top_k | No | Matches per entry in the targeted mode (default 5). | |
| offset | No | Groups to skip in the audit mode (default 0). Pass the `next_offset` from a previous call to page through. | |
| project | No | Carrick project slug to query. Omit to auto-resolve via `repo`, or omit both when the workspace has one project. | |
| service | No | Limit the comparison to one service (fuzzy match by service name, repo name, or trailing segment). | |
| functions | No | One entry per function to check, up to 20 in a call. Omit for a whole-project audit. | |
| min_lines | No | Shortest function to compare (audit default 3, targeted default 1). One-line and two-line wrappers carry no behaviour to reuse; the response says how many rows this hid. | |
| scan_from | No | Audit only: where the next window starts. An audit larger than one call compares the functions in windows and each answer names its `window`; pass its `next_scan_from` to continue. | |
| include_tests | No | Include test files, which repeat each other by design (default false). | |
| include_callbacks | No | Include the anonymous callbacks the scan indexed, such as a `map_handler` row (default false). They cannot be imported, so a group of them is not a reuse finding. | |
| include_generated | No | Include generated and bundled files (default false). | |
| similarity_threshold | No | Floor for a match. Defaults to 0.85 between two indexed functions and 0.45 for a `description`, which are different scales: one side is a stored vector and the other a sentence embedded on the spot. The answer carries `vector_basis` for which stored vectors it compared, and its hint says what that basis means for a renamed copy. |