[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M754ZBWMQDD7PXSYN2VY8QZM":3,"skill-same:01M754ZBWMQDD7PXSYN2VY8QZM":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":40,"commitSha":41,"skillDirectory":42,"forksCount":43,"repositoryHtmlUrl":44,"repositoryHomepageUrl":6,"ownerHtmlUrl":45,"ownerBlogUrl":46,"ownerDescription":47,"updatedAt":48,"install":49,"resources":61},"01M754ZBWMQDD7PXSYN2VY8QZM","x-refine-epic",null,"Multi-persona 4-phase strategic epic refinement dispatcher. Phase A: 5-6 parallel specialist agents analyse the epic for strategic gaps. Phase B: single consolidated question batch to the operator. Phase C: 5-6 parallel specialists refine with answers. Phase D: Architect (opus) consolidates a Refinement Verdict with scope=epic and dual-writes to execution-state.json + epic markdown.","review-bench\u002Federcnj_ia-dev-environment","review-bench","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F286778065?v=4","01M7517F9NTEPDZDAXJBR30FWT","ReviewBench","01M7517FAC9F4P7TGWCNJ8VYVW",0,"MIT","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-refine-epic\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: x-refine-epic\ndescription: \"Multi-persona 4-phase strategic epic refinement dispatcher. Phase A: 5-6 parallel specialist agents analyse the epic for strategic gaps. Phase B: single consolidated question batch to the operator. Phase C: 5-6 parallel specialists refine with answers. Phase D: Architect (opus) consolidates a Refinement Verdict with scope=epic and dual-writes to execution-state.json + epic markdown.\"\nvisibility: public\nuser-invocable: true\nmodel: sonnet\nallowed-tools: [Read, Write, Edit, Skill, Agent, TaskCreate, TaskUpdate, Bash]\nargument-hint: \"\u003CEPIC-ID> [--non-interactive] [--dry-run] [--legacy-refinement]\"\ncontext-budget: heavy\nrequires-capabilities: [governance.refinement-gate]\n---\n\n## Global Output Policy\n\n- **Language**: English ONLY.\n- **Tone**: Technical, Direct, Concise.\n- **Efficiency**: Remove all conversational fillers. Start directly with technical content.\n\n## Triggers\n\n```\n\u002Fx-refine-epic epic-0069                        — full 4-phase strategic refinement (interactive)\n\u002Fx-refine-epic epic-0069 --non-interactive       — phases A+D only (no operator questions)\n\u002Fx-refine-epic epic-0069 --dry-run               — run A-D without writing markdown or state\n\u002Fx-refine-epic epic-0069 --legacy-refinement     — skip all phases; return verdict.status=\"tbd\"\n```\n\n## Parameters\n\n| Parameter | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `EPIC-ID` | positional | (required) | `epic-XXXX` or bare `0069` format |\n| `--epic-id` | String | auto-derived | 4-digit epic ID override |\n| `--non-interactive` | boolean | `false` | Skip Phase B+C (no operator questions); verdict based on Phases A+D only |\n| `--dry-run` | boolean | `false` | Execute Phases A–D without writing markdown or state |\n| `--legacy-refinement` | boolean | `false` | Skip all phases; emit WARNING; return `verdict.status=\"tbd\"` |\n\n## Output Contract\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `epicId` | String | Resolved epic ID |\n| `verdict` | Enum | `approved \\| rejected \\| tbd` |\n| `verdictHash` | String | SHA-256 of verdict JSON (for CI drift detection) |\n| `blockers` | List\\\u003CString\\> | NO-GO dimensions (empty if approved) |\n| `refinedAt` | ISO-8601 | Timestamp of final verdict |\n| `artifactPath` | String | Path to epic markdown `## Refinement Verdict` section |\n\n## Error Codes\n\n| Exit | Code | Condition |\n|------|------|-----------|\n| 1 | `EPIC_NOT_FOUND` | Epic markdown not found at expected path |\n| 2 | `EPIC_STATE_MISSING` | `execution-state.json` not found for epic |\n| 3 | `PHASE_A_EMPTY` | All personas returned empty gap-reports |\n| 4 | `VERDICT_WRITE_FAILED` | x-internal-update-status returned non-zero |\n\n---\n\n## CRITICAL EXECUTION RULE\n\n**4 phases (A–D). ALL phases through Phase D are mandatory unless `--non-interactive` skips Phase B+C.** Print `>>> Phase X completed. Proceeding to Phase Y...` between phases. `>>> Phase D completed. Refinement verdict written.` at end.\n\n`--legacy-refinement`: emit WARNING and return immediately with `verdict.status=\"tbd\"` — no phases execute.\n\n---\n\n## Phase A — Parallel Strategic Analysis\n\n\u003C!-- TELEMETRY: phase.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh start x-refine-epic Phase-A-StrategicAnalysis`\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode pre --skill x-refine-epic --phase Phase-A-StrategicAnalysis\")\n\nOpen phase tracker:\n\n    TaskCreate(subject: \"epic-XXXX › Phase A - Strategic Analysis\", activeForm: \"Running parallel strategic persona analysis\")\n\n### A.1 Resolve epic path and state\n\nProbe for epic markdown using glob `ai\u002Fepics\u002Fepic-XXXX-*\u002Fepic-XXXX.md`. Non-zero → exit `EPIC_NOT_FOUND`.\nProbe for `ai\u002Fepics\u002Fepic-XXXX-*\u002Fexecution-state.json`. Non-zero → exit `EPIC_STATE_MISSING`.\n\nRead the dimensions KP for epic dimension rules:\n\n    Read: .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md\n\n### A.2 Launch 5-6 parallel strategic persona-agents\n\n**MANDATORY — emit ALL persona Agent() calls as SIBLING tool calls in ONE assistant message.**\n\nResolve active personas: 5 fixed always active + conditional SRE\u002FDevOps (activate when capability `infra.observability.*` OR `infra.deploy.*` is active in the project profile — read from `settings.json` or project YAML).\n\nAlways active (5 core personas):\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic PO`\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"PO strategic analysis for epic-XXXX\",\n  prompt: \"You are a Product Owner specialist performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY these dimensions for the PO persona: problem, persona (epic-level), hypothesis (value), okrs.\nApply these NO-GOs silently (do NOT ask about them — reject immediately):\n- Hypothesis absent or is pure feature description (not in If\u002Fthen\u002Fbecause form)\n- No measurable KPI or OKR with unit+target+measurement-method defined\n- Persona absent or is a copy of the system description\n- Problem vague without observable evidence\nReturn a JSON gap-report:\n{\n  \\\"persona\\\": \\\"PO\\\",\n  \\\"gaps\\\": [\n    {\\\"dimension\\\": \\\"\u003Cname>\\\", \\\"issue\\\": \\\"\u003Cdescription>\\\", \\\"question\\\": \\\"\u003Cask if severity=question>\\\", \\\"severity\\\": \\\"question|noGo\\\"}\n  ]\n}\nIf no gaps found, return {\\\"persona\\\": \\\"PO\\\", \\\"gaps\\\": []}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › PO analysis\\\", activeForm: \\\"Analysing epic as PO\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Tech Lead strategic analysis for epic-XXXX\",\n  prompt: \"You are a Tech Lead performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY these dimensions for Tech Lead: feasibility (technical viability), epic-dependencies (inter-epic blockers, circular dependencies).\nApply these NO-GOs silently:\n- Circular epic dependencies declared (epic A depends on epic B which depends on A)\n- Critical technical dependency flagged as unresolvable blocker\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"TechLead\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › Tech Lead analysis\\\", activeForm: \\\"Analysing epic as Tech Lead\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Architect strategic analysis for epic-XXXX\",\n  prompt: \"You are an Architect performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY these dimensions: strategic-alternatives (§5 Alternativas), architectural-impact, out-of-scope (§1.4 Fora do escopo — REQUIRED: ≥3 explicit items).\nApply these NO-GOs silently:\n- Zero strategic alternatives documented (§5 absent or empty)\n- Fewer than 2 alternatives with rejection rationale (§Epic Dimensions rule)\n- Out-of-scope list absent OR has fewer than 3 explicit items (D4: heuristic preserved as Architect NO-GO)\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"Architect\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › Architect analysis\\\", activeForm: \\\"Analysing epic as Architect\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Security strategic analysis for epic-XXXX\",\n  prompt: \"You are a Security Engineer performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY: security-posture (does the epic address security concerns?), compliance-triggers (PCI\u002FLGPD\u002FHIPAA\u002FSOC2 if domain is sensitive).\nApply these NO-GOs silently:\n- Epic touches a sensitive domain (payments, healthcare, personal data, auth\u002Fidentity) without declaring compliance requirements\n- Cross-domain epic without threat-modeling scope declared\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"Security\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › Security analysis\\\", activeForm: \\\"Analysing epic as Security\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"QA strategic analysis for epic-XXXX\",\n  prompt: \"You are a QA Engineer performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY: quality-strategy (how do we know the epic shipped successfully?), smoke-scope (is a smoke test strategy declared?).\nApply these NO-GOs silently:\n- No 'definition of done' or success criterion at epic level\n- No smoke testing strategy mentioned\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"QA\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › QA analysis\\\", activeForm: \\\"Analysing epic as QA\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\nConditional persona (activate when `infra.observability.*` OR `infra.deploy.*` capability active):\n\n```\nAgent(  [conditional: flag.has_infra_capability]\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"SRE\u002FDevOps strategic analysis for epic-XXXX\",\n  prompt: \"You are an SRE\u002FDevOps Engineer performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY: operational-impact (how does this epic affect production operations?), rollback-strategy (is there a rollback plan?).\nApply these NO-GOs silently:\n- Epic touches production systems without a rollback or feature-flag strategy declared\n- Epic introduces new infrastructure without operational runbook or SLO targets\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"SRE\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › SRE analysis\\\", activeForm: \\\"Analysing epic as SRE\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)\n```\n\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic PO ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic TechLead`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic TechLead ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Architect`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Architect ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Security`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Security ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic QA`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic QA ok`\n\nCollect all gap-reports. Validate each is parseable JSON; discard malformed. If ALL are empty → exit `PHASE_A_EMPTY`.\n\nSeparate:\n- `questions` — gaps with `severity: \"question\"` → feed into Phase B\n- `noGos` — gaps with `severity: \"noGo\"` → pass directly to Phase D; **NOT surfaced as questions** (D-R15: NO-GOs silent)\n\n    TaskUpdate(id: phaseATaskId, status: \"completed\")\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode post --skill x-refine-epic --phase Phase-A-StrategicAnalysis\")\n\n\u003C!-- TELEMETRY: phase.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh end x-refine-epic Phase-A-StrategicAnalysis ok`\n\n>>> Phase A completed. Proceeding to Phase B (Consolidation)...\n\n---\n\n## Phase B — Consolidate & Operator Q&A\n\n\u003C!-- phase-no-gate: Phase B is skipped entirely when --non-interactive; gate is inside conditional block -->\n\n\u003C!-- TELEMETRY: phase.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh start x-refine-epic Phase-B-Consolidate`\n\n**Skip Phase B when `--non-interactive`**: set `answers = {}` and proceed directly to Phase C.\n\nOpen phase tracker:\n\n    TaskCreate(subject: \"epic-XXXX › Phase B - Consolidate\", activeForm: \"Consolidating strategic questions and awaiting operator answers\")\n\n### B.1 Dedup and group strategic questions\n\nFrom all Phase A `questions` (severity: \"question\"):\n1. Deduplicate by semantic similarity (same dimension + same gap → keep one).\n2. Group by strategic category: `Problema`, `Hipótese\u002FOKRs`, `Alternativas`, `Segurança`, `Qualidade`, `Operações`.\n3. Discard empty groups.\n\nIf no questions remain (all gaps were NO-GOs or all personas returned empty) → skip B.2, set `answers = {}`.\n\n### B.2 Single batch to operator (D-R14: one batch only)\n\n**EXACTLY ONE** `AskUserQuestion` call — no per-persona loops, no retry loops.\n\nPresent grouped strategic questions:\n\n```\n--- Epic Refinement Questions for epic-XXXX ---\n\nThe following strategic gaps were identified. Please answer each question.\n(NO-GO blockers are tracked separately and will appear in the final verdict.)\n\n[Problema]\nQ1. \u003Cquestion from PO about problem evidence>\n\n[Hipótese\u002FOKRs]\nQ2. \u003Cquestion from PO about measurable hypothesis>\n\n[Alternativas]\nQ3. \u003Cquestion from Architect about strategic alternatives>\n\n[Segurança]\nQ4. \u003Cquestion from Security about compliance posture>\n\n[Qualidade]\nQ5. \u003Cquestion from QA about definition of done>\n\n[Operações]\nQ6. \u003Cquestion from SRE about operational strategy>\n\nReply with answers numbered Q1, Q2, Q3, etc. Type SKIP to skip a question.\n```\n\nParse the operator's reply into a map `{Q1: \"\u003Canswer>\", Q2: \"\u003Canswer>\", ...}`.\nMap each answer back to its originating `{persona, dimension, gap}` entry.\n\n    TaskUpdate(id: phaseBTaskId, status: \"completed\")\n\n\u003C!-- TELEMETRY: phase.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh end x-refine-epic Phase-B-Consolidate ok`\n\n>>> Phase B completed. Proceeding to Phase C (Strategic Refinement)...\n\n---\n\n## Phase C — Parallel Strategic Refinement\n\n\u003C!-- TELEMETRY: phase.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh start x-refine-epic Phase-C-Refine`\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode pre --skill x-refine-epic --phase Phase-C-Refine\")\n\n**Skip Phase C when `--non-interactive`**: set `proposedSections = {}` and proceed to Phase D.\n\nOpen phase tracker:\n\n    TaskCreate(subject: \"epic-XXXX › Phase C - Strategic Refinement\", activeForm: \"Running parallel strategic refinement with operator answers\")\n\n### C.1 Distribute answers and re-launch persona-agents\n\n**MANDATORY — emit ALL persona Agent() calls as SIBLING tool calls in ONE assistant message.**\n\nFor each persona that had questions in Phase A, launch a refinement agent with the answers it owns:\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic PO-Refine`\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"PO strategic refinement for epic-XXXX\",\n  prompt: \"You are a Product Owner specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForPO}.\nBased on these answers, produce the proposed epic sections for your dimensions (problem, persona, hypothesis, okrs).\nReturn a JSON object: {\\\"persona\\\": \\\"PO\\\", \\\"proposedSections\\\": {\\\"problem\\\": \\\"\u003Crefined text>\\\", \\\"persona\\\": \\\"\u003Crefined text>\\\", \\\"hypothesis\\\": \\\"\u003Crefined text>\\\", \\\"okrs\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › PO refinement\\\", activeForm: \\\"Refining epic as PO\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Tech Lead strategic refinement for epic-XXXX\",\n  prompt: \"You are a Tech Lead specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForTechLead}.\nBased on these answers, produce the proposed epic sections for your dimensions (feasibility, epic-dependencies).\nReturn a JSON object: {\\\"persona\\\": \\\"TechLead\\\", \\\"proposedSections\\\": {\\\"feasibility\\\": \\\"\u003Crefined text>\\\", \\\"epic-dependencies\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › Tech Lead refinement\\\", activeForm: \\\"Refining epic as Tech Lead\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Architect strategic refinement for epic-XXXX\",\n  prompt: \"You are an Architect specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForArchitect}.\nBased on these answers, produce the proposed epic sections for your dimensions (strategic-alternatives, out-of-scope, architectural-impact).\nReturn a JSON object: {\\\"persona\\\": \\\"Architect\\\", \\\"proposedSections\\\": {\\\"alternatives\\\": \\\"\u003Crefined text>\\\", \\\"out-of-scope\\\": \\\"\u003Crefined text>\\\", \\\"architectural-impact\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › Architect refinement\\\", activeForm: \\\"Refining epic as Architect\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Security strategic refinement for epic-XXXX\",\n  prompt: \"You are a Security specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForSecurity}.\nBased on these answers, produce the proposed epic sections for your dimensions (security-posture, compliance-triggers).\nReturn a JSON object: {\\\"persona\\\": \\\"Security\\\", \\\"proposedSections\\\": {\\\"security-posture\\\": \\\"\u003Crefined text>\\\", \\\"compliance-triggers\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › Security refinement\\\", activeForm: \\\"Refining epic as Security\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"QA strategic refinement for epic-XXXX\",\n  prompt: \"You are a QA specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForQA}.\nBased on these answers, produce the proposed epic sections for your dimensions (quality-strategy, smoke-scope).\nReturn a JSON object: {\\\"persona\\\": \\\"QA\\\", \\\"proposedSections\\\": {\\\"quality-strategy\\\": \\\"\u003Crefined text>\\\", \\\"smoke-scope\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › QA refinement\\\", activeForm: \\\"Refining epic as QA\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic PO-Refine ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic TechLead-Refine`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic TechLead-Refine ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Architect-Refine`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Architect-Refine ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Security-Refine`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Security-Refine ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic QA-Refine`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic QA-Refine ok`\n\nCollect `proposedSections` from each agent. Merge into a single map keyed by section.\n\n    TaskUpdate(id: phaseCTaskId, status: \"completed\")\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode post --skill x-refine-epic --phase Phase-C-Refine\")\n\n\u003C!-- TELEMETRY: phase.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh end x-refine-epic Phase-C-Refine ok`\n\n>>> Phase C completed. Proceeding to Phase D (Architect Consolidation)...\n\n---\n\n## Phase D — Architect Consolidation + Dual-Write\n\n\u003C!-- TELEMETRY: phase.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh start x-refine-epic Phase-D-Architect`\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode pre --skill x-refine-epic --phase Phase-D-Architect\")\n\nOpen phase tracker:\n\n    TaskCreate(subject: \"epic-XXXX › Phase D - Architect Consolidation\", activeForm: \"Architect consolidating strategic refinement verdict\")\n\n### D.1 Architect consolidation (opus tier)\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Architect-Consolidate`\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"opus\",\n  description: \"Architect consolidation for epic-XXXX\",\n  prompt: \"You are the Lead Architect and final consolidator for an epic strategic refinement session.\n\nEpic: {epicPath}\nProposed section refinements from all personas: {proposedSections}\nNO-GO blockers from Phase A: {noGos}\nOperator answers summary: {answers}\n\nYour job:\n1. Review all proposed sections for strategic coherence.\n2. Merge proposedSections into the appropriate epic markdown sections:\n   - §1.3 Escopo (In-scope items)\n   - §1.4 Fora do escopo (Out-of-scope items — must have ≥3 explicit items)\n   - §6 Decisões Arquiteturais (add decision records for key strategic choices)\n3. Evaluate all noGos — determine if each blocker is genuinely disqualifying or was resolved by operator answers.\n4. Produce the final Refinement Verdict JSON:\n{\n  \\\"status\\\": \\\"approved\\\" | \\\"rejected\\\" | \\\"tbd\\\",\n  \\\"scope\\\": \\\"epic\\\",\n  \\\"checkedAt\\\": \\\"\u003CISO-8601 UTC>\\\",\n  \\\"dimensions\\\": {\n    \\\"problem\\\":    { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"persona\\\":    { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"value\\\":      { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"okrs\\\":       { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"alternatives\\\":{ \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"risks\\\":      { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"scope\\\":      { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" }\n  },\n  \\\"blockers\\\": [\\\"\u003Cdimension: reason>\\\"],\n  \\\"refinedSections\\\": {\\\"\u003CsectionName>\\\": \\\"\u003Crefined markdown text>\\\"},\n  \\\"verdictRationale\\\": \\\"\u003C1-2 sentence summary>\\\"\n}\nRules:\n- status=approved: ALL 7 dimensions checked=true AND blockers is empty.\n- status=rejected: ANY dimension has blocker != null AND operator answers did not resolve it.\n- status=tbd: gaps remain but no hard NO-GOs — operator interaction needed.\n\nApply Edit tool to the epic markdown file:\n1. Update §1.3 Escopo with refined in-scope items.\n2. Update §1.4 Fora do escopo with refined out-of-scope items (ensure ≥3 items).\n3. Append new ADR entries to §6 Decisões Arquiteturais for key strategic decisions.\n4. Append or replace the ## Refinement Verdict block (see format below).\n\n## Refinement Verdict format to write:\n---\n## Refinement Verdict\n\n**Status:** approved | rejected | tbd\n**Scope:** epic\n**Refined at:** \u003CISO-8601>\n**Verdict hash:** \u003CverdictHash — will be computed after JSON finalized>\n\n### Dimensions\n\n| Dimension | Status | Blocker |\n|-----------|--------|---------|\n| problem | passed\u002Fgap\u002FnoGo | — |\n| persona | passed\u002Fgap\u002FnoGo | — |\n| value | passed\u002Fgap\u002FnoGo | — |\n| okrs | passed\u002Fgap\u002FnoGo | — |\n| alternatives | passed\u002Fgap\u002FnoGo | — |\n| risks | passed\u002Fgap\u002FnoGo | — |\n| scope | passed\u002Fgap\u002FnoGo | — |\n\n### Blockers\n\n\u003Cnone — or list of blockers>\n\n### Rationale\n\n\u003CverdictRationale>\n---\n\nReturn ONLY the JSON verdict object above. Apply file edits inline using the Edit tool. No prose outside JSON in return value.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase D › Architect verdict\\\", activeForm: \\\"Producing strategic Refinement Verdict\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Architect-Consolidate ok`\n\nParse the Architect's JSON verdict. Validate `status` is one of `approved|rejected|tbd` and `scope` is `\"epic\"`.\n\n### D.2 Compute verdictHash\n\nWrite the verdict JSON to compute hash (safe for non-ASCII):\n\nBash command: `printf '%s' '\u003Cverdict JSON>' | sha256sum | awk '{print $1}'`\n\n### D.3 Dual-write (MANDATORY — NON-NEGOTIABLE)\n\n**`--dry-run` guard**: skip D.3 writes when `--dry-run` is active.\n\n**Write 1 — execution-state.json** (via x-internal-update-status, INLINE-SKILL):\n\n    Skill(skill: \"x-internal-update-status\", args: \"--file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json --type epic --id \u003CEPIC-ID> --field refinementVerdict --value {\\\"status\\\":\\\"\u003Cstatus>\\\",\\\"scope\\\":\\\"epic\\\",\\\"checkedAt\\\":\\\"\u003Ciso>\\\",\\\"dimensions\\\":{...},\\\"blockers\\\":[...],\\\"verdictHash\\\":\\\"\u003Chash>\\\"}\")  [required]\n\nNon-zero → exit `VERDICT_WRITE_FAILED`.\n\n**Write 2 — Epic markdown** (replace `## Refinement Verdict` block):\n\nThe Architect agent in D.1 applies the Edit inline. If the Architect did not apply the edit (e.g., dry-run), the orchestrator writes it using the `Edit` tool directly — replace or append the `## Refinement Verdict` block with the computed verdictHash populated.\n\n### D.4 Finalize\n\n    TaskUpdate(id: phaseDTaskId, status: \"completed\")\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode final --skill x-refine-epic --phase Phase-D-Architect --expected-artifacts {epicPath},{epicStatePath}\")\n\n\u003C!-- TELEMETRY: phase.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh end x-refine-epic Phase-D-Architect ok`\n\n>>> Phase D completed. Refinement verdict written.\n\n---\n\n## Output Summary\n\nPrint a concise summary:\n\n```\nx-refine-epic completed for epic-XXXX\n  Verdict: \u003Capproved|rejected|tbd>\n  Blockers: \u003Cnone | list>\n  Verdict hash: \u003Chash>\n  State file: ai\u002Fepics\u002Fepic-XXXX...\u002Fexecution-state.json (field: refinementVerdict.scope=epic)\n  Epic markdown: {epicPath} (section: ## Refinement Verdict)\n```\n\n---\n\n## Integration Notes\n\n- **Consumed by:** `x-implement-epic` (Phase 0: checks `refinementVerdict.status == \"approved\"` AND `scope == \"epic\"` via `enforce-refinement-gate.sh` hook).\n- **Parallel with:** `x-refine-story` (distinct write paths; shared `dimensions.md` KP is read-only).\n- **Depends on:** `x-internal-update-status` (INLINE-SKILL, Rule 13 Pattern 1), `knowledge\u002Frefinement\u002Fdimensions.md` (KP, story-0069-0001).\n- **Verdict drift detection:** `verdictHash` in state file vs `verdictHash` in epic markdown is compared by `audit-refinement-gate.sh` (story-0069-0006). Drift fails CI with `REFINEMENT_VERDICT_DRIFT`.\n- **Re-run idempotency:** Running x-refine-epic again on an `approved` epic replaces the verdict. This is intentional — re-refinement after epic scope changes should update the verdict.\n- **Scope discriminator:** This skill always writes `scope: \"epic\"`. The gate `enforce-refinement-gate.sh` checks both `status == \"approved\"` AND `scope == \"epic\"` to unblock `x-implement-epic`. Story-level `scope: \"story\"` verdicts do NOT unblock epic-level gates.\n","## Global Output Policy\n\n- **Language**: English ONLY.\n- **Tone**: Technical, Direct, Concise.\n- **Efficiency**: Remove all conversational fillers. Start directly with technical content.\n\n## Triggers\n\n```\n\u002Fx-refine-epic epic-0069                        — full 4-phase strategic refinement (interactive)\n\u002Fx-refine-epic epic-0069 --non-interactive       — phases A+D only (no operator questions)\n\u002Fx-refine-epic epic-0069 --dry-run               — run A-D without writing markdown or state\n\u002Fx-refine-epic epic-0069 --legacy-refinement     — skip all phases; return verdict.status=\"tbd\"\n```\n\n## Parameters\n\n| Parameter | Type | Default | Description |\n|-----------|------|---------|-------------|\n| `EPIC-ID` | positional | (required) | `epic-XXXX` or bare `0069` format |\n| `--epic-id` | String | auto-derived | 4-digit epic ID override |\n| `--non-interactive` | boolean | `false` | Skip Phase B+C (no operator questions); verdict based on Phases A+D only |\n| `--dry-run` | boolean | `false` | Execute Phases A–D without writing markdown or state |\n| `--legacy-refinement` | boolean | `false` | Skip all phases; emit WARNING; return `verdict.status=\"tbd\"` |\n\n## Output Contract\n\n| Field | Type | Description |\n|-------|------|-------------|\n| `epicId` | String | Resolved epic ID |\n| `verdict` | Enum | `approved \\| rejected \\| tbd` |\n| `verdictHash` | String | SHA-256 of verdict JSON (for CI drift detection) |\n| `blockers` | List\\\u003CString\\> | NO-GO dimensions (empty if approved) |\n| `refinedAt` | ISO-8601 | Timestamp of final verdict |\n| `artifactPath` | String | Path to epic markdown `## Refinement Verdict` section |\n\n## Error Codes\n\n| Exit | Code | Condition |\n|------|------|-----------|\n| 1 | `EPIC_NOT_FOUND` | Epic markdown not found at expected path |\n| 2 | `EPIC_STATE_MISSING` | `execution-state.json` not found for epic |\n| 3 | `PHASE_A_EMPTY` | All personas returned empty gap-reports |\n| 4 | `VERDICT_WRITE_FAILED` | x-internal-update-status returned non-zero |\n\n---\n\n## CRITICAL EXECUTION RULE\n\n**4 phases (A–D). ALL phases through Phase D are mandatory unless `--non-interactive` skips Phase B+C.** Print `>>> Phase X completed. Proceeding to Phase Y...` between phases. `>>> Phase D completed. Refinement verdict written.` at end.\n\n`--legacy-refinement`: emit WARNING and return immediately with `verdict.status=\"tbd\"` — no phases execute.\n\n---\n\n## Phase A — Parallel Strategic Analysis\n\n\u003C!-- TELEMETRY: phase.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh start x-refine-epic Phase-A-StrategicAnalysis`\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode pre --skill x-refine-epic --phase Phase-A-StrategicAnalysis\")\n\nOpen phase tracker:\n\n    TaskCreate(subject: \"epic-XXXX › Phase A - Strategic Analysis\", activeForm: \"Running parallel strategic persona analysis\")\n\n### A.1 Resolve epic path and state\n\nProbe for epic markdown using glob `ai\u002Fepics\u002Fepic-XXXX-*\u002Fepic-XXXX.md`. Non-zero → exit `EPIC_NOT_FOUND`.\nProbe for `ai\u002Fepics\u002Fepic-XXXX-*\u002Fexecution-state.json`. Non-zero → exit `EPIC_STATE_MISSING`.\n\nRead the dimensions KP for epic dimension rules:\n\n    Read: .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md\n\n### A.2 Launch 5-6 parallel strategic persona-agents\n\n**MANDATORY — emit ALL persona Agent() calls as SIBLING tool calls in ONE assistant message.**\n\nResolve active personas: 5 fixed always active + conditional SRE\u002FDevOps (activate when capability `infra.observability.*` OR `infra.deploy.*` is active in the project profile — read from `settings.json` or project YAML).\n\nAlways active (5 core personas):\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic PO`\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"PO strategic analysis for epic-XXXX\",\n  prompt: \"You are a Product Owner specialist performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY these dimensions for the PO persona: problem, persona (epic-level), hypothesis (value), okrs.\nApply these NO-GOs silently (do NOT ask about them — reject immediately):\n- Hypothesis absent or is pure feature description (not in If\u002Fthen\u002Fbecause form)\n- No measurable KPI or OKR with unit+target+measurement-method defined\n- Persona absent or is a copy of the system description\n- Problem vague without observable evidence\nReturn a JSON gap-report:\n{\n  \\\"persona\\\": \\\"PO\\\",\n  \\\"gaps\\\": [\n    {\\\"dimension\\\": \\\"\u003Cname>\\\", \\\"issue\\\": \\\"\u003Cdescription>\\\", \\\"question\\\": \\\"\u003Cask if severity=question>\\\", \\\"severity\\\": \\\"question|noGo\\\"}\n  ]\n}\nIf no gaps found, return {\\\"persona\\\": \\\"PO\\\", \\\"gaps\\\": []}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › PO analysis\\\", activeForm: \\\"Analysing epic as PO\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Tech Lead strategic analysis for epic-XXXX\",\n  prompt: \"You are a Tech Lead performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY these dimensions for Tech Lead: feasibility (technical viability), epic-dependencies (inter-epic blockers, circular dependencies).\nApply these NO-GOs silently:\n- Circular epic dependencies declared (epic A depends on epic B which depends on A)\n- Critical technical dependency flagged as unresolvable blocker\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"TechLead\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › Tech Lead analysis\\\", activeForm: \\\"Analysing epic as Tech Lead\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Architect strategic analysis for epic-XXXX\",\n  prompt: \"You are an Architect performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY these dimensions: strategic-alternatives (§5 Alternativas), architectural-impact, out-of-scope (§1.4 Fora do escopo — REQUIRED: ≥3 explicit items).\nApply these NO-GOs silently:\n- Zero strategic alternatives documented (§5 absent or empty)\n- Fewer than 2 alternatives with rejection rationale (§Epic Dimensions rule)\n- Out-of-scope list absent OR has fewer than 3 explicit items (D4: heuristic preserved as Architect NO-GO)\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"Architect\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › Architect analysis\\\", activeForm: \\\"Analysing epic as Architect\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Security strategic analysis for epic-XXXX\",\n  prompt: \"You are a Security Engineer performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY: security-posture (does the epic address security concerns?), compliance-triggers (PCI\u002FLGPD\u002FHIPAA\u002FSOC2 if domain is sensitive).\nApply these NO-GOs silently:\n- Epic touches a sensitive domain (payments, healthcare, personal data, auth\u002Fidentity) without declaring compliance requirements\n- Cross-domain epic without threat-modeling scope declared\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"Security\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › Security analysis\\\", activeForm: \\\"Analysing epic as Security\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"QA strategic analysis for epic-XXXX\",\n  prompt: \"You are a QA Engineer performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY: quality-strategy (how do we know the epic shipped successfully?), smoke-scope (is a smoke test strategy declared?).\nApply these NO-GOs silently:\n- No 'definition of done' or success criterion at epic level\n- No smoke testing strategy mentioned\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"QA\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › QA analysis\\\", activeForm: \\\"Analysing epic as QA\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\nConditional persona (activate when `infra.observability.*` OR `infra.deploy.*` capability active):\n\n```\nAgent(  [conditional: flag.has_infra_capability]\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"SRE\u002FDevOps strategic analysis for epic-XXXX\",\n  prompt: \"You are an SRE\u002FDevOps Engineer performing strategic DoR gap analysis for an EPIC.\nRead the epic markdown at {epicPath}. Read .claude\u002Fknowledge\u002Frefinement\u002Fdimensions.md §Epic Dimensions.\nAnalyse ONLY: operational-impact (how does this epic affect production operations?), rollback-strategy (is there a rollback plan?).\nApply these NO-GOs silently:\n- Epic touches production systems without a rollback or feature-flag strategy declared\n- Epic introduces new infrastructure without operational runbook or SLO targets\nReturn a JSON gap-report:\n{\\\"persona\\\": \\\"SRE\\\", \\\"gaps\\\": [{\\\"dimension\\\": ..., \\\"issue\\\": ..., \\\"question\\\": ..., \\\"severity\\\": \\\"question|noGo\\\"}]}.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase A › SRE analysis\\\", activeForm: \\\"Analysing epic as SRE\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)\n```\n\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic PO ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic TechLead`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic TechLead ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Architect`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Architect ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Security`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Security ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic QA`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic QA ok`\n\nCollect all gap-reports. Validate each is parseable JSON; discard malformed. If ALL are empty → exit `PHASE_A_EMPTY`.\n\nSeparate:\n- `questions` — gaps with `severity: \"question\"` → feed into Phase B\n- `noGos` — gaps with `severity: \"noGo\"` → pass directly to Phase D; **NOT surfaced as questions** (D-R15: NO-GOs silent)\n\n    TaskUpdate(id: phaseATaskId, status: \"completed\")\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode post --skill x-refine-epic --phase Phase-A-StrategicAnalysis\")\n\n\u003C!-- TELEMETRY: phase.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh end x-refine-epic Phase-A-StrategicAnalysis ok`\n\n>>> Phase A completed. Proceeding to Phase B (Consolidation)...\n\n---\n\n## Phase B — Consolidate & Operator Q&A\n\n\u003C!-- phase-no-gate: Phase B is skipped entirely when --non-interactive; gate is inside conditional block -->\n\n\u003C!-- TELEMETRY: phase.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh start x-refine-epic Phase-B-Consolidate`\n\n**Skip Phase B when `--non-interactive`**: set `answers = {}` and proceed directly to Phase C.\n\nOpen phase tracker:\n\n    TaskCreate(subject: \"epic-XXXX › Phase B - Consolidate\", activeForm: \"Consolidating strategic questions and awaiting operator answers\")\n\n### B.1 Dedup and group strategic questions\n\nFrom all Phase A `questions` (severity: \"question\"):\n1. Deduplicate by semantic similarity (same dimension + same gap → keep one).\n2. Group by strategic category: `Problema`, `Hipótese\u002FOKRs`, `Alternativas`, `Segurança`, `Qualidade`, `Operações`.\n3. Discard empty groups.\n\nIf no questions remain (all gaps were NO-GOs or all personas returned empty) → skip B.2, set `answers = {}`.\n\n### B.2 Single batch to operator (D-R14: one batch only)\n\n**EXACTLY ONE** `AskUserQuestion` call — no per-persona loops, no retry loops.\n\nPresent grouped strategic questions:\n\n```\n--- Epic Refinement Questions for epic-XXXX ---\n\nThe following strategic gaps were identified. Please answer each question.\n(NO-GO blockers are tracked separately and will appear in the final verdict.)\n\n[Problema]\nQ1. \u003Cquestion from PO about problem evidence>\n\n[Hipótese\u002FOKRs]\nQ2. \u003Cquestion from PO about measurable hypothesis>\n\n[Alternativas]\nQ3. \u003Cquestion from Architect about strategic alternatives>\n\n[Segurança]\nQ4. \u003Cquestion from Security about compliance posture>\n\n[Qualidade]\nQ5. \u003Cquestion from QA about definition of done>\n\n[Operações]\nQ6. \u003Cquestion from SRE about operational strategy>\n\nReply with answers numbered Q1, Q2, Q3, etc. Type SKIP to skip a question.\n```\n\nParse the operator's reply into a map `{Q1: \"\u003Canswer>\", Q2: \"\u003Canswer>\", ...}`.\nMap each answer back to its originating `{persona, dimension, gap}` entry.\n\n    TaskUpdate(id: phaseBTaskId, status: \"completed\")\n\n\u003C!-- TELEMETRY: phase.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh end x-refine-epic Phase-B-Consolidate ok`\n\n>>> Phase B completed. Proceeding to Phase C (Strategic Refinement)...\n\n---\n\n## Phase C — Parallel Strategic Refinement\n\n\u003C!-- TELEMETRY: phase.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh start x-refine-epic Phase-C-Refine`\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode pre --skill x-refine-epic --phase Phase-C-Refine\")\n\n**Skip Phase C when `--non-interactive`**: set `proposedSections = {}` and proceed to Phase D.\n\nOpen phase tracker:\n\n    TaskCreate(subject: \"epic-XXXX › Phase C - Strategic Refinement\", activeForm: \"Running parallel strategic refinement with operator answers\")\n\n### C.1 Distribute answers and re-launch persona-agents\n\n**MANDATORY — emit ALL persona Agent() calls as SIBLING tool calls in ONE assistant message.**\n\nFor each persona that had questions in Phase A, launch a refinement agent with the answers it owns:\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic PO-Refine`\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"PO strategic refinement for epic-XXXX\",\n  prompt: \"You are a Product Owner specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForPO}.\nBased on these answers, produce the proposed epic sections for your dimensions (problem, persona, hypothesis, okrs).\nReturn a JSON object: {\\\"persona\\\": \\\"PO\\\", \\\"proposedSections\\\": {\\\"problem\\\": \\\"\u003Crefined text>\\\", \\\"persona\\\": \\\"\u003Crefined text>\\\", \\\"hypothesis\\\": \\\"\u003Crefined text>\\\", \\\"okrs\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › PO refinement\\\", activeForm: \\\"Refining epic as PO\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Tech Lead strategic refinement for epic-XXXX\",\n  prompt: \"You are a Tech Lead specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForTechLead}.\nBased on these answers, produce the proposed epic sections for your dimensions (feasibility, epic-dependencies).\nReturn a JSON object: {\\\"persona\\\": \\\"TechLead\\\", \\\"proposedSections\\\": {\\\"feasibility\\\": \\\"\u003Crefined text>\\\", \\\"epic-dependencies\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › Tech Lead refinement\\\", activeForm: \\\"Refining epic as Tech Lead\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Architect strategic refinement for epic-XXXX\",\n  prompt: \"You are an Architect specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForArchitect}.\nBased on these answers, produce the proposed epic sections for your dimensions (strategic-alternatives, out-of-scope, architectural-impact).\nReturn a JSON object: {\\\"persona\\\": \\\"Architect\\\", \\\"proposedSections\\\": {\\\"alternatives\\\": \\\"\u003Crefined text>\\\", \\\"out-of-scope\\\": \\\"\u003Crefined text>\\\", \\\"architectural-impact\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › Architect refinement\\\", activeForm: \\\"Refining epic as Architect\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"Security strategic refinement for epic-XXXX\",\n  prompt: \"You are a Security specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForSecurity}.\nBased on these answers, produce the proposed epic sections for your dimensions (security-posture, compliance-triggers).\nReturn a JSON object: {\\\"persona\\\": \\\"Security\\\", \\\"proposedSections\\\": {\\\"security-posture\\\": \\\"\u003Crefined text>\\\", \\\"compliance-triggers\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › Security refinement\\\", activeForm: \\\"Refining epic as Security\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"sonnet\",\n  description: \"QA strategic refinement for epic-XXXX\",\n  prompt: \"You are a QA specialist.\nRead the epic markdown at {epicPath}.\nThe operator answered your strategic questions as follows: {answersForQA}.\nBased on these answers, produce the proposed epic sections for your dimensions (quality-strategy, smoke-scope).\nReturn a JSON object: {\\\"persona\\\": \\\"QA\\\", \\\"proposedSections\\\": {\\\"quality-strategy\\\": \\\"\u003Crefined text>\\\", \\\"smoke-scope\\\": \\\"\u003Crefined text>\\\"}}.\nOnly include sections where you have refinements — omit unchanged sections.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase C › QA refinement\\\", activeForm: \\\"Refining epic as QA\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic PO-Refine ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic TechLead-Refine`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic TechLead-Refine ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Architect-Refine`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Architect-Refine ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Security-Refine`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Security-Refine ok`\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic QA-Refine`\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic QA-Refine ok`\n\nCollect `proposedSections` from each agent. Merge into a single map keyed by section.\n\n    TaskUpdate(id: phaseCTaskId, status: \"completed\")\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode post --skill x-refine-epic --phase Phase-C-Refine\")\n\n\u003C!-- TELEMETRY: phase.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh end x-refine-epic Phase-C-Refine ok`\n\n>>> Phase C completed. Proceeding to Phase D (Architect Consolidation)...\n\n---\n\n## Phase D — Architect Consolidation + Dual-Write\n\n\u003C!-- TELEMETRY: phase.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh start x-refine-epic Phase-D-Architect`\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode pre --skill x-refine-epic --phase Phase-D-Architect\")\n\nOpen phase tracker:\n\n    TaskCreate(subject: \"epic-XXXX › Phase D - Architect Consolidation\", activeForm: \"Architect consolidating strategic refinement verdict\")\n\n### D.1 Architect consolidation (opus tier)\n\n\u003C!-- TELEMETRY: subagent.start -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-start x-refine-epic Architect-Consolidate`\n\n```\nAgent(\n  subagent_type: \"general-purpose\",\n  model: \"opus\",\n  description: \"Architect consolidation for epic-XXXX\",\n  prompt: \"You are the Lead Architect and final consolidator for an epic strategic refinement session.\n\nEpic: {epicPath}\nProposed section refinements from all personas: {proposedSections}\nNO-GO blockers from Phase A: {noGos}\nOperator answers summary: {answers}\n\nYour job:\n1. Review all proposed sections for strategic coherence.\n2. Merge proposedSections into the appropriate epic markdown sections:\n   - §1.3 Escopo (In-scope items)\n   - §1.4 Fora do escopo (Out-of-scope items — must have ≥3 explicit items)\n   - §6 Decisões Arquiteturais (add decision records for key strategic choices)\n3. Evaluate all noGos — determine if each blocker is genuinely disqualifying or was resolved by operator answers.\n4. Produce the final Refinement Verdict JSON:\n{\n  \\\"status\\\": \\\"approved\\\" | \\\"rejected\\\" | \\\"tbd\\\",\n  \\\"scope\\\": \\\"epic\\\",\n  \\\"checkedAt\\\": \\\"\u003CISO-8601 UTC>\\\",\n  \\\"dimensions\\\": {\n    \\\"problem\\\":    { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"persona\\\":    { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"value\\\":      { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"okrs\\\":       { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"alternatives\\\":{ \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"risks\\\":      { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" },\n    \\\"scope\\\":      { \\\"checked\\\": true|false, \\\"blocker\\\": null | \\\"\u003Creason>\\\" }\n  },\n  \\\"blockers\\\": [\\\"\u003Cdimension: reason>\\\"],\n  \\\"refinedSections\\\": {\\\"\u003CsectionName>\\\": \\\"\u003Crefined markdown text>\\\"},\n  \\\"verdictRationale\\\": \\\"\u003C1-2 sentence summary>\\\"\n}\nRules:\n- status=approved: ALL 7 dimensions checked=true AND blockers is empty.\n- status=rejected: ANY dimension has blocker != null AND operator answers did not resolve it.\n- status=tbd: gaps remain but no hard NO-GOs — operator interaction needed.\n\nApply Edit tool to the epic markdown file:\n1. Update §1.3 Escopo with refined in-scope items.\n2. Update §1.4 Fora do escopo with refined out-of-scope items (ensure ≥3 items).\n3. Append new ADR entries to §6 Decisões Arquiteturais for key strategic decisions.\n4. Append or replace the ## Refinement Verdict block (see format below).\n\n## Refinement Verdict format to write:\n---\n## Refinement Verdict\n\n**Status:** approved | rejected | tbd\n**Scope:** epic\n**Refined at:** \u003CISO-8601>\n**Verdict hash:** \u003CverdictHash — will be computed after JSON finalized>\n\n### Dimensions\n\n| Dimension | Status | Blocker |\n|-----------|--------|---------|\n| problem | passed\u002Fgap\u002FnoGo | — |\n| persona | passed\u002Fgap\u002FnoGo | — |\n| value | passed\u002Fgap\u002FnoGo | — |\n| okrs | passed\u002Fgap\u002FnoGo | — |\n| alternatives | passed\u002Fgap\u002FnoGo | — |\n| risks | passed\u002Fgap\u002FnoGo | — |\n| scope | passed\u002Fgap\u002FnoGo | — |\n\n### Blockers\n\n\u003Cnone — or list of blockers>\n\n### Rationale\n\n\u003CverdictRationale>\n---\n\nReturn ONLY the JSON verdict object above. Apply file edits inline using the Edit tool. No prose outside JSON in return value.\nFIRST ACTION: TaskCreate(subject: \\\"epic-XXXX › Phase D › Architect verdict\\\", activeForm: \\\"Producing strategic Refinement Verdict\\\").\nLAST ACTION: TaskUpdate(status: \\\"completed\\\").\"\n)  [required]\n```\n\n\u003C!-- TELEMETRY: subagent.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh subagent-end x-refine-epic Architect-Consolidate ok`\n\nParse the Architect's JSON verdict. Validate `status` is one of `approved|rejected|tbd` and `scope` is `\"epic\"`.\n\n### D.2 Compute verdictHash\n\nWrite the verdict JSON to compute hash (safe for non-ASCII):\n\nBash command: `printf '%s' '\u003Cverdict JSON>' | sha256sum | awk '{print $1}'`\n\n### D.3 Dual-write (MANDATORY — NON-NEGOTIABLE)\n\n**`--dry-run` guard**: skip D.3 writes when `--dry-run` is active.\n\n**Write 1 — execution-state.json** (via x-internal-update-status, INLINE-SKILL):\n\n    Skill(skill: \"x-internal-update-status\", args: \"--file ai\u002Fepics\u002Fepic-XXXX\u002Fexecution-state.json --type epic --id \u003CEPIC-ID> --field refinementVerdict --value {\\\"status\\\":\\\"\u003Cstatus>\\\",\\\"scope\\\":\\\"epic\\\",\\\"checkedAt\\\":\\\"\u003Ciso>\\\",\\\"dimensions\\\":{...},\\\"blockers\\\":[...],\\\"verdictHash\\\":\\\"\u003Chash>\\\"}\")  [required]\n\nNon-zero → exit `VERDICT_WRITE_FAILED`.\n\n**Write 2 — Epic markdown** (replace `## Refinement Verdict` block):\n\nThe Architect agent in D.1 applies the Edit inline. If the Architect did not apply the edit (e.g., dry-run), the orchestrator writes it using the `Edit` tool directly — replace or append the `## Refinement Verdict` block with the computed verdictHash populated.\n\n### D.4 Finalize\n\n    TaskUpdate(id: phaseDTaskId, status: \"completed\")\n\n    Skill(skill: \"x-internal-verify-phase-gates\", model: \"haiku\", args: \"--mode final --skill x-refine-epic --phase Phase-D-Architect --expected-artifacts {epicPath},{epicStatePath}\")\n\n\u003C!-- TELEMETRY: phase.end -->\nBash command: `$CLAUDE_PROJECT_DIR\u002F.claude\u002Fhooks\u002Ftelemetry-phase.sh end x-refine-epic Phase-D-Architect ok`\n\n>>> Phase D completed. Refinement verdict written.\n\n---\n\n## Output Summary\n\nPrint a concise summary:\n\n```\nx-refine-epic completed for epic-XXXX\n  Verdict: \u003Capproved|rejected|tbd>\n  Blockers: \u003Cnone | list>\n  Verdict hash: \u003Chash>\n  State file: ai\u002Fepics\u002Fepic-XXXX...\u002Fexecution-state.json (field: refinementVerdict.scope=epic)\n  Epic markdown: {epicPath} (section: ## Refinement Verdict)\n```\n\n---\n\n## Integration Notes\n\n- **Consumed by:** `x-implement-epic` (Phase 0: checks `refinementVerdict.status == \"approved\"` AND `scope == \"epic\"` via `enforce-refinement-gate.sh` hook).\n- **Parallel with:** `x-refine-story` (distinct write paths; shared `dimensions.md` KP is read-only).\n- **Depends on:** `x-internal-update-status` (INLINE-SKILL, Rule 13 Pattern 1), `knowledge\u002Frefinement\u002Fdimensions.md` (KP, story-0069-0001).\n- **Verdict drift detection:** `verdictHash` in state file vs `verdictHash` in epic markdown is compared by `audit-refinement-gate.sh` (story-0069-0006). Drift fails CI with `REFINEMENT_VERDICT_DRIFT`.\n- **Re-run idempotency:** Running x-refine-epic again on an `approved` epic replaces the verdict. This is intentional — re-refinement after epic scope changes should update the verdict.\n- **Scope discriminator:** This skill always writes `scope: \"epic\"`. The gate `enforce-refinement-gate.sh` checks both `status == \"approved\"` AND `scope == \"epic\"` to unblock `x-implement-epic`. Story-level `scope: \"story\"` verdicts do NOT unblock epic-level gates.\n",{"name":5,"model":24,"visibility":25,"description":7,"allowed-tools":26,"argument-hint":35,"context-budget":36,"user-invocable":37,"requires-capabilities":38},"sonnet","public",[27,28,29,30,31,32,33,34],"Read","Write","Edit","Skill","Agent","TaskCreate","TaskUpdate","Bash","\u003CEPIC-ID> [--non-interactive] [--dry-run] [--legacy-refinement]","heavy",true,[39],"governance.refinement-gate","main","952a630c6f38d193a349d86fa18db1de8843e837","src\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-refine-epic",1,"https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment","https:\u002F\u002Fgithub.com\u002Freview-bench","https:\u002F\u002Freview-bench.ai","An open benchmark for AI code review.","2026-10-27 06:56:37",{"source":8,"skillName":5,"commands":50,"prompt":60,"zipAvailable":37},[51,54,57],{"tool":52,"command":53},"npx","npx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-refine-epic",{"tool":55,"command":56},"bunx","bunx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-refine-epic",{"tool":58,"command":59},"pnpm","pnpm dlx skills add review-bench\u002Federcnj_ia-dev-environment --skill x-refine-epic","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-refine-epic\u002FSKILL.md",[62],{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Ffull-protocol.md","REFERENCE","参考文档",7160,"https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring-fintech-pci\u002F.claude\u002Fskills\u002Fx-refine-epic\u002Freferences\u002Ffull-protocol.md",[69,76,83,90,97,104],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M757M8J48TQ1Y3X25GSJBXAS","x-parallel-eval","Detects and classifies file-collision risks between work units (tasks, stories, or epic phases) before parallel execution. Reads ## File Footprint blocks produced by x-task-plan \u002F x-story-plan, applies the parallelism-heuristics knowledge pack (hard \u002F regen \u002F soft categories + hotspot overrides), and emits a collision matrix + serialization recommendation in Markdown (default) or JSON.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fx-parallel-eval\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M757M57XMR9546S69466HDWT","parallelism-heuristics","Canonical catalog of file-collision heuristics for parallel task, story, and epic execution. Defines the File Footprint block format, the three Conflict Categories (hard \u002F regen \u002F soft), a hotspot list of high-contention paths, and the degrade-with-warning policy. Consumed by x-task-plan, x-story-plan, x-epic-map, x-parallel-eval, and x-dev-*-implement.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fparallelism-heuristics\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M757M11SZ8P1VCQABT08QVYA","x-watch-pr-ci","Polls a PR's CI checks and Copilot review status, blocking until checks complete or timeout. Returns one of 8 stable exit codes (SUCCESS=0, CI_PENDING_PROCEED=10, CI_FAILED=20, TIMEOUT=30, PR_ALREADY_MERGED=40, NO_CI_CONFIGURED=50, PR_CLOSED=60, PR_NOT_FOUND=70). Writes a versioned state-file for session resume.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-watch-pr-ci\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M757KW53K8KFPGADFB4PH949","x-validate-docs","Documentation freshness gate: validates 6 dimensions (readme, api-specs, grpc-proto, adr, skill-docs, system-architecture) against code changes in a PR. Stack-aware — only validates targets declared\u002Fauto-detected from ProjectConfig.documentation.targets. Returns exit non-zero on staleness; produces structured report.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-validate-docs\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M757KQZHSA10MKC0CR571D60","x-update-system-architecture","Incrementally updates docs\u002Farchitecture\u002Fsystem.md after an epic completes. Appends new entries to the Decision Log (§11) using x-internal-write-report --append (dedup by ## ID: marker) and surgically inserts component\u002Fintegration changes into sections 1-10 via Edit. Idempotent: re-running with the same epic produces a byte-identical system.md.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-update-system-architecture\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M757KKBT5Q1SVF8DMJBVF46M","x-update-architecture","Incrementally updates the service architecture document with changes from architecture plans. Adds new components, integrations, flows, and ADR references without rewriting existing content. Use after implementation to keep architecture documentation current.","https:\u002F\u002Fgithub.com\u002Freview-bench\u002Federcnj_ia-dev-environment\u002Fblob\u002Fmain\u002Fsrc\u002Ftest\u002Fresources\u002Fgolden\u002Fjava-spring\u002Fplatform-claude-code\u002F.claude\u002Fskills\u002Fx-update-architecture\u002FSKILL.md",[],[]]