write-tui
Skill53 starsChanged 14 days agoMITView on GitHub
Use when writing or modifying the daemon-backed kimi-code terminal UI in apps/kimi-code/src/tui.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- MoonshotAI/kimi-codetheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- MoonshotAI/kimi-code★ 8.2ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- agent-core-devSkill
- agent-core-reviewSkill
- gen-changesetsSkill
- gen-docsSkill
- kiki-docs-catchupSkill
- kiki-docsSkill
- kiki-docs-writingSkill
- pre-changelogSkill
- sync-changelogSkill
- translate-docsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Prefer @kiki/klient facades for daemon capabilities: global.*, session(id).*, and session(id).agent(id).*.
- Very specific: line 32
Add a REST adapter to daemon/client.ts only when an existing public REST contract has no Klient facade.
- Very specific: line 63
All selectors and dialogs must follow DESIGN.md: SearchableList, SELECT_POINTER, CURRENT_MARK, two-border layout, width truncation, …
- Very specific: line 70
Run focused daemon/run-shell tests, @kiki/cli and @kiki/session-core typechecks, remaining TUI tests, printable-key/color guards, and git …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Write TUI (apps/kimi-code)
The interactive terminal UI is daemon-backed. Before changing it, read apps/kimi-code/AGENTS.md. For list dialogs, selectors, input boxes, and toggle/status lists, also read DESIGN.md; its keyboard, width, color, and layout rules are normative.
Interactive architecture
The startup chain is:
src/main.ts → src/cli/commands.ts → src/cli/run-shell.ts → workspace trust → daemon attach-or-spawn → src/tui/daemon/daemon-tui.ts
There is no legacy KimiTUI runtime path or experimental selector.
src/cli/run-shell.tsowns trust ordering, daemon connection setup, process/signal cleanup, and terminal restoration. It must not contain session interaction logic.src/tui/daemon/daemon-tui.tsis the coordinator. It wiresTUIState, editor callbacks,SessionController, daemon commands, dialogs, session navigation, and lifecycle cleanup.src/tui/daemon/client.tsdelegates session actions to the shared session-core Klient adapter and keeps small REST adapters not already represented by the public Klient facade.session(id).viewsupplies ordered snapshots, transcript pages, and live recovery on the Klient event socket; there is no separate daemon session socket.src/tui/daemon/transcript-renderer.tsprojects session-core transcript blocks onto shared TUI message/media components.src/tui/daemon/commands.tsis the interactive slash-command source of truth. Every catalog command is explicitlysupportedordisabled;/helpand autocomplete are generated from the same table.src/tui/interactions/owns neutral approval/question dialog types and request/response adapters.src/tui/tui-state.tsconstructs shared terminal, layout, editor, footer, todo, and container state.src/tui/components/,theme/,constant/, andutils/remain reusable presentation and rendering layers.
Core boundaries
- Session snapshots, transcript ordering, reconnect/resync, prompt submission, abort, history rewrites, agent forest state, todos, tasks, usage, and retry state come from
@kiki/session-core. - Prefer
@kiki/klientfacades for daemon capabilities:global.*,session(id).*, andsession(id).agent(id).*. - Add a REST adapter to
daemon/client.tsonly when an existing public REST contract has no Klient facade. Do not add raw service/procedure escape hatches. - Components do not call Klient, REST, the SDK, or session-core controllers. They receive view data and callbacks.
- Commands without a real daemon contract stay disabled. Unknown slash input must never fall through as a prompt; discovered Skill and profile commands are the only dynamic exceptions.
Feature routing
- CLI startup flags and trust/lifecycle behavior →
src/cli/run-shell.ts, then pass data intoDaemonTUI. - Interactive slash declarations, aliases, help status, and argument validation →
src/tui/daemon/commands.ts. - Command execution and session coordination →
DaemonTUI; move pure parsing/projection helpers intodaemon/orutils/. - Session/transcript behavior → use or extend session-core contracts first.
- Approval/question adaptation →
src/tui/interactions/; presentation remains undercomponents/dialogs/. - Transcript block rendering →
src/tui/daemon/transcript-renderer.ts, reusingcomponents/messages/andcomponents/media/. - Session list pagination/search/scope →
SessionPickerComponentplus daemon keyset pages; do not truncate backend pagination at the first page. - Skill commands → session skill catalog and real
activateSkill/promptWithSkillscontracts. Inline skill tokens must not be sent as plain prompts. - Attachments → daemon file uploads and real prompt content parts. Keep placeholder expansion deterministic and render structured media from session-core blocks.
- Footer/todo/activity/task state → project session-core
SessionViewState; do not reconstruct parallel state from ad hoc events. - Agent navigation → session-core forest/roster plus focused-agent transcript subscriptions.
- New selector/dialog →
components/dialogs/, mounted with the coordinator’s editor-replacement helpers, followingDESIGN.md.
Keyboard rules
- Printable characters must be decoded with
printableChar()before comparison; function/control keys usematchesKey()andKey.*. - Preserve editor-native history, empty Up/Down, paste buffering, and text paste behavior unless a real coordinator action consumes the callback.
- Ctrl-C interrupts active work before exit confirmation; Ctrl-D exits only through the confirmed shutdown path.
- Ctrl-O toggles tool output, Ctrl-T toggles overflowing todos, Ctrl+- invokes the real undo contract, and Shift-Tab toggles plan mode.
- A bound callback must either perform its advertised operation or display an explicit disabled result.
Theme and dialog mechanics
Themes remain centralized under src/tui/theme/. Use semantic palette tokens, never chalk named colors, and do not cache styled functions at module scope. Keep ColorPalette, built-in palettes, schema, and required mirrors synchronized when changing tokens.
All selectors and dialogs must follow DESIGN.md: SearchableList, SELECT_POINTER, CURRENT_MARK, two-border layout, width truncation, Kitty-safe printable keys, and deterministic render/input tests.
Test placement and verification
- Daemon coordinator, commands, client, socket, pagination, attachments, transcript state, and lifecycle tests →
test/tui/daemon/. - Interaction adapter tests →
test/tui/interactions/. - Component tests remain under
test/tui/components/. - Run focused daemon/run-shell tests,
@kiki/cliand@kiki/session-coretypechecks, remaining TUI tests, printable-key/color guards, andgit diff --check. - Real TTY behavior may remain a stated manual residual; do not replace it with a fake terminal assertion that does not exercise the contract.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

