@really-knows-ai/foundry 2.0.0 → 2.0.1

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.
@@ -24,6 +24,31 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
24
24
  const packageRoot = path.resolve(__dirname, '../..');
25
25
  const allSkillsDir = path.join(packageRoot, 'skills');
26
26
 
27
+ function listFlows(foundryDir) {
28
+ const flowsDir = path.join(foundryDir, 'flows');
29
+ if (!fs.existsSync(flowsDir)) return [];
30
+ const flows = [];
31
+ for (const entry of readdirSync(flowsDir)) {
32
+ if (!entry.endsWith('.md') || entry === '.gitkeep') continue;
33
+ try {
34
+ const text = readFileSync(path.join(flowsDir, entry), 'utf-8');
35
+ const fmMatch = text.match(/^---\n([\s\S]*?)\n---/);
36
+ if (!fmMatch) continue;
37
+ const fm = fmMatch[1];
38
+ const idMatch = fm.match(/^id:\s*(.+)$/m);
39
+ const nameMatch = fm.match(/^name:\s*(.+)$/m);
40
+ const startingMatch = fm.match(/^starting-cycles:\s*\n((?:\s*-\s*.+\n?)+)/m);
41
+ const id = idMatch ? idMatch[1].trim() : entry.replace(/\.md$/, '');
42
+ const name = nameMatch ? nameMatch[1].trim() : id;
43
+ const startingCycles = startingMatch
44
+ ? startingMatch[1].split('\n').map(l => l.replace(/^\s*-\s*/, '').trim()).filter(Boolean)
45
+ : [];
46
+ flows.push({ id, name, startingCycles });
47
+ } catch { /* skip bad files */ }
48
+ }
49
+ return flows;
50
+ }
51
+
27
52
  function getBootstrapContent(directory) {
28
53
  const foundryDir = path.join(directory, 'foundry');
29
54
  const foundryExists = fs.existsSync(foundryDir) && fs.statSync(foundryDir).isDirectory();
@@ -37,6 +62,14 @@ and guide you through defining artefact types, laws, appraisers, cycles, and flo
37
62
  </FOUNDRY_CONTEXT>`;
38
63
  }
39
64
 
65
+ const flows = listFlows(foundryDir);
66
+ const flowList = flows.length > 0
67
+ ? flows.map(f => {
68
+ const sc = f.startingCycles.length > 0 ? ` — starting cycles: ${f.startingCycles.join(', ')}` : '';
69
+ return `- \`${f.id}\` — ${f.name}${sc}`;
70
+ }).join('\n')
71
+ : '- (no flows defined yet — use the `add-flow` skill to create one)';
72
+
40
73
  return `<FOUNDRY_CONTEXT>
41
74
  Foundry is active in this project. The foundry/ directory contains the project's artefact definitions,
42
75
  laws, appraisers, cycles, and flows.
@@ -44,15 +77,32 @@ laws, appraisers, cycles, and flows.
44
77
  Foundry is a skill-driven framework for governed artefact generation and evaluation.
45
78
  The pipeline: forge (produce) → quench (deterministic checks) → appraise (subjective evaluation) → iterate.
46
79
 
47
- Available skills:
48
- - **Pipeline:** forge, quench, appraise, cycle, flow, sort, hitl
49
- - **Helpers:** add-artefact-type, add-law, add-appraiser, add-cycle, add-flow, init-foundry
80
+ ## Defined flows
81
+
82
+ ${flowList}
83
+
84
+ **CRITICAL ROUTING RULE:** When the user references any flow above — by id (e.g. "creative-flow"),
85
+ by name (e.g. "Creative Flow"), or by clear paraphrase (e.g. "the creative flow", "use the creative pipeline") —
86
+ invoke the \`flow\` skill DIRECTLY with that flow's id. Do NOT invoke brainstorming, do NOT explore the
87
+ codebase, do NOT ask clarifying questions about what to build. The flow's cycles already define the
88
+ work. The user's request text (e.g. "make a haiku about X") is the goal to pass to the flow.
89
+
90
+ Brainstorming applies to NEW features being added to foundry itself (new cycles, new artefact types,
91
+ new skills). It does NOT apply to running an existing, defined flow.
92
+
93
+ ## Available skills
94
+
95
+ - **Pipeline:** forge, quench, appraise, cycle, flow, sort, human-appraise
96
+ - **Authoring:** add-artefact-type, add-law, add-appraiser, add-cycle, add-flow, init-foundry
97
+ - **Maintenance:** upgrade-foundry, refresh-agents, list-agents
98
+
99
+ ## Multi-model routing
50
100
 
51
- Multi-model routing: Foundry uses \`foundry-*\` sub-agents defined as markdown files in \`.opencode/agents/\`.
101
+ Foundry uses \`foundry-*\` sub-agents defined as markdown files in \`.opencode/agents/\`.
52
102
  Run the \`refresh-agents\` skill to regenerate them after adding or removing providers.
53
103
  Cycle definitions can specify per-stage models via the \`models\` frontmatter map. Appraisers can override with their own \`model\` field.
54
104
 
55
- To start a flow, use the \`flow\` skill. All user content lives under foundry/.
105
+ All user content lives under foundry/.
56
106
  Scripts are located at: ${path.join(packageRoot, 'scripts')}
57
107
  </FOUNDRY_CONTEXT>`;
58
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@really-knows-ai/foundry",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
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",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: flow
3
3
  type: composite
4
- description: Orchestrates foundry cycles as a dependency graph, driven by a flow definition.
4
+ description: Runs a defined foundry flow to produce artefacts. Use this whenever the user references a flow by id, name, or paraphrase (e.g. "use the creative flow", "run creative-flow"). Do not brainstorm — the flow's cycles already define the work. The user's request is the goal to pass in.
5
5
  composes: [cycle]
6
6
  ---
7
7