v0.4.1 Feature

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

Watch mode runs in the foreground and monitors your project for changes. Press Ctrl+C to stop.

How It Works

1

Initial Generation

Watch mode first generates all context files (like stamp context)

2

File Monitoring

Watches for changes to .ts,.tsx files in your project

3

Debounced Rebuilds

Changes are batched with a 500ms delay to handle rapid edits efficiently

4

Incremental Updates

Only the affected folder's context.json is regenerated, not the entire project

Options

OptionDefaultDescription
--watchfalseEnable watch mode for continuous file monitoring
--log-file <path>noneWrite structured change logs to a file for tracking modifications
--include-stylefalseInclude style metadata (Tailwind, SCSS, animations) in generated context
--depth <n>2Dependency 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

  1. Start watch mode in a terminal: stamp context --watch
  2. MCP tool calls logicstamp_watch_status first
  3. If watch mode is active, skip refresh_snapshot entirely
  4. Go directly to list_bundlesread_bundle
Zero-Cost Context Access

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 45ms

What 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