@really-knows-ai/foundry 3.0.2 → 3.1.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 +8 -7
- package/dist/.opencode/plugins/foundry-tools/helpers.js +10 -19
- package/dist/.opencode/plugins/foundry-tools/refresh-agents-tool.js +88 -0
- package/dist/.opencode/plugins/foundry.js +2 -0
- package/dist/CHANGELOG.md +113 -0
- package/dist/README.md +8 -7
- package/dist/agents/foundry.md +37 -0
- package/dist/docs/architecture.md +6 -3
- package/dist/docs/concepts.md +1 -1
- package/dist/docs/getting-started.md +57 -135
- package/dist/docs/tools.md +21 -1
- package/dist/scripts/sort.js +1 -1
- package/dist/skills/add-appraiser/SKILL.md +19 -34
- package/dist/skills/add-artefact-type/SKILL.md +19 -22
- package/dist/skills/add-cycle/SKILL.md +28 -37
- package/dist/skills/add-extractor/SKILL.md +21 -33
- package/dist/skills/add-flow/SKILL.md +43 -88
- package/dist/skills/add-law/SKILL.md +19 -24
- package/dist/skills/add-memory-edge-type/SKILL.md +11 -17
- package/dist/skills/add-memory-entity-type/SKILL.md +9 -16
- package/dist/skills/change-embedding-model/SKILL.md +6 -8
- package/dist/skills/drop-memory-edge-type/SKILL.md +6 -8
- package/dist/skills/drop-memory-entity-type/SKILL.md +6 -8
- package/dist/skills/dry-run/SKILL.md +11 -28
- package/dist/skills/flow/SKILL.md +1 -1
- package/dist/skills/init-foundry/SKILL.md +30 -25
- package/dist/skills/init-memory/SKILL.md +11 -22
- package/dist/skills/list-agents/SKILL.md +1 -1
- package/dist/skills/refresh-agents/SKILL.md +4 -26
- package/dist/skills/rename-memory-edge-type/SKILL.md +6 -8
- package/dist/skills/rename-memory-entity-type/SKILL.md +6 -8
- package/dist/skills/reset-memory/SKILL.md +10 -16
- package/dist/skills/upgrade-foundry/SKILL.md +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -142,16 +142,17 @@ Open OpenCode in your project repo and say:
|
|
|
142
142
|
> run init-foundry
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
Foundry scaffolds a `foundry/` directory, generates one `foundry-<model>` agent
|
|
146
|
-
per model available in your session,
|
|
147
|
-
|
|
148
|
-
populate them next.
|
|
145
|
+
Foundry scaffolds a `foundry/` directory, generates one `foundry-<model>` stage agent
|
|
146
|
+
file per model available in your session, installs the user-facing `Foundry` guide
|
|
147
|
+
agent, commits the structure, and asks you to restart.
|
|
149
148
|
|
|
150
|
-
Restart OpenCode so the new
|
|
149
|
+
Restart OpenCode so the new agents register. After the restart, switch to the
|
|
150
|
+
**Foundry** agent. The Foundry agent is the normal interface for authoring and
|
|
151
|
+
running Foundry workflows.
|
|
151
152
|
|
|
152
|
-
### Phase 3 —
|
|
153
|
+
### Phase 3 — Ask the Foundry agent for a flow
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
With the **Foundry** agent active, ask it to set up a flow:
|
|
155
156
|
|
|
156
157
|
```
|
|
157
158
|
> set up a flow that writes haikus
|
|
@@ -94,14 +94,13 @@ function buildFoundryNotInitializedMessage() {
|
|
|
94
94
|
return `<FOUNDRY_CONTEXT>
|
|
95
95
|
Foundry is installed but not initialised in this project. There is no foundry/ directory.
|
|
96
96
|
|
|
97
|
-
To set up Foundry,
|
|
98
|
-
and guide you through defining artefact types, laws, appraisers, cycles, and flows.
|
|
97
|
+
To set up Foundry, initialise the project first. Initialisation creates the foundry/ directory structure, installs the user-facing Foundry agent, and generates model-routing stage agents. After initialisation, restart OpenCode and switch to the Foundry agent.
|
|
99
98
|
</FOUNDRY_CONTEXT>`;
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
function buildFlowList(flows) {
|
|
103
102
|
if (flows.length === 0) {
|
|
104
|
-
return '- (no flows defined yet —
|
|
103
|
+
return '- (no flows defined yet — ask the Foundry agent to set one up)';
|
|
105
104
|
}
|
|
106
105
|
return flows.map(f => {
|
|
107
106
|
const sc = f.startingCycles.length > 0 ? ` — starting cycles: ${f.startingCycles.join(', ')}` : '';
|
|
@@ -121,27 +120,19 @@ The pipeline: assay (populate memory) → forge (produce) → quench (determinis
|
|
|
121
120
|
|
|
122
121
|
${flowList}
|
|
123
122
|
|
|
124
|
-
|
|
125
|
-
by name (e.g. "Creative Flow"), or by clear paraphrase (e.g. "the creative flow",
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
When the user references any flow above — by id (e.g. "creative-flow"),
|
|
124
|
+
by name (e.g. "Creative Flow"), or by clear paraphrase (e.g. "the creative flow",
|
|
125
|
+
"use the creative pipeline") — ask the Foundry agent to run that flow with the user's
|
|
126
|
+
request as the goal. The Foundry agent handles cycle selection, work-branch creation, and
|
|
127
|
+
orchestration automatically.
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
new skills). It does NOT apply to running an existing, defined flow.
|
|
129
|
+
## Foundry agent capabilities
|
|
132
130
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- **Pipeline:** assay, forge, quench, appraise, orchestrate, flow, human-appraise
|
|
136
|
-
- **Authoring:** add-artefact-type, add-law, add-appraiser, add-cycle, add-flow, add-memory-entity-type, add-memory-edge-type, add-extractor, init-foundry
|
|
137
|
-
- **Maintenance:** upgrade-foundry, refresh-agents, list-agents, init-memory, change-embedding-model, dry-run
|
|
138
|
-
- **Memory Admin:** drop-memory-entity-type, drop-memory-edge-type, rename-memory-entity-type, rename-memory-edge-type, reset-memory
|
|
131
|
+
The Foundry agent has internal workflows for pipeline execution, authoring, maintenance, memory administration, and dry-run trials. Present these capabilities as Foundry outcomes instead of naming internal skills.
|
|
139
132
|
|
|
140
133
|
## Multi-model routing
|
|
141
134
|
|
|
142
|
-
Foundry uses \`foundry-*\`
|
|
143
|
-
Run the \`refresh-agents\` skill to regenerate them after adding or removing providers.
|
|
144
|
-
Cycle definitions can specify per-stage models via the \`models\` frontmatter map. Appraisers can override with their own \`model\` field.
|
|
135
|
+
Foundry uses generated \`foundry-*\` stage agents for cycle stage dispatch. The user-facing \`Foundry\` agent is installed as \`.opencode/agents/foundry.md\` and should be used for authoring and running Foundry workflows.
|
|
145
136
|
|
|
146
137
|
All user content lives under foundry/.
|
|
147
138
|
Scripts are located at: ${path.join(packageRoot, 'scripts')}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { execFileSync } from 'child_process';
|
|
3
|
+
import { mkdirSync, readdirSync, writeFileSync, unlinkSync } from 'fs';
|
|
4
|
+
|
|
5
|
+
const AGENT_FRONTMATTER_TEMPLATE = `---
|
|
6
|
+
description: "Foundry stage agent using MODEL_ID"
|
|
7
|
+
mode: subagent
|
|
8
|
+
model: "MODEL_ID"
|
|
9
|
+
hidden: true
|
|
10
|
+
---
|
|
11
|
+
You are a Foundry stage agent. Follow the skill instructions provided in your task prompt exactly.
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
function makeSlug(modelId) {
|
|
15
|
+
return modelId.replace(/[/.]/g, '-');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function buildAgentContent(modelId) {
|
|
19
|
+
return AGENT_FRONTMATTER_TEMPLATE.replace(/MODEL_ID/g, modelId);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function listModels(worktree) {
|
|
23
|
+
const stdout = execFileSync('opencode', ['models'], {
|
|
24
|
+
cwd: worktree,
|
|
25
|
+
encoding: 'utf8',
|
|
26
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
27
|
+
});
|
|
28
|
+
return stdout
|
|
29
|
+
.split('\n')
|
|
30
|
+
.map(line => line.trim())
|
|
31
|
+
.filter(line => line.length > 0);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function deleteStaleAgents(agentsDir) {
|
|
35
|
+
let existing;
|
|
36
|
+
try {
|
|
37
|
+
existing = readdirSync(agentsDir);
|
|
38
|
+
} catch {
|
|
39
|
+
existing = [];
|
|
40
|
+
}
|
|
41
|
+
for (const entry of existing) {
|
|
42
|
+
if (entry.startsWith('foundry-') && entry.endsWith('.md')) {
|
|
43
|
+
unlinkSync(path.join(agentsDir, entry));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function writeAgentFiles(agentsDir, models) {
|
|
49
|
+
for (const modelId of models) {
|
|
50
|
+
const slug = makeSlug(modelId);
|
|
51
|
+
const filePath = path.join(agentsDir, `foundry-${slug}.md`);
|
|
52
|
+
writeFileSync(filePath, buildAgentContent(modelId), 'utf8');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function refreshAgents(worktree) {
|
|
57
|
+
const models = listModels(worktree);
|
|
58
|
+
if (models.length === 0) {
|
|
59
|
+
return { ok: false, error: 'No models returned by `opencode models`. Is the opencode CLI available?' };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const agentsDir = path.join(worktree, '.opencode', 'agents');
|
|
63
|
+
mkdirSync(agentsDir, { recursive: true });
|
|
64
|
+
deleteStaleAgents(agentsDir);
|
|
65
|
+
writeAgentFiles(agentsDir, models);
|
|
66
|
+
|
|
67
|
+
return { ok: true, count: models.length };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function createRefreshAgentsTool({ tool }) {
|
|
71
|
+
return {
|
|
72
|
+
foundry_refresh_agents: tool({
|
|
73
|
+
description: 'Regenerate .opencode/agents/foundry-*.md stage-agent files from the currently available models.',
|
|
74
|
+
args: {},
|
|
75
|
+
async execute(_args, context) {
|
|
76
|
+
try {
|
|
77
|
+
const result = refreshAgents(context.worktree);
|
|
78
|
+
return JSON.stringify(result);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
return JSON.stringify({
|
|
81
|
+
ok: false,
|
|
82
|
+
error: `foundry_refresh_agents: ${err.message ?? String(err)}`,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -29,6 +29,7 @@ import { createMemoryTools } from './foundry-tools/memory-tools.js';
|
|
|
29
29
|
import { createMemoryAdminTools } from './foundry-tools/memory-admin-tools.js';
|
|
30
30
|
import { createSnapshotTools } from './foundry-tools/snapshot-tools.js';
|
|
31
31
|
import { createAttestationTools } from './foundry-tools/attestation-tools.js';
|
|
32
|
+
import { createRefreshAgentsTool } from './foundry-tools/refresh-agents-tool.js';
|
|
32
33
|
|
|
33
34
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
34
35
|
const packageRoot = path.resolve(__dirname, '../..');
|
|
@@ -55,6 +56,7 @@ function buildTools(createTool, pending) {
|
|
|
55
56
|
...createMemoryAdminTools({ tool: createTool }),
|
|
56
57
|
...createSnapshotTools({ tool: createTool }),
|
|
57
58
|
...createAttestationTools({ tool: createTool }),
|
|
59
|
+
...createRefreshAgentsTool({ tool: createTool }),
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
62
|
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,118 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.1.0] - 2026-05-11
|
|
4
|
+
|
|
5
|
+
The Foundry guide agent release. Foundry now ships a user-facing agent that
|
|
6
|
+
routes configuration authoring through Foundry concepts — users ask the Foundry
|
|
7
|
+
agent for outcomes, and the agent composes dependent work internally rather than
|
|
8
|
+
handing users a chain of individual tools and skills.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Foundry guide agent** (`src/agents/foundry.md`). A user-facing agent with
|
|
13
|
+
identity marker *"You are the Foundry agent"* that maps user requests to
|
|
14
|
+
Foundry concepts, routes through the standard config-branch workflow, and
|
|
15
|
+
delegates to authoring skills internally.
|
|
16
|
+
- **`foundry_refresh_agents` tool.** Deterministic stage-agent generation: runs
|
|
17
|
+
`opencode models`, deletes stale `.opencode/agents/foundry-*.md` files, and
|
|
18
|
+
writes fresh agent files — one per available model. Replaces the prior
|
|
19
|
+
skill-only protocol where the LLM had to implement the logic with shell
|
|
20
|
+
commands.
|
|
21
|
+
- **`init-foundry` installs the guide agent.** Step 5 creates
|
|
22
|
+
`.opencode/agents/foundry.md` (preferring `dist/agents/foundry.md`, falling
|
|
23
|
+
back to `src/agents/foundry.md`), then instructs the user to restart OpenCode
|
|
24
|
+
and switch to the Foundry agent.
|
|
25
|
+
- **Comprehensive guidance audit tests.** `tests/skills/foundry-guidance-audit.test.js`
|
|
26
|
+
(357 lines) and `tests/skills/authoring-guidance.test.js` (45 lines) enforce
|
|
27
|
+
that skills avoid dead-end delegation patterns, route through the Foundry
|
|
28
|
+
agent, keep internal tool-call syntax out of normal user guidance, and handle
|
|
29
|
+
config branches and dependencies internally.
|
|
30
|
+
- **Packaging test** (`tests/plugin/packaging.test.js`). Verifies the published
|
|
31
|
+
package ships `dist/agents/` so `init-foundry` can locate the guide agent
|
|
32
|
+
template in a packaged install.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **Authoring skills reworked around the Foundry agent.** `add-flow`,
|
|
37
|
+
`add-cycle`, `add-artefact-type`, `add-law`, and `add-appraiser` now include a
|
|
38
|
+
`## Foundry Agent Preflight` section; and frame user requests as Foundry
|
|
39
|
+
outcomes, compose missing dependencies internally in validation order, and
|
|
40
|
+
hide internal tool-call syntax from normal user guidance (`foundry_git_branch`,
|
|
41
|
+
`foundry_git_finish`, `foundry_config_create_*`).
|
|
42
|
+
- **Memory/config skills handle branches and dependencies internally.**
|
|
43
|
+
`init-memory`, `reset-memory`, `add-memory-entity-type`, `add-memory-edge-type`,
|
|
44
|
+
`add-extractor`, and the `rename-memory-*` / `drop-memory-*` /
|
|
45
|
+
`change-embedding-model` skills no longer tell the user to create config
|
|
46
|
+
branches or run prerequisite skills. All use *"move to a suitable `config/*`
|
|
47
|
+
branch internally when the current branch is safe"* with `work/*` /
|
|
48
|
+
`dry-run/*/*` / uncommitted-change guards.
|
|
49
|
+
- **`add-extractor` composes cycle wiring internally.** The skill updates
|
|
50
|
+
relevant cycle definitions rather than presenting manual frontmatter editing
|
|
51
|
+
as the normal outcome.
|
|
52
|
+
- **`add-cycle` hides generated stage-agent files.** Model selection guidance
|
|
53
|
+
now references *"Available session models are listed in your session
|
|
54
|
+
configuration"* instead of exposing `.opencode/agents/foundry-*.md`.
|
|
55
|
+
- **Existing-file recovery keeps the agent in the loop.** When
|
|
56
|
+
`foundry_config_create_*` returns `{ ok: false }` because the target file
|
|
57
|
+
already exists, `add-artefact-type`, `add-appraiser`, `add-law`, and
|
|
58
|
+
`add-cycle` now read the existing content, incorporate the user's requested
|
|
59
|
+
changes, propose the merged result, and commit — rather than telling the user
|
|
60
|
+
to *"edit by hand."*
|
|
61
|
+
- **Bootstrap context** (`helpers.js`) presents capabilities as Foundry
|
|
62
|
+
outcomes (*"ask the Foundry agent to add flow memory"*, *"ask the Foundry
|
|
63
|
+
agent to run that flow"*) instead of listing internal skills.
|
|
64
|
+
- **`getting-started.md` reworked.** The walkthrough now routes through the
|
|
65
|
+
Foundry agent, removes direct `foundry_git_branch({` /
|
|
66
|
+
`foundry_git_finish({` / `Run \`add-*\`` / `foundry_config_validate_*({` /
|
|
67
|
+
`foundry_config_create_*({` references, and uses `pnpm add -D
|
|
68
|
+
@really-knows-ai/foundry`.
|
|
69
|
+
- **`README.md` quick-start** updated for the install → init → ask-agent
|
|
70
|
+
workflow (`pnpm add -D @really-knows-ai/foundry`, ask the Foundry agent
|
|
71
|
+
to add a haiku flow).
|
|
72
|
+
- **`refresh-agents` skill** delegates to `foundry_refresh_agents()`. The skill
|
|
73
|
+
is now a thin wrapper around the deterministic tool.
|
|
74
|
+
- **`init-foundry`, `list-agents`, `sort.js`, `upgrade-foundry`** updated to
|
|
75
|
+
reference the `foundry_refresh_agents` tool.
|
|
76
|
+
- **Docs** (`architecture.md`, `concepts.md`, `tools.md`) updated to reference
|
|
77
|
+
guide-agent installation and the refresh tool. Tool count increased from 66 to
|
|
78
|
+
67.
|
|
79
|
+
|
|
80
|
+
### Fixed
|
|
81
|
+
|
|
82
|
+
- **`dist/agents/` added to the published package.** The build script already
|
|
83
|
+
copied `src/agents/` to `dist/agents/`, but the `files` array in
|
|
84
|
+
`package.json` excluded `dist/agents/`. `init-foundry` can now locate the
|
|
85
|
+
guide agent template in a packaged install.
|
|
86
|
+
- **`foundry_refresh_agents` preserves the guide agent.** Only
|
|
87
|
+
`foundry-*.md` stage agents are regenerated; `.opencode/agents/foundry.md`
|
|
88
|
+
survives refresh.
|
|
89
|
+
|
|
90
|
+
## [3.0.3] - 2026-05-11
|
|
91
|
+
|
|
92
|
+
A patch release that makes agent-file generation deterministic by moving
|
|
93
|
+
`refresh-agents` from a skill-only protocol into a tested plugin tool.
|
|
94
|
+
|
|
95
|
+
### Added
|
|
96
|
+
|
|
97
|
+
- **`foundry_refresh_agents` tool.** Runs `opencode models`, deletes stale
|
|
98
|
+
`.opencode/agents/foundry-*.md` files, and generates fresh agent files — one
|
|
99
|
+
per available model. The tool is idempotent, handles missing directories, and
|
|
100
|
+
returns `{ ok: true, count: <n> }` on success. This replaces the prior
|
|
101
|
+
skill-only protocol where the LLM had to implement the logic with shell
|
|
102
|
+
commands, which was error-prone and non-deterministic.
|
|
103
|
+
|
|
104
|
+
### Changed
|
|
105
|
+
|
|
106
|
+
- **`refresh-agents` skill** now simply calls `foundry_refresh_agents()` and
|
|
107
|
+
reports the result.
|
|
108
|
+
- **`init-foundry` skill** step 4 now calls `foundry_refresh_agents()` instead
|
|
109
|
+
of instructing the LLM to run the `refresh-agents` skill.
|
|
110
|
+
- **`list-agents` skill** error message now references the tool.
|
|
111
|
+
- **`sort.js`** missing-agent error now references the tool.
|
|
112
|
+
- **`helpers.js`** bootstrap message now references the tool.
|
|
113
|
+
- **Docs** (`tools.md`, `getting-started.md`, `architecture.md`, `concepts.md`)
|
|
114
|
+
updated to reference the tool. Tool count increased from 65 to 66.
|
|
115
|
+
|
|
3
116
|
## [3.0.2] - 2026-05-11
|
|
4
117
|
|
|
5
118
|
A documentation and tool-correctness patch driven by a failing
|
package/dist/README.md
CHANGED
|
@@ -142,16 +142,17 @@ Open OpenCode in your project repo and say:
|
|
|
142
142
|
> run init-foundry
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
Foundry scaffolds a `foundry/` directory, generates one `foundry-<model>` agent
|
|
146
|
-
per model available in your session,
|
|
147
|
-
|
|
148
|
-
populate them next.
|
|
145
|
+
Foundry scaffolds a `foundry/` directory, generates one `foundry-<model>` stage agent
|
|
146
|
+
file per model available in your session, installs the user-facing `Foundry` guide
|
|
147
|
+
agent, commits the structure, and asks you to restart.
|
|
149
148
|
|
|
150
|
-
Restart OpenCode so the new
|
|
149
|
+
Restart OpenCode so the new agents register. After the restart, switch to the
|
|
150
|
+
**Foundry** agent. The Foundry agent is the normal interface for authoring and
|
|
151
|
+
running Foundry workflows.
|
|
151
152
|
|
|
152
|
-
### Phase 3 —
|
|
153
|
+
### Phase 3 — Ask the Foundry agent for a flow
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
With the **Foundry** agent active, ask it to set up a flow:
|
|
155
156
|
|
|
156
157
|
```
|
|
157
158
|
> set up a flow that writes haikus
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Guide users through Foundry authoring and flow execution"
|
|
3
|
+
mode: primary
|
|
4
|
+
---
|
|
5
|
+
You are the Foundry agent.
|
|
6
|
+
|
|
7
|
+
Foundry is a framework for governed AI artefact generation. Your role is to help the user reach their stated Foundry outcome by understanding the goal, handling prerequisites, composing dependent configuration, and explaining progress in Foundry concepts.
|
|
8
|
+
|
|
9
|
+
## Operating Principles
|
|
10
|
+
|
|
11
|
+
- Treat user requests as goals to satisfy.
|
|
12
|
+
- Use Foundry skills and tools internally.
|
|
13
|
+
- Keep tool names, JSON arguments, and tool-call syntax out of normal user-facing instructions.
|
|
14
|
+
- Create missing dependencies when they are part of the user's stated goal.
|
|
15
|
+
- Handle config branches, validation, commits, and dependency ordering when safe.
|
|
16
|
+
- Ask one focused question when intent, safety, or irreversible project state requires user input.
|
|
17
|
+
- Report outcomes as Foundry concepts, files created or updated, validations run, and commits made.
|
|
18
|
+
|
|
19
|
+
## Authoring Posture
|
|
20
|
+
|
|
21
|
+
When the user asks to create or change a flow, work backwards from the requested outcome. A flow may require artefact types, laws, validators, appraisers, cycles, memory configuration, and branch setup. Create or reuse those pieces as needed instead of telling the user to invoke another skill.
|
|
22
|
+
|
|
23
|
+
When a dependency is ambiguous, present the smallest useful choice. When a dependency is missing and the user's goal clearly requires it, create it. When a hard conflict exists, stop and explain the conflict in Foundry terms.
|
|
24
|
+
|
|
25
|
+
## Safety Boundaries
|
|
26
|
+
|
|
27
|
+
- Preserve user changes.
|
|
28
|
+
- Do not overwrite unrelated files.
|
|
29
|
+
- Do not bypass Foundry validation.
|
|
30
|
+
- Do not create overlapping artefact file patterns.
|
|
31
|
+
- Do not change Foundry configuration on an active `work/*` branch.
|
|
32
|
+
- Do not continue configuration work from `dry-run/*/*`; finish the dry run first.
|
|
33
|
+
- Do not push, publish, or create pull requests unless the user explicitly asks.
|
|
34
|
+
|
|
35
|
+
## User-Facing Style
|
|
36
|
+
|
|
37
|
+
Speak directly and concretely. Explain what you are creating and why it supports the user's goal. Prefer Foundry terms such as artefact type, law, validator, appraiser, cycle, and flow. Avoid exposing implementation details unless the user asks for them.
|
|
@@ -300,7 +300,9 @@ Different stages can run on different models for cognitive diversity. Cycle defi
|
|
|
300
300
|
|
|
301
301
|
### Agent files
|
|
302
302
|
|
|
303
|
-
|
|
303
|
+
The user-facing `Foundry` agent is installed by `init-foundry` as `.opencode/agents/foundry.md`. Users switch to this agent after restarting OpenCode. It guides authoring and flow execution while generated `foundry-*` stage agents remain hidden routing targets for specific models.
|
|
304
|
+
|
|
305
|
+
`foundry_refresh_agents()` generates a `foundry-<slug>.md` agent file in `.opencode/agents/` for every model available in the session, where `<slug>` is the model ID with both `/` and `.` replaced by `-` (e.g. `anthropic-claude-opus-4-7.md`).
|
|
304
306
|
|
|
305
307
|
### Dispatch behaviour
|
|
306
308
|
|
|
@@ -336,7 +338,7 @@ Implementation: `src/plugin/tools/helpers.js` (`buildCyclePromptExtras`) and `sr
|
|
|
336
338
|
│ │ ├── add-flow/
|
|
337
339
|
│ │ ├── add-extractor/
|
|
338
340
|
│ │ ├── list-agents/ # utility
|
|
339
|
-
│ │ ├── refresh-agents/
|
|
341
|
+
│ │ ├── refresh-agents/ # utility (now backed by foundry_refresh_agents tool)
|
|
340
342
|
│ │ ├── upgrade-foundry/
|
|
341
343
|
│ │ ├── init-memory/ # memory
|
|
342
344
|
│ │ ├── add-memory-entity-type/
|
|
@@ -415,7 +417,8 @@ your-project/
|
|
|
415
417
|
│ └── .secret # per-worktree HMAC key (mode 0600)
|
|
416
418
|
├── .opencode/
|
|
417
419
|
│ └── agents/
|
|
418
|
-
│
|
|
420
|
+
│ ├── foundry.md # user-facing Foundry guide agent
|
|
421
|
+
│ └── foundry-*.md # generated stage agents for model routing
|
|
419
422
|
├── opencode.json
|
|
420
423
|
└── ...
|
|
421
424
|
```
|
package/dist/docs/concepts.md
CHANGED
|
@@ -265,7 +265,7 @@ All deterministic pipeline operations are exposed as custom tools by the Foundry
|
|
|
265
265
|
|
|
266
266
|
## Skill
|
|
267
267
|
|
|
268
|
-
A self-contained workflow written as markdown with YAML frontmatter. Foundry ships
|
|
268
|
+
A self-contained workflow written as markdown with YAML frontmatter. Foundry ships a user-facing `Foundry` guide agent plus skills for pipeline execution, authoring, maintenance, and memory administration. The guide agent is the normal interface for users; skills and tools provide the internal workflows it uses to initialise projects, create artefact types, define laws, configure appraisers, build cycles and flows, and run governed artefact generation. Skills are either **atomic** (do one thing) or **composite** (orchestrate other skills).
|
|
269
269
|
|
|
270
270
|
---
|
|
271
271
|
|