@thatix.io/context-first-agents-cli 0.1.0 → 0.2.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 +189 -7
- package/dist/commands/create-orchestrator.js +4 -1
- package/dist/commands/doctor.js +21 -5
- package/dist/commands/init.js +3 -1
- package/dist/templates/commands/en/engineer/plan.md +301 -0
- package/dist/templates/commands/en/engineer/pr.md +194 -0
- package/dist/templates/commands/en/engineer/pre-pr.md +325 -0
- package/dist/templates/commands/en/engineer/start.md +285 -0
- package/dist/templates/commands/en/engineer/work.md +256 -0
- package/dist/templates/commands/en/products/check.md +237 -0
- package/dist/templates/commands/en/products/collect.md +170 -0
- package/dist/templates/commands/en/products/refine.md +231 -0
- package/dist/templates/commands/en/products/spec.md +273 -0
- package/dist/templates/commands/en/quality/metrics.md +266 -0
- package/dist/templates/commands/en/quality/observe.md +172 -0
- package/dist/templates/commands/en/warm-up.md +59 -0
- package/dist/templates/commands/es/agents/CONTEXT-CONTRACT.md +63 -0
- package/dist/templates/commands/es/agents/implementer.md +27 -0
- package/dist/templates/commands/es/agents/integrator.md +24 -0
- package/dist/templates/commands/es/agents/reviewer.md +31 -0
- package/dist/templates/commands/es/agents/tester.md +22 -0
- package/dist/templates/commands/es/engineer/plan.md +335 -0
- package/dist/templates/commands/es/engineer/pr.md +228 -0
- package/dist/templates/commands/es/engineer/pre-pr.md +359 -0
- package/dist/templates/commands/es/engineer/start.md +318 -0
- package/dist/templates/commands/es/engineer/work.md +290 -0
- package/dist/templates/commands/es/orchestrate.md +125 -0
- package/dist/templates/commands/es/products/check.md +271 -0
- package/dist/templates/commands/es/products/collect.md +218 -0
- package/dist/templates/commands/es/products/refine.md +265 -0
- package/dist/templates/commands/es/products/spec.md +306 -0
- package/dist/templates/commands/es/quality/metrics.md +300 -0
- package/dist/templates/commands/es/quality/observe.md +205 -0
- package/dist/templates/commands/es/warm-up.md +59 -0
- package/dist/templates/commands/pt-BR/engineer/plan.md +335 -0
- package/dist/templates/commands/pt-BR/engineer/pr.md +228 -0
- package/dist/templates/commands/pt-BR/engineer/pre-pr.md +359 -0
- package/dist/templates/commands/pt-BR/engineer/start.md +319 -0
- package/dist/templates/commands/pt-BR/engineer/work.md +290 -0
- package/dist/templates/commands/pt-BR/products/check.md +271 -0
- package/dist/templates/commands/pt-BR/products/collect.md +219 -0
- package/dist/templates/commands/pt-BR/products/refine.md +265 -0
- package/dist/templates/commands/pt-BR/products/spec.md +307 -0
- package/dist/templates/commands/pt-BR/quality/metrics.md +300 -0
- package/dist/templates/commands/pt-BR/quality/observe.md +206 -0
- package/dist/templates/commands/pt-BR/warm-up.md +59 -0
- package/package.json +7 -3
- package/templates/commands/en/engineer/plan.md +301 -0
- package/templates/commands/en/engineer/pr.md +194 -0
- package/templates/commands/en/engineer/pre-pr.md +325 -0
- package/templates/commands/en/engineer/start.md +285 -0
- package/templates/commands/en/engineer/work.md +256 -0
- package/templates/commands/en/products/check.md +237 -0
- package/templates/commands/en/products/collect.md +170 -0
- package/templates/commands/en/products/refine.md +231 -0
- package/templates/commands/en/products/spec.md +273 -0
- package/templates/commands/en/quality/metrics.md +266 -0
- package/templates/commands/en/quality/observe.md +172 -0
- package/templates/commands/en/warm-up.md +59 -0
- package/templates/commands/es/agents/CONTEXT-CONTRACT.md +63 -0
- package/templates/commands/es/agents/implementer.md +27 -0
- package/templates/commands/es/agents/integrator.md +24 -0
- package/templates/commands/es/agents/reviewer.md +31 -0
- package/templates/commands/es/agents/tester.md +22 -0
- package/templates/commands/es/engineer/plan.md +335 -0
- package/templates/commands/es/engineer/pr.md +228 -0
- package/templates/commands/es/engineer/pre-pr.md +359 -0
- package/templates/commands/es/engineer/start.md +318 -0
- package/templates/commands/es/engineer/work.md +290 -0
- package/templates/commands/es/orchestrate.md +125 -0
- package/templates/commands/es/products/check.md +271 -0
- package/templates/commands/es/products/collect.md +218 -0
- package/templates/commands/es/products/refine.md +265 -0
- package/templates/commands/es/products/spec.md +306 -0
- package/templates/commands/es/quality/metrics.md +300 -0
- package/templates/commands/es/quality/observe.md +205 -0
- package/templates/commands/es/warm-up.md +59 -0
- package/templates/commands/pt-BR/engineer/plan.md +335 -0
- package/templates/commands/pt-BR/engineer/pr.md +228 -0
- package/templates/commands/pt-BR/engineer/pre-pr.md +359 -0
- package/templates/commands/pt-BR/engineer/start.md +319 -0
- package/templates/commands/pt-BR/engineer/work.md +290 -0
- package/templates/commands/pt-BR/products/check.md +271 -0
- package/templates/commands/pt-BR/products/collect.md +219 -0
- package/templates/commands/pt-BR/products/refine.md +265 -0
- package/templates/commands/pt-BR/products/spec.md +307 -0
- package/templates/commands/pt-BR/quality/metrics.md +300 -0
- package/templates/commands/pt-BR/quality/observe.md +206 -0
- package/templates/commands/pt-BR/warm-up.md +59 -0
package/README.md
CHANGED
|
@@ -15,6 +15,39 @@ spec → complexity → execution DAG → context contract per node → ephemera
|
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
+
## What is this for?
|
|
19
|
+
|
|
20
|
+
You have a **multi-repository product** (say a backend, a web client, a mobile app, a
|
|
21
|
+
shared UI library, a specs repo) and you drive development with an **AI coding tool**
|
|
22
|
+
through slash commands.
|
|
23
|
+
|
|
24
|
+
The problem: doing a feature that touches several repos with **one AI agent** means
|
|
25
|
+
stuffing every repo, every spec, and the whole plan into **one giant context**. It
|
|
26
|
+
saturates, loses the thread, and there's no parallelism — you babysit it phase by phase.
|
|
27
|
+
|
|
28
|
+
This tool fixes that by moving one level up. You write an approved spec; the AI runs
|
|
29
|
+
`/orchestrate`, which:
|
|
30
|
+
|
|
31
|
+
1. **reads your `context-manifest.json`** to know your repos,
|
|
32
|
+
2. **figures out how big the task is** (which repos it touches, whether it's risky),
|
|
33
|
+
3. **builds the minimum graph of ephemeral agents** — e.g. one implementer per impacted
|
|
34
|
+
repo (in parallel), then an integrator, then a tester, plus an adversarial reviewer
|
|
35
|
+
when the task is risky,
|
|
36
|
+
4. **gives each agent a tiny, bounded "context contract"** (only the files it may read,
|
|
37
|
+
only the repo it may write) and spawns them as subagents,
|
|
38
|
+
5. **collects their reports** and summarizes what changed.
|
|
39
|
+
|
|
40
|
+
Each agent is **ephemeral**: it does one bounded job with a clean, small context, returns
|
|
41
|
+
a structured report, and is discarded. The orchestrator stays light — it coordinates, it
|
|
42
|
+
doesn't implement. That's what keeps large, multi-repo work from collapsing under its own
|
|
43
|
+
context.
|
|
44
|
+
|
|
45
|
+
**Who it's for:** teams using an AI tool (Claude Code, Cursor, etc.) across several repos
|
|
46
|
+
who want spec-driven, parallel, context-isolated feature development — without hand-wiring
|
|
47
|
+
which agent runs when.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
18
51
|
## What's new vs. context-first-cli
|
|
19
52
|
|
|
20
53
|
| | context-first-cli | context-first-agents-cli |
|
|
@@ -33,14 +66,27 @@ Everything specific lives in `context-manifest.json`.
|
|
|
33
66
|
## Install
|
|
34
67
|
|
|
35
68
|
```bash
|
|
36
|
-
npm install -g context-first-agents-cli
|
|
69
|
+
npm install -g @thatix.io/context-first-agents-cli
|
|
37
70
|
# binaries: context-agents (alias: cfa)
|
|
38
71
|
```
|
|
39
72
|
|
|
73
|
+
## Concepts (30 seconds)
|
|
74
|
+
|
|
75
|
+
- **Orchestrator** — a small control repo (the folder you run the CLI in). Holds
|
|
76
|
+
`context-manifest.json` and the installed `.md` commands. It is the single source of
|
|
77
|
+
truth for your dev process.
|
|
78
|
+
- **Repositories** — your actual code repos, listed in the manifest, sitting next to the
|
|
79
|
+
orchestrator (`../service-a`, `../client-b`, …).
|
|
80
|
+
- **Metaspecs** — the repo holding your normative specs (the `role: metaspecs` entry).
|
|
81
|
+
- **Session** — one feature/issue. Lives in `.sessions/<ISSUE-ID>/` with the plan and each
|
|
82
|
+
agent's report.
|
|
83
|
+
- **Ephemeral agent** — a subagent compiled on the fly from
|
|
84
|
+
`archetype + objective + repository + context contract`, run once, then discarded.
|
|
85
|
+
|
|
40
86
|
## Quick start
|
|
41
87
|
|
|
42
88
|
```bash
|
|
43
|
-
# 1. Create an orchestrator
|
|
89
|
+
# 1. Create an orchestrator (or run `init` inside an existing one)
|
|
44
90
|
context-agents create:orchestrator my-orchestrator
|
|
45
91
|
cd my-orchestrator
|
|
46
92
|
|
|
@@ -54,18 +100,62 @@ context-agents doctor
|
|
|
54
100
|
/orchestrate <ISSUE-ID or path/to/spec.md>
|
|
55
101
|
```
|
|
56
102
|
|
|
103
|
+
## The development flow after install
|
|
104
|
+
|
|
105
|
+
Setup happens **once**; then it's the same short loop per feature.
|
|
106
|
+
|
|
107
|
+
**One-time setup (Node CLI):**
|
|
108
|
+
|
|
109
|
+
1. `create:orchestrator my-orchestrator` (or `cd` into an existing orchestrator and run
|
|
110
|
+
`init`).
|
|
111
|
+
2. Edit `ai.properties.md` → set `base_path` to where your repos live.
|
|
112
|
+
3. `add:repo` for each repository. Give each one **`hints`** (keywords that mean "this repo
|
|
113
|
+
is impacted"), an optional **`context`** list (files an agent here may read), and a
|
|
114
|
+
**`testCommand`**.
|
|
115
|
+
4. Fill `orchestration.riskSignals` (keywords like `migration`, `payment`, `auth`) and
|
|
116
|
+
`orchestration.indexes` (your spec index files).
|
|
117
|
+
5. `doctor` until it's all green.
|
|
118
|
+
|
|
119
|
+
**Per feature (in your AI tool) — the full command flow:**
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
/warm-up → /collect → /refine → /spec → /orchestrate
|
|
123
|
+
load gather shape approve derive agent graph
|
|
124
|
+
context idea scope the spec + execute
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
1. **`/warm-up`** — load project context (manifest, specs, conventions).
|
|
128
|
+
2. **`/collect`** → **`/refine`** → **`/spec`** — turn an idea into an **approved,
|
|
129
|
+
normative spec** (PRD). These are the "product" commands.
|
|
130
|
+
3. **`/orchestrate <ISSUE-ID or path/to/spec.md>`** — the new engine. It will:
|
|
131
|
+
- classify complexity and **show you the agent graph**,
|
|
132
|
+
- wait for your **approval**,
|
|
133
|
+
- spawn the ephemeral agents wave by wave (implementers in parallel, then
|
|
134
|
+
integrator/tester, plus a reviewer if risky),
|
|
135
|
+
- write everything to `.sessions/<ISSUE-ID>/` and summarize the result.
|
|
136
|
+
4. Review the summary. If the reviewer flagged blockers, fix and re-run the affected part.
|
|
137
|
+
5. Open the PR(s) from the per-repo worktrees (or use `/pre-pr` / `/pr`).
|
|
138
|
+
|
|
139
|
+
The classic **`/start` → `/plan` → `/work`** commands are still installed as **manual
|
|
140
|
+
escape hatches** — for most tasks `/orchestrate` replaces that whole sequence. Quality
|
|
141
|
+
commands `/observe` and `/metrics` are also included.
|
|
142
|
+
|
|
57
143
|
## Commands (Node — scaffold/management only)
|
|
58
144
|
|
|
59
145
|
| Command | Purpose |
|
|
60
146
|
|---|---|
|
|
61
|
-
| `create:orchestrator [name]` | New orchestrator (manifest + `.md`
|
|
62
|
-
| `init` | Install/refresh
|
|
147
|
+
| `create:orchestrator [name]` | New orchestrator (manifest + full `.md` command flow) |
|
|
148
|
+
| `init` | Install/refresh the full command flow in an existing orchestrator |
|
|
63
149
|
| `add:repo` | Add a repo to the manifest (id, role, **hints**, context, testCommand) |
|
|
64
|
-
| `update:commands` | Overwrite the
|
|
65
|
-
| `doctor` | Validate manifest, hints, indexes, installed commands |
|
|
150
|
+
| `update:commands` | Overwrite the command templates |
|
|
151
|
+
| `doctor` | Validate manifest, hints, indexes, and installed flow commands |
|
|
66
152
|
| `status` | Show repos, risk signals, and active sessions |
|
|
67
153
|
|
|
68
|
-
`--lang en|pt-BR` selects the language of the installed `.md` commands.
|
|
154
|
+
`--lang en|es|pt-BR` selects the language of the installed `.md` commands.
|
|
155
|
+
|
|
156
|
+
**Installed `.md` commands** (into `.claude/commands/`): `warm-up`,
|
|
157
|
+
`products/{collect,refine,spec,check}`, **`orchestrate`** (+ `agents/`),
|
|
158
|
+
`engineer/{start,plan,work,pre-pr,pr}` (escape hatches), `quality/{observe,metrics}`.
|
|
69
159
|
|
|
70
160
|
## The `.md` orchestration layer (the engine)
|
|
71
161
|
|
|
@@ -113,6 +203,98 @@ additive fields). See `templates/orchestrator/context-manifest.example.json`.
|
|
|
113
203
|
tester) · `complex` (medium + adversarial reviewer). A spec may force it via
|
|
114
204
|
`complexity:` frontmatter. Small tasks stay small by design.
|
|
115
205
|
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## End-to-end example
|
|
209
|
+
|
|
210
|
+
Assume this manifest (two code repos + a specs repo):
|
|
211
|
+
|
|
212
|
+
```jsonc
|
|
213
|
+
{
|
|
214
|
+
"project": "example",
|
|
215
|
+
"repositories": [
|
|
216
|
+
{ "id": "metaspecs", "role": "metaspecs", "hints": ["spec", "adr"] },
|
|
217
|
+
{ "id": "service-a", "role": "service", "hints": ["api", "backend"],
|
|
218
|
+
"context": ["../metaspecs/specs/api.md"], "testCommand": "npm test" },
|
|
219
|
+
{ "id": "client-b", "role": "application", "hints": ["ui", "client"],
|
|
220
|
+
"context": ["../metaspecs/specs/design.md"], "testCommand": "npm test" }
|
|
221
|
+
],
|
|
222
|
+
"orchestration": {
|
|
223
|
+
"riskSignals": ["migration", "payment", "security"],
|
|
224
|
+
"indexes": ["../metaspecs/specs/index.md"],
|
|
225
|
+
"parallelism": { "maxWorkers": 8, "maxPerRepository": 2 }
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 1. Write a spec — `.sessions/ISSUE-42/spec.md`
|
|
231
|
+
|
|
232
|
+
```markdown
|
|
233
|
+
---
|
|
234
|
+
id: ISSUE-42
|
|
235
|
+
---
|
|
236
|
+
# Add a `discountRate` field to the order
|
|
237
|
+
|
|
238
|
+
Expose `discountRate` in the **service-a** order API and show it on the
|
|
239
|
+
order screen in the **client-b** UI.
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### 2. Run the command
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
/orchestrate .sessions/ISSUE-42/spec.md
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 3. What the orchestrator does
|
|
249
|
+
|
|
250
|
+
**Classification** — the spec text mentions `service-a`/`api` and `client-b`/`ui` →
|
|
251
|
+
**repoHits = 2**, no risk signals → **medium**.
|
|
252
|
+
|
|
253
|
+
**Proposed graph (shown for approval):**
|
|
254
|
+
|
|
255
|
+
| id | archetype | repository | dependsOn |
|
|
256
|
+
|----|-----------|------------|-----------|
|
|
257
|
+
| W1 | implementer | service-a | — |
|
|
258
|
+
| W2 | implementer | client-b | — |
|
|
259
|
+
| W3 | integrator | (session) | W1, W2 |
|
|
260
|
+
| W4 | tester | (session) | W3 |
|
|
261
|
+
|
|
262
|
+
**Execution** — after you approve:
|
|
263
|
+
|
|
264
|
+
- **Wave 1 (parallel):** W1 and W2 are spawned as subagents in one shot. Each gets ONLY
|
|
265
|
+
its context contract — e.g. W1 may read `../metaspecs/specs/index.md` +
|
|
266
|
+
`../metaspecs/specs/api.md`, may write only in `service-a`'s worktree, and is told not
|
|
267
|
+
to assume anything outside the spec.
|
|
268
|
+
- **Wave 2:** W3 (integrator) checks that the API field W1 added matches what W2 consumes
|
|
269
|
+
(name, type, nullability).
|
|
270
|
+
- **Wave 3:** W4 (tester) runs `npm test` in each impacted repo and maps the acceptance
|
|
271
|
+
criterion ("field visible on the order screen") to a check.
|
|
272
|
+
|
|
273
|
+
**Result** — written to `.sessions/ISSUE-42/`:
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
.sessions/ISSUE-42/
|
|
277
|
+
├── spec.md
|
|
278
|
+
├── execution-plan.md # the DAG above
|
|
279
|
+
└── workers/
|
|
280
|
+
├── agent-w1.md # contract + report (service-a)
|
|
281
|
+
├── agent-w2.md # contract + report (client-b)
|
|
282
|
+
├── agent-w3.md # integration findings
|
|
283
|
+
└── agent-w4.md # test results
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Each report follows a fixed shape: `summary / changes / evidence / tests / unresolved /
|
|
287
|
+
confidence`.
|
|
288
|
+
|
|
289
|
+
### If the task were risky
|
|
290
|
+
|
|
291
|
+
Change the spec to *"…behind a **payment** flow with a DB **migration**"*. Now
|
|
292
|
+
**risks = 2** → **complex**, and the graph gains a **W5 reviewer** (dependsOn integrator)
|
|
293
|
+
that adversarially checks business rules, security, and the migration's reversibility
|
|
294
|
+
before you ship. You didn't have to remember to add it — the `riskSignals` did.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
116
298
|
## Design rules
|
|
117
299
|
|
|
118
300
|
- **No catalog of domain agents.** Expertise comes from selected context, not personas.
|
|
@@ -83,5 +83,8 @@ export async function createOrchestratorCommand(name, opts) {
|
|
|
83
83
|
console.log(chalk.gray('\nNext steps:'));
|
|
84
84
|
console.log(chalk.gray(` cd ${dirName}`));
|
|
85
85
|
console.log(chalk.gray(' context-agents add:repo # register your repositories'));
|
|
86
|
-
console.log(chalk.gray(' #
|
|
86
|
+
console.log(chalk.gray(' context-agents doctor # validate the setup'));
|
|
87
|
+
console.log(chalk.gray('\nThen, in your AI tool, the full flow:'));
|
|
88
|
+
console.log(chalk.gray(' /warm-up → /collect → /refine → /spec → /orchestrate <ISSUE-ID>'));
|
|
89
|
+
console.log(chalk.gray(' (/plan, /work, /pre-pr remain as manual escape hatches)\n'));
|
|
87
90
|
}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -15,15 +15,31 @@ export async function doctorCommand() {
|
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
17
|
console.log(chalk.green(`✓ Manifest OK — ${manifest.project} (${manifest.repositories.length} repos)`));
|
|
18
|
-
// Commands installed?
|
|
18
|
+
// Commands installed? Check the full flow (product → orchestrate → engineer escape hatches).
|
|
19
19
|
const commandsDir = path.join(cwd, '.claude', 'commands');
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const flow = [
|
|
21
|
+
{ file: 'warm-up.md', label: '/warm-up' },
|
|
22
|
+
{ file: 'products/collect.md', label: '/collect' },
|
|
23
|
+
{ file: 'products/refine.md', label: '/refine' },
|
|
24
|
+
{ file: 'products/spec.md', label: '/spec' },
|
|
25
|
+
{ file: 'orchestrate.md', label: '/orchestrate', required: true },
|
|
26
|
+
];
|
|
27
|
+
const missing = [];
|
|
28
|
+
for (const step of flow) {
|
|
29
|
+
if (!(await pathExists(path.join(commandsDir, step.file))))
|
|
30
|
+
missing.push(step.label);
|
|
22
31
|
}
|
|
23
|
-
|
|
24
|
-
console.log(chalk.
|
|
32
|
+
if (!missing.length) {
|
|
33
|
+
console.log(chalk.green('✓ Full command flow installed (warm-up → collect → refine → spec → orchestrate)'));
|
|
34
|
+
}
|
|
35
|
+
else if (missing.includes('/orchestrate')) {
|
|
36
|
+
console.log(chalk.red(`✗ Core command /orchestrate missing — run \`context-agents init\``));
|
|
25
37
|
problems++;
|
|
26
38
|
}
|
|
39
|
+
else {
|
|
40
|
+
console.log(chalk.yellow(`! Some flow commands missing (${missing.join(', ')}) — run \`context-agents init\` to install them`));
|
|
41
|
+
warnings++;
|
|
42
|
+
}
|
|
27
43
|
// Orchestration block
|
|
28
44
|
const orch = manifest.orchestration;
|
|
29
45
|
if (!orch?.riskSignals?.length) {
|
package/dist/commands/init.js
CHANGED
|
@@ -18,5 +18,7 @@ export async function initCommand(opts) {
|
|
|
18
18
|
console.log(chalk.bold('\nInstalling agent command templates:'));
|
|
19
19
|
const written = await installCommands(cwd, { lang: opts.lang, force: opts.force });
|
|
20
20
|
console.log(chalk.green(`\n✓ Installed ${written.length} command file(s).`));
|
|
21
|
-
console.log(chalk.gray('\
|
|
21
|
+
console.log(chalk.gray('\nFull flow in your AI tool:'));
|
|
22
|
+
console.log(chalk.gray(' /warm-up → /collect → /refine → /spec → /orchestrate <ISSUE-ID>'));
|
|
23
|
+
console.log(chalk.gray(' (/plan, /work, /pre-pr remain as manual escape hatches)\n'));
|
|
22
24
|
}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# Technical Planning
|
|
2
|
+
|
|
3
|
+
This command creates the detailed technical plan for the feature implementation.
|
|
4
|
+
|
|
5
|
+
## 📋 Prerequisites
|
|
6
|
+
|
|
7
|
+
- PRD created via `/spec`
|
|
8
|
+
- Initial analysis done via `/start`
|
|
9
|
+
- `context.md` and `architecture.md` files created and approved
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
Read `context-manifest.json` and `ai.properties.md` from the orchestrator to get repositories, base_path, and task_management_system.
|
|
14
|
+
|
|
15
|
+
## 📍 IMPORTANT: Understand the Structure
|
|
16
|
+
|
|
17
|
+
**Workspace**:
|
|
18
|
+
```
|
|
19
|
+
<orchestrator>/.sessions/<ISSUE-ID>/
|
|
20
|
+
├── repo-1/ # worktree (will be used in /work)
|
|
21
|
+
├── repo-2/ # worktree (will be used in /work)
|
|
22
|
+
├── context.md # context (immutable - READ)
|
|
23
|
+
├── architecture.md # architecture (immutable - READ)
|
|
24
|
+
└── plan.md # plan (mutable - CREATE)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Main repositories** (read-only):
|
|
28
|
+
```
|
|
29
|
+
{base_path}/repo-1/ # main repo (branch main/master)
|
|
30
|
+
{base_path}/repo-2/ # main repo (branch main/master)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**GOLDEN RULE**:
|
|
34
|
+
- ✅ Read `context.md` and `architecture.md` (immutable)
|
|
35
|
+
- ✅ Create `plan.md` in `.sessions/<ISSUE-ID>/`
|
|
36
|
+
- ✅ Read code from main repositories (read-only)
|
|
37
|
+
- ❌ NEVER checkout main repositories
|
|
38
|
+
- ❌ NEVER modify `context.md` or `architecture.md`
|
|
39
|
+
|
|
40
|
+
## ⚠️ IMPORTANT: Immutable Files
|
|
41
|
+
|
|
42
|
+
**This command must READ but NOT MODIFY:**
|
|
43
|
+
- ✅ **READ** `.sessions/<ISSUE-ID>/context.md` (immutable)
|
|
44
|
+
- ✅ **READ** `.sessions/<ISSUE-ID>/architecture.md` (immutable)
|
|
45
|
+
- ✅ **CREATE** `.sessions/<ISSUE-ID>/plan.md` (mutable - will be updated during `/work`)
|
|
46
|
+
- ❌ **DO NOT modify `context.md` or `architecture.md`**
|
|
47
|
+
|
|
48
|
+
## 📚 Load MetaSpecs
|
|
49
|
+
|
|
50
|
+
**Automatically locate MetaSpecs**:
|
|
51
|
+
1. Read `context-manifest.json` from the orchestrator
|
|
52
|
+
2. Find the repository with `"role": "metaspecs"`
|
|
53
|
+
3. Read `ai.properties.md` to get the `base_path`
|
|
54
|
+
4. The metaspecs are at: `{base_path}/{metaspecs-repo-id}/`
|
|
55
|
+
5. Read the relevant `index.md` files to ensure compliance with:
|
|
56
|
+
- System architecture
|
|
57
|
+
- Design and code patterns
|
|
58
|
+
- Folder and file structure
|
|
59
|
+
- Naming conventions
|
|
60
|
+
|
|
61
|
+
## 🎯 Goal
|
|
62
|
+
|
|
63
|
+
Create a detailed technical plan that will guide the implementation, dividing the work into smaller, sequential units.
|
|
64
|
+
|
|
65
|
+
## 📝 Plan Structure
|
|
66
|
+
|
|
67
|
+
### 1. Technical Overview
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
# Technical Plan - [Feature Title]
|
|
71
|
+
|
|
72
|
+
## Summary
|
|
73
|
+
[Brief technical description of what will be implemented]
|
|
74
|
+
|
|
75
|
+
## Involved Repositories
|
|
76
|
+
- **<repo-1>**: [Role in this feature]
|
|
77
|
+
- **<repo-2>**: [Role in this feature]
|
|
78
|
+
|
|
79
|
+
## Technical Approach
|
|
80
|
+
[General implementation strategy]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 2. Solution Architecture
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
## Architecture
|
|
87
|
+
|
|
88
|
+
### Component Diagram
|
|
89
|
+
[Textual description or ASCII art of components and their relationships]
|
|
90
|
+
|
|
91
|
+
### Data Flow
|
|
92
|
+
1. [Step 1 of the flow]
|
|
93
|
+
2. [Step 2 of the flow]
|
|
94
|
+
3. [Step 3 of the flow]
|
|
95
|
+
|
|
96
|
+
### Integrations
|
|
97
|
+
- **<repo-1> → <repo-2>**: [How they communicate]
|
|
98
|
+
- **System → External API**: [If any]
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 3. Technical Decisions
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
## Technical Decisions
|
|
105
|
+
|
|
106
|
+
### Decision 1: [Title]
|
|
107
|
+
**Context**: [Why we need to decide this]
|
|
108
|
+
**Considered options**:
|
|
109
|
+
- Option A: [Pros and cons]
|
|
110
|
+
- Option B: [Pros and cons]
|
|
111
|
+
**Decision**: [Chosen option]
|
|
112
|
+
**Justification**: [Why we chose this option]
|
|
113
|
+
|
|
114
|
+
### Decision 2: [Title]
|
|
115
|
+
[Same format as above]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 4. Implementation Plan
|
|
119
|
+
|
|
120
|
+
Divide the work into small, sequential units:
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
## Implementation Plan
|
|
124
|
+
|
|
125
|
+
### Phase 1: [Phase Name]
|
|
126
|
+
**Goal**: [What will be achieved in this phase]
|
|
127
|
+
**Repositories**: [affected repos]
|
|
128
|
+
|
|
129
|
+
#### Task 1.1: [Description]
|
|
130
|
+
- **Repo**: <repo-1>
|
|
131
|
+
- **Files**: [files to create/modify]
|
|
132
|
+
- **Description**: [What to do]
|
|
133
|
+
- **Tests**: [Tests to implement]
|
|
134
|
+
- **Estimate**: [estimated time]
|
|
135
|
+
|
|
136
|
+
#### Task 1.2: [Description]
|
|
137
|
+
- **Repo**: <repo-2>
|
|
138
|
+
- **Files**: [files to create/modify]
|
|
139
|
+
- **Description**: [What to do]
|
|
140
|
+
- **Tests**: [Tests to implement]
|
|
141
|
+
- **Estimate**: [estimated time]
|
|
142
|
+
|
|
143
|
+
### Phase 2: [Phase Name]
|
|
144
|
+
[Same format as above]
|
|
145
|
+
|
|
146
|
+
### Phase 3: [Phase Name]
|
|
147
|
+
[Same format as above]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 5. File Structure
|
|
151
|
+
|
|
152
|
+
For each repository, define the structure:
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
## File Structure
|
|
156
|
+
|
|
157
|
+
### <repo-1>
|
|
158
|
+
```
|
|
159
|
+
src/
|
|
160
|
+
├── components/
|
|
161
|
+
│ ├── NewComponent.tsx (CREATE)
|
|
162
|
+
│ └── ExistingComponent.tsx (MODIFY)
|
|
163
|
+
├── services/
|
|
164
|
+
│ └── NewService.ts (CREATE)
|
|
165
|
+
└── tests/
|
|
166
|
+
└── NewComponent.test.tsx (CREATE)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### <repo-2>
|
|
170
|
+
```
|
|
171
|
+
src/
|
|
172
|
+
├── controllers/
|
|
173
|
+
│ └── NewController.ts (CREATE)
|
|
174
|
+
└── tests/
|
|
175
|
+
└── NewController.test.ts (CREATE)
|
|
176
|
+
```
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### 6. APIs and Contracts
|
|
180
|
+
|
|
181
|
+
```markdown
|
|
182
|
+
## APIs and Contracts
|
|
183
|
+
|
|
184
|
+
### New Endpoints
|
|
185
|
+
|
|
186
|
+
#### POST /api/resource
|
|
187
|
+
**Request**:
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"field1": "string",
|
|
191
|
+
"field2": "number"
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Response**:
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"id": "string",
|
|
199
|
+
"status": "string"
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Modified Endpoints
|
|
204
|
+
|
|
205
|
+
#### GET /api/resource/:id
|
|
206
|
+
**Changes**: [What changes]
|
|
207
|
+
**Breaking Change**: Yes / No
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 7. Testing Strategy
|
|
211
|
+
|
|
212
|
+
```markdown
|
|
213
|
+
## Testing Strategy
|
|
214
|
+
|
|
215
|
+
### Unit Tests
|
|
216
|
+
- **<repo-1>**: [Components/functions to test]
|
|
217
|
+
- **<repo-2>**: [Components/functions to test]
|
|
218
|
+
|
|
219
|
+
### Integration Tests
|
|
220
|
+
- **Scenario 1**: [Description and involved repos]
|
|
221
|
+
- **Scenario 2**: [Description and involved repos]
|
|
222
|
+
|
|
223
|
+
### E2E Tests (if applicable)
|
|
224
|
+
- **Flow 1**: [Description]
|
|
225
|
+
- **Flow 2**: [Description]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### 8. Technical Risks
|
|
229
|
+
|
|
230
|
+
```markdown
|
|
231
|
+
## Technical Risks
|
|
232
|
+
|
|
233
|
+
### Risk 1: [Description]
|
|
234
|
+
- **Impact**: High / Medium / Low
|
|
235
|
+
- **Probability**: High / Medium / Low
|
|
236
|
+
- **Mitigation**: [How to mitigate]
|
|
237
|
+
- **Plan B**: [Alternative if it occurs]
|
|
238
|
+
|
|
239
|
+
### Risk 2: [Description]
|
|
240
|
+
[Same format as above]
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### 9. Implementation Checklist
|
|
244
|
+
|
|
245
|
+
```markdown
|
|
246
|
+
## Implementation Checklist
|
|
247
|
+
|
|
248
|
+
### Phase 1
|
|
249
|
+
- [ ] Task 1.1
|
|
250
|
+
- [ ] Task 1.2
|
|
251
|
+
- [ ] Phase 1 Tests
|
|
252
|
+
|
|
253
|
+
### Phase 2
|
|
254
|
+
- [ ] Task 2.1
|
|
255
|
+
- [ ] Task 2.2
|
|
256
|
+
- [ ] Phase 2 Tests
|
|
257
|
+
|
|
258
|
+
### Phase 3
|
|
259
|
+
- [ ] Task 3.1
|
|
260
|
+
- [ ] Task 3.2
|
|
261
|
+
- [ ] Phase 3 Tests
|
|
262
|
+
|
|
263
|
+
### Finalization
|
|
264
|
+
- [ ] Documentation updated
|
|
265
|
+
- [ ] Code review
|
|
266
|
+
- [ ] Integration tests
|
|
267
|
+
- [ ] PR created
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## 📄 Saving the Plan
|
|
271
|
+
|
|
272
|
+
Save it in `./.sessions/<ISSUE-ID>/plan.md`
|
|
273
|
+
|
|
274
|
+
## 🔍 Review
|
|
275
|
+
|
|
276
|
+
Review the plan checking:
|
|
277
|
+
- All tasks are clear and executable
|
|
278
|
+
- Dependencies between tasks are identified
|
|
279
|
+
- Estimates are realistic
|
|
280
|
+
- Risks have been considered
|
|
281
|
+
- Testing strategy is adequate
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
**Provided arguments**:
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
#$ARGUMENTS
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## 🎯 Next Step
|
|
294
|
+
|
|
295
|
+
After plan approval:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
/work
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
This command will start executing the first work unit of the plan.
|