From office
Execute implementation plan with autonomous subagent pipeline. Two-stage review (spec + quality). Flags only for critical blockers.
How this skill is triggered — by the user, by Claude, or both
Slash command
/office:buildingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Autonomous execution of the implementation plan from `/warroom`. Each phase gets an isolated worktree for safe parallel execution.
Autonomous execution of the implementation plan from /warroom. Each phase gets an isolated worktree for safe parallel execution.
Key principles:
Requires completed /warroom session with:
docs/office/tasks.yaml - Feature-grouped task structurespec/phase_*/spec.md - TDD implementation specs (one per phase)docs/office/session.yaml with status: plan_completeCheck (use Bash with test/ls, do NOT read file contents):
- session.yaml exists: grep -q "status: plan_complete" docs/office/session.yaml
- tasks.yaml exists: test -f docs/office/tasks.yaml
- spec/phase_*/spec.md exists: ls spec/phase_*/spec.md >/dev/null 2>&1
If any missing:
"Run /warroom first to create implementation plan."
CRITICAL - Context Conservation:
If docs/office/build/ directory exists:
# Check for existing phase directories
phases=$(ls -d docs/office/build/phase-* 2>/dev/null)
If phases exist:
Ask: "Found existing build. Resume or start fresh?"
If resume:
# Find last completed phase
for dir in $phases; do
grep -l "status: completed" "$dir/status.yaml" 2>/dev/null
done
# Resume from first incomplete phase
If fresh:
rm -rf docs/office/build/
# Start over
Ask user (use AskUserQuestion tool):
Model preset:
default - Sonnet/Opus/Haiku/Sonnet (recommended)fast - Sonnet/Sonnet/Haiku/Haikuquality - Opus/Opus/Sonnet/SonnetRetry limit: (default: 3)
Note: Build always creates a PR to main when complete.
Create an isolated branch for all build work:
# Generate session ID
session_id=$(date +%Y%m%d-%H%M%S)
# Create and push build branch
git checkout -b build/${session_id}
git push -u origin build/${session_id}
echo "Build branch: build/${session_id}"
Store session_id for later use (worktree names, PR).
CRITICAL: Task subagents run in background and auto-deny permission prompts. Prime permissions upfront by running check commands.
5a. Extract permissions from tasks.yaml:
# Get required permissions list
sed -n '/^required_permissions:/,/^[a-z]/{ /^ - /p }' docs/office/tasks.yaml | sed 's/^ - //' | head -20
5b. Always-needed permissions:
These are always required for build (logging, commits):
echo "echo"
echo "git"
5c. Project-specific permissions (fallback):
If required_permissions section is missing (older tasks.yaml), infer from project:
[ -f package.json ] && echo "npm"
[ -f yarn.lock ] && echo "yarn"
[ -f pnpm-lock.yaml ] && echo "pnpm"
[ -f Cargo.toml ] && echo "cargo"
[ -f go.mod ] && echo "go"
[ -f requirements.txt ] && echo "pip" && echo "python"
[ -f pyproject.toml ] && echo "pip" && echo "python"
5d. Display to user:
Preparing build permissions...
Required commands for this build:
- npm
- git
Requesting permissions now. Please approve each prompt.
5e. Run permission check commands:
For each permission, run the corresponding check command:
| Permission | Check Command |
|---|---|
| echo | echo "permission check" |
| npm | npm --version |
| npx | npx --version |
| yarn | yarn --version |
| pnpm | pnpm --version |
| git | git --version |
| node | node --version |
| cargo | cargo --version |
| go | go version |
| python | python --version |
| pip | pip --version |
| pytest | pytest --version |
| make | make --version |
| tsc | npx tsc --version |
| jest | npx jest --version |
| vitest | npx vitest --version |
Run each check command. User will see permission prompts and approve them.
5f. Confirm and proceed:
After all check commands complete:
All permissions granted. Starting build...
5g. Error handling:
If a check command fails (command not found), warn but continue:
Warning: 'cargo' not found. Tasks requiring Rust may fail.
Continue anyway? [Y/n]
If user denies a permission prompt, that command won't work for background agents. Warn and ask whether to continue.
Create the build output structure:
docs/office/build/
└── config.yaml # Build configuration
Extract phase list from tasks.yaml without reading full file:
# Get phase IDs and names only
grep -E "^- id:|^ name:" docs/office/tasks.yaml | paste - - | \
sed 's/- id: //; s/ name: /|/'
Create config.yaml with build settings:
models:
implementer: sonnet
clarifier: opus
spec_reviewer: haiku
code_reviewer: sonnet
retry_limit: 3
started_at: [ISO timestamp]
Note: Each phase executor will create its own docs/office/build/phase-{id}/ directory with status.yaml and progress.log. The orchestrator does NOT create per-phase directories.
REQUIRED: Invoke /office:dashboard skill to start build dashboard.
Use the Skill tool: skill: "office:dashboard"
Extract phase-level dependencies from tasks.yaml (without reading full file):
# Get phase IDs and their depends_on
grep -E "^- id:|^ depends_on:" docs/office/tasks.yaml | paste - - | \
sed 's/- id: //; s/ depends_on: /|/'
Example output:
phase-1|[]
phase-2|[phase-1]
phase-3|[phase-1]
phase-4|[phase-2, phase-3]
Parse output to build phase dependency graph:
depends_on: [] → ready immediately (can start in parallel)Store dependency graph in memory for orchestration. Do NOT read full tasks.yaml.
Key principle: Independent phases run in parallel in separate worktrees. Tasks within each phase run sequentially (handled by phase-execution skill).
While phases remain incomplete:
1. Find ready phases:
- Status is 'pending'
- All depends_on phases are 'completed' (merged to build branch)
2. For each ready phase IN PARALLEL (single message, multiple Task tools):
a. Create worktree from build branch:
git worktree add .worktrees/phase-{id} -b phase/{id} build/${session_id}
b. Dispatch phase execution (foreground subagent per phase):
Task tool:
subagent_type: general-purpose
description: "Execute phase: {phase-id}"
prompt: |
Execute phase {phase-id} in worktree.
Working directory: {project_path}/.worktrees/phase-{id}
Phase spec: spec/phase_{N}_{name}/spec.md
Tasks file: docs/office/tasks.yaml (your phase only)
Run tasks SEQUENTIALLY (one at a time):
- For each task: implement (TDD) → self-review → commit
- All commits go to phase/{id} branch in your worktree
When all tasks complete:
PHASE_COMPLETE: {phase-id}
On blocking issue:
FLAG: {type} | {task-id} | {description}
3. Wait for ANY phase to complete:
- Poll TaskOutput for each in-progress phase (block=false)
- On completion, process result
4. On PHASE_COMPLETE:
a. Switch to build branch and merge phase:
git checkout build/${session_id}
git merge phase/{id} --no-ff -m "Merge phase: {phase-name}"
b. If merge conflict:
- Read conflicting files to understand the conflict
- Resolve based on phase context (you have full visibility)
- git add -A && git commit -m "Resolve conflicts: phase {id}"
c. Cleanup worktree:
git worktree remove .worktrees/phase-{id}
git branch -d phase/{id}
d. Update phase status to 'completed'
e. Check if new phases are now ready (their dependencies now met)
5. On FLAG:
- Present to user with options (see Flag Handling section)
- Handle user choice
- Resume or skip as directed
All phases complete → Continue to Completion section
CRITICAL: To run independent phases in parallel, dispatch multiple Task tools in a SINGLE message:
Example: phase-1 and phase-3 both have depends_on: []
[Task tool: Execute phase-1 in .worktrees/phase-1]
[Task tool: Execute phase-3 in .worktrees/phase-3]
Both dispatch in same message → both run simultaneously
Each phase works in its own worktree on its own branch - no conflicts possible.
When merging a phase to build branch, conflicts can occur if:
The orchestrator (you) resolves conflicts because:
Resolution approach:
git diff --name-only --diff-filter=U to list conflicted filesgit add and commit the resolutionKey principle: Each phase executor OWNS its status file. No race conditions, no shared state.
docs/office/build/
├── config.yaml # Build config (created by orchestrator)
└── phase-{id}/ # Created by phase executor
├── status.yaml # Phase executor OWNS this file
└── progress.log # Append-only event log
phase: phase-1
status: in_progress # pending | in_progress | completed | failed
started_at: "2026-01-16T10:30:00Z"
tasks:
setup-001: completed
setup-002: in_progress
setup-003: in_progress # parallel with 002 (different dependency chain)
setup-004: blocked # waiting on 002, 003
2026-01-16T10:30:00 PHASE_START
2026-01-16T10:30:01 TASK_START:setup-001
2026-01-16T10:31:30 TASK_DONE:setup-001
2026-01-16T10:31:31 TASK_START:setup-002
2026-01-16T10:31:31 TASK_START:setup-003
2026-01-16T10:32:45 CODE_REVIEW:setup-002
2026-01-16T10:33:00 TASK_DONE:setup-002
Benefits:
build/ directory for all updatesUse the Skill tool to invoke /phase-execution:
Skill tool:
skill: "office:phase-execution"
Before invoking, set context for the skill (it reads from conversation):
The skill will:
Example conversation flow:
Orchestrator: "Executing phase-1: Project Foundation"
Orchestrator: "Phase ID: phase-1"
Orchestrator: "Project: /Users/dev/my-project"
Orchestrator: "Models: sonnet/opus/haiku/sonnet, Retry: 3"
[Invokes Skill: office:phase-execution]
... skill runs, spawns parallel tasks ...
Skill returns: "PHASE_COMPLETE: phase-1"
Orchestrator: Applies completion policy, moves to phase-2
The /phase-execution skill runs in the foreground (main context). When it returns:
| Output | Meaning | Action |
|---|---|---|
PHASE_COMPLETE: [id] | Phase finished | Apply completion policy |
FLAG: [type] | [task] | [desc] | Needs human input | Handle flag |
Dashboard integration: The skill updates status.yaml and progress.log as tasks complete. Dashboard watches these files for real-time progress display.
Flags are the only time human intervention is needed.
| Type | Trigger | Severity |
|---|---|---|
clarifier_blocked | Clarifier can't answer from codebase | BLOCKING |
spec_review_exhausted | 3 attempts, still not compliant | BLOCKING |
code_review_exhausted | 3 attempts, still has issues | WARNING |
implementation_error | Unrecoverable error | BLOCKING |
security_concern | Potential vulnerability | BLOCKING |
1. Read flag details from TaskOutput result
2. Present to user:
FLAG: [type]
Task: [task-id] - [task-title]
Phase: [phase-id]
[Context from flag payload]
Options:
[1] Provide guidance
[2] Skip task
[3] Accept as-is
[4] Abort phase
3. On user choice:
- Guidance: Resume phase with user's input
- Skip: Mark task skipped, continue to next
- Accept: Mark task completed with warnings
- Abort: Mark phase aborted, continue others
| Severity | Feature | Other Features |
|---|---|---|
| BLOCKING | Paused until resolved | Continue |
| WARNING | Continues (task has warnings) | Unaffected |
Merge phase to build branch:
1. Switch to build branch:
git checkout build/${session_id}
2. Merge phase:
git merge phase/{id} --no-ff -m "Merge phase: {phase-name}"
3. Handle conflicts if any (orchestrator resolves)
4. Cleanup worktree:
git worktree remove .worktrees/phase-{id}
git branch -d phase/{id}
5. Update phase status to 'completed'
Check: Any blocked phases now unblocked?
All phases have been merged to build/${session_id} branch.
Create Pull Request:
gh pr create \
--base main \
--head build/${session_id} \
--title "Build: {project-name}" \
--body "$(cat <<'EOF'
## Build Summary
**Session:** ${session_id}
**Phases:** {N} completed
| Phase | Tasks | Status |
|-------|-------|--------|
| phase-1 | {n}/{m} | completed |
| phase-2 | {n}/{m} | completed |
## Changes
{summary of major changes from each phase}
---
Generated by Office Plugin /build
EOF
)"
echo "PR created: $(gh pr view --json url -q .url)"
Report to user:
## Build Complete!
**PR Created:** {pr_url}
**Summary:**
- Phases: {N} completed
- Total tasks: {M}
| Phase | Tasks | Commits |
|-------|-------|---------|
| {phase-name} | {completed}/{total} | {commit-count} |
**Next steps:**
1. Review the PR: {pr_url}
2. CI checks will run automatically
3. Merge when ready
Note: Build branch `build/${session_id}` will be deleted when PR is merged.
# Update session status
sed -i '' 's/status: .*/status: build_complete/' docs/office/session.yaml
# Stop dashboard
pkill -f "server.py.*office" 2>/dev/null
# Worktrees already cleaned up after each phase merge
# Build branch remains until PR is merged/closed
| Item | Approach | Context Cost |
|---|---|---|
| tasks.yaml | Read once per phase by skill | ~500-1k (per phase) |
| spec files | Read by task subagents | ~0 (in main) |
| State updates | Skill owns status files | ~50 per update |
| /build skill | Loaded once | ~5k |
| /phase-execution skill | Loaded per phase | ~3k (per phase) |
| Task subagent results | Brief completion messages | ~100 per task |
Total per phase: ~5-8k context
Why this works:
Skills:
skills/building/SKILL.md - This orchestratorskills/phase-execution/SKILL.md - Phase executor (DAG + task parallelism)Runtime files:
docs/office/build/config.yaml - Build configurationdocs/office/build/phase-{id}/status.yaml - Per-phase status (owned by phase-execution skill)docs/office/build/phase-{id}/progress.log - Per-phase event logdocs/office/session.yaml - Updated on completionnpx claudepluginhub shahar061/office --plugin officeOrchestrates a full build pipeline from PRD: plans tasks, implements in parallel, and reviews results. Routes simple work to a lighter workflow.
Executes implementation plans by dispatching tasks to implementer and reviewer subagents. Tracks progress per-task and coordinates sequential phases.
Executes implementation tasks from docs/plan/plan.md using TDD workflow, commits changes via git, verifies hooks, and updates progress. Use after /plan in build pipeline.