@really-knows-ai/foundry 3.2.4 → 3.2.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.
- package/README.md +20 -23
- package/dist/.opencode/plugins/foundry-tools/helpers.js +12 -6
- package/dist/.opencode/plugins/foundry.js +1 -41
- package/dist/CHANGELOG.md +26 -0
- package/dist/README.md +20 -23
- package/dist/docs/getting-started.md +18 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,9 +103,18 @@ Add the plugin to `opencode.json`:
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Restart OpenCode so the plugin registers
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
Restart OpenCode so the plugin registers. On startup, Foundry bootstraps the
|
|
107
|
+
directory structure, generates stage agents, and installs the Foundry guide
|
|
108
|
+
agent automatically.
|
|
109
|
+
|
|
110
|
+
After restart, type **hello foundry**. The assistant will tell you whether a
|
|
111
|
+
further restart is needed and when to switch to the Foundry agent.
|
|
112
|
+
|
|
113
|
+
Optionally, to make the package available to your project's local `node_modules`:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
pnpm add -D @really-knows-ai/foundry
|
|
117
|
+
```
|
|
109
118
|
|
|
110
119
|
---
|
|
111
120
|
|
|
@@ -121,29 +130,17 @@ The upgrade process asks clarifying questions for ambiguous routing, input contr
|
|
|
121
130
|
|
|
122
131
|
### Phase 1 — Install
|
|
123
132
|
|
|
124
|
-
Add the plugin to `opencode.json` (see Install section above)
|
|
125
|
-
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
"$schema": "https://opencode.ai/config.json",
|
|
129
|
-
"plugin": ["@really-knows-ai/foundry"]
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Then restart OpenCode so the plugin registers its tools and skills. You will see new
|
|
134
|
-
tools and skills become available in OpenCode's command palette once the restart
|
|
135
|
-
completes. Flow-management tools are now ready to use.
|
|
133
|
+
Add the plugin to `opencode.json` (see Install section above), then restart
|
|
134
|
+
OpenCode.
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
Type **hello foundry**. The assistant will guide you through any remaining
|
|
137
|
+
setup. If Foundry was just initialised, it will ask you to restart and switch
|
|
138
|
+
to the **Foundry** agent. If Foundry is already set up, it will tell you to
|
|
139
|
+
switch to the Foundry agent directly.
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
a decision tree: if `foundry/` is missing or its VERSION does not match the
|
|
141
|
-
installed plugin version, it bootstraps the directory structure, generates
|
|
142
|
-
`foundry-<model>` stage agent files, installs the user-facing `Foundry` guide
|
|
143
|
-
agent, and tells you to restart again.
|
|
141
|
+
### Phase 2 — Switch to the Foundry agent
|
|
144
142
|
|
|
145
|
-
|
|
146
|
-
switch to the **Foundry** agent. The Foundry agent is the normal interface for
|
|
143
|
+
Switch to the **Foundry** agent. The Foundry agent is the normal interface for
|
|
147
144
|
authoring and running Foundry workflows.
|
|
148
145
|
|
|
149
146
|
### Phase 3 — Ask the Foundry agent for a flow
|
|
@@ -92,9 +92,11 @@ export function listFlows(foundryDir) {
|
|
|
92
92
|
|
|
93
93
|
function buildFoundryNotInitializedMessage() {
|
|
94
94
|
return `<FOUNDRY_CONTEXT>
|
|
95
|
-
Foundry is installed but not initialised in this project
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
Foundry is installed but not yet initialised in this project — there is no foundry/ directory.
|
|
96
|
+
The plugin will bootstrap the directory structure, generate stage agents, and install the
|
|
97
|
+
Foundry guide agent automatically on the next startup. The user may just need to restart
|
|
98
|
+
OpenCode for this to happen. Once initialised, direct the user to restart again so the new
|
|
99
|
+
agents register, then switch to the Foundry agent.
|
|
98
100
|
</FOUNDRY_CONTEXT>`;
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -110,8 +112,9 @@ function buildFlowList(flows) {
|
|
|
110
112
|
|
|
111
113
|
function buildFoundryInitializedMessage(flowList, packageRoot) {
|
|
112
114
|
return `<FOUNDRY_CONTEXT>
|
|
113
|
-
Foundry is active in this project. The foundry/ directory contains the project's artefact
|
|
114
|
-
laws, appraisers, cycles, and flows.
|
|
115
|
+
Foundry is active in this project. The foundry/ directory contains the project's artefact
|
|
116
|
+
definitions, laws, appraisers, cycles, and flows. The user should switch to the Foundry agent
|
|
117
|
+
to author and run workflows.
|
|
115
118
|
|
|
116
119
|
Foundry is a skill-driven framework for governed artefact generation and evaluation.
|
|
117
120
|
The pipeline: assay (populate memory) → forge (produce) → quench (deterministic checks) → appraise (subjective evaluation) → human-appraise (human review) → iterate.
|
|
@@ -142,7 +145,10 @@ Scripts are located at: ${path.join(packageRoot, 'scripts')}
|
|
|
142
145
|
export function getBootstrapContent(directory, packageRoot, restartNeeded = false) {
|
|
143
146
|
if (restartNeeded) {
|
|
144
147
|
return `<FOUNDRY_CONTEXT>
|
|
145
|
-
Foundry
|
|
148
|
+
Foundry has just been initialised in this project. The directory structure, stage agent files,
|
|
149
|
+
and Foundry guide agent have all been created. Tell the user to restart OpenCode now so the new
|
|
150
|
+
agents register. After restarting, the user should switch to the Foundry agent to author and
|
|
151
|
+
run workflows.
|
|
146
152
|
</FOUNDRY_CONTEXT>`;
|
|
147
153
|
}
|
|
148
154
|
|
|
@@ -153,44 +153,6 @@ function runPluginBootstrap(worktree, pkgRoot) {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
-
const defaultSleep = ms => new Promise(resolve => { setTimeout(resolve, ms); });
|
|
157
|
-
|
|
158
|
-
function resolveOpt(opts, key, fallback) {
|
|
159
|
-
return (opts && opts[key] !== undefined) ? opts[key] : fallback;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const STARTUP_MSG_MAX_MS = 3000;
|
|
163
|
-
|
|
164
|
-
async function retryUntilReady(fn, opts) {
|
|
165
|
-
const sleep = resolveOpt(opts, 'sleep', defaultSleep);
|
|
166
|
-
const now = resolveOpt(opts, 'now', Date.now);
|
|
167
|
-
const maxMs = resolveOpt(opts, 'maxMs', STARTUP_MSG_MAX_MS);
|
|
168
|
-
const deadline = now() + maxMs;
|
|
169
|
-
while (now() < deadline) {
|
|
170
|
-
try {
|
|
171
|
-
await fn();
|
|
172
|
-
return;
|
|
173
|
-
} catch {
|
|
174
|
-
await sleep(500);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
async function showStartupMessage(needsRestart, directory, client, timerFns) {
|
|
180
|
-
if (!client) return;
|
|
181
|
-
if (needsRestart) {
|
|
182
|
-
await retryUntilReady(() => client.tui.appendPrompt({
|
|
183
|
-
body: { text: 'Foundry initialised. Restart OpenCode so the Foundry agent registers, then switch to it to author and run workflows.' },
|
|
184
|
-
}), timerFns);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (existsSync(path.join(directory, 'foundry'))) {
|
|
188
|
-
await retryUntilReady(() => client.tui.showToast({
|
|
189
|
-
body: { message: 'Foundry is active', variant: 'info' },
|
|
190
|
-
}), timerFns);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
156
|
export { buildCyclePromptExtras } from './foundry-tools/helpers.js';
|
|
195
157
|
|
|
196
158
|
function buildTools(createTool, pending) {
|
|
@@ -227,7 +189,7 @@ function getFirstUserWithParts(output) {
|
|
|
227
189
|
return firstUser;
|
|
228
190
|
}
|
|
229
191
|
|
|
230
|
-
export const FoundryPlugin = async ({ directory
|
|
192
|
+
export const FoundryPlugin = async ({ directory }) => {
|
|
231
193
|
// Pending store is per-plugin-instance (shared across all tool invocations).
|
|
232
194
|
const pending = createPendingStore();
|
|
233
195
|
|
|
@@ -242,8 +204,6 @@ export const FoundryPlugin = async ({ directory, client }) => {
|
|
|
242
204
|
}
|
|
243
205
|
|
|
244
206
|
restartNeeded = runPluginBootstrap(directory, packageRoot);
|
|
245
|
-
// Fire-and-forget: don't block startup. messages.transform is the fallback.
|
|
246
|
-
showStartupMessage(restartNeeded, directory, client);
|
|
247
207
|
},
|
|
248
208
|
|
|
249
209
|
'experimental.chat.messages.transform': async (_input, output) => {
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.2.6] - 2026-05-14
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **Bootstrap context messages confused the AI.** The injected `FOUNDRY_CONTEXT`
|
|
8
|
+
messages were written as direct user instructions ("Restart OpenCode..."),
|
|
9
|
+
but the AI reads them as system context and interprets them as commands to
|
|
10
|
+
itself. Rewritten as AI-facing framing: "Tell the user to restart...",
|
|
11
|
+
"The user should switch to the Foundry agent...".
|
|
12
|
+
|
|
13
|
+
## [3.2.5] - 2026-05-14
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **Startup flow simplified to "hello foundry".** Removed the TUI client
|
|
18
|
+
retry approach for startup messages. Users now type **hello foundry**
|
|
19
|
+
after restarting; the AI reads the injected `FOUNDRY_CONTEXT` and responds
|
|
20
|
+
with restart instructions or readiness confirmation. This replaces the
|
|
21
|
+
silent double-restart dance.
|
|
22
|
+
- **E2E tests no longer depend on Python or `dd`.** The SIGTERM trap test
|
|
23
|
+
now uses shell builtins (`trap`/`echo`/`while`). The output cap tests use
|
|
24
|
+
small Node.js scripts instead of `dd` piped to `tr`. Tests are faster and
|
|
25
|
+
have no external dependencies.
|
|
26
|
+
- **Install docs updated** (`README.md`, `docs/getting-started.md`) to
|
|
27
|
+
reflect the "hello foundry" flow.
|
|
28
|
+
|
|
3
29
|
## [3.2.4] - 2026-05-14
|
|
4
30
|
|
|
5
31
|
### Fixed
|
package/dist/README.md
CHANGED
|
@@ -103,9 +103,18 @@ Add the plugin to `opencode.json`:
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
Restart OpenCode so the plugin registers
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
Restart OpenCode so the plugin registers. On startup, Foundry bootstraps the
|
|
107
|
+
directory structure, generates stage agents, and installs the Foundry guide
|
|
108
|
+
agent automatically.
|
|
109
|
+
|
|
110
|
+
After restart, type **hello foundry**. The assistant will tell you whether a
|
|
111
|
+
further restart is needed and when to switch to the Foundry agent.
|
|
112
|
+
|
|
113
|
+
Optionally, to make the package available to your project's local `node_modules`:
|
|
114
|
+
|
|
115
|
+
```sh
|
|
116
|
+
pnpm add -D @really-knows-ai/foundry
|
|
117
|
+
```
|
|
109
118
|
|
|
110
119
|
---
|
|
111
120
|
|
|
@@ -121,29 +130,17 @@ The upgrade process asks clarifying questions for ambiguous routing, input contr
|
|
|
121
130
|
|
|
122
131
|
### Phase 1 — Install
|
|
123
132
|
|
|
124
|
-
Add the plugin to `opencode.json` (see Install section above)
|
|
125
|
-
|
|
126
|
-
```json
|
|
127
|
-
{
|
|
128
|
-
"$schema": "https://opencode.ai/config.json",
|
|
129
|
-
"plugin": ["@really-knows-ai/foundry"]
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Then restart OpenCode so the plugin registers its tools and skills. You will see new
|
|
134
|
-
tools and skills become available in OpenCode's command palette once the restart
|
|
135
|
-
completes. Flow-management tools are now ready to use.
|
|
133
|
+
Add the plugin to `opencode.json` (see Install section above), then restart
|
|
134
|
+
OpenCode.
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
Type **hello foundry**. The assistant will guide you through any remaining
|
|
137
|
+
setup. If Foundry was just initialised, it will ask you to restart and switch
|
|
138
|
+
to the **Foundry** agent. If Foundry is already set up, it will tell you to
|
|
139
|
+
switch to the Foundry agent directly.
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
a decision tree: if `foundry/` is missing or its VERSION does not match the
|
|
141
|
-
installed plugin version, it bootstraps the directory structure, generates
|
|
142
|
-
`foundry-<model>` stage agent files, installs the user-facing `Foundry` guide
|
|
143
|
-
agent, and tells you to restart again.
|
|
141
|
+
### Phase 2 — Switch to the Foundry agent
|
|
144
142
|
|
|
145
|
-
|
|
146
|
-
switch to the **Foundry** agent. The Foundry agent is the normal interface for
|
|
143
|
+
Switch to the **Foundry** agent. The Foundry agent is the normal interface for
|
|
147
144
|
authoring and running Foundry workflows.
|
|
148
145
|
|
|
149
146
|
### Phase 3 — Ask the Foundry agent for a flow
|
|
@@ -21,7 +21,12 @@ Add Foundry to `opencode.json`:
|
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
Restart OpenCode so the plugin registers. On startup, Foundry bootstraps the
|
|
25
|
+
directory structure, generates stage agents, and installs the Foundry guide
|
|
26
|
+
agent automatically.
|
|
27
|
+
|
|
28
|
+
After restart, type **hello foundry**. The assistant will tell you whether a
|
|
29
|
+
further restart is needed and when to switch to the Foundry agent.
|
|
25
30
|
|
|
26
31
|
Optionally, if you want the package available to your project's local node_modules (for editor tooling or scripts), run:
|
|
27
32
|
|
|
@@ -31,11 +36,20 @@ pnpm add -D @really-knows-ai/foundry
|
|
|
31
36
|
|
|
32
37
|
## Initialise
|
|
33
38
|
|
|
34
|
-
|
|
39
|
+
After restarting OpenCode with the plugin, type **hello foundry**. The
|
|
40
|
+
assistant will read the Foundry bootstrap context and respond with guidance:
|
|
41
|
+
|
|
42
|
+
- If Foundry was just initialised: it will tell you to restart again and switch
|
|
43
|
+
to the Foundry agent.
|
|
44
|
+
- If Foundry is already set up: it will tell you to switch to the Foundry agent
|
|
45
|
+
directly.
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
switch to the **Foundry** agent before authoring flows. The Foundry agent
|
|
48
|
+
understands Foundry's authoring workflow and handles dependent setup such as
|
|
49
|
+
artefact types, laws, validators, appraisers, cycles, and config branches.
|
|
37
50
|
|
|
38
|
-
The `.foundry/` runtime directory (holding `.secret` for stage tokens) is
|
|
51
|
+
The `.foundry/` runtime directory (holding `.secret` for stage tokens) is
|
|
52
|
+
created automatically on first plugin boot and added to `.gitignore`.
|
|
39
53
|
|
|
40
54
|
---
|
|
41
55
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@really-knows-ai/foundry",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.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",
|