78 lines
3.4 KiB
Markdown
78 lines
3.4 KiB
Markdown
---
|
||
name: keep
|
||
description: >
|
||
Explicit immediate memory.
|
||
Use when user says "keep X", "zapamatuj si X", "ulož si X", "pamatuj si X", "/keep X".
|
||
Adds, deduplicates, and compacts entries in workspace/keep.md.
|
||
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: `- <terse fact>`.
|
||
**No dates.** Date adds noise, has no value for keep/discard decisions.
|
||
|
||
## 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: `<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 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.
|
||
- 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.
|