Plan
Compile a design document into a ralphex-compatible execution plan. The plan is a structured markdown file that ralphex autonomously executes through Claude Code to produce the implementation.
Synopsis
/goga:plan <function-name>
Examples in this document use Claude Code style (/goga:<command>). For other agents, invoke the skill directly: goga-plan.
Output artifact
docs/plans/<function-name>.md — an execution plan with this structure:
### Task N: <title>headings define individual tasks- [ ]checkboxes mark incomplete items## Validation Commandssection lists verification commands- Three task types: infrastructure (cell structure, facade, re-exports), TDD coding (entity implementation with the ralphex protocol), integration tests (cross-entity scenarios)
Only ONE task is executed per ralphex iteration.
Algorithm
Phase 1. Context loading
| Step | Action |
|---|---|
| 1 | Load DSL specification via goga-cell. |
| 2 | Load DSL application principles via goga-cookbook. |
| 3 | Load language implementation rules via goga-lang-disp. |
| 4 | Load the plan template from output-template.md. |
| 5 | Load project conventions from conventions.md. |
| 6 | Read the design document from docs/design/<function-name>.md. Halt if missing. |
Phase 2. Compile design document into plan
| Step | Action |
|---|---|
| 1. Extract data from design | Contract changes → task scope; applied fixes → context; entity interactions → diagrams; code stack traces → verified chains; algorithm design → checkboxes; cross-cutting concerns → distributed across tasks; usages analysis → task context; .usages/ updates → tasks; test stack traces → test instructions. Transfer traces and diagrams verbatim, do not summarize. |
| 2. Compile into ralphex tasks | For each entity: create tasks following DSL compilation rules, cell boundaries, ralphex format requirements, task ordering, TDD workflow, task formation rules, templates, and project conventions. |
| 3. Save the plan | Write to docs/plans/<function-name>.md. Create directory if missing. |
Phase 3. Plan verification
10-point checklist:
- Every entity from contract changes covered by a task.
- Every test scenario included in task test instructions.
- Every Usages analysis entry referenced in at least one task.
- Every planned
.usages/entry has a creation task or step. - Interaction diagrams and traces transferred verbatim.
- All coding tasks follow the TDD workflow.
- Ralphex format correct (
### Task N:headings,- [ ]checkboxes). - Every task atomic and self-contained.
- Validation commands defined.
- CODEMANIFEST files marked as read-only.
If any answer is "no" — rework the plan.
Phase 4. Present summary
- Task table (numbered, with type and one-line description)
- Key design decisions (3–5 points)
- Total test count
DSL compilation mapping
| DSL element | Result in plan |
|---|---|
Types Import |
Context section — internal types grouped under one From |
Usages Import |
Context section — imported practice from another cell's .usages/ |
Usages |
Context section with implementation guidance |
Annotations |
Contextual hints embedded into task descriptions |
->Re-exports |
Task: ensure importability from the facade |
Entity with properties |
Task: create entity in location, implement properties |
Entity with methods |
Task: implement methods with behavior from descriptions |
| Standalone function | Task: implement function in location |
Type:: mutation |
Task: implement interface mutation mechanism |
| Method/property descriptions | Reflected in task implementation instructions |
Task ordering (within a cell)
- Infrastructure tasks (cell structure, facade, re-exports)
- Entity skeleton tasks
- Property implementation tasks
- Method implementation tasks
- Interface mutation tasks
- Integration test tasks
Leaf cells first, then parent cells. Entities sharing the same location are grouped into one task.
Ralphex execution protocol (embedded in each coding task)
Each coding task includes steps 0–8 as checkboxes:
| Step | Action |
|---|---|
| 0 | Declaration — declare which task is being worked on |
| 1 | Contract tests — write contract tests (they will fail) |
| 2 | Implementation — write the code |
| 3 | Interface verification — run contract tests |
| 4 | Logic tests — write behavioral tests |
| 5 | Debugging — run tests, fix implementation until all pass |
| 6 | Contract re-verification — verify contract obligations still met |
| 7 | Lint — run linter, fix formatting |
| 8 | Completion — mark checkboxes as completed |
After completion: → REVIEW → APPROVAL → NEXT_TASK.
Boundaries
Allowed within a cell: additional internal files, helper functions/classes, private abstractions, internal restructuring, decomposition into smaller units.
Prohibited: creating new cells, defining new cell-level interfaces outside the current one, replacing contract entities with internal-only abstractions, ignoring location, modifying CODEMANIFEST files (read-only).
Resolving the function name
If <function-name> is omitted:
- Scan
docs/design/. - Single file — use automatically.
- Multiple files — ask the user.
- Empty or missing — halt and ask the user to run
designfirst.
Inputs and outputs
| Input | docs/design/<function-name>.md |
| Output | docs/plans/<function-name>.md |
What happens next
- Run
reviewon the plan artifact (review(plan)). - On approval, run
goga buildto execute the plan.