@really-knows-ai/foundry 3.3.3 → 3.3.6

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.
@@ -152,29 +152,13 @@ function resolveGuideSource(packageRoot) {
152
152
  return path.join(packageRoot, 'src', 'agents', 'foundry.md');
153
153
  }
154
154
 
155
- /**
156
- * Copy the Foundry guide agent (foundry.md) from the installed package
157
- * to the project's .opencode/agents/ directory.
158
- *
159
- * Resolves the source from `packageRoot/dist/agents/foundry.md` and
160
- * falls back to `packageRoot/src/agents/foundry.md` when the dist
161
- * path does not exist. Skips writing when the target file already
162
- * exists (uses existsSync check).
163
- *
164
- * @param {string} worktree - Absolute path to the project worktree root.
165
- * @param {string} packageRoot - Absolute path to the installed package root.
166
- * @returns {{ ok: true, written: boolean } | { ok: false, error: string }}
167
- */
168
155
  export function writeFoundryGuideAgent(worktree, packageRoot) {
169
156
  const targetDir = path.join(worktree, '.opencode', 'agents');
170
157
  const targetPath = path.join(targetDir, 'foundry.md');
171
158
 
172
- if (existsSync(targetPath)) {
173
- return { ok: true, written: false };
174
- }
159
+ if (existsSync(targetPath)) return { ok: true, written: false };
175
160
 
176
161
  const sourcePath = resolveGuideSource(packageRoot);
177
-
178
162
  try {
179
163
  const content = readFileSync(sourcePath, 'utf8');
180
164
  mkdirSync(targetDir, { recursive: true });
@@ -184,3 +168,4 @@ export function writeFoundryGuideAgent(worktree, packageRoot) {
184
168
  return { ok: false, error: `Failed to write guide agent: ${err.message ?? String(err)}` };
185
169
  }
186
170
  }
171
+
@@ -218,6 +218,9 @@ export const FoundryPlugin = async ({ directory }) => {
218
218
  config.skills.paths.push(allSkillsDir);
219
219
  }
220
220
 
221
+ // Always ensure guide agent is up to date
222
+ ensureGuideAgent(directory, packageRoot);
223
+
221
224
  restartNeeded = runPluginBootstrap(directory, packageRoot);
222
225
  },
223
226
 
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.3.6] - 2026-05-18
4
+
5
+ ### Fixed
6
+
7
+ - **Foundry skills reference in agent.** The Foundry agent now lists all 27
8
+ skills in an "Available Skills" table with their purposes and instructions
9
+ on how to load them via the `skill` tool. The LLM can call
10
+ `skill({name: "add-flow"})` etc. without needing them listed in the
11
+ system prompt's `available_skills` section.
12
+
13
+ ## [3.3.4] - 2026-05-18
14
+
15
+ ### Fixed
16
+
17
+ - **Corrected law/validator framing across all skills and agent.** Laws are
18
+ rules — they are never "deterministic" or "subjective." Validators are
19
+ optional scripts attached to laws that check script-checkable elements
20
+ during quench. Appraisers evaluate every law, de-prioritising elements
21
+ already covered by passed validators. Removed all `[deterministic|subjective]`
22
+ law labelling from add-flow's plan template and add-law's Understand phase.
23
+
3
24
  ## [3.3.3] - 2026-05-15
4
25
 
5
26
  ### Fixed
@@ -9,7 +9,7 @@ Foundry is a framework for governed AI artefact generation. Your role is to help
9
9
  ## Operating Principles
10
10
 
11
11
  - Treat user requests as goals to satisfy through the wizard protocol.
12
- - Load the relevant authoring skill before creating or editing any configuration.
12
+ - Call the `skill` tool to load the relevant authoring skill before creating or editing any configuration.
13
13
  - Use Foundry skills and tools internally.
14
14
  - Keep tool names, JSON arguments, and tool-call syntax out of normal user-facing instructions.
15
15
  - Handle config branches, validation, commits, and dependency ordering when safe.
@@ -17,9 +17,53 @@ Foundry is a framework for governed AI artefact generation. Your role is to help
17
17
  - Only create configuration during the Build phase, after the user confirms the plan.
18
18
  - Report outcomes as Foundry concepts, files created or updated, validations run, and commits made.
19
19
 
20
+ ## Foundry Concepts
21
+
22
+ - **Artefact type** — the kind of file a flow produces (e.g. a haiku poem, a blog post, a code review). Defined by file patterns and appraiser configuration.
23
+ - **Law** — a single rule that artefacts of a given type must satisfy. Laws cover both objective criteria (line count, syllable count, forbidden words) and subjective criteria (imagery quality, emotional resonance, persuasiveness). Every law is appraised by appraisers — laws are not inherently deterministic.
24
+ - **Validator** — an optional script attached to a law. Runs during quench to check script-checkable elements without an LLM. Outputs NDJSON with file/text per violation. Since quench always runs before appraise, validators that pass mean those elements are already verified. A law may have zero, one, or multiple validators. Appraisers are aware of which elements a validator covers so they can de-prioritise them, focusing their judgment on elements without deterministic checks.
25
+ - **Appraiser** — a personality or perspective that reads all laws for an artefact type and judges artefacts against them. Appraisers evaluate every law — they note which elements were covered by validators (and thus passed deterministically) and focus their judgment on the remaining elements.
26
+ - **Cycle** — a pipeline stage (assay → forge → quench → appraise → human-appraise) that produces artefacts of one type.
27
+ - **Flow** — ties cycles together. Defines which cycles start the pipeline.
28
+
29
+ When discussing laws with the user, say they are "rules" or "criteria." Present which elements can be script-checked (with validators) and which elements require the appraiser's judgment. Never label a law itself as "deterministic" or "subjective."
30
+
31
+ ## Available Skills
32
+
33
+ All skills are registered by the Foundry plugin and loadable via `skill({name: "<name>"})`. Load the relevant skill before creating or editing configuration, or when a user task matches a skill's purpose.
34
+
35
+ | Skill | Use when |
36
+ |-------|----------|
37
+ | `add-flow` | Creating a complete flow from scratch — asks about artefacts, laws, appraisers, cycles |
38
+ | `add-artefact-type` | Defining a new artefact type with file patterns and appraiser config |
39
+ | `add-appraiser` | Creating a new appraiser personality |
40
+ | `add-law` | Defining a law with passing/failing criteria and optional validators |
41
+ | `add-cycle` | Creating a cycle within an existing flow |
42
+ | `add-extractor` | Registering a memory extractor CLI that emits JSONL |
43
+ | `add-memory-entity-type` | Declaring a new entity type in flow memory |
44
+ | `add-memory-edge-type` | Declaring a new edge type between entity types |
45
+ | `init-memory` | Scaffolding the flow memory directory structure |
46
+ | `rename-memory-entity-type` | Renaming an entity type and migrating edges |
47
+ | `rename-memory-edge-type` | Renaming an edge type |
48
+ | `change-embedding-model` | Switching the embedding model and re-embedding entities |
49
+ | `reset-memory` | Purging all memory data while keeping type definitions |
50
+ | `drop-memory-entity-type` | Deleting an entity type and cascading to edges |
51
+ | `drop-memory-edge-type` | Deleting an edge type and all its rows |
52
+ | `orchestrate` | Running a foundry cycle by calling `foundry_orchestrate` in a loop |
53
+ | `flow` | Running a defined flow — pass the user's request as the goal |
54
+ | `forge` | Producing or revising an artefact during a cycle |
55
+ | `quench` | Running deterministic validators on an artefact |
56
+ | `appraise` | Subjectively evaluating an artefact against laws via appraisers |
57
+ | `human-appraise` | Presenting the artefact to the human for review |
58
+ | `assay` | Populating flow memory by running extractor scripts |
59
+ | `dry-run` | Trial-running a flow on a dry-run branch |
60
+ | `upgrade-foundry` | Rebuilding configuration for the current plugin version |
61
+ | `list-agents` | Listing available foundry-* sub-agents |
62
+ | `refresh-agents` | Regenerating foundry-* agent files after model changes |
63
+
20
64
  ## Authoring Posture
21
65
 
22
- When the user asks to create or change a flow, load the relevant authoring skill first (`add-flow`, `add-artefact-type`, `add-appraiser`, `add-law`, `add-cycle`, or the memory authoring skills). Each skill follows a wizard protocol: Understand → Plan → Confirm → Build. Follow the skill's instructions — they guide you through asking questions, presenting a plan, waiting for confirmation, and only then building.
66
+ When the user asks to create or change a flow, call the `skill` tool to load the relevant authoring skill (`add-flow`, `add-artefact-type`, `add-appraiser`, `add-law`, `add-cycle`, or the memory authoring skills). These skills are registered by the Foundry plugin and are always available even if not listed in `available_skills`. Each skill follows a wizard protocol: Understand → Plan → Confirm → Build. Follow the skill's instructions — they guide you through asking questions, presenting a plan, waiting for confirmation, and only then building.
23
67
 
24
68
  Never create configuration without user confirmation of the plan. When the user asks "create a flow that makes haikus," do not auto-build — walk them through the wizard. Ask questions one at a time. Present a summary plan. Ask "Proceed?" before calling any creation tool.
25
69
 
@@ -45,7 +45,7 @@ Extract or ask for the flow purpose, expected final artefact, output location, a
45
45
 
46
46
  **What the flow produces**: Ask about the artefact type the flow should produce. Determine whether it needs a new artefact type or whether an existing one fits.
47
47
 
48
- **Quality constraints**: Ask about the laws that govern quality. For each law: what it checks, whether it applies globally or to a specific artefact type, and the deterministic-vs-subjective split.
48
+ **Quality constraints**: Ask about the laws that govern quality. For each law: what it checks, whether it applies globally or to a specific artefact type, and which elements can be checked with validators.
49
49
 
50
50
  **Appraisers**: Ask about the appraisers that evaluate quality. Determine how many are needed and whether existing appraisers fit or new ones are needed.
51
51
 
@@ -65,7 +65,7 @@ Create missing dependencies in validation order:
65
65
 
66
66
  1. **Artefact types** (no sub-dependencies): For each new artefact type, gather `id`, `name`, `filePatterns`, `description`, and whether it needs type-specific laws or appraiser configuration. Context object: `{id, name, filePatterns, description, appraisers?}`.
67
67
 
68
- 2. **Laws** (may reference artefact types): For each new law, gather `id`, `name`, `description`, `passing`, `failing`, the target (global file or type-specific with `typeId`), and the deterministic-vs-subjective split. Determine whether validators are needed. Context object: `{id, name, description, passing, failing, target: {kind, file|typeId}, validators?}`.
68
+ 2. **Laws** (may reference artefact types): For each new law, gather `id`, `name`, `description`, `passing`, `failing`, the target (global file or type-specific with `typeId`), and which elements can be checked with validators. Determine whether validators are needed. Context object: `{id, name, description, passing, failing, target: {kind, file|typeId}, validators?}`.
69
69
 
70
70
  3. **Appraisers** (may reference models): For each new appraiser, gather `id`, `name`, `description`, and optional `model` preference. Context object: `{id, name, description, model?}`.
71
71
 
@@ -86,8 +86,8 @@ Flow: <id> — <name>
86
86
  Artefact Types:
87
87
  · <id> (<name>) — <filePatterns>
88
88
  Laws:
89
- · <id> — <description> [deterministic|subjective]
90
- validators: <validator-id> (if deterministic)
89
+ · <id> — <description>
90
+ validators: <validator-id> (if any)
91
91
  Appraisers:
92
92
  · <id> — <description>
93
93
  Cycles:
@@ -53,20 +53,20 @@ If global, ask for the `file` (the filename under `foundry/laws/`, e.g. `rules.m
53
53
 
54
54
  **Fields**: Ask for `id`, `name`, `description`, `passing` criteria, and `failing` criteria one at a time.
55
55
 
56
- **Deterministic vs subjective split**: For each law, explicitly split what it checks into two categories:
56
+ **Validators**: For each law, identify which elements can be validated deterministically:
57
57
 
58
- - **Deterministic** — can be checked by a script without human or LLM judgment. Examples: line count, syllable count, word minimum, forbidden patterns, file existence, formatting rules. These become `validators:` entries in the law.
59
- - **Subjective** — requires judgment. Examples: imagery quality, emotional resonance, persuasiveness, aesthetic appeal, clarity of argument. The appraisers evaluate these during the appraise stage. No validator entry needed; the law's prose alone guides the appraiser.
58
+ - **Script-checkable** — can be checked by a validator without human or LLM judgment. Examples: line count, syllable count, word minimum, forbidden patterns, file existence, formatting rules. These become `validators:` entries in the law. Since quench runs before appraise, validators that pass mean those elements are already verified — the appraiser is aware of this and can de-prioritise them, focusing judgment on elements without validators.
59
+ - **Requires judgment** — needs the appraiser's evaluation. Examples: imagery quality, emotional resonance, persuasiveness, aesthetic appeal, clarity of argument. The law's prose alone guides the appraiser no validator entry needed.
60
60
 
61
- Walk the user through this split for each law:
61
+ Walk the user through which elements of the law can be validated deterministically:
62
62
 
63
- > This law covers [summary]. Here's what's deterministic vs subjective:
64
- > - Deterministic: [list elements that can be script-checked]
65
- > - Subjective: [list elements requiring judgment — appraisers handle these]
63
+ > This law covers [summary]. Here's which parts can be checked with validators:
64
+ > - Validatable: [list elements that can be script-checked]
65
+ > - Requires judgment: [list elements the appraiser evaluates]
66
66
  >
67
- > Shall I add validators for the deterministic elements?
67
+ > Shall I add validators for the script-checkable elements?
68
68
 
69
- For each deterministic element, write a standalone `.mjs` script next to the artefacts it validates (e.g. `foundry/artefacts/<type>/check-line-count.mjs`) and reference it in the command (e.g. `node foundry/artefacts/<type>/check-line-count.mjs {files}`). Place validators alongside the artefacts so they colocate with what they validate. Prefer Node.js built-ins and libraries already in the project; hand-rolled heuristics are fragile — use available packages instead of writing custom validation logic from scratch.
69
+ For each script-checkable element, write a standalone `.mjs` script next to the artefacts it validates (e.g. `foundry/artefacts/<type>/check-line-count.mjs`) and reference it in the command (e.g. `node foundry/artefacts/<type>/check-line-count.mjs {files}`). Place validators alongside the artefacts so they colocate with what they validate. Prefer Node.js built-ins and libraries already in the project; hand-rolled heuristics are fragile — use available packages instead of writing custom validation logic from scratch.
70
70
 
71
71
  **Validators**: Ask about `validators` (optional) — offer to create one or skip.
72
72
 
@@ -85,7 +85,7 @@ For each deterministic element, write a standalone `.mjs` script next to the art
85
85
 
86
86
  ### 2. Plan
87
87
 
88
- Present a structured summary: law id, name, description, passing/failing criteria, target (global or type-specific with typeId), deterministic/subjective split, validators. Ask: "Does this capture what you want, or should we adjust the wording?" Iterate until the user is satisfied.
88
+ Present a structured summary: law id, name, description, passing/failing criteria, target (global or type-specific with typeId), and validators (which elements are checked deterministically). Ask: "Does this capture what you want, or should we adjust the wording?" Iterate until the user is satisfied.
89
89
 
90
90
  ### 3. Confirm
91
91
 
@@ -164,6 +164,6 @@ When reviewing an artefact, check the feedback history for `#human` tagged items
164
164
 
165
165
  - You do not write files — feedback output goes through `foundry_feedback_add` and `foundry_feedback_resolve`.
166
166
  - You do not revise the artefact.
167
- - You do not check deterministic rules — that is the quench skill's job.
167
+ - You do not run deterministic validators — that is the quench skill's job.
168
168
  - You do not filter out feedback because only one appraiser raised it — one is enough.
169
169
  - You do not register artefacts — that happens automatically via the orchestrator's internal finalize step.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@really-knows-ai/foundry",
3
- "version": "3.3.3",
3
+ "version": "3.3.6",
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",