text
stringlengths
3
8.33k
repo
stringclasses
52 values
path
stringlengths
6
141
language
stringclasses
35 values
sha
stringlengths
64
64
chunk_index
int32
0
273
n_tokens
int32
1
896
--- phase: 01-foundation-smoke plan: 05 status: complete requirements: [FND-09, FND-10, FND-11] completed: 2026-04-18 --- # 01-05 SUMMARY — ToolRegistry + GemmaToolParser + JSContext round-trip ## Decision line (resume-signal) `fnd09=code_complete fnd10=code_complete fnd11=deferred parser_tests=4 device_runs=0` ## ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-SUMMARY.md
Markdown
408516aff292fa48d8a111250cc99e511e6a1be901c438a0c61d7eb10b6dabd2
0
896
`grep "generateWithTools" ios/SpecialistApp/ModelState.swift` | ✅ | | No `CoreML` / `transformers` / `E2B` / `WebContainers` refs in authored Swift | ✅ (A03/A04 held) | | No `.py` files authored | ✅ (A05 held) | ## Key files created - `ios/SpecialistApp/DynamicTool.swift` — tool descriptor + `AnyCodable` - `ios/Speci...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-SUMMARY.md
Markdown
3dcc827bf7189cae76b0640e5e597ab6709473fa7fc3acfff8ff369c9eafb3c3
1
737
--- phase: 01-foundation-smoke plan: 05 type: execute wave: 3 depends_on: [03, 04] files_modified: - ios/SpecialistApp/SpecialistCore/ToolRegistry.swift - ios/SpecialistApp/SpecialistCore/GemmaToolParser.swift - ios/SpecialistApp/SpecialistCore/DynamicTool.swift - ios/SpecialistApp/SpecialistCore/OnlineMonitor....
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-toolregistry-parser-roundtrip-PLAN.md
Markdown
c0e4097cd7a28b8735fefc83d8915704877ab2a596d76749de9913a883f86a5c
0
896
ModelState` (base weights resident, airplane-mode sanity verified). - This plan does NOT require an adapter — the hand-written JS tool test runs against the UNMODIFIED E4B base. PRD §14 H2: "Force the unmodified E4B to emit a `<|tool_call|>` token by constructing a prompt with a tool definition in context." Gemma 4 to...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-toolregistry-parser-roundtrip-PLAN.md
Markdown
558101a93f02f00f180edd39d3930dfbf5887f6fde3f171eec533e28589822e3
1
896
) { value = a.map { $0.value }; return } if let o = try? c.decode([String: AnyCodable].self) { value = o.mapValues { $0.value }; return } value = NSNull() } func encode(to encoder: Encoder) throws { var c = encoder.singleValueContainer() ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-toolregistry-parser-roundtrip-PLAN.md
Markdown
83d67eeb25ef1e83a92bc41a99cf870fb10b6fc51646b1ec3794ff009884c2fa
2
896
SpecialistCore/ToolRegistry.swift && grep -l "NWPathMonitor" ios/SpecialistApp/SpecialistCore/OnlineMonitor.swift && grep -l "requiresNetwork" ios/SpecialistApp/SpecialistCore/DynamicTool.swift && xcodebuild -project ios/SpecialistApp/SpecialistApp.xcodeproj -scheme SpecialistApp -destination 'generic/platform=iOS' -co...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-toolregistry-parser-roundtrip-PLAN.md
Markdown
8fca81287047e4a31343ebcf54509299b19d0e9891c34580e79c709305ef16c4
3
896
// No open tag in buffer — flush as text if no partial open-tag suffix if !buffer.hasSuffix("<") && !buffer.hasSuffix("<|") && !buffer.hasSuffix("<|t") { events.append(.text(buffer)) buffer.removeAll() } return events } ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-toolregistry-parser-roundtrip-PLAN.md
Markdown
1b79e2bd1b51530e3ee6527cce8aa208eeb6f09d230b3aacd6dacae977886d8a
4
896
else { return false } }) } } ``` 3. Run `xcodebuild test` against the simulator to confirm parser tests pass. 4. Tokenizer sanity: (PITFALLS P1) add a one-shot test asserting the base tokenizer encodes `<|tool_call|>` as a SINGLE token id. If it splits into multiple ids, the parser st...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-toolregistry-parser-roundtrip-PLAN.md
Markdown
5cbdda52821c6ce595d2fe43ca5b0822925cc1cbcef660d95e75d12d54f14226
5
896
s) — retrying") // Retry = ask model to regenerate the last call (single attempt) } } } } ``` If mlx-swift-lm 3.x does not expose a continuation primitive cleanly, fall back to prompt-concat-and-generate-twice (documented acceptabl...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-toolregistry-parser-roundtrip-PLAN.md
Markdown
a8f36b92ba1b2052c1428339fa2bfe40886f905aa9c9f02f97c25d634768f383
6
896
>FND-11 kill-point resolved. Phase 1 complete; Phase 2+ may proceed with confidence in the dynamic-tool path.</done> </task> </tasks> <threat_model> ## Trust Boundaries | Boundary | Description | |----------|-------------| | Model stream → GemmaToolParser | Untrusted text from base model; parser must fail-safe on ma...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/01-foundation-smoke/01-05-toolregistry-parser-roundtrip-PLAN.md
Markdown
39f1fcca424b90b342348317f4a698cf8247d553956b7b1aba4a79099dd5caae
7
682
--- phase: 02-orchestrator-harness plan: 01 type: execute wave: 1 depends_on: [] files_modified: - app/api/pipeline/route.ts - lib/coordinator/coordinator.ts - lib/coordinator/spawnWorker.ts - lib/coordinator/taskNotification.ts - lib/workers/roles.ts - lib/streams/mergeWriter.ts - lib/observability/agent...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-pipeline-coordinator-worker-PLAN.md
Markdown
934340751d16c7be4dc2c980e79c612838baa5a54f24b845e53cce862ad8372d
0
896
@.planning/phases/01-foundation-smoke/01-01-next-scaffold-sentry-providers-PLAN.md <interfaces> <!-- Pinned from Phase 1 scaffold (01-01). Use these EXACT import paths and versions. --> - `ai@^6.0.168` — `import { createUIMessageStream, Experimental_Agent as Agent, tool, stepCountIs } from 'ai'` - `@ai-sdk/anthropic@^...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-pipeline-coordinator-worker-PLAN.md
Markdown
bac742e51e9a007216cd4ed9a76e406d6251cf9eb8fcaac0e78e041b5cb6bccd
1
896
worker.id', id); return fn(span); })`. Also export `setToolCallAttributes(name: string, args: unknown)` that does `Sentry.getActiveSpan()?.setAttribute('gen_ai.tool.name', name)` + `.setAttribute('gen_ai.tool.arguments', JSON.stringify(args).slice(0, 2000))` (defensive vs PITFALLS P11). 2. **lib/coordinator/taskNotifi...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-pipeline-coordinator-worker-PLAN.md
Markdown
c0d1ca632d4799062c62f083bbdeebb23d0c3d2fd25feccbb313b5fe01800d64
2
896
. You only call spawnWorker to delegate. Always launch at least 2 workers in parallel when asked.' })`. Coordinator MUST NOT include any other tool; the no-domain-work rule (PRD §10.2 #1) is enforced by tool allowlist. </action> <verify> <automated>node -e "require('./lib/observability/agentSpans.ts')" 2>&1 | h...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-pipeline-coordinator-worker-PLAN.md
Markdown
234d742f6a11b7c1dacce81384f7dcc3f56e7a2721f1dc2b25329f2e58d21afe
3
896
AbortSignal propagates into agent.generate via its own signal option }); try { await coordinator.generate({ prompt, abortSignal: req.signal }); } catch (e) { const msg = e instanceof Error ? e.message.slice(0, 400) : 'coordinator error'; writer.write({ type: 'data-agent-status'...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-pipeline-coordinator-worker-PLAN.md
Markdown
2d4fe80e81944802ae466537155a4efbd0e403e0be220154ba66a440ee1864fa
4
896
''; let startCount = 0; const notificationIds = new Set<string>(); while (true) { const { value, done } = await reader.read(); if (done) break; buf += decoder.decode(value, { stream: true }); for (const line of buf.split('\n')) { if (line.startsWith('data:')) { const payload = line.slice(5).trim(); ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-pipeline-coordinator-worker-PLAN.md
Markdown
79b24782c937bf336f688a93e9c0215c1f2c888b5d2f396e55fe54201a37b2cd
5
896
never reach `runRole` | | T-02-02 | DoS | ToolLoopAgent unbounded | mitigate | `stepCountIs(8)` + `AbortSignal.timeout(90_000)` per worker (PITFALLS P10) | | T-02-03 | DoS/Cost | Concurrent worker spawn burst | mitigate | `p-limit(15)` on every spawn; 429 from Anthropic falls over to Gemini (PITFALLS P22) | | T-02-04 |...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-pipeline-coordinator-worker-PLAN.md
Markdown
1159664a94eedc2269b8773617cb1405e76612896fddde04ccb0d7f67341b5d2
6
518
--- phase: 02-orchestrator-harness plan: 01 subsystem: laptop/orchestrator tags: [ai-sdk-v6, createUIMessageStream, writer.merge, coordinator, spawnWorker, sentry, ai.agent] requires: - ai@^6.0.168 - @ai-sdk/anthropic@^3.0.71 - @ai-sdk/google@^3.0.64 - @sentry/nextjs@^10.49.0 - zod@^3.25.76 - p-limit@^6 pro...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-SUMMARY.md
Markdown
43d17c4ed83b0a9bce02a8de6edf78ea2176ad5c5cec5cd892e10f4234843b95
0
896
) that opens one client SSE, a `ToolLoopAgent` coordinator whose only tool is `spawnWorker`, and a per-worker sub-stream wired through `writer.merge` that emits a `data-agent-status` (transient) and a `data-task-notification` (persistent) chunk. Every worker invocation is wrapped in `Sentry.startSpan({op:'ai.agent'})` ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-SUMMARY.md
Markdown
0f0d4d9c98ae1fe43b589a3eb565e4841c27b7a7f85eb0dec7c7c21e2ebe7d45
1
896
## Deviations from Plan All deviations are Rule 3 (blocking-issue fixes) caused by AI SDK v6.0.168 API shape differences against the plan's expectations. None changed the behavior required by the must-haves/truths/artifacts; only surface names moved. ### Auto-fixed Issues **1. [Rule 3 — API rename] `tool({parameters...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-SUMMARY.md
Markdown
39131a21a139f611d4614c7087cf852734d1f12472e25ef27f11821f2f7742b8
2
896
excludes `scripts/` and Next only compiles files it resolves from the router. ## Authentication Gates None triggered. Task 3's smoke script requires a live `ANTHROPIC_API_KEY` in the environment when run manually; script is not executed during plan execution (documented in its own comments as a manual verification st...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-SUMMARY.md
Markdown
2bd78eb6317234d78c6565f2f089a7a239cc1298f8d04f52dd1b0090f535a1b2
3
896
does not change. - Demo client (`app/(demo)/page.tsx`) consumes `/api/pipeline` via `useChat({onData})` — routes `data-agent-status` (transient) to the 5x4 grid and `data-task-notification` (persistent) to the terminal-state map. 02-02 will wire the grid; chart is already wired via 02-02 T3. ## Known Stubs - `lib/wor...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-01-SUMMARY.md
Markdown
b2b6f55fe5f82a97c45935f27c17628022ba9b82acb6aa4889eb38b7b546d505
4
386
--- phase: 02-orchestrator-harness plan: 02 subsystem: training-subprocess tags: [training, sse, mlx-lm, recharts, sentry] requires: - ai@^6.0.168 (createUIMessageStream, createUIMessageStreamResponse) - "@sentry/nextjs@^10.49.0" - recharts - node:child_process, node:readline provides: - POST /api/train (SSE ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-SUMMARY.md
Markdown
46b8f2a95e81a24b320efec60c30ceb866abffe83040f0c35575d2092114dbd7
0
896
from Plan ### Auto-fixed Issues **1. [Rule 1 - Bug] AI SDK v6 stream has no `.toResponse()` method** - **Found during:** Task 2 typecheck - **Issue:** Plan snippet used `stream.toResponse()`; `tsc --noEmit` reported `Property 'toResponse' does not exist on type 'ReadableStream<...>'`. - **Fix:** Switched to `createUI...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-SUMMARY.md
Markdown
0e526bf0871ff7ad72d10bd36bffd8e5ac7d047b23b810c66ca708a418431846
1
729
--- phase: 02-orchestrator-harness plan: 02 type: execute wave: 1 depends_on: [] files_modified: - app/api/train/route.ts - lib/streams/trainParser.ts - lib/observability/trainingSpans.ts - app/(demo)/LossChart.tsx autonomous: true requirements: [ORC-04, ORC-05] must_haves: truths: - "`/api/train` spawns...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-train-subprocess-loss-chart-PLAN.md
Markdown
10cab6de3feb28aa3564889d1d6df1a698967c7d4ed36a1f5f42c2f8cb64b892
0
896
PLAN.md @.planning/phases/01-foundation-smoke/01-02-python-venv-microbench-PLAN.md <interfaces> <!-- Pinned deps (from Phase 1 01-01) --> - `ai@^6.0.168` — `createUIMessageStream` (stream framing) - `@sentry/nextjs@^10.49.0` - `recharts` (latest; install if absent: `pnpm add recharts`) - Node built-ins: `node:child_pr...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-train-subprocess-loss-chart-PLAN.md
Markdown
4d6f344519a322c38d4e4a0f136539a5638afd9e49d4dbaa05dd9720c3cc02ce
1
896
; const t = line.match(TRAIN_LOSS_RE); if (t) return { iter: Number(t[1]), loss: Number(t[2]) }; const r = line.match(REWARD_RE); if (r) return { iter: Number(r[1]), reward: Number(r[2]) }; const f = line.match(LOSS_FALLBACK_RE); if (f) return { iter: -1, loss: Number(f[1]) }; return null; } ``` 2. **lib...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-train-subprocess-loss-chart-PLAN.md
Markdown
7baa5a370fdf4718ee3a0c60a7787ce2f1a5d54dd86a3544a409f610d928ec36
2
896
registry so hot-reload can SIGTERM orphans (PITFALLS P16 defense) const CHILDREN = new Map<string, ChildProcessWithoutNullStreams>(); type TrainRequest = { mode: 'sft' | 'grpo'; iters?: number; model?: string; // NEVER accept arbitrary argv from body — only a closed enum of (mode, iters, model). }; export asy...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-train-subprocess-loss-chart-PLAN.md
Markdown
b7fe9c2054c053d47b6460ccdd909d6fab7446c12903002564934efcb2c84bc4
3
896
CHILDREN.values()) { try { c.kill('SIGTERM'); } catch {} } }); } ``` Hard rules: - `model` must pass the closed regex `/^[\w\-./]+$/` — blocks arg injection (T-02-09). - `iters` capped at 2000 — blocks training-runs-over-20-min hard constraint (CLAUDE.md). - No user-supplied path ever reaches `spawn(bin, args)` except...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-train-subprocess-loss-chart-PLAN.md
Markdown
54f3b3767735a804cbeed12af822e5f9bc7459052043e1dec74857cbfd9ede8b
4
896
12, right: 24, bottom: 8, left: 8 }}> <CartesianGrid strokeDasharray="3 3" /> <XAxis dataKey="iter" type="number" domain={['auto', 'auto']} /> <YAxis yAxisId="loss" orientation="left" domain={['auto', 'auto']} /> <YAxis yAxisId="reward" orientation="right" domain={['auto', 'auto'...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-train-subprocess-loss-chart-PLAN.md
Markdown
60d7e92e7f5bfff41e300fce3ac8ac26dc51efc29e8e74652e83d42dfb2c78b1
5
896
_000_000` | mitigate | Cap `iters <= 2000` (CLAUDE.md hard constraint: no runs >20 min) | | T-02-10 | Information Disclosure | Provider/subprocess error leaks env | mitigate | Truncate error strings to 400 chars; never echo `process.env` contents | | T-02-11 | Tampering | Unknown `mode` triggers undefined binary | miti...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-02-train-subprocess-loss-chart-PLAN.md
Markdown
32ed33a6c06395f3e76eb60578545c182fbdf23ad26075ed11431e2ff65d2ade
6
467
--- phase: 02-orchestrator-harness plan: 03 type: execute wave: 2 depends_on: [02-01, 02-02] files_modified: - app/(demo)/page.tsx - app/(demo)/AgentGrid.tsx - app/(demo)/AgentCard.tsx - app/(demo)/useDemoStream.ts autonomous: true requirements: [ORC-03] must_haves: truths: - "Demo page mounts `useChat({...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-agent-grid-demo-page-PLAN.md
Markdown
8e489d1650263e61614d4737c3b983ce942571a1deae229f84d4404631880565
0
896
-subprocess-loss-chart-PLAN.md @.planning/phases/01-foundation-smoke/01-01-next-scaffold-sentry-providers-PLAN.md <interfaces> <!-- Part shapes produced by Plans 02-01 and 02-02 (must match exactly) --> type AgentStatus = { role: string; status: 'running'|'ok'|'err'|'timeout'; step?: string; lastLine?: string }; type ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-agent-grid-demo-page-PLAN.md
Markdown
11492a39ad523c0450bcbd4ba42024f7c738144ce0b9e1709cb61ef560d09dbd
1
896
part.id]: part.data as AgentStatus })); } else if (part.type === 'data-task-notification') { const n = part.data as TaskNotification; setNotifications((p) => ({ ...p, [part.id]: n })); // Promote terminal status onto agents map so card turns green/red setAgents((p) => ({ ...p, [par...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-agent-grid-demo-page-PLAN.md
Markdown
dd23a897ac85e8bdccadde7c3988d9ddef8f42a9087b083aab5683f7f1b03392
2
896
slice(0, 20); // Pad to 20 slots so the grid always shows 5x4 const slots: ([string, AgentStatus] | null)[] = [...entries]; while (slots.length < 20) slots.push(null); return ( <div style={{ display: 'grid', gridTemplateColumns: 'repeat(5, 1fr)', gridTemplateRows: 'repeat(4, 1fr)', gap: 8 }} dat...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-agent-grid-demo-page-PLAN.md
Markdown
5f70bd4f0bfcaa254862fb26736f500b6ed8e53bc590fd877e8e403b92be7dd5
3
896
md (layout conventions) </read_first> <action> Create `app/(demo)/page.tsx`: ```typescript 'use client'; import { useDemoStream } from './useDemoStream'; import { AgentGrid } from './AgentGrid'; import { LossChart } from './LossChart'; export default function DemoPage() { const { agents, notifications, train, se...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-agent-grid-demo-page-PLAN.md
Markdown
2c6cbceb4eed050345db7d1d9fa0ad0e23bb53657dfebc483ea27a60dd00582e
4
896
and empty chart; click "Smoke: 2 workers" populates >=2 cards; click "Smoke: SFT 20 iter" renders a loss line </acceptance_criteria> <done>Demo page renders, build succeeds, manual smoke populates grid and chart.</done> </task> <task type="checkpoint:human-verify" gate="blocking"> <name>Task 3: Human verificatio...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-agent-grid-demo-page-PLAN.md
Markdown
36133543dff0f122373f99969e270a0e013b53cb4473cb46d24dffbe35cbd564
5
896
on load, populated grid after smoke click, chart renders loss line after SFT smoke. - Sentry dashboard confirms `ai.agent` + `training.sft` spans in the same session. </verification> <success_criteria> - ORC-03 satisfied: `useChat({onData})` routes transient status vs persistent notification into the 5×4 grid keyed by...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-agent-grid-demo-page-PLAN.md
Markdown
468bed84923bbef9279b86b67d055505bfca4fb44774d269b17c4cd0e0e63f88
6
183
--- phase: 02-orchestrator-harness plan: 03 subsystem: demo-ui tags: [orchestrator, ui, streaming, ai-sdk-v6, recharts] requirements: [ORC-03] provides: - demo-route: app/(demo)/page.tsx mounts AgentGrid + LossChart - hook: useDemoStream routes data-agent-status / data-task-notification / data-train - components:...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-SUMMARY.md
Markdown
a4d7059186e306fe07c045cb37fe9b35cfe0ed2bde53e4d2695087776811a1ad
0
896
5, 1fr)'` and `gridTemplateRows:'repeat(4, 1fr)'`, padded to 20 slots so the grid is always visually 5×4 even on mount with zero workers. Empty slots render a dashed `#27272a` placeholder. - **`app/(demo)/page.tsx`** — Composes the two surfaces. Header buttons: **Smoke: 2 workers** (fires `sendMessage({text: 'Launch 2 ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-SUMMARY.md
Markdown
550cf6b95fb2853b24f5f4bc135d10f7c096fb6b0960e8f141fb939ba7596dc6
1
896
**Commit:** 1fe1afe ### Plan-Anticipated Adjustments (not deviations) - Plan's `<interfaces>` suggested `useChat` from `ai/react` "or whatever Plan 02-01 recorded". We used `@ai-sdk/react` (the v6 canonical surface) and `DefaultChatTransport` from `ai`, which is the AI SDK v6 shape (v6 moved hooks out of the `ai` roo...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-03-SUMMARY.md
Markdown
33972059804557265fe4e5f910662d7f26e7fe195bc45d3bbbcca08c2138b131
2
394
# Phase 2: Orchestrator Harness - Research **Researched:** 2026-04-18 (H3 window) **Domain:** AI SDK v6 merged SSE streams, coordinator/worker agent pattern, Node `child_process` → SSE pipe, Sentry `gen_ai` spans **Confidence:** MEDIUM (Phase 1 pins are HIGH; AI SDK v6 beta API surface is LOW-MEDIUM — resolve import p...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
217f24f8436de6ddfa7dd91d25f588307d0e545a9300b9527b7e1ec7f13df715
0
896
/ Backend | Browser (Sentry browser SDK can capture UI interactions, nice-to-have) | `gen_ai` + training telemetry belongs on the server; iOS stays uninstrumented (PRD §12.3, A15). | | Provider token accounting (Anthropic org-TPM guard) | API / Backend | — | Coordinator needs a global counter; only server has this view...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
19cce136bfecd1c3c9c3193c532ce4056bef5d2b6c969faebcf213ebb27f3009
1
896
createUIMessageStream` + `writer.merge` | Raw SSE via `new Response(new ReadableStream(...))` | Loses `useChat({onData})` typed parts and transient/persistent distinction; requires hand-rolling the client parser. Reject — PRD §10.4 specifically requires the typed-part plumbing. [ASSUMED: v6 still exposes this API under...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
ef2a671b020c3d0c420f649fb8b06782f15befc4dcda48ea1a3330c9fa22e972
2
896
sft.400iter' }, async span => { | const rl = readline.createInterface({ input: child.stdout }); | for await (const line of rl) { | const m = line.match(/Iter (\d+): Train loss ([\d.]+)/); | if (m) { | const iter = Number(m[1]), loss = Number(m[2]); ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
ffcf8df2b7f5473c997f8a2cb4de968760bd6c44fcb3b4541ee11a9d3084fc8f
3
896
z } from 'zod'; import * as Sentry from '@sentry/nextjs'; export const runtime = 'nodejs'; export const dynamic = 'force-dynamic'; export async function POST(req: Request) { const stream = createUIMessageStream({ execute: async ({ writer }) => { const coordinator = new Agent({ model: anthropic('cl...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
59220ae8b098b6c6c37483af241d5d2bf4e08d20116739c5a3c364b2d58e7291
4
896
{ writer }) => { await Sentry.startSpan({ op: 'training.sft', name: 'sft.400iter' }, async (span) => { const child = spawn( 'mlx_lm.lora', ['--model', 'unsloth/gemma-4-E4B-it-UD-MLX-4bit', '--train', '--iters', '400', /* ... */], { env: { ...process.env, PYTHONUNBUFFERED: '1'...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
e7058f8693c7f9f2a281b9cb8455374bce30ac6d8317356c70c1d2ba8f336730
5
896
real-time feel and breaks the loss chart animation. Always `readline`. - **Coordinator doing domain work.** PRD §10.2 rule #1: coordinator ONLY orchestrates. If the coordinator itself produces tool schemas / QA items / trajectories, delete that code — spawn a worker. - **Trusting `vercelAIIntegration()` alone for tool-...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
360d56fc47f4932b40a266e6804254327926634f4f523dc97f972e6e73954c77
6
896
machine either resets or mis-attributes parts. **Why it happens:** AI SDK v6 beta defaults emit framing per-stream. **How to avoid:** Always pass `{ sendStart: false, sendFinish: false }` to `writer.merge`. Write an integration test in plan 01 that launches 2 workers and asserts exactly one `start` is observed. **Warni...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
d801e552ab0927c418a7f10ab59668919f9ce6db225cc3a59052a37961d513e6
7
896
cascade. **How to avoid:** Add a token-budget tracker module: running sum of `usage.totalTokens` over sliding 60s window; gate below 900K TPM. When saturated, fall back to Gemini 2.5 Pro (4M TPM). **Warning signs:** First worker completes fine; 3rd-onwards get `429 rate_limit_error` with `retry-after` headers. ## Code...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
7b1b41669c65d2b667ac1b608e2f67333394a81a99552baf5be0afb28e36a5e9
8
896
--------| | ORC-01 | `/api/pipeline` merges N parallel workers into one SSE via `createUIMessageStream` + `writer.merge` | Pattern 1 above; `{sendStart:false, sendFinish:false}` is the key flag. | | ORC-02 | Coordinator/Worker harness; `spawnWorker` tool; coordinator never works; workers return via `task-notification` ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
80d32addf62e2688c8822cbcf088f6a08214a8ea574dd02464b78a2874d1204e
9
896
>` handles <10 Hz additions without custom throttling | Pattern / Pitfall 5 | LOW — 5-step cadence is ~0.5 Hz, well below the stutter threshold. | ## Open Questions 1. **Which `Agent` export name is live in `ai@^6.0.168`?** - What we know: PRD §13.2 writes "`ToolLoopAgent`"; Phase 1's interfaces file writes "`Expe...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
51e326cef9f17752d7d0adf6e88cf2dce5e4364d47743c4ca10ded396f764138
10
896
DSN | `Sentry.init` + span dashboard | ✓ (Phase 1 scaffold `.env.example`) | — | If DSN unset, Sentry init is a no-op; spans are built but not sent. Acceptable for local dev. | **Missing dependencies with no fallback:** none — every Phase-2 dep is a Phase-1 deliverable. **Missing dependencies with fallback:** Anthrop...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
63876441f94896ab35291645823c7a5c7292a60b826057753fef462d42b6d527
11
896
input into `spawn(cmd, args)`. | | SSE stream leak of provider API errors | Information Disclosure | Truncate + redact error payloads (phase 1 precedent). | | Long-lived subprocess survives after route abort → DoS / resource leak | DoS | Wire `req.signal.addEventListener('abort', () => child.kill('SIGTERM'))` on every ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/02-orchestrator-harness/02-RESEARCH.md
Markdown
93c094b0d907f8a128c7a0a5d22d4f6f2c51f34211c63af8b8869046ed36a30e
12
708
--- phase: 03-discovery-tool-design plan: 01 type: execute wave: 1 depends_on: [] files_modified: - lib/discovery/types.ts - lib/discovery/corpus.ts - lib/discovery/__fixtures__/llms-mini.txt - lib/discovery/corpus.test.ts - vitest.config.ts - package.json - data/corpus.json autonomous: true requirements:...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-corpus-fetch-chunk-PLAN.md
Markdown
666587eae8f245d679375463317e495fa1c9338c9a45b40e7242b4b2efa0c29d
0
896
.ts export interface Chunk { id: string; // e.g. "llms.txt#0042" source: 'llms' | 'cli' | 'guides'; text: string; // raw chunk text tokenCount: number; // measured by gpt-tokenizer ordinal: number; // 0-based index within source } export interface CORPUS { chunks: Chunk...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-corpus-fetch-chunk-PLAN.md
Markdown
028bc7b4308718f582912354a9f06861c5021769c189be3ccbb2812b3d340c55
1
896
^3.2.0"` (or latest 3.x) - `"@types/node": "^20"` — confirm present; add if missing. Add to `scripts`: - `"test": "vitest run"` - `"test:watch": "vitest"` 2. Create `vitest.config.ts` at repo root (only if not present from Phase 1): ```ts import { defineConfig } from 'vite...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-corpus-fetch-chunk-PLAN.md
Markdown
d5bf8dd6bb2268762793a486ddc1c18c36564ffc8848bc7e00758b0b58fe0ce5
2
896
Chunk + CORPUS) </read_first> <action> 1. Write `lib/discovery/__fixtures__/llms-mini.txt` — a ~2 KB plaintext fixture mimicking the shape of `llms.txt`. Content: 6–10 short Supabase doc-style paragraphs separated by blank lines, covering topics like "Row Level Security", "Realtime Channels", "Auth with magic l...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-corpus-fetch-chunk-PLAN.md
Markdown
4a2b413993e86f9a9437ca52b2a1d5f8f5e0bc2e82c970f8387622dc6c6203f8
3
896
.trim()).filter(Boolean); const chunks: Chunk[] = []; let buf = ''; let bufTokens = 0; let ordinal = 0; const pushChunk = (windowText: string) => { const tokenCount = encode(windowText).length; chunks.push({ id: `${source}.txt#${String(ordi...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-corpus-fetch-chunk-PLAN.md
Markdown
43a033d5fb7671b12bed6de65df58ca010809c194f1a6e37d410e23b39b349af
4
896
expect(corpus.sourceBytes).toBeGreaterThan(0); }); }); ``` 4. After tests pass, run `fetchCorpus({ refresh: true })` once against LIVE Supabase URLs to populate `data/corpus.json`. Use a one-shot script OR `node --experimental-strip-types -e "import('./lib/discovery/corpus.ts').then(m => m.f...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-corpus-fetch-chunk-PLAN.md
Markdown
c53d2b721becc714d588b6491d38e0a6dd87a52d3da203123f1326356a309f79
5
896
data/corpus.json` cache is always checked first (Pitfall 5). Fixture-backed fallback if cold-start and live fails. | | T-03-03 | Information Disclosure | Fetch secrets leak via error body | mitigate | `fetch` error throws with URL only; no auth headers sent. | </threat_model> <verification> - `npm install` succeeds. -...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-corpus-fetch-chunk-PLAN.md
Markdown
06c49b3721624f0f75b1e8c91a3af3b2ed296d222ecee2a80ecbccfd9eb2254e
6
305
--- phase: 03-discovery-tool-design plan: 01 subsystem: discovery-corpus tags: [corpus, chunking, types, vitest, SWR-01] dependency_graph: requires: [] provides: [lib/discovery/types.ts, lib/discovery/corpus.ts, data/corpus.json] affects: [03-02, 03-03, 03-04, 03-05] tech_stack: added: [gpt-tokenizer] pattern...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-SUMMARY.md
Markdown
bcf5d771f5418d38d01aa0df6d584c91c84d5778c5035526262937e79c8cfe78
0
896
data/corpus.json commit** - **Found during:** Task 2 - **Issue:** `.gitignore` had `data/` which ignored the entire directory; git negation patterns cannot override directory-level ignores - **Fix:** Changed `data/` to `data/*` + `!data/corpus.json` so the corpus cache is trackable while other data artifacts remain ign...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-01-SUMMARY.md
Markdown
27df405a0c02b80c3b47ece3c1544329df2a1ad47dc7062ec6b50931054feb90
1
221
--- phase: 03-discovery-tool-design plan: 02 subsystem: discovery-validation tags: [validation, sandbox, security, worker-threads, vm, ajv, acorn, fuzz, trajectory] dependency_graph: requires: [03-01] provides: [validateTool, validateSchema, validateParse, runInSandbox, validateFuzz, validateTrajectories] affects...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-SUMMARY.md
Markdown
c5f54fbbafb647c499fd3ce960ef3163b1f97b28a023fd50d76c644f2fce58f5
0
896
2s timeout). The error surfaces through the Worker `error` event with a message containing "terminated" or via `exit` event with non-zero code. ## Per-Gate Timing Observations From the integration test run against all 12 fixtures: | Gate | Candidate | Time | |------|-----------|------| | schema | schemaBad | <1ms | ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-SUMMARY.md
Markdown
eaabee4671030b638495b7a84aa60805387afe593eda9b00fe492f8c966ca4f3
1
703
--- phase: 03-discovery-tool-design plan: 02 type: execute wave: 2 depends_on: [01] files_modified: - lib/discovery/validate/index.ts - lib/discovery/validate/schema.ts - lib/discovery/validate/parse.ts - lib/discovery/validate/sandbox.ts - lib/discovery/validate/sandbox.worker.mjs - lib/discovery/validate/...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
20eeba7dc34ea375b1c3a6ae7577d3c13d282d1b11c79a73556365dac497c366
0
896
- from: "lib/discovery/validate/sandbox.ts" to: "lib/discovery/validate/sandbox.worker.mjs" via: "new Worker(path.resolve(...), { resourceLimits: { maxOldGenerationSizeMb: 64, ... } })" pattern: "maxOldGenerationSizeMb:\\s*64" - from: "lib/discovery/validate/index.ts" to: "validateSchema, va...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
0047d38a3bccd7f2002f8d878fd3f438fc481ce2c10d626d67fd26a9321fe3b5
1
896
a', '0', 'x'.repeat(1000), '🦄🚀', 'null', 'undefined', 'true', ' ', '\n']` - number → `[0, 1, -1, 1.5, -1.5, 1e308, -1e308, Number.MAX_SAFE_INTEGER, 0.1 + 0.2, Number.EPSILON]` - integer → `[0, 1, -1, 100, -100, 2**31 - 1, -(2**31), 42, 7, 13]` - boolean → alternate `[true, false, true, false, ...]` - array → `[[], [...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
1a2d308aa4aee5bef913bd7c3026d57cd36a1bff9c071a291687713eb87a0913
2
896
> </context> <tasks> <task type="auto"> <name>Task 1: Gates 1 + 2 (schema, parse) — ajv + acorn with AST deny-list</name> <files> lib/discovery/validate/schema.ts, lib/discovery/validate/parse.ts, lib/discovery/validate/schema.test.ts, lib/discovery/validate/parse.test.ts, lib/discovery/__fixtures__/mock-cand...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
7c927d3221884a206390b133981bd22006d49132e3afe2269e7a921f71cf9ef2
3
896
as const; export function validateParse(jsBody: string): ValidationResult { let ast: acorn.Node; try { ast = acorn.parse(jsBody, { ecmaVersion: 2022, sourceType: 'script' }); } catch (err) { return { pass: false, failedGate: 'parse', reason: `acorn: ${(err as Err...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
616abd460d065cafd18ee92f67967bc35ac8ee4bd073d258faf585e5a26a6068
4
896
.meta.jsBody); expect(r.pass).toBe(false); expect(r.reason).toMatch(/fetch/); }); it('rejects Date.now (nondeterministicDate)', () => { const bad = candidates.find((c: any) => c.spec.function.name === 'nondeterministicDate')!; expect(validateParse(bad.spec.m...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
c58b9b4c69d9044474e0857a1f181bd863105fe3a2bbf3945da58360709d0d8e
5
896
name from the body (convention: `function <name>(args) { ... }`) const nameMatch = /function\s+([A-Za-z_$][\w$]*)\s*\(/.exec(jsBody); if (!nameMatch) { parentPort.postMessage({ ok: false, error: 'sandbox: no named function in body' }); process.exit(0); } const f...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
c9fb8b6d4d6eaeaa94919612fe342440770926e08a5fa7d6d596f65398682119
6
896
t0 = Date.now(); const r = await runInSandbox('function loop(_) { while(true){} }', {}, 2000); const dt = Date.now() - t0; expect(r.ok).toBe(false); expect(r.error).toMatch(/timeout|exit/); expect(dt).toBeLessThan(3000); }, 5000); it('rejects non-...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
67768c3993221226697d94460470c8d000c3f1e7ad5f9113128a07043cda7bf7
7
896
/phases/03-discovery-tool-design/03-RESEARCH.md (Pattern 3 fuzz, Pitfall 2 ≥8 tolerance, Pitfall 3 trajectory non-determinism) - /Users/julianschmidt/Documents/GitHub/codex-hackathon/PRD_SPEC.md §9.3 - /Users/julianschmidt/Documents/GitHub/codex-hackathon/lib/discovery/validate/sandbox.ts (Task 2 output) - ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
8db877bfba48f3d0ccc2bf4333d7b42cbac7395e8ef0f2a90f85e70916ec943b
8
896
." Enforce both conditions exactly. 2. `lib/discovery/validate/trajectory.ts`: ```ts import equal from 'fast-deep-equal'; import { runInSandbox } from './sandbox.js'; import type { ValidationResult } from '../types.js'; export interface Trajectory { userPrompt: string; ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
a6d2946202f32bd2c0b40697c79e4fe14a964ddaee181ddee24259ec70e68fe5
9
896
> { it('accepts a robust body', async () => { const body = 'function f(args) { return { ok: String(args.x ?? "") }; }'; const r = await validateFuzz(body, { type: 'object', properties: { x: { type: 'string' } } }); expect(r.pass).toBe(true); }, 15000); it('rej...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
3ad74deca17ec29f5ae3c844ef4bc7fdaf9bdb94718148c5023e3f9775f8fdf7
10
896
-types -e "..."` or add an optional integration test in `lib/discovery/validate/index.test.ts`). For each candidate, assert `result.failedGate === candidate.expectedFailedGate` (null → pass:true). Record any divergence in the SUMMARY. </action> <verify> <automated>cd /Users/julianschmidt/Documents/GitHub/codex-...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
a5a9ab3e2aaa37078f68289dc95d92ff9cff6e7fb1a4784187c200d1ddea705d
11
896
member-access deny-list rejects both; Gate 5 (`fast-deep-equal` strict, no epsilon) would catch any survivor. | </threat_model> <verification> - `npx tsc --noEmit` exits 0. - `npx vitest run lib/discovery/validate` all tests green. - `mock-candidates.json` has 12 entries. - Sandbox infinite-loop test completes in <3 s...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-02-validator-gates-PLAN.md
Markdown
d4203782aecd077ab78b9a5ef5944b92e77ec11e0ceafbe9ae37d454323c2d1a
12
269
--- phase: 03-discovery-tool-design plan: 03 subsystem: discovery tags: [ai-sdk, generateObject, zod, worker, prompt-engineering, mocked-test] dependency_graph: requires: [03-01] provides: [toolDesignWorker, DYNAMIC_TOOL_SPEC_SCHEMA, buildToolDesignPrompt, BANNED_LIST] affects: [03-04, 03-05] tech_stack: added:...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-SUMMARY.md
Markdown
3da91ef897007ca11a16bc77282e506db1446f05cd0257eed4fbfbd7fcfcada4
0
896
Found during:** Task 2 - **Issue:** AI SDK v6's `generateObject` calls `logWarnings` which reads `.length` on the warnings array. `MockLanguageModelV3` does not include it by default. - **Fix:** Added `warnings: []` to the `doGenerate` result object. - **Files modified:** lib/discovery/worker.test.ts - **Commit:** baab...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-SUMMARY.md
Markdown
4eedf0c76d87609ea768961c9b55b1bd2f1720b9445a03cf29cd868c1132d824
1
228
--- phase: 03-discovery-tool-design plan: 03 type: execute wave: 2 depends_on: [01] files_modified: - lib/discovery/worker.ts - lib/discovery/prompts.ts - lib/discovery/worker.test.ts autonomous: true requirements: [SWR-02] must_haves: truths: - "`toolDesignWorker(input)` takes `{ workerId, slice: Chunk[],...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-tool-design-worker-PLAN.md
Markdown
4b9e0032169c9ee3cd7dc7cca3c8139c81a263dc11d2eb12cce718081df6e393
0
896
`` Model alias: `anthropic('claude-opus-4-5')` primary, fallback chain `claude-opus-4-7` → `claude-opus-4-latest` → `google('gemini-3.1-flash-lite')` on 429/404 (PITFALLS P22). The worker takes `model` as an optional parameter so Wave 3 can swap at runtime. `ToolDesignWorkerInput` shape: ```ts interface ToolDesignWor...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-tool-design-worker-PLAN.md
Markdown
3f141d3119190750c327ad737f9eab043e5e91edc872cd145ec8cca4250bdb3b
1
896
-01-next-scaffold-sentry-providers-PLAN.md (AI SDK v6 import + experimental_telemetry pattern) </read_first> <action> 1. Write `lib/discovery/prompts.ts`: ```ts import type { Chunk } from './types.js'; export const BANNED_LIST = [ 'fetch','require','import','process','globalThis',...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-tool-design-worker-PLAN.md
Markdown
20e7759bf50248617654c200fba45ba3c11e9337e5d85b84eeb1e8d6099b15fe
2
896
-z0-9_]*$/), description: z.string().min(10).max(400), parameters: z.record(z.string(), z.any()), }), meta: z.object({ jsBody: z.string().min(20).max(4000), requiresNetwork: z.boolean(), trajectories: z.array(Z_TRAJECTORY).min(3).max(6), ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-tool-design-worker-PLAN.md
Markdown
21ab9eb824e3ee52e7e1bed669e748500514c008f680619ce0a2b3353d844904
3
896
. Write `lib/discovery/worker.test.ts` using a custom `LanguageModel` stub (AI SDK v6 exposes `MockLanguageModelV2` in test utilities; if not, hand-roll a minimal `LanguageModel`-conforming stub that returns a hardcoded object for `doGenerate`): ```ts import { describe, it, expect } from 'vitest'; ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-tool-design-worker-PLAN.md
Markdown
f21726ba4a3a34f10d197d17b6649e89ca8b0d420a7a9568effc5605935fe392
4
896
/); expect(out[0].meta.trajectories.length).toBeGreaterThanOrEqual(3); }); it('overwrites sourceWorker with the passed workerId', async () => { const out = await toolDesignWorker({ workerId: 'tool-design-7', slice: fakeCorpus, model: makeMoc...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-tool-design-worker-PLAN.md
Markdown
a40d5480724ac847b30e447a15ac698ff8d65b867000fc6eb40a55b2a6c485e6
5
896
T-03-14 | Information Disclosure | Provider error leaks API key via error body | mitigate | No custom error surfacing here; AI SDK v6 errors are already redacted. | | T-03-15 | DoS | Worker infinite-loops on huge slice | mitigate | `generateObject` default timeout; Wave 3 wraps call in `AbortSignal.timeout(90_000)` per...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-03-tool-design-worker-PLAN.md
Markdown
2c85d9f4e2cc29f7b98c26e1565d3abbfd0c058539e1547939a150b3be2ad82f
6
276
--- phase: 03-discovery-tool-design plan: 04 subsystem: discovery-pipeline tags: [swarm, pipeline, manifest, kill-point, SWR-02, SWR-08] dependency_graph: requires: [03-01, 03-02, 03-03, 03-05] provides: [data/adapter-tools.json, /api/discover endpoint, KillPointError, designToolsSwarm, runDiscoveryPipeline] affe...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-SUMMARY.md
Markdown
1a9c55a08337f23fc5705e0cd1459ed3682a6e297e1ac7b1e7e98c6f08a4d899
0
896
**data/adapter-tools.json**: Committed with fallback source (no API key available in execution environment; demo-time swarm will overwrite with real results) ## Manifest Details - **Source**: fallback (API key not available; swarm path proven by integration test) - **Count**: 8 tools - **Raw candidates (test run)**: ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-SUMMARY.md
Markdown
64bb37a60443ba296af91195b57ff1c8ea3a1b29d36652301f4f927ea77425cd
1
896
conflicts with `capMax=12`. 2. Reused Phase 2's `buildStatusPart`/`buildNotificationPart` typed helpers for SSE event shapes instead of raw objects, ensuring type safety with the writer API. 3. Used `createUIMessageStreamResponse({ stream })` pattern (matching Phase 2's `/api/pipeline`) instead of `stream.toResponse()`...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-SUMMARY.md
Markdown
75e48bf58788cf9552ed221fe31dc356f4fa35e6216e706e9249e63fac4d4378
2
133
--- phase: 03-discovery-tool-design plan: 04 type: execute wave: 3 depends_on: [01, 02, 03, 05] files_modified: - lib/discovery/swarm.ts - lib/discovery/manifest.ts - lib/discovery/pipeline.ts - lib/discovery/dedupe.ts - lib/discovery/pipeline.test.ts - app/api/discover/route.ts - data/adapter-tools.json ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
81e800954687f67fa9271544934d6c2572c3e6ce617814988382b3d937daa717
0
896
"copyFallback|fallback\\.json" - from: "app/api/discover/route.ts" to: "lib/discovery/pipeline" via: "createUIMessageStream + writer.merge per worker and gate" pattern: "createUIMessageStream" --- <objective> Wire the complete discovery pipeline: 4-worker swarm → dedupe → 5-gate validation → mani...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
132660f1b86f8702f76aabad055cbfc1e5c4bd188959440d69a0d387b0068b9a
1
896
"trajectory": 4 } } } ``` Dedupe rule (Pitfall 7): normalize `name.toLowerCase().replace(/[_-]/g, '')`; keep first occurrence (Promise.all preserves input ordering across workers). SWR-08 kill-point decision tree: - survivors.length ≥ 8 → write manifest `source: 'swarm'`, tools = survivors.slice(0, 12). - 4 ≤ survi...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
9deddebb44f50f5f273249c720e36478059c1308456a910379c017d8d3f8ce3c
2
896
/discovery/manifest.ts`: ```ts import { writeFile, copyFile, mkdir } from 'node:fs/promises'; import path from 'node:path'; import type { DynamicToolSpec, GateName } from './types.js'; import { DYNAMIC_TOOL_SPEC_SCHEMA } from './worker.js'; export const MANIFEST_PATH = path.re...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
691a0c8015b9b83cd251d8624fdf6106f02f3450058f48760f3b050287b9557c
3
896
'./swarm.js'; import { validateTool } from './validate/index.js'; import { dedupeByNormalizedName } from './dedupe.js'; import { writeManifest, copyFallback, type ManifestMeta } from './manifest.js'; export class KillPointError extends Error { constructor(public code: string, publi...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
e4e5d53185847566fe84d0ad1d52ca9ea8b88707452f4f40db46e7fb98602177
4
896
', source: 'swarm', count: finalTools.length }); return { tools: finalTools, source: 'swarm' }; } ``` </action> <verify> <automated>cd /Users/julianschmidt/Documents/GitHub/codex-hackathon && npx tsc --noEmit && grep -E "export async function designToolsSwarm" lib/discovery/swarm.ts && gr...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
84282fff48efbe1b8351daa3e8dc9b199a6055a46f8de771bab0dfb326306afb
5
896
async ({ writer }) => { await Sentry.startSpan({ op: 'ai.agent', name: 'discovery.pipeline' }, async () => { writer.write({ type: 'data-agent-status', id: 'coordinator', data: { role: 'coordinator', status: 'running', step: 'fetch-corpus' },...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
77cd2bd800b814c214789f90b833ba1d7ac0cd68abc5d43c65909a810a687f91
6
896
'err', summary: msg.slice(0, 400) }, transient: false, }); } } }); }, }); return stream.toResponse(); } ``` 2. Write `lib/discovery/pipeline.test.ts` — integration test using the 12-spec ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
94065ff39e55a13f57de21aaa2c940ed369cd9206a85253cebf9ba4bfe98db05
7
896
needed for the pipeline test; prefer adjusting the test assertions. 4. After tests pass, run a REAL end-to-end execution to populate the committed `data/adapter-tools.json`: - Start the Next.js dev server (`next build && next start` per PITFALLS P16 — avoid `next dev` for multi-minute runs, though this one ...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
e909dcb6c5673847de763b9e1b721e5aa426880b026ee4562da3d60777f7b83b
8
896
done>SWR-02 + SWR-08 land end-to-end. `/api/discover` streams live worker + gate progress via the Phase 2 harness; `data/adapter-tools.json` is on disk for Phase 4; kill-point fallback is proven to work by the integration test.</done> </task> </tasks> <threat_model> ## Trust Boundaries | Boundary | Description | |--...
codex-hackathon
.planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-04-swarm-pipeline-manifest-PLAN.md
Markdown
e38a0ea0ad7f3e96a0be1a03d66a2fea066f99bb983faabf9d10f5c3450f891c
9
759