alignfirst 0.6.0-preview.1 → 0.6.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/README.md +9 -5
- package/dist/project-layout.js +5 -6
- package/package.json +1 -1
- package/templates/guide/code-review/correctness-reviewer.md +0 -1
- package/templates/guide/code-review/intent-reviewer.md +1 -1
- package/templates/guide/code-review/quality-reviewer.md +0 -3
- package/templates/guide/code-review/reviewer-common.md +0 -2
- package/templates/guide/protocols/aad.md +17 -26
- package/templates/guide/protocols/description.md +8 -8
- package/templates/guide/protocols/merge.md +5 -5
- package/templates/guide/protocols/plan.md +70 -59
- package/templates/guide/protocols/spec.md +37 -46
package/README.md
CHANGED
|
@@ -81,6 +81,12 @@ Use your alignfirst-setup-guide skill. What AlignFirst tooling could we add in t
|
|
|
81
81
|
|
|
82
82
|
The guide installs the selected components and configures the repository. You can remove the setup-guide skill once setup is complete.
|
|
83
83
|
|
|
84
|
+
To leave the repository untouched, the guide keeps the project's AlignFirst files in a [companion directory](#companion-directories):
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Use your alignfirst-setup-guide skill. Set up AlignFirst in this project without touching the repository.
|
|
88
|
+
```
|
|
89
|
+
|
|
84
90
|
## CLI commands
|
|
85
91
|
|
|
86
92
|
- `guide` — Print an AlignFirst protocol.
|
|
@@ -101,11 +107,10 @@ Run `alignfirst --help` for command usage or `alignfirst guide` to choose a prot
|
|
|
101
107
|
|
|
102
108
|
## Companion directories
|
|
103
109
|
|
|
104
|
-
A companion directory holds a project's AlignFirst files outside its repository, so the repository stays untouched. `~/.
|
|
110
|
+
A companion directory holds a project's AlignFirst files outside its repository, so the repository stays untouched. `~/.alignfirst/companions.json` declares which projects have one:
|
|
105
111
|
|
|
106
112
|
```json
|
|
107
113
|
{
|
|
108
|
-
"root": "~/alignfirst-companions",
|
|
109
114
|
"paths": {
|
|
110
115
|
"~/projects/team-app": { ".plans": false, "_aligndev": true },
|
|
111
116
|
"~/projects/client-api": {},
|
|
@@ -114,7 +119,6 @@ A companion directory holds a project's AlignFirst files outside its repository,
|
|
|
114
119
|
}
|
|
115
120
|
```
|
|
116
121
|
|
|
117
|
-
- `root` — the directory that holds the companion directories: an absolute path or a `~/` path.
|
|
118
122
|
- `paths` — the projects, by absolute or `~/` path. Each value sets flags for the items a companion can hold: `.alignfirst.json`, `.alignfirst.md`, `DEVELOPERS.md`, `docs`, `.plans` and `_aligndev`. A flag is `true`, `false` or `"auto"`.
|
|
119
123
|
|
|
120
124
|
An absent file means no project has a companion. An invalid file makes every command fail; `doctor` reports it and continues.
|
|
@@ -123,7 +127,7 @@ An absent file means no project has a companion. An invalid file makes every com
|
|
|
123
127
|
|
|
124
128
|
A key matches a project when it names the project's main worktree or one of its ancestors, so every worktree of a project shares one companion. `"~": {}` matches every project under the home directory. For each item, the longest matching key that sets the flag wins, and an unset flag is `"auto"`. A bare repository or a directory outside git has no companion.
|
|
125
129
|
|
|
126
|
-
The companion directory is
|
|
130
|
+
The companion directory is `~/.alignfirst/companions/<name>`. The name is the main worktree path relative to the home directory, or the absolute path without its leading `/` outside it, with every `/` replaced by `_`. For example, `~/projects/client-api` gets `~/.alignfirst/companions/projects_client-api/`. To keep the companions elsewhere, make `~/.alignfirst/companions` a symlink.
|
|
127
131
|
|
|
128
132
|
### Resolution
|
|
129
133
|
|
|
@@ -146,7 +150,7 @@ The companion directory is `<root>/<name>`. The name is the main worktree path r
|
|
|
146
150
|
An agent reads a repository's `AGENTS.md` on its own, but never a companion. When your repositories carry no AlignFirst instructions, add this line to your global agent instructions (`~/.claude/CLAUDE.md`, `~/.codex/AGENTS.md`, or the equivalent):
|
|
147
151
|
|
|
148
152
|
```text
|
|
149
|
-
In a git repository, run `alignfirst context`
|
|
153
|
+
In a git repository, run `alignfirst context` as your first command, whatever the task, unless the project's instructions already say so.
|
|
150
154
|
```
|
|
151
155
|
|
|
152
156
|
## Upgrade from v1, v2, or v3
|
package/dist/project-layout.js
CHANGED
|
@@ -12,6 +12,8 @@ export const ITEM_NAMES = [
|
|
|
12
12
|
".plans",
|
|
13
13
|
"_aligndev",
|
|
14
14
|
];
|
|
15
|
+
// The directory holding the companions. A symlink there moves them elsewhere.
|
|
16
|
+
const COMPANIONS_ROOT = "~/.alignfirst/companions";
|
|
15
17
|
const FLAG = "boolean | 'auto'";
|
|
16
18
|
const flagsSchema = type({
|
|
17
19
|
"+": "reject",
|
|
@@ -24,7 +26,6 @@ const flagsSchema = type({
|
|
|
24
26
|
});
|
|
25
27
|
const companionsSchema = type({
|
|
26
28
|
"+": "reject",
|
|
27
|
-
root: "string > 0",
|
|
28
29
|
paths: type.Record("string", flagsSchema),
|
|
29
30
|
});
|
|
30
31
|
export function layoutOf(ctx) {
|
|
@@ -48,7 +49,7 @@ function resolveCompanion(cwd, home) {
|
|
|
48
49
|
return null;
|
|
49
50
|
const flags = mergeFlags(matches);
|
|
50
51
|
assertValidFlags(file, flags, matches);
|
|
51
|
-
const dir = join(normalizePath(
|
|
52
|
+
const dir = join(normalizePath(COMPANIONS_ROOT, realHome), companionName(mainWorktree, realHome));
|
|
52
53
|
return { dir, exists: pathExists(dir), entries: matches.map((match) => match.key), flags };
|
|
53
54
|
}
|
|
54
55
|
function readCompanionsFile(home) {
|
|
@@ -65,15 +66,13 @@ function readCompanionsFile(home) {
|
|
|
65
66
|
const file = companionsSchema(value);
|
|
66
67
|
if (file instanceof type.errors)
|
|
67
68
|
throw invalidCompanions(path, file.summary.split("\n", 1)[0]);
|
|
68
|
-
if (!isUserPath(file.root))
|
|
69
|
-
throw invalidCompanions(path, `root must be an absolute path or start with ~/: ${file.root}`);
|
|
70
69
|
const badKey = Object.keys(file.paths).find((key) => !isUserPath(key));
|
|
71
70
|
if (badKey !== undefined)
|
|
72
71
|
throw invalidCompanions(path, `paths key must be an absolute path or start with ~/: ${badKey}`);
|
|
73
|
-
return { path,
|
|
72
|
+
return { path, paths: file.paths };
|
|
74
73
|
}
|
|
75
74
|
export function companionsPath(home) {
|
|
76
|
-
return join(home, ".
|
|
75
|
+
return join(home, ".alignfirst", "companions.json");
|
|
77
76
|
}
|
|
78
77
|
function invalidCompanions(path, detail) {
|
|
79
78
|
return new CliError(`Invalid ${path}: ${detail}`);
|
package/package.json
CHANGED
|
@@ -38,7 +38,6 @@ 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? | 🔴 |
|
|
42
41
|
| One occurrence of a pattern fixed | Does the same pattern exist elsewhere, unfixed? Report once, with the count. | 🟡 |
|
|
43
42
|
| Code the diff touches contains a bug unrelated to the diff | Report it as 🟣, without requiring a fix in this PR. | 🟣 |
|
|
44
43
|
| 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? 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,8 +16,6 @@ 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. | 🟡 |
|
|
21
19
|
|
|
22
20
|
## DRY and YAGNI
|
|
23
21
|
|
|
@@ -54,4 +52,3 @@ Also check consistency by example: does the new code match its neighbors in stru
|
|
|
54
52
|
| Mock added | Does it reproduce the real contract of the dependency, or an idealized version that can never fail? | 🟡 |
|
|
55
53
|
| Test depending on the clock, network, execution order, or shared state | Source of flakiness. | 🟡 |
|
|
56
54
|
| 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,8 +10,6 @@ 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
|
-
|
|
15
13
|
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.
|
|
16
14
|
|
|
17
15
|
To answer a checklist question, read the code — including files outside the diff (callers, configuration, the installed version of a dependency). Never guess.
|
|
@@ -10,39 +10,30 @@ This is a 4-step protocol. Follow each step in order.
|
|
|
10
10
|
|
|
11
11
|
## 1. Investigate
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Check your context for available **documentation** and **skills**. Read every document and skill relevant to any aspect of the task — this is not optional. For each skill, also **read its relevant references**.
|
|
14
14
|
|
|
15
|
-
Explore the codebase. Take the time to understand how it works
|
|
15
|
+
Explore the codebase. Take the time to understand how it currently works and what needs to change.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Always seek a clean break solution by default. Never consider backward compatibility unless explicitly requested.
|
|
18
18
|
|
|
19
19
|
## 2. Discuss
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Present your findings and proposed approach. Ask clarifying questions. Explore trade-offs and edge cases.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
**Remember**: This discussion happens BEFORE any implementation or formal specification writing.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Engage in a thorough collaborative discussion covering:
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
- **Problem/Goal exploration**: Present your understanding and ask clarifying questions
|
|
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
|
|
28
31
|
|
|
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.
|
|
32
|
+
You're new to this project, the user can guide you.
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
Do not use your question tool. Always ask in plain text. Your questions will be the opportunity for a real discussion.
|
|
44
35
|
|
|
45
|
-
|
|
36
|
+
**This phase is mandatory.** If there is nothing to discuss, ask the user for an explicit validation.
|
|
46
37
|
|
|
47
38
|
## 3. Act
|
|
48
39
|
|
|
@@ -56,7 +47,7 @@ Use subagents (your subagent tool) for distinct, isolated units of work when ben
|
|
|
56
47
|
|
|
57
48
|
Finalize the summary file: replace the working notes with the final content described below.
|
|
58
49
|
|
|
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.
|
|
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. Always exclude `alignfirst` from skills.
|
|
60
51
|
|
|
61
52
|
Example:
|
|
62
53
|
|
|
@@ -73,15 +64,15 @@ Used documentation:
|
|
|
73
64
|
Used skills: `skill-a`, `skill-b`
|
|
74
65
|
```
|
|
75
66
|
|
|
76
|
-
The finalized summary is a **very concise handover document
|
|
67
|
+
The finalized summary is a **very concise handover document** that should capture:
|
|
77
68
|
|
|
78
69
|
- What was the topic or problem
|
|
79
70
|
- What was decided or discovered
|
|
80
|
-
- What action was taken
|
|
71
|
+
- What action was taken (if any)
|
|
81
72
|
- Key outcomes or next steps
|
|
82
73
|
|
|
83
74
|
The shorter the better.
|
|
84
75
|
|
|
85
|
-
|
|
76
|
+
_Ignore markdown lint errors in the summary file._
|
|
86
77
|
|
|
87
78
|
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-5 words for the description part. Shorter is better when it's 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
|
-
- **Merge related subjects.**
|
|
34
|
+
- **Describe only WHAT was done, never WHY.** Never include explanations, justifications, or reasoning for the changes. Only state what was implemented or modified.
|
|
35
|
+
- **Keep it minimal and functional.** Mention each subject very concisely—just the essentials. Most subjects can be summarized in one sentence of about 5 to 15 words.
|
|
36
|
+
- **Always prefer functional/business descriptions.** Avoid technical implementation details unless absolutely necessary.
|
|
37
|
+
- **CRITICAL: Merge related subjects whenever possible.** Look for opportunities to combine similar changes into a single, cohesive subject. This keeps the description focused and readable.
|
|
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
|
+
- Do not mention specs that were not implemented. If in doubt, explore the codebase to confirm what was actually done.
|
|
40
|
+
- **Absorb fix-only summaries**: If a summary is about fixing issues introduced by previous summaries in the same ticket (e.g., bug fixes, corrections, adjustments to earlier work), do not mention it as a separate subject. An external reader only cares about the end state.
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
_Ignore lint errors (formatting issues) 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}} If the merge completes cleanly, you are done — no summary file needed. 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
|
+
Resolve the conflicts properly — preserve both intents whenever possible. Do not blindly accept one side.
|
|
26
26
|
|
|
27
|
-
Resolve conflicts one at a time.
|
|
27
|
+
Resolve conflicts one at a time. Avoid batch processing, broad search-and-replace operations, and other brute-force edits.
|
|
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.** Only document challenging conflicts and the choices made to resolve them. Do not list straightforward resolutions — if everything was trivial, the summary should be almost empty (just a header and a one-line note that there was nothing tricky). Do not include a commit message — git already 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,85 +2,92 @@
|
|
|
2
2
|
|
|
3
3
|
## Prerequisites
|
|
4
4
|
|
|
5
|
+
### Determine TICKET_DIR and the Spec File
|
|
6
|
+
|
|
5
7
|
You need:
|
|
6
8
|
|
|
7
9
|
- the TICKET_DIR and ticket directory context — run `{{TICKET_CMD}}` once (`{{CMD}} ticket --side` for a side ticket, when there is no ticket)
|
|
8
10
|
- a **spec file** in the TICKET_DIR
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
Identify TICKET_DIR and the spec file before starting the protocol. If either is missing, STOP AND ASK THE USER.
|
|
11
13
|
|
|
12
14
|
## Phases
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
Before starting, **read the spec file** and understand it entirely.
|
|
15
17
|
|
|
16
|
-
|
|
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.
|
|
18
|
+
In order to generate implementation plans, you MUST follow this process:
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
1. **Investigation**: Explore the codebase, understand the current implementation, and identify the problem
|
|
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)
|
|
24
26
|
|
|
25
27
|
## Phase 1. Investigation
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
Check your context for available **documentation** and **skills**. Read every document and skill relevant to any aspect of the task — this is not optional. For each skill, also **read its relevant references**.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
Investigate the codebase yourself, find the relevant source code, think carefully, take the time to understand how it currently works and what has to be done.
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
Use the SPEC text as a starting point, but do not trust it blindly. Verify the current implementation and ensure the spec is still accurate. If you discover that an important design choice still needs to be made, or if the spec has issues, STOP AND ASK THE USER.
|
|
32
34
|
|
|
33
|
-
For each operation in the spec, search for
|
|
35
|
+
For each operation in the spec, search for existing functions that do a similar job.
|
|
34
36
|
|
|
35
37
|
## Phase 2. Analysis
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Prefer a single plan when the work fits one session, especially when it stays within one area.
|
|
39
|
+
Based on your investigation, determine the plan structure:
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
### 2.1 Assess Work Scopes
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
- **Stack boundaries**: different technologies or specialization areas. The descriptions of custom agents, when some are defined, help find these boundaries.
|
|
43
|
+
Evaluate if the work should be split into multiple specialized plans or handled as a single plan:
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
- **Single plan**: Preferred when work is small enough to be manageable, especially if it is cohesive within one area
|
|
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**
|
|
47
50
|
|
|
48
51
|
### 2.2 Identify Relevant Documentation and Skills
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
Identify which **documentation** and **skills** are relevant for the work. Omit if none apply.
|
|
54
|
+
|
|
55
|
+
- List the documentation and skills that the implementing agent should read and follow. Always exclude `alignfirst` from skills.
|
|
56
|
+
- For complex skills with reference files, identify specific files that should be loaded
|
|
51
57
|
|
|
52
58
|
## Phase 3. Plan Design
|
|
53
59
|
|
|
54
|
-
Design
|
|
60
|
+
Design an implementation plan based on the SPEC. Include all useful information from the spec. If the spec is already detailed enough, you can extract and reuse parts of it. Add implementation details, file paths, and a breakdown into steps that weren't in the spec.
|
|
55
61
|
|
|
56
62
|
### 3.1 Plan Content Guidelines
|
|
57
63
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
The plan is a **self-explanatory prompt** for the coding agent. That agent starts from zero: tell it what you discovered.
|
|
64
|
+
Follow these guidelines for all plans (single or specialized):
|
|
61
65
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
- **
|
|
69
|
-
-
|
|
66
|
+
- The plan must be a **self-explanatory prompt** for the coding agent, so help it by explaining what you discovered that is relevant.
|
|
67
|
+
- Give some context: explain how it works currently, and how it will work after the task is done.
|
|
68
|
+
- In a "Prerequisites" section, list **relevant documentation and skills** to use. Do not repeat their content.
|
|
69
|
+
- Mention a way to find **important source files**: by giving file paths, or by providing a function name to search for, for example. If needed, line numbers can be mentioned in the plan.
|
|
70
|
+
- Include a list of **numbered steps**.
|
|
71
|
+
- **Never plan backward compatibility** unless explicitly requested. Prefer clean code. Unused code must be removed.
|
|
72
|
+
- About **tests**: First investigate the codebase to see if there are tests already in place for the kind of tests you're considering. Do not mention writing tests unless you are sure they will be well-integrated into the project.
|
|
73
|
+
- Do not include sections like "Benefits", "Code Style Compliance", "Rationale" or anything that adds no actionable information. Focus on the problem and the solution.
|
|
74
|
+
- List **existing functions to reuse or refactor**. Plan thin wrappers, not re-implementations. Each operation should have one proper place.
|
|
70
75
|
|
|
71
76
|
### 3.2 Single Plan Format
|
|
72
77
|
|
|
73
78
|
_Use this when writing a single plan. Skip this section for multiple plans._
|
|
74
79
|
|
|
75
|
-
A single plan has no header with assignment, documentation, or skills
|
|
80
|
+
A single plan has no header with assignment, documentation, or skills — they are listed in the Prerequisites section within the plan body.
|
|
76
81
|
|
|
77
82
|
### 3.3 Specialized Plan Format
|
|
78
83
|
|
|
79
84
|
_Use this when writing multiple plans. Skip this section for a single plan._
|
|
80
85
|
|
|
81
|
-
|
|
86
|
+
For specialized plans, add these additional requirements:
|
|
82
87
|
|
|
83
|
-
|
|
88
|
+
**At the top of each specialized plan**, add a header. Only include fields that have content — omit any field with nothing to list. One agent can be assigned to multiple plans (separate instances).
|
|
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._
|
|
84
91
|
|
|
85
92
|
Example:
|
|
86
93
|
|
|
@@ -94,23 +101,23 @@ Example:
|
|
|
94
101
|
- **Skills**: `skill-a`, `skill-b`
|
|
95
102
|
```
|
|
96
103
|
|
|
97
|
-
**In the context section**, explain what you discovered **
|
|
104
|
+
**In the context section**, explain what you discovered **relevant to this plan's scope** and how it works currently and will work after the task is done **within its scope**.
|
|
98
105
|
|
|
99
|
-
**In the numbered steps**, include only this plan's work. Each plan
|
|
106
|
+
**In the numbered steps**, include only steps for this plan's work. Each plan should be self-contained.
|
|
100
107
|
|
|
101
|
-
**Coordination notes**:
|
|
108
|
+
**Coordination notes**: If this plan depends on another plan, mention it explicitly.
|
|
102
109
|
|
|
103
110
|
### 3.4 Add a Final Step to Plans
|
|
104
111
|
|
|
105
|
-
|
|
112
|
+
_For all plans (single or specialized)_, add a final step named "Write a Handover Document" with this content:
|
|
106
113
|
|
|
107
114
|
```markdown
|
|
108
|
-
Write a **handover document
|
|
115
|
+
Write a **handover document**. This document must contain the list of all files you updated. Also, summarize the changes made in a very concise way. Add only relevant information that will help your teammates understand what's new. Do not mention obvious information. It's not a course or a tutorial, if there is nothing to explain, then do not explain. 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.
|
|
109
116
|
```
|
|
110
117
|
|
|
111
118
|
Note:
|
|
112
119
|
|
|
113
|
-
- This is a regular step, numbered like the
|
|
120
|
+
- This is a regular step, it should be numbered like the other steps. For example, if your plan has 5 steps, this becomes step 6.
|
|
114
121
|
- 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`.
|
|
115
122
|
|
|
116
123
|
### 3.5 Common Footer for All Plans
|
|
@@ -122,21 +129,21 @@ Add the following content to the very end of each plan:
|
|
|
122
129
|
|
|
123
130
|
Do not trust this plan blindly. Be sure you understand the codebase and the plan by yourself before applying it.
|
|
124
131
|
|
|
125
|
-
Do
|
|
132
|
+
**IMPORTANT**: Do NOT use external search tools (Context7, web search, documentation fetching) during implementation unless explicitly allowed in this plan. All context should be provided in this plan or discoverable in the codebase.
|
|
126
133
|
```
|
|
127
134
|
|
|
128
135
|
## Phase 4. Main Plan Design
|
|
129
136
|
|
|
130
|
-
**Create a main plan only when
|
|
137
|
+
**Create a main plan only when multiple plans are created. Skip this section entirely if not applicable.**
|
|
131
138
|
|
|
132
139
|
### 4.1 Main Plan Guidelines
|
|
133
140
|
|
|
134
|
-
The main plan coordinates the execution of
|
|
141
|
+
The main plan coordinates the execution of all specialized plans. It should contain:
|
|
135
142
|
|
|
136
|
-
1. **Reference to the specification**:
|
|
137
|
-
2. **Execution strategy** section: parallel or sequential, with
|
|
138
|
-
3. **Plan assignments** section:
|
|
139
|
-
4. **Main Handover Document** section
|
|
143
|
+
1. **Reference to the specification**: Mention the spec file but do not repeat its content.
|
|
144
|
+
2. **Execution strategy** section: Specify if plans can be executed in parallel or must be sequential, with dependencies clearly noted.
|
|
145
|
+
3. **Plan assignments** section: For each specialized plan, include only applicable fields — assignment, documentation, skills, and a brief description
|
|
146
|
+
4. **Main Handover Document** section
|
|
140
147
|
|
|
141
148
|
Format example:
|
|
142
149
|
|
|
@@ -170,7 +177,7 @@ Execute these specialized plans:
|
|
|
170
177
|
- `docs/topic-b/doc-3.md`
|
|
171
178
|
- **Description**: [Brief description]
|
|
172
179
|
|
|
173
|
-
|
|
180
|
+
_**Important:** In the prompt you give to the subagent tool, do not reproduce the specialized plan. Instead, provide the file path._
|
|
174
181
|
|
|
175
182
|
### Coordination Notes
|
|
176
183
|
|
|
@@ -178,10 +185,12 @@ _In the prompt given to the subagent tool, provide the file path of the speciali
|
|
|
178
185
|
|
|
179
186
|
## Main Handover Document
|
|
180
187
|
|
|
181
|
-
Write a **main plan handover document**. This document:
|
|
188
|
+
Write a **main plan handover document**. This document should:
|
|
182
189
|
|
|
183
|
-
1.
|
|
184
|
-
2. For each referenced handover
|
|
190
|
+
1. Reference each specialized plan's handover file
|
|
191
|
+
2. For each referenced handover:
|
|
192
|
+
- State "Completed" if the plan was executed successfully
|
|
193
|
+
- Detail any issues encountered during execution
|
|
185
194
|
|
|
186
195
|
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.
|
|
187
196
|
|
|
@@ -189,7 +198,7 @@ Keep this handover very short. Do not combine or repeat the content of individua
|
|
|
189
198
|
|
|
190
199
|
Do not trust this plan blindly. Be sure you understand the codebase and all specialized plans before coordinating their execution.
|
|
191
200
|
|
|
192
|
-
Do
|
|
201
|
+
**IMPORTANT**: Do NOT use external search tools (Context7, web search, documentation fetching) during implementation unless explicitly allowed in these plans. All context should be provided in these plans or discoverable in the codebase.
|
|
193
202
|
````
|
|
194
203
|
|
|
195
204
|
Note:
|
|
@@ -215,19 +224,21 @@ Continue the current cycle. Request the file names with `{{TICKET_CMD}} --next`,
|
|
|
215
224
|
- 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.
|
|
216
225
|
- 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.
|
|
217
226
|
|
|
218
|
-
|
|
227
|
+
_Important Note: There will be lint errors in the markdown files you write. Ignore them. NEVER FIX LINT ERRORS (FORMATTING ISSUES) IN THE PLANS._
|
|
219
228
|
|
|
220
229
|
## Phase 6. Review
|
|
221
230
|
|
|
222
|
-
When you think the
|
|
231
|
+
When you think the plan(s) are complete, read them again with a critical eye and edit them to improve them.
|
|
232
|
+
|
|
233
|
+
Repeat the review until you think all plans are solid.
|
|
223
234
|
|
|
224
235
|
**Additional review for multiple plans**:
|
|
225
236
|
|
|
226
237
|
- Each specialized plan is self-contained
|
|
227
238
|
- Each specialized plan header includes only applicable fields (assignment, documentation, skills)
|
|
228
|
-
- The main plan references all specialized plans with their applicable fields
|
|
229
|
-
- Dependencies between plans are
|
|
239
|
+
- The main plan correctly references all specialized plans with their applicable fields
|
|
240
|
+
- Dependencies between plans are clearly documented
|
|
230
241
|
|
|
231
242
|
---
|
|
232
243
|
|
|
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)
|
|
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)
|
|
@@ -6,77 +6,68 @@ Run `{{TICKET_CMD}}` once to identify TICKET_DIR and load the ticket directory c
|
|
|
6
6
|
|
|
7
7
|
## Phases
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
When the user asks you for a SPEC (technical specification), you MUST follow this process:
|
|
10
10
|
|
|
11
|
-
1. **Investigation**: understand the current implementation and the problem
|
|
12
|
-
2. **Discussion**:
|
|
13
|
-
3. **Specification**:
|
|
11
|
+
1. **Investigation**: Research the codebase to understand the current implementation and identify the problem
|
|
12
|
+
2. **Discussion**: Collaborate with the user to explore the problem space and potential solutions BEFORE writing the specification file
|
|
13
|
+
3. **Specification**: Only after user approval, write the final specification file
|
|
14
14
|
|
|
15
|
-
The
|
|
15
|
+
The discussion phase is MANDATORY. Remember that you are a newcomer to this project while the user has extensive experience with the codebase and will be happy to help guide you.
|
|
16
16
|
|
|
17
17
|
## Phase 1. Investigation
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Check your context for available **documentation** and **skills**. Read every document and skill relevant to any aspect of the task — this is not optional. For each skill, also **read its relevant references**.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
Investigate the codebase yourself, find the relevant source code, think carefully, take the time to understand how it currently works and what has to be done. If the Context7 MCP is available, feel free to use it.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Always seek a clean break solution by default. Never consider backward compatibility unless explicitly requested.
|
|
24
24
|
|
|
25
25
|
## Phase 2. Discussion
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Engage in a thorough collaborative discussion covering:
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
- **Problem exploration**: Present your understanding of the problem and ask clarifying questions
|
|
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
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
You should ask questions freely to ensure you fully understand:
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
- The problem context and requirements
|
|
39
|
+
- Existing patterns and conventions in the codebase
|
|
40
|
+
- User preferences for implementation approaches
|
|
41
|
+
- Any constraints or considerations you might have missed
|
|
34
42
|
|
|
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.
|
|
43
|
+
Do not use your question tool. Always ask in plain text. Your questions will be the opportunity for a real discussion.
|
|
52
44
|
|
|
53
45
|
## Phase 3. Specification
|
|
54
46
|
|
|
55
47
|
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.
|
|
56
48
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```text
|
|
60
|
-
# [{TICKET_ID}] Short Title
|
|
49
|
+
- After the title, include a suggested commit message {{COMMIT_RULE}}. The shorter the better. Then list the required documentation and skills. List each doc file individually — never a folder. Always exclude `alignfirst` from skills. Omit any field with nothing to list. Example:
|
|
61
50
|
|
|
62
|
-
|
|
51
|
+
```text
|
|
52
|
+
# [{TICKET_ID}] Short Title
|
|
63
53
|
|
|
64
|
-
|
|
54
|
+
Suggested commit message: `<commit message>`
|
|
65
55
|
|
|
66
|
-
|
|
67
|
-
- `docs/topic-b/doc-2.md`
|
|
56
|
+
Required Documentation:
|
|
68
57
|
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
- `docs/topic-a/doc-1.md`
|
|
59
|
+
- `docs/topic-b/doc-2.md`
|
|
71
60
|
|
|
72
|
-
|
|
61
|
+
Required skills: `skill-1`, `skill-2`
|
|
62
|
+
```
|
|
73
63
|
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
64
|
+
- **Do not specify backward compatibility** unless explicitly requested. Prefer clean break by default. Unused code must be removed.
|
|
65
|
+
- A specification is not always immediately executed, and you have to assume that the code can change before it is executed. You can mention a function by name, but NEVER mention specific line numbers as they will become obsolete.
|
|
66
|
+
- Spell out every change to code contracts: database schema and migrations, API shapes, critical type definitions.
|
|
67
|
+
- Do not include other detailed code. Refer to source files by path or function name.
|
|
68
|
+
- Cover the full scope of the task. Never drop parts to shrink the spec — splitting work across plans is handled later by the *plan* protocol. If you anticipate a section should land in a separate plan, flag it inline (e.g. "candidate for a specialized plan").
|
|
69
|
+
- Do not include sections like "Benefits", "Code Style Compliance" or anything that adds no new information. Focus on the problem and the solution.
|
|
79
70
|
|
|
80
|
-
|
|
71
|
+
_Important Note:_ There will be lint errors in the markdown file you write. Ignore them. NEVER FIX LINT ERRORS (FORMATTING ISSUES) IN THE SPEC.
|
|
81
72
|
|
|
82
73
|
At the end, give the path of the spec file to the user.
|