alignfirst 0.7.0 → 0.8.0-preview.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/package.json +1 -1
- package/templates/guide/code-review/correctness-reviewer.md +1 -0
- package/templates/guide/code-review/intent-reviewer.md +1 -1
- package/templates/guide/code-review/quality-reviewer.md +3 -0
- package/templates/guide/code-review/reviewer-common.md +2 -0
- package/templates/guide/protocols/aad.md +26 -17
- package/templates/guide/protocols/description.md +8 -8
- package/templates/guide/protocols/merge.md +5 -5
- package/templates/guide/protocols/plan.md +59 -70
- package/templates/guide/protocols/spec.md +46 -37
package/package.json
CHANGED
|
@@ -38,6 +38,7 @@ The most useful findings come from here, because nobody looks for them.
|
|
|
38
38
|
| Signal | Question | Severity |
|
|
39
39
|
| --- | --- | --- |
|
|
40
40
|
| Function modified | Who calls it? Do callers outside the diff assume the old behavior? | 🔴 |
|
|
41
|
+
| Code, branch or condition removed | What did it handle? Is that case now impossible, handled elsewhere, or silently dropped? | 🔴 |
|
|
41
42
|
| One occurrence of a pattern fixed | Does the same pattern exist elsewhere, unfixed? Report once, with the count. | 🟡 |
|
|
42
43
|
| Code the diff touches contains a bug unrelated to the diff | Report it as 🟣, without requiring a fix in this PR. | 🟣 |
|
|
43
44
|
| Constant, enumeration, or type union extended | Was every place that exhausts it updated? | 🔴 |
|
|
@@ -8,7 +8,7 @@ Evaluate the change as a whole: what it tries to accomplish, and whether the imp
|
|
|
8
8
|
- Is there a simpler design that achieves the same intent?
|
|
9
9
|
- Does the change fit the architecture and conventions of the codebase, or work against them?
|
|
10
10
|
- Does it leave the codebase healthier than before?
|
|
11
|
-
- Is the size proportionate to the intent?
|
|
11
|
+
- Is the size proportionate to the intent? A diff that adds more lines than it removes owes a reason; layers, options, and generality nobody asked for cost as much as missing pieces.
|
|
12
12
|
- Does the diff mix a refactor with a behavior change? If they cannot be told apart, say so — it is what makes a review reliable or not.
|
|
13
13
|
4. Report portions of code that deserve a **rewrite** as findings: 🟡, or 🔴 when the flaw defeats the intent. Observations about the change as a whole belong in the assessment, not in the findings list.
|
|
14
14
|
|
|
@@ -16,6 +16,8 @@ Also check consistency by example: does the new code match its neighbors in stru
|
|
|
16
16
|
| Abstraction introduced with a single implementation | Does it solve a present problem, or an anticipated one? | 🟡 |
|
|
17
17
|
| Boolean parameter added to an existing function | Does the function now do two things? | 🟡 |
|
|
18
18
|
| New file | Is it in the right place per the repo's conventions? | 🟡 |
|
|
19
|
+
| Defect fixed by adding code | Is the line that caused it still there? Removing the cause is often a proper fix. | 🟡 |
|
|
20
|
+
| Check or branch for a case already ruled out by a type, a caller or an earlier check | What guarantees it? A guard for an impossible case hides the real contract. | 🟡 |
|
|
19
21
|
|
|
20
22
|
## DRY and YAGNI
|
|
21
23
|
|
|
@@ -52,3 +54,4 @@ Also check consistency by example: does the new code match its neighbors in stru
|
|
|
52
54
|
| Mock added | Does it reproduce the real contract of the dependency, or an idealized version that can never fail? | 🟡 |
|
|
53
55
|
| Test depending on the clock, network, execution order, or shared state | Source of flakiness. | 🟡 |
|
|
54
56
|
| Assertion modified to make a test pass | Was the test fixed, or aligned with a bug? Strong signal: find out why it failed. | 🔴 |
|
|
57
|
+
| Test deleted or skipped | Which behavior stops being verified? Was it fixed, or made to stop failing? | 🔴 |
|
|
@@ -10,6 +10,8 @@ You are one of several reviewers examining the same branch, each from a differen
|
|
|
10
10
|
|
|
11
11
|
## Method
|
|
12
12
|
|
|
13
|
+
Assume nothing works until the code shows it does: your job is to find how this change goes wrong. The bar below decides what you report, not what you look for.
|
|
14
|
+
|
|
13
15
|
Work signal by signal: each checklist item is a signal/question pair, and applies only when its signal is visible in the diff. This keeps the review on the change, away from a general audit of the repository. A defect in the changed code is a finding even without a matching checklist item.
|
|
14
16
|
|
|
15
17
|
To answer a checklist question, read the code — including files outside the diff (callers, configuration, the installed version of a dependency). Never guess.
|
|
@@ -10,30 +10,39 @@ This is a 4-step protocol. Follow each step in order.
|
|
|
10
10
|
|
|
11
11
|
## 1. Investigate
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Your context lists the available **documentation** and **skills**. Read every document and skill that applies to any aspect of the task, and the relevant references of each skill. A familiar-looking task tempts you to skip this reading; the project conventions live in these files.
|
|
14
14
|
|
|
15
|
-
Explore the codebase. Take the time to understand how it
|
|
15
|
+
Explore the codebase. Take the time to understand how it works today and what needs to change.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Seek a clean break solution by default. Consider backward compatibility only when the user asks for it.
|
|
18
18
|
|
|
19
19
|
## 2. Discuss
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Nothing is implemented, and nothing is written in TICKET_DIR, before the user agrees. This step is where a small task reveals itself as a large one. It is never skipped.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The user is a developer who carries the global vision of the project and decides the choices that matter. You carry the details of the code you just read. The discussion keeps the user aware of what you found and hands them every decision worth taking.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Manage the reader's attention. Open with the task as you understand it and the approach you propose, in two or three sentences. Then write one block per independent decision that needs the user. Write for a reader who has not opened the code today: a function, module or mechanism gets a few words of definition the first time you name it.
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
- **Current implementation analysis**: Share what you discovered and ask for confirmation or corrections
|
|
29
|
-
- **Approach evaluation**: Discuss potential solutions and their trade-offs
|
|
30
|
-
- **Edge cases and implications**: Explore potential issues and broader system impacts
|
|
27
|
+
A block is a question and a recommendation:
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
```
|
|
30
|
+
❓ **Q1 - <title>**: <the problem in plain words, what the code does today in the words needed to decide, the options with their consequence>
|
|
31
|
+
|
|
32
|
+
➡️ <your recommendation>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Look for edge cases and impacts on the rest of the system; each one that needs a decision gets its block.
|
|
36
|
+
|
|
37
|
+
Every decision for the user is a numbered question, a yes/no one included; the simpler it is, the shorter its block. Numbering continues across rounds.
|
|
38
|
+
|
|
39
|
+
Settle on your own what the code can answer; routine choices belong in the opening approach. Ask the user what needs their judgement: product behavior, scope, priorities, constraints the code does not show. Leave out the investigation narrative and the list of files you read.
|
|
40
|
+
|
|
41
|
+
Ask in rounds: a question whose answer depends on another question still open waits for the next round. A question the reply skips stays open.
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
When there is nothing to decide, say so in a few lines and ask for an explicit go.
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
Do not use your question tool. Ask in plain text: your questions open a real discussion, a multiple-choice widget closes it.
|
|
37
46
|
|
|
38
47
|
## 3. Act
|
|
39
48
|
|
|
@@ -47,7 +56,7 @@ Use subagents (your subagent tool) for distinct, isolated units of work when ben
|
|
|
47
56
|
|
|
48
57
|
Finalize the summary file: replace the working notes with the final content described below.
|
|
49
58
|
|
|
50
|
-
Start the summary with a header, then a suggested commit message {{COMMIT_RULE}}. The shorter the better. Omit any field with nothing to list.
|
|
59
|
+
Start the summary with a header, then a suggested commit message {{COMMIT_RULE}}. The shorter the better. Omit any field with nothing to list. Exclude `alignfirst` from the skills.
|
|
51
60
|
|
|
52
61
|
Example:
|
|
53
62
|
|
|
@@ -64,15 +73,15 @@ Used documentation:
|
|
|
64
73
|
Used skills: `skill-a`, `skill-b`
|
|
65
74
|
```
|
|
66
75
|
|
|
67
|
-
The finalized summary is a **very concise handover document
|
|
76
|
+
The finalized summary is a **very concise handover document**. It captures:
|
|
68
77
|
|
|
69
78
|
- What was the topic or problem
|
|
70
79
|
- What was decided or discovered
|
|
71
|
-
- What action was taken
|
|
80
|
+
- What action was taken, if any
|
|
72
81
|
- Key outcomes or next steps
|
|
73
82
|
|
|
74
83
|
The shorter the better.
|
|
75
84
|
|
|
76
|
-
|
|
85
|
+
Ignore Markdown lint errors in the summary file.
|
|
77
86
|
|
|
78
87
|
At the end, give the path of the summary file to the user.
|
|
@@ -24,23 +24,23 @@ Run `{{TICKET_CMD}}` once to identify TICKET_DIR and load the ticket directory c
|
|
|
24
24
|
[description body]
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Start with a suggested commit message {{COMMIT_RULE}}. Refine it from the suggested commit messages found in the specs and summaries you read. Keep it brief
|
|
27
|
+
Start with a suggested commit message {{COMMIT_RULE}}. Refine it from the suggested commit messages found in the specs and summaries you read. Keep it brief, usually 3 to 5 words for the description part. Shorter is better when it stays clear.
|
|
28
28
|
|
|
29
29
|
## Guidelines for the Description Body
|
|
30
30
|
|
|
31
31
|
- Write in markdown:
|
|
32
32
|
- If there is one subject, write a single paragraph.
|
|
33
33
|
- Otherwise, write a bulleted list with one subject per item.
|
|
34
|
-
- **Describe
|
|
35
|
-
- **Keep it minimal and functional.** Mention each subject very concisely
|
|
36
|
-
- **
|
|
37
|
-
- **
|
|
34
|
+
- **Describe what was done, never why.** Explanations, justifications and reasoning stay out; the reader gets the result.
|
|
35
|
+
- **Keep it minimal and functional.** Mention each subject very concisely, the essentials only. Most subjects fit in one sentence of about 5 to 15 words.
|
|
36
|
+
- **Prefer functional descriptions.** Technical implementation details appear only when the reader needs them.
|
|
37
|
+
- **Merge related subjects.** A long list of small items is the usual failure of a description; combine similar changes into one cohesive subject.
|
|
38
38
|
- Include technical details only for major structural changes (e.g., renaming a database table, significant linter config changes, major codebase refactors).
|
|
39
|
-
-
|
|
40
|
-
- **Absorb fix-only summaries
|
|
39
|
+
- Leave out specs that were not implemented. In doubt, explore the codebase to confirm what was done.
|
|
40
|
+
- **Absorb fix-only summaries.** A summary that fixes issues introduced by earlier work in the same ticket is not a subject of its own. An external reader only cares about the end state.
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Ignore Markdown lint errors in the description file.
|
|
45
45
|
|
|
46
46
|
At the end, give the path of the description file to the user.
|
|
@@ -12,7 +12,7 @@ This protocol applies when a merge or rebase has produced conflicts, or when the
|
|
|
12
12
|
|
|
13
13
|
Run `git status` to check for conflicts.
|
|
14
14
|
|
|
15
|
-
**If there are no conflicts:** start the merge — use the incoming branch if the user provided one, {{BASE_BRANCH_RULE}}
|
|
15
|
+
**If there are no conflicts:** start the merge — use the incoming branch if the user provided one, {{BASE_BRANCH_RULE}} A merge that completes cleanly ends the protocol, with no summary file. Otherwise, continue with the steps below.
|
|
16
16
|
|
|
17
17
|
## 2. Investigate
|
|
18
18
|
|
|
@@ -22,9 +22,9 @@ Take the time to understand how things work in the incoming branch and in the cu
|
|
|
22
22
|
|
|
23
23
|
Run `{{TICKET_CMD}} --next merge.summary.md` to continue the current cycle. Append FILE_NAME to TICKET_DIR, then immediately create the summary at that path. Log each notable resolution in it as you resolve (see step 5 for the expected content).
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Preserve both intents whenever possible. Accepting one side wholesale is the usual failure of a merge; it silently drops the other branch's work.
|
|
26
26
|
|
|
27
|
-
Resolve conflicts one at a time.
|
|
27
|
+
Resolve conflicts one at a time. Batch processing, broad search-and-replace and other brute-force edits are out.
|
|
28
28
|
|
|
29
29
|
**Special case for lock files:** If a lock file has conflicts:
|
|
30
30
|
|
|
@@ -41,7 +41,7 @@ If you need to execute the project, whether through E2E tests or manual checks,
|
|
|
41
41
|
|
|
42
42
|
Finalize the summary file.
|
|
43
43
|
|
|
44
|
-
**Keep it lean.**
|
|
44
|
+
**Keep it lean.** Document only the challenging conflicts and the choices made to resolve them. Straightforward resolutions stay out: when everything was trivial, the summary is a header and a one-line note that nothing was tricky. No commit message either; Git provides one for merges.
|
|
45
45
|
|
|
46
46
|
Example:
|
|
47
47
|
|
|
@@ -59,6 +59,6 @@ Example:
|
|
|
59
59
|
|
|
60
60
|
Omit any section with nothing to report.
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Ignore Markdown lint errors in the summary file.
|
|
63
63
|
|
|
64
64
|
At the end, give the path of the summary file to the user.
|
|
@@ -2,92 +2,85 @@
|
|
|
2
2
|
|
|
3
3
|
## Prerequisites
|
|
4
4
|
|
|
5
|
-
### Determine TICKET_DIR and the Spec File
|
|
6
|
-
|
|
7
5
|
You need:
|
|
8
6
|
|
|
9
7
|
- the TICKET_DIR and ticket directory context — run `{{TICKET_CMD}}` once (`{{CMD}} ticket --side` for a side ticket, when there is no ticket)
|
|
10
8
|
- a **spec file** in the TICKET_DIR
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
Without a spec file, stop and ask the user.
|
|
13
11
|
|
|
14
12
|
## Phases
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
Read the spec file entirely before starting. Then plan in six phases, in this order:
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
1. **Investigation**: explore the codebase and check the spec against it.
|
|
17
|
+
2. **Analysis**: decide the plan structure, single or multiple, and collect the documentation and skills.
|
|
18
|
+
3. **Plan Design**: design each plan.
|
|
19
|
+
4. **Main Plan Design**: with multiple plans, design the main plan that coordinates them.
|
|
20
|
+
5. **Writing**: write the plan files.
|
|
21
|
+
6. **Review**: reread the plans critically and improve them.
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
2. **Analysis**: Determine the plan structure (single or multiple plans) and identify relevant documentation and skills
|
|
22
|
-
3. **Plan Design**: Design plan(s) based on the analysis - If you discover issues or missing design decisions, STOP AND ASK THE USER
|
|
23
|
-
4. **Main Plan Design**: If multiple plans, design a main plan to coordinate them
|
|
24
|
-
5. **Writing**: Write the plan file(s)
|
|
25
|
-
6. **Review**: Critically review and improve the plan(s)
|
|
23
|
+
One rule holds across all phases: an important design decision the spec leaves open, or a spec that is wrong or contradicts the code, stops the protocol. Ask the user. A plan is executed by an agent that trusts it, often while the user is away.
|
|
26
24
|
|
|
27
25
|
## Phase 1. Investigation
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
Your context lists the available **documentation** and **skills**. Read every document and skill that applies to any aspect of the task, and the relevant references of each skill. A familiar-looking task tempts you to skip this reading; the project conventions live in these files.
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
Find the relevant source code. Take the time to understand how it works today and what has to change.
|
|
32
30
|
|
|
33
|
-
|
|
31
|
+
The spec is the starting point, and it was written against an earlier state of the code. Verify each statement against the current implementation.
|
|
34
32
|
|
|
35
|
-
For each operation in the spec, search for existing
|
|
33
|
+
For each operation in the spec, search for an existing function that does a similar job.
|
|
36
34
|
|
|
37
35
|
## Phase 2. Analysis
|
|
38
36
|
|
|
39
|
-
Based on your investigation, determine the plan structure:
|
|
40
|
-
|
|
41
37
|
### 2.1 Assess Work Scopes
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
Prefer a single plan when the work fits one session, especially when it stays within one area.
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
- **Multiple specialized plans with a main plan**: Split the work when it is complex, based on:
|
|
47
|
-
- **Distinct logical units**: When large enough, separate features or modules within the same stack
|
|
48
|
-
- **Stack boundaries**: Different technologies or specialization areas (if custom agents are defined, their descriptions can help identify these boundaries)
|
|
49
|
-
- Each specialized plan should produce a **coherent deliverable**
|
|
41
|
+
Split complex work into specialized plans, coordinated by a main plan. Split along:
|
|
50
42
|
|
|
51
|
-
|
|
43
|
+
- **Distinct logical units**: separate features or modules, each large enough to stand alone
|
|
44
|
+
- **Stack boundaries**: different technologies or specialization areas. The descriptions of custom agents, when some are defined, help find these boundaries.
|
|
45
|
+
|
|
46
|
+
Each specialized plan produces a coherent deliverable.
|
|
52
47
|
|
|
53
|
-
Identify
|
|
48
|
+
### 2.2 Identify Relevant Documentation and Skills
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
- For complex skills with reference files, identify specific files that should be loaded
|
|
50
|
+
List the documentation and skills the implementing agent must read and follow. Exclude `alignfirst` from the skills. For a skill with reference files, name the files to load. Omit the list when nothing applies.
|
|
57
51
|
|
|
58
52
|
## Phase 3. Plan Design
|
|
59
53
|
|
|
60
|
-
Design
|
|
54
|
+
Design each plan from the spec. Reuse the parts of the spec that are detailed enough, and add what the spec lacks: implementation details, file paths, a breakdown into steps.
|
|
61
55
|
|
|
62
56
|
### 3.1 Plan Content Guidelines
|
|
63
57
|
|
|
64
|
-
|
|
58
|
+
These guidelines apply to every plan, single or specialized.
|
|
59
|
+
|
|
60
|
+
The plan is a **self-explanatory prompt** for the coding agent. That agent starts from zero: tell it what you discovered.
|
|
65
61
|
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
- List **existing functions to reuse or refactor**. Plan thin wrappers, not re-implementations. Each operation should have one proper place.
|
|
62
|
+
- Give context: how it works today, and how it will work after the task.
|
|
63
|
+
- In a "Prerequisites" section, list the relevant documentation and skills. Do not repeat their content.
|
|
64
|
+
- Give a way to find the **important source files**: file paths, or a function name to search for. Line numbers are fine in a plan.
|
|
65
|
+
- Give **numbered steps**.
|
|
66
|
+
- List the **existing functions to reuse or refactor**. Plan thin wrappers, not re-implementations: each operation has one proper place.
|
|
67
|
+
- Plan a clean break. Unused code is removed. Backward compatibility appears only when the user asked for it.
|
|
68
|
+
- **Tests**: look first for existing tests of the kind you consider. Plan tests only when they fit the project's test setup.
|
|
69
|
+
- Leave out sections that add no actionable information: "Benefits", "Code Style Compliance", "Rationale", and the like.
|
|
75
70
|
|
|
76
71
|
### 3.2 Single Plan Format
|
|
77
72
|
|
|
78
73
|
_Use this when writing a single plan. Skip this section for multiple plans._
|
|
79
74
|
|
|
80
|
-
A single plan has no header with assignment, documentation, or skills
|
|
75
|
+
A single plan has no header with assignment, documentation, or skills. They are listed in the Prerequisites section within the plan body.
|
|
81
76
|
|
|
82
77
|
### 3.3 Specialized Plan Format
|
|
83
78
|
|
|
84
79
|
_Use this when writing multiple plans. Skip this section for a single plan._
|
|
85
80
|
|
|
86
|
-
|
|
81
|
+
**At the top of each specialized plan**, add a header. Include only the fields that have content. One agent can be assigned to several plans, as separate instances.
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
_Note: "Custom agent" refers to configured agent profiles in your environment (e.g., custom agents in Copilot, custom subagents in Claude Code). If your environment doesn't support this, ignore the "Assigned to" field._
|
|
83
|
+
_Note: "Custom agent" refers to configured agent profiles in your environment (custom agents in Copilot, custom subagents in Claude Code). Ignore the "Assigned to" field when your environment has none._
|
|
91
84
|
|
|
92
85
|
Example:
|
|
93
86
|
|
|
@@ -101,23 +94,23 @@ Example:
|
|
|
101
94
|
- **Skills**: `skill-a`, `skill-b`
|
|
102
95
|
```
|
|
103
96
|
|
|
104
|
-
**In the context section**, explain what you discovered **
|
|
97
|
+
**In the context section**, explain what you discovered **within this plan's scope**: how it works today and how it will work after the task.
|
|
105
98
|
|
|
106
|
-
**In the numbered steps**, include only
|
|
99
|
+
**In the numbered steps**, include only this plan's work. Each plan is self-contained.
|
|
107
100
|
|
|
108
|
-
**Coordination notes**:
|
|
101
|
+
**Coordination notes**: when this plan depends on another plan, say so explicitly.
|
|
109
102
|
|
|
110
103
|
### 3.4 Add a Final Step to Plans
|
|
111
104
|
|
|
112
|
-
|
|
105
|
+
For every plan, single or specialized, add a final step named "Write a Handover Document" with this content:
|
|
113
106
|
|
|
114
107
|
```markdown
|
|
115
|
-
Write a **handover document
|
|
108
|
+
Write a **handover document** for your teammates. List every file you updated, then summarize the changes very concisely. Keep only what helps a teammate understand what is new; leave out the obvious. When there is nothing to explain, explain nothing. Create its path by replacing the final `.md` in `{PLAN_FILE_PATH}` with `.summary.md`, then write the handover there. Ignore lint errors (formatting issues) in this file. At the end, give the path of this handover file to the user.
|
|
116
109
|
```
|
|
117
110
|
|
|
118
111
|
Note:
|
|
119
112
|
|
|
120
|
-
- This is a regular step,
|
|
113
|
+
- This is a regular step, numbered like the others. A plan with 5 steps gets this one as step 6.
|
|
121
114
|
- Replace "{PLAN_FILE_PATH}" with the complete plan file path, such as `.plans/123/A2-plan-backend.md`. Its handover path is `.plans/123/A2-plan-backend.summary.md`.
|
|
122
115
|
|
|
123
116
|
### 3.5 Common Footer for All Plans
|
|
@@ -129,21 +122,21 @@ Add the following content to the very end of each plan:
|
|
|
129
122
|
|
|
130
123
|
Do not trust this plan blindly. Be sure you understand the codebase and the plan by yourself before applying it.
|
|
131
124
|
|
|
132
|
-
|
|
125
|
+
Do not use external search tools (Context7, web search, documentation fetching) during implementation unless this plan explicitly allows it. Everything needed is in this plan or discoverable in the codebase.
|
|
133
126
|
```
|
|
134
127
|
|
|
135
128
|
## Phase 4. Main Plan Design
|
|
136
129
|
|
|
137
|
-
**Create a main plan only when
|
|
130
|
+
**Create a main plan only when there are several plans. Skip this section otherwise.**
|
|
138
131
|
|
|
139
132
|
### 4.1 Main Plan Guidelines
|
|
140
133
|
|
|
141
|
-
The main plan coordinates the execution of
|
|
134
|
+
The main plan coordinates the execution of the specialized plans. It contains:
|
|
142
135
|
|
|
143
|
-
1. **Reference to the specification**:
|
|
144
|
-
2. **Execution strategy** section:
|
|
145
|
-
3. **Plan assignments** section:
|
|
146
|
-
4. **Main Handover Document** section
|
|
136
|
+
1. **Reference to the specification**: mention the spec file; do not repeat its content.
|
|
137
|
+
2. **Execution strategy** section: parallel or sequential, with the dependencies stated.
|
|
138
|
+
3. **Plan assignments** section: for each specialized plan, the applicable fields only: assignment, documentation, skills, and a brief description.
|
|
139
|
+
4. **Main Handover Document** section.
|
|
147
140
|
|
|
148
141
|
Format example:
|
|
149
142
|
|
|
@@ -177,7 +170,7 @@ Execute these specialized plans:
|
|
|
177
170
|
- `docs/topic-b/doc-3.md`
|
|
178
171
|
- **Description**: [Brief description]
|
|
179
172
|
|
|
180
|
-
|
|
173
|
+
_In the prompt given to the subagent tool, provide the file path of the specialized plan. Do not reproduce its content._
|
|
181
174
|
|
|
182
175
|
### Coordination Notes
|
|
183
176
|
|
|
@@ -185,12 +178,10 @@ _**Important:** In the prompt you give to the subagent tool, do not reproduce th
|
|
|
185
178
|
|
|
186
179
|
## Main Handover Document
|
|
187
180
|
|
|
188
|
-
Write a **main plan handover document**. This document
|
|
181
|
+
Write a **main plan handover document**. This document:
|
|
189
182
|
|
|
190
|
-
1.
|
|
191
|
-
2. For each referenced handover
|
|
192
|
-
- State "Completed" if the plan was executed successfully
|
|
193
|
-
- Detail any issues encountered during execution
|
|
183
|
+
1. References each specialized plan's handover file
|
|
184
|
+
2. For each referenced handover, states "Completed" when the plan was executed successfully, and details any issue encountered otherwise
|
|
194
185
|
|
|
195
186
|
Keep this handover very short. Do not combine or repeat the content of individual handovers. Create its path by replacing the final `.md` in `{PLAN_FILE_PATH}` with `.summary.md`, then write the handover there. Ignore lint errors (formatting issues) in this file.
|
|
196
187
|
|
|
@@ -198,7 +189,7 @@ Keep this handover very short. Do not combine or repeat the content of individua
|
|
|
198
189
|
|
|
199
190
|
Do not trust this plan blindly. Be sure you understand the codebase and all specialized plans before coordinating their execution.
|
|
200
191
|
|
|
201
|
-
|
|
192
|
+
Do not use external search tools (Context7, web search, documentation fetching) during implementation unless these plans explicitly allow it. Everything needed is in these plans or discoverable in the codebase.
|
|
202
193
|
````
|
|
203
194
|
|
|
204
195
|
Note:
|
|
@@ -224,21 +215,19 @@ Continue the current cycle. Request the file names with `{{TICKET_CMD}} --next`,
|
|
|
224
215
|
- Specialized plans: `{TICKET_DIR}{CYCLE_LETTER}{FILE_NUMBER}-plan-{DESCRIPTOR}.md`, e.g. `.plans/123/A3-plan-api.md`, `.plans/123/A4-plan-ui.md`. The descriptor is lowercase and hyphenated and names the work scope or stack area.
|
|
225
216
|
- Handovers: replace the final `.md` with `.summary.md`, e.g. `.plans/123/A3-plan-api.summary.md`. The main plan handover is written after all specialized plans complete.
|
|
226
217
|
|
|
227
|
-
|
|
218
|
+
Ignore Markdown lint errors in the plan files. Fixing them wastes the session.
|
|
228
219
|
|
|
229
220
|
## Phase 6. Review
|
|
230
221
|
|
|
231
|
-
When you think the
|
|
232
|
-
|
|
233
|
-
Repeat the review until you think all plans are solid.
|
|
222
|
+
When you think the plans are complete, read them again with a critical eye and edit them to improve them. Repeat until every plan is solid.
|
|
234
223
|
|
|
235
224
|
**Additional review for multiple plans**:
|
|
236
225
|
|
|
237
226
|
- Each specialized plan is self-contained
|
|
238
227
|
- Each specialized plan header includes only applicable fields (assignment, documentation, skills)
|
|
239
|
-
- The main plan
|
|
240
|
-
- Dependencies between plans are
|
|
228
|
+
- The main plan references all specialized plans with their applicable fields
|
|
229
|
+
- Dependencies between plans are stated
|
|
241
230
|
|
|
242
231
|
---
|
|
243
232
|
|
|
244
|
-
At the end, give the path of the plan file to the user (for a single plan: the plan file; for multiple plans: the main plan file)
|
|
233
|
+
At the end, give the path of the plan file to the user (for a single plan: the plan file; for multiple plans: the main plan file).
|
|
@@ -6,68 +6,77 @@ Run `{{TICKET_CMD}}` once to identify TICKET_DIR and load the ticket directory c
|
|
|
6
6
|
|
|
7
7
|
## Phases
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A specification is produced in three phases, in this order:
|
|
10
10
|
|
|
11
|
-
1. **Investigation**:
|
|
12
|
-
2. **Discussion**:
|
|
13
|
-
3. **Specification**:
|
|
11
|
+
1. **Investigation**: understand the current implementation and the problem.
|
|
12
|
+
2. **Discussion**: align with the user on the problem and the solution.
|
|
13
|
+
3. **Specification**: write the spec file, once the user has approved.
|
|
14
14
|
|
|
15
|
-
The
|
|
15
|
+
The usual failure is to write the spec right after investigating. The discussion comes first, every time.
|
|
16
16
|
|
|
17
17
|
## Phase 1. Investigation
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Your context lists the available **documentation** and **skills**. Read every document and skill that applies to any aspect of the task, and the relevant references of each skill. A familiar-looking task tempts you to skip this reading; the project conventions live in these files.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Find the relevant source code. Take the time to understand how it works today and what has to change. Documentation lookup tools are welcome in this phase.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Seek a clean break solution by default. Consider backward compatibility only when the user asks for it.
|
|
24
24
|
|
|
25
25
|
## Phase 2. Discussion
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Nothing is written in TICKET_DIR before the user agrees.
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
- **Current implementation analysis**: Share what you discovered and ask for confirmation or corrections
|
|
31
|
-
- **Multiple solution approaches**: Present several viable alternatives when they exist, explaining trade-offs
|
|
32
|
-
- **Sub-subject identification**: Break down the problem into all relevant sub-components and ensure each is addressed
|
|
33
|
-
- **Design decisions**: Ask for user input on key architectural choices
|
|
34
|
-
- **Edge cases and implications**: Explore potential issues and broader system impacts
|
|
29
|
+
The user is a developer who carries the global vision of the project and decides the choices that matter. You carry the details of the code you just read. The discussion keeps the user aware of what you found and hands them every decision worth taking.
|
|
35
30
|
|
|
36
|
-
|
|
31
|
+
Manage the reader's attention. Open with the task as you understand it and the approach you propose, in two or three sentences. Then write one block per independent decision that needs the user. Write for a reader who has not opened the code today: a function, module or mechanism gets a few words of definition the first time you name it.
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
- Existing patterns and conventions in the codebase
|
|
40
|
-
- User preferences for implementation approaches
|
|
41
|
-
- Any constraints or considerations you might have missed
|
|
33
|
+
A block is a question and a recommendation:
|
|
42
34
|
|
|
43
|
-
|
|
35
|
+
```
|
|
36
|
+
❓ **Q1 - <title>**: <the problem in plain words, what the code does today in the words needed to decide, the options with their consequence>
|
|
37
|
+
|
|
38
|
+
➡️ <your recommendation>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Look for edge cases and impacts on the rest of the system; each one that needs a decision gets its block.
|
|
42
|
+
|
|
43
|
+
Every decision for the user is a numbered question, a yes/no one included; the simpler it is, the shorter its block. Numbering continues across rounds.
|
|
44
|
+
|
|
45
|
+
Settle on your own what the code can answer; routine choices belong in the opening approach. Ask the user what needs their judgement: product behavior, scope, priorities, constraints the code does not show. Leave out the investigation narrative and the list of files you read.
|
|
46
|
+
|
|
47
|
+
Ask in rounds: a question whose answer depends on another question still open waits for the next round. A question the reply skips stays open.
|
|
48
|
+
|
|
49
|
+
When several approaches are viable, present them with their trade-offs. Check that every sub-subject of the task has its block; a sub-subject skipped here is missing from the spec.
|
|
50
|
+
|
|
51
|
+
Do not use your question tool. Ask in plain text: your questions open a real discussion, a multiple-choice widget closes it.
|
|
44
52
|
|
|
45
53
|
## Phase 3. Specification
|
|
46
54
|
|
|
47
55
|
After the user approves your proposal, run `{{TICKET_CMD}} --next spec.md --new-cycle` to start a new cycle. Append FILE_NAME to TICKET_DIR, then immediately write the specification at that path. Do not overwrite an existing file.
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
Start with the title, a suggested commit message {{COMMIT_RULE}}, then the required documentation and skills. The shorter the commit message, the better. List each doc file individually, never a folder. Exclude `alignfirst` from the skills. Omit a field with nothing to list.
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
# [{TICKET_ID}] Short Title
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
# [{TICKET_ID}] Short Title
|
|
62
|
+
Suggested commit message: `<commit message>`
|
|
53
63
|
|
|
54
|
-
|
|
64
|
+
Required Documentation:
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
- `docs/topic-a/doc-1.md`
|
|
67
|
+
- `docs/topic-b/doc-2.md`
|
|
57
68
|
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
Required skills: `skill-1`, `skill-2`
|
|
70
|
+
```
|
|
60
71
|
|
|
61
|
-
|
|
62
|
-
```
|
|
72
|
+
Content rules:
|
|
63
73
|
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
- Do not include sections like "Benefits", "Code Style Compliance" or anything that adds no new information. Focus on the problem and the solution.
|
|
74
|
+
- The spec covers the full scope of the task. Dropping a part to shrink the spec is a frequent failure; splitting the work is the job of the *plan* protocol. Flag inline a section that should land in its own plan ("candidate for a specialized plan").
|
|
75
|
+
- Spell out every change to a code contract: database schema and migrations, API shapes, critical type definitions. Leave out other code; refer to source files by path or function name.
|
|
76
|
+
- The code may change before the spec is executed. Name functions, never line numbers.
|
|
77
|
+
- Specify a clean break. Unused code is removed. Backward compatibility appears only when the user asked for it.
|
|
78
|
+
- Leave out sections that add no information: "Benefits", "Code Style Compliance", and the like. Problem and solution only.
|
|
70
79
|
|
|
71
|
-
|
|
80
|
+
Ignore Markdown lint errors in the spec file. Fixing them wastes the session.
|
|
72
81
|
|
|
73
82
|
At the end, give the path of the spec file to the user.
|