Introduction¶
In the DSH (DeepSeek Harness) workflow, agents can extend their capabilities through plugins. dsh-incident-full-chain provides SREs and on-call engineers with a standardized process from incident onset to postmortem closure. It does not replace alerting platforms or LLMs; instead, it turns “on-call triage, mitigation logging, and automated postmortem” into executable commands.
What It Is¶
dsh-incident-full-chain is a DSH workflow plugin maintained by liuhange789. It chains together the full incident lifecycle through three tools: incident_oncall to draft an incident, incident_mitigate to log actions and outcomes, and incident_postmortem to generate a postmortem.md and compute MTTR.
Core Features¶
incident_oncall: Start or Restart an Incident¶
This tool transforms an alert into a structured troubleshooting checklist with ranked hypotheses.
Parameters
alert: Required. A one-line alert description, e.g., “API gateway 5xx error rate at 12%”symptoms: Optional. Log snippets, error codes, or monitoring metrics used to classify the alert family and rank hypothesesservice: Optional. The affected service/moduleseverity: Optional.SEV1/SEV2(default) /SEV3/SEV4at: Optional. Alert time (ISO 8601); defaults to current time; use the actual time when backfilling
Returns
incidentIdsignal: Alert family, one ofmemory/database/cpu/timeout/error-rate/latency/generichypotheses: Hypotheses ranked by confidencechecklist: Ordered troubleshooting pathstatePathreplacedPrevious
Each alert family has its own hypothesis table and troubleshooting checklist. For example, the timeout family first asks you to determine “is it global or concentrated on a downstream service,” then checks DNS and connection pools.
incident_mitigate: Log a Mitigation Action¶
During incident handling, record each action and its outcome. The tool suggests next steps based on a built-in fault tree.
Parameters
action: Required. What was actually done, e.g., “rolled back to v1.42”result: Required.worked(recovered) /partial(partially mitigated) /failed(no effect)note: Optional. Metric changes, error messages, linkskind: Optional.restart/rollback/scale/drain/config/network/data/other; if omitted, inferred fromactionat: Optional. Action time (ISO 8601); defaults to current time
Returns
recoveredrecoveredNowmttrMinuteselapsedMinutesactionCountnextStepswarnings
Rules (deterministic)
- Recovery time is taken from the earliest effective action (sorted by
at): backfilling an earlierworkedaction corrects MTTR to the true value; a later effective action will not increase it partial/failedtriggers the escalation path for that alert family, and action types that have already failed will not be suggested again- When 3 or more consecutive actions are ineffective, a reminder is issued to preserve on-site evidence first
incident_postmortem: Generate a Postmortem Report¶
After incident resolution, use this tool to generate a Markdown-formatted postmortem document.
Parameters
output: Optional. Output path within the workspace; defaults topostmortem.mdauthor: Optional. The person recording the reportat: Optional. Generation time (ISO 8601), used to calculate unrecovered duration
Report Sections
The report sections are fixed: Summary, Impact, Timeline table (with relative minutes), Root Cause Hypothesis & Verification, Remediation & Recovery, Blockers, Action Items (checkable), and Lessons Learned. After generation, the incident is marked as closed.
MTTR Definition¶
MTTR = first(worked action time) − alert time, expressed in whole minutes. It is computed from the timeline and does not rely on inference. For unrecovered incidents, the elapsed duration is reported instead.
Workspace Layout¶
All state is stored under the session workspace (cwd):
.incident/
current.json # points to the currently active incident
INC-20261118-100000/
state.json # append-only timeline + recoveredAt
postmortem.md # generated by incident_postmortem
current.json uses atomic writes; a crash will not leave a partially written state. When continuing the same incident in another process, simply continue calling the tools—no in-memory session is required.
Limitations¶
- Only one active incident is allowed per workspace; starting a new incident replaces the pointer, but the previous state remains on disk
- The fault tree is a fixed shallow table structure; it provides prioritized check items but does not assert diagnostic conclusions
- Reports are Markdown only; no charts, PDFs, or external services are provided
Installation & Activation¶
- Install the package:
npm install @liuhange/dsh-incident-full-chain
- Add the bundle to your DSH configuration file:
{
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-headless",
"@liuhange/dsh-incident-full-chain"
]
}
},
"dependencies": {
"@liuhange/dsh-incident-full-chain": "0.1.0"
}
}
- Restart the profile and the three tools are available; no additional configuration is needed.
Typical Usage¶
Below is a complete example flow from alert to postmortem:
You: Widespread timeouts on the payment API, help me open an incident
Model: incident_oncall alert="Payment API P99 timeout 8s, error rate 21%" service="pay-api"
symptoms="504 gateway timeout, upstream timed out after 10s" severity="SEV1"
Model: incident_mitigate action="Restarted all pay-api instances" result="failed" note="Error rate still at 18%"
→ "Restart" will no longer appear in next-step suggestions
Model: incident_mitigate action="Rolled back to v2.7" result="worked" note="Error rate back to 0.3%"
→ Recovered, MTTR 14 minutes
Model: incident_postmortem author="Zhang San"
→ Written to postmortem.md
Use Cases & Notes¶
This plugin is suited for teams that already use DSH to build workflows and need a standardized incident handling process. It runs with the permissions of the current dsh process; review the source code and license (MIT) before installing.
Summary¶
dsh-incident-full-chain turns three critical phases of incident handling into reusable commands: from alert intake, through mitigation action logging, to an auto-generated postmortem report with MTTR. It does not depend on external services—all facts come from what you record.
- Plugin directory: https://www.skillhub.cn/plugins/liuhange789/dsh-incident-full-chain
- GitHub: https://github.com/liuhange789/dsh-incident-full-chain