cc-os/plugins/cc-architect/workflows/audit-workflow.md

129 lines
3.9 KiB
Markdown

# Workflow: Audit Workflow
Evaluate workflow documents for quality, compliance, and completeness against workflow-architect standards.
## Who should do this work
- **Haiku subagent**: Research phase (setup, context loading, structure audit)
- **Sonnet subagent**: Analysis phase (evaluation, quality assessment)
- **Opus subagent**: Synthesis phase (classification, verdict, report)
- **Haiku subagent**: Cleanup phase
## When to use
- Evaluating workflow for quality and compliance
- Checking workflow-architect standards
- Reviewing structure, clarity, completeness
## Inputs required
- **workflow_path** - Path to workflow file (e.g., `plugin/skills/my-skill/workflows/my-workflow.md`)
## Output
- `.claude/plugin-data/workflow-architect/audits/<workflow-name>-audit.md` (gitignored)
- Summary with verdict (Ready / Not Ready)
- Delete report after user acts on findings
---
## Phase 1: Research
Subagent: haiku.
Read: `${CLAUDE_PLUGIN_ROOT}/references/layout/workflow-structure.md`
**Setup:**
- Verify `workflow_path` exists, is `.md` file
- Verify in `workflows/` directory
- Create scratch workspace
- Extract workflow name
**Context loading:**
- Check for `invariants.md` in workflow's plugin root
- Check for `.decisions/` directory
- Check for `examples/golden/`
- Record: invariants list, prior decisions count/topics, golden examples list (or "none" for each)
**Structure audit:**
- Has "When to use"
- Has "Inputs required"
- Has "Output"
- Has "Subtasks" or "Phase" sections with clear steps
- Each subtask/phase: "Who" (main/subagent)
- Each subtask/phase: "Must read" if applicable
- Each subtask/phase: clear "Do" instructions
**Read workflow file:**
- Full workflow content
- Note all referenced files
Write: `scratch/research-findings.md`
---
## Phase 2: Analysis
Subagent: sonnet.
Read: `scratch/research-findings.md`, `${CLAUDE_PLUGIN_ROOT}/references/layout/workflow-structure.md`
**Ownership clarity evaluation:**
- Each subtask/phase clearly assigns ownership (main vs subagent)
- Subagent tasks reference model if specified
- Main tasks don't delegate subagent work
- No ambiguous ownership
**Completeness evaluation:**
- Clear purpose and trigger conditions
- Inputs well-defined
- Output format specified
- All subtasks/phases have necessary context
- Verification steps if modifies files
- No missing steps in workflow flow
**Quality assessment:**
- Logical step ordering
- Appropriate subagent model assignments
- File artifacts properly passed between phases
- No redundant steps
Write: `scratch/analysis-findings.md`
---
## Phase 3: Synthesis
Subagent: opus.
Read: `scratch/analysis-findings.md`, `${CLAUDE_PLUGIN_ROOT}/references/tool-patterns/severity-guide.md`, `references/tool-patterns/catalog.md`
**Classify findings:**
- Classify by severity (significant/minor/polish)
- Verdict: Ready (0 significant) or Not Ready (1+ significant)
**Severity for workflows:**
- **Significant:** Missing sections, ambiguous ownership, incomplete flow, missing verification
- **Minor:** Unclear wording, missing optional context, suboptimal structure
- **Polish:** Style, formatting
**Impact analysis per recommendation:**
- What could degrade?
- Invariant conflict?
- Golden example impact?
If contradicts invariant or affects golden example: note and require user approval.
Write: `.claude/plugin-data/workflow-architect/audits/<workflow-name>-audit.md`
**Present report to user:**
- Walk through significant findings first
- Offer to fix or let user handle
- After user confirms: invoke cleanup
**Cleanup (haiku):**
- Delete scratch workspace
- Delete audit report
- Record decisions if needed:
- Template: `references/tool-patterns/templates/decision-record-template.md`
- Write: `<plugin_path>/.decisions/YYYY-MM-DD-<topic>.md`
- When: non-standard structures, exceptions to best practices, complex delegation patterns
- Prompt: "Were any significant decisions made? (structure exceptions, pattern decisions, best practice deviations)"