Watch Mode
Keep your context files fresh automatically with incremental rebuilds. Watch mode detects file changes and updates only affected bundles.
Why Watch Mode?
Watch mode keeps your AI context always up-to-date as you code. Instead of manually regenerating context files, watch mode automatically detects changes and incrementally rebuilds only the affected bundles.
Instant Context
Zero-cost access for MCP tools
Incremental Rebuilds
Only affected bundles update
Change Detection
See what changed (props, hooks, state)
Syntax
# Start watch mode (recommended)
stamp context --watch
# Alternative syntax
stamp context watch
# With options
stamp context --watch --log-file ./watch.logWatch mode runs in the foreground and monitors your project for changes. Press Ctrl+C to stop.
How It Works
Initial Generation
Watch mode first generates all context files (like stamp context)
File Monitoring
Watches for changes to .ts,.tsx files in your project
Debounced Rebuilds
Changes are batched with a 500ms delay to handle rapid edits efficiently
Incremental Updates
Only the affected folder's context.json is regenerated, not the entire project
Options
| Option | Default | Description |
|---|---|---|
--watch | false | Enable watch mode for continuous file monitoring |
--log-file <path> | none | Write structured change logs to a file for tracking modifications |
--include-style | false | Include style metadata (Tailwind, SCSS, animations) in generated context |
--depth <n> | 2 | Dependency traversal depth for bundles |
All standard stamp context options work with watch mode. The options above are watch-mode specific or commonly used together.
MCP Integration
Watch mode is designed to work seamlessly with the LogicStamp MCP server. When watch mode is active, MCP tools can skip expensive regeneration and access fresh context instantly.
MCP Workflow with Watch Mode
- Start watch mode in a terminal:
stamp context --watch - MCP tool calls
logicstamp_watch_statusfirst - If watch mode is active, skip
refresh_snapshotentirely - Go directly to
list_bundles→read_bundle
With watch mode active, LLM tools get instant access to fresh, pre-generated context without any regeneration overhead.
Watch Status File
Watch mode creates a status file at .logicstamp/context_watch-status.json that MCP tools use to detect if watch mode is running:
{
"active": true,
"projectRoot": "/path/to/project",
"pid": 12345,
"startedAt": "2026-01-21T11:33:48.260Z",
"outputDir": "/path/to/project"
}The status file is automatically cleaned up when watch mode stops (normally or via Ctrl+C).
Example Workflows
# Start watch mode in a terminal
stamp context --watch
# Output:
# ✓ Initial context generated (96 components, 68 bundles)
# 👁 Watching for changes...
#
# [file change detected]
# ↻ Rebuilding src/components/Button...
# ✓ Updated in 45msWhat Changes Are Detected?
Watch mode tracks semantic changes to your components, not just file modifications:
Component Changes
- • Props added/removed/modified
- • State variables changed
- • Hooks added/removed
- • Emitted events changed
Structural Changes
- • New components added
- • Components deleted
- • Import dependencies changed
- • Export signatures modified
Best Practices
Start watch mode when beginning a coding session
Run stamp context --watch in a dedicated terminal alongside your dev server
Use with MCP for the best experience
MCP tools automatically detect watch mode and skip regeneration, giving you instant context access
Add .logicstamp/ to .gitignore
The cache directory and watch status file shouldn't be committed to version control
Use --log-file for debugging
If you need to track what's changing, enable logging to see detailed rebuild information