Repository navigation
Expand file tree
/
Copy pathworkflow.json
More file actions
306 lines (306 loc) · 103 KB
/
Copy pathworkflow.json
File metadata and controls
306 lines (306 loc) · 103 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
{
"git": {
"enabled": true,
"repositoryName": "scienceevolve-alphaevolve-todo-20261013-r2",
"repositoryVisibility": "private"
},
"agents": {
"main": {
"harness": "codex",
"model": "gpt-6.1-sol",
"gatewayReasoningOption": "mid",
"permission": "workspace",
"proxy": {
"mode": "direct"
},
"skills": [],
"autoSkills": [],
"sessionPersistence": true,
"webSearch": false,
"mcpServers": [
{
"name": "search",
"project": "alpha-main"
}
],
"instructions": "Coordinate the public AlphaEvolve-method acceptance, two genuinely parallel native Git generation branches plus asynchronous atomic evaluation. Require a genuinely evaluated official initial program (it may fail because it has a placeholder score), three candidates per independent worker, preserved parent/inspiration/diff provenance, actual syntax/cheap/official evaluation cascades, live database feedback and an independent audit. Unpublished original archive details are explicitly independent choices, not a claim to exact original engine replication. Require all real jobs to end and all native Git results to integrate before formal completion; no premature group finish. Model gpt-6.1-sol/mid only. Do not author business code or silently serialise workers."
},
"manager": {
"harness": "codex",
"model": "gpt-6.1-sol",
"gatewayReasoningOption": "mid",
"permission": "workspace",
"proxy": {
"mode": "direct"
},
"skills": [],
"autoSkills": [],
"sessionPersistence": true,
"webSearch": false,
"mcpServers": [
{
"name": "search",
"project": "alpha-manager"
}
],
"instructions": "Management-only leader. Branch on the CURRENT inbox Purpose, not the whole group lifecycle: for Purpose plan, read the graph, assign generate_a and generate_b exactly once concurrently, call finish_task and IMMEDIATELY return the final concise handoff/native Stop. Assignments are staged and WILL NOT dispatch until this turn stops; NEVER sleep, poll candidates, or wait for worker completion in a planning turn. For a later failure coordination turn, handle only its retained issue then finish_task and return. For a later integration/completion turn, inspect actual receipts and only then use the currently exposed integration/group-completion controls. Do not enforce a generation-wide evaluation barrier. Preserve unrelated work if a member fails. Do not write code or perform business Git yourself. Actual final group integration by an eligible business owner and complete_group are later turns, not prerequisites for ending this planning turn. Use actual inbox group/epoch identities."
},
"worker_a": {
"harness": "codex",
"model": "gpt-6.1-sol",
"gatewayReasoningOption": "mid",
"permission": "workspace",
"proxy": {
"mode": "direct"
},
"skills": [],
"autoSkills": [],
"sessionPersistence": true,
"webSearch": false,
"mcpServers": [
{
"name": "search",
"project": "alpha-worker_a"
}
],
"instructions": "You are independent generator worker_a, island 0. Read get_search_state and sample_prompt with a stable new requestId per candidate; read the actual parent, inspiration code, scores and your failure feedback. Propose concrete SEARCH/REPLACE diffs only within EVOLVE-BLOCK markers. Use submit_diff with your actual promptId and stable candidate id. Generate three candidates; asynchronous evaluator is already running. Do not wait for all other branches or a whole generation. You may sample/generate another while prior evaluation is pending; inspect completed results and use current database/failure feedback for later proposals. At least the final proposal should consume actual evaluated earlier feedback if available; use inspect_candidate instead of guessing. Task construct_packing(n) returns centers,radii,claimed_score, all finite and valid nonoverlapping circles inside unit square, claimed_score exactly actual sum. Develop from the supplied official initial program, not published final constructions. numpy/scipy available; each construction must finish within 60 seconds (explicitly smaller CPU execution budget than original 1000s). Two seeds of n=26 and cheap n=8 are verified; do not special-case only known seeds/n. Failures are scientific records, not hidden. After all three actual evaluations end, export_search_artifacts and write results/worker_a/report.md including parent/inspiration IDs, native async timing, failures, scores and all limits. Write only your own results/<role> path. At the beginning of a business execution turn, use tool discovery to load the filesystem MCP tools write_file, git_status, git_stage and git_commit; a tool being registered is not the same as having its schema loaded. Use the actual discovered schema and current inbox identities, never guessed namespace/arguments or shell git. Exporting files does NOT stage, commit or push them. For an ordinary writable execution branch, inspect git_status, stage only your own changed result files, create a real Git commit with git_commit, verify the returned commit/HEAD, and only then perform git_push and the PR/integration actions actually authorized for the current inbox Purpose. A git_push result reporting not_committed requires discovering/staging/committing first, not repeated identical pushes. If the required tool genuinely cannot be discovered, report the exact missing capability rather than inventing completion. Do not use these write actions in a management/read-only turn. Execute ONLY the current inbox purpose; later lifecycle turns may expose additional Git/PR controls. Do not wait for an unavailable future PR tool. Once the current business work and its exposed authorized delivery actions are done, call finish_task and immediately return a concise final handoff (native Stop). A control receipt marked staged means pending control dispatch after native Stop; it is NOT Git index staging, NOT a Git commit, and NOT proof of task completion. Do not sleep/poll after finish_task or re-run completed scientific work. Never fabricate an evaluation or read the published evolved solution. The external evaluator is an atomic deterministic Task backend, not an autonomous research system."
},
"worker_b": {
"harness": "codex",
"model": "gpt-6.1-sol",
"gatewayReasoningOption": "mid",
"permission": "workspace",
"proxy": {
"mode": "direct"
},
"skills": [],
"autoSkills": [],
"sessionPersistence": true,
"webSearch": false,
"mcpServers": [
{
"name": "search",
"project": "alpha-worker_b"
}
],
"instructions": "You are independent generator worker_b, island 1. Follow sample_prompt/submit_diff for three real candidate diffs, inspect parent/inspiration metrics/failures and use the live evolving program database. Explore a structurally different feasible search strategy; do not copy the other worker unpublished program through shared Git. Both workers are concurrent; atomic Task queue handles cascade evaluation without a generation barrier. After proposing an initial candidate, use actual completed feedback in a later sample when it becomes available, while retaining actual queued work. Do not report results until scored/rejected receipts exist. construct_packing(n) must return correct finite geometry/claimed score, not print a canned success. Each call has a reduced 60-second budget; no downloads or GPU. Export all actual evidence and code to results/worker_b/report.md and its own path, preserving unsuccessful attempts. Write only your own results/<role> path. At the beginning of a business execution turn, use tool discovery to load the filesystem MCP tools write_file, git_status, git_stage and git_commit; a tool being registered is not the same as having its schema loaded. Use the actual discovered schema and current inbox identities, never guessed namespace/arguments or shell git. Exporting files does NOT stage, commit or push them. For an ordinary writable execution branch, inspect git_status, stage only your own changed result files, create a real Git commit with git_commit, verify the returned commit/HEAD, and only then perform git_push and the PR/integration actions actually authorized for the current inbox Purpose. A git_push result reporting not_committed requires discovering/staging/committing first, not repeated identical pushes. If the required tool genuinely cannot be discovered, report the exact missing capability rather than inventing completion. Do not use these write actions in a management/read-only turn. Execute ONLY the current inbox purpose; later lifecycle turns may expose additional Git/PR controls. Do not wait for an unavailable future PR tool. Once the current business work and its exposed authorized delivery actions are done, call finish_task and immediately return a concise final handoff (native Stop). A control receipt marked staged means pending control dispatch after native Stop; it is NOT Git index staging, NOT a Git commit, and NOT proof of task completion. Do not sleep/poll after finish_task or re-run completed scientific work. Never fabricate an evaluation or read the published evolved solution. The external evaluator is an atomic deterministic Task backend, not an autonomous research system."
},
"audit": {
"harness": "codex",
"model": "gpt-6.1-sol",
"gatewayReasoningOption": "mid",
"permission": "workspace",
"proxy": {
"mode": "direct"
},
"skills": [],
"autoSkills": [],
"sessionPersistence": true,
"webSearch": false,
"mcpServers": [
{
"name": "search",
"project": "alpha-audit"
}
],
"instructions": "Independently inspect all six actual candidate receipts, code/diffs, parent/inspiration sample records, original seed and protected official-verifier hashes. Verify two native Git branches really overlapped and sampler/evaluator operated as a non-blocking pipeline; do not equate a field saying parallel with proof. Check rejection feedback and whether later candidate context actually included live earlier results; a successful independent sampling baseline is not evolution. Re-evaluation metrics must come from retained official geometry runs for n=26/seeds42,43; never from model self-assessment. Export_search_artifacts to results/audit, identify the best valid candidate (or disclose none), reproduce its score and limitations from actual evaluator records and write audit.md. State baseline rejection truthfully if the official starter's claimed_score placeholder fails; do not rewrite its receipt as passed. Only endorse method-contract completion when all actual outcomes and parent links are consistent and native deliveries integrated; findings may be negative, but missing/invented phases fail. Write only your own results/<role> path. At the beginning of a business execution turn, use tool discovery to load the filesystem MCP tools write_file, git_status, git_stage and git_commit; a tool being registered is not the same as having its schema loaded. Use the actual discovered schema and current inbox identities, never guessed namespace/arguments or shell git. Exporting files does NOT stage, commit or push them. For an ordinary writable execution branch, inspect git_status, stage only your own changed result files, create a real Git commit with git_commit, verify the returned commit/HEAD, and only then perform git_push and the PR/integration actions actually authorized for the current inbox Purpose. A git_push result reporting not_committed requires discovering/staging/committing first, not repeated identical pushes. If the required tool genuinely cannot be discovered, report the exact missing capability rather than inventing completion. Do not use these write actions in a management/read-only turn. Execute ONLY the current inbox purpose; later lifecycle turns may expose additional Git/PR controls. Do not wait for an unavailable future PR tool. Once the current business work and its exposed authorized delivery actions are done, call finish_task and immediately return a concise final handoff (native Stop). A control receipt marked staged means pending control dispatch after native Stop; it is NOT Git index staging, NOT a Git commit, and NOT proof of task completion. Do not sleep/poll after finish_task or re-run completed scientific work. Never fabricate an evaluation or read the published evolved solution. The external evaluator is an atomic deterministic Task backend, not an autonomous research system."
}
},
"mcpDefinitions": {
"alpha-main": {
"command": "node",
"entrypoint": "server.cjs",
"files": {
"server.cjs": "const { Server } = require('@modelcontextprotocol/sdk/server/index.js');\nconst { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');\nconst { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');\nconst { openPrograms } = require('./program-store.cjs');\nconst actor = process.argv[2], store = openPrograms(process.env.SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT, actor);\nconst definitions = [\n { name: 'get_search_state', description: 'Read actual candidate queue, baseline/evaluator receipts, scores, statuses and methodReadiness per worker. Missing, pending, and scientific negative results are distinct.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } },\n { name: 'inspect_candidate', description: 'Read one actual async evaluation status, cascade results, metrics and errors; no guessed results.', inputSchema: { type: 'object', required: ['candidateId'], properties: { candidateId: { type: 'string' } }, additionalProperties: false } }\n];\nif (['worker_a','worker_b'].includes(actor)) definitions.push(\n { name: 'sample_prompt', description: 'Sample a current database parent, distinct inspirations and your actual failure feedback. Uses per-island elites/diversity and live scored results; keep the returned promptId.', inputSchema: { type: 'object', required: ['requestId'], properties: { requestId: { type: 'string' } }, additionalProperties: false } },\n { name: 'submit_diff', description: 'Apply actual SEARCH/REPLACE diff inside EVOLVE-BLOCK, enqueue without a generation barrier, preserve parent/inspiration provenance. Final candidate at this three-candidate scale requires a new sampled prompt containing actual completed earlier own feedback. Stable request IDs protect against duplicates.', inputSchema: { type: 'object', required: ['requestId','promptId','diff'], properties: { requestId: { type: 'string' }, promptId: { type: 'string' }, diff: { type: 'string', maxLength: 100000 } }, additionalProperties: false } }\n);\nif (['worker_a','worker_b','audit'].includes(actor)) definitions.push({ name: 'export_search_artifacts', description: 'Write actual candidate programs/diffs, final metric/error receipts and database state to your own results/<role> branch path. Does not commit or finish task.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } });\nconst server = new Server({ name: 'alphaevolve-task-tools', version: '0.1.0' }, { capabilities: { tools: {} } });\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: definitions }));\nserver.setRequestHandler(CallToolRequestSchema, async request => {\n const { name, arguments: args = {} } = request.params;\n if (!definitions.some(tool => tool.name === name)) throw new Error('Tool not assigned to this role');\n try { return { content: [{ type: 'text', text: JSON.stringify(await store.operations[name](args)) }] }; }\n catch (error) { return { isError: true, content: [{ type: 'text', text: error.message }] }; }\n});\nserver.connect(new StdioServerTransport()); process.stdin.on('end', () => { store.close(); server.close().finally(() => process.exit()); });\n",
"program-store.cjs": "const fs = require('node:fs');\nconst path = require('node:path');\nconst { createHash } = require('node:crypto');\nconst { DatabaseSync } = require('node:sqlite');\nconst hash = value => createHash('sha256').update(typeof value === 'string' || Buffer.isBuffer(value) ? value : JSON.stringify(value)).digest('hex');\nconst idOk = id => typeof id === 'string' && /^[a-zA-Z0-9_-]{1,100}$/.test(id);\nconst timestamp = () => new Date().toISOString();\nfunction applyDiff(program, diff) {\n const edits = [...diff.matchAll(/<<<<<<< SEARCH\\r?\\n([\\s\\S]*?)\\r?\\n=======\\r?\\n([\\s\\S]*?)\\r?\\n>>>>>>> REPLACE/g)];\n if (!edits.length) throw new Error('Supply SEARCH/REPLACE edits, not an unrelated full program');\n let result = program;\n for (const edit of edits) {\n const search = edit[1], replace = edit[2];\n if (!search || result.split(search).length !== 2) throw new Error('Each SEARCH block must match exactly once');\n result = result.replace(search, replace);\n }\n if (!result.includes('# EVOLVE-BLOCK-START') || !result.includes('# EVOLVE-BLOCK-END')) throw new Error('Evolution markers must be preserved');\n const outside = text => [text.split('# EVOLVE-BLOCK-START')[0], text.split('# EVOLVE-BLOCK-END').slice(1).join('# EVOLVE-BLOCK-END')];\n if (JSON.stringify(outside(result)) !== JSON.stringify(outside(program))) throw new Error('Edits outside the authorized evolution block are forbidden');\n return result;\n}\nfunction openPrograms(root, actor) {\n if (!path.isAbsolute(root) || !['worker_a', 'worker_b', 'manager', 'main', 'audit', 'evaluator'].includes(actor)) throw new Error('Known actor and explicit root required');\n const config = JSON.parse(fs.readFileSync(path.join(root, 'settings.json'), 'utf8'));\n if (config.method !== 'alphaevolve') throw new Error('Wrong method state');\n const db = new DatabaseSync(path.join(root, 'programs.sqlite'));\n db.exec('PRAGMA busy_timeout=5000');\n for(let attempt=0;;attempt++){\n try{\n if(db.prepare('PRAGMA journal_mode').get().journal_mode!=='wal')db.exec('PRAGMA journal_mode=WAL');\n db.exec('CREATE TABLE IF NOT EXISTS programs(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS prompts(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS journal(seq INTEGER PRIMARY KEY AUTOINCREMENT,json TEXT NOT NULL);');\n break;\n }catch(error){if(![5,6].includes(error.errcode)||attempt>=80){db.close();throw error;}Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25);}\n }\n const log = entry => db.prepare('INSERT INTO journal(json) VALUES (?)').run(JSON.stringify({ ...entry, at: timestamp() }));\n const list = () => db.prepare('SELECT json FROM programs').all().map(row => JSON.parse(row.json));\n const get = id => { const row = db.prepare('SELECT json FROM programs WHERE id=?').get(id); return row ? JSON.parse(row.json) : null; };\n const save = program => db.prepare('INSERT INTO programs(id,json) VALUES (?,?) ON CONFLICT(id) DO UPDATE SET json=excluded.json').run(program.id, JSON.stringify(program));\n const transaction = fn => { db.exec('BEGIN IMMEDIATE'); try { const result = fn(); db.exec('COMMIT'); return result; } catch (error) { db.exec('ROLLBACK'); throw error; } };\n const initialCode = fs.readFileSync(config.initialProgram, 'utf8');\n db.prepare('INSERT OR IGNORE INTO programs(id,json) VALUES (?,?)').run('initial', JSON.stringify({ id: 'initial', code: initialCode, codeSha256: hash(initialCode), actor: 'evaluator', island: 0, status: 'queued', requestedAt: timestamp(), seedProgram: true }));\n const final = program => ['scored','rejected'].includes(program.status);\n const feedbackContext = prompt => ({\n scoredParent: Boolean(prompt.parent?.metrics),\n scoredInspirations: prompt.inspirations?.map(program => program.id) ?? [],\n failureIds: prompt.failures?.map(program => program.id) ?? []\n });\n const readiness = () => {\n const programs = list();\n const prompts = db.prepare('SELECT json FROM prompts').all().map(row => JSON.parse(row.json));\n const workers = Object.fromEntries(['worker_a','worker_b'].map(name => {\n const owned = programs.filter(program => program.actor === name);\n const laterFeedback = prompts.filter(prompt => prompt.actor === name).filter(prompt => {\n const included = [prompt.parent?.metrics ? prompt.parent.id : null,...(prompt.inspirations??[]).map(item=>item.id),...(prompt.failures??[]).map(item=>item.id)].filter(Boolean);\n return owned.some(program => final(program) && program.finishedAt <= prompt.sampledAt && included.includes(program.id));\n }).map(prompt=>prompt.id);\n return [name,{created:owned.length,final:owned.filter(final).length,required:config.perWorkerBudget,laterOwnFeedbackPromptIds:laterFeedback,ready:owned.length===config.perWorkerBudget&&owned.every(final)&&laterFeedback.length>0}];\n }));\n return {workers,ready:Object.values(workers).every(worker=>worker.ready)&&final(programs.find(program=>program.id==='initial')),note:'Scientific evidence gate, not proof of native Git integration or model cognition. Final proposal must sample actual earlier own feedback at this reduced three-candidate scale; no generation-wide barrier.'};\n };\n const state = () => ({ method: config.method, publicTask: config.publicTask, perWorkerBudget: config.perWorkerBudget, evaluatorConcurrency: 2, programs: list().map(({ code, ...item }) => item), methodReadiness:readiness(), note: 'Independent public-method adaptation; unpublished original database parameters are not claimed.' });\n const worker = () => { if (!['worker_a', 'worker_b'].includes(actor)) throw new Error('Candidate creation is assigned only to independent generators'); };\n const operations = {\n get_search_state: async () => state(),\n sample_prompt: async args => {\n worker(); if (!idOk(args.requestId)) throw new Error('Stable requestId required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`;\n const retained = db.prepare('SELECT json FROM prompts WHERE id=?').get(id); if (retained) return JSON.parse(retained.json);\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n const viable = all.filter(program => program.status === 'scored' && program.valid);\n const initial = all.find(program => program.id === 'initial');\n if (!viable.length && (!initial || ['queued','evaluating'].includes(initial.status))) throw new Error('Initial program must be actually evaluated before generation');\n const island = actor === 'worker_a' ? 0 : 1;\n const local = viable.filter(program => program.island === island); const population = local.length ? local : viable.length ? viable : [initial];\n // Transparent MAP-Elites-style archive: best in code-size bins on each island.\n // These descriptor bins/sampling weights are independent choices, not unpublished AlphaEvolve defaults.\n const archive = new Map();\n const score = program => program.metrics?.sum_of_radii ?? -Infinity;\n for (const program of population) { const bin = Math.floor(program.code.length / 1000); if (!archive.has(bin) || score(archive.get(bin)) < score(program)) archive.set(bin, program); }\n const elites = [...archive.values()].sort((a, b) => score(b) - score(a));\n const seed = parseInt(hash(id).slice(0, 8), 16);\n const parent = seed % 4 === 0 ? elites[seed % elites.length] : elites[0];\n const inspirations = viable.filter(program => program.id !== parent.id).sort((a,b) => b.metrics.sum_of_radii - a.metrics.sum_of_radii).slice(0, 2);\n const failures = all.filter(program => (program.actor === actor || program.seedProgram) && program.status === 'rejected').slice(-2).map(({ id, stages, error }) => ({ id, stages, error }));\n const prompt = { id, actor, island, parent: { id: parent.id, code: parent.code, metrics: parent.metrics }, inspirations: inspirations.map(({ id, code, metrics, island }) => ({ id, code, metrics, island })), failures, databaseRevision: all.length, instructions: config.taskInstructions, policy: 'size-bin elites within actor island; 75% best / 25% deterministic diverse sampling; global inspiration exchange. Explicit independent implementation choices.', sampledAt: timestamp() };\n prompt.feedbackContext = feedbackContext(prompt);\n db.prepare('INSERT INTO prompts(id,json) VALUES (?,?)').run(id, JSON.stringify(prompt)); log({ type: 'prompt.sampled', promptId: id, actor, parent: parent.id, inspirationIds: inspirations.map(program => program.id), revision: all.length }); return prompt;\n });\n },\n submit_diff: async args => {\n worker(); if (!idOk(args.requestId) || typeof args.diff !== 'string' || args.diff.length > 100000) throw new Error('Stable request id and bounded actual diff required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`, retained = get(id), requestHash = hash(args);\n if (retained) { if (retained.requestHash !== requestHash) throw new Error('Idempotency key cannot be changed'); return { candidateId: id, status: retained.status }; }\n const promptRow = db.prepare('SELECT json FROM prompts WHERE id=?').get(args.promptId);\n const prompt = promptRow && JSON.parse(promptRow.json); if (!prompt || prompt.actor !== actor) throw new Error('Use your actual sampled parent and inspirations');\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n if (all.filter(program=>program.actor===actor).length===config.perWorkerBudget-1) {\n const included=[prompt.parent?.metrics?prompt.parent.id:null,...prompt.inspirations.map(item=>item.id),...prompt.failures.map(item=>item.id)].filter(Boolean);\n if (!all.some(program=>program.actor===actor&&final(program)&&program.finishedAt<=prompt.sampledAt&&included.includes(program.id))) throw new Error('Before the final candidate, inspect an actual completed earlier own evaluation, then sample_prompt with a NEW requestId so scored parent/inspiration or rejection feedback is included. Keep the other branch asynchronous; no whole-generation barrier.');\n }\n const code = applyDiff(prompt.parent.code, args.diff);\n const program = { id, actor, island: prompt.island, code, codeSha256: hash(code), diff: args.diff, parentId: prompt.parent.id, inspirationIds: prompt.inspirations.map(program => program.id), promptId: args.promptId, requestHash, status: 'queued', requestedAt: timestamp() };\n save(program); log({ type: 'candidate.queued', id, actor, parentId: program.parentId, codeSha256: program.codeSha256 });\n return { candidateId: id, status: 'queued', instruction: 'Evaluation runs asynchronously in the external atomic Task backend; do not wait on a group-wide barrier. You may sample/generate another candidate while this is pending, then poll its actual result.' };\n });\n },\n inspect_candidate: async ({ candidateId }) => {\n const program = get(candidateId); if (!program) throw new Error('Unknown candidate');\n const { code, diff, ...record } = program; return record;\n },\n export_search_artifacts: async () => {\n if (!['worker_a', 'worker_b', 'audit'].includes(actor)) throw new Error('Export belongs to business roles');\n const owned = list().filter(program => actor === 'audit' || program.actor === actor);\n if (owned.some(program => ['queued','evaluating'].includes(program.status))) throw new Error('Actual evaluations are still pending; preserve them, do not claim completion');\n const contract=readiness();\n if (actor==='audit'?!contract.ready:!contract.workers[actor].ready) throw new Error('Scientific evidence is incomplete: read get_search_state.methodReadiness; each generator needs three final receipts and a later sample containing its actual earlier feedback. Git integration remains a separate native requirement.');\n const directory = path.join(process.cwd(), 'results', actor); fs.mkdirSync(directory, { recursive: true });\n for (const program of owned) { fs.writeFileSync(path.join(directory, `${program.id}.py`), program.code); fs.writeFileSync(path.join(directory, `${program.id}.json`), JSON.stringify(program, null, 2)); }\n const prompts=db.prepare('SELECT json FROM prompts').all().map(row=>JSON.parse(row.json)).filter(prompt=>actor==='audit'||prompt.actor===actor);\n const journal=db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row=>JSON.parse(row.json)).filter(entry=>actor==='audit'||entry.actor===actor||owned.some(program=>program.id===entry.id));\n fs.writeFileSync(path.join(directory,'prompts.json'),JSON.stringify(prompts,null,2));\n fs.writeFileSync(path.join(directory,'journal.json'),JSON.stringify(journal,null,2));\n fs.writeFileSync(path.join(directory, 'search-state.json'), JSON.stringify(state(), null, 2));\n return { relativePath: `results/${actor}`, candidates: owned.map(program => ({ id: program.id, status: program.status, valid: program.valid, metrics: program.metrics })) };\n }\n };\n return { operations, config, list, get, state, journal: () => db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row => JSON.parse(row.json)),\n claimQueued: () => transaction(() => { const item = list().find(program => program.status === 'queued'); if (!item) return null; item.status = 'evaluating'; item.startedAt = timestamp(); save(item); log({ type: 'evaluation.started', id: item.id }); return item; }),\n finish: (id, receipt) => transaction(() => { const item = get(id); if (!item || item.status !== 'evaluating') throw new Error('Evaluation is not in the retained executing state'); Object.assign(item, receipt, { finishedAt: timestamp() }); save(item); log({ type: 'evaluation.finished', id, status: item.status, metrics: item.metrics, stageCount: item.stages?.length }); }),\n close: () => db.close() };\n}\nmodule.exports = { openPrograms, applyDiff, hash };\n"
},
"args": [
"main"
],
"envFrom": {
"SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT": "SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT"
}
},
"alpha-manager": {
"command": "node",
"entrypoint": "server.cjs",
"files": {
"server.cjs": "const { Server } = require('@modelcontextprotocol/sdk/server/index.js');\nconst { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');\nconst { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');\nconst { openPrograms } = require('./program-store.cjs');\nconst actor = process.argv[2], store = openPrograms(process.env.SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT, actor);\nconst definitions = [\n { name: 'get_search_state', description: 'Read actual candidate queue, baseline/evaluator receipts, scores, statuses and methodReadiness per worker. Missing, pending, and scientific negative results are distinct.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } },\n { name: 'inspect_candidate', description: 'Read one actual async evaluation status, cascade results, metrics and errors; no guessed results.', inputSchema: { type: 'object', required: ['candidateId'], properties: { candidateId: { type: 'string' } }, additionalProperties: false } }\n];\nif (['worker_a','worker_b'].includes(actor)) definitions.push(\n { name: 'sample_prompt', description: 'Sample a current database parent, distinct inspirations and your actual failure feedback. Uses per-island elites/diversity and live scored results; keep the returned promptId.', inputSchema: { type: 'object', required: ['requestId'], properties: { requestId: { type: 'string' } }, additionalProperties: false } },\n { name: 'submit_diff', description: 'Apply actual SEARCH/REPLACE diff inside EVOLVE-BLOCK, enqueue without a generation barrier, preserve parent/inspiration provenance. Final candidate at this three-candidate scale requires a new sampled prompt containing actual completed earlier own feedback. Stable request IDs protect against duplicates.', inputSchema: { type: 'object', required: ['requestId','promptId','diff'], properties: { requestId: { type: 'string' }, promptId: { type: 'string' }, diff: { type: 'string', maxLength: 100000 } }, additionalProperties: false } }\n);\nif (['worker_a','worker_b','audit'].includes(actor)) definitions.push({ name: 'export_search_artifacts', description: 'Write actual candidate programs/diffs, final metric/error receipts and database state to your own results/<role> branch path. Does not commit or finish task.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } });\nconst server = new Server({ name: 'alphaevolve-task-tools', version: '0.1.0' }, { capabilities: { tools: {} } });\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: definitions }));\nserver.setRequestHandler(CallToolRequestSchema, async request => {\n const { name, arguments: args = {} } = request.params;\n if (!definitions.some(tool => tool.name === name)) throw new Error('Tool not assigned to this role');\n try { return { content: [{ type: 'text', text: JSON.stringify(await store.operations[name](args)) }] }; }\n catch (error) { return { isError: true, content: [{ type: 'text', text: error.message }] }; }\n});\nserver.connect(new StdioServerTransport()); process.stdin.on('end', () => { store.close(); server.close().finally(() => process.exit()); });\n",
"program-store.cjs": "const fs = require('node:fs');\nconst path = require('node:path');\nconst { createHash } = require('node:crypto');\nconst { DatabaseSync } = require('node:sqlite');\nconst hash = value => createHash('sha256').update(typeof value === 'string' || Buffer.isBuffer(value) ? value : JSON.stringify(value)).digest('hex');\nconst idOk = id => typeof id === 'string' && /^[a-zA-Z0-9_-]{1,100}$/.test(id);\nconst timestamp = () => new Date().toISOString();\nfunction applyDiff(program, diff) {\n const edits = [...diff.matchAll(/<<<<<<< SEARCH\\r?\\n([\\s\\S]*?)\\r?\\n=======\\r?\\n([\\s\\S]*?)\\r?\\n>>>>>>> REPLACE/g)];\n if (!edits.length) throw new Error('Supply SEARCH/REPLACE edits, not an unrelated full program');\n let result = program;\n for (const edit of edits) {\n const search = edit[1], replace = edit[2];\n if (!search || result.split(search).length !== 2) throw new Error('Each SEARCH block must match exactly once');\n result = result.replace(search, replace);\n }\n if (!result.includes('# EVOLVE-BLOCK-START') || !result.includes('# EVOLVE-BLOCK-END')) throw new Error('Evolution markers must be preserved');\n const outside = text => [text.split('# EVOLVE-BLOCK-START')[0], text.split('# EVOLVE-BLOCK-END').slice(1).join('# EVOLVE-BLOCK-END')];\n if (JSON.stringify(outside(result)) !== JSON.stringify(outside(program))) throw new Error('Edits outside the authorized evolution block are forbidden');\n return result;\n}\nfunction openPrograms(root, actor) {\n if (!path.isAbsolute(root) || !['worker_a', 'worker_b', 'manager', 'main', 'audit', 'evaluator'].includes(actor)) throw new Error('Known actor and explicit root required');\n const config = JSON.parse(fs.readFileSync(path.join(root, 'settings.json'), 'utf8'));\n if (config.method !== 'alphaevolve') throw new Error('Wrong method state');\n const db = new DatabaseSync(path.join(root, 'programs.sqlite'));\n db.exec('PRAGMA busy_timeout=5000');\n for(let attempt=0;;attempt++){\n try{\n if(db.prepare('PRAGMA journal_mode').get().journal_mode!=='wal')db.exec('PRAGMA journal_mode=WAL');\n db.exec('CREATE TABLE IF NOT EXISTS programs(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS prompts(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS journal(seq INTEGER PRIMARY KEY AUTOINCREMENT,json TEXT NOT NULL);');\n break;\n }catch(error){if(![5,6].includes(error.errcode)||attempt>=80){db.close();throw error;}Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25);}\n }\n const log = entry => db.prepare('INSERT INTO journal(json) VALUES (?)').run(JSON.stringify({ ...entry, at: timestamp() }));\n const list = () => db.prepare('SELECT json FROM programs').all().map(row => JSON.parse(row.json));\n const get = id => { const row = db.prepare('SELECT json FROM programs WHERE id=?').get(id); return row ? JSON.parse(row.json) : null; };\n const save = program => db.prepare('INSERT INTO programs(id,json) VALUES (?,?) ON CONFLICT(id) DO UPDATE SET json=excluded.json').run(program.id, JSON.stringify(program));\n const transaction = fn => { db.exec('BEGIN IMMEDIATE'); try { const result = fn(); db.exec('COMMIT'); return result; } catch (error) { db.exec('ROLLBACK'); throw error; } };\n const initialCode = fs.readFileSync(config.initialProgram, 'utf8');\n db.prepare('INSERT OR IGNORE INTO programs(id,json) VALUES (?,?)').run('initial', JSON.stringify({ id: 'initial', code: initialCode, codeSha256: hash(initialCode), actor: 'evaluator', island: 0, status: 'queued', requestedAt: timestamp(), seedProgram: true }));\n const final = program => ['scored','rejected'].includes(program.status);\n const feedbackContext = prompt => ({\n scoredParent: Boolean(prompt.parent?.metrics),\n scoredInspirations: prompt.inspirations?.map(program => program.id) ?? [],\n failureIds: prompt.failures?.map(program => program.id) ?? []\n });\n const readiness = () => {\n const programs = list();\n const prompts = db.prepare('SELECT json FROM prompts').all().map(row => JSON.parse(row.json));\n const workers = Object.fromEntries(['worker_a','worker_b'].map(name => {\n const owned = programs.filter(program => program.actor === name);\n const laterFeedback = prompts.filter(prompt => prompt.actor === name).filter(prompt => {\n const included = [prompt.parent?.metrics ? prompt.parent.id : null,...(prompt.inspirations??[]).map(item=>item.id),...(prompt.failures??[]).map(item=>item.id)].filter(Boolean);\n return owned.some(program => final(program) && program.finishedAt <= prompt.sampledAt && included.includes(program.id));\n }).map(prompt=>prompt.id);\n return [name,{created:owned.length,final:owned.filter(final).length,required:config.perWorkerBudget,laterOwnFeedbackPromptIds:laterFeedback,ready:owned.length===config.perWorkerBudget&&owned.every(final)&&laterFeedback.length>0}];\n }));\n return {workers,ready:Object.values(workers).every(worker=>worker.ready)&&final(programs.find(program=>program.id==='initial')),note:'Scientific evidence gate, not proof of native Git integration or model cognition. Final proposal must sample actual earlier own feedback at this reduced three-candidate scale; no generation-wide barrier.'};\n };\n const state = () => ({ method: config.method, publicTask: config.publicTask, perWorkerBudget: config.perWorkerBudget, evaluatorConcurrency: 2, programs: list().map(({ code, ...item }) => item), methodReadiness:readiness(), note: 'Independent public-method adaptation; unpublished original database parameters are not claimed.' });\n const worker = () => { if (!['worker_a', 'worker_b'].includes(actor)) throw new Error('Candidate creation is assigned only to independent generators'); };\n const operations = {\n get_search_state: async () => state(),\n sample_prompt: async args => {\n worker(); if (!idOk(args.requestId)) throw new Error('Stable requestId required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`;\n const retained = db.prepare('SELECT json FROM prompts WHERE id=?').get(id); if (retained) return JSON.parse(retained.json);\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n const viable = all.filter(program => program.status === 'scored' && program.valid);\n const initial = all.find(program => program.id === 'initial');\n if (!viable.length && (!initial || ['queued','evaluating'].includes(initial.status))) throw new Error('Initial program must be actually evaluated before generation');\n const island = actor === 'worker_a' ? 0 : 1;\n const local = viable.filter(program => program.island === island); const population = local.length ? local : viable.length ? viable : [initial];\n // Transparent MAP-Elites-style archive: best in code-size bins on each island.\n // These descriptor bins/sampling weights are independent choices, not unpublished AlphaEvolve defaults.\n const archive = new Map();\n const score = program => program.metrics?.sum_of_radii ?? -Infinity;\n for (const program of population) { const bin = Math.floor(program.code.length / 1000); if (!archive.has(bin) || score(archive.get(bin)) < score(program)) archive.set(bin, program); }\n const elites = [...archive.values()].sort((a, b) => score(b) - score(a));\n const seed = parseInt(hash(id).slice(0, 8), 16);\n const parent = seed % 4 === 0 ? elites[seed % elites.length] : elites[0];\n const inspirations = viable.filter(program => program.id !== parent.id).sort((a,b) => b.metrics.sum_of_radii - a.metrics.sum_of_radii).slice(0, 2);\n const failures = all.filter(program => (program.actor === actor || program.seedProgram) && program.status === 'rejected').slice(-2).map(({ id, stages, error }) => ({ id, stages, error }));\n const prompt = { id, actor, island, parent: { id: parent.id, code: parent.code, metrics: parent.metrics }, inspirations: inspirations.map(({ id, code, metrics, island }) => ({ id, code, metrics, island })), failures, databaseRevision: all.length, instructions: config.taskInstructions, policy: 'size-bin elites within actor island; 75% best / 25% deterministic diverse sampling; global inspiration exchange. Explicit independent implementation choices.', sampledAt: timestamp() };\n prompt.feedbackContext = feedbackContext(prompt);\n db.prepare('INSERT INTO prompts(id,json) VALUES (?,?)').run(id, JSON.stringify(prompt)); log({ type: 'prompt.sampled', promptId: id, actor, parent: parent.id, inspirationIds: inspirations.map(program => program.id), revision: all.length }); return prompt;\n });\n },\n submit_diff: async args => {\n worker(); if (!idOk(args.requestId) || typeof args.diff !== 'string' || args.diff.length > 100000) throw new Error('Stable request id and bounded actual diff required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`, retained = get(id), requestHash = hash(args);\n if (retained) { if (retained.requestHash !== requestHash) throw new Error('Idempotency key cannot be changed'); return { candidateId: id, status: retained.status }; }\n const promptRow = db.prepare('SELECT json FROM prompts WHERE id=?').get(args.promptId);\n const prompt = promptRow && JSON.parse(promptRow.json); if (!prompt || prompt.actor !== actor) throw new Error('Use your actual sampled parent and inspirations');\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n if (all.filter(program=>program.actor===actor).length===config.perWorkerBudget-1) {\n const included=[prompt.parent?.metrics?prompt.parent.id:null,...prompt.inspirations.map(item=>item.id),...prompt.failures.map(item=>item.id)].filter(Boolean);\n if (!all.some(program=>program.actor===actor&&final(program)&&program.finishedAt<=prompt.sampledAt&&included.includes(program.id))) throw new Error('Before the final candidate, inspect an actual completed earlier own evaluation, then sample_prompt with a NEW requestId so scored parent/inspiration or rejection feedback is included. Keep the other branch asynchronous; no whole-generation barrier.');\n }\n const code = applyDiff(prompt.parent.code, args.diff);\n const program = { id, actor, island: prompt.island, code, codeSha256: hash(code), diff: args.diff, parentId: prompt.parent.id, inspirationIds: prompt.inspirations.map(program => program.id), promptId: args.promptId, requestHash, status: 'queued', requestedAt: timestamp() };\n save(program); log({ type: 'candidate.queued', id, actor, parentId: program.parentId, codeSha256: program.codeSha256 });\n return { candidateId: id, status: 'queued', instruction: 'Evaluation runs asynchronously in the external atomic Task backend; do not wait on a group-wide barrier. You may sample/generate another candidate while this is pending, then poll its actual result.' };\n });\n },\n inspect_candidate: async ({ candidateId }) => {\n const program = get(candidateId); if (!program) throw new Error('Unknown candidate');\n const { code, diff, ...record } = program; return record;\n },\n export_search_artifacts: async () => {\n if (!['worker_a', 'worker_b', 'audit'].includes(actor)) throw new Error('Export belongs to business roles');\n const owned = list().filter(program => actor === 'audit' || program.actor === actor);\n if (owned.some(program => ['queued','evaluating'].includes(program.status))) throw new Error('Actual evaluations are still pending; preserve them, do not claim completion');\n const contract=readiness();\n if (actor==='audit'?!contract.ready:!contract.workers[actor].ready) throw new Error('Scientific evidence is incomplete: read get_search_state.methodReadiness; each generator needs three final receipts and a later sample containing its actual earlier feedback. Git integration remains a separate native requirement.');\n const directory = path.join(process.cwd(), 'results', actor); fs.mkdirSync(directory, { recursive: true });\n for (const program of owned) { fs.writeFileSync(path.join(directory, `${program.id}.py`), program.code); fs.writeFileSync(path.join(directory, `${program.id}.json`), JSON.stringify(program, null, 2)); }\n const prompts=db.prepare('SELECT json FROM prompts').all().map(row=>JSON.parse(row.json)).filter(prompt=>actor==='audit'||prompt.actor===actor);\n const journal=db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row=>JSON.parse(row.json)).filter(entry=>actor==='audit'||entry.actor===actor||owned.some(program=>program.id===entry.id));\n fs.writeFileSync(path.join(directory,'prompts.json'),JSON.stringify(prompts,null,2));\n fs.writeFileSync(path.join(directory,'journal.json'),JSON.stringify(journal,null,2));\n fs.writeFileSync(path.join(directory, 'search-state.json'), JSON.stringify(state(), null, 2));\n return { relativePath: `results/${actor}`, candidates: owned.map(program => ({ id: program.id, status: program.status, valid: program.valid, metrics: program.metrics })) };\n }\n };\n return { operations, config, list, get, state, journal: () => db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row => JSON.parse(row.json)),\n claimQueued: () => transaction(() => { const item = list().find(program => program.status === 'queued'); if (!item) return null; item.status = 'evaluating'; item.startedAt = timestamp(); save(item); log({ type: 'evaluation.started', id: item.id }); return item; }),\n finish: (id, receipt) => transaction(() => { const item = get(id); if (!item || item.status !== 'evaluating') throw new Error('Evaluation is not in the retained executing state'); Object.assign(item, receipt, { finishedAt: timestamp() }); save(item); log({ type: 'evaluation.finished', id, status: item.status, metrics: item.metrics, stageCount: item.stages?.length }); }),\n close: () => db.close() };\n}\nmodule.exports = { openPrograms, applyDiff, hash };\n"
},
"args": [
"manager"
],
"envFrom": {
"SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT": "SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT"
}
},
"alpha-worker_a": {
"command": "node",
"entrypoint": "server.cjs",
"files": {
"server.cjs": "const { Server } = require('@modelcontextprotocol/sdk/server/index.js');\nconst { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');\nconst { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');\nconst { openPrograms } = require('./program-store.cjs');\nconst actor = process.argv[2], store = openPrograms(process.env.SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT, actor);\nconst definitions = [\n { name: 'get_search_state', description: 'Read actual candidate queue, baseline/evaluator receipts, scores, statuses and methodReadiness per worker. Missing, pending, and scientific negative results are distinct.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } },\n { name: 'inspect_candidate', description: 'Read one actual async evaluation status, cascade results, metrics and errors; no guessed results.', inputSchema: { type: 'object', required: ['candidateId'], properties: { candidateId: { type: 'string' } }, additionalProperties: false } }\n];\nif (['worker_a','worker_b'].includes(actor)) definitions.push(\n { name: 'sample_prompt', description: 'Sample a current database parent, distinct inspirations and your actual failure feedback. Uses per-island elites/diversity and live scored results; keep the returned promptId.', inputSchema: { type: 'object', required: ['requestId'], properties: { requestId: { type: 'string' } }, additionalProperties: false } },\n { name: 'submit_diff', description: 'Apply actual SEARCH/REPLACE diff inside EVOLVE-BLOCK, enqueue without a generation barrier, preserve parent/inspiration provenance. Final candidate at this three-candidate scale requires a new sampled prompt containing actual completed earlier own feedback. Stable request IDs protect against duplicates.', inputSchema: { type: 'object', required: ['requestId','promptId','diff'], properties: { requestId: { type: 'string' }, promptId: { type: 'string' }, diff: { type: 'string', maxLength: 100000 } }, additionalProperties: false } }\n);\nif (['worker_a','worker_b','audit'].includes(actor)) definitions.push({ name: 'export_search_artifacts', description: 'Write actual candidate programs/diffs, final metric/error receipts and database state to your own results/<role> branch path. Does not commit or finish task.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } });\nconst server = new Server({ name: 'alphaevolve-task-tools', version: '0.1.0' }, { capabilities: { tools: {} } });\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: definitions }));\nserver.setRequestHandler(CallToolRequestSchema, async request => {\n const { name, arguments: args = {} } = request.params;\n if (!definitions.some(tool => tool.name === name)) throw new Error('Tool not assigned to this role');\n try { return { content: [{ type: 'text', text: JSON.stringify(await store.operations[name](args)) }] }; }\n catch (error) { return { isError: true, content: [{ type: 'text', text: error.message }] }; }\n});\nserver.connect(new StdioServerTransport()); process.stdin.on('end', () => { store.close(); server.close().finally(() => process.exit()); });\n",
"program-store.cjs": "const fs = require('node:fs');\nconst path = require('node:path');\nconst { createHash } = require('node:crypto');\nconst { DatabaseSync } = require('node:sqlite');\nconst hash = value => createHash('sha256').update(typeof value === 'string' || Buffer.isBuffer(value) ? value : JSON.stringify(value)).digest('hex');\nconst idOk = id => typeof id === 'string' && /^[a-zA-Z0-9_-]{1,100}$/.test(id);\nconst timestamp = () => new Date().toISOString();\nfunction applyDiff(program, diff) {\n const edits = [...diff.matchAll(/<<<<<<< SEARCH\\r?\\n([\\s\\S]*?)\\r?\\n=======\\r?\\n([\\s\\S]*?)\\r?\\n>>>>>>> REPLACE/g)];\n if (!edits.length) throw new Error('Supply SEARCH/REPLACE edits, not an unrelated full program');\n let result = program;\n for (const edit of edits) {\n const search = edit[1], replace = edit[2];\n if (!search || result.split(search).length !== 2) throw new Error('Each SEARCH block must match exactly once');\n result = result.replace(search, replace);\n }\n if (!result.includes('# EVOLVE-BLOCK-START') || !result.includes('# EVOLVE-BLOCK-END')) throw new Error('Evolution markers must be preserved');\n const outside = text => [text.split('# EVOLVE-BLOCK-START')[0], text.split('# EVOLVE-BLOCK-END').slice(1).join('# EVOLVE-BLOCK-END')];\n if (JSON.stringify(outside(result)) !== JSON.stringify(outside(program))) throw new Error('Edits outside the authorized evolution block are forbidden');\n return result;\n}\nfunction openPrograms(root, actor) {\n if (!path.isAbsolute(root) || !['worker_a', 'worker_b', 'manager', 'main', 'audit', 'evaluator'].includes(actor)) throw new Error('Known actor and explicit root required');\n const config = JSON.parse(fs.readFileSync(path.join(root, 'settings.json'), 'utf8'));\n if (config.method !== 'alphaevolve') throw new Error('Wrong method state');\n const db = new DatabaseSync(path.join(root, 'programs.sqlite'));\n db.exec('PRAGMA busy_timeout=5000');\n for(let attempt=0;;attempt++){\n try{\n if(db.prepare('PRAGMA journal_mode').get().journal_mode!=='wal')db.exec('PRAGMA journal_mode=WAL');\n db.exec('CREATE TABLE IF NOT EXISTS programs(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS prompts(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS journal(seq INTEGER PRIMARY KEY AUTOINCREMENT,json TEXT NOT NULL);');\n break;\n }catch(error){if(![5,6].includes(error.errcode)||attempt>=80){db.close();throw error;}Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25);}\n }\n const log = entry => db.prepare('INSERT INTO journal(json) VALUES (?)').run(JSON.stringify({ ...entry, at: timestamp() }));\n const list = () => db.prepare('SELECT json FROM programs').all().map(row => JSON.parse(row.json));\n const get = id => { const row = db.prepare('SELECT json FROM programs WHERE id=?').get(id); return row ? JSON.parse(row.json) : null; };\n const save = program => db.prepare('INSERT INTO programs(id,json) VALUES (?,?) ON CONFLICT(id) DO UPDATE SET json=excluded.json').run(program.id, JSON.stringify(program));\n const transaction = fn => { db.exec('BEGIN IMMEDIATE'); try { const result = fn(); db.exec('COMMIT'); return result; } catch (error) { db.exec('ROLLBACK'); throw error; } };\n const initialCode = fs.readFileSync(config.initialProgram, 'utf8');\n db.prepare('INSERT OR IGNORE INTO programs(id,json) VALUES (?,?)').run('initial', JSON.stringify({ id: 'initial', code: initialCode, codeSha256: hash(initialCode), actor: 'evaluator', island: 0, status: 'queued', requestedAt: timestamp(), seedProgram: true }));\n const final = program => ['scored','rejected'].includes(program.status);\n const feedbackContext = prompt => ({\n scoredParent: Boolean(prompt.parent?.metrics),\n scoredInspirations: prompt.inspirations?.map(program => program.id) ?? [],\n failureIds: prompt.failures?.map(program => program.id) ?? []\n });\n const readiness = () => {\n const programs = list();\n const prompts = db.prepare('SELECT json FROM prompts').all().map(row => JSON.parse(row.json));\n const workers = Object.fromEntries(['worker_a','worker_b'].map(name => {\n const owned = programs.filter(program => program.actor === name);\n const laterFeedback = prompts.filter(prompt => prompt.actor === name).filter(prompt => {\n const included = [prompt.parent?.metrics ? prompt.parent.id : null,...(prompt.inspirations??[]).map(item=>item.id),...(prompt.failures??[]).map(item=>item.id)].filter(Boolean);\n return owned.some(program => final(program) && program.finishedAt <= prompt.sampledAt && included.includes(program.id));\n }).map(prompt=>prompt.id);\n return [name,{created:owned.length,final:owned.filter(final).length,required:config.perWorkerBudget,laterOwnFeedbackPromptIds:laterFeedback,ready:owned.length===config.perWorkerBudget&&owned.every(final)&&laterFeedback.length>0}];\n }));\n return {workers,ready:Object.values(workers).every(worker=>worker.ready)&&final(programs.find(program=>program.id==='initial')),note:'Scientific evidence gate, not proof of native Git integration or model cognition. Final proposal must sample actual earlier own feedback at this reduced three-candidate scale; no generation-wide barrier.'};\n };\n const state = () => ({ method: config.method, publicTask: config.publicTask, perWorkerBudget: config.perWorkerBudget, evaluatorConcurrency: 2, programs: list().map(({ code, ...item }) => item), methodReadiness:readiness(), note: 'Independent public-method adaptation; unpublished original database parameters are not claimed.' });\n const worker = () => { if (!['worker_a', 'worker_b'].includes(actor)) throw new Error('Candidate creation is assigned only to independent generators'); };\n const operations = {\n get_search_state: async () => state(),\n sample_prompt: async args => {\n worker(); if (!idOk(args.requestId)) throw new Error('Stable requestId required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`;\n const retained = db.prepare('SELECT json FROM prompts WHERE id=?').get(id); if (retained) return JSON.parse(retained.json);\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n const viable = all.filter(program => program.status === 'scored' && program.valid);\n const initial = all.find(program => program.id === 'initial');\n if (!viable.length && (!initial || ['queued','evaluating'].includes(initial.status))) throw new Error('Initial program must be actually evaluated before generation');\n const island = actor === 'worker_a' ? 0 : 1;\n const local = viable.filter(program => program.island === island); const population = local.length ? local : viable.length ? viable : [initial];\n // Transparent MAP-Elites-style archive: best in code-size bins on each island.\n // These descriptor bins/sampling weights are independent choices, not unpublished AlphaEvolve defaults.\n const archive = new Map();\n const score = program => program.metrics?.sum_of_radii ?? -Infinity;\n for (const program of population) { const bin = Math.floor(program.code.length / 1000); if (!archive.has(bin) || score(archive.get(bin)) < score(program)) archive.set(bin, program); }\n const elites = [...archive.values()].sort((a, b) => score(b) - score(a));\n const seed = parseInt(hash(id).slice(0, 8), 16);\n const parent = seed % 4 === 0 ? elites[seed % elites.length] : elites[0];\n const inspirations = viable.filter(program => program.id !== parent.id).sort((a,b) => b.metrics.sum_of_radii - a.metrics.sum_of_radii).slice(0, 2);\n const failures = all.filter(program => (program.actor === actor || program.seedProgram) && program.status === 'rejected').slice(-2).map(({ id, stages, error }) => ({ id, stages, error }));\n const prompt = { id, actor, island, parent: { id: parent.id, code: parent.code, metrics: parent.metrics }, inspirations: inspirations.map(({ id, code, metrics, island }) => ({ id, code, metrics, island })), failures, databaseRevision: all.length, instructions: config.taskInstructions, policy: 'size-bin elites within actor island; 75% best / 25% deterministic diverse sampling; global inspiration exchange. Explicit independent implementation choices.', sampledAt: timestamp() };\n prompt.feedbackContext = feedbackContext(prompt);\n db.prepare('INSERT INTO prompts(id,json) VALUES (?,?)').run(id, JSON.stringify(prompt)); log({ type: 'prompt.sampled', promptId: id, actor, parent: parent.id, inspirationIds: inspirations.map(program => program.id), revision: all.length }); return prompt;\n });\n },\n submit_diff: async args => {\n worker(); if (!idOk(args.requestId) || typeof args.diff !== 'string' || args.diff.length > 100000) throw new Error('Stable request id and bounded actual diff required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`, retained = get(id), requestHash = hash(args);\n if (retained) { if (retained.requestHash !== requestHash) throw new Error('Idempotency key cannot be changed'); return { candidateId: id, status: retained.status }; }\n const promptRow = db.prepare('SELECT json FROM prompts WHERE id=?').get(args.promptId);\n const prompt = promptRow && JSON.parse(promptRow.json); if (!prompt || prompt.actor !== actor) throw new Error('Use your actual sampled parent and inspirations');\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n if (all.filter(program=>program.actor===actor).length===config.perWorkerBudget-1) {\n const included=[prompt.parent?.metrics?prompt.parent.id:null,...prompt.inspirations.map(item=>item.id),...prompt.failures.map(item=>item.id)].filter(Boolean);\n if (!all.some(program=>program.actor===actor&&final(program)&&program.finishedAt<=prompt.sampledAt&&included.includes(program.id))) throw new Error('Before the final candidate, inspect an actual completed earlier own evaluation, then sample_prompt with a NEW requestId so scored parent/inspiration or rejection feedback is included. Keep the other branch asynchronous; no whole-generation barrier.');\n }\n const code = applyDiff(prompt.parent.code, args.diff);\n const program = { id, actor, island: prompt.island, code, codeSha256: hash(code), diff: args.diff, parentId: prompt.parent.id, inspirationIds: prompt.inspirations.map(program => program.id), promptId: args.promptId, requestHash, status: 'queued', requestedAt: timestamp() };\n save(program); log({ type: 'candidate.queued', id, actor, parentId: program.parentId, codeSha256: program.codeSha256 });\n return { candidateId: id, status: 'queued', instruction: 'Evaluation runs asynchronously in the external atomic Task backend; do not wait on a group-wide barrier. You may sample/generate another candidate while this is pending, then poll its actual result.' };\n });\n },\n inspect_candidate: async ({ candidateId }) => {\n const program = get(candidateId); if (!program) throw new Error('Unknown candidate');\n const { code, diff, ...record } = program; return record;\n },\n export_search_artifacts: async () => {\n if (!['worker_a', 'worker_b', 'audit'].includes(actor)) throw new Error('Export belongs to business roles');\n const owned = list().filter(program => actor === 'audit' || program.actor === actor);\n if (owned.some(program => ['queued','evaluating'].includes(program.status))) throw new Error('Actual evaluations are still pending; preserve them, do not claim completion');\n const contract=readiness();\n if (actor==='audit'?!contract.ready:!contract.workers[actor].ready) throw new Error('Scientific evidence is incomplete: read get_search_state.methodReadiness; each generator needs three final receipts and a later sample containing its actual earlier feedback. Git integration remains a separate native requirement.');\n const directory = path.join(process.cwd(), 'results', actor); fs.mkdirSync(directory, { recursive: true });\n for (const program of owned) { fs.writeFileSync(path.join(directory, `${program.id}.py`), program.code); fs.writeFileSync(path.join(directory, `${program.id}.json`), JSON.stringify(program, null, 2)); }\n const prompts=db.prepare('SELECT json FROM prompts').all().map(row=>JSON.parse(row.json)).filter(prompt=>actor==='audit'||prompt.actor===actor);\n const journal=db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row=>JSON.parse(row.json)).filter(entry=>actor==='audit'||entry.actor===actor||owned.some(program=>program.id===entry.id));\n fs.writeFileSync(path.join(directory,'prompts.json'),JSON.stringify(prompts,null,2));\n fs.writeFileSync(path.join(directory,'journal.json'),JSON.stringify(journal,null,2));\n fs.writeFileSync(path.join(directory, 'search-state.json'), JSON.stringify(state(), null, 2));\n return { relativePath: `results/${actor}`, candidates: owned.map(program => ({ id: program.id, status: program.status, valid: program.valid, metrics: program.metrics })) };\n }\n };\n return { operations, config, list, get, state, journal: () => db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row => JSON.parse(row.json)),\n claimQueued: () => transaction(() => { const item = list().find(program => program.status === 'queued'); if (!item) return null; item.status = 'evaluating'; item.startedAt = timestamp(); save(item); log({ type: 'evaluation.started', id: item.id }); return item; }),\n finish: (id, receipt) => transaction(() => { const item = get(id); if (!item || item.status !== 'evaluating') throw new Error('Evaluation is not in the retained executing state'); Object.assign(item, receipt, { finishedAt: timestamp() }); save(item); log({ type: 'evaluation.finished', id, status: item.status, metrics: item.metrics, stageCount: item.stages?.length }); }),\n close: () => db.close() };\n}\nmodule.exports = { openPrograms, applyDiff, hash };\n"
},
"args": [
"worker_a"
],
"envFrom": {
"SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT": "SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT"
}
},
"alpha-worker_b": {
"command": "node",
"entrypoint": "server.cjs",
"files": {
"server.cjs": "const { Server } = require('@modelcontextprotocol/sdk/server/index.js');\nconst { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');\nconst { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');\nconst { openPrograms } = require('./program-store.cjs');\nconst actor = process.argv[2], store = openPrograms(process.env.SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT, actor);\nconst definitions = [\n { name: 'get_search_state', description: 'Read actual candidate queue, baseline/evaluator receipts, scores, statuses and methodReadiness per worker. Missing, pending, and scientific negative results are distinct.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } },\n { name: 'inspect_candidate', description: 'Read one actual async evaluation status, cascade results, metrics and errors; no guessed results.', inputSchema: { type: 'object', required: ['candidateId'], properties: { candidateId: { type: 'string' } }, additionalProperties: false } }\n];\nif (['worker_a','worker_b'].includes(actor)) definitions.push(\n { name: 'sample_prompt', description: 'Sample a current database parent, distinct inspirations and your actual failure feedback. Uses per-island elites/diversity and live scored results; keep the returned promptId.', inputSchema: { type: 'object', required: ['requestId'], properties: { requestId: { type: 'string' } }, additionalProperties: false } },\n { name: 'submit_diff', description: 'Apply actual SEARCH/REPLACE diff inside EVOLVE-BLOCK, enqueue without a generation barrier, preserve parent/inspiration provenance. Final candidate at this three-candidate scale requires a new sampled prompt containing actual completed earlier own feedback. Stable request IDs protect against duplicates.', inputSchema: { type: 'object', required: ['requestId','promptId','diff'], properties: { requestId: { type: 'string' }, promptId: { type: 'string' }, diff: { type: 'string', maxLength: 100000 } }, additionalProperties: false } }\n);\nif (['worker_a','worker_b','audit'].includes(actor)) definitions.push({ name: 'export_search_artifacts', description: 'Write actual candidate programs/diffs, final metric/error receipts and database state to your own results/<role> branch path. Does not commit or finish task.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } });\nconst server = new Server({ name: 'alphaevolve-task-tools', version: '0.1.0' }, { capabilities: { tools: {} } });\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: definitions }));\nserver.setRequestHandler(CallToolRequestSchema, async request => {\n const { name, arguments: args = {} } = request.params;\n if (!definitions.some(tool => tool.name === name)) throw new Error('Tool not assigned to this role');\n try { return { content: [{ type: 'text', text: JSON.stringify(await store.operations[name](args)) }] }; }\n catch (error) { return { isError: true, content: [{ type: 'text', text: error.message }] }; }\n});\nserver.connect(new StdioServerTransport()); process.stdin.on('end', () => { store.close(); server.close().finally(() => process.exit()); });\n",
"program-store.cjs": "const fs = require('node:fs');\nconst path = require('node:path');\nconst { createHash } = require('node:crypto');\nconst { DatabaseSync } = require('node:sqlite');\nconst hash = value => createHash('sha256').update(typeof value === 'string' || Buffer.isBuffer(value) ? value : JSON.stringify(value)).digest('hex');\nconst idOk = id => typeof id === 'string' && /^[a-zA-Z0-9_-]{1,100}$/.test(id);\nconst timestamp = () => new Date().toISOString();\nfunction applyDiff(program, diff) {\n const edits = [...diff.matchAll(/<<<<<<< SEARCH\\r?\\n([\\s\\S]*?)\\r?\\n=======\\r?\\n([\\s\\S]*?)\\r?\\n>>>>>>> REPLACE/g)];\n if (!edits.length) throw new Error('Supply SEARCH/REPLACE edits, not an unrelated full program');\n let result = program;\n for (const edit of edits) {\n const search = edit[1], replace = edit[2];\n if (!search || result.split(search).length !== 2) throw new Error('Each SEARCH block must match exactly once');\n result = result.replace(search, replace);\n }\n if (!result.includes('# EVOLVE-BLOCK-START') || !result.includes('# EVOLVE-BLOCK-END')) throw new Error('Evolution markers must be preserved');\n const outside = text => [text.split('# EVOLVE-BLOCK-START')[0], text.split('# EVOLVE-BLOCK-END').slice(1).join('# EVOLVE-BLOCK-END')];\n if (JSON.stringify(outside(result)) !== JSON.stringify(outside(program))) throw new Error('Edits outside the authorized evolution block are forbidden');\n return result;\n}\nfunction openPrograms(root, actor) {\n if (!path.isAbsolute(root) || !['worker_a', 'worker_b', 'manager', 'main', 'audit', 'evaluator'].includes(actor)) throw new Error('Known actor and explicit root required');\n const config = JSON.parse(fs.readFileSync(path.join(root, 'settings.json'), 'utf8'));\n if (config.method !== 'alphaevolve') throw new Error('Wrong method state');\n const db = new DatabaseSync(path.join(root, 'programs.sqlite'));\n db.exec('PRAGMA busy_timeout=5000');\n for(let attempt=0;;attempt++){\n try{\n if(db.prepare('PRAGMA journal_mode').get().journal_mode!=='wal')db.exec('PRAGMA journal_mode=WAL');\n db.exec('CREATE TABLE IF NOT EXISTS programs(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS prompts(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS journal(seq INTEGER PRIMARY KEY AUTOINCREMENT,json TEXT NOT NULL);');\n break;\n }catch(error){if(![5,6].includes(error.errcode)||attempt>=80){db.close();throw error;}Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25);}\n }\n const log = entry => db.prepare('INSERT INTO journal(json) VALUES (?)').run(JSON.stringify({ ...entry, at: timestamp() }));\n const list = () => db.prepare('SELECT json FROM programs').all().map(row => JSON.parse(row.json));\n const get = id => { const row = db.prepare('SELECT json FROM programs WHERE id=?').get(id); return row ? JSON.parse(row.json) : null; };\n const save = program => db.prepare('INSERT INTO programs(id,json) VALUES (?,?) ON CONFLICT(id) DO UPDATE SET json=excluded.json').run(program.id, JSON.stringify(program));\n const transaction = fn => { db.exec('BEGIN IMMEDIATE'); try { const result = fn(); db.exec('COMMIT'); return result; } catch (error) { db.exec('ROLLBACK'); throw error; } };\n const initialCode = fs.readFileSync(config.initialProgram, 'utf8');\n db.prepare('INSERT OR IGNORE INTO programs(id,json) VALUES (?,?)').run('initial', JSON.stringify({ id: 'initial', code: initialCode, codeSha256: hash(initialCode), actor: 'evaluator', island: 0, status: 'queued', requestedAt: timestamp(), seedProgram: true }));\n const final = program => ['scored','rejected'].includes(program.status);\n const feedbackContext = prompt => ({\n scoredParent: Boolean(prompt.parent?.metrics),\n scoredInspirations: prompt.inspirations?.map(program => program.id) ?? [],\n failureIds: prompt.failures?.map(program => program.id) ?? []\n });\n const readiness = () => {\n const programs = list();\n const prompts = db.prepare('SELECT json FROM prompts').all().map(row => JSON.parse(row.json));\n const workers = Object.fromEntries(['worker_a','worker_b'].map(name => {\n const owned = programs.filter(program => program.actor === name);\n const laterFeedback = prompts.filter(prompt => prompt.actor === name).filter(prompt => {\n const included = [prompt.parent?.metrics ? prompt.parent.id : null,...(prompt.inspirations??[]).map(item=>item.id),...(prompt.failures??[]).map(item=>item.id)].filter(Boolean);\n return owned.some(program => final(program) && program.finishedAt <= prompt.sampledAt && included.includes(program.id));\n }).map(prompt=>prompt.id);\n return [name,{created:owned.length,final:owned.filter(final).length,required:config.perWorkerBudget,laterOwnFeedbackPromptIds:laterFeedback,ready:owned.length===config.perWorkerBudget&&owned.every(final)&&laterFeedback.length>0}];\n }));\n return {workers,ready:Object.values(workers).every(worker=>worker.ready)&&final(programs.find(program=>program.id==='initial')),note:'Scientific evidence gate, not proof of native Git integration or model cognition. Final proposal must sample actual earlier own feedback at this reduced three-candidate scale; no generation-wide barrier.'};\n };\n const state = () => ({ method: config.method, publicTask: config.publicTask, perWorkerBudget: config.perWorkerBudget, evaluatorConcurrency: 2, programs: list().map(({ code, ...item }) => item), methodReadiness:readiness(), note: 'Independent public-method adaptation; unpublished original database parameters are not claimed.' });\n const worker = () => { if (!['worker_a', 'worker_b'].includes(actor)) throw new Error('Candidate creation is assigned only to independent generators'); };\n const operations = {\n get_search_state: async () => state(),\n sample_prompt: async args => {\n worker(); if (!idOk(args.requestId)) throw new Error('Stable requestId required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`;\n const retained = db.prepare('SELECT json FROM prompts WHERE id=?').get(id); if (retained) return JSON.parse(retained.json);\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n const viable = all.filter(program => program.status === 'scored' && program.valid);\n const initial = all.find(program => program.id === 'initial');\n if (!viable.length && (!initial || ['queued','evaluating'].includes(initial.status))) throw new Error('Initial program must be actually evaluated before generation');\n const island = actor === 'worker_a' ? 0 : 1;\n const local = viable.filter(program => program.island === island); const population = local.length ? local : viable.length ? viable : [initial];\n // Transparent MAP-Elites-style archive: best in code-size bins on each island.\n // These descriptor bins/sampling weights are independent choices, not unpublished AlphaEvolve defaults.\n const archive = new Map();\n const score = program => program.metrics?.sum_of_radii ?? -Infinity;\n for (const program of population) { const bin = Math.floor(program.code.length / 1000); if (!archive.has(bin) || score(archive.get(bin)) < score(program)) archive.set(bin, program); }\n const elites = [...archive.values()].sort((a, b) => score(b) - score(a));\n const seed = parseInt(hash(id).slice(0, 8), 16);\n const parent = seed % 4 === 0 ? elites[seed % elites.length] : elites[0];\n const inspirations = viable.filter(program => program.id !== parent.id).sort((a,b) => b.metrics.sum_of_radii - a.metrics.sum_of_radii).slice(0, 2);\n const failures = all.filter(program => (program.actor === actor || program.seedProgram) && program.status === 'rejected').slice(-2).map(({ id, stages, error }) => ({ id, stages, error }));\n const prompt = { id, actor, island, parent: { id: parent.id, code: parent.code, metrics: parent.metrics }, inspirations: inspirations.map(({ id, code, metrics, island }) => ({ id, code, metrics, island })), failures, databaseRevision: all.length, instructions: config.taskInstructions, policy: 'size-bin elites within actor island; 75% best / 25% deterministic diverse sampling; global inspiration exchange. Explicit independent implementation choices.', sampledAt: timestamp() };\n prompt.feedbackContext = feedbackContext(prompt);\n db.prepare('INSERT INTO prompts(id,json) VALUES (?,?)').run(id, JSON.stringify(prompt)); log({ type: 'prompt.sampled', promptId: id, actor, parent: parent.id, inspirationIds: inspirations.map(program => program.id), revision: all.length }); return prompt;\n });\n },\n submit_diff: async args => {\n worker(); if (!idOk(args.requestId) || typeof args.diff !== 'string' || args.diff.length > 100000) throw new Error('Stable request id and bounded actual diff required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`, retained = get(id), requestHash = hash(args);\n if (retained) { if (retained.requestHash !== requestHash) throw new Error('Idempotency key cannot be changed'); return { candidateId: id, status: retained.status }; }\n const promptRow = db.prepare('SELECT json FROM prompts WHERE id=?').get(args.promptId);\n const prompt = promptRow && JSON.parse(promptRow.json); if (!prompt || prompt.actor !== actor) throw new Error('Use your actual sampled parent and inspirations');\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n if (all.filter(program=>program.actor===actor).length===config.perWorkerBudget-1) {\n const included=[prompt.parent?.metrics?prompt.parent.id:null,...prompt.inspirations.map(item=>item.id),...prompt.failures.map(item=>item.id)].filter(Boolean);\n if (!all.some(program=>program.actor===actor&&final(program)&&program.finishedAt<=prompt.sampledAt&&included.includes(program.id))) throw new Error('Before the final candidate, inspect an actual completed earlier own evaluation, then sample_prompt with a NEW requestId so scored parent/inspiration or rejection feedback is included. Keep the other branch asynchronous; no whole-generation barrier.');\n }\n const code = applyDiff(prompt.parent.code, args.diff);\n const program = { id, actor, island: prompt.island, code, codeSha256: hash(code), diff: args.diff, parentId: prompt.parent.id, inspirationIds: prompt.inspirations.map(program => program.id), promptId: args.promptId, requestHash, status: 'queued', requestedAt: timestamp() };\n save(program); log({ type: 'candidate.queued', id, actor, parentId: program.parentId, codeSha256: program.codeSha256 });\n return { candidateId: id, status: 'queued', instruction: 'Evaluation runs asynchronously in the external atomic Task backend; do not wait on a group-wide barrier. You may sample/generate another candidate while this is pending, then poll its actual result.' };\n });\n },\n inspect_candidate: async ({ candidateId }) => {\n const program = get(candidateId); if (!program) throw new Error('Unknown candidate');\n const { code, diff, ...record } = program; return record;\n },\n export_search_artifacts: async () => {\n if (!['worker_a', 'worker_b', 'audit'].includes(actor)) throw new Error('Export belongs to business roles');\n const owned = list().filter(program => actor === 'audit' || program.actor === actor);\n if (owned.some(program => ['queued','evaluating'].includes(program.status))) throw new Error('Actual evaluations are still pending; preserve them, do not claim completion');\n const contract=readiness();\n if (actor==='audit'?!contract.ready:!contract.workers[actor].ready) throw new Error('Scientific evidence is incomplete: read get_search_state.methodReadiness; each generator needs three final receipts and a later sample containing its actual earlier feedback. Git integration remains a separate native requirement.');\n const directory = path.join(process.cwd(), 'results', actor); fs.mkdirSync(directory, { recursive: true });\n for (const program of owned) { fs.writeFileSync(path.join(directory, `${program.id}.py`), program.code); fs.writeFileSync(path.join(directory, `${program.id}.json`), JSON.stringify(program, null, 2)); }\n const prompts=db.prepare('SELECT json FROM prompts').all().map(row=>JSON.parse(row.json)).filter(prompt=>actor==='audit'||prompt.actor===actor);\n const journal=db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row=>JSON.parse(row.json)).filter(entry=>actor==='audit'||entry.actor===actor||owned.some(program=>program.id===entry.id));\n fs.writeFileSync(path.join(directory,'prompts.json'),JSON.stringify(prompts,null,2));\n fs.writeFileSync(path.join(directory,'journal.json'),JSON.stringify(journal,null,2));\n fs.writeFileSync(path.join(directory, 'search-state.json'), JSON.stringify(state(), null, 2));\n return { relativePath: `results/${actor}`, candidates: owned.map(program => ({ id: program.id, status: program.status, valid: program.valid, metrics: program.metrics })) };\n }\n };\n return { operations, config, list, get, state, journal: () => db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row => JSON.parse(row.json)),\n claimQueued: () => transaction(() => { const item = list().find(program => program.status === 'queued'); if (!item) return null; item.status = 'evaluating'; item.startedAt = timestamp(); save(item); log({ type: 'evaluation.started', id: item.id }); return item; }),\n finish: (id, receipt) => transaction(() => { const item = get(id); if (!item || item.status !== 'evaluating') throw new Error('Evaluation is not in the retained executing state'); Object.assign(item, receipt, { finishedAt: timestamp() }); save(item); log({ type: 'evaluation.finished', id, status: item.status, metrics: item.metrics, stageCount: item.stages?.length }); }),\n close: () => db.close() };\n}\nmodule.exports = { openPrograms, applyDiff, hash };\n"
},
"args": [
"worker_b"
],
"envFrom": {
"SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT": "SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT"
}
},
"alpha-audit": {
"command": "node",
"entrypoint": "server.cjs",
"files": {
"server.cjs": "const { Server } = require('@modelcontextprotocol/sdk/server/index.js');\nconst { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');\nconst { ListToolsRequestSchema, CallToolRequestSchema } = require('@modelcontextprotocol/sdk/types.js');\nconst { openPrograms } = require('./program-store.cjs');\nconst actor = process.argv[2], store = openPrograms(process.env.SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT, actor);\nconst definitions = [\n { name: 'get_search_state', description: 'Read actual candidate queue, baseline/evaluator receipts, scores, statuses and methodReadiness per worker. Missing, pending, and scientific negative results are distinct.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } },\n { name: 'inspect_candidate', description: 'Read one actual async evaluation status, cascade results, metrics and errors; no guessed results.', inputSchema: { type: 'object', required: ['candidateId'], properties: { candidateId: { type: 'string' } }, additionalProperties: false } }\n];\nif (['worker_a','worker_b'].includes(actor)) definitions.push(\n { name: 'sample_prompt', description: 'Sample a current database parent, distinct inspirations and your actual failure feedback. Uses per-island elites/diversity and live scored results; keep the returned promptId.', inputSchema: { type: 'object', required: ['requestId'], properties: { requestId: { type: 'string' } }, additionalProperties: false } },\n { name: 'submit_diff', description: 'Apply actual SEARCH/REPLACE diff inside EVOLVE-BLOCK, enqueue without a generation barrier, preserve parent/inspiration provenance. Final candidate at this three-candidate scale requires a new sampled prompt containing actual completed earlier own feedback. Stable request IDs protect against duplicates.', inputSchema: { type: 'object', required: ['requestId','promptId','diff'], properties: { requestId: { type: 'string' }, promptId: { type: 'string' }, diff: { type: 'string', maxLength: 100000 } }, additionalProperties: false } }\n);\nif (['worker_a','worker_b','audit'].includes(actor)) definitions.push({ name: 'export_search_artifacts', description: 'Write actual candidate programs/diffs, final metric/error receipts and database state to your own results/<role> branch path. Does not commit or finish task.', inputSchema: { type: 'object', properties: {}, additionalProperties: false } });\nconst server = new Server({ name: 'alphaevolve-task-tools', version: '0.1.0' }, { capabilities: { tools: {} } });\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: definitions }));\nserver.setRequestHandler(CallToolRequestSchema, async request => {\n const { name, arguments: args = {} } = request.params;\n if (!definitions.some(tool => tool.name === name)) throw new Error('Tool not assigned to this role');\n try { return { content: [{ type: 'text', text: JSON.stringify(await store.operations[name](args)) }] }; }\n catch (error) { return { isError: true, content: [{ type: 'text', text: error.message }] }; }\n});\nserver.connect(new StdioServerTransport()); process.stdin.on('end', () => { store.close(); server.close().finally(() => process.exit()); });\n",
"program-store.cjs": "const fs = require('node:fs');\nconst path = require('node:path');\nconst { createHash } = require('node:crypto');\nconst { DatabaseSync } = require('node:sqlite');\nconst hash = value => createHash('sha256').update(typeof value === 'string' || Buffer.isBuffer(value) ? value : JSON.stringify(value)).digest('hex');\nconst idOk = id => typeof id === 'string' && /^[a-zA-Z0-9_-]{1,100}$/.test(id);\nconst timestamp = () => new Date().toISOString();\nfunction applyDiff(program, diff) {\n const edits = [...diff.matchAll(/<<<<<<< SEARCH\\r?\\n([\\s\\S]*?)\\r?\\n=======\\r?\\n([\\s\\S]*?)\\r?\\n>>>>>>> REPLACE/g)];\n if (!edits.length) throw new Error('Supply SEARCH/REPLACE edits, not an unrelated full program');\n let result = program;\n for (const edit of edits) {\n const search = edit[1], replace = edit[2];\n if (!search || result.split(search).length !== 2) throw new Error('Each SEARCH block must match exactly once');\n result = result.replace(search, replace);\n }\n if (!result.includes('# EVOLVE-BLOCK-START') || !result.includes('# EVOLVE-BLOCK-END')) throw new Error('Evolution markers must be preserved');\n const outside = text => [text.split('# EVOLVE-BLOCK-START')[0], text.split('# EVOLVE-BLOCK-END').slice(1).join('# EVOLVE-BLOCK-END')];\n if (JSON.stringify(outside(result)) !== JSON.stringify(outside(program))) throw new Error('Edits outside the authorized evolution block are forbidden');\n return result;\n}\nfunction openPrograms(root, actor) {\n if (!path.isAbsolute(root) || !['worker_a', 'worker_b', 'manager', 'main', 'audit', 'evaluator'].includes(actor)) throw new Error('Known actor and explicit root required');\n const config = JSON.parse(fs.readFileSync(path.join(root, 'settings.json'), 'utf8'));\n if (config.method !== 'alphaevolve') throw new Error('Wrong method state');\n const db = new DatabaseSync(path.join(root, 'programs.sqlite'));\n db.exec('PRAGMA busy_timeout=5000');\n for(let attempt=0;;attempt++){\n try{\n if(db.prepare('PRAGMA journal_mode').get().journal_mode!=='wal')db.exec('PRAGMA journal_mode=WAL');\n db.exec('CREATE TABLE IF NOT EXISTS programs(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS prompts(id TEXT PRIMARY KEY, json TEXT NOT NULL); CREATE TABLE IF NOT EXISTS journal(seq INTEGER PRIMARY KEY AUTOINCREMENT,json TEXT NOT NULL);');\n break;\n }catch(error){if(![5,6].includes(error.errcode)||attempt>=80){db.close();throw error;}Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25);}\n }\n const log = entry => db.prepare('INSERT INTO journal(json) VALUES (?)').run(JSON.stringify({ ...entry, at: timestamp() }));\n const list = () => db.prepare('SELECT json FROM programs').all().map(row => JSON.parse(row.json));\n const get = id => { const row = db.prepare('SELECT json FROM programs WHERE id=?').get(id); return row ? JSON.parse(row.json) : null; };\n const save = program => db.prepare('INSERT INTO programs(id,json) VALUES (?,?) ON CONFLICT(id) DO UPDATE SET json=excluded.json').run(program.id, JSON.stringify(program));\n const transaction = fn => { db.exec('BEGIN IMMEDIATE'); try { const result = fn(); db.exec('COMMIT'); return result; } catch (error) { db.exec('ROLLBACK'); throw error; } };\n const initialCode = fs.readFileSync(config.initialProgram, 'utf8');\n db.prepare('INSERT OR IGNORE INTO programs(id,json) VALUES (?,?)').run('initial', JSON.stringify({ id: 'initial', code: initialCode, codeSha256: hash(initialCode), actor: 'evaluator', island: 0, status: 'queued', requestedAt: timestamp(), seedProgram: true }));\n const final = program => ['scored','rejected'].includes(program.status);\n const feedbackContext = prompt => ({\n scoredParent: Boolean(prompt.parent?.metrics),\n scoredInspirations: prompt.inspirations?.map(program => program.id) ?? [],\n failureIds: prompt.failures?.map(program => program.id) ?? []\n });\n const readiness = () => {\n const programs = list();\n const prompts = db.prepare('SELECT json FROM prompts').all().map(row => JSON.parse(row.json));\n const workers = Object.fromEntries(['worker_a','worker_b'].map(name => {\n const owned = programs.filter(program => program.actor === name);\n const laterFeedback = prompts.filter(prompt => prompt.actor === name).filter(prompt => {\n const included = [prompt.parent?.metrics ? prompt.parent.id : null,...(prompt.inspirations??[]).map(item=>item.id),...(prompt.failures??[]).map(item=>item.id)].filter(Boolean);\n return owned.some(program => final(program) && program.finishedAt <= prompt.sampledAt && included.includes(program.id));\n }).map(prompt=>prompt.id);\n return [name,{created:owned.length,final:owned.filter(final).length,required:config.perWorkerBudget,laterOwnFeedbackPromptIds:laterFeedback,ready:owned.length===config.perWorkerBudget&&owned.every(final)&&laterFeedback.length>0}];\n }));\n return {workers,ready:Object.values(workers).every(worker=>worker.ready)&&final(programs.find(program=>program.id==='initial')),note:'Scientific evidence gate, not proof of native Git integration or model cognition. Final proposal must sample actual earlier own feedback at this reduced three-candidate scale; no generation-wide barrier.'};\n };\n const state = () => ({ method: config.method, publicTask: config.publicTask, perWorkerBudget: config.perWorkerBudget, evaluatorConcurrency: 2, programs: list().map(({ code, ...item }) => item), methodReadiness:readiness(), note: 'Independent public-method adaptation; unpublished original database parameters are not claimed.' });\n const worker = () => { if (!['worker_a', 'worker_b'].includes(actor)) throw new Error('Candidate creation is assigned only to independent generators'); };\n const operations = {\n get_search_state: async () => state(),\n sample_prompt: async args => {\n worker(); if (!idOk(args.requestId)) throw new Error('Stable requestId required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`;\n const retained = db.prepare('SELECT json FROM prompts WHERE id=?').get(id); if (retained) return JSON.parse(retained.json);\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n const viable = all.filter(program => program.status === 'scored' && program.valid);\n const initial = all.find(program => program.id === 'initial');\n if (!viable.length && (!initial || ['queued','evaluating'].includes(initial.status))) throw new Error('Initial program must be actually evaluated before generation');\n const island = actor === 'worker_a' ? 0 : 1;\n const local = viable.filter(program => program.island === island); const population = local.length ? local : viable.length ? viable : [initial];\n // Transparent MAP-Elites-style archive: best in code-size bins on each island.\n // These descriptor bins/sampling weights are independent choices, not unpublished AlphaEvolve defaults.\n const archive = new Map();\n const score = program => program.metrics?.sum_of_radii ?? -Infinity;\n for (const program of population) { const bin = Math.floor(program.code.length / 1000); if (!archive.has(bin) || score(archive.get(bin)) < score(program)) archive.set(bin, program); }\n const elites = [...archive.values()].sort((a, b) => score(b) - score(a));\n const seed = parseInt(hash(id).slice(0, 8), 16);\n const parent = seed % 4 === 0 ? elites[seed % elites.length] : elites[0];\n const inspirations = viable.filter(program => program.id !== parent.id).sort((a,b) => b.metrics.sum_of_radii - a.metrics.sum_of_radii).slice(0, 2);\n const failures = all.filter(program => (program.actor === actor || program.seedProgram) && program.status === 'rejected').slice(-2).map(({ id, stages, error }) => ({ id, stages, error }));\n const prompt = { id, actor, island, parent: { id: parent.id, code: parent.code, metrics: parent.metrics }, inspirations: inspirations.map(({ id, code, metrics, island }) => ({ id, code, metrics, island })), failures, databaseRevision: all.length, instructions: config.taskInstructions, policy: 'size-bin elites within actor island; 75% best / 25% deterministic diverse sampling; global inspiration exchange. Explicit independent implementation choices.', sampledAt: timestamp() };\n prompt.feedbackContext = feedbackContext(prompt);\n db.prepare('INSERT INTO prompts(id,json) VALUES (?,?)').run(id, JSON.stringify(prompt)); log({ type: 'prompt.sampled', promptId: id, actor, parent: parent.id, inspirationIds: inspirations.map(program => program.id), revision: all.length }); return prompt;\n });\n },\n submit_diff: async args => {\n worker(); if (!idOk(args.requestId) || typeof args.diff !== 'string' || args.diff.length > 100000) throw new Error('Stable request id and bounded actual diff required');\n return transaction(() => {\n const id = `${actor}-${args.requestId}`, retained = get(id), requestHash = hash(args);\n if (retained) { if (retained.requestHash !== requestHash) throw new Error('Idempotency key cannot be changed'); return { candidateId: id, status: retained.status }; }\n const promptRow = db.prepare('SELECT json FROM prompts WHERE id=?').get(args.promptId);\n const prompt = promptRow && JSON.parse(promptRow.json); if (!prompt || prompt.actor !== actor) throw new Error('Use your actual sampled parent and inspirations');\n const all = list(); if (all.filter(program => program.actor === actor).length >= config.perWorkerBudget) throw new Error('Authorized generation budget exhausted');\n if (all.filter(program=>program.actor===actor).length===config.perWorkerBudget-1) {\n const included=[prompt.parent?.metrics?prompt.parent.id:null,...prompt.inspirations.map(item=>item.id),...prompt.failures.map(item=>item.id)].filter(Boolean);\n if (!all.some(program=>program.actor===actor&&final(program)&&program.finishedAt<=prompt.sampledAt&&included.includes(program.id))) throw new Error('Before the final candidate, inspect an actual completed earlier own evaluation, then sample_prompt with a NEW requestId so scored parent/inspiration or rejection feedback is included. Keep the other branch asynchronous; no whole-generation barrier.');\n }\n const code = applyDiff(prompt.parent.code, args.diff);\n const program = { id, actor, island: prompt.island, code, codeSha256: hash(code), diff: args.diff, parentId: prompt.parent.id, inspirationIds: prompt.inspirations.map(program => program.id), promptId: args.promptId, requestHash, status: 'queued', requestedAt: timestamp() };\n save(program); log({ type: 'candidate.queued', id, actor, parentId: program.parentId, codeSha256: program.codeSha256 });\n return { candidateId: id, status: 'queued', instruction: 'Evaluation runs asynchronously in the external atomic Task backend; do not wait on a group-wide barrier. You may sample/generate another candidate while this is pending, then poll its actual result.' };\n });\n },\n inspect_candidate: async ({ candidateId }) => {\n const program = get(candidateId); if (!program) throw new Error('Unknown candidate');\n const { code, diff, ...record } = program; return record;\n },\n export_search_artifacts: async () => {\n if (!['worker_a', 'worker_b', 'audit'].includes(actor)) throw new Error('Export belongs to business roles');\n const owned = list().filter(program => actor === 'audit' || program.actor === actor);\n if (owned.some(program => ['queued','evaluating'].includes(program.status))) throw new Error('Actual evaluations are still pending; preserve them, do not claim completion');\n const contract=readiness();\n if (actor==='audit'?!contract.ready:!contract.workers[actor].ready) throw new Error('Scientific evidence is incomplete: read get_search_state.methodReadiness; each generator needs three final receipts and a later sample containing its actual earlier feedback. Git integration remains a separate native requirement.');\n const directory = path.join(process.cwd(), 'results', actor); fs.mkdirSync(directory, { recursive: true });\n for (const program of owned) { fs.writeFileSync(path.join(directory, `${program.id}.py`), program.code); fs.writeFileSync(path.join(directory, `${program.id}.json`), JSON.stringify(program, null, 2)); }\n const prompts=db.prepare('SELECT json FROM prompts').all().map(row=>JSON.parse(row.json)).filter(prompt=>actor==='audit'||prompt.actor===actor);\n const journal=db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row=>JSON.parse(row.json)).filter(entry=>actor==='audit'||entry.actor===actor||owned.some(program=>program.id===entry.id));\n fs.writeFileSync(path.join(directory,'prompts.json'),JSON.stringify(prompts,null,2));\n fs.writeFileSync(path.join(directory,'journal.json'),JSON.stringify(journal,null,2));\n fs.writeFileSync(path.join(directory, 'search-state.json'), JSON.stringify(state(), null, 2));\n return { relativePath: `results/${actor}`, candidates: owned.map(program => ({ id: program.id, status: program.status, valid: program.valid, metrics: program.metrics })) };\n }\n };\n return { operations, config, list, get, state, journal: () => db.prepare('SELECT json FROM journal ORDER BY seq').all().map(row => JSON.parse(row.json)),\n claimQueued: () => transaction(() => { const item = list().find(program => program.status === 'queued'); if (!item) return null; item.status = 'evaluating'; item.startedAt = timestamp(); save(item); log({ type: 'evaluation.started', id: item.id }); return item; }),\n finish: (id, receipt) => transaction(() => { const item = get(id); if (!item || item.status !== 'evaluating') throw new Error('Evaluation is not in the retained executing state'); Object.assign(item, receipt, { finishedAt: timestamp() }); save(item); log({ type: 'evaluation.finished', id, status: item.status, metrics: item.metrics, stageCount: item.stages?.length }); }),\n close: () => db.close() };\n}\nmodule.exports = { openPrograms, applyDiff, hash };\n"
},
"args": [
"audit"
],
"envFrom": {
"SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT": "SCIENCEEVOLVE_ALPHA_SCIENCE_ROOT"
}
}
},
"orchestration": {
"schemaVersion": 3,
"agents": [
{
"name": "main",
"template": "main"
},
{
"name": "manager",
"template": "general"
},
{
"name": "worker_a",
"template": "general"
},
{
"name": "worker_b",
"template": "general"
},
{
"name": "audit",
"template": "general"
}
],
"collaborations": [
{
"id": "search",
"displayName": "Independent concurrent evolutionary samplers",
"memberAgentIds": [],
"renamePolicy": "editable"
}
],
"scopedWorkflow": {
"schemaVersion": 1,
"rootAgentIds": [
"main",
"audit"
],
"groups": [
{
"id": "search",
"leaderAgentId": "manager",
"allowLeaderReconfiguration": false,
"workflow": {
"nodes": [
{
"kind": "agent",
"nodeId": "generate_a",
"agentId": "worker_a"
},
{
"kind": "agent",
"nodeId": "generate_b",
"agentId": "worker_b"
}
],
"input": {
"source": "input",
"edges": [
{
"kind": "parallel",
"target": "generate_a"
},
{
"kind": "parallel",
"target": "generate_b"
}
]
},
"routes": {
"generate_a": [
{
"kind": "strong",
"target": "finish"
}
],
"generate_b": [
{
"kind": "strong",
"target": "finish"
}
]
}
}
}
]
},
"input": {
"source": "input",
"target": "search"
},
"routes": {
"main": [],
"search": [
{
"kind": "strong",
"target": "audit"
}
],
"audit": [
{
"kind": "weak",
"target": "finish"
}
]
},
"decisionPlans": {
"audit": "Inspect true method and Task evidence; finish only after both generator paths and all six asynchronous evaluations are accounted for and actual artifacts integrated. Missing phases require an explicit blocker, not fabricated success."
},
"allowMainReconfiguration": false,
"allowUserIntervention": true,
"termination": {
"agent": "audit",
"condition": "Two actual overlapping native Git samplers, six real evaluated candidates plus seed, exact diff and cascade receipts, current-database feedback and independently verified integrated report.",
"decisionBy": "main",
"automatic": false
},
"resultFormat": {
"presets": [
"code",
"markdown"
],
"custom": "Native Git/PR proofs, actual candidate database, diff/parent/inspiration records, real cascade results and audit."
}
}
}