@cassiomc1/forgeloop 1.0.0 → 1.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 (96) hide show
  1. package/.cursor/rules/project-loop.mdc +3 -2
  2. package/.github/copilot-instructions.md +1 -0
  3. package/AGENTS.md +2 -1
  4. package/CLAUDE.md +1 -0
  5. package/DOCS_INDEX.md +36 -0
  6. package/ENG/design-code-eng.md +68 -2
  7. package/ENG/documentation-quality-eng.md +400 -0
  8. package/ENG/taste-frontend-eng.md +6 -3
  9. package/EXECUTION_STATE.md +23 -13
  10. package/GUIDE_ROUTER.md +23 -8
  11. package/LOOP_ENGINEERING.md +77 -12
  12. package/PROTOCOL_INTEGRATION.md +9 -6
  13. package/README.md +86 -39
  14. package/docs/ARTIFACT_REFERENCE.md +442 -0
  15. package/docs/CLI_REFERENCE.md +892 -0
  16. package/docs/CROSS_HARNESS_CONTINUITY.md +198 -0
  17. package/docs/DOCUMENTATION_GUIDE.md +161 -0
  18. package/docs/GETTING_STARTED.md +348 -0
  19. package/docs/RECIPES.md +250 -0
  20. package/docs/TROUBLESHOOTING.md +345 -0
  21. package/docs/assets/forgeloop-flow.svg +1 -1
  22. package/docs/forgeloop-flow.mmd +1 -1
  23. package/package.json +13 -2
  24. package/schemas/task-descriptor.schema.json +56 -0
  25. package/schemas/work-state.schema.json +18 -1
  26. package/scripts/CI_VALIDATORS.md +7 -0
  27. package/src/cli.js +280 -388
  28. package/src/commands/advance.js +5 -2
  29. package/src/commands/audit.js +11 -1
  30. package/src/commands/clear-continuity.js +5 -2
  31. package/src/commands/clear-state.js +5 -2
  32. package/src/commands/complete.js +9 -1
  33. package/src/commands/continuity.js +5 -2
  34. package/src/commands/inspect.js +10 -2
  35. package/src/commands/next.js +5 -2
  36. package/src/commands/preflight.js +9 -1
  37. package/src/commands/prepare-completion.js +5 -2
  38. package/src/commands/reconcile-continuity.js +5 -2
  39. package/src/commands/record-check.js +7 -1
  40. package/src/commands/record-continuity.js +21 -14
  41. package/src/commands/record-terminal-result.js +7 -1
  42. package/src/commands/route.js +22 -18
  43. package/src/commands/run-check.js +52 -44
  44. package/src/commands/status.js +18 -12
  45. package/src/commands/task-create.js +94 -0
  46. package/src/commands/task-list.js +48 -0
  47. package/src/commands/task-migrate.js +34 -0
  48. package/src/commands/task-scope.js +75 -0
  49. package/src/commands/task-show.js +81 -0
  50. package/src/commands/task-unlock.js +35 -0
  51. package/src/commands/validate-protocol.js +37 -20
  52. package/src/commands/validate-state.js +24 -18
  53. package/src/config/guides.json +42 -0
  54. package/src/core/activation.js +8 -4
  55. package/src/core/artifact-registry.js +166 -0
  56. package/src/core/audit.js +65 -12
  57. package/src/core/bundles.js +76 -50
  58. package/src/core/cli-command-definitions.js +611 -0
  59. package/src/core/cli-metadata.js +23 -0
  60. package/src/core/completion-artifacts.js +161 -74
  61. package/src/core/completion.js +134 -76
  62. package/src/core/continuity.js +20 -13
  63. package/src/core/contract.js +6 -3
  64. package/src/core/error-codes.js +197 -0
  65. package/src/core/events.js +19 -14
  66. package/src/core/execution.js +38 -6
  67. package/src/core/gate-artifact.js +12 -9
  68. package/src/core/gates.js +4 -2
  69. package/src/core/guide-metadata.js +7 -11
  70. package/src/core/guide-registry.js +29 -0
  71. package/src/core/inspect.js +7 -4
  72. package/src/core/native-adapters.js +6 -0
  73. package/src/core/phase.js +85 -33
  74. package/src/core/preflight-consistency.js +24 -14
  75. package/src/core/preflight-loaders.js +16 -11
  76. package/src/core/preflight.js +44 -25
  77. package/src/core/protocol.js +2 -11
  78. package/src/core/receipt.js +1 -1
  79. package/src/core/report.js +2 -2
  80. package/src/core/repository.js +46 -12
  81. package/src/core/resumability.js +6 -4
  82. package/src/core/route-artifact.js +9 -5
  83. package/src/core/router.js +11 -7
  84. package/src/core/schema-validation.js +1 -0
  85. package/src/core/task-command.js +41 -0
  86. package/src/core/task-context.js +126 -0
  87. package/src/core/task-descriptor.js +81 -0
  88. package/src/core/task-discovery.js +116 -0
  89. package/src/core/task-identity.js +76 -0
  90. package/src/core/task-lock.js +209 -0
  91. package/src/core/task-migration-validation.js +140 -0
  92. package/src/core/task-migration.js +361 -0
  93. package/src/core/task-paths.js +96 -0
  94. package/src/core/task-scope.js +179 -0
  95. package/src/core/templates.js +3 -9
  96. package/src/core/work-state.js +24 -13
@@ -1,9 +1,13 @@
1
1
  # Execution state and resume protocol
2
2
 
3
+ > Looking for a practical resume tutorial? See [`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md).
4
+ > Looking for artifact field definitions? See [`docs/ARTIFACT_REFERENCE.md`](./docs/ARTIFACT_REFERENCE.md).
5
+ > Looking for stale-state recovery? See [`docs/TROUBLESHOOTING.md`](./docs/TROUBLESHOOTING.md).
6
+
3
7
  Compatible agents may persist a handoff checkpoint at:
4
8
 
5
9
  ```text
6
- .forgeloop/work-state.json
10
+ .forgeloop/task-state/<taskKey>/work-state.json
7
11
  ```
8
12
 
9
13
  The file is local, ignored by Git, schema-versioned, and never a replacement
@@ -58,10 +62,10 @@ Any material difference produces `REVALIDATION_REQUIRED`. A non-Git target
58
62
  reports that branch/HEAD drift is not verifiable. Cheap checks may be rerun,
59
63
  but a completed destructive or publication action is never rerun automatically.
60
64
 
61
- The current contract is compared only when its JSON file is supplied:
65
+ The current contract is compared when resolving the target task:
62
66
 
63
67
  ```bash
64
- forgeloop status --contract-file .forgeloop/current-contract.json --json
68
+ forgeloop status --task <id> --json
65
69
  ```
66
70
 
67
71
  Without that file, contract comparison is `NOT_VERIFIED`; the status does not
@@ -69,16 +73,11 @@ claim full freshness. Required artifact hashes report missing or changed files.
69
73
  An optional age threshold may recommend cheap verification with
70
74
  `CHECKPOINT_OLD` without changing a fresh result.
71
75
 
72
- `inspect`, `status`, and `validate-protocol` use the same derived freshness
73
- classifier. Protocol validation can be run against the current route, state,
74
- receipt, and contract artifacts:
76
+ Protocol validation can be run against the task artifacts:
75
77
 
76
78
  ```bash
77
79
  forgeloop validate-protocol \
78
- --route-file .forgeloop/routing-result.json \
79
- --state-file .forgeloop/work-state.json \
80
- --receipt-file .forgeloop/execution-receipt.json \
81
- --contract-file .forgeloop/current-contract.json \
80
+ --task <id> \
82
81
  --json
83
82
  ```
84
83
 
@@ -109,15 +108,26 @@ forgeloop clear-state
109
108
 
110
109
  `status` explains whether state is absent, fresh, or requires revalidation.
111
110
  `validate-state` performs schema and semantic checks without mutation.
112
- `clear-state` affects only `.forgeloop/work-state.json` and prints the exact
111
+ `clear-state` affects only `work-state.json` for the target task and prints the exact
113
112
  relative path it removed; it never deletes the directory, manifest, or project
114
113
  files.
115
114
 
116
115
  ## Execution continuity companion
117
116
 
118
- `.forgeloop/work-state.json` remains the canonical checkpoint and owns phase,
117
+ `work-state.json` under `.forgeloop/task-state/<taskKey>/` remains the canonical checkpoint and owns phase,
119
118
  `completedSteps`, `pendingSteps`, failures, blockers, verification cycles, and
120
- required artifact fingerprints. `.forgeloop/continuity.json` is an optional
119
+ required artifact fingerprints. `continuity.json` under `.forgeloop/task-state/<taskKey>/` is an optional
121
120
  companion containing only granular implementation-resume context. It is bound
122
121
  to the current task, contract fingerprint, work-state fingerprint, phase, and
123
122
  repository context and is always operational context rather than evidence.
123
+
124
+ ## Resume decision table
125
+
126
+ | Work State | Continuity | Repository HEAD | Action |
127
+ | --- | --- | --- | --- |
128
+ | Valid / Fresh | Fresh | Matches | Continue execution directly via `forgeloop next` |
129
+ | Valid / Fresh | Missing | Matches | Continue from work-state checkpoint (continuity is optional) |
130
+ | Valid / Fresh | Stale | Matches / Drifted | Run `forgeloop reconcile-continuity --json`, inspect diff, continue |
131
+ | Stale | Any | Changed | Run `forgeloop route` and `forgeloop preflight` to revalidate |
132
+ | Invalid / Corrupted | Any | Any | Fail closed; inspect errors via `forgeloop doctor --json` |
133
+ | Different Task ID | Present | Any | Do not merge contexts; clear or finish previous task first |
package/GUIDE_ROUTER.md CHANGED
@@ -51,6 +51,7 @@ project commands.
51
51
  | `performance` | [Performance](./ENG/perf-code-eng.md) | Measurement, diagnosis, budgets, and optimization |
52
52
  | `accessibility` | [Accessibility](./ENG/accessibility-eng.md) | WCAG, keyboard access, focus, semantics, and assistive technology |
53
53
  | `games` | [Web games](./ENG/games-code-design-web-eng.md) | Architecture and operation of 2D, 3D, and procedural web games |
54
+ | `documentation` | [Documentation quality](./ENG/documentation-quality-eng.md) | Accuracy, architecture, freshness, accessibility, and verifiable technical documentation |
54
55
 
55
56
  ## Domain rules
56
57
 
@@ -190,11 +191,26 @@ rg -n '^## |game loop|procedural|input|assets|audio|multiplayer|WASM|PWA|CI/CD'
190
191
 
191
192
  **Expected evidence:** verifiable simulation, determinism when promised, capability fallbacks, budgets, accessibility, and release gates.
192
193
 
194
+ ### `documentation` — technical documentation quality
195
+
196
+ **Activate when:** creating, modifying, reviewing, or restructuring README files, tutorials, how-to guides, technical reference, API/CLI/configuration documentation, architecture documentation, troubleshooting, migration guides, runbooks, or other project documentation; also activate when an implementation change explicitly affects a documentation surface.
197
+
198
+ **Do not activate merely because:** source code contains comments, a task description mentions documentation in passing, or code examples appear in an unrelated domain document without changing project documentation.
199
+
200
+ **Usually combine with:** the domain whose behavior is documented. Add `test` when commands, examples, generated docs, or executable references need verification; add `security` for authentication, authorization, secrets, privacy, or sensitive examples; use `accessibility` when the published documentation surface itself has accessibility requirements.
201
+
202
+ ```bash
203
+ rg -n '^## |accuracy|completeness|Diátaxis|tutorial|how-to|reference|explanation|README|API|CLI|configuration|architecture|freshness|accessibility|Definition of Done' ENG/documentation-quality-eng.md
204
+ ```
205
+
206
+ **Expected evidence:** documentation purpose and audience are clear, factual claims are cross-checked against canonical project sources, changed documentation surfaces are complete, relevant examples/links/builds are validated when available, and unavailable required checks are recorded as `NOT_VERIFIED`.
207
+
193
208
  ## Work-type matrix
194
209
 
195
210
  | Work | Primary guide | Common complements | Exclude when |
196
211
  | --- | --- | --- | --- |
197
- | Documentation change | Relevant domain | `test` only for executable examples or commands | No software behavior exists |
212
+ | Documentation change | `documentation` | Relevant domain; `test` for executable examples/commands; `security` for trust-sensitive docs | No documentation artifact or documented contract changes |
213
+ | UI copy or microcopy | `design` | `accessibility` | Users cannot observe the change |
198
214
  | Code or bug without UI | `clean` | `test`; risk may add `security` or `performance` | The surface is unchanged |
199
215
  | Backend, API, or data | `clean` | `test`, `security`; `performance` for a critical path | That layer does not exist |
200
216
  | Web, mobile, or desktop UI | `design` | `accessibility`, `clean`, `test`; risk defines the rest | Users cannot observe the change |
@@ -214,12 +230,12 @@ the repository.
214
230
 
215
231
  The first routing contract is versioned as `schemaVersion: 1`. It accepts:
216
232
 
217
- - `workType`: `documentation`, `code`, `bug`, `refactor`, `backend`, `api`,
233
+ - `workType`: `documentation`, `ui-copy`, `code`, `bug`, `refactor`, `backend`, `api`,
218
234
  `api-auth`, `complete-website`, `mobile-ui`, `web-game`, `html-video`,
219
235
  `infrastructure`, `security-review`, `performance`, `accessibility`,
220
236
  `test-only`, `dependency-update`, or `release`;
221
237
  - `surfaces`: `ui`, `forms`, `api`, `auth`, `data`, `database`, `mobile`,
222
- `desktop`, `game`, `video`, `ci`, `config`, or `critical-path`;
238
+ `desktop`, `game`, `video`, `ci`, `config`, `critical-path`, or `documentation`;
223
239
  - `risks`: `untrusted-input`, `personal-data`, `secrets`, `external-service`,
224
240
  `publication`, `critical-path`, `performance`, or `accessibility`;
225
241
  - `platforms`: `web`, `mobile`, `desktop`, `server`, `ci`, or
@@ -236,9 +252,8 @@ error.
236
252
  Every selected guide has stable reason codes such as
237
253
  `WORK_COMPLETE_WEBSITE`, `SURFACE_UI`, `RISK_UNTRUSTED_INPUT`, and
238
254
  `CHANGE_EXECUTABLE_CONFIG`. Exclusions use stable codes such as
239
- `NO_TRUST_BOUNDARY` and `NO_MEASURABLE_PERFORMANCE_RISK`. Documentation-only
240
- input records `DOCUMENTATION_DOMAIN_GUIDE_REQUIRED` instead of activating
241
- technical guides automatically.
255
+ `NO_TRUST_BOUNDARY`, `NO_MEASURABLE_PERFORMANCE_RISK`, and
256
+ `NO_DOCUMENTATION_SURFACE`.
242
257
 
243
258
  Platform signals are contextual, not automatic guide activators:
244
259
 
@@ -302,9 +317,9 @@ Verify the game loop, authoritative server, reconciliation, input, assets, fallb
302
317
 
303
318
  ### Documentation
304
319
 
305
- <!-- route:documentation=domain -->
320
+ <!-- route:documentation=documentation -->
306
321
 
307
- `domain` means the single domain guide implicated by the change. Verify Markdown, links, paths, commands, and examples.
322
+ Verify Markdown, links, paths, commands, and examples.
308
323
 
309
324
  ## Route changes
310
325
 
@@ -4,6 +4,31 @@
4
4
  > technical rules remain in the guides selected through
5
5
  > [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md).
6
6
 
7
+ ## Navigation
8
+
9
+ - [Protocol Applicability](#protocol-applicability)
10
+ - [Blocking vs Non-Blocking Decisions](#blocking-vs-non-blocking-decisions)
11
+ - [External Workflow Compatibility](#external-workflow-compatibility)
12
+ - [Serialized Protocol Preparation](#serialized-protocol-preparation)
13
+ - [Completion Validation & Chronology](#completion-validation-and-chronology)
14
+ - [Post-Implementation Closure](#post-implementation-closure)
15
+ - [Independent Completion Dimensions](#independent-completion-dimensions)
16
+ - [Failure Taxonomy & Invariants](#failure-taxonomy-retry-and-loop-invariants)
17
+ - [Workflow State Semantics](#workflow-state-semantics)
18
+ - [Execution Contract](#execution-contract)
19
+ - [Project Discovery](#project-discovery)
20
+ - [Capability Discovery & Authority](#capability-discovery-and-on-demand-extensions)
21
+ - [Guide Selection](#guide-selection)
22
+ - [Design & Implementation Gates](#design-and-implementation-gates)
23
+ - [Proportional Planning](#proportional-planning)
24
+ - [Execution Loop](#execution-loop)
25
+ - [Verification & Regression](#verification-and-regression)
26
+ - [Evidence-Driven Correction](#evidence-driven-correction)
27
+ - [Precedence & Stop Conditions](#precedence)
28
+ - [Final Delivery](#final-delivery)
29
+ - [Cross-Harness Continuity](#cross-harness-execution-continuity)
30
+ - [Multi-Task Concurrent Project State](#multi-task-concurrent-project-state)
31
+
7
32
  ## Protocol applicability
8
33
 
9
34
  ForgeLoop is a project-local engineering protocol.
@@ -48,11 +73,11 @@ name is unknown.
48
73
  Lifecycle-owned ForgeLoop artifacts must be created or mutated only through
49
74
  the supported ForgeLoop lifecycle commands or canonical ForgeLoop APIs:
50
75
 
51
- - `.forgeloop/preflight.json`
52
- - `.forgeloop/work-state.json`
53
- - `.forgeloop/events.ndjson`
54
- - `.forgeloop/execution-receipt.json`
55
- - `.forgeloop/executions/<executionId>.json`
76
+ - `.forgeloop/task-state/<taskKey>/preflight.json`
77
+ - `.forgeloop/task-state/<taskKey>/work-state.json`
78
+ - `.forgeloop/task-state/<taskKey>/events.ndjson`
79
+ - `.forgeloop/task-state/<taskKey>/execution-receipt.json`
80
+ - `.forgeloop/task-state/<taskKey>/executions/<executionId>.json`
56
81
  - completion recovery metadata
57
82
  - canonical check/evidence state
58
83
  - terminal-result lifecycle state
@@ -130,7 +155,7 @@ Recognized command dispatchers (such as `npm test`, `npm start`, `npm stop`, `np
130
155
  Use `forgeloop run-check --id <id> --requirement <requirement> -- <argv>` for
131
156
  observed command evidence. ForgeLoop preserves the exact argv vector, target
132
157
  cwd, resolution classification, timestamps, exit status, and task/check
133
- binding in `.forgeloop/executions/<executionId>.json` before recording the
158
+ binding in `.forgeloop/task-state/<taskKey>/executions/<executionId>.json` before recording the
134
159
  check. Resolution is classified before process launch; install-capable
135
160
  resolution is rejected without a valid host-attested authority, while
136
161
  `npx --no-install` remains a non-installing path and may fail honestly when a
@@ -157,7 +182,7 @@ ForgeLoop validates authority semantics, while the host defines the trust bounda
157
182
 
158
183
  ### Stale receipt recovery invariant
159
184
 
160
- Every recovery action returned by `forgeloop next` must be executable from the state that produced it. When work state changes legitimately after preparing a completion receipt, `forgeloop prepare-completion` refreshes the receipt and re-binds it to current state and changed paths without requiring manual deletion of `.forgeloop/execution-receipt.json`.
185
+ Every recovery action returned by `forgeloop next` must be executable from the state that produced it. When work state changes legitimately after preparing a completion receipt, `forgeloop prepare-completion` refreshes the receipt and re-binds it to current state and changed paths without requiring manual deletion of `.forgeloop/task-state/<taskKey>/execution-receipt.json`.
161
186
 
162
187
  ### Conformance profile escalation policy
163
188
 
@@ -435,9 +460,9 @@ If the harness cannot disable a mandatory approval workflow, record
435
460
 
436
461
  ForgeLoop keeps the agent responsible for implementation while making the
437
462
  pre-implementation contract observable. Before executable changes, the target
438
- should contain a schema-valid `.forgeloop/current-contract.json` and a persisted
439
- `.forgeloop/routing-result.json`. Guide metadata can declare mandatory gates;
440
- those gates are recorded under `.forgeloop/gates/` and are checked by:
463
+ should contain a schema-valid task contract (`.forgeloop/task-state/<taskKey>/contract.json`) and a persisted
464
+ `.forgeloop/task-state/<taskKey>/routing-result.json`. Guide metadata can declare mandatory gates;
465
+ those gates are recorded under `.forgeloop/task-state/<taskKey>/gates/` and are checked by:
441
466
 
442
467
  ```text
443
468
  forgeloop preflight
@@ -720,7 +745,7 @@ proportional phases, but:
720
745
  Resume rules are conservative: revalidate branch, HEAD, contract fingerprint,
721
746
  protocol version, and required artifacts before continuing; never rerun a
722
747
  completed destructive or publication action automatically; rerun cheap
723
- verification when state is stale; and clear only `.forgeloop/work-state.json`
748
+ verification when state is stale; and clear only task work state (`.forgeloop/task-state/<taskKey>/work-state.json`)
724
749
  when abandoned state must be removed.
725
750
 
726
751
  ## Execution contract
@@ -1169,7 +1194,7 @@ from external publication.
1169
1194
  A change of model, provider, IDE, process, terminal, or context window does not
1170
1195
  create a new task when a valid resumable ForgeLoop task already exists.
1171
1196
  `work-state.json` remains the sole owner of lifecycle progress. An optional
1172
- `.forgeloop/continuity.json` may record bounded granular implementation context
1197
+ `.forgeloop/task-state/<taskKey>/continuity.json` may record bounded granular implementation context
1173
1198
  such as current focus, remaining implementation work, known issues, and paths
1174
1199
  to inspect first.
1175
1200
 
@@ -1178,3 +1203,43 @@ never satisfy verification coverage, publication, production readiness, or
1178
1203
  completion. `CONTINUITY_CANNOT_GRANT_AUTHORITY`: continuity cannot authorize an
1179
1204
  installation or external action. The receiving harness MUST reconcile
1180
1205
  continuity against the current work state and checkout before acting on it.
1206
+
1207
+ ## Multi-task concurrent project state
1208
+
1209
+ ForgeLoop supports isolated, concurrent tasks within the same repository workspace.
1210
+ Multiple active tasks can progress simultaneously without artifact collisions or state
1211
+ corruption through three fundamental protocol mechanisms:
1212
+
1213
+ 1. **Deterministic Task Namespacing**:
1214
+ Each task is identified by a canonical string `taskId` and an immutable, filesystem-safe
1215
+ `taskKey` derived as `SHA-256(taskId)` in 64 lowercase hexadecimal characters. All
1216
+ task-scoped artifacts (`task.json`, `contract.json`, `routing-result.json`,
1217
+ `preflight.json`, `work-state.json`, `events.ndjson`, `execution-receipt.json`,
1218
+ `continuity.json`, gates, and execution records) are stored strictly under
1219
+ `.forgeloop/task-state/<taskKey>/`. Shared repository configuration and sources
1220
+ (`config.json`, `sources.json`) remain at `.forgeloop/`.
1221
+
1222
+ 2. **Scoped Write Claims & Conflict Prevention**:
1223
+ Every task declares explicit project-relative directory or file path prefixes
1224
+ (`writeClaims`) in its `task.json` descriptor.
1225
+ - When creating a task (`forgeloop task-create --task <id> --claim <path>`),
1226
+ ForgeLoop asserts that claimed paths have no pre-existing uncommitted changes
1227
+ (`E_TASK_SCOPE_DIRTY`) and do not overlap with active write claims of any other
1228
+ non-`COMPLETE` task (`E_TASK_SCOPE_CONFLICT`).
1229
+ - Once execution begins (`EXECUTING` through `COMPLETE`), write claims are immutable
1230
+ (`E_TASK_SCOPE_FROZEN`).
1231
+ - At verification and completion, Git modifications are validated to ensure no changes
1232
+ escaped the task's declared scope (`E_TASK_CHANGE_OUTSIDE_SCOPE`).
1233
+
1234
+ 3. **Per-Task Exclusive Mutex Locking**:
1235
+ Mutating lifecycle commands (`advance`, `preflight`, `run-check`, `complete`, etc.)
1236
+ acquire an exclusive filesystem lock at `.forgeloop/task-state/<taskKey>/.lock` using
1237
+ atomic creation flags (`wx`). Concurrent mutations on the same task reject with
1238
+ `E_TASK_LOCKED`. Read-only commands (`status`, `audit`, `inspect`, `continuity`) bypass
1239
+ locking. Stale locks can be cleared with `forgeloop task-unlock --task <id> --force`.
1240
+
1241
+ 4. **Task Resolution & Legacy Migration**:
1242
+ Commands select their target task via `--task <id>`, the `FORGELOOP_TASK` environment
1243
+ variable, or implicit single-task fallback. If multiple active tasks exist without a
1244
+ selector, ForgeLoop fails closed with `E_TASK_AMBIGUOUS`. Legacy ForgeLoop 1.0 single-task
1245
+ layouts can be migrated into namespaced layout using `forgeloop task-migrate`.
@@ -124,11 +124,11 @@ The resolved CLI must match the installed project's package identity.
124
124
 
125
125
  The following protocol artifacts are strictly owned by ForgeLoop:
126
126
 
127
- - `.forgeloop/preflight.json`
128
- - `.forgeloop/work-state.json`
129
- - `.forgeloop/events.ndjson`
130
- - `.forgeloop/execution-receipt.json`
131
- - `.forgeloop/executions/<executionId>.json`
127
+ - `.forgeloop/task-state/<taskKey>/preflight.json`
128
+ - `.forgeloop/task-state/<taskKey>/work-state.json`
129
+ - `.forgeloop/task-state/<taskKey>/events.ndjson`
130
+ - `.forgeloop/task-state/<taskKey>/execution-receipt.json`
131
+ - `.forgeloop/task-state/<taskKey>/executions/<executionId>.json`
132
132
  - Canonical check, evidence, and terminal-result state
133
133
 
134
134
  If the required CLI or API capability cannot be resolved:
@@ -149,7 +149,7 @@ Command verification has two explicit paths:
149
149
  execution. It classifies the exact argv before launch, uses a non-shell
150
150
  process boundary, records the target cwd, resolution mode, timestamps,
151
151
  exit status, and task/check binding in
152
- `.forgeloop/executions/<executionId>.json`, then records an `OBSERVED` check
152
+ `.forgeloop/task-state/<taskKey>/executions/<executionId>.json`, then records an `OBSERVED` check
153
153
  with `provenance: FORGELOOP_EXECUTED`.
154
154
  - `forgeloop record-check` owns serialization only. `--command` is metadata and
155
155
  is never launched. A `kind: command` check with `evidenceKind: OBSERVED`
@@ -309,3 +309,6 @@ A compatible environment reopening a resumable task SHOULD inspect the current
309
309
  work state, reconcile optional execution continuity, inspect the checkout, and
310
310
  continue the existing lifecycle instead of replacing the contract merely
311
311
  because the executor changed.
312
+
313
+ For the practical handoff and multi-tool takeover sequence, see
314
+ [`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md).
package/README.md CHANGED
@@ -1,12 +1,16 @@
1
1
  # ForgeLoop — Verifiable Engineering Protocol
2
2
 
3
+ <p align="center">
4
+ <img src="./docs/assets/forgeloop-readme-banner.svg" alt="ForgeLoop — Verifiable Engineering Protocol" width="100%">
5
+ </p>
6
+
3
7
  [![Docs quality](https://github.com/cassiomc1/forgeloop/actions/workflows/docs-quality.yml/badge.svg?branch=main)](https://github.com/cassiomc1/forgeloop/actions/workflows/docs-quality.yml)
4
8
 
5
9
  ForgeLoop is a portable, vendor-neutral protocol for AI-assisted development
6
10
  and developer workflows. It turns an outcome into a contract, deterministic
7
- routing, resumable state, evidence-backed verification, recovery, and
8
- validator-backed completion. It is a protocol/support CLI, not an agent or LLM
9
- runtime.
11
+ routing, resumable state, evidence-backed verification, recovery, cross-harness
12
+ continuity, and validator-backed completion. It is a protocol/support CLI, not
13
+ an agent or LLM runtime, not an agent framework, and not a graph orchestrator.
10
14
 
11
15
  The operational sources are indexed in [`DOCS_INDEX.md`](./DOCS_INDEX.md).
12
16
  [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md) is the canonical process;
@@ -15,6 +19,19 @@ levels and discovery; [`PROJECT_PROFILE.md`](./PROJECT_PROFILE.md) stores
15
19
  durable project facts; and [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md) selects only
16
20
  relevant guides.
17
21
 
22
+ ## Where should I start?
23
+
24
+ - **New to ForgeLoop** → [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md)
25
+ - **Full protocol specification** → [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md)
26
+ - **Integrating an AI harness** → [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md)
27
+ - **Continuing another harness's task** → [`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md)
28
+ - **CLI command reference** → [`docs/CLI_REFERENCE.md`](./docs/CLI_REFERENCE.md)
29
+ - **Artifact & schema reference** → [`docs/ARTIFACT_REFERENCE.md`](./docs/ARTIFACT_REFERENCE.md)
30
+ - **Operational recipes** → [`docs/RECIPES.md`](./docs/RECIPES.md)
31
+ - **Troubleshooting & error codes** → [`docs/TROUBLESHOOTING.md`](./docs/TROUBLESHOOTING.md)
32
+ - **System architecture & safety** → [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md) & [`THREAT_MODEL.md`](./THREAT_MODEL.md)
33
+ - **Documentation index & ownership** → [`DOCS_INDEX.md`](./DOCS_INDEX.md)
34
+
18
35
  ## Catalog
19
36
 
20
37
  | Topic | Guide |
@@ -28,6 +45,7 @@ relevant guides.
28
45
  | Performance | [`ENG/perf-code-eng.md`](./ENG/perf-code-eng.md) |
29
46
  | Accessibility | [`ENG/accessibility-eng.md`](./ENG/accessibility-eng.md) |
30
47
  | Web games | [`ENG/games-code-design-web-eng.md`](./ENG/games-code-design-web-eng.md) |
48
+ | Documentation quality | [`ENG/documentation-quality-eng.md`](./ENG/documentation-quality-eng.md) |
31
49
 
32
50
  Each guide declares its name, language, version, and review date in
33
51
  frontmatter. Repository validators keep the catalog and metadata synchronized.
@@ -42,8 +60,9 @@ npx @cassiomc1/forgeloop doctor
42
60
  ```
43
61
 
44
62
  The CLI installs canonical documents under `.forgeloop/kit/`, keeps small
45
- native discovery shims at the project root, and stores mutable contract, route,
46
- gate, state, event, receipt, and execution artifacts under `.forgeloop/`.
63
+ native discovery shims at the project root, stores project-scoped
64
+ configuration under `.forgeloop/`, and stores task-scoped protocol artifacts
65
+ under `.forgeloop/task-state/<taskKey>/`.
47
66
  `update` preserves target-specific profile facts and locally modified files.
48
67
 
49
68
  Before npm publication, the same source checkout can be exercised without a
@@ -66,26 +85,28 @@ request → discovery → contract → routing → plan → execution
66
85
  └──── evidence-only rejection / next cycle
67
86
  ```
68
87
 
69
- The harness writes a schema-valid `.forgeloop/current-contract.json`, required
70
- gate artifacts, and routing. `preflight` must return `PREFLIGHT_READY` before
71
- implementation. ForgeLoop then records an append-only event ledger and protects
72
- the lifecycle with contract, route, repository, and artifact fingerprints.
88
+ The harness writes a schema-valid task contract under
89
+ `.forgeloop/task-state/<taskKey>/contract.json`, required gate artifacts, and
90
+ routing. `preflight` must return `PREFLIGHT_READY` before implementation.
91
+ ForgeLoop then records an append-only event ledger and protects the lifecycle
92
+ with contract, route, repository, and artifact fingerprints.
73
93
 
74
94
  Typical local commands are:
75
95
 
76
96
  ```bash
77
- forgeloop route --work complete-website --surface ui --risk untrusted-input
78
- forgeloop activate
79
- forgeloop preflight --json
80
- forgeloop next --json
81
- forgeloop advance --to PLANNED
82
- forgeloop advance --to EXECUTING
83
- forgeloop advance --to VERIFYING
84
- forgeloop prepare-completion --json
85
- forgeloop run-check --json --id tests --requirement tests -- npm test
86
- forgeloop advance --to REVIEWING
87
- forgeloop audit --json
88
- forgeloop complete --json
97
+ forgeloop task-create --task example-task --claim src --claim tests --json
98
+ forgeloop route --task example-task --work complete-website --surface ui --risk untrusted-input
99
+ forgeloop activate --task example-task
100
+ forgeloop preflight --task example-task --json
101
+ forgeloop next --task example-task --json
102
+ forgeloop advance --task example-task --to PLANNED
103
+ forgeloop advance --task example-task --to EXECUTING
104
+ forgeloop advance --task example-task --to VERIFYING
105
+ forgeloop prepare-completion --task example-task --json
106
+ forgeloop run-check --task example-task --json --id tests --requirement tests -- npm test
107
+ forgeloop advance --task example-task --to REVIEWING
108
+ forgeloop audit --task example-task --json
109
+ forgeloop complete --task example-task --json
89
110
  ```
90
111
 
91
112
  `advance` changes protocol phase only; it never runs target commands.
@@ -103,6 +124,42 @@ falling back to discovery. Delegation artifacts are required only when
103
124
  delegation is present in the execution history; ForgeLoop does not provide a
104
125
  graph runtime, agent runtime, or hidden prompt store.
105
126
 
127
+ ### Cross-harness continuity
128
+
129
+ ForgeLoop preserves task state when switching between AI coding tools, IDEs, or terminals:
130
+
131
+ ```bash
132
+ forgeloop status --task example-task --json
133
+ forgeloop continuity --task example-task --json
134
+ forgeloop reconcile-continuity --task example-task --json
135
+ forgeloop next --task example-task --json
136
+ ```
137
+
138
+ See [`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md) for full handoff and recovery procedures.
139
+
140
+ ### Multi-task concurrent project state
141
+
142
+ ForgeLoop supports isolated, concurrent tasks within the same repository via deterministic SHA-256 namespacing, per-task mutex locking, and write-claim conflict detection:
143
+
144
+ ```bash
145
+ # Create an isolated task claiming specific directories
146
+ forgeloop task-create --task auth-feature --claim src/auth --claim tests/auth --json
147
+
148
+ # List active and completed tasks
149
+ forgeloop task-list --json
150
+
151
+ # Run standard lifecycle commands targeting the task
152
+ forgeloop route --task auth-feature --work clean-code --surface backend
153
+ forgeloop preflight --task auth-feature --json
154
+ forgeloop advance --task auth-feature --to EXECUTING
155
+ forgeloop complete --task auth-feature --json
156
+
157
+ # Migrate legacy 1.0 single-task layout
158
+ forgeloop task-migrate --json
159
+ ```
160
+
161
+ See [`docs/CLI_REFERENCE.md`](./docs/CLI_REFERENCE.md) and [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md) for architecture details.
162
+
106
163
  ## Architecture flow
107
164
 
108
165
  The canonical source is [`docs/forgeloop-flow.mmd`](./docs/forgeloop-flow.mmd),
@@ -110,9 +167,7 @@ and the committed render is [`docs/assets/forgeloop-flow.svg`](./docs/assets/for
110
167
  The broader architecture and boundaries are in
111
168
  [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md).
112
169
 
113
- <p align="center">
114
- <img src="./docs/assets/forgeloop-flow.svg" alt="ForgeLoop evidence-first engineering flow" width="100%" />
115
- </p>
170
+ ![ForgeLoop evidence-first engineering flow](./docs/assets/forgeloop-flow.svg)
116
171
 
117
172
  Text-only fallback: discovery creates the contract and route; required gates
118
173
  and `PREFLIGHT_READY` authorize execution; verification creates structured
@@ -189,15 +244,6 @@ configuration file, never in Git, `.forgeloop/kit/PROJECT_PROFILE.md`, or
189
244
  copied instruction files. ForgeLoop does not vendor Qwen code or install it
190
245
  through `init`, `update`, or `doctor`.
191
246
 
192
- ## Cross-harness continuity
193
-
194
- ForgeLoop can optionally persist bounded execution-continuity context for a
195
- resumable task so another compatible harness can reconcile the current checkout
196
- and continue without replacing the task contract. Continuity is operational
197
- context only; it is never verification evidence or authority. See
198
- [`EXECUTION_STATE.md`](./EXECUTION_STATE.md) and
199
- [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md).
200
-
201
247
  ## Release and maintenance
202
248
 
203
249
  The release workflow uses [npm trusted publishing](https://docs.npmjs.com/trusted-publishers)
@@ -236,16 +282,17 @@ src/ npm CLI and protocol implementation
236
282
  schemas/ versioned artifact schemas
237
283
  ENG/ package-source engineering guides
238
284
  docs/forgeloop-flow.mmd canonical Mermaid source
239
- docs/assets/ committed diagram render
285
+ docs/assets/ committed diagram render
240
286
  scripts/ checks, renderer, release identity, CI notes
241
287
  tests/ Node and Python regression coverage
242
- .forgeloop/ local protocol ledger and mutable artifacts
243
- DOCS_INDEX.md documentation map and ownership boundaries
288
+ .forgeloop/ project-scoped ForgeLoop configuration
289
+ .forgeloop/task-state/ isolated live task protocol state
290
+ DOCS_INDEX.md documentation map and ownership boundaries
244
291
  ```
245
292
 
246
- The source repository keeps canonical documents at the root. A bootstrapped
247
- target uses the hidden kit layout; mutable protocol artifacts remain directly
248
- under `.forgeloop/`.
293
+ Project-scoped configuration remains under `.forgeloop/`.
294
+ Task-scoped mutable protocol state is stored under
295
+ `.forgeloop/task-state/<taskKey>/`.
249
296
 
250
297
  For document ownership, guide routing, capability degradation, and integration
251
298
  details, start at [`DOCS_INDEX.md`](./DOCS_INDEX.md).