Session Management
The session watcher monitors your Contox project for new sessions and tracks the enrichment pipeline progress. It runs alongside the git watcher and provides real-time feedback through VS Code notifications and the status bar.
Session polling
The session watcher polls the Contox API every 30 seconds to check for new sessions. On each poll, it:
- Fetches the 5 most recent sessions for your project
- Updates the status bar with the last save time
- Detects new sessions that were not seen before
- Tracks whether the active session has been closed externally
New session notifications
When a new session is detected (saved via MCP, CLI, or the dashboard), the extension shows a VS Code notification:
Contox: Session saved (MCP) — Built JWT authentication with refresh tokens
The notification includes:
- The source of the session (MCP, CLI, or unknown)
- A truncated summary (up to 120 characters)
- A View Pipeline button to track enrichment progress
- A Dismiss button
Pipeline tracking
After a new session is detected, the extension automatically starts polling the enrichment pipeline every 5 seconds. The pipeline processes your session through four jobs:
| Job | Description |
|---|---|
| Enrichment | AI extracts structured knowledge from session evidence |
| Embedding | Generates vector embeddings for semantic search |
| Deduplication | Removes duplicate or overlapping memory items |
| Drift Check | Detects stale or contradictory information |
The status bar shows the current pipeline status with animated icons:
- Spinning sync icon for running jobs
- Check icon for completed jobs
- Error icon for failed jobs
- Clock icon for pending jobs
Pipeline completion
When the pipeline finishes, the extension shows a completion notification:
Success:
Contox pipeline complete: ✓ Enrichment ✓ Embedding ✓ Deduplication ✓ Drift Check
Failure:
Contox pipeline failed: ✓ Enrichment ✗ Embedding ○ Deduplication ○ Drift Check — error message
After completion, the status bar returns to showing the last save time.
External session closure
When you close a session from the Contox dashboard (for example, by clicking "Generate Memory"), the extension detects this automatically:
- The session watcher notices the active session is no longer present
- The git watcher's capture buffer is reset
- A new session is created automatically
- A notification confirms: "Session closed externally -- new session started."
This ensures the extension always has an active session to capture events into, even when sessions are managed from the dashboard.
Ending a session manually
You can end the current session from VS Code using the Contox: End Session & Start New command (contox.endSession). This:
- Flushes any pending capture events
- Finds the active session for your project
- Closes the session via the API
- Resets the capture buffer
- Creates a new session immediately
Disconnect and reconnect
If you need to temporarily pause all background activity:
- Contox: Disconnect (Pause Sync) (
contox.desync) -- Stops the session watcher and git watcher. The status bar shows a disconnected state. This preference persists across VS Code restarts. - Contox: Reconnect (Resume Sync) (
contox.connect) -- Restarts both watchers. Resumes normal operation.
These commands can also be triggered via deep links:
vscode://contox.contox-vscode/desync
vscode://contox.contox-vscode/connect
Next steps
- Auto Capture -- Details on git commit and diff capture
- Commands -- All 11 extension commands