Skip to content

search_local component reference ​

This page lists every field and option. The overview shows what it does and a first example.

The search_local component searches a local directory by content keyword and/or filename glob and returns {results, count}.

It is a kdeps component from the components asset set. Call it with a component: resource. You do not install it. It calls the search_local tool of the kdeps API. This tool runs the native searchLocal executor. kdeps rejects a workflow that uses searchLocal: directly, as primary or in a before:/after: step. See Search resources for how it relates to web_search.

It runs as a workflow step.

component: search_localPOST /tools/search_local/callwalk the folder:glob + keywordindex: true:TF-IDF + optional graphBoost{results, count}index: false (default)index: true

Configuration ​

yaml
# resources/search.yaml
actionId: search
name: Search
component:
  name: search_local              # from the components asset set; a components/search_local/ of your own wins
  with:
    path: "{{ get('path', '/data') }}"   # directory to search; empty searches the working project's folders
    query: "{{ get('query') }}"          # keyword in file contents; query or glob is required
    glob: "{{ get('glob', '') }}"        # optional filename pattern, e.g. *.md
    limit: 10                            # max results, default 3
InputTypeRequiredDefaultDescription
querystringquery or glob-Case-insensitive keyword or regex to find in file contents
pathstringnoworking projectDirectory to search recursively. An absolute path is recommended
globstringno-Filename glob pattern (e.g. *.md, report_*.csv)
limitnumberno3Max results
indexboolnofalseBuild/use a persistent TF-IDF index instead of walking every search
fuzzyboolnofalseLevenshtein fuzzy term matching (requires index: true)
maxDistanceintegerno2Max edit distance for fuzzy matching
indexDBPathstringno~/.kdeps/projects/<folder>-<hash>/index.dbWhere the index is stored
graphBoostboolnofalseRe-rank indexed results from the vault graph when the folder is inside it, otherwise from the folder's link/topic graph (requires index: true)

If you set query and glob, a file must match both.

Output ​

json
{
  "results": [{"path": "/data/2024-invoice.md", "name": "2024-invoice.md", "size": 812, "isDir": false}],
  "count": 1
}

Read it with output('search').results and output('search').count.

Each result object:

KeyTypeDescription
pathstringFull file path
namestringFilename
sizeintegerFile size in bytes
isDirboolAlways false

What the walk skips ​

The walk skips directories that hold only binaries, generated output or caches, so they do not crowd real documents out of the limit: every dot-directory (.git, .codeql-db, .venv, .cache, ...) and node_modules, bower_components, vendor, target, build, bin, obj, __pycache__, site-packages, coverage, dist-packages, tmp.

kdeps also skips files larger than 1 MiB. It does not compare them with the glob or the content.

The path you pass is always searched, even when it is a dot-directory such as path: "/workspace/.config-app". Indexed mode (index: true) applies the same directory and size skips when it builds the index.

Examples ​

Find all Markdown files:

yaml
# resources/find-docs.yaml
actionId: findDocs
component:
  name: search_local
  with:
    path: "/workspace/docs"
    glob: "*.md"

Find files containing a keyword:

yaml
# resources/find-invoices.yaml
actionId: findInvoices
component:
  name: search_local
  with:
    path: "/data/uploads"
    query: "overdue"
    limit: 20

Feed results into an LLM:

yaml
# resources/find-files.yaml
actionId: findFiles
component:
  name: search_local
  with:
    path: "/data/reports"
    query: "{{ get('query') }}"

---
actionId: answer
flow:
  requires: [findFiles]
chat:
  model:
    name: llama3.2:1b
  context:
    prompt: "Files found: {{ output('findFiles').results }}. Summarize."

Indexed search (ranked results) ​

index: true changes the executor from a plain directory walk to a persistent TF-IDF inverted index. Each result then gets a relevance score, not only a yes/no filename or content match. kdeps builds the index one time (or updates it incrementally) at ~/.kdeps/projects/<folder>-<hash>/index.db. The index makes repeated searches of the same folder faster. kdeps writes nothing into the folder that it searches, so a git repository stays clean.

yaml
# resources/search-indexed.yaml
actionId: searchDocs
component:
  name: search_local
  with:
    path: "/workspace/docs"
    query: "authentication flow"
    index: true                  # build/use a persistent TF-IDF index instead of walking every search
    fuzzy: true                   # optional: Levenshtein fuzzy matching (requires index: true)
    maxDistance: 2                # optional: max edit distance for fuzzy matching, default 2
    indexDBPath: "/custom/index.db"  # optional: override the default ~/.kdeps/projects/<folder>-<hash>/index.db
    graphBoost: true              # optional: re-rank from the vault graph, or the folder's link/topic graph outside it (requires index: true)

How graphBoost ranks results ​

Indexed search already ranks by TF-IDF. graphBoost then moves a document up when one of the top 5 matches connects to it.

If path is the knowledge vault, or a folder in it, kdeps upgrades the structural graph of that vault (links, tags, and frontmatter; no model call). Then it reads those edges. It does not write graph.db. An extracted reference gets a boost of 25%. A weaker edge gets a smaller boost: an inferred edge by its confidence, an ambiguous edge by 0.3 times its confidence, and a shared tag by 0.3 of that.

For a folder outside the vault, kdeps builds a link and topic graph of the folder at ~/.kdeps/projects/<folder>-<hash>/graph.db. The graph uses markdown links and shared topics: / tags: frontmatter. Each connected document gets the full 25%.

A lower-scoring connected document can outrank a higher-scoring isolated one. That matters when the top match is a short index page.

yaml
# resources/search-graph.yaml
actionId: findRelatedDocs
component:
  name: search_local
  with:
    path: "/workspace/docs"
    query: "{{ get('query') }}"
    index: true
    graphBoost: true

Indexed-mode output ​

Indexed-mode output rows add three fields on top of the base result shape:

KeyTypeDescription
scorefloatTF-IDF relevance score (post-boost when graphBoost is set)
matchCountintegerNumber of distinct query terms matched
snippetstringText excerpt around the match

Errors ​

ErrorCause
search_local: give a query (or a glob) to search forNeither query nor glob is set
search_local: ... blockedpath is a filesystem root (/)
component "search_local" not foundThe components asset set is not installed - run kdeps install components

See also ​

kdeps has the Apache 2.0 License.