Overview
Theindex command processes all directories in the watch list, extracting text content, chunking it, and creating vector embeddings for semantic search.
Syntax
Options
Show detailed logs during indexing, including file processing information and statistics.Alias:
-lComma-separated list of file extensions to index. By default, indexes all supported file types.Alias:
-eExample: --ext .md,.txt or --ext md,txtInclude only files matching glob patterns. Can be specified multiple times or as comma-separated values.Alias:
-gExample: --glob "**/*.md" --glob "notes/**"Only index files modified since the specified time. Accepts relative time (e.g.,
7d, 12h, 30m) or absolute dates (e.g., 2024-01-15).Examples:7d- Last 7 days12h- Last 12 hours30m- Last 30 minutes2w- Last 2 weeks2024-01-15- Since January 15, 20242024-01-15T10:30:00- Specific timestamp
Scan subdirectories recursively. Use
--no-recursive to scan only top-level files.Alias: -r (enable), -R (disable)Size of each text chunk in tokens. Larger chunks provide more context but may reduce precision.Alias:
-cNumber of overlapping tokens between consecutive chunks. Helps maintain context across chunk boundaries.Alias:
-oClear the entire index and re-index everything from scratch.Alias:
-fSimulate indexing without writing to the database. Useful for previewing what will be indexed.
Write a JSON report of skipped files to the specified path.
Examples
Basic indexing
Index with detailed logs
Index only markdown files
Index files modified in last 7 days
Index with glob patterns
Force re-index everything
Dry run to preview indexing
Custom chunk settings
Generate skip report
The index command only processes files that have been modified since the last index. Use
--force to rebuild the entire index from scratch.Time Format Reference
The--since flag accepts flexible time formats:
| Format | Description | Example |
|---|---|---|
<N>m | Minutes ago | 30m |
<N>h | Hours ago | 12h |
<N>d | Days ago | 7d |
<N>w | Weeks ago | 2w |
YYYY-MM-DD | Absolute date | 2024-01-15 |
| ISO 8601 | Full timestamp | 2024-01-15T10:30:00 |
Prerequisites
Before runningknow index, you must:
- Add at least one directory:
know add <directory> - Verify directories are added:
know dirs
See Also
know add- Add directories to watch listknow prune- Remove orphaned chunksknow search- Search indexed content