@really-knows-ai/foundry 3.3.1 → 3.3.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/dist/CHANGELOG.md +28 -0
- package/dist/skills/add-appraiser/SKILL.md +19 -48
- package/dist/skills/add-artefact-type/SKILL.md +26 -92
- package/dist/skills/add-cycle/SKILL.md +46 -114
- package/dist/skills/add-extractor/SKILL.md +44 -48
- package/dist/skills/add-flow/SKILL.md +90 -23
- package/dist/skills/add-law/SKILL.md +67 -111
- package/dist/skills/add-memory-edge-type/SKILL.md +56 -27
- package/dist/skills/add-memory-entity-type/SKILL.md +59 -40
- package/dist/skills/change-embedding-model/SKILL.md +24 -14
- package/dist/skills/drop-memory-edge-type/SKILL.md +20 -12
- package/dist/skills/drop-memory-entity-type/SKILL.md +22 -14
- package/dist/skills/init-memory/SKILL.md +45 -41
- package/dist/skills/rename-memory-edge-type/SKILL.md +17 -8
- package/dist/skills/rename-memory-entity-type/SKILL.md +17 -9
- package/dist/skills/reset-memory/SKILL.md +18 -9
- package/package.json +1 -1
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.3.2] - 2026-05-14
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **All 15 creation and edit skills converted to an interactive wizard
|
|
8
|
+
protocol.** Every skill now follows Understand → Plan → Confirm → Build
|
|
9
|
+
instead of auto-creating configuration. The AI asks questions, presents a
|
|
10
|
+
plan, waits for confirmation, then builds — no file is created before the
|
|
11
|
+
user says yes.
|
|
12
|
+
|
|
13
|
+
Skills converted:
|
|
14
|
+
|
|
15
|
+
| Phase | Skills |
|
|
16
|
+
|-------|--------|
|
|
17
|
+
| Core config | `add-artefact-type`, `add-appraiser`, `add-law` |
|
|
18
|
+
| Cycle and flow | `add-cycle`, `add-flow` (composite — invokes sub-skills with context) |
|
|
19
|
+
| Memory creation | `add-extractor`, `add-memory-entity-type`, `add-memory-edge-type`, `init-memory` |
|
|
20
|
+
| Memory edit/destructive | `rename-memory-entity-type`, `rename-memory-edge-type`, `change-embedding-model`, `reset-memory`, `drop-memory-entity-type`, `drop-memory-edge-type` |
|
|
21
|
+
|
|
22
|
+
- **Sub-skill composition via context object contract.** Parent skills (e.g.
|
|
23
|
+
`add-flow`, `add-artefact-type`) pass pre-filled field objects to
|
|
24
|
+
sub-skills (e.g. `add-law`, `add-cycle`). Sub-skills skip questions for
|
|
25
|
+
provided fields and only ask for gaps. `add-flow` presents a single
|
|
26
|
+
combined plan covering all dependencies and confirms once before building.
|
|
27
|
+
- **Destructive skills require typed confirmation.** `reset-memory` requires
|
|
28
|
+
typing "reset"; `drop-*` skills show previews of affected rows and edges
|
|
29
|
+
before requiring explicit confirmation.
|
|
30
|
+
|
|
3
31
|
## [3.3.1] - 2026-05-14
|
|
4
32
|
|
|
5
33
|
### Fixed
|
|
@@ -34,30 +34,23 @@ Do not tell the user to call branch tools directly.
|
|
|
34
34
|
|
|
35
35
|
## Protocol
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Context object
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
- `id` — lowercase, hyphenated identifier
|
|
41
|
-
- `name` — a short character name (e.g., "The Pedant", "The Pragmatist")
|
|
42
|
-
- `model` — (optional) a specific model ID to use for this appraiser (e.g., `openai/gpt-4o`). Overrides the cycle-level model for the appraise stage. If omitted, the appraiser uses whatever model the cycle's appraise stage is configured with.
|
|
43
|
-
- A prose description of the personality: how they think, what they prioritize, how they evaluate
|
|
39
|
+
When invoked with pre-filled fields matching the `foundry_config_create_appraiser` tool args, skip questions for provided fields. Missing fields trigger clarifying questions.
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
Context fields: `{id, name, description, model?}`
|
|
46
42
|
|
|
47
|
-
|
|
43
|
+
When invoked with a context:
|
|
44
|
+
- If all required fields are present, skip the Understand phase and proceed to Plan → Confirm → Build.
|
|
45
|
+
- If only some fields are present, ask only for the missing ones.
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
### 1. Understand
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
Ask for `id`, `name`, and `description` one at a time. Ask about `model` (optional) — offer the default model as the recommended choice.
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
**Id conflict check**: Read all existing appraiser definitions in `foundry/appraisers/*.md`. Exact id match means a hard conflict — choose a different id.
|
|
54
52
|
|
|
55
|
-
For each existing appraiser, compare the new personality against it:
|
|
56
|
-
- What does this appraiser prioritize?
|
|
57
|
-
- What lens do they evaluate through?
|
|
58
|
-
- Would two artefacts get meaningfully different feedback from these appraisers?
|
|
59
|
-
|
|
60
|
-
If significant overlap is found, present it to the user:
|
|
53
|
+
**Semantic overlap check**: For each existing appraiser, compare the new personality against it. If significant overlap is found, present it to the user:
|
|
61
54
|
|
|
62
55
|
> The new appraiser `<new-id>` seems to overlap with existing appraiser `<existing-id>`:
|
|
63
56
|
> - New: <name> — <personality summary>
|
|
@@ -74,45 +67,23 @@ If significant overlap is found, present it to the user:
|
|
|
74
67
|
|
|
75
68
|
Do not proceed until the user has decided.
|
|
76
69
|
|
|
77
|
-
###
|
|
78
|
-
|
|
79
|
-
Present the definition to the user with these structured fields:
|
|
80
|
-
|
|
81
|
-
- `id` (string) — lowercase, hyphenated identifier
|
|
82
|
-
- `name` (string) — a short character name (e.g., "The Pedant", "The Pragmatist")
|
|
83
|
-
- `description` (string) — 2-4 sentences describing how this appraiser thinks, what they care about, and how they approach evaluation
|
|
84
|
-
- `model` (string, optional) — a specific model ID to use for this appraiser (e.g., `openai/gpt-4o`). Overrides the cycle-level model for the appraise stage. Omit this field to use the cycle's default model.
|
|
85
|
-
|
|
86
|
-
Ask: does this capture the personality correctly?
|
|
87
|
-
|
|
88
|
-
### 5. Refine with the user
|
|
89
|
-
|
|
90
|
-
Iterate until the user is happy with the personality description. Key things to check:
|
|
91
|
-
- Is the personality distinct enough from existing appraisers?
|
|
92
|
-
- Does the description give the LLM enough direction to adopt a consistent voice?
|
|
93
|
-
- Is it clear what this appraiser would flag vs let pass?
|
|
94
|
-
|
|
95
|
-
### 6. Validate the draft
|
|
96
|
-
|
|
97
|
-
Call `foundry_config_validate_appraiser({ name: "<id>", body: "<assembled markdown>" })`. Assemble the body from the fields using the frontmatter format the tool produces internally.
|
|
70
|
+
### 2. Plan
|
|
98
71
|
|
|
99
|
-
|
|
72
|
+
Present a quick inline summary: id, name, personality description. Include the model if one was specified. Ask: "Does this capture the personality correctly?" Iterate until the user is satisfied.
|
|
100
73
|
|
|
101
|
-
###
|
|
74
|
+
### 3. Confirm
|
|
102
75
|
|
|
103
|
-
|
|
76
|
+
Ask: "Proceed with this plan?" — wait for user answer before building. If the user rejects the plan, return to the Understand phase and adjust.
|
|
104
77
|
|
|
105
|
-
|
|
106
|
-
- writes `foundry/appraisers/<id>.md`;
|
|
107
|
-
- produces one git commit on the current `config/*` branch.
|
|
78
|
+
### 4. Build
|
|
108
79
|
|
|
109
|
-
|
|
80
|
+
1. **Validate**: Call `foundry_config_validate_appraiser({ name: "<id>", body: "<assembled markdown>" })`. Assemble the body from the fields using the frontmatter format the tool produces internally. If the result is `{ ok: false, errors: [...] }`, address each error and re-run until `{ ok: true }`. Common issues: missing required frontmatter keys, references to artefact types or flows that do not exist yet.
|
|
110
81
|
|
|
111
|
-
Show the user the resulting commit hash
|
|
82
|
+
2. **Create**: Call `foundry_config_create_appraiser({ id: "<id>", name: "<name>", description: "<description>" })`. The tool re-validates the body (TOCTOU), writes `foundry/appraisers/<id>.md`, and produces one git commit on the current `config/*` branch. Show the user the resulting commit hash.
|
|
112
83
|
|
|
113
|
-
|
|
84
|
+
If the tool returns `{ ok: false, errors }` because the target file already exists, read the existing file, incorporate the user's requested changes into the current body, propose the merged result for review, then write and commit the updated file.
|
|
114
85
|
|
|
115
|
-
After creating the appraiser, offer to connect it to relevant artefact-type configuration when doing so supports the user's stated goal. If the user confirms, update the artefact type's `appraisers.allowed` list on the same config branch.
|
|
86
|
+
3. **Artefact type configuration**: After creating the appraiser, offer to connect it to relevant artefact-type configuration when doing so supports the user's stated goal. If the user confirms, update the artefact type's `appraisers.allowed` list on the same config branch.
|
|
116
87
|
|
|
117
88
|
## What you do NOT do
|
|
118
89
|
|
|
@@ -34,24 +34,21 @@ Do not tell the user to call branch tools directly.
|
|
|
34
34
|
|
|
35
35
|
## Protocol
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Context object
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
- `id` — lowercase, hyphenated identifier (e.g. `haiku`). The
|
|
41
|
-
frontmatter `name:` field must equal this id; any human-readable
|
|
42
|
-
label goes in the `## Definition` prose, not in frontmatter.
|
|
43
|
-
- `file-patterns` — glob patterns for files this type produces
|
|
44
|
-
(forge's write scope is exactly these patterns).
|
|
45
|
-
- A prose description of what this artefact type is.
|
|
39
|
+
When invoked with pre-filled fields matching the `foundry_config_create_artefact_type` tool args, skip questions for provided fields. Missing fields trigger clarifying questions.
|
|
46
40
|
|
|
47
|
-
|
|
41
|
+
Context fields: `{id, name, filePatterns, description, appraisers?}`
|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
When invoked with a context:
|
|
44
|
+
- If all required fields are present, skip the Understand phase and proceed to Plan → Confirm → Build.
|
|
45
|
+
- If only some fields are present, ask only for the missing ones.
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
### 1. Understand
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
Ask for each field one question at a time. Prefer multiple choice for `filePatterns`, deriving options from the artefact type name and common conventions (e.g. `haikus/*.md`, `haiku.md`, `output/haiku/*.md`). Ask about `appraisers` (optional) — either provide an existing appraiser ID or skip.
|
|
50
|
+
|
|
51
|
+
**Naming conflict check**: Read all existing artefact type definitions in `foundry/artefacts/*/definition.md`. Exact id match means a hard conflict — choose a different id. A semantically similar name or description triggers a warning:
|
|
55
52
|
|
|
56
53
|
> An artefact type `<existing-id>` already exists that seems similar:
|
|
57
54
|
> - Existing: <name> — <description summary>
|
|
@@ -59,16 +56,7 @@ Read all existing artefact type definitions in `foundry/artefacts/*/definition.m
|
|
|
59
56
|
>
|
|
60
57
|
> Is the new type genuinely distinct, or should you extend the existing one?
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
For each existing artefact type, check whether the new type's `file-patterns` could match the same files as any existing type's `file-patterns`.
|
|
65
|
-
|
|
66
|
-
Examples of intersections:
|
|
67
|
-
- `features/*.feature` vs `features/*.feature` — exact overlap
|
|
68
|
-
- `features/**` vs `features/*.feature` — subset overlap
|
|
69
|
-
- `output/*.md` vs `output/reports/*.md` — potential overlap if nested
|
|
70
|
-
|
|
71
|
-
If any intersection is found, this is a hard block:
|
|
59
|
+
**File pattern overlap check**: For each existing artefact type, check whether the new type's `filePatterns` could match the same files as any existing type's patterns. Overlapping file patterns are a hard block:
|
|
72
60
|
|
|
73
61
|
> The file pattern `<new-pattern>` intersects with artefact type `<existing-id>` which uses `<existing-pattern>`.
|
|
74
62
|
>
|
|
@@ -78,87 +66,33 @@ If any intersection is found, this is a hard block:
|
|
|
78
66
|
|
|
79
67
|
Do not proceed until the patterns are non-overlapping.
|
|
80
68
|
|
|
81
|
-
###
|
|
69
|
+
### 2. Plan
|
|
82
70
|
|
|
83
71
|
Present the definition to the user with these structured fields:
|
|
84
72
|
|
|
85
|
-
- `id` (string) — lowercase, hyphenated identifier
|
|
86
|
-
- `name` (string) — human-readable label
|
|
87
|
-
- `filePatterns` (string[]) — glob patterns for files this type produces
|
|
88
|
-
- `description` (string) — prose description of what this artefact type is
|
|
89
|
-
- `appraisers` ({ count?: number, allowed?: string[] }, optional) — appraiser configuration
|
|
90
|
-
|
|
91
|
-
The `id` value must exactly match the artefact type's identifier
|
|
92
|
-
(lowercase, hyphenated). If you want a human-readable label, put it
|
|
93
|
-
in the `name` field.
|
|
94
|
-
|
|
95
|
-
Ask: does this capture the artefact type correctly?
|
|
96
|
-
|
|
97
|
-
### 5. Laws (optional)
|
|
98
|
-
|
|
99
|
-
Ask:
|
|
100
|
-
|
|
101
|
-
> Do you want to define any type-specific laws for this artefact type? (Global laws in `foundry/laws/` will apply automatically.)
|
|
102
|
-
|
|
103
|
-
If yes, walk through each law using the same format as `add-law`:
|
|
104
|
-
- Draft each law, adding validators where a deterministic check applies
|
|
105
|
-
- Check for conflicts with global laws and any existing type-specific laws
|
|
106
|
-
- Confirm with the user
|
|
107
|
-
|
|
108
|
-
Each law may declare an optional `validators:` block; the YAML shape,
|
|
109
|
-
JSONL output contract, `{pattern}` / `{files}` placeholders, skip
|
|
110
|
-
rule, working directory, and a worked example are documented once in
|
|
111
|
-
the `add-law` skill under **§7a. Validator contract**. Authors of
|
|
112
|
-
type-specific laws must follow that contract — do not invent a
|
|
113
|
-
different one here.
|
|
114
|
-
|
|
115
|
-
### 6. Appraisers (optional)
|
|
116
|
-
|
|
117
|
-
Ask:
|
|
118
|
-
|
|
119
|
-
> How should appraisers be configured for this artefact type?
|
|
120
|
-
> - How many appraisers per foundry cycle? (default: 3)
|
|
121
|
-
> - Restrict to specific appraiser personalities? (default: all available)
|
|
122
|
-
|
|
123
|
-
If the user specifies preferences, include these fields:
|
|
124
|
-
|
|
125
|
-
- `appraisers.count` (number, optional, default: 3) — how many appraisers per foundry cycle
|
|
126
|
-
- `appraisers.allowed` (string[], optional, default: all available) — whitelist of appraiser personality IDs
|
|
127
|
-
|
|
128
|
-
If the user is happy with the defaults (3 appraisers, any personality), omit the appraisers configuration entirely.
|
|
129
|
-
|
|
130
|
-
List the available appraisers from `foundry/appraisers/*.md` so the user can see their options.
|
|
131
|
-
|
|
132
|
-
### 7. Validate the draft
|
|
133
|
-
|
|
134
|
-
Call `foundry_config_validate_artefact_type({ name: "<id>", body: "<assembled markdown>" })`. Assemble the body from the fields using the frontmatter format the tool produces internally.
|
|
135
|
-
|
|
136
|
-
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.
|
|
73
|
+
- `id` (string) — lowercase, hyphenated identifier. Must be unique across artefact types.
|
|
74
|
+
- `name` (string) — human-readable label.
|
|
75
|
+
- `filePatterns` (string[]) — glob patterns for files this type produces.
|
|
76
|
+
- `description` (string) — prose description of what this artefact type is.
|
|
77
|
+
- `appraisers` ({ count?: number, allowed?: string[] }, optional) — appraiser configuration.
|
|
137
78
|
|
|
138
|
-
|
|
79
|
+
Ask: does this capture the artefact type correctly? Iterate until the user is satisfied.
|
|
139
80
|
|
|
140
|
-
|
|
81
|
+
### 3. Confirm
|
|
141
82
|
|
|
142
|
-
|
|
143
|
-
- writes `foundry/artefacts/<id>/definition.md`;
|
|
144
|
-
- produces one git commit on the current `config/*` branch.
|
|
83
|
+
Ask: "Proceed with this plan?" — wait for user answer before building. If the user rejects the plan, return to the Understand phase and adjust.
|
|
145
84
|
|
|
146
|
-
|
|
85
|
+
### 4. Build
|
|
147
86
|
|
|
148
|
-
|
|
87
|
+
1. **Validate**: Call `foundry_config_validate_artefact_type({ name: "<id>", body: "<assembled markdown>" })`. Assemble the body from the fields using the frontmatter format the tool produces internally. If the result is `{ ok: false, errors: [...] }`, address each error and re-run until `{ ok: true }`. Common issues: missing required frontmatter keys, references to artefact types or flows that do not exist yet.
|
|
149
88
|
|
|
150
|
-
|
|
89
|
+
2. **Create**: Call `foundry_config_create_artefact_type({ id: "<id>", name: "<name>", filePatterns: ["<pattern>"], description: "<description>" })`. The tool re-validates the body (TOCTOU), writes `foundry/artefacts/<id>/definition.md`, and produces one git commit on the current `config/*` branch. Show the user the resulting commit hash.
|
|
151
90
|
|
|
152
|
-
If
|
|
153
|
-
`foundry_config_add_law` (one call per law) with
|
|
154
|
-
`target: { kind: "type-specific", typeId: "<id>" }`. The first call
|
|
155
|
-
creates `foundry/artefacts/<id>/laws.md`; subsequent calls append to
|
|
156
|
-
that same file. Each call produces its own microcommit. See the
|
|
157
|
-
`add-law` skill for the full protocol.
|
|
91
|
+
If the tool returns `{ ok: false, errors }` because the target file already exists, read the existing file, incorporate the user's requested changes into the current body, propose the merged result for review, then write and commit the updated file.
|
|
158
92
|
|
|
159
|
-
|
|
93
|
+
3. **Type-specific laws**: Ask "Define any type-specific laws for this artefact type?" If yes, invoke the `add-law` protocol with context: `{target: {kind: "type-specific", typeId: "<new-type-id>"}}`. The `add-law` skill asks for the missing law fields (id, name, description, passing, failing) and creates the law at `foundry/artefacts/<typeId>/laws.md`.
|
|
160
94
|
|
|
161
|
-
|
|
95
|
+
4. **Appraisers**: Ask "How should appraisers be configured for this artefact type?" Offer the defaults (3 appraisers, any personality) or let the user specify preferences. List the available appraisers from `foundry/appraisers/*.md` so the user can see their options.
|
|
162
96
|
|
|
163
97
|
## What you do NOT do
|
|
164
98
|
|
|
@@ -34,151 +34,83 @@ Do not tell the user to call branch tools directly.
|
|
|
34
34
|
|
|
35
35
|
## Protocol
|
|
36
36
|
|
|
37
|
-
###
|
|
37
|
+
### Context object
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
When invoked with pre-filled fields matching the `foundry_config_create_cycle` tool args, skip questions for provided fields. Missing fields trigger clarifying questions.
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### 2. Gather basics
|
|
44
|
-
|
|
45
|
-
From the user's prompt, establish:
|
|
46
|
-
- `id` — lowercase, hyphenated identifier for the foundry cycle
|
|
47
|
-
- `name` — human-readable name
|
|
48
|
-
- `output-type` — the artefact type this foundry cycle produces (must exist in `foundry/artefacts/`)
|
|
49
|
-
- `inputs` — artefact types this cycle reads, with a contract type:
|
|
50
|
-
- `type`: `any-of` (at least one must exist) or `all-of` (all must exist)
|
|
51
|
-
- `artefacts`: list of artefact type IDs
|
|
52
|
-
- May be empty for starting cycles
|
|
53
|
-
- `targets` — cycle(s) to route to after this cycle completes (may be empty for terminal cycles)
|
|
54
|
-
- A prose description of what this foundry cycle does
|
|
41
|
+
Context fields: `{id, name, outputType, description, inputs?, targets?, humanAppraise?, deadlockAppraise?, deadlockIterations?, maxIterations?, assay?, memory?, models?}`
|
|
55
42
|
|
|
56
|
-
|
|
43
|
+
When invoked with a context:
|
|
44
|
+
- If all required fields are present, skip the Understand phase and proceed to Plan → Confirm → Build.
|
|
45
|
+
- If only some fields are present, ask only for the missing ones.
|
|
57
46
|
|
|
58
|
-
###
|
|
47
|
+
### 1. Understand
|
|
59
48
|
|
|
60
|
-
|
|
49
|
+
**Identify the flow**: From the user's prompt, identify which foundry flow this cycle belongs to. If not specified, list available flows from `foundry/flows/` and ask.
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
>
|
|
64
|
-
> For each stage, specify a model ID (e.g., `openai/gpt-4o`) or leave blank to use the session's default model:
|
|
65
|
-
> - forge: ___
|
|
66
|
-
> - quench: ___
|
|
67
|
-
> - appraise: ___
|
|
68
|
-
|
|
69
|
-
Only stages with an explicitly specified model are included in the `models` frontmatter map.
|
|
51
|
+
If the parent flow or required artefact type is missing and the user's goal clearly requires it, create that dependency first. If multiple designs are plausible, ask one focused question before creating it.
|
|
70
52
|
|
|
71
|
-
|
|
53
|
+
**Required fields** — Gather each required field one question at a time:
|
|
54
|
+
- `id` — lowercase, hyphenated identifier for the cycle
|
|
55
|
+
- `name` — human-readable name
|
|
56
|
+
- `outputType` — the artefact type this cycle produces. List existing artefact types from `foundry/artefacts/*/definition.md` as multiple-choice options.
|
|
57
|
+
- `description` — prose description of what this cycle does
|
|
72
58
|
|
|
73
|
-
|
|
59
|
+
**Id conflict check**: Read all existing cycle definitions in `foundry/cycles/*.md`. An exact id match is a hard conflict — choose a different id.
|
|
74
60
|
|
|
75
|
-
|
|
61
|
+
**Output-type conflict check**: Read the flow definition from `foundry/flows/<flow-id>.md`. Check that no cycle in the flow already outputs the same artefact type. Two cycles producing the same type in one flow is a conflict — the file modification enforcement cannot distinguish which cycle owns the files. If a conflict exists, present it:
|
|
76
62
|
|
|
77
|
-
>
|
|
78
|
-
>
|
|
79
|
-
> 1. `human-appraise` — should a human review the artefact every iteration? Default: no.
|
|
80
|
-
> 2. `deadlock-appraise` — should a human be pulled in only when LLM appraisers deadlock? Default: yes.
|
|
81
|
-
> 3. `deadlock-iterations` — the deadlock threshold (default: 5). Only applies when `deadlock-appraise` or `human-appraise` is enabled.
|
|
63
|
+
> A cycle `<existing-id>` already produces `<outputType>` in this flow. Two cycles producing the same artefact type creates a conflict.
|
|
82
64
|
>
|
|
83
|
-
>
|
|
84
|
-
>
|
|
85
|
-
>
|
|
86
|
-
|
|
87
|
-
### 5. Validate artefact types
|
|
88
|
-
|
|
89
|
-
For `output-type` and each entry in `inputs`, verify the artefact type exists in `foundry/artefacts/<type>/definition.md`.
|
|
90
|
-
|
|
91
|
-
If a required artefact type is missing and the user's goal clearly requires it, create that dependency first. If the file pattern or type design cannot be inferred safely, ask one focused question before creating it.
|
|
92
|
-
|
|
93
|
-
### 6. Validate against the foundry flow
|
|
94
|
-
|
|
95
|
-
Read the flow definition from `foundry/flows/<flow-id>.md`. Check:
|
|
65
|
+
> Options:
|
|
66
|
+
> 1. Choose a different `outputType`
|
|
67
|
+
> 2. Choose a different flow
|
|
68
|
+
> 3. Proceed anyway if the types are intentionally distinct
|
|
96
69
|
|
|
97
|
-
|
|
98
|
-
- Each `input` artefact type is produced by some cycle that can run before this one according to the flow's `targets` graph (a reachable predecessor). If an input references an artefact type that no reachable predecessor outputs, warn:
|
|
70
|
+
**Input reachability check**: For each input artefact type, verify that a reachable predecessor in the flow's `targets` graph produces it. If an input references a type that no reachable predecessor outputs, warn:
|
|
99
71
|
|
|
100
|
-
> Input `<type>` is not produced by any reachable predecessor of this
|
|
72
|
+
> Input `<type>` is not produced by any reachable predecessor of this cycle in the flow's `targets` graph. The artefact will not exist when this cycle runs.
|
|
101
73
|
>
|
|
102
74
|
> Options:
|
|
103
|
-
> 1. Add a
|
|
104
|
-
> 2. Remove `<type>` from inputs (this
|
|
105
|
-
> 3. Proceed anyway (the artefact may exist from a previous
|
|
106
|
-
|
|
107
|
-
### 7. Check for id conflicts
|
|
108
|
-
|
|
109
|
-
Read all existing cycle definitions in `foundry/cycles/*.md`.
|
|
110
|
-
|
|
111
|
-
- Exact id match → hard conflict, must choose a different id
|
|
112
|
-
|
|
113
|
-
### 8. Check for semantic overlap
|
|
114
|
-
|
|
115
|
-
For foundry cycles already in this foundry flow, check whether the new foundry cycle overlaps in purpose:
|
|
116
|
-
- Does another foundry cycle already transform the same inputs into a similar output?
|
|
117
|
-
- Would the new foundry cycle's description make sense as a revision of an existing foundry cycle rather than a new one?
|
|
118
|
-
|
|
119
|
-
If overlap is found, present it and ask the user to confirm the distinction is real.
|
|
120
|
-
|
|
121
|
-
### 9. Draft the definition
|
|
122
|
-
|
|
123
|
-
Present the foundry cycle definition to the user with these structured fields:
|
|
124
|
-
|
|
125
|
-
- `id` (string) — lowercase, hyphenated identifier
|
|
126
|
-
- `name` (string) — human-readable name
|
|
127
|
-
- `outputType` (string) — the artefact type this cycle produces (must exist in `foundry/artefacts/`)
|
|
128
|
-
- `description` (string) — prose description of what this cycle does
|
|
129
|
-
- `inputs` (object, optional) — input contract. Shape: `{ type: "any-of" | "all-of", artefacts: string[] }`. May be omitted for starting cycles.
|
|
130
|
-
- `targets` (string[], optional) — cycle IDs to route to after completion. May be omitted for terminal cycles.
|
|
131
|
-
- `humanAppraise` (boolean, optional, default: false) — whether a human reviews the artefact every iteration
|
|
132
|
-
- `deadlockAppraise` (boolean, optional, default: true) — whether a human is pulled in when LLM appraisers deadlock
|
|
133
|
-
- `deadlockIterations` (number, optional, default: 5) — deadlock threshold
|
|
134
|
-
- `maxIterations` (number, optional) — maximum iterations before forced progression
|
|
135
|
-
- `assay` (object, optional) — assay configuration
|
|
136
|
-
- `memory` (object, optional) — memory configuration
|
|
137
|
-
- `models` (object, optional) — stage-specific model overrides, e.g. `{ appraise: "openai/gpt-4o" }`
|
|
138
|
-
|
|
139
|
-
Ask: does this capture the foundry cycle correctly?
|
|
140
|
-
|
|
141
|
-
### 10. Validate target routing
|
|
142
|
-
|
|
143
|
-
For each target cycle:
|
|
144
|
-
- Verify the target cycle exists in `foundry/cycles/`
|
|
145
|
-
- Verify this cycle's output type satisfies at least one of the target's input artefacts
|
|
146
|
-
- If the target doesn't exist yet, note it as pending
|
|
75
|
+
> 1. Add a cycle that produces `<type>` and route to this cycle via `targets`
|
|
76
|
+
> 2. Remove `<type>` from inputs (this cycle will not have that context)
|
|
77
|
+
> 3. Proceed anyway (the artefact may exist from a previous flow run)
|
|
147
78
|
|
|
148
|
-
For input
|
|
149
|
-
- Verify that at least one cycle in the flow has the input artefact type(s) as its output
|
|
150
|
-
- If using `all-of`, verify all input types are producible
|
|
79
|
+
**Validate target routing**: For each target cycle, verify the target exists in `foundry/cycles/` and that this cycle's output type satisfies at least one of the target's input artefacts. If a target does not exist yet, note it as pending.
|
|
151
80
|
|
|
152
|
-
|
|
81
|
+
**Optional clusters** — After each cluster, ask whether the user wants to configure it; if not, skip:
|
|
153
82
|
|
|
154
|
-
|
|
83
|
+
- **Routing**: `inputs` (input contract: `{type: "any-of"|"all-of", artefacts: string[]}`), `targets` (cycle IDs to route to after completion), `maxIterations` (maximum iterations before forced progression)
|
|
84
|
+
- **Human-appraise**: `humanAppraise` (boolean, default false) — human reviews every iteration; `deadlockAppraise` (boolean, default true) — human is pulled in when LLM appraisers deadlock; `deadlockIterations` (number, default 5) — deadlock threshold. Only applies when either appraise is enabled.
|
|
85
|
+
- **Memory and models**: `assay` (assay configuration), `memory` (memory configuration), `models` (stage-specific model overrides, e.g. `{forge: "openai/gpt-4o", appraise: "openai/gpt-4o"}`). For models, offer each stage (forge, quench, appraise) individually. If the user has no preference, omit the `models` map and use the session defaults.
|
|
155
86
|
|
|
156
|
-
|
|
87
|
+
### 2. Plan
|
|
157
88
|
|
|
158
|
-
|
|
89
|
+
Present a structured summary of the cycle definition: id, name, outputType, description, and any configured optional fields (inputs, targets, humanAppraise, deadlockAppraise, deadlockIterations, maxIterations, assay, memory, models). Include only fields that have values.
|
|
159
90
|
|
|
160
|
-
|
|
91
|
+
Ask: "Does this capture the cycle correctly?" Iterate until the user is satisfied.
|
|
161
92
|
|
|
162
|
-
|
|
163
|
-
- writes `foundry/cycles/<id>.md`;
|
|
164
|
-
- produces one git commit on the current `config/*` branch.
|
|
93
|
+
### 3. Confirm
|
|
165
94
|
|
|
166
|
-
|
|
95
|
+
Ask: "Proceed with this plan?" — wait for user answer before building. If the user rejects the plan, return to the Understand phase and adjust.
|
|
167
96
|
|
|
168
|
-
|
|
97
|
+
### 4. Build
|
|
169
98
|
|
|
170
|
-
|
|
99
|
+
1. **Validate**: Call `foundry_config_validate_cycle({ name: "<id>", body: "<assembled markdown>" })`. Assemble the body from the fields using the frontmatter format the tool produces internally. If the result is `{ ok: false, errors: [...] }`, address each error and re-run until `{ ok: true }`. Common issues: missing required frontmatter keys, references to artefact types or flows that do not exist yet.
|
|
171
100
|
|
|
172
|
-
`foundry_config_create_cycle
|
|
101
|
+
2. **Create**: Call `foundry_config_create_cycle({ id: "<id>", name: "<name>", outputType: "<type>", description: "<description>", inputs: ..., targets: ..., humanAppraise: ..., deadlockAppraise: ..., deadlockIterations: ..., maxIterations: ..., assay: ..., memory: ..., models: ... })`. The tool:
|
|
102
|
+
- re-validates the body (TOCTOU);
|
|
103
|
+
- writes `foundry/cycles/<id>.md`;
|
|
104
|
+
- produces one git commit on the current `config/*` branch.
|
|
173
105
|
|
|
174
|
-
|
|
106
|
+
If the tool returns `{ ok: false, errors }` because the target file already exists, read the existing cycle file, apply any necessary updates, write it back, and commit on this `config/*` branch.
|
|
175
107
|
|
|
176
|
-
|
|
108
|
+
3. **Add to flow cycle list**: `foundry_config_create_cycle` writes the cycle file only. The cycle still needs to appear in the parent flow's `## Cycles` list. Read the existing flow file from `foundry/flows/<flow-id>.md`. Add the new cycle id under `## Cycles` if not already present. Write the updated file back and commit on this same `config/*` branch.
|
|
177
109
|
|
|
178
|
-
Show the user the cycle file, the updated flow file, and both commit hashes.
|
|
110
|
+
4. Show the user the cycle file, the updated flow file, and both commit hashes.
|
|
179
111
|
|
|
180
112
|
## What you do NOT do
|
|
181
113
|
|
|
182
|
-
- You do not create
|
|
114
|
+
- You do not create cycles that output an artefact type already produced by another cycle in the same flow
|
|
183
115
|
- You do not skip artefact type validation
|
|
184
116
|
- You do not create dependencies (artefact types, flows) unless the user's stated goal clearly requires them; ask one focused question when multiple designs are plausible
|