ftwPIV workflow orchestrator - Plan, Implement, Validate loop for systematic multi-phase software development. Use when building features phase-by-phase with PRPs, automated validation loops, or multi-agent orchestration. Supports PRD creation, PRP generation, codebase analysis, and iterative execution with validation.
Install via ClawdBot CLI:
clawdbot install SmokeAlot420/ftwParse arguments using this logic:
.md)If the first argument ends with .md, it's a direct path to a PRD file:
PRD_PATH - Direct path to the PRD filePROJECT_PATH - Derived by going up from PRDs/ folderSTART_PHASE - Second argument (default: 1)END_PHASE - Third argument (default: auto-detect from PRD)If the first argument does NOT end with .md:
PROJECT_PATH - Absolute path to project (default: current working directory)START_PHASE - Second argument (default: 1)END_PHASE - Third argument (default: 4)PRD_PATH - Auto-discover from PROJECT_PATH/PRDs/ folderIf $ARGUMENTS[0] ends with ".md":
PRD_PATH = $ARGUMENTS[0]
PROJECT_PATH = dirname(dirname(PRD_PATH))
START_PHASE = $ARGUMENTS[1] or 1
END_PHASE = $ARGUMENTS[2] or auto-detect from PRD
PRD_NAME = basename without extension
Else:
PROJECT_PATH = $ARGUMENTS[0] or current working directory
START_PHASE = $ARGUMENTS[1] or 1
END_PHASE = $ARGUMENTS[2] or 4
PRD_PATH = auto-discover from PROJECT_PATH/PRDs/
PRD_NAME = discovered PRD basename
After parsing arguments:
CRITICAL: Each role MUST read their instruction files before acting.
| Role | Instructions |
|------|-------------|
| Discovery (no PRD) | Read {baseDir}/references/piv-discovery.md |
| PRD Creation | Read {baseDir}/references/create-prd.md |
| PRP Generation | Read {baseDir}/references/generate-prp.md |
| Codebase Analysis | Read {baseDir}/references/codebase-analysis.md |
| Executor | Read {baseDir}/references/piv-executor.md + {baseDir}/references/execute-prp.md |
| Validator | Read {baseDir}/references/piv-validator.md |
| Debugger | Read {baseDir}/references/piv-debugger.md |
Prerequisite: A PRD must exist before entering the Phase Workflow. If no PRD exists, the orchestrator enters Discovery Mode (see below).
When MODE = "discovery":
The orchestrator handles discovery and PRD generation directly (no sub-agent needed — interactive Q&A requires staying in the same session, and answers are already in context for PRD generation).
"Context budget: ~15% orchestrator, 100% fresh per subagent"
You are the orchestrator. You stay lean and manage workflow. You DO NOT execute PRPs yourself - you spawn specialized sub-agents with fresh context for each task.
Sub-agent spawning: Use the sessions_spawn tool to create fresh sub-agent sessions. Each spawn is non-blocking — you'll receive results via an announce step. Wait for each agent's results before proceeding to the next step.
If the project doesn't have PIV directories, create them:
mkdir -p PROJECT_PATH/PRDs PROJECT_PATH/PRPs/templates PROJECT_PATH/PRPs/planning
Copy {baseDir}/assets/prp_base.md to PROJECT_PATH/PRPs/templates/prp_base.md if it doesn't exist.
Create PROJECT_PATH/WORKFLOW.md from {baseDir}/assets/workflow-template.md if it doesn't exist.
For each phase from START_PHASE to END_PHASE:
Check for existing PRP:
ls -la PROJECT_PATH/PRPs/ 2>/dev/null | grep -i "phase.*N\|pN\|p-N"
If no PRP exists, spawn a fresh sub-agent using sessions_spawn to do both codebase analysis and PRP generation in sequence:
RESEARCH & PRP GENERATION MISSION - Phase {N}
==============================================
Project root: {PROJECT_PATH}
PRD Path: {PRD_PATH}
## Phase {N} Scope (from PRD)
{paste phase scope}
## Step 1: Codebase Analysis
Read {baseDir}/references/codebase-analysis.md for the process.
Save to: {PROJECT_PATH}/PRPs/planning/{PRD_NAME}-phase-{N}-analysis.md
## Step 2: Generate PRP (analysis context still loaded)
Read {baseDir}/references/generate-prp.md for the process.
Use template: PRPs/templates/prp_base.md
Output to: {PROJECT_PATH}/PRPs/PRP-{PRD_NAME}-phase-{N}.md
Do BOTH steps yourself. DO NOT spawn sub-agents.
Spawn a fresh sub-agent using sessions_spawn:
EXECUTOR MISSION - Phase {N}
============================
Read {baseDir}/references/piv-executor.md for your role definition.
Read {baseDir}/references/execute-prp.md for the execution process.
PRP Path: {PRP_PATH}
Project: {PROJECT_PATH}
Follow: Load PRP → Plan Thoroughly → Execute → Validate → Verify
Output EXECUTION SUMMARY with Status, Files, Tests, Issues.
Spawn a fresh sub-agent using sessions_spawn:
VALIDATOR MISSION - Phase {N}
=============================
Read {baseDir}/references/piv-validator.md for your validation process.
PRP Path: {PRP_PATH}
Project: {PROJECT_PATH}
Executor Summary: {SUMMARY}
Verify ALL requirements independently.
Output VERIFICATION REPORT with Grade, Checks, Gaps.
Process result: PASS → commit | GAPS_FOUND → debugger | HUMAN_NEEDED → ask user
Spawn a fresh sub-agent using sessions_spawn:
DEBUGGER MISSION - Phase {N} - Iteration {I}
============================================
Read {baseDir}/references/piv-debugger.md for your debugging methodology.
Project: {PROJECT_PATH}
PRP Path: {PRP_PATH}
Gaps: {GAPS}
Errors: {ERRORS}
Fix root causes, not symptoms. Run tests after each fix.
Output FIX REPORT with Status, Fixes Applied, Test Results.
After debugger: re-validate → PASS (commit) or loop (max 3) or escalate.
cd PROJECT_PATH && git status && git diff --stat
Create semantic commit with Built with FTW (First Try Works) - https://github.com/SmokeAlot420/ftw.
Mark phase complete, note validation results.
Loop back to Step 1 for next phase.
When a sub-agent times out or fails:
## PIV RALPH COMPLETE
Phases Completed: START to END
Total Commits: N
Validation Cycles: M
### Phase Summary:
- Phase 1: [feature] - validated in N cycles
...
All phases successfully implemented and validated.
Generated Mar 1, 2026
A team is building a new analytics dashboard feature for their SaaS product. They need to implement it in phases: backend API endpoints, frontend components, data visualization, and integration testing. PIV orchestrates each phase with PRP generation, codebase analysis, and validation loops.
A developer is adding push notification functionality to an existing mobile app. Phases include setting up notification services, implementing UI changes, handling user permissions, and testing across devices. PIV manages the iterative workflow with automated validation.
A company is migrating their e-commerce platform to a new tech stack. Phases involve database schema updates, API reimplementation, frontend redesign, and performance optimization. PIV coordinates multi-agent orchestration for systematic execution.
Maintainers are refactoring a popular open-source library to improve performance and add new features. Phases include code analysis, breaking changes, documentation updates, and release management. PIV uses PRDs and PRPs to ensure consistency.
An IT team is automating a manual reporting process with a custom tool. Phases cover requirement gathering, script development, integration with existing systems, and user training. PIV supports discovery mode for initial PRD creation.
Charge users a recurring fee for access to the software or service. This model provides predictable revenue and encourages ongoing updates and support, aligning well with PIV's iterative development cycles.
Offer a basic version for free to attract users, with premium features available for a fee. PIV can help phase the rollout of premium features, ensuring each addition is validated and integrated smoothly.
Sell customized licenses to large organizations for on-premise or cloud deployment. PIV's systematic approach supports complex, multi-phase implementations tailored to enterprise needs.
💬 Integration Tip
Integrate PIV with version control systems like Git for tracking changes and CI/CD pipelines to automate validation steps, ensuring seamless workflow transitions.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection