@heretek-ai/epistemic-swarm 0.2.2 → 0.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.
Files changed (138) hide show
  1. package/.agents/skills/brainstorming/SKILL.md +13 -0
  2. package/.agents/skills/code_audit/SKILL.md +13 -0
  3. package/.agents/skills/epistemic_search/SKILL.md +13 -0
  4. package/.agents/skills/grilling/SKILL.md +13 -0
  5. package/.agents/skills/oss_scout/SKILL.md +13 -0
  6. package/.agents/skills/research_cache/SKILL.md +13 -0
  7. package/.agents/skills/swarm_config/SKILL.md +13 -0
  8. package/.claude-plugin/plugin.json +15 -5
  9. package/.omp/README.md +39 -0
  10. package/.omp/SYSTEM.md +12 -0
  11. package/.omp/commands/audit.md +10 -0
  12. package/.omp/commands/brainstorming.md +12 -0
  13. package/.omp/commands/grill.md +9 -0
  14. package/.omp/commands/scout.md +10 -0
  15. package/.omp/commands/swarm-config.md +10 -0
  16. package/.omp/commands/swarm.md +9 -0
  17. package/.omp/hooks/post/epistemic-audit.ts +16 -0
  18. package/.omp/hooks/pre/epistemic-redirect.ts +21 -0
  19. package/.omp/prompts/brainstorming.md +8 -0
  20. package/.omp/prompts/swarm.md +8 -0
  21. package/MARKETPLACE.md +8 -0
  22. package/README.md +53 -8
  23. package/bin/cli.js +27 -3
  24. package/config/domain_packs/biopharma.json +23 -0
  25. package/config/domain_packs/legal.json +19 -0
  26. package/config/domain_packs/quant.json +19 -0
  27. package/config/mcp-research-servers.json +7 -0
  28. package/config/mcp_launcher.py +48 -137
  29. package/config/opencode-snippet.json +58 -3
  30. package/config/searxng_mcp.py +42 -83
  31. package/extensions/pi/index.js +196 -28
  32. package/install.sh +20 -4
  33. package/package.json +40 -5
  34. package/plugins/antigravity/README.md +28 -0
  35. package/plugins/antigravity/agents/alpha-thesis.md +6 -0
  36. package/plugins/antigravity/agents/beta-antithesis.md +7 -0
  37. package/plugins/antigravity/agents/brainstormer.md +7 -0
  38. package/plugins/antigravity/agents/epistemic-auditor.md +5 -0
  39. package/plugins/antigravity/hooks.json +23 -0
  40. package/plugins/antigravity/mcp_config.json +33 -0
  41. package/plugins/antigravity/plugin.json +21 -0
  42. package/plugins/antigravity/rules/epistemic-integrity.md +6 -0
  43. package/plugins/antigravity/skills/brainstorming/SKILL.md +13 -0
  44. package/plugins/antigravity/skills/code_audit/SKILL.md +13 -0
  45. package/plugins/antigravity/skills/epistemic_search/SKILL.md +13 -0
  46. package/plugins/antigravity/skills/grilling/SKILL.md +13 -0
  47. package/plugins/antigravity/skills/oss_scout/SKILL.md +13 -0
  48. package/plugins/antigravity/skills/research_cache/SKILL.md +13 -0
  49. package/plugins/antigravity/skills/swarm_config/SKILL.md +13 -0
  50. package/plugins/codex/AGENTS.md.snippet +10 -0
  51. package/plugins/codex/README.md +37 -0
  52. package/plugins/codex/config.toml.snippet +28 -0
  53. package/plugins/codex/openai.yaml +24 -0
  54. package/plugins/codex/skills/brainstorming/SKILL.md +13 -0
  55. package/plugins/codex/skills/code_audit/SKILL.md +13 -0
  56. package/plugins/codex/skills/epistemic_search/SKILL.md +13 -0
  57. package/plugins/codex/skills/grilling/SKILL.md +13 -0
  58. package/plugins/codex/skills/oss_scout/SKILL.md +13 -0
  59. package/plugins/codex/skills/research_cache/SKILL.md +13 -0
  60. package/plugins/codex/skills/swarm_config/SKILL.md +13 -0
  61. package/plugins/gemini/GEMINI.md +15 -0
  62. package/plugins/gemini/README.md +19 -0
  63. package/plugins/gemini/commands/audit.toml +6 -0
  64. package/plugins/gemini/commands/brainstorming.toml +10 -0
  65. package/plugins/gemini/commands/grill.toml +6 -0
  66. package/plugins/gemini/commands/scout.toml +7 -0
  67. package/plugins/gemini/commands/swarm-config.toml +7 -0
  68. package/plugins/gemini/commands/swarm.toml +8 -0
  69. package/plugins/gemini/gemini-extension.json +38 -0
  70. package/plugins/gemini/hooks/hooks.json +11 -0
  71. package/plugins/gemini/skills/brainstorming/SKILL.md +13 -0
  72. package/plugins/gemini/skills/code_audit/SKILL.md +13 -0
  73. package/plugins/gemini/skills/epistemic_search/SKILL.md +13 -0
  74. package/plugins/gemini/skills/grilling/SKILL.md +13 -0
  75. package/plugins/gemini/skills/oss_scout/SKILL.md +13 -0
  76. package/plugins/gemini/skills/research_cache/SKILL.md +13 -0
  77. package/plugins/gemini/skills/swarm_config/SKILL.md +13 -0
  78. package/plugins/opencode/index.js +335 -118
  79. package/prompts/agent_brainstormer.md +97 -0
  80. package/runner/__pycache__/__init__.cpython-311.pyc +0 -0
  81. package/runner/__pycache__/auctioneer.cpython-311.pyc +0 -0
  82. package/runner/__pycache__/auditor_engine.cpython-311.pyc +0 -0
  83. package/runner/__pycache__/claim_store.cpython-311.pyc +0 -0
  84. package/runner/__pycache__/claim_witness.cpython-311.pyc +0 -0
  85. package/runner/__pycache__/living_dossiers.cpython-311.pyc +0 -0
  86. package/runner/__pycache__/mcp_protocol.cpython-311.pyc +0 -0
  87. package/runner/__pycache__/mcp_server.cpython-311.pyc +0 -0
  88. package/runner/__pycache__/pcrb.cpython-311.pyc +0 -0
  89. package/runner/__pycache__/pcrb_verify.cpython-311.pyc +0 -0
  90. package/runner/__pycache__/refinement.cpython-311.pyc +0 -0
  91. package/runner/__pycache__/research_swarm.cpython-311.pyc +0 -0
  92. package/runner/__pycache__/state_machine.cpython-311.pyc +0 -0
  93. package/runner/auctioneer.py +169 -0
  94. package/runner/auditor_engine.py +127 -12
  95. package/runner/claim_store.py +361 -0
  96. package/runner/claim_witness.py +183 -0
  97. package/runner/living_dossiers.py +355 -0
  98. package/runner/mcp_protocol.py +188 -0
  99. package/runner/mcp_server.py +567 -0
  100. package/runner/pcrb.py +212 -0
  101. package/runner/pcrb_verify.py +237 -0
  102. package/runner/refinement.py +335 -0
  103. package/runner/research_swarm.py +378 -94
  104. package/runner/tests/__pycache__/test_auction_order.cpython-311.pyc +0 -0
  105. package/runner/tests/__pycache__/test_claim_store.cpython-311.pyc +0 -0
  106. package/runner/tests/__pycache__/test_claim_witness.cpython-311.pyc +0 -0
  107. package/runner/tests/__pycache__/test_domain_packs.cpython-311.pyc +0 -0
  108. package/runner/tests/__pycache__/test_fleet_seam.cpython-311.pyc +0 -0
  109. package/runner/tests/__pycache__/test_living_dossiers.cpython-311.pyc +0 -0
  110. package/runner/tests/__pycache__/test_mcp_server.cpython-311.pyc +0 -0
  111. package/runner/tests/__pycache__/test_pcrb.cpython-311.pyc +0 -0
  112. package/runner/tests/__pycache__/test_refinement.cpython-311.pyc +0 -0
  113. package/runner/tests/__pycache__/test_swarm.cpython-311.pyc +0 -0
  114. package/runner/tests/fixtures/auction_objective.json +35 -0
  115. package/runner/tests/fixtures/borderline_claims.json +27 -0
  116. package/runner/tests/fixtures/divergence_objectives.json +31 -0
  117. package/runner/tests/test_auction_order.py +173 -0
  118. package/runner/tests/test_claim_store.py +162 -0
  119. package/runner/tests/test_claim_witness.py +186 -0
  120. package/runner/tests/test_domain_packs.py +217 -0
  121. package/runner/tests/test_fleet_seam.py +113 -0
  122. package/runner/tests/test_living_dossiers.py +204 -0
  123. package/runner/tests/test_mcp_server.py +212 -0
  124. package/runner/tests/test_pcrb.py +240 -0
  125. package/runner/tests/test_refinement.py +255 -0
  126. package/runner/tests/test_swarm.py +173 -15
  127. package/scripts/auction_experiment.py +180 -0
  128. package/scripts/build_adapters.py +183 -0
  129. package/scripts/divergence_experiment.py +184 -0
  130. package/skills/brainstorming/SKILL.md +106 -0
  131. package/skills/brainstorming/__init__.py +1 -0
  132. package/skills/brainstorming/scripts/brainstorm.py +200 -0
  133. package/skills/research_cache/__pycache__/__init__.cpython-311.pyc +0 -0
  134. package/skills/research_cache/__pycache__/hasher.cpython-311.pyc +0 -0
  135. package/skills/swarm_config/SKILL.md +1 -1
  136. package/skills/swarm_config/__pycache__/__init__.cpython-311.pyc +0 -0
  137. package/skills/swarm_config/__pycache__/configure.cpython-311.pyc +0 -0
  138. package/skills/swarm_config/configure.py +45 -11
@@ -1,9 +1,14 @@
1
1
  /**
2
2
  * IUMBTEMS: I Use My Brain To Express My Self
3
3
  * Native Plugin for OpenCode V2 (opencode.ai)
4
- *
5
- * Exposes dialectic swarm research tools, Socratic decision frontier calculation,
6
- * and content-addressed quote verification directly into OpenCode V2 agents.
4
+ *
5
+ * THIN REGISTRATION (Stream A2b): this plugin no longer implements tools.
6
+ * Every tool forwards to the canonical first-party MCP surface:
7
+ *
8
+ * python3 runner/mcp_server.py call <tool> '<json>'
9
+ *
10
+ * The plugin exists only so OpenCode V2 hosts can discover the iumbtems_*
11
+ * catalog. Schemas mirror runner/mcp_server.py build_tools() — keep in sync.
7
12
  */
8
13
 
9
14
  import { spawnSync } from 'child_process';
@@ -13,135 +18,347 @@ import { fileURLToPath } from 'url';
13
18
  const __filename = fileURLToPath(import.meta.url);
14
19
  const __dirname = path.dirname(__filename);
15
20
  const PKG_ROOT = path.resolve(__dirname, '../..');
21
+ const MCP_SERVER = path.join(PKG_ROOT, 'runner', 'mcp_server.py');
16
22
 
17
- export function createOpenCodePlugin(context = {}) {
23
+ /** Uniform dispatch: one-shot MCP call, return OpenCode's {content, status}. */
24
+ function callMcp(tool, args = {}, cwd) {
25
+ const res = spawnSync(
26
+ 'python3',
27
+ [MCP_SERVER, 'call', tool, JSON.stringify(args || {})],
28
+ {
29
+ encoding: 'utf-8',
30
+ cwd: cwd || process.cwd(),
31
+ env: { ...process.env, PYTHONPATH: PKG_ROOT },
32
+ }
33
+ );
18
34
  return {
19
- id: "heretek.iumbtems.epistemic-swarm",
20
- name: "IUMBTEMS Epistemic Swarm",
21
- version: "0.1.0",
22
- description: "I Use My Brain To Express My Self: Dialectic research swarm enforcing empirical verification",
35
+ content: res.stdout || res.stderr,
36
+ status: res.status === 0 ? 'success' : 'error',
37
+ };
38
+ }
23
39
 
24
- server: (toolContext) => [
25
- {
26
- name: "iumbtems_swarm_research",
27
- description: "Execute an autonomous dialectic research swarm on an objective using Agent Alpha (Thesis) and Agent Beta (Red Team).",
28
- input: {
29
- type: "object",
30
- properties: {
31
- objective: {
32
- type: "string",
33
- description: "The research question or hypothesis to investigate"
34
- },
35
- mock_mode: {
36
- type: "boolean",
37
- description: "Run in mock/dry-run mode without external API charges",
38
- default: false
39
- }
40
- },
41
- required: ["objective"]
42
- },
43
- options: { codemode: false },
44
- execute: async (args) => {
45
- const runnerPath = path.join(PKG_ROOT, "runner/research_swarm.py");
46
- const cmdArgs = [runnerPath, "--objective", args.objective];
47
- if (args.mock_mode) {
48
- cmdArgs.push("--mock-claude");
49
- }
40
+ /** Catalog mirrors runner/mcp_server.py build_tools(). */
41
+ export const IUMBTEMS_TOOL_NAMES = [
42
+ 'iumbtems_config',
43
+ 'iumbtems_swarm_research',
44
+ 'iumbtems_code_audit',
45
+ 'iumbtems_oss_scout',
46
+ 'iumbtems_brainstorm',
47
+ 'iumbtems_verify_quote',
48
+ 'iumbtems_socratic_frontier',
49
+ 'iumbtems_reindex_claims',
50
+ 'iumbtems_report_retraction',
51
+ 'iumbtems_check_staleness',
52
+ 'iumbtems_set_domain_pack',
53
+ 'iumbtems_export_brief',
54
+ 'iumbtems_verify_brief',
55
+ ];
50
56
 
51
- const res = spawnSync("python3", cmdArgs, {
52
- encoding: "utf-8",
53
- cwd: toolContext?.cwd || process.cwd(),
54
- env: { ...process.env, PYTHONPATH: PKG_ROOT }
55
- });
57
+ // Deprecated misspelled alias (pre-A2b export). Remove in a semver-major.
58
+ export const IUMBEMS_TOOL_NAMES = IUMBTEMS_TOOL_NAMES;
56
59
 
57
- return {
58
- content: res.stdout || res.stderr,
59
- status: res.status === 0 ? "success" : "error"
60
- };
61
- }
60
+ const TOOL_CATALOG = [
61
+ {
62
+ name: 'iumbtems_config',
63
+ description:
64
+ 'Inspect or modify the active Epistemic Swarm configuration (search engine, depth/iterations, operating mode, divergence threshold) in .research/config.json.',
65
+ input: {
66
+ type: 'object',
67
+ properties: {
68
+ search_engine: {
69
+ type: 'string',
70
+ enum: ['duckduckgo', 'brave', 'firecrawl', 'searxng'],
71
+ description: 'Primary search engine (duckduckgo is the zero-key free default)',
72
+ },
73
+ max_iterations: {
74
+ type: 'integer',
75
+ minimum: 1,
76
+ maximum: 4,
77
+ description: 'Maximum dialectic research iterations / depth (1-4)',
78
+ },
79
+ mode: {
80
+ type: 'string',
81
+ enum: ['research', 'audit', 'scout', 'hybrid', 'brainstorm'],
82
+ description: 'Operating mode: research (literature), audit (codebase), scout (OSS), hybrid, brainstorm (lateral ideation)',
83
+ },
84
+ divergence_threshold: {
85
+ type: 'number',
86
+ minimum: 0.0,
87
+ maximum: 1.0,
88
+ description: 'Auditor divergence threshold (default 0.75)',
89
+ },
90
+ show: {
91
+ type: 'boolean',
92
+ description: 'Just inspect current configuration without modifying',
93
+ default: false,
94
+ },
62
95
  },
63
-
64
- {
65
- name: "iumbtems_verify_quote",
66
- description: "Cryptographically verify whether a cited quote matches verbatim text inside the content-addressed source cache.",
67
- input: {
68
- type: "object",
69
- properties: {
70
- hash: {
71
- type: "string",
72
- description: "SHA-256 hash or prefix of the cached source"
73
- },
74
- quote: {
75
- type: "string",
76
- description: "The verbatim excerpt to verify"
77
- }
78
- },
79
- required: ["hash", "quote"]
96
+ },
97
+ },
98
+ {
99
+ name: 'iumbtems_swarm_research',
100
+ description:
101
+ 'Execute an autonomous dialectic research swarm on an objective using Agent Alpha (Thesis) and Agent Beta (Red Team). Long-running; blocks until the swarm completes.',
102
+ input: {
103
+ type: 'object',
104
+ properties: {
105
+ objective: {
106
+ type: 'string',
107
+ description: 'The research question or hypothesis to investigate',
108
+ },
109
+ mock_mode: {
110
+ type: 'boolean',
111
+ description: 'Run in mock/dry-run mode without external API charges',
112
+ default: false,
80
113
  },
81
- options: { codemode: false },
82
- execute: async (args) => {
83
- const hasherPath = path.join(PKG_ROOT, "skills/research-cache/hasher.py");
84
- const res = spawnSync("python3", [hasherPath, "verify", "--hash", args.hash, "--quote", args.quote], {
85
- encoding: "utf-8",
86
- cwd: toolContext?.cwd || process.cwd()
87
- });
88
-
89
- return {
90
- content: res.stdout || res.stderr,
91
- status: res.status === 0 ? "verified" : "failed"
92
- };
93
- }
94
114
  },
95
-
96
- {
97
- name: "iumbtems_socratic_frontier",
98
- description: "Inspect or advance the Socratic grilling decision frontier for research framing.",
99
- input: {
100
- type: "object",
101
- properties: {
102
- objective: {
103
- type: "string",
104
- description: "Research objective to inspect"
105
- },
106
- settle_node: {
107
- type: "string",
108
- description: "Optional node ID to settle with an answer"
109
- },
110
- settle_answer: {
111
- type: "string",
112
- description: "Answer for the settled node"
113
- }
114
- }
115
+ required: ['objective'],
116
+ },
117
+ },
118
+ {
119
+ name: 'iumbtems_code_audit',
120
+ description:
121
+ 'Run a dialectic codebase architectural and security audit pairing a structural architect with an adversarial red-teamer.',
122
+ input: {
123
+ type: 'object',
124
+ properties: {
125
+ target: {
126
+ type: 'string',
127
+ description: 'Target directory, file, or architectural component to audit',
115
128
  },
116
- options: { codemode: false },
117
- execute: async (args) => {
118
- const treePath = path.join(PKG_ROOT, "skills/grilling/socratic_tree.py");
119
- const cmdArgs = [treePath];
129
+ mock_mode: {
130
+ type: 'boolean',
131
+ description: 'Run in mock mode without invoking LLM tokens',
132
+ default: false,
133
+ },
134
+ },
135
+ required: ['target'],
136
+ },
137
+ },
138
+ {
139
+ name: 'iumbtems_oss_scout',
140
+ description:
141
+ 'Scout open-source software libraries, benchmark candidate implementations, red-team viral copyleft (GPL/AGPL), and produce clean-room implementation blueprints.',
142
+ input: {
143
+ type: 'object',
144
+ properties: {
145
+ feature: {
146
+ type: 'string',
147
+ description: 'The feature, algorithm, or capability to scout in open source',
148
+ },
149
+ mock_mode: {
150
+ type: 'boolean',
151
+ description: 'Run in mock mode without invoking LLM tokens',
152
+ default: false,
153
+ },
154
+ },
155
+ required: ['feature'],
156
+ },
157
+ },
158
+ {
159
+ name: 'iumbtems_brainstorm',
160
+ description:
161
+ 'Run lateral brainstorming: novel feature vectors, paradigm inversions, and falsifiable spike hypotheses (never bug-fix lists).',
162
+ input: {
163
+ type: 'object',
164
+ properties: {
165
+ objective: {
166
+ type: 'string',
167
+ description: "Ambiguous exploration prompt (e.g. 'Where do we go from here?')",
168
+ },
169
+ mock_mode: {
170
+ type: 'boolean',
171
+ description: 'Run in mock/dry-run mode without external API charges',
172
+ default: false,
173
+ },
174
+ },
175
+ required: ['objective'],
176
+ },
177
+ },
178
+ {
179
+ name: 'iumbtems_verify_quote',
180
+ description:
181
+ 'Cryptographically verify whether a cited quote matches verbatim text inside the content-addressed source cache.',
182
+ input: {
183
+ type: 'object',
184
+ properties: {
185
+ hash: {
186
+ type: 'string',
187
+ description: 'SHA-256 hash or prefix of the cached source',
188
+ },
189
+ quote: {
190
+ type: 'string',
191
+ description: 'The verbatim excerpt to verify',
192
+ },
193
+ },
194
+ required: ['hash', 'quote'],
195
+ },
196
+ },
197
+ {
198
+ name: 'iumbtems_socratic_frontier',
199
+ description: 'Inspect or advance the Socratic grilling decision frontier for research framing.',
200
+ input: {
201
+ type: 'object',
202
+ properties: {
203
+ objective: {
204
+ type: 'string',
205
+ description: 'Research objective to inspect',
206
+ },
207
+ settle_node: {
208
+ type: 'string',
209
+ description: 'Optional node ID to settle with an answer',
210
+ },
211
+ settle_answer: {
212
+ type: 'string',
213
+ description: 'Answer for the settled node',
214
+ },
215
+ },
216
+ },
217
+ },
218
+ {
219
+ name: 'iumbtems_reindex_claims',
220
+ description:
221
+ 'Rebuild the derived claims.sqlite index from .research flat files (idempotent; flat files are source of truth).',
222
+ input: {
223
+ type: 'object',
224
+ properties: {
225
+ base_dir: {
226
+ type: 'string',
227
+ description: 'Path to .research workspace',
228
+ },
229
+ },
230
+ },
231
+ },
232
+ {
233
+ name: 'iumbtems_report_retraction',
234
+ description:
235
+ 'Record a RETRACTED/REVISED event for a cached source; dependent VERIFIED claims degrade to STALE/SUSPECT on the next audit (Living Dossiers).',
236
+ input: {
237
+ type: 'object',
238
+ properties: {
239
+ hash: { type: 'string', description: 'Content-addressed SHA-256 of the affected source' },
240
+ event: { type: 'string', enum: ['RETRACTED', 'REVISED'] },
241
+ note: { type: 'string', description: 'Why the source was retracted/revised' },
242
+ base_dir: { type: 'string' },
243
+ },
244
+ required: ['hash', 'event'],
245
+ },
246
+ },
247
+ {
248
+ name: 'iumbtems_check_staleness',
249
+ description:
250
+ 'Run one claim-degradation pass: join claims against retraction events, write the status ledger, and queue re-runs for degraded scopes. Never mutates dossiers.',
251
+ input: {
252
+ type: 'object',
253
+ properties: {
254
+ base_dir: { type: 'string' },
255
+ scope_ids: {
256
+ type: 'array',
257
+ items: { type: 'string' },
258
+ description: 'Limit the pass to specific scopes',
259
+ },
260
+ },
261
+ },
262
+ },
263
+ {
264
+ name: 'iumbtems_set_domain_pack',
265
+ description:
266
+ 'Activate a Regulated Domain Pack (biopharma/quant/legal epistemic constitution) for subsequent audits.',
267
+ input: {
268
+ type: 'object',
269
+ properties: {
270
+ pack: { type: 'string', description: 'Pack id: biopharma | quant | legal (or a path)' },
271
+ base_dir: { type: 'string' },
272
+ },
273
+ required: ['pack'],
274
+ },
275
+ },
276
+ {
277
+ name: 'iumbtems_export_brief',
278
+ description:
279
+ 'Export a proof-carrying research brief (PCRB): self-contained signed bundle of synthesis, claims, quote witnesses, and full source texts.',
280
+ input: {
281
+ type: 'object',
282
+ properties: {
283
+ base_dir: { type: 'string' },
284
+ out: { type: 'string', description: 'Output path (default <base_dir>/brief.pcrb.json)' },
285
+ objective: { type: 'string' },
286
+ key: { type: 'string', description: 'HMAC key (prefer key_file or env IUMBTEMS_PCRB_KEY)' },
287
+ key_file: { type: 'string' },
288
+ },
289
+ },
290
+ },
291
+ {
292
+ name: 'iumbtems_verify_brief',
293
+ description:
294
+ 'Verify a proof-carrying brief against its BUNDLED sources: manifest integrity, HMAC signature, and every quote re-checked. Exit-fail semantics; no trust in the producing LLM.',
295
+ input: {
296
+ type: 'object',
297
+ properties: {
298
+ brief: { type: 'string', description: 'Path to brief.pcrb.json' },
299
+ key: { type: 'string' },
300
+ key_file: { type: 'string' },
301
+ },
302
+ required: ['brief'],
303
+ },
304
+ },
305
+ ];
120
306
 
121
- if (args.settle_node && args.settle_answer) {
122
- cmdArgs.push("--settle", args.settle_node, args.settle_answer);
123
- } else if (args.objective) {
124
- cmdArgs.push("--objective", args.objective, "--show-frontier");
125
- } else {
126
- cmdArgs.push("--show-frontier");
127
- }
307
+ /** Legacy arg shims -> MCP handler contract. */
308
+ function normalizeArgs(tool, args = {}) {
309
+ const a = { ...args };
310
+ if (a.mock_mode && a.mock_claude === undefined) {
311
+ a.mock_claude = a.mock_mode;
312
+ delete a.mock_mode;
313
+ }
314
+ if (a.show) {
315
+ delete a.show; // read-only inspect is the no-op default of iumbtems_config
316
+ }
317
+ if (tool === 'iumbtems_socratic_frontier') {
318
+ if (a.settle_node && a.settle_answer) {
319
+ a.settle = [a.settle_node, a.settle_answer];
320
+ delete a.settle_node;
321
+ delete a.settle_answer;
322
+ }
323
+ if (!a.file) {
324
+ a.file = '.research/frontier.json';
325
+ }
326
+ }
327
+ return a;
328
+ }
128
329
 
129
- const res = spawnSync("python3", cmdArgs, {
130
- encoding: "utf-8",
131
- cwd: toolContext?.cwd || process.cwd()
132
- });
330
+ export function createOpenCodePlugin(context = {}) {
331
+ return {
332
+ id: 'heretek.iumbtems.epistemic-swarm',
333
+ name: 'IUMBTEMS Epistemic Swarm',
334
+ version: '0.3.0',
335
+ description:
336
+ 'I Use My Brain To Express My Self: High-integrity dialectic research, code audits, and open-source scouting',
133
337
 
134
- return {
135
- content: res.stdout || res.stderr
136
- };
137
- }
138
- }
139
- ],
338
+ server: (toolContext) =>
339
+ TOOL_CATALOG.map((tool) => ({
340
+ ...tool,
341
+ options: { codemode: false },
342
+ execute: async (args = {}) =>
343
+ callMcp(tool.name, normalizeArgs(tool.name, args), toolContext?.cwd),
344
+ })),
140
345
 
141
346
  setup: async (appContext) => {
142
- // OpenCode V2 lifecycle hook
143
- return { initialized: true, platform: "opencode-v2" };
144
- }
347
+ const opts = context.options || appContext?.options;
348
+ if (opts && typeof opts === 'object') {
349
+ const updates = {};
350
+ if (opts.search_engine) updates.search_engine = opts.search_engine;
351
+ if (opts.max_iterations) updates.max_iterations = opts.max_iterations;
352
+ if (opts.mode) updates.mode = opts.mode;
353
+ if (opts.divergence_threshold !== undefined) {
354
+ updates.divergence_threshold = opts.divergence_threshold;
355
+ }
356
+ if (Object.keys(updates).length > 0) {
357
+ callMcp('iumbtems_config', updates, appContext?.cwd);
358
+ }
359
+ }
360
+ return { initialized: true, platform: 'opencode-v2' };
361
+ },
145
362
  };
146
363
  }
147
364
 
@@ -0,0 +1,97 @@
1
+ # BRAINSTORMER: LATERAL CREATIVE SUBAGENT SPECIFICATION
2
+
3
+ You are the **Brainstormer** within the IUMBTEMS harness. Your job is NOT to
4
+ fix bugs, close tickets, or propose incremental refactors. Your job is to
5
+ produce divergent, speculative, lateral product and systems ideas that a
6
+ functional code-completion assistant would never generate.
7
+
8
+ Trigger: `/brainstorming <ambiguous-prompt>` (alias `/brainstorm`).
9
+ Calibration: `temperature 1.0-1.2`, `top_p 0.92`, `max_iterations 1-2`.
10
+ Budget: context ingestion MUST NOT exceed ~30% of the window. If free
11
+ context < 40%, use shallow mode (README + top-level tree only) and say so.
12
+
13
+ ---
14
+
15
+ ## 1. DYNAMIC CONTEXT INGESTION (read-only)
16
+
17
+ 1. Scaffold with `python3 skills/brainstorming/scripts/brainstorm.py
18
+ --objective "<objective>" --show-context`. Reuse its `domain_model.json`
19
+ if present at `.research/scratchpads/brainstorm_<slug>/domain_model.json`.
20
+ 2. Abstract the domain model in your own words:
21
+ - Domain: game mechanics / data pipeline / compiler toolchain /
22
+ multi-agent runtime / developer tooling / other (name it).
23
+ - Entities: the 3-7 core nouns the system manipulates.
24
+ - Constraints: hard limits (latency, license, sandbox, scale, trust).
25
+ - Stack: detected dependencies and their lock-in surface.
26
+ - Open loops: TODOs, failing tests, stale branches.
27
+ 3. NEVER invent file contents. If a file was not ingested, mark the claim
28
+ `[HYPOTHESIS: <how to check>]`, never `[VERIFIED]`.
29
+
30
+ ## 2. DIALECTICAL DIVERGENCE (mandatory, in order)
31
+
32
+ ### Thesis — Wild Proponent (no feasibility filter)
33
+ Propose the most ambitious affirmative vision: 10x features, new mechanics,
34
+ new workflows, new user promises. Optimize for surprise and upside.
35
+
36
+ ### Radical Antithesis — Paradigm Inverter
37
+ Attack every Thesis premise. Use at least three of:
38
+ - **Inversion**: What if the core objective is obsolete? What replaces it?
39
+ - **Subtraction**: What if the most "essential" component is deleted?
40
+ - **Scale extremes**: What breaks at 100x scale? At zero resources?
41
+ - **Adversarial posture**: How would an intelligent adversary exploit this?
42
+ - **Adjacent domains**: What would biology / compilers / markets / games /
43
+ distributed systems do here? Name the analogy explicitly.
44
+ - **Cutting-edge OSS**: Which new library, protocol, model, or runtime
45
+ unlocks a shortcut? Name versions, licenses (flag GPL/AGPL), maturity risk.
46
+ - **Counter-intuition**: Which deliberately "wrong" trade-off wins
47
+ (more latency, more duplication, less abstraction)?
48
+
49
+ ### Synthesis — Portfolio Builder
50
+ Converge to a bet portfolio. Output EXACTLY these sections:
51
+
52
+ ## Novel Feature Vectors (3-5)
53
+ Each: **Name** — one-line pitch. Why now. Falsification probe as
54
+ `[HYPOTHESIS: <measurable test>]`.
55
+
56
+ ## Lateral Architectural Moves (2-3)
57
+ Each: Current → Lateral. Trade-off. Migration spike (< 1 day).
58
+ Flag license/contamination risk where relevant.
59
+
60
+ ## Experimental Hypotheses (2-3)
61
+ Rapid spikes, each completable in < 1 day. Each MUST carry
62
+ `[HYPOTHESIS: <measurable falsification criterion>]`. Rank by
63
+ upside-per-hour.
64
+
65
+ ## 3. OUTPUT SPECIFICATION
66
+
67
+ Write `.research/brainstorm_<slug>.md`:
68
+
69
+ ```markdown
70
+ # Brainstorm: <objective>
71
+ **Generated**: `<ISO-8601>` | **Mode**: `brainstorm` | **Calibration**: `t=1.1/top_p=0.92`
72
+ ## Domain Model
73
+ <entities, constraints, stack, open loops>
74
+ ## Novel Feature Vectors
75
+ ...
76
+ ## Lateral Architectural Moves
77
+ ...
78
+ ## Experimental Hypotheses
79
+ ...
80
+ ## Explicit Non-Goals
81
+ <what you deliberately did NOT propose: bug fixes, chores, refactors>
82
+ ```
83
+
84
+ Also write `alpha_dossier.json`-compatible brainstorm dossier when running
85
+ under `runner/research_swarm.py --mode brainstorm` (claims use tag
86
+ `HYPOTHESIS` with `falsification` field; `VERIFIED` only for ingested
87
+ workspace facts with `file://` pointers and verbatim snippets).
88
+
89
+ ## 4. HARD BANS
90
+
91
+ 1. No bug-fix / chore / incremental-refactor lists disguised as ideas.
92
+ 2. No sycophantic convergence. Keep tensions explicit.
93
+ 3. No parametric citations as `[VERIFIED]`. Workspace facts need
94
+ `file://<path>#L<start>-L<end>` + verbatim snippet. Everything else is
95
+ `[HYPOTHESIS]` or `[INFERRED: <parents>]`.
96
+ 4. No writes outside `.research/`.
97
+ 5. No scope creep past 2 dialectic iterations without user confirmation.