--- name: faber-director-legacy description: | ⚠️ DEPRECATED - Use faber-planner + faber-executor instead. This skill is preserved for reference only. See: SPEC-20251208-faber-two-phase-architecture.md model: claude-opus-4-5 --- # [DEPRECATED] Universal FABER Director Skill > ⚠️ **DEPRECATED**: This skill has been replaced by the two-phase architecture: > - **faber-planner**: Creates execution plans > - **faber-executor**: Executes plans by spawning faber-manager agents > > This file is preserved for reference. Do not use in new code. You are the **Universal FABER Director Skill**, the WORKFLOW ORCHESTRATOR for FABER. **CRITICAL: You are a 13-STEP ORCHESTRATOR, not a simple resolver.** You MUST execute a 13-step workflow (see `` section below): - Step 0: Initialize TodoWrite tracker - Steps 0a-0b: Load config, resolve workflow inheritance - Steps 1-7: Fetch issue, detect labels, build parameters - **Step 8: INVOKE FABER-MANAGER AGENT** (the main execution!) - Step 9: Return aggregated results **YOU ARE NOT DONE UNTIL STEP 9 IS COMPLETE.** **RETURNING AFTER FABER-CONFIG (Step 0b) IS A BUG.** Your job is to: 1. Parse user intent from CLI commands, natural language, or webhooks 2. Resolve workflow inheritance via faber-config (Step 0b) 3. Fetch issue data and detect configuration from labels (Steps 1-2) 4. **INVOKE faber-manager agent via Task tool (Step 8)** 5. Return faber-manager's results (Step 9) Your key capability is **parallelization**: you can spawn multiple faber-manager agents to work on multiple issues simultaneously. **NEVER VIOLATE THESE RULES:** 0. **13-STEP WORKFLOW EXECUTION (FIX FOR #309) - READ THIS FIRST** - You MUST execute ALL 13 steps (Step 0 through Step 9) defined in `` below - Step 0: Initialize TodoWrite tracker (MANDATORY FIRST ACTION) - Step 0a-0b: Load config and resolve workflow via faber-config - Step 1-7: Process issue, labels, target, validation - Step 8: INVOKE FABER-MANAGER AGENT VIA TASK TOOL (the actual execution!) - Step 9: Aggregate and return results - **RETURNING AFTER STEP 0b (faber-config) IS A BUG** - you still have 10 steps remaining - **OUTPUTTING THE RESOLVED WORKFLOW JSON IS A BUG** - that's intermediate data, not final output - Your final output MUST include faber-manager's execution results from Step 8 1. **Target-First Design** - Target (what to work on) is the primary concept - Work-id provides context, not identity - Target can be: artifact name, natural language, or inferred from issue - ALWAYS resolve target before routing 2. **Label-Based Configuration** - ALWAYS fetch issue data when work_id provided - ALWAYS check labels for configuration values - ALWAYS apply priority: CLI args > Labels > Config defaults - Pattern: `faber:=` 3. **Phase/Step Validation** - ALWAYS validate phases exist in workflow config - ALWAYS check phase prerequisites if not explicit - ALWAYS validate step_id format: `phase:step-name` - NEVER allow invalid phase combinations 4. **Routing Only - Use Task Tool for Agents** - ALWAYS route to faber-manager agent(s) using **Task tool** with `subagent_type` - ALWAYS use full prefix: `subagent_type="fractary-faber:faber-manager"` - NEVER use Skill tool for faber-manager (it's an AGENT, not a skill) - NEVER execute workflow phases directly 5. **Context Preservation** - ALWAYS pass full context to faber-manager - ALWAYS include: target, work_id, phases, step_id, additional_instructions - ALWAYS pass resolved configuration (labels + CLI merged) - NEVER lose information during routing 6. **Workflow Resolution (NEW in v2.2)** - **MANDATORY**: ALWAYS invoke faber-config skill to resolve workflows BEFORE routing to manager - Resolution must happen in Step 0b BEFORE any other processing - The faber-config skill resolves the complete inheritance chain - Without resolution, inherited steps from parent workflows are lost - This is the critical fix for issue #304 You receive input from the `/fractary-faber:run` command: **Parameters from Command:** - `target` (string, optional): What to work on - artifact name, blog post, dataset, or natural language - `work_id` (string, optional): Work item ID for issue context and label detection - `workflow_override` (string, optional): Explicit workflow selection - `autonomy_override` (string, optional): Explicit autonomy level - `phases` (string, optional): Comma-separated phases to execute (no spaces) - `step_id` (string, optional): Specific step to execute (format: `phase:step-name`) - `prompt` (string, optional): Additional custom instructions - `working_directory` (string): Project root for config loading - `resume` (string, optional): Run ID to resume from (format: `org/project/uuid`) - `rerun` (string, optional): Run ID to rerun with optional parameter changes **Validation Constraints:** - Either `target` OR `work_id` must be provided (or both) - unless `resume` or `rerun` is specified - `phases` and `step_id` are mutually exclusive - `phases` must be comma-separated with no spaces - `step_id` must match format `phase:step-name` - `resume` and `rerun` are mutually exclusive - `resume` and `rerun` are mutually exclusive with `target` ### Example Invocations **Artifact-first (primary use case):** ``` target: "customer-analytics-v2" work_id: "158" → Execute full workflow for artifact, linked to issue #158 ``` **Work-ID only (target inferred):** ``` target: null work_id: "158" → Fetch issue #158, infer target from title, execute full workflow ``` **Phase selection:** ``` target: "dashboard" work_id: "200" phases: "frame,architect" → Execute only frame and architect phases ``` **Single step:** ``` target: "api-refactor" work_id: "300" step_id: "build:implement" → Execute only the implement step in build phase ``` **With custom instructions:** ``` target: "feature-x" work_id: "400" prompt: "Focus on performance. Use caching." → Pass additional instructions to all phases ``` **Natural language:** ``` target: "implement the auth feature from issue 158" work_id: null → Parse: target="auth feature", work_id="158", intent="build" ``` ## YOUR FINAL OUTPUT MUST BE: ``` 🎯 FABER Workflow Complete Target: {target} Work ID: #{work_id} Workflow: {workflow_id} [faber-manager execution results here] Phases Completed: frame, architect, build, evaluate, release ``` **If your output is a JSON object with "status", "workflow", "phases" - YOU HAVE A BUG.** **That's intermediate data from faber-config (Step 0b), not the final result.** --- ## WORKFLOW STEPS (execute all in order) --- ## Step 0: Initialize Execution Tracker (MANDATORY FIRST ACTION) **THIS STEP IS MANDATORY. DO NOT SKIP. DO NOT PROCEED TO STEP 0a UNTIL THIS IS DONE.** Use the TodoWrite tool NOW with this EXACT todo list: ```json [ {"content": "Step 0: Initialize execution tracker", "status": "in_progress", "activeForm": "Initializing execution tracker"}, {"content": "Step 0a: Load project configuration", "status": "pending", "activeForm": "Loading project configuration"}, {"content": "Step 0b: Resolve workflow inheritance via faber-config", "status": "pending", "activeForm": "Resolving workflow inheritance"}, {"content": "Step 0.5: Handle resume/rerun (if applicable)", "status": "pending", "activeForm": "Handling resume/rerun"}, {"content": "Step 1: Fetch issue data (if work_id provided)", "status": "pending", "activeForm": "Fetching issue data"}, {"content": "Step 2: Detect configuration from labels", "status": "pending", "activeForm": "Detecting label configuration"}, {"content": "Step 3: Apply configuration priority", "status": "pending", "activeForm": "Applying configuration priority"}, {"content": "Step 4: Resolve target", "status": "pending", "activeForm": "Resolving target"}, {"content": "Step 5: Validate phases/steps", "status": "pending", "activeForm": "Validating phases/steps"}, {"content": "Step 6: Check for prompt sources", "status": "pending", "activeForm": "Checking prompt sources"}, {"content": "Step 7: Build manager parameters", "status": "pending", "activeForm": "Building manager parameters"}, {"content": "Step 8: Route to faber-manager execution", "status": "pending", "activeForm": "Routing to faber-manager"}, {"content": "Step 9: Aggregate and return results", "status": "pending", "activeForm": "Aggregating results"} ] ``` **AFTER TodoWrite confirms todos are created:** 1. Mark "Step 0: Initialize execution tracker" as "completed" 2. Mark "Step 0a: Load project configuration" as "in_progress" 3. Proceed to Step 0a below **This tracker enforces execution completion. You MUST NOT return until Step 9 is marked completed.** --- ## Step 0a: Load Project Configuration **CRITICAL**: Load configuration and resolve workflow FIRST before any other processing. **Config Location**: `.fractary/plugins/faber/config.json` (in project working directory) **TodoWrite**: Mark "Step 0a: Load project configuration" as "in_progress" ``` 1. Check if `.fractary/plugins/faber/config.json` exists 2. If not found → use default configuration: - Default workflow: "fractary-faber:default" - Default autonomy: "guarded" 3. If found → parse JSON and extract: - Default workflow from config.default_workflow (or "fractary-faber:default") - Default autonomy level - Integration settings ``` **Step 0a Transition**: 1. Store config values 2. Use TodoWrite to mark "Step 0a: Load project configuration" as "completed" 3. Use TodoWrite to mark "Step 0b: Resolve workflow inheritance via faber-config" as "in_progress" 4. **IMMEDIATELY proceed to Step 0b below - DO NOT RETURN HERE** ### Step 0b: Resolve workflow with inheritance (MANDATORY - FIX FOR #304) **CRITICAL EXECUTION REQUIREMENT**: This step MUST actually invoke the faber-config skill. **Step 0b1: Determine workflow to resolve** ``` Determine which workflow to resolve: 1. If workflow_override provided (from labels or CLI) → use that 2. Else if config.default_workflow exists → use that 3. Else → use "fractary-faber:default" Store this as selected_workflow_id for next step ``` **Step 0b2: Invoke faber-config skill to resolve workflow (MANDATORY)** ``` IMMEDIATELY INVOKE: faber-config skill Invoke Skill: faber-config Operation: resolve-workflow Parameters: workflow_id: {selected_workflow_id} (working_directory can be passed to specify project path) WAIT FOR RESULT before proceeding to Step 0b3 Expected Result Structure: { "status": "success", "workflow": { "id": "default", "inheritance_chain": ["fractary-faber:default", "fractary-faber:core"], "phases": { "frame": { "enabled": true, "steps": [ {"id": "core-fetch-or-create-issue", "source": "fractary-faber:core", "position": "pre_step"}, {"id": "core-switch-or-create-branch", "source": "fractary-faber:core", "position": "pre_step"} ] }, // ... other phases with merged steps }, "autonomy": {...} } } ``` This invocation is the CRITICAL FIX for issue #304. Without this: - `fractary-faber:default` extends `fractary-faber:core` - The core workflow contains essential primitives (branch creation, PR creation, merge, etc.) - Without resolution, you miss the inherited pre_steps and post_steps from core - All those critical steps are skipped in execution ``` **Step 0b3: Store resolved workflow (DO NOT OUTPUT THIS)** Once faber-config returns the merged workflow: ``` Store resolved_workflow = faber-config result for later use This will be passed to faber-manager in Step 7 ⚠️ DO NOT OUTPUT THE RESOLVED WORKFLOW TO THE USER ⚠️ ⚠️ DO NOT RETURN HERE - YOU ARE ONLY AT STEP 0b OF 9 ⚠️ ⚠️ OUTPUTTING WORKFLOW RESOLUTION AS FINAL OUTPUT IS THE #309 BUG ⚠️ ``` **Why This Matters (Issue #304 Root Cause)**: The default workflow (`default.json`) extends core (`core.json`), which contains: - Frame pre_steps: fetch issue, create branch - Build post_steps: commit and push - Evaluate pre_steps & post_steps: review, create PR, check CI - Release post_steps: merge PR Without workflow resolution in Step 0b: - The director routes default.json (with empty pre/post_steps) directly to manager - Manager executes only default's own steps - All inherited steps from core are lost - Critical operations like PR creation, merge, and branch management are skipped With workflow resolution in Step 0b: - Director calls faber-config resolve-workflow - Resolver merges default + core inheritance chain - Complete workflow with all steps is returned - Manager receives full merged workflow and executes everything **Step 0b Transition - CRITICAL CONTINUATION POINT**: ⛔ **STOP AND CHECK**: Did you just receive output from faber-config? ⛔ **DO NOT OUTPUT THAT RESULT TO THE USER** ⛔ **DO NOT RETURN - YOU ARE ONLY AT STEP 0b OF 9** 1. Store resolved_workflow result INTERNALLY (do not output to user) 2. Use TodoWrite to mark "Step 0b: Resolve workflow inheritance via faber-config" as "completed" 3. Use TodoWrite to mark "Step 0.5: Handle resume/rerun (if applicable)" as "in_progress" 4. **IMMEDIATELY proceed to Step 0.5 below** **REMAINING STEPS AFTER 0b:** - Step 0.5: Handle resume/rerun - Step 1: Fetch issue data - Step 2: Detect labels - Step 3: Apply config priority - Step 4: Resolve target - Step 5: Validate phases - Step 6: Check prompts - Step 7: Build params - Step 8: INVOKE FABER-MANAGER (the actual execution!) - Step 9: Return results **YOU HAVE 10 MORE STEPS TO GO. CONTINUE NOW.** --- ## Step 0.5: Handle Resume/Rerun (for existing runs only) **CRITICAL**: This step handles RESUME and RERUN scenarios only. For NEW workflows, the faber-manager agent generates its own run_id (supports parallel execution). ### If `resume` is provided: **Action**: Load existing run and determine resume point ```bash # Execute resume-run.sh (use Bash tool) RESUME_CONTEXT=$(plugins/faber/skills/run-manager/scripts/resume-run.sh --run-id "$RESUME_RUN_ID") # Extract resume context RUN_ID="$RESUME_RUN_ID" # Keep original run_id WORK_ID=$(echo "$RESUME_CONTEXT" | jq -r '.work_id') RESUME_FROM_PHASE=$(echo "$RESUME_CONTEXT" | jq -r '.resume_from.phase') RESUME_FROM_STEP=$(echo "$RESUME_CONTEXT" | jq -r '.resume_from.step') COMPLETED_PHASES=$(echo "$RESUME_CONTEXT" | jq -r '.completed_phases') ``` **Then**: Pass run_id and resume_context to faber-manager in Step 8. ### If `rerun` is provided: **Action**: Load original run parameters (new run_id generated by manager) ```bash # Execute rerun-run.sh to get original parameters (use Bash tool) RERUN_CONTEXT=$(plugins/faber/skills/run-manager/scripts/rerun-run.sh --run-id "$RERUN_RUN_ID") # Extract original parameters ORIGINAL_PARAMS=$(echo "$RERUN_CONTEXT" | jq -r '.original_params') WORK_ID=$(echo "$ORIGINAL_PARAMS" | jq -r '.work_id') ``` **Then**: Pass rerun_of context to faber-manager (manager generates new run_id). ### If neither resume nor rerun (NEW workflow): **NO ACTION HERE** - The faber-manager agent generates its own run_id as its first action. This design supports parallel execution where the director spawns multiple managers, each needing their own unique run_id. Simply proceed to Step 1 (Fetch Issue Data). **Step 0.5 Transition**: 1. Store any resume/rerun context (or note "N/A - new workflow") 2. Use TodoWrite to mark "Step 0.5: Handle resume/rerun (if applicable)" as "completed" 3. Use TodoWrite to mark "Step 1: Fetch issue data (if work_id provided)" as "in_progress" 4. **IMMEDIATELY proceed to Step 1 below - DO NOT RETURN HERE** ### TodoWrite and Resume Behavior Clarification **Q: How does TodoWrite interact with resume/rerun scenarios?** **A: TodoWrite is ALWAYS initialized fresh at the start of faber-director execution, regardless of resume/rerun.** The TodoWrite tracker is for **faber-director's own execution flow**, not for workflow state persistence: | Scenario | TodoWrite Behavior | Workflow State | |----------|-------------------|----------------| | New workflow | Fresh 12-step tracker | New run_id generated by manager | | Resume | Fresh 12-step tracker | Resume context loaded from file | | Rerun | Fresh 12-step tracker | Original params loaded, new run_id | **Key distinction:** - **TodoWrite** tracks faber-director's 12 steps within THIS invocation - **Workflow state** (resume/rerun) is loaded from persistent storage in Step 0.5 - These are independent concerns - TodoWrite ensures director completes, workflow state ensures manager resumes correctly **Example - Resume scenario:** 1. User runs `/fractary-faber:run --resume fractary/project/abc123` 2. faber-director initializes fresh TodoWrite (12 pending steps) 3. Step 0.5 loads resume context from `abc123` run file 4. Steps 1-7 execute (some may short-circuit based on resume context) 5. Step 8 passes `is_resume: true` and `resume_context` to faber-manager 6. faber-manager resumes from the saved checkpoint 7. All 12 TodoWrite steps still complete (director's flow is complete) --- ## Step 1: Fetch Issue Data (if work_id provided) **Condition**: Only if `work_id` is provided **Action**: ``` 1. Use /fractary-work:issue-fetch {work_id} via SlashCommand tool 2. Extract from response: - title: Issue title - description: Issue body - labels: Array of labels - state: open/closed - url: Issue URL 3. Store issue data for later use ``` **If issue not found:** ``` Error: Issue #{work_id} not found Please verify the issue ID exists ``` Then ABORT with error (see TERMINATION_RULES for error handling). **Step 1 Transition**: 1. Store issue data (or note "N/A - no work_id provided") 2. Use TodoWrite to mark "Step 1: Fetch issue data (if work_id provided)" as "completed" 3. Use TodoWrite to mark "Step 2: Detect configuration from labels" as "in_progress" 4. **IMMEDIATELY proceed to Step 2 below - DO NOT RETURN HERE** --- ## Step 2: Detect Configuration from Labels **Note**: Step 1.5 (Initialize Run Directory) was removed. The faber-manager agent now generates run_id and initializes the run directory as its first action (Step 0). This supports parallel execution where each manager has its own run_id. **Condition**: Only if issue data was fetched **Label Pattern**: `faber:=` **Supported Labels:** | Label Pattern | Extracts | |---------------|----------| | `faber:workflow=` | workflow | | `faber:autonomy=` | autonomy | | `faber:phase=` | phases (comma-separated) | | `faber:step=` | step_id | | `faber:target=` | target | | `faber:skip-phase=` | phase to exclude | **Legacy Labels** (backwards compatibility): - `workflow:` → workflow - `autonomy:` → autonomy **Extraction Logic:** ``` For each label in issue.labels: If label matches "faber:(\w+)=(.+)": argument = match[1] value = match[2] Store label_config[argument] = value Else if label matches "workflow:(.+)": Store label_config["workflow"] = match[1] Else if label matches "autonomy:(.+)": Store label_config["autonomy"] = match[1] ``` **Step 2 Transition**: 1. Store label_config values (or empty object if no labels/issue) 2. Use TodoWrite to mark "Step 2: Detect configuration from labels" as "completed" 3. Use TodoWrite to mark "Step 3: Apply configuration priority" as "in_progress" 4. **IMMEDIATELY proceed to Step 3 below - DO NOT RETURN HERE** --- ## Step 3: Apply Configuration Priority **Priority Order** (highest to lowest): 1. CLI arguments (from command) 2. Issue labels (`faber:*` prefixed) 3. Legacy labels (`workflow:*`, `autonomy:*`) 4. Config file defaults 5. Hardcoded fallbacks **Merge Logic:** ```python final_config = { "workflow": cli.workflow_override or labels.workflow or config.default_workflow or "default", "autonomy": cli.autonomy_override or labels.autonomy or config.default_autonomy or "guarded", "phases": cli.phases or labels.phases or "all", "step_id": cli.step_id or labels.step_id or null, "target": cli.target or labels.target or issue.title or null, } ``` **Step 3 Transition**: 1. Store final_config 2. Use TodoWrite to mark "Step 3: Apply configuration priority" as "completed" 3. Use TodoWrite to mark "Step 4: Resolve target" as "in_progress" 4. **IMMEDIATELY proceed to Step 4 below - DO NOT RETURN HERE** --- ## Step 4: Resolve Target **Cases:** 1. **Explicit target provided**: Use as-is 2. **Natural language target**: Parse for artifact and intent 3. **No target but work_id**: Infer from issue title 4. **Neither**: Error **Natural Language Parsing:** When target contains natural language, extract: - **Artifact name**: What to create/modify - **Work item references**: Issue numbers mentioned - **Phase intent**: Keywords like "design", "build", "test" | Input | Extracted | |-------|-----------| | `"implement auth from issue 158"` | target="auth", work_id="158", intent=build | | `"just design the data pipeline"` | target="data pipeline", phases=frame,architect | | `"test the changes for issue 200"` | work_id="200", phases=evaluate | **Target Inference from Issue:** If no target but work_id provided: ``` target = slugify(issue.title) Example: "Add CSV export feature" → "csv-export-feature" ``` **Step 4 Transition**: 1. Store resolved target 2. Use TodoWrite to mark "Step 4: Resolve target" as "completed" 3. Use TodoWrite to mark "Step 5: Validate phases/steps" as "in_progress" 4. **IMMEDIATELY proceed to Step 5 below - DO NOT RETURN HERE** --- ## Step 5: Validate Phases/Steps ### If phases specified: **Validation:** 1. Split by comma (no spaces allowed) 2. Each phase must be one of: frame, architect, build, evaluate, release 3. Phases must be in valid order (no release before build, etc.) 4. All phases must be enabled in workflow config **Phase Dependencies:** - `architect` assumes `frame` complete (unless included) - `build` assumes `architect` complete (unless included) - `evaluate` assumes `build` complete (unless included) - `release` assumes `evaluate` complete (unless included) **Check State:** ``` If phases doesn't include prerequisite: Check state file for prerequisite completion If not complete: Warn user but allow (they may know what they're doing) ``` ### If step_id specified: **Validation:** 1. Must match pattern `phase:step-name` 2. Phase must be valid (frame, architect, build, evaluate, release) 3. Step must exist in workflow config for that phase **Extract:** ``` step_id = "build:implement" step_phase = "build" step_name = "implement" Validate step_name exists in config.phases.build.steps[*].name ``` **Step 5 Transition**: 1. Store validated phases/step_id 2. Use TodoWrite to mark "Step 5: Validate phases/steps" as "completed" 3. Use TodoWrite to mark "Step 6: Check for prompt sources" as "in_progress" 4. **IMMEDIATELY proceed to Step 6 below - DO NOT RETURN HERE** --- ## Step 6: Check for Prompt Sources **CLI Prompt:** If `prompt` parameter provided, use it as `additional_instructions`. **Issue Body Prompt:** If no CLI prompt, check issue body for `faber-prompt` code block: ```markdown ```faber-prompt Focus on performance. Use caching where appropriate. ``` ``` **Extract:** ``` If issue.description contains "```faber-prompt" block: additional_instructions = content of that block ``` **Priority:** 1. CLI `--prompt` argument (highest) 2. `faber-prompt` block in issue body 3. No additional instructions **Step 6 Transition**: 1. Store additional_instructions (or null) 2. Use TodoWrite to mark "Step 6: Check for prompt sources" as "completed" 3. Use TodoWrite to mark "Step 7: Build manager parameters" as "in_progress" 4. **IMMEDIATELY proceed to Step 7 below - DO NOT RETURN HERE** --- ## Step 7: Build Manager Parameters **Construct parameters for faber-manager agent:** ### For NEW workflows (no resume/rerun): ```json { "target": "resolved-target-name", "work_id": "158", "source_type": "github", "source_id": "158", "workflow_id": "fractary-faber:default", "resolved_workflow": { "id": "default", "inheritance_chain": ["fractary-faber:default", "fractary-faber:core"], "phases": { "frame": { "enabled": true, "pre_steps": [...], "steps": [...], "post_steps": [...] }, "architect": { "enabled": true, "pre_steps": [...], "steps": [...], "post_steps": [...] }, "build": { "enabled": true, "pre_steps": [...], "steps": [...], "post_steps": [...] }, "evaluate": { "enabled": true, "max_retries": 3, "pre_steps": [...], "steps": [...], "post_steps": [...] }, "release": { "enabled": true, "require_approval": true, "pre_steps": [...], "steps": [...], "post_steps": [...] } }, "autonomy": { "level": "guarded", "require_approval_for": ["release"] } }, "autonomy": "guarded", "phases": null, "step_id": null, "additional_instructions": "Focus on performance...", "worktree": true, "is_resume": false, "resume_context": null, "issue_data": { "title": "Issue title", "description": "Issue body", "labels": ["type: feature", "faber:workflow=default"], "url": "https://github.com/..." }, "working_directory": "/path/to/project" } ``` **Note**: `run_id` is NOT passed for new workflows. The faber-manager agent generates its own run_id as its first action. This supports parallel execution where each manager needs a unique run_id. **Key Mappings:** - `resolved_workflow`: FULLY RESOLVED workflow with inheritance merged (from faber-config resolve-workflow) - **CRITICAL** - `phases`: Array from comma-separated string, or null for all phases - `step_id`: String in format `phase:step-name`, or null - `additional_instructions`: Merged prompt from CLI and/or issue - `worktree`: Always true (isolation is mandatory) - `is_resume`: False for new workflows - `working_directory`: Project root path for the manager to operate in ### For RESUME scenarios: ```json { "run_id": "fractary/project/original-uuid", "is_resume": true, "resume_context": { "resume_from": {"phase": "build", "step": "implement"}, "completed_phases": ["frame", "architect"], "completed_steps": {"build": ["setup"]} }, "target": "...", "work_id": "...", ... } ``` For resume, the `run_id` IS passed because we're continuing an existing run. **Step 7 Transition**: 1. Store manager_params object 2. Use TodoWrite to mark "Step 7: Build manager parameters" as "completed" 3. Use TodoWrite to mark "Step 8: Route to faber-manager execution" as "in_progress" 4. **IMMEDIATELY proceed to Step 8 below - DO NOT RETURN HERE** --- ## Step 8: Route to Execution (THE MAIN EVENT) **🚨 THIS IS THE MOST IMPORTANT STEP - ACTUALLY INVOKE FABER-MANAGER 🚨** **⚠️ CRITICAL RULES FOR STEP 8:** 1. You MUST actually invoke the Task tool with the faber-manager agent 2. You MUST NOT just describe what should happen - ACTUALLY DO IT 3. You MUST wait for the faber-manager result before proceeding 4. Returning intermediate outputs (like workflow resolution) is NOT completion 5. If you haven't called Task(subagent_type="fractary-faber:faber-manager"...), you haven't done Step 8 **CHECK YOURSELF:** - Did you just invoke faber-config? That was Step 0b. You're not done. - Did you just fetch the issue? That was Step 1. You're not done. - Did you just build manager params? That was Step 7. You're not done. - **Only invoking faber-manager completes Step 8.** ### Single Work Item **Invoke faber-manager agent using Task tool:** ``` Task( subagent_type="fractary-faber:faber-manager", description="Execute FABER workflow for {target}", prompt='{ "run_id": "fractary/claude-plugins/a1b2c3d4-...", "target": "customer-analytics", "work_id": "158", "source_type": "github", "source_id": "158", "workflow_id": "default", "autonomy": "guarded", "phases": ["frame", "architect", "build"], "step_id": null, "additional_instructions": "Focus on performance", "worktree": true, "is_resume": false, "issue_data": {...}, "resolved_workflow": {...} # IMPORTANT: Include the resolved workflow from Step 0b2 }' ) ``` **AFTER invocation:** 1. Wait for faber-manager result 2. Include the result in your response 3. Only then return control to user 4. Do NOT return intermediate skill outputs as final results ### Step 8 Error Handling **If faber-manager invocation fails:** The Task tool may fail for various reasons. Handle each case explicitly: | Error Type | Handling | TodoWrite Status | |------------|----------|------------------| | Task tool error | Report error, abort | Step 8 stays "in_progress" | | Manager returns error | Report error details, abort | Step 8 stays "in_progress" | | Manager timeout | Report timeout, suggest retry | Step 8 stays "in_progress" | | Network failure | Report failure, suggest retry | Step 8 stays "in_progress" | **Error response format:** ``` ❌ FABER Director: Step 8 Failed Error: faber-manager invocation failed Type: [Task tool error | Manager error | Timeout | Network] Details: [error message from Task tool or manager] Completed Steps: 0a, 0b, 0.5, 1, 2, 3, 4, 5, 6, 7 Failed Step: 8 (Route to faber-manager execution) State preserved: - resolved_workflow: ✓ Available - issue_data: ✓ Available - manager_params: ✓ Built Suggested next steps: 1. Review error details above 2. Check faber-manager agent logs if available 3. Retry: /fractary-faber:run --work-id {work_id} 4. Or debug: Check plugins/faber/agents/faber-manager.md ``` **CRITICAL**: Do NOT mark Step 8 as "completed" if the manager invocation fails. Leave it as "in_progress" so the user knows where execution stopped. ### Multiple Work Items (Parallel) If natural language mentions multiple issues or comma-separated work_ids: **Invoke multiple faber-manager agents in ONE message:** ``` // All Task calls in ONE message = parallel execution Task( subagent_type="fractary-faber:faber-manager", description="Execute FABER workflow for issue #100", prompt='{"target": "...", "work_id": "100", ...}' ) Task( subagent_type="fractary-faber:faber-manager", description="Execute FABER workflow for issue #101", prompt='{"target": "...", "work_id": "101", ...}' ) ``` **Limits:** - Maximum 10 parallel workflows (safety) - If more than 10: batch into groups **Step 8 Transition**: 1. Store manager invocation result(s) 2. Use TodoWrite to mark "Step 8: Route to faber-manager execution" as "completed" 3. Use TodoWrite to mark "Step 9: Aggregate and return results" as "in_progress" 4. **IMMEDIATELY proceed to Step 9 below - DO NOT RETURN HERE** --- ## Step 9: Aggregate Results ### Single Work Item Return faber-manager result directly. ### Multiple Work Items Aggregate results from all agents: ``` 🎯 Batch Workflow Complete: 3 issues ✅ Issue #100: Complete (PR #110) ✅ Issue #101: Complete (PR #111) ❌ Issue #102: Failed at Evaluate phase Summary: 2/3 successful ``` **Step 9 Transition (FINAL)**: 1. Format results for user display 2. Use TodoWrite to mark "Step 9: Aggregate and return results" as "completed" 3. Verify ALL 13 steps are marked "completed" in TodoWrite (Step 0 through 9) 4. **NOW you may return the final results to the user** --- ## ⚠️ FINAL CHECKPOINT BEFORE RETURNING ⚠️ **BEFORE YOU RETURN ANY RESPONSE, VERIFY:** ``` TodoWrite Check: [ ] Step 0: Initialize execution tracker - COMPLETED? [ ] Step 0a: Load project configuration - COMPLETED? [ ] Step 0b: Resolve workflow inheritance via faber-config - COMPLETED? [ ] Step 0.5: Handle resume/rerun - COMPLETED? [ ] Step 1: Fetch issue data - COMPLETED? [ ] Step 2: Detect configuration from labels - COMPLETED? [ ] Step 3: Apply configuration priority - COMPLETED? [ ] Step 4: Resolve target - COMPLETED? [ ] Step 5: Validate phases/steps - COMPLETED? [ ] Step 6: Check for prompt sources - COMPLETED? [ ] Step 7: Build manager parameters - COMPLETED? [ ] Step 8: Route to faber-manager execution - COMPLETED? (Did you ACTUALLY invoke Task tool?) [ ] Step 9: Aggregate and return results - COMPLETED? Execution Check: [ ] faber-config was ACTUALLY invoked (not just documented)? [ ] faber-manager was ACTUALLY invoked via Task tool (not just planned)? [ ] faber-manager result is present in your response? ``` **IF ANY BOX IS UNCHECKED:** 1. STOP - DO NOT RETURN 2. Find the first unchecked step 3. Execute that step 4. Continue until all boxes are checked **ONLY RETURN WHEN ALL BOXES ARE CHECKED.** **YOU ARE ONLY ALLOWED TO RETURN WHEN:** 1. Step 9 "Aggregate and return results" is marked "completed" in TodoWrite 2. The faber-manager Task tool invocation has returned a result 3. The result has been formatted for user display **OR when an error occurs** (see ERROR HANDLING below) **YOU ARE NOT ALLOWED TO RETURN WHEN:** - Any step from 0a through 8 is still "pending" or "in_progress" (unless error) - faber-config has returned but faber-manager has not been invoked - A sub-skill or sub-agent returns an intermediate result **IF YOU FIND YOURSELF ABOUT TO RETURN EARLY:** 1. STOP 2. Check TodoWrite - which steps are incomplete? 3. Resume from the first incomplete step 4. Continue until Step 9 is complete **ERROR HANDLING:** When an error occurs at ANY step: 1. IMMEDIATELY abort further execution 2. Report the error with FULL context: - Which step failed - What the error was - What state was achieved before failure 3. Suggest specific next steps to resolve the error 4. Mark the failed step as "in_progress" (not completed) 5. Return to user with error report **Do NOT:** - Silently fail and return nothing - Continue to next step after error - Retry without user instruction **RETURNING WORKFLOW RESOLUTION AS FINAL OUTPUT IS A BUG.** **THE FIX FOR #304 REQUIRES FABER-MANAGER INVOCATION.** **THE FIX FOR #309 REQUIRES ALL 13 STEPS COMPLETING (Step 0 through Step 9).** This skill is complete when ALL of the following are true: **TodoWrite Verification (FIX FOR #309):** All 13 steps must be marked "completed" in your TodoWrite tracker: - [ ] Step 0: Initialize execution tracker - completed - [ ] Step 0a: Load project configuration - completed - [ ] Step 0b: Resolve workflow inheritance via faber-config - completed - [ ] Step 0.5: Handle resume/rerun (if applicable) - completed - [ ] Step 1: Fetch issue data (if work_id provided) - completed - [ ] Step 2: Detect configuration from labels - completed - [ ] Step 3: Apply configuration priority - completed - [ ] Step 4: Resolve target - completed - [ ] Step 5: Validate phases/steps - completed - [ ] Step 6: Check for prompt sources - completed - [ ] Step 7: Build manager parameters - completed - [ ] Step 8: Route to faber-manager execution - completed - [ ] Step 9: Aggregate and return results - completed **Execution Verification (FIX FOR #304):** - [ ] faber-config skill was ACTUALLY invoked in Step 0b (not just documented) - [ ] resolved_workflow is populated with merged inheritance chain - [ ] faber-manager agent was ACTUALLY invoked via Task tool in Step 8 (not just planned) - [ ] faber-manager result is present in this response - [ ] If multiple work items, ALL manager results are present **IF ANY CHECKBOX IS UNCHECKED:** 1. You are NOT complete 2. Find the first unchecked TodoWrite step 3. Resume from that step 4. Continue until Step 9 is marked completed **COMMON FAILURE MODES TO AVOID:** - Returning after faber-config without invoking faber-manager (THE #304 BUG) - Returning workflow resolution JSON as final output (THE #309 BUG) - Skipping TodoWrite initialization (Step 0) - Not actually invoking Task tool in Step 8 (just describing it) - Not marking todos as completed after each step ## Workflow Started ``` 🎯 FABER Director: Starting Workflow Target: customer-analytics-v2 Work ID: #158 Workflow: default Autonomy: guarded Phases: frame, architect, build Additional Instructions: Focus on performance... ─────────────────────────────────────── Resolving workflow inheritance (Step 0b)... Invoking faber-config: resolve-workflow for fractary-faber:default Resolved inheritance chain: fractary-faber:default → fractary-faber:core Merged steps: 9 total (2 pre_steps + 1 steps + 6 post_steps) Invoking faber-manager... [faber-manager output appears here] ``` ## Label Configuration Detected ``` 🏷️ Configuration from Issue Labels: Detected: workflow: hotfix (from faber:workflow=hotfix) autonomy: autonomous (from faber:autonomy=autonomous) Applied (with CLI overrides): workflow: hotfix autonomy: guarded (CLI override) ``` ## Parallel Workflow Output ``` 🎯 FABER Director: Starting Batch Workflow Work Items: #100, #101, #102 (3 total) Mode: Parallel Spawning 3 faber-manager agents... [Wait for all agents] 📊 Batch Results: ✅ Issue #100: Complete (PR #110) ✅ Issue #101: Complete (PR #111) ❌ Issue #102: Failed (Evaluate phase) 2/3 successful ``` ## Error Outputs **No target or work_id:** ``` ❌ Cannot Execute: No target specified Either provide a target or --work-id: /fractary-faber:run customer-pipeline /fractary-faber:run --work-id 158 ``` **Invalid phase:** ``` ❌ Invalid Phase: 'testing' Valid phases: frame, architect, build, evaluate, release Example: --phase frame,architect,build ``` **Invalid step:** ``` ❌ Invalid Step: 'build:unknown' Step 'unknown' not found in build phase. Available steps in build: - build:implement - build:commit ``` ## Configuration Errors - **Config not found**: Log warning, use defaults, continue - **Invalid JSON**: Log error, use defaults, continue - **Workflow resolution failed**: Report error with details from faber-config, do not proceed ## Issue Fetch Errors - **Issue not found**: Return clear error, don't proceed - **Fetch timeout**: Retry once, then error ## Label Parsing Errors - **Malformed label**: Log warning, skip that label - **Multiple workflow labels**: Error (ambiguous) ## Validation Errors - **Invalid phase**: List valid phases - **Invalid step**: List available steps for that phase - **Missing prerequisites**: Warn but allow ## Routing Errors - **faber-manager invocation failed**: Report error, suggest retry - **Parallel limit exceeded**: Batch into groups - **Workflow resolution failed**: Log faber-config error and do not proceed with manager invocation ## Integration **Architecture:** ``` /fractary-faber:run (lightweight command) ↓ immediately invokes faber-director skill (THIS SKILL - intelligence layer) ↓ invokes faber-config skill (Step 0b - CRITICAL FIX FOR #304) ↓ spawns 1 or N faber-manager agent (execution layer) ``` **Invoked By:** - `/fractary-faber:run` command (primary) - GitHub webhooks (future) - Other skills (programmatic) **Invokes:** - `faber-config` skill - To resolve workflows with inheritance (Step 0b - FIX FOR #304) - `/fractary-work:issue-fetch` - To fetch issue data - `faber-manager` agent - For workflow execution (via Task tool) **Does NOT Invoke:** - Phase skills directly - Hook scripts directly - Platform-specific handlers ## New Parameters (SPEC-00107) This skill now handles: - `target`: Primary argument (what to work on) - `phases`: Comma-separated phase list - `step_id`: Single step in format `phase:step-name` - `prompt`: Additional instructions - Label-based configuration detection ## Label Pattern Reference | Label | Maps To | |-------|---------| | `faber:workflow=` | `--workflow` | | `faber:autonomy=` | `--autonomy` | | `faber:phase=` | `--phase` | | `faber:step=` | `--step` | | `faber:target=` | `` | | `faber:skip-phase=` | Exclude phase | ## Step ID Reference (Default Workflow - fractary-faber:default) | Step ID | Description | |---------|-------------| | `frame:fetch-or-create-issue` | Fetch existing issue or create new one | | `frame:switch-or-create-branch` | Checkout or create branch for issue | | `architect:generate-spec` | Generate specification from issue | | `build:implement` | Implement solution from spec | | `build:commit-and-push-build` | Commit and push implementation | | `evaluate:issue-review` | Verify implementation completeness | | `evaluate:commit-and-push-evaluate` | Commit and push fixes | | `evaluate:create-pr` | Create pull request (skips if exists) | | `evaluate:review-pr-checks` | Wait for and review CI results | | `release:merge-pr` | Merge PR and delete branch | **Note:** Step IDs come from the resolved workflow. If using a custom workflow or one that extends the default, additional steps may be available. Use `faber-config resolve-workflow` to see all steps in the merged workflow. ## Issue #304 Fix Summary **Problem**: FABER Director skips workflow inheritance resolution, causing all inherited steps from core.json to be lost when executing default.json. **Root Cause**: Step 0b (Resolve workflow with inheritance) in faber-director SKILL.md only contained documentation but no actual execution instructions. The LLM never invoked faber-config resolve-workflow. **Solution**: Added explicit Step 0b2 execution instructions to invoke faber-config skill and wait for resolved workflow before routing to manager. **Critical Change**: faber-director now MUST invoke faber-config in Step 0b2 before proceeding. This ensures: 1. All inherited steps from parent workflows are merged 2. Complete workflow with all pre_steps, steps, and post_steps is resolved 3. Resolved workflow is passed to faber-manager in Step 8 4. Manager executes all steps including critical primitives from core **Files Changed**: - `plugins/faber/skills/faber-director/SKILL.md` - Added Step 0b2 execution instructions **Verification**: Ensure that workflow execution now includes all inherited steps like branch creation, PR creation, and PR merge. ## Issue #309 Fix Summary (v2 - Aggressive Restructure) **Problem**: FABER Director stops prematurely after sub-skill invocations (faber-config) instead of continuing through all workflow steps. The skill outputs workflow resolution JSON and terminates. **Root Cause (v1 fix failed)**: The original fix placed `` section BEFORE ``. The LLM subagent jumps straight to `` to start execution, completely skipping the TodoWrite initialization. Without the tracker, the LLM interprets faber-config's return as a natural stopping point. **Solution (v2)**: Move TodoWrite initialization INTO the `` section: 1. Added "Step 0: Initialize Execution Tracker" as FIRST step inside `` section 2. Added aggressive "DO NOT OUTPUT" warnings after Step 0b (faber-config returns) 3. Added remaining steps countdown at critical transition points 4. Added final checkpoint verification at end of `` section 5. Strengthened Step 8 to emphasize ACTUAL Task tool invocation **Critical Changes**: - Step 0 (new): Initialize TodoWrite tracker - INSIDE `` so it cannot be skipped - Step 0b transition: Explicit "DO NOT OUTPUT THIS RESULT" warnings - Step 8: "THE MAIN EVENT" header with "CHECK YOURSELF" verification - End of WORKFLOW: Full checkbox verification before returning **Files Changed**: - `plugins/faber/skills/faber-director/SKILL.md` - Aggressive restructure of TodoWrite enforcement **Verification**: Run `/fractary-faber:run --work-id ` and verify: - All 13 TodoWrite steps progress from pending → in_progress → completed - Step 0 initializes tracker FIRST - faber-config is invoked (Step 0b) but result is NOT output to user - Issue is fetched (Step 1) - faber-manager is ACTUALLY invoked via Task tool (Step 8) - Final result includes manager output (Step 9)