@really-knows-ai/foundry 2.1.0 → 2.3.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.
@@ -1,79 +0,0 @@
1
- ---
2
- name: sort
3
- type: atomic
4
- description: Deterministic routing for a foundry cycle. Runs the foundry_sort tool and returns the next stage.
5
- ---
6
-
7
- # Sort
8
-
9
- You are the central dispatcher for a foundry cycle. You call the `foundry_sort` tool to determine what stage to execute next, then dispatch that stage to a fresh subagent.
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
-
17
- ## Protocol
18
-
19
- 1. Call `foundry_sort` (optionally passing `cycleDef` if the cycle definition has a non-standard path). It returns `{route, model?, details?}`.
20
-
21
- 2. Call `foundry_history_append` with the current cycle, stage `"sort"`, and a comment explaining the routing decision in natural language. This is your audit trail — if something goes wrong, this comment is what someone will read to understand what happened.
22
-
23
- 3. Act on the route:
24
- - `forge:*` — **dispatch** (see §Dispatch below)
25
- - `quench:*` — **dispatch**
26
- - `appraise:*` — **dispatch**. Note: the appraise skill handles its own per-appraiser model resolution internally.
27
- - `human-appraise:*` — invoke the human-appraise skill inline (human stage, no subagent)
28
- - `done` — foundry cycle is complete, return to the cycle skill
29
- - `blocked` — foundry cycle is blocked (iteration limit hit with unresolved feedback), return to the cycle skill
30
- - `violation` — a validation, file-modification, or missing-subagent violation was detected (see `details`). The cycle halts — call `foundry_artefacts_set_status` with status `"blocked"` for each affected artefact, and return to the cycle skill. If `details` mentions a missing subagent, tell the user to run the `refresh-agents` skill and restart.
31
-
32
- 4. After the subagent completes, call `foundry_history_append` with the current cycle, the **dispatched stage alias** (e.g., `forge:write-haiku`), and a comment summarizing what the subagent reported doing. This is critical — sort is the only reliable writer of stage history. Subagents must NOT write their own history entries.
33
-
34
- 5. After logging the stage history, call `foundry_sort` again. Repeat from step 1 until it returns `done`, `blocked`, or `violation`.
35
-
36
- ## Dispatch
37
-
38
- Every forge, quench, and appraise stage runs in a **fresh subagent**. Never inline the stage work in the orchestrator conversation — even if the chosen model happens to match the orchestrator's model. The orchestrator's job is to route and log, nothing else.
39
-
40
- ### Choosing the subagent
41
-
42
- - If `foundry_sort` returned a `model` field in its response, use that value verbatim as `subagent_type`. It is already in `foundry-<slug>` form (the tool does the slug computation by replacing both `/` and `.` with `-` in the model ID).
43
- - If `foundry_sort` returned **no** `model` field (the cycle has no `models:` map, or no entry for this stage base), dispatch to the default general-purpose subagent: `general`.
44
-
45
- ### Dispatch call shape
46
-
47
- Use the `task` tool:
48
-
49
- ```
50
- task tool:
51
- subagent_type: <model-slug-from-foundry_sort-response, or "general">
52
- description: "Run <stage-alias> for <cycle-id>"
53
- prompt: |
54
- You are a Foundry stage agent. Invoke the <stage-base> skill and follow its instructions exactly.
55
-
56
- Current cycle: <cycle-id>
57
- Current stage: <stage-alias>
58
- Working directory: <worktree>
59
-
60
- When done, report back a brief summary of what you did. Do NOT call foundry_history_append — the orchestrator handles history.
61
- ```
62
-
63
- Substitute:
64
- - `<stage-alias>` — the full route string from `foundry_sort` (e.g., `forge:write-haiku`)
65
- - `<stage-base>` — the base of the alias (e.g., `forge`, `quench`, `appraise`)
66
- - `<cycle-id>` — the current cycle ID from WORK.md frontmatter
67
- - `<worktree>` — the current working directory
68
-
69
- ### Missing subagent (fail-fast)
70
-
71
- The `foundry_sort` tool verifies that the required `.opencode/agents/foundry-<slug>.md` file exists before returning a `model`. If it doesn't, sort returns `{route: 'violation', details: 'Missing required subagent: ...'}`. Handle this as described in step 3 above — halt the cycle, mark artefacts blocked, and instruct the user to run the `refresh-agents` skill.
72
-
73
- ## What you do NOT do
74
-
75
- - You do not make routing decisions yourself — the tool decides.
76
- - You do not skip calling `foundry_sort`.
77
- - You do not override the tool's output.
78
- - You do not skip the history entry — every sort invocation gets a `sort` entry, and every completed stage gets a stage entry (e.g., `forge:write-haiku`). You are the sole writer of history.
79
- - You do **not** inline forge/quench/appraise work — always dispatch to a subagent via the `task` tool, even when the resolved model matches the orchestrator's own model.