Best for
- Complete an epic by conducting a retrospective, tagging the milestone, and updating tracking. No branch merge needed — stories already merged to the development branch during story-close.
humansys/raise/packages/raise-cli/src/raise_cli/skills_base/rai-epic-close-enterprise/SKILL.md
Close epic with retrospective, push, and merge request. Use after all stories done.
Decision brief
Close epic with retrospective, push, and merge request. Use after all stories done.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/humansys/raise --skill "packages/raise-cli/src/raise_cli/skills_base/rai-epic-close-enterprise"Inspect the Agent Skill "rai-epic-close-enterprise" from https://github.com/humansys/raise/blob/88a77d6e4065e3c8bdbae9be4aff5b84e6a7a5eb/packages/raise-cli/src/raise_cli/skills_base/rai-epic-close-enterprise/SKILL.md at commit 88a77d6e4065e3c8bdbae9be4aff5b84e6a7a5eb. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
1a. Check all stories are done in the epic scope document:
Query Jira for child stories that are NOT in Done status:
After child reconciliation passes, query the parent epic itself:
Do not run the full suite here — the full gate runs once in Step 4 via /rai-mr-create before push. Trust the scoped gates that passed during story-close.
Tag the current {devbranch} HEAD to mark epic completion:
Permission review
The documentation asks the agent to run terminal commands or scripts.
git tag -a "epic/e{N}-complete" -m "Epic E{N}: {Epic Name} completeThe documentation asks the agent to run terminal commands or scripts.
git add work/epics/e{N}-{name}/Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 92/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 71 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Complete an epic by conducting a retrospective, tagging the milestone, and updating tracking. No branch merge needed — stories already merged to the development branch during story-close.
When to use: All stories complete and merged to {dev_branch}. Ready to close the epic lifecycle.
When to skip: Epic abandoned (document why, update backlog as "Abandoned").
Inputs: Epic scope document, all story retrospectives, passing test suite.
Branch config: Read branches.development from .raise/manifest.yaml for {dev_branch}. Default: main.
Before executing any step, verify this skill was invoked via the pipeline engine:
Run ID: appears in the context above (injected by pipeline/prompt.py)Standalone execution detected. This skill is running outside the pipeline engine. Prior phases (docs, journal) may have been skipped.
Options:
- Continue anyway (acknowledge that prior phases were skipped)
- Abort and investigate why the pipeline engine is not orchestrating
Wait for the user's explicit choice before proceeding. This gate fires even in Ri mode — standalone execution is a signal of broken infrastructure, not a routine gate.
Before starting Step 1, you MUST execute the PRIME protocol:
scope.md if present (rai-epic-plan appends the Implementation Plan / Milestones / Sequencing Risks sections there), and each completed story's work/epics/e{N}-{name}/stories/s{N}.{M}-retrospective.md if present. This provides context for the retrospective. If scope.md or story retrospectives are missing (legacy epic), note and continue.raise_graph_query MCP tool with cwd="{project_or_worktree_path}". If MCP tools are not available, fall back to:
rai graph query
If graph is unavailable, note and continue.1a. Check all stories are done in the epic scope document:
grep -E "^\s*-\s*\[ \]" "work/epics/e{N}-{name}/scope.md"
| Condition | Action |
|---|---|
| All stories checked | Continue to 1b |
| Incomplete stories | Complete them first or explicitly descope |
1b. Scope re-read (mandatory — do not skip): open work/epics/e{N}-{name}/scope.md and the original epic brief. Go through the "In scope" and "Done when" sections item by item and verify each commitment against observable state of the code. Do not trust "all stories checked ⇒ scope fulfilled" — it's not the same claim.
Pay special attention to commitments with elimination verbs ("eliminate X", "remove Y", "replace Z with …", "consolidate A and B"). For each such commitment, answer one of three explicitly in the retrospective:
This exists because RCA s2092.1 showed E1323 ("eliminate subprocess layer") closed Done while the layer was actually amplified — the tools shipped, the tests passed, nobody re-read the scope (pattern refactor-declared-done-without-sweep at epic-scale).
JIT: Before descoping decisions, query graph for completion patterns and prior descoping outcomes →
aspects/introspection.md § JIT Protocol
Query Jira for child stories that are NOT in Done status:
rai backlog search "parent = {EPIC_KEY} AND status != Done"
| Condition | Action |
|---|---|
| No results (all Done) | Continue to Step 2 |
| Drifted stories found | Present the list and offer resolution (see below) |
| No Jira adapter configured | Warn: "Jira reconciliation skipped — no adapter" and continue |
| No epic Jira key | Warn: "No Jira key for epic — skipping reconciliation" and continue |
| Query fails (network, auth) | Warn: "Jira query failed �� manual check recommended" and continue |
When drifted stories are found, present:
Jira drift detected: {N} child stories are not in Done status.
{KEY-1} {status} {summary}
{KEY-2} {status} {summary}
...
Options:
1. Batch-transition to Done: rai backlog batch-transition {KEY-1},{KEY-2} done
2. Descope explicitly (document in retrospective why they're not Done)
3. Abort epic close and fix the stories first
Do NOT proceed to Step 2 until the user has chosen an option. This gate prevents silent Jira drift that was found in E1690 audit (5 stories locally done but Backlog in Jira).
After child reconciliation passes, query the parent epic itself:
rai backlog get {EPIC_KEY}
| Condition | Action |
|---|---|
| Epic is already Done | Continue to Step 2 |
| all child stories are Done but the epic is not | Present the discrepancy and resolve it before continuing |
| Epic status cannot be read | Stop immediately — manual reconciliation required before epic close |
When the epic is stale-open while all children are Done, present:
Parent status drift detected: all child stories are Done but the epic is not.
Options:
1. Transition the epic now, then verify the new status
2. Abort epic close and investigate why the parent stayed open
Do NOT proceed to Step 2 until the parent epic is in Done status or the close is aborted.
Do not run the full suite here — the full gate runs once in Step 4 via /rai-mr-create
before push. Trust the scoped gates that passed during story-close.
JIT: Before writing retrospective, query graph for process improvement patterns from similar epics →
aspects/introspection.md § JIT Protocol
Publish retrospective to local path and docs adapter. Use templates/retrospective.md as structure, fill from story retrospectives and git history:
Use raise_docs_write MCP tool with doc_type="retrospective", title="E{N}: {Epic Name} — Retrospective", content="[content following templates/retrospective.md structure]", output_path="work/epics/e{N}-{name}/retrospective.md", cwd="{project_or_worktree_path}".
If MCP tools are not available, fall back to:
rai docs write retrospective \
--title "E{N}: {Epic Name} — Retrospective" \
--stdin \
--output-path work/epics/e{N}-{name}/retrospective.md << 'EOF'
[content following templates/retrospective.md structure]
EOF
Emit the retrospective as a structured artifact so epic.yaml's close.validates (RAISE-11088) can prove — in SQLite, issue-scoped by construction — that THIS epic's own retrospective exists before close can complete. A repo-wide work/epics/**/retrospective.md glob would be satisfied by ANY epic's retrospective already in the repo (epic directory numbering is not reliably Jira-key-derived); this sqlite record cannot be:
raise_artifact_emit(
artifact_type="retro",
story_id="{JIRA_KEY}",
content=<JSON with fields: patterns_learned (list[str]), reinforcements (list[str]), velocity_ratio (optional float), notes (optional str)>,
cwd="{project_or_worktree_path}"
)
CRITICAL — identifier mismatch risk (same hazard as RAISE-11147's implement fix): story_id here MUST be {JIRA_KEY} — the pipeline's issue key (the same value passed to pipeline_start, e.g. "RAISE-11404"), NOT the e{N} directory-number convention used by this step's output_path above (epic directories are not reliably Jira-key-derived — e.g. e3-scaleup-agent vs e11404-...). epic.yaml's sqlite validate branch looks up artifact_store.exists(run["issue_id"], "retro"), and run["issue_id"] is always the Jira key. Emitting with the directory number instead would make the sqlite lookup never find the artifact, turning close into a permanent artifact_missing deadlock.
Note: The CLI fallback for artifact emission was removed in v3.0.0. MCP tool raise_artifact_emit is required. If MCP tools are not available, skip structured artifact emission — the pipeline will require it before close can complete.
Tag the current {dev_branch} HEAD to mark epic completion:
git tag -a "epic/e{N}-complete" -m "Epic E{N}: {Epic Name} complete
Delivered: [key deliverables]
Stories: N stories
Co-Authored-By: Rai <[email protected]>"
Commit retrospective and any final artifacts (scoped to this epic's directory — RAISE-11778: git add -A in a shared checkout silently sweeps in unrelated uncommitted work from other sessions):
git add work/epics/e{N}-{name}/
git commit -m "epic(e{N}): close with retrospective
Co-Authored-By: Rai <[email protected]>"
Invoke /rai-mr-create — it runs the full gate suite, rebases onto target if needed,
pushes, and creates the MR. This is the single point where the full test suite runs.
/rai-mr-create
source_branch: {dev_branch}
target_branch: {main_branch}
title: "epic(e{N}): {Epic Name}"
description: |
## Epic E{N}: {Epic Name}
### Stories delivered
- S{N}.1: {name}
...
### Key changes
- {summary of deliverables}
Co-Authored-By: Rai <[email protected]>
| Condition | Action |
|---|---|
| Full gate passes | /rai-mr-create pushes and creates MR |
| Gate fails | Fix before push — do not skip |
| No release planned | Push dev only via /rai-mr-create without MR |
apply_phase_transition / terminal-close gate (RAISE-10966).
No skill-initiated transition call required or allowed.
If no Jira key is known, search first to confirm the key:rai backlog search "summary ~ '{epic name}'"
Then enforce Jira consistency (RAISE-10966) — blocking, not best-effort:
branches.development
(e.g. release/3.1.0 → 3.1.0) and assign it as the fixVersion:
rai backlog update {JIRA_KEY} -F 'fixVersions=[{"name": "{version}"}]'
rai backlog get {JIRA_KEY}
If the status is not in a Done category, or the fixVersion assignment
failed, FAIL the close — do not log-and-continue.| Condition | Action |
|---|---|
| Jira key known | statuses list → infer → transition |
| No Jira key | search → resolve key → transition |
| Transition fails / not Done on re-read | FAIL the close — epic close cannot complete with stale parent status |
| fixVersion assignment fails | FAIL the close |
The mission CLI was eliminated in ADR-130 — there are no longer "mission objectives" to mark.
The worktree binding survives as worktrees.workitem_id. Verify the worktree is correctly
associated with the epic's initiative:
rai worktree list # confirm workitem_id reflects the linked initiative
If the worktree should be closed after this epic (mission complete), run:
rai worktree complete # marks worktree status → closed
| Condition | Action |
|---|---|
| Epic is last in this worktree's scope | rai worktree complete |
| More epics remain in this worktree | Skip complete — worktree stays open |
| No worktree registered | Skip silently |
git reset --hard, git clean -fd, or git checkout -- . to resolve an unexpected working tree state — STOP and report instead, it may hold someone else's uncommitted workgit add -A — stage only work/epics/e{N}-{name}/| Item | Destination |
|---|---|
| Retrospective | work/epics/e{N}-{name}/retrospective.md |
| Retro artifact | SQLite (artifact_type=retro, keyed by Jira issue key) |
| Tag | epic/e{N}-complete on {dev_branch} |
| Push | {dev_branch} pushed to origin |
| Merge request | GitLab MR: {dev_branch} → {main_branch} (if release) |
| Backlog update | Tracker via rai backlog CLI |
STOP HERE. Return your summary to the orchestrator. Do NOT invoke any further skill.
{dev_branch}rai worktree list); rai worktree complete if final epic in this worktreetemplates/retrospective.md/rai-story-close completions/rai-epic-design for next epicFrequently asked questions
Close epic with retrospective, push, and merge request. Use after all stories done.
The source record exposes this install command: npx skills add https://github.com/humansys/raise --skill "packages/raise-cli/src/raise_cli/skills_base/rai-epic-close-enterprise". Inspect the command and pinned source before running it.
Static rules flagged exec-script in the source; the page lists the matching lines and excerpts.