-
Notifications
You must be signed in to change notification settings - Fork 0
Add env_investigate job for production debugging with Grafana MCP subagents #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
ncrmro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot can you rewrite this using the existing job pattern and update or create an AGENTS.md explaining how to use this meta framework
Co-authored-by: ncrmro <8276365+ncrmro@users.noreply.github.com>
Done! I've restructured Added files (commit 79b8ba0):
Meta-framework explanation in AGENTS.md: The structure now matches |
|
@copilot How would you have us use the claude serve mcp or gemini --acp flag to do suagebta ourselves in a unifef way |
The current implementation uses Claude Code's Task tool for subagent isolation (spawning isolated contexts) rather than running separate MCP servers. This works for Claude Code but has no equivalent in Gemini CLI. If you want to use native MCP server features ( Approach:
Trade-offs:
The current implementation with isolated subagents (via Task tool) was chosen because it guarantees context isolation for Claude Code users. The MCP server approach would require agents to manually truncate/summarize, which is less reliable. Would you like me to add documentation for the MCP server approach as an alternative pattern, or modify the implementation to use native MCP features? |
|
@copilot I was thinking more along the lines that either agent could delegate work to another agent |
Adds a pre-built 6-step investigation workflow for debugging production issues using Grafana MCP (Prometheus, Alertmanager, Loki). Delegates all observability queries to isolated subagents to prevent context bloat from log dumps and metric time series.
New Job: env_investigate
Six-step workflow:
triage→alert_check→metrics_analysis→log_investigation→root_cause→remediationEach step produces structured markdown artifacts. Observability steps delegate to specialized subagents that enforce strict output contracts (max 10 alerts/metrics, 5 log lines, 200 char truncation).
Subagent Templates (Claude Code)
Three analyst subagents in
src/deepwork/templates/claude/agents/:mcp__grafana__get_alerts, returns YAML summary grouped by severitymcp__grafana__query_prometheus, samples 10 data points per metric with trendsmcp__grafana__query_loki, returns pattern counts + max 5 truncated log samplesGenerated to
.claude/agents/*.mdduring sync. Subagents return structured YAML, never raw observability data.Platform Support
Claude Code: Full subagent isolation via Task tool delegation
Gemini CLI: Inline summarization rules in step instructions (no subagent support)
Agent Generation System
New
AgentGeneratorclass renders Jinja2 templates fromsrc/deepwork/templates/{platform}/agents/:Integrated into
deepwork syncanddeepwork installflows. Install now includes env_investigate alongside deepwork_jobs and deepwork_policy.Standard Job Pattern
The job follows the standard DeepWork job pattern with:
AGENTS.md - Comprehensive documentation (8.7KB) explaining the observability subagent meta-framework:
templates/ - 7 artifact templates for investigation outputs:
triage.md.template- Investigation scope structurealerts.md.template- Alertmanager analysis formatmetrics.md.template- Prometheus metrics formatlogs.md.template- Loki logs formatroot_cause.md.template- Root cause analysis structuretimeline.md.template- Incident timeline formatremediation.md.template- Remediation plan structuremake_new_job.sh - Script to create investigation directories with README tracking
Example Usage
Step instructions delegate queries:
Subagent returns:
Files Added
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.