AP.PERFENG

Incident Pilot agent skill

An agent skill for evidence-backed alert triage: install the skill in your coding agent, run the local Go service, and investigate recent deploys, logs and traces without guessing at root cause.

Timeline of a deploy correlating with an alert A deploy at 10:37 happened three minutes before the HighRequestLatency alert at 10:40, inside the ten-minute strong correlation window. deploy 10:37 commit a39bf2c alert 10:40 HighRequestLatency weak window: 60 min, medium severity strong window: 10 min, high severity 3m
The correlation behind the headline finding in the demo run: the deploy landed three minutes before the alert, inside the strong window.

Overview

Incident Pilot has two parts: an open-source Go service that turns an alert plus recent context (deploys, error logs, traces, open incidents) into a structured incident, and a SKILL.md agent skill that teaches a compatible coding agent how to operate that service. The agent can start the service, record context, send an alert and explain the resulting evidence-backed findings.

The analysis is done by five deterministic rules, not a model. A finding that cannot cite at least one piece of evidence is dropped by the engine. If you configure an LLM, it only rephrases the findings into prose. It never adds causes and never changes severity.

Requirements: Go 1.22+ and curl. No API keys. The service source is MIT-licensed at github.com/anshikapundeel/incident-pilot.

Agent setup: install, invoke, verify

The repository includes a ready-to-copy SKILL.md. Install it in a skill-aware coding agent such as Claude Code, Codex or Cursor. These instructions assume the agent can access your local project files and run terminal commands.

Skill versus service. Installing SKILL.md gives your agent instructions; it does not start the Go server or connect your monitoring stack. The service runs separately at localhost:9099. For your first test, open the agent in the cloned incident-pilot repository.
  1. Get the repository.
    git clone https://github.com/anshikapundeel/incident-pilot.git
    cd incident-pilot
    The repository root contains both SKILL.md and the Go service source.
  2. Install the skill for your agent. From the repository root, run the commands for your agent. Codex and Cursor can share the same project-level skill folder; Claude Code uses its own folder.
    # Claude Code
    mkdir -p .claude/skills/incident-pilot
    cp SKILL.md .claude/skills/incident-pilot/SKILL.md
    
    # Codex or Cursor
    mkdir -p .agents/skills/incident-pilot
    cp SKILL.md .agents/skills/incident-pilot/SKILL.md
    To use this skill in another repository, copy it into that repository's corresponding skill directory instead. The Go service source must still be available wherever the agent builds and runs it.
  3. Open your agent and select the skill. Start Claude Code, Codex or Cursor in this repository. Skills may activate when a request matches their description, or you can invoke one explicitly:
    AgentHow to invoke
    Claude CodeEnter /incident-pilot or ask the agent to use the skill.
    CodexType $incident-pilot in the prompt, or use /skills to find it.
    CursorSearch for incident-pilot after typing / in Agent chat, or ask for it by name.
    If it is missing, check the SKILL.md path and its YAML frontmatter, then reload your agent session.
  4. Try a reproducible first prompt. Ask the agent to operate against the local demo, not an active production incident:
    Use the incident-pilot skill in this repository.
    Start the local service if needed. For api-gateway, record a
    sample deploy 3 minutes ago and 10 ERROR logs, then send a
    firing HighRequestLatency alert with the current UTC startsAt.
    Fetch the latest incident and explain each rule ID, severity,
    confidence and supporting evidence. Do not claim root cause.
    The agent should use fresh timestamps and record context before firing the alert. The manual quick start below shows the same workflow as terminal commands.
  5. Verify the result. Check that curl -s localhost:9099/healthz prints ok and GET /api/incidents?limit=1 returns the new incident as JSON. With the sample input, you should see deploy.recent_correlated and logs.error_spike among its findings, each backed by evidence. The agent's explanation should preserve the rule output rather than assert a proven cause.

Need a different setup? See the Claude Code, Codex and Cursor skill-directory documentation. These are local coding-agent instructions, not a one-click browser-chat installation.

Quick start

This is the manual terminal demo, independent of your agent. First clone the repository (you can skip installing the agent skill for this section). Record context before the alert, because the rules read context buffers when the alert arrives. Timestamps must be current: only the last hour of context is used, and the alert's startsAt must be after the deploy.

  1. Build and start the service.
    go build -o incident-pilot ./cmd/incident-pilot
    ./incident-pilot            # listens on :9099
    curl -s localhost:9099/healthz    # prints: ok
    Use go build -o, not go build ./..., which compiles but produces no binary.
  2. Record a recent deploy and 10 error logs (the error-spike rule fires at 3 and reaches medium at 10).
    WHEN=$(date -u -v-3M +"%Y-%m-%dT%H:%M:%SZ")   # macOS
    # Linux: WHEN=$(date -u -d '3 minutes ago' +"%Y-%m-%dT%H:%M:%SZ")
    
    curl -X POST localhost:9099/context/deploys -d '{
      "service": "api-gateway", "commit": "a39bf2c1234567",
      "version": "v1.42.3", "author": "alice",
      "summary": "tighten DB pool retry", "when": "'"$WHEN"'"}'
    
    for i in 1 2 3 4 5 6 7 8 9 10; do
      curl -X POST localhost:9099/context/logs -d '{
        "service": "api-gateway", "level": "ERROR",
        "message": "upstream timeout connecting to db"}'
    done
  3. Send the alert.
    NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
    curl -X POST localhost:9099/alerts -H 'Content-Type: application/json' -d '{
      "version": "4", "status": "firing",
      "alerts": [{"fingerprint": "abc123def456", "status": "firing",
        "labels": {"alertname": "HighRequestLatency", "service": "api-gateway",
                   "severity": "high", "team": "team-platform"},
        "startsAt": "'"$NOW"'"}]}'
  4. Read the incident.
    curl -s 'localhost:9099/api/incidents?limit=1'

What you should see

The GET /api/incidents request returns structured JSON. The following human-readable example is printed by the running service to its terminal (stdout); it is not the raw HTTP response.

INCIDENT INC-949002c2 — high
Alert:   HighRequestLatency
Service: api-gateway
Team:    team-platform

  1. [high/high] Recent deploy correlates with alert
     Deployed 3m0s before the alert fired. Commit a39bf2c by alice.
     Evidence:
       - deploy at 10:37:00Z (commit a39bf2c)
       - alert fired at 10:40:00Z

  2. [medium/medium] Error-log volume elevated
  3. [info/high] Team routing: team-platform

Your incident ID and timestamps will differ; the sample commit is fixed in the commands above.

The five rules

Each rule lives in its own file in internal/rules/ and reports a severity and a confidence, which are independent. A rule can be very sure of something minor.

RuleFires whenSeverity
deploy.recent_correlatedA deploy to the same service landed within 10 minutes before the alert (strong) or 60 minutes (weak).high / medium
logs.error_spike3 or more ERROR logs for the service. The dominant message is clustered with numbers collapsed.low at 3, medium at 10, high at 50
traces.tail_latencyAt least 20 trace samples for the service and p99 is 500 ms or more.low at 500 ms, medium at 2 s, high at 10 s
incident.duplicate_openThe same fingerprint, or the same service and alert name, already has an open incident.info / low
routing.teamReports the team label, or flags that it is missing.info / low

The incident's severity is the highest of the alert's own severity and every finding's severity. A finding can raise it. Nothing can lower it.

How the agent behaves

The skill gives the agent five ground rules. They matter more than the commands, because they stop the agent from turning a correct report into a confident guess.

When it explains an incident, the agent leads with the highest-severity, highest-confidence finding, cites its evidence, and ends with that finding's suggested action. If no rule fired, it says the platform had no matching context and that manual investigation is needed. It does not guess a cause.

API reference

EndpointPurpose
POST /alertsAlertmanager webhook. Accepts the envelope or a single bare alert (which needs a non-empty fingerprint). A resolved status closes the matching open incident.
POST /context/deploysRecord a deploy: service, commit, version, author, summary, when.
POST /context/logsRecord an error log: service, level, message, when.
POST /context/tracesRecord a trace sample: trace_id, service, operation, duration_ns (integer nanoseconds), has_error, when.
GET /api/incidents?limit=NList recent incidents.
GET /api/incidents/{id}Fetch one incident in full.
POST /api/incidents/{id}/resolveMark an incident resolved.
GET /api/statsCounters: alerts received, incidents opened, dropped.
GET /healthzLiveness check. Prints ok.

An omitted when defaults to now. Labels the rules read from alerts: alertname, service, severity and team.

Configuration

Everything is off by default, so a fresh install makes no outbound calls. Flags: -addr :8080 changes the port and -quiet turns off the stdout sink.

VariablePurpose
INCIDENT_PILOT_SLACK_WEBHOOKAlso deliver incidents to Slack.
INCIDENT_PILOT_LLM_PROVIDERollama or openai-compatible.
INCIDENT_PILOT_LLM_BASE_URLFor example http://localhost:11434.
INCIDENT_PILOT_LLM_MODELFor example llama3.1:8b.
INCIDENT_PILOT_LLM_API_KEYOnly if the endpoint needs one.

If the LLM is unset or fails, templated narration is used. That is normal, and the incident is still routed.

Troubleshooting

My coding agent does not find incident-pilot

Ensure the copied file is named exactly SKILL.md inside incident-pilot/ beneath your agent's supported skill directory, the YAML frontmatter has valid name and description fields, and your agent is running in the correct repository. Reload the session if necessary. Installing a skill does not start the local Go service.

No deploy finding, though a deploy was recorded

The deploy is older than 60 minutes, was recorded after the alert, or its service does not exactly match the alert's service label. Stale example timestamps are the usual cause.

The alert returned an error, or no incident was created

A resolved alert closes a matching open incident but never opens one. A bare alert with an empty fingerprint is rejected with HTTP 400.

Incidents vanished

The process restarted. The store is in memory.

The trace finding never fires

Fewer than 20 samples exist for that service, so p99 is not computed.

Limits

This is v0, and it is honest about its scope.

Design background. The reasoning behind keeping the LLM out of the analysis path is in the ai-ops-design repository.