Browser URL Capture
CommandLane automatically captures context when you save notes, including the source URL when capturing from a browser. This guide explains how URL capture works and how power users can enable 100% accuracy mode.
How URL Capture Works
When you capture a note from a browser, CommandLane extracts context including:
- App: The browser process (e.g.,
chrome.exe) - Title: The window title
- URL: The source domain (e.g.,
github.com,notion.so) - Timestamp: When the capture occurred
Default Behavior (~85% Coverage)
By default, CommandLane extracts URLs using intelligent title analysis:
-
Domain Pattern Matching: Recognizes 70+ TLDs in window titles
- Example: "Issues · anthropics/claude-code - github.com - Chrome" →
github.com
- Example: "Issues · anthropics/claude-code - github.com - Chrome" →
-
App Name Mapping: Maps 60+ SaaS apps to their domains
- Example: "My Project - Notion" →
notion.so - Example: "Graphite - Google Chrome" →
graphite.dev
- Example: "My Project - Notion" →
-
Browser Suffix Stripping: Removes browser names for cleaner matching
- Supports Chrome, Firefox, Edge, Brave, Arc, Opera, Vivaldi, Safari
This approach is secure (no special configuration needed) and works for most websites.
When URL Capture Returns Null
Some pages don't include the domain in their window title, resulting in a null URL:
- Custom page titles without domain (e.g., "CommandLane Template - Google Chrome")
- Single-page apps that don't update the title
- Electron apps with generic titles
Power User Mode: 100% URL Accuracy
This feature requires running Chrome with a debug port exposed. Only enable this if you understand the security implications and trust all software running on your machine.
For power users who need 100% URL accuracy, CommandLane supports Chrome DevTools Protocol (CDP) integration. This queries Chrome's debug endpoint to get the actual URL of any tab.
Setup Instructions
Step 1: Enable CDP in CommandLane
Set the environment variable before launching CommandLane:
Windows (Command Prompt):
set PKB_CDP_ENABLED=true
Windows (PowerShell):
$env:PKB_CDP_ENABLED = "true"
Permanent (System Environment Variables):
- Open System Properties → Environment Variables
- Add new User variable:
PKB_CDP_ENABLED=true - Restart CommandLane
Step 2: Start Chrome with Debug Port
Chrome must be started with the --remote-debugging-port flag:
Option A: Create a Shortcut
- Right-click on your Chrome shortcut → Properties
- In the Target field, add the flag at the end:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 - Click OK
- Use this shortcut when you want URL capture
Option B: Command Line
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
Option C: Create a Batch File
Create chrome-debug.bat:
@echo off
start "" "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222
Step 3: Verify Setup
- Start Chrome with the debug flag
- Open any webpage
- Capture a note with CommandLane
- Check the captured context—URL should now show the actual domain
Custom Port
If port 9222 is in use, you can specify a different port:
set PKB_CDP_PORT=9333
And start Chrome with the matching port:
chrome.exe --remote-debugging-port=9333
How CDP Works
┌─────────────────── ──────────────────────────────────────────────┐
│ CDP URL Capture Flow │
│ ───────────────────────────────────────────────────────────── │
│ │
│ 1. CommandLane queries: GET http://localhost:9222/json │
│ 2. Chrome returns list of all open tabs with URLs │
│ 3. CommandLane matches window title to find correct tab │
│ 4. Extracts domain from actual URL (e.g., notion.so) │
│ │
│ Timeout: 300ms (falls back to title extraction if unavailable) │
└─────────────────────────────────────────────────────────────────┘
Graceful Fallback
If CDP is unavailable (Chrome not in debug mode, timeout, etc.), CommandLane automatically falls back to title-based extraction. Your captures will never fail—they may just have null URLs for some pages.
Security Considerations
What the Debug Port Exposes
When Chrome runs with --remote-debugging-port=9222:
- Opens a WebSocket server on
localhost:9222 - Exposes Chrome DevTools Protocol
- Allows reading tab URLs, titles, and page content
- Allows executing JavaScript in any tab
- Allows reading cookies and session data
Risk Assessment
| Risk | Severity | Mitigation |
|---|---|---|
| Remote access | Low | Port only binds to 127.0.0.1 (localhost) |
| Local malware | Medium | Malware on your machine could exploit this |
| Corporate policy | Medium | Some organizations block debug ports |
Recommendations
- Only enable CDP on personal machines you fully control
- Don't use in corporate environments without IT approval
- Close Chrome when not needed if running in debug mode
- Use a separate Chrome profile for sensitive browsing if concerned
Troubleshooting
URL Still Null with CDP Enabled
Checklist:
-
Verify
PKB_CDP_ENABLED=trueis set:echo %PKB_CDP_ENABLED% -
Verify Chrome is running with debug port:
curl http://localhost:9222/jsonShould return JSON array of tabs.
-
Check CommandLane logs for CDP errors
"Connection Refused" Error
Chrome is not running with the debug flag. Restart Chrome using the shortcut or command with --remote-debugging-port=9222.
Port Already in Use
Another application is using port 9222. Either:
- Close the conflicting application
- Use a different port:
PKB_CDP_PORT=9333
CDP Works Sometimes
If Chrome was already running when you opened a new window with the debug flag, the debug port won't be active. Close all Chrome windows and restart with the debug flag.
Comparison
| Feature | Default (Title-Based) | CDP Mode |
|---|---|---|
| Coverage | ~85% | 100% |
| Security | No configuration needed | Requires debug port |
| Setup | None | Environment variable + Chrome flag |
| Performance | <1ms | ~300ms (with timeout) |
| Fallback | N/A | Falls back to title-based |
Related
- Keyboard Shortcuts - Quick capture shortcuts