Vibe Coding Background Agent
You build AI-powered background agents that observe developer workflow and proactively offer help without breaking flow state. You know the architectural stack: file watchers → event triage → action execution → permission gates → suggestion UX. The north star: the best background agent is one you forget is there until it saves you 10 minutes.
DECISION POINTS
Event Triage Matrix
IF event.type === 'file:saved' AND event.ext === '.ts'
→ run-typecheck (immediate, silent)
IF event.type === 'file:saved' AND isTestFile(event.path)
→ run-related-tests (immediate, silent)
IF event.type === 'build:error' AND confidence > 0.8
→ suggest-fix (immediate, requires-approval)
IF event.type === 'build:error' AND confidence <= 0.8
→ queue-for-batch-analysis (background, silent)
IF event.type === 'git:branch-switch'
→ cancel-all-running + prefetch-context (immediate, silent)
IF event.type === 'deps:changed' AND has-lockfile
→ generate-types + security-scan (background, notify)
Permission Decision Tree
Action has side effects?
├─ NO → silent execution
│ └─ Examples: run-tests, typecheck, fetch-docs, lint-check
└─ YES → Check determinism
├─ Deterministic & reversible → notify-after
│ └─ Examples: auto-format, generate-types
└─ Non-deterministic OR irreversible → requires-approval
└─ Examples: suggest-fix, auto-commit, npm-publish
Cost vs Confidence Matrix
CONFIDENCE
Low (<0.6) High (>0.8)
Cost Low | queue-batch | execute-immediate |
High | require-human | execute-with-notify |
Suggestion Timing
IF keystroke-rate > 60/min → queue-suggestions
IF idle-time > 5s AND queue-length > 0 → flush-queue
IF context-switch (file-open, branch-switch) → immediate-delivery
IF flow-state (typing-streak > 2min) → defer-non-critical
FAILURE MODES
Race Condition Cascade
- Symptoms: Multiple actions running on same file, conflicting outputs, test flake
- Detection Rule: If 2+ actions with same dedupeKey within 1s, you've hit this
- Fix: Implement proper debouncing with awaitWriteFinish: {stabilityThreshold: 200}
Permission Creep
- Symptoms: Agent asking approval for everything OR doing dangerous things silently
- Detection Rule: If approval-rate > 40% OR any git/deploy commands in silent-list, you've hit this
- Fix: Review permission policy, move destructive actions to blocked-list
LLM Cost Explosion
- Symptoms: Monthly bill > $100, agent slower than human, constant API rate limits
- Detection Rule: If LLM-calls-per-hour > 50 OR cost-per-session > $2, you've hit this
- Fix: Add deterministic rules for 80% of events, hard budget caps with kill-switch
UI Notification Spam
- Symptoms: Developer ignoring all suggestions, dismissal rate > 80%, complaints about interruptions
- Detection Rule: If visible-notifications > 3 OR dismissal-rate > 70%, you've hit this
- Fix: Reduce to 1 visible notification, batch related items, respect flow-state
Stale Context Poisoning
- Symptoms: Suggestions for old file versions, fixes that don't apply, outdated test failures
- Detection Rule: If suggestion-age > 5min OR file-modified after suggestion-created, you've hit this
- Fix: TTL all suggestions (5min max), invalidate on file-change events
WORKED EXAMPLES
Example 1: Type Generation Pipeline
Scenario: Developer saves schema.prisma file with new User model
Event Flow:
- File watcher detects
prisma extension → deterministic rule match
- Action:
generate-types (background, notify-after permission)
- Execute:
npx prisma generate with 30s timeout
- Success → show toast: "Types generated for User model"
- Background: queue
run-typecheck to validate generated types
- If typecheck fails → promote to approval-required suggestion with diff
Novice Miss: Would run full test suite, not just type generation
Expert Catch: Chains related actions (generate → validate) with proper permission escalation
Example 2: Test Failure Auto-Triage
Scenario: Developer saves auth.ts, 3 tests fail in auth.test.ts
Decision Process:
- Event:
file:saved + test:failed within 2s window
- Confidence analysis:
- Test failures contain line numbers from saved file → confidence = 0.9
- Error messages mention recently changed function → confidence = 0.95
- High confidence → immediate notification tier
- Show persistent toast: "3 auth tests failed - likely caused by recent changes"
- Include 1-click action: "Show diff + suggested fixes"
Trade-offs Navigated:
- Could run auto-fix (faster) vs suggest-fix (safer) → chose safer due to test failures
- Could show all 3 failures vs batched summary → chose batched to avoid noise
- Could interrupt immediately vs wait for pause → waited 5s for natural pause
Example 3: Background Context Prefetch
Scenario: Developer switches to feature/payments branch
Agent Response:
- Git hook fires:
post-checkout event
- Cancel all running actions (old context invalid)
- Background tasks (silent execution):
- Fetch README and recent commits for branch context
- Index new/changed files for semantic search
- Pre-warm relevant documentation (Stripe API docs based on import analysis)
- Status bar update: "Context ready for payments feature"
- If indexing finds potential issues (missing env vars) → queue for next pause
Context Switch Intelligence:
- Read-only checkout (git log, file browsing) → minimal activity
- Checkout + immediate editing → full context preparation
- Branch age > 7 days → extra security/dependency scanning
QUALITY GATES
NOT-FOR BOUNDARIES
This skill is NOT for:
- Chat-based AI where user explicitly asks questions → use
prompt-engineer instead
- System daemon deployment with launchd/systemd → use
daemon-development instead
- Real-time collaborative editing sessions → use
cooperative-vibe-coding instead
- Job queue infrastructure like BullMQ or Celery → use
background-job-orchestrator instead
- Long-running batch processing (>10 min) → use
workflow-orchestration instead
- Security-critical operations requiring audit trails → use
secure-automation instead
Delegate to other skills when:
- Agent needs to persist state across machine restarts → use
daemon-development
- Multiple agents need coordination and conflict resolution → use
multi-agent-coordination
- Background work involves human approval workflows → use
human-in-loop-automation
- Performance monitoring and alerting required → use
observability-implementation
1---2license: Apache-2.03name: vibe-coding-background-agent4description: |5 Build background AI agents that run alongside developers during vibe coding sessions, proactively helping without being asked. Covers file watcher architecture, event queue design, LLM router for triage, action executors, permission models (silent vs. approval-required), non-intrusive suggestion UX, and editor integration (VS Code, Cursor background agents, Claude Code hooks). Activate on 'background agent', 'vibe coding assistant', 'proactive AI helper', 'file watcher agent', 'ambient coding intelligence', 'background coding agent', 'auto-fix agent'. NOT for: chat-based AI (use prompt-engineer), long-running daemons (use daemon-development), real-time human collaboration (use cooperative-vibe-coding).6allowed-tools: Read,Write,Edit,Bash,Glob,Grep,WebSearch,WebFetch7metadata:8 source: https://skillmd.com/skills/curiositech/vibe-coding-background-agent9 category: AI & Agents10 tags:11 - background-agent12 - vibe-coding13 - file-watcher14 - proactive-ai15 - ambient-intelligence16 - developer-experience17 - automation18 - event-driven19 - editor-integration20 pairs-with:21 - skill: always-on-agent-architecture22 reason: Background agents are a specialization of always-on agents with IDE-specific lifecycle23 - skill: daemon-development24 reason: The agent process itself is a daemon that needs graceful lifecycle management25 - skill: cooperative-vibe-coding26 reason: Background agents are AI participants in collaborative vibe coding sessions27 - skill: multi-agent-coordination28 reason: Multiple background agents need coordination to avoid conflicts and redundant work29category: Code Quality & Testing30tags:31 - background-agents32 - vibe-coding33 - automation34 - continuous35 - monitoring36---3738# Vibe Coding Background Agent3940You build AI-powered background agents that observe developer workflow and proactively offer help without breaking flow state. You know the architectural stack: file watchers → event triage → action execution → permission gates → suggestion UX. The north star: **the best background agent is one you forget is there until it saves you 10 minutes.**4142## DECISION POINTS4344### Event Triage Matrix45```46IF event.type === 'file:saved' AND event.ext === '.ts'47 → run-typecheck (immediate, silent)48 49IF event.type === 'file:saved' AND isTestFile(event.path)50 → run-related-tests (immediate, silent)51 52IF event.type === 'build:error' AND confidence > 0.853 → suggest-fix (immediate, requires-approval)54 55IF event.type === 'build:error' AND confidence <= 0.856 → queue-for-batch-analysis (background, silent)57 58IF event.type === 'git:branch-switch'59 → cancel-all-running + prefetch-context (immediate, silent)60 61IF event.type === 'deps:changed' AND has-lockfile62 → generate-types + security-scan (background, notify)63```6465### Permission Decision Tree66```67Action has side effects?68├─ NO → silent execution69│ └─ Examples: run-tests, typecheck, fetch-docs, lint-check70└─ YES → Check determinism71 ├─ Deterministic & reversible → notify-after72 │ └─ Examples: auto-format, generate-types73 └─ Non-deterministic OR irreversible → requires-approval74 └─ Examples: suggest-fix, auto-commit, npm-publish75```7677### Cost vs Confidence Matrix78```79 CONFIDENCE80 Low (<0.6) High (>0.8)81Cost Low | queue-batch | execute-immediate |82 High | require-human | execute-with-notify |83```8485### Suggestion Timing86```87IF keystroke-rate > 60/min → queue-suggestions88IF idle-time > 5s AND queue-length > 0 → flush-queue89IF context-switch (file-open, branch-switch) → immediate-delivery90IF flow-state (typing-streak > 2min) → defer-non-critical91```9293## FAILURE MODES9495### Race Condition Cascade96- **Symptoms**: Multiple actions running on same file, conflicting outputs, test flake97- **Detection Rule**: If 2+ actions with same dedupeKey within 1s, you've hit this98- **Fix**: Implement proper debouncing with awaitWriteFinish: {stabilityThreshold: 200}99100### Permission Creep101- **Symptoms**: Agent asking approval for everything OR doing dangerous things silently102- **Detection Rule**: If approval-rate > 40% OR any git/deploy commands in silent-list, you've hit this103- **Fix**: Review permission policy, move destructive actions to blocked-list104105### LLM Cost Explosion 106- **Symptoms**: Monthly bill > $100, agent slower than human, constant API rate limits107- **Detection Rule**: If LLM-calls-per-hour > 50 OR cost-per-session > $2, you've hit this108- **Fix**: Add deterministic rules for 80% of events, hard budget caps with kill-switch109110### UI Notification Spam111- **Symptoms**: Developer ignoring all suggestions, dismissal rate > 80%, complaints about interruptions112- **Detection Rule**: If visible-notifications > 3 OR dismissal-rate > 70%, you've hit this113- **Fix**: Reduce to 1 visible notification, batch related items, respect flow-state114115### Stale Context Poisoning116- **Symptoms**: Suggestions for old file versions, fixes that don't apply, outdated test failures117- **Detection Rule**: If suggestion-age > 5min OR file-modified after suggestion-created, you've hit this118- **Fix**: TTL all suggestions (5min max), invalidate on file-change events119120## WORKED EXAMPLES121122### Example 1: Type Generation Pipeline123**Scenario**: Developer saves `schema.prisma` file with new User model124125**Event Flow**:1261. File watcher detects `prisma` extension → deterministic rule match1272. Action: `generate-types` (background, notify-after permission) 1283. Execute: `npx prisma generate` with 30s timeout1294. Success → show toast: "Types generated for User model"1305. Background: queue `run-typecheck` to validate generated types1316. If typecheck fails → promote to approval-required suggestion with diff132133**Novice Miss**: Would run full test suite, not just type generation134**Expert Catch**: Chains related actions (generate → validate) with proper permission escalation135136### Example 2: Test Failure Auto-Triage 137**Scenario**: Developer saves `auth.ts`, 3 tests fail in `auth.test.ts`138139**Decision Process**:1401. Event: `file:saved` + `test:failed` within 2s window1412. Confidence analysis:142 - Test failures contain line numbers from saved file → confidence = 0.9143 - Error messages mention recently changed function → confidence = 0.951443. High confidence → immediate notification tier1454. Show persistent toast: "3 auth tests failed - likely caused by recent changes"1465. Include 1-click action: "Show diff + suggested fixes"147148**Trade-offs Navigated**:149- Could run auto-fix (faster) vs suggest-fix (safer) → chose safer due to test failures150- Could show all 3 failures vs batched summary → chose batched to avoid noise151- Could interrupt immediately vs wait for pause → waited 5s for natural pause152153### Example 3: Background Context Prefetch154**Scenario**: Developer switches to `feature/payments` branch155156**Agent Response**:1571. Git hook fires: `post-checkout` event1582. Cancel all running actions (old context invalid)1593. Background tasks (silent execution):160 - Fetch README and recent commits for branch context 161 - Index new/changed files for semantic search162 - Pre-warm relevant documentation (Stripe API docs based on import analysis)1634. Status bar update: "Context ready for payments feature"1645. If indexing finds potential issues (missing env vars) → queue for next pause165166**Context Switch Intelligence**:167- Read-only checkout (git log, file browsing) → minimal activity168- Checkout + immediate editing → full context preparation169- Branch age > 7 days → extra security/dependency scanning170171## QUALITY GATES172173- [ ] **Debouncing configured**: File watcher uses awaitWriteFinish with 200ms stability threshold174- [ ] **Exclusions in place**: node_modules, .git, dist, build directories excluded from watching 175- [ ] **Permission model explicit**: Every action categorized as silent/notify/approval/blocked176- [ ] **LLM budget enforced**: Hard cap at 50 calls/hour with visible spend tracking177- [ ] **Suggestion TTL active**: All suggestions expire after 5 minutes or file modification178- [ ] **Flow state detection**: Agent queues notifications during active typing (>60 keystrokes/min)179- [ ] **Related-only execution**: Tests run only for files that import/are imported by changed file180- [ ] **Graceful cancellation**: Branch switch or manual cancel kills all background processes181- [ ] **Max 3 visible**: Notification UI limits to 3 concurrent items to prevent banner blindness182- [ ] **Engagement tracking**: Agent logs acceptance/dismissal rates for automatic tuning183184## NOT-FOR BOUNDARIES185186**This skill is NOT for:**187- Chat-based AI where user explicitly asks questions → use `prompt-engineer` instead188- System daemon deployment with launchd/systemd → use `daemon-development` instead 189- Real-time collaborative editing sessions → use `cooperative-vibe-coding` instead190- Job queue infrastructure like BullMQ or Celery → use `background-job-orchestrator` instead191- Long-running batch processing (>10 min) → use `workflow-orchestration` instead192- Security-critical operations requiring audit trails → use `secure-automation` instead193194**Delegate to other skills when:**195- Agent needs to persist state across machine restarts → use `daemon-development`196- Multiple agents need coordination and conflict resolution → use `multi-agent-coordination`197- Background work involves human approval workflows → use `human-in-loop-automation`198- Performance monitoring and alerting required → use `observability-implementation`