content/skills/research-learning-knowledge/memory-system/SKILL.md
本地记忆系统,将 Markdown 文件索引到 SQLite 实现跨会话语义搜索。当用户提到:记忆、memory、知识库、索引笔记、搜索记忆、跨会话记忆、记住这个、memory search、memory index、memory status、回忆、查找记忆 时触发。支持增量索引、混合搜索(向量+全文)、记忆添加和清理;不适用于云同步或跨设备共享。
npx skillsauth add bahayonghang/my-claude-code-settings memory-systemInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
脚本路径:$SKILL_DIR/scripts/memory.py
这个 skill 负责三件事:把笔记存下来、把笔记建立索引、把相关记忆重新找回来。
如果首次运行报依赖缺失,提示用户手动安装 Python 依赖,不要在主流程里自动安装:
python -m pip install sentence-transformers numpy
all-MiniLM-L6-v2当用户说“搜索记忆”“在记忆中查找 X”或相近表达时:
python "$SKILL_DIR/scripts/memory.py" search "用户查询" \
--db ./memory/memory.sqlite --json --top 6
执行前检查:
index回答时不要只贴 JSON。要给用户:
当用户说“记住这个”“添加到记忆”时:
python "$SKILL_DIR/scripts/memory.py" add "内容" \
--file 合适的文件名.md --dir ./memory --db ./memory/memory.sqlite
执行后报告:
当用户说“索引记忆”“更新记忆索引”时:
python "$SKILL_DIR/scripts/memory.py" index \
--dir ./memory --db ./memory/memory.sqlite
如果还要索引额外文件:
python "$SKILL_DIR/scripts/memory.py" index \
--dir ./memory --db ./memory/memory.sqlite --memory-file ./MEMORY.md
当用户说“记忆状态”或 memory status:
python "$SKILL_DIR/scripts/memory.py" status \
--db ./memory/memory.sqlite -v
把技术输出翻译成用户看得懂的状态说明,例如:
当用户说“清理记忆”时:
python "$SKILL_DIR/scripts/memory.py" cleanup \
--days 90 --dir ./memory --force
在执行前先确认这是删除旧记忆,不是仅重建索引。
./memory/ 和 --db 路径都相对于当前项目工作目录./memory/ 目录,先创建再执行| 问题 | 解决方案 |
|------|----------|
| ModuleNotFoundError: sentence_transformers | 运行 python -m pip install sentence-transformers numpy |
| ModuleNotFoundError: numpy | 运行 python -m pip install numpy |
| 搜索无结果 | 先运行 index 建立索引,再缩短或改写查询 |
| FTS5 不可用 | 向量搜索仍可用,仅全文搜索降级 |
| 索引后数据库损坏 | 删除 .sqlite 后重新索引 |
development
Implement safe, behavior-preserving code refactors after inspecting the existing project. Use when the user asks to refactor code, split large files or modules, extract functions or methods, reduce duplicated logic, rename confusing classes/functions/variables, improve code comments, remove unused or dead code, or says 重构代码, 拆分模块, 提取方法, 减少重复代码, 优化命名, 优化注释, 删除未调用代码. For broad refactor requests, plan safe slices and wait for approval; for narrow scoped requests, directly implement the smallest verifiable slice.
development
Use only when the user explicitly asks for swarm, subagents, parallel agents, dynamic workflow, multi-agent orchestration, 多智能体编排, or when the task truly needs coordinated research plus implementation plus review plus verification packets. Do not use for ordinary code review, planning-only work, single-line bugfixes, routine audits, or migrations unless orchestration is requested or at least two independent workflow dimensions are present.
development
Run a code quality review focused on maintainability, structure, abstraction quality, file growth, branching complexity, boundary cleanliness, and refactoring opportunities. Use when the user asks for code quality review, code review, maintainability review, architecture quality review, PR code quality feedback, 代码质量审查, 代码质量 review, 可维护性审查, 架构质量审查, or review comments about code structure. Do not use for pure security review, formatting-only review, performance profiling, or implementation tasks unless the user also asks for a code quality review.
development
Plan-first brainstorming workflow that turns an idea into an approved Markdown implementation plan by default. Use when the user wants to brainstorm, design, scope, or plan a feature/spec before implementation. Spark explores project context, asks only blocking questions, writes the plan under the project root's .plannings/YYYY-MM-DD-feature-slug.md path, self-reviews it, and waits for user approval. Create an HTML or visual plan/spec only when the user explicitly asks for HTML, browser-viewable, or visual output; save the paired .html beside the Markdown plan.