/ana:chat-windowfrom ana
Port or rebuild the ANA chat window so it looks and behaves like the Claude app — full-width session combo, user bubbles + markdown replies + collapsible tool groups rendered from the agent's own JSONL log (Claude Code and Codex), floating composer with model pill, model/effort sheet, 5-hour/weekly usage rings, voice dictation, file attachments, reliable send state, iOS keyboard fit, one ledger per session. Use when the user says "채팅창 개선", "채팅창 스킬", "클로드 앱처럼", "모델 선택", "한도 표시", "음성 입력", "코덱스 지원", "세션별로 따로", "port the chat window", or when ana-update reports chat-* features missing.
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.| 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.
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).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
npx claudepluginhub agent-native-agent/docs-ana --plugin ana16 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.