TerminalPulse — Automatic Context Capture for AI-Assisted Debugging
Every time I used Claude or ChatGPT to fix a bug, I went through the same ritual:
- Read the traceback
- Copy the error
- Switch to AI chat
- Explain my project, branch, and current file
- Paste relevant code
- Wait for a response
- Switch back to the terminal
That's a surprising amount of friction repeated dozens of times per week.
So I built TerminalPulse — a background daemon that continuously captures development context and makes it instantly available when something breaks.
When a command fails:
pulse fix
The context is already there.
Core Idea
TerminalPulse builds a time-decaying context graph from three event streams:
- Focus — active file in VS Code
- Activity — recently modified files
- Distress — failed terminal commands
Each event receives a heat score:
heat = e^(-λ × age_seconds) × severity
where:
- λ = decay constant
- age_seconds = current_time - event_time
- severity = importance weight of the event
Older events naturally fade away while recent events remain highly ranked.
The goal is to provide AI tools with the context that is relevant now, rather than a large amount of stale project history.
Architecture
VS Code (Windows) → HTTP:7077 ─┐
Terminal errors → Unix socket ─┼─→ pulsed daemon
File saves → watchdog ─┘
pulsed daemon
↓
~/.devpulse_state.json
↓
pulse fix
↓
TerminalMind / AI Provider
↓
Suggested Fix
The daemon is implemented as a long-running Python asyncio process containing:
- Unix socket server for shell-hook events
- HTTP server for editor-focus events
- Filesystem watchdog for file activity
Shell integration is intentionally lightweight.
A small bash hook runs after failed commands and sends a compact JSON payload to the daemon through a Unix socket without re-executing anything.
Windows ↔ WSL Bridge
I primarily develop using Windows 11 + WSL Ubuntu.
One challenge was transferring editor focus information from Windows into a daemon running inside WSL.
The solution:
- Poll
GetForegroundWindow()on Windows - Extract the filename from the VS Code title bar
- Send focus updates over HTTP
- Store them as graph events inside the daemon
This keeps focus tracking independent of VS Code extensions.
Example Workflow
python3 server.py
# KeyError: 'user_id'
⚡ Error detected. Run 'pulse fix' to auto-fix.
Running:
pulse fix
can automatically gather:
- Project type
- Current git branch
- Recent commits
- Recently modified files
- Relevant source files
- Error traceback
- Active editor context
before sending the request to an AI workflow.
Pattern Detection
TerminalPulse also keeps historical event statistics.
pulse insights
Example output:
Recurring failure:
python3 server.py
Occurrences: 4
Failure rate: 80%
Suggestion:
Consider adding automated tests around authentication logic.
The goal is to identify repeated development bottlenecks rather than only fixing individual failures.
Commands
pulse watch
Auto-detect project and start monitoring.
pulse fix
Generate context and launch AI-assisted debugging.
pulse context
Copy ranked context for ChatGPT, Claude, or Cursor.
pulse insights
Analyze recurring failure patterns.
pulse report
Generate an end-of-day development summary.
pulse mcp
Expose context through an MCP server.
Installation
pip install terminalpulse
pip install terminalmind
tmind auth
pulse install-deps
pulse init
source ~/.bashrc
cd your-project
pulse watch
Current status:
- Python implementation
- Asyncio-based daemon architecture
- Windows + WSL support
- MCP integration
- 29 passing unit tests
GitHub:
https://github.com/prajwal-2509/terminalpulse
PyPI:
https://pypi.org/project/terminalpulse/
I'd appreciate feedback on the architecture, event-ranking model, and any edge cases or failure modes that come to mind.
Top comments (1)
Time-decay on a knowledge graph is a smart move. Most memory systems treat every fact as equally true forever, which is exactly how an agent ends up acting on a decision you reversed two weeks ago. Decay encodes the thing humans do automatically: recent context outranks stale context unless something keeps reinforcing it. The design question I'd dig into is the decay function, uniform half-life, or does access/reinforcement reset it so load-bearing facts stay hot while one-off noise fades? That recency-versus-reinforcement balance is the same problem I wrestle with for agent context in Moonshift, what the agent saw recently versus what's structurally important to the task. How are you tuning the decay rate, and does a re-access bump a node back up?