🧪 Memory made of skills: demos memory-skills and memory-skills-2 (#74)
Two demos of a memory kept in .mm/memory.md by small skills, no mm code: memory-skills reads it with a recall skill, memory-skills-2 puts it in the system prompt through agentsMd.path. Measured with Qwen3.5 4B on llama.cpp (READMEs EN+FR). Ticket 74 filled with the analysis and the results; ticket 269 filed (the window's "context N% full" badge stays after /compact). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5e82ddd parent: 78e2e4e modified
.tickets/issues/0074-memory-memgpt-hierarchic-memory.yaml +261 -4 | @@ -6,12 +6,269 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-10-04T15:12:36.643Z |
| 9 | -updatedAt: 2026-10-20T07:49:17.543Z | |
| 9 | +updatedAt: 2026-11-27T00:30:00.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - priority::high |
| 12 | 12 | epic: Agent Memory |
| 13 | 13 | related: |
| 14 | 14 | - 48 |
| 15 | -body: "" | |
| 16 | -tasks: [] | |
| 17 | -comments: [] | |
| 15 | + - 43 | |
| 16 | + - 81 | |
| 17 | + - 250 | |
| 18 | + - 251 | |
| 19 | +body: | | |
| 20 | + ## Idea: MemGPT-style hierarchical memory | |
| 21 | + MemGPT (now Letta) treats the model's context like an OS's RAM, with | |
| 22 | + three levels that the AGENT manages itself through tools: | |
| 23 | + 1. **Core memory** — short blocks always in the prompt (who the agent | |
| 24 | + is, who the user is, key facts), edited by the agent | |
| 25 | + (`core_memory_append`, `core_memory_replace`). | |
| 26 | + 2. **Recall memory** — the whole conversation history, out of context | |
| 27 | + but searchable (`conversation_search`). | |
| 28 | + 3. **Archival memory** — a long-term store where the agent files and | |
| 29 | + finds facts (`archival_memory_insert`, `archival_memory_search`; | |
| 30 | + embeddings in the original). | |
| 31 | + When the context nears its limit, the system warns the agent, which | |
| 32 | + saves what matters before messages are summarised or evicted. | |
| 33 | + | |
| 34 | + ## What mm already covers (checked 2026-11-26) | |
| 35 | + | MemGPT | mm | Ticket | | |
| 36 | + |---|---|---| | |
| 37 | + | Recall | stored sessions + `/memory` and the `search_memory` tool (BM25) | 48, closed | | |
| 38 | + | Overflow handling | `/compact`, automatic compaction, also inside a turn | 43, 251, closed | | |
| 39 | + | Core, read-only | `AGENTS.md` appended to the system prompt | 81, closed | | |
| 40 | + | |
| 41 | + ## What is missing — the scope of this ticket | |
| 42 | + - **Core memory the agent edits**: a few persistent blocks (a file per | |
| 43 | + project, e.g. `.mm/memory.md`), injected in the prompt, changed by a | |
| 44 | + dedicated tool. The heart of MemGPT. | |
| 45 | + - **Archival memory**: facts the agent CHOOSES to keep and finds again — | |
| 46 | + not the same as searching sessions, where nothing was chosen. BM25 of | |
| 47 | + `internal/docsearch`, no embeddings: consistent with the "no model" | |
| 48 | + choice of ticket 48. | |
| 49 | + - **"Save before I compress"**: before a compaction, give the agent a | |
| 50 | + chance to write down what must not be lost. | |
| 51 | + | |
| 52 | + ## Open questions | |
| 53 | + - Scope: per project, per agent, global? | |
| 54 | + - Can small local models manage their memory themselves? MemGPT was | |
| 55 | + designed on GPT-4: measure it (like ticket 268), do not assume. | |
| 56 | + - Safety: an agent that rewrites its own prompt is an entry point for a | |
| 57 | + persistent prompt injection (ticket 250). Who reviews the memory, | |
| 58 | + how is it cleared, does `yolo: false` ask before a write? | |
| 59 | + | |
| 60 | + ## Links | |
| 61 | + - MemGPT paper: https://arxiv.org/abs/2310.08560 | |
| 62 | + - Letta (MemGPT's successor): https://docs.letta.com | |
| 63 | +tasks: | |
| 64 | + - id: 1 | |
| 65 | + title: "Decide the scope with the user: memory per project, per agent, or global; where the files live (.mm/memory.md?)" | |
| 66 | + state: open | |
| 67 | + priority: medium | |
| 68 | + author: | |
| 69 | + name: k33g | |
| 70 | + email: ph.charriere@gmail.com | |
| 71 | + createdAt: 2026-11-26T21:30:00.000Z | |
| 72 | + updatedAt: 2026-11-26T21:30:00.000Z | |
| 73 | + - id: 2 | |
| 74 | + title: "Core memory: a few persistent blocks injected in the system prompt, edited by the agent through one tool (append / replace), size-capped — design + prototype behind a switch" | |
| 75 | + state: open | |
| 76 | + priority: medium | |
| 77 | + author: | |
| 78 | + name: k33g | |
| 79 | + email: ph.charriere@gmail.com | |
| 80 | + createdAt: 2026-11-26T21:30:00.000Z | |
| 81 | + updatedAt: 2026-11-26T21:30:00.000Z | |
| 82 | + - id: 3 | |
| 83 | + title: "Archival memory: the agent stores and finds durable facts itself (insert / search), BM25 reusing internal/docsearch, no embeddings — design + prototype" | |
| 84 | + state: open | |
| 85 | + priority: medium | |
| 86 | + author: | |
| 87 | + name: k33g | |
| 88 | + email: ph.charriere@gmail.com | |
| 89 | + createdAt: 2026-11-26T21:30:00.000Z | |
| 90 | + updatedAt: 2026-11-26T21:30:00.000Z | |
| 91 | + - id: 4 | |
| 92 | + title: "Before compaction: give the agent one chance to save what must not be lost (hook in compact / in-turn compaction)" | |
| 93 | + state: open | |
| 94 | + priority: medium | |
| 95 | + author: | |
| 96 | + name: k33g | |
| 97 | + email: ph.charriere@gmail.com | |
| 98 | + createdAt: 2026-11-26T21:30:00.000Z | |
| 99 | + updatedAt: 2026-11-26T21:30:00.000Z | |
| 100 | + - id: 5 | |
| 101 | + title: "Safety: an agent rewriting its own prompt = persistent injection risk (ticket 250) — permissions (yolo false asks), what the banner shows, how the user reviews and clears the memory" | |
| 102 | + state: open | |
| 103 | + priority: medium | |
| 104 | + author: | |
| 105 | + name: k33g | |
| 106 | + email: ph.charriere@gmail.com | |
| 107 | + createdAt: 2026-11-26T21:30:00.000Z | |
| 108 | + updatedAt: 2026-11-26T21:30:00.000Z | |
| 109 | + - id: 6 | |
| 110 | + title: "Measure with small local models (Qwen3.5 4B, gpt-oss 20B): do they save the right facts, use them in a later session, keep the blocks clean?" | |
| 111 | + state: open | |
| 112 | + priority: medium | |
| 113 | + author: | |
| 114 | + name: k33g | |
| 115 | + email: ph.charriere@gmail.com | |
| 116 | + createdAt: 2026-11-26T21:30:00.000Z | |
| 117 | + updatedAt: 2026-11-26T21:30:00.000Z | |
| 118 | + - id: 7 | |
| 119 | + title: "Decide (with the user): keep, change, or drop; then docs EN+FR and a demo" | |
| 120 | + state: open | |
| 121 | + priority: medium | |
| 122 | + author: | |
| 123 | + name: k33g | |
| 124 | + email: ph.charriere@gmail.com | |
| 125 | + createdAt: 2026-11-26T21:30:00.000Z | |
| 126 | + updatedAt: 2026-11-26T21:30:00.000Z | |
| 127 | +comments: | |
| 128 | + - id: 1 | |
| 129 | + author: | |
| 130 | + name: k33g | |
| 131 | + email: ph.charriere@gmail.com | |
| 132 | + createdAt: 2026-11-26T22:00:00.000Z | |
| 133 | + body: | | |
| 134 | + ## What it would bring to mini-me (user's question, 2026-11-26) | |
| 135 | + Mostly **continuity from one session to the next**, without the user | |
| 136 | + repeating things. The real gain depends a lot on small local models. | |
| 137 | + | |
| 138 | + ### What it would bring | |
| 139 | + 1. **An agent that remembers without being told again.** Today each new | |
| 140 | + session starts from scratch, apart from `AGENTS.md`, which the user | |
| 141 | + writes. With core memory the agent itself would note "we tag | |
| 142 | + `rel-YYYY.MM`", "the user wants answers in French", "`go test -race` | |
| 143 | + is impossible here", and read them at every start — what the user | |
| 144 | + does by hand today with `.memory/` for Claude Code. | |
| 145 | + 2. **Chosen memories rather than a raw archive.** `search_memory` (48) | |
| 146 | + digs through every session: it finds words, but also the dead ends, | |
| 147 | + the corrected mistakes, the abandoned decisions. Archival memory | |
| 148 | + holds only what the agent judged durable: less noise, fewer tokens. | |
| 149 | + 3. **Less destructive compactions.** When the history is summarised | |
| 150 | + (43, 251) details are lost; "save before I compress" gives the agent | |
| 151 | + a chance to keep the important facts first. | |
| 152 | + 4. **More value with small contexts.** mm's own case: local models | |
| 153 | + often have 8–32k tokens of context. A memory outside the context, | |
| 154 | + read on demand, costs less than keeping everything in the history. | |
| 155 | + | |
| 156 | + ### What it would not bring, or badly | |
| 157 | + - **Short, one-off sessions** (one question, one fix): almost nothing; | |
| 158 | + `AGENTS.md` is enough. | |
| 159 | + - **With a small model**, memory management can go wrong: it notes | |
| 160 | + trivia, forgets the essential, fills its blocks with contradictions. | |
| 161 | + MemGPT was designed on GPT-4. A real risk, not a certainty — hence | |
| 162 | + the measuring task. | |
| 163 | + - **More surface**: one more tool in the prompt, while the cost of each | |
| 164 | + tool is already measured (4, tool routing); and an agent rewriting | |
| 165 | + its own prompt is a persistent-injection vector (250). | |
| 166 | + | |
| 167 | + ### Recommendation | |
| 168 | + Best gain/risk: **core memory alone** — a small file per project, | |
| 169 | + injected in the prompt, changed by a tool with permission, which the | |
| 170 | + user can read and edit by hand. Measure it first with Qwen3.5 4B over | |
| 171 | + two or three chained sessions. Archival memory and "save before | |
| 172 | + compaction" only afterwards, if core memory delivers. Otherwise | |
| 173 | + `AGENTS.md` + `search_memory` + compaction already cover the essentials, | |
| 174 | + and 74 can stay an idea. | |
| 175 | + - id: 2 | |
| 176 | + author: | |
| 177 | + name: k33g | |
| 178 | + email: ph.charriere@gmail.com | |
| 179 | + createdAt: 2026-11-26T22:30:00.000Z | |
| 180 | + body: | | |
| 181 | + ## Direction (user, 2026-11-26): mini-skills first, no mm code | |
| 182 | + For now, give the agent this memory with small skills rather than a | |
| 183 | + built-in core memory. Proposal (not built yet): | |
| 184 | + - a file `.mm/memory.md` in the project, sections `## user` and | |
| 185 | + `## project`, one fact per line; | |
| 186 | + - skill `remember`: when the user says "remember / note that / | |
| 187 | + souviens-toi", add ONE short line to the right section (edit_file), | |
| 188 | + replace a line it contradicts instead of adding a second one, never | |
| 189 | + a secret; | |
| 190 | + - skill `recall`: before answering a question about the user's | |
| 191 | + preferences or the project's conventions, read_file `.mm/memory.md` | |
| 192 | + and use it; say when it holds nothing on the subject; | |
| 193 | + - skill `forget`: remove the line the user names. | |
| 194 | + | |
| 195 | + What it gives vs a built-in core memory: zero code, the file stays | |
| 196 | + readable and editable by hand, `yolo: false` already asks before the | |
| 197 | + edit_file. What it loses: the memory is NOT always in the prompt — the | |
| 198 | + model must think of calling `recall` (skill routing, `$recall`, or one | |
| 199 | + line in AGENTS.md "read .mm/memory.md first" can help). | |
| 200 | + | |
| 201 | + To measure: does Qwen3.5 4B pick `remember` / `recall` at the right | |
| 202 | + moment, write a clean line, and use the fact in a NEW session? The | |
| 203 | + result decides whether task 2 (built-in core memory) is still needed. | |
| 204 | + - id: 3 | |
| 205 | + author: | |
| 206 | + name: k33g | |
| 207 | + email: ph.charriere@gmail.com | |
| 208 | + createdAt: 2026-11-26T23:00:00.000Z | |
| 209 | + body: | | |
| 210 | + ## Demo built: demos/memory-skills (Jay, Qwen3.5 4B on llama.cpp) | |
| 211 | + Skills remember / recall / forget over `.mm/memory.md`, read_file / | |
| 212 | + write_file / edit_file, no bash, temperature 0, thinking off. | |
| 213 | + Measured 2026-11-26, one run, each question a separate `-p` (a new | |
| 214 | + conversation): 8/8 right behaviour. | |
| 215 | + - remember French + rel-YYYY.MM → file created, right sections; | |
| 216 | + - "tag for November 2026?" (new conversation) → recall → rel-2026.11, | |
| 217 | + in French; "what do you know about me?" → recall → French; | |
| 218 | + - "CI on Forgejo" then "moved to GitHub Actions" → the line REPLACED; | |
| 219 | + - "remember my API token" → refused, file unchanged; | |
| 220 | + - "oublie la CI" → forget → line removed; | |
| 221 | + - "capital of Italy?" → no skill, Rome. | |
| 222 | + **Limit seen**: the memory is applied only when recall is called — the | |
| 223 | + GitHub Actions confirmation and the Rome answer came in English | |
| 224 | + although the memory says "Prefers answers in French". That is the case | |
| 225 | + for task 2 (memory always in the prompt); lighter tries first: a line | |
| 226 | + in AGENTS.md, skill routing. | |
| 227 | + - id: 4 | |
| 228 | + author: | |
| 229 | + name: k33g | |
| 230 | + email: ph.charriere@gmail.com | |
| 231 | + createdAt: 2026-11-26T23:30:00.000Z | |
| 232 | + body: | | |
| 233 | + ## Variant 2: demos/memory-skills-2 — the memory always in the prompt | |
| 234 | + No recall skill: `agentsMd.path: .mm/memory.md` (maxChars 4000) — mm | |
| 235 | + reads the file at the start of every conversation and appends it to | |
| 236 | + the system prompt, the AGENTS.md mechanism pointed at the memory. No | |
| 237 | + mm code. Cost: that agent no longer reads the project's AGENTS.md. | |
| 238 | + Same 8 questions, same order, separate `-p`, Qwen3.5 4B, one run: | |
| 239 | + - fixed: the French preference applied without a skill call — 6/7 | |
| 240 | + answers after it was saved in French (4/7 with recall); "what do | |
| 241 | + you know about me?" lists every fact; | |
| 242 | + - not fixed: the tag question asked in English answered in English | |
| 243 | + (maybe the heading "when the user asks otherwise … the user wins"); | |
| 244 | + - new problems: `remember` read on two plain questions (no write); | |
| 245 | + the CI fact written under `## user` and in French (the memory's | |
| 246 | + "Prefers answers in French" applied to the memory's own lines). | |
| 247 | + Next lead: say in `remember` that lines are always English, then | |
| 248 | + retry. This mechanism is a cheap stand-in for task 2 (built-in core | |
| 249 | + memory) — the remaining question is mostly prompt wording. | |
| 250 | + - id: 5 | |
| 251 | + author: | |
| 252 | + name: k33g | |
| 253 | + email: ph.charriere@gmail.com | |
| 254 | + createdAt: 2026-11-27T00:30:00.000Z | |
| 255 | + body: | | |
| 256 | + ## Variant 2 tuned: 8/8 (four runs, one change at a time) | |
| 257 | + - B: `remember` — lines always English, "our CI / we use" → project: | |
| 258 | + CI line right, tag in French, but `remember` read on the tag | |
| 259 | + question WROTE an unasked line. | |
| 260 | + - C: `remember` only on explicit request + a stopping step 0: no | |
| 261 | + unasked write, but tag back in English and "what do you know about | |
| 262 | + me?" → "nothing" (step 0 said not to read the memory). | |
| 263 | + - D: a `recall` skill WITHOUT any tool ("the memory is already in | |
| 264 | + your prompt, answer from it, in the language it says"): 8/8, and | |
| 265 | + 7/7 answers in French after the preference was saved (4/7 in | |
| 266 | + demos/memory-skills), Rome included. | |
| 267 | + Finding: `read_skill` tells the model to load a skill BEFORE any task, | |
| 268 | + so a question with no matching skill gets the nearest one (`remember`). | |
| 269 | + A harmless skill for questions gives that reflex somewhere to go. | |
| 270 | + One run per configuration: a hint, not a variance measurement. | |
| 271 | + Conclusion for this ticket: memory file + agentsMd.path + three | |
| 272 | + skills covers "core memory" with no mm code for this model; task 2 | |
| 273 | + (built-in) is only needed to keep the project's AGENTS.md as well | |
| 274 | + (agentsMd has one path). | |
| @@ -6,12 +6,269 @@ author: | |||
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-10-04T15:12:36.643Z | 8 | createdAt: 2026-10-04T15:12:36.643Z |
| 9 | -updatedAt: 2026-10-20T07:49:17.543Z | 9 | +updatedAt: 2026-11-27T00:30:00.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - priority::high | 11 | - priority::high |
| 12 | epic: Agent Memory | 12 | epic: Agent Memory |
| 13 | related: | 13 | related: |
| 14 | - 48 | 14 | - 48 |
| 15 | -body: "" | 15 | + - 43 |
| 16 | -tasks: [] | 16 | + - 81 |
| 17 | -comments: [] | 17 | + - 250 |
| 18 | + - 251 | ||
| 19 | +body: | | ||
| 20 | + ## Idea: MemGPT-style hierarchical memory | ||
| 21 | + MemGPT (now Letta) treats the model's context like an OS's RAM, with | ||
| 22 | + three levels that the AGENT manages itself through tools: | ||
| 23 | + 1. **Core memory** — short blocks always in the prompt (who the agent | ||
| 24 | + is, who the user is, key facts), edited by the agent | ||
| 25 | + (`core_memory_append`, `core_memory_replace`). | ||
| 26 | + 2. **Recall memory** — the whole conversation history, out of context | ||
| 27 | + but searchable (`conversation_search`). | ||
| 28 | + 3. **Archival memory** — a long-term store where the agent files and | ||
| 29 | + finds facts (`archival_memory_insert`, `archival_memory_search`; | ||
| 30 | + embeddings in the original). | ||
| 31 | + When the context nears its limit, the system warns the agent, which | ||
| 32 | + saves what matters before messages are summarised or evicted. | ||
| 33 | + | ||
| 34 | + ## What mm already covers (checked 2026-11-26) | ||
| 35 | + | MemGPT | mm | Ticket | | ||
| 36 | + |---|---|---| | ||
| 37 | + | Recall | stored sessions + `/memory` and the `search_memory` tool (BM25) | 48, closed | | ||
| 38 | + | Overflow handling | `/compact`, automatic compaction, also inside a turn | 43, 251, closed | | ||
| 39 | + | Core, read-only | `AGENTS.md` appended to the system prompt | 81, closed | | ||
| 40 | + | ||
| 41 | + ## What is missing — the scope of this ticket | ||
| 42 | + - **Core memory the agent edits**: a few persistent blocks (a file per | ||
| 43 | + project, e.g. `.mm/memory.md`), injected in the prompt, changed by a | ||
| 44 | + dedicated tool. The heart of MemGPT. | ||
| 45 | + - **Archival memory**: facts the agent CHOOSES to keep and finds again — | ||
| 46 | + not the same as searching sessions, where nothing was chosen. BM25 of | ||
| 47 | + `internal/docsearch`, no embeddings: consistent with the "no model" | ||
| 48 | + choice of ticket 48. | ||
| 49 | + - **"Save before I compress"**: before a compaction, give the agent a | ||
| 50 | + chance to write down what must not be lost. | ||
| 51 | + | ||
| 52 | + ## Open questions | ||
| 53 | + - Scope: per project, per agent, global? | ||
| 54 | + - Can small local models manage their memory themselves? MemGPT was | ||
| 55 | + designed on GPT-4: measure it (like ticket 268), do not assume. | ||
| 56 | + - Safety: an agent that rewrites its own prompt is an entry point for a | ||
| 57 | + persistent prompt injection (ticket 250). Who reviews the memory, | ||
| 58 | + how is it cleared, does `yolo: false` ask before a write? | ||
| 59 | + | ||
| 60 | + ## Links | ||
| 61 | + - MemGPT paper: https://arxiv.org/abs/2310.08560 | ||
| 62 | + - Letta (MemGPT's successor): https://docs.letta.com | ||
| 63 | +tasks: | ||
| 64 | + - id: 1 | ||
| 65 | + title: "Decide the scope with the user: memory per project, per agent, or global; where the files live (.mm/memory.md?)" | ||
| 66 | + state: open | ||
| 67 | + priority: medium | ||
| 68 | + author: | ||
| 69 | + name: k33g | ||
| 70 | + email: ph.charriere@gmail.com | ||
| 71 | + createdAt: 2026-11-26T21:30:00.000Z | ||
| 72 | + updatedAt: 2026-11-26T21:30:00.000Z | ||
| 73 | + - id: 2 | ||
| 74 | + title: "Core memory: a few persistent blocks injected in the system prompt, edited by the agent through one tool (append / replace), size-capped — design + prototype behind a switch" | ||
| 75 | + state: open | ||
| 76 | + priority: medium | ||
| 77 | + author: | ||
| 78 | + name: k33g | ||
| 79 | + email: ph.charriere@gmail.com | ||
| 80 | + createdAt: 2026-11-26T21:30:00.000Z | ||
| 81 | + updatedAt: 2026-11-26T21:30:00.000Z | ||
| 82 | + - id: 3 | ||
| 83 | + title: "Archival memory: the agent stores and finds durable facts itself (insert / search), BM25 reusing internal/docsearch, no embeddings — design + prototype" | ||
| 84 | + state: open | ||
| 85 | + priority: medium | ||
| 86 | + author: | ||
| 87 | + name: k33g | ||
| 88 | + email: ph.charriere@gmail.com | ||
| 89 | + createdAt: 2026-11-26T21:30:00.000Z | ||
| 90 | + updatedAt: 2026-11-26T21:30:00.000Z | ||
| 91 | + - id: 4 | ||
| 92 | + title: "Before compaction: give the agent one chance to save what must not be lost (hook in compact / in-turn compaction)" | ||
| 93 | + state: open | ||
| 94 | + priority: medium | ||
| 95 | + author: | ||
| 96 | + name: k33g | ||
| 97 | + email: ph.charriere@gmail.com | ||
| 98 | + createdAt: 2026-11-26T21:30:00.000Z | ||
| 99 | + updatedAt: 2026-11-26T21:30:00.000Z | ||
| 100 | + - id: 5 | ||
| 101 | + title: "Safety: an agent rewriting its own prompt = persistent injection risk (ticket 250) — permissions (yolo false asks), what the banner shows, how the user reviews and clears the memory" | ||
| 102 | + state: open | ||
| 103 | + priority: medium | ||
| 104 | + author: | ||
| 105 | + name: k33g | ||
| 106 | + email: ph.charriere@gmail.com | ||
| 107 | + createdAt: 2026-11-26T21:30:00.000Z | ||
| 108 | + updatedAt: 2026-11-26T21:30:00.000Z | ||
| 109 | + - id: 6 | ||
| 110 | + title: "Measure with small local models (Qwen3.5 4B, gpt-oss 20B): do they save the right facts, use them in a later session, keep the blocks clean?" | ||
| 111 | + state: open | ||
| 112 | + priority: medium | ||
| 113 | + author: | ||
| 114 | + name: k33g | ||
| 115 | + email: ph.charriere@gmail.com | ||
| 116 | + createdAt: 2026-11-26T21:30:00.000Z | ||
| 117 | + updatedAt: 2026-11-26T21:30:00.000Z | ||
| 118 | + - id: 7 | ||
| 119 | + title: "Decide (with the user): keep, change, or drop; then docs EN+FR and a demo" | ||
| 120 | + state: open | ||
| 121 | + priority: medium | ||
| 122 | + author: | ||
| 123 | + name: k33g | ||
| 124 | + email: ph.charriere@gmail.com | ||
| 125 | + createdAt: 2026-11-26T21:30:00.000Z | ||
| 126 | + updatedAt: 2026-11-26T21:30:00.000Z | ||
| 127 | +comments: | ||
| 128 | + - id: 1 | ||
| 129 | + author: | ||
| 130 | + name: k33g | ||
| 131 | + email: ph.charriere@gmail.com | ||
| 132 | + createdAt: 2026-11-26T22:00:00.000Z | ||
| 133 | + body: | | ||
| 134 | + ## What it would bring to mini-me (user's question, 2026-11-26) | ||
| 135 | + Mostly **continuity from one session to the next**, without the user | ||
| 136 | + repeating things. The real gain depends a lot on small local models. | ||
| 137 | + | ||
| 138 | + ### What it would bring | ||
| 139 | + 1. **An agent that remembers without being told again.** Today each new | ||
| 140 | + session starts from scratch, apart from `AGENTS.md`, which the user | ||
| 141 | + writes. With core memory the agent itself would note "we tag | ||
| 142 | + `rel-YYYY.MM`", "the user wants answers in French", "`go test -race` | ||
| 143 | + is impossible here", and read them at every start — what the user | ||
| 144 | + does by hand today with `.memory/` for Claude Code. | ||
| 145 | + 2. **Chosen memories rather than a raw archive.** `search_memory` (48) | ||
| 146 | + digs through every session: it finds words, but also the dead ends, | ||
| 147 | + the corrected mistakes, the abandoned decisions. Archival memory | ||
| 148 | + holds only what the agent judged durable: less noise, fewer tokens. | ||
| 149 | + 3. **Less destructive compactions.** When the history is summarised | ||
| 150 | + (43, 251) details are lost; "save before I compress" gives the agent | ||
| 151 | + a chance to keep the important facts first. | ||
| 152 | + 4. **More value with small contexts.** mm's own case: local models | ||
| 153 | + often have 8–32k tokens of context. A memory outside the context, | ||
| 154 | + read on demand, costs less than keeping everything in the history. | ||
| 155 | + | ||
| 156 | + ### What it would not bring, or badly | ||
| 157 | + - **Short, one-off sessions** (one question, one fix): almost nothing; | ||
| 158 | + `AGENTS.md` is enough. | ||
| 159 | + - **With a small model**, memory management can go wrong: it notes | ||
| 160 | + trivia, forgets the essential, fills its blocks with contradictions. | ||
| 161 | + MemGPT was designed on GPT-4. A real risk, not a certainty — hence | ||
| 162 | + the measuring task. | ||
| 163 | + - **More surface**: one more tool in the prompt, while the cost of each | ||
| 164 | + tool is already measured (4, tool routing); and an agent rewriting | ||
| 165 | + its own prompt is a persistent-injection vector (250). | ||
| 166 | + | ||
| 167 | + ### Recommendation | ||
| 168 | + Best gain/risk: **core memory alone** — a small file per project, | ||
| 169 | + injected in the prompt, changed by a tool with permission, which the | ||
| 170 | + user can read and edit by hand. Measure it first with Qwen3.5 4B over | ||
| 171 | + two or three chained sessions. Archival memory and "save before | ||
| 172 | + compaction" only afterwards, if core memory delivers. Otherwise | ||
| 173 | + `AGENTS.md` + `search_memory` + compaction already cover the essentials, | ||
| 174 | + and 74 can stay an idea. | ||
| 175 | + - id: 2 | ||
| 176 | + author: | ||
| 177 | + name: k33g | ||
| 178 | + email: ph.charriere@gmail.com | ||
| 179 | + createdAt: 2026-11-26T22:30:00.000Z | ||
| 180 | + body: | | ||
| 181 | + ## Direction (user, 2026-11-26): mini-skills first, no mm code | ||
| 182 | + For now, give the agent this memory with small skills rather than a | ||
| 183 | + built-in core memory. Proposal (not built yet): | ||
| 184 | + - a file `.mm/memory.md` in the project, sections `## user` and | ||
| 185 | + `## project`, one fact per line; | ||
| 186 | + - skill `remember`: when the user says "remember / note that / | ||
| 187 | + souviens-toi", add ONE short line to the right section (edit_file), | ||
| 188 | + replace a line it contradicts instead of adding a second one, never | ||
| 189 | + a secret; | ||
| 190 | + - skill `recall`: before answering a question about the user's | ||
| 191 | + preferences or the project's conventions, read_file `.mm/memory.md` | ||
| 192 | + and use it; say when it holds nothing on the subject; | ||
| 193 | + - skill `forget`: remove the line the user names. | ||
| 194 | + | ||
| 195 | + What it gives vs a built-in core memory: zero code, the file stays | ||
| 196 | + readable and editable by hand, `yolo: false` already asks before the | ||
| 197 | + edit_file. What it loses: the memory is NOT always in the prompt — the | ||
| 198 | + model must think of calling `recall` (skill routing, `$recall`, or one | ||
| 199 | + line in AGENTS.md "read .mm/memory.md first" can help). | ||
| 200 | + | ||
| 201 | + To measure: does Qwen3.5 4B pick `remember` / `recall` at the right | ||
| 202 | + moment, write a clean line, and use the fact in a NEW session? The | ||
| 203 | + result decides whether task 2 (built-in core memory) is still needed. | ||
| 204 | + - id: 3 | ||
| 205 | + author: | ||
| 206 | + name: k33g | ||
| 207 | + email: ph.charriere@gmail.com | ||
| 208 | + createdAt: 2026-11-26T23:00:00.000Z | ||
| 209 | + body: | | ||
| 210 | + ## Demo built: demos/memory-skills (Jay, Qwen3.5 4B on llama.cpp) | ||
| 211 | + Skills remember / recall / forget over `.mm/memory.md`, read_file / | ||
| 212 | + write_file / edit_file, no bash, temperature 0, thinking off. | ||
| 213 | + Measured 2026-11-26, one run, each question a separate `-p` (a new | ||
| 214 | + conversation): 8/8 right behaviour. | ||
| 215 | + - remember French + rel-YYYY.MM → file created, right sections; | ||
| 216 | + - "tag for November 2026?" (new conversation) → recall → rel-2026.11, | ||
| 217 | + in French; "what do you know about me?" → recall → French; | ||
| 218 | + - "CI on Forgejo" then "moved to GitHub Actions" → the line REPLACED; | ||
| 219 | + - "remember my API token" → refused, file unchanged; | ||
| 220 | + - "oublie la CI" → forget → line removed; | ||
| 221 | + - "capital of Italy?" → no skill, Rome. | ||
| 222 | + **Limit seen**: the memory is applied only when recall is called — the | ||
| 223 | + GitHub Actions confirmation and the Rome answer came in English | ||
| 224 | + although the memory says "Prefers answers in French". That is the case | ||
| 225 | + for task 2 (memory always in the prompt); lighter tries first: a line | ||
| 226 | + in AGENTS.md, skill routing. | ||
| 227 | + - id: 4 | ||
| 228 | + author: | ||
| 229 | + name: k33g | ||
| 230 | + email: ph.charriere@gmail.com | ||
| 231 | + createdAt: 2026-11-26T23:30:00.000Z | ||
| 232 | + body: | | ||
| 233 | + ## Variant 2: demos/memory-skills-2 — the memory always in the prompt | ||
| 234 | + No recall skill: `agentsMd.path: .mm/memory.md` (maxChars 4000) — mm | ||
| 235 | + reads the file at the start of every conversation and appends it to | ||
| 236 | + the system prompt, the AGENTS.md mechanism pointed at the memory. No | ||
| 237 | + mm code. Cost: that agent no longer reads the project's AGENTS.md. | ||
| 238 | + Same 8 questions, same order, separate `-p`, Qwen3.5 4B, one run: | ||
| 239 | + - fixed: the French preference applied without a skill call — 6/7 | ||
| 240 | + answers after it was saved in French (4/7 with recall); "what do | ||
| 241 | + you know about me?" lists every fact; | ||
| 242 | + - not fixed: the tag question asked in English answered in English | ||
| 243 | + (maybe the heading "when the user asks otherwise … the user wins"); | ||
| 244 | + - new problems: `remember` read on two plain questions (no write); | ||
| 245 | + the CI fact written under `## user` and in French (the memory's | ||
| 246 | + "Prefers answers in French" applied to the memory's own lines). | ||
| 247 | + Next lead: say in `remember` that lines are always English, then | ||
| 248 | + retry. This mechanism is a cheap stand-in for task 2 (built-in core | ||
| 249 | + memory) — the remaining question is mostly prompt wording. | ||
| 250 | + - id: 5 | ||
| 251 | + author: | ||
| 252 | + name: k33g | ||
| 253 | + email: ph.charriere@gmail.com | ||
| 254 | + createdAt: 2026-11-27T00:30:00.000Z | ||
| 255 | + body: | | ||
| 256 | + ## Variant 2 tuned: 8/8 (four runs, one change at a time) | ||
| 257 | + - B: `remember` — lines always English, "our CI / we use" → project: | ||
| 258 | + CI line right, tag in French, but `remember` read on the tag | ||
| 259 | + question WROTE an unasked line. | ||
| 260 | + - C: `remember` only on explicit request + a stopping step 0: no | ||
| 261 | + unasked write, but tag back in English and "what do you know about | ||
| 262 | + me?" → "nothing" (step 0 said not to read the memory). | ||
| 263 | + - D: a `recall` skill WITHOUT any tool ("the memory is already in | ||
| 264 | + your prompt, answer from it, in the language it says"): 8/8, and | ||
| 265 | + 7/7 answers in French after the preference was saved (4/7 in | ||
| 266 | + demos/memory-skills), Rome included. | ||
| 267 | + Finding: `read_skill` tells the model to load a skill BEFORE any task, | ||
| 268 | + so a question with no matching skill gets the nearest one (`remember`). | ||
| 269 | + A harmless skill for questions gives that reflex somewhere to go. | ||
| 270 | + One run per configuration: a hint, not a variance measurement. | ||
| 271 | + Conclusion for this ticket: memory file + agentsMd.path + three | ||
| 272 | + skills covers "core memory" with no mm code for this model; task 2 | ||
| 273 | + (built-in) is only needed to keep the project's AGENTS.md as well | ||
| 274 | + (agentsMd has one path). | ||
added
.tickets/issues/0269-window-the-context-full-badge-stays-after-a-compression.yaml +93 -0 | new file mode 100644 | ||
| @@ -0,0 +1,93 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 269 | |
| 3 | +title: "Window: the \"context N% full\" badge stays after /compact (and /new, /resume)" | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-27T01:00:00.000Z | |
| 9 | +updatedAt: 2026-11-27T01:00:00.000Z | |
| 10 | +labels: | |
| 11 | + - bug | |
| 12 | + - kind::bug | |
| 13 | +epic: Improve TUI | |
| 14 | +related: | |
| 15 | + - 153 | |
| 16 | +body: | | |
| 17 | + ## Reported (user, 2026-11-27) | |
| 18 | + The "context N% full" warning shows fine, but once the history is | |
| 19 | + compressed it keeps showing. | |
| 20 | + | |
| 21 | + ## Cause (read in the code, 2026-11-27) | |
| 22 | + - engine/struggle.go `contextStruggle`: at the end of a turn, when the | |
| 23 | + last model call read ≥ 80% of the window (`contextFullShare`), the | |
| 24 | + turn reports `⚠ context N% full` (ui.ReportStruggle). | |
| 25 | + - In the window that struggle becomes the status-bar badge (ticket 153, | |
| 26 | + tui/struggle.go). The badge "outlives the turn" by design and is | |
| 27 | + cleared in ONE place only: `startTurn` (tui/turn.go:201), when the next | |
| 28 | + question is sent. | |
| 29 | + - `/compact` (tui/turn.go, outcome "compact", `res.changed`) replaces the | |
| 30 | + history and calls `ForgetInputTokens()`, but does not touch the badge: | |
| 31 | + it keeps saying "context 85% full" over a history that is now small. | |
| 32 | + Same for `/new` and `/resume` (tui/commands.go `newSession`, `resume`). | |
| 33 | + - The header's `ctx N%` is right after a compaction (it falls back to | |
| 34 | + `compact.Estimate` once the server's count is forgotten): only the badge | |
| 35 | + is stale — the two then disagree on screen. | |
| 36 | + - Line mode prints the warning once as a line: nothing stays. ACP: to | |
| 37 | + check whether the editor keeps anything. | |
| 38 | + | |
| 39 | + ## Fix proposed | |
| 40 | + - When the history shrinks — `/compact` that compressed, `/new`, | |
| 41 | + `/resume` — drop the CONTEXT struggle from the badge, and only it: a | |
| 42 | + "looped — stopped" or "max turns reached" badge still says why the last | |
| 43 | + turn ended and must stay until the next question (ticket 153). | |
| 44 | + - `ui.Struggle` gets a way to tell a context struggle from the others (a | |
| 45 | + `Context bool`, or a kind), set by `contextStruggle`; `struggles` | |
| 46 | + forgets it (and recomputes the badge from what is left — today it | |
| 47 | + keeps only the worst + a count, so it must keep the list). | |
| 48 | + - The automatic compaction at the start of a question needs nothing: the | |
| 49 | + badge is already cleared by `startTurn`. | |
| 50 | + | |
| 51 | + ## Done when | |
| 52 | + - Unit tests in tui: badge "context N% full" → /compact compressed → no | |
| 53 | + badge; a severe badge survives /compact; /new and /resume clear the | |
| 54 | + context badge; a failed /compact keeps it. | |
| 55 | + - Reference docs (struggle signals, window) EN+FR say when the badge goes. | |
| 56 | +tasks: | |
| 57 | + - id: 1 | |
| 58 | + title: "ui.Struggle: mark the context struggle; tui struggles: keep the list, forget the context one" | |
| 59 | + state: open | |
| 60 | + priority: medium | |
| 61 | + author: | |
| 62 | + name: k33g | |
| 63 | + email: ph.charriere@gmail.com | |
| 64 | + createdAt: 2026-11-27T01:00:00.000Z | |
| 65 | + updatedAt: 2026-11-27T01:00:00.000Z | |
| 66 | + - id: 2 | |
| 67 | + title: "Clear it after /compact (compressed), /new, /resume — with tests" | |
| 68 | + state: open | |
| 69 | + priority: medium | |
| 70 | + author: | |
| 71 | + name: k33g | |
| 72 | + email: ph.charriere@gmail.com | |
| 73 | + createdAt: 2026-11-27T01:00:00.000Z | |
| 74 | + updatedAt: 2026-11-27T01:00:00.000Z | |
| 75 | + - id: 3 | |
| 76 | + title: "Check ACP (does the editor keep the warning?) and the line mode" | |
| 77 | + state: open | |
| 78 | + priority: low | |
| 79 | + author: | |
| 80 | + name: k33g | |
| 81 | + email: ph.charriere@gmail.com | |
| 82 | + createdAt: 2026-11-27T01:00:00.000Z | |
| 83 | + updatedAt: 2026-11-27T01:00:00.000Z | |
| 84 | + - id: 4 | |
| 85 | + title: "Docs EN+FR: when the context badge goes" | |
| 86 | + state: open | |
| 87 | + priority: low | |
| 88 | + author: | |
| 89 | + name: k33g | |
| 90 | + email: ph.charriere@gmail.com | |
| 91 | + createdAt: 2026-11-27T01:00:00.000Z | |
| 92 | + updatedAt: 2026-11-27T01:00:00.000Z | |
| 93 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 269 | ||
| 3 | +title: "Window: the \"context N% full\" badge stays after /compact (and /new, /resume)" | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-27T01:00:00.000Z | ||
| 9 | +updatedAt: 2026-11-27T01:00:00.000Z | ||
| 10 | +labels: | ||
| 11 | + - bug | ||
| 12 | + - kind::bug | ||
| 13 | +epic: Improve TUI | ||
| 14 | +related: | ||
| 15 | + - 153 | ||
| 16 | +body: | | ||
| 17 | + ## Reported (user, 2026-11-27) | ||
| 18 | + The "context N% full" warning shows fine, but once the history is | ||
| 19 | + compressed it keeps showing. | ||
| 20 | + | ||
| 21 | + ## Cause (read in the code, 2026-11-27) | ||
| 22 | + - engine/struggle.go `contextStruggle`: at the end of a turn, when the | ||
| 23 | + last model call read ≥ 80% of the window (`contextFullShare`), the | ||
| 24 | + turn reports `⚠ context N% full` (ui.ReportStruggle). | ||
| 25 | + - In the window that struggle becomes the status-bar badge (ticket 153, | ||
| 26 | + tui/struggle.go). The badge "outlives the turn" by design and is | ||
| 27 | + cleared in ONE place only: `startTurn` (tui/turn.go:201), when the next | ||
| 28 | + question is sent. | ||
| 29 | + - `/compact` (tui/turn.go, outcome "compact", `res.changed`) replaces the | ||
| 30 | + history and calls `ForgetInputTokens()`, but does not touch the badge: | ||
| 31 | + it keeps saying "context 85% full" over a history that is now small. | ||
| 32 | + Same for `/new` and `/resume` (tui/commands.go `newSession`, `resume`). | ||
| 33 | + - The header's `ctx N%` is right after a compaction (it falls back to | ||
| 34 | + `compact.Estimate` once the server's count is forgotten): only the badge | ||
| 35 | + is stale — the two then disagree on screen. | ||
| 36 | + - Line mode prints the warning once as a line: nothing stays. ACP: to | ||
| 37 | + check whether the editor keeps anything. | ||
| 38 | + | ||
| 39 | + ## Fix proposed | ||
| 40 | + - When the history shrinks — `/compact` that compressed, `/new`, | ||
| 41 | + `/resume` — drop the CONTEXT struggle from the badge, and only it: a | ||
| 42 | + "looped — stopped" or "max turns reached" badge still says why the last | ||
| 43 | + turn ended and must stay until the next question (ticket 153). | ||
| 44 | + - `ui.Struggle` gets a way to tell a context struggle from the others (a | ||
| 45 | + `Context bool`, or a kind), set by `contextStruggle`; `struggles` | ||
| 46 | + forgets it (and recomputes the badge from what is left — today it | ||
| 47 | + keeps only the worst + a count, so it must keep the list). | ||
| 48 | + - The automatic compaction at the start of a question needs nothing: the | ||
| 49 | + badge is already cleared by `startTurn`. | ||
| 50 | + | ||
| 51 | + ## Done when | ||
| 52 | + - Unit tests in tui: badge "context N% full" → /compact compressed → no | ||
| 53 | + badge; a severe badge survives /compact; /new and /resume clear the | ||
| 54 | + context badge; a failed /compact keeps it. | ||
| 55 | + - Reference docs (struggle signals, window) EN+FR say when the badge goes. | ||
| 56 | +tasks: | ||
| 57 | + - id: 1 | ||
| 58 | + title: "ui.Struggle: mark the context struggle; tui struggles: keep the list, forget the context one" | ||
| 59 | + state: open | ||
| 60 | + priority: medium | ||
| 61 | + author: | ||
| 62 | + name: k33g | ||
| 63 | + email: ph.charriere@gmail.com | ||
| 64 | + createdAt: 2026-11-27T01:00:00.000Z | ||
| 65 | + updatedAt: 2026-11-27T01:00:00.000Z | ||
| 66 | + - id: 2 | ||
| 67 | + title: "Clear it after /compact (compressed), /new, /resume — with tests" | ||
| 68 | + state: open | ||
| 69 | + priority: medium | ||
| 70 | + author: | ||
| 71 | + name: k33g | ||
| 72 | + email: ph.charriere@gmail.com | ||
| 73 | + createdAt: 2026-11-27T01:00:00.000Z | ||
| 74 | + updatedAt: 2026-11-27T01:00:00.000Z | ||
| 75 | + - id: 3 | ||
| 76 | + title: "Check ACP (does the editor keep the warning?) and the line mode" | ||
| 77 | + state: open | ||
| 78 | + priority: low | ||
| 79 | + author: | ||
| 80 | + name: k33g | ||
| 81 | + email: ph.charriere@gmail.com | ||
| 82 | + createdAt: 2026-11-27T01:00:00.000Z | ||
| 83 | + updatedAt: 2026-11-27T01:00:00.000Z | ||
| 84 | + - id: 4 | ||
| 85 | + title: "Docs EN+FR: when the context badge goes" | ||
| 86 | + state: open | ||
| 87 | + priority: low | ||
| 88 | + author: | ||
| 89 | + name: k33g | ||
| 90 | + email: ph.charriere@gmail.com | ||
| 91 | + createdAt: 2026-11-27T01:00:00.000Z | ||
| 92 | + updatedAt: 2026-11-27T01:00:00.000Z | ||
| 93 | +comments: [] | ||
modified
README.md +2 -0 | @@ -193,6 +193,8 @@ The `demos/` directory holds ready-made set-ups (most with a README explaining h | ||
| 193 | 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 | 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 | 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/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` | | |
| 196 | 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 | |
| 197 | 199 | | `demos/memory-search/` | an assistant that remembers a project's decisions: four earlier sessions (port, storage, logs in French, deployment as a `/compact` summary), `/memory <words>` for you and the `search_memory` tool for the model; Qwen3.5 4B on llmman, measured results — including what a word search cannot find | |
| 198 | 200 | | `demos/declared-tools/` | an ops desk with no `bash` and no skills, acting only through four tools declared under `tools:` — release, version bump, service logs, slow requests — covering every parameter type (string, enum, boolean, integer, number), a safe default (`dryRun: true`) and an optional argument; Mellum2 12B on DMR, measured results | |
| @@ -193,6 +193,8 @@ 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/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` | | ||
| 196 | | `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 | | 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 | |
| 197 | | `demos/memory-search/` | an assistant that remembers a project's decisions: four earlier sessions (port, storage, logs in French, deployment as a `/compact` summary), `/memory <words>` for you and the `search_memory` tool for the model; Qwen3.5 4B on llmman, measured results — including what a word search cannot find | | 199 | | `demos/memory-search/` | an assistant that remembers a project's decisions: four earlier sessions (port, storage, logs in French, deployment as a `/compact` summary), `/memory <words>` for you and the `search_memory` tool for the model; Qwen3.5 4B on llmman, measured results — including what a word search cannot find | |
| 198 | | `demos/declared-tools/` | an ops desk with no `bash` and no skills, acting only through four tools declared under `tools:` — release, version bump, service logs, slow requests — covering every parameter type (string, enum, boolean, integer, number), a safe default (`dryRun: true`) and an optional argument; Mellum2 12B on DMR, measured results | | 200 | | `demos/declared-tools/` | an ops desk with no `bash` and no skills, acting only through four tools declared under `tools:` — release, version bump, service logs, slow requests — covering every parameter type (string, enum, boolean, integer, number), a safe default (`dryRun: true`) and an optional argument; Mellum2 12B on DMR, measured results | |
added
demos/memory-skills-2/.gitignore +4 -0 | new file mode 100644 | ||
| @@ -0,0 +1,4 @@ | ||
| 1 | +!.mm | |
| 2 | +.mm/sessions | |
| 3 | +.mm/traces | |
| 4 | +.mm/memory.md | |
| new file mode 100644 | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | +!.mm | ||
| 2 | +.mm/sessions | ||
| 3 | +.mm/traces | ||
| 4 | +.mm/memory.md | ||
added
demos/memory-skills-2/.mm/agent.yaml +82 -0 | new file mode 100644 | ||
| @@ -0,0 +1,82 @@ | ||
| 1 | +# Jay, variant 2 — the memory always in the prompt (ticket 74). | |
| 2 | +# Named after the jay, which hides thousands of acorns and finds them again. | |
| 3 | +# | |
| 4 | +# Same memory file as demos/memory-skills, .mm/memory.md, written by the | |
| 5 | +# same skills (remember, forget). The difference: recall reads no file — mm | |
| 6 | +# puts the file in the system prompt itself, at the start of every conversation, | |
| 7 | +# through agentsMd.path (the mechanism of AGENTS.md, pointed at the memory). | |
| 8 | +# | |
| 9 | +# cd demos/memory-skills-2 | |
| 10 | +# ../../mm line mode | |
| 11 | +# ../../mm -tui window | |
| 12 | +# ../../mm -p "…" one question, a new conversation each time | |
| 13 | +# | |
| 14 | +# See ../README.en.md. | |
| 15 | + | |
| 16 | +provider: llamacpp | |
| 17 | +# Qwen3.5 4B, thinking off. No baseUrl: llamacpp's defaults apply — | |
| 18 | +# 127.0.0.1:9931 (the Llama app), then 8080, then host.docker.internal:9931. | |
| 19 | +model: "unsloth/Qwen3.5-4B-GGUF:Q4_K_M" | |
| 20 | + | |
| 21 | +# relative to the folder mm runs in (demos/memory-skills-2) | |
| 22 | +skillsDir: .mm/skills | |
| 23 | +# read_file, write_file, edit_file: the skills need them. No bash. | |
| 24 | +editTools: true | |
| 25 | +bashTool: false | |
| 26 | +planTool: false | |
| 27 | +fetchContentTool: false | |
| 28 | +askUserTool: false | |
| 29 | + | |
| 30 | +# The memory, read at the start of every conversation (start-up, /new, | |
| 31 | +# /resume, -p, an ACP session) and appended to the system prompt. Never in | |
| 32 | +# the middle of one: a fact saved during a conversation is in its history | |
| 33 | +# already, and in the prompt from the next one. A missing file is no error. | |
| 34 | +# This agent therefore does not read the project's AGENTS.md. | |
| 35 | +agentsMd: | |
| 36 | + enabled: true | |
| 37 | + path: .mm/memory.md | |
| 38 | + # above this, the file is not read at all and the banner says so | |
| 39 | + maxChars: 4000 | |
| 40 | + | |
| 41 | +# yolo: true so that -p can write the memory. Set it to false and mm asks | |
| 42 | +# before every write_file / edit_file of the memory (not in -p: rejected). | |
| 43 | +yolo: true | |
| 44 | +# The model is shared with your other agents: leave it loaded. | |
| 45 | +unloadOnExit: false | |
| 46 | +unloadModels: false | |
| 47 | +maxTurns: 8 | |
| 48 | +firstTokenTimeout: 3m | |
| 49 | + | |
| 50 | +sessions: | |
| 51 | + enabled: true | |
| 52 | + dir: .mm/sessions | |
| 53 | + | |
| 54 | +sampling: | |
| 55 | + # family qwen, precise: the skills are procedures to follow exactly | |
| 56 | + temperature: 0.0 | |
| 57 | + max_tokens: 2048 | |
| 58 | + parallel_tool_calls: false | |
| 59 | + chat_template_kwargs: | |
| 60 | + enable_thinking: false | |
| 61 | + | |
| 62 | +acp: | |
| 63 | + name: jay | |
| 64 | + title: "Jay (memory in the prompt)" | |
| 65 | + | |
| 66 | +system: | | |
| 67 | + Your name is Jay, a helpful assistant. You keep a memory of the user and | |
| 68 | + of the project in the file .mm/memory.md. When it holds something, it is | |
| 69 | + shown at the end of this prompt, under "PROJECT INSTRUCTIONS (from | |
| 70 | + …/.mm/memory.md)": those lines ARE your memory — apply what it says about | |
| 71 | + the user (for example the language they want) in EVERY answer. | |
| 72 | + - The user's message EXPLICITLY asks you to remember or note something | |
| 73 | + ("remember", "note that", "souviens-toi", "retiens") → call read_skill | |
| 74 | + remember, then do exactly what the skill says. Never on your own | |
| 75 | + initiative: a question is not a request to remember. | |
| 76 | + - The user asks you to forget something → call read_skill forget, then do | |
| 77 | + exactly what the skill says. | |
| 78 | + - A question about the user or the project's conventions → call | |
| 79 | + read_skill recall, then answer as it says. Never guess. | |
| 80 | + For anything else, answer directly. | |
| 81 | + Never put a password, a key or a token in the memory. | |
| 82 | + Answer in a few lines. | |
| new file mode 100644 | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | +# Jay, variant 2 — the memory always in the prompt (ticket 74). | ||
| 2 | +# Named after the jay, which hides thousands of acorns and finds them again. | ||
| 3 | +# | ||
| 4 | +# Same memory file as demos/memory-skills, .mm/memory.md, written by the | ||
| 5 | +# same skills (remember, forget). The difference: recall reads no file — mm | ||
| 6 | +# puts the file in the system prompt itself, at the start of every conversation, | ||
| 7 | +# through agentsMd.path (the mechanism of AGENTS.md, pointed at the memory). | ||
| 8 | +# | ||
| 9 | +# cd demos/memory-skills-2 | ||
| 10 | +# ../../mm line mode | ||
| 11 | +# ../../mm -tui window | ||
| 12 | +# ../../mm -p "…" one question, a new conversation each time | ||
| 13 | +# | ||
| 14 | +# See ../README.en.md. | ||
| 15 | + | ||
| 16 | +provider: llamacpp | ||
| 17 | +# Qwen3.5 4B, thinking off. No baseUrl: llamacpp's defaults apply — | ||
| 18 | +# 127.0.0.1:9931 (the Llama app), then 8080, then host.docker.internal:9931. | ||
| 19 | +model: "unsloth/Qwen3.5-4B-GGUF:Q4_K_M" | ||
| 20 | + | ||
| 21 | +# relative to the folder mm runs in (demos/memory-skills-2) | ||
| 22 | +skillsDir: .mm/skills | ||
| 23 | +# read_file, write_file, edit_file: the skills need them. No bash. | ||
| 24 | +editTools: true | ||
| 25 | +bashTool: false | ||
| 26 | +planTool: false | ||
| 27 | +fetchContentTool: false | ||
| 28 | +askUserTool: false | ||
| 29 | + | ||
| 30 | +# The memory, read at the start of every conversation (start-up, /new, | ||
| 31 | +# /resume, -p, an ACP session) and appended to the system prompt. Never in | ||
| 32 | +# the middle of one: a fact saved during a conversation is in its history | ||
| 33 | +# already, and in the prompt from the next one. A missing file is no error. | ||
| 34 | +# This agent therefore does not read the project's AGENTS.md. | ||
| 35 | +agentsMd: | ||
| 36 | + enabled: true | ||
| 37 | + path: .mm/memory.md | ||
| 38 | + # above this, the file is not read at all and the banner says so | ||
| 39 | + maxChars: 4000 | ||
| 40 | + | ||
| 41 | +# yolo: true so that -p can write the memory. Set it to false and mm asks | ||
| 42 | +# before every write_file / edit_file of the memory (not in -p: rejected). | ||
| 43 | +yolo: true | ||
| 44 | +# The model is shared with your other agents: leave it loaded. | ||
| 45 | +unloadOnExit: false | ||
| 46 | +unloadModels: false | ||
| 47 | +maxTurns: 8 | ||
| 48 | +firstTokenTimeout: 3m | ||
| 49 | + | ||
| 50 | +sessions: | ||
| 51 | + enabled: true | ||
| 52 | + dir: .mm/sessions | ||
| 53 | + | ||
| 54 | +sampling: | ||
| 55 | + # family qwen, precise: the skills are procedures to follow exactly | ||
| 56 | + temperature: 0.0 | ||
| 57 | + max_tokens: 2048 | ||
| 58 | + parallel_tool_calls: false | ||
| 59 | + chat_template_kwargs: | ||
| 60 | + enable_thinking: false | ||
| 61 | + | ||
| 62 | +acp: | ||
| 63 | + name: jay | ||
| 64 | + title: "Jay (memory in the prompt)" | ||
| 65 | + | ||
| 66 | +system: | | ||
| 67 | + Your name is Jay, a helpful assistant. You keep a memory of the user and | ||
| 68 | + of the project in the file .mm/memory.md. When it holds something, it is | ||
| 69 | + shown at the end of this prompt, under "PROJECT INSTRUCTIONS (from | ||
| 70 | + …/.mm/memory.md)": those lines ARE your memory — apply what it says about | ||
| 71 | + the user (for example the language they want) in EVERY answer. | ||
| 72 | + - The user's message EXPLICITLY asks you to remember or note something | ||
| 73 | + ("remember", "note that", "souviens-toi", "retiens") → call read_skill | ||
| 74 | + remember, then do exactly what the skill says. Never on your own | ||
| 75 | + initiative: a question is not a request to remember. | ||
| 76 | + - The user asks you to forget something → call read_skill forget, then do | ||
| 77 | + exactly what the skill says. | ||
| 78 | + - A question about the user or the project's conventions → call | ||
| 79 | + read_skill recall, then answer as it says. Never guess. | ||
| 80 | + For anything else, answer directly. | ||
| 81 | + Never put a password, a key or a token in the memory. | ||
| 82 | + Answer in a few lines. | ||
added
demos/memory-skills-2/.mm/skills/forget/SKILL.md +15 -0 | new file mode 100644 | ||
| @@ -0,0 +1,15 @@ | ||
| 1 | +--- | |
| 2 | +name: forget | |
| 3 | +description: Remove a fact from the memory file when the user asks to forget it. | |
| 4 | +keywords: forget, remove from memory, no longer true, oublie, efface, supprime de ta mémoire | |
| 5 | +--- | |
| 6 | + | |
| 7 | +# Forget a fact | |
| 8 | + | |
| 9 | +## What to do | |
| 10 | + | |
| 11 | +1. Call `read_file` with the path `.mm/memory.md`. If it does not exist, say there is nothing to forget. | |
| 12 | +2. Find the line (or lines) the user means. If none matches, say so and stop. | |
| 13 | +3. Remove each line: `edit_file` with `old` = that line followed by its newline, exactly, and `new` = an empty string. Never call `write_file` on the memory: it would erase the other facts. | |
| 14 | +4. Call `read_file` again: only the lines you meant must be gone. If another one is missing, put it back with `edit_file`. | |
| 15 | +5. Answer in one sentence what you forgot. | |
| new file mode 100644 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | +--- | ||
| 2 | +name: forget | ||
| 3 | +description: Remove a fact from the memory file when the user asks to forget it. | ||
| 4 | +keywords: forget, remove from memory, no longer true, oublie, efface, supprime de ta mémoire | ||
| 5 | +--- | ||
| 6 | + | ||
| 7 | +# Forget a fact | ||
| 8 | + | ||
| 9 | +## What to do | ||
| 10 | + | ||
| 11 | +1. Call `read_file` with the path `.mm/memory.md`. If it does not exist, say there is nothing to forget. | ||
| 12 | +2. Find the line (or lines) the user means. If none matches, say so and stop. | ||
| 13 | +3. Remove each line: `edit_file` with `old` = that line followed by its newline, exactly, and `new` = an empty string. Never call `write_file` on the memory: it would erase the other facts. | ||
| 14 | +4. Call `read_file` again: only the lines you meant must be gone. If another one is missing, put it back with `edit_file`. | ||
| 15 | +5. Answer in one sentence what you forgot. | ||
added
demos/memory-skills-2/.mm/skills/recall/SKILL.md +15 -0 | new file mode 100644 | ||
| @@ -0,0 +1,15 @@ | ||
| 1 | +--- | |
| 2 | +name: recall | |
| 3 | +description: Answer a question about the user or the project's conventions from the memory already in your prompt. | |
| 4 | +keywords: what do you know, my preferences, how should I, convention, our rule, tu te souviens, que sais-tu, mes préférences | |
| 5 | +--- | |
| 6 | + | |
| 7 | +# Recall the memory | |
| 8 | + | |
| 9 | +## What to do | |
| 10 | + | |
| 11 | +Your memory is ALREADY in your system prompt, under "PROJECT INSTRUCTIONS (from …/.mm/memory.md)". Do not call any tool. | |
| 12 | + | |
| 13 | +1. Answer the question from those lines, and say it comes from your memory. | |
| 14 | +2. If they hold nothing about the question, say so plainly ("my memory says nothing about that"). | |
| 15 | +3. Apply what the memory says about the user — the language of your answer first: when it says the user prefers a language, answer in that language, whatever the language of the question. | |
| new file mode 100644 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | +--- | ||
| 2 | +name: recall | ||
| 3 | +description: Answer a question about the user or the project's conventions from the memory already in your prompt. | ||
| 4 | +keywords: what do you know, my preferences, how should I, convention, our rule, tu te souviens, que sais-tu, mes préférences | ||
| 5 | +--- | ||
| 6 | + | ||
| 7 | +# Recall the memory | ||
| 8 | + | ||
| 9 | +## What to do | ||
| 10 | + | ||
| 11 | +Your memory is ALREADY in your system prompt, under "PROJECT INSTRUCTIONS (from …/.mm/memory.md)". Do not call any tool. | ||
| 12 | + | ||
| 13 | +1. Answer the question from those lines, and say it comes from your memory. | ||
| 14 | +2. If they hold nothing about the question, say so plainly ("my memory says nothing about that"). | ||
| 15 | +3. Apply what the memory says about the user — the language of your answer first: when it says the user prefers a language, answer in that language, whatever the language of the question. | ||
added
demos/memory-skills-2/.mm/skills/remember/SKILL.md +31 -0 | new file mode 100644 | ||
| @@ -0,0 +1,31 @@ | ||
| 1 | +--- | |
| 2 | +name: remember | |
| 3 | +description: Save one fact about the user or the project in the memory file, for the next conversations. | |
| 4 | +keywords: remember, note that, keep in mind, from now on, souviens-toi, retiens, note que, rappelle-toi | |
| 5 | +--- | |
| 6 | + | |
| 7 | +# Remember a fact | |
| 8 | + | |
| 9 | +The memory file is a title and a list, one fact per line, newest first: | |
| 10 | + | |
| 11 | + # Memory | |
| 12 | + | |
| 13 | + - CI runs on GitHub Actions. | |
| 14 | + - Prefers answers in French. | |
| 15 | + | |
| 16 | +## What to do | |
| 17 | + | |
| 18 | +0. Only when the user's message asks you to remember or note something. If it is a question, or if it does not ask that, do not write anything: answer from the memory in your prompt. | |
| 19 | +1. Call `read_file` with the path `.mm/memory.md`. | |
| 20 | + - Only if the file does not exist: call `write_file` with the path `.mm/memory.md` and exactly this content (a title line, then an empty line), then go on with step 2: | |
| 21 | + | |
| 22 | + # Memory | |
| 23 | + | |
| 24 | + - If the file exists, NEVER call `write_file` on it: that would erase every other fact. Change it only with `edit_file`. | |
| 25 | +2. Write the fact as ONE short line, starting with `- `, in the third person: `- Prefers answers in French.`, `- Release tags are rel-YYYY.MM.` Several facts in one request: one line each. | |
| 26 | + The lines of the memory are ALWAYS in English — even when the user writes in another language, even when the memory says the user prefers another language. That preference is for your answers, never for the memory. "Notre CI tourne sur Forgejo" becomes `- CI runs on Forgejo.` | |
| 27 | +3. If a line of the file already says the same thing, do nothing for this fact. If a line says something the new fact CONTRADICTS (the user changed their mind), replace THAT line only: `edit_file` with `old` = the old line, exactly, and `new` = the new line. | |
| 28 | +4. Otherwise add the line at the top of the list: `edit_file` with `old` = `# Memory` followed by its empty line, and `new` = `# Memory`, the empty line, then your line. Nothing else in `old`: the other lines must not be touched. | |
| 29 | +5. Call `read_file` on `.mm/memory.md` again and compare with step 1: every line that was there must still be there (except a line you replaced in step 3). If one is missing, put it back with `edit_file`. | |
| 30 | +6. Never write a password, a key or a token: say you will not keep it, without repeating it. | |
| 31 | +7. Answer in one sentence what you saved (or replaced). | |
| new file mode 100644 | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | +--- | ||
| 2 | +name: remember | ||
| 3 | +description: Save one fact about the user or the project in the memory file, for the next conversations. | ||
| 4 | +keywords: remember, note that, keep in mind, from now on, souviens-toi, retiens, note que, rappelle-toi | ||
| 5 | +--- | ||
| 6 | + | ||
| 7 | +# Remember a fact | ||
| 8 | + | ||
| 9 | +The memory file is a title and a list, one fact per line, newest first: | ||
| 10 | + | ||
| 11 | + # Memory | ||
| 12 | + | ||
| 13 | + - CI runs on GitHub Actions. | ||
| 14 | + - Prefers answers in French. | ||
| 15 | + | ||
| 16 | +## What to do | ||
| 17 | + | ||
| 18 | +0. Only when the user's message asks you to remember or note something. If it is a question, or if it does not ask that, do not write anything: answer from the memory in your prompt. | ||
| 19 | +1. Call `read_file` with the path `.mm/memory.md`. | ||
| 20 | + - Only if the file does not exist: call `write_file` with the path `.mm/memory.md` and exactly this content (a title line, then an empty line), then go on with step 2: | ||
| 21 | + | ||
| 22 | + # Memory | ||
| 23 | + | ||
| 24 | + - If the file exists, NEVER call `write_file` on it: that would erase every other fact. Change it only with `edit_file`. | ||
| 25 | +2. Write the fact as ONE short line, starting with `- `, in the third person: `- Prefers answers in French.`, `- Release tags are rel-YYYY.MM.` Several facts in one request: one line each. | ||
| 26 | + The lines of the memory are ALWAYS in English — even when the user writes in another language, even when the memory says the user prefers another language. That preference is for your answers, never for the memory. "Notre CI tourne sur Forgejo" becomes `- CI runs on Forgejo.` | ||
| 27 | +3. If a line of the file already says the same thing, do nothing for this fact. If a line says something the new fact CONTRADICTS (the user changed their mind), replace THAT line only: `edit_file` with `old` = the old line, exactly, and `new` = the new line. | ||
| 28 | +4. Otherwise add the line at the top of the list: `edit_file` with `old` = `# Memory` followed by its empty line, and `new` = `# Memory`, the empty line, then your line. Nothing else in `old`: the other lines must not be touched. | ||
| 29 | +5. Call `read_file` on `.mm/memory.md` again and compare with step 1: every line that was there must still be there (except a line you replaced in step 3). If one is missing, put it back with `edit_file`. | ||
| 30 | +6. Never write a password, a key or a token: say you will not keep it, without repeating it. | ||
| 31 | +7. Answer in one sentence what you saved (or replaced). | ||
added
demos/memory-skills-2/README.en.md +78 -0 | new file mode 100644 | ||
| @@ -0,0 +1,78 @@ | ||
| 1 | +# memory-skills-2 demo — the memory always in the prompt (`agentsMd.path`) | |
| 2 | + | |
| 3 | +The variant of [`demos/memory-skills`](../memory-skills/README.en.md). Same agent, Jay, same memory file `.mm/memory.md`, same `remember` and `forget` skills. One difference: **`recall` reads no file**. mm puts the memory in the system prompt by itself, at the start of every conversation, with the mechanism it uses for `AGENTS.md` — pointed at the memory file: | |
| 4 | + | |
| 5 | +```yaml | |
| 6 | +agentsMd: | |
| 7 | + enabled: true | |
| 8 | + path: .mm/memory.md | |
| 9 | + maxChars: 4000 # above this, the file is not read at all and the banner says so | |
| 10 | +``` | |
| 11 | + | |
| 12 | +No mm code either. What it costs: this agent does not read the project's `AGENTS.md` any more (`agentsMd` has one path). | |
| 13 | + | |
| 14 | +Version française : [README.fr.md](README.fr.md). | |
| 15 | + | |
| 16 | +| File | What it is | | |
| 17 | +|------|------------| | |
| 18 | +| `.mm/agent.yaml` | Jay: `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (thinking off, temperature 0), `agentsMd.path: .mm/memory.md`, `read_file` / `write_file` / `edit_file`, no `bash` | | |
| 19 | +| `.mm/skills/remember`, `.mm/skills/forget` | the same as in `memory-skills`: one list of facts, `edit_file` only (never `write_file` on an existing file), a second read to check no fact was lost, lines always in English, never unasked — the rules were found here (runs B, C, E) then given to `memory-skills` too | | |
| 20 | +| `.mm/skills/recall` | no tool: "your memory is already in your prompt — answer from it, in the language the memory says" | | |
| 21 | +| `.mm/memory.md` | the memory, created by the first `remember` — not in the repository | | |
| 22 | + | |
| 23 | +The file is read at the start of a conversation, never in the middle (the server's prompt cache is kept): a fact saved during a conversation is in its history already, and in the prompt from the next conversation on. A missing file is no error. | |
| 24 | + | |
| 25 | +## Run it | |
| 26 | + | |
| 27 | +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`. | |
| 28 | + | |
| 29 | +```bash | |
| 30 | +cd demos/memory-skills-2 | |
| 31 | +../../mm # line mode | |
| 32 | +../../mm -tui # window | |
| 33 | +../../mm -p "Remember that I prefer answers in French, and that we tag our releases rel-YYYY.MM." | |
| 34 | +../../mm -p "What is the capital of Italy?" # answered in French: the memory is in the prompt | |
| 35 | +``` | |
| 36 | + | |
| 37 | +## What was checked (2026-11-26, from an sbx sandbox, llama-server router on the Mac) | |
| 38 | + | |
| 39 | +The same 8 questions as `memory-skills`, in the same order, each a separate `-p` (a new conversation), Qwen3.5 4B at temperature 0 — four runs, one change at a time: | |
| 40 | + | |
| 41 | +| Run | What changed | What went wrong | | |
| 42 | +|-----|--------------|-----------------| | |
| 43 | +| A | no `recall` skill at all, the memory in the prompt | the tag question (asked in English) answered in English; `remember` read on two plain questions; the CI fact under `## user`, in French | | |
| 44 | +| B | `remember`: lines always in English, "our CI / we use" → `## project` | CI line right; tag answer now in French — but `remember` read on the tag question **wrote a line nobody asked for** | | |
| 45 | +| C | `remember` only when explicitly asked, a step 0 that stops otherwise | no unasked write — but the tag answer back in English, and "what do you know about me?" answered "nothing" (step 0 said not to read the memory) | | |
| 46 | +| **D** | a `recall` skill **without any tool**: "the memory is already in your prompt, answer from it, in the language it says" | **nothing: 8/8** | | |
| 47 | + | |
| 48 | +Run D, the files as they are now: | |
| 49 | + | |
| 50 | +| Question | Skill, tools | Result | | |
| 51 | +|----------|--------------|--------| | |
| 52 | +| Remember I prefer French, and tags rel-YYYY.MM | `remember`, `read_file`, `write_file` | both facts, right sections; answer in French | | |
| 53 | +| How should I name the tag for the November 2026 release? | `recall`, no tool | **rel-2026.11, in French** | | |
| 54 | +| What do you know about me? | `recall`, no tool | the French preference, "according to my memory" | | |
| 55 | +| Souviens-toi que notre CI tourne sur Forgejo. | `remember`, `edit_file` | `- CI runs on Forgejo.` under `## project`, in English | | |
| 56 | +| Actually, we moved the CI to GitHub Actions. Remember that. | `remember`, `edit_file` | the line replaced; confirmation in French | | |
| 57 | +| Remember my API token: sk-test-… | `remember`, no write | refused, in French, the token not repeated | | |
| 58 | +| Oublie ce que tu sais sur la CI. | `forget`, `edit_file` | the line removed | | |
| 59 | +| What is the capital of Italy? | none | **Rome, in French** | | |
| 60 | + | |
| 61 | +Compared with `memory-skills` — the same `remember` and `forget`, only a `recall` that reads the file instead of the memory in the prompt: there, 4 of the 7 answers after the preference was saved came in French; here 7 of 7 — the preference is in the prompt even when no skill is called (Rome). | |
| 62 | + | |
| 63 | +**What these runs show about Qwen3.5 4B:** the `read_skill` tool asks the model to load a skill BEFORE any task, so a question with no matching skill gets the nearest one — `remember` when nothing else speaks of memory. A harmless skill for questions (`recall`, no tool) gives that reflex somewhere to go. One run per configuration: a hint, not a measurement of variance. | |
| 64 | + | |
| 65 | +The window and Zed were not tried live. | |
| 66 | + | |
| 67 | +## Later: one list, no lost fact, and what the memory costs (2026-11-27) | |
| 68 | + | |
| 69 | +**Run E — one list instead of `## user` / `## project`.** The sections added a decision at every `remember` (run A put the CI under `## user`) and gave nothing: the file is per project anyway. A user's own run also showed a write that **emptied the user section** while saving a project fact. `remember` and `forget` now: one list, newest first; `edit_file` only — never `write_file` on a file that exists; `old` = the title and its empty line, nothing else; then `read_file` again and put back any line that went missing. Ten questions (the eight, plus "Remember that my name is Sam." and a second "What do you know about me?"), the file shown after every write: **no fact lost in 6 writes**; the last question answered "tu t'appelles Sam, tu préfères le français, tags rel-YYYY.MM". One confirmation ("I've saved that you're Sam.") came in English. | |
| 70 | + | |
| 71 | +**What the memory costs in the context** (llama-server's `prompt_tokens`, `AGENT_TRACE`, a 4-line memory): | |
| 72 | + | |
| 73 | +| Question | `memory-skills` (recall reads the file) | `memory-skills-2` (memory in the prompt) | | |
| 74 | +|----------|------------------------------------------|-------------------------------------------| | |
| 75 | +| What is the capital of Italy? (1 call) | 1749 | 1839 (+90) | | |
| 76 | +| Tag for November 2026? (last call) | 2073 (3 calls) | 2088 (2 calls) | | |
| 77 | + | |
| 78 | +The memory in the prompt costs about **90 tokens for 4 facts** (~10 a line, plus mm's heading), on every call — but it is the start of the prompt, which llama-server keeps in its prompt cache. `recall` costs about as much **each time it is called**, and that read stays in the history. What fills the context is the rest: ~1750 tokens of system prompt and tool definitions before the first word, against a **4096-token window** (the banner's `ctx: 4096 (/props)` — the llama-server preset, not the model, which takes far more). Raise `ctx-size` in the server's preset, or lower `agentsMd.maxChars` (4000 characters ≈ 1100 tokens at most). | |
| new file mode 100644 | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | +# memory-skills-2 demo — the memory always in the prompt (`agentsMd.path`) | ||
| 2 | + | ||
| 3 | +The variant of [`demos/memory-skills`](../memory-skills/README.en.md). Same agent, Jay, same memory file `.mm/memory.md`, same `remember` and `forget` skills. One difference: **`recall` reads no file**. mm puts the memory in the system prompt by itself, at the start of every conversation, with the mechanism it uses for `AGENTS.md` — pointed at the memory file: | ||
| 4 | + | ||
| 5 | +```yaml | ||
| 6 | +agentsMd: | ||
| 7 | + enabled: true | ||
| 8 | + path: .mm/memory.md | ||
| 9 | + maxChars: 4000 # above this, the file is not read at all and the banner says so | ||
| 10 | +``` | ||
| 11 | + | ||
| 12 | +No mm code either. What it costs: this agent does not read the project's `AGENTS.md` any more (`agentsMd` has one path). | ||
| 13 | + | ||
| 14 | +Version française : [README.fr.md](README.fr.md). | ||
| 15 | + | ||
| 16 | +| File | What it is | | ||
| 17 | +|------|------------| | ||
| 18 | +| `.mm/agent.yaml` | Jay: `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (thinking off, temperature 0), `agentsMd.path: .mm/memory.md`, `read_file` / `write_file` / `edit_file`, no `bash` | | ||
| 19 | +| `.mm/skills/remember`, `.mm/skills/forget` | the same as in `memory-skills`: one list of facts, `edit_file` only (never `write_file` on an existing file), a second read to check no fact was lost, lines always in English, never unasked — the rules were found here (runs B, C, E) then given to `memory-skills` too | | ||
| 20 | +| `.mm/skills/recall` | no tool: "your memory is already in your prompt — answer from it, in the language the memory says" | | ||
| 21 | +| `.mm/memory.md` | the memory, created by the first `remember` — not in the repository | | ||
| 22 | + | ||
| 23 | +The file is read at the start of a conversation, never in the middle (the server's prompt cache is kept): a fact saved during a conversation is in its history already, and in the prompt from the next conversation on. A missing file is no error. | ||
| 24 | + | ||
| 25 | +## Run it | ||
| 26 | + | ||
| 27 | +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`. | ||
| 28 | + | ||
| 29 | +```bash | ||
| 30 | +cd demos/memory-skills-2 | ||
| 31 | +../../mm # line mode | ||
| 32 | +../../mm -tui # window | ||
| 33 | +../../mm -p "Remember that I prefer answers in French, and that we tag our releases rel-YYYY.MM." | ||
| 34 | +../../mm -p "What is the capital of Italy?" # answered in French: the memory is in the prompt | ||
| 35 | +``` | ||
| 36 | + | ||
| 37 | +## What was checked (2026-11-26, from an sbx sandbox, llama-server router on the Mac) | ||
| 38 | + | ||
| 39 | +The same 8 questions as `memory-skills`, in the same order, each a separate `-p` (a new conversation), Qwen3.5 4B at temperature 0 — four runs, one change at a time: | ||
| 40 | + | ||
| 41 | +| Run | What changed | What went wrong | | ||
| 42 | +|-----|--------------|-----------------| | ||
| 43 | +| A | no `recall` skill at all, the memory in the prompt | the tag question (asked in English) answered in English; `remember` read on two plain questions; the CI fact under `## user`, in French | | ||
| 44 | +| B | `remember`: lines always in English, "our CI / we use" → `## project` | CI line right; tag answer now in French — but `remember` read on the tag question **wrote a line nobody asked for** | | ||
| 45 | +| C | `remember` only when explicitly asked, a step 0 that stops otherwise | no unasked write — but the tag answer back in English, and "what do you know about me?" answered "nothing" (step 0 said not to read the memory) | | ||
| 46 | +| **D** | a `recall` skill **without any tool**: "the memory is already in your prompt, answer from it, in the language it says" | **nothing: 8/8** | | ||
| 47 | + | ||
| 48 | +Run D, the files as they are now: | ||
| 49 | + | ||
| 50 | +| Question | Skill, tools | Result | | ||
| 51 | +|----------|--------------|--------| | ||
| 52 | +| Remember I prefer French, and tags rel-YYYY.MM | `remember`, `read_file`, `write_file` | both facts, right sections; answer in French | | ||
| 53 | +| How should I name the tag for the November 2026 release? | `recall`, no tool | **rel-2026.11, in French** | | ||
| 54 | +| What do you know about me? | `recall`, no tool | the French preference, "according to my memory" | | ||
| 55 | +| Souviens-toi que notre CI tourne sur Forgejo. | `remember`, `edit_file` | `- CI runs on Forgejo.` under `## project`, in English | | ||
| 56 | +| Actually, we moved the CI to GitHub Actions. Remember that. | `remember`, `edit_file` | the line replaced; confirmation in French | | ||
| 57 | +| Remember my API token: sk-test-… | `remember`, no write | refused, in French, the token not repeated | | ||
| 58 | +| Oublie ce que tu sais sur la CI. | `forget`, `edit_file` | the line removed | | ||
| 59 | +| What is the capital of Italy? | none | **Rome, in French** | | ||
| 60 | + | ||
| 61 | +Compared with `memory-skills` — the same `remember` and `forget`, only a `recall` that reads the file instead of the memory in the prompt: there, 4 of the 7 answers after the preference was saved came in French; here 7 of 7 — the preference is in the prompt even when no skill is called (Rome). | ||
| 62 | + | ||
| 63 | +**What these runs show about Qwen3.5 4B:** the `read_skill` tool asks the model to load a skill BEFORE any task, so a question with no matching skill gets the nearest one — `remember` when nothing else speaks of memory. A harmless skill for questions (`recall`, no tool) gives that reflex somewhere to go. One run per configuration: a hint, not a measurement of variance. | ||
| 64 | + | ||
| 65 | +The window and Zed were not tried live. | ||
| 66 | + | ||
| 67 | +## Later: one list, no lost fact, and what the memory costs (2026-11-27) | ||
| 68 | + | ||
| 69 | +**Run E — one list instead of `## user` / `## project`.** The sections added a decision at every `remember` (run A put the CI under `## user`) and gave nothing: the file is per project anyway. A user's own run also showed a write that **emptied the user section** while saving a project fact. `remember` and `forget` now: one list, newest first; `edit_file` only — never `write_file` on a file that exists; `old` = the title and its empty line, nothing else; then `read_file` again and put back any line that went missing. Ten questions (the eight, plus "Remember that my name is Sam." and a second "What do you know about me?"), the file shown after every write: **no fact lost in 6 writes**; the last question answered "tu t'appelles Sam, tu préfères le français, tags rel-YYYY.MM". One confirmation ("I've saved that you're Sam.") came in English. | ||
| 70 | + | ||
| 71 | +**What the memory costs in the context** (llama-server's `prompt_tokens`, `AGENT_TRACE`, a 4-line memory): | ||
| 72 | + | ||
| 73 | +| Question | `memory-skills` (recall reads the file) | `memory-skills-2` (memory in the prompt) | | ||
| 74 | +|----------|------------------------------------------|-------------------------------------------| | ||
| 75 | +| What is the capital of Italy? (1 call) | 1749 | 1839 (+90) | | ||
| 76 | +| Tag for November 2026? (last call) | 2073 (3 calls) | 2088 (2 calls) | | ||
| 77 | + | ||
| 78 | +The memory in the prompt costs about **90 tokens for 4 facts** (~10 a line, plus mm's heading), on every call — but it is the start of the prompt, which llama-server keeps in its prompt cache. `recall` costs about as much **each time it is called**, and that read stays in the history. What fills the context is the rest: ~1750 tokens of system prompt and tool definitions before the first word, against a **4096-token window** (the banner's `ctx: 4096 (/props)` — the llama-server preset, not the model, which takes far more). Raise `ctx-size` in the server's preset, or lower `agentsMd.maxChars` (4000 characters ≈ 1100 tokens at most). | ||
added
demos/memory-skills-2/README.fr.md +78 -0 | new file mode 100644 | ||
| @@ -0,0 +1,78 @@ | ||
| 1 | +# Démo memory-skills-2 — la mémoire toujours dans le prompt (`agentsMd.path`) | |
| 2 | + | |
| 3 | +La variante de [`demos/memory-skills`](../memory-skills/README.fr.md). Même agent, Jay, même fichier mémoire `.mm/memory.md`, mêmes skills `remember` et `forget`. Une différence : **`recall` ne lit aucun fichier**. mm met lui-même la mémoire dans le prompt système, au début de chaque conversation, avec le mécanisme qu'il utilise pour `AGENTS.md` — pointé sur le fichier mémoire : | |
| 4 | + | |
| 5 | +```yaml | |
| 6 | +agentsMd: | |
| 7 | + enabled: true | |
| 8 | + path: .mm/memory.md | |
| 9 | + maxChars: 4000 # au-delà, le fichier n'est pas lu du tout et la bannière le dit | |
| 10 | +``` | |
| 11 | + | |
| 12 | +Pas de code mm non plus. Ce que ça coûte : cet agent ne lit plus le `AGENTS.md` du projet (`agentsMd` n'a qu'un chemin). | |
| 13 | + | |
| 14 | +English version: [README.en.md](README.en.md). | |
| 15 | + | |
| 16 | +| Fichier | Ce que c'est | | |
| 17 | +|---------|--------------| | |
| 18 | +| `.mm/agent.yaml` | Jay : `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (raisonnement coupé, température 0), `agentsMd.path: .mm/memory.md`, `read_file` / `write_file` / `edit_file`, pas de `bash` | | |
| 19 | +| `.mm/skills/remember`, `.mm/skills/forget` | les mêmes que dans `memory-skills` : une seule liste de faits, `edit_file` seulement (jamais `write_file` sur un fichier qui existe), une seconde lecture pour vérifier qu'aucun fait n'a été perdu, lignes toujours en anglais, jamais sans demande — règles trouvées ici (passages B, C, E) puis données aussi à `memory-skills` | | |
| 20 | +| `.mm/skills/recall` | aucun outil : « ta mémoire est déjà dans ton prompt — réponds à partir d'elle, dans la langue qu'elle indique » | | |
| 21 | +| `.mm/memory.md` | la mémoire, créée par le premier `remember` — pas dans le dépôt | | |
| 22 | + | |
| 23 | +Le fichier est lu au début d'une conversation, jamais au milieu (le cache de prompt du serveur est préservé) : un fait enregistré pendant une conversation est déjà dans son historique, et dans le prompt dès la conversation suivante. Un fichier absent n'est pas une erreur. | |
| 24 | + | |
| 25 | +## Lancer la démo | |
| 26 | + | |
| 27 | +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`. | |
| 28 | + | |
| 29 | +```bash | |
| 30 | +cd demos/memory-skills-2 | |
| 31 | +../../mm # mode ligne | |
| 32 | +../../mm -tui # fenêtre | |
| 33 | +../../mm -p "Remember that I prefer answers in French, and that we tag our releases rel-YYYY.MM." | |
| 34 | +../../mm -p "What is the capital of Italy?" # réponse en français : la mémoire est dans le prompt | |
| 35 | +``` | |
| 36 | + | |
| 37 | +## Ce qui a été vérifié (26/11/2026, depuis un sandbox sbx, routeur llama-server sur le Mac) | |
| 38 | + | |
| 39 | +Les 8 mêmes questions que dans `memory-skills`, dans le même ordre, chacune un `-p` à part (une nouvelle conversation), Qwen3.5 4B à température 0 — quatre passages, un changement à la fois : | |
| 40 | + | |
| 41 | +| Passage | Ce qui a changé | Ce qui n'allait pas | | |
| 42 | +|---------|-----------------|---------------------| | |
| 43 | +| A | aucune skill `recall`, la mémoire dans le prompt | la question du tag (posée en anglais) a reçu une réponse en anglais ; `remember` lue sur deux simples questions ; le fait CI sous `## user`, en français | | |
| 44 | +| B | `remember` : lignes toujours en anglais, « notre CI / on utilise » → `## project` | ligne CI juste ; réponse du tag en français — mais `remember`, lue sur la question du tag, **a écrit une ligne que personne n'a demandée** | | |
| 45 | +| C | `remember` seulement sur demande explicite, une étape 0 qui s'arrête sinon | plus d'écriture non demandée — mais la réponse du tag de nouveau en anglais, et « que sais-tu de moi ? » a répondu « rien » (l'étape 0 disait de ne pas lire la mémoire) | | |
| 46 | +| **D** | une skill `recall` **sans aucun outil** : « la mémoire est déjà dans ton prompt, réponds à partir d'elle, dans la langue qu'elle indique » | **rien : 8/8** | | |
| 47 | + | |
| 48 | +Passage D, les fichiers tels qu'ils sont maintenant : | |
| 49 | + | |
| 50 | +| Question | Skill, outils | Résultat | | |
| 51 | +|----------|---------------|----------| | |
| 52 | +| Remember I prefer French, and tags rel-YYYY.MM | `remember`, `read_file`, `write_file` | les deux faits, bonnes sections ; réponse en français | | |
| 53 | +| How should I name the tag for the November 2026 release? | `recall`, aucun outil | **rel-2026.11, en français** | | |
| 54 | +| What do you know about me? | `recall`, aucun outil | la préférence pour le français, « d'après ma mémoire » | | |
| 55 | +| Souviens-toi que notre CI tourne sur Forgejo. | `remember`, `edit_file` | `- CI runs on Forgejo.` sous `## project`, en anglais | | |
| 56 | +| Actually, we moved the CI to GitHub Actions. Remember that. | `remember`, `edit_file` | la ligne remplacée ; confirmation en français | | |
| 57 | +| Remember my API token: sk-test-… | `remember`, aucune écriture | refusé, en français, le jeton non répété | | |
| 58 | +| Oublie ce que tu sais sur la CI. | `forget`, `edit_file` | la ligne retirée | | |
| 59 | +| What is the capital of Italy? | aucune | **Rome, en français** | | |
| 60 | + | |
| 61 | +Comparé à `memory-skills` — les mêmes `remember` et `forget`, seulement un `recall` qui lit le fichier au lieu de la mémoire dans le prompt : là-bas, 4 des 7 réponses qui suivent l'enregistrement de la préférence sont venues en français ; ici 7 sur 7 — la préférence est dans le prompt même quand aucune skill n'est appelée (Rome). | |
| 62 | + | |
| 63 | +**Ce que ces passages montrent de Qwen3.5 4B :** l'outil `read_skill` demande au modèle de charger une skill AVANT toute tâche ; une question sans skill qui lui corresponde reçoit donc la plus proche — `remember`, quand rien d'autre ne parle de mémoire. Une skill inoffensive pour les questions (`recall`, sans outil) donne un endroit où aller à ce réflexe. Un passage par configuration : une indication, pas une mesure de la variance. | |
| 64 | + | |
| 65 | +La fenêtre et Zed n'ont pas été essayés en vrai. | |
| 66 | + | |
| 67 | +## Ensuite : une seule liste, aucun fait perdu, et ce que coûte la mémoire (27/11/2026) | |
| 68 | + | |
| 69 | +**Passage E — une seule liste au lieu de `## user` / `## project`.** Les sections ajoutaient une décision à chaque `remember` (le passage A a rangé la CI sous `## user`) et n'apportaient rien : le fichier est de toute façon propre au projet. Un passage de l'utilisateur a aussi montré une écriture qui **a vidé la section user** en enregistrant un fait du projet. `remember` et `forget` désormais : une seule liste, le plus récent en tête ; `edit_file` seulement — jamais `write_file` sur un fichier qui existe ; `old` = le titre et sa ligne vide, rien d'autre ; puis `read_file` à nouveau, et remettre toute ligne disparue. Dix questions (les huit, plus « Remember that my name is Sam. » et un second « What do you know about me? »), le fichier affiché après chaque écriture : **aucun fait perdu en 6 écritures** ; la dernière question a reçu « tu t'appelles Sam, tu préfères le français, tags rel-YYYY.MM ». Une confirmation (« I've saved that you're Sam. ») est venue en anglais. | |
| 70 | + | |
| 71 | +**Ce que coûte la mémoire dans le contexte** (`prompt_tokens` de llama-server, `AGENT_TRACE`, une mémoire de 4 lignes) : | |
| 72 | + | |
| 73 | +| Question | `memory-skills` (recall lit le fichier) | `memory-skills-2` (mémoire dans le prompt) | | |
| 74 | +|----------|------------------------------------------|---------------------------------------------| | |
| 75 | +| What is the capital of Italy? (1 appel) | 1749 | 1839 (+90) | | |
| 76 | +| Tag de novembre 2026 ? (dernier appel) | 2073 (3 appels) | 2088 (2 appels) | | |
| 77 | + | |
| 78 | +La mémoire dans le prompt coûte environ **90 tokens pour 4 faits** (~10 par ligne, plus le titre de mm), à chaque appel — mais c'est le début du prompt, que llama-server garde dans son cache. `recall` coûte à peu près autant **à chaque appel de la skill**, et cette lecture reste dans l'historique. Ce qui remplit le contexte, c'est le reste : ~1750 tokens de prompt système et de définitions d'outils avant le premier mot, pour une **fenêtre de 4096 tokens** (le `ctx: 4096 (/props)` de la bannière — le preset de llama-server, pas le modèle, qui accepte bien plus). Augmentez `ctx-size` dans le preset du serveur, ou baissez `agentsMd.maxChars` (4000 caractères ≈ 1100 tokens au plus). | |
| new file mode 100644 | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | +# Démo memory-skills-2 — la mémoire toujours dans le prompt (`agentsMd.path`) | ||
| 2 | + | ||
| 3 | +La variante de [`demos/memory-skills`](../memory-skills/README.fr.md). Même agent, Jay, même fichier mémoire `.mm/memory.md`, mêmes skills `remember` et `forget`. Une différence : **`recall` ne lit aucun fichier**. mm met lui-même la mémoire dans le prompt système, au début de chaque conversation, avec le mécanisme qu'il utilise pour `AGENTS.md` — pointé sur le fichier mémoire : | ||
| 4 | + | ||
| 5 | +```yaml | ||
| 6 | +agentsMd: | ||
| 7 | + enabled: true | ||
| 8 | + path: .mm/memory.md | ||
| 9 | + maxChars: 4000 # au-delà, le fichier n'est pas lu du tout et la bannière le dit | ||
| 10 | +``` | ||
| 11 | + | ||
| 12 | +Pas de code mm non plus. Ce que ça coûte : cet agent ne lit plus le `AGENTS.md` du projet (`agentsMd` n'a qu'un chemin). | ||
| 13 | + | ||
| 14 | +English version: [README.en.md](README.en.md). | ||
| 15 | + | ||
| 16 | +| Fichier | Ce que c'est | | ||
| 17 | +|---------|--------------| | ||
| 18 | +| `.mm/agent.yaml` | Jay : `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (raisonnement coupé, température 0), `agentsMd.path: .mm/memory.md`, `read_file` / `write_file` / `edit_file`, pas de `bash` | | ||
| 19 | +| `.mm/skills/remember`, `.mm/skills/forget` | les mêmes que dans `memory-skills` : une seule liste de faits, `edit_file` seulement (jamais `write_file` sur un fichier qui existe), une seconde lecture pour vérifier qu'aucun fait n'a été perdu, lignes toujours en anglais, jamais sans demande — règles trouvées ici (passages B, C, E) puis données aussi à `memory-skills` | | ||
| 20 | +| `.mm/skills/recall` | aucun outil : « ta mémoire est déjà dans ton prompt — réponds à partir d'elle, dans la langue qu'elle indique » | | ||
| 21 | +| `.mm/memory.md` | la mémoire, créée par le premier `remember` — pas dans le dépôt | | ||
| 22 | + | ||
| 23 | +Le fichier est lu au début d'une conversation, jamais au milieu (le cache de prompt du serveur est préservé) : un fait enregistré pendant une conversation est déjà dans son historique, et dans le prompt dès la conversation suivante. Un fichier absent n'est pas une erreur. | ||
| 24 | + | ||
| 25 | +## Lancer la démo | ||
| 26 | + | ||
| 27 | +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`. | ||
| 28 | + | ||
| 29 | +```bash | ||
| 30 | +cd demos/memory-skills-2 | ||
| 31 | +../../mm # mode ligne | ||
| 32 | +../../mm -tui # fenêtre | ||
| 33 | +../../mm -p "Remember that I prefer answers in French, and that we tag our releases rel-YYYY.MM." | ||
| 34 | +../../mm -p "What is the capital of Italy?" # réponse en français : la mémoire est dans le prompt | ||
| 35 | +``` | ||
| 36 | + | ||
| 37 | +## Ce qui a été vérifié (26/11/2026, depuis un sandbox sbx, routeur llama-server sur le Mac) | ||
| 38 | + | ||
| 39 | +Les 8 mêmes questions que dans `memory-skills`, dans le même ordre, chacune un `-p` à part (une nouvelle conversation), Qwen3.5 4B à température 0 — quatre passages, un changement à la fois : | ||
| 40 | + | ||
| 41 | +| Passage | Ce qui a changé | Ce qui n'allait pas | | ||
| 42 | +|---------|-----------------|---------------------| | ||
| 43 | +| A | aucune skill `recall`, la mémoire dans le prompt | la question du tag (posée en anglais) a reçu une réponse en anglais ; `remember` lue sur deux simples questions ; le fait CI sous `## user`, en français | | ||
| 44 | +| B | `remember` : lignes toujours en anglais, « notre CI / on utilise » → `## project` | ligne CI juste ; réponse du tag en français — mais `remember`, lue sur la question du tag, **a écrit une ligne que personne n'a demandée** | | ||
| 45 | +| C | `remember` seulement sur demande explicite, une étape 0 qui s'arrête sinon | plus d'écriture non demandée — mais la réponse du tag de nouveau en anglais, et « que sais-tu de moi ? » a répondu « rien » (l'étape 0 disait de ne pas lire la mémoire) | | ||
| 46 | +| **D** | une skill `recall` **sans aucun outil** : « la mémoire est déjà dans ton prompt, réponds à partir d'elle, dans la langue qu'elle indique » | **rien : 8/8** | | ||
| 47 | + | ||
| 48 | +Passage D, les fichiers tels qu'ils sont maintenant : | ||
| 49 | + | ||
| 50 | +| Question | Skill, outils | Résultat | | ||
| 51 | +|----------|---------------|----------| | ||
| 52 | +| Remember I prefer French, and tags rel-YYYY.MM | `remember`, `read_file`, `write_file` | les deux faits, bonnes sections ; réponse en français | | ||
| 53 | +| How should I name the tag for the November 2026 release? | `recall`, aucun outil | **rel-2026.11, en français** | | ||
| 54 | +| What do you know about me? | `recall`, aucun outil | la préférence pour le français, « d'après ma mémoire » | | ||
| 55 | +| Souviens-toi que notre CI tourne sur Forgejo. | `remember`, `edit_file` | `- CI runs on Forgejo.` sous `## project`, en anglais | | ||
| 56 | +| Actually, we moved the CI to GitHub Actions. Remember that. | `remember`, `edit_file` | la ligne remplacée ; confirmation en français | | ||
| 57 | +| Remember my API token: sk-test-… | `remember`, aucune écriture | refusé, en français, le jeton non répété | | ||
| 58 | +| Oublie ce que tu sais sur la CI. | `forget`, `edit_file` | la ligne retirée | | ||
| 59 | +| What is the capital of Italy? | aucune | **Rome, en français** | | ||
| 60 | + | ||
| 61 | +Comparé à `memory-skills` — les mêmes `remember` et `forget`, seulement un `recall` qui lit le fichier au lieu de la mémoire dans le prompt : là-bas, 4 des 7 réponses qui suivent l'enregistrement de la préférence sont venues en français ; ici 7 sur 7 — la préférence est dans le prompt même quand aucune skill n'est appelée (Rome). | ||
| 62 | + | ||
| 63 | +**Ce que ces passages montrent de Qwen3.5 4B :** l'outil `read_skill` demande au modèle de charger une skill AVANT toute tâche ; une question sans skill qui lui corresponde reçoit donc la plus proche — `remember`, quand rien d'autre ne parle de mémoire. Une skill inoffensive pour les questions (`recall`, sans outil) donne un endroit où aller à ce réflexe. Un passage par configuration : une indication, pas une mesure de la variance. | ||
| 64 | + | ||
| 65 | +La fenêtre et Zed n'ont pas été essayés en vrai. | ||
| 66 | + | ||
| 67 | +## Ensuite : une seule liste, aucun fait perdu, et ce que coûte la mémoire (27/11/2026) | ||
| 68 | + | ||
| 69 | +**Passage E — une seule liste au lieu de `## user` / `## project`.** Les sections ajoutaient une décision à chaque `remember` (le passage A a rangé la CI sous `## user`) et n'apportaient rien : le fichier est de toute façon propre au projet. Un passage de l'utilisateur a aussi montré une écriture qui **a vidé la section user** en enregistrant un fait du projet. `remember` et `forget` désormais : une seule liste, le plus récent en tête ; `edit_file` seulement — jamais `write_file` sur un fichier qui existe ; `old` = le titre et sa ligne vide, rien d'autre ; puis `read_file` à nouveau, et remettre toute ligne disparue. Dix questions (les huit, plus « Remember that my name is Sam. » et un second « What do you know about me? »), le fichier affiché après chaque écriture : **aucun fait perdu en 6 écritures** ; la dernière question a reçu « tu t'appelles Sam, tu préfères le français, tags rel-YYYY.MM ». Une confirmation (« I've saved that you're Sam. ») est venue en anglais. | ||
| 70 | + | ||
| 71 | +**Ce que coûte la mémoire dans le contexte** (`prompt_tokens` de llama-server, `AGENT_TRACE`, une mémoire de 4 lignes) : | ||
| 72 | + | ||
| 73 | +| Question | `memory-skills` (recall lit le fichier) | `memory-skills-2` (mémoire dans le prompt) | | ||
| 74 | +|----------|------------------------------------------|---------------------------------------------| | ||
| 75 | +| What is the capital of Italy? (1 appel) | 1749 | 1839 (+90) | | ||
| 76 | +| Tag de novembre 2026 ? (dernier appel) | 2073 (3 appels) | 2088 (2 appels) | | ||
| 77 | + | ||
| 78 | +La mémoire dans le prompt coûte environ **90 tokens pour 4 faits** (~10 par ligne, plus le titre de mm), à chaque appel — mais c'est le début du prompt, que llama-server garde dans son cache. `recall` coûte à peu près autant **à chaque appel de la skill**, et cette lecture reste dans l'historique. Ce qui remplit le contexte, c'est le reste : ~1750 tokens de prompt système et de définitions d'outils avant le premier mot, pour une **fenêtre de 4096 tokens** (le `ctx: 4096 (/props)` de la bannière — le preset de llama-server, pas le modèle, qui accepte bien plus). Augmentez `ctx-size` dans le preset du serveur, ou baissez `agentsMd.maxChars` (4000 caractères ≈ 1100 tokens au plus). | ||
added
demos/memory-skills/.gitignore +4 -0 | new file mode 100644 | ||
| @@ -0,0 +1,4 @@ | ||
| 1 | +!.mm | |
| 2 | +.mm/sessions | |
| 3 | +.mm/traces | |
| 4 | +.mm/memory.md | |
| new file mode 100644 | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | +!.mm | ||
| 2 | +.mm/sessions | ||
| 3 | +.mm/traces | ||
| 4 | +.mm/memory.md | ||
added
demos/memory-skills/.mm/agent.yaml +77 -0 | new file mode 100644 | ||
| @@ -0,0 +1,77 @@ | ||
| 1 | +# Jay — a memory made of three small skills (ticket 74, "mini-skills first"). | |
| 2 | +# Named after the jay, which hides thousands of acorns and finds them again. | |
| 3 | +# | |
| 4 | +# The memory is one file, .mm/memory.md, in the folder mm runs in. Jay | |
| 5 | +# changes it only through its skills: | |
| 6 | +# remember add one fact (or replace the one it contradicts) | |
| 7 | +# recall read the file before answering about you or the project | |
| 8 | +# forget remove the fact you name | |
| 9 | +# No mm code: read_file / write_file / edit_file do the work. | |
| 10 | +# | |
| 11 | +# This file and the skills live in .mm/, beside the memory: mm finds | |
| 12 | +# .mm/agent.yaml by itself when started in demos/memory-skills. | |
| 13 | +# | |
| 14 | +# cd demos/memory-skills | |
| 15 | +# ../../mm line mode | |
| 16 | +# ../../mm -tui window | |
| 17 | +# ../../mm -p "…" one question, a new conversation each time | |
| 18 | +# | |
| 19 | +# See ../README.en.md. | |
| 20 | + | |
| 21 | +provider: llamacpp | |
| 22 | +# Qwen3.5 4B, thinking off. No baseUrl: llamacpp's defaults apply — | |
| 23 | +# 127.0.0.1:9931 (the Llama app), then 8080, then host.docker.internal:9931. | |
| 24 | +model: "unsloth/Qwen3.5-4B-GGUF:Q4_K_M" | |
| 25 | + | |
| 26 | +# relative to the folder mm runs in (demos/memory-skills) | |
| 27 | +skillsDir: .mm/skills | |
| 28 | +# read_file, write_file, edit_file: the skills need them. No bash. | |
| 29 | +editTools: true | |
| 30 | +bashTool: false | |
| 31 | +planTool: false | |
| 32 | +fetchContentTool: false | |
| 33 | +askUserTool: false | |
| 34 | +agentsMd: | |
| 35 | + enabled: false | |
| 36 | +# yolo: true so that -p can write the memory. Set it to false and mm asks | |
| 37 | +# before every write_file / edit_file of the memory (not in -p: rejected). | |
| 38 | +yolo: true | |
| 39 | +# The model is shared with your other agents: leave it loaded. | |
| 40 | +unloadOnExit: false | |
| 41 | +unloadModels: false | |
| 42 | +maxTurns: 8 | |
| 43 | +firstTokenTimeout: 3m | |
| 44 | + | |
| 45 | +sessions: | |
| 46 | + enabled: true | |
| 47 | + dir: .mm/sessions | |
| 48 | + | |
| 49 | +sampling: | |
| 50 | + # family qwen, precise: the skills are procedures to follow exactly | |
| 51 | + temperature: 0.0 | |
| 52 | + max_tokens: 2048 | |
| 53 | + parallel_tool_calls: false | |
| 54 | + chat_template_kwargs: | |
| 55 | + enable_thinking: false | |
| 56 | + | |
| 57 | +acp: | |
| 58 | + name: jay | |
| 59 | + title: "Jay (memory skills)" | |
| 60 | + | |
| 61 | +system: | | |
| 62 | + Your name is Jay, a helpful assistant. You keep a memory of the user and | |
| 63 | + of the project in the file .mm/memory.md, and you change or read it ONLY | |
| 64 | + by following one of your skills — call read_skill first, then do exactly | |
| 65 | + what the skill says: | |
| 66 | + - the user's message EXPLICITLY asks you to remember or note something | |
| 67 | + ("remember", "note that", "souviens-toi", "retiens") → skill remember. | |
| 68 | + Never on your own initiative: a question is not a request to remember; | |
| 69 | + - the user asks you to forget something → skill forget; | |
| 70 | + - the question is about the user (their name, their preferences, how | |
| 71 | + they want you to answer) or about this project's conventions (names, | |
| 72 | + tags, tools, rules), or the user asks what you know → skill recall, | |
| 73 | + BEFORE you answer. Never answer such a question from your own guess. | |
| 74 | + For anything else, answer directly. | |
| 75 | + Never put a password, a key or a token in the memory. | |
| 76 | + Answer in a few lines, in the language of the user's message — unless | |
| 77 | + the memory says how the user wants to be answered. | |
| new file mode 100644 | |||
| @@ -0,0 +1,77 @@ | |||
| 1 | +# Jay — a memory made of three small skills (ticket 74, "mini-skills first"). | ||
| 2 | +# Named after the jay, which hides thousands of acorns and finds them again. | ||
| 3 | +# | ||
| 4 | +# The memory is one file, .mm/memory.md, in the folder mm runs in. Jay | ||
| 5 | +# changes it only through its skills: | ||
| 6 | +# remember add one fact (or replace the one it contradicts) | ||
| 7 | +# recall read the file before answering about you or the project | ||
| 8 | +# forget remove the fact you name | ||
| 9 | +# No mm code: read_file / write_file / edit_file do the work. | ||
| 10 | +# | ||
| 11 | +# This file and the skills live in .mm/, beside the memory: mm finds | ||
| 12 | +# .mm/agent.yaml by itself when started in demos/memory-skills. | ||
| 13 | +# | ||
| 14 | +# cd demos/memory-skills | ||
| 15 | +# ../../mm line mode | ||
| 16 | +# ../../mm -tui window | ||
| 17 | +# ../../mm -p "…" one question, a new conversation each time | ||
| 18 | +# | ||
| 19 | +# See ../README.en.md. | ||
| 20 | + | ||
| 21 | +provider: llamacpp | ||
| 22 | +# Qwen3.5 4B, thinking off. No baseUrl: llamacpp's defaults apply — | ||
| 23 | +# 127.0.0.1:9931 (the Llama app), then 8080, then host.docker.internal:9931. | ||
| 24 | +model: "unsloth/Qwen3.5-4B-GGUF:Q4_K_M" | ||
| 25 | + | ||
| 26 | +# relative to the folder mm runs in (demos/memory-skills) | ||
| 27 | +skillsDir: .mm/skills | ||
| 28 | +# read_file, write_file, edit_file: the skills need them. No bash. | ||
| 29 | +editTools: true | ||
| 30 | +bashTool: false | ||
| 31 | +planTool: false | ||
| 32 | +fetchContentTool: false | ||
| 33 | +askUserTool: false | ||
| 34 | +agentsMd: | ||
| 35 | + enabled: false | ||
| 36 | +# yolo: true so that -p can write the memory. Set it to false and mm asks | ||
| 37 | +# before every write_file / edit_file of the memory (not in -p: rejected). | ||
| 38 | +yolo: true | ||
| 39 | +# The model is shared with your other agents: leave it loaded. | ||
| 40 | +unloadOnExit: false | ||
| 41 | +unloadModels: false | ||
| 42 | +maxTurns: 8 | ||
| 43 | +firstTokenTimeout: 3m | ||
| 44 | + | ||
| 45 | +sessions: | ||
| 46 | + enabled: true | ||
| 47 | + dir: .mm/sessions | ||
| 48 | + | ||
| 49 | +sampling: | ||
| 50 | + # family qwen, precise: the skills are procedures to follow exactly | ||
| 51 | + temperature: 0.0 | ||
| 52 | + max_tokens: 2048 | ||
| 53 | + parallel_tool_calls: false | ||
| 54 | + chat_template_kwargs: | ||
| 55 | + enable_thinking: false | ||
| 56 | + | ||
| 57 | +acp: | ||
| 58 | + name: jay | ||
| 59 | + title: "Jay (memory skills)" | ||
| 60 | + | ||
| 61 | +system: | | ||
| 62 | + Your name is Jay, a helpful assistant. You keep a memory of the user and | ||
| 63 | + of the project in the file .mm/memory.md, and you change or read it ONLY | ||
| 64 | + by following one of your skills — call read_skill first, then do exactly | ||
| 65 | + what the skill says: | ||
| 66 | + - the user's message EXPLICITLY asks you to remember or note something | ||
| 67 | + ("remember", "note that", "souviens-toi", "retiens") → skill remember. | ||
| 68 | + Never on your own initiative: a question is not a request to remember; | ||
| 69 | + - the user asks you to forget something → skill forget; | ||
| 70 | + - the question is about the user (their name, their preferences, how | ||
| 71 | + they want you to answer) or about this project's conventions (names, | ||
| 72 | + tags, tools, rules), or the user asks what you know → skill recall, | ||
| 73 | + BEFORE you answer. Never answer such a question from your own guess. | ||
| 74 | + For anything else, answer directly. | ||
| 75 | + Never put a password, a key or a token in the memory. | ||
| 76 | + Answer in a few lines, in the language of the user's message — unless | ||
| 77 | + the memory says how the user wants to be answered. | ||
added
demos/memory-skills/.mm/skills/forget/SKILL.md +15 -0 | new file mode 100644 | ||
| @@ -0,0 +1,15 @@ | ||
| 1 | +--- | |
| 2 | +name: forget | |
| 3 | +description: Remove a fact from the memory file when the user asks to forget it. | |
| 4 | +keywords: forget, remove from memory, no longer true, oublie, efface, supprime de ta mémoire | |
| 5 | +--- | |
| 6 | + | |
| 7 | +# Forget a fact | |
| 8 | + | |
| 9 | +## What to do | |
| 10 | + | |
| 11 | +1. Call `read_file` with the path `.mm/memory.md`. If it does not exist, say there is nothing to forget. | |
| 12 | +2. Find the line (or lines) the user means. If none matches, say so and stop. | |
| 13 | +3. Remove each line: `edit_file` with `old` = that line followed by its newline, exactly, and `new` = an empty string. Never call `write_file` on the memory: it would erase the other facts. | |
| 14 | +4. Call `read_file` again: only the lines you meant must be gone. If another one is missing, put it back with `edit_file`. | |
| 15 | +5. Answer in one sentence what you forgot. | |
| new file mode 100644 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | +--- | ||
| 2 | +name: forget | ||
| 3 | +description: Remove a fact from the memory file when the user asks to forget it. | ||
| 4 | +keywords: forget, remove from memory, no longer true, oublie, efface, supprime de ta mémoire | ||
| 5 | +--- | ||
| 6 | + | ||
| 7 | +# Forget a fact | ||
| 8 | + | ||
| 9 | +## What to do | ||
| 10 | + | ||
| 11 | +1. Call `read_file` with the path `.mm/memory.md`. If it does not exist, say there is nothing to forget. | ||
| 12 | +2. Find the line (or lines) the user means. If none matches, say so and stop. | ||
| 13 | +3. Remove each line: `edit_file` with `old` = that line followed by its newline, exactly, and `new` = an empty string. Never call `write_file` on the memory: it would erase the other facts. | ||
| 14 | +4. Call `read_file` again: only the lines you meant must be gone. If another one is missing, put it back with `edit_file`. | ||
| 15 | +5. Answer in one sentence what you forgot. | ||
added
demos/memory-skills/.mm/skills/recall/SKILL.md +14 -0 | new file mode 100644 | ||
| @@ -0,0 +1,14 @@ | ||
| 1 | +--- | |
| 2 | +name: recall | |
| 3 | +description: Read the memory file before answering a question about the user or the project's conventions. | |
| 4 | +keywords: what do you know, my preferences, how do I, convention, our rule, tu te souviens, que sais-tu, mes préférences | |
| 5 | +--- | |
| 6 | + | |
| 7 | +# Recall the memory | |
| 8 | + | |
| 9 | +## What to do | |
| 10 | + | |
| 11 | +1. Call `read_file` with the path `.mm/memory.md`. | |
| 12 | +2. If the file does not exist, or holds nothing about the question, say so plainly ("my memory says nothing about that") and then answer as best you can, saying it is not from the memory. | |
| 13 | +3. Otherwise answer from the lines of the memory, and say it comes from your memory. Apply what it says about the user (for example, the language they want). | |
| 14 | +4. Do not change the file: recall only reads. | |
| new file mode 100644 | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | +--- | ||
| 2 | +name: recall | ||
| 3 | +description: Read the memory file before answering a question about the user or the project's conventions. | ||
| 4 | +keywords: what do you know, my preferences, how do I, convention, our rule, tu te souviens, que sais-tu, mes préférences | ||
| 5 | +--- | ||
| 6 | + | ||
| 7 | +# Recall the memory | ||
| 8 | + | ||
| 9 | +## What to do | ||
| 10 | + | ||
| 11 | +1. Call `read_file` with the path `.mm/memory.md`. | ||
| 12 | +2. If the file does not exist, or holds nothing about the question, say so plainly ("my memory says nothing about that") and then answer as best you can, saying it is not from the memory. | ||
| 13 | +3. Otherwise answer from the lines of the memory, and say it comes from your memory. Apply what it says about the user (for example, the language they want). | ||
| 14 | +4. Do not change the file: recall only reads. | ||
added
demos/memory-skills/.mm/skills/remember/SKILL.md +31 -0 | new file mode 100644 | ||
| @@ -0,0 +1,31 @@ | ||
| 1 | +--- | |
| 2 | +name: remember | |
| 3 | +description: Save one fact about the user or the project in the memory file, for the next conversations. | |
| 4 | +keywords: remember, note that, keep in mind, from now on, souviens-toi, retiens, note que, rappelle-toi | |
| 5 | +--- | |
| 6 | + | |
| 7 | +# Remember a fact | |
| 8 | + | |
| 9 | +The memory file is a title and a list, one fact per line, newest first: | |
| 10 | + | |
| 11 | + # Memory | |
| 12 | + | |
| 13 | + - CI runs on GitHub Actions. | |
| 14 | + - Prefers answers in French. | |
| 15 | + | |
| 16 | +## What to do | |
| 17 | + | |
| 18 | +0. Only when the user's message asks you to remember or note something. If it is a question, or if it does not ask that, do not write anything: for a question about the user or the project, follow the recall skill instead. | |
| 19 | +1. Call `read_file` with the path `.mm/memory.md`. | |
| 20 | + - Only if the file does not exist: call `write_file` with the path `.mm/memory.md` and exactly this content (a title line, then an empty line), then go on with step 2: | |
| 21 | + | |
| 22 | + # Memory | |
| 23 | + | |
| 24 | + - If the file exists, NEVER call `write_file` on it: that would erase every other fact. Change it only with `edit_file`. | |
| 25 | +2. Write the fact as ONE short line, starting with `- `, in the third person: `- Prefers answers in French.`, `- Release tags are rel-YYYY.MM.` Several facts in one request: one line each. | |
| 26 | + The lines of the memory are ALWAYS in English — even when the user writes in another language, even when the memory says the user prefers another language. That preference is for your answers, never for the memory. "Notre CI tourne sur Forgejo" becomes `- CI runs on Forgejo.` | |
| 27 | +3. If a line of the file already says the same thing, do nothing for this fact. If a line says something the new fact CONTRADICTS (the user changed their mind), replace THAT line only: `edit_file` with `old` = the old line, exactly, and `new` = the new line. | |
| 28 | +4. Otherwise add the line at the top of the list: `edit_file` with `old` = `# Memory` followed by its empty line, and `new` = `# Memory`, the empty line, then your line. Nothing else in `old`: the other lines must not be touched. | |
| 29 | +5. Call `read_file` on `.mm/memory.md` again and compare with step 1: every line that was there must still be there (except a line you replaced in step 3). If one is missing, put it back with `edit_file`. | |
| 30 | +6. Never write a password, a key or a token: say you will not keep it, without repeating it. | |
| 31 | +7. Answer in one sentence what you saved (or replaced). | |
| new file mode 100644 | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | +--- | ||
| 2 | +name: remember | ||
| 3 | +description: Save one fact about the user or the project in the memory file, for the next conversations. | ||
| 4 | +keywords: remember, note that, keep in mind, from now on, souviens-toi, retiens, note que, rappelle-toi | ||
| 5 | +--- | ||
| 6 | + | ||
| 7 | +# Remember a fact | ||
| 8 | + | ||
| 9 | +The memory file is a title and a list, one fact per line, newest first: | ||
| 10 | + | ||
| 11 | + # Memory | ||
| 12 | + | ||
| 13 | + - CI runs on GitHub Actions. | ||
| 14 | + - Prefers answers in French. | ||
| 15 | + | ||
| 16 | +## What to do | ||
| 17 | + | ||
| 18 | +0. Only when the user's message asks you to remember or note something. If it is a question, or if it does not ask that, do not write anything: for a question about the user or the project, follow the recall skill instead. | ||
| 19 | +1. Call `read_file` with the path `.mm/memory.md`. | ||
| 20 | + - Only if the file does not exist: call `write_file` with the path `.mm/memory.md` and exactly this content (a title line, then an empty line), then go on with step 2: | ||
| 21 | + | ||
| 22 | + # Memory | ||
| 23 | + | ||
| 24 | + - If the file exists, NEVER call `write_file` on it: that would erase every other fact. Change it only with `edit_file`. | ||
| 25 | +2. Write the fact as ONE short line, starting with `- `, in the third person: `- Prefers answers in French.`, `- Release tags are rel-YYYY.MM.` Several facts in one request: one line each. | ||
| 26 | + The lines of the memory are ALWAYS in English — even when the user writes in another language, even when the memory says the user prefers another language. That preference is for your answers, never for the memory. "Notre CI tourne sur Forgejo" becomes `- CI runs on Forgejo.` | ||
| 27 | +3. If a line of the file already says the same thing, do nothing for this fact. If a line says something the new fact CONTRADICTS (the user changed their mind), replace THAT line only: `edit_file` with `old` = the old line, exactly, and `new` = the new line. | ||
| 28 | +4. Otherwise add the line at the top of the list: `edit_file` with `old` = `# Memory` followed by its empty line, and `new` = `# Memory`, the empty line, then your line. Nothing else in `old`: the other lines must not be touched. | ||
| 29 | +5. Call `read_file` on `.mm/memory.md` again and compare with step 1: every line that was there must still be there (except a line you replaced in step 3). If one is missing, put it back with `edit_file`. | ||
| 30 | +6. Never write a password, a key or a token: say you will not keep it, without repeating it. | ||
| 31 | +7. Answer in one sentence what you saved (or replaced). | ||
added
demos/memory-skills/README.en.md +74 -0 | new file mode 100644 | ||
| @@ -0,0 +1,74 @@ | ||
| 1 | +# memory-skills demo — a memory made of three small skills | |
| 2 | + | |
| 3 | +Jay remembers facts about you and about the project from one conversation to the next. There is no memory feature in mm for this: the memory is one Markdown file, `.mm/memory.md`, and Jay changes it only through three skills (ticket 74, "mini-skills first"). Its name is the jay's: the bird hides thousands of acorns in autumn and finds them again months later. | |
| 4 | + | |
| 5 | +| Skill | When | What it does | | |
| 6 | +|-------|------|--------------| | |
| 7 | +| `remember` | "remember…", "note that…", "souviens-toi…" | adds one short line to the list (`edit_file` only, never `write_file` on an existing file), then reads the file again to check no fact was lost; replaces the line a new fact contradicts; lines always in English; never writes unasked; refuses secrets | | |
| 8 | +| `recall` | a question about you, your preferences, the project's conventions, "what do you know?" | reads the file and answers from it, says when it holds nothing | | |
| 9 | +| `forget` | "forget…", "oublie…" | removes the line you name | | |
| 10 | + | |
| 11 | +Version française : [README.fr.md](README.fr.md). | |
| 12 | + | |
| 13 | +| File | What it is | | |
| 14 | +|------|------------| | |
| 15 | +| `.mm/agent.yaml` | Jay: `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (thinking off, temperature 0), `read_file` / `write_file` / `edit_file`, no `bash`, sessions on | | |
| 16 | +| `.mm/skills/remember`, `.mm/skills/recall`, `.mm/skills/forget` | the three skills (`SKILL.md`) | | |
| 17 | +| `.mm/memory.md` | the memory, created by the first `remember` — not in the repository | | |
| 18 | + | |
| 19 | +The memory file looks like this: | |
| 20 | + | |
| 21 | +```markdown | |
| 22 | +# Memory | |
| 23 | + | |
| 24 | +- Release tags are rel-YYYY.MM. | |
| 25 | +- Prefers answers in French. | |
| 26 | +``` | |
| 27 | + | |
| 28 | +It is a plain file: read it, correct it, or delete it to start over (`rm .mm/memory.md`). | |
| 29 | + | |
| 30 | +## Before you start | |
| 31 | + | |
| 32 | +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`. | |
| 33 | + | |
| 34 | +## Run it | |
| 35 | + | |
| 36 | +```bash | |
| 37 | +cd demos/memory-skills | |
| 38 | +../../mm # line mode | |
| 39 | +../../mm -tui # window | |
| 40 | +``` | |
| 41 | + | |
| 42 | +Each `-p` is a new conversation, which is the easiest way to see the memory survive: | |
| 43 | + | |
| 44 | +```bash | |
| 45 | +../../mm -p "Remember that I prefer answers in French, and that we tag our releases rel-YYYY.MM." | |
| 46 | +cat .mm/memory.md | |
| 47 | +../../mm -p "How should I name the tag for the November 2026 release?" | |
| 48 | +../../mm -p "What do you know about me?" | |
| 49 | +``` | |
| 50 | + | |
| 51 | +To be asked before each write of the memory, set `yolo: false` (then not with `-p`, where nobody can answer: the write is rejected). | |
| 52 | + | |
| 53 | +## What was checked (2026-11-26, from an sbx sandbox, llama-server router on the Mac) | |
| 54 | + | |
| 55 | +Two runs, same results: the first with the first `remember`, the second after `remember` got the rules found with `memory-skills-2` (lines in English, project section, never unasked) — so the two demos now share `remember` and `forget`, and differ only by how the memory reaches the model. Each line is a separate `-p`, so a new conversation, in this order (second run): | |
| 56 | + | |
| 57 | +| Question | Skill, tools | Result | | |
| 58 | +|----------|--------------|--------| | |
| 59 | +| Remember I prefer French, and tags rel-YYYY.MM | `remember`, `read_file` (missing), `write_file` | the file created with both facts in the right sections; answer in French | | |
| 60 | +| How should I name the tag for the November 2026 release? | `recall`, `read_file` | **rel-2026.11**, in French, "according to the project's conventions" | | |
| 61 | +| What do you know about me? | `recall`, `read_file` | "according to my memory, you prefer answers in French" | | |
| 62 | +| Souviens-toi que notre CI tourne sur Forgejo. | `remember`, `edit_file` | line added under `## project` | | |
| 63 | +| Actually, we moved the CI to GitHub Actions. Remember that. | `remember`, `edit_file` | the Forgejo line **replaced** (`- CI runs on GitHub Actions.`, under `## project`), not a second line; confirmation in English | | |
| 64 | +| Remember my API token: sk-test-… | `remember`, no write | refused, in English — the file unchanged | | |
| 65 | +| Oublie ce que tu sais sur la CI. | `forget`, `edit_file` | the CI line removed | | |
| 66 | +| What is the capital of Italy? | none | Rome, no skill — right | | |
| 67 | + | |
| 68 | +**The limit seen:** the memory is in the prompt only when Jay calls `recall`. When a question does not trigger it, what the memory says about you is not applied: the GitHub Actions confirmation, the refused token and the answer about Rome came in English, although the memory says "Prefers answers in French" — 4 of the 7 answers after the preference was saved came in French, in both runs. [`demos/memory-skills-2`](../memory-skills-2/README.en.md) fixes it with no mm code: the memory file read by `agentsMd.path`, always in the prompt, and a `recall` with no tool — 7 of 7 in French, 8/8 right behaviours. | |
| 69 | + | |
| 70 | +The window and Zed were not tried live. | |
| 71 | + | |
| 72 | +## Later: one list, no lost fact (2026-11-27) | |
| 73 | + | |
| 74 | +Same change as `memory-skills-2` (run E there): one list instead of `## user` / `## project`, `edit_file` only, a second read to check no fact was lost. Ten questions, the file shown after every write: **no fact lost in 6 writes**. As before, the French preference was applied only after a `recall` (the tag question): the confirmations, the token refusal and Rome came in English. The cost in tokens of `recall` against the memory in the prompt is measured in [`memory-skills-2`](../memory-skills-2/README.en.md#later-one-list-no-lost-fact-and-what-the-memory-costs-2026-11-27). | |
| new file mode 100644 | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | +# memory-skills demo — a memory made of three small skills | ||
| 2 | + | ||
| 3 | +Jay remembers facts about you and about the project from one conversation to the next. There is no memory feature in mm for this: the memory is one Markdown file, `.mm/memory.md`, and Jay changes it only through three skills (ticket 74, "mini-skills first"). Its name is the jay's: the bird hides thousands of acorns in autumn and finds them again months later. | ||
| 4 | + | ||
| 5 | +| Skill | When | What it does | | ||
| 6 | +|-------|------|--------------| | ||
| 7 | +| `remember` | "remember…", "note that…", "souviens-toi…" | adds one short line to the list (`edit_file` only, never `write_file` on an existing file), then reads the file again to check no fact was lost; replaces the line a new fact contradicts; lines always in English; never writes unasked; refuses secrets | | ||
| 8 | +| `recall` | a question about you, your preferences, the project's conventions, "what do you know?" | reads the file and answers from it, says when it holds nothing | | ||
| 9 | +| `forget` | "forget…", "oublie…" | removes the line you name | | ||
| 10 | + | ||
| 11 | +Version française : [README.fr.md](README.fr.md). | ||
| 12 | + | ||
| 13 | +| File | What it is | | ||
| 14 | +|------|------------| | ||
| 15 | +| `.mm/agent.yaml` | Jay: `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (thinking off, temperature 0), `read_file` / `write_file` / `edit_file`, no `bash`, sessions on | | ||
| 16 | +| `.mm/skills/remember`, `.mm/skills/recall`, `.mm/skills/forget` | the three skills (`SKILL.md`) | | ||
| 17 | +| `.mm/memory.md` | the memory, created by the first `remember` — not in the repository | | ||
| 18 | + | ||
| 19 | +The memory file looks like this: | ||
| 20 | + | ||
| 21 | +```markdown | ||
| 22 | +# Memory | ||
| 23 | + | ||
| 24 | +- Release tags are rel-YYYY.MM. | ||
| 25 | +- Prefers answers in French. | ||
| 26 | +``` | ||
| 27 | + | ||
| 28 | +It is a plain file: read it, correct it, or delete it to start over (`rm .mm/memory.md`). | ||
| 29 | + | ||
| 30 | +## Before you start | ||
| 31 | + | ||
| 32 | +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`. | ||
| 33 | + | ||
| 34 | +## Run it | ||
| 35 | + | ||
| 36 | +```bash | ||
| 37 | +cd demos/memory-skills | ||
| 38 | +../../mm # line mode | ||
| 39 | +../../mm -tui # window | ||
| 40 | +``` | ||
| 41 | + | ||
| 42 | +Each `-p` is a new conversation, which is the easiest way to see the memory survive: | ||
| 43 | + | ||
| 44 | +```bash | ||
| 45 | +../../mm -p "Remember that I prefer answers in French, and that we tag our releases rel-YYYY.MM." | ||
| 46 | +cat .mm/memory.md | ||
| 47 | +../../mm -p "How should I name the tag for the November 2026 release?" | ||
| 48 | +../../mm -p "What do you know about me?" | ||
| 49 | +``` | ||
| 50 | + | ||
| 51 | +To be asked before each write of the memory, set `yolo: false` (then not with `-p`, where nobody can answer: the write is rejected). | ||
| 52 | + | ||
| 53 | +## What was checked (2026-11-26, from an sbx sandbox, llama-server router on the Mac) | ||
| 54 | + | ||
| 55 | +Two runs, same results: the first with the first `remember`, the second after `remember` got the rules found with `memory-skills-2` (lines in English, project section, never unasked) — so the two demos now share `remember` and `forget`, and differ only by how the memory reaches the model. Each line is a separate `-p`, so a new conversation, in this order (second run): | ||
| 56 | + | ||
| 57 | +| Question | Skill, tools | Result | | ||
| 58 | +|----------|--------------|--------| | ||
| 59 | +| Remember I prefer French, and tags rel-YYYY.MM | `remember`, `read_file` (missing), `write_file` | the file created with both facts in the right sections; answer in French | | ||
| 60 | +| How should I name the tag for the November 2026 release? | `recall`, `read_file` | **rel-2026.11**, in French, "according to the project's conventions" | | ||
| 61 | +| What do you know about me? | `recall`, `read_file` | "according to my memory, you prefer answers in French" | | ||
| 62 | +| Souviens-toi que notre CI tourne sur Forgejo. | `remember`, `edit_file` | line added under `## project` | | ||
| 63 | +| Actually, we moved the CI to GitHub Actions. Remember that. | `remember`, `edit_file` | the Forgejo line **replaced** (`- CI runs on GitHub Actions.`, under `## project`), not a second line; confirmation in English | | ||
| 64 | +| Remember my API token: sk-test-… | `remember`, no write | refused, in English — the file unchanged | | ||
| 65 | +| Oublie ce que tu sais sur la CI. | `forget`, `edit_file` | the CI line removed | | ||
| 66 | +| What is the capital of Italy? | none | Rome, no skill — right | | ||
| 67 | + | ||
| 68 | +**The limit seen:** the memory is in the prompt only when Jay calls `recall`. When a question does not trigger it, what the memory says about you is not applied: the GitHub Actions confirmation, the refused token and the answer about Rome came in English, although the memory says "Prefers answers in French" — 4 of the 7 answers after the preference was saved came in French, in both runs. [`demos/memory-skills-2`](../memory-skills-2/README.en.md) fixes it with no mm code: the memory file read by `agentsMd.path`, always in the prompt, and a `recall` with no tool — 7 of 7 in French, 8/8 right behaviours. | ||
| 69 | + | ||
| 70 | +The window and Zed were not tried live. | ||
| 71 | + | ||
| 72 | +## Later: one list, no lost fact (2026-11-27) | ||
| 73 | + | ||
| 74 | +Same change as `memory-skills-2` (run E there): one list instead of `## user` / `## project`, `edit_file` only, a second read to check no fact was lost. Ten questions, the file shown after every write: **no fact lost in 6 writes**. As before, the French preference was applied only after a `recall` (the tag question): the confirmations, the token refusal and Rome came in English. The cost in tokens of `recall` against the memory in the prompt is measured in [`memory-skills-2`](../memory-skills-2/README.en.md#later-one-list-no-lost-fact-and-what-the-memory-costs-2026-11-27). | ||
added
demos/memory-skills/README.fr.md +74 -0 | new file mode 100644 | ||
| @@ -0,0 +1,74 @@ | ||
| 1 | +# Démo memory-skills — une mémoire faite de trois petites skills | |
| 2 | + | |
| 3 | +Jay retient des faits sur vous et sur le projet d'une conversation à l'autre. mm n'a pas de fonction mémoire pour cela : la mémoire est un fichier Markdown, `.mm/memory.md`, et Jay ne le modifie qu'au travers de trois skills (ticket 74, « des mini-skills d'abord »). Son nom est celui du geai (*jay*) : l'oiseau cache des milliers de glands à l'automne et les retrouve des mois plus tard. | |
| 4 | + | |
| 5 | +| Skill | Quand | Ce qu'elle fait | | |
| 6 | +|-------|-------|-----------------| | |
| 7 | +| `remember` | « remember… », « note que… », « souviens-toi… » | ajoute une ligne courte à la liste (`edit_file` seulement, jamais `write_file` sur un fichier qui existe), puis relit le fichier pour vérifier qu'aucun fait n'a été perdu ; remplace la ligne qu'un nouveau fait contredit ; lignes toujours en anglais ; n'écrit jamais sans demande ; refuse les secrets | | |
| 8 | +| `recall` | une question sur vous, vos préférences, les conventions du projet, « que sais-tu ? » | lit le fichier et répond à partir de lui, dit quand il ne contient rien | | |
| 9 | +| `forget` | « forget… », « oublie… » | retire la ligne que vous désignez | | |
| 10 | + | |
| 11 | +English version: [README.en.md](README.en.md). | |
| 12 | + | |
| 13 | +| Fichier | Ce que c'est | | |
| 14 | +|---------|--------------| | |
| 15 | +| `.mm/agent.yaml` | Jay : `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (raisonnement coupé, température 0), `read_file` / `write_file` / `edit_file`, pas de `bash`, sessions activées | | |
| 16 | +| `.mm/skills/remember`, `.mm/skills/recall`, `.mm/skills/forget` | les trois skills (`SKILL.md`) | | |
| 17 | +| `.mm/memory.md` | la mémoire, créée par le premier `remember` — pas dans le dépôt | | |
| 18 | + | |
| 19 | +Le fichier mémoire ressemble à ceci : | |
| 20 | + | |
| 21 | +```markdown | |
| 22 | +# Memory | |
| 23 | + | |
| 24 | +- Release tags are rel-YYYY.MM. | |
| 25 | +- Prefers answers in French. | |
| 26 | +``` | |
| 27 | + | |
| 28 | +C'est un simple fichier : lisez-le, corrigez-le, ou supprimez-le pour repartir de zéro (`rm .mm/memory.md`). | |
| 29 | + | |
| 30 | +## Avant de commencer | |
| 31 | + | |
| 32 | +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`. | |
| 33 | + | |
| 34 | +## Lancer la démo | |
| 35 | + | |
| 36 | +```bash | |
| 37 | +cd demos/memory-skills | |
| 38 | +../../mm # mode ligne | |
| 39 | +../../mm -tui # fenêtre | |
| 40 | +``` | |
| 41 | + | |
| 42 | +Chaque `-p` est une nouvelle conversation : c'est le moyen le plus simple de voir la mémoire survivre : | |
| 43 | + | |
| 44 | +```bash | |
| 45 | +../../mm -p "Remember that I prefer answers in French, and that we tag our releases rel-YYYY.MM." | |
| 46 | +cat .mm/memory.md | |
| 47 | +../../mm -p "How should I name the tag for the November 2026 release?" | |
| 48 | +../../mm -p "What do you know about me?" | |
| 49 | +``` | |
| 50 | + | |
| 51 | +Pour qu'on vous demande la permission avant chaque écriture de la mémoire, mettez `yolo: false` (alors pas avec `-p`, où personne ne peut répondre : l'écriture est refusée). | |
| 52 | + | |
| 53 | +## Ce qui a été vérifié (26/11/2026, depuis un sandbox sbx, routeur llama-server sur le Mac) | |
| 54 | + | |
| 55 | +Deux passages, mêmes résultats : le premier avec la première `remember`, le second après que `remember` a reçu les règles trouvées avec `memory-skills-2` (lignes en anglais, section projet, jamais sans demande) — les deux démos partagent donc `remember` et `forget`, et ne diffèrent que par la façon dont la mémoire arrive au modèle. Chaque ligne est un `-p` à part, donc une nouvelle conversation, dans cet ordre (second passage) : | |
| 56 | + | |
| 57 | +| Question | Skill, outils | Résultat | | |
| 58 | +|----------|---------------|----------| | |
| 59 | +| Remember I prefer French, and tags rel-YYYY.MM | `remember`, `read_file` (absent), `write_file` | le fichier créé avec les deux faits dans les bonnes sections ; réponse en français | | |
| 60 | +| How should I name the tag for the November 2026 release? | `recall`, `read_file` | **rel-2026.11**, en français, « selon les conventions du projet » | | |
| 61 | +| What do you know about me? | `recall`, `read_file` | « selon ma mémoire, vous préférez les réponses en français » | | |
| 62 | +| Souviens-toi que notre CI tourne sur Forgejo. | `remember`, `edit_file` | ligne ajoutée sous `## project` | | |
| 63 | +| Actually, we moved the CI to GitHub Actions. Remember that. | `remember`, `edit_file` | la ligne Forgejo **remplacée** (`- CI runs on GitHub Actions.`, sous `## project`), pas une deuxième ligne ; confirmation en anglais | | |
| 64 | +| Remember my API token: sk-test-… | `remember`, aucune écriture | refusé, en anglais — le fichier inchangé | | |
| 65 | +| Oublie ce que tu sais sur la CI. | `forget`, `edit_file` | la ligne CI retirée | | |
| 66 | +| What is the capital of Italy? | aucune | Rome, sans skill — juste | | |
| 67 | + | |
| 68 | +**La limite constatée :** la mémoire n'est dans le prompt que lorsque Jay appelle `recall`. Quand une question ne la déclenche pas, ce que la mémoire dit de vous n'est pas appliqué : la confirmation GitHub Actions, le refus du jeton et la réponse sur Rome sont venus en anglais, alors que la mémoire dit « Prefers answers in French » — 4 des 7 réponses qui suivent l'enregistrement de la préférence en français, dans les deux passages. [`demos/memory-skills-2`](../memory-skills-2/README.fr.md) le règle sans code mm : le fichier mémoire lu par `agentsMd.path`, toujours dans le prompt, et un `recall` sans outil — 7 sur 7 en français, 8/8 comportements justes. | |
| 69 | + | |
| 70 | +La fenêtre et Zed n'ont pas été essayés en vrai. | |
| 71 | + | |
| 72 | +## Ensuite : une seule liste, aucun fait perdu (27/11/2026) | |
| 73 | + | |
| 74 | +Même changement que `memory-skills-2` (son passage E) : une seule liste au lieu de `## user` / `## project`, `edit_file` seulement, une seconde lecture pour vérifier qu'aucun fait n'a été perdu. Dix questions, le fichier affiché après chaque écriture : **aucun fait perdu en 6 écritures**. Comme avant, la préférence pour le français n'a été appliquée qu'après un `recall` (la question du tag) : les confirmations, le refus du jeton et Rome sont venus en anglais. Le coût en tokens de `recall` comparé à la mémoire dans le prompt est mesuré dans [`memory-skills-2`](../memory-skills-2/README.fr.md). | |
| new file mode 100644 | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | +# Démo memory-skills — une mémoire faite de trois petites skills | ||
| 2 | + | ||
| 3 | +Jay retient des faits sur vous et sur le projet d'une conversation à l'autre. mm n'a pas de fonction mémoire pour cela : la mémoire est un fichier Markdown, `.mm/memory.md`, et Jay ne le modifie qu'au travers de trois skills (ticket 74, « des mini-skills d'abord »). Son nom est celui du geai (*jay*) : l'oiseau cache des milliers de glands à l'automne et les retrouve des mois plus tard. | ||
| 4 | + | ||
| 5 | +| Skill | Quand | Ce qu'elle fait | | ||
| 6 | +|-------|-------|-----------------| | ||
| 7 | +| `remember` | « remember… », « note que… », « souviens-toi… » | ajoute une ligne courte à la liste (`edit_file` seulement, jamais `write_file` sur un fichier qui existe), puis relit le fichier pour vérifier qu'aucun fait n'a été perdu ; remplace la ligne qu'un nouveau fait contredit ; lignes toujours en anglais ; n'écrit jamais sans demande ; refuse les secrets | | ||
| 8 | +| `recall` | une question sur vous, vos préférences, les conventions du projet, « que sais-tu ? » | lit le fichier et répond à partir de lui, dit quand il ne contient rien | | ||
| 9 | +| `forget` | « forget… », « oublie… » | retire la ligne que vous désignez | | ||
| 10 | + | ||
| 11 | +English version: [README.en.md](README.en.md). | ||
| 12 | + | ||
| 13 | +| Fichier | Ce que c'est | | ||
| 14 | +|---------|--------------| | ||
| 15 | +| `.mm/agent.yaml` | Jay : `provider: llamacpp`, `unsloth/Qwen3.5-4B-GGUF:Q4_K_M` (raisonnement coupé, température 0), `read_file` / `write_file` / `edit_file`, pas de `bash`, sessions activées | | ||
| 16 | +| `.mm/skills/remember`, `.mm/skills/recall`, `.mm/skills/forget` | les trois skills (`SKILL.md`) | | ||
| 17 | +| `.mm/memory.md` | la mémoire, créée par le premier `remember` — pas dans le dépôt | | ||
| 18 | + | ||
| 19 | +Le fichier mémoire ressemble à ceci : | ||
| 20 | + | ||
| 21 | +```markdown | ||
| 22 | +# Memory | ||
| 23 | + | ||
| 24 | +- Release tags are rel-YYYY.MM. | ||
| 25 | +- Prefers answers in French. | ||
| 26 | +``` | ||
| 27 | + | ||
| 28 | +C'est un simple fichier : lisez-le, corrigez-le, ou supprimez-le pour repartir de zéro (`rm .mm/memory.md`). | ||
| 29 | + | ||
| 30 | +## Avant de commencer | ||
| 31 | + | ||
| 32 | +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`. | ||
| 33 | + | ||
| 34 | +## Lancer la démo | ||
| 35 | + | ||
| 36 | +```bash | ||
| 37 | +cd demos/memory-skills | ||
| 38 | +../../mm # mode ligne | ||
| 39 | +../../mm -tui # fenêtre | ||
| 40 | +``` | ||
| 41 | + | ||
| 42 | +Chaque `-p` est une nouvelle conversation : c'est le moyen le plus simple de voir la mémoire survivre : | ||
| 43 | + | ||
| 44 | +```bash | ||
| 45 | +../../mm -p "Remember that I prefer answers in French, and that we tag our releases rel-YYYY.MM." | ||
| 46 | +cat .mm/memory.md | ||
| 47 | +../../mm -p "How should I name the tag for the November 2026 release?" | ||
| 48 | +../../mm -p "What do you know about me?" | ||
| 49 | +``` | ||
| 50 | + | ||
| 51 | +Pour qu'on vous demande la permission avant chaque écriture de la mémoire, mettez `yolo: false` (alors pas avec `-p`, où personne ne peut répondre : l'écriture est refusée). | ||
| 52 | + | ||
| 53 | +## Ce qui a été vérifié (26/11/2026, depuis un sandbox sbx, routeur llama-server sur le Mac) | ||
| 54 | + | ||
| 55 | +Deux passages, mêmes résultats : le premier avec la première `remember`, le second après que `remember` a reçu les règles trouvées avec `memory-skills-2` (lignes en anglais, section projet, jamais sans demande) — les deux démos partagent donc `remember` et `forget`, et ne diffèrent que par la façon dont la mémoire arrive au modèle. Chaque ligne est un `-p` à part, donc une nouvelle conversation, dans cet ordre (second passage) : | ||
| 56 | + | ||
| 57 | +| Question | Skill, outils | Résultat | | ||
| 58 | +|----------|---------------|----------| | ||
| 59 | +| Remember I prefer French, and tags rel-YYYY.MM | `remember`, `read_file` (absent), `write_file` | le fichier créé avec les deux faits dans les bonnes sections ; réponse en français | | ||
| 60 | +| How should I name the tag for the November 2026 release? | `recall`, `read_file` | **rel-2026.11**, en français, « selon les conventions du projet » | | ||
| 61 | +| What do you know about me? | `recall`, `read_file` | « selon ma mémoire, vous préférez les réponses en français » | | ||
| 62 | +| Souviens-toi que notre CI tourne sur Forgejo. | `remember`, `edit_file` | ligne ajoutée sous `## project` | | ||
| 63 | +| Actually, we moved the CI to GitHub Actions. Remember that. | `remember`, `edit_file` | la ligne Forgejo **remplacée** (`- CI runs on GitHub Actions.`, sous `## project`), pas une deuxième ligne ; confirmation en anglais | | ||
| 64 | +| Remember my API token: sk-test-… | `remember`, aucune écriture | refusé, en anglais — le fichier inchangé | | ||
| 65 | +| Oublie ce que tu sais sur la CI. | `forget`, `edit_file` | la ligne CI retirée | | ||
| 66 | +| What is the capital of Italy? | aucune | Rome, sans skill — juste | | ||
| 67 | + | ||
| 68 | +**La limite constatée :** la mémoire n'est dans le prompt que lorsque Jay appelle `recall`. Quand une question ne la déclenche pas, ce que la mémoire dit de vous n'est pas appliqué : la confirmation GitHub Actions, le refus du jeton et la réponse sur Rome sont venus en anglais, alors que la mémoire dit « Prefers answers in French » — 4 des 7 réponses qui suivent l'enregistrement de la préférence en français, dans les deux passages. [`demos/memory-skills-2`](../memory-skills-2/README.fr.md) le règle sans code mm : le fichier mémoire lu par `agentsMd.path`, toujours dans le prompt, et un `recall` sans outil — 7 sur 7 en français, 8/8 comportements justes. | ||
| 69 | + | ||
| 70 | +La fenêtre et Zed n'ont pas été essayés en vrai. | ||
| 71 | + | ||
| 72 | +## Ensuite : une seule liste, aucun fait perdu (27/11/2026) | ||
| 73 | + | ||
| 74 | +Même changement que `memory-skills-2` (son passage E) : une seule liste au lieu de `## user` / `## project`, `edit_file` seulement, une seconde lecture pour vérifier qu'aucun fait n'a été perdu. Dix questions, le fichier affiché après chaque écriture : **aucun fait perdu en 6 écritures**. Comme avant, la préférence pour le français n'a été appliquée qu'après un `recall` (la question du tag) : les confirmations, le refus du jeton et Rome sont venus en anglais. Le coût en tokens de `recall` comparé à la mémoire dans le prompt est mesuré dans [`memory-skills-2`](../memory-skills-2/README.fr.md). | ||