An open API service indexing awesome lists of open source software.

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

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! ๐Ÿš€โœจ