---
phase: 11-architect-agent
plan: 06
type: execute
wave: 3
depends_on: ["11-04", "11-05"]
files_modified:
  - src/cli/index.ts
autonomous: true
---

<objective>
Add CLI commands for initiative management and architect workflow.

Purpose: Enable users to create initiatives, list them, and spawn architect agents via the CLI.

Output: CLI commands for `cw initiative` and `cw architect` command groups.
</objective>

<execution_context>
@~/.claude/get-shit-done/workflows/execute-plan.md
@~/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md

# Depends on tRPC procedures
@.planning/phases/11-architect-agent/11-04-SUMMARY.md
@.planning/phases/11-architect-agent/11-05-SUMMARY.md

# CLI reference
@src/cli/index.ts
</context>

<tasks>

<task type="auto">
  <name>Task 1: Add initiative CLI commands</name>
  <files>src/cli/index.ts</files>
  <action>
Add initiative command group following existing patterns (agent commands):

```typescript
// cw initiative
const initiativeCommand = program
  .command('initiative')
  .description('Manage initiatives');

// cw initiative create <name>
initiativeCommand
  .command('create <name>')
  .description('Create a new initiative')
  .option('-d, --description <description>', 'Initiative description')
  .action(async (name: string, options: { description?: string }) => {
    const client = createClient();
    try {
      const initiative = await client.createInitiative.mutate({
        name,
        description: options.description,
      });
      console.log(`Created initiative: ${initiative.id}`);
      console.log(`  Name: ${initiative.name}`);
      if (initiative.description) {
        console.log(`  Description: ${initiative.description}`);
      }
    } catch (error) {
      handleError(error);
    }
  });

// cw initiative list
initiativeCommand
  .command('list')
  .description('List all initiatives')
  .option('-s, --status <status>', 'Filter by status (active, completed, archived)')
  .action(async (options: { status?: 'active' | 'completed' | 'archived' }) => {
    const client = createClient();
    try {
      const initiatives = await client.listInitiatives.query(
        options.status ? { status: options.status } : undefined
      );
      if (initiatives.length === 0) {
        console.log('No initiatives found');
        return;
      }
      for (const init of initiatives) {
        console.log(`${init.id}  ${init.status.padEnd(10)}  ${init.name}`);
      }
    } catch (error) {
      handleError(error);
    }
  });

// cw initiative get <id>
initiativeCommand
  .command('get <id>')
  .description('Get initiative details')
  .action(async (id: string) => {
    const client = createClient();
    try {
      const initiative = await client.getInitiative.query({ id });
      console.log(`ID: ${initiative.id}`);
      console.log(`Name: ${initiative.name}`);
      console.log(`Status: ${initiative.status}`);
      if (initiative.description) {
        console.log(`Description: ${initiative.description}`);
      }
      console.log(`Created: ${initiative.createdAt.toISOString()}`);
    } catch (error) {
      handleError(error);
    }
  });
```
  </action>
  <verify>npm run build passes, cw initiative --help shows commands</verify>
  <done>Initiative CLI commands added (create, list, get)</done>
</task>

<task type="auto">
  <name>Task 2: Add architect CLI commands</name>
  <files>src/cli/index.ts</files>
  <action>
Add architect command group:

```typescript
// cw architect
const architectCommand = program
  .command('architect')
  .description('Architect agent workflow');

// cw architect discuss <initiative-id>
architectCommand
  .command('discuss <initiativeId>')
  .description('Start discussion phase for an initiative')
  .requiredOption('--name <name>', 'Agent name')
  .option('-c, --context <context>', 'Initial context')
  .action(async (initiativeId: string, options: { name: string; context?: string }) => {
    const client = createClient();
    try {
      const agent = await client.spawnArchitectDiscuss.mutate({
        name: options.name,
        initiativeId,
        context: options.context,
      });
      console.log(`Started architect agent in discuss mode`);
      console.log(`  Agent: ${agent.name} (${agent.id})`);
      console.log(`  Mode: ${agent.mode}`);
      console.log(`  Initiative: ${initiativeId}`);
    } catch (error) {
      handleError(error);
    }
  });

// cw architect breakdown <initiative-id>
architectCommand
  .command('breakdown <initiativeId>')
  .description('Start breakdown phase for an initiative')
  .requiredOption('--name <name>', 'Agent name')
  .option('-s, --summary <summary>', 'Context summary from discuss phase')
  .action(async (initiativeId: string, options: { name: string; summary?: string }) => {
    const client = createClient();
    try {
      const agent = await client.spawnArchitectBreakdown.mutate({
        name: options.name,
        initiativeId,
        contextSummary: options.summary,
      });
      console.log(`Started architect agent in breakdown mode`);
      console.log(`  Agent: ${agent.name} (${agent.id})`);
      console.log(`  Mode: ${agent.mode}`);
      console.log(`  Initiative: ${initiativeId}`);
    } catch (error) {
      handleError(error);
    }
  });
```
  </action>
  <verify>npm run build passes, cw architect --help shows commands</verify>
  <done>Architect CLI commands added (discuss, breakdown)</done>
</task>

<task type="auto">
  <name>Task 3: Add phase list command</name>
  <files>src/cli/index.ts</files>
  <action>
Add phase listing under initiative or as separate command:

```typescript
// cw initiative phases <initiative-id>
initiativeCommand
  .command('phases <initiativeId>')
  .description('List phases for an initiative')
  .action(async (initiativeId: string) => {
    const client = createClient();
    try {
      const phases = await client.listPhases.query({ initiativeId });
      if (phases.length === 0) {
        console.log('No phases found');
        return;
      }
      for (const phase of phases) {
        console.log(`${phase.number.toString().padStart(2)}. ${phase.name}  [${phase.status}]`);
        if (phase.description) {
          console.log(`    ${phase.description}`);
        }
      }
    } catch (error) {
      handleError(error);
    }
  });
```
  </action>
  <verify>npm run build passes</verify>
  <done>Phase listing command added</done>
</task>

</tasks>

<verification>
Before declaring plan complete:
- [ ] npm run build succeeds without errors
- [ ] cw initiative --help shows: create, list, get, phases
- [ ] cw architect --help shows: discuss, breakdown
- [ ] Commands follow existing CLI patterns (error handling, output format)
</verification>

<success_criteria>

- All tasks completed
- Initiative CRUD available via CLI
- Architect workflow accessible via CLI
- Phase listing works for initiatives
</success_criteria>

<output>
After completion, create `.planning/phases/11-architect-agent/11-06-SUMMARY.md`
</output>
