Handoff: CreatorTrack AI agent picker + claude2 subscription + MarkAi (2026-07-07)¶
URL: https://mkdocs.justinsforge.com/memory/handoffs/creatortrack-ai-agent-picker-2026-07-07/
Status update 2026-07-07: MERGED to main and DEPLOYED to prod (:3070, build cibNtTx0, health 200). Migration applied to prod DB (plus 5 pending batch-0706 migrations found unapplied). Dev slot torn down; branch pushed to origin. Canonical doc: reference_creatortrack_chat_agents. Remaining: browser QA of picker/settings/photo flows on prod.
Branch: feat/ai-agent-picker (4 commits). Provider layer live-verified via scripts/smoke-chat-agents.ts.
What was built¶
- Built-in chat agents for all users (
lib/llm/user-config.ts): justin-haiku(Justin's Claude Haiku,claude-haiku-4-5) andjustin-sonnet(Justin's Claude Sonnet,claude-sonnet-5), both on the claude2 subscription ([email protected]). Auth: OAuth bearer from~/.claude-sub2/.credentials.json, auto-refreshed and written back atomically (lib/llm/claude-subscription.ts),anthropic-beta: oauth-2025-04-20, Claude Code identity as first system block.markai: Copper API direct (https://copper-api.markcodes.org, bare token~/.forge-secrets/markaiapi.env), modelcyankiwi/Qwen3.6-27B-AWQ-BF16-INT4, noThink mode.self-hosteddefault unchanged. Custom models addable: Claude (Anthropic key) or OpenAI-compatible; keys AES-encrypted incore.user_llm_keyskeyed by custom model id.- Chat sidebar agent picker: sliders button next to Recent (
ChatSidebarPanel), popoutChatAgentPickerlisting agents, persists viaPUT /api/chat/ai-config {select}. - Settings > AI model: dropdown replaced by added-models list (built-ins pre-added, Photos/Key pills) + "Add model" form (
SettingsModal.tsx AgentPane). - Photo uploads in chat: attach button + paste in composer, staged chips, images in user bubbles; server loads file ids RLS-scoped, base64 to vision agents (Anthropic image blocks / OpenAI data URIs). Non-vision agents fail loud with a switch-model message. Migration
20260707T040841_*addsapp.chat_messages.attachments jsonb(applied to slot clone only). - Tool catalog expanded (
lib/chat.ts): +complete_task,update_task,get_habits,log_habit,list_projects,create_project,create_page(all RLS-scoped; mutation kinds broadcast for auto-revalidate).
Verified live (real API calls)¶
- claude2 token read + shape OK; Haiku and Sonnet 5 reply over subscription OAuth; tool_use round-trip OK; image block OK ("Red").
- Sonnet 5 rejects
temperature-> removed from Anthropic provider. - MarkAi replies OK after model-id fix.
npx tsc --noEmitclean (only pre-existing worktree type noise); eslint: no new errors.
To review / before merge¶
- NOT browser-tested (no dev server this session). Exercise: picker popout, settings pane, photo send, each agent end-to-end in the chat UI.
- Apply the attachments migration on prod DB at deploy (deploy script runs migrations).
- Prod needs read/write on
~/.claude-sub2/.credentials.json(systemd runs as justinwieb: OK) and~/.forge-secrets/markaiapi.env. - Policy check: subscription OAuth against the Messages API is the community pattern (bearer + oauth beta header + CC identity block); if Anthropic tightens it, errors surface loudly in chat, fall back is BYO key via Add model.
- Multi-user note: built-ins (Justin's subscription + MarkAi) are visible to EVERY workspace user by design ("as an option for all users"); Michael's usage bills Justin's subscription quota.
[Claude Code]