@cassiomc1/forgeloop 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) 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 +31 -0
  7. package/ENG/documentation-quality-eng.md +400 -0
  8. package/EXECUTION_STATE.md +23 -13
  9. package/GUIDE_ROUTER.md +23 -8
  10. package/LOOP_ENGINEERING.md +77 -12
  11. package/PROTOCOL_INTEGRATION.md +9 -6
  12. package/README.md +82 -39
  13. package/docs/ARTIFACT_REFERENCE.md +442 -0
  14. package/docs/CLI_REFERENCE.md +892 -0
  15. package/docs/CROSS_HARNESS_CONTINUITY.md +198 -0
  16. package/docs/DOCUMENTATION_GUIDE.md +161 -0
  17. package/docs/GETTING_STARTED.md +348 -0
  18. package/docs/RECIPES.md +250 -0
  19. package/docs/TROUBLESHOOTING.md +345 -0
  20. package/docs/assets/forgeloop-flow.svg +1 -1
  21. package/docs/forgeloop-flow.mmd +1 -1
  22. package/package.json +13 -2
  23. package/schemas/task-descriptor.schema.json +56 -0
  24. package/schemas/work-state.schema.json +18 -1
  25. package/scripts/CI_VALIDATORS.md +7 -0
  26. package/src/cli.js +280 -388
  27. package/src/commands/advance.js +5 -2
  28. package/src/commands/audit.js +11 -1
  29. package/src/commands/clear-continuity.js +5 -2
  30. package/src/commands/clear-state.js +5 -2
  31. package/src/commands/complete.js +9 -1
  32. package/src/commands/continuity.js +5 -2
  33. package/src/commands/inspect.js +10 -2
  34. package/src/commands/next.js +5 -2
  35. package/src/commands/preflight.js +9 -1
  36. package/src/commands/prepare-completion.js +5 -2
  37. package/src/commands/reconcile-continuity.js +5 -2
  38. package/src/commands/record-check.js +7 -1
  39. package/src/commands/record-continuity.js +21 -14
  40. package/src/commands/record-terminal-result.js +7 -1
  41. package/src/commands/route.js +22 -18
  42. package/src/commands/run-check.js +52 -44
  43. package/src/commands/status.js +18 -12
  44. package/src/commands/task-create.js +94 -0
  45. package/src/commands/task-list.js +48 -0
  46. package/src/commands/task-migrate.js +34 -0
  47. package/src/commands/task-scope.js +75 -0
  48. package/src/commands/task-show.js +81 -0
  49. package/src/commands/task-unlock.js +35 -0
  50. package/src/commands/validate-protocol.js +37 -20
  51. package/src/commands/validate-state.js +24 -18
  52. package/src/config/guides.json +42 -0
  53. package/src/core/activation.js +8 -4
  54. package/src/core/artifact-registry.js +166 -0
  55. package/src/core/audit.js +65 -12
  56. package/src/core/bundles.js +76 -50
  57. package/src/core/cli-command-definitions.js +611 -0
  58. package/src/core/cli-metadata.js +23 -0
  59. package/src/core/completion-artifacts.js +161 -74
  60. package/src/core/completion.js +134 -76
  61. package/src/core/continuity.js +20 -13
  62. package/src/core/contract.js +6 -3
  63. package/src/core/error-codes.js +197 -0
  64. package/src/core/events.js +19 -14
  65. package/src/core/execution.js +38 -6
  66. package/src/core/gate-artifact.js +12 -9
  67. package/src/core/gates.js +4 -2
  68. package/src/core/guide-metadata.js +7 -11
  69. package/src/core/guide-registry.js +29 -0
  70. package/src/core/inspect.js +7 -4
  71. package/src/core/native-adapters.js +6 -0
  72. package/src/core/phase.js +85 -33
  73. package/src/core/preflight-consistency.js +24 -14
  74. package/src/core/preflight-loaders.js +16 -11
  75. package/src/core/preflight.js +44 -25
  76. package/src/core/protocol.js +2 -11
  77. package/src/core/receipt.js +1 -1
  78. package/src/core/report.js +2 -2
  79. package/src/core/repository.js +46 -12
  80. package/src/core/resumability.js +6 -4
  81. package/src/core/route-artifact.js +9 -5
  82. package/src/core/router.js +11 -7
  83. package/src/core/schema-validation.js +1 -0
  84. package/src/core/task-command.js +41 -0
  85. package/src/core/task-context.js +126 -0
  86. package/src/core/task-descriptor.js +81 -0
  87. package/src/core/task-discovery.js +116 -0
  88. package/src/core/task-identity.js +76 -0
  89. package/src/core/task-lock.js +209 -0
  90. package/src/core/task-migration-validation.js +140 -0
  91. package/src/core/task-migration.js +361 -0
  92. package/src/core/task-paths.js +96 -0
  93. package/src/core/task-scope.js +179 -0
  94. package/src/core/templates.js +3 -9
  95. package/src/core/work-state.js +24 -13
@@ -17,11 +17,12 @@ Do not treat ForgeLoop as vendor-specific, optional, or to follow only "in spiri
17
17
  5. Make the minimum change, run specific checks, and run proportional regression checks.
18
18
  6. Diagnose failures before fixing them; do not repeat attempts without new evidence.
19
19
  7. Request authority for unrelated actions, installations, and publications. Do not install a missing verification tool merely to satisfy a check. For missing Qwen-MM-Plugins, follow `LOOP_ENGINEERING.md`.
20
- 8. After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` structured evidence `REVIEWING` execution receipt validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
20
+ 8. Before creating or activating new lifecycle state: if `.forgeloop/work-state.json` exists, inspect the existing task, reconcile continuity when present, inspect the checkout, and run `forgeloop next`. A change of harness, model, provider, IDE, process, terminal, or session does not create a new task.
21
+ 9. After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
21
22
 
22
23
  After implementation work for the current task is complete, run `forgeloop next` before returning a final result. Follow the returned lifecycle action until ForgeLoop reaches a terminal state or an explicit blocker.
23
24
 
24
- 9. Report only demonstrated results and checks.
25
+ 10. Report only demonstrated results and checks.
25
26
 
26
27
  Do not stop for non-blocking missing product details. When a safe, reversible
27
28
  local default exists, record it as an agent assumption and follow the Blocking vs Non-Blocking Decisions policy in `LOOP_ENGINEERING.md`.
@@ -14,6 +14,7 @@ Use these instructions across the repository while preserving local rules.
14
14
  - Make the smallest coherent change; validate with specific and regression checks.
15
15
  - Diagnose causes before fixing failures; do not make unverified attempts.
16
16
  - Do not install software, publish, delete, or alter external state without authority. Do not install a missing verification tool merely to satisfy a check. For missing Qwen-MM-Plugins, follow `LOOP_ENGINEERING.md`.
17
+ - Before creating or activating new lifecycle state: if `.forgeloop/work-state.json` exists, inspect the existing task, reconcile continuity when present, inspect the checkout, and run `forgeloop next`. A change of harness, model, provider, IDE, process, terminal, or session does not create a new task.
17
18
  - After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
18
19
 
19
20
  After implementation work for the current task is complete, run `forgeloop next` before returning a final result. Follow the returned lifecycle action until ForgeLoop reaches a terminal state or an explicit blocker.
package/AGENTS.md CHANGED
@@ -12,7 +12,8 @@ Do not treat ForgeLoop as vendor-specific, optional, or to follow only "in spiri
12
12
  1. Make the smallest coherent change, run specific checks, and proportional regression checks.
13
13
  1. Diagnose failures before fixing; do not repeat attempts without new evidence.
14
14
  1. Do not install software, publish, delete, or migrate data without authority. Do not install a missing verification tool merely to satisfy a check. For missing Qwen-MM-Plugins, follow `LOOP_ENGINEERING.md`.
15
- 1. Before implementation, create/validate `.forgeloop/current-contract.json`, persist routing, satisfy gates, and require `forgeloop preflight` to return `READY`.
15
+ 1. Before creating or activating new lifecycle state: if `.forgeloop/work-state.json` exists, inspect the existing task, reconcile continuity when present, inspect the checkout, and run `forgeloop next`. A change of harness, model, provider, IDE, process, terminal, or session does not create a new task.
16
+ 1. Before implementation, create/validate the task contract (`contract.json`), persist routing, satisfy gates, and require `forgeloop preflight` to return `READY`.
16
17
  1. Before claiming `COMPLETE`, require `forgeloop complete` to return `VALID`; otherwise report completion as not protocol-verified.
17
18
  1. After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
18
19
  1. After implementation work for the current task is complete, run `forgeloop next` before returning a final result. Follow the returned lifecycle action until ForgeLoop reaches a terminal state or an explicit blocker.
package/CLAUDE.md CHANGED
@@ -14,6 +14,7 @@ When working in this repository:
14
14
  1. Make small changes, run specific checks, and run proportional regression checks.
15
15
  1. Investigate root causes before fixing failures; do not make unverified attempts.
16
16
  1. Request authority for unrelated installations, publications, deletions, or migrations. Do not install a missing verification tool merely to satisfy a check. For missing Qwen-MM-Plugins, follow `LOOP_ENGINEERING.md`.
17
+ 1. Before creating or activating new lifecycle state: if `.forgeloop/work-state.json` exists, inspect the existing task, reconcile continuity when present, inspect the checkout, and run `forgeloop next`. A change of harness, model, provider, IDE, process, terminal, or session does not create a new task.
17
18
  1. After implementation begins, do not return a final result in `EXECUTING`: advance through `VERIFYING` → structured evidence → `REVIEWING` → execution receipt → validator-backed `COMPLETE`. If closure cannot be reached, report `BLOCKED` or `PARTIALLY VERIFIED`.
18
19
  1. After implementation work for the current task is complete, run `forgeloop next` before returning a final result. Follow the returned lifecycle action until ForgeLoop reaches a terminal state or an explicit blocker.
19
20
  1. Report current evidence, limitations, and publication state without claiming checks that were not run.
package/DOCS_INDEX.md CHANGED
@@ -7,6 +7,13 @@ integration and guide context. Use this map before editing documentation.
7
7
 
8
8
  | Need | Canonical source | Boundary |
9
9
  | --- | --- | --- |
10
+ | Getting started tutorial | [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md) | First-time walkthrough from init to completion |
11
+ | Cross-harness continuity | [`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md) | Operational handoff and multi-tool resumption |
12
+ | CLI command reference | [`docs/CLI_REFERENCE.md`](./docs/CLI_REFERENCE.md) | Full syntax, options, and JSON examples for all commands |
13
+ | Artifact and schema reference | [`docs/ARTIFACT_REFERENCE.md`](./docs/ARTIFACT_REFERENCE.md) | Purpose, mutability, and trust classifications of `.forgeloop/` |
14
+ | Troubleshooting and recovery | [`docs/TROUBLESHOOTING.md`](./docs/TROUBLESHOOTING.md) | Symptom-first recovery and stable error code reference |
15
+ | Operational recipes | [`docs/RECIPES.md`](./docs/RECIPES.md) | Short copy-paste recipes for daily workflows |
16
+ | Documentation guide | [`docs/DOCUMENTATION_GUIDE.md`](./docs/DOCUMENTATION_GUIDE.md) | Rules and checklist for modifying documentation |
10
17
  | Lifecycle, gates, planning, verification, and recovery | [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md) | Normative process for agents and developer workflows |
11
18
  | Capability levels, discovery, and degradation | [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md) | Vendor-neutral harness contract |
12
19
  | Durable project facts | [`PROJECT_PROFILE.md`](./PROJECT_PROFILE.md) | Target-specific facts only; no prompts or secrets |
@@ -17,6 +24,35 @@ integration and guide context. Use this map before editing documentation.
17
24
  | Guide content | [`ENG/`](./ENG/) | Context-specific, English-only operational guides |
18
25
  | Diagram | [`docs/forgeloop-flow.mmd`](./docs/forgeloop-flow.mmd) | Canonical Mermaid source; SVG is generated output |
19
26
 
27
+ ## Audience map
28
+
29
+ | I am a... | Start here |
30
+ | --- | --- |
31
+ | **First-time user or developer** | [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md) |
32
+ | **AI coding agent / harness** | [`AGENTS.md`](./AGENTS.md) → [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md) |
33
+ | **Harness integrator** | [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md) |
34
+ | **Resuming another tool / session** | [`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md) |
35
+ | **Looking up CLI commands** | [`docs/CLI_REFERENCE.md`](./docs/CLI_REFERENCE.md) |
36
+ | **Inspecting `.forgeloop/` files** | [`docs/ARTIFACT_REFERENCE.md`](./docs/ARTIFACT_REFERENCE.md) |
37
+ | **Fixing a broken or stale state** | [`docs/TROUBLESHOOTING.md`](./docs/TROUBLESHOOTING.md) |
38
+ | **Looking for quick recipes** | [`docs/RECIPES.md`](./docs/RECIPES.md) |
39
+ | **Documentation contributor** | [`docs/DOCUMENTATION_GUIDE.md`](./docs/DOCUMENTATION_GUIDE.md) |
40
+ | **Protocol architect / maintainer** | [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md) + [`schemas/`](./schemas/) |
41
+ | **Security auditor** | [`THREAT_MODEL.md`](./THREAT_MODEL.md) |
42
+ | **Engineering guide author** | [`GUIDE_ROUTER.md`](./GUIDE_ROUTER.md) + [`ENG/`](./ENG/) |
43
+
44
+ ## Task map
45
+
46
+ - **Start my first task**: [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md)
47
+ - **Resume after switching tools**: [`docs/CROSS_HARNESS_CONTINUITY.md`](./docs/CROSS_HARNESS_CONTINUITY.md)
48
+ - **Check CLI options and syntax**: [`docs/CLI_REFERENCE.md`](./docs/CLI_REFERENCE.md)
49
+ - **Understand what `.forgeloop/` stores**: [`docs/ARTIFACT_REFERENCE.md`](./docs/ARTIFACT_REFERENCE.md)
50
+ - **Fix a blocked, stale, or invalid state**: [`docs/TROUBLESHOOTING.md`](./docs/TROUBLESHOOTING.md)
51
+ - **Find operational copy-paste commands**: [`docs/RECIPES.md`](./docs/RECIPES.md)
52
+ - **Read the normative protocol specification**: [`LOOP_ENGINEERING.md`](./LOOP_ENGINEERING.md)
53
+ - **Integrate a new AI environment**: [`PROTOCOL_INTEGRATION.md`](./PROTOCOL_INTEGRATION.md)
54
+ - **Edit documentation safely**: [`docs/DOCUMENTATION_GUIDE.md`](./docs/DOCUMENTATION_GUIDE.md)
55
+
20
56
  `README.md` is intentionally a catalog and quickstart. Do not copy the full
21
57
  process into adapters or README sections; link to the canonical source.
22
58
 
@@ -307,10 +307,40 @@ Canvas, WebGL, SVG displacement, and Liquid Glass effects follow the **normative
307
307
  - For charts and data visualization, consult [TanStack Charts](https://github.com/TanStack/charts); preserve responsiveness, contrast, keyboard readability, and never rely on color alone to communicate series or states.
308
308
  - For subtle interaction sounds, consult [Cuelume](https://cuelume-site.pages.dev/); provide volume/mute controls and never rely on audio to communicate essential information.
309
309
 
310
+ ### Architecture and diagram design — Beautiful Mermaid
311
+
312
+ When a task benefits from a polished technical diagram — for example an
313
+ architecture flow, lifecycle, state machine, sequence, class, ER, or other
314
+ Mermaid-supported visualization — consider
315
+ [Beautiful Mermaid by Craft](https://agents.craft.do/mermaid) as an optional
316
+ design/rendering resource.
317
+
318
+ Use the live editor at
319
+ [agents.craft.do/mermaid/editor](https://agents.craft.do/mermaid/editor) to
320
+ preview and refine Mermaid source and, when appropriate, export a polished SVG.
321
+
322
+ Rules:
323
+
324
+ - Mermaid source remains the canonical editable artifact when the project
325
+ already uses Mermaid-as-source.
326
+ - Prefer improving diagram structure and semantics before styling.
327
+ - Preserve technical accuracy; visual polish must never remove meaningful
328
+ states, branches, trust boundaries, failure paths, or labels.
329
+ - Prefer local/versioned SVG assets for repository documentation rather than
330
+ hotlinking externally rendered images.
331
+ - Treat Beautiful Mermaid as optional tooling, not as an implementation,
332
+ verification, authority, or completion dependency.
333
+ - Do not install `beautiful-mermaid` merely to render a documentation asset
334
+ when the browser editor or an already available equivalent is sufficient.
335
+ - If automated rendering is explicitly required, evaluate the open-source
336
+ `beautiful-mermaid` library separately under the project's dependency and
337
+ authorization policies before adding it.
338
+
310
339
  ## External design-reference map
311
340
 
312
341
  Select references for a product problem; they do not override project tokens or semantics. Check every adoption for keyboard and focus access, contrast, reduced motion, touch behavior, bundle/runtime cost, and fallback behavior. Cursor, canvas, 3D, audio, and decorative motion are progressive enhancement only. Do not copy source or assets; check the license and current terms for each exact resource, and treat a catalog listing as no transfer of rights.
313
342
 
343
+ - **Technical diagrams and architecture flows**: for polished Mermaid-based architecture and workflow diagrams, use [Beautiful Mermaid by Craft](https://agents.craft.do/mermaid) when relevant; preserve canonical Mermaid source, local versioned SVG assets, and do not treat presentation tooling as a mandatory protocol gate or runtime dependency.
314
344
  - **Component source and interaction inspiration**: use [21st.dev](https://21st.dev/) to study components and interactions; inspect each source, dependency, community contribution, and premium-material term before adoption.
315
345
  - **Component and motion inspiration**: use [React Bits](https://reactbits.dev/) to study component and motion behavior; distinguish public/free material from React Bits Pro and inspect each source/dependency license.
316
346
  - **Component inspiration**: use [Fancy Components](https://www.fancycomponents.dev/) to study component composition; verify its terms separately from Motion, Tailwind, shadcn, or other dependencies.
@@ -514,3 +544,4 @@ Select references for a product problem; they do not override project tokens or
514
544
  - Rights: the gallery's images and works are distinct from external resources it merely indexes. Consult the [terms](https://liquidglassdesign.com/terms); do not rehost, redistribute, or directly use images or works commercially without permission. For each external prompt or code resource, verify its license, provenance, credits, compatibility, and maintenance individually before use; being indexed does not transfer rights.
515
545
  - Apple — Adopting Liquid Glass (official guidance for Apple platforms): https://developer.apple.com/documentation/TechnologyOverviews/adopting-liquid-glass
516
546
  - Liquid Glass React, SVG, and Studio (experimental implementations; assess license, compatibility, weight, and maintenance): https://github.com/rdev/liquid-glass-react | https://github.com/shuding/liquid-glass | https://github.com/iyinchao/liquid-glass-studio
547
+ - Beautiful Mermaid (technical diagram design and rendering): https://agents.craft.do/mermaid | https://agents.craft.do/mermaid/editor | https://github.com/lukilabs/beautiful-mermaid
@@ -0,0 +1,400 @@
1
+ ---
2
+ name: documentation-quality-eng
3
+ language: en
4
+ description: "Quality standards for accurate, task-oriented, maintainable, accessible, and verifiable technical documentation."
5
+ version: "2026.09"
6
+ last-reviewed: "2026-08-17"
7
+ guide-id: documentation
8
+ ---
9
+
10
+ # Documentation Quality for AI Agents
11
+
12
+ > **Related documents**: use [`clean-code-eng.md`](./clean-code-eng.md) when software behavior or code structure changes; [`test-code-eng.md`](./test-code-eng.md) for executable examples and verification strategy; [`sec-code-eng.md`](./sec-code-eng.md) for secrets, authentication, authorization, privacy, and sensitive examples; [`accessibility-eng.md`](./accessibility-eng.md) when a published documentation surface has additional accessibility requirements. This guide owns documentation architecture, factual quality, freshness, maintainability, and reader usability.
13
+ >
14
+ > **Tooling policy**: identify the documentation surface, canonical sources, and existing project checks first. Prefer already available project-native tools. Ask for authorization before installing tooling or changing the environment. If a required check cannot be executed, record it as blocked or `NOT_VERIFIED`; never claim it passed.
15
+
16
+ ## Context
17
+
18
+ Technical documentation is part of the product contract. A document can compile, render, and contain no broken links while still being wrong, incomplete, difficult to use, or stale. Treat documentation changes with the same evidence discipline as executable changes: identify the reader, identify the authoritative source, make the smallest coherent change, and verify what can be observed.
19
+
20
+ ## Documentation quality model
21
+
22
+ Review documentation across independent dimensions:
23
+
24
+ - **Accuracy** — facts match the implementation, public contract, schema, registry, configuration, or other authoritative source.
25
+ - **Completeness** — the intended reader has enough information to complete the intended task.
26
+ - **Consistency** — terminology, values, commands, and behavior do not contradict other authoritative documentation.
27
+ - **Precision** — statements are specific enough to act on and verify.
28
+ - **Usefulness** — the content serves a real reader need rather than filling a template.
29
+ - **Freshness** — current supported behavior is documented and obsolete claims are removed or versioned.
30
+ - **Findability** — readers can reach the content through predictable navigation and descriptive headings/links.
31
+ - **Accessibility** — structure and meaning remain usable with assistive technology and without visual-only cues.
32
+ - **Verifiability** — executable or machine-defined claims are checked against authoritative sources where feasible.
33
+ - **Flow** — prerequisites, actions, results, and recovery guidance follow the reader's task without unrelated detours.
34
+
35
+ Functional correctness is required before polish. A beautiful document that is inaccurate is not high-quality documentation.
36
+
37
+ ## Identify the reader and job
38
+
39
+ Before writing, answer:
40
+
41
+ - Who is the intended reader?
42
+ - What are they trying to accomplish or understand?
43
+ - What can they reasonably be expected to know?
44
+ - What prerequisites must exist?
45
+ - What is the expected result?
46
+ - Which project source owns each factual claim?
47
+ - Which checks can verify the result?
48
+
49
+ Do not write from memory when the repository contains a more authoritative source.
50
+
51
+ ## Documentation modes
52
+
53
+ Use the Diátaxis model as a practical mental model. Do not create empty structures merely to satisfy it.
54
+
55
+ ### Tutorial
56
+
57
+ Use a tutorial for learning. Provide a controlled, safe path that produces a working result and helps the reader acquire familiarity. Keep optional branches and exhaustive reference material out of the main learning flow.
58
+
59
+ ### How-to guide
60
+
61
+ Use a how-to guide for a real task. State the goal and prerequisites, provide ordered actions, show the expected result, and include verification or recovery where useful. Link to explanation rather than interrupting the procedure with long conceptual digressions.
62
+
63
+ ### Reference
64
+
65
+ Use reference for authoritative technical facts: APIs, CLI commands, configuration, schemas, environment variables, statuses, and error codes. Prioritize accuracy, completeness, precision, neutrality, and predictable structure. Where possible, structure reference documentation to reflect the structure of the system it describes.
66
+
67
+ ### Explanation
68
+
69
+ Use explanation for understanding: architecture, concepts, trade-offs, context, and why the system behaves as it does. Keep required operational steps in how-to material.
70
+
71
+ ## README quality
72
+
73
+ A repository README should normally make it possible to answer:
74
+
75
+ 1. What is this project?
76
+ 2. Why would I use it?
77
+ 3. What are the prerequisites?
78
+ 4. How do I get a minimal working result?
79
+ 5. Where is deeper documentation?
80
+ 6. How do I get help or contribute when relevant?
81
+ 7. What license or support policy applies?
82
+
83
+ Keep the README as an entry point. Move deep tutorials, reference, architecture, and troubleshooting to dedicated documents when they grow.
84
+
85
+ ## Canonical sources and docs-as-code
86
+
87
+ Prefer one authoritative source for machine-defined facts.
88
+
89
+ Examples:
90
+
91
+ ```text
92
+ package scripts -> documented development commands
93
+ CLI registry -> CLI reference
94
+ OpenAPI description -> HTTP API reference
95
+ JSON Schema/types -> configuration/reference fields
96
+ error registry -> error-code reference
97
+ runtime config -> environment-variable reference
98
+ protocol constants -> lifecycle/status reference
99
+ ```
100
+
101
+ Generate or validate projections when practical. Do not manually copy the same factual table into multiple documents.
102
+
103
+ ## Generated and handwritten documentation
104
+
105
+ Generated content must have an explicit owner and deterministic generation path. Edit the canonical source or generator, not the generated projection.
106
+
107
+ Keep handwritten content for reader context, explanation, examples, and guidance that cannot be mechanically derived.
108
+
109
+ If generated regions use markers, validation must fail closed on missing, duplicate, nested, malformed, or unknown regions rather than silently rewriting arbitrary content.
110
+
111
+ ## Documentation impact analysis
112
+
113
+ For each task, assess whether it changes:
114
+
115
+ - public behavior;
116
+ - API or CLI syntax;
117
+ - installation or prerequisites;
118
+ - configuration or environment variables;
119
+ - architecture or trust boundaries;
120
+ - authentication or authorization;
121
+ - errors or observable states;
122
+ - deployment or operation;
123
+ - version compatibility;
124
+ - deprecations or migration steps;
125
+ - examples or workflows.
126
+
127
+ Update affected documentation in the same task when the change is required for correct use.
128
+
129
+ ## Freshness and timeless wording
130
+
131
+ Avoid time-sensitive words such as `new`, `currently`, `latest`, `now`, or `soon` in evergreen technical documentation when they will age without adding information.
132
+
133
+ Use explicit versions or dates when history or compatibility requires them.
134
+
135
+ Release notes, migration histories, and announcements may intentionally use time-based language.
136
+
137
+ ## Writing style and terminology
138
+
139
+ - Use direct, concise language.
140
+ - Prefer active voice.
141
+ - Use second person where it clarifies reader actions.
142
+ - Prefer specific nouns and verbs over vague references.
143
+ - Use one canonical term per concept.
144
+ - Define acronyms when the intended audience may not know them.
145
+ - Use sentence-case headings unless project style requires otherwise.
146
+ - Avoid idioms, culture-specific jokes, unnecessary metaphors, and ambiguous language in globally consumed documentation.
147
+ - Use normative `MUST`, `SHOULD`, and `MAY` only when the document is truly specifying requirement levels.
148
+
149
+ ## Procedures
150
+
151
+ A procedure should normally include:
152
+
153
+ ```text
154
+ goal
155
+ prerequisites
156
+ ordered actions
157
+ expected result
158
+ verification
159
+ recovery/troubleshooting
160
+ ```
161
+
162
+ Use numbered steps when order matters and imperative verbs for required actions.
163
+
164
+ Do not hide a prerequisite after the step that depends on it.
165
+
166
+ ## Commands and code samples
167
+
168
+ Runnable commands and copyable code must be safe and credible.
169
+
170
+ - Validate examples when feasible.
171
+ - Never invent successful command output.
172
+ - Label illustrative output explicitly.
173
+ - Use clear placeholders.
174
+ - Never include real secrets, tokens, private keys, PII, or production credentials.
175
+ - Explain destructive effects before the command.
176
+ - Follow the project's language and formatting conventions.
177
+ - Prefer real text over screenshots of terminal output or code.
178
+
179
+ ## API documentation
180
+
181
+ For HTTP APIs, use a machine-readable description such as OpenAPI when the project already supports or benefits from it.
182
+
183
+ Document relevant:
184
+
185
+ - authentication and authorization;
186
+ - operations and paths;
187
+ - parameters;
188
+ - request and response bodies;
189
+ - status codes and errors;
190
+ - pagination;
191
+ - rate limits;
192
+ - idempotency;
193
+ - webhooks;
194
+ - versioning;
195
+ - deprecation;
196
+ - examples.
197
+
198
+ Do not require OpenAPI for projects without an HTTP API.
199
+
200
+ ## CLI documentation
201
+
202
+ CLI reference should describe relevant:
203
+
204
+ - usage;
205
+ - commands;
206
+ - arguments;
207
+ - options;
208
+ - aliases;
209
+ - defaults;
210
+ - repeatable options;
211
+ - exit/error behavior;
212
+ - examples;
213
+ - shell-sensitive behavior;
214
+ - configuration precedence.
215
+
216
+ Derive or validate these facts from the CLI registry/parser when possible.
217
+
218
+ ## Configuration and environment documentation
219
+
220
+ Document each public configuration item with relevant:
221
+
222
+ ```text
223
+ name
224
+ purpose
225
+ type
226
+ required/optional
227
+ default
228
+ allowed values
229
+ safe example
230
+ secret classification
231
+ scope
232
+ precedence
233
+ reload/restart behavior
234
+ ```
235
+
236
+ Keep `.env.example`, runtime configuration, and documentation consistent.
237
+
238
+ ## Architecture documentation
239
+
240
+ Document the architecture at the smallest useful level.
241
+
242
+ Cover relevant:
243
+
244
+ - system context;
245
+ - major runtime boundaries;
246
+ - dependencies;
247
+ - data flow;
248
+ - trust boundaries;
249
+ - storage;
250
+ - external systems;
251
+ - deployment topology;
252
+ - important architectural decisions.
253
+
254
+ Use diagrams only when they improve understanding. A context/container view is enough for many systems; do not generate every possible diagram level.
255
+
256
+ For significant decisions, use an ADR or equivalent record containing context, decision, alternatives when useful, consequences, and status.
257
+
258
+ ## Troubleshooting and runbooks
259
+
260
+ Write troubleshooting around observable symptoms or stable error codes.
261
+
262
+ Prefer:
263
+
264
+ ```text
265
+ symptom
266
+ likely cause
267
+ how to verify
268
+ correction
269
+ next diagnostic/escalation step
270
+ ```
271
+
272
+ Operational runbooks should identify trigger, access prerequisites, safety checks, steps, verification, rollback, and escalation.
273
+
274
+ ## Accessibility
275
+
276
+ - Use one clear title.
277
+ - Maintain meaningful heading hierarchy.
278
+ - Use descriptive link text instead of `click here`.
279
+ - Provide text alternatives for informative images.
280
+ - Do not put unique information only in screenshots or diagrams.
281
+ - Do not use color, location, shape, or direction as the only semantic cue.
282
+ - Use tables for tabular data, not layout.
283
+ - Keep long content scannable.
284
+ - Prefer real text for code and terminal output.
285
+
286
+ ## Security and sensitive information
287
+
288
+ Documentation must not expose:
289
+
290
+ ```text
291
+ tokens
292
+ passwords
293
+ private keys
294
+ real credentials
295
+ session identifiers
296
+ personal data
297
+ production connection strings
298
+ internal secrets
299
+ ```
300
+
301
+ Use explicitly fake examples. Authentication and authorization documentation must match actual server-side behavior and permissions.
302
+
303
+ ## Versioning, deprecation, and migration
304
+
305
+ If the project has a versioned public API, keep its documentation precise and comprehensive enough to understand compatibility.
306
+
307
+ Document breaking changes and deprecations. When users need action to upgrade, provide a migration guide with affected versions, prerequisites, steps, verification, rollback/recovery, and known incompatibilities.
308
+
309
+ Do not promise removal dates or future behavior unless the project has committed to them.
310
+
311
+ ## Validation and evidence
312
+
313
+ Use the project's own tools first.
314
+
315
+ Possible checks include:
316
+
317
+ - Markdown lint/validation;
318
+ - internal link and anchor validation;
319
+ - external link checks with an explicit network-failure policy;
320
+ - documentation build;
321
+ - code example execution or compilation;
322
+ - OpenAPI/schema validation;
323
+ - CLI/reference parity;
324
+ - configuration/reference parity;
325
+ - generated-document freshness;
326
+ - diagram source/artifact parity;
327
+ - README quick-start execution.
328
+
329
+ Do not install optional tooling solely to satisfy this list.
330
+
331
+ If a required check is unavailable, record it as blocked or `NOT_VERIFIED`. Never report an unexecuted check as passed.
332
+
333
+ ## Anti-patterns
334
+
335
+ Avoid:
336
+
337
+ - README as a dumping ground;
338
+ - tutorials mixed with exhaustive reference;
339
+ - procedures interrupted by unrelated explanation;
340
+ - factual tables manually duplicated across files;
341
+ - untested commands presented as guaranteed;
342
+ - invented output;
343
+ - screenshots of code or terminal text;
344
+ - stale time-sensitive wording;
345
+ - dead-end documents with no navigation;
346
+ - manual edits to generated documentation;
347
+ - undocumented breaking changes;
348
+ - known required documentation deferred indefinitely after behavior changes.
349
+
350
+ ## Agent workflow
351
+
352
+ For documentation work:
353
+
354
+ 1. Discover relevant documentation and project truth sources.
355
+ 2. Classify the reader need: tutorial, how-to, reference, or explanation.
356
+ 3. Identify the authoritative source for factual claims.
357
+ 4. Map documentation impact.
358
+ 5. Make the smallest coherent update.
359
+ 6. Run relevant project-native documentation checks.
360
+ 7. Inspect the diff from the intended reader's perspective.
361
+ 8. Cross-check facts against implementation or canonical machine sources.
362
+ 9. Record observed verification evidence through the project/ForgeLoop verification flow.
363
+ 10. Do not claim completion beyond the evidence.
364
+
365
+ ## Documentation Definition of Done
366
+
367
+ Before completion verify:
368
+
369
+ - [ ] Intended reader and purpose are clear.
370
+ - [ ] Factual claims match authoritative project sources.
371
+ - [ ] The documentation mode fits the reader need.
372
+ - [ ] Required information is complete for the intended task.
373
+ - [ ] Terminology is consistent.
374
+ - [ ] Procedures are ordered and actionable.
375
+ - [ ] Examples and commands are safe and validated when feasible.
376
+ - [ ] Internal navigation and links are coherent.
377
+ - [ ] Accessibility basics are satisfied.
378
+ - [ ] No real secrets or sensitive data appear.
379
+ - [ ] Generated/reference material is fresh.
380
+ - [ ] Version/deprecation/migration impact is documented when applicable.
381
+ - [ ] Relevant project-native checks have observed evidence.
382
+ - [ ] Unavailable required checks are explicitly `NOT_VERIFIED` or blocked.
383
+ - [ ] The completion claim does not exceed the evidence.
384
+
385
+ ## Sources and further reading
386
+
387
+ This guide is an original operational synthesis informed by:
388
+
389
+ - Diátaxis — https://diataxis.fr/
390
+ - Diátaxis quality — https://diataxis.fr/quality/
391
+ - Google Developer Documentation Style Guide — https://developers.google.com/style
392
+ - Google accessible documentation guidance — https://developers.google.com/style/accessibility
393
+ - Google code sample guidance — https://developers.google.com/style/code-samples
394
+ - Google timeless documentation guidance — https://developers.google.com/style/timeless-documentation
395
+ - GitHub repository documentation guidance — https://docs.github.com/en/repositories/creating-and-managing-repositories/best-practices-for-repositories
396
+ - W3C WAI writing guidance — https://www.w3.org/WAI/tips/writing/
397
+ - OpenAPI Specification — https://spec.openapis.org/oas/
398
+ - Semantic Versioning — https://semver.org/
399
+ - C4 model — https://c4model.com/
400
+ - RFC 2119 — https://www.rfc-editor.org/rfc/rfc2119.html
@@ -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 |