@nathapp/nax 0.51.2 → 0.52.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/CHANGELOG.md +1304 -88
- package/README.md +98 -987
- package/dist/nax.js +886 -860
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -12,1077 +12,188 @@ npm install -g @nathapp/nax
|
|
|
12
12
|
bun install -g @nathapp/nax
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
Requires: Node 18+ or Bun 1.0+. Git must be initialized.
|
|
16
|
+
|
|
15
17
|
## Quick Start
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
cd your-project
|
|
19
|
-
nax init
|
|
20
|
-
nax features create my-feature
|
|
21
|
-
|
|
22
|
-
# Option A: write prd.json manually, then run
|
|
23
|
-
nax run -f my-feature
|
|
21
|
+
nax init # Create .nax/ structure
|
|
22
|
+
nax features create my-feature # Scaffold a feature
|
|
24
23
|
|
|
25
|
-
#
|
|
24
|
+
# Write your spec, then plan + run
|
|
26
25
|
nax plan -f my-feature --from spec.md
|
|
27
26
|
nax run -f my-feature
|
|
28
27
|
|
|
29
|
-
#
|
|
28
|
+
# Or in one shot (no interactive Q&A)
|
|
30
29
|
nax run -f my-feature --plan --from spec.md
|
|
31
30
|
```
|
|
32
31
|
|
|
32
|
+
See [docs/](docs/) for full guides on configuration, test strategies, monorepo setup, and more.
|
|
33
|
+
|
|
33
34
|
## How It Works
|
|
34
35
|
|
|
35
36
|
```
|
|
36
|
-
(plan →) acceptance setup → route → execute → verify →
|
|
37
|
+
(plan →) acceptance setup → route → execute → verify → review → escalate → loop → regression gate → acceptance
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
1. **Plan** *(optional)* —
|
|
40
|
-
2. **Acceptance setup**
|
|
41
|
-
3. **Route** —
|
|
42
|
-
4. **Context** —
|
|
43
|
-
5. **Execute** —
|
|
44
|
-
6. **Verify** —
|
|
45
|
-
7. **Review** — lint + typecheck;
|
|
46
|
-
8. **Escalate** —
|
|
47
|
-
9. **Loop** —
|
|
48
|
-
10. **Regression gate** —
|
|
49
|
-
11. **Acceptance**
|
|
40
|
+
1. **Plan** *(optional)* — Generate `prd.json` from a spec file using an LLM
|
|
41
|
+
2. **Acceptance setup** — Generate acceptance tests; assert RED before implementation
|
|
42
|
+
3. **Route** — Classify story complexity and select model tier (fast → balanced → powerful)
|
|
43
|
+
4. **Context** — Gather relevant code, tests, and project standards per story
|
|
44
|
+
5. **Execute** — Run agent session (Claude Code, Codex, Gemini CLI, or ACP)
|
|
45
|
+
6. **Verify** — Run scoped tests; rectify on failure before escalating
|
|
46
|
+
7. **Review** — Run lint + typecheck; autofix before escalating
|
|
47
|
+
8. **Escalate** — On repeated failure, retry with a higher model tier
|
|
48
|
+
9. **Loop** — Repeat steps 3–8 per story until all pass or a cost/iteration limit is hit
|
|
49
|
+
10. **Regression gate** — Run full test suite after all stories pass
|
|
50
|
+
11. **Acceptance** — Run acceptance tests against the completed feature
|
|
50
51
|
|
|
51
52
|
---
|
|
52
53
|
|
|
53
54
|
## CLI Reference
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Initialize nax in your project
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
nax
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.nax
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
**Monorepo — scaffold a package:**
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
nax init --package packages/api
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Creates `.nax/mono/packages/api/context.md` for per-package agent context.
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
### `nax features create <name>`
|
|
81
|
-
|
|
82
|
-
Scaffold a new feature.
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
nax features create user-auth
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Creates `.nax/features/user-auth/spec.md` — fill in the overview, user stories, and acceptance criteria, then run `nax plan` to generate `prd.json`.
|
|
89
|
-
|
|
90
|
-
### `nax features list`
|
|
91
|
-
|
|
92
|
-
List all features and their story completion status.
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
nax features list
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
### `nax plan -f <name> --from <spec>`
|
|
101
|
-
|
|
102
|
-
Generate a `prd.json` from a spec file using an LLM. Replaces the deprecated `nax analyze`.
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
nax plan -f my-feature --from spec.md
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**Flags:**
|
|
109
|
-
|
|
110
|
-
| Flag | Description |
|
|
111
|
-
|:-----|:------------|
|
|
112
|
-
| `-f, --feature <name>` | Feature name (required) |
|
|
113
|
-
| `--from <spec-path>` | Path to spec file (required) |
|
|
114
|
-
| `--auto` / `--one-shot` | Skip interactive Q&A — single LLM call, no back-and-forth |
|
|
115
|
-
| `-b, --branch <branch>` | Override default branch name |
|
|
116
|
-
| `-d, --dir <path>` | Project directory |
|
|
117
|
-
|
|
118
|
-
**Interactive vs one-shot:**
|
|
119
|
-
- Default (no flag): interactive planning session — nax asks clarifying questions, refines the plan iteratively
|
|
120
|
-
- `--auto` / `--one-shot`: single LLM call, faster but less precise
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
### `nax analyze` *(deprecated)*
|
|
125
|
-
|
|
126
|
-
> ⚠️ **Deprecated.** Use `nax plan` instead. `nax analyze` remains available for backward compatibility but will be removed in a future version.
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
### `nax run -f <name>`
|
|
131
|
-
|
|
132
|
-
Execute the orchestration loop for a feature.
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
nax run -f my-feature
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**Flags:**
|
|
139
|
-
|
|
140
|
-
| Flag | Description |
|
|
141
|
-
|:-----|:------------|
|
|
142
|
-
| `-f, --feature <name>` | Feature name |
|
|
143
|
-
| `-a, --agent <name>` | Force a specific agent (`claude`, `opencode`, `codex`, etc.). Only applies when `agent.protocol = "cli"` — ignored when using ACP protocol. |
|
|
144
|
-
| `--plan` | Run plan phase first (requires `--from`) |
|
|
145
|
-
| `--from <spec-path>` | Spec file for `--plan` |
|
|
146
|
-
| `--one-shot` | Skip interactive Q&A during planning (ACP only) |
|
|
147
|
-
| `--force` | Overwrite existing `prd.json` when using `--plan` |
|
|
148
|
-
| `--parallel <n>` | Max parallel sessions (`0` = auto based on CPU cores; omit = sequential) |
|
|
149
|
-
| `--dry-run` | Preview story routing without running agents |
|
|
150
|
-
| `--headless` | Non-interactive output (structured logs, no TUI) |
|
|
151
|
-
| `--verbose` | Debug-level logging |
|
|
152
|
-
| `--quiet` | Warnings and errors only |
|
|
153
|
-
| `--silent` | Errors only |
|
|
154
|
-
| `--json` | Raw JSONL output to stdout (for scripting) |
|
|
155
|
-
| `--skip-precheck` | Skip precheck validations (advanced users only) |
|
|
156
|
-
| `--no-context` | Disable context builder (skip file context in prompts) |
|
|
157
|
-
| `--no-batch` | Execute all stories individually (disable batching) |
|
|
158
|
-
| `-d, --dir <path>` | Working directory |
|
|
159
|
-
|
|
160
|
-
**Examples:**
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# Preview what would run (no agents spawned)
|
|
164
|
-
nax run -f user-auth --dry-run
|
|
165
|
-
|
|
166
|
-
# Plan from spec then run — one command
|
|
167
|
-
nax run -f user-auth --plan --from spec.md
|
|
168
|
-
|
|
169
|
-
# Run with parallel execution (auto concurrency)
|
|
170
|
-
nax run -f user-auth --parallel 0
|
|
171
|
-
|
|
172
|
-
# Run with up to 3 parallel worktree sessions
|
|
173
|
-
nax run -f user-auth --parallel 3
|
|
174
|
-
|
|
175
|
-
# Force a specific agent
|
|
176
|
-
nax run -f user-auth --agent opencode
|
|
177
|
-
|
|
178
|
-
# Run in CI/CD (structured output)
|
|
179
|
-
nax run -f user-auth --headless
|
|
180
|
-
|
|
181
|
-
# Raw JSONL for scripting
|
|
182
|
-
nax run -f user-auth --json
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
### `nax precheck -f <name>`
|
|
188
|
-
|
|
189
|
-
Validate your project is ready to run — checks git, PRD, CLI tools, deps, test/lint/typecheck scripts.
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
nax precheck -f my-feature
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
Run this before `nax run` to catch configuration issues early.
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
### `nax status -f <name>`
|
|
200
|
-
|
|
201
|
-
Show live run progress — stories passed, failed, current story, cost so far.
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
nax status -f my-feature
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
### `nax logs`
|
|
210
|
-
|
|
211
|
-
Stream logs from the current or last run. Run from your project directory.
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
# List all recorded runs
|
|
215
|
-
nax logs --list
|
|
216
|
-
|
|
217
|
-
# Follow current run in real-time
|
|
218
|
-
nax logs --follow
|
|
219
|
-
|
|
220
|
-
# Filter by story
|
|
221
|
-
nax logs --story US-003
|
|
222
|
-
|
|
223
|
-
# Filter by log level
|
|
224
|
-
nax logs --level error
|
|
225
|
-
|
|
226
|
-
# Select a specific run by ID
|
|
227
|
-
nax logs --run <runId>
|
|
228
|
-
|
|
229
|
-
# Raw JSONL output (for scripting)
|
|
230
|
-
nax logs --json
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
---
|
|
234
|
-
|
|
235
|
-
### `nax diagnose -f <name>`
|
|
236
|
-
|
|
237
|
-
Analyze a failed run and suggest fixes. No LLM — pure pattern matching on PRD state, git log, and events.
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
nax diagnose -f my-feature
|
|
241
|
-
|
|
242
|
-
# JSON output for scripting
|
|
243
|
-
nax diagnose -f my-feature --json
|
|
244
|
-
|
|
245
|
-
# Verbose (per-story tier/strategy detail)
|
|
246
|
-
nax diagnose -f my-feature --verbose
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
Output sections:
|
|
250
|
-
- **Run Summary** — status, stories passed/failed/pending, total cost
|
|
251
|
-
- **Story Breakdown** — per-story pattern classification
|
|
252
|
-
- **Failure Analysis** — pattern name, symptom, recommended fix
|
|
253
|
-
- **Lock Check** — detects stale `nax.lock`
|
|
254
|
-
- **Recommendations** — ordered next actions
|
|
56
|
+
| Command | Description |
|
|
57
|
+
|:--------|:-----------|
|
|
58
|
+
| [`nax init`](docs/guides/cli-reference.md#nax-init) | Initialize nax in your project |
|
|
59
|
+
| [`nax features create`](docs/guides/cli-reference.md#nax-features-create-name) | Scaffold a new feature directory |
|
|
60
|
+
| [`nax features list`](docs/guides/cli-reference.md#nax-features-list) | List all features and story status |
|
|
61
|
+
| [`nax plan`](docs/guides/cli-reference.md#nax-plan---from-spec) | Generate `prd.json` from a spec file |
|
|
62
|
+
| [`nax run`](docs/guides/cli-reference.md#nax-run) | Execute the orchestration loop |
|
|
63
|
+
| [`nax precheck`](docs/guides/cli-reference.md#nax-precheck) | Validate project readiness |
|
|
64
|
+
| [`nax status`](docs/guides/cli-reference.md#nax-status) | Show live run progress |
|
|
65
|
+
| [`nax logs`](docs/guides/cli-reference.md#nax-logs) | Stream or query run logs |
|
|
66
|
+
| [`nax diagnose`](docs/guides/cli-reference.md#nax-diagnose) | Analyze failures, suggest fixes |
|
|
67
|
+
| [`nax generate`](docs/guides/cli-reference.md#nax-generate) | Generate `.nax/` files for all packages in a monorepo |
|
|
68
|
+
| [`nax prompts`](docs/guides/cli-reference.md#nax-prompts) | Print prompt snapshots for debugging |
|
|
69
|
+
| [`nax runs`](docs/guides/cli-reference.md#nax-runs) | List recorded run metadata |
|
|
70
|
+
| [`nax config`](docs/guides/cli-reference.md#nax-config) | Show/validate configuration |
|
|
255
71
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
| Pattern | Symptom | Fix |
|
|
259
|
-
|:--------|:--------|:----|
|
|
260
|
-
| `GREENFIELD_TDD` | No source files exist yet | Use `test-after` or bootstrap files first |
|
|
261
|
-
| `MAX_TIERS_EXHAUSTED` | All model tiers tried | Split story into smaller sub-stories |
|
|
262
|
-
| `ENVIRONMENTAL` | Build/dep errors | Fix precheck issues before re-running |
|
|
263
|
-
| `LOCK_STALE` | `nax.lock` blocking | Shown automatically with `rm nax.lock` |
|
|
264
|
-
| `AUTO_RECOVERED` | nax self-healed | No action needed |
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
### `nax generate`
|
|
269
|
-
|
|
270
|
-
Generate agent config files from `.nax/context.md`. Supports Claude Code, OpenCode, Codex, Cursor, Windsurf, Aider, and Gemini.
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
nax generate
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
**Flags:**
|
|
277
|
-
|
|
278
|
-
| Flag | Description |
|
|
279
|
-
|:-----|:------------|
|
|
280
|
-
| `-c, --context <path>` | Context file path (default: `.nax/context.md`) |
|
|
281
|
-
| `-o, --output <dir>` | Output directory (default: project root) |
|
|
282
|
-
| `-a, --agent <name>` | Generate for a specific agent only (`claude`, `opencode`, `cursor`, `windsurf`, `aider`, `codex`, `gemini`) |
|
|
283
|
-
| `--dry-run` | Preview without writing files |
|
|
284
|
-
| `--no-auto-inject` | Disable auto-injection of project metadata |
|
|
285
|
-
| `--package <dir>` | Generate for a specific monorepo package (e.g. `packages/api`) |
|
|
286
|
-
| `--all-packages` | Generate for all discovered packages |
|
|
287
|
-
|
|
288
|
-
**What it generates:**
|
|
289
|
-
|
|
290
|
-
| Agent | File |
|
|
291
|
-
|:------|:-----|
|
|
292
|
-
| Claude Code | `CLAUDE.md` |
|
|
293
|
-
| OpenCode | `AGENTS.md` |
|
|
294
|
-
| Codex | `AGENTS.md` |
|
|
295
|
-
| Cursor | `.cursorrules` |
|
|
296
|
-
| Windsurf | `.windsurfrules` |
|
|
297
|
-
| Aider | `.aider.md` |
|
|
298
|
-
| Gemini | `GEMINI.md` |
|
|
299
|
-
|
|
300
|
-
**Workflow:**
|
|
301
|
-
|
|
302
|
-
1. Create `.nax/context.md` — describe your project's architecture, conventions, and coding standards
|
|
303
|
-
2. Run `nax generate` — writes agent config files to the project root (and per-package if configured)
|
|
304
|
-
3. Commit the generated files — your agents will automatically pick them up
|
|
305
|
-
|
|
306
|
-
**Monorepo (per-package):**
|
|
307
|
-
|
|
308
|
-
```bash
|
|
309
|
-
# Generate CLAUDE.md for a single package
|
|
310
|
-
nax generate --package packages/api
|
|
311
|
-
|
|
312
|
-
# Generate for all packages (auto-discovers workspace packages)
|
|
313
|
-
nax generate --all-packages
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
Each package can have its own context file at `.nax/mono/<package>/context.md` for package-specific agent instructions (created via `nax init --package <package>`).
|
|
317
|
-
|
|
318
|
-
---
|
|
319
|
-
|
|
320
|
-
### `nax prompts -f <name>`
|
|
321
|
-
|
|
322
|
-
Assemble and display the prompt that would be sent to the agent for each story role.
|
|
323
|
-
|
|
324
|
-
```bash
|
|
325
|
-
nax prompts -f my-feature
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
**Flags:**
|
|
329
|
-
|
|
330
|
-
| Flag | Description |
|
|
331
|
-
|:-----|:------------|
|
|
332
|
-
| `--init` | Export default role templates to `.nax/templates/` for customization |
|
|
333
|
-
| `--role <role>` | Show prompt for a specific role (`implementer`, `test-writer`, `verifier`, `tdd-simple`) |
|
|
334
|
-
|
|
335
|
-
After running `--init`, edit the templates and nax will use them automatically via `prompts.overrides` config.
|
|
336
|
-
|
|
337
|
-
---
|
|
338
|
-
|
|
339
|
-
### `nax unlock`
|
|
340
|
-
|
|
341
|
-
Release a stale `nax.lock` from a crashed process.
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
nax unlock -f my-feature
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
---
|
|
348
|
-
|
|
349
|
-
### `nax runs`
|
|
350
|
-
|
|
351
|
-
Show all registered runs from the central registry (`~/.nax/runs/`).
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
nax runs
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
---
|
|
358
|
-
|
|
359
|
-
### `nax agents`
|
|
360
|
-
|
|
361
|
-
List installed coding agents and which models they support.
|
|
362
|
-
|
|
363
|
-
```bash
|
|
364
|
-
nax agents
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
---
|
|
368
|
-
|
|
369
|
-
### `nax config`
|
|
370
|
-
|
|
371
|
-
Display the effective merged configuration (global + project layers).
|
|
372
|
-
|
|
373
|
-
```bash
|
|
374
|
-
# Show merged config
|
|
375
|
-
nax config
|
|
376
|
-
|
|
377
|
-
# Show with field descriptions
|
|
378
|
-
nax config --explain
|
|
379
|
-
|
|
380
|
-
# Show only fields where project overrides global
|
|
381
|
-
nax config --diff
|
|
382
|
-
```
|
|
72
|
+
For full flag details, see the [CLI Reference](docs/guides/cli-reference.md).
|
|
383
73
|
|
|
384
74
|
---
|
|
385
75
|
|
|
386
76
|
## Configuration
|
|
387
77
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
| File | Scope |
|
|
391
|
-
|:-----|:------|
|
|
392
|
-
| `~/.nax/config.json` | Global (all projects) |
|
|
393
|
-
| `.nax/config.json` | Project-level override |
|
|
394
|
-
|
|
395
|
-
**Key options:**
|
|
78
|
+
`.nax/config.json` is the project-level config. Key fields:
|
|
396
79
|
|
|
397
80
|
```json
|
|
398
81
|
{
|
|
399
82
|
"execution": {
|
|
400
|
-
"
|
|
401
|
-
"
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
"strategy": "auto"
|
|
83
|
+
"testStrategy": "three-session-tdd", // How to write tests (see Test Strategies)
|
|
84
|
+
"maxIterations": 5,
|
|
85
|
+
"modelTier": "balanced", // "fast" | "balanced" | "powerful"
|
|
86
|
+
"permissionProfile": "unrestricted" // "unrestricted" | "safe" | "scoped"
|
|
405
87
|
},
|
|
406
88
|
"quality": {
|
|
407
89
|
"commands": {
|
|
408
|
-
"test": "bun test test
|
|
409
|
-
"
|
|
410
|
-
"
|
|
411
|
-
"typecheck": "bun x tsc --noEmit",
|
|
412
|
-
"lintFix": "bun x biome check --fix src/",
|
|
413
|
-
"formatFix": "bun x biome format --write src/"
|
|
90
|
+
"test": "bun test", // Root test command
|
|
91
|
+
"lint": "bun lint", // Optional linter
|
|
92
|
+
"typecheck": "bun typecheck" // Optional type checker
|
|
414
93
|
}
|
|
94
|
+
},
|
|
95
|
+
"hooks": {
|
|
96
|
+
"onComplete": "npm run build" // Fire after a feature completes
|
|
415
97
|
}
|
|
416
98
|
}
|
|
417
99
|
```
|
|
418
100
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
Review commands (`lint`, `typecheck`) are executed directly via `Bun.spawn` — **not** through a shell. This means shell operators like `&&`, `||`, `;`, and `|` are passed as literal arguments and will not work as expected.
|
|
422
|
-
|
|
423
|
-
**❌ This will NOT work:**
|
|
424
|
-
```json
|
|
425
|
-
"typecheck": "bun run build && bun run typecheck"
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
**✅ Workaround — wrap in a `package.json` script:**
|
|
429
|
-
```json
|
|
430
|
-
// package.json
|
|
431
|
-
"scripts": {
|
|
432
|
-
"build-and-check": "bun run build && bun run typecheck"
|
|
433
|
-
}
|
|
434
|
-
```
|
|
435
|
-
```json
|
|
436
|
-
// .nax/config.json
|
|
437
|
-
"quality": {
|
|
438
|
-
"commands": {
|
|
439
|
-
"typecheck": "bun run build-and-check"
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
This limitation applies to all `quality.commands` entries (`test`, `lint`, `typecheck`, `lintFix`, `formatFix`).
|
|
445
|
-
|
|
446
|
-
---
|
|
447
|
-
|
|
448
|
-
### Scoped Test Command
|
|
449
|
-
|
|
450
|
-
By default, nax runs scoped tests (per-story verification) by appending discovered test files to the `test` command. This can produce incorrect commands when the base command includes a directory path (e.g. `bun test test/`), since the path is not replaced — it is appended alongside it.
|
|
451
|
-
|
|
452
|
-
Use `testScoped` to define the exact scoped test command with a `{{files}}` placeholder:
|
|
453
|
-
|
|
454
|
-
| Runner | `test` | `testScoped` |
|
|
455
|
-
|:-------|:-------|:-------------|
|
|
456
|
-
| Bun | `bun test test/ --timeout=60000` | `bun test --timeout=60000 {{files}}` |
|
|
457
|
-
| Jest | `npx jest` | `npx jest -- {{files}}` |
|
|
458
|
-
| pytest | `pytest tests/` | `pytest {{files}}` |
|
|
459
|
-
| cargo | `cargo test` | `cargo test {{files}}` |
|
|
460
|
-
| go | `go test ./...` | `go test {{files}}` |
|
|
461
|
-
|
|
462
|
-
If `testScoped` is not configured, nax falls back to a heuristic that replaces the last path-like token in the `test` command. **Recommended:** always configure `testScoped` explicitly to avoid surprises.
|
|
463
|
-
|
|
464
|
-
**TDD strategy options:** <a name="tdd-strategy-options"></a>
|
|
465
|
-
|
|
466
|
-
| Value | Behaviour |
|
|
467
|
-
|:------|:----------|
|
|
468
|
-
| `auto` | nax decides based on complexity and tags — simple→`tdd-simple`, security/public-api→`three-session-tdd`, else→`three-session-tdd-lite` |
|
|
469
|
-
| `strict` | Always use `three-session-tdd` (strictest — all stories) |
|
|
470
|
-
| `lite` | Always use `three-session-tdd-lite` |
|
|
471
|
-
| `simple` | Always use `tdd-simple` (1 session) |
|
|
472
|
-
| `off` | No TDD — tests written after implementation (`test-after`) |
|
|
473
|
-
|
|
474
|
-
---
|
|
475
|
-
|
|
476
|
-
## Customization
|
|
477
|
-
|
|
478
|
-
### Prompt Customization
|
|
479
|
-
|
|
480
|
-
Customize the instructions sent to each agent role for your project's specific needs. Override prompts to enforce coding style, domain knowledge, or architectural constraints.
|
|
481
|
-
|
|
482
|
-
**Quick start:**
|
|
483
|
-
|
|
484
|
-
```bash
|
|
485
|
-
nax prompts --init # Create default templates
|
|
486
|
-
# Edit .nax/templates/*.md
|
|
487
|
-
nax prompts --export test-writer # Preview a role's prompt
|
|
488
|
-
nax run -f my-feature # Uses your custom prompts
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
**Full guide:** See [Prompt Customization Guide](docs/guides/prompt-customization.md) for detailed instructions, role reference, and best practices.
|
|
492
|
-
|
|
493
|
-
---
|
|
494
|
-
|
|
495
|
-
## Test Strategies
|
|
496
|
-
|
|
497
|
-
nax selects a test strategy per story based on complexity and tags:
|
|
498
|
-
|
|
499
|
-
| Strategy | Sessions | When | Description |
|
|
500
|
-
|:---------|:---------|:-----|:------------|
|
|
501
|
-
| `no-test` | 1 | Config, docs, CI, pure refactors with no behavior change | No tests written or run — requires `noTestJustification` in prd.json |
|
|
502
|
-
| `test-after` | 1 | Refactors, deletions | Single session, tests written after implementation |
|
|
503
|
-
| `tdd-simple` | 1 | Simple stories | Single session with TDD prompt (red-green-refactor) |
|
|
504
|
-
| `three-session-tdd-lite` | 3 | Medium stories | Three sessions, relaxed isolation rules |
|
|
505
|
-
| `three-session-tdd` | 3 | Complex/security stories | Three sessions, strict file isolation |
|
|
506
|
-
|
|
507
|
-
Configure the default TDD behavior in `.nax/config.json`:
|
|
508
|
-
|
|
509
|
-
```json
|
|
510
|
-
{
|
|
511
|
-
"tdd": {
|
|
512
|
-
"strategy": "auto"
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
See [TDD strategy options](#tdd-strategy-options) for all values.
|
|
101
|
+
See [Configuration Guide](docs/guides/configuration.md) for the full schema.
|
|
518
102
|
|
|
519
103
|
---
|
|
520
104
|
|
|
521
|
-
##
|
|
522
|
-
|
|
523
|
-
For complex or security-critical stories, nax enforces strict role separation:
|
|
105
|
+
## Key Concepts
|
|
524
106
|
|
|
525
|
-
|
|
526
|
-
|:--------|:-----|:--------------|
|
|
527
|
-
| 1 | Test Writer | Test files only — no source code |
|
|
528
|
-
| 2 | Implementer | Source files only — no test changes |
|
|
529
|
-
| 3 | Verifier | Reviews quality, auto-approves or flags |
|
|
530
|
-
|
|
531
|
-
Isolation is verified automatically via `git diff` between sessions. Violations cause an immediate failure.
|
|
532
|
-
|
|
533
|
-
---
|
|
107
|
+
### Test Strategies
|
|
534
108
|
|
|
535
|
-
|
|
109
|
+
nax supports four TDD strategies. Select per-feature in `config.json`:
|
|
536
110
|
|
|
537
|
-
|
|
111
|
+
| Strategy | Sessions | When to use |
|
|
112
|
+
|:---------|:---------|:------------|
|
|
113
|
+
| `three-session-tdd` | 3 | Strict TDD — red/green/refactor in separate sessions |
|
|
114
|
+
| `three-session-tdd-lite` | 3 | Flexible TDD — test-writer may add minimal stubs |
|
|
115
|
+
| `tdd-simple` | 1 | Simple changes — single session, implementer writes tests |
|
|
116
|
+
| `test-after` | 1 | Legacy / exploratory — implement first, add tests after |
|
|
117
|
+
| `no-test` | 0 | Config-only, docs, CI, dependency bumps — requires justification |
|
|
538
118
|
|
|
539
|
-
|
|
119
|
+
See [Test Strategies Guide](docs/guides/test-strategies.md) for details.
|
|
540
120
|
|
|
541
|
-
###
|
|
121
|
+
### Story Decomposition
|
|
542
122
|
|
|
543
|
-
|
|
123
|
+
Stories over a complexity threshold are auto-decomposed into smaller sub-stories. Triggered by story size or `prd.json` analysis. Sub-stories run sequentially within the feature.
|
|
544
124
|
|
|
545
|
-
|
|
546
|
-
{
|
|
547
|
-
"quality": {
|
|
548
|
-
"testing": {
|
|
549
|
-
"hermetic": true,
|
|
550
|
-
"externalBoundaries": ["claude", "acpx", "redis", "grpc"],
|
|
551
|
-
"mockGuidance": "Use injectable deps for CLI spawning, ioredis-mock for Redis"
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
```
|
|
125
|
+
See [Story Decomposition Guide](docs/guides/decomposition.md).
|
|
556
126
|
|
|
557
|
-
|
|
558
|
-
|:------|:-----|:--------|:------------|
|
|
559
|
-
| `hermetic` | `boolean` | `true` | Inject hermetic test requirement into prompts. Set `false` to allow real external calls. |
|
|
560
|
-
| `externalBoundaries` | `string[]` | — | Project-specific CLI tools, clients, or services to mock (e.g. `["claude", "redis"]`). The AI uses this list to identify what to mock in your project. |
|
|
561
|
-
| `mockGuidance` | `string` | — | Project-specific mocking instructions injected verbatim into the prompt (e.g. which mock libraries to use). |
|
|
127
|
+
### Regression Gate
|
|
562
128
|
|
|
563
|
-
|
|
129
|
+
After all stories pass, nax runs the full test suite once. If it fails, it retries failed suites with a shorter timeout. If still failing after retries, the feature is marked as needing attention — nax does not block on a full-suite failure.
|
|
564
130
|
|
|
565
|
-
|
|
131
|
+
See [Regression Gate Guide](docs/guides/regression-gate.md).
|
|
566
132
|
|
|
567
|
-
|
|
133
|
+
### Parallel Execution
|
|
568
134
|
|
|
569
|
-
|
|
135
|
+
Stories are batched by compatibility (same model tier, similar complexity) and run in parallel within each batch. Use `--parallel <n>` to control concurrency. Sequential mode uses a deferred regression gate; parallel mode always runs regression at the end.
|
|
570
136
|
|
|
571
|
-
|
|
137
|
+
See [Parallel Execution Guide](docs/guides/parallel-execution.md).
|
|
572
138
|
|
|
573
|
-
|
|
139
|
+
### Monorepo Support
|
|
574
140
|
|
|
575
|
-
|
|
141
|
+
Per-package context files, per-package test commands, and per-story working directories are supported. Initialize with `nax init --package packages/api`. Package config files live at `.nax/mono/packages/<pkg>/config.json`.
|
|
576
142
|
|
|
577
|
-
|
|
143
|
+
See [Monorepo Guide](docs/guides/monorepo.md).
|
|
578
144
|
|
|
579
|
-
|
|
580
|
-
{
|
|
581
|
-
"decompose": {
|
|
582
|
-
"trigger": "auto",
|
|
583
|
-
"maxAcceptanceCriteria": 6,
|
|
584
|
-
"maxSubstories": 5,
|
|
585
|
-
"maxSubstoryComplexity": "medium",
|
|
586
|
-
"maxRetries": 2,
|
|
587
|
-
"model": "balanced"
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
```
|
|
145
|
+
### Hooks
|
|
591
146
|
|
|
592
|
-
|
|
147
|
+
Lifecycle hooks fire at key points (onFeatureStart, onAllStoriesComplete, onComplete, onFinalRegressionFail). Use them to trigger deployments, send notifications, or integrate with external systems.
|
|
593
148
|
|
|
594
|
-
|
|
595
|
-
|:------|:----------|
|
|
596
|
-
| `auto` | Decompose automatically — no confirmation prompt |
|
|
597
|
-
| `confirm` | Show interaction prompt — you approve, skip, or continue as-is |
|
|
598
|
-
| `disabled` | Never decompose — log a warning if story is oversized |
|
|
149
|
+
See [Hooks Guide](docs/guides/hooks.md).
|
|
599
150
|
|
|
600
|
-
|
|
151
|
+
### Plugins
|
|
601
152
|
|
|
602
|
-
|
|
153
|
+
Extensible plugin architecture for prompt optimization, custom routing, code review, and reporting. Plugins live in `.nax/plugins/` (project) or `~/.nax/plugins/` (global).
|
|
603
154
|
|
|
604
|
-
|
|
605
|
-
2. Post-decompose validators check overlap, coverage, complexity, and dependency ordering
|
|
606
|
-
3. The parent story is replaced in the PRD with the validated sub-stories
|
|
607
|
-
|
|
608
|
-
---
|
|
609
|
-
|
|
610
|
-
## Regression Gate
|
|
611
|
-
|
|
612
|
-
After all stories pass their individual verification, nax can run a deferred full-suite regression gate to catch cross-story regressions.
|
|
613
|
-
|
|
614
|
-
```json
|
|
615
|
-
{
|
|
616
|
-
"execution": {
|
|
617
|
-
"regressionGate": {
|
|
618
|
-
"mode": "deferred",
|
|
619
|
-
"acceptOnTimeout": true,
|
|
620
|
-
"maxRectificationAttempts": 2
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
```
|
|
625
|
-
|
|
626
|
-
| Mode | Behaviour |
|
|
627
|
-
|:-----|:----------|
|
|
628
|
-
| `disabled` | No regression gate |
|
|
629
|
-
| `per-story` | Full suite after each story — higher cost and slower if stories fail regression |
|
|
630
|
-
| `deferred` | Full suite once after all stories pass (recommended) — **default** |
|
|
631
|
-
|
|
632
|
-
If the regression gate detects failures, nax maps them to the responsible story via git blame and attempts automated rectification. If rectification fails, affected stories are marked as `regression-failed`.
|
|
633
|
-
|
|
634
|
-
> **Smart skip (v0.34.0):** When all stories used `three-session-tdd` or `three-session-tdd-lite` in sequential mode, each story already ran the full suite gate. nax will skip the redundant deferred regression in this case.
|
|
635
|
-
|
|
636
|
-
---
|
|
637
|
-
|
|
638
|
-
## Parallel Execution
|
|
639
|
-
|
|
640
|
-
nax can run multiple stories concurrently using git worktrees — each story gets an isolated worktree so agents don't step on each other.
|
|
641
|
-
|
|
642
|
-
```bash
|
|
643
|
-
# Auto concurrency (based on CPU cores)
|
|
644
|
-
nax run -f my-feature --parallel 0
|
|
645
|
-
|
|
646
|
-
# Fixed concurrency
|
|
647
|
-
nax run -f my-feature --parallel 3
|
|
648
|
-
```
|
|
649
|
-
|
|
650
|
-
**How it works:**
|
|
651
|
-
|
|
652
|
-
1. Stories are grouped by dependency order (dependent stories wait for their prerequisites)
|
|
653
|
-
2. Each batch of independent stories gets its own git worktree
|
|
654
|
-
3. Agent sessions run concurrently inside those worktrees
|
|
655
|
-
4. Once a batch completes, changes are merged back in dependency order
|
|
656
|
-
5. Merge conflicts are automatically rectified by re-running the conflicted story on the updated base
|
|
657
|
-
|
|
658
|
-
**Config:**
|
|
659
|
-
|
|
660
|
-
```json
|
|
661
|
-
{
|
|
662
|
-
"execution": {
|
|
663
|
-
"maxParallelSessions": 4
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
```
|
|
667
|
-
|
|
668
|
-
> Sequential mode (no `--parallel`) is the safe default. Use parallel for large feature sets with independent stories.
|
|
155
|
+
See [Plugins Guide](docs/guides/agents.md#plugins).
|
|
669
156
|
|
|
670
157
|
---
|
|
671
158
|
|
|
672
159
|
## Agents
|
|
673
160
|
|
|
674
|
-
nax supports multiple
|
|
675
|
-
|
|
676
|
-
> **CLI protocol** (`agent.protocol: "cli"`) is supported for Claude Code only and is being gradually deprecated in favour of ACP. New projects should use ACP.
|
|
677
|
-
|
|
678
|
-
```bash
|
|
679
|
-
# List installed agents and their capabilities
|
|
680
|
-
nax agents
|
|
681
|
-
```
|
|
161
|
+
nax supports multiple agent backends:
|
|
682
162
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
|
686
|
-
|
|
687
|
-
| `
|
|
688
|
-
|
|
|
689
|
-
|
|
690
|
-
nax connects to agents via [acpx](https://github.com/openclaw/acpx). All agents run as persistent ACP sessions — nax sends prompts and receives structured JSON-RPC responses including token counts and exact USD cost per session. For the full list of supported agents and their ACP startup commands, see the [acpx agent docs](https://github.com/openclaw/acpx#agents).
|
|
691
|
-
|
|
692
|
-
> **Note:** When `agent.protocol` is set to `"acp"`, the `--agent` CLI flag has no effect — all execution routes through the ACP adapter regardless of agent name.
|
|
693
|
-
|
|
694
|
-
> **Known issue — `acpx` ≤ 0.3.1:** The `--model` flag is not supported. Model selection via `execution.model` or per-package `model` overrides has no effect. As a temporary workaround, use the [nathapp-io/acpx](https://github.com/nathapp-io/acpx) fork which adds `--model` support. Upstream fix is tracked in [openclaw/acpx#49](https://github.com/openclaw/acpx/issues/49).
|
|
695
|
-
|
|
696
|
-
**Configuring agents:**
|
|
697
|
-
|
|
698
|
-
```json
|
|
699
|
-
{
|
|
700
|
-
"execution": {
|
|
701
|
-
"defaultAgent": "claude",
|
|
702
|
-
"protocol": "acp",
|
|
703
|
-
"fallbackOrder": ["claude", "codex", "opencode", "gemini"]
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
```
|
|
163
|
+
| Agent | Protocol | Notes |
|
|
164
|
+
|:------|:---------|:------|
|
|
165
|
+
| ACP (recommended) | ACP | Works with Claude Code, Codex, Gemini CLI, and more. Supports multi-turn continuity |
|
|
166
|
+
| Claude Code | CLI | Direct `claude` invocation. `--agent claude` |
|
|
167
|
+
| Codex | CLI | `opencode` / Codex CLI. `--agent opencode` |
|
|
168
|
+
| Gemini CLI | CLI | `--agent gemini` |
|
|
169
|
+
| OpenCode | CLI | `--agent opencode` |
|
|
707
170
|
|
|
708
|
-
|
|
171
|
+
ACP is recommended — it provides structured JSON-RPC communication, token-cost tracking, and multi-session continuity.
|
|
709
172
|
|
|
710
|
-
|
|
711
|
-
# Only applies when agent.protocol = "cli" (Claude Code only — other agents experimental)
|
|
712
|
-
nax run -f my-feature --agent claude
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
---
|
|
716
|
-
|
|
717
|
-
## Monorepo Support
|
|
718
|
-
|
|
719
|
-
nax supports monorepos with workspace-level and per-package configuration.
|
|
720
|
-
|
|
721
|
-
### Setup
|
|
722
|
-
|
|
723
|
-
```bash
|
|
724
|
-
# Initialize nax at the repo root
|
|
725
|
-
nax init
|
|
726
|
-
|
|
727
|
-
# Scaffold per-package context for a specific package
|
|
728
|
-
nax init --package packages/api
|
|
729
|
-
nax init --package packages/web
|
|
730
|
-
```
|
|
731
|
-
|
|
732
|
-
### Per-Package Config
|
|
733
|
-
|
|
734
|
-
Each package's config and context are stored centrally under the root `.nax/mono/` directory:
|
|
735
|
-
|
|
736
|
-
```
|
|
737
|
-
repo-root/
|
|
738
|
-
├── .nax/
|
|
739
|
-
│ ├── config.json # root config
|
|
740
|
-
│ └── mono/
|
|
741
|
-
│ ├── packages/
|
|
742
|
-
│ │ └── api/
|
|
743
|
-
│ │ ├── config.json # overrides for packages/api
|
|
744
|
-
│ │ └── context.md # agent context for packages/api
|
|
745
|
-
│ └── apps/
|
|
746
|
-
│ └── api/
|
|
747
|
-
│ ├── config.json # overrides for apps/api
|
|
748
|
-
│ └── context.md # agent context for apps/api
|
|
749
|
-
```
|
|
750
|
-
|
|
751
|
-
**Overridable fields per package:** `execution`, `review`, `acceptance`, `quality`, `context`
|
|
752
|
-
|
|
753
|
-
```json
|
|
754
|
-
// .nax/mono/packages/api/config.json
|
|
755
|
-
{
|
|
756
|
-
"quality": {
|
|
757
|
-
"commands": {
|
|
758
|
-
"test": "turbo test --filter=@myapp/api",
|
|
759
|
-
"lint": "turbo lint --filter=@myapp/api"
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
```
|
|
764
|
-
|
|
765
|
-
### Per-Package Stories
|
|
766
|
-
|
|
767
|
-
In your `prd.json`, set `workdir` on each story to point to the package:
|
|
768
|
-
|
|
769
|
-
```json
|
|
770
|
-
{
|
|
771
|
-
"userStories": [
|
|
772
|
-
{
|
|
773
|
-
"id": "US-001",
|
|
774
|
-
"title": "Add auth endpoint",
|
|
775
|
-
"workdir": "packages/api",
|
|
776
|
-
"status": "pending"
|
|
777
|
-
}
|
|
778
|
-
]
|
|
779
|
-
}
|
|
780
|
-
```
|
|
781
|
-
|
|
782
|
-
nax will run the agent inside that package's directory and apply its config overrides automatically.
|
|
783
|
-
|
|
784
|
-
### Workspace Detection
|
|
785
|
-
|
|
786
|
-
When `nax plan` generates stories for a monorepo, it auto-discovers packages from:
|
|
787
|
-
- `turbo.json` → `packages` field
|
|
788
|
-
- `package.json` → `workspaces`
|
|
789
|
-
- `pnpm-workspace.yaml` → `packages`
|
|
790
|
-
- Existing `.nax/mono/*/context.md` files
|
|
791
|
-
|
|
792
|
-
### Generate Agent Files for All Packages
|
|
793
|
-
|
|
794
|
-
```bash
|
|
795
|
-
nax generate --all-packages
|
|
796
|
-
```
|
|
797
|
-
|
|
798
|
-
Generates a `CLAUDE.md` (or agent-specific file) in each discovered package directory, using the package's own `.nax/mono/<package>/context.md` if present.
|
|
799
|
-
|
|
800
|
-
---
|
|
801
|
-
|
|
802
|
-
## Hooks
|
|
803
|
-
|
|
804
|
-
Integrate notifications, CI triggers, or custom scripts via lifecycle hooks.
|
|
805
|
-
|
|
806
|
-
**Project hooks** (`.nax/hooks.json`):
|
|
807
|
-
|
|
808
|
-
```json
|
|
809
|
-
{
|
|
810
|
-
"hooks": {
|
|
811
|
-
"on-complete": {
|
|
812
|
-
"command": "openclaw system event --text 'Feature done!'",
|
|
813
|
-
"enabled": true
|
|
814
|
-
},
|
|
815
|
-
"on-pause": {
|
|
816
|
-
"command": "bash hooks/notify.sh",
|
|
817
|
-
"enabled": true
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
```
|
|
822
|
-
|
|
823
|
-
**Available events:**
|
|
824
|
-
|
|
825
|
-
| Event | Fires when |
|
|
826
|
-
|:------|:-----------|
|
|
827
|
-
| `on-start` | Run begins |
|
|
828
|
-
| `on-story-start` | A story starts processing |
|
|
829
|
-
| `on-story-complete` | A story passes all checks |
|
|
830
|
-
| `on-story-fail` | A story exhausts all retry attempts |
|
|
831
|
-
| `on-pause` | Run paused (awaiting human input) |
|
|
832
|
-
| `on-resume` | Run resumed after pause |
|
|
833
|
-
| `on-session-end` | An agent session ends (per-session teardown) |
|
|
834
|
-
| `on-all-stories-complete` | All stories passed — regression gate pending *(v0.34.0)* |
|
|
835
|
-
| `on-final-regression-fail` | Deferred regression failed after rectification *(v0.34.0)* |
|
|
836
|
-
| `on-complete` | Everything finished and verified (including regression gate) |
|
|
837
|
-
| `on-error` | Unhandled error terminates the run |
|
|
838
|
-
|
|
839
|
-
**Hook lifecycle:**
|
|
840
|
-
|
|
841
|
-
```
|
|
842
|
-
on-start
|
|
843
|
-
└─ on-story-start → on-story-complete (or on-story-fail) ← per story
|
|
844
|
-
└─ on-all-stories-complete ← all stories done
|
|
845
|
-
└─ deferred regression gate (if enabled)
|
|
846
|
-
└─ on-final-regression-fail ← if regression fails
|
|
847
|
-
└─ on-complete ← everything verified
|
|
848
|
-
```
|
|
849
|
-
|
|
850
|
-
Each hook receives context via `NAX_*` environment variables and full JSON on stdin.
|
|
851
|
-
|
|
852
|
-
**Environment variables passed to hooks:**
|
|
853
|
-
|
|
854
|
-
| Variable | Description |
|
|
855
|
-
|:---------|:------------|
|
|
856
|
-
| `NAX_EVENT` | Event name (e.g., `on-story-complete`) |
|
|
857
|
-
| `NAX_FEATURE` | Feature name |
|
|
858
|
-
| `NAX_STORY_ID` | Current story ID (if applicable) |
|
|
859
|
-
| `NAX_STATUS` | Status (`pass`, `fail`, `paused`, `error`) |
|
|
860
|
-
| `NAX_REASON` | Reason for pause or error |
|
|
861
|
-
| `NAX_COST` | Accumulated cost in USD |
|
|
862
|
-
| `NAX_MODEL` | Current model |
|
|
863
|
-
| `NAX_AGENT` | Current agent |
|
|
864
|
-
| `NAX_ITERATION` | Current iteration number |
|
|
865
|
-
|
|
866
|
-
**Global vs project hooks:** Global hooks (`~/.nax/hooks.json`) fire alongside project hooks. Set `"skipGlobal": true` in your project `hooks.json` to disable global hooks.
|
|
867
|
-
|
|
868
|
-
---
|
|
869
|
-
|
|
870
|
-
## Interaction Triggers
|
|
871
|
-
|
|
872
|
-
nax can pause execution and prompt you for decisions at critical points. Configure triggers in `nax/config.json` (or `~/.nax/config.json` globally):
|
|
873
|
-
|
|
874
|
-
```json
|
|
875
|
-
{
|
|
876
|
-
"interaction": {
|
|
877
|
-
"plugin": "telegram",
|
|
878
|
-
"defaults": {
|
|
879
|
-
"timeout": 600000,
|
|
880
|
-
"fallback": "escalate"
|
|
881
|
-
},
|
|
882
|
-
"triggers": {
|
|
883
|
-
"security-review": true,
|
|
884
|
-
"cost-exceeded": true,
|
|
885
|
-
"cost-warning": true,
|
|
886
|
-
"max-retries": true,
|
|
887
|
-
"human-review": true,
|
|
888
|
-
"story-ambiguity": true,
|
|
889
|
-
"story-oversized": true,
|
|
890
|
-
"review-gate": true,
|
|
891
|
-
"pre-merge": false,
|
|
892
|
-
"merge-conflict": true
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
```
|
|
897
|
-
|
|
898
|
-
**Available triggers:**
|
|
899
|
-
|
|
900
|
-
| Trigger | Safety | Default Fallback | Description |
|
|
901
|
-
|:--------|:------:|:----------------:|:------------|
|
|
902
|
-
| `security-review` | 🔴 Red | `abort` | Critical security issues found during review |
|
|
903
|
-
| `cost-exceeded` | 🔴 Red | `abort` | Run cost exceeded the configured limit |
|
|
904
|
-
| `merge-conflict` | 🔴 Red | `abort` | Git merge conflict detected |
|
|
905
|
-
| `cost-warning` | 🟡 Yellow | `escalate` | Approaching cost limit — escalate to higher model tier? |
|
|
906
|
-
| `max-retries` | 🟡 Yellow | `skip` | Story exhausted all retry attempts — skip and continue? |
|
|
907
|
-
| `pre-merge` | 🟡 Yellow | `escalate` | Checkpoint before merging to main branch |
|
|
908
|
-
| `human-review` | 🟡 Yellow | `skip` | Human review required on critical failure |
|
|
909
|
-
| `story-oversized` | 🟡 Yellow | `continue` | Story too complex — decompose into sub-stories? (only fires when `decompose.trigger = "confirm"`) |
|
|
910
|
-
| `story-ambiguity` | 🟢 Green | `continue` | Story requirements unclear — continue with best effort? |
|
|
911
|
-
| `review-gate` | 🟢 Green | `continue` | Code review checkpoint before proceeding |
|
|
912
|
-
|
|
913
|
-
**Safety tiers:**
|
|
914
|
-
- 🔴 **Red** — Critical; defaults to aborting if no response
|
|
915
|
-
- 🟡 **Yellow** — Caution; defaults to escalating or skipping
|
|
916
|
-
- 🟢 **Green** — Informational; defaults to continuing
|
|
917
|
-
|
|
918
|
-
**Fallback behaviors** (when interaction times out):
|
|
919
|
-
- `continue` — proceed as normal
|
|
920
|
-
- `skip` — skip the current story
|
|
921
|
-
- `escalate` — escalate to a higher model tier
|
|
922
|
-
- `abort` — stop the run
|
|
923
|
-
|
|
924
|
-
**Interaction plugins:**
|
|
925
|
-
|
|
926
|
-
| Plugin | Description |
|
|
927
|
-
|:-------|:------------|
|
|
928
|
-
| `telegram` | Send prompts via Telegram bot (recommended for remote runs) |
|
|
929
|
-
| `cli` | Interactive terminal prompts (for local runs) |
|
|
930
|
-
| `webhook` | POST interaction requests to a webhook URL |
|
|
931
|
-
| `auto` | Auto-respond based on fallback behavior (no human prompt) |
|
|
932
|
-
|
|
933
|
-
---
|
|
934
|
-
|
|
935
|
-
## Plugins
|
|
936
|
-
|
|
937
|
-
Extend nax with custom reviewers, reporters, or integrations.
|
|
938
|
-
|
|
939
|
-
**Project plugins** (`.nax/config.json`):
|
|
940
|
-
|
|
941
|
-
```json
|
|
942
|
-
{
|
|
943
|
-
"plugins": [
|
|
944
|
-
{ "name": "my-reporter", "path": "./plugins/my-reporter.ts" }
|
|
945
|
-
]
|
|
946
|
-
}
|
|
947
|
-
```
|
|
948
|
-
|
|
949
|
-
**Global plugin directory:** `~/.nax/plugins/` — plugins here are loaded for all projects.
|
|
950
|
-
|
|
951
|
-
### Reviewer Plugins
|
|
952
|
-
|
|
953
|
-
Reviewer plugins run during the review pipeline stage and return structured `ReviewFinding` objects:
|
|
954
|
-
|
|
955
|
-
```typescript
|
|
956
|
-
interface ReviewFinding {
|
|
957
|
-
ruleId: string; // e.g. "javascript.express.security.audit.xss"
|
|
958
|
-
severity: "critical" | "error" | "warning" | "info" | "low";
|
|
959
|
-
file: string;
|
|
960
|
-
line: number;
|
|
961
|
-
column?: number;
|
|
962
|
-
message: string;
|
|
963
|
-
url?: string; // Link to rule documentation
|
|
964
|
-
source: string; // e.g. "semgrep", "eslint", "snyk"
|
|
965
|
-
category?: string; // e.g. "security", "performance"
|
|
966
|
-
}
|
|
967
|
-
```
|
|
968
|
-
|
|
969
|
-
Findings are threaded through the escalation pipeline — if a story fails review, the retry agent receives the exact file, line, and rule to fix.
|
|
970
|
-
|
|
971
|
-
**Example:** The built-in Semgrep reviewer plugin scans for security issues using `semgrep scan --config auto` and returns structured findings.
|
|
173
|
+
See [Agents Guide](docs/guides/agents.md).
|
|
972
174
|
|
|
973
175
|
---
|
|
974
176
|
|
|
975
177
|
## Troubleshooting
|
|
976
178
|
|
|
977
|
-
|
|
179
|
+
| Problem | Solution |
|
|
180
|
+
|:--------|:---------|
|
|
181
|
+
| "Working tree is dirty" | Commit or stash changes; nax will restore your working tree after the run |
|
|
182
|
+
| HOME env warning | Set HOME to an absolute path — nax warns if it contains `~` |
|
|
183
|
+
| ACP sessions leaking | Upgrade to nax v0.48+ and ensure `.nax/acp-sessions.json` is gitignored |
|
|
184
|
+
| Monorepo packages misclassified | Ensure `.nax/mono/packages/<pkg>/config.json` is set up per package |
|
|
185
|
+
| Acceptance tests regenerating every run | Check `acceptance-meta.json` — stale fingerprints indicate outdated story context |
|
|
978
186
|
|
|
979
|
-
|
|
980
|
-
# Check if nax is actually running first
|
|
981
|
-
pgrep -fa nax
|
|
982
|
-
|
|
983
|
-
# If nothing is running, remove the lock
|
|
984
|
-
rm nax.lock
|
|
985
|
-
```
|
|
986
|
-
|
|
987
|
-
**Story keeps failing**
|
|
988
|
-
|
|
989
|
-
```bash
|
|
990
|
-
nax diagnose -f my-feature
|
|
991
|
-
```
|
|
992
|
-
|
|
993
|
-
**Precheck fails**
|
|
994
|
-
|
|
995
|
-
```bash
|
|
996
|
-
nax precheck -f my-feature
|
|
997
|
-
# Fix reported issues, then re-run
|
|
998
|
-
```
|
|
999
|
-
|
|
1000
|
-
**Run stopped mid-way**
|
|
1001
|
-
|
|
1002
|
-
nax saves progress in `.nax/features/<name>/prd.json`. Re-run with the same command — completed stories are skipped automatically.
|
|
187
|
+
See the [Troubleshooting Guide](docs/guides/troubleshooting.md) for more.
|
|
1003
188
|
|
|
1004
189
|
---
|
|
1005
190
|
|
|
1006
|
-
##
|
|
191
|
+
## Credits
|
|
1007
192
|
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
```json
|
|
1011
|
-
{
|
|
1012
|
-
"project": "my-app",
|
|
1013
|
-
"feature": "user-auth",
|
|
1014
|
-
"branchName": "feat/user-auth",
|
|
1015
|
-
"createdAt": "2026-01-01T00:00:00.000Z",
|
|
1016
|
-
"updatedAt": "2026-01-01T00:00:00.000Z",
|
|
1017
|
-
"userStories": [
|
|
1018
|
-
{
|
|
1019
|
-
"id": "US-001",
|
|
1020
|
-
"title": "Add login endpoint",
|
|
1021
|
-
"description": "POST /auth/login accepts email + password, returns signed JWT on success",
|
|
1022
|
-
"acceptanceCriteria": [
|
|
1023
|
-
"Returns 200 + JWT on valid credentials",
|
|
1024
|
-
"Returns 401 on invalid credentials",
|
|
1025
|
-
"Rate-limits to 5 attempts per minute"
|
|
1026
|
-
],
|
|
1027
|
-
"tags": ["auth", "security"],
|
|
1028
|
-
"dependencies": [],
|
|
1029
|
-
"status": "pending",
|
|
1030
|
-
"passes": false,
|
|
1031
|
-
"attempts": 0,
|
|
1032
|
-
"escalations": [],
|
|
1033
|
-
"contextFiles": ["src/auth/types.ts"],
|
|
1034
|
-
"expectedFiles": ["src/auth/login.ts", "test/auth/login.test.ts"]
|
|
1035
|
-
},
|
|
1036
|
-
{
|
|
1037
|
-
"id": "US-002",
|
|
1038
|
-
"title": "Update changelog",
|
|
1039
|
-
"description": "Add v1.0 entry to CHANGELOG.md",
|
|
1040
|
-
"acceptanceCriteria": ["CHANGELOG.md has v1.0 section"],
|
|
1041
|
-
"tags": ["docs"],
|
|
1042
|
-
"dependencies": [],
|
|
1043
|
-
"status": "pending",
|
|
1044
|
-
"passes": false,
|
|
1045
|
-
"attempts": 0,
|
|
1046
|
-
"escalations": [],
|
|
1047
|
-
"routing": {
|
|
1048
|
-
"complexity": "simple",
|
|
1049
|
-
"testStrategy": "no-test",
|
|
1050
|
-
"noTestJustification": "Docs-only change — no executable code",
|
|
1051
|
-
"reasoning": "Pure documentation update"
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
]
|
|
1055
|
-
}
|
|
1056
|
-
```
|
|
1057
|
-
|
|
1058
|
-
**Key fields:**
|
|
1059
|
-
|
|
1060
|
-
| Field | Required | Description |
|
|
1061
|
-
|:------|:---------|:------------|
|
|
1062
|
-
| `id` | ✅ | Story ID — must be unique (e.g. `US-001`) |
|
|
1063
|
-
| `title` | ✅ | Short story title |
|
|
1064
|
-
| `description` | ✅ | What needs to be built |
|
|
1065
|
-
| `acceptanceCriteria` | ✅ | Testable outcomes — used for acceptance tests |
|
|
1066
|
-
| `tags` | ✅ | Routing hints that influence complexity classification and test strategy selection. Security tags (`auth`, `security`, `jwt`, `oauth`, `rbac`, etc.) and public-API tags (`public-api`, `endpoint`, `sdk`, etc.) force `three-session-tdd`. UI/integration tags (`ui`, `layout`, `cli`, `integration`) prefer `three-session-tdd-lite`. |
|
|
1067
|
-
| `dependencies` | ✅ | Story IDs that must pass before this one runs |
|
|
1068
|
-
| `status` | ✅ | `pending` \| `in-progress` \| `passed` \| `failed` \| `skipped` \| `blocked` \| `paused` |
|
|
1069
|
-
| `passes` | ✅ | `true` once all ACs pass — set by nax, not manually |
|
|
1070
|
-
| `attempts` | ✅ | Retry counter — set by nax |
|
|
1071
|
-
| `escalations` | ✅ | Escalation history — set by nax |
|
|
1072
|
-
| `contextFiles` | optional | Files pre-loaded into agent prompt |
|
|
1073
|
-
| `expectedFiles` | optional | Files that must exist after execution (pre-flight gate) |
|
|
1074
|
-
| `workdir` | optional | Package subdirectory for monorepo stories (e.g. `packages/api`) |
|
|
1075
|
-
| `routing` | optional | Pre-set routing — skip LLM classification if provided |
|
|
1076
|
-
| `routing.testStrategy` | optional | Override test strategy (e.g. `no-test`, `tdd-simple`). Only honored when `routing.contentHash` is absent — omit `contentHash` to prevent the LLM classifier from overriding your manual value. |
|
|
1077
|
-
| `routing.noTestJustification` | required if `no-test` | Explain why no tests are needed |
|
|
1078
|
-
| `storyPoints` | optional | Estimate (default: 1) |
|
|
1079
|
-
|
|
1080
|
-
> **Tip:** Use `"status": "passed"` to manually skip a story that's already done.
|
|
1081
|
-
|
|
1082
|
-
---
|
|
193
|
+
nax is inspired by [Relentless](https://github.com/ArvorCo/Relentless) — the same "keep trying until done" philosophy, applied to AI agent orchestration.
|
|
1083
194
|
|
|
195
|
+
ACP support is powered by [acpx](https://github.com/openclaw/acpx) from the [OpenClaw](https://github.com/openclaw/openclaw) project.
|
|
1084
196
|
|
|
1085
197
|
## License
|
|
1086
198
|
|
|
1087
199
|
MIT
|
|
1088
|
-
|