motspilot.sh
The Filing SystemShell utility that manages named tasks, requirements, state, checkpoints, and artifacts. Does not invoke AI directly.
Claude Code
The EngineAI orchestrator that reads work orders and runs each pipeline phase as a Task subagent. You approve each phase before it proceeds.
Pipeline at a Glance
Consensus queries 3 AIs (Claude + GPT-4o + Gemini) before pipeline starts — human approval gates between phases
Quick Start
# Edit .motspilot/config with your language, framework, and test command
Task Lifecycle
Edit tasks/<name>/01_requirements.md — describe what you want built, acceptance criteria, constraints.
Review summary after each phase → [A]pprove, [R]eject with feedback, or [V]iew full artifact.
When delivery is approved, task moves to archive/ automatically. Status: completed
$ ./motspilot.sh go --task=my-feature --from=development
Multi-Task Scenarios
New Feature
# Previous task paused automatically
Resume Paused Task
Bug Fix on Archived Task
$ ./motspilot.sh go --task=task-name --from=development
See All Tasks
$ ./motspilot.sh tasks --all # + archived
Checkpointing & Resumption
After each approved phase, a checkpoint is saved to tasks/<name>/checkpoint.
- Format:
<phase>|approved(e.g.,development|approved) - Resume from any phase:
./motspilot.sh go --task=name --from=testing - State persists on disk — works across sessions
- Artifacts serve as the persistent context bridge between sessions
Before the phases begin, a multi-model consensus step queries 3 AIs in parallel and synthesizes a unified starting context. Each phase then uses a thinking framework (not a checklist) and receives the framework guide for your project's framework. Prompt engineering techniques applied across all phases: XML-tagged prompt assembly, investigate-before-acting guards, anti-overengineering clauses, phase-specific self-checks, few-shot examples, and quote-grounded findings.
Requirements — You write this
No codeDescribe what you want built: user stories, acceptance criteria, data requirements, UI specs, security constraints, and what's out of scope.
Artifact:01_requirements.md
Multi-Model Consensus — 3 AIs before pipeline starts
AutomaticFans out the task requirements to Claude + GPT-4o + Gemini in parallel, collects all responses, then synthesizes via a 3-pass process (Extract → Reconcile → Synthesize) with completeness verification.
consensus/01_claude.md — Full Claude responseconsensus/02_gpt4o.md — Full GPT-4o responseconsensus/03_gemini.md — Full Gemini responseconsensus/04_synthesis.md — Judge-merged unified outputconsensus/05_differences.md — Unique contributions per AI (what each brought that others missed)
bin/consensus.php — PHP 8+, no framework dependencies. API keys in .env. Fault-tolerant: works with 1-3 models. Dynamic timeouts scale with prompt length (60–300s).
Architecture — Design only
No codeExplores the codebase, understands existing patterns, traces blast radius, and produces a comprehensive design document. Includes <investigate_before_designing> guard, <anti_overengineering> clause, assumption-gating, and <self_check> verification before finalizing.
- Start with the person — Who uses this? What's their goal? What do they see?
- Get a feel for the codebase — Read landmark files. What conventions exist? What would look natural?
- Trace the blast radius — What could break? Map dependencies. Every line is a potential failure.
- Design by asking questions — Data, logic, security, failure. Not by following templates.
- Consider alternatives — Think of 2+ approaches, explain why you chose one.
- User Experience
- Codebase Analysis
- Blast Radius
- Data Design
- Component Design
- Security Design
- Failure Modes
- Alternatives Considered
- File Map (new + modified)
- Rollback Plan
02_architecture.md
Development — Build in tiny loops
Writes codeImplements the feature following the architecture document. Creates and modifies actual files in the codebase. Includes <investigate_before_coding> guard, <anti_overengineering> clause, follow-through policy, and <self_check> verification.
Loop 1 — Foundation: Schema/migration → model/entity → relationships → verify
Loop 2 — Logic: Service method → test → green → next method → test → green
Loop 3 — Interface: Controller/handler → template/view → routes → verify in browser
- Read every file you'll modify before changing it
- Surgical additions only — never reformat or restructure
- Match the existing coding style exactly
- One logical action per migration file
- Legacy patterns: work with them, don't refactor
- Record test baseline before any changes
03_development.md
Testing — Security-first
Writes codeWrites comprehensive tests starting with what scares you most, not what's easiest. Includes <investigate_before_testing> guard, few-shot <example> blocks for test naming, and <self_check> verification. Falls back to manual test checklists when no test framework exists.
- Integration safety — existing tests still pass
- Security — auth bypass, CSRF, mass assignment, IDOR, XSS
- Business logic edge cases — service layer decisions
- Happy path — basic "it works" confirmation
- Error paths — validation, duplicates, missing data
04_testing.md
Verification — Skeptical senior reviewer
No codeReads actual code (not reports), traces data flows, checks for security issues, verifies framework API correctness. Includes <investigate_before_judging> guard requiring quoted code for every finding. Completeness contract: must read every file. Requirements coverage matrix (MET/NOT MET) per requirement. <self_check> verification.
- Did anything existing break? (full test suite)
- Does the feature meet requirements? (every criterion)
- Is the code secure? (validation, escaping, auth, IDOR, CSRF)
- Is the code clean? (readable, maintainable)
- Correct framework API for the project's version?
05_verification.md — READY or NOT READY
Delivery — Safe and reversible
No codeProduces deployment guide with copy-paste commands, rollback steps, smoke tests, and monitoring instructions. Includes <investigate_before_documenting> guard and <self_check> verification. Surfaces unresolved verification issues with [VERIFY] markers.
- What changed (human summary)
- Files (new, modified, deleted)
- Deployment steps
- Rollback steps
- Configuration changes
- Git commit message
- What to watch after deploy
- Known limitations / future work
06_delivery.md
Project Configuration
Edit .motspilot/config — this file is sourced by motspilot.sh and read by the orchestrator.
| Key | Description | Example | Default |
|---|---|---|---|
| PROJECT_ROOT | Path to project root (relative to motspilot/ or absolute) | ".." | .. |
| LANGUAGE | Programming language | "php" | "" (empty) |
| LANGUAGE_VERSION | Language version | "8.2" | "" (empty) |
| FRAMEWORK | Framework name — loads matching guide from prompts/frameworks/ |
"cakephp" | "" (empty) |
| AUTO_APPROVE | Skip approval gates between phases | "all" or "architecture,delivery" | "none" |
| MAX_RETRIES | Retry budget per phase on failure | 2 | 2 |
| TEST_CMD | How to run tests | "pytest" | "" (empty) |
| APP_URL | URL for smoke testing in verification | "http://localhost:3000" | "http://localhost:8080" |
| DEPLOY_CMD | Deployment command | "./deploy.sh" | "echo 'Deploy not configured'" |
Example Configurations
CakePHP Project
LANGUAGE_VERSION="8.2"
FRAMEWORK="cakephp"
TEST_CMD="./vendor/bin/phpunit"
APP_URL="http://localhost:8080"
Django Project
LANGUAGE_VERSION="3.12"
FRAMEWORK="django"
TEST_CMD="python manage.py test"
APP_URL="http://localhost:8000"
Next.js Project
LANGUAGE_VERSION="5.3"
FRAMEWORK="nextjs"
TEST_CMD="npm test"
APP_URL="http://localhost:3000"
Rails Project
LANGUAGE_VERSION="3.3"
FRAMEWORK="rails"
TEST_CMD="bundle exec rspec"
APP_URL="http://localhost:3000"
Command Reference
| Command | Description |
|---|---|
./motspilot.sh init |
First-time setup — creates config and directory structure |
./motspilot.sh go --task=<name> "description" |
Create task + generate work order |
./motspilot.sh go --task=<name> |
Re-prepare existing task (regenerate work order) |
./motspilot.sh go --task=<name> --from=<phase> |
Prepare to re-run from a specific phase |
./motspilot.sh tasks |
List active tasks with phase progress bars |
./motspilot.sh tasks --all |
List active + archived tasks |
./motspilot.sh status [--task=<name>] |
Detailed task status with artifact sizes |
./motspilot.sh archive --task=<name> |
Manually archive a completed task |
./motspilot.sh reactivate <name> |
Restore task from archive for bug fixes |
./motspilot.sh reset --task=<name> |
Delete phase artifacts (keeps requirements) |
./motspilot.sh view <phase> [--task=<name>] |
View a phase artifact in terminal |
Phase Names & Shortcuts
Full Phase Names
architecture ·
development ·
testing ·
verification ·
delivery
View Shortcuts
req ·
arch ·
dev ·
test ·
verify ·
wo (workorder)
Framework Guides
Framework-specific knowledge lives in prompts/frameworks/<name>.md. When a guide exists for your configured FRAMEWORK, it's automatically included in every subagent prompt alongside the thinking framework.
Available Guides
cakephp.md
CakePHP 4.x — Version reference, naming conventions, migration/entity/table/service/controller/template/route/test patterns, verification checks, deployment commandsAdding a New Framework Guide
motspilot/prompts/frameworks/<framework-name>.mdFRAMEWORK="<framework-name>" in .motspilot/configRecommended Sections for a Framework Guide
| Section | Purpose | Used by Phase |
|---|---|---|
| Version Reference | Correct vs incorrect API for the framework version | All phases |
| Naming Conventions | How files, classes, routes are named | Architecture, Development |
| Files to Explore | Key landmark files for codebase understanding | Architecture |
| Migration / Schema Patterns | How to create and rollback schema changes | Development |
| Model / Entity Patterns | Access control, validation, relationships | Development |
| Service / Logic Patterns | Where business logic lives | Development |
| Controller / Handler Patterns | Request handling conventions | Development |
| Template / View Patterns | Output escaping, form helpers, layout | Development, Verification |
| Test Patterns | Test setup, fixtures/factories, security test examples | Testing |
| Verification Checks | Grep patterns to catch common mistakes | Verification |
| Deployment Commands | Deploy, rollback, cache clear commands | Delivery |
Core Philosophy
These principles guide every phase of the pipeline. They're not rules to follow — they're a way of thinking.
Start with the person
Think about who uses the feature before touching code. What's their goal? Their emotional state? What do they see when things go wrong?
Explore before building
Read existing code. Understand patterns. Don't assume anything about the codebase structure. Your new code should feel like it was always there.
Trace the blast radius
Before changing anything, ask: "What could this break?" Map every dependency between your feature and existing code.
Build in tiny loops
Write a little → verify it works → write more. Never write 500 lines and hope for the best.
Security mindset
Think like an attacker at every step. Test auth bypass, CSRF, IDOR, mass assignment, and XSS before testing the happy path.
Never greenfield
Always integrating into existing apps. Match existing patterns. Work with legacy code, don't refactor it.
One action per migration
Never combine unrelated changes in a single migration. Each migration should do exactly one thing — easier to debug, rollback, and review.
Human in the loop
Approval gates between every phase. You review, reject, or approve. The AI proposes, you decide.
Prompt Architecture
Each subagent receives a layered prompt assembled by the orchestrator using XML tags for unambiguous section parsing:
<thinking_framework>
[Full contents of prompts/<phase>.md]
Includes <investigate_before_*>, <anti_overengineering>, <self_check>, <example> blocks
</thinking_framework>
<framework_guide>
[Full contents of prompts/frameworks/<FRAMEWORK>.md]
Framework-specific patterns, API reference, verification checks
</framework_guide>
<project_config>
Language, version, framework, test command, app URL
</project_config>
<requirements>
Full contents of 01_requirements.md
</requirements>
<consensus>
Multi-model synthesis (omitted if unavailable)
</consensus>
<previous_phases>
Cumulative context from all completed prior phases
</previous_phases>
<task>
Phase-specific instructions
</task>
</motspilot_phase>
Why XML tags? Claude's prompt engineering best practices recommend XML tags over plain-text markers for unambiguous parsing of multi-section prompts. Each section is clearly delineated, reducing misinterpretation when mixing instructions, context, examples, and variable inputs.