You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- custom-theme.md, update-config.md, mcp-config.md now resolve KIMI_CODE_HOME first.
- custom-theme.md requires clarifying intent before creating or editing themes.
- custom-theme.md falls back to plain-text questions in auto mode.
Copy file name to clipboardExpand all lines: packages/agent-core/src/skill/builtin/custom-theme.md
+46-15Lines changed: 46 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,35 @@
1
1
---
2
2
name: custom-theme
3
-
description: Create or edit a kimi-code custom color theme — a JSON file under ~/.kimi-code/themes/ that recolors the TUI. Use when the user wants their own theme, asks for a specific palette or mood, or wants to tweak an existing custom theme's colors.
3
+
description: Create or edit a kimi-code custom color theme — a JSON file under the resolved KIMI_CODE_HOME data directory that recolors the TUI. Use when the user wants their own theme, asks for a specific palette or mood, or wants to tweak an existing custom theme's colors.
4
4
---
5
5
6
6
# Create a kimi-code custom theme (custom-theme)
7
7
8
8
Help the user design, write, and apply a custom color theme for the kimi-code TUI. A theme is a single JSON file; the TUI ships with `dark`, `light`, and `auto`, and any file the user adds becomes selectable alongside them.
9
9
10
+
## Rules of engagement
11
+
12
+
-**Never write a theme until the user has explicitly clarified what they want.** This skill may only run after the user has confirmed light vs dark, the style or mood, any specific colors they care about, and the intended filename. If any of these are missing, ask before creating files.
13
+
-**Never assume the data directory is `~/.kimi-code`.** Always resolve `$KIMI_CODE_HOME` first with the Bash command below.
14
+
-**Never edit a live theme file in place.** Always create a `.json.new` candidate, validate it, back up the old file, and then `mv` it into place.
15
+
-**Never overwrite an existing theme without reading it first.** Read, back up, then overwrite only after the user confirms.
16
+
17
+
## Where a theme lives
18
+
19
+
The kimi-code runtime resolves the data directory as `KIMI_CODE_HOME` first, falling back to `~/.kimi-code`. Theme files live inside the `themes/` subdirectory of that data directory.
20
+
21
+
Before doing anything, resolve the actual data root with Bash so you don't write to the wrong place. Check whether `KIMI_CODE_HOME` is set and fall back to `~/.kimi-code` when it is empty:
22
+
23
+
```bash
24
+
echo"$KIMI_CODE_HOME"
25
+
echo"$HOME/.kimi-code"
26
+
```
27
+
28
+
Use the first line when it is non-empty; otherwise use the second line. In the rest of this skill, `<KIMI_CODE_HOME>` means that resolved data root — **never assume `~/.kimi-code`**. Theme files live at `<KIMI_CODE_HOME>/themes/<name>.json`. Create the `themes/` directory if it doesn't exist.
29
+
10
30
## What a theme is
11
31
12
-
- A theme lives at `~/.kimi-code/themes/<name>.json` (or `$KIMI_CODE_HOME/themes/<name>.json` when that variable is set). Create the `themes/` directory if it doesn't exist.
32
+
- A theme lives at `<KIMI_CODE_HOME>/themes/<name>.json`.
13
33
-**The filename is the theme name**: `ember.json` shows up in the `/theme` picker as `Custom: ember`.
14
34
- Shape:
15
35
@@ -67,24 +87,33 @@ Only set tokens from this set — unknown keys are silently ignored at load. If
67
87
-**What style / mood?** e.g. warm vs cool, vivid vs muted, high vs low contrast, a named vibe ("nord", "solarized", "sunset"), or a base to start from (an existing theme, or `dark` / `light`).
68
88
-**Any specific colors?** Whether they have exact hex values to anchor on (a brand color, a preferred `primary`, etc.).
69
89
70
-
Use **AskUserQuestion** for the discrete choices (light vs dark, a few style options); use a plain question for free-form input like specific hex values. Don't start picking colors until you at least know light-vs-dark and the rough style.
71
-
2.**Pick a starting point.**
72
-
- Tweaking an existing custom theme: **Read**`~/.kimi-code/themes/<name>.json` first — never overwrite a theme you haven't read.
73
-
- Starting fresh: build a `colors` object from the token table. You can `ls ~/.kimi-code/themes/` and Read one of the user's existing themes as a reference for the format.
74
-
3.**Choose colors deliberately.**
90
+
For the discrete choices (light vs dark, a few style options), prefer **AskUserQuestion** if it is available. If you are running in **auto mode** and `AskUserQuestion` is unavailable, ask the same question as a plain-text message with clear numbered or bulleted options, and wait for the user's reply. Don't start picking colors until you at least know light-vs-dark and the rough style.
91
+
92
+
2.**Resolve the actual theme directory and current theme(s).**
93
+
- Resolve the data root by checking `echo "$KIMI_CODE_HOME"`; if empty, use `echo "$HOME/.kimi-code"`. Use `<root>/themes` for every subsequent step.
94
+
- If tweaking an existing custom theme, **Read**`<KIMI_CODE_HOME>/themes/<name>.json` first — never overwrite a theme you haven't read.
95
+
- Starting fresh: build a `colors` object from the token table. You can `ls <KIMI_CODE_HOME>/themes/` and Read one of the user's existing themes as a reference for the format.
96
+
97
+
3.**Pick a starting point and choose colors deliberately.**
75
98
- Every value is a 6-digit hex `#RRGGBB` (not 3-digit, not a named color).
76
99
- Keep contrast usable against the user's terminal background: don't let `text` / `textDim` sit too close to the background, and keep `success` / `warning` / `error` clearly distinguishable from each other.
77
100
-`primary` is the most-seen color (links, selection, focus) — make it readable and distinct from `text`.
78
101
-`roleUser` is the one role color meant to stand on its own — give it a distinct hue.
79
-
4.**Write the file** to `~/.kimi-code/themes/<name>.json` with **Write** for a new theme (pick a short kebab-case filename). When editing an existing theme, prefer **Edit** on just the color(s) that change so the rest stays intact — and back it up first (see Don'ts).
80
-
5.**Validate.** Confirm the file is valid JSON and every `colors` value matches `^#[0-9a-fA-F]{6}$`. A quick check with **Bash**:
4.**Create a candidate file; never edit the live theme in place.**
104
+
- Use Bash to create a candidate. If the target theme already exists, copy it verbatim: `cp <name>.json <name>.json.new` (inside `<KIMI_CODE_HOME>/themes/`). If it doesn't exist, use **Write** to create a minimal skeleton named `<name>.json.new`.
105
+
- Use **Edit** on the candidate to change only the intended keys. Keep every existing entry, comment, and formatting intact.
106
+
107
+
5.**Validate the candidate before overwriting.**
108
+
- Read the candidate with **Read** to visually confirm it is well-formed JSON and that every `colors` value is a full 6-digit hex `#RRGGBB` (not 3-digit, not a named color).
109
+
- Invalid hex values are silently skipped at load (they fall back to the base palette), but fix them so the theme renders as intended.
110
+
111
+
6.**Back up and overwrite.**
112
+
- Back up the old file first — **always** create a new timestamped backup and never overwrite an existing backup: `cp <name>.json "<name>.json.$(date +%Y%m%d-%H%M%S).bak"`.
113
+
- If the target didn't exist, skip the backup.
114
+
- Overwrite with the candidate: `mv <name>.json.new <name>.json`.
85
115
86
-
Invalid values are silently skipped at load (they fall back to the base palette; not fatal), but fix them so the theme renders as intended.
87
-
6.**Tell the user how to apply it** (next section).
116
+
7.**Tell the user how to apply it** (next section).
88
117
89
118
## Applying the theme
90
119
@@ -94,7 +123,9 @@ Only set tokens from this set — unknown keys are silently ignored at load. If
94
123
95
124
## Don'ts
96
125
126
+
-**Don't start creating or editing a theme until the user has clarified light/dark, style/mood, any specific colors, and the filename.** If anything is unclear, ask — don't guess.
97
127
- Don't invent token names — only use the documented set; unknown keys are silently ignored.
98
128
- Don't write 3-digit hex or named colors — use full `#RRGGBB`.
99
-
- Before overwriting an existing theme file, **read it and back it up** (e.g. `cp <name>.json "<name>.json.$(date +%Y%m%d-%H%M%S).bak"`) so the user can recover.
129
+
- Never edit the live theme file in place; work through a candidate and validate before `mv`.
130
+
- Before overwriting an existing theme file, **read it and back it up** so the user can recover.
100
131
- Don't tell the user to restart the app to apply a theme — `/theme` or `/reload-tui` is enough.
Copy file name to clipboardExpand all lines: packages/agent-core/src/skill/builtin/update-config.md
+12-3Lines changed: 12 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,16 @@ Help the user inspect, change, and validate kimi-code's configuration files. The
9
9
10
10
## The two config files
11
11
12
-
kimi-code has two TOML config files, both under `~/.kimi-code/` (or under `KIMI_CODE_HOME` when set), both snake_case, but with different ownership — decide which one the user means before doing anything:
12
+
kimi-code has two TOML config files, both under `<KIMI_CODE_HOME>/`, both snake_case, but with different ownership — decide which one the user means before doing anything.
13
+
14
+
The runtime resolves the data directory as `KIMI_CODE_HOME` first, falling back to `~/.kimi-code`. Before doing anything, resolve the actual directory with Bash so you don't write to the wrong place. Check whether `KIMI_CODE_HOME` is set and fall back to `~/.kimi-code` when it is empty:
15
+
16
+
```bash
17
+
echo"$KIMI_CODE_HOME"
18
+
echo"$HOME/.kimi-code"
19
+
```
20
+
21
+
Use the first line when it is non-empty; otherwise use the second line. In the rest of this skill, `<KIMI_CODE_HOME>` means that resolved root — **never assume `~/.kimi-code`**.
-**`tui.toml`** — terminal-UI / client preferences: `theme`, `[editor].command`, `[notifications]`, `[upgrade].auto_install` (auto-update). These can usually also be changed with the interactive commands `/config`, `/theme`, `/editor`, which is easier — prefer pointing the user at those.
Before any modification, use **Read** on the target config file (decide whether it's `config.toml` or `tui.toml` per the above):
33
42
34
-
- Location: `~/.kimi-code/config.toml` or `~/.kimi-code/tui.toml` (under `$KIMI_CODE_HOME/` when set). For other scopes/files, defer to the official docs.
43
+
- Location: `<KIMI_CODE_HOME>/config.toml` or `<KIMI_CODE_HOME>/tui.toml`. For other scopes/files, defer to the official docs.
35
44
- A missing or empty file is fine — you'll create a minimal skeleton later.
36
45
- If the file exists but **fails to parse as TOML**, report the error verbatim and **stop** — never overwrite a broken file in place (it could destroy the user's existing config).
37
46
@@ -53,7 +62,7 @@ Don't edit the target file in place, and **don't rewrite it from scratch** — i
53
62
1.**Clarify intent**: which key, what value, and which file (`config.toml` or `tui.toml`). Ask in one line if ambiguous; for discrete choices (e.g. scope) AskUserQuestion is fine, but use plain questions for free-form input.
54
63
2.**Read the target file** (Prerequisite 2): Read it to understand the current state and confirm it parses.
55
64
3.**Copy out a candidate (do not create from scratch)**: use **Bash** to copy the target verbatim — `cp config.toml config-new.toml` (same directory, `-new` suffix; for tui.toml, `cp tui.toml tui-new.toml`). **Leave the original untouched for now.**
56
-
- Only when the target doesn't exist (nothing to copy) should you use **Write** to create a minimal skeleton candidate (e.g. just the comment line `# ~/.kimi-code/config.toml`).
65
+
- Only when the target doesn't exist (nothing to copy) should you use **Write** to create a minimal skeleton candidate (e.g. just the comment line `# <KIMI_CODE_HOME>/config.toml`).
57
66
4.**Edit the candidate**: use the **Edit** tool on the candidate to **change/add only the target key** — never rewrite the whole file. That way every existing section, entry, comment, and bit of formatting stays exactly as-is; only what should change changes. The candidate is identical to the original, so use the content you read in step 2 to locate the Edit anchor. Check the change against the official docs (key / section / value type / allowed values, snake_case).
58
67
5.**Validate the candidate** (see Capability 3, via `kimi doctor`). **If anything fails, keep Editing the candidate and re-validate, looping until it all passes.**
59
68
6.**Back up and overwrite** (only after validation fully passes):
0 commit comments