#14690: feat(agent-autonomy): add runtime behavioral health monitor
stale
size: L
Cluster:
Error Handling in Agent Tools
## Summary
- Add a VIGIL-inspired runtime behavioral health monitor for agent sessions
- Detects degradation patterns in real-time: failure streaks, execution loops, rising error rates, context budget exhaustion, and stalled progress
- Each signal produces severity score, suggested intervention, and affected tool list; overall assessment computes a 0–100 health score (healthy/degraded/critical)
## Changes
- `extensions/agent-autonomy/src/behavioral-health-monitor.ts` — monitor implementation (493 lines)
- `extensions/agent-autonomy/src/behavioral-health-monitor.test.ts` — comprehensive test suite (429 lines)
## Test plan
- [x] Unit tests included covering all 5 signal types
- [ ] CI pass on this branch
Ref: [VIGIL paper](https://arxiv.org/abs/2512.07094)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a new `BehavioralHealthMonitor` to the `agent-autonomy` extension that records tool-call events and computes a health assessment based on five degradation signals (failure streak, execution loop, rising error rate, context exhaustion, stalled progress). It also introduces a comprehensive Vitest suite that exercises each signal and the combined scoring/action derivation.
The monitor is currently self-contained within `extensions/agent-autonomy/src/` and is intended to be consumed by agent session/runtime logic to detect real-time degradation and suggest interventions.
<h3>Confidence Score: 2/5</h3>
- Not safe to merge as-is due to a build-breaking missing import/module.
- The new monitor file imports `./types.js`, but that module does not exist in this extension in the provided changeset/HEAD tree, which should break TypeScript resolution and CI. There is also an API/doc mismatch in `getEventCount()` semantics that can mislead consumers.
- extensions/agent-autonomy/src/behavioral-health-monitor.ts
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#14136: feat: add agent collapse safeguards and fix TUI display on abort
by liangweigain-create · 2026-02-11
70.9%
#21290: feat(diagnostics-otel): OpenTelemetry diagnostics with GenAI semant...
by Baukebrenninkmeijer · 2026-02-19
70.2%
#19953: Add SoundChain extension + Agent Eye browser bug catcher
by soundchainio · 2026-02-18
69.8%
#7525: Agents: skip errored tool calls during pairing
by justinhuangcode · 2026-02-02
69.6%
#8713: feat: gateway memory monitor, install linger, docs and failover
by quratus · 2026-02-04
69.4%
#12999: feat(agents): Add streaming response metrics tracking
by trevorgordon981 · 2026-02-10
69.4%
#9085: fix: improve stability for terminated responses and telegram retries
by vladdick88 · 2026-02-04
69.2%
#8166: fix(telegram): lifecycle fixes for duplicate messages and auto-reco...
by cheenu1092-oss · 2026-02-03
68.7%
#13990: feat: add subagent_progress tool for sub-agent progress reporting
by caprihan · 2026-02-11
68.7%
#13524: feat: conditional bootstrap file loading for heartbeat vs DM sessions
by tarun131313 · 2026-02-10
68.6%