alignfirst 0.6.0-preview.0 → 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 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. `~/.config/alignfirst/companions.json` declares which projects have one:
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 `<root>/<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 `<root>/projects_client-api/`.
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` once before investigating, unless the project's instructions already say so.
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
@@ -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(file.root, realHome), companionName(mainWorktree, realHome));
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, root: file.root, paths: file.paths };
72
+ return { path, paths: file.paths };
74
73
  }
75
74
  export function companionsPath(home) {
76
- return join(home, ".config", "alignfirst", "companions.json");
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alignfirst",
3
- "version": "0.6.0-preview.0",
3
+ "version": "0.6.0",
4
4
  "license": "CC0-1.0",
5
5
  "author": "Thomas MUR",
6
6
  "description": "The AlignFirst CLI: protocols, work files and docs in one command.",
@@ -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? | 🔴 |
@@ -52,4 +52,3 @@ Also check consistency by example: does the new code match its neighbors in stru
52
52
  | Mock added | Does it reproduce the real contract of the dependency, or an idealized version that can never fail? | 🟡 |
53
53
  | Test depending on the clock, network, execution order, or shared state | Source of flakiness. | 🟡 |
54
54
  | Assertion modified to make a test pass | Was the test fixed, or aligned with a bug? Strong signal: find out why it failed. | 🔴 |
55
- | 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,37 +10,30 @@ This is a 4-step protocol. Follow each step in order.
10
10
 
11
11
  ## 1. Investigate
12
12
 
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.
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 today and what needs to change.
15
+ Explore the codebase. Take the time to understand how it currently works and what needs to change.
16
16
 
17
- Seek a clean break solution by default. Consider backward compatibility only when the user asks for it.
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
- 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.
21
+ Present your findings and proposed approach. Ask clarifying questions. Explore trade-offs and edge cases.
22
22
 
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.
23
+ **Remember**: This discussion happens BEFORE any implementation or formal specification writing.
24
24
 
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 point that deserves a decision. 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.
25
+ Engage in a thorough collaborative discussion covering:
26
26
 
27
- A block is a question and a recommendation:
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
- A ❓ is open: the user's answer shapes what you build. When the only answers are go or veto, the block shrinks to a single ➡️ line stating your choice. The more obvious the choice, the shorter the line. Leave out the investigation narrative and the list of files you read.
38
-
39
- Settle on your own what the code can answer. Ask the user what needs their judgement: product behavior, scope, priorities, constraints the code does not show. Every ❓ carries a ➡️, so that "fine with all recommendations" is a valid answer. Ask in rounds: a question whose answer depends on another question still open waits for the next round.
32
+ You're new to this project, the user can guide you.
40
33
 
41
- When there is nothing to decide, say so in a few lines and ask for an explicit go.
34
+ Do not use your question tool. Always ask in plain text. Your questions will be the opportunity for a real discussion.
42
35
 
43
- Do not use your question tool. Ask in plain text: your questions open a real discussion, a multiple-choice widget closes it.
36
+ **This phase is mandatory.** If there is nothing to discuss, ask the user for an explicit validation.
44
37
 
45
38
  ## 3. Act
46
39
 
@@ -54,7 +47,7 @@ Use subagents (your subagent tool) for distinct, isolated units of work when ben
54
47
 
55
48
  Finalize the summary file: replace the working notes with the final content described below.
56
49
 
57
- 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.
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.
58
51
 
59
52
  Example:
60
53
 
@@ -71,15 +64,15 @@ Used documentation:
71
64
  Used skills: `skill-a`, `skill-b`
72
65
  ```
73
66
 
74
- The finalized summary is a **very concise handover document**. It captures:
67
+ The finalized summary is a **very concise handover document** that should capture:
75
68
 
76
69
  - What was the topic or problem
77
70
  - What was decided or discovered
78
- - What action was taken, if any
71
+ - What action was taken (if any)
79
72
  - Key outcomes or next steps
80
73
 
81
74
  The shorter the better.
82
75
 
83
- Ignore Markdown lint errors in the summary file.
76
+ _Ignore markdown lint errors in the summary file._
84
77
 
85
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, usually 3 to 5 words for the description part. Shorter is better when it stays clear.
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 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.
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
- - 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.
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
- Ignore Markdown lint errors in the description file.
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}} A merge that completes cleanly ends the protocol, with no summary file. Otherwise, continue with the steps below.
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
- Preserve both intents whenever possible. Accepting one side wholesale is the usual failure of a merge; it silently drops the other branch's work.
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. Batch processing, broad search-and-replace and other brute-force edits are out.
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.** 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.
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
- Ignore Markdown lint errors in the summary file.
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
- Without a spec file, stop and ask the user.
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
- Read the spec file entirely before starting. Then plan in six phases, in this order:
16
+ Before starting, **read the spec file** and understand it entirely.
15
17
 
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.
18
+ In order to generate implementation plans, you MUST follow this process:
22
19
 
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.
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
- 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.
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
- Find the relevant source code. Take the time to understand how it works today and what has to change.
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
- The spec is the starting point, and it was written against an earlier state of the code. Verify each statement against the current implementation.
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 an existing function that does a similar job.
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
- ### 2.1 Assess Work Scopes
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
- Split complex work into specialized plans, coordinated by a main plan. Split along:
41
+ ### 2.1 Assess Work Scopes
42
42
 
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.
43
+ Evaluate if the work should be split into multiple specialized plans or handled as a single plan:
45
44
 
46
- Each specialized plan produces a coherent deliverable.
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
- 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.
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 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.
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
- 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.
64
+ Follow these guidelines for all plans (single or specialized):
61
65
 
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.
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. They are listed in the Prerequisites section within the plan body.
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
- **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.
86
+ For specialized plans, add these additional requirements:
82
87
 
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._
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 **within this plan's scope**: how it works today and how it will work after the task.
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 is self-contained.
106
+ **In the numbered steps**, include only steps for this plan's work. Each plan should be self-contained.
100
107
 
101
- **Coordination notes**: when this plan depends on another plan, say so explicitly.
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
- For every plan, single or specialized, add a final step named "Write a Handover Document" with this content:
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** 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.
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 others. A plan with 5 steps gets this one as step 6.
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 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.
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 there are several plans. Skip this section otherwise.**
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 the specialized plans. It contains:
141
+ The main plan coordinates the execution of all specialized plans. It should contain:
135
142
 
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.
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
- _In the prompt given to the subagent tool, provide the file path of the specialized plan. Do not reproduce its content._
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. 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
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 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.
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
- Ignore Markdown lint errors in the plan files. Fixing them wastes the session.
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 plans are complete, read them again with a critical eye and edit them to improve them. Repeat until every plan is solid.
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 stated
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,75 +6,68 @@ Run `{{TICKET_CMD}}` once to identify TICKET_DIR and load the ticket directory c
6
6
 
7
7
  ## Phases
8
8
 
9
- A specification is produced in three phases, in this order:
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**: align with the user on the problem and the solution.
13
- 3. **Specification**: write the spec file, once the user has approved.
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 usual failure is to write the spec right after investigating. The discussion comes first, every time.
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
- 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.
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
- 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.
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
- Seek a clean break solution by default. Consider backward compatibility only when the user asks for it.
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
- Nothing is written in TICKET_DIR before the user agrees.
27
+ Engage in a thorough collaborative discussion covering:
28
28
 
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.
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
- 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 point that deserves a decision. 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.
36
+ You should ask questions freely to ensure you fully understand:
32
37
 
33
- A block is a question and a recommendation:
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
- A ❓ is open: the user's answer shapes what you build. When the only answers are go or veto, the block shrinks to a single ➡️ line stating your choice. The more obvious the choice, the shorter the line. Leave out the investigation narrative and the list of files you read.
44
-
45
- Settle on your own what the code can answer. Ask the user what needs their judgement: product behavior, scope, priorities, constraints the code does not show. Every ❓ carries a ➡️, so that "fine with all recommendations" is a valid answer. Ask in rounds: a question whose answer depends on another question still open waits for the next round.
46
-
47
- 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.
48
-
49
- 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.
50
44
 
51
45
  ## Phase 3. Specification
52
46
 
53
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.
54
48
 
55
- 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.
56
-
57
- ```text
58
- # [{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:
59
50
 
60
- Suggested commit message: `<commit message>`
51
+ ```text
52
+ # [{TICKET_ID}] Short Title
61
53
 
62
- Required Documentation:
54
+ Suggested commit message: `<commit message>`
63
55
 
64
- - `docs/topic-a/doc-1.md`
65
- - `docs/topic-b/doc-2.md`
56
+ Required Documentation:
66
57
 
67
- Required skills: `skill-1`, `skill-2`
68
- ```
58
+ - `docs/topic-a/doc-1.md`
59
+ - `docs/topic-b/doc-2.md`
69
60
 
70
- Content rules:
61
+ Required skills: `skill-1`, `skill-2`
62
+ ```
71
63
 
72
- - 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").
73
- - 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.
74
- - The code may change before the spec is executed. Name functions, never line numbers.
75
- - Specify a clean break. Unused code is removed. Backward compatibility appears only when the user asked for it.
76
- - Leave out sections that add no information: "Benefits", "Code Style Compliance", and the like. Problem and solution only.
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.
77
70
 
78
- Ignore Markdown lint errors in the spec file. Fixing them wastes the session.
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.
79
72
 
80
73
  At the end, give the path of the spec file to the user.