A single place to pick the project back up — current state, decisions, gotchas, and what's next.
A Codex/Claude-Code-style terminal coding agent, provider-agnostic across OpenAI, Google Gemini, and xAI (Grok). TypeScript pnpm monorepo. Goals: runtime model switching, smart routing, secure local key setup, and an optional hosted server — all on one provider-blind agent engine.
- ✅ Monorepo scaffolded; typechecks clean.
- ✅ Canonical core (types, permission engine, agent loop).
- ✅ Providers via AI SDK adapter: OpenAI + Gemini + xAI + Muse + NVIDIA NIM + Qwen + Anthropic (catalog, 2026-08-31).
- ✅ Smart routing: heuristic and model-driven classifiers (
--routing model), with heuristic fallback; per-turn auto-routing in the TUI (/route). - ✅ Tools: read/write/edit/bash/grep/glob with permission classes.
- ✅ Claude-Code-style Ink TUI: welcome banner,
⏺/⎿tool rendering, markdown assistant output, bordered composer, spinner (elapsed + esc-to-interrupt), status bar. - ✅ Settings screen for keys: masked paste · import-from-env · open key page · validate with a test call · agentic hook (stub; MCP flow TODO).
- ✅ Secure key flow: masked first-run setup → OS keychain (DPAPI-backed on Windows),
0600file fallback. Keychain backend verified active. - ✅ Tool-execution sandbox:
local(host) +docker(isolated shell) backends; tools run only through theSandboxcontract;--sandbox dockerfails closed. - ✅ Hosted server:
POST /chat(SSE) +/health(takes aSandbox). - ✅ Live smoke harness (
pnpm smoke <provider:model>). - ✅ Build & distribute:
tsupbundles the CLI to a singlepolybin (internal packages bundled, third-party external); private@polycode/cli(not npmjs); multi-stage serverDockerfile. - ✅ Docs in Markdown + generated HTML (
docs/,docs/html/). - ✅ Live end-to-end provider call verified (2026-06-23) —
pnpm smoke xai:grok-4.3round-trip green (tool call → numbered result → text). - ✅ Phase 1 — Brains + Loop (2026-06-23) — project-context injection (
gatherContext), loop hardening (maxStepscap + transient-error retry), and acat -nnumberedreadwithoffset/limit. See the Claude-Code Parity Roadmap for what's next.
- TypeScript + Ink + Vercel AI SDK — closest to the Claude Code look; best multi-model SDK; ship via git + Docker, not npmjs.
- Unifying SDK behind our own
Providerinterface — fast to build, not locked in; can drop a hand-rolled adapter per provider where the SDK flattens something we need. - Anthropic is first-class (reversed 2026-08-31) —
@ai-sdk/anthropicplus OpenAI-compat rows for Muse / NVIDIA NIM / Qwen. Contributor / training-tier model ids are refused unlessallowTrainingTiers: true. - Provider-blind core — loop/tools/permissions/UI see only canonical types; the seam that makes multi-model work.
- Engine reused local + hosted —
coreis transport-agnostic; TUI imports it, server wraps it. - Keys in the OS keychain — secure-by-default; masked input; never logged/committed.
- pnpm not on PATH; Corepack can't write shims without admin. Use
corepack pnpm -C "<repo>" <cmd>.corepack enablefrom an admin shell fixes it. - Model IDs churn. Confirmed June 2026:
gpt-5.5,gemini-2.5-flash/-pro,grok-4.3.grok-4is retired;gpt-5is superseded. See Providers. - AI SDK v5 stream shapes. The adapter switches on
fullStreampart types (text-delta,reasoning-delta,tool-call,finish). Re-verify on a major SDK bump. - Capability numbers are estimates in
packages/providers/src/index.ts. - Dev resolution. Packages point
main/exportsatsrc/index.tsfortsx. For publishing, switch todistand runbuild. - TUI flicker. Streaming text is paint-buffered (~10 Hz). Open markdown fences
render without a round border so the live region does not reflow every token.
Frame-count tests live in
packages/tui/src/app.ux.test.ts. Still run the TUI once in a real Windows Terminal (120×40) before merging TUI-touching PRs.
gasantiago16/polycode(public, experimental alpha), default branchmain.- Commits: baseline scaffold → secure key setup + smoke harness → docs.
The Claude-Code parity plan now lives in the Roadmap: Phase 1 (brains + loop) is done; Phases 2–4 (tools / TUI / persistence) are queued.
- Run the live smoke test — paste a key via the setup screen, then
corepack pnpm smoke <provider:model>; confirmPASS. Alsoroute-checkthe classifier.--sandbox dockerfails closed if Docker is not running. - Build/push the Docker image — the
Dockerfileexists but hasn't been image-built from CI yet. - Parallel-safe tool batching — run
parallelSafetools concurrently in the loop. - Tune the classifier — few-shot examples / structured output; cache across sessions.
- Wire agentic key provisioning — the Settings
ahook is a stub; connect a real MCP/tool flow.
corepack pnpm -C "C:\Users\Gabriel Santiago\polycode" install
corepack pnpm -C "C:\Users\Gabriel Santiago\polycode" dev # TUI (first run = key setup)
corepack pnpm -C "C:\Users\Gabriel Santiago\polycode" smoke google:gemini-2.5-flash
corepack pnpm -C "C:\Users\Gabriel Santiago\polycode" typecheck
corepack pnpm -C "C:\Users\Gabriel Santiago\polycode" docs