ralphctl 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +94 -0
- package/LICENSE +21 -0
- package/README.md +189 -0
- package/bin/ralphctl +13 -0
- package/package.json +92 -0
- package/schemas/config.schema.json +20 -0
- package/schemas/ideate-output.schema.json +22 -0
- package/schemas/projects.schema.json +53 -0
- package/schemas/requirements-output.schema.json +24 -0
- package/schemas/sprint.schema.json +109 -0
- package/schemas/task-import.schema.json +49 -0
- package/schemas/tasks.schema.json +72 -0
- package/src/ai/executor.ts +973 -0
- package/src/ai/lifecycle.ts +45 -0
- package/src/ai/parser.ts +40 -0
- package/src/ai/permissions.ts +207 -0
- package/src/ai/process-manager.ts +248 -0
- package/src/ai/prompts/ideate-auto.md +144 -0
- package/src/ai/prompts/ideate.md +165 -0
- package/src/ai/prompts/index.ts +89 -0
- package/src/ai/prompts/plan-auto.md +131 -0
- package/src/ai/prompts/plan-common.md +157 -0
- package/src/ai/prompts/plan-interactive.md +190 -0
- package/src/ai/prompts/task-execution.md +159 -0
- package/src/ai/prompts/ticket-refine.md +230 -0
- package/src/ai/rate-limiter.ts +89 -0
- package/src/ai/runner.ts +478 -0
- package/src/ai/session.ts +319 -0
- package/src/ai/task-context.ts +270 -0
- package/src/cli-metadata.ts +7 -0
- package/src/cli.ts +65 -0
- package/src/commands/completion/index.ts +33 -0
- package/src/commands/config/config.ts +58 -0
- package/src/commands/config/index.ts +33 -0
- package/src/commands/dashboard/dashboard.ts +5 -0
- package/src/commands/dashboard/index.ts +6 -0
- package/src/commands/doctor/doctor.ts +271 -0
- package/src/commands/doctor/index.ts +25 -0
- package/src/commands/progress/index.ts +25 -0
- package/src/commands/progress/log.ts +64 -0
- package/src/commands/progress/show.ts +14 -0
- package/src/commands/project/add.ts +336 -0
- package/src/commands/project/index.ts +104 -0
- package/src/commands/project/list.ts +31 -0
- package/src/commands/project/remove.ts +43 -0
- package/src/commands/project/repo.ts +118 -0
- package/src/commands/project/show.ts +49 -0
- package/src/commands/sprint/close.ts +180 -0
- package/src/commands/sprint/context.ts +109 -0
- package/src/commands/sprint/create.ts +60 -0
- package/src/commands/sprint/current.ts +75 -0
- package/src/commands/sprint/delete.ts +72 -0
- package/src/commands/sprint/health.ts +229 -0
- package/src/commands/sprint/ideate.ts +496 -0
- package/src/commands/sprint/index.ts +226 -0
- package/src/commands/sprint/list.ts +86 -0
- package/src/commands/sprint/plan-utils.ts +207 -0
- package/src/commands/sprint/plan.ts +549 -0
- package/src/commands/sprint/refine.ts +359 -0
- package/src/commands/sprint/requirements.ts +58 -0
- package/src/commands/sprint/show.ts +140 -0
- package/src/commands/sprint/start.ts +119 -0
- package/src/commands/sprint/switch.ts +20 -0
- package/src/commands/task/add.ts +316 -0
- package/src/commands/task/import.ts +150 -0
- package/src/commands/task/index.ts +123 -0
- package/src/commands/task/list.ts +145 -0
- package/src/commands/task/next.ts +45 -0
- package/src/commands/task/remove.ts +47 -0
- package/src/commands/task/reorder.ts +45 -0
- package/src/commands/task/show.ts +111 -0
- package/src/commands/task/status.ts +99 -0
- package/src/commands/ticket/add.ts +265 -0
- package/src/commands/ticket/edit.ts +166 -0
- package/src/commands/ticket/index.ts +114 -0
- package/src/commands/ticket/list.ts +128 -0
- package/src/commands/ticket/refine-utils.ts +89 -0
- package/src/commands/ticket/refine.ts +268 -0
- package/src/commands/ticket/remove.ts +48 -0
- package/src/commands/ticket/show.ts +74 -0
- package/src/completion/handle.ts +30 -0
- package/src/completion/resolver.ts +241 -0
- package/src/interactive/dashboard.ts +268 -0
- package/src/interactive/escapable.ts +81 -0
- package/src/interactive/file-browser.ts +153 -0
- package/src/interactive/index.ts +429 -0
- package/src/interactive/menu.ts +403 -0
- package/src/interactive/selectors.ts +273 -0
- package/src/interactive/wizard.ts +221 -0
- package/src/providers/claude.ts +53 -0
- package/src/providers/copilot.ts +86 -0
- package/src/providers/index.ts +43 -0
- package/src/providers/types.ts +85 -0
- package/src/schemas/index.ts +130 -0
- package/src/store/config.ts +74 -0
- package/src/store/progress.ts +230 -0
- package/src/store/project.ts +276 -0
- package/src/store/sprint.ts +229 -0
- package/src/store/task.ts +443 -0
- package/src/store/ticket.ts +178 -0
- package/src/theme/index.ts +215 -0
- package/src/theme/ui.ts +872 -0
- package/src/utils/detect-scripts.ts +247 -0
- package/src/utils/editor-input.ts +41 -0
- package/src/utils/editor.ts +37 -0
- package/src/utils/exit-codes.ts +27 -0
- package/src/utils/file-lock.ts +135 -0
- package/src/utils/git.ts +185 -0
- package/src/utils/ids.ts +37 -0
- package/src/utils/issue-fetch.ts +244 -0
- package/src/utils/json-extract.ts +62 -0
- package/src/utils/multiline.ts +61 -0
- package/src/utils/path-selector.ts +236 -0
- package/src/utils/paths.ts +108 -0
- package/src/utils/provider.ts +34 -0
- package/src/utils/requirements-export.ts +63 -0
- package/src/utils/storage.ts +107 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Quick Ideation to Implementation
|
|
2
|
+
|
|
3
|
+
You are a combined requirements analyst and task planner. Your goal is to quickly turn a rough idea into refined
|
|
4
|
+
requirements and a dependency-ordered set of implementation tasks in a single session.
|
|
5
|
+
|
|
6
|
+
## Two-Phase Protocol
|
|
7
|
+
|
|
8
|
+
### Phase 1: Refine Requirements (WHAT)
|
|
9
|
+
|
|
10
|
+
Focus: Clarify WHAT needs to be built (implementation-agnostic)
|
|
11
|
+
|
|
12
|
+
**Hard Constraints:**
|
|
13
|
+
|
|
14
|
+
- Do NOT explore the codebase yet
|
|
15
|
+
- Do NOT reference specific files or implementation details
|
|
16
|
+
- Do NOT select affected repositories (user already selected them)
|
|
17
|
+
- Focus exclusively on requirements, acceptance criteria, and scope
|
|
18
|
+
|
|
19
|
+
**Steps:**
|
|
20
|
+
|
|
21
|
+
1. **Analyze the idea** — Read the idea description below and identify what is clear vs ambiguous
|
|
22
|
+
2. **Interview the user** — Ask focused questions one at a time using AskUserQuestion:
|
|
23
|
+
- What problem are we solving and for whom?
|
|
24
|
+
- What is in scope vs explicitly out of scope?
|
|
25
|
+
- What should the system do? (Describe behavior, not implementation)
|
|
26
|
+
- What are the acceptance criteria? (Given/When/Then format)
|
|
27
|
+
- What edge cases and error states need handling?
|
|
28
|
+
- What are the business constraints? (performance, compatibility, etc.)
|
|
29
|
+
3. **Stop when ready** — Stop asking questions when the problem statement is clear, requirements have acceptance
|
|
30
|
+
criteria, scope boundaries are explicit, and major edge cases are addressed
|
|
31
|
+
4. **Present requirements** — Show the complete refined requirements in readable markdown, then ask for approval using
|
|
32
|
+
AskUserQuestion:
|
|
33
|
+
```
|
|
34
|
+
Question: "Does this look correct? Any changes needed?"
|
|
35
|
+
Header: "Approval"
|
|
36
|
+
Options:
|
|
37
|
+
- "Approved, continue" — "Requirements are complete and accurate"
|
|
38
|
+
- "Needs changes" — "I'll describe what to adjust"
|
|
39
|
+
```
|
|
40
|
+
5. **Iterate if needed** — If user requests changes, edit and re-present until approved
|
|
41
|
+
|
|
42
|
+
**Requirements Format:**
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## Problem
|
|
46
|
+
|
|
47
|
+
[Clear problem statement]
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
- [Functional requirement 1]
|
|
52
|
+
- [Functional requirement 2]
|
|
53
|
+
|
|
54
|
+
## Acceptance Criteria
|
|
55
|
+
|
|
56
|
+
- Given [precondition], When [action], Then [expected result]
|
|
57
|
+
- [Additional criteria...]
|
|
58
|
+
|
|
59
|
+
## Scope
|
|
60
|
+
|
|
61
|
+
**In scope:**
|
|
62
|
+
|
|
63
|
+
- [What's included]
|
|
64
|
+
|
|
65
|
+
**Out of scope:**
|
|
66
|
+
|
|
67
|
+
- [What's explicitly excluded or deferred]
|
|
68
|
+
|
|
69
|
+
## Constraints
|
|
70
|
+
|
|
71
|
+
- [Business/technical constraints if any]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Phase 2: Plan Implementation (HOW)
|
|
75
|
+
|
|
76
|
+
Focus: Determine HOW to implement the approved requirements
|
|
77
|
+
|
|
78
|
+
**After requirements are approved, proceed to implementation planning.**
|
|
79
|
+
|
|
80
|
+
**Steps:**
|
|
81
|
+
|
|
82
|
+
1. **Explore the codebase** — Read CLAUDE.md (if exists), check project structure, find similar implementations, extract
|
|
83
|
+
verification commands
|
|
84
|
+
2. **Review approved requirements** — Understand WHAT was approved in Phase 1
|
|
85
|
+
3. **Explore selected repositories** — The user pre-selected repositories (listed below). Deep-dive to understand
|
|
86
|
+
patterns, conventions, and existing code
|
|
87
|
+
4. **Plan tasks** — Create tasks using the guidelines from the Planning Common Context below. Use tools:
|
|
88
|
+
- **Explore agent** — Broad codebase understanding
|
|
89
|
+
- **Grep/glob** — Find specific patterns, existing implementations
|
|
90
|
+
- **File reading** — Understand implementation details
|
|
91
|
+
5. **Ask implementation questions** — Use AskUserQuestion for decisions (library choice, approach, architecture
|
|
92
|
+
patterns)
|
|
93
|
+
6. **Present task breakdown** — SHOW BEFORE WRITE. Present tasks in readable markdown:
|
|
94
|
+
- List each task with repository, blocked by, and steps
|
|
95
|
+
- Show dependency graph
|
|
96
|
+
- Ask: "Does this task breakdown look correct? Any changes needed?"
|
|
97
|
+
7. **Wait for confirmation** — ONLY AFTER USER CONFIRMS write to output file
|
|
98
|
+
|
|
99
|
+
## Idea to Refine and Plan
|
|
100
|
+
|
|
101
|
+
**Title:** {{IDEA_TITLE}}
|
|
102
|
+
|
|
103
|
+
**Project:** {{PROJECT_NAME}}
|
|
104
|
+
|
|
105
|
+
**Description:**
|
|
106
|
+
|
|
107
|
+
{{IDEA_DESCRIPTION}}
|
|
108
|
+
|
|
109
|
+
## Selected Repositories
|
|
110
|
+
|
|
111
|
+
The user pre-selected these repositories for exploration:
|
|
112
|
+
|
|
113
|
+
{{REPOSITORIES}}
|
|
114
|
+
|
|
115
|
+
**Do NOT** propose changing the repository selection. These are the paths you will explore in Phase 2.
|
|
116
|
+
|
|
117
|
+
## Planning Common Context
|
|
118
|
+
|
|
119
|
+
{{COMMON}}
|
|
120
|
+
|
|
121
|
+
## Output Format
|
|
122
|
+
|
|
123
|
+
When BOTH phases are approved by the user, write to: {{OUTPUT_FILE}}
|
|
124
|
+
|
|
125
|
+
Use this exact JSON Schema:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{{SCHEMA}}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Example output:**
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"requirements": "## Problem\n...\n\n## Requirements\n...\n\n## Acceptance Criteria\n...\n\n## Scope\n...\n\n## Constraints\n...",
|
|
136
|
+
"tasks": [
|
|
137
|
+
{
|
|
138
|
+
"id": "1",
|
|
139
|
+
"name": "Add date range filter to export API",
|
|
140
|
+
"description": "Add startDate/endDate query parameters to the /api/export endpoint with validation",
|
|
141
|
+
"projectPath": "/Users/dev/my-app/backend",
|
|
142
|
+
"steps": [
|
|
143
|
+
"Add DateRangeSchema to src/schemas/export.ts with startDate and endDate as optional ISO8601 strings",
|
|
144
|
+
"Update ExportController.getExport() in src/controllers/export.ts to parse and validate date range params",
|
|
145
|
+
"Add date range filtering to ExportRepository.findRecords() in src/repositories/export.ts",
|
|
146
|
+
"Write tests in src/controllers/__tests__/export.test.ts for: no dates, valid range, invalid range, start > end",
|
|
147
|
+
"Run pnpm typecheck && pnpm lint && pnpm test — all pass"
|
|
148
|
+
],
|
|
149
|
+
"blockedBy": []
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Important:**
|
|
156
|
+
|
|
157
|
+
- `requirements` is a single markdown string with the approved requirements from Phase 1
|
|
158
|
+
- `tasks` is an array of implementation tasks following the schema
|
|
159
|
+
- Each task must have `projectPath` from the Selected Repositories list
|
|
160
|
+
- Tasks can reference each other via `id` and `blockedBy`
|
|
161
|
+
- Only write after BOTH requirements AND task breakdown are approved
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
Start with Phase 1: Read the idea above, identify what's clear vs ambiguous, then ask your first clarifying question.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
|
|
7
|
+
function loadTemplate(name: string): string {
|
|
8
|
+
return readFileSync(join(__dirname, `${name}.md`), 'utf-8');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function buildPlanPrompt(template: string, context: string, schema: string): string {
|
|
12
|
+
const common = loadTemplate('plan-common');
|
|
13
|
+
return template.replace('{{COMMON}}', common).replace('{{CONTEXT}}', context).replace('{{SCHEMA}}', schema);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function buildInteractivePrompt(context: string, outputFile: string, schema: string): string {
|
|
17
|
+
const template = loadTemplate('plan-interactive');
|
|
18
|
+
return buildPlanPrompt(template, context, schema).replace('{{OUTPUT_FILE}}', outputFile);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function buildAutoPrompt(context: string, schema: string): string {
|
|
22
|
+
const template = loadTemplate('plan-auto');
|
|
23
|
+
return buildPlanPrompt(template, context, schema);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function buildTaskExecutionPrompt(progressFilePath: string, noCommit: boolean, contextFileName: string): string {
|
|
27
|
+
const template = loadTemplate('task-execution');
|
|
28
|
+
const commitStep = noCommit
|
|
29
|
+
? ''
|
|
30
|
+
: '\n> **Before continuing:** Create a git commit with a descriptive message for the changes made.\n';
|
|
31
|
+
const commitConstraint = noCommit ? '' : '- **Must commit** — Create a git commit before signaling completion.\n';
|
|
32
|
+
return template
|
|
33
|
+
.replace('{{PROGRESS_FILE}}', progressFilePath)
|
|
34
|
+
.replace('{{COMMIT_STEP}}', commitStep)
|
|
35
|
+
.replace('{{COMMIT_CONSTRAINT}}', commitConstraint)
|
|
36
|
+
.replaceAll('{{CONTEXT_FILE}}', contextFileName);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function buildTicketRefinePrompt(
|
|
40
|
+
ticketContent: string,
|
|
41
|
+
outputFile: string,
|
|
42
|
+
schema: string,
|
|
43
|
+
issueContext = ''
|
|
44
|
+
): string {
|
|
45
|
+
const template = loadTemplate('ticket-refine');
|
|
46
|
+
return template
|
|
47
|
+
.replace('{{TICKET}}', ticketContent)
|
|
48
|
+
.replace('{{OUTPUT_FILE}}', outputFile)
|
|
49
|
+
.replace('{{SCHEMA}}', schema)
|
|
50
|
+
.replace('{{ISSUE_CONTEXT}}', issueContext);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function buildIdeatePrompt(
|
|
54
|
+
ideaTitle: string,
|
|
55
|
+
ideaDescription: string,
|
|
56
|
+
projectName: string,
|
|
57
|
+
repositories: string,
|
|
58
|
+
outputFile: string,
|
|
59
|
+
schema: string
|
|
60
|
+
): string {
|
|
61
|
+
const template = loadTemplate('ideate');
|
|
62
|
+
const common = loadTemplate('plan-common');
|
|
63
|
+
return template
|
|
64
|
+
.replace('{{IDEA_TITLE}}', ideaTitle)
|
|
65
|
+
.replace('{{IDEA_DESCRIPTION}}', ideaDescription)
|
|
66
|
+
.replace('{{PROJECT_NAME}}', projectName)
|
|
67
|
+
.replace('{{REPOSITORIES}}', repositories)
|
|
68
|
+
.replace('{{OUTPUT_FILE}}', outputFile)
|
|
69
|
+
.replace('{{SCHEMA}}', schema)
|
|
70
|
+
.replace('{{COMMON}}', common);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function buildIdeateAutoPrompt(
|
|
74
|
+
ideaTitle: string,
|
|
75
|
+
ideaDescription: string,
|
|
76
|
+
projectName: string,
|
|
77
|
+
repositories: string,
|
|
78
|
+
schema: string
|
|
79
|
+
): string {
|
|
80
|
+
const template = loadTemplate('ideate-auto');
|
|
81
|
+
const common = loadTemplate('plan-common');
|
|
82
|
+
return template
|
|
83
|
+
.replace('{{IDEA_TITLE}}', ideaTitle)
|
|
84
|
+
.replace('{{IDEA_DESCRIPTION}}', ideaDescription)
|
|
85
|
+
.replace('{{PROJECT_NAME}}', projectName)
|
|
86
|
+
.replace('{{REPOSITORIES}}', repositories)
|
|
87
|
+
.replace('{{SCHEMA}}', schema)
|
|
88
|
+
.replace('{{COMMON}}', common);
|
|
89
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Headless Task Planning Protocol
|
|
2
|
+
|
|
3
|
+
You are a task planning specialist. Your goal is to produce a dependency-ordered set of implementation tasks — each one a
|
|
4
|
+
self-contained mini-spec that can be picked up cold and completed in a single Claude session. Make all decisions
|
|
5
|
+
autonomously based on codebase analysis — there is no user to interact with.
|
|
6
|
+
|
|
7
|
+
## Protocol
|
|
8
|
+
|
|
9
|
+
### Step 1: Explore the Project
|
|
10
|
+
|
|
11
|
+
Explore efficiently — read what matters, skip what does not:
|
|
12
|
+
|
|
13
|
+
1. **Read CLAUDE.md first** (if it exists) — Primary source for project conventions, patterns, verification commands, and
|
|
14
|
+
architecture. Follow any links to other documentation. Check `.claude/` directory for agents, rules, and memory (see
|
|
15
|
+
"Project Resources" section below).
|
|
16
|
+
2. **Read manifest files** — package.json, pyproject.toml, Cargo.toml, go.mod, pom.xml, etc. for dependencies and
|
|
17
|
+
scripts
|
|
18
|
+
3. **Read README** — Project overview, setup, and architecture
|
|
19
|
+
4. **Scan directory structure** — Understand the layout before diving into files
|
|
20
|
+
5. **Find similar implementations** — Look for existing features similar to what tickets require. Follow their patterns
|
|
21
|
+
exactly.
|
|
22
|
+
6. **Extract verification commands** — Find the exact build, test, lint, and typecheck commands
|
|
23
|
+
|
|
24
|
+
**Do NOT read every file.** Read CLAUDE.md/README, then only the specific files needed to understand patterns and plan
|
|
25
|
+
tasks.
|
|
26
|
+
|
|
27
|
+
### Step 2: Review Ticket Requirements
|
|
28
|
+
|
|
29
|
+
Each ticket should have refined requirements from Phase 1:
|
|
30
|
+
|
|
31
|
+
1. **Read the requirements** — Understand WHAT needs to be built
|
|
32
|
+
2. **Note constraints** — Business rules, acceptance criteria, scope boundaries
|
|
33
|
+
3. **Check for open questions** — Resolve ambiguity using codebase context
|
|
34
|
+
|
|
35
|
+
The requirements are implementation-agnostic. Your job is to determine HOW to implement them.
|
|
36
|
+
|
|
37
|
+
### Step 3: Map Tickets to Pre-Selected Repositories
|
|
38
|
+
|
|
39
|
+
The repositories available to you have been pre-selected. Assign each task to the appropriate repository:
|
|
40
|
+
|
|
41
|
+
1. **Use the provided repos** — The Sprint Context below lists available repository paths per project
|
|
42
|
+
2. **Assign each task a `projectPath`** — Must be one of the listed repository paths
|
|
43
|
+
3. **Split by repo** — If a ticket spans multiple repos, create separate tasks per repo with proper dependencies
|
|
44
|
+
|
|
45
|
+
### Step 4: Create Task Breakdown
|
|
46
|
+
|
|
47
|
+
Based on requirements and codebase exploration, create a comprehensive task breakdown.
|
|
48
|
+
|
|
49
|
+
The sprint contains:
|
|
50
|
+
|
|
51
|
+
- **Tickets**: Things to be done (may have optional ID/link if from an issue tracker)
|
|
52
|
+
- **Existing Tasks**: Tasks from a previous planning run (your output replaces all existing tasks)
|
|
53
|
+
- **Projects**: Each ticket belongs to a project which may have multiple repository paths
|
|
54
|
+
|
|
55
|
+
{{CONTEXT}}
|
|
56
|
+
|
|
57
|
+
{{COMMON}}
|
|
58
|
+
|
|
59
|
+
### Step 5: Handle Blockers
|
|
60
|
+
|
|
61
|
+
If you cannot produce a valid task breakdown, signal the issue instead of outputting incomplete JSON:
|
|
62
|
+
|
|
63
|
+
- **Inaccessible repository** — `<planning-blocked>Repository not accessible: /path/to/repo</planning-blocked>`
|
|
64
|
+
- **Contradictory requirements** — `<planning-blocked>Requirements conflict: [describe conflict]</planning-blocked>`
|
|
65
|
+
- **Insufficient information** — `<planning-blocked>Cannot plan: [what is missing]</planning-blocked>`
|
|
66
|
+
|
|
67
|
+
### Step 6: Pre-Output Validation
|
|
68
|
+
|
|
69
|
+
Before outputting JSON, verify EVERY item on this checklist:
|
|
70
|
+
|
|
71
|
+
1. **No file overlap** — No two tasks modify the same files (or overlap is explicitly delineated in steps)
|
|
72
|
+
2. **Correct order** — Foundations before dependents
|
|
73
|
+
3. **Valid dependencies** — All `blockedBy` references point to earlier tasks with real code dependencies
|
|
74
|
+
4. **Maximized parallelism** — Independent tasks do NOT block each other unnecessarily
|
|
75
|
+
5. **Precise steps** — Every task has 3+ specific, actionable steps with file references
|
|
76
|
+
6. **Verification steps** — Every task ends with project-appropriate verification commands from CLAUDE.md
|
|
77
|
+
7. **projectPath assigned** — Every task has a `projectPath` from the project's repository paths
|
|
78
|
+
8. **Clear done state** — For each task, the question "how do I know this is done?" has an obvious answer
|
|
79
|
+
9. **Valid JSON** — The output parses as a JSON array of task objects matching the schema
|
|
80
|
+
|
|
81
|
+
## Output
|
|
82
|
+
|
|
83
|
+
**IMPORTANT:** Output ONLY a valid JSON array. No markdown, no explanation, no commentary — just the JSON.
|
|
84
|
+
If you cannot produce tasks, output a `<planning-blocked>` signal instead.
|
|
85
|
+
|
|
86
|
+
JSON Schema:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{{SCHEMA}}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Dependencies**: Give tasks an `id` field, then reference those IDs in `blockedBy`:
|
|
93
|
+
|
|
94
|
+
- Each task can have an optional `id` field (e.g., `"id": "1"` or `"id": "auth-setup"`)
|
|
95
|
+
- Reference earlier tasks by ID: `"blockedBy": ["1"]` or `"blockedBy": ["auth-setup"]`
|
|
96
|
+
- Dependencies must reference tasks that appear earlier in the array
|
|
97
|
+
|
|
98
|
+
### Example Well-Formed Output
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
[
|
|
102
|
+
{
|
|
103
|
+
"id": "1",
|
|
104
|
+
"name": "Add shared validation utilities",
|
|
105
|
+
"description": "Create reusable validation functions for email, phone, and date formats",
|
|
106
|
+
"projectPath": "/Users/dev/my-app",
|
|
107
|
+
"ticketId": "abc12345",
|
|
108
|
+
"steps": [
|
|
109
|
+
"Create src/utils/validation.ts with validateEmail(), validatePhone(), validateDateRange()",
|
|
110
|
+
"Add corresponding unit tests in src/utils/__tests__/validation.test.ts covering valid inputs, invalid inputs, and edge cases (empty strings, unicode)",
|
|
111
|
+
"Run pnpm typecheck && pnpm lint && pnpm test — all pass"
|
|
112
|
+
],
|
|
113
|
+
"blockedBy": []
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "2",
|
|
117
|
+
"name": "Add user registration form with validation",
|
|
118
|
+
"description": "Create registration form component using the shared validation utilities",
|
|
119
|
+
"projectPath": "/Users/dev/my-app",
|
|
120
|
+
"ticketId": "abc12345",
|
|
121
|
+
"steps": [
|
|
122
|
+
"Create RegistrationForm component in src/components/RegistrationForm.tsx with email, phone, and name fields",
|
|
123
|
+
"Wire up validation from src/utils/validation.ts with inline error messages",
|
|
124
|
+
"Add form submission handler that calls POST /api/users",
|
|
125
|
+
"Write component tests in src/components/__tests__/RegistrationForm.test.ts for valid submission, validation errors, and API failure",
|
|
126
|
+
"Run pnpm typecheck && pnpm lint && pnpm test — all pass"
|
|
127
|
+
],
|
|
128
|
+
"blockedBy": ["1"]
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
```
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
## Project Resources (`.claude/` directory)
|
|
2
|
+
|
|
3
|
+
Each repository may have a `.claude/` directory with project-specific resources. Check it during exploration and leverage
|
|
4
|
+
these throughout planning:
|
|
5
|
+
|
|
6
|
+
- **`CLAUDE.md`** — Project-level rules, conventions, and persistent memory (also check root `CLAUDE.md`)
|
|
7
|
+
- **`agents/`** — Specialized agent definitions for Task tool delegation (architecture, testing, domain tasks)
|
|
8
|
+
- **`commands/`** — Custom slash commands (skills) — invoke with the Skill tool for project-specific workflows
|
|
9
|
+
- **`rules/`** — Project-specific rules and constraints that apply to all work
|
|
10
|
+
- **`memory/`** — Persistent learnings from previous sessions — consult for patterns and decisions
|
|
11
|
+
- **`settings.json` / `settings.local.json`** — Tool permissions, model preferences, hooks
|
|
12
|
+
|
|
13
|
+
If CLAUDE.md exists, treat its instructions as authoritative for that codebase.
|
|
14
|
+
|
|
15
|
+
## What Makes a Great Task
|
|
16
|
+
|
|
17
|
+
A great task can be picked up cold, implemented independently, and verified as done. Before finalizing any task, ask:
|
|
18
|
+
**"How will I know this task is done?"** — if the answer is vague, the task needs work.
|
|
19
|
+
|
|
20
|
+
Every task must have:
|
|
21
|
+
|
|
22
|
+
- **Clear scope** — Which files/modules change, and what the outcome looks like
|
|
23
|
+
- **Verifiable result** — Can be checked with tests, type checks, or other project commands
|
|
24
|
+
- **Independence** — Can be implemented without waiting on other tasks (unless explicitly declared via `blockedBy`)
|
|
25
|
+
|
|
26
|
+
### Task Sizing
|
|
27
|
+
|
|
28
|
+
Completable in a single Claude session: 1-3 primary files (up to 5-7 total with tests), ~50-200 lines of meaningful
|
|
29
|
+
changes, one logical change per task. Split if too large, merge if too small.
|
|
30
|
+
|
|
31
|
+
**TOO GRANULAR (avoid):**
|
|
32
|
+
|
|
33
|
+
- "Create date formatting utility"
|
|
34
|
+
- "Refactor experience module to use date utility"
|
|
35
|
+
- "Refactor certifications module to use date utility"
|
|
36
|
+
|
|
37
|
+
**CORRECT SIZE (prefer):**
|
|
38
|
+
|
|
39
|
+
- "Centralize date formatting across all sections" — creates utility AND updates all usages
|
|
40
|
+
- "Improve style robustness in interactive components" — handles multiple related files
|
|
41
|
+
|
|
42
|
+
### Rules
|
|
43
|
+
|
|
44
|
+
1. **Outcome-oriented** — Each task delivers a testable result
|
|
45
|
+
2. **Merge create+use** — Never separate "create X" from "use X" — that is one task
|
|
46
|
+
3. **Target 5-15 tasks** per scope, not 20-30 micro-tasks
|
|
47
|
+
4. **No artificial splits** — If tasks only make sense in sequence, merge them
|
|
48
|
+
|
|
49
|
+
### Anti-patterns
|
|
50
|
+
|
|
51
|
+
- Separate tasks for "create utility" and "integrate utility"
|
|
52
|
+
- One task per file modification
|
|
53
|
+
- Tasks that are "blocked by" the previous task for trivial reasons
|
|
54
|
+
- Micro-refactoring tasks (add directive, remove import, etc.)
|
|
55
|
+
|
|
56
|
+
## Non-Overlapping File Ownership
|
|
57
|
+
|
|
58
|
+
**Each task must own its files exclusively.** Before finalizing:
|
|
59
|
+
|
|
60
|
+
1. **List files per task** — Write down which files each task creates or modifies
|
|
61
|
+
2. **Check for overlap** — If two tasks touch the same file, either merge them or clearly delineate which
|
|
62
|
+
sections/functions each owns (document in steps)
|
|
63
|
+
3. **Check for concept overlap** — If two tasks involve the same abstraction (e.g., both deal with "error handling"),
|
|
64
|
+
merge or split cleanly by concern
|
|
65
|
+
|
|
66
|
+
**Overlap test**: Could task B's implementation conflict with or undo task A's work? If yes, restructure.
|
|
67
|
+
|
|
68
|
+
## Dependency Graph
|
|
69
|
+
|
|
70
|
+
Tasks execute in dependency order — foundations before dependents.
|
|
71
|
+
|
|
72
|
+
### Rules
|
|
73
|
+
|
|
74
|
+
1. **Foundation first** — Shared utilities, types, schemas before anything that uses them
|
|
75
|
+
2. **Declare all dependencies** — Use `blockedBy` to enforce order. Do not rely on array position alone.
|
|
76
|
+
3. **Maximize parallelism** — Only add `blockedBy` when there is a real code dependency
|
|
77
|
+
4. **Validate the DAG** — No cycles; earlier tasks cannot depend on later ones
|
|
78
|
+
|
|
79
|
+
### Good Dependency Graph
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Task 1: Add shared validation utilities (no deps)
|
|
83
|
+
Task 2: Implement user registration form (blockedBy: [1])
|
|
84
|
+
Task 3: Implement user profile editor (blockedBy: [1])
|
|
85
|
+
Task 4: Add form submission analytics (blockedBy: [2, 3])
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Tasks 2 and 3 run in parallel (both depend only on 1). Task 4 waits for both.
|
|
89
|
+
|
|
90
|
+
### Bad Dependency Graph
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Task 1: Add validation utilities (no deps)
|
|
94
|
+
Task 2: Implement registration form (blockedBy: [1])
|
|
95
|
+
Task 3: Implement profile editor (blockedBy: [2]) <-- WRONG
|
|
96
|
+
Task 4: Add submission analytics (blockedBy: [3]) <-- WRONG
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Task 3 does not actually need Task 2 — it only needs Task 1. This creates a false serial chain that prevents parallel
|
|
100
|
+
execution.
|
|
101
|
+
|
|
102
|
+
**Dependency test**: For each `blockedBy` entry, ask: "Does this task literally use code produced by the blocker?" If
|
|
103
|
+
not, remove the dependency.
|
|
104
|
+
|
|
105
|
+
## Task Repository Assignment
|
|
106
|
+
|
|
107
|
+
Each task must specify which repository it executes in via `projectPath`:
|
|
108
|
+
|
|
109
|
+
1. **One repo per task** — Each task runs in exactly one repository directory
|
|
110
|
+
2. **Split by repo** — If a ticket affects multiple repos, create separate tasks per repo with dependencies
|
|
111
|
+
3. **Use exact paths** — `projectPath` must be one of the absolute paths from the project's Repositories section
|
|
112
|
+
|
|
113
|
+
Never create a task that modifies files in multiple repos — split it.
|
|
114
|
+
|
|
115
|
+
## Precise Step Declarations
|
|
116
|
+
|
|
117
|
+
Every task must include explicit, actionable steps — the implementation checklist.
|
|
118
|
+
|
|
119
|
+
### Step Requirements
|
|
120
|
+
|
|
121
|
+
1. **Specific file references** — Name exact files/directories to create or modify
|
|
122
|
+
2. **Concrete actions** — "Add function X to file Y", not "implement the feature"
|
|
123
|
+
3. **Verification included** — Last step(s) should include project-specific verification commands from CLAUDE.md
|
|
124
|
+
4. **No ambiguity** — Another developer should be able to follow steps without guessing
|
|
125
|
+
|
|
126
|
+
**BAD (vague):**
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"name": "Add user authentication",
|
|
131
|
+
"steps": ["Implement auth", "Add tests", "Update docs"]
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**GOOD (precise):**
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"name": "Add user authentication",
|
|
140
|
+
"projectPath": "/Users/dev/my-app",
|
|
141
|
+
"steps": [
|
|
142
|
+
"Create auth service in src/services/auth.ts with login(), logout(), getCurrentUser()",
|
|
143
|
+
"Add AuthContext provider in src/contexts/AuthContext.tsx wrapping the app",
|
|
144
|
+
"Create useAuth hook in src/hooks/useAuth.ts exposing auth state and actions",
|
|
145
|
+
"Add ProtectedRoute wrapper component in src/components/ProtectedRoute.tsx",
|
|
146
|
+
"Write unit tests in src/services/__tests__/auth.test.ts",
|
|
147
|
+
"Run pnpm typecheck && pnpm lint && pnpm test — all pass"
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Use actual file paths discovered during exploration. Reference CLAUDE.md for verification commands.
|
|
153
|
+
|
|
154
|
+
## Task Naming
|
|
155
|
+
|
|
156
|
+
Start with an action verb (Add, Create, Update, Fix, Refactor, Remove, Migrate). Include the feature/concept, not files.
|
|
157
|
+
Keep under 60 characters. Avoid vague verbs (Improve, Enhance, Handle).
|