@really-knows-ai/foundry 1.0.0 → 1.2.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/.opencode/plugins/foundry.js +10 -40
- package/README.md +3 -3
- package/package.json +1 -1
- package/scripts/sort.js +14 -6
- package/skills/add-appraiser/SKILL.md +6 -0
- package/skills/add-artefact-type/SKILL.md +6 -0
- package/skills/add-cycle/SKILL.md +7 -1
- package/skills/add-flow/SKILL.md +6 -0
- package/skills/add-law/SKILL.md +6 -0
- package/skills/appraise/SKILL.md +6 -0
- package/skills/cycle/SKILL.md +6 -0
- package/skills/flow/SKILL.md +7 -1
- package/skills/forge/SKILL.md +7 -1
- package/skills/hitl/SKILL.md +6 -0
- package/skills/init-foundry/SKILL.md +10 -4
- package/skills/list-agents/SKILL.md +24 -0
- package/skills/quench/SKILL.md +6 -0
- package/skills/refresh-agents/SKILL.md +40 -0
- package/skills/sort/SKILL.md +6 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Foundry plugin for OpenCode.ai
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* - If foundry/ exists
|
|
6
|
-
* - If foundry/ does not exist:
|
|
4
|
+
* All skills are always registered. Individual skills check for foundry/ dir.
|
|
5
|
+
* - If foundry/ exists: pipeline context injected into first message
|
|
6
|
+
* - If foundry/ does not exist: minimal prompt guiding user to init-foundry
|
|
7
|
+
* Multi-model agents are managed as .opencode/agents/foundry-*.md files via the refresh-agents skill.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import path from 'path';
|
|
@@ -13,7 +14,6 @@ import { fileURLToPath } from 'url';
|
|
|
13
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
15
|
const packageRoot = path.resolve(__dirname, '../..');
|
|
15
16
|
const allSkillsDir = path.join(packageRoot, 'skills');
|
|
16
|
-
const initSkillDir = path.join(allSkillsDir, 'init-foundry');
|
|
17
17
|
|
|
18
18
|
function getBootstrapContent(directory) {
|
|
19
19
|
const foundryDir = path.join(directory, 'foundry');
|
|
@@ -39,7 +39,8 @@ Available skills:
|
|
|
39
39
|
- **Pipeline:** forge, quench, appraise, cycle, flow, sort, hitl
|
|
40
40
|
- **Helpers:** add-artefact-type, add-law, add-appraiser, add-cycle, add-flow, init-foundry
|
|
41
41
|
|
|
42
|
-
Multi-model routing:
|
|
42
|
+
Multi-model routing: Foundry uses \`foundry-*\` sub-agents defined as markdown files in \`.opencode/agents/\`.
|
|
43
|
+
Run the \`refresh-agents\` skill to regenerate them after adding or removing providers.
|
|
43
44
|
Cycle definitions can specify per-stage models via the \`models\` frontmatter map. Appraisers can override with their own \`model\` field.
|
|
44
45
|
|
|
45
46
|
To start a flow, use the \`flow\` skill. All user content lives under foundry/.
|
|
@@ -47,46 +48,15 @@ Scripts are located at: ${path.join(packageRoot, 'scripts')}
|
|
|
47
48
|
</FOUNDRY_CONTEXT>`;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
export const FoundryPlugin = async ({
|
|
51
|
-
const foundryDir = path.join(directory, 'foundry');
|
|
52
|
-
const foundryExists = fs.existsSync(foundryDir) && fs.statSync(foundryDir).isDirectory();
|
|
53
|
-
|
|
51
|
+
export const FoundryPlugin = async ({ directory }) => {
|
|
54
52
|
return {
|
|
55
53
|
config: async (config) => {
|
|
56
54
|
config.skills = config.skills || {};
|
|
57
55
|
config.skills.paths = config.skills.paths || [];
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Register per-model subagents for multi-model stage routing
|
|
65
|
-
try {
|
|
66
|
-
const providers = await client.provider.list();
|
|
67
|
-
config.agent = config.agent || {};
|
|
68
|
-
for (const provider of providers) {
|
|
69
|
-
if (!provider.models) continue;
|
|
70
|
-
const modelKeys = Array.isArray(provider.models)
|
|
71
|
-
? provider.models
|
|
72
|
-
: Object.keys(provider.models);
|
|
73
|
-
for (const modelKey of modelKeys) {
|
|
74
|
-
const agentName = `foundry-${provider.id}-${modelKey}`;
|
|
75
|
-
config.agent[agentName] = {
|
|
76
|
-
model: `${provider.id}/${modelKey}`,
|
|
77
|
-
mode: 'subagent',
|
|
78
|
-
hidden: true,
|
|
79
|
-
description: `Foundry stage agent using ${provider.id}/${modelKey}`,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
} catch (err) {
|
|
84
|
-
console.warn('[foundry] Failed to discover models for agent registration:', err.message);
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
if (!config.skills.paths.includes(initSkillDir)) {
|
|
88
|
-
config.skills.paths.push(initSkillDir);
|
|
89
|
-
}
|
|
57
|
+
// Always register all skills — individual skills check for foundry/ dir
|
|
58
|
+
if (!config.skills.paths.includes(allSkillsDir)) {
|
|
59
|
+
config.skills.paths.push(allSkillsDir);
|
|
90
60
|
}
|
|
91
61
|
},
|
|
92
62
|
|
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@ A skill-driven framework for governed artefact generation and evaluation using A
|
|
|
4
4
|
|
|
5
5
|
## Compatibility
|
|
6
6
|
|
|
7
|
-
- **OpenCode** — full support, multi-model routing via
|
|
7
|
+
- **OpenCode** — full support, multi-model routing via file-based agents
|
|
8
8
|
|
|
9
|
-
Multi-model support enables model diversity across pipeline stages.
|
|
9
|
+
Multi-model support enables model diversity across pipeline stages. Foundry agents are defined as `.opencode/agents/foundry-*.md` files, generated by the `refresh-agents` skill (also run during `init-foundry`). Cycle definitions specify which model each stage uses. Tools limited to a single model lose model-diversity but still get personality-based diversity.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -235,7 +235,7 @@ The generator can decline subjective feedback with a justification, but an appra
|
|
|
235
235
|
|
|
236
236
|
### Multi-model stage routing
|
|
237
237
|
|
|
238
|
-
Cycle definitions specify which model each stage uses via a `models` map. The
|
|
238
|
+
Cycle definitions specify which model each stage uses via a `models` map. The `refresh-agents` skill generates `foundry-*` agent files in `.opencode/agents/` from available models. Individual appraisers can override the cycle-level model. Resolution order: appraiser `model` → cycle `models.<stage>` → session default. Multiple personalities catch different issues. Consolidation is union with dedup — one appraiser flagging an issue is enough.
|
|
239
239
|
|
|
240
240
|
### Input artefacts are read-only
|
|
241
241
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@really-knows-ai/foundry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A structured framework for AI-driven artefact creation with deterministic routing, quality gates, and iterative refinement cycles.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": ".opencode/plugins/foundry.js",
|
package/scripts/sort.js
CHANGED
|
@@ -76,24 +76,32 @@ function parseFeedback(text, cycle, artefacts) {
|
|
|
76
76
|
const items = [];
|
|
77
77
|
let currentFile = null;
|
|
78
78
|
let inFeedback = false;
|
|
79
|
+
let feedbackLevel = 0; // 1 for '# Feedback', 2 for '## Feedback'
|
|
79
80
|
|
|
80
81
|
for (const line of text.split('\n')) {
|
|
81
82
|
const stripped = line.trim();
|
|
82
83
|
|
|
83
|
-
if (stripped === '# Feedback') {
|
|
84
|
+
if (stripped === '# Feedback' || stripped === '## Feedback') {
|
|
84
85
|
inFeedback = true;
|
|
86
|
+
feedbackLevel = stripped.startsWith('## ') ? 2 : 1;
|
|
85
87
|
continue;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
// Exit feedback on a heading at the same or higher level
|
|
91
|
+
if (inFeedback && /^#{1,2} /.test(stripped)) {
|
|
92
|
+
const level = stripped.startsWith('## ') ? 2 : 1;
|
|
93
|
+
if (level <= feedbackLevel && stripped !== '# Feedback' && stripped !== '## Feedback') {
|
|
94
|
+
inFeedback = false;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
if (!inFeedback) continue;
|
|
94
100
|
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
// File sub-headings are one level below the Feedback heading
|
|
102
|
+
const fileHeadingPrefix = feedbackLevel === 1 ? '## ' : '### ';
|
|
103
|
+
if (stripped.startsWith(fileHeadingPrefix)) {
|
|
104
|
+
currentFile = stripped.slice(fileHeadingPrefix.length).trim();
|
|
97
105
|
continue;
|
|
98
106
|
}
|
|
99
107
|
|
|
@@ -8,6 +8,12 @@ description: Creates a new appraiser personality, checking for semantic overlap
|
|
|
8
8
|
|
|
9
9
|
You help the user create a new appraiser personality. You ensure it's genuinely distinct from existing appraisers and scaffold the definition file.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Protocol
|
|
12
18
|
|
|
13
19
|
### 1. Gather basics
|
|
@@ -8,6 +8,12 @@ description: Creates a new artefact type, checking for conflicts with existing t
|
|
|
8
8
|
|
|
9
9
|
You help the user create a new artefact type. You ensure it doesn't conflict with existing types, scaffold the directory structure, and walk the user through defining laws and validation.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Protocol
|
|
12
18
|
|
|
13
19
|
### 1. Gather basics
|
|
@@ -8,6 +8,12 @@ description: Creates a new foundry cycle within a foundry flow, specifying the o
|
|
|
8
8
|
|
|
9
9
|
You help the user create a new foundry cycle and add it to an existing foundry flow. A foundry cycle produces one artefact type (read-write) and optionally reads from artefact types produced by earlier foundry cycles (read-only).
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Protocol
|
|
12
18
|
|
|
13
19
|
### 1. Identify the foundry flow
|
|
@@ -31,7 +37,7 @@ If any of these are missing, ask.
|
|
|
31
37
|
|
|
32
38
|
For each stage in the cycle (forge, quench, appraise), ask the user if they want to specify a model:
|
|
33
39
|
|
|
34
|
-
> Each stage can optionally run on a specific model for model diversity. Available models are
|
|
40
|
+
> Each stage can optionally run on a specific model for model diversity. Available models are listed as `foundry-*` agent files in `.opencode/agents/`. Run the `list-agents` skill to see them.
|
|
35
41
|
>
|
|
36
42
|
> For each stage, specify a model ID (e.g., `openai/gpt-4o`) or leave blank to use the session's default model:
|
|
37
43
|
> - forge: ___
|
package/skills/add-flow/SKILL.md
CHANGED
|
@@ -8,6 +8,12 @@ description: Creates a new foundry flow definition.
|
|
|
8
8
|
|
|
9
9
|
You help the user create a new foundry flow. A foundry flow is an ordered list of foundry cycles that transforms a request into finished artefacts.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Protocol
|
|
12
18
|
|
|
13
19
|
### 1. Gather basics
|
package/skills/add-law/SKILL.md
CHANGED
|
@@ -8,6 +8,12 @@ description: Creates a new law, checking for conflicts with existing laws.
|
|
|
8
8
|
|
|
9
9
|
You help the user create a new law. You ensure it's well-scoped, doesn't conflict with existing laws, and ends up in the right file.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Protocol
|
|
12
18
|
|
|
13
19
|
### 1. Determine scope
|
package/skills/appraise/SKILL.md
CHANGED
|
@@ -8,6 +8,12 @@ description: Subjective evaluation of an artefact against laws via multiple inde
|
|
|
8
8
|
|
|
9
9
|
You orchestrate subjective appraisal of an artefact by dispatching independent sub-agent appraisers, then consolidating their feedback into WORK.md.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Appraiser configuration
|
|
12
18
|
|
|
13
19
|
Appraiser personalities are defined in `foundry/appraisers/` (the appraiser directory). Each markdown file defines:
|
package/skills/cycle/SKILL.md
CHANGED
|
@@ -9,6 +9,12 @@ composes: [sort, forge, quench, appraise, hitl]
|
|
|
9
9
|
|
|
10
10
|
A foundry cycle reads its definition from `foundry/cycles/<cycle-id>.md`, sets up WORK.md for routing, then hands control to the sort skill which drives the forge → quench → appraise loop.
|
|
11
11
|
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
15
|
+
|
|
16
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
17
|
+
|
|
12
18
|
## Cycle definition
|
|
13
19
|
|
|
14
20
|
The cycle definition (`foundry/cycles/<cycle-id>.md`) specifies:
|
package/skills/flow/SKILL.md
CHANGED
|
@@ -9,6 +9,12 @@ composes: [cycle]
|
|
|
9
9
|
|
|
10
10
|
A foundry flow reads a flow definition from `foundry/flows/`, creates a work branch, initialises WORK.md, and executes each foundry cycle in sequence.
|
|
11
11
|
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
15
|
+
|
|
16
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
17
|
+
|
|
12
18
|
## Starting a foundry flow
|
|
13
19
|
|
|
14
20
|
1. Read the flow definition from `foundry/flows/<flow-id>.md`
|
|
@@ -16,7 +22,7 @@ A foundry flow reads a flow definition from `foundry/flows/`, creates a work bra
|
|
|
16
22
|
3. Create `WORK.md` in the root following the spec in `docs/work-spec.md`:
|
|
17
23
|
- Set frontmatter: flow id, first cycle id, first stage
|
|
18
24
|
- Write the goal (from flow definition + human context)
|
|
19
|
-
- Empty artefacts table
|
|
25
|
+
- Empty artefacts table with all four columns: `| File | Type | Cycle | Status |`
|
|
20
26
|
- Empty feedback section
|
|
21
27
|
4. Execute each foundry cycle in order by reading its definition from `foundry/cycles/<cycle-id>.md`
|
|
22
28
|
5. Update the frontmatter cursor as each foundry cycle starts (set `cycle` to the new cycle id)
|
package/skills/forge/SKILL.md
CHANGED
|
@@ -8,6 +8,12 @@ description: Produces or revises an artefact, guided by WORK.md and the foundry
|
|
|
8
8
|
|
|
9
9
|
You produce or revise artefacts. You read WORK.md to understand the goal and feedback, and the foundry cycle definition to understand what you're producing and what inputs you can read.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Protocol
|
|
12
18
|
|
|
13
19
|
### First generation (no artefact registered in WORK.md yet)
|
|
@@ -20,7 +26,7 @@ You produce or revise artefacts. You read WORK.md to understand the goal and fee
|
|
|
20
26
|
6. If the foundry cycle has inputs, read the input artefacts (read-only context)
|
|
21
27
|
7. Produce the artefact, respecting all applicable laws from the start
|
|
22
28
|
8. Write the artefact to the location specified in the artefact type definition
|
|
23
|
-
9. Register the artefact in the WORK.md artefacts table
|
|
29
|
+
9. Register the artefact in the WORK.md artefacts table. The table MUST have all four columns — File, Type, Cycle, Status. Set cycle to the current cycle id from WORK.md frontmatter. Set status to `draft`.
|
|
24
30
|
|
|
25
31
|
### Revision (feedback exists in WORK.md)
|
|
26
32
|
|
package/skills/hitl/SKILL.md
CHANGED
|
@@ -8,6 +8,12 @@ description: Human-in-the-loop checkpoint. Pauses the cycle for human input befo
|
|
|
8
8
|
|
|
9
9
|
You are a human-in-the-loop checkpoint. Sort has routed to you because the cycle definition includes a pause point here. Your job is to present context, ask the human whatever needs asking, record their response, and return control to sort.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Protocol
|
|
12
18
|
|
|
13
19
|
1. Read `WORK.md` — understand the current state: goal, artefacts, feedback
|
|
@@ -29,18 +29,24 @@ Set up the `foundry/` directory structure in the current project.
|
|
|
29
29
|
appraisers/.gitkeep
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
3. **
|
|
32
|
+
3. **Generate foundry agent files**
|
|
33
|
+
|
|
34
|
+
Run the `refresh-agents` skill to generate `.opencode/agents/foundry-*.md` files for multi-model routing.
|
|
35
|
+
|
|
36
|
+
4. **Commit the structure**
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
|
-
git add foundry/
|
|
39
|
+
git add foundry/ .opencode/agents/foundry-*.md
|
|
36
40
|
git commit -m "feat: initialize Foundry project structure"
|
|
37
41
|
```
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
5. **Guide next steps**
|
|
40
44
|
|
|
41
45
|
Tell the user:
|
|
42
46
|
|
|
43
|
-
> Foundry is initialized.
|
|
47
|
+
> Foundry is initialized. **Restart OpenCode** for the new foundry agents to take effect.
|
|
48
|
+
>
|
|
49
|
+
> Here's how to set up your first pipeline:
|
|
44
50
|
>
|
|
45
51
|
> 1. **Define an artefact type** — use the `add-artefact-type` skill
|
|
46
52
|
> 2. **Add laws** — use the `add-law` skill to define quality criteria
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: list-agents
|
|
3
|
+
description: Use when you need to see which foundry-* sub-agents are available for multi-model routing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# List Agents
|
|
7
|
+
|
|
8
|
+
Output all available `foundry-*` sub-agents.
|
|
9
|
+
|
|
10
|
+
## Protocol
|
|
11
|
+
|
|
12
|
+
1. List all files matching `.opencode/agents/foundry-*.md`
|
|
13
|
+
2. For each file, read the `model` field from its YAML frontmatter
|
|
14
|
+
3. Output each agent name and its model, one per line
|
|
15
|
+
|
|
16
|
+
## Output format
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
foundry-<provider>-<model> → <provider>/<model>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
If no `foundry-*.md` files are found, output:
|
|
23
|
+
|
|
24
|
+
> No foundry agent files found. Run the `refresh-agents` skill to generate them.
|
package/skills/quench/SKILL.md
CHANGED
|
@@ -8,6 +8,12 @@ description: Deterministic validation of an artefact by running CLI commands. Wr
|
|
|
8
8
|
|
|
9
9
|
You run deterministic checks on an artefact by executing the CLI commands defined in the artefact type's validation file. No judgment — commands pass or fail.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## When this skill applies
|
|
12
18
|
|
|
13
19
|
This skill only runs if `foundry/artefacts/<type>/validation.md` exists. If there is no validation file for the artefact type, this skill is skipped.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refresh-agents
|
|
3
|
+
description: Use when initializing Foundry or after adding/removing providers to regenerate foundry-* agent files for multi-model routing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Refresh Agents
|
|
7
|
+
|
|
8
|
+
Regenerate `.opencode/agents/foundry-*.md` files from the currently available models.
|
|
9
|
+
|
|
10
|
+
## Protocol
|
|
11
|
+
|
|
12
|
+
1. Run `opencode models` to get all available `provider/model` IDs
|
|
13
|
+
2. Create `.opencode/agents/` directory if it does not exist
|
|
14
|
+
3. Delete all existing `.opencode/agents/foundry-*.md` files (stale agents from removed providers)
|
|
15
|
+
4. For each model line in the output, generate a markdown agent file
|
|
16
|
+
|
|
17
|
+
### Agent file format
|
|
18
|
+
|
|
19
|
+
Filename: `.opencode/agents/foundry-<provider>-<model-key>.md`
|
|
20
|
+
|
|
21
|
+
Where `<provider>-<model-key>` is the model ID with `/` replaced by `-`.
|
|
22
|
+
|
|
23
|
+
Example: model `opencode/claude-sonnet-4` produces `.opencode/agents/foundry-opencode-claude-sonnet-4.md`
|
|
24
|
+
|
|
25
|
+
Content:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
---
|
|
29
|
+
description: "Foundry stage agent using <provider>/<model-key>"
|
|
30
|
+
mode: subagent
|
|
31
|
+
model: "<provider>/<model-key>"
|
|
32
|
+
hidden: true
|
|
33
|
+
---
|
|
34
|
+
You are a Foundry stage agent. Follow the skill instructions provided in your task prompt exactly.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
5. After writing all files, output:
|
|
38
|
+
|
|
39
|
+
> Generated `<count>` foundry agent files in `.opencode/agents/`.
|
|
40
|
+
> **Restart OpenCode** for the new agents to take effect.
|
package/skills/sort/SKILL.md
CHANGED
|
@@ -8,6 +8,12 @@ description: Deterministic routing for a foundry cycle. Runs scripts/sort.js and
|
|
|
8
8
|
|
|
9
9
|
You are the central dispatcher for a foundry cycle. You run the sort script to determine what stage to execute next, then invoke that stage's skill.
|
|
10
10
|
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before running this skill, verify that the `foundry/` directory exists in the project root. If it does not exist, stop and tell the user:
|
|
14
|
+
|
|
15
|
+
> Foundry is not initialized in this project. Run the `init-foundry` skill first to create the foundry/ directory structure.
|
|
16
|
+
|
|
11
17
|
## Protocol
|
|
12
18
|
|
|
13
19
|
1. Run the sort script:
|