stamp init Command
Set up `.gitignore` patterns and project defaults so LogicStamp can generate context safely.
Initialize LogicStamp in your project by setting up .gitignore patterns and other project configuration.
Usage
stamp init [path] [options]Arguments
[path]- Target directory to initialize (default: current directory)
Options
--skip-gitignore- Skip.gitignoresetup--yes, -y- Skip all prompts (non-interactive mode)--no-secure- Skip security scan (security scan runs by default in v0.3.0+)-h, --help- Show help
What It Does
stamp init sets up LogicStamp in your project by:
-
Creating or updating
.gitignorewith LogicStamp-specific patterns:The following patterns are added to prevent generated files and sensitive reports from being committed:
-
context.json- Per-folder context bundles generated bystamp context. These are large JSON files containing component contracts and dependency graphs. They're regenerated on each run and don't need to be versioned. -
context_*.json- Main index file (context_main.json) and other context variants. The main index provides a directory overview of all context files. Likecontext.json, these are regenerated and can be large. -
context.toonandcontext_*.toon- TOON format context bundles generated when using--format toon. These are alternative output format files (similar to JSON but in TOON format) that are regenerated on each run and don't need to be versioned. -
*.uif.json- UIF (User Interface Format) contract files. These are generated contract sidecars that may be created by other LogicStamp tools. They're build artifacts and don't need to be committed. -
logicstamp.manifest.json- Dependency manifest files that track project dependencies. These are generated metadata files that can be regenerated. -
.logicstamp/- Configuration directory containing user preferences (config.json) and potentially cache files. This directory stores local settings and shouldn't be committed. -
stamp_security_report.json- 🔒 SECURITY CRITICAL: Security scan report file generated bystamp security scan. This file only contains sensitive information if secrets are actually detected (file locations, line numbers, code snippets). If no secrets are found, the report will havesecretsFound: 0and an emptymatches: []array. Note: Secrets should not normally be present in TypeScript, JavaScript, or JSON source files—they should be stored in.envfiles or environment variables. The security scan checks for secrets that may have been accidentally committed to source files. This file should never be committed to prevent exposing security findings. Important: Even if you don't runstamp init,stamp security scanautomatically ensures this file is in.gitignoreto protect sensitive findings.
Why these patterns? LogicStamp generates files that are:
- Large (context bundles can be hundreds of KB)
- Regenerable (can be recreated from source code)
- Potentially sensitive (security reports contain secret locations)
- User-specific (configuration preferences vary by developer)
These files are meant for local use and sharing with AI assistants, not for version control.
🔒 Security Note: The
stamp_security_report.jsonpattern is critical for security. This file only contains sensitive information if secrets are actually detected (file paths, line numbers, code snippets). If no secrets are found during the scan, the report will havesecretsFound: 0and an emptymatches: []array. Note: Secrets should not normally be present in TypeScript (.ts,.tsx), JavaScript (.js,.jsx), or JSON (.json) source files—they should be stored in.envfiles or environment variables. The security scan checks for secrets that may have been accidentally committed to source files. Even if you don't runstamp init,stamp security scanautomatically ensures this file is in.gitignoreto protect sensitive findings. Never commit security reports to version control. -
-
Generating
LLM_context.mdin the project root (if it doesn't already exist) - A guide that helps AI assistants understand your project structure and how to work with LogicStamp context files -
Creating
.logicstamp/config.jsonto save your preferences sostamp contextwon't prompt again
Examples
Basic initialization
stamp initInitializes LogicStamp in the current directory. Creates or updates .gitignore with the necessary patterns and runs a security scan by default. This is non-interactive by default - informational messages are shown, but no prompts appear and all operations are performed automatically.
Initialize a specific directory
stamp init ./my-projectInitializes LogicStamp in the specified directory.
Skip .gitignore setup
stamp init --skip-gitignoreInitializes LogicStamp but skips modifying .gitignore. Useful if you want to manage .gitignore manually.
Non-interactive mode
stamp init --yesInitializes LogicStamp without any prompts. All operations are performed automatically. Note: This is redundant since stamp init is already non-interactive by default (security scan runs automatically). The --yes flag is provided for explicit clarity in CI/CD pipelines.
Skip security scan (enables interactive mode)
stamp init --no-secureInitializes LogicStamp without running the security scan. This will:
- Set up
.gitignorepatterns (with interactive prompts if in TTY) - Generate
LLM_context.md(with interactive prompts if in TTY)
Note: By default, stamp init runs a security scan automatically, which makes it non-interactive. Use --no-secure to skip the security scan and enable interactive prompts (when running in a TTY environment).
Behavior
When .gitignore doesn't exist
Creates a new .gitignore file with LogicStamp patterns:
✅ Created .gitignore with LogicStamp patterns
The following patterns were added/verified:
- context.json
- context_*.json
- context.toon
- context_*.toon
- *.uif.json
- logicstamp.manifest.jsonWhen .gitignore exists but doesn't have LogicStamp patterns
Adds LogicStamp patterns to the existing .gitignore:
✅ Added LogicStamp patterns to existing .gitignore
The following patterns were added/verified:
- context.json
- context_*.json
- context.toon
- context_*.toon
- *.uif.json
- logicstamp.manifest.jsonWhen .gitignore already has LogicStamp patterns
If all patterns are present, no changes are made:
ℹ️ .gitignore already contains all LogicStamp patterns
The following patterns were added/verified:
- context.json
- context_*.json
- context.toon
- context_*.toon
- *.uif.json
- logicstamp.manifest.jsonIf some patterns exist but others are missing (idempotent patch mode), only missing patterns are added:
✅ Updated existing LogicStamp section in .gitignore
LLM_context.md Generation
stamp init also generates LLM_context.md in your project root:
✅ Created LLM_context.md
If LLM_context.md already exists:
ℹ️ LLM_context.md already exists
This file provides guidance for AI assistants on how to understand and work with your LogicStamp context files. It's automatically generated from the package template and includes information about:
- Project structure and context file organization
- How to load and use context files
- Understanding bundle structure and metadata
- Interpreting missing dependencies
Interactive Prompts
By default, stamp init is non-interactive because the security scan runs automatically. However, if you use --no-secure, stamp init will prompt you interactively (in TTY mode) for both .gitignore and LLM_context.md setup:
.gitignore Setup Prompt
When .gitignore doesn't already have LogicStamp patterns, you'll see:
💡 LogicStamp generates large context files that are usually not committed.
The following patterns will be added to .gitignore:
- context.json
- context_*.json
- context.toon
- context_*.toon
- *.uif.json
- logicstamp.manifest.json
- .logicstamp/
Add recommended patterns to .gitignore? [Y/n]If you choose "Y" (or just press Enter):
- Patterns are added to
.gitignore - Preference saved as
"added"in.logicstamp/config.json stamp contextwill automatically maintain patterns in future runs
If you choose "n":
.gitignoreis not modified- Preference saved as
"skipped"in.logicstamp/config.json stamp contextwill never touch.gitignore- ⚠️ Security Warning: If you skip this, you must manually ensure
stamp_security_report.jsonis in.gitignorebefore runningstamp security scan, or the security report will be automatically added by the scan command itself.
LLM_context.md Generation Prompt
When LLM_context.md doesn't exist, you'll see:
💡 LogicStamp can generate LLM_context.md to help AI assistants understand your project structure.
Generate LLM_context.md in project root? [Y/n]If you choose "Y" (or just press Enter):
LLM_context.mdis created in the project root- Preference saved as
"added"in.logicstamp/config.json stamp contextwill automatically maintain the file in future runs
If you choose "n":
LLM_context.mdis not created- Preference saved as
"skipped"in.logicstamp/config.json stamp contextwill never create this file
Default Behavior (Non-Interactive)
By default, stamp init is non-interactive because the security scan runs automatically:
- Informational messages are shown (e.g., "The following patterns will be added to .gitignore:")
- No prompts are shown - operations proceed automatically
- All operations are performed automatically without user input
- Preferences are saved to config
To enable interactive mode: Use --no-secure to skip the security scan, which will enable interactive prompts (when running in a TTY environment). In interactive mode, you'll see the same informational messages plus prompts asking for confirmation.
Behavior in stamp context
The stamp context command never prompts—it respects the preferences you set via stamp init:
- If config has
"added"preference: Automatically performs the operation - If config has
"skipped"preference: Skips the operation - If no config exists: Defaults to skipping (safe, CI-friendly behavior)
You can override per-run with the --skip-gitignore flag:
stamp context --skip-gitignore # Never touch .gitignore this runSafety
stamp init is:
- Idempotent - Safe to run multiple times without duplicating patterns
- Non-destructive - Preserves existing
.gitignorecontent - Safe by default - Only adds patterns, never removes anything
Security Considerations
🔒 Important Security Notes:
-
Security Report Protection: The
stamp_security_report.jsonpattern is critical for security. This file only contains sensitive information if secrets are actually detected (file paths, line numbers, code snippets). If no secrets are found, the report will havesecretsFound: 0and an emptymatches: []array. Note: Secrets should not normally be present in TypeScript (.ts,.tsx), JavaScript (.js,.jsx), or JSON (.json) source files—they should be stored in.envfiles or environment variables. The security scan checks for secrets that may have been accidentally committed to source files. Even if you skip.gitignoresetup duringstamp init,stamp security scanwill automatically add this pattern when it runs. Never commit security reports to version control. -
If You Skip
.gitignoreSetup: If you choose to skip adding patterns to.gitignore:- You must manually ensure
stamp_security_report.jsonis in.gitignorebefore runningstamp security scan - Or rely on
stamp security scanto automatically add it (which it will do) - Other patterns (context.json, etc.) are optional but recommended to avoid committing large generated files
- You must manually ensure
-
Automatic Protection:
stamp security scanalways ensures the security report file is in.gitignore, regardless of yourstamp initpreferences. This cannot be disabled because security reports must never be committed.
When to Use
Use stamp init when:
- Setting up LogicStamp in a new project
- You want explicit control over initialization
- You want to set up
.gitignorebefore generating context files
You don't need stamp init if:
- Your
.gitignorealready has the necessary patterns - You prefer to manually manage
.gitignoreandLLM_context.md - You're running
stamp contextin CI (it defaults to skipping both operations)
Related Commands
stamp context- Generate context files (includes smart detection)stamp context validate- Validate generated context filesstamp context compare- Detect drift in context filesstamp security scan- Scan for secrets and generate security report
Related Commands
Next Steps
Generate context next, or review the full command reference.