# Prism — TypeScript Specialist LoRA Adapter codename: `prism` Agent: `build-ts` Base model: Qwen/Qwen3.5-27B ## Objective Teach the model TypeScript-idiomatic code generation aligned with the build-ts agent's system prompt. The adapter should internalize: - Strict TypeScript — no `any` without justification - `const` over `let`, never `var` - Named exports, `type` over `interface` (unless extending) - Package manager detection (bun/pnpm/npm) - Framework-aware patterns (Next.js, Vite, Astro, SvelteKit, Remix, Bun) - tsc → lint → test verification cycle ## Data Sources ### Session extraction (~200–350 examples) Classify from opencode `build` sessions by: - File paths: `.ts`, `.tsx`, `.js`, `.jsx`, `package.json`, `tsconfig.json` - Bash commands: `npm`, `pnpm`, `bun`, `npx`, `tsc`, `vitest`, `jest`, `biome` - Error patterns: `TS2`, `TS7`, `error TS`, type errors - Framework config files in context: `next.config.*`, `vite.config.*` ### Git repo mining (~150–250 examples) Target repos: - `~/.config/opencode/plugins/` — opencode plugins (TypeScript) - `madcat-os/sere-kit` — UI component library - `madcat-os/visor` — HUD/display system - Any `package.json`-rooted repos in madcat-os org Extract patterns: - React component implementations (hooks, state management) - Plugin/tool development (opencode tools, MCP servers) - Type-safe API integrations - Build configuration (tsconfig, vite, next) ### Synthetic (~50–100 examples) - Generic type patterns and constraints - Discriminated unions and type narrowing - Zod schema → TypeScript type inference - React Server Components vs Client Components - Edge runtime constraints (Cloudflare Workers, Vercel Edge) ## Example Format ```json { "messages": [ { "role": "system", "content": "" }, { "role": "user", "content": "Add a new visor widget component for displaying memory graph connections" }, { "role": "assistant", "content": null, "tool_calls": [ { "type": "function", "function": { "name": "glob", "arguments": {"pattern": "src/components/**/*.tsx"} } } ] }, { "role": "tool", "content": "" }, { "role": "assistant", "content": null, "tool_calls": [ { "type": "function", "function": { "name": "read", "arguments": {"filePath": "src/components/widgets/LogWidget.tsx"} } } ] }, { "role": "tool", "content": "" }, { "role": "assistant", "content": null, "tool_calls": [ { "type": "function", "function": { "name": "write", "arguments": { "filePath": "src/components/widgets/GraphWidget.tsx", "content": "" } } } ] }, { "role": "tool", "content": "File written successfully" }, { "role": "assistant", "content": null, "tool_calls": [ { "type": "function", "function": { "name": "bash", "arguments": {"command": "npx tsc --noEmit"} } } ] }, { "role": "tool", "content": "" }, { "role": "assistant", "content": "GraphWidget created. Follows LogWidget's pattern — named export, typed props, const component. Type check clean." } ] } ``` ## Evaluation Criteria 1. Generated TypeScript passes `tsc --noEmit` with strict mode 2. No `any` types without explicit justification 3. Correct import/export patterns (named exports) 4. Framework-appropriate patterns (detects Next.js vs Vite etc.) 5. Package manager awareness (correct lockfile, correct run command) 6. Tool call sequence: explore → read → implement → type-check 7. React patterns: proper hook usage, no stale closures ## Training Config Overrides ```python MAX_SEQ = 8192 LR = 5e-5 ``` ## Estimated Size - 400–600 examples total (largest dataset — most session history) - ~3M tokens - Training time: ~3 hrs on H100 - Adapter size: ~305 MB