@cassiomc1/forgeloop 1.1.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/project-loop.mdc +1 -1
- package/.github/copilot-instructions.md +1 -1
- package/AGENTS.md +1 -1
- package/CLAUDE.md +1 -1
- package/DOCS_INDEX.md +3 -0
- package/ENG/design-code-eng.md +124 -0
- package/ENG/premium-sites-studio-eng.md +28 -0
- package/ENG/taste-frontend-eng.md +3 -2
- package/ENG/test-code-eng.md +45 -0
- package/LOOP_ENGINEERING.md +74 -0
- package/LOOP_SYSTEM_DESIGN.md +9 -5
- package/ORCHESTRATOR_INTEGRATION.md +41 -6
- package/PROTOCOL_INTEGRATION.md +13 -0
- package/README.md +40 -6
- package/TERMINOLOGY.md +10 -0
- package/THIRD_PARTY_NOTICES.md +58 -1
- package/THREAT_MODEL.md +12 -1
- package/docs/ARTIFACT_REFERENCE.md +152 -2
- package/docs/CLI_REFERENCE.md +346 -30
- package/docs/CROSS_HARNESS_CONTINUITY.md +1 -0
- package/docs/DOCUMENTATION_GUIDE.md +41 -4
- package/docs/GETTING_STARTED.md +39 -8
- package/docs/RECIPES.md +66 -7
- package/docs/TROUBLESHOOTING.md +279 -6
- package/package.json +1 -1
- package/schemas/policy-baseline.schema.json +26 -0
- package/schemas/policy-discovery.schema.json +45 -0
- package/schemas/policy-lock.schema.json +16 -0
- package/schemas/policy-rules.schema.json +48 -0
- package/schemas/policy-snapshot.schema.json +16 -0
- package/src/cli.js +102 -1
- package/src/commands/baseline.js +120 -0
- package/src/commands/init.js +304 -6
- package/src/commands/next.js +15 -1
- package/src/commands/policy-diff.js +51 -0
- package/src/commands/policy-discover.js +42 -0
- package/src/commands/policy-status.js +33 -0
- package/src/commands/profile-interview.js +50 -0
- package/src/commands/progress.js +51 -0
- package/src/commands/reconcile-closure.js +49 -0
- package/src/commands/record-decision-criterion.js +34 -0
- package/src/commands/record-diagnosis.js +49 -0
- package/src/commands/rule-verify.js +36 -0
- package/src/commands/validate-receipt.js +38 -3
- package/src/core/artifact-registry.js +60 -0
- package/src/core/audit.js +24 -0
- package/src/core/cli-command-definitions.js +163 -7
- package/src/core/cli-metadata.js +1 -1
- package/src/core/completion-artifacts.js +29 -3
- package/src/core/completion.js +101 -10
- package/src/core/diagnosis-model.js +214 -0
- package/src/core/diagnosis.js +171 -0
- package/src/core/error-codes.js +292 -0
- package/src/core/events.js +47 -1
- package/src/core/execution-prerequisites.js +38 -20
- package/src/core/execution.js +20 -3
- package/src/core/native-adapters.js +14 -4
- package/src/core/next-action-model.js +40 -5
- package/src/core/next-action.js +234 -91
- package/src/core/phase.js +29 -0
- package/src/core/policy-adapters.js +276 -0
- package/src/core/policy-baseline.js +144 -0
- package/src/core/policy-diff.js +133 -0
- package/src/core/policy-discovery.js +225 -0
- package/src/core/policy-engine.js +533 -0
- package/src/core/policy-mutation.js +139 -0
- package/src/core/preflight-consistency.js +23 -15
- package/src/core/preflight-model.js +10 -2
- package/src/core/preflight.js +65 -1
- package/src/core/progress.js +143 -0
- package/src/core/protocol.js +8 -0
- package/src/core/reconcile-closure.js +173 -0
- package/src/core/schema-validation.js +6 -0
- package/src/core/settlement-model.js +85 -0
- package/src/core/settlement.js +78 -0
- package/src/core/task-context.js +11 -0
- package/src/core/task-discovery.js +67 -1
- package/src/core/task-paths.js +9 -0
- package/src/core/templates.js +5 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# ForgeLoop — Verifiable Engineering Protocol
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="./docs/assets/
|
|
4
|
+
<img src="./docs/assets/eng_readme_forgeloop.png" alt="ForgeLoop — Loop Engineering for AI Agents" width="100%">
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
[](https://github.com/cassiomc1/forgeloop/actions/workflows/docs-quality.yml)
|
|
@@ -96,7 +96,7 @@ Typical local commands are:
|
|
|
96
96
|
```bash
|
|
97
97
|
forgeloop task-create --task example-task --claim src --claim tests --json
|
|
98
98
|
forgeloop route --task example-task --work complete-website --surface ui --risk untrusted-input
|
|
99
|
-
forgeloop activate
|
|
99
|
+
forgeloop activate
|
|
100
100
|
forgeloop preflight --task example-task --json
|
|
101
101
|
forgeloop next --task example-task --json
|
|
102
102
|
forgeloop advance --task example-task --to PLANNED
|
|
@@ -112,10 +112,12 @@ forgeloop complete --task example-task --json
|
|
|
112
112
|
`advance` changes protocol phase only; it never runs target commands.
|
|
113
113
|
`run-check` classifies the exact argv before launch and records ForgeLoop-owned
|
|
114
114
|
execution provenance. `record-check` stores an observation and never executes
|
|
115
|
-
the text supplied to `--command`. `
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
the text supplied to `--command`. `record-diagnosis` appends an authoritative
|
|
116
|
+
root-cause hypothesis to the event ledger. `progress` evaluates task
|
|
117
|
+
progression and detects stalls deterministically. `complete` validates the
|
|
118
|
+
contract, route, gates, ledger, evidence, coverage, receipt, and freshness.
|
|
119
|
+
`audit` is read-only. `report` exposes independent completion, publication,
|
|
120
|
+
and production-readiness dimensions.
|
|
119
121
|
|
|
120
122
|
The status precedence is `INVALID` > `INCONSISTENT` > `STALE` > `INCOMPLETE` >
|
|
121
123
|
`VALID`. A `READY` preflight is a resumable checkpoint: if its work state is
|
|
@@ -158,6 +160,38 @@ forgeloop complete --task auth-feature --json
|
|
|
158
160
|
forgeloop task-migrate --json
|
|
159
161
|
```
|
|
160
162
|
|
|
163
|
+
### Executable policy verification & brownfield baselines
|
|
164
|
+
|
|
165
|
+
ForgeLoop enforces automated, non-interactive verification rules (`rules.json`) with zero interactive dependencies:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Discover architecture conventions and candidate rules (read-only unless --write)
|
|
169
|
+
forgeloop policy-discover --json
|
|
170
|
+
|
|
171
|
+
# Inspect active policy verification status, baselines, and drift
|
|
172
|
+
forgeloop policy-status --json
|
|
173
|
+
|
|
174
|
+
# Record brownfield legacy debt into baseline to prevent blocking
|
|
175
|
+
forgeloop baseline --record --json
|
|
176
|
+
|
|
177
|
+
# Monotonically ratchet down resolved technical debt
|
|
178
|
+
forgeloop baseline --update --json
|
|
179
|
+
|
|
180
|
+
# Prove rule checker efficacy against synthetic mutation fixtures
|
|
181
|
+
forgeloop rule-verify --rule SECURITY.NO_HARDCODED_SECRET --json
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
A policy-bound task captures its effective rules and semantic baseline in
|
|
185
|
+
`.forgeloop/task-state/<taskKey>/policy-snapshot.json`. The project lock at
|
|
186
|
+
`.forgeloop/policy/policy.lock` protects the effective rules plus baseline and
|
|
187
|
+
must contain matching `algorithm`, `digest`, `rulesDigest`, and `baselineDigest`
|
|
188
|
+
values. `capturedAt` is informational metadata and does not change semantic
|
|
189
|
+
identity. During an active task, `baseline --update` may remove resolved debt,
|
|
190
|
+
but `baseline --record` is blocked unless an operator explicitly supplies
|
|
191
|
+
`--policy-reset-authorized`. Use `forgeloop next --task <id> --json` to receive
|
|
192
|
+
semantic recovery such as `RESTORE_POLICY`, `REPAIR_CHECKER`, or
|
|
193
|
+
`RESTORE_BASELINE` when verification detects drift or corruption.
|
|
194
|
+
|
|
161
195
|
See [`docs/CLI_REFERENCE.md`](./docs/CLI_REFERENCE.md) and [`LOOP_SYSTEM_DESIGN.md`](./LOOP_SYSTEM_DESIGN.md) for architecture details.
|
|
162
196
|
|
|
163
197
|
## Architecture flow
|
package/TERMINOLOGY.md
CHANGED
|
@@ -25,3 +25,13 @@
|
|
|
25
25
|
| Execution continuity | Bounded current-task implementation context used to resume the same ForgeLoop task across sessions or harnesses. |
|
|
26
26
|
| Continuity artifact | `.forgeloop/continuity.json`; non-evidence operational context bound to canonical work state. |
|
|
27
27
|
| Continuity reconciliation | Read-only comparison of continuity bindings and path hints against current canonical state and checkout. |
|
|
28
|
+
| Executable policy rule | A structured rule with an automated checker evaluating constraints on code and artifacts. |
|
|
29
|
+
| Policy discovery | Deterministic non-interactive inspection of codebase structure and conventions with confidence levels. |
|
|
30
|
+
| Brownfield baseline | Cryptographically fingerprinted list of pre-existing policy violations tolerated without blocking progress. |
|
|
31
|
+
| Violation fingerprint | SHA-256 hash uniquely identifying a violation by rule, file, and line/content hash. |
|
|
32
|
+
| Monotonic ratchet | Invariant ensuring brownfield baseline debt only decreases as legacy violations are resolved. |
|
|
33
|
+
| Mutation verification | Proving checker capability by asserting failure on intentionally mutated code fixtures. |
|
|
34
|
+
| Proof digest | Cryptographic digest confirming a checker caught a mutation fixture. |
|
|
35
|
+
| Inert check | A verification rule whose check target or scope does not exist or matches 0 files in the codebase. |
|
|
36
|
+
| Policy drift | Divergence between task preflight snapshot policy and current workspace policy. |
|
|
37
|
+
| Policy diff | Semantic classification of policy changes into `TIGHTEN`, `NEUTRAL`, `WEAKEN`, or `UNKNOWN`. |
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -13,6 +13,22 @@ review the applicable source terms before redistributing such material.
|
|
|
13
13
|
|
|
14
14
|
## Adapted and editorial sources
|
|
15
15
|
|
|
16
|
+
### Elaya Design — Landing Page Design
|
|
17
|
+
|
|
18
|
+
- Project:
|
|
19
|
+
[elayadesign/ai-design-skills](https://github.com/elayadesign/ai-design-skills).
|
|
20
|
+
- Referenced skill:
|
|
21
|
+
[landing-page-design](https://github.com/elayadesign/ai-design-skills/blob/main/skills/landing-page-design/SKILL.md).
|
|
22
|
+
- License declared by the upstream repository: MIT.
|
|
23
|
+
- Use in this collection: editorial influence for landing-page strategy,
|
|
24
|
+
conversion structure, proof/objection placement, benefit-first copy, and
|
|
25
|
+
incremental section-by-section implementation.
|
|
26
|
+
- Boundary: ForgeLoop does not adopt the upstream skill's complete prescriptive
|
|
27
|
+
visual system as a universal rule, and does not import its intake-question
|
|
28
|
+
workflow over ForgeLoop's own decision classification. The strategy concepts
|
|
29
|
+
are paraphrased; if substantial upstream text is copied or adapted in the
|
|
30
|
+
future, preserve the applicable MIT notice and attribution.
|
|
31
|
+
|
|
16
32
|
### A11Y.md
|
|
17
33
|
|
|
18
34
|
- Project: [fecarrico/A11Y.md](https://github.com/fecarrico/A11Y.md).
|
|
@@ -56,6 +72,16 @@ dependencies, version, and distribution conditions before adoption.
|
|
|
56
72
|
workflow boundaries and public discoverability only.
|
|
57
73
|
- Boundary: this repository links to Superpowers as a reference; it is not a dependency of `ForgeLoop`, and `ForgeLoop` does not copy, bundle, install, or vendor any Superpowers source, skill, hook, plugin, runtime, dependency, credential, or provider.
|
|
58
74
|
|
|
75
|
+
### React Doctor
|
|
76
|
+
|
|
77
|
+
- Project: [millionco/react-doctor](https://github.com/millionco/react-doctor).
|
|
78
|
+
- Use in this collection: optional target-project React diagnostic/verifier
|
|
79
|
+
reference.
|
|
80
|
+
- Boundary: React Doctor is not a ForgeLoop runtime dependency or universal
|
|
81
|
+
completion gate. ForgeLoop does not automatically download, install, execute,
|
|
82
|
+
configure, or enable its CI/agent integrations. Verify current upstream
|
|
83
|
+
license, CLI, telemetry, network behavior, and dependencies before use.
|
|
84
|
+
|
|
59
85
|
### Runtime and validator boundary
|
|
60
86
|
|
|
61
87
|
The distributed CLI and repository validators use Node.js and Python standard
|
|
@@ -87,14 +113,27 @@ network behavior, and distribution terms separately.
|
|
|
87
113
|
|
|
88
114
|
## Design reference sites
|
|
89
115
|
|
|
90
|
-
The following
|
|
116
|
+
The following sites are references in the design guide. None is a
|
|
91
117
|
dependency of this collection or a blanket permission to reuse code, assets,
|
|
92
118
|
fonts, templates, or other material.
|
|
93
119
|
|
|
94
120
|
- [21st.dev](https://21st.dev/): component and template registry; check the
|
|
95
121
|
terms for the specific author, community contribution, or paid material.
|
|
122
|
+
- [AIcss](https://www.aicss.dev/): AI-agent interface pattern and component
|
|
123
|
+
reference; verify current terms, provenance, dependencies, and reuse rights
|
|
124
|
+
for the exact block before copying or redistributing it.
|
|
96
125
|
- [React Bits](https://reactbits.dev/): component and motion reference; keep
|
|
97
126
|
public/free material, React Bits Pro, and dependency terms separate.
|
|
127
|
+
- [beUI](https://beui.dev/) / source
|
|
128
|
+
[starc007/ui-components](https://github.com/starc007/ui-components):
|
|
129
|
+
React/Next.js animated component reference; verify current terms, license,
|
|
130
|
+
Motion/Tailwind dependencies, and accessibility/reduced-motion behavior before
|
|
131
|
+
adoption.
|
|
132
|
+
- [Transition Kit](https://transition-kit.space/) / source
|
|
133
|
+
[AbdullahMukadam/Transition-kit](https://github.com/AbdullahMukadam/Transition-kit):
|
|
134
|
+
CSS-first page/theme transition reference around the View Transitions API;
|
|
135
|
+
verify current terms, browser compatibility, and fallback behavior before
|
|
136
|
+
adoption.
|
|
98
137
|
- [Fancy Components](https://www.fancycomponents.dev/): component reference;
|
|
99
138
|
verify the linked source license and each dependency before reuse.
|
|
100
139
|
- [Motion Primitives](https://motion-primitives.com/): motion reference; keep
|
|
@@ -112,6 +151,24 @@ fonts, templates, or other material.
|
|
|
112
151
|
- [cables.gl](https://cables.gl/): creative-coding and WebGL reference; check
|
|
113
152
|
the tool, exported patches or operators, code, and third-party assets
|
|
114
153
|
separately before distribution.
|
|
154
|
+
- [VibePrompt](https://vibeprompts.dev/): optional UI-pattern and prompt
|
|
155
|
+
reference for comparing common page/component structures. ForgeLoop does not
|
|
156
|
+
bundle its prompts or snippets and does not make Tailwind a dependency.
|
|
157
|
+
Verify the site's current terms and the provenance/license of any prompt,
|
|
158
|
+
snippet, or substantial material before copying or redistributing it.
|
|
159
|
+
- [Kitbitz](https://kitbitz.art/): optional illustration and visual-asset
|
|
160
|
+
reference. ForgeLoop does not bundle, mirror, or download its assets. Verify
|
|
161
|
+
the current first-party license and asset-specific terms before use; record
|
|
162
|
+
attribution when required and preserve asset provenance in the target
|
|
163
|
+
project. A catalog listing is not a permanent license statement.
|
|
164
|
+
- [DesEngs](https://desengs.com/) / source
|
|
165
|
+
[remvze/desengs](https://github.com/remvze/desengs):
|
|
166
|
+
curated meta-directory for design-engineering resources. The upstream
|
|
167
|
+
DesEngs repository currently declares MIT for its own software/material
|
|
168
|
+
covered by that license. ForgeLoop uses the site only as an optional discovery
|
|
169
|
+
index and does not bundle or mirror its catalog. Each external resource linked
|
|
170
|
+
by DesEngs retains its own license, terms, authorship, dependencies, and
|
|
171
|
+
premium/free boundary; inspect the exact upstream source before adoption.
|
|
115
172
|
|
|
116
173
|
### Qwen-MM-Plugins
|
|
117
174
|
|
package/THREAT_MODEL.md
CHANGED
|
@@ -43,7 +43,18 @@ remaining trust boundaries and their executable evidence.
|
|
|
43
43
|
| Recursive npm script dispatch | A recognized npm lifecycle script invokes another npm script, which later invokes an installation-capable resolver (e.g. `test` -> `npm run visual` -> `npx package`) | Recognized npm dispatcher semantics before ForgeLoop process launch | Recursive npm-script resolution with cycle detection, maximum depth (16), lifecycle hook inspection, restart special semantics, and fail-closed behavior when the resolver cannot prove the chain is non-installing | Opaque executables may spawn arbitrary descendants. Full descendant-process attestation requires host-level process controls and is outside this release | `tests/run-check.test.js`, `tests/verification-capability.test.js` |
|
|
44
44
|
| npm invocation rewriting and workspace dispatch | npm configuration flags appear before the subcommand, or npm workspace selectors cause script execution to occur against a package.json different from the ForgeLoop target root | Raw npm argv versus effective npm command and execution context | Canonical npm invocation parsing, effective subcommand extraction, workspace flag detection across the full npm argv, and fail-closed workspace script handling when the selected package.json cannot be proven from the current target | ForgeLoop 0.1.15 intentionally does not implement full npm workspace resolution. Users should execute run-check from the selected workspace target directory | `tests/run-check.test.js`, `tests/verification-capability.test.js` |
|
|
45
45
|
| Unclassified npm Install-Capable Command | The npm security classifier recognizes only a small denylist of package-mutating commands. Another official npm command or alias with install/update/bootstrap semantics falls through as a local package command | Effective npm command semantics versus ForgeLoop's command classifier | Semantic npm command classification with explicit install-capable families, explicit script-dispatch families, a deliberately small non-installing allowlist, and fail-closed behavior for unknown or ambiguous npm commands | Future npm commands are blocked until ForgeLoop explicitly classifies them | `tests/verification-capability.test.js`, `tests/run-check.test.js` |
|
|
46
|
-
|
|
|
46
|
+
| Policy weakening bypass | An actor weakens complexity or security thresholds mid-task to bypass verification failures | Task policy snapshot (`policy-snapshot.json`) and semantic policy diff | `policy-diff` classifies rule relaxations as `WEAKEN`, preflight snapshots enforce baseline digests, and `complete` blocks on `E_POLICY_WEAKENING` | A project operator with local filesystem access can authoritatively update project rules | `tests/policy-autonomy.test.js`, `tests/policy-hardening.test.js` |
|
|
47
|
+
| Inert check evasion | An actor relies on an inert or non-matching checker to create false verification pass | Policy engine checker inspection | Scanned file counters and adapter target checks; unproven or inert project rules trigger `E_CHECK_INERT` | Discovered rules gracefully downgrade to advisory without stopping execution | `tests/policy-autonomy.test.js`, `tests/policy-hardening.test.js` |
|
|
48
|
+
| Baseline debt expansion | An actor expands baseline tolerances during task execution to ignore new violations | Brownfield baseline (`baseline.json`) and violation fingerprints | SHA-256 violation fingerprinting by rule and file content; monotonic ratchet ensures baseline debt only decreases | Operators can intentionally re-record baselines using `forgeloop baseline --record --policy-reset-authorized` | `tests/policy-autonomy.test.js`, `tests/policy-hardening.test.js` |
|
|
49
|
+
| Unproven mutation checker | A broken or mock checker passes regardless of code correctness | Mutation testing runner (`rule-verify`) | Mutation verification runs checks against synthetic mutant fixtures; failure to catch a mutation yields `CHECK_MUTATION_NOT_DETECTED` and `UNPROVEN` status | Mutation fixtures are maintained for standard built-in adapters | `tests/policy-autonomy.test.js`, `tests/policy-hardening.test.js` |
|
|
50
|
+
| Checker crash interpreted as proof | A broken checker crashes with an exception and is erroneously treated as observing expected failure | Mutation verification runner (`rule-verify`) | Distinguish `ERROR` from `FAIL`; exceptions produce `observed: ERROR`, `CHECK_MUTATION_EXECUTION_ERROR`, and null `proofDigest` | Repaired checker must pass mutation test cleanly | `tests/policy-hardening.test.js` |
|
|
51
|
+
| Policy corruption bypass | Malformed policy artifacts cause runtime errors that are silently ignored to bypass checks | Fail-closed policy evaluation in `audit` and `complete` | Explicit capability classification (`NOT_PRESENT`, `AVAILABLE`, `INVALID`); corrupt artifacts fail closed with `E_POLICY_INVALID` or `E_POLICY_EVALUATION_FAILED` | Absent policy in legacy targets remains compatible without blocking | `tests/policy-hardening.test.js` |
|
|
52
|
+
| Partial initialization authority | Manifest is committed before executable-policy bootstrap completes, so a repository appears initialized while `discovery.json`/`baseline.json`/`policy.lock` are partial or absent | Manifest commit boundary during `forgeloop init` | Manifest-last commit authority: policy artifacts are written and verified (`detectPolicyCapability` = `AVAILABLE`, `verifyPolicyLock` = `VALID`) before the manifest is written; any bootstrap failure raises `E_POLICY_INITIALIZATION_FAILED` with no committed manifest; retry reconciles already-correct files and fails with a deterministic conflict on unowned divergent content; `dry-run` performs no writes | A trusted operator can still deliberately edit artifacts after initialization | `tests/init-policy.test.js` |
|
|
53
|
+
| Lock regeneration or subdigest tampering | An actor modifies rules or baseline, omits subdigests, or regenerates `policy.lock` to hide tampering | Effective policy lock verification (`verifyPolicyLock`) | Lock derives deterministically from effective rules + baseline. Schema-invalid lock artifacts (malformed JSON or missing required fields such as `rulesDigest`/`baselineDigest`) fail closed with `E_POLICY_INVALID`; schema-valid locks whose semantic digest components (`algorithm`, `digest`, `rulesDigest`, `baselineDigest`) no longer match effective policy state fail with `E_POLICY_LOCK_MISMATCH` before any relocking. Changing only `capturedAt` does not change semantic identity | Explicit update commands (`policy-discover --write`, `baseline`) update lock after authorization | `tests/policy-hardening.test.js` |
|
|
54
|
+
| Baseline re-record bypass | An actor uses `baseline --record` during an active task to convert newly introduced violations into tolerated debt | Active task baseline protection in `runBaseline` | `baseline --record` is rejected during active policy-bound tasks with `E_BASELINE_RECORD_DURING_ACTIVE_TASK`; only monotonic `--update` is permitted | Explicit `--policy-reset-authorized` flag required for intentional operator resets | `tests/policy-hardening.test.js` |
|
|
55
|
+
| Legacy snapshot semantic confusion | A legacy task snapshot lacking baseline state is assumed to have empty baseline, creating false `WEAKEN` drift | Semantic baseline snapshotting in `policy-snapshot.json` | Snapshots retain full semantic baseline entries; snapshots lacking baseline state classify drift as `UNKNOWN` rather than inventing state | Modern tasks retain semantic baseline entries for exact diff | `tests/policy-hardening.test.js` |
|
|
56
|
+
| Cross-task state confusion | Concurrent processes or alternative harnesses mutate or read the wrong task's state in a multi-task workspace | Task-scoped isolation in `.forgeloop/task-state/<taskKey>/` | Deterministic SHA-256 task directory namespacing, explicit `--task` / `FORGELOOP_TASK` selectors, file-level mutex locking (`.lock`), and claim overlap detection in `task-create` | Tasks must declare non-overlapping write claims or operate in isolated worktrees | `tests/task-namespace.test.js`, `tests/task-scope.test.js` |
|
|
57
|
+
| Modern namespace descriptor deletion | Corruption or an attacker removes `task.json` from a modern task namespace (leaving contract/work-state/receipt/events), the resolver ignores the namespace, and stale legacy singleton state becomes authoritative | Descriptor boundary between modern task namespaces and the legacy singleton | Descriptor-less 64-hex directories are classified by contents: directories containing modern task artifacts (or empty directories) fail closed with `E_TASK_DESCRIPTOR_INVALID`; only directories containing exclusively the explicitly recognized legacy-incidental artifact (`policy-snapshot.json`) are ignored; `resolveTaskContext` fails closed when all namespaces are corrupt | A separately privileged process can rewrite task-state directories after validation | `tests/validate-receipt-task.test.js` |
|
|
47
58
|
|
|
48
59
|
## Boundary rules
|
|
49
60
|
|
|
@@ -25,6 +25,11 @@ All artifact schemas are defined in `schemas/*.schema.json`. Persisted artifact
|
|
|
25
25
|
| `task-state/<task-key>/continuity.json` | `continuity` | Agent Or Harness | Mutable Handoff Notes | Non Evidence Handoff |
|
|
26
26
|
| `task-state/<task-key>/execution-receipt.json` | `execution-receipt` | Protocol Compiled | Atomic Compilation | Evidence Compilation |
|
|
27
27
|
| `task-state/<task-key>/executions/exec-<id>.json` | `execution` | Protocol Executed | Immutable Once Written | Execution Provenance |
|
|
28
|
+
| `policy/rules.json` | `policy-rules` | Operator Or Agent | Mutable Configuration | Policy Specification |
|
|
29
|
+
| `policy/discovery.json` | `policy-discovery` | Protocol Generated | Mutable On Discovery | Discovered Policy Specification |
|
|
30
|
+
| `policy/baseline.json` | `policy-baseline` | Protocol Generated Or Operator | Monotonic Ratchet Down | Brownfield Baseline |
|
|
31
|
+
| `policy/policy.lock` | `policy-lock` | Protocol Generated | Atomic Digest Compilation | Policy Integrity Lock |
|
|
32
|
+
| `task-state/<task-key>/policy-snapshot.json` | `policy-snapshot` | Protocol Generated | Mutable Before Execution | Task Policy Attestation |
|
|
28
33
|
|
|
29
34
|
<!-- END FORGELOOP GENERATED: artifact-registry -->
|
|
30
35
|
|
|
@@ -160,7 +165,7 @@ Discovered repository facts, platforms, runtimes, and dependencies.
|
|
|
160
165
|
|
|
161
166
|
<!-- forgeloop-doc: schema=event artifact=.forgeloop/task-state/<task-key>/events.ndjson -->
|
|
162
167
|
|
|
163
|
-
The append-only cryptographic event ledger. Each line is a single JSON event object.
|
|
168
|
+
The append-only cryptographic event ledger. Each line is a single JSON event object. Records authoritative chronological events including lifecycle milestones (`TASK_RECEIVED`, `CONTRACT_VALIDATED`, `ROUTE_VALIDATED`, `PREFLIGHT_READY`, `EXECUTION_STARTED`, `VERIFICATION_STARTED`), evidence-backed diagnoses (`DIAGNOSIS_RECORDED`), and decision settlement criteria (`DECISION_CRITERION_RECORDED`).
|
|
164
169
|
|
|
165
170
|
#### Canonical Line Fields
|
|
166
171
|
|
|
@@ -254,7 +259,7 @@ Pre-implementation gate approval artifact recording decisions, bound artifact ha
|
|
|
254
259
|
|
|
255
260
|
<!-- forgeloop-doc: schema=work-state artifact=.forgeloop/task-state/<task-key>/work-state.json -->
|
|
256
261
|
|
|
257
|
-
The canonical, authoritative lifecycle work state.
|
|
262
|
+
The canonical, authoritative lifecycle work state. Represents current checkpoint and resume state (`phase`, `checks`, `verificationCycle`, `lastUpdated`). Note: `diagnosedHypothesis` is maintained as a backward-compatibility projection of the latest diagnosis from `events.ndjson`.
|
|
258
263
|
|
|
259
264
|
#### Canonical Fields
|
|
260
265
|
|
|
@@ -440,3 +445,148 @@ Canonical task descriptor declaring task identity, key, timestamps, and write cl
|
|
|
440
445
|
- `writeClaims` *(array<string>, required)*
|
|
441
446
|
|
|
442
447
|
<!-- END FORGELOOP GENERATED: schema:task-descriptor -->
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
### 2.14 `policy/rules.json`
|
|
452
|
+
|
|
453
|
+
<!-- forgeloop-doc: schema=policy-rules artifact=.forgeloop/policy/rules.json -->
|
|
454
|
+
|
|
455
|
+
Repository-level executable policy rules declaring verification constraints.
|
|
456
|
+
|
|
457
|
+
#### Canonical Fields
|
|
458
|
+
|
|
459
|
+
<!-- BEGIN FORGELOOP GENERATED: schema:policy-rules -->
|
|
460
|
+
|
|
461
|
+
- `schemaVersion` *(number, required, const: 1)*
|
|
462
|
+
- `rules` *(array<object>, required)*
|
|
463
|
+
- `id` *(string, required, minLength: 1)*
|
|
464
|
+
- `severity` *(string, required, enum: `HIGH`, `MEDIUM`, `LOW`, `INFO`)*
|
|
465
|
+
- `source` *(string, required, enum: `builtin`, `discovered`, `project`)*
|
|
466
|
+
- `blocking` *(boolean, required)*
|
|
467
|
+
- `why` *(string, required, minLength: 1)*
|
|
468
|
+
- `fix` *(string, required, minLength: 1)*
|
|
469
|
+
- `confidence` *(string, optional, enum: `HIGH`, `MEDIUM`, `LOW`, `UNKNOWN`)*
|
|
470
|
+
- `scope` *(object, optional)*
|
|
471
|
+
- `includes` *(array<string>, optional)*
|
|
472
|
+
- `excludes` *(array<string>, optional)*
|
|
473
|
+
- `check` *(object, required)*
|
|
474
|
+
- `type` *(string, required, minLength: 1)*
|
|
475
|
+
- `adapter` *(string, optional)*
|
|
476
|
+
- `command` *(array<string>, optional)*
|
|
477
|
+
- `threshold` *(number, optional)*
|
|
478
|
+
- `parameters` *(object, optional)*
|
|
479
|
+
|
|
480
|
+
<!-- END FORGELOOP GENERATED: schema:policy-rules -->
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
### 2.15 `policy/discovery.json`
|
|
485
|
+
|
|
486
|
+
<!-- forgeloop-doc: schema=policy-discovery artifact=.forgeloop/policy/discovery.json -->
|
|
487
|
+
|
|
488
|
+
Automated non-interactive discovery report recording inferred architecture, conventions, and confidence scores.
|
|
489
|
+
|
|
490
|
+
#### Canonical Fields
|
|
491
|
+
|
|
492
|
+
<!-- BEGIN FORGELOOP GENERATED: schema:policy-discovery -->
|
|
493
|
+
|
|
494
|
+
- `schemaVersion` *(number, required, const: 1)*
|
|
495
|
+
- `languages` *(array<string>, required)*
|
|
496
|
+
- `testing` *(object, required)*
|
|
497
|
+
- `detected` *(boolean, required)*
|
|
498
|
+
- `command` *(array<string>, optional)*
|
|
499
|
+
- `framework` *(string, optional)*
|
|
500
|
+
- `confidence` *(string, required, enum: `HIGH`, `MEDIUM`, `LOW`, `UNKNOWN`)*
|
|
501
|
+
- `linting` *(object, required)*
|
|
502
|
+
- `detected` *(boolean, required)*
|
|
503
|
+
- `command` *(array<string>, optional)*
|
|
504
|
+
- `tool` *(string, optional)*
|
|
505
|
+
- `confidence` *(string, required, enum: `HIGH`, `MEDIUM`, `LOW`, `UNKNOWN`)*
|
|
506
|
+
- `architecture` *(object, required)*
|
|
507
|
+
- `value` *(string,null, optional)*
|
|
508
|
+
- `confidence` *(string, required, enum: `HIGH`, `MEDIUM`, `LOW`, `UNKNOWN`)*
|
|
509
|
+
- `enforcement` *(string, required, enum: `BLOCKING`, `ADVISORY`, `NONE`)*
|
|
510
|
+
- `discoveredRules` *(array<object>, required)*
|
|
511
|
+
|
|
512
|
+
<!-- END FORGELOOP GENERATED: schema:policy-discovery -->
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
### 2.16 `policy/baseline.json`
|
|
517
|
+
|
|
518
|
+
<!-- forgeloop-doc: schema=policy-baseline artifact=.forgeloop/policy/baseline.json -->
|
|
519
|
+
|
|
520
|
+
Brownfield policy baseline recording tolerated legacy violations by cryptographic fingerprint.
|
|
521
|
+
|
|
522
|
+
#### Canonical Fields
|
|
523
|
+
|
|
524
|
+
<!-- BEGIN FORGELOOP GENERATED: schema:policy-baseline -->
|
|
525
|
+
|
|
526
|
+
- `schemaVersion` *(number, required, const: 1)*
|
|
527
|
+
- `createdAt` *(string, required, minLength: 1)*
|
|
528
|
+
- `entries` *(array<object>, required)*
|
|
529
|
+
- `ruleId` *(string, required, minLength: 1)*
|
|
530
|
+
- `fingerprints` *(array<string>, required)*
|
|
531
|
+
- `reviewBy` *(string, optional)*
|
|
532
|
+
- `details` *(array<object>, optional)*
|
|
533
|
+
|
|
534
|
+
<!-- END FORGELOOP GENERATED: schema:policy-baseline -->
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
### 2.17 `policy/policy.lock`
|
|
539
|
+
|
|
540
|
+
<!-- forgeloop-doc: schema=policy-lock artifact=.forgeloop/policy/policy.lock -->
|
|
541
|
+
|
|
542
|
+
Cryptographic policy digest lock securing effective rules and baseline state.
|
|
543
|
+
|
|
544
|
+
The lock protects the **effective policy** — built-in rules plus discovered
|
|
545
|
+
rules plus project rules/overrides, combined with the baseline. `algorithm`,
|
|
546
|
+
`digest`, `rulesDigest`, and `baselineDigest` all participate in lock integrity
|
|
547
|
+
validation; a disagreement with the current effective policy produces
|
|
548
|
+
`E_POLICY_LOCK_MISMATCH`. `capturedAt` is informational metadata only — it is
|
|
549
|
+
not part of semantic policy identity, and changing it alone does not represent
|
|
550
|
+
a policy change. A missing or malformed lock fails closed rather than being
|
|
551
|
+
silently ignored.
|
|
552
|
+
|
|
553
|
+
#### Canonical Fields
|
|
554
|
+
|
|
555
|
+
<!-- BEGIN FORGELOOP GENERATED: schema:policy-lock -->
|
|
556
|
+
|
|
557
|
+
- `schemaVersion` *(number, required, const: 1)*
|
|
558
|
+
- `algorithm` *(string, required, const: `sha256`)*
|
|
559
|
+
- `digest` *(string, required, minLength: 1)*
|
|
560
|
+
- `rulesDigest` *(string, required)*
|
|
561
|
+
- `baselineDigest` *(string, required)*
|
|
562
|
+
- `capturedAt` *(string, optional)*
|
|
563
|
+
|
|
564
|
+
<!-- END FORGELOOP GENERATED: schema:policy-lock -->
|
|
565
|
+
|
|
566
|
+
---
|
|
567
|
+
|
|
568
|
+
### 2.18 `task-state/<taskKey>/policy-snapshot.json`
|
|
569
|
+
|
|
570
|
+
<!-- forgeloop-doc: schema=policy-snapshot artifact=.forgeloop/task-state/<task-key>/policy-snapshot.json -->
|
|
571
|
+
|
|
572
|
+
Task-scoped immutable snapshot of effective policy captured during preflight to detect policy drift.
|
|
573
|
+
|
|
574
|
+
A snapshot binds the task to the policy that was authorized at activation:
|
|
575
|
+
`policyDigest`, the effective `rules`, semantic `baseline` entries, and
|
|
576
|
+
`baselineDigest`. Later policy changes are classified by semantic diff as
|
|
577
|
+
`TIGHTEN`, `NEUTRAL`, `WEAKEN`, or `UNKNOWN`. Modern snapshots carry the full
|
|
578
|
+
semantic baseline; legacy snapshots without baseline state leave baseline
|
|
579
|
+
comparison explicitly `UNKNOWN` rather than assuming an empty baseline.
|
|
580
|
+
|
|
581
|
+
#### Canonical Fields
|
|
582
|
+
|
|
583
|
+
<!-- BEGIN FORGELOOP GENERATED: schema:policy-snapshot -->
|
|
584
|
+
|
|
585
|
+
- `schemaVersion` *(number, required, const: 1)*
|
|
586
|
+
- `policyDigest` *(string, required, minLength: 1)*
|
|
587
|
+
- `rules` *(array<string,object>, required)*
|
|
588
|
+
- `baseline` *(object, optional)*
|
|
589
|
+
- `baselineDigest` *(string, optional)*
|
|
590
|
+
- `capturedAt` *(string, optional)*
|
|
591
|
+
|
|
592
|
+
<!-- END FORGELOOP GENERATED: schema:policy-snapshot -->
|