Generation Command

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

OptionDefaultDescription
--depth <n>1Dependency traversal depth (0 = entry only, 1 = direct deps, etc.).
--include-code <mode>headerInclude none, header, or full source snippets.
--format <fmt>jsonOutput format: json, pretty, or ndjson.
--out <file>context.jsonOutput 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>100Maximum graph nodes per bundle.
--profile <name>llm-chatPreset configuration (llm-chat, llm-safe, ci-strict).
--strictfalseFail when dependencies are missing.
--predict-behaviorfalseExperimental behavioral prediction annotations.
--dry-runfalseSkip writing the output; display summary only.
--statsfalseEmit 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-run

Understanding 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.