@felixdotgo/aidlc-kit 0.2.0 → 0.3.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.
Files changed (109) hide show
  1. package/DEVELOPMENT.md +13 -26
  2. package/README.md +35 -39
  3. package/dist/assets/.agents/aidlc/orchestrator.md +1 -1
  4. package/dist/assets/.agents/aidlc/schemas/state.schema.json +2 -0
  5. package/dist/assets/.agents/aidlc/scripts/lib/assignment-store.mjs +94 -48
  6. package/dist/assets/.agents/aidlc/scripts/lib/context-runtime.mjs +5 -4
  7. package/dist/assets/.agents/aidlc/scripts/lib/loop-authority.mjs +21 -5
  8. package/dist/assets/.agents/aidlc/scripts/lib/loop-daemon.mjs +52 -78
  9. package/dist/assets/.agents/aidlc/scripts/lib/loop-drivers.mjs +88 -14
  10. package/dist/assets/.agents/aidlc/scripts/lib/loop-env.mjs +279 -0
  11. package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-cli.mjs +20 -5
  12. package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-remote.mjs +10 -1
  13. package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-supervisor.mjs +2 -1
  14. package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet.mjs +3 -2
  15. package/dist/assets/.agents/aidlc/scripts/lib/loop-git.mjs +9 -3
  16. package/dist/assets/.agents/aidlc/scripts/lib/loop-holder.mjs +376 -0
  17. package/dist/assets/.agents/aidlc/scripts/lib/loop-intake.mjs +11 -3
  18. package/dist/assets/.agents/aidlc/scripts/lib/loop-lease.mjs +67 -61
  19. package/dist/assets/.agents/aidlc/scripts/lib/loop-leases.mjs +268 -0
  20. package/dist/assets/.agents/aidlc/scripts/lib/loop-local-workers.mjs +78 -17
  21. package/dist/assets/.agents/aidlc/scripts/lib/loop-runtime.mjs +42 -10
  22. package/dist/assets/.agents/aidlc/scripts/lib/loop-stream.mjs +66 -9
  23. package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor-local.mjs +16 -56
  24. package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor-run-local.mjs +12 -6
  25. package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-docker.mjs +14 -2
  26. package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-log.mjs +158 -0
  27. package/dist/assets/.agents/aidlc/scripts/lib/repo-head.mjs +22 -0
  28. package/dist/assets/.agents/aidlc/scripts/lib/store.mjs +11 -0
  29. package/dist/assets/.agents/aidlc/scripts/lib/task-runtime-migrate.mjs +75 -0
  30. package/dist/assets/.agents/aidlc/scripts/lib/task-runtime.mjs +97 -0
  31. package/dist/assets/.agents/aidlc/scripts/loop-entry.mjs +87 -4
  32. package/dist/assets/.agents/aidlc/scripts/loop.cmd +101 -0
  33. package/dist/assets/.agents/aidlc/scripts/loop.sh +71 -0
  34. package/dist/assets/.agents/aidlc/scripts/remote-state.mjs +10 -4
  35. package/dist/assets/.agents/aidlc/scripts/state.mjs +16 -8
  36. package/dist/assets/ui/changes.js +83 -0
  37. package/dist/assets/ui/common.js +664 -0
  38. package/dist/assets/ui/dashboard.css +281 -59
  39. package/dist/assets/ui/dashboard.js +77 -0
  40. package/dist/assets/ui/detail.js +159 -0
  41. package/dist/assets/ui/live-log.js +332 -0
  42. package/dist/services/aidlc-coordination/package.json +1 -1
  43. package/dist/services/aidlc-coordination/src/lifecycle-core.mjs +11 -0
  44. package/dist/src/cli/argv.js +10 -4
  45. package/dist/src/cli/commands.js +52 -22
  46. package/dist/src/cli/loop-launcher.d.ts +47 -0
  47. package/dist/src/cli/loop-launcher.js +322 -0
  48. package/dist/src/cli.js +3 -0
  49. package/dist/src/installer.js +4 -2
  50. package/dist/src/model/records.d.ts +4 -0
  51. package/dist/src/state/validate.js +5 -0
  52. package/dist/src/task-ui.d.ts +31 -52
  53. package/dist/src/task-ui.js +25 -1562
  54. package/dist/src/ui/assets.d.ts +14 -0
  55. package/dist/src/ui/assets.js +45 -0
  56. package/dist/src/ui/changes.d.ts +83 -0
  57. package/dist/src/ui/changes.js +498 -0
  58. package/dist/src/ui/containers.d.ts +71 -0
  59. package/dist/src/ui/containers.js +214 -0
  60. package/dist/src/ui/daemon.d.ts +75 -0
  61. package/dist/src/ui/daemon.js +232 -0
  62. package/dist/src/ui/data.d.ts +42 -0
  63. package/dist/src/ui/data.js +89 -0
  64. package/dist/src/ui/docs.d.ts +13 -0
  65. package/dist/src/ui/docs.js +39 -0
  66. package/dist/src/ui/files.d.ts +3 -0
  67. package/dist/src/ui/files.js +20 -0
  68. package/dist/src/ui/http.d.ts +14 -0
  69. package/dist/src/ui/http.js +80 -0
  70. package/dist/src/ui/live.d.ts +5 -0
  71. package/dist/src/ui/live.js +43 -0
  72. package/dist/src/ui/markdown.d.ts +2 -0
  73. package/dist/src/ui/markdown.js +127 -0
  74. package/dist/src/ui/options.d.ts +48 -0
  75. package/dist/src/ui/options.js +81 -0
  76. package/dist/src/ui/security.d.ts +34 -0
  77. package/dist/src/ui/security.js +38 -0
  78. package/dist/src/ui/server.d.ts +39 -0
  79. package/dist/src/ui/server.js +347 -0
  80. package/dist/src/ui/sse.d.ts +14 -0
  81. package/dist/src/ui/sse.js +281 -0
  82. package/dist/src/ui/views/board.d.ts +7 -0
  83. package/dist/src/ui/views/board.js +131 -0
  84. package/dist/src/ui/views/changes.d.ts +19 -0
  85. package/dist/src/ui/views/changes.js +154 -0
  86. package/dist/src/ui/views/components.d.ts +56 -0
  87. package/dist/src/ui/views/components.js +113 -0
  88. package/dist/src/ui/views/docs.d.ts +15 -0
  89. package/dist/src/ui/views/docs.js +64 -0
  90. package/dist/src/ui/views/layout.d.ts +44 -0
  91. package/dist/src/ui/views/layout.js +233 -0
  92. package/dist/src/ui/views/task.d.ts +25 -0
  93. package/dist/src/ui/views/task.js +320 -0
  94. package/dist/src/upgrade.js +5 -2
  95. package/dist/src/workflow.d.ts +4 -0
  96. package/dist/src/workflow.js +33 -1
  97. package/docs/README.md +48 -33
  98. package/docs/architecture.md +101 -38
  99. package/docs/command-reference.md +269 -93
  100. package/docs/configuration.md +62 -42
  101. package/docs/coordination-service.md +85 -36
  102. package/docs/design-decisions.md +35 -31
  103. package/docs/development.md +111 -61
  104. package/docs/loop-local-run.md +135 -402
  105. package/docs/loop-runbook.md +84 -105
  106. package/docs/operating-workflow.md +55 -42
  107. package/docs/testing-and-release.md +70 -51
  108. package/docs/troubleshooting.md +165 -69
  109. package/package.json +1 -1
@@ -1,37 +1,32 @@
1
1
  # Development guide
2
2
 
3
- This guide is for contributors to `@felixdotgo/aidlc-kit`. It covers local setup, source ownership, and the rules that keep the package runtime and installed workflow behaviour aligned.
3
+ Local setup, dogfooding, source ownership, and the rules that keep package runtime and installed workflow aligned. To use the workflow in your own project, start at the [documentation index](./README.md).
4
4
 
5
5
  ## Requirements and dependencies
6
6
 
7
- - Node.js 20.17 or newer is required by the package runtime.
8
- - npm installs the repository development dependencies.
9
- - `@inquirer/prompts` is the runtime dependency for interactive CLI prompts; installed lifecycle scripts remain dependency-free.
10
- - Development uses TypeScript and `@types/node` as declared in `package.json`.
7
+ - Node.js 20.17 or newer; npm installs the dev dependencies (TypeScript, `@types/node`).
8
+ - `@inquirer/prompts` is the only runtime dependency; installed lifecycle scripts are dependency-free.
9
+ - Codex, Claude Code, or OpenCode: only for real evaluator drivers; OpenCode also needs `AIDLC_OPENCODE_MODEL` (`provider/model[#variant]`).
11
10
 
12
11
  ```sh
13
12
  npm install
14
13
  ```
15
14
 
16
- Codex, Claude Code, or OpenCode are optional for manually exercising real evaluator drivers. Ordinary build, lint, and unit-test work does not need external model credentials. OpenCode driver runs also need `AIDLC_OPENCODE_MODEL` set to a `provider/model[#variant]` value.
17
-
18
15
  ## Platform support
19
16
 
20
- Node.js 20.17 or newer is required on every platform. Linux and macOS are fully supported and tested. Windows is best-effort: win32 path separators are handled in `src/state/guards.ts`, `src/profiles.ts`, and the installed `assets/aidlc/scripts/lib/store.mjs`/`context-runtime.mjs`, and the state lock uses `process.kill(pid, 0)` for liveness; the lock and path handling are not exercised on Windows in CI. Loop and fleet features require Docker and a POSIX shell (`loop-local-workers.mjs` rejects non-Linux hosts).
21
-
22
17
  | Platform | Status | Notes |
23
18
  | --- | --- | --- |
24
19
  | Linux | Supported | Full CI coverage; Docker worker isolation available. |
25
20
  | macOS | Supported | Full test coverage; POSIX shell recipes apply. |
26
- | Windows | Best-effort | Use WSL or Git Bash for the local build recipe; lock/path code handles win32 separators but is untested. |
27
- | Loop / fleet | Linux only | Requires Docker + POSIX shell; `AIDLC_TEST_WORKER_IMAGE`/`AIDLC_WORKER_DOCKER_IMAGE` for e2e. |
21
+ | Windows | Best-effort | Use WSL or Git Bash for shell recipes. win32 separators handled in `src/state/guards.ts`, `src/profiles.ts`, installed `lib/store.mjs` and `context-runtime.mjs`; state lock liveness via `process.kill(pid, 0)`. Not in CI. |
22
+ | Loop / fleet | Linux only | Needs Docker and a POSIX shell; `loop-local-workers.mjs` rejects other hosts. E2e tests need `AIDLC_TEST_WORKER_IMAGE` and `AIDLC_WORKER_DOCKER_IMAGE`. |
28
23
 
29
24
  ## Repository layout
30
25
 
31
26
  ```text
32
27
  assets/aidlc/ Source workflow contracts, schemas, and installed scripts
33
28
  skills/ Source thin phase adapters
34
- src/ TypeScript package CLI (src/cli/), installer + shared planning core, lifecycle domain (src/model/, src/state/), profiles, and migrations
29
+ src/ Package CLI (src/cli/), installer, shared planning core, lifecycle domain (src/model/, src/state/), profiles, migrations
35
30
  dev/evaluator/ Development-only evaluator harness and runners
36
31
  scripts/build-assets.mjs Bundles workflow assets for package distribution
37
32
  test/unit/ Unit and installed-runtime parity tests
@@ -39,26 +34,22 @@ docs/ User, operator, and contributor documentation
39
34
  dist/ Generated TypeScript and bundled assets; do not hand-edit
40
35
  ```
41
36
 
42
- The asset build copies `assets/aidlc/` and `skills/` into `dist/assets/.agents/`. At install time, the package writes the workflow to a consumer project's `.agents/aidlc/` and `.agents/skills/` locations. Always state which of these three layouts—source, bundle, or installed project—you mean in code or documentation.
37
+ Three layouts: source (`assets/aidlc/`, `skills/`), bundle (`dist/assets/.agents/`), installed (consumer `.agents/aidlc/` and `.agents/skills/`). Say which you mean.
43
38
 
44
39
  ## Local commands
45
40
 
46
41
  | Command | Purpose |
47
42
  | --- | --- |
48
- | `npm run build` | Rebuild bundled workflow assets and compile TypeScript into `dist/`. |
43
+ | `npm run build` | Bundle workflow assets and compile TypeScript into `dist/`. |
49
44
  | `npm run sync-core` | Copy `assets/aidlc/scripts/lib/store.mjs` to `services/aidlc-coordination/src/lifecycle-core.mjs` byte-identically. |
50
45
  | `npm run lint` | Type-check without emitting files. |
51
- | `npm test` | Build, then run every compiled unit test with Node's test runner. |
52
- | `node --test dist/test/unit/<file>.test.js` | Run a focused compiled test after building. |
53
- | `npm run release:check` | Run the repository release-evidence policy check. |
54
-
55
- Run the narrowest relevant test while iterating, then run `npm test` and `npm run lint` before handing off a non-trivial change. See [Testing and release](./testing-and-release.md) for the package smoke test and evaluator.
46
+ | `npm test` | Build, then run all compiled unit tests (Node test runner). |
47
+ | `node --test dist/test/unit/<file>.test.js` | Run one compiled test after building. |
48
+ | `npm run release:check` | Release-evidence policy check. |
56
49
 
57
50
  ## Local build and registry-free installation
58
51
 
59
- Use this fast smoke test to install workflow assets from the current checkout into a disposable consumer project. It invokes the freshly compiled CLI directly, so the consumer installation does not use `npm install`, `npx`, a published package, or an npm registry. Repository bootstrap and build still use npm and the dependencies already installed in this checkout.
60
-
61
- Run the following POSIX shell commands from the repository root:
52
+ Install the checkout's assets into a disposable consumer project via the compiled CLI (no `npm install`, `npx`, or registry). From the repository root:
62
53
 
63
54
  ```sh
64
55
  AIDLC_REPO="$(pwd)"
@@ -74,72 +65,131 @@ node "$AIDLC_LOCAL_PROJECT/.agents/aidlc/scripts/state.mjs" task list --root "$A
74
65
  printf 'Local test project: %s\n' "$AIDLC_LOCAL_PROJECT"
75
66
  ```
76
67
 
77
- The dry run previews the managed writes before `--yes` applies them. `status` describes the installed version and adapters, `doctor --strict` is the integrity check, and the final command confirms that the copied dependency-free lifecycle runtime can read its canonical state without the package CLI.
68
+ - Use a new empty directory each time (reuse across versions triggers the human-only upgrade protection); remove it manually. On Windows, create it in PowerShell and pass the absolute path.
69
+ - Do not target a real project unless its managed files and state are intentional test targets.
70
+ - This checks the compiled checkout only, not the published allowlist, bin metadata, or tarball exclusions; run the [package smoke test](./testing-and-release.md#package-smoke-test) before release.
71
+
72
+ ## Run `npx` from a local package archive
78
73
 
79
- Always use a new empty directory and inspect the printed path before removing it manually. Do not point this recipe at a real project unless its managed files and workflow state are intentional test targets. Reusing a fixture across package versions triggers the human-only upgrade protection by design. On Windows, use WSL or Git Bash for the snippet, or create a temporary directory in PowerShell and pass its absolute path to the same Node commands.
74
+ ```sh
75
+ npm pack
76
+ npx --package felixdotgo-aidlc-kit-0.3.0.tgz -- aidlc-kit init .
77
+ ```
80
78
 
81
- This direct-`dist` smoke verifies the compiled checkout, but it does not verify the published file allowlist, package bin metadata, or tarball exclusions. Before release, also run the separate [package smoke test](./testing-and-release.md#package-smoke-test), which packs and extracts a local tarball without installing or fetching the package from a registry.
79
+ Run from the archive's directory; pass a disposable project instead of `.` to avoid writing into the current directory.
82
80
 
83
- ## Run `npx` from a local package archive
81
+ ## Dogfooding this repository
84
82
 
85
- To test the package before release, create its `.tgz` archive and run the local archive with `npx`:
83
+ `.agents/` is gitignored; each contributor installs the repository's own workflow from the checkout.
84
+
85
+ ### Install the workflow from source
86
86
 
87
87
  ```sh
88
- npm pack
89
- npx --package felixdotgo-aidlc-kit-0.2.0.tgz -- aidlc-kit init .
88
+ npm install
89
+ npm run build
90
+ node dist/src/cli.js init . --agent <codex|claude|opencode> --loop-mode off --yes
90
91
  ```
91
92
 
92
- `npx` runs the archive without publishing it. Run the command from the directory containing the archive. Use a disposable project instead of `.` if you do not want the command to write workflow files into the current directory.
93
+ Edit `.agents/config.json` as below (`commands` as executable-and-argument arrays; your adapter id → `"scripted"` in `agentState`), then `node dist/src/cli.js profile validate .`.
94
+
95
+ ```json
96
+ {
97
+ "commands": {
98
+ "build": { "command": "npm", "args": ["run", "build"] },
99
+ "test": { "command": "npm", "args": ["test"] },
100
+ "lint": { "command": "npm", "args": ["run", "lint"] }
101
+ },
102
+ "agentState": { "opencode": "scripted" }
103
+ }
104
+ ```
93
105
 
94
- ## Ownership boundaries
106
+ ### Check for drift and re-sync
95
107
 
96
- The package has three ownership layers:
108
+ After changing `assets/aidlc/`, check for a stale install (any output means stale; symptom: `loop: Isolated local worker dispatcher is not integrated; loop execution is unavailable`):
97
109
 
98
- 1. Package-managed kernel assets installed under `.agents/aidlc/`.
99
- 2. Project-owned configuration, profiles, rules, and evaluation material under `.agents/project/`.
100
- 3. Project-owned task state and derived data under `.agents/data/`.
110
+ ```sh
111
+ diff -rq assets/aidlc/scripts .agents/aidlc/scripts
112
+ ```
101
113
 
102
- Do not introduce a second lifecycle board or hand-edit canonical state. The installed lifecycle scripts are dependency-free so consumer projects do not need this package to operate after installation.
114
+ Re-sync is a human-only upgrade (TTY required); stop the loop daemon first (`node dist/src/cli.js loop down --root .` or `loop stop`), then re-run `diff -rq`:
103
115
 
104
- ## Mirrored runtime behaviour
116
+ ```sh
117
+ npm run build
118
+ node dist/src/cli.js upgrade . --dry-run # preview the plan
119
+ node dist/src/cli.js upgrade . # type the package version when prompted
120
+ ```
121
+
122
+ ### Run the loop from a source checkout
123
+
124
+ > [!WARNING]
125
+ > Experimental, pre-1.0. See [Status and stability](./loop-runbook.md#status-and-stability).
126
+
127
+ In place of `npx --package @felixdotgo/aidlc-kit@<version> aidlc-kit …`, run the compiled CLI after `npm run build`:
128
+
129
+ | Task | Command |
130
+ | --- | --- |
131
+ | Start the daemon and dashboard | `node dist/src/cli.js loop up --root .` |
132
+ | Check daemon and task status | `node dist/src/cli.js loop status --root . [--task-id <task-id>]` |
133
+ | Serve only the dashboard | `node dist/src/cli.js ui .` |
134
+
135
+ See [Local loop walkthrough](./loop-local-run.md) and [Command reference](./command-reference.md#loop).
105
136
 
106
- The TypeScript implementation powers the package CLI. Installed projects use a dependency-free mirror under `assets/aidlc/scripts/`. Changes to shared lifecycle, state, gate, profile, or context behaviour must preserve parity between these paths and add coverage for both package and installed-runtime execution.
137
+ ## Ownership boundaries
138
+
139
+ - `.agents/aidlc/`: package-managed kernel assets.
140
+ - `.agents/project/`: project-owned config, profiles, rules, and evaluation material.
141
+ - `.agents/data/`: project-owned task state and derived data; never add a second lifecycle board or hand-edit it.
107
142
 
108
- Likewise, a public configuration or schema change must update its validator, JSON schema, installed assets, package inventory, documentation, and tests together.
143
+ ## Mirrored runtime behaviour
109
144
 
110
- The dual-core sync rule: after editing `assets/aidlc/scripts/lib/store.mjs`, run `npm run sync-core` so `services/aidlc-coordination/src/lifecycle-core.mjs` stays byte-identical.
145
+ - TypeScript powers the package CLI; installed projects use the dependency-free mirror in `assets/aidlc/scripts/`. Lifecycle, state, gate, profile, or context changes keep parity and add coverage for both.
146
+ - A public configuration or schema change updates validator, JSON schema, installed assets, package inventory, docs, and tests together.
147
+ - Dual-core sync rule: after editing `assets/aidlc/scripts/lib/store.mjs`, run `npm run sync-core` so `services/aidlc-coordination/src/lifecycle-core.mjs` stays byte-identical.
111
148
 
112
149
  ## Code style and conventions
113
150
 
114
- Adopted as the project baseline (approved decision `D1-convention-standard` on task `refactor-source-readability`):
151
+ Baseline (decision `D1-convention-standard`, task `refactor-source-readability`):
115
152
 
116
- - **Strict TypeScript, no new dependencies for tooling.** Keep `strict` mode; enforce via `npm run lint` (`tsc --noEmit`). No ESLint/Prettier for now.
117
- - **File size targets.** Aim for ≤250 lines per source file and ≤60 lines per function; split by domain responsibility when exceeded.
118
- - **Module boundaries.** One responsibility per module; a facade module may re-export a public API for compatibility (for example `src/state.ts`).
119
- - **Naming.** Descriptive camelCase for functions/variables, `PascalCase` for types/interfaces, `SCREAMING_SNAKE_CASE` for true constants; file names match their primary export.
120
- - **Error handling.** Fail with typed, one-line errors; never swallow exceptions silently; validate inputs before I/O.
121
- - **Dependencies.** Pass dependencies (fetch, clock, environment) explicitly as parameters; avoid module-level mutable state.
122
- - **Public API.** Document exported symbols with JSDoc when the contract is non-obvious.
123
- - **Behavior preservation.** Refactors must not change CLI output, state schema, file layout, or installed assets; run parity tests.
124
- - **Verification.** Run the narrowest relevant test while iterating; `npm test` + `npm run lint` before handing off.
153
+ - **Strict TypeScript.** Keep `strict`; enforce via `npm run lint` (`tsc --noEmit`). No ESLint/Prettier or other tooling deps.
154
+ - **Size.** ≤250 lines per file, ≤60 per function; split by responsibility.
155
+ - **Modules.** One responsibility each; a facade may re-export a public API (e.g. `src/state.ts`).
156
+ - **Naming.** camelCase functions/variables, `PascalCase` types, `SCREAMING_SNAKE_CASE` constants; file name matches primary export.
157
+ - **Errors.** Typed one-line errors; never swallow; validate inputs before I/O.
158
+ - **Dependencies.** Pass fetch, clock, environment explicitly; no module-level mutable state.
159
+ - **Public API.** JSDoc exported symbols with non-obvious contracts.
160
+ - **Behavior preservation.** Refactors never change CLI output, state schema, file layout, or installed assets; run parity tests.
161
+ - **Verification.** Narrowest test while iterating; `npm test` + `npm run lint` before handoff.
125
162
 
126
163
  ## Safe implementation rules
127
164
 
128
- - Resolve all project-relative paths through the shared path helpers; reject traversal and symlink escape.
129
- - Keep installation, migration, and upgrade plans deterministic and conflict-first.
165
+ - Resolve project-relative paths through the shared path helpers; reject traversal and symlink escape.
166
+ - Keep install, migration, and upgrade plans deterministic and conflict-first.
130
167
  - Preserve project-owned configuration and state when changing managed assets.
131
- - Do not add remote profile discovery, runtime asset downloads, executable plugin hooks, registry checks, or shell-string command execution.
132
- - Treat human-gated lifecycle transitions as atomic, auditable state operations.
133
-
134
- Read [Architecture](./architecture.md) before changing a module boundary, migration, installed script, or bundle layout.
168
+ - Never add remote profile discovery, runtime asset downloads, executable plugin hooks, registry checks, or shell-string execution.
169
+ - Human-gated lifecycle transitions are atomic, auditable state operations.
170
+ - Read [Architecture](./architecture.md) before changing a module boundary, migration, installed script, or bundle layout.
135
171
 
136
172
  ## Contributing to prompt assets
137
173
 
138
- Prompt assets are the installed workflow contracts under `assets/aidlc/` (notably `orchestrator.md` and `phase-*.md`). They feed the phase packets generated by `context.mjs`.
174
+ Prompt assets are the contracts under `assets/aidlc/` (`orchestrator.md`, `phase-*.md`) that `context.mjs` turns into phase packets.
139
175
 
140
- - Keep them compact: the default phase-packet budget is 16,000 characters (`config.context.maxChars`). Optional rules and diagnostics are omitted first; the next-action contract, full phase contract, approved decisions, safety/spec anchors, task state, and applicable latest evidence are mandatory and are never truncated — if they do not fit, packet generation fails instead.
141
- - Heading invariants are enforced by `gate-check.mjs`:
176
+ - Keep them compact: default packet budget is 16,000 characters (`config.context.maxChars`); optional rules and diagnostics drop first.
177
+ - Never truncated (generation fails instead): next-action contract, phase contract, approved decisions, safety/spec anchors, task state, latest applicable evidence.
178
+ - Heading invariants enforced by `gate-check.mjs`:
142
179
  - Intent (`G0_confirm`): `## 📋 Problem`, `## 🗺️ Affected areas`, `## 💭 Assumptions`, `## ❓ Open questions`, `## 🎯 Scope`.
143
180
  - Design (`G1_review`): `## 🧩 Solution per affected area`, `## 📌 Spec traceability`, `## 🔗 Cross-service contracts`, `## ⚠️ Risks / edge cases`.
144
- - When changing contracts, run `npm run release:check` (`--adapters opencode`) and the evaluator suite; update docs and tests in the same change.
145
- - Never duplicate canonical agent instructions in overview docs; point to the installed assets instead. See [Design decisions](./design-decisions.md) (D6) for the compact-style rationale.
181
+ - After changing contracts, run `npm run release:check` (`--adapters opencode`) and the evaluator suite; update docs and tests in the same change. Rationale: [Design decisions](./design-decisions.md) D6.
182
+
183
+ ## Documentation conventions
184
+
185
+ Follow [Adding or changing a page](./README.md#adding-or-changing-a-page). In addition:
186
+
187
+ - A public contract change (command, config field, schema, installed asset) updates its guide and the asserting test in the same change.
188
+ - Never duplicate canonical agent instructions from `assets/aidlc/`; link to the installed asset.
189
+
190
+ ## Related
191
+
192
+ - [Testing and release](./testing-and-release.md)
193
+ - [Architecture](./architecture.md)
194
+ - [Design decisions](./design-decisions.md)
195
+ - [Configuration](./configuration.md)