Skip to content

Export context

Use --format to select Markdown, JSON, or XML. All formats contain the selected repository context, but their framing and escaping have different token costs, so changing formats can change the available file detail.

Markdown

Markdown is the default and works well for direct review and model prompts:

Shell
contextcraft . --budget 8000 -o context.md

JSON

JSON provides a structured path listing and content entries for downstream tools:

Shell
contextcraft . --format json --budget 8000 -o context.json

Parse the output rather than relying on field order. Its serialized bytes count toward the budget along with the included source.

XML

XML separates source entries with explicit elements:

Shell
contextcraft . --format xml --budget 8000 -o context.xml

Streams and files

Artifact bytes go to stdout by default, or with --output -, while notices, errors, and --stats go to stderr. --quiet suppresses notices while keeping errors visible. Output is plain text, including on a terminal.

File output uses a same-directory temporary file followed by atomic replacement. Existing regular-file permission bits are retained, and destination symlinks are replaced instead of followed.

See output schemas for field definitions and a machine-readable JSON Schema. Continue with secret protection before sharing generated context.