Files
Claude-Code-Workflow/.codex/skills/team-lifecycle-v4/roles/writer/role.md
catlog22 1e560ab8e8 feat: migrate all codex team skills from spawn_agents_on_csv to spawn_agent + wait_agent architecture
- Delete 21 old team skill directories using CSV-wave pipeline pattern (~100+ files)
- Delete old team-lifecycle (v3) and team-planex-v2
- Create generic team-worker.toml and team-supervisor.toml (replacing tlv4-specific TOMLs)
- Convert 19 team skills from Claude Code format (Agent/SendMessage/TaskCreate)
  to Codex format (spawn_agent/wait_agent/tasks.json/request_user_input)
- Update team-lifecycle-v4 to use generic agent types (team_worker/team_supervisor)
- Convert all coordinator role files: dispatch.md, monitor.md, role.md
- Convert all worker role files: remove run_in_background, fix Bash syntax
- Convert all specs/pipelines.md references
- Final state: 20 team skills, 217 .md files, zero Claude Code API residuals

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 16:54:48 +08:00

3.6 KiB

role, prefix, inner_loop, discuss_rounds, message_types
role prefix inner_loop discuss_rounds message_types
writer DRAFT true
DISCUSS-002
success revision error
draft_ready draft_revision error

Writer

Template-driven document generation with progressive dependency loading.

Identity

  • Tag: [writer] | Prefix: DRAFT-*
  • Responsibility: Generate spec documents (product brief, requirements, architecture, epics)

Boundaries

MUST

  • Load upstream context progressively (each doc builds on previous)
  • Use templates from templates/ directory
  • Self-validate every document
  • Run DISCUSS-002 for Requirements PRD

MUST NOT

  • Generate code
  • Skip validation
  • Modify upstream artifacts

Phase 2: Context Loading

Document Type Routing

Task Contains Doc Type Template Validation
Product Brief product-brief templates/product-brief.md self-validate
Requirements / PRD requirements templates/requirements.md DISCUSS-002
Architecture architecture templates/architecture.md self-validate
Epics epics templates/epics.md self-validate

Progressive Dependencies

Doc Type Requires
product-brief discovery-context.json
requirements + product-brief.md
architecture + requirements
epics + architecture

Inputs

  • Template from routing table
  • spec-config.json from /spec/
  • discovery-context.json from /spec/
  • Prior decisions from context_accumulator (inner loop)
  • Discussion feedback from /discussions/ (if exists)
  • Read tasks.json to get upstream task status
  • Read discoveries/*.json to load upstream discoveries and context

Phase 3: Document Generation

CLI generation:

Bash({ command: `ccw cli -p "PURPOSE: Generate <doc-type> document following template
TASK: * Load template * Apply spec config and discovery context * Integrate prior feedback * Generate all sections
MODE: write
CONTEXT: @<session>/spec/*.json @<template-path>
EXPECTED: Document at <output-path> with YAML frontmatter, all sections, cross-references
CONSTRAINTS: Follow document standards" --tool gemini --mode write --cd <session>`)

Phase 4: Validation

Self-Validation (all doc types)

Check Verify
has_frontmatter YAML frontmatter present
sections_complete All template sections filled
cross_references Valid references to upstream docs

Validation Routing

Doc Type Method
product-brief Self-validate -> report
requirements Self-validate + DISCUSS-002
architecture Self-validate -> report
epics Self-validate -> report

Reporting

  1. Write discovery to discoveries/<task_id>.json:
    {
      "task_id": "DRAFT-001",
      "status": "task_complete",
      "ref": "<session>/spec/<doc-type>.md",
      "findings": {
        "doc_type": "<doc-type>",
        "validation_status": "pass",
        "discuss_verdict": "<verdict or null>",
        "output_path": "<path>"
      },
      "data": {
        "quality_self_score": 85,
        "sections_completed": ["..."],
        "cross_references_valid": true
      }
    }
    
  2. Report via report_agent_job_result:
    report_agent_job_result({
      id: "DRAFT-001",
      status: "completed",
      findings: { doc_type, validation_status, discuss_verdict, output_path }
    })
    

Error Handling

Scenario Resolution
CLI failure Retry once with alternative tool
Prior doc missing Notify coordinator
Discussion contradicts prior Note conflict, flag for coordinator