/ana:chat-windowfrom ana
Rebuilds the ANA chat window to match the Claude iOS app UX: user bubbles, markdown replies, collapsible tool groups from JSONL logs, floating composer with model/effort sheet, usage rings, voice dictation, file attachments, and per-session ledgers.
Ships in ana. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
UI/UX is the point of this skill. Match the spec below exactly; it came from side-by-side comparison with the Claude iOS app. The reference implementation is the upstream base (dashboard.html, dashboard-api.js, agent-log.js, codex-settings.js). Take code from there by the anchors in features.json (chat-* features).
┌──────────────────────────────────────────┐
│ ‹ ● base-ana-claude ▾ │ header: back (mobile) + full-width combo, left-aligned, no ⋯ button
├──────────────────────────────────────────┤
│ ┌──────────────┐ │
│ │ user bubble │ │ gray bubble, right; images as 110px thumbnails above it
│ └──────────────┘ │
│ Assistant reply as plain markdown — │ no bubble; headings, lists, code, tables, links
│ **bold**, `code`, lists, tables. │
│ Ran 3 commands, read 1 file › │ collapsible tool group; "Running `cmd`" + spinner while running
│ │
│ ✳ 12s · Working… ⟳ Syncing… │ status line (spinner + elapsed + agent's status)
│ ( ↓ ) │ jump-to-bottom, dot when new messages arrive below
│ ╭──────────────────────────────────────╮ │
│ │ Message ANA — Enter to send │ │ floating, blurred, translucent card
│ │ (+) (Opus 5.5) (🛡)(5h)(7d) (🎤) (↑) │ │ send = theme accent; stop = light circle + 18px ■; 🛡 = permission mode
│ ╰──────────────────────────────────────╯ │
└──────────────────────────────────────────┘
.exe), msg count, and You only on the session this screen views. Elsewhere show "Open in another tab" / "Your last pick".Opus 5.5, GPT-6 Astra). Tap opens the model sheet. Without a log it opens the session list.perm-only). Refreshed every 15 s while the chat is visible. Below 380 px the round controls shrink to 36 px so the model name still fits.--dangerously-skip-permissions.SpeechRecognition exists; pulses red while listening; dictation goes into the input. It needs https, and on iPhone Siri & Dictation must be on./btw, /login, /model, /effort, /help, /cost…): typing / opens #slashMenu (SLASH_CMDS, filtered as you type; ↑↓, Tab/Enter fill in, commands without arguments send at once). Anything starting with / is sent to the input line as-is and Claude Code runs it. Because commands leave no transcript echo, their bubble (.msg.user.cmd) is confirmed on delivery (o.cmd). watchSlash then reads the terminal (/api/screen + /api/health): an overlay (health.dialog without dialogInfo — /btw, /help) is shown as a .msg.term box with Close (sends Esc; the generic dialog card is suppressed while slashOverlay), new lines above the input box (/effort → Set effort level to …) are shown as text, and a menu (dialogInfo) is left to the dialog card. Sending a normal message while an overlay is open presses Esc first — otherwise the input line is not ready and /api/chat answers 409.send() picks its Chat about this option first (dialogDo({action:'pick', n}), 600 ms) and then sends the text; if the question has only Type something, the text is sent as that answer. Any other 409 not ready (a menu such as /model, startup) puts the bubble into waiting (waitAndResend): the terminal card opens with what the screen shows, and the message is resent by itself once health.ready && !health.dialog (polled every 2 s, up to 3 min). Only login/setup dialogs (dialogInfo.kind === 'onboarding') disable the composer. Codex: its composer has no separator lines, so the core never reports ready; the client treats a Codex session as ready whenever no dialog is open (inputReadyNow), the / menu lists Codex's commands (CODEX_CMDS), and its prompt line (› Ask Codex to do anything) and status line (<model> <effort> · <cwd>) are dropped from command results. channel-core.js ≥ 0.27.4 recognizes the Codex composer (codexPromptReady: a › line right above the <model> <effort> · <cwd> status line), so health.ready is true and a send goes out at once; older cores waited ANA_READY_TIMEOUT (5 s) before each Codex send.| Piece | Where | Notes |
|---|---|---|
| Structured log | agent-log.js (copy whole) | Finds the log for a tmux target from the pane's cwd. Claude Code: ~/.claude/projects/<cwd with non-alnum→'-'>/*.jsonl (newest). Codex: the most recently modified ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl whose first-line session_meta.cwd matches — the date folder is the day the session started, and Codex keeps appending to that file, so never limit the search to recent date folders. Incremental reads by byte offset; items get a rev; clients poll since=rev and replace by id. |
| Log API | GET /api/agentlog?target=&since= → {available, kind, model, modelName, effort, limits, rev, items}; &before=<idx>&limit=40 pages backwards ({oldest, older, total}); GET /api/agentlog/img?target=&ref= | Images are re-read from the JSONL line by reference, never cached in memory. |
| Model/effort | POST /api/agent-setting {model?, effort?, target}; GET /api/agent-models (Codex catalog) | Claude: whitelist opus/fable/sonnet/haiku and low…max. Inject /model x / /effort y with ctx.injectText(cmd, true, true) (no sender prefix, or the slash command breaks). Then read the screen: "Set model to …" = ok, "Kept model as …" = refused (long conversations can refuse Fable). Codex: codex-settings.js (copy whole). The catalog comes from ~/.codex/models_cache.json; it types /model and walks Codex's own menus, then waits for "Model changed to …". |
| Permission mode | GET /api/agent-permission → {kind, current, options[{id,label,desc,risky,available}]}; POST /api/agent-permission {mode, target} | permission-mode.js (copy whole). Claude: current mode = the bottom status line (⏵⏵ auto mode on, ⏸ plan mode on, … — only lines starting with ⏵⏵/⏸, never reply text). Switch = BTab one press at a time, re-reading the status line after each, at most one lap; settings files are not touched. Codex: current = rollout turn_context (approval_policy + sandbox_policy + approvals_reviewer); before the first turn, start flags / config.toml. Switch = type /permissions, pick the row, confirm "Enable full access?", wait for "Permissions updated to …". Codex writes approvals_reviewer to ~/.codex/config.toml. |
| Limits | GET /api/limits?target= | Claude: server reads the OAuth token (macOS keychain Claude Code-credentials, else ~/.claude/.credentials.json) and calls https://api.anthropic.com/api/oauth/usage with anthropic-beta: oauth-2025-04-20 → five_hour / seven_day.utilization. Cache 60s. Never send the token to the browser. Codex: token_count.rate_limits from the rollout (window_minutes ≤ 360 = 5h, else weekly). |
| Uploads | POST /api/upload → .ana/uploads/…; the message carries "N attached file(s) — read and check these paths:" + paths | The log view turns those paths back into thumbnails (/uploads/<name>). |
| Per-session ledgers | channel-core.js ≥ upstream d690eda (TARGETS_FILE, transcripts/) | Each tmux session keeps its own history; each person's last-picked session is remembered. Needs the newer shared runtime; see ana-update step 2. |
| Screen mirror | /api/stream (SSE) from channel-core | Still used for busy/status, dialogs, and agents without a structured log. In log mode, render only proposal messages from the ledger. |
Opening a session loads only the latest 40 items (pageItems). Every item carries idx, its position in the conversation. Scrolling within 320 px of the top calls loadOlder(), which fetches before=<oldest idx>&limit=40 and inserts the items under the #logMore marker. It then restores the scroll by the height difference, so the item you were reading doesn't move. If the screen still isn't full, it keeps loading. The marker reads "Loading earlier messages…" while loading, "Load earlier messages" as a fallback button, and "Beginning of the conversation" at the end. Incremental since= updates for items older than the loaded window are skipped, never appended at the bottom.
Reading never locks the composer. Only switching sessions (swStart(…, withConnect) → sw.switching, body.chat-loading) disables the input and send. A first load or a catch-up shows the card (body.chat-catchup) while typing and sending stay open — a message goes to the terminal regardless of the log. When a conversation already on screen grows and the server reads it in the background, the card says Catching up on new messages (sw.quiet). On the server, agent-log.js reads growth of an already-open log at once up to 32 MB (SYNC_MAX_GROW); only a first open over 4 MB is read in the background.
The log poller cannot die. pollLog() wraps pollLogBody() in try/catch and always schedules the next poll; pollHealth restarts it if no poll ran for 15 s, and while loading a watchdog restarts it after 12 s of silence. (Before 0.27.5 one exception — e.g. a malformed log answer — ended the chain and Loading… stayed until a reload.)
The loading card keeps a detailed log (swLog): each /api/agentlog answer (server is reading the log 2.9 MB / 7.6 MB ×30, → 2 message(s), rev 5 (12 ms), no answer (timed out after 8 s), session changed to …, errors). Details opens by itself after 8 s; after 20 s the card offers Try again (reread from the start), Reload page and Hide (gives the composer back). The card is sticky at the top of the feed so it stays in view in a long conversation; the same lines go to the console as [chat-load].
Server (agent-log.js): update() parses new bytes synchronously when there are ≤ 4 MB of them. Above that, loadInBackground reads 4 MB chunks on setImmediate and tracks st.loading {from, done, total}. ingestRange splits lines on the \n byte and keeps the unfinished tail as a Buffer (st.carry), so multi-byte characters at chunk edges stay intact. While loading, read() returns {available, loading:{done,total,ms}, kind, title, items:[]} and never a partial page. prefetch(target) starts loading and returns {size, loading, items} (/api/agentlog?prefetch=1).
Page: applyTmuxTarget empties the chat and starts the progress card (#swLoad, swStart / swSet / swEnd / renderSw) with four steps: connect (POST /api/config) → find (first /api/agentlog, Claude Code / Codex + title, or "no structured log" for shells, which then render the stashed ledger sw.ledger) → read (MB + bar from loading, re-polled every 300 ms) → show ("latest 40 of N"). Each step shows its time. It calls pollLog() right away with a provisional health.target. A poll that's still in flight sets logAgain, so the next one runs immediately instead of 2 s later. While switching, the SSE snapshot's ledger is stashed, not drawn, to avoid a flash. While sw is set, renderSw puts body.chat-loading on: the input is disabled with Loading … (updateSendMode), the model pill becomes a spinner + Loading…, the other composer buttons dim and ignore taps, the combo dot spins, a bar runs along the top of the composer, #feed gets aria-busy, and send() returns early. Opening the combo calls prefetchLogs() for the other agent sessions (once a minute each).
ana-diff.mjs → note which chat-* features are ✗/◐ and whether the runtime differs.agent-log.js and codex-settings.js. In the ANA's extraApi module add const { createAgentLog } = require('./agent-log.js'); const agentLog = createAgentLog({ socket: opts.TMUX_SOCKET || '' }); and pass TMUX_SOCKET from server.js. Then copy the route blocks for /api/agentlog, /api/agentlog/img, /api/agent-models, /api/agent-setting, /api/limits (plus readOauth/collectLimits).#chatDock (composer, #jumpBtn, .cbar with #agentPill #ring5h #ringWeek #micBtn #send), #connPill/#tmuxCfg, #msheet/#msheetScrim, #limitPop..chat-dock, .composer, .cbar, .limit-ring, .msheet, .md, .actgrp, .umsg, .limg, kb-open, and the mobile #chatSide rule using --vvh/--vvt.logMode…, pollLog, logItemHtml, toolSummary, splitUserText, mdHtml), limits (pollLimits, renderLimits, openLimitPop), mic IIFE, model sheet (openModelSheet, applyAgentSetting), the visualViewport IIFE, and delivery (addOptimistic, reconcile, echoOf).pollHealth() kicks pollLogSoon(); switchStream() calls logReset(); the ledger render goes through ledgerHtml().logMode, logRev, logModel, logKind, limits, … sit next to contextChips. Bootstrap calls pollHealth → pollLog before later lets run, which throws a TDZ error, and the page silently stops..click() on a button from inside its own click handler (re-entrancy is ignored). Use a plain function (selectTab).data-mode on <html>, so don't use [data-mode] for your own buttons./permissions rewrites ~/.codex/config.toml (and trusting a folder adds a [projects…] entry). Back it up before testing on a throwaway session and restore it after./model changes defaults: Claude Code saves /model and /effort as the default for new sessions in ~/.claude/settings.json. Never test on the live session you're running in. Use a throwaway tmux -L test new-session …, back up settings.json first, and restore it after.TMUX_SOCKET=<nonexistent>. The runtime sets pane options on any session it attaches to.killall node.node test.cjs (includes agent-log toolLabel/cleanUser/modelName/codexModelName/codexLimits) and node --test codex-settings.test.cjs.GPT-…/api/agent-setting rejects {"model":"sonnet; rm -rf ~"} with 400; no token in any response.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub tykimos/agent-native-agent --plugin ana10 skills in this plugin
/agent-requestsPort ANA's Requests, Evolve, PRD and Knowledge tabs — Requests (what the agent needs from the user — pending data-change diffs, approval / decision / access requests, work only the user can do, missing information), Evolve (the agent looks at the work and the usage log and proposes what to do now and how the app should change, then builds the approved ones) and PRD (what this ANA is and does — the agent writes it, people edit it, every version is kept). Knowledge (an ontology and a graph that start empty and the agent fills from the work). Every card speaks plainly (why / ask / effect / ifNot). Also triggers on "PRD", "요구사항 문서", "지식", "온톨로지". Use when the user says "Requests 탭", "에이전트가 요청", "사용자에게 요청", "Evolve", "진화 제안", "개선 제안 탭", or when ana-update reports agent-requests / agent-evolve missing./anaAttach ANA (Agent-Native Agent) to an existing web app or service so the user can operate it by watching a dashboard and chatting with a coding agent that runs inside tmux — chat is injected via tmux paste-buffer and the session is mirrored via capture-pane, with zero dependencies (no MCP, no bridge, no hooks, no plugin runtime). Use this whenever the user wants to "add ANA / a chat+watch dashboard to my app", "attach a coding-agent chat to an existing service", "make my dashboard talk to a tmux agent", "화면 보면서 대화로 조작", "기존 서비스에 ANA 붙이기", or to scaffold the standalone ANA base app. The single file `channel-core.js` is the whole runtime — drop it in and mount it./ana-updateBring an existing, customized ANA up to date with the latest upstream ANA (github.com/tykimos/agent-native-agent) feature by feature — compare first, report what is new/missing/outdated, then port only what the user picks, using the per-feature skills (chat-window, context-chips, work-and-knowledge, app-shell, agent-requests, trust-checks). Never overwrite the ANA's own domain code. Use when the user says "최신 내용으로 업데이트해", "ANA 업데이트", "update this ANA", "upstream이랑 뭐가 달라", "새 기능 가져와", "base-ana 개선사항 적용", or gives the ANA GitHub URL and asks to sync./app-shellPort ANA's app shell — one workspace, six tabs in a menu under the ANA logo (PRD with Current / History, Work with a sub-tab per kind of work, Knowledge with Ontology / Graph, Requests · Evolve · Update with Waiting / In progress / Done), sub-tabs (in the top bar), badges, right-aligned profile, "New version available" reload pill, and the remembered tab. Use when the user says "탭 구조", "모바일 네비게이션", "워크 탭", "서브탭", or when ana-update reports app-tabs missing./audio-cd-rip오디오 CD를 mp3로 리핑해 contents/music 앨범 폴더로 만든다. CD 케이스·표지 사진에서 곡명을 읽거나 MusicBrainz로 조회해 album.json 메타를 작성하고, 커버 이미지를 저장해 음악 탭(/music)에 바로 뜨게 한다. "CD 복사해줘", "CD를 mp3로", "앨범 넣어줘", "음악 CD 리핑" 요청 시 사용./cloud-settingProvision and wire up a cloud VM as an ANA (Agent-Native Agent) host end-to-end — create an Azure VM (az CLI), record its connection info, SSH in, install Node ≥ 20 + tmux + Claude Code, clone a project into ~/Projects/<name>, run the coding agent inside a named tmux session, expose the ANA server through a Cloudflare Tunnel (cloudflared systemd service + public hostname), and register everything as systemd units that survive reboots and crashes. Use whenever the user says "VM 만들어", "클라우드 셋팅", "cloudflare 터널 연결", "tmux에서 claude 띄워", "서비스로 등록해", "재부팅해도 살아있게", "azure vm setup", "cloud-setting", "deploy ANA to a server", or wants to move an ANA project from laptop to a server.Other plugins' skills for the same job