Skip to content

skill: add /add-memory — semantic memory with RAG#727

Open
obekt wants to merge 1 commit intonanocoai:mainfrom
obekt:skill/add-memory
Open

skill: add /add-memory — semantic memory with RAG#727
obekt wants to merge 1 commit intonanocoai:mainfrom
obekt:skill/add-memory

Conversation

@obekt
Copy link
Copy Markdown

@obekt obekt commented Mar 5, 2026

Summary

Adds the /add-memory skill — a three-layer semantic memory system with RAG that gives container agents automatic recall of past conversations and stored facts.

This is a repackaging of PRs #560 and #561 as a standalone skill, following the feedback that the memory system is too complex for core but would work well as a skill.

What this skill does

  • Core Memories — discrete facts/preferences stored by the agent via IPC, auto-injected into prompts when semantically relevant
  • Conversation Memory — every message is embedded after each conversation; relevant past messages retrieved via RAG
  • Archival Memory — session summaries searchable via memory_search
  • Four IPC toolsmemory_add, memory_update, memory_remove, memory_search

Uses sqlite-vec for vector search within the existing SQLite database and local embeddings via @huggingface/transformers (all-MiniLM-L6-v2) — no external API costs.

Skill type

Code modification — adds src/memory.ts and modifies src/db.ts, src/index.ts, src/ipc.ts, src/task-scheduler.ts.

Files

File Purpose
SKILL.md Installation guide with 4 phases
manifest.yaml Skill metadata, deps, file lists
add/src/memory.ts Complete memory system (3 layers, embeddings, RAG)
modify/src/db.ts Load sqlite-vec extension, export getDb()
modify/src/index.ts Init schema, RAG retrieval, conversation embedding, memory snapshots
modify/src/ipc.ts Memory IPC handlers (add/update/remove/search)
modify/src/task-scheduler.ts Inject memory context into scheduled tasks
tests/add-memory.test.ts 10 tests validating skill package structure

Testing

  • Skill package tests pass (10/10)
  • All modified files preserve upstream patterns (isMain, syncGroups, sender-allowlist, channel registry)
  • Intent files document all changes and invariants
  • Built against upstream/main (v1.2.6)

Dependencies

Package Version
sqlite-vec ^0.1.7-alpha.2
@huggingface/transformers ^3.8.1

New environment variables

None

Supersedes


Generated with /create-skill

Vector-search memory system using sqlite-vec and local embeddings
(all-MiniLM-L6-v2). Three layers: core memories (facts/preferences),
conversation memory (embedded message chunks), and archival memory
(session summaries). Integrates via RAG into agent prompts and
scheduled tasks. Agent manages memories through IPC.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Andy-NanoClaw-AI Andy-NanoClaw-AI added PR: Skill Skill package or skill-related changes Status: Needs Review Ready for maintainer review labels Mar 5, 2026
klapom added a commit to klapom/nanoclaw that referenced this pull request Mar 5, 2026
…res)

Bug fixes applied:
- nanocoai#636: task-scheduler recalculates next_run before enqueue
- nanocoai#655: LIMIT 200 on message queries to prevent OOM
- nanocoai#670: rateLimitResetAt field in ContainerOutput interface
- nanocoai#694: ANTHROPIC_MODEL passthrough to container env
- nanocoai#700: session rotation at 5MB JSONL threshold
- nanocoai#701: session retry on corrupted resume (clear + retry)
- nanocoai#708: update_task MCP tool in ipc-mcp-stdio
- nanocoai#719: outputChain .catch() to prevent group hang
- nanocoai#729: fix send_message description (remove incorrect scheduled-task note)
- nanocoai#735: datePrefix() injects current date/time into all agent prompts
- nanocoai#738: ANTHROPIC_MODEL from .env passed to agent container
- nanocoai#746: systemd OnFailure restart prevention logic (container hardening)
- nanocoai#751: DM-with-bot JID normalization
- nanocoai#754: setOnPipeCallback to reset idle timer on piped messages
- nanocoai#756: cursorBeforePipe rollback on container crash

Features added:
- nanocoai#723: streaming infrastructure (STREAM_TEXT markers, onStreamDelta)
- nanocoai#742: container hardening (entrypoint.sh privilege drop, env sanitize)
- nanocoai#680: add-cli skill (CLI send binary)
- nanocoai#727: add-memory skill extracted to .claude/skills/add-memory/
- nanocoai#744: add-s3-storage skill extracted to .claude/skills/add-s3-storage/

Test fixes:
- Mock fs.promises in container-runner.test.ts to prevent real I/O
- Add ANTHROPIC_MODEL to config mock
- Fix cpSync expectation: { recursive: true, force: true }
- Fix isActive() to use state.active instead of state.process
- Fix container-runtime error message: Docker → Container runtime

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Skill Skill package or skill-related changes Status: Needs Review Ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants