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: 03-discovery-tool-design
plan: 05
type: execute
wave: 2
depends_on: [02]
files_modified:
- lib/tools/hand-written-supabase.ts
- lib/tools/hand-written-supabase.test.ts
- data/adapter-tools.fallback.json
autonomous: true
requirements: [SWR-08]
must_haves:
truths:
- "`lib/tools/hand-written-supaba... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-fallback-hand-written-tools-PLAN.md | Markdown | 5d5c873aa899410dfd9614e5f5ff2e4a50bf3b768044b3f8341234cd156b7066 | 0 | 896 |
) author a minimal local copy and reconcile in Wave 3 (Plan 03-04 integration step).
Expected imports:
- `import type { DynamicToolSpec } from '../discovery/types.js'` — shape ships in 03-01.
- `import { validateTool } from '../discovery/validate/index.js'` — ships in 03-02; test depends on this.
Hand-written tool sl... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-fallback-hand-written-tools-PLAN.md | Markdown | 5f8f9513e79bf1ceda72e11f469f277d156b80dbfa3a01a0c504c708dab68f6a | 1 | 896 |
tools/hand-written-supabase.ts` exporting a single `HAND_WRITTEN_SUPABASE_TOOLS: DynamicToolSpec[]` array of exactly 8 entries. Each entry follows the interfaces list above. Example entry shape (for tool 1):
```ts
import type { DynamicToolSpec } from '../discovery/types.js';
export const HAND_WRI... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-fallback-hand-written-tools-PLAN.md | Markdown | cffe2664e47cf1f77392d77659200ba620ff887716a76a6e1c5849d06768120b | 2 | 896 |
`ajv` 2020 must compile it).
- `sourceWorker: 'hand-written'`, `sourceChunks: []`.
For the other 7 tools (2–8), implement the bodies strictly per their interfaces description. Keep each body short (<30 lines), pure compute, and deterministic.
For `supabase_jwt_claims_extractor`: decode the MIDDLE... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-fallback-hand-written-tools-PLAN.md | Markdown | 105667a9e74e82f6667f1740472287e2398047fe32913d587103d7b4b47eeecb | 3 | 896 |
tools) if (t.meta.trajectories.length !== 3) process.exit(3);"</automated>
</verify>
<acceptance_criteria>
- `lib/tools/hand-written-supabase.ts` exports `HAND_WRITTEN_SUPABASE_TOOLS` with exactly 8 entries.
- Every entry has `requiresNetwork: false`.
- Every entry has exactly 3 trajectories.
- `gre... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-fallback-hand-written-tools-PLAN.md | Markdown | edf4b578b2ceea02cfb558048f453b819730e6136d1add2e9460eebe935fa350 | 4 | 896 |
Math.random` → rewrite body to accept timestamp as an argument.
- Gate 5 `trajectory` mismatch → the stated `result` in the trajectory does not equal the body's actual return; re-run the body in a REPL and paste the exact return.
- Gate 4 `fuzz` rejected because body throws on empty/weird inputs → add gua... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-fallback-hand-written-tools-PLAN.md | Markdown | 95ccd8610c1b5e062b2b5520787602e14b9f6683b9eb82b6c8a57917e4a0fc36 | 5 | 896 |
4 to consume.
</success_criteria>
<output>
After completion, create `.planning/phases/03-discovery-tool-design/03-05-SUMMARY.md` noting:
- Names of the 8 tools (so narration has a script if we end up on Tier-3).
- Any tool that required rewriting during Task 2 to pass validation, and why.
- Approximate wall-time for t... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-fallback-hand-written-tools-PLAN.md | Markdown | 727c849c9562db3ab12cd0403457bf9da87ddf5ae2865a9743740d93d199ec6d | 6 | 111 |
---
phase: 03-discovery-tool-design
plan: 05
subsystem: tools
tags: [fallback, supabase, hand-written, kill-point, SWR-08]
dependency_graph:
requires: [03-01, 03-02]
provides: [SWR-08-fallback, adapter-tools.fallback.json]
affects: [03-04]
tech_stack:
added: []
patterns: [vm-sandbox, base64url-manual-decode, ... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-SUMMARY.md | Markdown | 4be4ac15910c3dc174cb7327d917b9b8bf24c579ab8af540e6f9e39f4bb9d7b9 | 0 | 896 |
adapter-tools.fallback.json` to `.gitignore` exceptions
- **Files modified:** `.gitignore`
- **Commit:** `eb170e3`
### Design Notes
- **JWT tool (supabase_jwt_claims_extractor):** Required a hand-rolled base64url decoder because `vm.createContext({})` provides zero Node globals (no `Buffer`, no `atob`). The 20-line i... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-05-SUMMARY.md | Markdown | 81b4887108661af355572c13bbbe3df34a54d5ad9c000fb0e96b84f551142e68 | 1 | 348 |
# Phase 3: Discovery + Tool Design — Research
**Researched:** 2026-04-18
**Domain:** Corpus ingestion + parallel agent swarm + multi-gate tool validation + manifest emission
**Confidence:** HIGH (scope is fully constrained by PRD §9 + §10.3 + §19.3; no open architectural questions)
## Summary
Phase 3 takes the coord... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | 6bbe3a8b82a2ae294338599a83db8b12b95dbb3d43ba9168019af2e13c459918 | 0 | 896 |
→ `fs.writeFile` | — | Single atomic write at end of phase |
## Standard Stack
### Core
| Library | Version | Purpose | Why Standard |
|---------|---------|---------|--------------|
| AI SDK v6 | `^6.x` (locked Phase 1) | `generateObject` for tool-design workers with Zod schema | Project-locked; already wired in Phas... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | a5c26eeec55b72c690fdf3cbbb99d4a25237d9d195c91972e97f830e306c3d09 | 1 | 896 |
─────┼──────────┬──────────┐ (swarm fan-out, Promise.all)
▼ ▼ ▼ ▼
Worker 1 Worker 2 Worker 3 Worker 4 (generateObject; slice = chunks[i::4])
DynamicToolSpec[] … … … (each ≥3 example trajectories)
│ │ │... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | b82dbf796fa51df4aebca73a96c38700a63fa3af14ceab82908da2d64a8ad3c3 | 2 | 896 |
.resolve('lib/discovery/validate/sandbox.worker.mjs'), {
workerData: { jsBody, args },
resourceLimits: { maxOldGenerationSizeMb: 64, maxYoungGenerationSizeMb: 16 },
});
const timer = setTimeout(() => {
worker.terminate();
resolve({ ok: false, error: 'timeout' });
}, timeoutMs);
w... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | 7b66f3d5599d434c602c1277616bf1a38217814e2dafc98e4273d5a61e3b6f3c | 3 | 896 |
to avoid wasting sandbox spins on clones.
- **Shipping a tool whose `jsBody` calls `fetch`, `require`, or `process`:** The sandbox won't have those, but gate 4 might accidentally pass if the body uses them inside an unused branch. Static-check the AST from gate 2 for forbidden identifiers: `fetch`, `require`, `import`,... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | c56115dfd1c5a0613e3216c632b5506797be62f244243f6b447d7abd94aa7323 | 4 | 896 |
happens:** Non-determinism in tool implementations.
**How to avoid:** AST-scan gate 2 for `Date.`, `Math.random`, `crypto`, `performance`. Reject outright. Additionally: numeric comparison in SWR-07 should use `fast-deep-equal` which is strict — no epsilon tolerance. This is correct behavior — reject drift.
**Warning s... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | 48b61c26efbce059025fa0f6ae0cc2db08c4d7917c3cbc02022ecdee05a24ebf | 5 | 896 |
/discover` route | ✓ (Phase 1 locked) | 15.x | — |
| AI SDK v6 + provider keys | `generateObject` in workers | ✓ (Phase 1–2 smoke) | 6.x | Narrate with pre-generated fixture if keys fail |
| `supabase.com/llms*.txt` | Corpus source (SWR-01) | Check live at phase start | — | Commit `data/corpus.json` ahead of time |
| `... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | fc70a03a5434a7a7aa814cc3f8bcf925c9d4df6a4aad2b9aaefb4e5d5857ba42 | 6 | 896 |
tokens from fixture `llms.txt` | unit | `npx vitest run lib/discovery/corpus.test.ts` | Wave 0 |
| SWR-02 | `toolDesignWorker(slice)` returns `DynamicToolSpec[]` with ≥3 trajectories each (mocked LLM) | unit | `npx vitest run lib/discovery/worker.test.ts` | Wave 0 |
| SWR-03 | `validateSchema(badSchema)` returns `{pass... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | 9e040829b2b7c6ee2a5a79fa7a1829ee2313cd1ed0e3a52ae37d15a0825ec744 | 7 | 896 |
exhaustion via large allocation | Denial of Service | `resourceLimits.maxOldGenerationSizeMb: 64` |
| Prompt injection in `llms.txt` steering worker to emit `fetch('evil.com')` body | Tampering | Gate 2 AST deny-list blocks `fetch`, `require`, `import`, `process`, `globalThis`, `eval`, `Function` |
| Tool-name collisio... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | 8a3ea82f7e7b53a7a8374093f8b5f756c499040b8eaea618a7528377ad9886c2 | 8 | 896 |
`AbortController` timeout only — note in PLAN |
| A5 | Phase 4 can consume `adapter-tools.json` in OpenAI tool-schema shape with `meta.jsBody` sibling | Phase 2 Integration / Pitfall 6 | Phase 4 must write re-shape code — adds ~10 min |
| A6 | ≥8 unique tools is achievable from the Supabase corpus with 4 workers | SWR-... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | 16f58bbdbf287a17325d2bf4a5aace2a2d071c614be1764acca4e4d94ca8246f | 9 | 896 |
`PRD_SPEC.md` §9 (Tool Design Pipeline), §10.3 (Corpus), §14 H4 (Phase 3 hour-band), §19.3 (manifest shape), §19.4 (hard constraints) — authoritative
- `.planning/REQUIREMENTS.md` SWR-01..SWR-08 — requirement IDs and kill-point status
- `.planning/ROADMAP.md` Phase 3 section — success criteria and plan-count guidance
-... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-RESEARCH.md | Markdown | 1c33e4d4f758244e25f6e43b0e3120dbd9257e65b5dd54fc8562c12f7c5292b1 | 10 | 330 |
---
phase: 03-discovery-tool-design
verified: 2026-04-18T14:40:00Z
status: human_needed
score: 9/9
overrides_applied: 0
human_verification:
- test: "Trigger live 4-worker swarm via /api/discover with valid ANTHROPIC_API_KEY"
expected: "Swarm produces >=8 validated tools with source=swarm in adapter-tools.json; SS... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-VERIFICATION.md | Markdown | 21d4b9597bb779bab56e34767d650ec5c5b34f94043f95fc489ba098b697e384 | 0 | 896 |
tools.length=8, all requiresNetwork=false, all with 3 trajectories. |
| 8 | /api/discover route streams progress via createUIMessageStream | VERIFIED | `app/api/discover/route.ts` exists (141 lines), uses `runtime='nodejs'`, `dynamic='force-dynamic'`, `createUIMessageStream`, `buildStatusPart`/`buildNotificationPart` f... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-VERIFICATION.md | Markdown | 883da07847064a90aa0cd16724afe58201f3e63fad91054a9f8ebaaad945e9ec | 1 | 896 |
| VERIFIED | 49 lines, Promise.all, strided slicing, Sentry.startSpan, 90s abort |
| `lib/discovery/dedupe.ts` | dedupeByNormalizedName | VERIFIED | 17 lines, normalize + Set-based dedup |
| `lib/discovery/manifest.ts` | writeManifest + copyFallback | VERIFIED | 44 lines, per-tool Zod validation at write time, atomic w... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-VERIFICATION.md | Markdown | 983cfd8cd9ff8e175053d87248b97df1aee30926e5b8f4ffc46ce9c001359f55 | 2 | 896 |
| `pipeline.ts` | `createUIMessageStream + runDiscoveryPipeline + KillPointError` | WIRED | All imports verified, onEvent callbacks stream progress |
| `hand-written-supabase.ts` | `validate/index.ts` | `validateTool(tool) green for all 8` | WIRED | Test confirms all 8 pass (hand-written-supabase.test.ts line 27) |
##... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-VERIFICATION.md | Markdown | 80a206f82c651f7c408b1b5917e9f62840bbe705503a182cde50ede54c4f90a2 | 3 | 896 |
2550 chunks, 4.6 MB) |
| SWR-02 | 03-03, 03-04 | 4 parallel workers emit DynamicToolSpec with >= 3 trajectories each | SATISFIED | swarm.ts fans 4 workers via Promise.all; Zod schema enforces min(3) trajectories; mocked test and integration test verify |
| SWR-03 | 03-02 | Schema well-formedness gate passes | SATISFIED... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-VERIFICATION.md | Markdown | 03b6431475110c59bfcee69c13e8a911e1a98eb4abfe2f4a83cd440f397ae458 | 4 | 896 |
response quality, timeout behavior) can only be verified with live keys.
### 2. SSE Stream Rendering in Agent Grid UI
**Test:** Open the demo page in a browser while `/api/discover` is running. Observe the 5x4 AgentGrid.
**Expected:** Agent cards appear for each `tool-design-{0..3}` worker showing running/ok/err stat... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/03-VERIFICATION.md | Markdown | 6ae04fae2f99f736501342ca9b933b3e56ddb2456f467848679365659442a4b7 | 5 | 363 |
# Deferred Items — Phase 3
Out-of-scope issues discovered during execution, not caused by current plans.
## Pre-existing TS error in lib/streams/trainParser.test.ts
- **File:** `lib/streams/trainParser.test.ts:3`
- **Error:** `TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtension... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/03-discovery-tool-design/deferred-items.md | Markdown | c816376f273f068db68bc133b7bc0d8f57210bc40da4ba28e1ab2894ea374b21 | 0 | 184 |
---
phase: 04-data-eval-gen
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- lib/data/types.ts
- lib/data/split.ts
- lib/data/personas.ts
- lib/data/split.test.ts
- lib/data/__fixtures__/mock-corpus.json
- lib/data/__fixtures__/mock-tools.json
autonomous: true
requirements: [DAT-09]
must_hav... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-01-doc-split-types-personas-PLAN.md | Markdown | fc702e300b5b9650a8edc52b08f196c0302dff44b776a0f35e72feb0c98c9e47 | 0 | 896 |
"Vitest covers: identical input → identical split (bit-for-bit), 70/30 ratio within ±5%, NO chunk appears in both `trainChunks` and `evalChunks` (set-disjointness assertion), `splitHash` is stable across runs, and serializing the manifest then re-loading reproduces the same partition."
artifacts:
- path: "lib/dat... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-01-doc-split-types-personas-PLAN.md | Markdown | d88af59ddf387048124ab9ff8a0154485d11acfcb43637bb23a007e9b07c440c | 1 | 896 |
`loadCached()` returning `CORPUS | null`. Chunk ids are `${source}.txt#${4-digit-ordinal}`.
- `data/adapter-tools.json` is the validated tool manifest from Phase 3. Read shape from `data/adapter-tools.json` directly when generating fixtures.
Hash split spec (PRD §11.2, DAT-09):
- Document-level granularity (`chunk.sou... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-01-doc-split-types-personas-PLAN.md | Markdown | 183ca3eefe1868f13bff1f6080a0f8a0e858a080bca6ac499064bce37aeed7d4 | 2 | 896 |
.arguments` MUST be a JSON-stringified string (matches OpenAI/mlx-lm `tools` format exactly). `TrainingExample` is `{ messages: ChatMessage[]; tools: DynamicToolSpec[] }` — DAT-08 kill-point shape.
2. `lib/data/personas.ts`:
- `PERSONAS: Persona[]` with the 8 entries from interfaces. Each `voice` is one pro... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-01-doc-split-types-personas-PLAN.md | Markdown | 131f46d6336ad9bd2f89bbbc72331e3530e554176c2b6b68e84e6eb1a300e6c0 | 3 | 896 |
data/__fixtures__/mock-corpus.json (Task 1 output — your test input)
</read_first>
<action>
1. `lib/data/split.ts`:
- `import { createHash } from 'node:crypto';`
- `export const SPLIT_MANIFEST_PATH = path.resolve('data/split.manifest.json');`
- `function chunkScore(salt: string, chunkId: st... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-01-doc-split-types-personas-PLAN.md | Markdown | 1d93fa468a15bd604137e00f2ac3eb92d89ad33f957f736fd6d0b7f15dd34eab | 4 | 896 |
>
Create `.planning/phases/04-data-eval-gen/04-01-SUMMARY.md` noting:
- Final TrainingExample shape (verbatim signature).
- Salt + trainRatio defaults chosen.
- Mock fixture chunk count + tool count.
- Any deviation from PRD §11.2 doc-level granularity (we use chunk-id stratification).
</output>
| codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-01-doc-split-types-personas-PLAN.md | Markdown | e8b22950b4299690b7578ad206a6ead591691a32bc077291b98baf6e0d6d03db | 5 | 75 |
---
phase: 04-data-eval-gen
plan: 01
subsystem: data-foundation
tags: [types, split, personas, fixtures, deterministic]
dependency_graph:
requires: [lib/discovery/types.ts, data/adapter-tools.json]
provides: [lib/data/types.ts, lib/data/split.ts, lib/data/personas.ts, lib/data/__fixtures__/mock-corpus.json, lib/dat... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-01-SUMMARY.md | Markdown | 1d12a2d1b4a635c882fa560420a83b377b841a84563cfcb7c1e9bea53b337c13 | 0 | 896 |
(','))` for Phase 5/7 verification
- `loadSplitManifest()`: reads `data/split.manifest.json` for downstream verification
- `SPLIT_MANIFEST_PATH`: resolved absolute path to manifest
### lib/data/personas.ts -- Persona Pool + Seedable PRNG
- `PERSONAS`: 8 entries (junior-dev, senior-backend, security-auditor, devops, m... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-01-SUMMARY.md | Markdown | 6a2096898985863e1be74c8298e14c306ffc48748ab40d91939c8b5c26de0ac4 | 1 | 690 |
---
phase: 04-data-eval-gen
plan: 02
type: execute
wave: 1
depends_on: []
files_modified:
- lib/data/schema-gate.ts
- lib/data/dedupe.ts
- lib/data/stratify.ts
- lib/data/schema-gate.test.ts
- lib/data/dedupe.test.ts
- lib/data/stratify.test.ts
autonomous: true
requirements: [DAT-03, DAT-06, DAT-07]
must_h... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-schema-gate-dedup-stratify-PLAN.md | Markdown | 0af3b0572f91595b7b93a81261c2e9a3799a7ef91c9654a648c552f6a5c9e350 | 0 | 896 |
adapter-tools.json"
via: "readFileSync at module init to compile AJV validators"
pattern: "adapter-tools\\.json"
- from: "lib/data/dedupe.ts"
to: "(standalone — no external imports except node:crypto)"
via: "pure functions"
pattern: "createHash"
- from: "lib/data/stratify.ts"
... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-schema-gate-dedup-stratify-PLAN.md | Markdown | 0261bf1b48c43cca5668e1c0300b596ea5f7b94fcd72fc86864124744c336005 | 1 | 896 |
), §7.2 #6 (stratification)
</read_first>
<action>
1. `lib/data/schema-gate.ts`:
```ts
import { readFileSync } from 'node:fs';
import path from 'node:path';
import Ajv, { type ValidateFunction } from 'ajv';
const MANIFEST_PATH = path.resolve('data/adapter-tools.json');
... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-schema-gate-dedup-stratify-PLAN.md | Markdown | fbde85fe5701e85aa299a2a64430fe27063cb1e20cfe73d262fa7541e6323730 | 2 | 896 |
: string[] = [];
for (const item of sigs) {
const isDup = keep.some((keptId) => {
const keptSig = sigs.find((s) => s.id === keptId)!.sig;
return estimateJaccard(item.sig, keptSig) >= threshold;
});
if (!isDup) keep.push(item.id);
}
re... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-schema-gate-dedup-stratify-PLAN.md | Markdown | 02c31160673725cc18db52cf3e12f49f4ae068332f5686a94636beb563ccad24 | 3 | 896 |
"export function minHashSignature" lib/data/dedupe.ts && grep -E "export function dedupeByMinHash" lib/data/dedupe.ts && grep -E "export function dedupeByEmbedding" lib/data/dedupe.ts && grep -E "export function checkStratification" lib/data/stratify.ts</automated>
</verify>
<done>Three quality-gate modules compile... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-schema-gate-dedup-stratify-PLAN.md | Markdown | e5cae4724ebdcd1f6708aab58e7f7bd17df58f709abb31733a8380406ec04e00 | 4 | 896 |
duplicate', () => {
const examples = [
{ id: 'a', text: 'write an rls policy for the users table in supabase with authenticated role' },
{ id: 'b', text: 'write an rls policy for the users table in supabase with authenticated role please' },
{ id: 'c', text: 'how do I s... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-schema-gate-dedup-stratify-PLAN.md | Markdown | b705bc8c814f0676e34b7c8ecc1edbbc5cc37c192178d4d956195b8917e51a07 | 5 | 896 |
({ length: 35 }, () => makeExample('toolA')),
...Array.from({ length: 10 }, () => makeExample('toolB')),
];
const r = checkStratification(examples, tools, 30);
expect(r.pass).toBe(false);
expect(r.deficit['toolB']).toBe(20);
});
});
```
<... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-schema-gate-dedup-stratify-PLAN.md | Markdown | 0773276d38c05218e1b04b4dd0f951902fe5b7bc99d4fd2740907517a1ccb3e3 | 6 | 728 |
---
phase: 04-data-eval-gen
plan: 02
subsystem: data-quality-gates
tags: [ajv, minhash, cosine, dedup, stratification, schema-validation]
dependency_graph:
requires: [data/adapter-tools.json]
provides: [validateToolCall, dedupeByMinHash, dedupeByEmbedding, checkStratification]
affects: [04-03-qa-worker, 04-04-tra... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-SUMMARY.md | Markdown | 502a2af5e0453ceac097349816d28ebf24742bfcc5f981923eb36c9abc28c2bb | 0 | 896 |
|
| Tests passed | 13 |
## Commits
| Task | Commit | Description |
|------|--------|-------------|
| 1 | 941ea4f | feat(04-02): schema-gate, dedupe, stratify modules + types |
| 2 | d7e6848 | test(04-02): 13 tests across 3 suites |
## Deviations from Plan
### Auto-added Missing Functionality
**1. [Rule 2 - Missing... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-02-SUMMARY.md | Markdown | 14dee1fab3db8301265ba215d3fd0db2f33f05d92f9d212ecd0d5dacd5d12831 | 1 | 272 |
---
phase: 04-data-eval-gen
plan: 03
type: execute
wave: 2
depends_on: [01, 02]
files_modified:
- lib/data/qa-worker.ts
- lib/data/qa-prompts.ts
- lib/data/qa-worker.test.ts
autonomous: true
requirements: [DAT-01, DAT-03]
must_haves:
truths:
- "`generateQABatch(opts: { trainChunks, tools, count?, concurren... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-data-gen-qa-worker-PLAN.md | Markdown | bf74405fef6e5c34138dfa2a1979993fc13e89449b732e58e37181abdd7e12a4 | 0 | 896 |
: "pLimit\\(15\\)|p-limit"
---
<objective>
Build the Data-Gen-QA Worker: 500 grounded Q&A examples generated by Claude Opus 4.7 using Genstruct-style prompting with persona x difficulty x chunk stratification. Schema-gate rejects re-enter the queue. This is the first of two parallel generator plans in Wave 2.
Purpose... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-data-gen-qa-worker-PLAN.md | Markdown | 531c967cd0ad083bbfb08a9efe9aeeea4f22b88293430ab846964b8686cd529e | 1 | 896 |
`.
Prompt design (Genstruct x PersonaHub):
- System prompt: persona voice + "You are generating training data for a Supabase specialist model. Ground every answer in the provided documentation. If the question involves a tool, include a tool_call with correctly-formed arguments."
- User prompt: difficulty-framed quest... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-data-gen-qa-worker-PLAN.md | Markdown | 2a99ae1f70b2a2d153eb5d2cea25d7b0f47c664b18abbc8f60c2807c9e13992b | 2 | 896 |
: `QA_RESPONSE_SCHEMA`, `buildQASystemPrompt`, `buildQAUserPrompt`.
</action>
<verify>
<automated>cd /Users/julianschmidt/Documents/GitHub/codex-hackathon && npx tsc --noEmit && grep -E "export const QA_RESPONSE_SCHEMA" lib/data/qa-prompts.ts && grep -E "export function buildQASystemPrompt" lib/data/qa-prompts.... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-data-gen-qa-worker-PLAN.md | Markdown | 362cf9fe8702ccc8acf5b4388fe5e4ceb58824e40abbacd7844d1155fab278ec | 3 | 896 |
easy' ? 1 : difficulty === 'medium' ? 2 : 3;
const startIdx = Math.floor(rng() * trainChunks.length);
const selectedChunks: Chunk[] = [];
for (let j = 0; j < numChunks; j++) {
selectedChunks.push(trainChunks[(startIdx + j) % trainChunks.length]);
}
ret... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-data-gen-qa-worker-PLAN.md | Markdown | eb6cbbf8b13a7ddc9182122026f7e9c28fb71b3432aca63742e8ada37ca6976f | 4 | 896 |
{ statusCode?: number })?.statusCode;
if (status === 429 && attempt < maxRetries) {
await new Promise(r => setTimeout(r, 2 ** attempt * 1000));
return generateOne(assignment, attempt + 1);
}
rejected++;
} finally {
done++;
... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-data-gen-qa-worker-PLAN.md | Markdown | c303e998eee09decfcf5129c06de07c3cdc717671e50f1e890ca1e7638200e16 | 5 | 896 |
`
</action>
<verify>
<automated>cd /Users/julianschmidt/Documents/GitHub/codex-hackathon && npx tsc --noEmit && npx vitest run lib/data/qa-worker.test.ts 2>&1 | tail -20 && grep -E "createAnthropic.*baseURL.*api\\.anthropic\\.com" lib/data/qa-worker.ts && grep -E "pLimit\\(" lib/data/qa-worker.ts && grep -E "va... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-data-gen-qa-worker-PLAN.md | Markdown | 656d1acc933616410c488ed761bd8b4bf25567d319b6ab18d526432ff4396978 | 6 | 724 |
---
phase: 04-data-eval-gen
plan: 03
subsystem: data-gen
tags: [data-generation, qa-worker, opus-4-7, schema-gate, training-data]
dependency_graph:
requires: [04-01, 04-02]
provides: [generateQABatch, QA_RESPONSE_SCHEMA, buildQASystemPrompt, buildQAUserPrompt]
affects: [04-05]
tech_stack:
added: []
patterns: ... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-SUMMARY.md | Markdown | 9131a565e390defb410c9ab4bb2b986f6ba34f9fc6666bf2704ff869e963b7b5 | 0 | 896 |
.
## Key Implementation Details
| Detail | Value |
|--------|-------|
| Model ID | `claude-opus-4-7` |
| Anthropic baseURL | `https://api.anthropic.com` (hardcoded bypass) |
| Default concurrency | p-limit(15) |
| Default count | 500 |
| Max retries (schema-gate) | 2 |
| Max retries (429 rate limit) | 2 |
| Temperatu... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-03-SUMMARY.md | Markdown | dcb653440b35968d2322d9db4fe97d70adbaeab72e904da2c1ff955a5eb88590 | 1 | 277 |
---
phase: 04-data-eval-gen
plan: 04
type: execute
wave: 2
depends_on: [01, 02]
files_modified:
- lib/data/traj-worker.ts
- lib/data/traj-prompts.ts
- lib/data/traj-worker.test.ts
autonomous: true
requirements: [DAT-02, DAT-03]
must_haves:
truths:
- "`generateTrajBatch(opts: { trainChunks, tools, counts?, ... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-04-data-gen-traj-worker-PLAN.md | Markdown | 68fb9a1779b07bd1439e42f077032a02fe3b535ccc0dd9188c1266ca95083fe2 | 0 | 896 |
every trajectory turn"
pattern: "validateToolCall"
- from: "lib/data/traj-worker.ts"
to: "data/adapter-tools.json"
via: "tools array passed through to TrainingExample.tools"
pattern: "adapter-tools"
- from: "lib/data/traj-worker.ts"
to: "p-limit"
via: "concurrency control at ... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-04-data-gen-traj-worker-PLAN.md | Markdown | a73df0b8ad46e984296517f7ffc0c9d1e0ee3458141c0d5f452fc20bb94837a7 | 1 | 896 |
second call's arguments reference first call's result.
**Refusal (3 messages, NO tool_calls):**
```json
[
{ "role": "system", "content": "..." },
{ "role": "user", "content": "What's the current Supabase stock price?" },
{ "role": "assistant", "content": "I can't look up live stock prices — that would require ne... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-04-data-gen-traj-worker-PLAN.md | Markdown | 3dafcb71a1076dae874c04bb6d23c2a65798f3148277eec81068d9bcc45572fe | 2 | 896 |
z.object({ name: z.string(), arguments: z.record(z.string(), z.any()) })).min(2).max(4), toolResults: z.array(z.any()).min(2), assistantAnswer: z.string().min(20), dependency: z.enum(['parallel','dependent']) })`.
4. **REFUSAL_SCHEMA** — `z.object({ userQuery: z.string().min(10), refusalResponse: z.string().min(20... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-04-data-gen-traj-worker-PLAN.md | Markdown | 17bb6241291e3a60bbeae80d0312292a799fb0d5596f892d45559844aec7950e | 3 | 896 |
<action>
1. Create `lib/data/traj-worker.ts`:
- Same provider setup as qa-worker: `const anthropicProvider = createAnthropic({ baseURL: 'https://api.anthropic.com' }); const MODEL = anthropicProvider('claude-opus-4-7');`
- `export interface TrajCounts { singleTurn?: number; multiTurn?: number; paralle... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-04-data-gen-traj-worker-PLAN.md | Markdown | 8af6f4ba806ce85bc6c89670147bf28a9eb36d08a14384329a2f11d6333ff6da | 4 | 896 |
model output; every tool_call validated. |
| Shell env -> Anthropic SDK | ANTHROPIC_BASE_URL shadowed; pinned baseURL. |
| Multi-turn trajectory -> training data | Each turn's tool_call validated independently. |
## STRIDE Threat Register
| Threat ID | Category | Component | Disposition | Mitigation Plan |
|---------... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-04-data-gen-traj-worker-PLAN.md | Markdown | b945d12d0ad171db050321524e245992dcbac6abcad9548b530588d443a795cc | 5 | 510 |
---
phase: "04"
plan: "04"
subsystem: data-gen
tags: [trajectory, tool-call, training-data, schema-gate, anthropic]
dependency_graph:
requires: ["04-01 (types, personas, split)", "04-02 (schema-gate, dedupe, stratify)"]
provides: ["generateTrajBatch — 1150 tool-call trajectories for SFT training"]
affects: ["04-0... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-04-SUMMARY.md | Markdown | 529c1c5b9546027682a2ca5ef93063207a35afe64c93353fced407e1906f774c | 0 | 896 |
under-represented tools get more examples (supports DAT-07 stratification).
**Tests (7/7 passing):**
1. Single-turn: 5+ messages with correct structure
2. Multi-turn: 6+ messages with interleaved tool calls
3. Refusal: exactly 3 messages, NO tool_calls anywhere
4. Schema-gate called for single-turn tool_calls
5. byTyp... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-04-SUMMARY.md | Markdown | 9a9cf89a2148102a4bd56cc32cd7b1f9795900cb7778b7e6c93b2d9b4decb0ac | 1 | 537 |
---
phase: 04-data-eval-gen
plan: 05
type: execute
wave: 3
depends_on: [01, 02, 03, 04]
files_modified:
- lib/data/judge.ts
- lib/data/eval-gen.ts
- lib/data/emit-jsonl.ts
- lib/data/pipeline.ts
- app/api/data-gen/route.ts
- lib/data/judge.test.ts
- lib/data/emit-jsonl.test.ts
- data/training.jsonl
- ... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | 395dab3efa3428ce4238ce4cf8d668b4cd56bc8027ca2d19983e284a9ea951d9 | 0 | 896 |
- "`/api/data-gen` route uses `runtime='nodejs'`, streams progress via `createUIMessageStream`, emits `data-agent-status` per worker phase and `data-task-notification` on completion. Reports per-stage stats: generated N -> judged M -> deduped K -> stratified -> emitted."
- "Hash-verified no-overlap (DAT-09): after ... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | a403b68dedf7f475a9eed3a70e1fb718e89ba05f2ed511e7f98d07d6e1e6f4fb | 1 | 896 |
s terminal plan — it consumes all Wave 1+2 outputs and produces the two JSONL files Phase 5 reads.
Purpose: This plan closes the loop: generated examples -> judged -> deduped -> stratified -> emitted as `data/training.jsonl` + `data/eval.jsonl`. Without it, Phase 5 has no training data.
Output: `data/training.jsonl` (... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | 590bde101e9e1da81b6a448da25e41ee9dfee3d30e0e5be6d9438ed3b95ad402 | 2 | 896 |
policy..."}],"tools":[{"type":"function","function":{"name":"supabase_rls_policy_template","description":"...","parameters":{...}}}]}
```
One JSON object per line. The `tools` array uses the OpenAI function-calling schema shape (NOT the `DynamicToolSpec` with `meta` — strip `meta` before emission).
Embedding for cosin... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | b96b24468193f499f9b9d30361d9aafd033761513d5923e49d5e1d3a4ecc40c6 | 3 | 896 |
}`;
if (m.tool_calls) line += `\n tool_calls: ${JSON.stringify(m.tool_calls)}`;
return line;
}).join('\n');
}
const JUDGE_SYSTEM = `You are evaluating training data quality for a specialist LLM. Rate the following conversation on four dimensions (1=terrible, 5=excellent):
... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | 993caf3736e5f3ace9e1076c08077d8229beda05ce96c9ff069f97e9e9ea5a19 | 4 | 896 |
TrainingExample[] = [];
for (const { index, score } of gpt5Scores) {
const pass = score.faithfulness >= 4
&& score.toolCorrectness >= 4
&& score.naturalness >= 4
&& score.grounding >= 4;
if (pass) {
accepted.push(examples[index]);
... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | c06ecd48b7db56d25b48e0c1a25b8d4119e804eda9b151f517172ca6330966b2 | 5 | 896 |
(
{ op: 'ai.agent', name: `eval-gen.${kind}` },
() => generateObject({
model,
schema: EVAL_TOOL_SCHEMA,
system: kind === 'single-turn-tool'
? `Generate a user query that requires calling exactly one of these tools with correct argum... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | e3daf2767251224d193bea3227c0cac5384df046bf7ba3f16d0a986cd21134ab | 6 | 896 |
/promises';
import path from 'node:path';
import type { TrainingExample, EvalItem } from './types.js';
import type { DynamicToolSpec } from '../discovery/types.js';
export const TRAINING_JSONL_PATH = path.resolve('data/training.jsonl');
export const EVAL_JSONL_PATH = path.resolve('da... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | c32c14ea2a04288477fa3d8f84a64804bb701d5316522094094acf7f04cb71b7 | 7 | 896 |
pipeline wiring.</done>
</task>
<task type="auto">
<name>Task 2: pipeline.ts + /api/data-gen route + tests</name>
<files>
lib/data/pipeline.ts, app/api/data-gen/route.ts, lib/data/judge.test.ts, lib/data/emit-jsonl.test.ts
</files>
<read_first>
- /Users/julianschmidt/Documents/GitHub/codex-hackathon/ap... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | 3dd7d4d445fc19caf2cc503353a525b613b130684a749d73b018cd474ea6315c | 8 | 896 |
onEvent, concurrency = 15 } = opts;
const emit = (stage: string, status: PipelineEvent['status'], detail?: string) =>
onEvent?.({ stage, status, detail });
// 1. Load corpus + split
emit('corpus', 'start');
const corpus = await fetchCorpus();
const { trainChunks,... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | 56f7330b9689b96d4aa1535fff4450f57e6c662a00a9cc49368e11b7a678170d | 9 | 896 |
for embedding
}));
// Batch embeddings (max 2048 per call)
const batchSize = 2048;
const allEmbeddings: number[][] = [];
for (let i = 0; i < textsToEmbed.length; i += batchSize) {
const batch = textsToEmbed.slice(i, i + batchSize);
const { embeddings } ... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | 6d2c224920f09201fbd75b5a9999409ce2c630190f80638116c57d1e06237bea | 10 | 896 |
'@sentry/nextjs';
import { runDataGenPipeline } from '@/lib/data/pipeline';
import { buildStatusPart, buildNotificationPart } from '@/lib/coordinator/taskNotification';
export const runtime = 'nodejs';
export const dynamic = 'force-dynamic';
export async function POST(_req: Request)... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | ec46e2e6098eb8f6b8e8a1d7d649263ce485ede543e7ae13d2228263e6e5a87b | 11 | 896 |
createUIMessageStream" app/api/data-gen/route.ts && grep -E "buildStatusPart|buildNotificationPart" app/api/data-gen/route.ts</automated>
</verify>
<done>Full Phase 4 pipeline wired end-to-end: generate -> judge -> dedup -> stratify -> emit. DAT-04 through DAT-10 implemented. `/api/data-gen` route streams progress.... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | 66edf8476acc0cb66d9254b88c20cd8587f7639843daaecd20ed42e11f760da8 | 12 | 896 |
jsonl in mlx-lm tools format — KILL POINT), DAT-09 (hash-verified 70/30 split no-overlap), DAT-10 (70-item eval.jsonl via GPT-5 cross-family). Phase 5 has everything it needs.
</success_criteria>
<output>
Create `.planning/phases/04-data-eval-gen/04-05-SUMMARY.md` noting:
- Final training example count (target >=1200)... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-judge-pipeline-eval-emission-PLAN.md | Markdown | 64213ce5d5f854fb19a391b4f6186e781da057cbbc21addc43eddc731e7eb170 | 13 | 166 |
---
phase: 04-data-eval-gen
plan: 05
subsystem: data-pipeline
tags: [judge, eval, jsonl, pipeline, dedup, stratify]
dependency_graph:
requires: [04-01, 04-02, 04-03, 04-04]
provides: [data/training.jsonl, data/eval.jsonl, /api/data-gen]
affects: [phase-05-training, phase-07-eval]
tech_stack:
added: []
pattern... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-SUMMARY.md | Markdown | cc9e1ad17f4bff90d03e40b157a7913964c5bf467fb4284351e0742b3140e0e9 | 0 | 896 |
`createUIMessageStream`. Emits `data-agent-status` per stage and `data-task-notification` on completion. Error truncated to 400 chars (T-04-16).
## Test Results
- `lib/data/judge.test.ts`: 5 tests passing
- judgeExample returns correct JudgeScore
- judgeJury accepts examples >= 4 on all dims
- judgeJury rejects... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-05-SUMMARY.md | Markdown | c7610cdfc748a8a03cf604bce887ced7b214af2bd7b31e3b381c7505248e4c10 | 1 | 876 |
# Phase 4 — Data + Eval Gen — Plan Index
**Phase:** 04-data-eval-gen (H5)
**Plans:** 5 plans across 3 waves
**Requirements:** DAT-01 through DAT-10
**Kill-point:** DAT-08 (training.jsonl in mlx-lm `tools` format)
---
## Wave Structure
| Wave | Plans | Parallel | Autonomous |
|------|-------|----------|------------|... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-PLAN-INDEX.md | Markdown | c3bb7487306a43057b425472977df92573f9726da5edff7892aae45c44461d5c | 0 | 896 |
03] ←─┘──────┘ [04-04] ←─┘──────┘
│ │
Wave 3: [04-05] ←───────────────┘
```
## Key Files Created
- `lib/data/types.ts` — Phase 4 vocabulary
- `lib/data/split.ts` — Deterministic doc split
- `lib/data/personas.ts` — Persona pool + PRNG
- `lib/data/schema-gate.ts` — AJV tool-call valida... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-PLAN-INDEX.md | Markdown | b86d653f2016f517604041f990038a61a027af456305ecf691ef53c2b0dc46e8 | 1 | 338 |
---
status: passed
phase: 04-data-eval-gen
verified_at: 2026-04-18T15:35Z
---
# Phase 4 Verification — Data + Eval Gen
## Result: PASSED
- 5/5 plans executed (3 waves)
- 92/92 tests green
- All DAT-01..DAT-10 requirements covered
- Key artifacts: types, split, personas, schema-gate, dedupe, stratify, qa-worker, traj-... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/04-data-eval-gen/04-VERIFICATION.md | Markdown | a2b168f7aaedd85eb3077d4a2ca0405b0b897c5f2a3b278f6f06a7a2b9901076 | 0 | 116 |
---
phase: 05-train-model-a
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
- requirements.txt
- CLAUDE.md
- PRD_SPEC.md
- scripts/grpo-smoke.sh
- data/training/grpo/smoke-train.jsonl
- data/training/grpo/smoke-valid.jsonl
- data/bench/rank-help.log
- data/bench/grpo-5iter.log
- .plannin... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-smoke-and-version-bump-PLAN.md | Markdown | 73dbf734a0fc6f696736a1d6aaac9f4e0f5432e6fa5c093c0a6283081ecb116c | 0 | 896 |
Canonical smoke-notes file + captured logs + corrected version pin.
</objective>
<execution_context>
@$HOME/.claude/get-shit-done/workflows/execute-plan.md
@$HOME/.claude/get-shit-done/templates/summary.md
</execution_context>
<context>
@PRD_SPEC.md
@CLAUDE.md
@.planning/ROADMAP.md
@.planning/REQUIREMENTS.md
@.planni... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-smoke-and-version-bump-PLAN.md | Markdown | 27fcc4817b34426aa297f959eb8eeb02b2bb393539273114b416993e850312c9 | 1 | 896 |
==0.31.2\`, \`mlx-lm-lora==0.1.9\`.` (exact string). Do not touch other bullet points.
3. **PRD_SPEC.md §13** — find the row asserting `mlx-lm-lora==0.1.0` and change the version to `0.1.9`. Directly above or below the changed row, add an italicized deviation note: `*Deviation: 0.1.0 was never published to PyPI; 0.1.9... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-smoke-and-version-bump-PLAN.md | Markdown | ef01f8856cbba8747c5466aa0b9721950bb27c470ec8af5deebee53b9977aa53 | 2 | 896 |
- `--rank` flag present: YES|NO ← fill in
- If NO: rank is set via `adapter_config.json` inside `--adapter-path` before training starts.
### Locked decision for scripts/train.sh (plan 05-02)
RANK_STRATEGY=cli # if --rank was present, pass `$RANK_FLAG_NAME 16` on argv
RANK_STRATEGY=config # otherwise, write a... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-smoke-and-version-bump-PLAN.md | Markdown | 21a979d3085f576b6fbd7a4c7fa567a19c311ca1a70dbf867226dac53e9e3732 | 3 | 896 |
model-a/05-01-smoke-notes.md</files>
<read_first>
- .planning/phases/05-train-model-a/05-RESEARCH.md §"Reward Stream Integration (TRN-03)", §"Wall-Clock Math (TRN-02)", §Pitfall P5 (data shape)
- .planning/phases/02-orchestrator-harness/02-02-train-subprocess-loss-chart-PLAN.md (Phase 2 trainParser regex — TR... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-smoke-and-version-bump-PLAN.md | Markdown | efad7980bd5999f29a3b059eb738c3e5523234f683b19170e4977ab1e3fbcdbf | 4 | 896 |
-START))" | tee -a data/bench/grpo-5iter.log
```
Run it:
```bash
bash scripts/grpo-smoke.sh
```
If it crashes (e.g. data shape still wrong, reward-weights format rejected, OOM), iterate on the smallest change — NEVER author `.py`. If it crashes after 3 attempts, record the failure mode in 05-01-smoke-notes.md §"GRPO ... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-smoke-and-version-bump-PLAN.md | Markdown | 2ca7d1d87afc9c6962f70b0cc922cbc6dc0abe2bab572be589e00714e0571c83 | 5 | 896 |
` and `"answer"` keys
- `scripts/grpo-smoke.sh` is executable (chmod +x)
- `data/bench/grpo-5iter.log` exists and is non-empty
- 05-01-smoke-notes.md contains exactly one `FINAL_GRPO_ITERS=<integer>` line
- 05-01-smoke-notes.md contains exactly one `REWARD_SHAPE_MATCHES_PHASE2=YES` or `=NO`
- If `FI... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-smoke-and-version-bump-PLAN.md | Markdown | 93419fe202b9b247198220bf2361fa7d632a0415e6065fa7459cfa30a4269c54 | 6 | 797 |
# 05-01 Smoke Notes (canonical input for 05-02/05-03/05-04)
## Rank flag decision
Observed in `mlx_lm.lora --help` (captured at data/bench/rank-help.log):
- `--rank` flag present: NO
- Rank is set via `adapter_config.json` inside `--adapter-path` before training starts.
### Locked decision for scripts/train.sh (plan... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-smoke-notes.md | Markdown | cf732d7b998cd070d52b28c54c032b9e7ef97eb3307c57845307ee5a99072220 | 0 | 637 |
---
phase: "05-train-model-a"
plan: "01"
subsystem: "training-smoke"
tags: [mlx-lm-lora, grpo, smoke-test, version-pin]
dependency_graph:
requires: ["01-02"]
provides: ["RANK_STRATEGY", "FINAL_GRPO_ITERS", "REWARD_RE"]
affects: ["05-02", "05-03", "05-04"]
tech_stack:
added: []
patterns: ["GRPO Path C kill-poi... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-SUMMARY.md | Markdown | ded8f6797f9c67026d1c1334b78904b2278d02a1e62df1bee716c2aebb34b8b7 | 0 | 896 |
Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Validation set too small for GRPO batch_size**
- Found during: Task 3
- Issue: `GRPODataset` requires `batch_size=4` minimum examples; initial valid set had 2
- Fix: Expanded smoke-valid.jsonl to 4 examples
- Files modified: data/training/grpo/smoke-valid.jsonl
**2... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-01-SUMMARY.md | Markdown | 283c4fc10a4ed65cee2698a5578ccf14be9f71c6bc2c4e363b449b00689f85b6 | 1 | 179 |
---
phase: 05-train-model-a
plan: 02
subsystem: training-scripts
tags: [bash, mlx-lm, sft, grpo, training]
dependency_graph:
requires: [05-01-smoke]
provides: [scripts/train.sh, scripts/grpo.sh, scripts/_lib.sh]
affects: [05-03-supervisor, 05-04-integration]
tech_stack:
added: []
patterns: [exec-style-forward... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-SUMMARY.md | Markdown | b96b3a7f139d6e4f4c42ceee9f27d1f66935312c1623f7775d322ebba467fbb0 | 0 | 896 |
only if RANK_STRATEGY=config. Since defaulting to cli, skipped.
- **Fix:** No adapter_config.json needed; rank handled via --lora-rank CLI flag.
## Verification
- `bash -n scripts/_lib.sh scripts/train.sh scripts/grpo.sh` -- all exit 0
- Path C test: `ITERS=0` logic emits "grpo.skipped" and exits 0
- No .py files aut... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-SUMMARY.md | Markdown | 4c00128151e0720b47e5bcb1add8dab39812e8f8cbf7f159e81a1314c27e10a6 | 1 | 137 |
---
phase: 05-train-model-a
plan: 02
type: execute
wave: 2
depends_on: [05-01]
files_modified:
- scripts/_lib.sh
- scripts/train.sh
- scripts/grpo.sh
- data/training/model-a-adapter/adapter_config.json
autonomous: true
requirements: [TRN-01, TRN-02]
must_haves:
truths:
- "`scripts/_lib.sh` is a sourced h... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-training-scripts-PLAN.md | Markdown | 5488e575bf10009de8c6830f663645a870863f14056d5b637f4bbc9b7c6ff601 | 0 | 896 |
-plan.md
@$HOME/.claude/get-shit-done/templates/summary.md
</execution_context>
<context>
@PRD_SPEC.md
@CLAUDE.md
@.planning/phases/05-train-model-a/05-RESEARCH.md
@.planning/phases/05-train-model-a/05-CONTEXT.md
@.planning/phases/05-train-model-a/05-01-smoke-notes.md
@.planning/phases/05-train-model-a/05-01-SUMMARY.m... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-training-scripts-PLAN.md | Markdown | 5e3fe9452cfdd53ee443b734609d799a880447966a6fe4f3841ae57a31e569d7 | 1 | 896 |
-E4B-it-UD-MLX-4bit}"
mkdir -p "$ADAPTER_DIR"
```
No shebang-based execution — the file is `source`d by callers. Mark it executable anyway (`chmod +x`) so a developer running `./scripts/_lib.sh` for a sanity check at least prints the echo (if any) without an ENOEXEC error.
</action>
<verify>
<automated>test -... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-training-scripts-PLAN.md | Markdown | 1d088750e3db2d03f59a2a7666fbedb0acb74a535c7f28080fefc2da66b89af3 | 2 | 896 |
"
--num-layers "$NUM_LAYERS"
--batch-size "$BATCH"
--max-seq-length "$SEQ_LEN"
--learning-rate "$LR"
--grad-checkpoint
--save-every "$SAVE_EVERY"
--steps-per-report "$STEPS_PER_REPORT"
--adapter-path "$ADAPTER_DIR"
)
# RANK_STRATEGY=cli → append `$RANK_FLAG` 16 where RANK_FLA... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-training-scripts-PLAN.md | Markdown | b68ba5035915fb7539c5a88a1dd8327f07e744c583fd466f31e96a62a860c62c | 3 | 896 |
`data/training/model-a-adapter/adapter_config.json` exists and contains `"rank": 16`
- If smoke-notes RANK_STRATEGY=cli: `scripts/train.sh` contains the data-driven pattern `RANK_FLAG="${RANK_FLAG:---rank}"` and `ARGS+=("$RANK_FLAG" 16)` — NOT a hand-edited `--rank 16` / `--lora-rank 16` literal with a "replace me"... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-training-scripts-PLAN.md | Markdown | 25db8f1f48fce25fdf86aa1f25deb543ea1173539ed3700b1ed8a7840f75dcc9 | 4 | 896 |
reward-weights "$REWARD_WEIGHTS"
--resume-adapter-file "$RESUME"
--adapter-path "$ADAPTER_DIR"
)
exec python -u -m mlx_lm_lora.train "${ARGS[@]}"
```
Notes:
- Path C is baked into the script itself, so 05-04 does not need a separate code path: /api/train can always invoke `grpo.sh`; the sk... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-training-scripts-PLAN.md | Markdown | a671a14399892906be8db9f13dc9596cf8aa36509fd95e869223aaceb7067c2e | 5 | 896 |
[@]"` quoted expansion; no `eval`; no command substitution from untrusted source |
| T-05-05 | DoS | grpo.sh spawns without a prior SFT adapter → writes fresh LoRA → training overshoots budget | mitigate | Explicit `[ ! -f "$RESUME" ]` guard → emit `grpo.skipped` and exit 0 |
| T-05-06 | Integrity | Rollback respawn wi... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-02-training-scripts-PLAN.md | Markdown | c63de003efbf2991a38f131b3db7bc75c6c16a22849064897cba7222ac4f2e50 | 6 | 494 |
---
phase: 05-train-model-a
plan: 03
type: execute
wave: 2
depends_on: [05-01]
files_modified:
- lib/training/supervisor.ts
- lib/training/supervisor.test.ts
- lib/training/rollback.ts
- lib/training/rollback.test.ts
- lib/training/transformGrpoJsonl.ts
- lib/training/transformGrpoJsonl.test.ts
- scripts/... | codex-hackathon | .planning/milestones/legacy-2026-04-pre-mlx-phases/05-train-model-a/05-03-supervisor-rollback-transform-PLAN.md | Markdown | 5a93d5c89d44de32fa87fcc96b9ecd7685b655fdc7c93a1f433bf837996a4e5e | 0 | 896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.