Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Headless Mode (CLI)

The non-interactive mode is designed for speed and automation. It allows developers to integrate context extraction into shell scripts, CI/CD pipelines, or quick terminal workflows.

Basic Execution

To scan the current directory and generate an XML report:

context .

By default, this will scan the folder, apply smart ignore heuristics, extract the content, and output the result to standard output (or prompt the TUI if no specific flags indicate automation).

Core Arguments

FlagNameDescription
-o, --output <FILE>Output PathWrites the final report to the specified file.
-f, --format <FMT>FormatForces serialization format (xml or markdown).
-s, --stdoutStandard OutputForces the report to the terminal stdout stream.
-c, --clipClipboardCopies the final report directly to the OS clipboard.
-I, --interactiveForce TUIForces the Terminal User Interface to launch.

Filtering Context

You can heavily restrict what is included in the dump to preserve token limits:

Extension Whitelisting

Only include specific file types:

context . -e rs,md,toml

Path Exclusion

Exclude specific directories or files containing a substring:

context . -X tests,migrations,vendor

Depth Limiting

Prevent the scanner from diving too deeply into the file tree:

context . --depth 2

Example: Quick PR Review Context

To copy the source code of a specific module to your clipboard for an LLM review, formatted as Markdown:

context src/api -c -f markdown -e rs