AI Latency Fitness
Turn AI wait time into micro-exercise prompts. When the extension detects AI-like edits streaming into your project — no open tab required — it shows a modal with a quick exercise and Done / Skip.
Works automatically with zero configuration — install it and forget it.
Detection uses two parallel watchers:
- Open buffers —
onDidChangeTextDocument for exact character counts in any open file
- Disk writes —
FileSystemWatcher for files written directly by external tools (Claude Code, Cursor, Copilot CLI) even when no tab is open
This means you can close all editor tabs, start a long agent run, and still get prompted at the right moment.
Local-only — no network, telemetry, or backend.
Exercise prompt

Skip shame (respectful, exercise-specific)

How it works
Detection
The extension runs two parallel watchers:
- Open buffers (
onDidChangeTextDocument) — exact character counts for any file open in a tab
- Disk writes (
FileSystemWatcher) — file size deltas for any file written directly to disk by external tools (Claude Code, Cursor, Copilot CLI) — no tab required
When either watcher sees enough editing activity (rapid inserts, large single edits, multi-file changes, or new file creations), it confirms an AI is at work and queues an exercise prompt.
Prompts only appear when VS Code/Cursor is the focused window — switching to another app suppresses them.
Exercise tiers
The exercise shown is matched to how long the AI has been working:
| Tier |
When it triggers |
Exercise duration |
Cooldown before next prompt |
Examples |
| Micro |
Short burst — quick fix, autocomplete |
~10–30 sec |
30 sec |
Neck rolls, wrist circles, eye focus reset, box breathing |
| Moderate |
Medium task — function rewrite, test generation |
~30 sec – 2 min |
45 sec |
Chair squats, desk pushups, wall sit, hip flexor stretch |
| Full |
Long run — multi-file refactor, scaffold, large context |
2+ min |
60 sec |
Jumping jacks, plank hold, lunges, burpees, push-ups |
| Hourly break |
1 hour of continuous work in the focused window |
5 min |
60 sec |
Take a walk, Touch grass |
After each prompt the extension waits for the cooldown before showing another — no back-to-back interruptions during long agent runs. The cooldown is matched to how long it realistically takes to complete that tier's exercise.
The hourly break timer resets automatically if you step away for 5+ minutes.

If the Prompt Bridge is enabled, the tier is pre-selected from your prompt text before any edits arrive — so the exercise is matched to the task, not just the wait time.
Requirements
- VS Code
^1.85.0 or compatible editors (e.g. Cursor)
Settings
| ID |
Default |
Description |
latencyGains.enabled |
true |
Master on/off |
latencyGains.idleThresholdMs |
0 |
Milliseconds after a burst starts before showing a prompt (0 = as soon as streaming is detected) |
latencyGains.promptBridge.enabled |
false |
Enable prompt-bridge early trigger (see below) |
Click the ⚡ status bar item to instantly pause or resume — or use the command Latency Gains: Toggle Enable/Disable.
Local file access
The extension reads and writes only two locations outside the workspace:
| Path |
Purpose |
~/.latency-gains/state.json |
Session stats persisted across restarts (exercise count, skips, total time) |
~/.latency-gains/prompt-bridge.json |
Optional early-trigger signal written by external hooks (read-only by extension) |
Both files are plain JSON in your home directory. No data leaves the machine.
Prompt Bridge (optional)
When latencyGains.promptBridge.enabled is true, the extension watches ~/.latency-gains/prompt-bridge.json for signals written by Claude Code or Cursor hooks. This lets the extension pre-select the right exercise tier before you even stop typing.
Example Claude Code hook (~/.claude/settings.json):
{
"hooks": {
"PreToolUse": [{
"matcher": ".*",
"hooks": [{
"type": "command",
"command": "node -e \"const fs=require('fs'),os=require('os'),p=require('path');const d=p.join(os.homedir(),'.latency-gains');fs.mkdirSync(d,{recursive:true});fs.writeFileSync(p.join(d,'prompt-bridge.json'),JSON.stringify({promptText:process.env.CLAUDE_PROMPT||'',timestamp:Date.now()}));\""
}]
}]
}
}
The bridge file is ignored if it is older than 60 seconds.
Install from VSIX (any project)
After install, the extension applies to all workspaces.
cd packages/vscode
npm install
npm run build
npx @vscode/vsce package --no-dependencies
code --install-extension ./latency-gains-0.0.1.vsix
# or: cursor --install-extension ./latency-gains-0.0.1.vsix
Reload the editor window. Bump version in package.json before packaging a new build.
Development
From monorepo root, use the existing launch.json Run Extension configuration, or build as above.
Publish to the Marketplace
- Create a publisher and install
@vscode/vsce.
vsce login <publisher>
- Ensure
publisher in package.json matches your Marketplace publisher id.
npm run build in packages/vscode, then vsce publish (from packages/vscode).
Repository
https://github.com/IGatsby9/AI_Fitness_plugin
License
MIT — see LICENSE.