Skip to content

CLI Reference

Complete command-line reference for ck.

Usage

bash
ck [OPTIONS] [PATTERN] [PATH...]

Search Modes

Keyword Search (Default)

bash
ck "pattern" [paths]
ck -i "case-insensitive" src/
ck -w "whole-word" src/
bash
ck --sem "conceptual query" [paths]
ck --semantic "error handling" src/
bash
ck --hybrid "combined query" [paths]

MCP Server

bash
ck --serve

Search Options

FlagDescription
--sem, --semanticSemantic search mode
--hybridHybrid search (semantic + keyword)
-i, --ignore-caseCase-insensitive search
-w, --word-regexpMatch whole words only
-v, --invert-matchInvert match (show non-matching lines)

Output Options

FlagDescription
-n, --line-numberShow line numbers
-l, --files-with-matchesList files with matches only
-L, --files-without-matchList files without matches
-c, --countCount matches per file
--no-filenameHide filenames in output
--scoresShow relevance scores (semantic/hybrid)

Context Control

FlagDescription
-A NUM, --after-context NUMShow NUM lines after match
-B NUM, --before-context NUMShow NUM lines before match
-C NUM, --context NUMShow NUM lines before and after match

Search Scope

FlagDescription
-R, -r, --recursiveRecursive search
--exclude PATTERNExclude files matching pattern
--no-ignoreDon’t respect .gitignore
--no-ckignoreDon’t respect .ckignore

Semantic Options

FlagDescription
--topk NUM, --limit NUMLimit to top NUM results. Semantic/hybrid: defaults to 10 results, max 100. Keyword: returns all matches.
--threshold FLOATMinimum relevance score. Semantic: 0.0-1.0 (default: 0.6). Hybrid: ~0.01-0.05 (try 0.02). See Hybrid Search for details.
--full-sectionReturn complete code sections

Index Management

FlagDescription
--index [PATH]Build/update index
--status [PATH]Show index status
--clean [PATH]Remove index and rebuild
--add FILEAdd single file to index
--inspect FILEShow file chunking details

Model Selection

FlagDescription
--model NAMEEmbedding model (bge-small, nomic-v1.5, jina-code)
--switch-model NAMESwitch to different model
--forceForce rebuild (with --switch-model)

Output Formats

FlagDescription
--jsonJSON array output
--jsonlJSONL (one JSON object per line)
--no-snippetMetadata only (no content snippets)
--snippet-length NUMSnippet size in characters

See Output Formats Reference for complete JSON/JSONL schemas, field descriptions, and processing examples.

MCP Options

FlagDescription
--serveStart MCP server
--page-size NUMResults per page (MCP pagination)
--cursor TOKENPagination cursor

Examples

bash
# Keyword search
ck "TODO" src/

# Case-insensitive
ck -i "error" src/

# With line numbers
ck -n "pattern" file.txt

Semantic Search

bash
# Find concepts
ck --sem "error handling" src/

# With scores
ck --sem --scores "auth" src/

# High confidence only
ck --sem --threshold 0.7 "pattern" src/

# Top 5 results
ck --sem --topk 5 "pattern" src/

Hybrid Search

bash
# Combined semantic + keyword search
ck --hybrid "connection timeout" src/

# With RRF scores (note: scores are ~0.01-0.05)
ck --hybrid --scores "auth" src/

# Filter by RRF threshold
ck --hybrid --threshold 0.02 "pattern" src/

Output Formats

bash
# List matching files
ck -l "pattern" src/

# JSON output
ck --json --sem "pattern" src/

# JSONL for streaming
ck --jsonl --sem "pattern" src/

Index Operations

bash
# Check status
ck --status .

# Build index
ck --index .

# Rebuild from scratch
ck --clean .
ck --index .

# Switch models
ck --switch-model nomic-v1.5 .

Exit Codes

  • 0: Matches found
  • 1: No matches found
  • 2: Error occurred

Environment Variables

Currently none. All configuration is via command-line flags or .ckignore file.

Next Steps

Released under the MIT or Apache-2.0 License.