Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gateway, gui: the skills an agent lists are their own part, not memory

yetone83234fe9207f
diff --git a/internal/gateway/history.go b/internal/gateway/history.go
index 372403243..addbdd241 100644
--- a/internal/gateway/history.go
+++ b/internal/gateway/history.go
@@ -340,6 +340,7 @@ func appendRoute(routes []Route, line []byte) []Route {
return routes
}
r.routedAgain()
+ r.Prompt.skillsApart()
return append(routes, r)
}
@@ -470,6 +471,7 @@ func HistoryRoute(id int64, day time.Time) (Route, bool) {
return true
}
found.routedAgain()
+ found.Prompt.skillsApart()
return false
})
if found.ID != 0 {
diff --git a/internal/gateway/prompt.go b/internal/gateway/prompt.go
index 609115083..5796af3bd 100644
--- a/internal/gateway/prompt.go
+++ b/internal/gateway/prompt.go
@@ -1,8 +1,8 @@
package gateway
// What a request's prompt is made of: the agent's system prompt, its tool
-// definitions, the instruction files it read in (CLAUDE.md, AGENTS.md,
-// skills), the files its tools read, its tools' other output, and the
+// definitions, the skills it lists, the instruction files it read in
+// (CLAUDE.md, AGENTS.md), the files its tools read, its tools' other output, and the
// conversation, each as the tokens it takes of the model's context window.
// Read from the body the agent sent, as it sent it: the parsed Request has
// the system blocks run together, and Codex's additional_tools lifted out.
@@ -31,13 +31,14 @@ import (
const (
PartSystem = "system" // the agent's own prompt: system, developer and harness messages
PartTools = "tools" // tool definitions
- PartMemory = "memory" // instruction files, skills, reminders
+ PartSkills = "skills" // the skills the agent lists for the model to load
+ PartMemory = "memory" // instruction files, reminders
PartFiles = "files" // files and images the tools read in
PartResults = "results" // the tools' other output
PartChat = "chat" // what the user and the model said, the model's calls
)
-var partOrder = []string{PartSystem, PartTools, PartMemory, PartFiles, PartResults, PartChat}
+var partOrder = []string{PartSystem, PartTools, PartSkills, PartMemory, PartFiles, PartResults, PartChat}
// Prompt is a request's prompt, part by part.
type Prompt struct {
@@ -236,6 +237,40 @@ func (b *promptBuilder) prompt() *Prompt {
return p
}
+// skillsApart reads a prompt kept when the skills were memory: they are
+// their own part, before it.
+func (p *Prompt) skillsApart() {
+ if p == nil {
+ return
+ }
+ for i, x := range p.Parts {
+ if x.Kind != PartMemory {
+ continue
+ }
+ skills := PromptPart{Kind: PartSkills}
+ kept := x.Items[:0:0]
+ for _, it := range x.Items {
+ if it.Tag == "skills" {
+ skills.Tokens += it.Tokens
+ skills.Items = append(skills.Items, it)
+ } else {
+ kept = append(kept, it)
+ }
+ }
+ if skills.Tokens == 0 {
+ return
+ }
+ x.Tokens -= skills.Tokens
+ x.Items = kept
+ parts := append(append(p.Parts[:i:i], skills), x)
+ if x.Tokens <= 0 {
+ parts = parts[:i+1]
+ }
+ p.Parts = append(parts, p.Parts[i+1:]...)
+ return
+ }
+}
+
// promptOf reads what a request's prompt holds; nil when the body isn't
// one it can read.
func promptOf(from provider.Protocol, body []byte) (p *Prompt) {
@@ -370,6 +405,28 @@ func (b *promptBuilder) splitMemory(text string) string {
return rest.String()
}
+// skillsList heads the skills Claude Code lists, in its own prompt or a
+// reminder; the list runs to the next blank line.
+const skillsList = "The following skills are available for use with the Skill tool:"
+
+// splitSkills takes the list of skills out of a text, as skills, and
+// returns what is left.
+func (b *promptBuilder) splitSkills(text, role string) string {
+ at := strings.Index(text, skillsList)
+ if at < 0 {
+ return text
+ }
+ body := text[at+len(skillsList):]
+ items := strings.TrimLeft(body, "\n")
+ end := len(text)
+ if j := strings.Index(items, "\n\n"); j >= 0 {
+ end -= len(items) - j
+ }
+ list := text[at:end]
+ b.add(PartSkills, "skills", "skills", tokensOf(list), txt(role, list))
+ return text[:at] + strings.TrimLeft(text[end:], "\n")
+}
+
// harnessName names a system or developer text by its leading tag, or
// what it is.
func harnessName(text, fallback string) string {
@@ -385,9 +442,12 @@ func harnessName(text, fallback string) string {
// systemText adds the agent's own prompt, with the instruction files in
// it taken out as memory.
func (b *promptBuilder) systemText(text, name string) {
- rest := b.splitMemory(text)
+ rest := b.splitSkills(b.splitMemory(text), "system")
if strings.HasPrefix(strings.TrimSpace(rest), "<skills_instructions>") {
- b.add(PartMemory, "skills", "skills", tokensOf(rest), txt("system", rest))
+ b.add(PartSkills, "skills", "skills", tokensOf(rest), txt("system", rest))
+ return
+ }
+ if strings.TrimSpace(rest) == "" {
return
}
b.add(PartSystem, harnessName(rest, name), "", tokensOf(rest), txt("system", rest))
@@ -399,7 +459,7 @@ func (b *promptBuilder) userText(text string) (said bool) {
t := strings.TrimSpace(text)
switch {
case strings.HasPrefix(t, "<system-reminder>"):
- rest := b.splitMemory(t)
+ rest := b.splitSkills(b.splitMemory(t), "user")
rest = strings.TrimSpace(strings.TrimSuffix(strings.TrimPrefix(strings.TrimSpace(rest), "<system-reminder>"), "</system-reminder>"))
if rest != "" {
b.add(PartMemory, "reminders", "reminder", tokensOf(rest), txt("user", rest))
diff --git a/internal/gateway/prompt_test.go b/internal/gateway/prompt_test.go
index 8dfc69b11..36a900807 100644
--- a/internal/gateway/prompt_test.go
+++ b/internal/gateway/prompt_test.go
@@ -8,6 +8,7 @@ import (
"net/http/httptest"
"os"
"slices"
+ "strconv"
"strings"
"testing"
@@ -98,6 +99,75 @@ func TestPromptOfClaudeCode(t *testing.T) {
}
}
+// Claude Code 2.1's skills, listed in its environment message as the
+// agent sent it (testdata/workdir): they are skills, apart from the
+// environment notes around them, and memory has none of them.
+func TestPromptOfClaudeCodeSkills(t *testing.T) {
+ p := fixturePrompt(t, "../workdir/claude-code-2.1.296.json", provider.Anthropic)
+ sk, ok := itemOf(p, PartSkills, "skills")
+ if !ok || sk.Tokens < 1000 {
+ t.Fatalf("skills %+v", partOf(p, PartSkills))
+ }
+ env, ok := itemOf(p, PartSystem, "environment")
+ if !ok || env.Tokens > 1000 {
+ t.Fatalf("the environment notes still hold the skills %+v", env)
+ }
+ if _, ok := itemOf(p, PartMemory, "skills"); ok {
+ t.Fatalf("the skills are memory too %+v", partOf(p, PartMemory))
+ }
+ var kinds []string
+ for _, x := range p.Parts {
+ kinds = append(kinds, x.Kind)
+ }
+ if !slices.Equal(kinds[:3], []string{PartSystem, PartTools, PartSkills}) {
+ t.Fatalf("parts %v", kinds)
+ }
+}
+
+// The list runs to the next blank line, and what follows it stays where
+// it was.
+func TestSplitSkillsEnds(t *testing.T) {
+ b := newPromptBuilder()
+ rest := b.splitSkills("Notes.\n\n"+skillsList+"\n\n- a: one\n more of a\n- b: two\n\nToday's date is 2026-10-24.", "user")
+ if rest != "Notes.\n\nToday's date is 2026-10-24." {
+ t.Fatalf("rest %q", rest)
+ }
+ if it, ok := itemOf(b.prompt(), PartSkills, "skills"); !ok || it.Tokens != tokensOf(skillsList+"\n\n- a: one\n more of a\n- b: two") {
+ t.Fatalf("skills %+v", it)
+ }
+ if rest := b.splitSkills("no list here", "user"); rest != "no list here" {
+ t.Fatalf("no list %q", rest)
+ }
+}
+
+// A prompt kept when the skills were memory is read with them apart, and
+// a memory part they made up alone goes.
+func TestSkillsApartOfKeptPrompt(t *testing.T) {
+ p := &Prompt{Tokens: 60, Parts: []PromptPart{
+ {Kind: PartTools, Tokens: 10, Items: []PromptItem{{Name: "Bash", Tokens: 10}}},
+ {Kind: PartMemory, Tokens: 30, Items: []PromptItem{{Name: "skills", Tag: "skills", Tokens: 20}, {Name: "/p/AGENTS.md", Tag: "project", Tokens: 10}}},
+ {Kind: PartChat, Tokens: 20, Items: []PromptItem{{Name: "1", Tag: "turn", Tokens: 20}}},
+ }}
+ p.skillsApart()
+ var got []string
+ for _, x := range p.Parts {
+ got = append(got, x.Kind+":"+strconv.Itoa(x.Tokens))
+ }
+ if !slices.Equal(got, []string{"tools:10", "skills:20", "memory:10", "chat:20"}) {
+ t.Fatalf("parts %v", got)
+ }
+ if _, ok := itemOf(p, PartMemory, "skills"); ok {
+ t.Fatal("still memory")
+ }
+ alone := &Prompt{Parts: []PromptPart{{Kind: PartMemory, Tokens: 20, Items: []PromptItem{{Name: "skills", Tag: "skills", Tokens: 20}}}}}
+ alone.skillsApart()
+ if len(alone.Parts) != 1 || alone.Parts[0].Kind != PartSkills {
+ t.Fatalf("alone %+v", alone.Parts)
+ }
+ var none *Prompt
+ none.skillsApart()
+}
+
// A Codex request, as Codex 0.1xx sends ChatGPT's backend: its tools come
// in additional_tools, its own functions one by one and any other
// namespace as one; AGENTS.md comes as a user message; the skills list as
@@ -107,8 +177,11 @@ func TestPromptOfCodex(t *testing.T) {
if it, ok := itemOf(p, PartMemory, "/home/dev/proj/AGENTS.md"); !ok || it.Tag != "project" {
t.Fatalf("AGENTS.md %+v", partOf(p, PartMemory))
}
- if it, ok := itemOf(p, PartMemory, "skills"); !ok || it.Tag != "skills" {
- t.Fatalf("skills %+v", partOf(p, PartMemory))
+ if it, ok := itemOf(p, PartSkills, "skills"); !ok || it.Tag != "skills" {
+ t.Fatalf("skills %+v", partOf(p, PartSkills))
+ }
+ if _, ok := itemOf(p, PartMemory, "skills"); ok {
+ t.Fatalf("the skills are memory too %+v", partOf(p, PartMemory))
}
if it, ok := itemOf(p, PartTools, "collaboration"); !ok || it.Tag != "namespace" || it.N < 2 {
t.Fatalf("collaboration %+v", partOf(p, PartTools))
diff --git a/internal/gui/assets/context.css b/internal/gui/assets/context.css
index 5bebf5d38..96cb9926f 100644
--- a/internal/gui/assets/context.css
+++ b/internal/gui/assets/context.css
@@ -1,12 +1,13 @@
/* Context windows: a request's prompt as a card (Routing, the Usage page's
Context tab) and each agent's score and tags. */
:root {
- --k-system: var(--c6); --k-tools: var(--c2); --k-memory: var(--c4);
+ --k-system: var(--c6); --k-tools: var(--c2); --k-skills: var(--c7); --k-memory: var(--c4);
--k-files: var(--c3); --k-results: var(--c5); --k-chat: var(--c1);
--k-free: color-mix(in srgb, var(--fg) 7%, transparent);
}
.k-system { --k: var(--k-system); }
.k-tools { --k: var(--k-tools); }
+.k-skills { --k: var(--k-skills); }
.k-memory { --k: var(--k-memory); }
.k-files { --k: var(--k-files); }
.k-results { --k: var(--k-results); }
@@ -68,7 +69,7 @@ i.dot.free { background: var(--k-free); box-shadow: inset 0 0 0 1px color-mix(in
.ctx-waffle > i.free { --k: var(--k-free); }
@keyframes ctx-cell { from { opacity: 0; transform: scale(.4); } }
.ctx-waffle[data-f] > i { opacity: .16; }
-.ctx-waffle[data-f="system"] > i.k-system, .ctx-waffle[data-f="tools"] > i.k-tools,
+.ctx-waffle[data-f="system"] > i.k-system, .ctx-waffle[data-f="tools"] > i.k-tools, .ctx-waffle[data-f="skills"] > i.k-skills,
.ctx-waffle[data-f="memory"] > i.k-memory, .ctx-waffle[data-f="files"] > i.k-files,
.ctx-waffle[data-f="results"] > i.k-results, .ctx-waffle[data-f="chat"] > i.k-chat,
.ctx-waffle[data-f="free"] > i.free, .ctx-waffle[data-f="item"] > i.on { opacity: 1; }
@@ -373,7 +374,7 @@ i.dot.free { background: var(--k-free); box-shadow: inset 0 0 0 1px color-mix(in
.ctx-tile.free .v { color: color-mix(in srgb, var(--muted) 78%, transparent); }
.ctx-tile.gone { pointer-events: none; }
.ctx-map[data-f] > .ctx-tile { opacity: .32; }
-.ctx-map[data-f="system"] > .k-system, .ctx-map[data-f="tools"] > .k-tools,
+.ctx-map[data-f="system"] > .k-system, .ctx-map[data-f="tools"] > .k-tools, .ctx-map[data-f="skills"] > .k-skills,
.ctx-map[data-f="memory"] > .k-memory, .ctx-map[data-f="files"] > .k-files,
.ctx-map[data-f="results"] > .k-results, .ctx-map[data-f="chat"] > .k-chat,
.ctx-map[data-f="free"] > .free, .ctx-map[data-f="tile"] > .on { opacity: 1; }
diff --git a/internal/gui/assets/context.js b/internal/gui/assets/context.js
index 31152045b..4ed66c668 100644
--- a/internal/gui/assets/context.js
+++ b/internal/gui/assets/context.js
@@ -7,14 +7,15 @@
// page's Context tab scores each agent's use of its window, tags it, and
// lists its sessions' fill request by request.
(() => {
- const PARTS = ["system", "tools", "memory", "files", "results", "chat"];
+ const PARTS = ["system", "tools", "skills", "memory", "files", "results", "chat"];
const PART_NAMES = {
- system: "System prompt", tools: "Tools", memory: "Memory",
+ system: "System prompt", tools: "Tools", skills: "Skills", memory: "Memory",
files: "Files", results: "Tool results", chat: "Conversation",
};
const PART_NOTES = {
system: "The agent's own instructions",
tools: "The definitions of the tools it can call",
+ skills: "The skills it can load, by name and what each is for",
memory: "Instruction files, memory and reminders",
files: "Files it read, and images",
results: "What the other tools it called returned",
@@ -972,13 +973,11 @@
confirmAsk = ed;
openModal(ed);
$("#modal").classList.add("lib");
- const gone = (list) => {
- body.replaceChildren(el("p", "ctx-view-gone", t("This request's text is no longer kept: magpie keeps the text of the last {n} requests, in memory only, while it runs.", { n: list?.kept || 10 })));
- };
+ const gone = (n) => el("p", "ctx-view-gone", t("This request's text is no longer kept: magpie keeps the text of the last {n} requests, in memory only, while it runs.", { n }));
let list;
try { list = await readText(id, kind); } catch (err) { body.replaceChildren(el("p", "ctx-view-gone", err.message)); return; }
if (confirmAsk !== ed) return;
- if (!list) return gone();
+ if (!list) return body.replaceChildren(gone(10));
const items = list.items || [];
total.textContent = fmtK(items.reduce((s, it) => s + it.tokens, 0)) + " " + t("tokens");
const note = el("p", "ctx-view-note", t("As magpie sent it, masked where masking is on. Kept in memory for the last {n} requests only.", { n: list.kept }));
@@ -1008,7 +1007,7 @@
text.replaceChildren(el("div", "ctx-view-wait", t("Reading…")));
read = readText(id, kind, i).then((one) => {
const pieces = one?.items?.[i]?.pieces;
- if (!pieces) { read = null; text.replaceChildren(el("p", "ctx-view-gone", t("This request's text is no longer kept: magpie keeps the text of the last {n} requests, in memory only, while it runs.", { n: list.kept }))); return; }
+ if (!pieces) { read = null; text.replaceChildren(gone(list.kept)); return; }
text.replaceChildren(...(pieces.length ? pieces.map(pieceView) : [el("div", "ctx-piece-note", t("Empty"))]));
}).catch((err) => { read = null; text.replaceChildren(el("p", "ctx-view-gone", err.message)); });
};
diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js
index 2f1da3b86..cfd3be2f8 100644
--- a/internal/gui/assets/i18n.js
+++ b/internal/gui/assets/i18n.js
@@ -153,6 +153,7 @@ const I18N = {
"Tool results": "工具结果",
"The agent's own instructions": "agent 自带的指令",
"The definitions of the tools it can call": "它可调用的工具的定义",
+ "The skills it can load, by name and what each is for": "它可加载的技能:每个的名字和用途",
"Instruction files, memory and reminders": "指令文件、记忆和提醒",
"Files it read, and images": "它读取的文件和图片",
"What the other tools it called returned": "它调用的其他工具返回的内容",
@@ -4099,6 +4100,7 @@ const I18N = {
"Tool results": "工具結果",
"The agent's own instructions": "agent 自帶的指令",
"The definitions of the tools it can call": "它可呼叫的工具的定義",
+ "The skills it can load, by name and what each is for": "它可載入的技能:每個的名稱和用途",
"Instruction files, memory and reminders": "指令檔案、記憶和提醒",
"Files it read, and images": "它讀取的檔案和圖片",
"What the other tools it called returned": "它呼叫的其他工具傳回的內容",
@@ -7992,6 +7994,7 @@ const I18N = {
"Tool results": "ツールの結果",
"The agent's own instructions": "エージェント自身の指示",
"The definitions of the tools it can call": "呼び出せるツールの定義",
+ "The skills it can load, by name and what each is for": "読み込めるスキル:それぞれの名前と用途",
"Instruction files, memory and reminders": "指示ファイル、メモリ、リマインダー",
"Files it read, and images": "読み込んだファイルと画像",
"What the other tools it called returned": "呼び出したその他のツールが返した内容",
@@ -11906,6 +11909,7 @@ const I18N = {
"Tool results": "Tool-Ergebnisse",
"The agent's own instructions": "Die eigenen Anweisungen des Agents",
"The definitions of the tools it can call": "Die Definitionen der Tools, die er aufrufen kann",
+ "The skills it can load, by name and what each is for": "Die Skills, die er laden kann: jeweils Name und Zweck",
"Instruction files, memory and reminders": "Anweisungsdateien, Memory und Erinnerungen",
"Files it read, and images": "Gelesene Dateien und Bilder",
"What the other tools it called returned": "Was die übrigen aufgerufenen Tools zurückgaben",
diff --git a/internal/gui/context.go b/internal/gui/context.go
index a441836db..4b46ae35a 100644
--- a/internal/gui/context.go
+++ b/internal/gui/context.go
@@ -284,7 +284,7 @@ func contextOf(routes []gateway.Route, days int) ctxJSON {
}
acc.a.Requests++
acc.prompts = append(acc.prompts, p.Tokens)
- acc.bases = append(acc.bases, partTokens(p, gateway.PartSystem, gateway.PartTools, gateway.PartMemory))
+ acc.bases = append(acc.bases, partTokens(p, gateway.PartSystem, gateway.PartTools, gateway.PartSkills, gateway.PartMemory))
acc.mcps = append(acc.mcps, mcpTokens(p))
for _, x := range p.Parts {
acc.parts[x.Kind] += x.Tokens
diff --git a/internal/gui/tests/context-map.test.cjs b/internal/gui/tests/context-map.test.cjs
index 2845ea03b..10a596f8f 100644
--- a/internal/gui/tests/context-map.test.cjs
+++ b/internal/gui/tests/context-map.test.cjs
@@ -22,7 +22,8 @@ const latest = {
parts: [
{ kind: "system", tokens: 5200, items: [{ name: "prompt", tokens: 4900 }, { name: "environment_context", tokens: 300 }] },
{ kind: "tools", tokens: 5000, items: [{ name: "multi_agent_v1", tag: "namespace", n: 5, tokens: 2900 }, { name: "exec_command", tokens: 2100 }] },
- { kind: "memory", tokens: 3300, items: [{ name: "skills", tag: "skills", tokens: 3300 }] },
+ { kind: "skills", tokens: 2600, items: [{ name: "skills", tag: "skills", tokens: 2600 }] },
+ { kind: "memory", tokens: 700, items: [{ name: "/work/app/AGENTS.md", tag: "project", tokens: 700 }] },
{ kind: "files", tokens: 5900, items: [{ name: "/work/app/prompt.go", tag: "shell", tokens: 2950 }, { name: "/work/app/context.go", tag: "shell", tokens: 2950 }] },
{ kind: "results", tokens: 1200, items: [{ name: "exec_command", tag: "result", n: 4, tokens: 1200 }] },
{ kind: "chat", tokens: 800, items: [{ name: "turn", tag: "turn", n: 3, tokens: 800 }] },
@@ -60,7 +61,8 @@ const texts = {
{ name: "exec_command", tokens: 2100, pieces: [{ role: "tool", name: "exec_command", text: "{\n \"name\": \"exec_command\",\n \"description\": \"Runs a command in a PTY\"\n}" }] }],
files: [{ name: "/work/app/prompt.go", tag: "shell", tokens: 2950, pieces: [{ role: "result", name: "exec_command", text: "package gateway // prompt.go" }] },
{ name: "/work/app/context.go", tag: "shell", tokens: 2950, pieces: [{ role: "result", name: "exec_command", text: "package gui // context.go" }] }],
- memory: [{ name: "skills", tag: "skills", tokens: 3300, pieces: [{ role: "system", text: "## Skills" }] }],
+ skills: [{ name: "skills", tag: "skills", tokens: 2600, pieces: [{ role: "system", text: "## Skills" }] }],
+ memory: [{ name: "/work/app/AGENTS.md", tag: "project", tokens: 700, pieces: [{ role: "user", text: "# AGENTS.md" }] }],
results: [{ name: "exec_command", tag: "result", n: 4, tokens: 1200, pieces: [{ role: "result", name: "exec_command", text: "ok" }] }],
chat: [{ name: "1", tag: "turn", tokens: 300, pieces: [{ role: "user", text: "port the parser" }, { role: "thinking", text: "", size: 900 }, { role: "call", name: "exec_command", text: "{\"cmd\": \"ls\"}" }] },
{ name: "2", tag: "turn", tokens: 500, pieces: [{ role: "image", src: PNG }, { role: "image" }, { role: "assistant", text: "Done." }] }],
@@ -128,11 +130,11 @@ async function wheelTo(page, l) {
}
const words = {
- en: { tools: "Tools", close: "Close", free: "Free space", map: "Context map", grid: "Block grid" },
- zh: { tools: "工具", close: "关闭", free: "剩余空间", map: "上下文地图", grid: "方格" },
- "zh-TW": { tools: "工具", close: "關閉", free: "剩餘空間", map: "上下文地圖", grid: "方格" },
- ja: { tools: "ツール", close: "閉じる", free: "空き", map: "コンテキストマップ", grid: "ブロックグリッド" },
- de: { tools: "Tools", close: "Schließen", free: "Frei", map: "Kontextkarte", grid: "Blockraster" },
+ en: { tools: "Tools", skills: "Skills", memory: "Memory", close: "Close", free: "Free space", map: "Context map", grid: "Block grid" },
+ zh: { tools: "工具", skills: "技能", memory: "记忆", close: "关闭", free: "剩余空间", map: "上下文地图", grid: "方格" },
+ "zh-TW": { tools: "工具", skills: "技能", memory: "記憶", close: "關閉", free: "剩餘空間", map: "上下文地圖", grid: "方格" },
+ ja: { tools: "ツール", skills: "スキル", memory: "メモリ", close: "閉じる", free: "空き", map: "コンテキストマップ", grid: "ブロックグリッド" },
+ de: { tools: "Tools", skills: "Skills", memory: "Memory", close: "Schließen", free: "Frei", map: "Kontextkarte", grid: "Blockraster" },
};
@@ -200,6 +202,18 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.mouse.move(2, 2);
await tip.waitFor({ state: "hidden" });
+ // the skills are their own part, not memory (the owner 10-24: 技能 / 记忆)
+ await map.locator(".ctx-tile.k-skills").hover();
+ await tip.waitFor({ state: "visible" });
+ const said = await tip.innerText();
+ assert.match(said, new RegExp(w.skills));
+ assert.doesNotMatch(said, new RegExp(w.memory), "the skills' tip names memory");
+ assert.equal(await map.locator(".ctx-tile.k-memory").count(), 1, "the skills are a memory tile too");
+ assert.notEqual(await map.locator(".ctx-tile.k-skills").evaluate((n) => getComputedStyle(n).backgroundColor),
+ await map.locator(".ctx-tile.k-memory").evaluate((n) => getComputedStyle(n).backgroundColor), "the skills are memory's colour");
+ await page.mouse.move(2, 2);
+ await tip.waitFor({ state: "hidden" });
+
// a refresh with the same window keeps the tiles where they are
const kept = await tile.elementHandle();
await page.evaluate(() => window.loadContext());
diff --git a/internal/gui/tests/context-scroll-end.test.cjs b/internal/gui/tests/context-scroll-end.test.cjs
index a3feefc0b..afaad58df 100644
--- a/internal/gui/tests/context-scroll-end.test.cjs
+++ b/internal/gui/tests/context-scroll-end.test.cjs
@@ -20,7 +20,7 @@ const latest = {
parts: [
{ kind: "system", tokens: 5200, items: [{ name: "prompt", tokens: 4900 }, { name: "environment_context", tokens: 300 }] },
{ kind: "tools", tokens: 5000, items: [{ name: "multi_agent_v1", tag: "namespace", n: 5, tokens: 2900 }, { name: "exec_command", tokens: 2100 }] },
- { kind: "memory", tokens: 3300, items: [{ name: "skills", tag: "skills", tokens: 3300 }] },
+ { kind: "skills", tokens: 3300, items: [{ name: "skills", tag: "skills", tokens: 3300 }] },
{ kind: "files", tokens: 5900, items: [{ name: "/work/app/prompt.go", tag: "shell", tokens: 2950 }, { name: "/work/app/context.go", tag: "shell", tokens: 2950 }] },
{ kind: "results", tokens: 1200, items: [{ name: "exec_command", tag: "result", n: 4, tokens: 1200 }] },
{ kind: "chat", tokens: 800, items: [{ name: "turn", tag: "turn", n: 3, tokens: 800 }] },
diff --git a/internal/gui/tests/context-text.test.cjs b/internal/gui/tests/context-text.test.cjs
index 55df8902b..b9a322359 100644
--- a/internal/gui/tests/context-text.test.cjs
+++ b/internal/gui/tests/context-text.test.cjs
@@ -21,7 +21,7 @@ const latest = {
parts: [
{ kind: "system", tokens: 5200, items: [{ name: "prompt", tokens: 4900 }, { name: "environment_context", tokens: 300 }] },
{ kind: "tools", tokens: 5000, items: [{ name: "multi_agent_v1", tag: "namespace", n: 5, tokens: 2900 }, { name: "exec_command", tokens: 2100 }] },
- { kind: "memory", tokens: 3300, items: [{ name: "skills", tag: "skills", tokens: 3300 }] },
+ { kind: "skills", tokens: 3300, items: [{ name: "skills", tag: "skills", tokens: 3300 }] },
{ kind: "files", tokens: 5900, items: [{ name: "/work/app/prompt.go", tag: "shell", tokens: 2950 }, { name: "/work/app/context.go", tag: "shell", tokens: 2950 }] },
{ kind: "results", tokens: 1200, items: [{ name: "exec_command", tag: "result", n: 4, tokens: 1200 }] },
{ kind: "chat", tokens: 800, items: [{ name: "turn", tag: "turn", n: 3, tokens: 800 }] },
@@ -57,7 +57,7 @@ const texts = {
{ name: "exec_command", tokens: 2100, pieces: [{ role: "tool", name: "exec_command", text: "{\n \"name\": \"exec_command\",\n \"description\": \"Runs a command in a PTY\"\n}" }] }],
files: [{ name: "/work/app/prompt.go", tag: "shell", tokens: 2950, pieces: [{ role: "result", name: "exec_command", text: "package gateway // prompt.go" }] },
{ name: "/work/app/context.go", tag: "shell", tokens: 2950, pieces: [{ role: "result", name: "exec_command", text: "package gui // context.go" }] }],
- memory: [{ name: "skills", tag: "skills", tokens: 3300, pieces: [{ role: "system", text: "## Skills" }] }],
+ skills: [{ name: "skills", tag: "skills", tokens: 3300, pieces: [{ role: "system", text: "## Skills" }] }],
results: [{ name: "exec_command", tag: "result", n: 4, tokens: 1200, pieces: [{ role: "result", name: "exec_command", text: "ok" }] }],
chat: [{ name: "1", tag: "turn", tokens: 300, pieces: [{ role: "user", text: "port the parser" }, { role: "thinking", text: "", size: 900 }, { role: "call", name: "exec_command", text: "{\"cmd\": \"ls\"}" }] },
{ name: "2", tag: "turn", tokens: 500, pieces: [{ role: "image" }, { role: "assistant", text: "Done." }] }],
diff --git a/internal/gui/tests/context-window.test.cjs b/internal/gui/tests/context-window.test.cjs
index acc6301a7..6336fd8a9 100644
--- a/internal/gui/tests/context-window.test.cjs
+++ b/internal/gui/tests/context-window.test.cjs
@@ -21,7 +21,7 @@ const latest = {
parts: [
{ kind: "system", tokens: 5200, items: [{ name: "prompt", tokens: 4900 }, { name: "environment_context", tokens: 300 }] },
{ kind: "tools", tokens: 5000, items: [{ name: "multi_agent_v1", tag: "namespace", n: 5, tokens: 2900 }, { name: "exec_command", tokens: 2100 }] },
- { kind: "memory", tokens: 3300, items: [{ name: "skills", tag: "skills", tokens: 3300 }] },
+ { kind: "skills", tokens: 3300, items: [{ name: "skills", tag: "skills", tokens: 3300 }] },
{ kind: "files", tokens: 5900, items: [{ name: "/work/app/prompt.go", tag: "shell", tokens: 2950 }, { name: "/work/app/context.go", tag: "shell", tokens: 2950 }] },
{ kind: "results", tokens: 1200, items: [{ name: "exec_command", tag: "result", n: 4, tokens: 1200 }] },
{ kind: "chat", tokens: 800, items: [{ name: "turn", tag: "turn", n: 3, tokens: 800 }] },
diff --git a/internal/gui/tests/routing-context-fold.test.cjs b/internal/gui/tests/routing-context-fold.test.cjs
index 098341b20..dab71e9c3 100644
--- a/internal/gui/tests/routing-context-fold.test.cjs
+++ b/internal/gui/tests/routing-context-fold.test.cjs
@@ -124,9 +124,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await fold.innerText(), words[lang]);
assert.equal(await box.locator(".ctx-short").innerText(), "186K / 272K · 68%");
assert.match(await box.locator(".ctx-crumbs").textContent(), /#112$/);
- // a bar of what fills the window, a part each (this prompt has no memory)
+ // a bar of what fills the window, a part each (this prompt has no skills or memory)
assert.deepEqual(await box.locator(".ctx-stack > i").evaluateAll((is) => is.map((i) => i.className + " " + i.style.width)),
- ["k-system 3.31%", "k-tools 4.41%", "k-memory 0%", "k-files 28.68%", "k-results 16.18%", "k-chat 15.81%"]);
+ ["k-system 3.31%", "k-tools 4.41%", "k-skills 0%", "k-memory 0%", "k-files 28.68%", "k-results 16.18%", "k-chat 15.81%"]);
const at = await page.evaluate(() => {
const r = (s) => document.querySelector(s).getBoundingClientRect();
const card = r(".rt-ctx .ctx-card"), head = r(".rt-ctx .ctx-head"), bar = r(".rt-ctx .ctx-stack"), c = document.querySelector(".rt-ctx .ctx-card");