Skip to main content
NSP reads JavaScript state from Chrome tabs — Gmail, Google Calendar, Slack Web, and other browser-based apps — by connecting to the Chrome DevTools Protocol (CDP). CDP is Chrome’s built-in remote control interface, used by debuggers, test runners, and profilers. By default it is disabled for security reasons. You must enable it at launch by passing a single command-line flag.

Why CDP Is Needed

The NSP daemon’s V8 probe connects to CDP to:
  • Walk the V8 heap and extract live JavaScript object graphs from open tabs
  • Read DOM state for UI-rendered data not available in network responses
  • Inject lightweight state-capture scripts that run inside the page’s JavaScript context
Without the debug port open, NSP cannot attach to any Chrome-based application.

Launching Chrome with the Debug Port

Close all existing Chrome windows before running these commands. Chrome only allows one debug session per user profile. If any Chrome window is already open (even minimized), the new instance will inherit the existing profile and silently ignore the --remote-debugging-port flag.

Verify CDP Is Active

After launching Chrome, confirm the debug port is responding before starting the NSP daemon:
You should see a JSON response like:
If this returns an error or nothing at all, Chrome is not running with CDP enabled. Close all Chrome windows and relaunch with the flag.

Create a Windows Shortcut

Create a permanent desktop shortcut so you don’t have to retype the command each time:
1

Right-click the Desktop

Select New → Shortcut.
2

Set the target

Paste this as the shortcut location (adjust for your Chrome installation path if needed):
3

Name the shortcut

Give it a recognisable name such as Chrome (NSP) so it’s easy to distinguish from your regular Chrome shortcut.
4

Launch and verify

Double-click the new shortcut, then run curl http://localhost:9222/json/version to confirm the port is active.

Chrome Profile Considerations

Every Chrome profile has its own cookies, login sessions, and extensions. Which profile matters for NSP:

Default profile

Works fine if you always close normal Chrome before launching the NSP-enabled instance. You’ll be logged in to all your accounts already.

Dedicated NSP profile

Recommended for production. Use --user-data-dir="C:\Temp\ChromeNSP" to create a separate profile. Log in to the accounts your agent needs and leave normal Chrome untouched.
Extensions installed in your default profile are not available in a dedicated --user-data-dir profile. If your target application requires a Chrome extension to function, install it in the NSP profile.

Opening the Target Application

After Chrome is running with CDP active, navigate to the application you want NSP to monitor. The daemon identifies tabs by URL pattern: Each open tab that matches a known URL pattern appears as a separate entry in GET /substrate/v1/apps. You can have multiple tabs open simultaneously.

Electron Apps

Electron applications (VS Code, Slack Desktop, Discord, Figma, and others) embed their own Chromium and typically expose CDP automatically. NSP detects them from the process command line — no manual flag required:
If an Electron app in your environment does not expose CDP, launch it with its own debug port:
Use a port other than 9222 if Chrome is already using that port.

What Happens When Chrome Closes

If Chrome is closed while NSP is streaming state from it:
  1. The daemon detects the process exit within one scan cycle (default: 5 seconds).
  2. All active session.watch() streams for that PID close with a WebSocketClosed error.
  3. When Chrome relaunches with the debug port flag, the daemon re-detects it and creates a new session with a new PID.
  4. Your agent should call client.wait_for_app() after reconnecting to handle the new session gracefully.

Troubleshooting