stamp context Command
Generate AI-ready bundles that describe your React/TypeScript codebase.
Syntax
stamp context [path] [options][path] (optional) – Directory to scan. Defaults to the current working directory. Paths can be relative (for example, ./src) or absolute.
Output Structure
LogicStamp Context generates folder-organized, multi-file output:
Multiple context.json files, one per folder containing components
Directory structure mirrors your project layout
context_main.json index file at the output root with folder metadata
Each folder containing components gets its own context.json file with bundles for that folder's components. The context_main.json file serves as a directory index with summary statistics and folder metadata.
First Run Behavior
On first run in interactive mode, stamp context will prompt you to:
Add LogicStamp patterns to .gitignore (to exclude context files from version control)
Generate LLM_CONTEXT.md in the project root (to help AI assistants understand your project structure)
Your preferences are saved in .logicstamp/config.json and respected on subsequent runs. See stamp init for explicit setup or to skip these prompts.
Behavior
Each run of stamp context performs a full scan, generates context files organized by folder, and then automatically validates the generated context before writing it to disk. The CLI output shows both the generation and validation steps so you can see when schema issues are caught.
Options
| Option | Default | Description |
|---|---|---|
--depth <n> | 1 | Dependency traversal depth (0 = entry only, 1 = direct deps, etc.). |
--include-code <mode> | header | Include none, header, or full source snippets. |
--format <fmt> | json | Output format: json, pretty, or ndjson. |
--out <file> | context.json | Output directory or file path. If a .json file is specified, its directory is used as the output directory. Otherwise, the path is used as the output directory. Context files will be written maintaining folder structure within this directory. |
--max-nodes <n> | 100 | Maximum graph nodes per bundle. |
--profile <name> | llm-chat | Preset configuration (llm-chat, llm-safe, ci-strict). |
--strict | false | Fail when dependencies are missing. |
--predict-behavior | false | Experimental behavioral prediction annotations. |
--dry-run | false | Skip writing the output; display summary only. |
--stats | false | Emit single-line JSON stats (ideal for CI). |
Example Workflows
# Scan entire repo and write context files (defaults)
stamp context
# Creates: context_main.json + context.json files in each folder
# Generate context for ./src with pretty-printed output
stamp context ./src --format pretty
# Include full source for deep AI reviews (limit nodes for safety)
stamp context --include-code full --max-nodes 20
# Custom output directory
stamp context --out ./output
# Or specify a file to use its directory
stamp context --out ./output/context.json
# Gather metrics without writing a file (e.g., CI dashboards)
stamp context --stats >> .ci/context-stats.jsonl
# Dry run to confirm counts before overwriting an existing file
stamp context ./packages/ui --dry-runUnderstanding meta.missing
The generated bundles include a meta.missing array that captures unresolved dependencies. An empty array ([]) confirms all dependencies were successfully resolved.
Expected
External packages like React or other npm modules (safe to ignore).
Actionable
Paths with reason file not found or outside scan path typically require code or configuration changes.
In CI you can enable --strict-missing to treat unexpected missing dependencies as errors.