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 β 6 AI agents, sealed-envelope testing, validated and shipped.
π¬ Pairs with Agent X-Ray β X-Ray scans your agents for weaknesses. Grid-Medic fixes what it finds.
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
Grid-Medic runs as a Copilot CLI custom agent.
# 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.mdRestart your Copilot CLI session (/exit then copilot). Grid-Medic will appear in your agent list.
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.
π₯ 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
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 |
For each issue, Grid-Medic generates a specific, minimal improvement with exact old/new text. No rewrites. Surgical edits only.
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 |
Approved changes are applied to agent files with automatic rollback if anything breaks. YAML frontmatter is validated after every edit.
Everything is logged to ~/.copilot/grid-medic-log.md and tracked in SQL for cross-session trend analysis.
π 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.
- 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.
| Tool | How They Work Together |
|---|---|
| Agent X-Ray | X-Ray scans for weaknesses. Grid-Medic fixes them. |
| Groundhog Day | Groundhog backs up your skills. Grid-Medic keeps agents healthy. |
| Dark Factory | Dark Factory builds agents. Grid-Medic maintains them post-deploy. |
MIT
π Created with π by @DUBSOpenHub with the GitHub Copilot CLI.
Let's build! πβ¨