--- name: keep description: > Explicit personal memory — durable facts, preferences, and decisions the user wants remembered. Use when user says "keep X", "zapamatuj si X", "ulož si X", "pamatuj si X", "/keep X". Adds, deduplicates, and compacts terse entries in workspace/keep.md. For durable personal facts / preferences / decisions — NOT collecting notes, links, or articles (that is note). Separate from MEMORY.md / Dream pipeline. --- # Keep Explicit memory store. User says "keep X" → reformulate, write to `/home/nanobot/.nanobot/workspace/keep.md`, dedup, compact when too long. ## File `workspace/keep.md`. Flat bullet list. One entry = one line: `- `. **No dates.** Date adds noise, has no value for keep/discard decisions. ## Triage — before writing anything `keep.md` is read on **every turn**, so only a durable fact / preference / decision **about the user** belongs here. Check the input against these first and redirect instead of writing: - A rule about how the agent should work (conventions, tooling, workflow) → **`AGENTS.md`**. Tell the user that is where it goes. - Something to try or read later, a link, an article, reference material → **`/note`**. - A fact that only matters inside one named project → **`/project`** (`projects//`). - A scheduled reminder → **`/remind`**. Only when it is genuinely a durable user fact, continue with the write protocol below. Mixed input (a fact plus a to-do) → split it and route each part. ## Write protocol 1. Extract the core fact. Drop filler ("you know", "important is that", "watch out for", "remember please"). 2. Rewrite as a 5–15 word terse fact. Telegraphic style. Dashes / parentheses for context. **Preserve the language of the input — never translate.** Czech input → Czech entry, English input → English entry. - Input: "you know, Honza from marketing is allergic to peanuts" - Entry: `Honza (marketing) — peanut allergy` - If the entry is a decision, preference, or dead-end (not a plain fact), append the reason inline on the same line: ` — because `. Plain facts (allergy, deploy window, name) get no reason. - If it is a decision/preference/dead-end but the input gives no reason, ask the user once for the why before storing. If they supply it → append it. If they decline or it is self-evident → store without it. 3. Read `workspace/keep.md` (create if missing). 4. Read `workspace/memory/MEMORY.md` and check if a semantically similar fact already exists there (Dream may have already distilled it). - If similar fact in MEMORY.md → tell the user (`"Already in MEMORY.md: . Keep anyway?"`) and act on their answer. Default: skip. 5. Check duplicates: case-insensitive substring match against existing lines. - If duplicate → ask user: replace, append as variant, or skip. 6. Append the new line. 7. If line count > 150 → run **compaction** (below) before responding. 8. Confirm: `Kept: `. Respond in the user's language (the model localizes the confirmation itself). ## Compaction Trigger: line count > 150, or user says "keep compact" / "udělej compaction". 1. Read full `keep.md`. 2. Rewrite under ~120 lines (headroom). Strategies: - Merge duplicates and near-duplicates. - Drop stale one-shot info (past meetings, transient states, expired notes). - Shorten verbose entries. 3. Write the new file in one go. 4. Report: `Compaction: 151 → 117 lines`. ## Edge cases - `/keep` with no content → ask "What should I remember?". - Vague input ("remember this", "that thing") → ask for the concrete fact; do not store a placeholder. - File missing → create it on first write. - Multi-line input → collapse newlines to spaces; one entry = one line. ## Rules - Never store the verbatim input. Always reformulate. - Never store an agent working rule, a link, or a to-try item — route those per **Triage** above. - Reason (why) only for decisions / preferences / dead-ends — never for plain facts. Always terse and inline on the same line; never a separate Why: block. - Preserve input language; never translate. - Do not store smalltalk or meta-commentary about memory itself. - Keep is separate from MEMORY.md and Dream. Read MEMORY.md only for the dedup check (step 4); never edit it or any Dream file from this skill. - Touch `keep.md` only via this skill. Other agent paths should read it (per USER.md reference) but not edit it.