Keep Learning
Learn knowledge from local directories and store it in agent memory for future reference.
When to Use This Skill
Activate this skill when user says:
- - "持续学习知识"
- "keep learning"
- "learn knowledge base"
- "学习知识库"
Supported File Formats (v0.0.1)
| Format | Extensions | Support |
|---|
| Markdown | .md, .markdown | Full |
| Python |
.py | Full |
| JavaScript/TypeScript | .js, .ts, .jsx, .tsx | Full |
| Java | .java | Full |
| Go | .go | Full |
| Rust | .rs | Full |
| C/C++ | .c, .cpp, .h, .hpp | Full |
| Shell | .sh, .bash, .zsh | Full |
| YAML/JSON/TOML | .yaml, .yml, .json, .toml | Full |
| SQL | .sql | Full |
| Other text | .txt, .csv | Full |
Not supported in v0.0.1: PDF, Word, Excel, PowerPoint, Keynote, audio, video files.
Three-Layer Knowledge Architecture
| Layer | Storage | Content | Purpose |
|---|
| L1 Core Memory | Agent Memory | Key conclusions, core concepts, decisions | Auto-surface in daily conversations |
| L2 Knowledge Index |
Agent Memory | File paths, summaries, keyword mappings | Know where knowledge lives |
| L3 Source Files | Local filesystem | Complete original content | Deep-dive when needed via read_file |
How It Works:
- 1. Daily conversations: L1 memories automatically appear in memoryoverview
- Need more detail: Query L2 index to find relevant files
- Deep investigation: Use readfile to access L3 source files
Runtime Data Directory
All runtime data is stored in ~/.keep-learning/:
| File | Purpose |
|---|
| last-commit | Git commit hash of last learning session |
| config.json |
User configuration (knowledge base path, etc.) |
Learning Workflow
Step 1: Get Configuration
First, search memory (category: projectenvironmentconfiguration) for an existing knowledge base path.
- - If found: confirm the path with the user before proceeding. Example: "Found your knowledge base at
~/knowledge/work-assistant. Start learning from there?" - If NOT found: stop and ask the user to provide the knowledge base path before doing anything else. Do NOT proceed until the user provides a valid path. Example: "Please provide the path to your knowledge base directory (e.g., ~/knowledge/work-assistant)."
Once confirmed, store the path in memory using updatememory with category projectenvironment_configuration.
Step 2: Git Pull (If Applicable)
Check if knowledge base is a git repository and pull latest changes before learning.
Step 3: Scan Files
Scan for supported files. Exclude: .git, node_modules, .obsidian, pycache, .venv
Step 4: Detect Changes (Incremental Learning)
For git repositories, detect ALL types of changes:
- 1. Committed changes: Compare current HEAD with last-commit hash stored in
~/.keep-learning/last-commit using INLINECODE2 - Uncommitted changes: Detect modified/added files in working directory using INLINECODE3
Combine both results to get the full list of changed files. This ensures learning happens even when:
- - Remote has no updates, but local files were edited
- Local commits exist that haven't been pushed yet
- Files are modified but not yet committed
After learning completes, update ~/.keep-learning/last-commit with current HEAD hash.
For non-git directories: scan all supported files (no incremental detection).
Step 5: Read and Extract Knowledge
For each file: read content, identify theme/concepts/conclusions, extract key knowledge.
Step 6: Store L1 Core Memory
Create L1 memory entries using update_memory with appropriate category:
- - expertexperience: Domain expertise, best practices
- projectintroduction: Project/product overviews
- learnedskillexperience: Reusable methods, procedures
Title format: [Domain] Concise Topic Description
Step 7: Build L2 Knowledge Index
Create knowledge index with file path, theme, keywords mappings.
Step 8: Generate Learning Report
Output: Timestamp, Statistics, L1 Memories list, L2 Index summary, Notes.
Memory Deduplication
Before creating: search_memory first. If exists, update; if not, create.
Quick Reference
| Situation | Action |
|---|
| First time user | Ask for knowledge base path |
| Git repo detected |
Run git pull before scanning |
| Large file | Read in chunks, summarize each section |
| Duplicate knowledge | Update existing memory |
| Unsupported file | Skip and note in report |
Limitations (v0.0.1)
- - Only Markdown and code files supported
- No PDF/Word/Excel/PPT support
- Memory entries have size limits
技能名称: keep-learning
详细描述:
持续学习
从本地目录学习知识,并将其存储在智能体记忆中,供将来参考。
何时使用此技能
当用户说出以下内容时激活此技能:
- - 持续学习知识
- keep learning
- learn knowledge base
- 学习知识库
支持的文件格式 (v0.0.1)
| 格式 | 扩展名 | 支持程度 |
|---|
| Markdown | .md, .markdown | 完整 |
| Python |
.py | 完整 |
| JavaScript/TypeScript | .js, .ts, .jsx, .tsx | 完整 |
| Java | .java | 完整 |
| Go | .go | 完整 |
| Rust | .rs | 完整 |
| C/C++ | .c, .cpp, .h, .hpp | 完整 |
| Shell | .sh, .bash, .zsh | 完整 |
| YAML/JSON/TOML | .yaml, .yml, .json, .toml | 完整 |
| SQL | .sql | 完整 |
| 其他文本 | .txt, .csv | 完整 |
v0.0.1 不支持:PDF、Word、Excel、PowerPoint、Keynote、音频、视频文件。
三层知识架构
| 层级 | 存储位置 | 内容 | 用途 |
|---|
| L1 核心记忆 | 智能体记忆 | 关键结论、核心概念、决策 | 在日常对话中自动呈现 |
| L2 知识索引 |
智能体记忆 | 文件路径、摘要、关键词映射 | 了解知识所在位置 |
| L3 源文件 | 本地文件系统 | 完整的原始内容 | 需要时通过 read_file 深入查看 |
工作原理:
- 1. 日常对话:L1 记忆自动出现在 memoryoverview 中
- 需要更多细节:查询 L2 索引以找到相关文件
- 深入调查:使用 readfile 访问 L3 源文件
运行时数据目录
所有运行时数据存储在 ~/.keep-learning/ 中:
| 文件 | 用途 |
|---|
| last-commit | 上次学习会话的 Git 提交哈希值 |
| config.json |
用户配置(知识库路径等) |
学习工作流程
步骤 1:获取配置
首先,在记忆(类别:projectenvironmentconfiguration)中搜索现有的知识库路径。
- - 如果找到:在继续之前与用户确认路径。示例:找到您的知识库位于 ~/knowledge/work-assistant。从此处开始学习?
- 如果未找到:停止并询问用户提供知识库路径,然后再进行任何其他操作。在用户提供有效路径之前,不要继续。示例:请提供您的知识库目录路径(例如,~/knowledge/work-assistant)。
确认后,使用 updatememory 将路径存储在记忆中,类别为 projectenvironment_configuration。
步骤 2:Git 拉取(如果适用)
检查知识库是否为 Git 仓库,并在学习前拉取最新更改。
步骤 3:扫描文件
扫描支持的文件。排除:.git、node_modules、.obsidian、pycache、.venv
步骤 4:检测更改(增量学习)
对于 Git 仓库,检测所有类型的更改:
- 1. 已提交的更改:使用 git diff HEAD --name-only 将当前 HEAD 与存储在 ~/.keep-learning/last-commit 中的上次提交哈希值进行比较
- 未提交的更改:使用 git status --porcelain 检测工作目录中已修改/添加的文件
合并两个结果以获得完整的更改文件列表。这确保了即使在以下情况下也能进行学习:
- - 远程没有更新,但本地文件被编辑过
- 存在尚未推送的本地提交
- 文件已被修改但尚未提交
学习完成后,使用当前 HEAD 哈希值更新 ~/.keep-learning/last-commit。
对于非 Git 目录:扫描所有支持的文件(无增量检测)。
步骤 5:读取并提取知识
对于每个文件:读取内容,识别主题/概念/结论,提取关键知识。
步骤 6:存储 L1 核心记忆
使用 update_memory 创建 L1 记忆条目,使用适当的类别:
- - expertexperience:领域专业知识、最佳实践
- projectintroduction:项目/产品概述
- learnedskillexperience:可重复使用的方法、程序
标题格式:[领域] 简洁主题描述
步骤 7:构建 L2 知识索引
创建包含文件路径、主题、关键词映射的知识索引。
步骤 8:生成学习报告
输出:时间戳、统计信息、L1 记忆列表、L2 索引摘要、备注。
记忆去重
在创建之前:先进行 search_memory。如果存在,则更新;如果不存在,则创建。
快速参考
| 情况 | 操作 |
|---|
| 首次使用的用户 | 询问知识库路径 |
| 检测到 Git 仓库 |
在扫描前运行 git pull |
| 大文件 | 分块读取,总结每个部分 |
| 重复知识 | 更新现有记忆 |
| 不支持的文件 | 跳过并在报告中注明 |
局限性 (v0.0.1)
- - 仅支持 Markdown 和代码文件
- 不支持 PDF/Word/Excel/PPT
- 记忆条目有大小限制