Files
nanobot-runtime/skills/keep/SKILL.md
2026-09-04 07:28:46 +02:00

99 lines
4.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: keep
description: >
Stores durable personal facts, preferences, and decisions about the user as
terse one-line entries in a persistent keep file. Use when the user wants
something remembered ("keep X", "remember X", "/keep X") or asks to compact
the store. Not for reference material, notes, or URLs to file and search
later (that is note), and not for facts scoped to one named project (that is
project).
---
# Keep
Explicit memory store. User says "keep X" → reformulate, write to
`workspace/keep.md`, dedup, compact when too long.
## File
`workspace/keep.md`. Flat bullet list. One entry = one line: `- <terse fact>`.
**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/<slug>/`).
- 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 515 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: `<fact> — because <terse why>`.
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:
<existing fact>. 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: <terse fact>`. Respond in the user's language (the model
localizes the confirmation itself).
## Compaction
Trigger: line count > 150, or the user asks for 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.