@really-knows-ai/foundry 2.3.2 → 3.0.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.
- package/README.md +180 -369
- package/dist/.opencode/plugins/foundry-tools/appraiser-tools.js +28 -0
- package/dist/.opencode/plugins/foundry-tools/artefact-tools.js +58 -0
- package/dist/.opencode/plugins/foundry-tools/assay-tools.js +92 -0
- package/dist/.opencode/plugins/foundry-tools/attestation-tools.js +191 -0
- package/dist/.opencode/plugins/foundry-tools/config-create-tools.js +128 -0
- package/dist/.opencode/plugins/foundry-tools/config-law-tools.js +380 -0
- package/dist/.opencode/plugins/foundry-tools/config-tools.js +43 -0
- package/dist/.opencode/plugins/foundry-tools/feedback-tools.js +234 -0
- package/dist/.opencode/plugins/foundry-tools/git-helpers.js +354 -0
- package/dist/.opencode/plugins/foundry-tools/git-tools.js +181 -0
- package/dist/.opencode/plugins/foundry-tools/helpers.js +340 -0
- package/dist/.opencode/plugins/foundry-tools/history-tools.js +20 -0
- package/dist/.opencode/plugins/foundry-tools/memory-admin-tools.js +296 -0
- package/dist/.opencode/plugins/foundry-tools/memory-helpers.js +104 -0
- package/dist/.opencode/plugins/foundry-tools/memory-tools.js +286 -0
- package/dist/.opencode/plugins/foundry-tools/orchestrate-tool.js +159 -0
- package/dist/.opencode/plugins/foundry-tools/snapshot-tools.js +104 -0
- package/dist/.opencode/plugins/foundry-tools/stage-tools.js +186 -0
- package/dist/.opencode/plugins/foundry-tools/validate-tools.js +263 -0
- package/dist/.opencode/plugins/foundry-tools/workfile-tools.js +102 -0
- package/dist/.opencode/plugins/foundry.js +105 -0
- package/dist/CHANGELOG.md +490 -0
- package/dist/LICENSE +21 -0
- package/dist/README.md +278 -0
- package/dist/docs/README.md +59 -0
- package/dist/docs/architecture.md +434 -0
- package/dist/docs/concepts.md +396 -0
- package/dist/docs/getting-started.md +345 -0
- package/dist/docs/memory-maintenance.md +176 -0
- package/dist/docs/tools.md +1411 -0
- package/dist/docs/work-spec.md +283 -0
- package/dist/scripts/lib/artefacts.js +151 -0
- package/dist/scripts/lib/assay/loader.js +151 -0
- package/dist/scripts/lib/assay/parse-jsonl.js +102 -0
- package/dist/scripts/lib/assay/permissions.js +52 -0
- package/dist/scripts/lib/assay/run.js +219 -0
- package/dist/scripts/lib/assay/spawn-with-timeout.js +138 -0
- package/dist/scripts/lib/attestation/attest.js +111 -0
- package/dist/scripts/lib/attestation/canonical-json.js +109 -0
- package/dist/scripts/lib/attestation/hash.js +17 -0
- package/dist/scripts/lib/attestation/parse.js +14 -0
- package/dist/scripts/lib/attestation/payload.js +106 -0
- package/dist/scripts/lib/attestation/render.js +16 -0
- package/dist/scripts/lib/attestation/verify.js +15 -0
- package/dist/scripts/lib/branch-guard.js +72 -0
- package/dist/scripts/lib/config-creators/appraiser.js +9 -0
- package/dist/scripts/lib/config-creators/artefact-type.js +9 -0
- package/dist/scripts/lib/config-creators/cycle.js +11 -0
- package/dist/scripts/lib/config-creators/factory.js +49 -0
- package/dist/scripts/lib/config-creators/flow.js +11 -0
- package/dist/scripts/lib/config-validators/appraiser.js +49 -0
- package/dist/scripts/lib/config-validators/artefact-type.js +38 -0
- package/dist/scripts/lib/config-validators/cycle.js +131 -0
- package/dist/scripts/lib/config-validators/flow.js +57 -0
- package/dist/scripts/lib/config-validators/helpers.js +96 -0
- package/dist/scripts/lib/config-validators/law.js +96 -0
- package/dist/scripts/lib/config.js +393 -0
- package/dist/scripts/lib/failed-flow.js +131 -0
- package/dist/scripts/lib/feedback-store.js +249 -0
- package/dist/scripts/lib/feedback-transitions.js +105 -0
- package/dist/scripts/lib/finalize.js +70 -0
- package/dist/scripts/lib/foundational-guards.js +13 -0
- package/dist/scripts/lib/git-bridge.js +77 -0
- package/dist/scripts/lib/git-finish/work-finish.js +233 -0
- package/dist/scripts/lib/git-policy.js +101 -0
- package/dist/scripts/lib/guards.js +125 -0
- package/dist/scripts/lib/history.js +132 -0
- package/dist/scripts/lib/memory/admin/create-edge-type.js +91 -0
- package/dist/scripts/lib/memory/admin/create-entity-type.js +43 -0
- package/dist/scripts/lib/memory/admin/create-extractor.js +67 -0
- package/dist/scripts/lib/memory/admin/drop-edge-type.js +40 -0
- package/dist/scripts/lib/memory/admin/drop-entity-type.js +172 -0
- package/dist/scripts/lib/memory/admin/dump.js +47 -0
- package/dist/scripts/lib/memory/admin/helpers.js +31 -0
- package/dist/scripts/lib/memory/admin/init.js +170 -0
- package/dist/scripts/lib/memory/admin/live-store.js +76 -0
- package/dist/scripts/lib/memory/admin/reembed.js +285 -0
- package/dist/scripts/lib/memory/admin/rename-edge-type.js +54 -0
- package/dist/scripts/lib/memory/admin/rename-entity-type.js +151 -0
- package/dist/scripts/lib/memory/admin/reset.js +24 -0
- package/dist/scripts/lib/memory/admin/vacuum.js +9 -0
- package/dist/scripts/lib/memory/admin/validate.js +19 -0
- package/dist/scripts/lib/memory/config.js +149 -0
- package/dist/scripts/lib/memory/cozo.js +136 -0
- package/dist/scripts/lib/memory/drift.js +71 -0
- package/dist/scripts/lib/memory/embeddings.js +128 -0
- package/dist/scripts/lib/memory/frontmatter.js +75 -0
- package/dist/scripts/lib/memory/ndjson.js +84 -0
- package/dist/scripts/lib/memory/paths.js +25 -0
- package/dist/scripts/lib/memory/permissions.js +41 -0
- package/dist/scripts/lib/memory/prompt.js +109 -0
- package/dist/scripts/lib/memory/query.js +56 -0
- package/dist/scripts/lib/memory/reads.js +109 -0
- package/dist/scripts/lib/memory/schema.js +64 -0
- package/dist/scripts/lib/memory/search.js +73 -0
- package/dist/scripts/lib/memory/singleton.js +49 -0
- package/dist/scripts/lib/memory/store.js +162 -0
- package/dist/scripts/lib/memory/types.js +93 -0
- package/dist/scripts/lib/memory/validate.js +58 -0
- package/dist/scripts/lib/memory/writes.js +40 -0
- package/{scripts → dist/scripts}/lib/pending.js +7 -2
- package/dist/scripts/lib/secret.js +59 -0
- package/{scripts → dist/scripts}/lib/slug.js +3 -2
- package/dist/scripts/lib/snapshot/finish.js +103 -0
- package/dist/scripts/lib/snapshot/inspect.js +253 -0
- package/dist/scripts/lib/snapshot/render.js +55 -0
- package/dist/scripts/lib/sort-fs-check.js +121 -0
- package/dist/scripts/lib/sort-routing.js +101 -0
- package/{scripts → dist/scripts}/lib/stage-guard.js +12 -6
- package/{scripts → dist/scripts}/lib/state.js +4 -0
- package/dist/scripts/lib/token.js +57 -0
- package/dist/scripts/lib/tracing.js +59 -0
- package/dist/scripts/lib/ulid.js +100 -0
- package/dist/scripts/lib/validator-jsonl.js +162 -0
- package/{scripts → dist/scripts}/lib/workfile.js +38 -20
- package/dist/scripts/orchestrate-cycle.js +215 -0
- package/dist/scripts/orchestrate-phases.js +314 -0
- package/dist/scripts/orchestrate.js +163 -0
- package/dist/scripts/sort.js +278 -0
- package/{skills → dist/skills}/add-appraiser/SKILL.md +39 -9
- package/{skills → dist/skills}/add-artefact-type/SKILL.md +46 -24
- package/{skills → dist/skills}/add-cycle/SKILL.md +57 -17
- package/dist/skills/add-extractor/SKILL.md +133 -0
- package/{skills → dist/skills}/add-flow/SKILL.md +36 -10
- package/dist/skills/add-law/SKILL.md +191 -0
- package/dist/skills/add-memory-edge-type/SKILL.md +52 -0
- package/dist/skills/add-memory-entity-type/SKILL.md +74 -0
- package/{skills → dist/skills}/appraise/SKILL.md +62 -13
- package/dist/skills/assay/SKILL.md +72 -0
- package/dist/skills/change-embedding-model/SKILL.md +58 -0
- package/dist/skills/drop-memory-edge-type/SKILL.md +54 -0
- package/dist/skills/drop-memory-entity-type/SKILL.md +57 -0
- package/dist/skills/dry-run/SKILL.md +116 -0
- package/{skills → dist/skills}/flow/SKILL.md +15 -2
- package/dist/skills/forge/SKILL.md +121 -0
- package/dist/skills/human-appraise/SKILL.md +153 -0
- package/{skills → dist/skills}/init-foundry/SKILL.md +23 -4
- package/dist/skills/init-memory/SKILL.md +92 -0
- package/{skills → dist/skills}/orchestrate/SKILL.md +30 -4
- package/dist/skills/quench/SKILL.md +99 -0
- package/{skills → dist/skills}/refresh-agents/SKILL.md +1 -1
- package/dist/skills/rename-memory-edge-type/SKILL.md +50 -0
- package/dist/skills/rename-memory-entity-type/SKILL.md +51 -0
- package/dist/skills/reset-memory/SKILL.md +54 -0
- package/dist/skills/upgrade-foundry/SKILL.md +192 -0
- package/package.json +34 -17
- package/.opencode/plugins/foundry.js +0 -761
- package/CHANGELOG.md +0 -100
- package/docs/concepts.md +0 -122
- package/docs/getting-started.md +0 -187
- package/docs/work-spec.md +0 -207
- package/scripts/lib/artefacts.js +0 -124
- package/scripts/lib/config.js +0 -175
- package/scripts/lib/feedback-transitions.js +0 -25
- package/scripts/lib/feedback.js +0 -440
- package/scripts/lib/finalize.js +0 -41
- package/scripts/lib/history.js +0 -59
- package/scripts/lib/secret.js +0 -23
- package/scripts/lib/tags.js +0 -108
- package/scripts/lib/token.js +0 -26
- package/scripts/orchestrate.js +0 -418
- package/scripts/sort.js +0 -370
- package/scripts/validate-tags.js +0 -54
- package/skills/add-law/SKILL.md +0 -111
- package/skills/forge/SKILL.md +0 -88
- package/skills/human-appraise/SKILL.md +0 -82
- package/skills/quench/SKILL.md +0 -62
- package/skills/upgrade-foundry/SKILL.md +0 -216
- /package/{skills → dist/skills}/list-agents/SKILL.md +0 -0
package/CHANGELOG.md
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 2.3.2 — 2026-04-21
|
|
4
|
-
|
|
5
|
-
### Changed
|
|
6
|
-
|
|
7
|
-
- Config-modifying skills (`add-flow`, `add-cycle`, `add-law`, `add-appraiser`, `add-artefact-type`) now refuse to run on a work branch. They require the current branch to not start with `work/`, directing the user to complete or discard the in-flight flow before changing foundry configuration. Structural changes belong on the base branch, not alongside transient flow state.
|
|
8
|
-
|
|
9
|
-
### Removed
|
|
10
|
-
|
|
11
|
-
- Historical planning docs (`docs/plans/`, `docs/specs/`, `docs/superpowers/`) and `HARDEN.md`. All described features that shipped in v2.2.0–v2.3.1; git history preserves the full record.
|
|
12
|
-
|
|
13
|
-
## 2.3.1 — 2026-04-20
|
|
14
|
-
|
|
15
|
-
### Changed
|
|
16
|
-
|
|
17
|
-
- `flow` skill: any cycle in a flow may now be the starting cycle (previously limited to `starting-cycles`). The list becomes a hint for ambiguous requests. A cycle whose `inputs` contract cannot be satisfied from files on disk is not eligible to start.
|
|
18
|
-
- `flow` skill: between-cycles logic no longer implies any carry-over ceremony. The next cycle's forge discovers the previous cycle's output via filesystem scan against its input types' `file-patterns`.
|
|
19
|
-
- `forge` skill: input discovery now explicitly uses filesystem scan against each input type's `file-patterns`, with the goal guiding which candidates are relevant.
|
|
20
|
-
- `forge` skill: the write invariant is restated accurately — forge may only write to files matching the output artefact type's `file-patterns` (plus the tool-managed files). All other files on disk are read-only. The previous "inputs are read-only" framing was a special case of this rule.
|
|
21
|
-
|
|
22
|
-
### Notes
|
|
23
|
-
|
|
24
|
-
- No tool, schema, or enforcement changes. Existing flows continue to work. `sort.js`'s `checkModifiedFiles` already enforces the write invariant.
|
|
25
|
-
|
|
26
|
-
## 2.3.0 — 2026-04-20
|
|
27
|
-
|
|
28
|
-
### Breaking
|
|
29
|
-
|
|
30
|
-
- **LLM orchestration replaced with deterministic `foundry_orchestrate` tool.** The `cycle` and `sort` skills are removed; replaced by a single thin `orchestrate` skill that drives a 3-line loop.
|
|
31
|
-
- **Six tools deregistered** from the plugin (still exist as internal imports for tests): `foundry_sort`, `foundry_history_append`, `foundry_stage_finalize`, `foundry_git_commit`, `foundry_workfile_configure_from_cycle`, `foundry_workfile_set`.
|
|
32
|
-
- Upgrade requires clean main + no in-flight workfile (see `upgrade-foundry` skill).
|
|
33
|
-
|
|
34
|
-
### Added
|
|
35
|
-
|
|
36
|
-
- `foundry_orchestrate` — single tool that owns the sort → history → dispatch → finalize → history → commit loop. Atomic stage completion.
|
|
37
|
-
- `scripts/orchestrate.js` — deterministic orchestration logic, composes existing internal functions.
|
|
38
|
-
- Orphaned-stage detection: if orchestrate is called without `lastResult` but an active stage exists, returns `violation`. Fixes the ses_256c failure mode where an LLM skipped the post-dispatch history append and wedged the cycle.
|
|
39
|
-
|
|
40
|
-
### Fixed
|
|
41
|
-
|
|
42
|
-
- Root cause of all deferred HARDEN.md bugs (B, C, D, E, G) and the ses_256c bug: LLM misfollowing a deterministic protocol. Protocol now lives inside the plugin tool.
|
|
43
|
-
|
|
44
|
-
### Migration
|
|
45
|
-
|
|
46
|
-
See `skills/upgrade-foundry/SKILL.md` for v2.3.0 pre-flight checks. No automated state migration — complete or discard in-flight cycles on v2.2.x before upgrading.
|
|
47
|
-
|
|
48
|
-
## 2.2.1 — 2026-04-20
|
|
49
|
-
|
|
50
|
-
Follow-up patch addressing the five bugs deferred from v2.2.0 (see `HARDEN.md` §Deferred).
|
|
51
|
-
|
|
52
|
-
### Breaking changes
|
|
53
|
-
|
|
54
|
-
- **Cycle-definition deadlock config flattened.** The nested `human-appraise: {enabled, deadlock-threshold}` block is replaced by three flat keys:
|
|
55
|
-
- `human-appraise: <bool>` (default `false`) — include `human-appraise` in the stage loop every iteration
|
|
56
|
-
- `deadlock-appraise: <bool>` (default `true`) — route to `human-appraise` when LLM appraisers deadlock
|
|
57
|
-
- `deadlock-iterations: <number>` (default `5`) — deadlock threshold
|
|
58
|
-
Run the `upgrade-foundry` skill to migrate existing cycle defs — the old nested form is no longer read.
|
|
59
|
-
|
|
60
|
-
### New
|
|
61
|
-
|
|
62
|
-
- **`foundry_workfile_configure_from_cycle({cycleId, stages})`** — populates WORK.md frontmatter from a cycle definition in one call. Replaces the prior 6–7 sequential `foundry_workfile_set` calls at cycle start. Defaults for `max-iterations`, `human-appraise`, `deadlock-appraise`, `deadlock-iterations`, and `models` now live in plugin code rather than skill prose.
|
|
63
|
-
- **`foundry_artefacts_list({cycle})`** — optional cycle filter. Callers should always pass the current cycle to avoid picking up stale rows from prior aborted sessions.
|
|
64
|
-
|
|
65
|
-
### Fixed
|
|
66
|
-
|
|
67
|
-
- **Bug B — deadlock routing.** Sort now reads the flat deadlock keys from WORK.md frontmatter and routes to `human-appraise` on deadlock (either an existing `human-appraise:<cycle>` stage in `stages`, or a synthesized one). When `deadlock-appraise: false`, deadlock marks the cycle `blocked`.
|
|
68
|
-
- **Bug C — stale artefact validation.** `quench`, `appraise`, and `human-appraise` skills now pass the current cycle to `foundry_artefacts_list`, scoping validation to artefacts produced by the current cycle instead of every row that has ever landed in WORK.md.
|
|
69
|
-
- **Bug D — overwriting WORK.md.** The `flow` skill now calls `foundry_workfile_get` before `foundry_workfile_create` and prompts the user to resume, discard, or abort when an existing workfile is detected. Silent overwrite is not offered; resume requires matching `flow` and `cycle`.
|
|
70
|
-
- **Bug E — missing micro-commits.** `foundry_sort` now returns `{route: 'violation'}` when `WORK.md`, `WORK.history.yaml`, or anything under `.foundry/` has uncommitted changes at the start of a sort call and history is non-empty. Structurally enforces the one-commit-per-stage contract that previously lived only in skill prose. First sort of a cycle is exempt (empty history).
|
|
71
|
-
- **Bug G — workfile setup boilerplate.** See `foundry_workfile_configure_from_cycle` above.
|
|
72
|
-
|
|
73
|
-
### Migration
|
|
74
|
-
|
|
75
|
-
Run the `upgrade-foundry` skill to migrate cycle definitions to the flat deadlock keys (Bug B). No other migration required — WORK.md, `.foundry/`, and feedback state are forward-compatible.
|
|
76
|
-
|
|
77
|
-
## 2.2.0 — 2026-04-19
|
|
78
|
-
|
|
79
|
-
### Breaking changes
|
|
80
|
-
|
|
81
|
-
- **`foundry_artefacts_add` removed.** Artefact registration now happens exclusively via `foundry_stage_finalize` after a forge stage closes.
|
|
82
|
-
- **`foundry_artefacts_set_status` no longer accepts `draft`.** Only `done` and `blocked` are valid. New artefacts are registered as `draft` automatically by `stage_finalize`.
|
|
83
|
-
- **Feedback / artefact / workfile mutation tools now enforce stage-lock preconditions.** Tools callable by subagents require an active stage matching their role; tools callable by the orchestrator require no active stage. Out-of-band calls return a structured error instead of mutating state.
|
|
84
|
-
- **Feedback state machine strictly enforced.** `approved` is terminal. `quench` cannot approve/reject `wont-fix` items. See `HARDEN.md` §4 for the full matrix.
|
|
85
|
-
- **`foundry_sort` dispatchable routes now return a `token` field.** Subagents must redeem the token via `foundry_stage_begin`; forged or replayed tokens are rejected.
|
|
86
|
-
|
|
87
|
-
### New
|
|
88
|
-
|
|
89
|
-
- **`foundry_stage_begin(stage, cycle, token)`** — subagents open a work stage by consuming a single-use HMAC-signed token.
|
|
90
|
-
- **`foundry_stage_end(summary)`** — subagents close a stage; preserves `baseSha` for finalize.
|
|
91
|
-
- **`foundry_stage_finalize(cycle)`** — orchestrator verifies stage output against allowed file patterns, registers matching files as draft artefacts, rejects stray writes with `{error: "unexpected_files", files: [...]}`.
|
|
92
|
-
- **`.foundry/` state directory** (gitignored) — holds `.secret` (per-worktree HMAC key, mode 0600), `active-stage.json` (present only during an active stage), `last-stage.json` (for finalize lookup).
|
|
93
|
-
|
|
94
|
-
### Fixed
|
|
95
|
-
|
|
96
|
-
- Normalized `maxIterations` → `max-iterations` across workfile read/write paths (previously inconsistent between flow and cycle skills, causing latent deadlock-detection issues).
|
|
97
|
-
|
|
98
|
-
### Migration
|
|
99
|
-
|
|
100
|
-
Upgrade with the `upgrade-foundry` skill. `.foundry/` is created automatically on first plugin boot; `.secret` is generated idempotently. No data migration required — existing `WORK.md` and `foundry/*` configs are compatible.
|
package/docs/concepts.md
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
# Concepts
|
|
2
|
-
|
|
3
|
-
This is the glossary. Every term here has a single definition and links out to the spec document that elaborates it. Concepts are arranged roughly top-down: flows contain cycles, cycles contain stages, stages operate on artefacts, artefacts are governed by laws and evaluated by appraisers.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Flow
|
|
8
|
-
|
|
9
|
-
The top-level unit of work. Defined in `foundry/flows/*.md`. A flow declares:
|
|
10
|
-
|
|
11
|
-
- A `starting-cycles` list — hints about which cycles can be entered first when the flow begins.
|
|
12
|
-
- A set of cycles (listed under `## Cycles`). Order is not implied — routing between cycles is owned by cycles themselves via their `targets` field.
|
|
13
|
-
|
|
14
|
-
Running a flow creates a work branch and a `WORK.md`. The flow completes when no more reachable cycles remain to run, or when the user decides to stop.
|
|
15
|
-
|
|
16
|
-
## Cycle
|
|
17
|
-
|
|
18
|
-
An iterative loop that produces a single artefact type. Defined in `foundry/cycles/*.md`. A cycle declares:
|
|
19
|
-
|
|
20
|
-
- `output` — the artefact type it produces (read-write).
|
|
21
|
-
- `inputs` — a contract (`any-of` / `all-of`) over other artefact types. Inputs are discovered on disk; they are read-only unless the output type's patterns happen to cover them.
|
|
22
|
-
- `targets` — the cycle(s) that may run after this one. May be empty (terminal cycle).
|
|
23
|
-
- `human-appraise` — whether a human quality gate runs every iteration (default: `false`).
|
|
24
|
-
- `deadlock-appraise` — whether a human is pulled in when LLM appraisers deadlock (default: `true`).
|
|
25
|
-
- `deadlock-iterations` — deadlock threshold (default: `5`).
|
|
26
|
-
- `models` — optional per-stage model overrides.
|
|
27
|
-
|
|
28
|
-
A cycle runs **forge → quench → appraise** (and optionally **human-appraise**), looping until all feedback is resolved or `max-iterations` is hit.
|
|
29
|
-
|
|
30
|
-
## Stage
|
|
31
|
-
|
|
32
|
-
A single step within a cycle. Every stage is referenced as `base:alias` (e.g. `forge:write-haiku`, `quench:check-syllables`) — the base is the stage type; the alias makes the stage's role self-documenting in WORK.md.
|
|
33
|
-
|
|
34
|
-
Stage bases:
|
|
35
|
-
|
|
36
|
-
- **forge** — produce or revise the artefact.
|
|
37
|
-
- **quench** — run deterministic CLI checks (skipped if the artefact type has no `validation.md`).
|
|
38
|
-
- **appraise** — subjective evaluation by multiple appraiser sub-agents.
|
|
39
|
-
- **human-appraise** — human quality gate. Can run every iteration, only on deadlock, or both.
|
|
40
|
-
|
|
41
|
-
Every stage runs inside a token-gated lifecycle (`foundry_stage_begin` / `foundry_stage_end` / `foundry_stage_finalize`). Mutation tools are stage-locked: a forge stage can't add feedback, a quench stage can't register artefacts. See the enforcement section of the [README](../README.md#enforcement-model).
|
|
42
|
-
|
|
43
|
-
## Artefact type
|
|
44
|
-
|
|
45
|
-
A definition of what is being produced. Lives in `foundry/artefacts/<type>/`:
|
|
46
|
-
|
|
47
|
-
- `definition.md` — identity, file patterns, output directory, appraiser config, prose description.
|
|
48
|
-
- `laws.md` *(optional)* — type-specific subjective criteria.
|
|
49
|
-
- `validation.md` *(optional)* — CLI commands for deterministic quench checks.
|
|
50
|
-
|
|
51
|
-
File patterns must not overlap with any other artefact type's patterns — the write-invariant enforcer needs to know which type owns a given file.
|
|
52
|
-
|
|
53
|
-
## Law
|
|
54
|
-
|
|
55
|
-
A subjective pass/fail criterion. Two scopes:
|
|
56
|
-
|
|
57
|
-
- **Global** — `foundry/laws/*.md`, all files concatenated, applies to every artefact.
|
|
58
|
-
- **Type-specific** — `foundry/artefacts/<type>/laws.md`.
|
|
59
|
-
|
|
60
|
-
Each law is a `## heading` (its identifier, used in feedback tags as `#law:<id>`) with a description, passing criteria, and failing criteria.
|
|
61
|
-
|
|
62
|
-
## Appraiser
|
|
63
|
-
|
|
64
|
-
An independent evaluator with a defined personality. Lives in `foundry/appraisers/*.md`. Appraisers may specify a `model` field to override the cycle-level appraise model. Each artefact type picks which appraisers may evaluate it (`appraisers.allowed`) and how many run per iteration (`appraisers.count`). Selection distributes evenly across allowed personalities.
|
|
65
|
-
|
|
66
|
-
## WORK.md
|
|
67
|
-
|
|
68
|
-
The transient shared state for a flow. Created on the work branch by the flow skill, it tracks:
|
|
69
|
-
|
|
70
|
-
- Current position (flow, cycle, stage list, iteration limits) in frontmatter.
|
|
71
|
-
- The goal (prose — written once).
|
|
72
|
-
- An artefact registry (file, type, cycle, status).
|
|
73
|
-
- All feedback with its full lifecycle.
|
|
74
|
-
|
|
75
|
-
See [work-spec.md](work-spec.md) for the full spec.
|
|
76
|
-
|
|
77
|
-
## WORK.history.yaml
|
|
78
|
-
|
|
79
|
-
Append-only log of every stage execution, sitting next to WORK.md. Used by sort to reconstruct what has happened in the current cycle. See [work-spec.md](work-spec.md).
|
|
80
|
-
|
|
81
|
-
## Feedback
|
|
82
|
-
|
|
83
|
-
The communication mechanism between stages. Written as markdown checklist items in WORK.md, grouped by artefact file, tagged by source:
|
|
84
|
-
|
|
85
|
-
- `#validation` — from a deterministic quench command. Cannot be wont-fixed.
|
|
86
|
-
- `#law:<law-id>` — from an appraiser, tied to a specific law. May be wont-fixed with justification.
|
|
87
|
-
- `#human` — from a human-appraise stage. Takes absolute priority; cannot be wont-fixed.
|
|
88
|
-
|
|
89
|
-
Lifecycle: `open` → `actioned` / `wont-fix` → `approved` / `rejected`. `approved` is terminal; `rejected` re-opens. Items are never deleted.
|
|
90
|
-
|
|
91
|
-
## HITL / human-appraise
|
|
92
|
-
|
|
93
|
-
Human-in-the-loop checkpoint. A stage where Foundry pauses and asks a human for input. Two triggers:
|
|
94
|
-
|
|
95
|
-
1. **Every-iteration** — the cycle declares `human-appraise: true`. The `human-appraise` stage runs after LLM appraise each iteration.
|
|
96
|
-
2. **Deadlock** — the cycle declares `deadlock-appraise: true` (default). If forge and appraisers ping-pong on the same items for `deadlock-iterations` (default 5) iterations, sort inserts a `human-appraise` stage to break the tie.
|
|
97
|
-
|
|
98
|
-
Human feedback is tagged `#human` and takes priority over LLM feedback on the same topic.
|
|
99
|
-
|
|
100
|
-
## Micro-commit
|
|
101
|
-
|
|
102
|
-
Every stage ends with a commit made by the orchestrator. This enables two things: file-modification enforcement (the write-invariant check compares the stage's diff to its allowed patterns) and recoverability (a crash mid-flow leaves a clean commit boundary to resume from). Orchestration refuses to proceed if uncommitted work is lingering in `WORK.md`, `WORK.history.yaml`, or `.foundry/`.
|
|
103
|
-
|
|
104
|
-
## Stage token
|
|
105
|
-
|
|
106
|
-
A single-use HMAC-signed string, minted by `foundry_orchestrate` when a stage is dispatched. The sub-agent must redeem the token via `foundry_stage_begin`; mutation tools then check the active stage matches their role. Keys live in `.foundry/.secret` (mode 0600, gitignored, one per worktree). This prevents out-of-band mutations, replayed stages, and sub-agents skipping the lifecycle.
|
|
107
|
-
|
|
108
|
-
## `.foundry/` state directory
|
|
109
|
-
|
|
110
|
-
A gitignored directory created on first plugin boot, holding runtime state:
|
|
111
|
-
|
|
112
|
-
- `.secret` — the HMAC key.
|
|
113
|
-
- `active-stage.json` — present only during an active stage.
|
|
114
|
-
- `last-stage.json` — used by `foundry_stage_finalize` after `stage_end`.
|
|
115
|
-
|
|
116
|
-
## Custom tools
|
|
117
|
-
|
|
118
|
-
All deterministic pipeline operations are exposed as custom tools by the Foundry plugin. Skills call these tools instead of manipulating files directly. Tools are backed by shared library modules in `scripts/lib/` with injectable I/O so they can be unit-tested. This separation ensures state transitions and routing logic are tested code, not LLM interpretation. See the [README](../README.md#custom-tools) for the full catalogue.
|
|
119
|
-
|
|
120
|
-
## Skill
|
|
121
|
-
|
|
122
|
-
A self-contained workflow written as markdown with YAML frontmatter. Foundry ships pipeline skills (`flow`, `orchestrate`, `forge`, `quench`, `appraise`, `human-appraise`), authoring skills (`add-*`, `init-foundry`), and utility skills (`list-agents`, `refresh-agents`, `upgrade-foundry`). Skills are either **atomic** (do one thing) or **composite** (orchestrate other skills).
|
package/docs/getting-started.md
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
# Getting Started
|
|
2
|
-
|
|
3
|
-
End-to-end walkthrough for setting up Foundry and running your first flow.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Prerequisites
|
|
8
|
-
|
|
9
|
-
- A git repository initialised with a clean working tree.
|
|
10
|
-
- Node.js ≥ 18.3.0 (for the plugin and validation scripts).
|
|
11
|
-
- [OpenCode](https://opencode.ai) (primary target — multi-model routing relies on OpenCode's agent files).
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
Add Foundry to `opencode.json`:
|
|
16
|
-
|
|
17
|
-
```json
|
|
18
|
-
{
|
|
19
|
-
"packages": {
|
|
20
|
-
"@really-knows-ai/foundry": "latest"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Restart OpenCode (or reload plugins) so the plugin registers its tools and skills.
|
|
26
|
-
|
|
27
|
-
## Initialize
|
|
28
|
-
|
|
29
|
-
In your project, invoke the `init-foundry` skill. It:
|
|
30
|
-
|
|
31
|
-
1. Creates the `foundry/` directory structure:
|
|
32
|
-
```
|
|
33
|
-
foundry/
|
|
34
|
-
artefacts/.gitkeep
|
|
35
|
-
flows/.gitkeep
|
|
36
|
-
cycles/.gitkeep
|
|
37
|
-
laws/.gitkeep
|
|
38
|
-
appraisers/.gitkeep
|
|
39
|
-
```
|
|
40
|
-
2. Runs `refresh-agents` to generate `.opencode/agents/foundry-*.md` — one per available model — so cycles can dispatch to specific models later.
|
|
41
|
-
3. Commits the scaffolding.
|
|
42
|
-
|
|
43
|
-
The `.foundry/` runtime directory (holding `.secret` for stage tokens) is created automatically on first plugin boot and added to `.gitignore`.
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Author the configuration
|
|
48
|
-
|
|
49
|
-
Foundry's configuration is five things: artefact types, laws, appraisers, cycles, and flows. You can write the files by hand, but the authoring skills do conflict checking, scaffolding, and validation — use them.
|
|
50
|
-
|
|
51
|
-
### 1. Define an artefact type
|
|
52
|
-
|
|
53
|
-
Run `add-artefact-type`. It walks you through:
|
|
54
|
-
|
|
55
|
-
- `id` (lowercase, hyphenated), `name`, prose description.
|
|
56
|
-
- `file-patterns` — glob patterns describing which files this type owns. The skill refuses patterns that overlap with existing types.
|
|
57
|
-
- `output-dir` — where forge should write new files.
|
|
58
|
-
- Appraiser config — how many appraisers evaluate this type and which personalities are allowed.
|
|
59
|
-
- Optional `laws.md` — type-specific criteria.
|
|
60
|
-
- Optional `validation.md` — CLI commands for quench (non-zero exit = failure).
|
|
61
|
-
|
|
62
|
-
Produces `foundry/artefacts/<id>/definition.md` (+ optional `laws.md`, `validation.md`).
|
|
63
|
-
|
|
64
|
-
### 2. Write laws
|
|
65
|
-
|
|
66
|
-
Laws are subjective pass/fail criteria evaluated by appraisers. Two scopes:
|
|
67
|
-
|
|
68
|
-
- **Global** — `foundry/laws/*.md`. All files are concatenated and apply to every artefact.
|
|
69
|
-
- **Type-specific** — `foundry/artefacts/<type>/laws.md`.
|
|
70
|
-
|
|
71
|
-
Run `add-law` to create one with conflict detection. Each law is a `## heading` (its identifier, referenced as `#law:<id>` in feedback) with a description, passing criteria, and failing criteria.
|
|
72
|
-
|
|
73
|
-
### 3. Create appraisers
|
|
74
|
-
|
|
75
|
-
Appraisers are independent evaluators with named personalities. Run `add-appraiser`. Each appraiser may override the cycle-level appraise model via a `model` field. Artefact types pick which appraisers may evaluate them (`appraisers.allowed`).
|
|
76
|
-
|
|
77
|
-
### 4. Define a cycle
|
|
78
|
-
|
|
79
|
-
Run `add-cycle`. A cycle produces one artefact type and declares:
|
|
80
|
-
|
|
81
|
-
- `output` — the artefact type (must already exist).
|
|
82
|
-
- `inputs` — a contract (`any-of` or `all-of`) over other types. Empty for starting cycles.
|
|
83
|
-
- `targets` — the cycle(s) that may run after this one. Empty for terminal cycles.
|
|
84
|
-
- `human-appraise` / `deadlock-appraise` / `deadlock-iterations` — human-gate config.
|
|
85
|
-
- `models` — optional per-stage model overrides.
|
|
86
|
-
|
|
87
|
-
Example:
|
|
88
|
-
|
|
89
|
-
```markdown
|
|
90
|
-
---
|
|
91
|
-
id: haiku-creation
|
|
92
|
-
name: Haiku Creation
|
|
93
|
-
output: haiku
|
|
94
|
-
inputs:
|
|
95
|
-
type: any-of
|
|
96
|
-
artefacts:
|
|
97
|
-
- petition
|
|
98
|
-
targets: []
|
|
99
|
-
human-appraise: false
|
|
100
|
-
deadlock-appraise: true
|
|
101
|
-
deadlock-iterations: 5
|
|
102
|
-
models:
|
|
103
|
-
appraise: openai/gpt-5
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
# Haiku Creation
|
|
107
|
-
|
|
108
|
-
Writes a haiku satisfying the petition produced by haiku-ideation.
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
The skill validates that every input type can be produced by some cycle in the flow and that targets are reachable.
|
|
112
|
-
|
|
113
|
-
### 5. Define a flow
|
|
114
|
-
|
|
115
|
-
Run `add-flow`. A flow groups cycles and declares starting points:
|
|
116
|
-
|
|
117
|
-
```markdown
|
|
118
|
-
---
|
|
119
|
-
id: make-haiku
|
|
120
|
-
name: Make a Haiku
|
|
121
|
-
starting-cycles:
|
|
122
|
-
- haiku-ideation
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
# Make a Haiku
|
|
126
|
-
|
|
127
|
-
End-to-end flow: petition → haiku, with a human quality gate.
|
|
128
|
-
|
|
129
|
-
## Cycles
|
|
130
|
-
|
|
131
|
-
- haiku-ideation
|
|
132
|
-
- haiku-creation
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Routing between cycles is owned by individual cycles via their `targets`, not by the flow.
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Run the flow
|
|
140
|
-
|
|
141
|
-
Tell OpenCode something like:
|
|
142
|
-
|
|
143
|
-
> Run the `make-haiku` flow to write a haiku about autumn rain.
|
|
144
|
-
|
|
145
|
-
The `flow` skill will:
|
|
146
|
-
|
|
147
|
-
1. Check prerequisites and pick a starting cycle — matching your prose to a cycle's output type. If the request is ambiguous, it prompts (defaulting to `starting-cycles`). If a cycle's input contract can't be satisfied from files on disk, it won't be chosen.
|
|
148
|
-
2. Create a work branch and scaffold `WORK.md` with the goal.
|
|
149
|
-
3. Hand off to `orchestrate`, which drives the cycle:
|
|
150
|
-
- **forge** writes the artefact.
|
|
151
|
-
- **quench** runs CLI validators (if configured).
|
|
152
|
-
- **appraise** dispatches parallel appraiser sub-agents and consolidates their `#law:<id>` feedback.
|
|
153
|
-
- **human-appraise** (if configured, or on deadlock) asks you for input.
|
|
154
|
-
- If any unresolved feedback remains, another forge iteration begins.
|
|
155
|
-
4. When the cycle completes, the flow skill checks the cycle's `targets`. If a target's input contract is satisfied, it asks whether to proceed.
|
|
156
|
-
5. When all desired cycles are done, the flow skill summarises the output and asks how to finish — squash-merge, PR, or leave the branch.
|
|
157
|
-
|
|
158
|
-
Every stage ends with a micro-commit. Violations of the write invariant (writing to disallowed files) hard-stop the cycle.
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## Inspecting progress
|
|
163
|
-
|
|
164
|
-
While a flow is running, the state of the world is in three places:
|
|
165
|
-
|
|
166
|
-
- `WORK.md` — current cycle, goal, artefact table, all feedback with full lifecycle.
|
|
167
|
-
- `WORK.history.yaml` — append-only log of every stage execution.
|
|
168
|
-
- `git log` — one commit per stage.
|
|
169
|
-
|
|
170
|
-
You can pause and resume: if the flow skill sees an existing `WORK.md` when you start, it asks whether to resume, discard, or abort. Resume is only offered if the existing flow and cycle match the current request.
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## Cleaning up
|
|
175
|
-
|
|
176
|
-
Before squash-merging the work branch back into main, **delete `WORK.md` and `WORK.history.yaml`** — they're ephemeral per-flow state, not artefacts. `.foundry/` is gitignored and doesn't need cleanup.
|
|
177
|
-
|
|
178
|
-
If you used `foundry_git_finish`, it handles this for you.
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
## Next steps
|
|
183
|
-
|
|
184
|
-
- [docs/concepts.md](concepts.md) — concise glossary.
|
|
185
|
-
- [docs/work-spec.md](work-spec.md) — full WORK.md spec.
|
|
186
|
-
- [README.md](../README.md) — architecture, enforcement, design decisions.
|
|
187
|
-
- [CHANGELOG.md](../CHANGELOG.md) — version history.
|
package/docs/work-spec.md
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
# WORK.md Spec
|
|
2
|
-
|
|
3
|
-
WORK.md is created at the start of a foundry flow on a work branch. It is the shared state between all stages in all foundry cycles. It is transient — it exists only for the duration of the foundry flow.
|
|
4
|
-
|
|
5
|
-
## Frontmatter
|
|
6
|
-
|
|
7
|
-
```yaml
|
|
8
|
-
---
|
|
9
|
-
flow: <flow-id>
|
|
10
|
-
cycle: <current-cycle-id>
|
|
11
|
-
stages: [forge:write-haiku, quench:check-syllables, appraise:evaluate-quality]
|
|
12
|
-
max-iterations: 3
|
|
13
|
-
human-appraise: false
|
|
14
|
-
deadlock-appraise: true
|
|
15
|
-
deadlock-iterations: 5
|
|
16
|
-
models:
|
|
17
|
-
forge: anthropic/claude-opus-4.7
|
|
18
|
-
appraise: openai/gpt-5
|
|
19
|
-
---
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Fields:
|
|
23
|
-
- `flow` — the foundry flow being executed.
|
|
24
|
-
- `cycle` — the current cycle id.
|
|
25
|
-
- `stages` — the ordered route for this cycle. Each entry uses `base:alias` format where `base` is the stage type (`forge`, `quench`, `appraise`, or `human-appraise`) and `alias` is a human-readable name for what that stage does in this cycle. Derived from the cycle and artefact type: `forge` + `appraise` are always included, `quench` is included iff the artefact type has `validation.md`, `human-appraise` is included iff the cycle sets `human-appraise: true`.
|
|
26
|
-
- `max-iterations` — how many forge passes before the cycle is blocked (default: 3).
|
|
27
|
-
- `human-appraise` — run human-appraise every iteration (default: `false`).
|
|
28
|
-
- `deadlock-appraise` — route to human-appraise when LLM appraisers deadlock (default: `true`).
|
|
29
|
-
- `deadlock-iterations` — deadlock threshold (default: 5).
|
|
30
|
-
- `models` — optional per-stage model overrides; individual appraisers may further override via their own `model` field.
|
|
31
|
-
|
|
32
|
-
The `stages` list is the happy path. Sort follows it but loops back to `forge` when unresolved feedback demands it, and inserts a `human-appraise` stage on deadlock.
|
|
33
|
-
|
|
34
|
-
### Who sets what
|
|
35
|
-
|
|
36
|
-
- `flow`, `cycle`, `goal` — set by the `flow` skill via `foundry_workfile_create` at flow/cycle boundaries.
|
|
37
|
-
- `stages`, `max-iterations`, `human-appraise`, `deadlock-appraise`, `deadlock-iterations`, `models` — set by `foundry_orchestrate` on the first call of each cycle (via internal `workfile_configure_from_cycle`, reading the cycle definition).
|
|
38
|
-
|
|
39
|
-
## Sections
|
|
40
|
-
|
|
41
|
-
### Goal
|
|
42
|
-
|
|
43
|
-
Free text describing what the foundry flow is producing and any context the human provided. Written once at foundry flow start, not modified after.
|
|
44
|
-
|
|
45
|
-
### Artefacts
|
|
46
|
-
|
|
47
|
-
A table tracking every artefact produced by the foundry flow.
|
|
48
|
-
|
|
49
|
-
```markdown
|
|
50
|
-
# Artefacts
|
|
51
|
-
|
|
52
|
-
| File | Type | Cycle | Status |
|
|
53
|
-
|------|------|-------|--------|
|
|
54
|
-
| petitions/login-change.md | petition | write-petition | draft |
|
|
55
|
-
| features/login-change.feature | gherkin | petition-to-gherkin | draft |
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Statuses:
|
|
59
|
-
- `draft` — artefact exists but has not cleared all stages
|
|
60
|
-
- `done` — artefact has cleared all stages
|
|
61
|
-
- `blocked` — artefact hit iteration limit or a violation
|
|
62
|
-
|
|
63
|
-
### Feedback
|
|
64
|
-
|
|
65
|
-
Grouped by artefact file path. Each item is a checklist entry with a tag indicating its source.
|
|
66
|
-
|
|
67
|
-
```markdown
|
|
68
|
-
# Feedback
|
|
69
|
-
|
|
70
|
-
## petitions/login-change.md
|
|
71
|
-
|
|
72
|
-
- [ ] Missing "Acceptance Criteria" section #validation
|
|
73
|
-
- [x] Justification is circular #law:justified-change | approved
|
|
74
|
-
- [~] Could be more concise #law:clear-language | wont-fix: brevity would lose necessary context | approved
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
#### Tags
|
|
78
|
-
|
|
79
|
-
- `#validation` — from a deterministic quench command
|
|
80
|
-
- `#law:<law-id>` — from subjective appraise, tied to a specific law
|
|
81
|
-
- `#human` — from human-provided feedback at a human-appraise checkpoint
|
|
82
|
-
|
|
83
|
-
#### Lifecycle states
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
- [ ] issue #tag open, needs forge action
|
|
87
|
-
- [x] issue #tag actioned, needs approval
|
|
88
|
-
- [~] issue #tag | wont-fix: <reason> declined by forge, needs approval (appraise only)
|
|
89
|
-
- [x] issue #tag | approved resolved
|
|
90
|
-
- [~] issue #tag | wont-fix: <reason> | approved resolved
|
|
91
|
-
- [x] issue #tag | rejected: <reason> re-opened
|
|
92
|
-
- [~] issue #tag | wont-fix: <reason> | rejected re-opened
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### Rules
|
|
96
|
-
|
|
97
|
-
- Validation feedback (`#validation`) cannot be wont-fixed — deterministic rules are not negotiable.
|
|
98
|
-
- Human feedback (`#human`) cannot be wont-fixed — it takes absolute priority over LLM feedback.
|
|
99
|
-
- Feedback is never deleted — it stays as a record of the iteration history.
|
|
100
|
-
- New feedback is appended, not inserted.
|
|
101
|
-
- Items are grouped under the artefact they relate to.
|
|
102
|
-
|
|
103
|
-
## Who writes what
|
|
104
|
-
|
|
105
|
-
| Section | Written by | Updated by |
|
|
106
|
-
|---------|-----------|------------|
|
|
107
|
-
| Frontmatter (`flow`, `cycle`, `goal`) | `foundry_workfile_create` (flow skill) | `foundry_workfile_delete` + re-create between cycles |
|
|
108
|
-
| Frontmatter (`stages`, `max-iterations`, `human-appraise`, `deadlock-appraise`, `deadlock-iterations`, `models`) | `foundry_orchestrate` (first call of each cycle, internally) | reset on each new cycle |
|
|
109
|
-
| Goal | `foundry_workfile_create` (flow skill) | nobody |
|
|
110
|
-
| Artefacts | `foundry_stage_finalize` (orchestrator, after forge closes) | `foundry_artefacts_set_status` (orchestrator → `done`/`blocked`) |
|
|
111
|
-
| Feedback | `foundry_feedback_add` (quench / appraise / human-appraise) | `foundry_feedback_action` / `foundry_feedback_wontfix` (forge), `foundry_feedback_resolve` (quench / appraise / human-appraise) |
|
|
112
|
-
|
|
113
|
-
Note: `foundry_artefacts_add` no longer exists as a public tool — artefact registration is automatic via `stage_finalize`, which scans the git diff and registers files matching the output type's `file-patterns` as `draft`.
|
|
114
|
-
|
|
115
|
-
## WORK.history.yaml
|
|
116
|
-
|
|
117
|
-
A separate file (`WORK.history.yaml`) alongside WORK.md. Append-only log of every stage execution.
|
|
118
|
-
|
|
119
|
-
```yaml
|
|
120
|
-
- timestamp: "2026-04-17T14:32:01Z"
|
|
121
|
-
cycle: write-petition
|
|
122
|
-
stage: forge:draft-petition
|
|
123
|
-
iteration: 1
|
|
124
|
-
comment: Initial petition draft created
|
|
125
|
-
|
|
126
|
-
- timestamp: "2026-04-17T14:32:45Z"
|
|
127
|
-
cycle: write-petition
|
|
128
|
-
stage: quench:validate-petition
|
|
129
|
-
iteration: 1
|
|
130
|
-
comment: 2 validation issues found
|
|
131
|
-
|
|
132
|
-
- timestamp: "2026-04-17T14:33:12Z"
|
|
133
|
-
cycle: write-petition
|
|
134
|
-
stage: forge:draft-petition
|
|
135
|
-
iteration: 2
|
|
136
|
-
comment: Addressed 2 validation issues
|
|
137
|
-
|
|
138
|
-
- timestamp: "2026-04-17T14:33:30Z"
|
|
139
|
-
cycle: write-petition
|
|
140
|
-
stage: quench:validate-petition
|
|
141
|
-
iteration: 2
|
|
142
|
-
comment: Validation passed
|
|
143
|
-
|
|
144
|
-
- timestamp: "2026-04-17T14:34:00Z"
|
|
145
|
-
cycle: write-petition
|
|
146
|
-
stage: appraise:review-petition
|
|
147
|
-
iteration: 2
|
|
148
|
-
comment: No issues found, cycle complete
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Fields
|
|
152
|
-
|
|
153
|
-
- `timestamp` — ISO 8601 UTC
|
|
154
|
-
- `cycle` — which foundry cycle this entry belongs to
|
|
155
|
-
- `stage` — which stage just completed, in `base:alias` format (e.g. `forge:draft-petition`, `quench:validate-petition`, `appraise:review-petition`, `human-appraise:human-review`)
|
|
156
|
-
- `iteration` — the current iteration number (increments each time forge runs within a cycle)
|
|
157
|
-
- `comment` — brief description of what happened
|
|
158
|
-
|
|
159
|
-
### Rules
|
|
160
|
-
|
|
161
|
-
- Append-only — never edit or delete entries.
|
|
162
|
-
- Every stage produces an entry when it completes.
|
|
163
|
-
- Sort reads this to determine what has happened in the current cycle.
|
|
164
|
-
- Iteration is derived from counting forge entries for the current cycle.
|
|
165
|
-
|
|
166
|
-
### Who writes
|
|
167
|
-
|
|
168
|
-
History entries are written by `foundry_orchestrate` after each stage closes (via its internal `foundry_history_append` — the tool is not registered publicly). Sub-agents never append history directly.
|
|
169
|
-
|
|
170
|
-
## Example
|
|
171
|
-
|
|
172
|
-
A complete WORK.md mid-foundry flow:
|
|
173
|
-
|
|
174
|
-
```markdown
|
|
175
|
-
---
|
|
176
|
-
flow: make-haiku
|
|
177
|
-
cycle: haiku-creation
|
|
178
|
-
stages: [forge:write-haiku, quench:check-syllables, appraise:evaluate-quality]
|
|
179
|
-
max-iterations: 3
|
|
180
|
-
human-appraise: false
|
|
181
|
-
deadlock-appraise: true
|
|
182
|
-
deadlock-iterations: 5
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
# Goal
|
|
186
|
-
|
|
187
|
-
Write a haiku about autumn rain. Should evoke loneliness
|
|
188
|
-
and the sound of rain on leaves.
|
|
189
|
-
|
|
190
|
-
# Artefacts
|
|
191
|
-
|
|
192
|
-
| File | Type | Cycle | Status |
|
|
193
|
-
|------|------|-------|--------|
|
|
194
|
-
| petitions/autumn-rain-haiku.md | petition | haiku-ideation | done |
|
|
195
|
-
| haiku/autumn-rain.md | haiku | haiku-creation | draft |
|
|
196
|
-
|
|
197
|
-
# Feedback
|
|
198
|
-
|
|
199
|
-
## petitions/autumn-rain-haiku.md
|
|
200
|
-
|
|
201
|
-
- [x] Acceptance criteria should mention seasonal reference #law:clear-acceptance-criteria | approved
|
|
202
|
-
|
|
203
|
-
## haiku/autumn-rain.md
|
|
204
|
-
|
|
205
|
-
- [ ] Line 2 has 8 syllables, expected 7 #validation
|
|
206
|
-
- [x] No seasonal reference detected #law:seasonal-reference | approved
|
|
207
|
-
```
|