@felixdotgo/aidlc-kit 0.0.1 → 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 (123) hide show
  1. package/DEVELOPMENT.md +1 -1
  2. package/README.md +20 -9
  3. package/dist/assets/.agents/aidlc/conventions.md +8 -8
  4. package/dist/assets/.agents/aidlc/orchestrator.md +15 -10
  5. package/dist/assets/.agents/aidlc/phase-build.md +7 -7
  6. package/dist/assets/.agents/aidlc/phase-clarify.md +3 -3
  7. package/dist/assets/.agents/aidlc/phase-plan.md +6 -6
  8. package/dist/assets/.agents/aidlc/phase-wrap.md +1 -1
  9. package/dist/assets/.agents/aidlc/schemas/manifest.schema.json +1 -1
  10. package/dist/assets/.agents/aidlc/scripts/assignment.mjs +36 -0
  11. package/dist/assets/.agents/aidlc/scripts/context.mjs +2 -0
  12. package/dist/assets/.agents/aidlc/scripts/gate-check.mjs +2 -0
  13. package/dist/assets/.agents/aidlc/scripts/gate-view.mjs +2 -0
  14. package/dist/assets/.agents/aidlc/scripts/lib/assignment-store.mjs +181 -0
  15. package/dist/assets/.agents/aidlc/scripts/lib/authority.mjs +3 -0
  16. package/dist/assets/.agents/aidlc/scripts/lib/context-runtime.mjs +13 -1
  17. package/dist/assets/.agents/aidlc/scripts/lib/feature-store.mjs +70 -0
  18. package/dist/assets/.agents/aidlc/scripts/lib/loop-drivers.mjs +220 -0
  19. package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-cli.mjs +183 -0
  20. package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-remote.mjs +100 -0
  21. package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-supervisor.mjs +58 -0
  22. package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet.mjs +320 -0
  23. package/dist/assets/.agents/aidlc/scripts/lib/loop-git.mjs +284 -0
  24. package/dist/assets/.agents/aidlc/scripts/lib/loop-intake.mjs +51 -0
  25. package/dist/assets/.agents/aidlc/scripts/lib/loop-lead-artifacts.mjs +63 -0
  26. package/dist/assets/.agents/aidlc/scripts/lib/loop-lead-broker.mjs +53 -0
  27. package/dist/assets/.agents/aidlc/scripts/lib/loop-lead-local-broker.mjs +44 -0
  28. package/dist/assets/.agents/aidlc/scripts/lib/loop-lead-sandbox.mjs +88 -0
  29. package/dist/assets/.agents/aidlc/scripts/lib/loop-lease.mjs +89 -0
  30. package/dist/assets/.agents/aidlc/scripts/lib/loop-local-gate-receipt.mjs +32 -0
  31. package/dist/assets/.agents/aidlc/scripts/lib/loop-local-workers.mjs +162 -0
  32. package/dist/assets/.agents/aidlc/scripts/lib/loop-planner.mjs +13 -0
  33. package/dist/assets/.agents/aidlc/scripts/lib/loop-runtime.mjs +260 -0
  34. package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor-local.mjs +131 -0
  35. package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor-run-local.mjs +55 -0
  36. package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor.mjs +101 -0
  37. package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-docker.mjs +32 -0
  38. package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-snapshot.mjs +66 -0
  39. package/dist/assets/.agents/aidlc/scripts/lib/remote-state-client.mjs +112 -0
  40. package/dist/assets/.agents/aidlc/scripts/lib/store.mjs +41 -6
  41. package/dist/assets/.agents/aidlc/scripts/loop-entry.mjs +90 -0
  42. package/dist/assets/.agents/aidlc/scripts/loop-gate.mjs +58 -0
  43. package/dist/assets/.agents/aidlc/scripts/loop.mjs +36 -0
  44. package/dist/assets/.agents/aidlc/scripts/remote-state.mjs +311 -0
  45. package/dist/assets/.agents/aidlc/scripts/render.mjs +2 -0
  46. package/dist/assets/.agents/aidlc/scripts/state.mjs +71 -11
  47. package/dist/assets/.agents/aidlc/scripts/task-next.mjs +2 -0
  48. package/dist/assets/.agents/aidlc/templates/model-contract.md +3 -3
  49. package/dist/assets/.agents/aidlc/templates/workplan.md +2 -2
  50. package/dist/assets/.agents/skills/aidlc-build/SKILL.md +2 -2
  51. package/dist/assets/.agents/skills/aidlc-clarify/SKILL.md +2 -2
  52. package/dist/assets/.agents/skills/aidlc-plan/SKILL.md +2 -2
  53. package/dist/assets/.agents/skills/aidlc-wrap/SKILL.md +1 -1
  54. package/dist/services/aidlc-coordination/.env.fleet.example +11 -0
  55. package/dist/services/aidlc-coordination/compose.yaml +23 -2
  56. package/dist/services/aidlc-coordination/package-lock.json +1 -0
  57. package/dist/services/aidlc-coordination/package.json +2 -1
  58. package/dist/services/aidlc-coordination/src/coordination.mjs +1 -1
  59. package/dist/services/aidlc-coordination/src/fleet-client.mjs +36 -0
  60. package/dist/services/aidlc-coordination/src/fleet-run.mjs +18 -0
  61. package/dist/services/aidlc-coordination/src/fleet.mjs +233 -0
  62. package/dist/services/aidlc-coordination/src/git-gateway.mjs +50 -0
  63. package/dist/services/aidlc-coordination/src/lifecycle-core.mjs +41 -6
  64. package/dist/services/aidlc-coordination/src/repository.mjs +167 -4
  65. package/dist/services/aidlc-coordination/src/server.mjs +53 -9
  66. package/dist/services/aidlc-coordination/test/fleet.test.mjs +351 -0
  67. package/dist/services/aidlc-coordination/test/git-gateway.test.mjs +75 -0
  68. package/dist/services/aidlc-coordination/test/supervisor-fencing.test.mjs +59 -0
  69. package/dist/src/adapters.js +32 -5
  70. package/dist/src/cli.js +146 -70
  71. package/dist/src/context.js +2 -0
  72. package/dist/src/gate.d.ts +1 -0
  73. package/dist/src/gate.js +51 -38
  74. package/dist/src/installer.d.ts +10 -1
  75. package/dist/src/installer.js +157 -37
  76. package/dist/src/managed-content.js +1 -1
  77. package/dist/src/model.d.ts +16 -1
  78. package/dist/src/model.js +1 -1
  79. package/dist/src/profiles.d.ts +9 -1
  80. package/dist/src/profiles.js +37 -3
  81. package/dist/src/project-migration.d.ts +1 -0
  82. package/dist/src/project-migration.js +7 -0
  83. package/dist/src/state/archive.d.ts +17 -0
  84. package/dist/src/state/archive.js +60 -0
  85. package/dist/src/state/items.d.ts +25 -0
  86. package/dist/src/state/items.js +146 -0
  87. package/dist/src/state/lessons.d.ts +7 -0
  88. package/dist/src/state/lessons.js +67 -0
  89. package/dist/src/state/lifecycle.d.ts +5 -0
  90. package/dist/src/state/lifecycle.js +78 -0
  91. package/dist/src/state/lock.d.ts +7 -0
  92. package/dist/src/state/lock.js +124 -0
  93. package/dist/src/state/memory.d.ts +8 -0
  94. package/dist/src/state/memory.js +88 -0
  95. package/dist/src/state/render.d.ts +26 -0
  96. package/dist/src/state/render.js +29 -0
  97. package/dist/src/state/shared.d.ts +29 -0
  98. package/dist/src/state/shared.js +71 -0
  99. package/dist/src/state/store.d.ts +4 -0
  100. package/dist/src/state/store.js +81 -0
  101. package/dist/src/state/transitions.d.ts +21 -0
  102. package/dist/src/state/transitions.js +93 -0
  103. package/dist/src/state/validate.d.ts +4 -0
  104. package/dist/src/state/validate.js +100 -0
  105. package/dist/src/state.d.ts +15 -110
  106. package/dist/src/state.js +15 -764
  107. package/dist/src/tracker.d.ts +7 -0
  108. package/dist/src/tracker.js +3 -0
  109. package/dist/src/upgrade-board.d.ts +5 -0
  110. package/dist/src/upgrade-board.js +89 -0
  111. package/dist/src/upgrade.d.ts +5 -6
  112. package/dist/src/upgrade.js +211 -193
  113. package/dist/src/workflow.d.ts +1 -0
  114. package/dist/src/workflow.js +3 -2
  115. package/docs/README.md +4 -4
  116. package/docs/architecture.md +10 -2
  117. package/docs/command-reference.md +72 -11
  118. package/docs/configuration.md +26 -4
  119. package/docs/coordination-service.md +59 -3
  120. package/docs/development.md +16 -2
  121. package/docs/operating-workflow.md +53 -14
  122. package/docs/testing-and-release.md +53 -10
  123. package/package.json +3 -3
@@ -23,15 +23,16 @@ export const initialProjectFiles = () => [
23
23
  { path: ".agents/data/lessons/index.json", owner: "aidlc-state", ownershipClass: "state", content: `${JSON.stringify(createLessonIndex([], lessonStateDigest(emptyState())), null, 2)}\n` },
24
24
  { path: ".agents/data/memory/agentic-memory.json", owner: "aidlc-memory", ownershipClass: "project", content: `${JSON.stringify(emptyMemoryRegistry(), null, 2)}\n` }
25
25
  ];
26
+ export const manifestKey = (spec) => spec.strategy === "managed-block" ? `${spec.path}#${spec.owner}` : spec.path;
26
27
  export const manifestFor = (files, adapters) => ({
27
28
  schemaVersion: 2,
28
29
  packageVersion: packageJson.version,
29
30
  workflow: "AI-DLC",
30
31
  source: "local-package-assets",
31
32
  remoteUpdates: false,
32
- managedBy: "aidlc-workflow",
33
+ managedBy: "aidlc-kit",
33
34
  adapters,
34
- files: Object.fromEntries(files.filter((file) => file.ownershipClass === "managed" || !file.ownershipClass).map((file) => [file.path, {
35
+ files: Object.fromEntries(files.filter((file) => file.ownershipClass === "managed" || !file.ownershipClass).map((file) => [manifestKey(file), {
35
36
  hash: contentHash(file.strategy === "managed-block" ? file.content.trimEnd() : file.content),
36
37
  owner: file.owner,
37
38
  strategy: file.strategy ?? "replace"
package/docs/README.md CHANGED
@@ -6,9 +6,9 @@ Use this page to choose the guide that matches your role and next task.
6
6
 
7
7
  1. Start with the repository [README](../README.md) to install the workflow.
8
8
  2. Read [Operating the workflow](./operating-workflow.md) before asking an agent to change a project.
9
- 3. Use [Configuration](./configuration.md) to configure project rules, profiles, and Codex/Claude permissions.
9
+ 3. Use [Configuration](./configuration.md) to configure project rules, profiles, and Codex, Claude Code, and OpenCode permissions.
10
10
  4. Keep [Command reference](./command-reference.md) nearby for safe CLI usage.
11
- 5. Read [AI-DLC Coordination service](./coordination-service.md) before enabling remote canonical state.
11
+ 5. Read [AI-DLC Coordination service](./coordination-service.md) before enabling remote canonical state — the service and the loop are **experimental and unfinished**, with known bugs and possible breaking changes in every release before `1.0.0`.
12
12
 
13
13
  ## For contributors and maintainers
14
14
 
@@ -21,11 +21,11 @@ Use this page to choose the guide that matches your role and next task.
21
21
  | Page | Audience | Purpose |
22
22
  | --- | --- | --- |
23
23
  | [Operating the workflow](./operating-workflow.md) | Operators | Lifecycle, task state, human gates, and blocked work. |
24
- | [Configuration](./configuration.md) | Operators and maintainers | Project configuration, profile precedence, rules, and Codex/Claude permissions. |
24
+ | [Configuration](./configuration.md) | Operators and maintainers | Project configuration, profile precedence, rules, and Codex, Claude Code, and OpenCode permissions. |
25
25
  | [Command reference](./command-reference.md) | Operators | Package CLI commands, flags, previews, and safety limits. |
26
26
  | [Development](./development.md) | Contributors | Dependencies, source layout, local commands, and implementation rules. |
27
27
  | [Testing and release](./testing-and-release.md) | Maintainers | Test strategy, evaluator, package smoke test, and release checks. |
28
28
  | [Architecture](./architecture.md) | Contributors | Boundaries, dependency direction, and source-to-consumer flow. |
29
- | [AI-DLC Coordination service](./coordination-service.md) | Operators | Opt-in service deployment, state authority, and credential safety. |
29
+ | [AI-DLC Coordination service](./coordination-service.md) | Operators | Opt-in service deployment, state authority, and credential safety. Experimental and unfinished: known bugs, breaking changes possible before `1.0.0`. |
30
30
 
31
31
  When a public command, configuration field, or installed layout changes, update the relevant guide and its validation in the same change.
@@ -45,7 +45,12 @@ The installed kernel consists of contracts, templates, schemas, profiles, and de
45
45
  | `.agents/data/` | Project owned | Canonical state, task artifacts, derived indexes, memory, and evidence. |
46
46
  | `.agents/project/` | Project owned | Local profiles, rules, and evaluation material. |
47
47
 
48
- The state machine enforces the lifecycle; gates require explicit human approval; evidence is append-only. Installed scripts remain usable without an `aidlc-workflow` executable or a duplicate board file.
48
+ The state machine enforces the lifecycle; gates require explicit human approval; evidence is append-only. Installed scripts remain usable without an `aidlc-kit` executable or a duplicate board file.
49
+
50
+ > [!WARNING]
51
+ > The interactive-loop support and the end-to-end loop/fleet coordinator described below are **experimental and unfinished**: they contain known bugs and rough edges, and — because the package is still pre-1.0 (`0.x`) — their command surface, configuration fields, and state layout can change incompatibly in any release before `1.0.0`.
52
+
53
+ The interactive loop runs inside the current Codex, Claude Code, or OpenCode conversation. Native workers use local assignment records under `.agents/data/loop/`; those records hold claims and checkpoints while `.agents/data/state/` remains lifecycle authority. The optional headless fleet runner uses the coordination service's PostgreSQL state, fenced lead and worker claims, and Git commit handoff. Its assignment records are operational metadata; task phase, evidence, and gates stay in the canonical lifecycle state. All hosts derive dispatch from task `nextAction` and dependency-ready work.
49
54
 
50
55
  Installed entry points share a strict dependency-free argv parser. Parsing and command-shape validation precede root discovery, lock acquisition, and state reads. Explicit roots are validated project directories; implicit roots use nearest-ancestor `.agents/aidlc/` discovery and never fall back to writing beneath an arbitrary working directory.
51
56
 
@@ -54,7 +59,7 @@ Installed entry points share a strict dependency-free argv parser. Parsing and c
54
59
  - Workflow assets are local package assets. The manifest records `remoteUpdates: false`; status and doctor do not consult a registry.
55
60
  - Install/upgrade plans are conflict-first, path-contained, and reject unsafe symlink traversal.
56
61
  - Human-only upgrade is an intentional boundary: interactive confirmation is required and agents must not run or discover upgrades.
57
- - Only Codex and Claude Code adapters are installed. Codex uses trusted project-scoped `.codex/config.toml` and `.codex/rules/aidlc.rules`; Claude Code scopes lifecycle-script permission through its local settings and phase skills.
62
+ - Codex, Claude Code, and OpenCode adapters are installed. Codex uses trusted project-scoped `.codex/config.toml` and `.codex/rules/aidlc.rules`; Claude Code scopes lifecycle-script permission through its local settings and phase skills. OpenCode gets an owner-scoped `AGENTS.md` block only, and `.opencode/` is read solely for detection, so no OpenCode configuration, MCP, or permission file is overridden.
58
63
  - Project commands are configured as executable-and-argument arrays rather than opaque shell strings.
59
64
  - Canonical state, terminal records, and rendered workplans reject symlink traversal and use same-directory atomic replacement. Lock acquisition is guard-serialized, while release verifies the owner token directly so a contended guard cannot strand the owner's main lock.
60
65
  - The compact master catalog remains archive authority. Recovery can replace only a valid, unreferenced terminal orphan tied by `id` and `createdAt` to the still-active catalog task; referenced, malformed, and identity-conflicting records fail closed.
@@ -70,3 +75,6 @@ Installed entry points share a strict dependency-free argv parser. Parsing and c
70
75
  | A public command | CLI parsing, README/setup guidance, command reference, and package tests. |
71
76
 
72
77
  Use this guide with [Development](./development.md) and [Testing and release](./testing-and-release.md) before changing a cross-cutting boundary.
78
+
79
+
80
+ The optional end-to-end loop coordinator is implemented for both authorities. Local mode runs a foreground supervisor over the canonical local state: Docker-isolated workers, a read-only lead sandbox whose structured proposals are applied by a host broker, and gate approval only through the trusted host terminal. Fleet mode runs the same loop against a coordination service: the service owns supervisor leases, gate checkpoints, and reviewer approval, workers execute in Docker with their own credentials, and Git integration is fenced per backend (SQLite on one host with a local volume, or PostgreSQL across hosts). Selecting a mode configures the loop; only an explicit `loop start` runs it. Host-executed lead turns accept Codex, Claude Code, or OpenCode; container-isolated lead turns and worker containers accept Codex and Claude Code only and reject OpenCode with an explicit diagnostic because its credentials are file-based. See [Coordination service](./coordination-service.md) for deployment and recovery constraints.
@@ -1,21 +1,23 @@
1
1
  # Command reference
2
2
 
3
- All package commands operate on local files. The examples run version `0.0.1` through npm; `npx` may ask permission to fetch that package on first use. Replace `.` with the target project path when needed. For a source checkout, see the [development guide](./development.md).
3
+ All package commands operate on local files. The examples run version `0.1.1` through npm; `npx` may ask permission to fetch that package on first use. Replace `.` with the target project path when needed. For a source checkout, see the [development guide](./development.md).
4
4
 
5
5
  ## `init`
6
6
 
7
7
  ```sh
8
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow init [path] [--agent <name[,name]> | --all] [--yes] [--dry-run] [--force]
8
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit init [path] [--agent <name[,name]> | --all] [--loop-mode off|local|fleet] [--loop-lead codex|claude|opencode] [--loop-workers <id=provider,...>] [--yes] [--dry-run] [--force]
9
9
  ```
10
10
 
11
11
  Plans the installation, prints a preview, and then writes the workflow only after confirmation (or `--yes`). `--dry-run` prints the same plan without writing. If exactly one installed agent is detected, it can be selected automatically. In an interactive terminal, choose multiple agents with the checkbox prompt: use arrow keys to move, Space to toggle, A to toggle all, and Enter to confirm. For scripts and non-interactive terminals, use `--agent <name[,name]>` or `--all`.
12
12
 
13
+ In interactive setup, choose a loop mode and, when enabled, the lead and worker providers. For non-interactive setup, omit loop options to keep the default off, or specify `--loop-mode local|fleet` together with `--loop-lead` and `--loop-workers` (for example, `--loop-workers a=codex,b=opencode`). The preview includes the project config change. These settings only configure the loop; run `aidlc-kit loop start` to actually start it. The loop and the coordination service are experimental: their flags and defaults may change incompatibly in any release before `1.0.0`.
14
+
13
15
  `--force` is for an intentional initial replacement of an unmanaged conflicting file. It is not an upgrade mechanism. If the project already has another workflow package version, use the human-run upgrade flow instead.
14
16
 
15
17
  ## `status`
16
18
 
17
19
  ```sh
18
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow status [path]
20
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit status [path]
19
21
  ```
20
22
 
21
23
  Reports the installed version and local installation status. It does not query a registry.
@@ -23,7 +25,7 @@ Reports the installed version and local installation status. It does not query a
23
25
  ## `doctor`
24
26
 
25
27
  ```sh
26
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow doctor [path] [--strict]
28
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit doctor [path] [--strict]
27
29
  ```
28
30
 
29
31
  Checks the local manifest, configuration, and canonical state. `--strict` turns compatibility warnings such as a legacy manifest into errors. It does not query a registry.
@@ -31,7 +33,7 @@ Checks the local manifest, configuration, and canonical state. `--strict` turns
31
33
  ## `profile validate`
32
34
 
33
35
  ```sh
34
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow profile validate [path]
36
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit profile validate [path]
35
37
  ```
36
38
 
37
39
  Loads `.agents/config.json`, resolves its profile chain, and prints the effective profile order. Use it after changing `extends` or local profiles.
@@ -39,7 +41,7 @@ Loads `.agents/config.json`, resolves its profile chain, and prints the effectiv
39
41
  ## `uninstall`
40
42
 
41
43
  ```sh
42
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow uninstall [path] [--yes] [--dry-run]
44
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit uninstall [path] [--yes] [--dry-run]
43
45
  ```
44
46
 
45
47
  Prints the removal plan before applying it. It removes eligible unchanged managed assets but preserves project configuration and state. Prefer `--dry-run` first when working in an existing project.
@@ -47,7 +49,7 @@ Prints the removal plan before applying it. It removes eligible unchanged manage
47
49
  ## `mcp setup`
48
50
 
49
51
  ```sh
50
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow mcp setup [path] [--dry-run] [--yes] [--storage sqlite|postgres] [--deployment docker|remote] [--bind localhost|network] [--workspace <id>] [--poll-ms <n>] [--enable]
52
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit mcp setup [path] [--dry-run] [--yes] [--storage sqlite|postgres] [--deployment docker|remote] [--bind localhost|network] [--workspace <id>] [--poll-ms <n>] [--enable]
51
53
  ```
52
54
 
53
55
  Previews the optional AI-DLC Coordination service configuration, then writes only after confirmation. Non-interactive use requires `--deployment`, `--storage`, `--bind`, and `--workspace`. It never starts Docker; `--enable` is explicit and remote mode has no local fallback. See [AI-DLC Coordination service](./coordination-service.md) for deployment and credential requirements.
@@ -55,13 +57,32 @@ Previews the optional AI-DLC Coordination service configuration, then writes onl
55
57
  ## `upgrade`
56
58
 
57
59
  ```sh
58
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow upgrade [path] [--dry-run]
60
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit upgrade [path] [--loop-mode off|local|fleet] [--loop-lead codex|claude|opencode] [--loop-workers <id=provider,...>] [--dry-run]
59
61
  ```
60
62
 
61
63
  Upgrade is deliberately human-only. The command rejects `--yes` and `--force`; applying it requires an interactive terminal and an exact typed confirmation of the package version. Interactive confirmations use the same styled terminal prompt as `init`. Agents must not run, preview, detect, or suggest package upgrades on their own.
62
64
 
65
+ An omitted loop selection preserves the existing config; an explicit selection appears in the preview and is included in the upgrade backup and rollback. Enabling a mode requires a lead and worker mapping.
66
+
63
67
  The upgrade plan handles supported legacy `.aidlc/` project data transactionally: identical paths are deduplicated, differing content or unsafe entries stop the plan, and an audit backup supports rollback. Review the preview before an authorised human applies it.
64
68
 
69
+ ## `loop`
70
+
71
+ ```sh
72
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit loop start|status|resume [options]
73
+ ```
74
+
75
+ > [!WARNING]
76
+ > The loop commands and fleet mode are **experimental and unfinished**: they contain known bugs and rough edges, and — because the package is still pre-1.0 (`0.x`) — their options, environment variables, and diagnostics can change incompatibly in any release before `1.0.0`.
77
+
78
+ Options: `--task-id <id>` (optional for `start`, which derives one; required for `status`/`resume`), `--root <path>`, and `--mode local|fleet` (defaults to the configured `loop.mode`). `start` reads the requirement from an interactive prompt or stdin — the requirement is never passed as an argument. The command fails closed when the requested mode does not match the configured authority, when another task is actionable, or when a resume record is missing.
79
+
80
+ `status` prints the canonical task, its derived next action, and — in fleet mode — the durable gate checkpoint. `start` and `resume` run the supervisor in the foreground until the next gate, a pause, a blocked state, or completion; the emitted events include each gate view and the waiting state.
81
+
82
+ Local mode requires the Docker worker image configuration described in [Testing and release](./testing-and-release.md) plus the provider credential environment; approval happens through the trusted host terminal command `node .agents/aidlc/scripts/loop-gate.mjs <task-id>`, which refuses piped input.
83
+
84
+ Fleet mode requires the running coordination service (`AIDLC_FLEET_URL`, `AIDLC_FLEET_WORKSPACE`, lead `AIDLC_FLEET_TOKEN`, `AIDLC_FLEET_INTEGRATION_BRANCH`, and optionally `AIDLC_FLEET_GIT_REMOTE`); worker IDs must match the configured `loop.agents.workers`, and `AIDLC_FLEET_WORKER_PROVIDERS` may map each worker to `codex`, `claude`, or `opencode`. The facade preflights the service and the integration branch and fails closed with a diagnosis instead of falling back to local. Fleet worker containers reject `opencode` with the container diagnostic above; assignment validation accepts it so that blocker surfaces when the job executes rather than being reported as an invalid provider. Fleet workers run separately through the fleet runner (`worker --once`) on each worker machine with `AIDLC_WORKER_DOCKER_IMAGE` and their own worker credential; a reviewer approves gates through the reviewer credential as documented in [Coordination service](./coordination-service.md).
85
+
65
86
  ## Installed lifecycle scripts
66
87
 
67
88
  After `init`, task lifecycle commands live in the target project, not in the package CLI:
@@ -71,10 +92,50 @@ node .agents/aidlc/scripts/state.mjs task list --limit 20
71
92
  node .agents/aidlc/scripts/state.mjs task find --query "<words>" --include-archive
72
93
  node .agents/aidlc/scripts/state.mjs task show <task-id>
73
94
  node .agents/aidlc/scripts/state.mjs task next <task-id>
95
+ node .agents/aidlc/scripts/state.mjs task ready <task-id>
96
+ node .agents/aidlc/scripts/state.mjs feature create <feature-id> --branch <integration-branch>
97
+ node .agents/aidlc/scripts/state.mjs feature link <feature-id> <task-id> [--depends-on <task-id,...>]
98
+ node .agents/aidlc/scripts/state.mjs feature ready <feature-id>
74
99
  node .agents/aidlc/scripts/task-next.mjs <task-id> --require-stop
75
100
  node .agents/aidlc/scripts/gate-view.mjs <task-id>
76
101
  ```
77
102
 
103
+ The normal interactive loop runs in the current Codex, Claude Code, or OpenCode conversation, using native agents and the installed lifecycle commands. The optional `loop.mjs` command is for unattended CLI execution:
104
+
105
+ ```sh
106
+ node .agents/aidlc/scripts/loop.mjs run <task-id> --agent codex|claude|opencode [--max-turns N] [--turn-timeout-ms N] [--max-stall-turns N] [--root PATH]
107
+ node .agents/aidlc/scripts/loop.mjs resume <task-id> [--max-turns N] [--turn-timeout-ms N] [--max-stall-turns N] [--root PATH]
108
+ node .agents/aidlc/scripts/loop.mjs status <task-id> [--root PATH]
109
+ ```
110
+
111
+ `--agent opencode` requires `AIDLC_OPENCODE_MODEL` in `provider/model[#variant]` form; the turn fails closed without it. Docker-isolated lead turns, local Docker worker batches, and fleet worker containers reject OpenCode with `OpenCode workers require file-based credentials and are not available in isolated containers yet` and do not fall back to the host. Use `loop.mjs run --agent opencode` for host-executed lead turns, or use Codex or Claude Code where container isolation is required.
112
+
113
+ The defaults are 12 turns and 10 minutes per turn; two completed turns without observable progress stop the run. Each run records its provider, and `resume` rejects a different agent. The runner never grants human approval. An interactive client can resume by reading `task next` and reconciling local assignment metadata; fleet execution uses fenced service leases and the remote canonical state.
114
+
115
+ If context preparation fails before an agent turn starts, the loop pauses with a reason; fix the context problem and use `resume`. An interrupted running turn with no captured session ID still requires inspection of canonical state before recovery.
116
+
117
+ The fleet runner drives the supervised multi-worker flow against a coordination service. From the service deployment (a source checkout or the installed `.agents/aidlc-coordination/`), with the lead credential plus `AIDLC_FLEET_WORKER_IDS`, `AIDLC_FLEET_INTEGRATION_BRANCH`, and `AIDLC_FLEET_PROJECT_ROOT` set:
118
+
119
+ ```sh
120
+ node .agents/aidlc-coordination/src/fleet-run.mjs supervisor <task-id>
121
+ node .agents/aidlc-coordination/src/fleet-run.mjs coordinator <task-id> --once
122
+ node .agents/aidlc-coordination/src/fleet-run.mjs worker --once
123
+ ```
124
+
125
+ `supervisor` claims the task's supervisor lease, runs fenced lead turns through the coordinator, publishes each gate snapshot with its checkpoint in one service transaction, waits for the reviewer approval, and resumes automatically; it returns at a pause, blocked state, or completion, and never approves a gate. `coordinator --once` runs a single unattended pass without the supervisor lease. `worker --once` claims one ready assignment on a worker machine; it requires `AIDLC_WORKER_DOCKER_IMAGE` and that machine's worker credential and fails closed without them. `aidlc-kit loop start --mode fleet` wraps the same supervisor with requirement intake and preflight.
126
+
127
+ Fleet mode uses `remote-state.mjs` instead of local `state.mjs`. Set `AIDLC_FLEET_URL`, `AIDLC_FLEET_WORKSPACE`, and `AIDLC_FLEET_PROJECT_ROOT`; lead mutations additionally require `AIDLC_FLEET_TOKEN` and the current `AIDLC_FLEET_LEAD_EPOCH`. Claim an epoch before creating or changing a task:
128
+
129
+ ```sh
130
+ node .agents/aidlc/scripts/remote-state.mjs run claim <task-id>
131
+ node .agents/aidlc/scripts/remote-state.mjs task next <task-id>
132
+ node .agents/aidlc/scripts/remote-state.mjs phase context <task-id>
133
+ node .agents/aidlc/scripts/remote-state.mjs run release <task-id> --epoch <epoch>
134
+ ```
135
+
136
+ The same client supports task items, evidence, decisions, status, audited transitions, wrap lessons, and feature manifests through revision-checked remote mutations. It cannot approve gates with a lead token. A connected reviewer uses `gate inbox` and, only after an explicit later user reply, `gate approve <task-id> --snapshot <id> --source <reply>` with `AIDLC_FLEET_REVIEWER_TOKEN`. See [Coordination service](./coordination-service.md#multi-machine-loop-deployment) for bootstrap, fleet processes, and credentials.
137
+ When `AIDLC_FLEET_URL` is set, local lifecycle, context, gate, assignment, and standalone loop commands reject use so an unattended lead cannot accidentally mutate a second local authority. Unset it only when deliberately returning to a local run.
138
+
78
139
  Installed lifecycle options may appear before or after positionals and accept both `--name value` and `--name=value`. Unknown, duplicate, command-irrelevant, missing-value, and surplus positional arguments are rejected before state I/O. Boolean options such as `--all`, `--include-archive`, and `--require-stop` do not accept values. When a literal value begins with `--`, use the equals form so it is not confused with a missing value.
79
140
 
80
141
  An explicit `--root <path>` wins and must identify a directory containing `.agents/`. Without `--root`, the runtime walks upward from the current working directory and selects the nearest ancestor containing `.agents/aidlc/`. If no installed-workflow marker exists, the command fails without creating local state. Manual calls from a nested directory need an absolute or upward-relative script path so Node can locate the entry point. Runtime-generated actions always include both an absolute script path and an absolute `--root`, so they remain executable from any working directory.
@@ -83,7 +144,7 @@ Every `state.mjs` and `task-next.mjs` command prints one JSON envelope: `{ok: tr
83
144
 
84
145
  `task-next.mjs --require-stop` prints the current action plus a machine-readable `continuation` object in the stdout envelope — `{required, code, taskId, classification}` and, when work remains, `command`, `reason`, `itemId`, and `remainingItems` — and exits `2` when the classification is `run_phase`. The first stderr line is `CONTINUATION_REQUIRED: {json}` carrying the same task id, command, and reason (followed by an explicit "expected pause, not a failure" note); it is a local guard against a premature final response, and the caller must execute `continuation.command` instead of replying. It exits normally (`continuation.code = STOP_ALLOWED`) for a valid human gate, durable blocker, terminal outcome, or completion. The guard is detection at the package boundary: it cannot technically intercept a message a model host has already emitted, so hosts recover by running `task next <task-id>` in the next turn and executing its command. `task status ... --status blocked_on_user` fails instead of persisting when the current gate is not ready, and `gate-view.mjs` only renders tasks already in that validated status.
85
146
 
86
- Human approval is a dedicated atomic operation:
147
+ Human approval is a dedicated atomic operation. The displayed review steps map to stable `--gate` values: **Confirm requirements** → `G0_confirm`, **Approve plan** → `G1_review`, **Review implementation** → `G2_codereview`. Display labels are always English; task prose may follow the task language:
87
148
 
88
149
  ```sh
89
150
  node .agents/aidlc/scripts/state.mjs gate approve <task-id> --gate <gate> --source "<explicit approval>"
@@ -91,13 +152,13 @@ node .agents/aidlc/scripts/state.mjs gate approve <task-id> --gate <gate> --sour
91
152
 
92
153
  `--source` is audit provenance, not authentication or proof of consent. The host agent must invoke this command only in a later user turn that explicitly approves the gate currently presented.
93
154
 
94
- `evidence add` accepts `spec`, `test`, `lint`, `review`, and `diagnostic`; it rejects `approval`. An evidence `--area` must belong to the task's affected areas, and multi-area test or lint evidence must name its area. `task status` accepts `active`, `blocked_on_user`, and `paused` (`done` is not a status command; finish with `task transition --to done` or `task archive`), and rejects `blocked_on_user` at wrap, which has no human gate. Every route out of a validated `blocked_on_user` wait, including `paused`, requires audited `--reason` and `--source` metadata and appends diagnostic evidence; entering `paused` from `active` requires the same audited `--mode audited --reason --source` triple and appends a `Paused while active` diagnostic, while resuming `paused → active` needs no audit metadata. Repair bounds are machine-enforced: the third failed verify record per area, or the second failed review record, in the current build flips `nextAction` to `blocked` and adds a `REPAIR_BOUND` error to the G2 gate check. Normal phase advancement uses `gate approve`, and wrap completion uses `task transition --to done` or `task archive <task-id> --reason "<reason>" --source "<source>"`, which applies the same transition checks and appends an `Archive to done` diagnostic. The low-level transition escape hatch is intentionally noisy, records diagnostic evidence, still applies all transition checks, and requires audit metadata:
155
+ `evidence add` accepts `spec`, `test`, `lint`, `review`, and `diagnostic`; it rejects `approval`. An evidence `--area` must belong to the task's affected areas, and multi-area test or lint evidence must name its area. `task status` accepts `active`, `blocked_on_user`, and `paused` (`done` is not a status command; finish with `task transition --to done` or `task archive`), and rejects `blocked_on_user` at wrap, which has no human gate. Every route out of a validated `blocked_on_user` wait, including `paused`, requires audited `--reason` and `--source` metadata and appends diagnostic evidence; entering `paused` from `active` requires the same audited `--mode audited --reason --source` triple and appends a `Paused while active` diagnostic, while resuming `paused → active` needs no audit metadata. Repair bounds are machine-enforced: the third failed verify record per area, or the second failed review record, in the current build flips `nextAction` to `blocked` and adds a `REPAIR_BOUND` error to the Review implementation gate check. Normal phase advancement uses `gate approve`, and wrap completion uses `task transition --to done` or `task archive <task-id> --reason "<reason>" --source "<source>"`, which applies the same transition checks and appends an `Archive to done` diagnostic. The low-level transition escape hatch is intentionally noisy, records diagnostic evidence, still applies all transition checks, and requires audit metadata:
95
156
 
96
157
  ```sh
97
158
  node .agents/aidlc/scripts/state.mjs task transition <task-id> --to <phase> --mode audited --reason "<reason>" --source "<source>"
98
159
  ```
99
160
 
100
- Self-transitions are rejected, and `task create` rejects an id that collides case-insensitively with an existing task or archive record. `task create` also fails while any other task is actionable (`nextAction` classification `run_phase`); the error lists the actionable task ids and the exact `--switch-from <ids>` acknowledgement. Passing that flag — only with explicit user direction to switch — records a resume-marker diagnostic on each acknowledged task and never pauses, closes, or otherwise mutates its lifecycle; the acknowledged task remains the authoritative resume target. After a G1 reopen, all non-deferred execution items return to `todo`; prior G2, verification, and review evidence cannot satisfy the new build boundary, and repair-bound counters reset with it.
161
+ Self-transitions are rejected, and `task create` rejects an id that collides case-insensitively with an existing task or archive record. `task create` also fails while another unrelated task is actionable; its `--switch-from <ids>` acknowledgement still requires explicit user direction. `--feature <feature-id>` permits sibling tasks in an existing feature without abandoning them. `feature link` checks membership and task dependencies; `task item ... --depends-on <item-id,...> --owns <path,...>` adds item edges and an optional Git path scope. Fleet dispatch requires a nonempty path scope. Path scopes are normalized (trailing slashes stripped) and may name either a file or a directory; directory scopes cover every file beneath them. Missing and cyclic dependencies fail, and an item or feature task cannot finish before its prerequisites. After reopening the Approve plan step, all non-deferred execution items return to `todo`; prior Review implementation, verification, and review evidence cannot satisfy the new build boundary, and repair-bound counters reset with it.
101
162
 
102
163
  State writes and generated workplans use symlink-checked atomic replacement. State-lock release is owner-token checked and never removes a replacement owner's lock. If a process stops after writing a terminal archive record but before committing the catalog, a retry replaces that orphan only when the persisted catalog still contains the same active task identity and does not reference an archive record; malformed, referenced, or identity-conflicting records fail closed.
103
164
 
@@ -1,6 +1,6 @@
1
1
  # Configuration
2
2
 
3
- Each installed project owns its workflow configuration at `.agents/config.json`. It selects topology profiles, specification roots, safe verification commands, and local rules without changing the package-managed kernel. The package supports only Codex and Claude Code.
3
+ Each installed project owns its workflow configuration at `.agents/config.json`. It selects topology profiles, specification roots, safe verification commands, and local rules without changing the package-managed kernel. The package supports Codex, Claude Code, and OpenCode.
4
4
 
5
5
  ## Minimal configuration
6
6
 
@@ -42,10 +42,10 @@ Built-in topology profiles are:
42
42
  Arrays are stable-deduplicated. Command keys are last-wins, so a project can replace a profile command intentionally. Validate the resolved profile chain with:
43
43
 
44
44
  ```sh
45
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow profile validate .
45
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit profile validate .
46
46
  ```
47
47
 
48
- This command uses the npm package at version `0.0.1`. To run from a source checkout instead, see the [development guide](./development.md).
48
+ This command uses the npm package at version `0.1.1`. To run from a source checkout instead, see the [development guide](./development.md).
49
49
 
50
50
  ## Rules, project data, and managed assets
51
51
 
@@ -61,6 +61,8 @@ Keep business/domain rules in `.agents/project/rules/`. Do not edit managed kern
61
61
 
62
62
  The Codex adapter installs `.codex/config.toml` with `approval_policy = "on-request"` and `sandbox_mode = "workspace-write"`, plus `.codex/rules/aidlc.rules`. The execpolicy allowlists only the six lifecycle entry points under `node .agents/aidlc/scripts/`, allowing AI-DLC state transitions without granting general command approval. Each allowed lifecycle command must be run as its own exec invocation: joining commands with `&`, `&&`, `;`, or `|` creates shell command segments that are not covered by a single prefix rule. Codex loads this project config only after the user trusts the project; network access stays disabled unless the project separately enables it. Claude Code installs `.claude/settings.local.json` and phase skills that allow only `node .agents/aidlc/scripts/*`, so lifecycle state updates do not require repeated confirmation while general Bash commands remain unapproved.
63
63
 
64
+ The OpenCode adapter installs only an owner-scoped managed block in `AGENTS.md` and reads `.opencode/` solely to detect the adapter. It writes no OpenCode configuration, MCP, or permission file, so user and project OpenCode settings are not overridden. Codex and OpenCode blocks are independently owned and merge in the same `AGENTS.md` when both adapters are installed.
65
+
64
66
  ## Context and risk
65
67
 
66
68
  `context.maxChars` bounds a phase packet. The runtime preserves lifecycle instructions, approved decisions, and mandatory invariants; it fails clearly rather than silently truncating required contract content.
@@ -69,4 +71,24 @@ Set the default risk level deliberately. Planning, migrations, cross-service con
69
71
 
70
72
  ## Optional AI-DLC Coordination
71
73
 
72
- `mcp` is absent (or `{ "enabled": false }`) by default. An enabled configuration requires an HTTP(S) `endpoint` and non-empty `workspace`; it may also name a token environment variable, polling interval from 1,000 to 3,600,000 ms, and the enabled Jira/Trello/GitHub Issues preflight providers. See [AI-DLC Coordination service](./coordination-service.md) for the remote-authority and deployment contract.
74
+ `mcp` is absent (or `{ "enabled": false }`) by default. An enabled configuration requires an HTTP(S) `endpoint` and non-empty `workspace`; it may also name a token environment variable, polling interval from 1,000 to 3,600,000 ms, and the enabled Jira/Trello/GitHub Issues preflight providers. See [AI-DLC Coordination service](./coordination-service.md) for the remote-authority and deployment contract. The coordination service is **experimental and unfinished** (known bugs included), and it can change incompatibly in any release before `1.0.0`.
75
+
76
+ ## Optional loop configuration
77
+
78
+ > [!WARNING]
79
+ > The loop and the coordination service are **experimental and unfinished**: they contain known bugs and rough edges, and — because the package is still pre-1.0 (`0.x`) — the `loop.*` fields, provider mappings, and environment variables can change incompatibly in any release before `1.0.0`.
80
+
81
+ `loop.mode` can be `off`, `local`, or `fleet`; an absent `loop` field means `off`. The optional `loop.agents` maps one lead and named workers to `codex`, `claude`, or `opencode`, independently of `mcp.providers`:
82
+
83
+ ```json
84
+ {
85
+ "loop": {
86
+ "mode": "local",
87
+ "agents": { "lead": "codex", "workers": { "worker-a": "codex", "worker-b": "opencode" } }
88
+ }
89
+ }
90
+ ```
91
+
92
+ When any selected provider is `opencode`, set `AIDLC_OPENCODE_MODEL` to a `provider/model[#variant]` value such as `opencode-go/gpt-6-luna`. The provider turn fails closed without a valid value. Docker-isolated lead turns, local Docker worker batches, and fleet worker containers reject OpenCode with `OpenCode workers require file-based credentials and are not available in isolated containers yet`; they do not fall back to the host.
93
+
94
+ Configure this field through the init or human-run upgrade preview, or edit the project-owned config deliberately. Provider credentials do not belong in this object. The configuration is an opt-in selection; it does not install or start a service, authorize an upgrade, or grant gate approval. Selecting a mode alone does not start the loop — run `aidlc-kit loop start` explicitly. Existing fleet operations and storage requirements are documented in [Coordination service](./coordination-service.md).
@@ -1,5 +1,8 @@
1
1
  # AI-DLC Coordination service
2
2
 
3
+ > [!WARNING]
4
+ > The coordination service (and the end-to-end loop that builds on it) is **experimental and unfinished**: it contains known bugs and rough edges. The package is pre-1.0 (`0.x`), so setup flags, `mcp.*`/`loop.*` configuration, endpoints, environment variables, and storage behaviour can change incompatibly in any release before `1.0.0`. Do not treat it as a stable dependency yet.
5
+
3
6
  The optional AI-DLC Coordination service is a separate Docker-deployable authority for a workflow workspace. It is disabled by default: without an enabled `mcp` block, installed lifecycle scripts remain local and make no network calls.
4
7
 
5
8
  ## Safe setup
@@ -7,11 +10,11 @@ The optional AI-DLC Coordination service is a separate Docker-deployable authori
7
10
  Preview a configuration first. Outside an interactive terminal, provide all four selection flags.
8
11
 
9
12
  ```sh
10
- npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow mcp setup . --dry-run \
13
+ npx --package @felixdotgo/aidlc-kit@0.1.1 aidlc-kit mcp setup . --dry-run \
11
14
  --deployment docker --storage sqlite --bind localhost --workspace engineering
12
15
  ```
13
16
 
14
- This command uses the npm package at version `0.0.1`. To run from a source checkout instead, see the [development guide](./development.md).
17
+ This command uses the npm package at version `0.1.1`. To run from a source checkout instead, see the [development guide](./development.md).
15
18
 
16
19
  Remove `--dry-run` and confirm to create `.agents/aidlc-coordination/` and update `.agents/config.json`. Setup does not start Docker. Copy `.env.example` to a secret-managed `.env`, review it, then start explicitly:
17
20
 
@@ -25,6 +28,59 @@ Use SQLite only on the local Docker volume. Use PostgreSQL for multiple hosts. A
25
28
 
26
29
  When enabled, the remote workspace is canonical. Import/export is an explicit recovery or migration action; there is no background dual-write or local fallback during an outage. Clients pull a revision or poll `state_events_since`; the service provides neither realtime subscriptions nor push notifications.
27
30
 
31
+ ## Multi-machine loop deployment
32
+
33
+ The fleet service supports both approved storage backends: SQLite through one coordination service on one host with the database on a local volume (set `MCP_STATE_DATABASE=sqlite`, the default, and `MCP_STATE_SQLITE_PATH`), and PostgreSQL for deployments spanning multiple hosts or service instances. Each deployment keeps its chosen backend; there is no implicit fallback or migration between them. SQLite limits availability and write concurrency to that single host. Do not switch an existing authority automatically; follow the supported deployment below.
34
+
35
+ Fleet mode is separate from the default local service profile. The source checkout keeps its deployment template in `services/aidlc-coordination/`; human-run `mcp setup` copies it into the target project's `.agents/aidlc-coordination/`. Copy that directory's `.env.fleet.example` to a private `.env`, set the database choice and three distinct credential classes (`MCP_FLEET_LEAD_TOKEN`, `MCP_FLEET_REVIEWER_TOKEN`, and the worker-ID-to-token JSON map `MCP_FLEET_WORKER_TOKENS`), then start the fleet profile. From a source checkout:
36
+
37
+ ```sh
38
+ docker compose --env-file .env --profile fleet -f services/aidlc-coordination/compose.yaml up -d fleet-coordination
39
+ ```
40
+
41
+ For an installed project, use `-f .agents/aidlc-coordination/compose.yaml` instead.
42
+
43
+ The default host binding is `127.0.0.1:8788`. For workers on other machines, expose `POST /mcp` through a TLS reverse proxy and set the binding deliberately. Fleet mode requires the chosen database backend and a shared Git remote. Give each worker an isolated worktree, a scoped branch, and its own worker credential. A process supervisor must restart the supervisor, lead, and workers; after restart they reacquire fenced leases and reconcile reported or uncertain Git results before retrying.
44
+
45
+ The lead credential can advance lifecycle state only while holding the current task epoch. Worker credentials can claim, checkpoint, and report assigned jobs but cannot mutate lifecycle state or approve gates. The reviewer credential can read pending gate snapshots and record a later explicit human approval against the snapshot and current revision. When the database, Git remote, or reviewer is unavailable, the run waits or fails closed; it does not fall back to local state.
46
+
47
+ The installed remote lifecycle client needs `AIDLC_FLEET_URL` (the full HTTPS `/mcp` URL), `AIDLC_FLEET_WORKSPACE`, and `AIDLC_FLEET_PROJECT_ROOT` (absolute). Lead mutations also need `AIDLC_FLEET_TOKEN` and the current `AIDLC_FLEET_LEAD_EPOCH` from its claim.
48
+
49
+ Create the task records before the remote feature manifest. For each task, claim a lead epoch, export the returned `epoch`, then create it with the feature ID; repeat for sibling tasks. Once both records exist, create and link the manifest:
50
+
51
+ ```sh
52
+ node .agents/aidlc/scripts/remote-state.mjs run claim checkout-api
53
+ export AIDLC_FLEET_LEAD_EPOCH=<returned-epoch>
54
+ node .agents/aidlc/scripts/remote-state.mjs task create checkout-api --title "Checkout API" --feature checkout
55
+ node .agents/aidlc/scripts/remote-state.mjs run release checkout-api --epoch <returned-epoch>
56
+ # Repeat claim/create/release for checkout-ui and checkout-integration.
57
+ node .agents/aidlc/scripts/remote-state.mjs feature create checkout --branch feature/checkout --tasks checkout-api,checkout-ui,checkout-integration
58
+ node .agents/aidlc/scripts/remote-state.mjs feature link checkout checkout-integration --depends-on checkout-api,checkout-ui
59
+ node .agents/aidlc/scripts/remote-state.mjs feature ready checkout
60
+ ```
61
+
62
+ The service checks that every manifest member has a canonical task record with the matching feature ID. A partially created task stays fail-closed until the manifest is completed. The lead epoch is task-specific and must be refreshed after release or expiry.
63
+
64
+ In a connected reviewer conversation, configure `AIDLC_FLEET_REVIEWER_TOKEN`, inspect the pending packet, and only after the human replies approving that packet run:
65
+
66
+ ```sh
67
+ node .agents/aidlc/scripts/remote-state.mjs gate inbox
68
+ node .agents/aidlc/scripts/remote-state.mjs gate approve <task-id> --snapshot <snapshot-id> --source "<explicit user approval>"
69
+ ```
70
+
71
+ The second command checks that the snapshot remains current and uses the reviewer-only service operation. At G2 it also verifies that the snapshot's integration commit still matches the live remote branch. Protect the integration branch against writes outside the lead so it cannot change between verification and approval. The review message is the source provenance; the token authenticates the reviewer client, while the client operator remains responsible for using the user's actual later reply.
72
+
73
+ Run the packaged fleet process on a lead machine and worker machines under a process supervisor. Point every process to the same `AIDLC_FLEET_URL` and workspace, but give each its own role token. On the lead, set `AIDLC_FLEET_WORKER_IDS` (comma-separated), `AIDLC_FLEET_INTEGRATION_BRANCH`, and optionally `AIDLC_FLEET_AGENT` (`codex`, `claude`, or `opencode`); `AIDLC_FLEET_WORKER_PROVIDERS` can override the provider per worker. The `job_schedule` tool accepts the same three agent values, but worker containers reject `opencode` with `OpenCode workers require file-based credentials and are not available in isolated containers yet`. The explicit blocker is reported when the job executes; there is no silent host fallback. On each worker, set its matching `AIDLC_FLEET_WORKER_ID` and `AIDLC_FLEET_WORKTREES_ROOT`:
74
+
75
+ ```sh
76
+ node dist/services/aidlc-coordination/src/fleet-run.mjs feature <feature-id>
77
+ node dist/services/aidlc-coordination/src/fleet-run.mjs worker
78
+ ```
79
+
80
+ `coordinator <task-id>` runs one task. `--once` processes a bounded polling pass for supervision or diagnostics. Defaults are four worker jobs per feature, five-minute leases with one-minute heartbeat, 12 turns per phase or assignment, 10 minutes per turn, and two consecutive stalls. Set `AIDLC_FLEET_MAX_WORKERS`, `AIDLC_FLEET_LEASE_MS`, `AIDLC_FLEET_HEARTBEAT_MS`, `AIDLC_FLEET_MAX_TURNS`, `AIDLC_FLEET_TURN_TIMEOUT_MS`, and `AIDLC_FLEET_MAX_STALL_TURNS` to change them. Feature mode dispatches dependency-ready tasks in order from one integration checkout; independent items within the active task can use several machines concurrently. After a lost worker report, the lead checks remote Git state and stops for reconciliation if the outcome is ambiguous. Set `AIDLC_FLEET_CODE_ONLY_RETRY=1` to permit an automatic retry only after the prior turn's timeout window has elapsed and Git confirms that no branch was published.
81
+
82
+ The coordinator and feature commands return when a task reaches a human gate; feature mode stops before dispatching further tasks. After the reviewer acts, restart the command to continue. Command events and command-failure diagnostics report status and exit code without the command text or its output. Worker progress observes changes to file content as well as paths.
83
+
28
84
  ## Shared coordination board
29
85
 
30
86
  The opt-in service also provides a small workspace-scoped Kanban board that is separate from lifecycle state. Board tasks may link to an AI-DLC task ID or artifact, but board writes, comments, and claims cannot mutate lifecycle state, approve a gate, or rewrite project files.
@@ -37,6 +93,6 @@ Every `state_apply` write needs an `expectedRevision`, an `idempotencyKey`, and
37
93
 
38
94
  The service checks lifecycle invariants across the whole before/after snapshot, not only touched task IDs. Existing evidence is append-only: the prior evidence array must remain an exact structural prefix (compared field-wise, so re-serialization key order does not matter, while record order still does). A validated `blocked_on_user` wait cannot be deleted, and while a task waits its readiness-bearing state (items, decisions, artifacts, and every other non-evidence field) is frozen; only evidence may be appended. Leaving a wait requires, in the same mutation, one of: a passing approval for that exact gate, gate-bound cancellation diagnostic evidence with a non-empty source, or a sourced closure/handoff record (`closed`/`superseded` with closure metadata, or `paused` with handoff metadata). The one compatibility recovery mirrors the local CLI: an invalid wait at the gateless wrap phase may return to `active` with no appended evidence; it is not a human approval. A snapshot that requests or holds `blocked_on_user` while shared lifecycle predicates still require planning, items, verification, review, or an unexhausted repair bound is rejected. The `legacyG2Wait` repair-bound exemption marker is migration-owned: the service stamps it only when upgrading a stored pre-v4 row, and rejects any client mutation that creates or changes it. SQLite uses an immediate transaction and busy timeout; PostgreSQL locks the workspace row in a transaction.
39
95
 
40
- These guards keep remote history tamper-evident, but they do not authenticate approvals. The `source` on an approval record is provenance supplied by the client, not an authenticator: any client holding the shared token can append a well-formed approval and leave a wait. The service never runs the local `checkGate` against client artifacts (it has no access to `clientProjectRoot`), so gate predicates are enforced structurally at wait entry and through the parked-state freeze, not re-verified from artifacts at exit. Treat MCP approval records exactly like the local `gate approve --source` honor system, behind a token you protect.
96
+ In default shared-token mode, these guards keep remote history tamper-evident but do not authenticate approvals: `source` remains provenance supplied by a client. Fleet mode binds separate lead, worker, and reviewer credentials to server-side roles, and only a reviewer credential can call the atomic gate approval tool. The service cannot inspect client project artifacts, so the lead must run local artifact checks before publishing a review snapshot; the service enforces structural gate readiness and snapshot revision at approval.
41
97
 
42
98
  `work_item_request` is intentionally only a credential-free preflight for Jira, Trello, or GitHub Issues. It reports the required environment variable names and never returns a reusable token, Authorization header, or token-bearing URL. External updates remain opt-in and must be made outside the lifecycle transaction.
@@ -13,7 +13,7 @@ This guide is for contributors to `@felixdotgo/aidlc-kit`. It covers local setup
13
13
  npm install
14
14
  ```
15
15
 
16
- Codex or Claude Code are optional for manually exercising real evaluator drivers. Ordinary build, lint, and unit-test work does not need external model credentials.
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
17
 
18
18
  ## Repository layout
19
19
 
@@ -74,7 +74,7 @@ To test the package before release, create its `.tgz` archive and run the local
74
74
 
75
75
  ```sh
76
76
  npm pack
77
- npx --package felixdotgo-aidlc-kit-0.0.1.tgz -- aidlc-workflow init .
77
+ npx --package felixdotgo-aidlc-kit-0.1.1.tgz -- aidlc-kit init .
78
78
  ```
79
79
 
80
80
  `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.
@@ -95,6 +95,20 @@ The TypeScript implementation powers the package CLI. Installed projects use a d
95
95
 
96
96
  Likewise, a public configuration or schema change must update its validator, JSON schema, installed assets, package inventory, documentation, and tests together.
97
97
 
98
+ ## Code style and conventions
99
+
100
+ Adopted as the project baseline (approved decision `D1-convention-standard` on task `refactor-source-readability`):
101
+
102
+ - **Strict TypeScript, no new dependencies for tooling.** Keep `strict` mode; enforce via `npm run lint` (`tsc --noEmit`). No ESLint/Prettier for now.
103
+ - **File size targets.** Aim for ≤250 lines per source file and ≤60 lines per function; split by domain responsibility when exceeded.
104
+ - **Module boundaries.** One responsibility per module; a facade module may re-export a public API for compatibility (for example `src/state.ts`).
105
+ - **Naming.** Descriptive camelCase for functions/variables, `PascalCase` for types/interfaces, `SCREAMING_SNAKE_CASE` for true constants; file names match their primary export.
106
+ - **Error handling.** Fail with typed, one-line errors; never swallow exceptions silently; validate inputs before I/O.
107
+ - **Dependencies.** Pass dependencies (fetch, clock, environment) explicitly as parameters; avoid module-level mutable state.
108
+ - **Public API.** Document exported symbols with JSDoc when the contract is non-obvious.
109
+ - **Behavior preservation.** Refactors must not change CLI output, state schema, file layout, or installed assets; run parity tests.
110
+ - **Verification.** Run the narrowest relevant test while iterating; `npm test` + `npm run lint` before handing off.
111
+
98
112
  ## Safe implementation rules
99
113
 
100
114
  - Resolve all project-relative paths through the shared path helpers; reject traversal and symlink escape.