@really-knows-ai/foundry 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +43 -0
- package/dist/docs/architecture.md +1 -2
- package/dist/docs/concepts.md +2 -3
- package/dist/docs/getting-started.md +2 -3
- package/dist/docs/work-spec.md +1 -1
- package/dist/scripts/lib/config.js +0 -65
- package/dist/skills/add-artefact-type/SKILL.md +28 -28
- package/dist/skills/upgrade-foundry/SKILL.md +3 -4
- package/package.json +1 -1
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.0.1] - 2026-05-11
|
|
4
|
+
|
|
5
|
+
A documentation and cleanup patch. No runtime behaviour change. `quench`
|
|
6
|
+
already read deterministic checks via `getLawsForQuench`; this release
|
|
7
|
+
aligns the authoring skills, end-user docs, and source tree with that
|
|
8
|
+
reality and removes the deprecated `validation.md` reader path.
|
|
9
|
+
|
|
10
|
+
### Authoring skills now teach laws-with-validators
|
|
11
|
+
|
|
12
|
+
- `add-artefact-type` folds deterministic checks into laws via the
|
|
13
|
+
optional `validators:` block. The skill walks the user through laws
|
|
14
|
+
and their validators in a single step; the previously separate
|
|
15
|
+
"Validation" step is gone.
|
|
16
|
+
- `upgrade-foundry` describes type-specific laws (with validators where
|
|
17
|
+
applicable) instead of standalone "validation commands".
|
|
18
|
+
- The `validators:` YAML shape in `add-artefact-type` is now identical
|
|
19
|
+
to the canonical shape in `add-law`.
|
|
20
|
+
|
|
21
|
+
### Documentation
|
|
22
|
+
|
|
23
|
+
- `docs/architecture.md`, `docs/concepts.md`, `docs/getting-started.md`,
|
|
24
|
+
and `docs/work-spec.md` drop every reference to `validation.md` and
|
|
25
|
+
describe `quench` as running validators declared inside laws.
|
|
26
|
+
- The `quench` stage is now correctly documented as included iff any
|
|
27
|
+
applicable law declares validators.
|
|
28
|
+
|
|
29
|
+
### Internal cleanup
|
|
30
|
+
|
|
31
|
+
- Remove the deprecated `getValidation` and `parseValidationLines`
|
|
32
|
+
exports from `src/scripts/lib/config.js`, plus their six private
|
|
33
|
+
helpers. Nothing in production called them; `quench` reads via
|
|
34
|
+
`getLawsForQuench`.
|
|
35
|
+
- Remove the `describe('getValidation', …)` test block and three inert
|
|
36
|
+
`validation.md` fixtures from the orchestrate integration tests.
|
|
37
|
+
|
|
38
|
+
### Migration
|
|
39
|
+
|
|
40
|
+
No action required for projects that already use laws-with-validators.
|
|
41
|
+
Projects still carrying a `foundry/artefacts/<type>/validation.md` file
|
|
42
|
+
have been carrying dead weight since the move to `getLawsForQuench`;
|
|
43
|
+
the file is now safe to delete by hand, or `upgrade-foundry` will
|
|
44
|
+
rebuild the configuration through the current tools.
|
|
45
|
+
|
|
3
46
|
## [3.0.0] - 2026-05-10
|
|
4
47
|
|
|
5
48
|
A consolidation release covering every change since v2.4.2. Foundry 3.0.0
|
|
@@ -399,8 +399,7 @@ your-project/
|
|
|
399
399
|
│ ├── artefacts/ # artefact type definitions
|
|
400
400
|
│ │ └── <type>/
|
|
401
401
|
│ │ ├── definition.md
|
|
402
|
-
│ │
|
|
403
|
-
│ │ └── validation.md # optional
|
|
402
|
+
│ │ └── laws.md # optional
|
|
404
403
|
│ ├── laws/ # global laws
|
|
405
404
|
│ ├── appraisers/ # appraiser personalities
|
|
406
405
|
│ └── memory/ # optional flow memory config (init-memory)
|
package/dist/docs/concepts.md
CHANGED
|
@@ -35,7 +35,7 @@ The stage names come from the foundry metaphor because the system treats AI outp
|
|
|
35
35
|
|
|
36
36
|
- **assay** — opt-in pre-forge stage that populates flow memory by running project-authored extractor scripts (iteration 0 only). No artefact, no feedback, no output beyond memory writes. See the [Assay](#assay) and [Extractor](#extractor) entries below.
|
|
37
37
|
- **forge** — produce or revise the artefact.
|
|
38
|
-
- **quench** — run deterministic CLI checks
|
|
38
|
+
- **quench** — run deterministic CLI checks declared in laws (via their optional `validators:` blocks).
|
|
39
39
|
- **appraise** — subjective evaluation by multiple appraiser sub-agents.
|
|
40
40
|
- **human-appraise** — human quality gate. Can run every iteration, only on deadlock, or both.
|
|
41
41
|
|
|
@@ -63,8 +63,7 @@ See also: [Extractor](#extractor).
|
|
|
63
63
|
A definition of what is being produced. Lives in `foundry/artefacts/<type>/`:
|
|
64
64
|
|
|
65
65
|
- `definition.md` — identity, file patterns, output directory, appraiser config, prose description.
|
|
66
|
-
- `laws.md` *(optional)* — type-specific subjective criteria.
|
|
67
|
-
- `validation.md` *(optional)* — CLI commands for deterministic quench checks.
|
|
66
|
+
- `laws.md` *(optional)* — type-specific subjective criteria, with optional validators for deterministic checks.
|
|
68
67
|
|
|
69
68
|
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.
|
|
70
69
|
|
|
@@ -72,10 +72,9 @@ Run `add-artefact-type`. It walks you through:
|
|
|
72
72
|
- `id` (lowercase, hyphenated), `name`, prose description.
|
|
73
73
|
- `file-patterns` — glob patterns describing which files this type owns. Forge's write scope is exactly these patterns; anything written outside them violates the cycle. The skill refuses patterns that overlap with existing types.
|
|
74
74
|
- Appraiser config — how many appraisers evaluate this type and which personalities are allowed.
|
|
75
|
-
- Optional `laws.md` — type-specific criteria.
|
|
76
|
-
- Optional `validation.md` — CLI commands for quench (non-zero exit = failure).
|
|
75
|
+
- Optional `laws.md` — type-specific criteria, with optional validators for deterministic checks.
|
|
77
76
|
|
|
78
|
-
Produces `foundry/artefacts/<id>/definition.md` (+ optional `laws.md
|
|
77
|
+
Produces `foundry/artefacts/<id>/definition.md` (+ optional `laws.md`).
|
|
79
78
|
|
|
80
79
|
### 2. Write laws
|
|
81
80
|
|
package/dist/docs/work-spec.md
CHANGED
|
@@ -46,7 +46,7 @@ assay:
|
|
|
46
46
|
Fields:
|
|
47
47
|
- `flow` — the foundry flow being executed.
|
|
48
48
|
- `cycle` — the current cycle id.
|
|
49
|
-
- `stages` — the ordered route for this cycle. Each entry uses `base:alias` format where `base` is the stage type (`forge`, `quench`, `appraise`, `human-appraise`, or `assay`) and `alias` is a human-readable name for what that stage does in this cycle. The list is derived from the cycle and artefact type: `forge` and `appraise` are always included; `quench` is included iff
|
|
49
|
+
- `stages` — the ordered route for this cycle. Each entry uses `base:alias` format where `base` is the stage type (`forge`, `quench`, `appraise`, `human-appraise`, or `assay`) and `alias` is a human-readable name for what that stage does in this cycle. The list is derived from the cycle and artefact type: `forge` and `appraise` are always included; `quench` is included iff any applicable law declares validators; `human-appraise` is included iff the cycle sets `human-appraise: true`; and `assay` is included iff the cycle declares an `assay.extractors` block.
|
|
50
50
|
- `max-iterations` — how many forge passes before the cycle is blocked (default: 3).
|
|
51
51
|
- `human-appraise` — run human-appraise every iteration (default: `false`).
|
|
52
52
|
- `deadlock-appraise` — route to human-appraise when LLM appraisers deadlock (default: `true`).
|
|
@@ -269,71 +269,6 @@ export async function getLawsForQuench(foundryDir, io, { typeId } = {}) {
|
|
|
269
269
|
return laws.filter(law => law.validators && law.validators.length > 0);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
function parseValidationEntry(line) {
|
|
273
|
-
const cmdMatch = line.match(/^Command:\s*(.+)/);
|
|
274
|
-
if (cmdMatch) return { type: 'command', value: cmdMatch[1].trim().replace(/^`|`$/g, '') };
|
|
275
|
-
const failMatch = line.match(/^Failure means:\s*(.+)/);
|
|
276
|
-
if (failMatch) return { type: 'failure', value: failMatch[1].trim() };
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function buildValidationEntry(currentId, currentCommand, currentFailure) {
|
|
281
|
-
if (!currentId || !currentCommand) return null;
|
|
282
|
-
const entry = { id: currentId, command: currentCommand };
|
|
283
|
-
if (currentFailure) entry.failureMeans = currentFailure;
|
|
284
|
-
return entry;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function flushValidationEntry(entries, id, command, failure) {
|
|
288
|
-
const entry = buildValidationEntry(id, command, failure);
|
|
289
|
-
if (entry) entries.push(entry);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function applyParsedEntry(state, parsed) {
|
|
293
|
-
if (parsed?.type === 'command') state.command = parsed.value;
|
|
294
|
-
if (parsed?.type === 'failure') state.failure = parsed.value;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
function handleValidationLine(line, state) {
|
|
298
|
-
const heading = line.match(/^## (.+)/);
|
|
299
|
-
if (heading) {
|
|
300
|
-
flushValidationEntry(state.entries, state.id, state.command, state.failure);
|
|
301
|
-
state.id = heading[1].trim();
|
|
302
|
-
state.command = null;
|
|
303
|
-
state.failure = null;
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
if (state.id) {
|
|
307
|
-
applyParsedEntry(state, parseValidationEntry(line));
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function internalParseValidationLines(lines) {
|
|
312
|
-
const state = { entries: [], id: null, command: null, failure: null };
|
|
313
|
-
for (const line of lines) {
|
|
314
|
-
handleValidationLine(line, state);
|
|
315
|
-
}
|
|
316
|
-
flushValidationEntry(state.entries, state.id, state.command, state.failure);
|
|
317
|
-
return state.entries;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* @deprecated Use getLawsForQuench instead. Phase 2 migration of validation.md files will remove this.
|
|
322
|
-
*/
|
|
323
|
-
export async function getValidation(foundryDir, typeId, io) {
|
|
324
|
-
const path = join(foundryDir, 'artefacts', typeId, 'validation.md');
|
|
325
|
-
if (!(await io.exists(path))) return null;
|
|
326
|
-
const text = await io.readFile(path);
|
|
327
|
-
return internalParseValidationLines(text.split('\n'));
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* @deprecated Use getLawsForQuench instead. Phase 2 migration of validation.md files will remove this.
|
|
332
|
-
*/
|
|
333
|
-
export async function parseValidationLines(lines) {
|
|
334
|
-
return internalParseValidationLines(lines);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
272
|
export async function getAppraisers(foundryDir, io) {
|
|
338
273
|
const dir = join(foundryDir, 'appraisers');
|
|
339
274
|
if (!(await io.exists(dir))) return [];
|
|
@@ -6,7 +6,7 @@ description: Creates a new artefact type, checking for conflicts with existing t
|
|
|
6
6
|
|
|
7
7
|
# Add Artefact Type
|
|
8
8
|
|
|
9
|
-
You help the user create a new artefact type. You ensure it
|
|
9
|
+
You help the user create a new artefact type. You ensure it avoids conflicts with existing types, scaffold the directory structure, and walk the user through defining laws and their optional validators.
|
|
10
10
|
|
|
11
11
|
## Prerequisites
|
|
12
12
|
|
|
@@ -106,10 +106,32 @@ Ask:
|
|
|
106
106
|
> Do you want to define any type-specific laws for this artefact type? (Global laws in `foundry/laws/` will apply automatically.)
|
|
107
107
|
|
|
108
108
|
If yes, walk through each law using the same format as `add-law`:
|
|
109
|
-
- Draft each law
|
|
109
|
+
- Draft each law, adding validators where a deterministic check applies
|
|
110
110
|
- Check for conflicts with global laws and any existing type-specific laws
|
|
111
111
|
- Confirm with the user
|
|
112
112
|
|
|
113
|
+
Each law may declare an optional `validators:` block. Include validators only when a deterministic check is needed. The format matches `add-law`:
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
## <law-id>
|
|
117
|
+
|
|
118
|
+
<What this law checks — one or two sentences.>
|
|
119
|
+
|
|
120
|
+
validators:
|
|
121
|
+
- id: validator-id
|
|
122
|
+
command: ./script.sh
|
|
123
|
+
failure-means: (optional description)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The `validators` block is optional. When present, `quench` runs each validator for this law. Validator scripts live within the artefact type directory (e.g., `foundry/artefacts/<type>/check-foo.mjs`).
|
|
127
|
+
|
|
128
|
+
**Use existing libraries:** Before writing custom validation logic, search npm for well-tested libraries that solve the problem (e.g., `syllable` for syllable counting, `natural` for NLP tasks). Hand-rolled heuristics are fragile — prefer battle-tested packages. Install them as project dependencies.
|
|
129
|
+
|
|
130
|
+
Check the project's `package.json` for `"type": "module"`:
|
|
131
|
+
- If ESM (`"type": "module"`): use `import` syntax, or name scripts with `.mjs` extension
|
|
132
|
+
- If CommonJS (no `"type"` field or `"type": "commonjs"`): `require()` is fine, or use `.cjs` extension
|
|
133
|
+
- When in doubt, use `.mjs` or `.cjs` extensions to be explicit regardless of project settings
|
|
134
|
+
|
|
113
135
|
### 6. Appraisers (optional)
|
|
114
136
|
|
|
115
137
|
Ask:
|
|
@@ -135,33 +157,13 @@ appraisers:
|
|
|
135
157
|
|
|
136
158
|
List the available appraisers from `foundry/appraisers/*.md` so the user can see their options.
|
|
137
159
|
|
|
138
|
-
### 7.
|
|
139
|
-
|
|
140
|
-
Ask:
|
|
141
|
-
|
|
142
|
-
> Do you want to define any deterministic validation commands for this artefact type?
|
|
143
|
-
|
|
144
|
-
If yes, walk through each validation entry:
|
|
145
|
-
- A `## heading` (identifier)
|
|
146
|
-
- A `Command:` line with `{file}` placeholder
|
|
147
|
-
- A `Failure means:` line explaining what a non-zero exit indicates
|
|
148
|
-
|
|
149
|
-
If the user wants validation scripts (not just inline commands), create them as separate files in the artefact type directory.
|
|
150
|
-
|
|
151
|
-
**Use existing libraries:** Before writing custom validation logic, search npm for well-tested libraries that solve the problem (e.g., `syllable` for syllable counting, `natural` for NLP tasks). Hand-rolled heuristics are fragile — prefer battle-tested packages. Install them as project dependencies.
|
|
152
|
-
|
|
153
|
-
Check the project's `package.json` for `"type": "module"`:
|
|
154
|
-
- If ESM (`"type": "module"`): use `import` syntax, or name scripts with `.mjs` extension
|
|
155
|
-
- If CommonJS (no `"type"` field or `"type": "commonjs"`): `require()` is fine, or use `.cjs` extension
|
|
156
|
-
- When in doubt, use `.mjs` or `.cjs` extensions to be explicit regardless of project settings
|
|
157
|
-
|
|
158
|
-
### 8. Validate the draft
|
|
160
|
+
### 7. Validate the draft
|
|
159
161
|
|
|
160
162
|
Call `foundry_config_validate_artefact_type({ name: "<id>", body: "<full markdown>" })`.
|
|
161
163
|
|
|
162
164
|
If the result is `{ ok: false, errors: [...] }`, address each error (adjust the body) and re-run until you get `{ ok: true }`. Common issues: missing required frontmatter keys, references to artefact types or flows that don't exist yet.
|
|
163
165
|
|
|
164
|
-
###
|
|
166
|
+
### 8. Create the file
|
|
165
167
|
|
|
166
168
|
Call `foundry_config_create_artefact_type({ name: "<id>", body: "<full markdown>" })`. The tool:
|
|
167
169
|
|
|
@@ -173,13 +175,11 @@ If the tool returns `{ ok: false, errors }` because the target file already exis
|
|
|
173
175
|
|
|
174
176
|
Show the user the resulting commit hash from the response.
|
|
175
177
|
|
|
176
|
-
###
|
|
178
|
+
### 9. Add laws file (if defined)
|
|
177
179
|
|
|
178
180
|
The create tool writes only `definition.md`. If you drafted any type-specific laws in step 5, append them to `foundry/artefacts/<id>/laws.md` by hand on this same `config/*` branch (use the `Edit` tool to create the file) and commit that as a separate microcommit.
|
|
179
181
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
### 11. Confirm
|
|
182
|
+
### 10. Confirm
|
|
183
183
|
|
|
184
184
|
Show the user the complete file listing and the commit hashes.
|
|
185
185
|
|
|
@@ -64,8 +64,7 @@ Read source material from the preserved directory:
|
|
|
64
64
|
- Flow definitions.
|
|
65
65
|
- Cycle definitions.
|
|
66
66
|
- Artefact type definitions.
|
|
67
|
-
- Type-specific laws.
|
|
68
|
-
- Type-specific validation commands.
|
|
67
|
+
- Type-specific laws (with validators where applicable).
|
|
69
68
|
- Global laws.
|
|
70
69
|
- Appraisers.
|
|
71
70
|
- Memory schema, relations, and extractors when present.
|
|
@@ -93,7 +92,7 @@ Common clarification points:
|
|
|
93
92
|
- Starting cycles when the old flow has no explicit current-version equivalent.
|
|
94
93
|
- Input contracts when old inputs do not state `any-of` or `all-of` intent.
|
|
95
94
|
- Artefact ownership when file patterns overlap or are missing.
|
|
96
|
-
-
|
|
95
|
+
- Validators whose purpose or failure meaning is unclear.
|
|
97
96
|
- Appraiser selection when old config lacks counts, allowed appraisers, or personality detail.
|
|
98
97
|
- Human appraisal and deadlock settings that map to current fields with changed semantics.
|
|
99
98
|
- Memory permissions, extractor outputs, relation files, or schema details whose current contract is ambiguous.
|
|
@@ -107,7 +106,7 @@ Recreate concepts in dependency order:
|
|
|
107
106
|
|
|
108
107
|
1. Global laws.
|
|
109
108
|
2. Appraisers.
|
|
110
|
-
3. Artefact types, including type laws and
|
|
109
|
+
3. Artefact types, including type laws and validators.
|
|
111
110
|
4. Memory schema and extractors when safely inferable.
|
|
112
111
|
5. Cycles.
|
|
113
112
|
6. Flows.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@really-knows-ai/foundry",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A skill-driven framework for governed artefact generation with AI coding tools. Define your own artefact types, laws, and flows — Foundry handles the forge → quench → appraise pipeline with deterministic routing, quality gates, and iterative refinement.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/.opencode/plugins/foundry.js",
|