Code & Local Files
Local Files & Code
By the end of this guide, you will have a local directory indexed into a searchable collection, with filters configured to include only the files you care about.
Quick start
indexed index create files -c my-docs -p ./documentsFor every flag and default, see Index commands (indexed index create files --help).
Prerequisites
- Indexed installed and initialized with
indexed init(see Quick Start) - A folder with documents (Markdown, PDF, DOCX, TXT, HTML, or any supported format)
What gets indexed
- Text extracted from each supported file type (see Supported file formats)
- File path and modification metadata
- Directory hierarchy
- Code structure when AST chunking is enabled (function/class boundaries for supported languages)
Create a Collection
Point Indexed at your folder. It recursively scans, parses every supported format, chunks, and embeds — all on your machine.
indexed index create files -c project-docs -p ~/work/docsIndexing is always recursive — all subdirectories are scanned. There is currently no depth-limit flag.
Obsidian vaults
Point -p at your vault root (e.g., ~/Documents/ObsidianVault). Indexed scans nested folders recursively and indexes the Markdown files themselves — wiki-link syntax and frontmatter are not interpreted.
Verify the collection was created:
indexed index inspect project-docsFilter what gets indexed
On the CLI, --include and --exclude take regexes matched against the full file path (repeat the flag for each pattern). When both are set, includes are applied first.
Persistent defaults for a workspace live in [sources.files]: include_patterns accepts globs or regexes, and prefixing a pattern with ! excludes matching files (for example ["*", "!*.pyc"]) — see Files connector. With --gitignore (on by default; disable with --no-gitignore), .gitignore rules and common noise dirs like node_modules and .git are skipped; see the same Index command reference for all indexed index create files flags.
# Only index Markdown and text files
indexed index create files -c docs-only -p ~/work/docs \
--include ".*\.md$" --include ".*\.txt$"
# Skip drafts and work-in-progress files
indexed index create files -c final-docs -p ~/work/docs \
--exclude ".*\.draft\.md$" --exclude ".*WIP.*"Configuration (OCR, change tracking, chunking)
Tune OCR, change tracking, table extraction, and code chunking under [sources.files] (or indexed config set sources.files.<key> <value>). Defaults and key names are in Config commands; narrative setup is in the Configuration guide.
[sources.files]
path = "./documents"
include_patterns = ["*.md", "*.pdf", "*.py", "!*.tmp"]
fail_fast = false
respect_gitignore = true
ocr_enabled = true
table_structure = true
code_chunking = true
max_chunk_tokens = 512
change_tracking = "auto"ocr_enabled defaults to true; set it to false to skip OCR for scanned PDFs and images. max_chunk_tokens applies in the parsing pipeline; embedding chunk size is core.v1.indexing.chunk_size (see Config commands).
Code Files
Code files with a tree-sitter grammar (.py, .ts, .go, .rs, .java, .c, .cpp, and more) always route to the code chunker. With code_chunking enabled (the default) it splits code at AST boundaries — functions, classes, and methods — rather than arbitrary line counts. Other code files fall back to line-based splitting.
Supported languages and formats
See Supported File Formats for the full list of file types, code languages with AST support, and plaintext formats.
Keep the Index Fresh
When your documents change, update only what's new:
indexed index update project-docsIndexed picks a change tracking strategy from sources.files.change_tracking (auto, git, content_hash, mtime, or none). See Parsing architecture and Config commands.
To automate updates:
# Update all Indexed collections every day at 8am (use the path from `which indexed`)
0 8 * * * /path/to/indexed index update 2>&1 >> ~/.indexed/update.logIf you need a clean re-index (e.g., after changing chunk size), use --force:
indexed index create files -c project-docs -p ~/work/docs --forceAdditional options
All indexed index create files flags and defaults: Index commands. OCR, change tracking, and patterns: Files connector and Configuration guide.
Troubleshooting
Unsupported file format error — Check the Supported File Formats list. If your format isn't listed, convert it to PDF or Markdown, which parse most reliably.
No results returned — Verify the collection exists with indexed index inspect <name>, then test from the CLI:
indexed index search "your query here" -c project-docsOCR not working on scanned PDFs — OCR is on by default (sources.files.ocr_enabled = true). If it was disabled in config, set it back to true, then re-create or update the collection (see Parsing architecture).