/engineering-discipline:long-runfrom engineering-discipline
Orchestrates multi-day execution of complex tasks through milestone phases (plan, run, review) with checkpoint/recovery. Runs autonomously end-to-end, escalating only on failures.
Ships in engineering-discipline. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Orchestrates multi-day execution of complex tasks through a milestone pipeline. Each milestone passes through plan-crafting → run-plan → review-work with checkpoints between milestones for recovery from interruptions.
Long-running execution must be resumable, auditable, and fail-safe. Every state transition is persisted to disk before the next action begins. If execution stops for any reason — rate limit, crash, user pause, context loss — it can resume from the last checkpoint without repeating completed work.
milestone-planning skill or user-provided. Never generate milestones inline during execution.failed), Mid-Execution Correction requires a scope decision, integration escalation triggers, or loaded state is inconsistent. Post a brief status report at each phase transition so the user can interrupt anytime — state files make every pause resumable.milestone-planning has produced a milestone DAGmilestone-planning first)docs/engineering-discipline/harness/<session-slug>/state.md and milestones/*.md filesIf no state directory exists, ask the user if they want to run milestone-planning first.
state.md from the harness directorymilestones/## Long Run Status: [Session Name]
**Progress:** N/M milestones completed
**Current phase:** [planning M3 | executing M3 | reviewing M3 | ready to start M3]
**Next up:** [M3, M4 (parallel)]
Completed: M1 ✓, M2 ✓
In progress: M3 (executing)
Pending: M4, M5
failed milestone blocks the path forward.For each milestone in topological order:
┌─────────────────────────────────────┐
│ Milestone Pipeline │
│ │
│ ┌──────────┐ ┌─────────┐ │
│ │ Plan │───→│ Run │ │
│ │ Crafting │ │ Plan │ │
│ └──────────┘ └────┬────┘ │
│ │ │
│ ┌────▼────┐ │
│ │ Review │ │
│ │ Work │ │
│ └────┬────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ PASS? │ │
│ │ Yes → checkpoint│ │
│ │ No → retry │ │
│ └─────────────────┘ │
└─────────────────────────────────────┘
Before starting a milestone:
completedplanningplan-crafting skill pattern:
docs/engineering-discipline/plans/YYYY-MM-DD-<milestone-name>.mdexecuting, increment Attempts counter by 1run-plan skill pattern:
failedvalidatingreview-work skill pattern:
completedAttempts counter in state.md, which persists across crashes):
failed, stop, report to userAfter a milestone passes review-work but before writing the checkpoint, verify that the milestone's output integrates correctly with all previously completed milestones:
If integration check passes: Proceed to checkpoint.
If integration check fails — Cross-Milestone Failure Response:
The milestone passed its own review-work (internal correctness) but breaks integration with other milestones. This is a boundary problem.
Diagnose (attempt 1):
Diagnose (attempt 2):
Escalate to user (after 2 failed attempts):
After a milestone passes review:
Write checkpoints/M<N>-checkpoint.md:
# Checkpoint: M<N> — [Milestone Name]
**Completed:** YYYY-MM-DD HH:MM
**Duration:** [time from planning start to review pass]
**Attempts:** [number of plan-execute-review cycles]
## Plan File
`docs/engineering-discipline/plans/YYYY-MM-DD-<name>.md`
## Review File
`docs/engineering-discipline/reviews/YYYY-MM-DD-<name>-review.md`
## Test Results
[Full test suite status at checkpoint time]
## Files Changed
[List of files created/modified in this milestone]
## State After Milestone
[Brief description of system state — what works now that didn't before]
When multiple milestones have all dependencies satisfied and no file conflicts:
isolation: "worktree") to prevent file conflictsWorktree merge protocol:
After all milestones are completed (including the Integration Verification Milestone from milestone-planning):
completingcompleted# Long Run Complete: [Session Name]
**Started:** YYYY-MM-DD
**Completed:** YYYY-MM-DD
**Total milestones:** N
**Total attempts:** [sum of all milestone attempts]
## Milestone Summary
| Milestone | Status | Attempts | Duration |
|-----------|--------|----------|----------|
| M1: [name] | ✓ completed | 1 | 2h |
| M2: [name] | ✓ completed | 2 | 4h |
| ...
## Final Test Suite
[PASS/FAIL — N passed, M failed]
## Files Changed (Total)
[Aggregated list across all milestones]
simplify for a final code quality passWhen resuming a paused or interrupted session:
| Last Status | Recovery Action |
|---|---|
pending | Start normally |
planning | Restart plan-crafting (plan file may be incomplete) |
executing | Check run-plan progress; resume or restart |
validating | Restart review-work (review may be incomplete) |
completed | Skip (already checkpointed) |
failed | Present failure to user; ask whether to retry or skip (see Skip Rules below) |
skipped | Skip (user previously chose to skip this milestone) |
executing milestones: check if tasks in the plan have checkboxes marked. Resume from the first unchecked task.Attempts counter from state.md to determine retry budget remaining. Do not reset the counter on resume — it persists across crashes to prevent infinite retry loops.failed milestone blocks the path or state is inconsistent.If execution reveals that a completed milestone's output is incorrect or a new milestone is needed:
pending, reset their Attempts to 0, and restart from that point.failed and stop.When a user chooses to skip a failed milestone:
skipped in state.mdfailed. The DAG contract is: dependents run only after prerequisites are completed.Skipped milestones cannot be un-skipped. If the user wants to attempt the milestone later, create a new milestone with the same goal.
If a single milestone's total active time (from planning start to review completion) becomes excessive:
planning or executing status for more than what appears to be a proportionally large share of the overall work, pause and report to user: "Milestone M3 has been in progress for an extended period. Continue, re-scope, or abort?"Long-running sessions will hit context window limits. Claude Code automatically compresses old messages (context collapse). The harness must be designed to survive this:
state.md and milestone files on disk. If the context is compressed, the harness re-reads state files — no information is lost.Long-running sessions will encounter rate limits. Claude Code has built-in retry with exponential backoff (up to 10 retries, 5-minute max backoff). The harness should work with this, not against it:
long-run when ready."| Anti-Pattern | Why It Fails |
|---|---|
| Generating milestones inline instead of using milestone-planning | Milestones lack adversarial review; poor decomposition |
| Skipping review-work for "simple" milestones | Undetected defects compound across milestones |
| Continuing after a milestone fails | Dependent milestones build on broken foundation |
| Not updating state.md between phases | Crash loses progress; cannot resume |
| Modifying completed milestone files | Breaks checkpoint invariant; invalidates reviews |
| Running parallel milestones without worktree isolation | File conflicts corrupt both milestones |
| Auto-retrying on rate limit | Wastes quota; user may prefer to wait |
| Pausing for approval between milestones | Defeats autonomous execution — the user opted into a full run at milestone lock. Escalate only on failures and scope changes |
| Merging worktrees without conflict check | Silent data loss if files overlap |
| Skipping cross-milestone integration check | Milestones pass independently but break each other at boundaries |
| Retrying E2E failures indefinitely without user escalation | 2-attempt limit exists to avoid budget waste on misdiagnosed problems |
After long run completion:
simplify skillsystematic-debugging skillmilestone-planning skillThis skill itself does not invoke the next skill. It reports completion and lets the user decide the next step.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub tmdgusya/engineering-discipline --plugin engineering-discipline11 skills in this plugin
/clarificationUse when a user's request is vague, ambiguous, or underspecified. Explores the codebase first, then runs an iterative Q&A loop grounded in the findings until ambiguity is gone. Outputs a clear, well-scoped context brief so the user can plan sharply. Triggers on "I want to...", "I need...", "let's build...", "can you help me...", "we should...", or any request where the full scope isn't immediately clear./clean-ai-slopCorrective cleanup of AI-generated code — removes LLM-specific patterns while preserving behavior. Use when the user says "deslop", "slop", "clean AI code", "remove AI patterns", or when you spot LLM-generated code smells after any generation session. For general post-change review and fixes ("clean up", "simplify"), use the simplify skill instead./karpathyBehavioral guardrails to prevent common LLM coding mistakes — enforces surgical changes, assumption verification, and scope discipline before and during implementation. Use when implementing features, modifying code, or when you notice yourself about to make changes without reading the existing code first./milestone-planningDecomposes complex, multi-day tasks into optimized milestones (ultraplan). Broad parallel exploration grounds a draft milestone DAG, then independent adversarial critics attack the draft in rounds until no blocking findings remain. Triggers when the user says "plan milestones", "break this into milestones", "ultraplan", or when long-run harness needs milestone generation./plan-craftingUse when a task's scope is clear and multi-step implementation is needed, before touching code. Triggered after clarification is complete, or when the user explicitly requests plan creation with a clear prompt./review-workUse after run-plan completes to independently verify the implementation. Reads only the plan document and inspects the codebase from scratch — information-isolated from the execution context. Produces a structured review document with PASS/FAIL verdict. Triggers when the user says "review the work", "verify the implementation", "check if the plan was executed correctly".Other plugins' skills for the same job