@thatix.io/context-first-agents-cli 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +171 -2
  2. package/package.json +7 -3
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,6 +100,37 @@ 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):**
120
+
121
+ 1. Write/approve a spec (a `.md` with the requirements, or an issue in your tracker).
122
+ 2. Run **`/orchestrate <ISSUE-ID or path/to/spec.md>`**. The command will:
123
+ - classify complexity and **show you the agent graph**,
124
+ - wait for your **approval**,
125
+ - spawn the ephemeral agents wave by wave (implementers in parallel, then
126
+ integrator/tester, plus a reviewer if risky),
127
+ - write everything to `.sessions/<ISSUE-ID>/` and summarize the result.
128
+ 3. Review the summary. If the reviewer flagged blockers, fix and re-run the affected part.
129
+ 4. Open the PR(s) from the per-repo worktrees.
130
+
131
+ `/plan` and `/work` from the classic flow can still exist as manual escape hatches — but
132
+ for most tasks `/orchestrate` replaces `start → plan → work`.
133
+
57
134
  ## Commands (Node — scaffold/management only)
58
135
 
59
136
  | Command | Purpose |
@@ -113,6 +190,98 @@ additive fields). See `templates/orchestrator/context-manifest.example.json`.
113
190
  tester) · `complex` (medium + adversarial reviewer). A spec may force it via
114
191
  `complexity:` frontmatter. Small tasks stay small by design.
115
192
 
193
+ ---
194
+
195
+ ## End-to-end example
196
+
197
+ Assume this manifest (two code repos + a specs repo):
198
+
199
+ ```jsonc
200
+ {
201
+ "project": "example",
202
+ "repositories": [
203
+ { "id": "metaspecs", "role": "metaspecs", "hints": ["spec", "adr"] },
204
+ { "id": "service-a", "role": "service", "hints": ["api", "backend"],
205
+ "context": ["../metaspecs/specs/api.md"], "testCommand": "npm test" },
206
+ { "id": "client-b", "role": "application", "hints": ["ui", "client"],
207
+ "context": ["../metaspecs/specs/design.md"], "testCommand": "npm test" }
208
+ ],
209
+ "orchestration": {
210
+ "riskSignals": ["migration", "payment", "security"],
211
+ "indexes": ["../metaspecs/specs/index.md"],
212
+ "parallelism": { "maxWorkers": 8, "maxPerRepository": 2 }
213
+ }
214
+ }
215
+ ```
216
+
217
+ ### 1. Write a spec — `.sessions/ISSUE-42/spec.md`
218
+
219
+ ```markdown
220
+ ---
221
+ id: ISSUE-42
222
+ ---
223
+ # Add a `discountRate` field to the order
224
+
225
+ Expose `discountRate` in the **service-a** order API and show it on the
226
+ order screen in the **client-b** UI.
227
+ ```
228
+
229
+ ### 2. Run the command
230
+
231
+ ```
232
+ /orchestrate .sessions/ISSUE-42/spec.md
233
+ ```
234
+
235
+ ### 3. What the orchestrator does
236
+
237
+ **Classification** — the spec text mentions `service-a`/`api` and `client-b`/`ui` →
238
+ **repoHits = 2**, no risk signals → **medium**.
239
+
240
+ **Proposed graph (shown for approval):**
241
+
242
+ | id | archetype | repository | dependsOn |
243
+ |----|-----------|------------|-----------|
244
+ | W1 | implementer | service-a | — |
245
+ | W2 | implementer | client-b | — |
246
+ | W3 | integrator | (session) | W1, W2 |
247
+ | W4 | tester | (session) | W3 |
248
+
249
+ **Execution** — after you approve:
250
+
251
+ - **Wave 1 (parallel):** W1 and W2 are spawned as subagents in one shot. Each gets ONLY
252
+ its context contract — e.g. W1 may read `../metaspecs/specs/index.md` +
253
+ `../metaspecs/specs/api.md`, may write only in `service-a`'s worktree, and is told not
254
+ to assume anything outside the spec.
255
+ - **Wave 2:** W3 (integrator) checks that the API field W1 added matches what W2 consumes
256
+ (name, type, nullability).
257
+ - **Wave 3:** W4 (tester) runs `npm test` in each impacted repo and maps the acceptance
258
+ criterion ("field visible on the order screen") to a check.
259
+
260
+ **Result** — written to `.sessions/ISSUE-42/`:
261
+
262
+ ```
263
+ .sessions/ISSUE-42/
264
+ ├── spec.md
265
+ ├── execution-plan.md # the DAG above
266
+ └── workers/
267
+ ├── agent-w1.md # contract + report (service-a)
268
+ ├── agent-w2.md # contract + report (client-b)
269
+ ├── agent-w3.md # integration findings
270
+ └── agent-w4.md # test results
271
+ ```
272
+
273
+ Each report follows a fixed shape: `summary / changes / evidence / tests / unresolved /
274
+ confidence`.
275
+
276
+ ### If the task were risky
277
+
278
+ Change the spec to *"…behind a **payment** flow with a DB **migration**"*. Now
279
+ **risks = 2** → **complex**, and the graph gains a **W5 reviewer** (dependsOn integrator)
280
+ that adversarially checks business rules, security, and the migration's reversibility
281
+ before you ship. You didn't have to remember to add it — the `riskSignals` did.
282
+
283
+ ---
284
+
116
285
  ## Design rules
117
286
 
118
287
  - **No catalog of domain agents.** Expertise comes from selected context, not personas.
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@thatix.io/context-first-agents-cli",
3
- "version": "0.1.0",
4
- "publishConfig": { "access": "public" },
3
+ "version": "0.1.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
5
7
  "description": "Evolution of context-first-cli: manage the Context-First methodology across any project AND orchestrate dynamic, ephemeral AI agents from specs. All agent orchestration lives in .md command templates; the Node layer only scaffolds and manages.",
6
8
  "type": "module",
7
9
  "main": "dist/index.js",
@@ -37,7 +39,9 @@
37
39
  ],
38
40
  "author": "Thiago Abreu <thiagoabreu.dev>",
39
41
  "license": "MIT",
40
- "engines": { "node": ">=18.0.0" },
42
+ "engines": {
43
+ "node": ">=18.0.0"
44
+ },
41
45
  "dependencies": {
42
46
  "chalk": "^5.6.2",
43
47
  "commander": "^14.0.2",