https://github.com/dubsopenhub/grid-medic
๐ Self-healing meta-agent that monitors, repairs, and continuously improves your AI agent fleet
https://github.com/dubsopenhub/grid-medic
Last synced: 2 days ago
JSON representation
๐ Self-healing meta-agent that monitors, repairs, and continuously improves your AI agent fleet
- Host: GitHub
- URL: https://github.com/dubsopenhub/grid-medic
- Owner: DUBSOpenHub
- License: mit
- Created: 2026-03-06T08:13:12.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-04-10T17:33:32.000Z (4 months ago)
- Last Synced: 2026-07-07T22:21:29.351Z (23 days ago)
- Size: 13.7 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
# ๐ Grid-Medic
> *Your agents just ran a mission. Who's checking if they came back healthy?*
Grid-Medic is a self-healing meta-agent that monitors, repairs, and continuously improves your AI agent fleet. It reads scan outputs, diagnoses failures, proposes minimal fixes, validates every change across multiple AI models, and auto-applies only what passes consensus.
Think of it as the immune system for your agents. They do the work. Grid-Medic keeps them healthy.
---
๐ **Works with any agent.** Scans `.agent.md` prompt files for Copilot CLI, but the patterns apply to any AI agent framework. Zero dependencies beyond the Copilot CLI itself.
๐ญ **Built with [Dark Factory](https://github.com/DUBSOpenHub/dark-factory)** โ 6 AI agents, [sealed-envelope testing](https://github.com/DUBSOpenHub/shadow-score-spec), validated and shipped.
๐ฌ **Pairs with [Agent X-Ray](https://github.com/DUBSOpenHub/agent-xray)** โ X-Ray scans your agents for weaknesses. Grid-Medic fixes what it finds.
---
## Why This Tool?
Agents degrade. APIs change, scoring goes stale, edge cases pile up, new capabilities emerge that your agents don't leverage. Manually reviewing and updating 8+ agent prompt files is tedious and error-prone.
Grid-Medic automates the entire maintenance lifecycle:
- **Self-healing** โ detects and fixes API errors (403 misclassification, deprecated endpoints, malformed queries) without human intervention
- **Multi-model validation** โ every change is reviewed by 3 AI models before being applied. No cowboy commits to your agent prompts
- **Full auditability** โ every diagnosis, proposal, validation result, and applied change is logged with rationale
- **Fleet health tracking** โ quality scores per agent, trend lines over time, a dashboard showing which agents need attention
## ๐ Quick Start
Grid-Medic runs as a [Copilot CLI](https://docs.github.com/copilot/concepts/agents/about-copilot-cli) custom agent.
### Install
```bash
# Copy the agent file to your Copilot agents directory
curl -fsSL https://raw.githubusercontent.com/DUBSOpenHub/grid-medic/main/grid-medic.agent.md \
-o ~/.copilot/agents/grid-medic.agent.md
```
Restart your Copilot CLI session (`/exit` then `copilot`). Grid-Medic will appear in your agent list.
### Run
Open Copilot CLI and say any of these:
```
grid-medic diagnose # Scan all agents for issues
grid-medic improve security-audit # Focus on one agent
grid-medic review-log # See improvement history
grid-medic /path/to/scan-output # Analyze sweep results
```
That's it. Point it at your agents and let it work.
## ๐ง The 5-Phase Improvement Cycle
```
๐ฅ Input ๐ Diagnose ๐ Prescribe ๐งช Validate โ
Apply
โโโโโโโโโโโ โโโถ โโโโโโโโโโโ โโโถ โโโโโโโโโโโ โโโถ โโโโโโโโโโโ โโโถ โโโโโโโโโโโ
diagnose Read agents Generate Send to 3 models Auto-apply
improve X Detect issues minimal fixes (2/3 consensus) + log everything
scan output Categorize Exact old/new Approve / Reject Rollback if broken
```
### Phase 1 โ Diagnosis
Reads all agent files from `~/.copilot/agents/` and categorizes issues:
| Category | Icon | What It Catches |
|----------|------|-----------------|
| API Fix | ๐ด | API calls returning errors, deprecated endpoints, malformed commands |
| Logic Fix | ๐ด | Missing fallback logic, edge cases that crash the agent |
| Scoring | ๐ก | Formulas that produce unintuitive or unfair results |
| Output | ๐ก | Missing evidence citations, broken formatting |
| Prompt Clarity | ๐ก | Ambiguous instructions causing inconsistent behavior |
| Performance | ๐ก | Redundant API calls, sequential ops that could be parallel |
| New Dimension | ๐ข | New data sources or analysis dimensions to add |
### Phase 2 โ Prescription
For each issue, Grid-Medic generates a specific, minimal improvement with exact old/new text. No rewrites. Surgical edits only.
### Phase 3 โ Multi-Model Validation
Every proposed change gets sent to 3 AI models in parallel:
```
๐ Proposed Change
โ
โโโโถ Claude Sonnet โโโถ โ
8/10
โโโโถ GPT Codex โโโถ โ
7/10
โโโโถ Gemini Pro โโโถ โ 4/10
โ
2/3 = Apply with note
```
| Consensus | Action |
|-----------|--------|
| 3/3 Approve | Auto-apply immediately |
| 2/3 Approve | Apply with "majority approved" note |
| 1/3 Approve | Log as proposed, don't apply |
| 0/3 Approve | Reject and log reason |
### Phase 4 โ Application
Approved changes are applied to agent files with automatic rollback if anything breaks. YAML frontmatter is validated after every edit.
### Phase 5 โ Logging
Everything is logged to `~/.copilot/grid-medic-log.md` and tracked in SQL for cross-session trend analysis.
## ๐ Sample Output
```
๐ Grid-Medic Report
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ DIAGNOSIS
Agents scanned: 8
๐ด Errors: 1
๐ก Inefficiencies: 2
๐ข Enhancements: 1
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ IMPROVEMENTS
[๐ด] security-audit: Fix code-scanning 403 response handling
Validation: {Sonnet: โ
9/10} {Codex: โ
8/10} {Gemini: โ
9/10} โ APPLIED โ
[๐ก] msft-impact: Add path: filter to org:microsoft code search
Validation: {Sonnet: โ
8/10} {Codex: โ
7/10} {Gemini: โ
8/10} โ APPLIED โ
[๐ก] octoscanner: Add retry logic for stats/commit_activity 202
Validation: {Sonnet: โ
9/10} {Codex: โ
8/10} {Gemini: โ
7/10} โ APPLIED โ
[๐ข] compliance-inspector: Add SPDX license list version check
Validation: {Sonnet: โ
6/10} {Codex: โ 4/10} {Gemini: โ
5/10} โ PROPOSED
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ AGENT HEALTH DASHBOARD
Agent Quality Issues Trend
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
repo-detective 9/10 0 โ Stable
security-audit 8/10 0 โ Fixed (was 6/10)
contact-info 9/10 0 โ Stable
social-presence 8/10 0 โ Stable
msft-impact 8/10 0 โ Fixed (was 6/10)
compliance-inspector 8/10 1 โ Stable
full-sweep 8/10 0 โ Stable
octoscanner 8/10 0 โ Fixed (was 7/10)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ CUMULATIVE STATS
Total improvements applied: 3
Total improvements proposed: 1
Fleet quality average: 8.3/10
๐ Grid-Medic signing off.
```
## ๐ก๏ธ Safety Rules
- **Never break a working agent.** If uncertain, propose but don't apply.
- **Validate everything.** No change is applied without multi-model consensus (โฅ 2/3).
- **Log everything.** Every diagnosis, proposal, validation, and application is recorded.
- **Minimal changes.** Surgical edits only. Never rewrite an entire agent file.
- **Preserve personality.** Agent codenames, emojis, and voice are sacred.
- **Evidence-based.** Improvements must be justified by observed failures.
- **Rollback on failure.** If a change breaks the file, immediately revert.
- If no issues are found, say so and sign off. Don't invent problems.
## ๐ฌ Works Great With
| Tool | How They Work Together |
|------|----------------------|
| [Agent X-Ray](https://github.com/DUBSOpenHub/agent-xray) | X-Ray scans for weaknesses. Grid-Medic fixes them. |
| [Groundhog Day](https://github.com/DUBSOpenHub/groundhog-day) | Groundhog backs up your skills. Grid-Medic keeps agents healthy. |
| [Dark Factory](https://github.com/DUBSOpenHub/dark-factory) | Dark Factory builds agents. Grid-Medic maintains them post-deploy. |
## License
MIT
---
๐ Created with ๐ by [@DUBSOpenHub](https://github.com/DUBSOpenHub) with the [GitHub Copilot CLI](https://docs.github.com/copilot/concepts/agents/about-copilot-cli).
Let's build! ๐โจ