bots-garden/mini-mepublic Fork
⑂ 9253ed6
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/mini-me.git
git clone ssh://git@rickub.com/bots-garden/mini-me.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

✨ metaPrompts: your own meta-prompts in the agent file (#272)

A `metaPrompts:` list (prefix, description) adds entries to the window's
`[` picker after the 13 built-ins; a built-in's label replaces it in
place. Checked at load. Demo demos/meta-prompts (Wren, Qwen3.5 4B):
the model reads only the prefix, so a custom one needs its meaning in
`system` — measured with and without. Tests, docs EN+FR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agent committed 2026-11-26T22:05:42+01:00 Browse files
9253ed6 parent: cf8a720
added .tickets/issues/0272-metaprompts-your-own-meta-prompts-in-the-config-file.yaml +108 -0
new file mode 100644
@@ -0,0 +1,108 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 272
3+title: "metaPrompts: your own meta-prompts in the agent file, for the [ picker"
4+state: closed
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-27T06:30:00.000Z
9+updatedAt: 2026-11-27T07:00:00.000Z
10+closedAt: 2026-11-27T07:00:00.000Z
11+labels:
12+ - enhancement
13+ - kind::feature
14+ - demo
15+milestone: v2.1.1
16+epic: Improve TUI
17+related:
18+ - 270
19+body: |
20+ ## Asked (user, 2026-11-27)
21+ Let me add my own meta-prompts in the configuration file — and a demo
22+ agent for it. Follows ticket 270 (the `[` picker, 13 hard-coded entries).
23+
24+ ## Design
25+ ```yaml
26+ metaPrompts:
27+ - prefix: "[Haiku]"
28+ description: Answer as a haiku (5-7-5)
29+ - prefix: "[Brief]" # a built-in's label: replaces it, in place
30+ description: Two sentences at most
31+ ```
32+ - Added after the 13 built-ins, in the order given; a label that is a
33+ built-in's (case ignored) replaces that one in its place.
34+ - Checked at load: "[name]" (one pair of brackets, non-empty name, one
35+ line), a description, no label twice.
36+ - Window only: the `[` picker is the window's (270). The line mode and an
37+ editor take a prefix typed by hand.
38+
39+ ## Finding (demos/meta-prompts, Qwen3.5 4B)
40+ The description is shown to the USER; the model reads only the prefix.
41+ Without an explanation in `system`, `[Commit Message] …` got a compliment
42+ instead of a commit message and `[Tweet]` went over 280 characters; with
43+ it, both worked. So a custom prefix needs its meaning in `system`.
44+
45+ ## Open questions (for the user)
46+ - An optional `instruction:` per entry that mm appends to the system
47+ prompt itself ("[Tweet]: one post of 280 characters at most"), so the
48+ meaning is written once? Cost: tokens on every call, for prefixes used
49+ now and then.
50+ - A switch to hide the built-ins (`metaPromptsBuiltin: false`) for an
51+ agent whose own list is all it needs?
52+tasks:
53+ - id: 1
54+ title: "config: metaPrompts list (prefix, description), validation — with tests"
55+ state: closed
56+ priority: medium
57+ author:
58+ name: k33g
59+ email: ph.charriere@gmail.com
60+ createdAt: 2026-11-27T06:30:00.000Z
61+ updatedAt: 2026-11-27T06:30:00.000Z
62+ closedAt: 2026-11-27T06:30:00.000Z
63+ - id: 2
64+ title: "metaprompt: Merge (replace in place / add after) and Configured; the window gets the merged catalogue — with tests"
65+ state: closed
66+ priority: medium
67+ author:
68+ name: k33g
69+ email: ph.charriere@gmail.com
70+ createdAt: 2026-11-27T06:30:00.000Z
71+ updatedAt: 2026-11-27T06:30:00.000Z
72+ closedAt: 2026-11-27T06:30:00.000Z
73+ - id: 3
74+ title: "Demo demos/meta-prompts (Wren), measured with and without the explanation in system"
75+ state: closed
76+ priority: medium
77+ author:
78+ name: k33g
79+ email: ph.charriere@gmail.com
80+ createdAt: 2026-11-27T06:30:00.000Z
81+ updatedAt: 2026-11-27T06:30:00.000Z
82+ closedAt: 2026-11-27T06:30:00.000Z
83+ - id: 4
84+ title: "Docs EN+FR: configuration reference (key, section, validation errors), the four pickers"
85+ state: closed
86+ priority: low
87+ author:
88+ name: k33g
89+ email: ph.charriere@gmail.com
90+ createdAt: 2026-11-27T06:30:00.000Z
91+ updatedAt: 2026-11-27T06:30:00.000Z
92+ closedAt: 2026-11-27T06:30:00.000Z
93+comments:
94+ - id: 1
95+ author:
96+ name: k33g
97+ email: ph.charriere@gmail.com
98+ createdAt: 2026-11-27T06:30:00.000Z
99+ body: |
100+ Done on branch feature/custom-meta-prompts (not merged yet):
101+ internal/config/metaprompts.go (+test), config.Cfg.MetaPrompts and its
102+ validation; internal/metaprompt Merge/Configured, Matching(list, typed);
103+ tui Options.MetaPrompts → View.metas (nil = built-ins), main.go passes
104+ metaprompt.Configured(). Tests: config, metaprompt (Merge, Configured),
105+ tui TestBracketPickerOffersTheAgentsOwn. go test ./..., vet, gofmt
106+ clean. Live: the catalogue loaded from the demo's file (17 entries);
107+ -p runs with and without the explanation (README). Window not tried
108+ live.
new file mode 100644
@@ -0,0 +1,108 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 272
3+title: "metaPrompts: your own meta-prompts in the agent file, for the [ picker"
4+state: closed
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-27T06:30:00.000Z
9+updatedAt: 2026-11-27T07:00:00.000Z
10+closedAt: 2026-11-27T07:00:00.000Z
11+labels:
12+ - enhancement
13+ - kind::feature
14+ - demo
15+milestone: v2.1.1
16+epic: Improve TUI
17+related:
18+ - 270
19+body: |
20+ ## Asked (user, 2026-11-27)
21+ Let me add my own meta-prompts in the configuration file — and a demo
22+ agent for it. Follows ticket 270 (the `[` picker, 13 hard-coded entries).
23+
24+ ## Design
25+ ```yaml
26+ metaPrompts:
27+ - prefix: "[Haiku]"
28+ description: Answer as a haiku (5-7-5)
29+ - prefix: "[Brief]" # a built-in's label: replaces it, in place
30+ description: Two sentences at most
31+ ```
32+ - Added after the 13 built-ins, in the order given; a label that is a
33+ built-in's (case ignored) replaces that one in its place.
34+ - Checked at load: "[name]" (one pair of brackets, non-empty name, one
35+ line), a description, no label twice.
36+ - Window only: the `[` picker is the window's (270). The line mode and an
37+ editor take a prefix typed by hand.
38+
39+ ## Finding (demos/meta-prompts, Qwen3.5 4B)
40+ The description is shown to the USER; the model reads only the prefix.
41+ Without an explanation in `system`, `[Commit Message] …` got a compliment
42+ instead of a commit message and `[Tweet]` went over 280 characters; with
43+ it, both worked. So a custom prefix needs its meaning in `system`.
44+
45+ ## Open questions (for the user)
46+ - An optional `instruction:` per entry that mm appends to the system
47+ prompt itself ("[Tweet]: one post of 280 characters at most"), so the
48+ meaning is written once? Cost: tokens on every call, for prefixes used
49+ now and then.
50+ - A switch to hide the built-ins (`metaPromptsBuiltin: false`) for an
51+ agent whose own list is all it needs?
52+tasks:
53+ - id: 1
54+ title: "config: metaPrompts list (prefix, description), validation — with tests"
55+ state: closed
56+ priority: medium
57+ author:
58+ name: k33g
59+ email: ph.charriere@gmail.com
60+ createdAt: 2026-11-27T06:30:00.000Z
61+ updatedAt: 2026-11-27T06:30:00.000Z
62+ closedAt: 2026-11-27T06:30:00.000Z
63+ - id: 2
64+ title: "metaprompt: Merge (replace in place / add after) and Configured; the window gets the merged catalogue — with tests"
65+ state: closed
66+ priority: medium
67+ author:
68+ name: k33g
69+ email: ph.charriere@gmail.com
70+ createdAt: 2026-11-27T06:30:00.000Z
71+ updatedAt: 2026-11-27T06:30:00.000Z
72+ closedAt: 2026-11-27T06:30:00.000Z
73+ - id: 3
74+ title: "Demo demos/meta-prompts (Wren), measured with and without the explanation in system"
75+ state: closed
76+ priority: medium
77+ author:
78+ name: k33g
79+ email: ph.charriere@gmail.com
80+ createdAt: 2026-11-27T06:30:00.000Z
81+ updatedAt: 2026-11-27T06:30:00.000Z
82+ closedAt: 2026-11-27T06:30:00.000Z
83+ - id: 4
84+ title: "Docs EN+FR: configuration reference (key, section, validation errors), the four pickers"
85+ state: closed
86+ priority: low
87+ author:
88+ name: k33g
89+ email: ph.charriere@gmail.com
90+ createdAt: 2026-11-27T06:30:00.000Z
91+ updatedAt: 2026-11-27T06:30:00.000Z
92+ closedAt: 2026-11-27T06:30:00.000Z
93+comments:
94+ - id: 1
95+ author:
96+ name: k33g
97+ email: ph.charriere@gmail.com
98+ createdAt: 2026-11-27T06:30:00.000Z
99+ body: |
100+ Done on branch feature/custom-meta-prompts (not merged yet):
101+ internal/config/metaprompts.go (+test), config.Cfg.MetaPrompts and its
102+ validation; internal/metaprompt Merge/Configured, Matching(list, typed);
103+ tui Options.MetaPrompts → View.metas (nil = built-ins), main.go passes
104+ metaprompt.Configured(). Tests: config, metaprompt (Merge, Configured),
105+ tui TestBracketPickerOffersTheAgentsOwn. go test ./..., vet, gofmt
106+ clean. Live: the catalogue loaded from the demo's file (17 entries);
107+ -p runs with and without the explanation (README). Window not tried
108+ live.
modified README.md +1 -0
@@ -193,6 +193,7 @@ The `demos/` directory holds ready-made set-ups (most with a README explaining h
193193 | `demos/unload-models/` | a coordinator (Qwen3.5 9B) hands programming questions to an expert (Qwen3.5 4B) with `ask_agent`, a `preAsk` hook unloads the coordinator's own model before the expert starts and a `postAsk` hook unloads the expert's once it has answered — the two models are never loaded together; `/unload` and `unload_model` on request; llmman, measured results |
194194 | `demos/plans/` | the `plan` tool at work: Planner (Qwen3.5 4B on llmman) builds a tiny Go program in four steps — module, code, test, README — while mm shows `📋 [C/N] …` after each plan action; a failing variant ends on `Plan finished: 2 done, 1 failed`; measured results |
195195 | `demos/docs-from-agent/` | `docSearch.dirs: ["@agent/handbook", docs]`: a handbook shipped beside the agent file plus the docs of the project mm runs in, searched together; Qwen3.5 4B on llama.cpp |
196+| `demos/meta-prompts/` | your own meta-prompts in the window's `[` picker (`metaPrompts:` — added, or rewording a built-in), and why `system` must explain them: measured with and without, Qwen3.5 4B on llama.cpp |
196197 | `demos/memory-skills/` | a memory from one conversation to the next made of three skills (`remember`, `recall`, `forget`) over `.mm/memory.md`, no mm code; Qwen3.5 4B on llama.cpp, measured on 8 questions |
197198 | `demos/memory-skills-2/` | the same memory always in the prompt (`agentsMd.path: .mm/memory.md`), a `recall` skill with no tool, no mm code; 8/8 after four measured runs, compared with `memory-skills` |
198199 | `demos/docs-search/` | an assistant answering from a documentation folder: nine Ratatui tutorials (Rust terminal UIs, each program checked against ratatui 0.30 by `check-tutorials.sh`), `/docs <words>` for you and the `search_docs` tool for the model; Qwen3.5 4B on llmman, measured results |
@@ -193,6 +193,7 @@ The `demos/` directory holds ready-made set-ups (most with a README explaining h
193 | `demos/unload-models/` | a coordinator (Qwen3.5 9B) hands programming questions to an expert (Qwen3.5 4B) with `ask_agent`, a `preAsk` hook unloads the coordinator's own model before the expert starts and a `postAsk` hook unloads the expert's once it has answered — the two models are never loaded together; `/unload` and `unload_model` on request; llmman, measured results |193 | `demos/unload-models/` | a coordinator (Qwen3.5 9B) hands programming questions to an expert (Qwen3.5 4B) with `ask_agent`, a `preAsk` hook unloads the coordinator's own model before the expert starts and a `postAsk` hook unloads the expert's once it has answered — the two models are never loaded together; `/unload` and `unload_model` on request; llmman, measured results |
194 | `demos/plans/` | the `plan` tool at work: Planner (Qwen3.5 4B on llmman) builds a tiny Go program in four steps — module, code, test, README — while mm shows `📋 [C/N] …` after each plan action; a failing variant ends on `Plan finished: 2 done, 1 failed`; measured results |194 | `demos/plans/` | the `plan` tool at work: Planner (Qwen3.5 4B on llmman) builds a tiny Go program in four steps — module, code, test, README — while mm shows `📋 [C/N] …` after each plan action; a failing variant ends on `Plan finished: 2 done, 1 failed`; measured results |
195 | `demos/docs-from-agent/` | `docSearch.dirs: ["@agent/handbook", docs]`: a handbook shipped beside the agent file plus the docs of the project mm runs in, searched together; Qwen3.5 4B on llama.cpp |195 | `demos/docs-from-agent/` | `docSearch.dirs: ["@agent/handbook", docs]`: a handbook shipped beside the agent file plus the docs of the project mm runs in, searched together; Qwen3.5 4B on llama.cpp |
196+| `demos/meta-prompts/` | your own meta-prompts in the window's `[` picker (`metaPrompts:` — added, or rewording a built-in), and why `system` must explain them: measured with and without, Qwen3.5 4B on llama.cpp |
196 | `demos/memory-skills/` | a memory from one conversation to the next made of three skills (`remember`, `recall`, `forget`) over `.mm/memory.md`, no mm code; Qwen3.5 4B on llama.cpp, measured on 8 questions |197 | `demos/memory-skills/` | a memory from one conversation to the next made of three skills (`remember`, `recall`, `forget`) over `.mm/memory.md`, no mm code; Qwen3.5 4B on llama.cpp, measured on 8 questions |
197 | `demos/memory-skills-2/` | the same memory always in the prompt (`agentsMd.path: .mm/memory.md`), a `recall` skill with no tool, no mm code; 8/8 after four measured runs, compared with `memory-skills` |198 | `demos/memory-skills-2/` | the same memory always in the prompt (`agentsMd.path: .mm/memory.md`), a `recall` skill with no tool, no mm code; 8/8 after four measured runs, compared with `memory-skills` |
198 | `demos/docs-search/` | an assistant answering from a documentation folder: nine Ratatui tutorials (Rust terminal UIs, each program checked against ratatui 0.30 by `check-tutorials.sh`), `/docs <words>` for you and the `search_docs` tool for the model; Qwen3.5 4B on llmman, measured results |199 | `demos/docs-search/` | an assistant answering from a documentation folder: nine Ratatui tutorials (Rust terminal UIs, each program checked against ratatui 0.30 by `check-tutorials.sh`), `/docs <words>` for you and the `search_docs` tool for the model; Qwen3.5 4B on llmman, measured results |
added demos/meta-prompts/.gitignore +3 -0
new file mode 100644
@@ -0,0 +1,3 @@
1+!.mm
2+.mm/sessions
3+.mm/traces
new file mode 100644
@@ -0,0 +1,3 @@
1+!.mm
2+.mm/sessions
3+.mm/traces
added demos/meta-prompts/.mm/agent.yaml +77 -0
new file mode 100644
@@ -0,0 +1,77 @@
1+# Wren — a demo of your own meta-prompts (ticket 272).
2+#
3+# In the window, `[` at the start of the box opens the meta-prompts: the 13
4+# built-in ones, and the ones of `metaPrompts:` below — added after them, or
5+# rewording a built-in with the same label ([Brief] here).
6+#
7+# cd demos/meta-prompts
8+# ../../mm -tui window: type [ to see the list
9+# ../../mm -p "[Haiku] What is a goroutine?"
10+#
11+# See ../README.en.md.
12+
13+provider: llamacpp
14+# Qwen3.5 4B, thinking off. No baseUrl: llamacpp's defaults apply —
15+# 127.0.0.1:9931 (the Llama app), then 8080, then host.docker.internal:9931.
16+model: "unsloth/Qwen3.5-4B-GGUF:Q4_K_M"
17+
18+# The picker shows each description to YOU. The model only reads the prefix
19+# you put before the question: a name that does not say it all ([Brief] is
20+# "two sentences" here, [Tweet] has a length) is explained in `system`.
21+metaPrompts:
22+ - prefix: "[Haiku]"
23+ description: Answer as a haiku (5-7-5)
24+ - prefix: "[Tweet]"
25+ description: One post of 280 characters at most
26+ - prefix: "[Commit Message]"
27+ description: A git commit message for what I describe
28+ - prefix: "[Bullet Points]"
29+ description: Three bullet points, nothing else
30+ # The label of a built-in: replaces it, in its place in the list.
31+ - prefix: "[Brief]"
32+ description: Two sentences at most
33+
34+# Wren only answers: no command, no file.
35+bashTool: false
36+editTools: false
37+planTool: false
38+fetchContentTool: false
39+askUserTool: false
40+skillsDir: no-skills
41+agentsMd:
42+ enabled: false
43+yolo: true
44+# The model is shared with your other agents: leave it loaded.
45+unloadOnExit: false
46+unloadModels: false
47+maxTurns: 4
48+firstTokenTimeout: 3m
49+
50+sampling:
51+ # family qwen, non-thinking (mm init's presets)
52+ temperature: 0.7
53+ top_p: 0.8
54+ top_k: 20
55+ max_tokens: 1024
56+ chat_template_kwargs:
57+ enable_thinking: false
58+
59+acp:
60+ name: wren
61+ title: "Wren (meta-prompts)"
62+
63+system: |
64+ Your name is Wren, a helpful assistant.
65+ A question may start with a meta-prompt in brackets: it says the FORM of
66+ the answer, not its subject. Follow it exactly, and do not mention it:
67+ - [Brief]: two sentences at most.
68+ - [Haiku]: a haiku — three lines of 5, 7 and 5 syllables — and nothing else.
69+ - [Tweet]: one post of 280 characters at most, no hashtag list.
70+ - [Commit Message]: a git commit message for the change described — an
71+ imperative subject line of 50 characters at most, a blank line, then a
72+ short body saying why. Nothing before or after it.
73+ - [Bullet Points]: exactly three bullet points, nothing else.
74+ Any other bracketed prefix ([Step-by-Step], [For Kids]…): do what its
75+ name says.
76+ Without a prefix, answer normally, in a few lines.
77+ Answer in the language of the question.
new file mode 100644
@@ -0,0 +1,77 @@
1+# Wren — a demo of your own meta-prompts (ticket 272).
2+#
3+# In the window, `[` at the start of the box opens the meta-prompts: the 13
4+# built-in ones, and the ones of `metaPrompts:` below — added after them, or
5+# rewording a built-in with the same label ([Brief] here).
6+#
7+# cd demos/meta-prompts
8+# ../../mm -tui window: type [ to see the list
9+# ../../mm -p "[Haiku] What is a goroutine?"
10+#
11+# See ../README.en.md.
12+
13+provider: llamacpp
14+# Qwen3.5 4B, thinking off. No baseUrl: llamacpp's defaults apply —
15+# 127.0.0.1:9931 (the Llama app), then 8080, then host.docker.internal:9931.
16+model: "unsloth/Qwen3.5-4B-GGUF:Q4_K_M"
17+
18+# The picker shows each description to YOU. The model only reads the prefix
19+# you put before the question: a name that does not say it all ([Brief] is
20+# "two sentences" here, [Tweet] has a length) is explained in `system`.
21+metaPrompts:
22+ - prefix: "[Haiku]"
23+ description: Answer as a haiku (5-7-5)
24+ - prefix: "[Tweet]"
25+ description: One post of 280 characters at most
26+ - prefix: "[Commit Message]"
27+ description: A git commit message for what I describe
28+ - prefix: "[Bullet Points]"
29+ description: Three bullet points, nothing else
30+ # The label of a built-in: replaces it, in its place in the list.
31+ - prefix: "[Brief]"
32+ description: Two sentences at most
33+
34+# Wren only answers: no command, no file.
35+bashTool: false
36+editTools: false
37+planTool: false
38+fetchContentTool: false
39+askUserTool: false
40+skillsDir: no-skills
41+agentsMd:
42+ enabled: false
43+yolo: true
44+# The model is shared with your other agents: leave it loaded.
45+unloadOnExit: false
46+unloadModels: false
47+maxTurns: 4
48+firstTokenTimeout: 3m
49+
50+sampling:
51+ # family qwen, non-thinking (mm init's presets)
52+ temperature: 0.7
53+ top_p: 0.8
54+ top_k: 20
55+ max_tokens: 1024
56+ chat_template_kwargs:
57+ enable_thinking: false
58+
59+acp:
60+ name: wren
61+ title: "Wren (meta-prompts)"
62+
63+system: |
64+ Your name is Wren, a helpful assistant.
65+ A question may start with a meta-prompt in brackets: it says the FORM of
66+ the answer, not its subject. Follow it exactly, and do not mention it:
67+ - [Brief]: two sentences at most.
68+ - [Haiku]: a haiku — three lines of 5, 7 and 5 syllables — and nothing else.
69+ - [Tweet]: one post of 280 characters at most, no hashtag list.
70+ - [Commit Message]: a git commit message for the change described — an
71+ imperative subject line of 50 characters at most, a blank line, then a
72+ short body saying why. Nothing before or after it.
73+ - [Bullet Points]: exactly three bullet points, nothing else.
74+ Any other bracketed prefix ([Step-by-Step], [For Kids]…): do what its
75+ name says.
76+ Without a prefix, answer normally, in a few lines.
77+ Answer in the language of the question.
added demos/meta-prompts/README.en.md +76 -0
new file mode 100644
@@ -0,0 +1,76 @@
1+# meta-prompts demo — your own meta-prompts in the `[` picker
2+
3+In the window (`mm -tui`), typing `[` at the start of the box opens the meta-prompts: style prefixes that set the **form** of the answer — `[Brief]`, `[Step-by-Step]`, `[For Kids]`… Wren adds its own with `metaPrompts:` in its file (ticket 272):
4+
5+```yaml
6+metaPrompts:
7+ - prefix: "[Haiku]"
8+ description: Answer as a haiku (5-7-5)
9+ - prefix: "[Tweet]"
10+ description: One post of 280 characters at most
11+ - prefix: "[Commit Message]"
12+ description: A git commit message for what I describe
13+ - prefix: "[Bullet Points]"
14+ description: Three bullet points, nothing else
15+ - prefix: "[Brief]" # a built-in's label: replaces it, in its place
16+ description: Two sentences at most
17+```
18+
19+The picker then lists 17 entries: the 13 built-ins — `[Brief]` reworded — then the four new ones.
20+
21+Version française : [README.fr.md](README.fr.md).
22+
23+| File | What it is |
24+|------|------------|
25+| `.mm/agent.yaml` | Wren: `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (thinking off), `metaPrompts:`, no tool; its `system` says what each prefix means |
26+
27+## The one thing to know
28+
29+The `description` is shown **to you**, in the picker. The model reads **only the prefix** you put before the question (`[Tweet] Why use Go?`). A prefix whose name does not say it all — a length, a format, a built-in you reworded — must be explained in `system`. Wren's does:
30+
31+```yaml
32+system: |
33+ … A question may start with a meta-prompt in brackets: it says the FORM of
34+ the answer, not its subject. Follow it exactly, and do not mention it:
35+ - [Brief]: two sentences at most.
36+ - [Tweet]: one post of 280 characters at most, no hashtag list.
37+ - [Commit Message]: … an imperative subject line of 50 characters at most …
38+```
39+
40+## Run it
41+
42+The model runs on llama-server on 127.0.0.1:9931 (the Llama app, or `llama-server` in router mode) with `unsloth/Qwen3.5-4B-GGUF:Q4_K_M`.
43+
44+```bash
45+cd demos/meta-prompts
46+../../mm -tui
47+```
48+
49+1. Type `[`: the list opens, `[Brief]` described as "Two sentences at most", the four new ones at the end.
50+2. Type `Co`: only `[Comparison]` and `[Commit Message]` are left. Enter on `[Commit Message]` puts `[Commit Message] ` in the box.
51+3. Type `I fixed the panic when the config file has no model key` and Enter.
52+
53+Without the window, type the prefix yourself — the model reads it the same:
54+
55+```bash
56+../../mm -p "[Haiku] What is a goroutine?"
57+../../mm -p "[Commit Message] I fixed the panic when the config file has no model key; it now says which key is missing."
58+```
59+
60+## What was checked (2026-11-27, from an sbx sandbox, llama-server router on the Mac, one run each)
61+
62+The catalogue the picker gets from this file (`metaprompt.Configured()` after `config.Load`): 17 entries, `[Brief]` first with "Two sentences at most", `[Haiku]`, `[Tweet]`, `[Commit Message]`, `[Bullet Points]` last. The window itself was not tried live (no terminal in the sandbox): its behaviour is covered by unit tests.
63+
64+`-p`, Wren as it is, then the same questions with a `system` that does **not** explain the prefixes:
65+
66+| Question | With the explanation | Without it |
67+|----------|----------------------|------------|
68+| `[Haiku] What is a goroutine?` | 3 lines — not a true 5-7-5 | 3 lines, same |
69+| `[Tweet] Why use Go for command-line tools?` | 211 characters | **297 characters** — over the limit |
70+| `[Commit Message] I fixed the panic …` | `fix: improve config file validation error message` (49 characters) + a body — but no blank line between them | **"Great fix! Clarifying exactly which model key …"** — a compliment, no commit message |
71+| `[Bullet Points] Why write tests?` | exactly 3 bullets | — |
72+| `[Brief] What is Docker?` | 2 sentences, 232 characters | 342 characters |
73+| `[For Kids] What is a server?` (a built-in) | a child's explanation, 2 sentences | — |
74+| `What is Docker?` (no prefix) | 2 sentences, 279 characters | — |
75+
76+The explanation in `system` is what makes a custom prefix work with a 4B model; the description alone never reaches it. Without a prefix the answer was already short ("a few lines" in `system`), so `[Brief]` changed little here.
new file mode 100644
@@ -0,0 +1,76 @@
1+# meta-prompts demo — your own meta-prompts in the `[` picker
2+
3+In the window (`mm -tui`), typing `[` at the start of the box opens the meta-prompts: style prefixes that set the **form** of the answer — `[Brief]`, `[Step-by-Step]`, `[For Kids]`… Wren adds its own with `metaPrompts:` in its file (ticket 272):
4+
5+```yaml
6+metaPrompts:
7+ - prefix: "[Haiku]"
8+ description: Answer as a haiku (5-7-5)
9+ - prefix: "[Tweet]"
10+ description: One post of 280 characters at most
11+ - prefix: "[Commit Message]"
12+ description: A git commit message for what I describe
13+ - prefix: "[Bullet Points]"
14+ description: Three bullet points, nothing else
15+ - prefix: "[Brief]" # a built-in's label: replaces it, in its place
16+ description: Two sentences at most
17+```
18+
19+The picker then lists 17 entries: the 13 built-ins — `[Brief]` reworded — then the four new ones.
20+
21+Version française : [README.fr.md](README.fr.md).
22+
23+| File | What it is |
24+|------|------------|
25+| `.mm/agent.yaml` | Wren: `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (thinking off), `metaPrompts:`, no tool; its `system` says what each prefix means |
26+
27+## The one thing to know
28+
29+The `description` is shown **to you**, in the picker. The model reads **only the prefix** you put before the question (`[Tweet] Why use Go?`). A prefix whose name does not say it all — a length, a format, a built-in you reworded — must be explained in `system`. Wren's does:
30+
31+```yaml
32+system: |
33+ … A question may start with a meta-prompt in brackets: it says the FORM of
34+ the answer, not its subject. Follow it exactly, and do not mention it:
35+ - [Brief]: two sentences at most.
36+ - [Tweet]: one post of 280 characters at most, no hashtag list.
37+ - [Commit Message]: … an imperative subject line of 50 characters at most …
38+```
39+
40+## Run it
41+
42+The model runs on llama-server on 127.0.0.1:9931 (the Llama app, or `llama-server` in router mode) with `unsloth/Qwen3.5-4B-GGUF:Q4_K_M`.
43+
44+```bash
45+cd demos/meta-prompts
46+../../mm -tui
47+```
48+
49+1. Type `[`: the list opens, `[Brief]` described as "Two sentences at most", the four new ones at the end.
50+2. Type `Co`: only `[Comparison]` and `[Commit Message]` are left. Enter on `[Commit Message]` puts `[Commit Message] ` in the box.
51+3. Type `I fixed the panic when the config file has no model key` and Enter.
52+
53+Without the window, type the prefix yourself — the model reads it the same:
54+
55+```bash
56+../../mm -p "[Haiku] What is a goroutine?"
57+../../mm -p "[Commit Message] I fixed the panic when the config file has no model key; it now says which key is missing."
58+```
59+
60+## What was checked (2026-11-27, from an sbx sandbox, llama-server router on the Mac, one run each)
61+
62+The catalogue the picker gets from this file (`metaprompt.Configured()` after `config.Load`): 17 entries, `[Brief]` first with "Two sentences at most", `[Haiku]`, `[Tweet]`, `[Commit Message]`, `[Bullet Points]` last. The window itself was not tried live (no terminal in the sandbox): its behaviour is covered by unit tests.
63+
64+`-p`, Wren as it is, then the same questions with a `system` that does **not** explain the prefixes:
65+
66+| Question | With the explanation | Without it |
67+|----------|----------------------|------------|
68+| `[Haiku] What is a goroutine?` | 3 lines — not a true 5-7-5 | 3 lines, same |
69+| `[Tweet] Why use Go for command-line tools?` | 211 characters | **297 characters** — over the limit |
70+| `[Commit Message] I fixed the panic …` | `fix: improve config file validation error message` (49 characters) + a body — but no blank line between them | **"Great fix! Clarifying exactly which model key …"** — a compliment, no commit message |
71+| `[Bullet Points] Why write tests?` | exactly 3 bullets | — |
72+| `[Brief] What is Docker?` | 2 sentences, 232 characters | 342 characters |
73+| `[For Kids] What is a server?` (a built-in) | a child's explanation, 2 sentences | — |
74+| `What is Docker?` (no prefix) | 2 sentences, 279 characters | — |
75+
76+The explanation in `system` is what makes a custom prefix work with a 4B model; the description alone never reaches it. Without a prefix the answer was already short ("a few lines" in `system`), so `[Brief]` changed little here.
added demos/meta-prompts/README.fr.md +76 -0
new file mode 100644
@@ -0,0 +1,76 @@
1+# Démo meta-prompts — vos propres méta-prompts dans le sélecteur `[`
2+
3+Dans la fenêtre (`mm -tui`), taper `[` en début de zone ouvre les méta-prompts : des préfixes de style qui fixent la **forme** de la réponse — `[Brief]`, `[Step-by-Step]`, `[For Kids]`… Wren ajoute les siens avec `metaPrompts:` dans son fichier (ticket 272) :
4+
5+```yaml
6+metaPrompts:
7+ - prefix: "[Haiku]"
8+ description: Answer as a haiku (5-7-5)
9+ - prefix: "[Tweet]"
10+ description: One post of 280 characters at most
11+ - prefix: "[Commit Message]"
12+ description: A git commit message for what I describe
13+ - prefix: "[Bullet Points]"
14+ description: Three bullet points, nothing else
15+ - prefix: "[Brief]" # le libellé d'un intégré : le remplace, à sa place
16+ description: Two sentences at most
17+```
18+
19+Le sélecteur liste alors 17 entrées : les 13 intégrés — `[Brief]` reformulé — puis les quatre nouveaux.
20+
21+English version: [README.en.md](README.en.md).
22+
23+| Fichier | Ce que c'est |
24+|---------|--------------|
25+| `.mm/agent.yaml` | Wren : `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (raisonnement coupé), `metaPrompts:`, aucun outil ; son `system` dit ce que veut dire chaque préfixe |
26+
27+## La seule chose à savoir
28+
29+La `description` vous est montrée **à vous**, dans le sélecteur. Le modèle ne lit **que le préfixe** placé devant la question (`[Tweet] Why use Go?`). Un préfixe dont le nom ne dit pas tout — une longueur, un format, un intégré reformulé — doit être expliqué dans `system`. Celui de Wren le fait :
30+
31+```yaml
32+system: |
33+ … A question may start with a meta-prompt in brackets: it says the FORM of
34+ the answer, not its subject. Follow it exactly, and do not mention it:
35+ - [Brief]: two sentences at most.
36+ - [Tweet]: one post of 280 characters at most, no hashtag list.
37+ - [Commit Message]: … an imperative subject line of 50 characters at most …
38+```
39+
40+## Lancer la démo
41+
42+Le modèle tourne sur llama-server en 127.0.0.1:9931 (l'application Llama, ou `llama-server` en mode routeur) avec `unsloth/Qwen3.5-4B-GGUF:Q4_K_M`.
43+
44+```bash
45+cd demos/meta-prompts
46+../../mm -tui
47+```
48+
49+1. Tapez `[` : la liste s'ouvre, `[Brief]` décrit « Two sentences at most », les quatre nouveaux à la fin.
50+2. Tapez `Co` : il ne reste que `[Comparison]` et `[Commit Message]`. Entrée sur `[Commit Message]` met `[Commit Message] ` dans la zone.
51+3. Tapez `I fixed the panic when the config file has no model key` puis Entrée.
52+
53+Sans la fenêtre, tapez le préfixe vous-même — le modèle le lit de la même façon :
54+
55+```bash
56+../../mm -p "[Haiku] What is a goroutine?"
57+../../mm -p "[Commit Message] I fixed the panic when the config file has no model key; it now says which key is missing."
58+```
59+
60+## Ce qui a été vérifié (27/11/2026, depuis un sandbox sbx, routeur llama-server sur le Mac, un passage chacun)
61+
62+Le catalogue que le sélecteur reçoit de ce fichier (`metaprompt.Configured()` après `config.Load`) : 17 entrées, `[Brief]` en tête avec « Two sentences at most », `[Haiku]`, `[Tweet]`, `[Commit Message]`, `[Bullet Points]` à la fin. La fenêtre elle-même n'a pas été essayée en vrai (pas de terminal dans le sandbox) : son comportement est couvert par des tests unitaires.
63+
64+`-p`, Wren tel quel, puis les mêmes questions avec un `system` qui n'explique **pas** les préfixes :
65+
66+| Question | Avec l'explication | Sans |
67+|----------|--------------------|------|
68+| `[Haiku] What is a goroutine?` | 3 lignes — pas un vrai 5-7-5 | 3 lignes, pareil |
69+| `[Tweet] Why use Go for command-line tools?` | 211 caractères | **297 caractères** — au-delà de la limite |
70+| `[Commit Message] I fixed the panic …` | `fix: improve config file validation error message` (49 caractères) + un corps — mais pas de ligne vide entre les deux | **« Great fix! Clarifying exactly which model key … »** — un compliment, pas de message de commit |
71+| `[Bullet Points] Why write tests?` | exactement 3 puces | — |
72+| `[Brief] What is Docker?` | 2 phrases, 232 caractères | 342 caractères |
73+| `[For Kids] What is a server?` (un intégré) | une explication pour enfant, 2 phrases | — |
74+| `What is Docker?` (sans préfixe) | 2 phrases, 279 caractères | — |
75+
76+C'est l'explication dans `system` qui fait marcher un préfixe personnalisé avec un modèle de 4B ; la description seule ne lui parvient jamais. Sans préfixe la réponse était déjà courte (« a few lines » dans `system`), donc `[Brief]` a peu changé ici.
new file mode 100644
@@ -0,0 +1,76 @@
1+# Démo meta-prompts — vos propres méta-prompts dans le sélecteur `[`
2+
3+Dans la fenêtre (`mm -tui`), taper `[` en début de zone ouvre les méta-prompts : des préfixes de style qui fixent la **forme** de la réponse — `[Brief]`, `[Step-by-Step]`, `[For Kids]`… Wren ajoute les siens avec `metaPrompts:` dans son fichier (ticket 272) :
4+
5+```yaml
6+metaPrompts:
7+ - prefix: "[Haiku]"
8+ description: Answer as a haiku (5-7-5)
9+ - prefix: "[Tweet]"
10+ description: One post of 280 characters at most
11+ - prefix: "[Commit Message]"
12+ description: A git commit message for what I describe
13+ - prefix: "[Bullet Points]"
14+ description: Three bullet points, nothing else
15+ - prefix: "[Brief]" # le libellé d'un intégré : le remplace, à sa place
16+ description: Two sentences at most
17+```
18+
19+Le sélecteur liste alors 17 entrées : les 13 intégrés — `[Brief]` reformulé — puis les quatre nouveaux.
20+
21+English version: [README.en.md](README.en.md).
22+
23+| Fichier | Ce que c'est |
24+|---------|--------------|
25+| `.mm/agent.yaml` | Wren : `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (raisonnement coupé), `metaPrompts:`, aucun outil ; son `system` dit ce que veut dire chaque préfixe |
26+
27+## La seule chose à savoir
28+
29+La `description` vous est montrée **à vous**, dans le sélecteur. Le modèle ne lit **que le préfixe** placé devant la question (`[Tweet] Why use Go?`). Un préfixe dont le nom ne dit pas tout — une longueur, un format, un intégré reformulé — doit être expliqué dans `system`. Celui de Wren le fait :
30+
31+```yaml
32+system: |
33+ … A question may start with a meta-prompt in brackets: it says the FORM of
34+ the answer, not its subject. Follow it exactly, and do not mention it:
35+ - [Brief]: two sentences at most.
36+ - [Tweet]: one post of 280 characters at most, no hashtag list.
37+ - [Commit Message]: … an imperative subject line of 50 characters at most …
38+```
39+
40+## Lancer la démo
41+
42+Le modèle tourne sur llama-server en 127.0.0.1:9931 (l'application Llama, ou `llama-server` en mode routeur) avec `unsloth/Qwen3.5-4B-GGUF:Q4_K_M`.
43+
44+```bash
45+cd demos/meta-prompts
46+../../mm -tui
47+```
48+
49+1. Tapez `[` : la liste s'ouvre, `[Brief]` décrit « Two sentences at most », les quatre nouveaux à la fin.
50+2. Tapez `Co` : il ne reste que `[Comparison]` et `[Commit Message]`. Entrée sur `[Commit Message]` met `[Commit Message] ` dans la zone.
51+3. Tapez `I fixed the panic when the config file has no model key` puis Entrée.
52+
53+Sans la fenêtre, tapez le préfixe vous-même — le modèle le lit de la même façon :
54+
55+```bash
56+../../mm -p "[Haiku] What is a goroutine?"
57+../../mm -p "[Commit Message] I fixed the panic when the config file has no model key; it now says which key is missing."
58+```
59+
60+## Ce qui a été vérifié (27/11/2026, depuis un sandbox sbx, routeur llama-server sur le Mac, un passage chacun)
61+
62+Le catalogue que le sélecteur reçoit de ce fichier (`metaprompt.Configured()` après `config.Load`) : 17 entrées, `[Brief]` en tête avec « Two sentences at most », `[Haiku]`, `[Tweet]`, `[Commit Message]`, `[Bullet Points]` à la fin. La fenêtre elle-même n'a pas été essayée en vrai (pas de terminal dans le sandbox) : son comportement est couvert par des tests unitaires.
63+
64+`-p`, Wren tel quel, puis les mêmes questions avec un `system` qui n'explique **pas** les préfixes :
65+
66+| Question | Avec l'explication | Sans |
67+|----------|--------------------|------|
68+| `[Haiku] What is a goroutine?` | 3 lignes — pas un vrai 5-7-5 | 3 lignes, pareil |
69+| `[Tweet] Why use Go for command-line tools?` | 211 caractères | **297 caractères** — au-delà de la limite |
70+| `[Commit Message] I fixed the panic …` | `fix: improve config file validation error message` (49 caractères) + un corps — mais pas de ligne vide entre les deux | **« Great fix! Clarifying exactly which model key … »** — un compliment, pas de message de commit |
71+| `[Bullet Points] Why write tests?` | exactement 3 puces | — |
72+| `[Brief] What is Docker?` | 2 phrases, 232 caractères | 342 caractères |
73+| `[For Kids] What is a server?` (un intégré) | une explication pour enfant, 2 phrases | — |
74+| `What is Docker?` (sans préfixe) | 2 phrases, 279 caractères | — |
75+
76+C'est l'explication dans `system` qui fait marcher un préfixe personnalisé avec un modèle de 4B ; la description seule ne lui parvient jamais. Sans préfixe la réponse était déjà courte (« a few lines » dans `system`), donc `[Brief]` a peu changé ici.
modified docs/en/reference/configuration.md +24 -0
@@ -50,6 +50,7 @@ Where `mm` looks for this file: [Configuration file resolution](cli.md#configura
5050 | `context` | map | see below | Automatic history compression. |
5151 | `sessions` | map | see below | Persistent, per-project sessions. |
5252 | `docSearch` | map | see below | BM25 search through the text files of some folders: the `/docs` command and the `search_docs` tool. |
53+| `metaPrompts` | list | `[]` | The agent's own meta-prompts for the window's `[` picker, beside the 13 built-in ones — see [`metaPrompts` keys](#metaprompts-keys). |
5354 | `trace` | map | see below | Write every request to the model and every response to files. |
5455 | `agentsMd` | map | see below | Append the project's `AGENTS.md` to the system prompt of every conversation. On by default. |
5556 | `acp` | map | see below | How `mm -acp` introduces itself to the editor. |
@@ -99,6 +100,25 @@ Either memory key set while `sessions.enabled` is false prints the start-up warn
99100
100101 `dirs`, `extensions` and `maxFileSize` are checked only when `searchDocs` or `autoSearchDocs` is true. Hidden folders (`.git`, `.mm`…) and `node_modules` are skipped, symbolic links are not followed, a file holding a NUL byte is skipped as binary.
101102
103+## `metaPrompts` keys
104+
105+A list (ticket 272). Each entry adds a meta-prompt to the window's `[` picker ([The four pickers](slash-commands.md#the-four-pickers)), after the 13 built-in ones, in the order given; an entry whose label is a built-in's (case ignored) **replaces** that one, in its place.
106+
107+| Key | Type | Default | Description |
108+|-----|------|---------|-------------|
109+| `metaPrompts[].prefix` | string | — | The label, brackets included: `"[Haiku]"` (quotes needed in YAML). Required. One pair of brackets around a non-empty name, on one line. The space after it in the box is added by mm. |
110+| `metaPrompts[].description` | string | — | Shown beside the label in the picker. Required. |
111+
112+```yaml
113+metaPrompts:
114+ - prefix: "[Haiku]"
115+ description: Answer as a haiku (5-7-5)
116+ - prefix: "[Brief]" # a built-in's label: replaces it
117+ description: Two sentences at most
118+```
119+
120+The description is for the user: **the model reads only the prefix** typed before the question. When the name does not say it all (a length, a format, a reworded built-in), say what it means in `system` — measured in `demos/meta-prompts`: without it, Qwen3.5 4B answered `[Commit Message] …` with a compliment instead of a commit message.
121+
102122 ## `trace` keys
103123
104124 | Key | Type | Default | Description |
@@ -477,6 +497,10 @@ Reported on stderr as `[config error: <path>: <message>]`, exit code 1 — in ev
477497 | `context.maxMessages must be >= 0` | negative value |
478498 | `sessions.dir must not be empty` | empty string |
479499 | `docSearch.dirs must name at least one folder` | `dirs: []` with a switch on |
500+| `metaPrompts[N].prefix: "…" must be a name in brackets, like "[Haiku]"` | a prefix without its brackets |
501+| `metaPrompts[N].prefix: "…" must hold a name, on one line, with no other bracket` | `"[]"`, `"[ ]"`, `"[a]b]"` |
502+| `metaPrompts[N].description: the picker shows it beside [X] — it must not be empty` | no `description` |
503+| `metaPrompts[N].prefix: [X] is listed twice` | two entries with the same label (case ignored) |
480504 | `docSearch.dirs: a folder must not be empty` | `dirs: [""]` |
481505 | `docSearch.extensions must name at least one extension` | `extensions: []` with a switch on |
482506 | `docSearch.extensions: "md" must start with a dot, like ".md"` | an extension without its dot |
@@ -50,6 +50,7 @@ Where `mm` looks for this file: [Configuration file resolution](cli.md#configura
50 | `context` | map | see below | Automatic history compression. |50 | `context` | map | see below | Automatic history compression. |
51 | `sessions` | map | see below | Persistent, per-project sessions. |51 | `sessions` | map | see below | Persistent, per-project sessions. |
52 | `docSearch` | map | see below | BM25 search through the text files of some folders: the `/docs` command and the `search_docs` tool. |52 | `docSearch` | map | see below | BM25 search through the text files of some folders: the `/docs` command and the `search_docs` tool. |
53+| `metaPrompts` | list | `[]` | The agent's own meta-prompts for the window's `[` picker, beside the 13 built-in ones — see [`metaPrompts` keys](#metaprompts-keys). |
53 | `trace` | map | see below | Write every request to the model and every response to files. |54 | `trace` | map | see below | Write every request to the model and every response to files. |
54 | `agentsMd` | map | see below | Append the project's `AGENTS.md` to the system prompt of every conversation. On by default. |55 | `agentsMd` | map | see below | Append the project's `AGENTS.md` to the system prompt of every conversation. On by default. |
55 | `acp` | map | see below | How `mm -acp` introduces itself to the editor. |56 | `acp` | map | see below | How `mm -acp` introduces itself to the editor. |
@@ -99,6 +100,25 @@ Either memory key set while `sessions.enabled` is false prints the start-up warn
99 100
100 `dirs`, `extensions` and `maxFileSize` are checked only when `searchDocs` or `autoSearchDocs` is true. Hidden folders (`.git`, `.mm`…) and `node_modules` are skipped, symbolic links are not followed, a file holding a NUL byte is skipped as binary.101 `dirs`, `extensions` and `maxFileSize` are checked only when `searchDocs` or `autoSearchDocs` is true. Hidden folders (`.git`, `.mm`…) and `node_modules` are skipped, symbolic links are not followed, a file holding a NUL byte is skipped as binary.
101 102
103+## `metaPrompts` keys
104+
105+A list (ticket 272). Each entry adds a meta-prompt to the window's `[` picker ([The four pickers](slash-commands.md#the-four-pickers)), after the 13 built-in ones, in the order given; an entry whose label is a built-in's (case ignored) **replaces** that one, in its place.
106+
107+| Key | Type | Default | Description |
108+|-----|------|---------|-------------|
109+| `metaPrompts[].prefix` | string | — | The label, brackets included: `"[Haiku]"` (quotes needed in YAML). Required. One pair of brackets around a non-empty name, on one line. The space after it in the box is added by mm. |
110+| `metaPrompts[].description` | string | — | Shown beside the label in the picker. Required. |
111+
112+```yaml
113+metaPrompts:
114+ - prefix: "[Haiku]"
115+ description: Answer as a haiku (5-7-5)
116+ - prefix: "[Brief]" # a built-in's label: replaces it
117+ description: Two sentences at most
118+```
119+
120+The description is for the user: **the model reads only the prefix** typed before the question. When the name does not say it all (a length, a format, a reworded built-in), say what it means in `system` — measured in `demos/meta-prompts`: without it, Qwen3.5 4B answered `[Commit Message] …` with a compliment instead of a commit message.
121+
102 ## `trace` keys122 ## `trace` keys
103 123
104 | Key | Type | Default | Description |124 | Key | Type | Default | Description |
@@ -477,6 +497,10 @@ Reported on stderr as `[config error: <path>: <message>]`, exit code 1 — in ev
477 | `context.maxMessages must be >= 0` | negative value |497 | `context.maxMessages must be >= 0` | negative value |
478 | `sessions.dir must not be empty` | empty string |498 | `sessions.dir must not be empty` | empty string |
479 | `docSearch.dirs must name at least one folder` | `dirs: []` with a switch on |499 | `docSearch.dirs must name at least one folder` | `dirs: []` with a switch on |
500+| `metaPrompts[N].prefix: "…" must be a name in brackets, like "[Haiku]"` | a prefix without its brackets |
501+| `metaPrompts[N].prefix: "…" must hold a name, on one line, with no other bracket` | `"[]"`, `"[ ]"`, `"[a]b]"` |
502+| `metaPrompts[N].description: the picker shows it beside [X] — it must not be empty` | no `description` |
503+| `metaPrompts[N].prefix: [X] is listed twice` | two entries with the same label (case ignored) |
480 | `docSearch.dirs: a folder must not be empty` | `dirs: [""]` |504 | `docSearch.dirs: a folder must not be empty` | `dirs: [""]` |
481 | `docSearch.extensions must name at least one extension` | `extensions: []` with a switch on |505 | `docSearch.extensions must name at least one extension` | `extensions: []` with a switch on |
482 | `docSearch.extensions: "md" must start with a dot, like ".md"` | an extension without its dot |506 | `docSearch.extensions: "md" must start with a dot, like ".md"` | an extension without its dot |
modified docs/en/reference/slash-commands.md +1 -1
@@ -195,7 +195,7 @@ A popup opens over the conversation as you type one of four triggers, and narrow
195195 | `/` | the window's commands | only as the whole first word of the box — a command *is* the message | the command, replacing the box, with a space when it takes an argument |
196196 | `@` | files and directories under the working directory | anywhere in a sentence | the path with its `@` kept. A **directory** gets a trailing `/` and no space, so Tab again walks down the tree; a **file** gets a space, so the sentence continues |
197197 | `$` | the skills of the catalogue | anywhere in a sentence | `$name` — the `$` **kept** — plus a space, with the cursor after it, ready for the skill's parameters |
198-| `[` | the 13 meta-prompts (ticket 270): style prefixes that steer the form of the answer — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — narrowed by the name typed after the `[`, spaces included (`[As a` → the three "As a …") | only as the **first character** of a one-line box, the cursor at its end, before any `]` | the prefix with its trailing space (`[Brief] `), replacing the box's `[…`, the cursor after it: type the question. The prefix is part of the question, sent and stored as typed |
198+| `[` | the 13 built-in meta-prompts (ticket 270), plus the agent's own from `metaPrompts:` (ticket 272, see [configuration](configuration.md#metaprompts-keys)): style prefixes that steer the form of the answer — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — narrowed by the name typed after the `[`, spaces included (`[As a` → the three "As a …") | only as the **first character** of a one-line box, the cursor at its end, before any `]` | the prefix with its trailing space (`[Brief] `), replacing the box's `[…`, the cursor after it: type the question. The prefix is part of the question, sent and stored as typed |
199199
200200 Four rules keep the popup out of the way:
201201
@@ -195,7 +195,7 @@ A popup opens over the conversation as you type one of four triggers, and narrow
195 | `/` | the window's commands | only as the whole first word of the box — a command *is* the message | the command, replacing the box, with a space when it takes an argument |195 | `/` | the window's commands | only as the whole first word of the box — a command *is* the message | the command, replacing the box, with a space when it takes an argument |
196 | `@` | files and directories under the working directory | anywhere in a sentence | the path with its `@` kept. A **directory** gets a trailing `/` and no space, so Tab again walks down the tree; a **file** gets a space, so the sentence continues |196 | `@` | files and directories under the working directory | anywhere in a sentence | the path with its `@` kept. A **directory** gets a trailing `/` and no space, so Tab again walks down the tree; a **file** gets a space, so the sentence continues |
197 | `$` | the skills of the catalogue | anywhere in a sentence | `$name` — the `$` **kept** — plus a space, with the cursor after it, ready for the skill's parameters |197 | `$` | the skills of the catalogue | anywhere in a sentence | `$name` — the `$` **kept** — plus a space, with the cursor after it, ready for the skill's parameters |
198-| `[` | the 13 meta-prompts (ticket 270): style prefixes that steer the form of the answer — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — narrowed by the name typed after the `[`, spaces included (`[As a` → the three "As a …") | only as the **first character** of a one-line box, the cursor at its end, before any `]` | the prefix with its trailing space (`[Brief] `), replacing the box's `[…`, the cursor after it: type the question. The prefix is part of the question, sent and stored as typed |198+| `[` | the 13 built-in meta-prompts (ticket 270), plus the agent's own from `metaPrompts:` (ticket 272, see [configuration](configuration.md#metaprompts-keys)): style prefixes that steer the form of the answer — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — narrowed by the name typed after the `[`, spaces included (`[As a` → the three "As a …") | only as the **first character** of a one-line box, the cursor at its end, before any `]` | the prefix with its trailing space (`[Brief] `), replacing the box's `[…`, the cursor after it: type the question. The prefix is part of the question, sent and stored as typed |
199 199
200 Four rules keep the popup out of the way:200 Four rules keep the popup out of the way:
201 201
modified docs/fr/reference/configuration.md +24 -0
@@ -50,6 +50,7 @@ Où `mm` cherche ce fichier : [Résolution du fichier de configuration](cli.md#r
5050 | `context` | dictionnaire | voir ci-dessous | Compression automatique de l'historique. |
5151 | `sessions` | dictionnaire | voir ci-dessous | Sessions persistantes, par projet. |
5252 | `docSearch` | dictionnaire | voir ci-dessous | Recherche BM25 dans les fichiers texte de dossiers : la commande `/docs` et l'outil `search_docs`. |
53+| `metaPrompts` | liste | `[]` | Les méta-prompts propres à l'agent pour le sélecteur `[` de la fenêtre, à côté des 13 intégrés — voir [Clés de `metaPrompts`](#clés-de-metaprompts). |
5354 | `agentsMd` | dictionnaire | voir ci-dessous | Ajoute le `AGENTS.md` du projet au prompt système de chaque conversation. Actif par défaut. |
5455 | `trace` | dictionnaire | voir ci-dessous | Écrit chaque requête au modèle et chaque réponse dans des fichiers. |
5556 | `acp` | dictionnaire | voir ci-dessous | La façon dont `mm -acp` se présente à l'éditeur. |
@@ -99,6 +100,25 @@ Une clé de mémoire activée alors que `sessions.enabled` vaut false affiche au
99100
100101 `dirs`, `extensions` et `maxFileSize` ne sont vérifiées que si `searchDocs` ou `autoSearchDocs` vaut true. Les dossiers cachés (`.git`, `.mm`…) et `node_modules` sont ignorés, les liens symboliques ne sont pas suivis, un fichier contenant un octet NUL est ignoré comme binaire.
101102
103+## Clés de `metaPrompts`
104+
105+Une liste (ticket 272). Chaque entrée ajoute un méta-prompt au sélecteur `[` de la fenêtre ([Les quatre sélecteurs](slash-commands.md#les-quatre-sélecteurs)), après les 13 intégrés, dans l'ordre donné ; une entrée dont le libellé est celui d'un intégré (casse ignorée) **remplace** celui-ci, à sa place.
106+
107+| Clé | Type | Défaut | Description |
108+|-----|------|--------|-------------|
109+| `metaPrompts[].prefix` | chaîne | — | Le libellé, crochets compris : `"[Haiku]"` (guillemets obligatoires en YAML). Obligatoire. Une paire de crochets autour d'un nom non vide, sur une ligne. L'espace qui le suit dans la zone est ajoutée par mm. |
110+| `metaPrompts[].description` | chaîne | — | Affichée à côté du libellé dans le sélecteur. Obligatoire. |
111+
112+```yaml
113+metaPrompts:
114+ - prefix: "[Haiku]"
115+ description: Answer as a haiku (5-7-5)
116+ - prefix: "[Brief]" # le libellé d'un intégré : le remplace
117+ description: Two sentences at most
118+```
119+
120+La description est pour l'utilisateur : **le modèle ne lit que le préfixe** tapé devant la question. Quand le nom ne dit pas tout (une longueur, un format, un intégré reformulé), dites ce qu'il signifie dans `system` — mesuré dans `demos/meta-prompts` : sans cela, Qwen3.5 4B a répondu à `[Commit Message] …` par un compliment au lieu d'un message de commit.
121+
102122 ## Clés de `trace`
103123
104124 | Clé | Type | Défaut | Description |
@@ -477,6 +497,10 @@ Signalées sur stderr sous la forme `[config error: <chemin>: <message>]`, code
477497 | `context.maxMessages must be >= 0` | valeur négative |
478498 | `sessions.dir must not be empty` | chaîne vide |
479499 | `docSearch.dirs must name at least one folder` | `dirs: []` avec un interrupteur activé |
500+| `metaPrompts[N].prefix: "…" must be a name in brackets, like "[Haiku]"` | un préfixe sans ses crochets |
501+| `metaPrompts[N].prefix: "…" must hold a name, on one line, with no other bracket` | `"[]"`, `"[ ]"`, `"[a]b]"` |
502+| `metaPrompts[N].description: the picker shows it beside [X] — it must not be empty` | pas de `description` |
503+| `metaPrompts[N].prefix: [X] is listed twice` | deux entrées au même libellé (casse ignorée) |
480504 | `docSearch.dirs: a folder must not be empty` | `dirs: [""]` |
481505 | `docSearch.extensions must name at least one extension` | `extensions: []` avec un interrupteur activé |
482506 | `docSearch.extensions: "md" must start with a dot, like ".md"` | une extension sans son point |
@@ -50,6 +50,7 @@ Où `mm` cherche ce fichier : [Résolution du fichier de configuration](cli.md#r
50 | `context` | dictionnaire | voir ci-dessous | Compression automatique de l'historique. |50 | `context` | dictionnaire | voir ci-dessous | Compression automatique de l'historique. |
51 | `sessions` | dictionnaire | voir ci-dessous | Sessions persistantes, par projet. |51 | `sessions` | dictionnaire | voir ci-dessous | Sessions persistantes, par projet. |
52 | `docSearch` | dictionnaire | voir ci-dessous | Recherche BM25 dans les fichiers texte de dossiers : la commande `/docs` et l'outil `search_docs`. |52 | `docSearch` | dictionnaire | voir ci-dessous | Recherche BM25 dans les fichiers texte de dossiers : la commande `/docs` et l'outil `search_docs`. |
53+| `metaPrompts` | liste | `[]` | Les méta-prompts propres à l'agent pour le sélecteur `[` de la fenêtre, à côté des 13 intégrés — voir [Clés de `metaPrompts`](#clés-de-metaprompts). |
53 | `agentsMd` | dictionnaire | voir ci-dessous | Ajoute le `AGENTS.md` du projet au prompt système de chaque conversation. Actif par défaut. |54 | `agentsMd` | dictionnaire | voir ci-dessous | Ajoute le `AGENTS.md` du projet au prompt système de chaque conversation. Actif par défaut. |
54 | `trace` | dictionnaire | voir ci-dessous | Écrit chaque requête au modèle et chaque réponse dans des fichiers. |55 | `trace` | dictionnaire | voir ci-dessous | Écrit chaque requête au modèle et chaque réponse dans des fichiers. |
55 | `acp` | dictionnaire | voir ci-dessous | La façon dont `mm -acp` se présente à l'éditeur. |56 | `acp` | dictionnaire | voir ci-dessous | La façon dont `mm -acp` se présente à l'éditeur. |
@@ -99,6 +100,25 @@ Une clé de mémoire activée alors que `sessions.enabled` vaut false affiche au
99 100
100 `dirs`, `extensions` et `maxFileSize` ne sont vérifiées que si `searchDocs` ou `autoSearchDocs` vaut true. Les dossiers cachés (`.git`, `.mm`…) et `node_modules` sont ignorés, les liens symboliques ne sont pas suivis, un fichier contenant un octet NUL est ignoré comme binaire.101 `dirs`, `extensions` et `maxFileSize` ne sont vérifiées que si `searchDocs` ou `autoSearchDocs` vaut true. Les dossiers cachés (`.git`, `.mm`…) et `node_modules` sont ignorés, les liens symboliques ne sont pas suivis, un fichier contenant un octet NUL est ignoré comme binaire.
101 102
103+## Clés de `metaPrompts`
104+
105+Une liste (ticket 272). Chaque entrée ajoute un méta-prompt au sélecteur `[` de la fenêtre ([Les quatre sélecteurs](slash-commands.md#les-quatre-sélecteurs)), après les 13 intégrés, dans l'ordre donné ; une entrée dont le libellé est celui d'un intégré (casse ignorée) **remplace** celui-ci, à sa place.
106+
107+| Clé | Type | Défaut | Description |
108+|-----|------|--------|-------------|
109+| `metaPrompts[].prefix` | chaîne | — | Le libellé, crochets compris : `"[Haiku]"` (guillemets obligatoires en YAML). Obligatoire. Une paire de crochets autour d'un nom non vide, sur une ligne. L'espace qui le suit dans la zone est ajoutée par mm. |
110+| `metaPrompts[].description` | chaîne | — | Affichée à côté du libellé dans le sélecteur. Obligatoire. |
111+
112+```yaml
113+metaPrompts:
114+ - prefix: "[Haiku]"
115+ description: Answer as a haiku (5-7-5)
116+ - prefix: "[Brief]" # le libellé d'un intégré : le remplace
117+ description: Two sentences at most
118+```
119+
120+La description est pour l'utilisateur : **le modèle ne lit que le préfixe** tapé devant la question. Quand le nom ne dit pas tout (une longueur, un format, un intégré reformulé), dites ce qu'il signifie dans `system` — mesuré dans `demos/meta-prompts` : sans cela, Qwen3.5 4B a répondu à `[Commit Message] …` par un compliment au lieu d'un message de commit.
121+
102 ## Clés de `trace`122 ## Clés de `trace`
103 123
104 | Clé | Type | Défaut | Description |124 | Clé | Type | Défaut | Description |
@@ -477,6 +497,10 @@ Signalées sur stderr sous la forme `[config error: <chemin>: <message>]`, code
477 | `context.maxMessages must be >= 0` | valeur négative |497 | `context.maxMessages must be >= 0` | valeur négative |
478 | `sessions.dir must not be empty` | chaîne vide |498 | `sessions.dir must not be empty` | chaîne vide |
479 | `docSearch.dirs must name at least one folder` | `dirs: []` avec un interrupteur activé |499 | `docSearch.dirs must name at least one folder` | `dirs: []` avec un interrupteur activé |
500+| `metaPrompts[N].prefix: "…" must be a name in brackets, like "[Haiku]"` | un préfixe sans ses crochets |
501+| `metaPrompts[N].prefix: "…" must hold a name, on one line, with no other bracket` | `"[]"`, `"[ ]"`, `"[a]b]"` |
502+| `metaPrompts[N].description: the picker shows it beside [X] — it must not be empty` | pas de `description` |
503+| `metaPrompts[N].prefix: [X] is listed twice` | deux entrées au même libellé (casse ignorée) |
480 | `docSearch.dirs: a folder must not be empty` | `dirs: [""]` |504 | `docSearch.dirs: a folder must not be empty` | `dirs: [""]` |
481 | `docSearch.extensions must name at least one extension` | `extensions: []` avec un interrupteur activé |505 | `docSearch.extensions must name at least one extension` | `extensions: []` avec un interrupteur activé |
482 | `docSearch.extensions: "md" must start with a dot, like ".md"` | une extension sans son point |506 | `docSearch.extensions: "md" must start with a dot, like ".md"` | une extension sans son point |
modified docs/fr/reference/slash-commands.md +1 -1
@@ -196,7 +196,7 @@ Une fenêtre surgissante s'ouvre au-dessus de la conversation dès que vous tape
196196 | `/` | les commandes de la fenêtre | seulement comme premier mot entier de la zone — une commande *est* le message | la commande, en remplaçant la zone, avec une espace si elle prend un argument |
197197 | `@` | fichiers et dossiers sous le répertoire de travail | n'importe où dans une phrase | le chemin avec son `@` conservé. Un **dossier** reçoit un `/` final et pas d'espace, donc Tab à nouveau descend dans l'arbre ; un **fichier** reçoit une espace, donc la phrase continue |
198198 | `$` | les skills du catalogue | n'importe où dans une phrase | `$nom` — le `$` **conservé** — plus une espace, curseur après, prêt pour les paramètres du skill |
199-| `[` | les 13 méta-prompts (ticket 270) : des préfixes de style qui orientent la forme de la réponse — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — resserrés par le nom tapé après le `[`, espaces compris (`[As a` → les trois « As a … ») | seulement comme **premier caractère** d'une zone d'une ligne, curseur à la fin, avant tout `]` | le préfixe avec son espace finale (`[Brief] `), à la place du `[…` de la zone, curseur après : tapez la question. Le préfixe fait partie de la question, envoyé et enregistré tel quel |
199+| `[` | les 13 méta-prompts intégrés (ticket 270), plus ceux de l'agent dans `metaPrompts:` (ticket 272, voir [configuration](configuration.md#clés-de-metaprompts)) : des préfixes de style qui orientent la forme de la réponse — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — resserrés par le nom tapé après le `[`, espaces compris (`[As a` → les trois « As a … ») | seulement comme **premier caractère** d'une zone d'une ligne, curseur à la fin, avant tout `]` | le préfixe avec son espace finale (`[Brief] `), à la place du `[…` de la zone, curseur après : tapez la question. Le préfixe fait partie de la question, envoyé et enregistré tel quel |
200200
201201 Quatre règles gardent la fenêtre à sa place :
202202
@@ -196,7 +196,7 @@ Une fenêtre surgissante s'ouvre au-dessus de la conversation dès que vous tape
196 | `/` | les commandes de la fenêtre | seulement comme premier mot entier de la zone — une commande *est* le message | la commande, en remplaçant la zone, avec une espace si elle prend un argument |196 | `/` | les commandes de la fenêtre | seulement comme premier mot entier de la zone — une commande *est* le message | la commande, en remplaçant la zone, avec une espace si elle prend un argument |
197 | `@` | fichiers et dossiers sous le répertoire de travail | n'importe où dans une phrase | le chemin avec son `@` conservé. Un **dossier** reçoit un `/` final et pas d'espace, donc Tab à nouveau descend dans l'arbre ; un **fichier** reçoit une espace, donc la phrase continue |197 | `@` | fichiers et dossiers sous le répertoire de travail | n'importe où dans une phrase | le chemin avec son `@` conservé. Un **dossier** reçoit un `/` final et pas d'espace, donc Tab à nouveau descend dans l'arbre ; un **fichier** reçoit une espace, donc la phrase continue |
198 | `$` | les skills du catalogue | n'importe où dans une phrase | `$nom` — le `$` **conservé** — plus une espace, curseur après, prêt pour les paramètres du skill |198 | `$` | les skills du catalogue | n'importe où dans une phrase | `$nom` — le `$` **conservé** — plus une espace, curseur après, prêt pour les paramètres du skill |
199-| `[` | les 13 méta-prompts (ticket 270) : des préfixes de style qui orientent la forme de la réponse — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — resserrés par le nom tapé après le `[`, espaces compris (`[As a` → les trois « As a … ») | seulement comme **premier caractère** d'une zone d'une ligne, curseur à la fin, avant tout `]` | le préfixe avec son espace finale (`[Brief] `), à la place du `[…` de la zone, curseur après : tapez la question. Le préfixe fait partie de la question, envoyé et enregistré tel quel |199+| `[` | les 13 méta-prompts intégrés (ticket 270), plus ceux de l'agent dans `metaPrompts:` (ticket 272, voir [configuration](configuration.md#clés-de-metaprompts)) : des préfixes de style qui orientent la forme de la réponse — `[Brief]`, `[In Layman's Terms]`, `[As a Story]`, `[Pros and Cons]`, `[Step-by-Step]`, `[Factual]`, `[Opinion]`, `[Comparison]`, `[Timeline]`, `[As a Poem]`, `[For Kids]`, `[Advantages Only]`, `[As a Recipe]` — resserrés par le nom tapé après le `[`, espaces compris (`[As a` → les trois « As a … ») | seulement comme **premier caractère** d'une zone d'une ligne, curseur à la fin, avant tout `]` | le préfixe avec son espace finale (`[Brief] `), à la place du `[…` de la zone, curseur après : tapez la question. Le préfixe fait partie de la question, envoyé et enregistré tel quel |
200 200
201 Quatre règles gardent la fenêtre à sa place :201 Quatre règles gardent la fenêtre à sa place :
202 202
modified internal/config/config.go +8 -0
@@ -273,6 +273,11 @@ type Config struct {
273273 // by default.
274274 DocSearch DocSearchConfig `yaml:"docSearch"`
275275
276+ // MetaPrompts: the agent's own meta-prompts for the window's `[`
277+ // picker (ticket 272), beside the built-in ones; a built-in's label
278+ // replaces it (internal/metaprompt.Configured).
279+ MetaPrompts []MetaPromptConfig `yaml:"metaPrompts"`
280+
276281 // Trace: write every request sent to the model and every response, as
277282 // they travel on the wire, to files (internal/engine/trace.go). Off
278283 // unless `trace.enabled: true` or AGENT_TRACE=true.
@@ -1229,6 +1234,9 @@ func (c Config) validate() error {
12291234 if err := c.validateTools(); err != nil {
12301235 return err
12311236 }
1237+ if err := validateMetaPrompts(c.MetaPrompts); err != nil {
1238+ return err
1239+ }
12321240 if err := c.DocSearch.validate(); err != nil {
12331241 return err
12341242 }
@@ -273,6 +273,11 @@ type Config struct {
273 // by default.273 // by default.
274 DocSearch DocSearchConfig `yaml:"docSearch"`274 DocSearch DocSearchConfig `yaml:"docSearch"`
275 275
276+ // MetaPrompts: the agent's own meta-prompts for the window's `[`
277+ // picker (ticket 272), beside the built-in ones; a built-in's label
278+ // replaces it (internal/metaprompt.Configured).
279+ MetaPrompts []MetaPromptConfig `yaml:"metaPrompts"`
280+
276 // Trace: write every request sent to the model and every response, as281 // Trace: write every request sent to the model and every response, as
277 // they travel on the wire, to files (internal/engine/trace.go). Off282 // they travel on the wire, to files (internal/engine/trace.go). Off
278 // unless `trace.enabled: true` or AGENT_TRACE=true.283 // unless `trace.enabled: true` or AGENT_TRACE=true.
@@ -1229,6 +1234,9 @@ func (c Config) validate() error {
1229 if err := c.validateTools(); err != nil {1234 if err := c.validateTools(); err != nil {
1230 return err1235 return err
1231 }1236 }
1237+ if err := validateMetaPrompts(c.MetaPrompts); err != nil {
1238+ return err
1239+ }
1232 if err := c.DocSearch.validate(); err != nil {1240 if err := c.DocSearch.validate(); err != nil {
1233 return err1241 return err
1234 }1242 }
added internal/config/metaprompts.go +50 -0
new file mode 100644
@@ -0,0 +1,50 @@
1+package config
2+
3+import (
4+ "fmt"
5+ "strings"
6+)
7+
8+// MetaPromptConfig is one entry of the `metaPrompts:` list (ticket 272): a
9+// meta-prompt of the agent's own, offered by the window's `[` picker beside
10+// the built-in ones (internal/metaprompt).
11+//
12+// metaPrompts:
13+// - prefix: "[Haiku]"
14+// description: Answer as a haiku
15+// - prefix: "[Brief]" # a built-in's label: replaces it
16+// description: Two sentences at most
17+type MetaPromptConfig struct {
18+ // Prefix is the label, brackets included: "[Haiku]". The space that
19+ // follows it in the box is added by mm.
20+ Prefix string `yaml:"prefix"`
21+ // Description is the short text shown beside it in the picker.
22+ Description string `yaml:"description"`
23+}
24+
25+// Label is the prefix as written, trimmed: "[Haiku]".
26+func (m MetaPromptConfig) Label() string { return strings.TrimSpace(m.Prefix) }
27+
28+// validateMetaPrompts checks every entry: a "[name]" prefix — one pair of
29+// brackets around a non-empty name on one line —, a description, and no two
30+// entries with the same label (case ignored).
31+func validateMetaPrompts(list []MetaPromptConfig) error {
32+ seen := map[string]bool{}
33+ for i, m := range list {
34+ where := fmt.Sprintf("metaPrompts[%d]", i)
35+ label := m.Label()
36+ name := strings.TrimSuffix(strings.TrimPrefix(label, "["), "]")
37+ switch {
38+ case !strings.HasPrefix(label, "[") || !strings.HasSuffix(label, "]") || len(label) < 2:
39+ return fmt.Errorf("%s.prefix: %q must be a name in brackets, like \"[Haiku]\"", where, m.Prefix)
40+ case strings.TrimSpace(name) == "" || strings.ContainsAny(name, "[]\n\r\t"):
41+ return fmt.Errorf("%s.prefix: %q must hold a name, on one line, with no other bracket", where, m.Prefix)
42+ case strings.TrimSpace(m.Description) == "":
43+ return fmt.Errorf("%s.description: the picker shows it beside %s — it must not be empty", where, label)
44+ case seen[strings.ToLower(label)]:
45+ return fmt.Errorf("%s.prefix: %s is listed twice", where, label)
46+ }
47+ seen[strings.ToLower(label)] = true
48+ }
49+ return nil
50+}
new file mode 100644
@@ -0,0 +1,50 @@
1+package config
2+
3+import (
4+ "fmt"
5+ "strings"
6+)
7+
8+// MetaPromptConfig is one entry of the `metaPrompts:` list (ticket 272): a
9+// meta-prompt of the agent's own, offered by the window's `[` picker beside
10+// the built-in ones (internal/metaprompt).
11+//
12+// metaPrompts:
13+// - prefix: "[Haiku]"
14+// description: Answer as a haiku
15+// - prefix: "[Brief]" # a built-in's label: replaces it
16+// description: Two sentences at most
17+type MetaPromptConfig struct {
18+ // Prefix is the label, brackets included: "[Haiku]". The space that
19+ // follows it in the box is added by mm.
20+ Prefix string `yaml:"prefix"`
21+ // Description is the short text shown beside it in the picker.
22+ Description string `yaml:"description"`
23+}
24+
25+// Label is the prefix as written, trimmed: "[Haiku]".
26+func (m MetaPromptConfig) Label() string { return strings.TrimSpace(m.Prefix) }
27+
28+// validateMetaPrompts checks every entry: a "[name]" prefix — one pair of
29+// brackets around a non-empty name on one line —, a description, and no two
30+// entries with the same label (case ignored).
31+func validateMetaPrompts(list []MetaPromptConfig) error {
32+ seen := map[string]bool{}
33+ for i, m := range list {
34+ where := fmt.Sprintf("metaPrompts[%d]", i)
35+ label := m.Label()
36+ name := strings.TrimSuffix(strings.TrimPrefix(label, "["), "]")
37+ switch {
38+ case !strings.HasPrefix(label, "[") || !strings.HasSuffix(label, "]") || len(label) < 2:
39+ return fmt.Errorf("%s.prefix: %q must be a name in brackets, like \"[Haiku]\"", where, m.Prefix)
40+ case strings.TrimSpace(name) == "" || strings.ContainsAny(name, "[]\n\r\t"):
41+ return fmt.Errorf("%s.prefix: %q must hold a name, on one line, with no other bracket", where, m.Prefix)
42+ case strings.TrimSpace(m.Description) == "":
43+ return fmt.Errorf("%s.description: the picker shows it beside %s — it must not be empty", where, label)
44+ case seen[strings.ToLower(label)]:
45+ return fmt.Errorf("%s.prefix: %s is listed twice", where, label)
46+ }
47+ seen[strings.ToLower(label)] = true
48+ }
49+ return nil
50+}
added internal/config/metaprompts_test.go +45 -0
new file mode 100644
@@ -0,0 +1,45 @@
1+package config
2+
3+import (
4+ "os"
5+ "path/filepath"
6+ "strings"
7+ "testing"
8+)
9+
10+// metaPrompts: (ticket 272) is read from the file and each entry checked.
11+func TestMetaPromptsConfig(t *testing.T) {
12+ defaults := Cfg
13+ t.Cleanup(func() { Cfg = defaults })
14+ load := func(yaml string) error {
15+ Cfg = defaults
16+ path := filepath.Join(t.TempDir(), "agent.yaml")
17+ if err := os.WriteFile(path, []byte(yaml), 0o644); err != nil {
18+ t.Fatal(err)
19+ }
20+ _, err := Load(path)
21+ return err
22+ }
23+ if len(Cfg.MetaPrompts) != 0 {
24+ t.Fatalf("default: %+v", Cfg.MetaPrompts)
25+ }
26+ ok := "metaPrompts:\n - prefix: \"[Haiku]\"\n description: Answer as a haiku\n - prefix: \" [Brief] \"\n description: Two sentences\n"
27+ if err := load(ok); err != nil {
28+ t.Fatal(err)
29+ }
30+ if got := Cfg.MetaPrompts; len(got) != 2 || got[0].Label() != "[Haiku]" || got[1].Label() != "[Brief]" || got[0].Description != "Answer as a haiku" {
31+ t.Errorf("loaded: %+v", got)
32+ }
33+ for yaml, word := range map[string]string{
34+ "metaPrompts:\n - prefix: Haiku\n description: x\n": "name in brackets",
35+ "metaPrompts:\n - prefix: \"[]\"\n description: x\n": "must hold a name",
36+ "metaPrompts:\n - prefix: \"[ ]\"\n description: x\n": "must hold a name",
37+ "metaPrompts:\n - prefix: \"[a]b]\"\n description: x\n": "no other bracket",
38+ "metaPrompts:\n - prefix: \"[Haiku]\"\n": "description",
39+ "metaPrompts:\n - prefix: \"[Haiku]\"\n description: a\n - prefix: \"[haiku]\"\n description: b\n": "twice",
40+ } {
41+ if err := load(yaml); err == nil || !strings.Contains(err.Error(), word) {
42+ t.Errorf("%q: err = %v, want one naming %q", yaml, err, word)
43+ }
44+ }
45+}
new file mode 100644
@@ -0,0 +1,45 @@
1+package config
2+
3+import (
4+ "os"
5+ "path/filepath"
6+ "strings"
7+ "testing"
8+)
9+
10+// metaPrompts: (ticket 272) is read from the file and each entry checked.
11+func TestMetaPromptsConfig(t *testing.T) {
12+ defaults := Cfg
13+ t.Cleanup(func() { Cfg = defaults })
14+ load := func(yaml string) error {
15+ Cfg = defaults
16+ path := filepath.Join(t.TempDir(), "agent.yaml")
17+ if err := os.WriteFile(path, []byte(yaml), 0o644); err != nil {
18+ t.Fatal(err)
19+ }
20+ _, err := Load(path)
21+ return err
22+ }
23+ if len(Cfg.MetaPrompts) != 0 {
24+ t.Fatalf("default: %+v", Cfg.MetaPrompts)
25+ }
26+ ok := "metaPrompts:\n - prefix: \"[Haiku]\"\n description: Answer as a haiku\n - prefix: \" [Brief] \"\n description: Two sentences\n"
27+ if err := load(ok); err != nil {
28+ t.Fatal(err)
29+ }
30+ if got := Cfg.MetaPrompts; len(got) != 2 || got[0].Label() != "[Haiku]" || got[1].Label() != "[Brief]" || got[0].Description != "Answer as a haiku" {
31+ t.Errorf("loaded: %+v", got)
32+ }
33+ for yaml, word := range map[string]string{
34+ "metaPrompts:\n - prefix: Haiku\n description: x\n": "name in brackets",
35+ "metaPrompts:\n - prefix: \"[]\"\n description: x\n": "must hold a name",
36+ "metaPrompts:\n - prefix: \"[ ]\"\n description: x\n": "must hold a name",
37+ "metaPrompts:\n - prefix: \"[a]b]\"\n description: x\n": "no other bracket",
38+ "metaPrompts:\n - prefix: \"[Haiku]\"\n": "description",
39+ "metaPrompts:\n - prefix: \"[Haiku]\"\n description: a\n - prefix: \"[haiku]\"\n description: b\n": "twice",
40+ } {
41+ if err := load(yaml); err == nil || !strings.Contains(err.Error(), word) {
42+ t.Errorf("%q: err = %v, want one naming %q", yaml, err, word)
43+ }
44+ }
45+}
modified internal/metaprompt/metaprompt.go +64 -13
@@ -4,16 +4,20 @@
44 // part of the user's message and the model reads it as an inline
55 // instruction. No front end and no part of the agent loop treats it apart.
66 //
7-// The catalogue is hard-coded (the user's decision): thirteen entries, the
8-// ones pk offers. The window lists them in its `[` picker — the only way in
7+// Thirteen built-in entries, the ones pk offers; an agent adds its own, or
8+// rewords a built-in, with `metaPrompts:` in its file (ticket 272). The window lists them in its `[` picker — the only way in
99 // (no slash command): the line mode and an editor take a prefix typed by
1010 // hand, which the model reads just the same.
1111 //
12-// for _, m := range metaprompt.Matching("as") { fmt.Println(m.Label()) }
12+// for _, m := range metaprompt.Matching(metaprompt.Configured(), "as") { fmt.Println(m.Label()) }
1313 // // [As a Story] [As a Poem] [As a Recipe]
1414 package metaprompt
1515
16-import "strings"
16+import (
17+ "strings"
18+
19+ "mm/internal/config"
20+)
1721
1822 // MetaPrompt is one entry of the catalogue.
1923 type MetaPrompt struct {
@@ -52,20 +56,67 @@ var catalogue = []MetaPrompt{
5256 {Token: "recipe", Prefix: "[As a Recipe] ", Description: "Information as a recipe"},
5357 }
5458
55-// All returns the catalogue, in display order. The slice is a copy.
59+// All returns the built-in catalogue, in display order. The slice is a copy.
5660 func All() []MetaPrompt { return append([]MetaPrompt(nil), catalogue...) }
5761
58-// Matching returns the entries whose name starts with what was typed after
59-// the `[`, case ignored: "Ste" → [Step-by-Step].
60-// Empty matches them all. The name is matched, not the token, because the
61-// name is what the box shows: "[Ste" → [Step-by-Step].
62+// Merge returns the built-in catalogue with the agent's own entries
63+// (ticket 272): an entry whose label is a built-in's (case ignored)
64+// replaces it IN PLACE — its description, and the label's spelling —, any
65+// other is added after the built-ins, in the order given.
66+//
67+// Merge([]MetaPrompt{{Prefix: "[Haiku] ", Description: "As a haiku"}})
68+// // the 13 built-ins, then [Haiku]
69+func Merge(own []MetaPrompt) []MetaPrompt {
70+ out := All()
71+ at := map[string]int{}
72+ for i, m := range out {
73+ at[strings.ToLower(m.Label())] = i
74+ }
75+ for _, m := range own {
76+ if i, ok := at[strings.ToLower(m.Label())]; ok {
77+ m.Token = out[i].Token
78+ out[i] = m
79+ continue
80+ }
81+ at[strings.ToLower(m.Label())] = len(out)
82+ out = append(out, m)
83+ }
84+ return out
85+}
86+
87+// Configured is the catalogue the window offers: the built-ins merged with
88+// the configuration's `metaPrompts:` list (already checked by
89+// config.Load).
90+func Configured() []MetaPrompt {
91+ own := make([]MetaPrompt, 0, len(config.Cfg.MetaPrompts))
92+ for _, c := range config.Cfg.MetaPrompts {
93+ label := c.Label()
94+ own = append(own, MetaPrompt{
95+ Token: token(label),
96+ Prefix: label + " ",
97+ Description: strings.TrimSpace(c.Description),
98+ })
99+ }
100+ return Merge(own)
101+}
102+
103+// token is a kebab-case name for a label: "[Code Review]" → "code-review".
104+func token(label string) string {
105+ name := strings.Trim(label, "[]")
106+ return strings.Join(strings.Fields(strings.ToLower(name)), "-")
107+}
108+
109+// Matching returns the entries of list whose name starts with what was
110+// typed after the `[`, case ignored. Empty matches them all. The name is
111+// matched, not the token, because the name is what the box shows: "[Ste" →
112+// [Step-by-Step].
62113 //
63-// metaprompt.Matching("b") // [Brief]
64-// metaprompt.Matching("as") // [As a Story], [As a Poem], [As a Recipe]
65-func Matching(typed string) []MetaPrompt {
114+// metaprompt.Matching(metaprompt.All(), "b") // [Brief]
115+// metaprompt.Matching(metaprompt.All(), "as") // [As a Story], [As a Poem], [As a Recipe]
116+func Matching(list []MetaPrompt, typed string) []MetaPrompt {
66117 typed = strings.ToLower(typed)
67118 var out []MetaPrompt
68- for _, m := range catalogue {
119+ for _, m := range list {
69120 if strings.HasPrefix(strings.ToLower(m.name()), typed) {
70121 out = append(out, m)
71122 }
@@ -4,16 +4,20 @@
4 // part of the user's message and the model reads it as an inline4 // part of the user's message and the model reads it as an inline
5 // instruction. No front end and no part of the agent loop treats it apart.5 // instruction. No front end and no part of the agent loop treats it apart.
6 //6 //
7-// The catalogue is hard-coded (the user's decision): thirteen entries, the7+// Thirteen built-in entries, the ones pk offers; an agent adds its own, or
8-// ones pk offers. The window lists them in its `[` picker — the only way in8+// rewords a built-in, with `metaPrompts:` in its file (ticket 272). The window lists them in its `[` picker — the only way in
9 // (no slash command): the line mode and an editor take a prefix typed by9 // (no slash command): the line mode and an editor take a prefix typed by
10 // hand, which the model reads just the same.10 // hand, which the model reads just the same.
11 //11 //
12-// for _, m := range metaprompt.Matching("as") { fmt.Println(m.Label()) }12+// for _, m := range metaprompt.Matching(metaprompt.Configured(), "as") { fmt.Println(m.Label()) }
13 // // [As a Story] [As a Poem] [As a Recipe]13 // // [As a Story] [As a Poem] [As a Recipe]
14 package metaprompt14 package metaprompt
15 15
16-import "strings"16+import (
17+ "strings"
18+
19+ "mm/internal/config"
20+)
17 21
18 // MetaPrompt is one entry of the catalogue.22 // MetaPrompt is one entry of the catalogue.
19 type MetaPrompt struct {23 type MetaPrompt struct {
@@ -52,20 +56,67 @@ var catalogue = []MetaPrompt{
52 {Token: "recipe", Prefix: "[As a Recipe] ", Description: "Information as a recipe"},56 {Token: "recipe", Prefix: "[As a Recipe] ", Description: "Information as a recipe"},
53 }57 }
54 58
55-// All returns the catalogue, in display order. The slice is a copy.59+// All returns the built-in catalogue, in display order. The slice is a copy.
56 func All() []MetaPrompt { return append([]MetaPrompt(nil), catalogue...) }60 func All() []MetaPrompt { return append([]MetaPrompt(nil), catalogue...) }
57 61
58-// Matching returns the entries whose name starts with what was typed after62+// Merge returns the built-in catalogue with the agent's own entries
59-// the `[`, case ignored: "Ste" → [Step-by-Step].63+// (ticket 272): an entry whose label is a built-in's (case ignored)
60-// Empty matches them all. The name is matched, not the token, because the64+// replaces it IN PLACE — its description, and the label's spelling —, any
61-// name is what the box shows: "[Ste" → [Step-by-Step].65+// other is added after the built-ins, in the order given.
66+//
67+// Merge([]MetaPrompt{{Prefix: "[Haiku] ", Description: "As a haiku"}})
68+// // the 13 built-ins, then [Haiku]
69+func Merge(own []MetaPrompt) []MetaPrompt {
70+ out := All()
71+ at := map[string]int{}
72+ for i, m := range out {
73+ at[strings.ToLower(m.Label())] = i
74+ }
75+ for _, m := range own {
76+ if i, ok := at[strings.ToLower(m.Label())]; ok {
77+ m.Token = out[i].Token
78+ out[i] = m
79+ continue
80+ }
81+ at[strings.ToLower(m.Label())] = len(out)
82+ out = append(out, m)
83+ }
84+ return out
85+}
86+
87+// Configured is the catalogue the window offers: the built-ins merged with
88+// the configuration's `metaPrompts:` list (already checked by
89+// config.Load).
90+func Configured() []MetaPrompt {
91+ own := make([]MetaPrompt, 0, len(config.Cfg.MetaPrompts))
92+ for _, c := range config.Cfg.MetaPrompts {
93+ label := c.Label()
94+ own = append(own, MetaPrompt{
95+ Token: token(label),
96+ Prefix: label + " ",
97+ Description: strings.TrimSpace(c.Description),
98+ })
99+ }
100+ return Merge(own)
101+}
102+
103+// token is a kebab-case name for a label: "[Code Review]" → "code-review".
104+func token(label string) string {
105+ name := strings.Trim(label, "[]")
106+ return strings.Join(strings.Fields(strings.ToLower(name)), "-")
107+}
108+
109+// Matching returns the entries of list whose name starts with what was
110+// typed after the `[`, case ignored. Empty matches them all. The name is
111+// matched, not the token, because the name is what the box shows: "[Ste" →
112+// [Step-by-Step].
62 //113 //
63-// metaprompt.Matching("b") // [Brief]114+// metaprompt.Matching(metaprompt.All(), "b") // [Brief]
64-// metaprompt.Matching("as") // [As a Story], [As a Poem], [As a Recipe]115+// metaprompt.Matching(metaprompt.All(), "as") // [As a Story], [As a Poem], [As a Recipe]
65-func Matching(typed string) []MetaPrompt {116+func Matching(list []MetaPrompt, typed string) []MetaPrompt {
66 typed = strings.ToLower(typed)117 typed = strings.ToLower(typed)
67 var out []MetaPrompt118 var out []MetaPrompt
68- for _, m := range catalogue {119+ for _, m := range list {
69 if strings.HasPrefix(strings.ToLower(m.name()), typed) {120 if strings.HasPrefix(strings.ToLower(m.name()), typed) {
70 out = append(out, m)121 out = append(out, m)
71 }122 }
modified internal/metaprompt/metaprompt_test.go +42 -3
@@ -3,6 +3,8 @@ package metaprompt
33 import (
44 "strings"
55 "testing"
6+
7+ "mm/internal/config"
68 )
79
810 // The catalogue's shape: pk's rules — fields filled, "[…] " prefixes that
@@ -44,11 +46,48 @@ func TestMatching(t *testing.T) {
4446 "x": "",
4547 }
4648 for in, want := range cases {
47- if got := names(Matching(in)); got != want {
49+ if got := names(Matching(All(), in)); got != want {
4850 t.Errorf("Matching(%q) = %s; want %s", in, got, want)
4951 }
5052 }
51- if len(Matching("")) != 13 {
52- t.Errorf("empty matches %d", len(Matching("")))
53+ if len(Matching(All(), "")) != 13 {
54+ t.Errorf("empty matches %d", len(Matching(All(), "")))
55+ }
56+}
57+
58+// Merge (ticket 272): a built-in's label replaces it in place, any other is
59+// added after the built-ins, in order.
60+func TestMerge(t *testing.T) {
61+ got := Merge([]MetaPrompt{
62+ {Prefix: "[Haiku] ", Description: "As a haiku"},
63+ {Prefix: "[brief] ", Description: "Two sentences at most"},
64+ {Prefix: "[Code Review] ", Description: "As a code review"},
65+ })
66+ if len(got) != 15 {
67+ t.Fatalf("%d entries, want 13 + 2", len(got))
68+ }
69+ if got[0].Prefix != "[brief] " || got[0].Description != "Two sentences at most" || got[0].Token != "brief" {
70+ t.Errorf("replaced built-in: %+v", got[0])
71+ }
72+ if got[13].Label() != "[Haiku]" || got[14].Label() != "[Code Review]" {
73+ t.Errorf("added: %+v %+v", got[13], got[14])
74+ }
75+ if len(Merge(nil)) != 13 || All()[0].Description != "Concise answer" {
76+ t.Error("Merge must not touch the built-ins")
77+ }
78+}
79+
80+// Configured reads config.Cfg.MetaPrompts.
81+func TestConfigured(t *testing.T) {
82+ saved := config.Cfg.MetaPrompts
83+ t.Cleanup(func() { config.Cfg.MetaPrompts = saved })
84+ config.Cfg.MetaPrompts = []config.MetaPromptConfig{{Prefix: " [Code Review] ", Description: " As a review "}}
85+ got := Configured()
86+ last := got[len(got)-1]
87+ if len(got) != 14 || last.Prefix != "[Code Review] " || last.Description != "As a review" || last.Token != "code-review" {
88+ t.Errorf("configured: %d, last %+v", len(got), last)
89+ }
90+ if got := Matching(got, "co"); len(got) != 2 || got[1].Label() != "[Code Review]" {
91+ t.Errorf("Matching co: %+v", got)
5392 }
5493 }
@@ -3,6 +3,8 @@ package metaprompt
3 import (3 import (
4 "strings"4 "strings"
5 "testing"5 "testing"
6+
7+ "mm/internal/config"
6 )8 )
7 9
8 // The catalogue's shape: pk's rules — fields filled, "[…] " prefixes that10 // The catalogue's shape: pk's rules — fields filled, "[…] " prefixes that
@@ -44,11 +46,48 @@ func TestMatching(t *testing.T) {
44 "x": "",46 "x": "",
45 }47 }
46 for in, want := range cases {48 for in, want := range cases {
47- if got := names(Matching(in)); got != want {49+ if got := names(Matching(All(), in)); got != want {
48 t.Errorf("Matching(%q) = %s; want %s", in, got, want)50 t.Errorf("Matching(%q) = %s; want %s", in, got, want)
49 }51 }
50 }52 }
51- if len(Matching("")) != 13 {53+ if len(Matching(All(), "")) != 13 {
52- t.Errorf("empty matches %d", len(Matching("")))54+ t.Errorf("empty matches %d", len(Matching(All(), "")))
55+ }
56+}
57+
58+// Merge (ticket 272): a built-in's label replaces it in place, any other is
59+// added after the built-ins, in order.
60+func TestMerge(t *testing.T) {
61+ got := Merge([]MetaPrompt{
62+ {Prefix: "[Haiku] ", Description: "As a haiku"},
63+ {Prefix: "[brief] ", Description: "Two sentences at most"},
64+ {Prefix: "[Code Review] ", Description: "As a code review"},
65+ })
66+ if len(got) != 15 {
67+ t.Fatalf("%d entries, want 13 + 2", len(got))
68+ }
69+ if got[0].Prefix != "[brief] " || got[0].Description != "Two sentences at most" || got[0].Token != "brief" {
70+ t.Errorf("replaced built-in: %+v", got[0])
71+ }
72+ if got[13].Label() != "[Haiku]" || got[14].Label() != "[Code Review]" {
73+ t.Errorf("added: %+v %+v", got[13], got[14])
74+ }
75+ if len(Merge(nil)) != 13 || All()[0].Description != "Concise answer" {
76+ t.Error("Merge must not touch the built-ins")
77+ }
78+}
79+
80+// Configured reads config.Cfg.MetaPrompts.
81+func TestConfigured(t *testing.T) {
82+ saved := config.Cfg.MetaPrompts
83+ t.Cleanup(func() { config.Cfg.MetaPrompts = saved })
84+ config.Cfg.MetaPrompts = []config.MetaPromptConfig{{Prefix: " [Code Review] ", Description: " As a review "}}
85+ got := Configured()
86+ last := got[len(got)-1]
87+ if len(got) != 14 || last.Prefix != "[Code Review] " || last.Description != "As a review" || last.Token != "code-review" {
88+ t.Errorf("configured: %d, last %+v", len(got), last)
89+ }
90+ if got := Matching(got, "co"); len(got) != 2 || got[1].Label() != "[Code Review]" {
91+ t.Errorf("Matching co: %+v", got)
53 }92 }
54 }93 }
modified internal/tui/metaprompt_test.go +25 -0
@@ -5,6 +5,8 @@ import (
55 "testing"
66
77 "github.com/gdamore/tcell/v2"
8+
9+ "mm/internal/metaprompt"
810 )
911
1012 // Ticket 270: `[` as the first character of the box opens the meta-prompt
@@ -72,3 +74,26 @@ func TestRuleNamesTheBracketPicker(t *testing.T) {
7274 t.Errorf("rule without the `[` picker:\n%s", text)
7375 }
7476 }
77+
78+// The picker offers the agent's own meta-prompts (ticket 272).
79+func TestBracketPickerOffersTheAgentsOwn(t *testing.T) {
80+ hs := newHarness(t, 80, 24)
81+ hs.v.metas = metaprompt.Merge([]metaprompt.MetaPrompt{
82+ {Prefix: "[Haiku] ", Description: "Answer as a haiku"},
83+ {Prefix: "[Brief] ", Description: "Two sentences at most"},
84+ })
85+ hs.typeText("[")
86+ if got := len(hs.v.choices()); got != 14 {
87+ t.Fatalf("%d choices, want 14", got)
88+ }
89+ hs.typeText("Ha")
90+ hs.key(tcell.KeyEnter, tcell.ModNone)
91+ if hs.v.Input() != "[Haiku] " {
92+ t.Fatalf("box %q", hs.v.Input())
93+ }
94+ hs.v.setInput("")
95+ hs.typeText("[Bri")
96+ if text := hs.screenText(); !strings.Contains(text, "Two sentences at most") || strings.Contains(text, "Concise answer") {
97+ t.Errorf("the built-in was not reworded:\n%s", text)
98+ }
99+}
@@ -5,6 +5,8 @@ import (
5 "testing"5 "testing"
6 6
7 "github.com/gdamore/tcell/v2"7 "github.com/gdamore/tcell/v2"
8+
9+ "mm/internal/metaprompt"
8 )10 )
9 11
10 // Ticket 270: `[` as the first character of the box opens the meta-prompt12 // Ticket 270: `[` as the first character of the box opens the meta-prompt
@@ -72,3 +74,26 @@ func TestRuleNamesTheBracketPicker(t *testing.T) {
72 t.Errorf("rule without the `[` picker:\n%s", text)74 t.Errorf("rule without the `[` picker:\n%s", text)
73 }75 }
74 }76 }
77+
78+// The picker offers the agent's own meta-prompts (ticket 272).
79+func TestBracketPickerOffersTheAgentsOwn(t *testing.T) {
80+ hs := newHarness(t, 80, 24)
81+ hs.v.metas = metaprompt.Merge([]metaprompt.MetaPrompt{
82+ {Prefix: "[Haiku] ", Description: "Answer as a haiku"},
83+ {Prefix: "[Brief] ", Description: "Two sentences at most"},
84+ })
85+ hs.typeText("[")
86+ if got := len(hs.v.choices()); got != 14 {
87+ t.Fatalf("%d choices, want 14", got)
88+ }
89+ hs.typeText("Ha")
90+ hs.key(tcell.KeyEnter, tcell.ModNone)
91+ if hs.v.Input() != "[Haiku] " {
92+ t.Fatalf("box %q", hs.v.Input())
93+ }
94+ hs.v.setInput("")
95+ hs.typeText("[Bri")
96+ if text := hs.screenText(); !strings.Contains(text, "Two sentences at most") || strings.Contains(text, "Concise answer") {
97+ t.Errorf("the built-in was not reworded:\n%s", text)
98+ }
99+}
modified internal/tui/picker.go +12 -3
@@ -101,7 +101,7 @@ func (v *View) choices() []choice {
101101 if v.pick.dismissed && v.pick.dismissedFor == v.Input() {
102102 return nil
103103 }
104- return metaChoices(typed)
104+ return metaChoices(v.metaPrompts(), typed)
105105 }
106106 tok, ok := v.tokenAtCursor()
107107 if !ok || (v.pick.dismissed && v.pick.dismissedFor == v.Input()) {
@@ -141,10 +141,19 @@ func (v *View) bracketPartial() (string, bool) {
141141 return rest, true
142142 }
143143
144+// metaPrompts is the catalogue the `[` picker offers: the built-ins and the
145+// agent's own (Options.MetaPrompts); the built-ins alone when none was given.
146+func (v *View) metaPrompts() []metaprompt.MetaPrompt {
147+ if v.metas == nil {
148+ return metaprompt.All()
149+ }
150+ return v.metas
151+}
152+
144153 // metaChoices narrows the meta-prompts by what follows the `[`.
145-func metaChoices(typed string) []choice {
154+func metaChoices(list []metaprompt.MetaPrompt, typed string) []choice {
146155 var out []choice
147- for _, m := range metaprompt.Matching(typed) {
156+ for _, m := range metaprompt.Matching(list, typed) {
148157 out = append(out, choice{insert: m.Prefix, label: m.Label(), detail: m.Description})
149158 }
150159 return out
@@ -101,7 +101,7 @@ func (v *View) choices() []choice {
101 if v.pick.dismissed && v.pick.dismissedFor == v.Input() {101 if v.pick.dismissed && v.pick.dismissedFor == v.Input() {
102 return nil102 return nil
103 }103 }
104- return metaChoices(typed)104+ return metaChoices(v.metaPrompts(), typed)
105 }105 }
106 tok, ok := v.tokenAtCursor()106 tok, ok := v.tokenAtCursor()
107 if !ok || (v.pick.dismissed && v.pick.dismissedFor == v.Input()) {107 if !ok || (v.pick.dismissed && v.pick.dismissedFor == v.Input()) {
@@ -141,10 +141,19 @@ func (v *View) bracketPartial() (string, bool) {
141 return rest, true141 return rest, true
142 }142 }
143 143
144+// metaPrompts is the catalogue the `[` picker offers: the built-ins and the
145+// agent's own (Options.MetaPrompts); the built-ins alone when none was given.
146+func (v *View) metaPrompts() []metaprompt.MetaPrompt {
147+ if v.metas == nil {
148+ return metaprompt.All()
149+ }
150+ return v.metas
151+}
152+
144 // metaChoices narrows the meta-prompts by what follows the `[`.153 // metaChoices narrows the meta-prompts by what follows the `[`.
145-func metaChoices(typed string) []choice {154+func metaChoices(list []metaprompt.MetaPrompt, typed string) []choice {
146 var out []choice155 var out []choice
147- for _, m := range metaprompt.Matching(typed) {156+ for _, m := range metaprompt.Matching(list, typed) {
148 out = append(out, choice{insert: m.Prefix, label: m.Label(), detail: m.Description})157 out = append(out, choice{insert: m.Prefix, label: m.Label(), detail: m.Description})
149 }158 }
150 return out159 return out
modified internal/tui/tui.go +1 -0
@@ -78,6 +78,7 @@ func newApp(screen tcell.Screen, opts Options) *app {
7878 })
7979 v.previewLines = config.Cfg.PreviewLines
8080 v.skills, v.cwd = opts.Skills, opts.Cwd
81+ v.metas = opts.MetaPrompts
8182 if opts.Banner != "" {
8283 t.Notice(opts.Banner)
8384 }
@@ -78,6 +78,7 @@ func newApp(screen tcell.Screen, opts Options) *app {
78 })78 })
79 v.previewLines = config.Cfg.PreviewLines79 v.previewLines = config.Cfg.PreviewLines
80 v.skills, v.cwd = opts.Skills, opts.Cwd80 v.skills, v.cwd = opts.Skills, opts.Cwd
81+ v.metas = opts.MetaPrompts
81 if opts.Banner != "" {82 if opts.Banner != "" {
82 t.Notice(opts.Banner)83 t.Notice(opts.Banner)
83 }84 }
modified internal/tui/turn.go +4 -0
@@ -18,6 +18,7 @@ import (
1818 "mm/internal/engine"
1919 mmhooks "mm/internal/hooks"
2020 "mm/internal/mention"
21+ "mm/internal/metaprompt"
2122 "mm/internal/session"
2223 "mm/internal/skills"
2324 "mm/internal/store"
@@ -57,6 +58,9 @@ type Options struct {
5758 // question is resolved against. Empty means no `$` picker and no `$`
5859 // expansion, which is right for an agent that ships no skill.
5960 Skills []skills.Skill
61+ // MetaPrompts is what the `[` picker offers: the built-ins merged with
62+ // the configuration's `metaPrompts:` (ticket 272). Nil = the built-ins.
63+ MetaPrompts []metaprompt.MetaPrompt
6064 // Version is what the status bar shows — the window's only place for it,
6165 // since the banner scrolls away with the conversation. Empty is allowed:
6266 // the bar then shows the counters alone.
@@ -18,6 +18,7 @@ import (
18 "mm/internal/engine"18 "mm/internal/engine"
19 mmhooks "mm/internal/hooks"19 mmhooks "mm/internal/hooks"
20 "mm/internal/mention"20 "mm/internal/mention"
21+ "mm/internal/metaprompt"
21 "mm/internal/session"22 "mm/internal/session"
22 "mm/internal/skills"23 "mm/internal/skills"
23 "mm/internal/store"24 "mm/internal/store"
@@ -57,6 +58,9 @@ type Options struct {
57 // question is resolved against. Empty means no `$` picker and no `$`58 // question is resolved against. Empty means no `$` picker and no `$`
58 // expansion, which is right for an agent that ships no skill.59 // expansion, which is right for an agent that ships no skill.
59 Skills []skills.Skill60 Skills []skills.Skill
61+ // MetaPrompts is what the `[` picker offers: the built-ins merged with
62+ // the configuration's `metaPrompts:` (ticket 272). Nil = the built-ins.
63+ MetaPrompts []metaprompt.MetaPrompt
60 // Version is what the status bar shows — the window's only place for it,64 // Version is what the status bar shows — the window's only place for it,
61 // since the banner scrolls away with the conversation. Empty is allowed:65 // since the banner scrolls away with the conversation. Empty is allowed:
62 // the bar then shows the counters alone.66 // the bar then shows the counters alone.
modified internal/tui/view.go +4 -1
@@ -6,6 +6,7 @@ import (
66 "time"
77
88 "mm/internal/consent"
9+ "mm/internal/metaprompt"
910 "mm/internal/skills"
1011
1112 "github.com/gdamore/tcell/v2"
@@ -81,7 +82,9 @@ type View struct {
8182 // set once at construction rather than refreshed per frame: the skills
8283 // catalogue is read at start-up, and the working directory does not move.
8384 skills []skills.Skill
84- cwd string
85+ // metas is what the `[` picker offers (ticket 272); nil = the built-ins.
86+ metas []metaprompt.MetaPrompt
87+ cwd string
8588
8689 // What the runner reports for the chrome, refreshed before each frame.
8790 header string // the header line
@@ -6,6 +6,7 @@ import (
6 "time"6 "time"
7 7
8 "mm/internal/consent"8 "mm/internal/consent"
9+ "mm/internal/metaprompt"
9 "mm/internal/skills"10 "mm/internal/skills"
10 11
11 "github.com/gdamore/tcell/v2"12 "github.com/gdamore/tcell/v2"
@@ -81,7 +82,9 @@ type View struct {
81 // set once at construction rather than refreshed per frame: the skills82 // set once at construction rather than refreshed per frame: the skills
82 // catalogue is read at start-up, and the working directory does not move.83 // catalogue is read at start-up, and the working directory does not move.
83 skills []skills.Skill84 skills []skills.Skill
84- cwd string85+ // metas is what the `[` picker offers (ticket 272); nil = the built-ins.
86+ metas []metaprompt.MetaPrompt
87+ cwd string
85 88
86 // What the runner reports for the chrome, refreshed before each frame.89 // What the runner reports for the chrome, refreshed before each frame.
87 header string // the header line90 header string // the header line
modified main.go +6 -3
@@ -53,6 +53,7 @@ import (
5353 "mm/internal/hooks"
5454 "mm/internal/lsp"
5555 "mm/internal/mcp"
56+ "mm/internal/metaprompt"
5657 "mm/internal/sbxinit"
5758 "mm/internal/skillcreate"
5859 "mm/internal/skills"
@@ -429,9 +430,11 @@ func runWindow(ctx context.Context, e *engine.Engine, agentTools []ai.ToolRef, d
429430 ModelName: config.Cfg.Model,
430431 Provider: e.Backend.Provider,
431432 Skills: skills.Declared(),
432- Version: version.Short(),
433- Banner: banner,
434- Asker: asker,
433+ // The `[` picker's catalogue: built-ins + metaPrompts: (ticket 272).
434+ MetaPrompts: metaprompt.Configured(),
435+ Version: version.Short(),
436+ Banner: banner,
437+ Asker: asker,
435438 })
436439 if err == nil {
437440 return
@@ -53,6 +53,7 @@ import (
53 "mm/internal/hooks"53 "mm/internal/hooks"
54 "mm/internal/lsp"54 "mm/internal/lsp"
55 "mm/internal/mcp"55 "mm/internal/mcp"
56+ "mm/internal/metaprompt"
56 "mm/internal/sbxinit"57 "mm/internal/sbxinit"
57 "mm/internal/skillcreate"58 "mm/internal/skillcreate"
58 "mm/internal/skills"59 "mm/internal/skills"
@@ -429,9 +430,11 @@ func runWindow(ctx context.Context, e *engine.Engine, agentTools []ai.ToolRef, d
429 ModelName: config.Cfg.Model,430 ModelName: config.Cfg.Model,
430 Provider: e.Backend.Provider,431 Provider: e.Backend.Provider,
431 Skills: skills.Declared(),432 Skills: skills.Declared(),
432- Version: version.Short(),433+ // The `[` picker's catalogue: built-ins + metaPrompts: (ticket 272).
433- Banner: banner,434+ MetaPrompts: metaprompt.Configured(),
434- Asker: asker,435+ Version: version.Short(),
436+ Banner: banner,
437+ Asker: asker,
435 })438 })
436 if err == nil {439 if err == nil {
437 return440 return