Think & Plan
The Think & Plan domain provides an automated, agentic specification methodology that translates unstructured business needs and user stories into persistent, machine-consumable artifacts (think.md and plan.md).
Rather than writing narrative PRDs that overwhelm AI agent context and compound errors, Coding Pal enforces a strict two-stage pipeline: Think (grounding architecture, tracing flows, mapping components, and bounding minimal scope) followed by Plan (sequencing atomic steps with narrow verification commands and explicit bootability checks). Downstream build agents consume these persistent artifacts step-by-step with zero hallucinated scope.
Domain Architecture
Capabilities Matrix
| Capability | Invocation / Entry Point | Specialist Agent | Scoping Instruction | Supporting Skill | Output Artifact |
|---|---|---|---|---|---|
| Business Needs to Specifications | Planning session or Think Planner agent (CI) | Think Planner | think-plan | think-plan | specs/think.md and specs/plan.md (System flows, invariants, atomic checklist, bootability checks) |
Capability Workflows
1. Business Needs to Specifications: Think & Plan
- When to Run: Before authoring code for any non-trivial business need, user story, feature request, or architectural change. Can be run interactively in the IDE (planning session) or headlessly in CI/CD when a GitHub issue is opened.
- Why It Replaces Traditional Specs:
- Traditional PRDs and narrative design docs are verbose, full of unstated assumptions, and swamp the LLM context window with conversational prose.
- In an agentic operating model, specifications are actionable data structures for models:
think.mdgrounds the LLM in real codebase architecture, data flows, invariants, and bounds the minimal change footprint.plan.mdsequences the implementation into atomic, dependency-ordered steps where each step verifies local functionality and asserts the application remains bootable.
- Downstream build agents consume
plan.mdone step at a time in fresh context sessions, preventing error compounding.
- Workflow Steps:
- Phase 1: Think:
- Interactive (IDE): Open a planning or reasoning session with your AI assistant and prompt with the business requirement: "Analyze the business need for [feature] and save findings to specs/think.md."
- Headless (GitHub Action): Triggered on
issues: [opened], invoking the Think Planner agent (think-plan.agent.md) with the issue title and body. - The
think-plan.instructions.mdstandard automatically loads, ensuring the model traces existing flows, maps component responsibilities, respects invariants, and confines scope without writing code. - Emits
specs/think.mdconforming toskills/think-plan/references/think-plan-contract.md.
- Phase 2: Plan:
- Interactive (IDE): In a clean planning session: "From specs/think.md, generate specs/plan.md."
- Headless (CI): The Think Planner agent automatically synthesizes
specs/plan.mddirectly from the validatedthink.md. - Emits
specs/plan.mdcontaining atomic steps with explicitFiles:,Action:,Verification:, andBootable Check:.
- Phase 3: Automated Validation:
- Specs are deterministically validated via the skill validator:bash
node .agents/skills/think-plan/scripts/validate-specs.mjs --dir specs
- Specs are deterministically validated via the skill validator:
- Phase 4: Agentic Build:
- Launch an AI build or coding agent with clean context.
- Prompt: "From specs/plan.md, implement Step 1 only."
- The agent executes one verified step at a time, keeping the application bootable throughout.
- Phase 1: Think:
Downstream Execution Discipline
When an AI build agent implements functionality from plan.md:
- It reads
plan.mdin a fresh chat session (clean context). - It executes exactly one step from the checklist.
- It runs the step's
Verificationcommand and asserts that the application still boots (Bootable Check). - Only when both pass does it mark the step done and proceed to the next step in a clean session.
Storage & GitHub Issue Attachment Pattern
When automating specifications from GitHub issues in CI/CD, specifications follow the Issue Comment + Dedicated Branch pattern:
- Non-destructive Issue Comment: The action never overwrites the issue description. Leaving the human product owner's original words intact preserves the authentic requirement while keeping discussions and reviews threaded.
- Collapsible Visual Layout: Full specifications are posted in a comment formatted with HTML
<details>tags:think.mdenclosed in<details><summary>🧠 <b>think.md (System Flow & Invariants)</b></summary> ... </details>.plan.mdenclosed in<details open><summary>📝 <b>plan.md (Implementation Steps)</b></summary> ... </details>.
- Dedicated Branch Storage: Files are committed to
specs/issue-<number>/on branchspecs/issue-<number>, providing clean filesystem access for downstream build agents.
- Falsifiable Done When:
think.mdandplan.mdpassskills/think-plan/scripts/validate-specs.mjswith exit code 0.- Zero code was modified during specification generation.