← 返回 Skills 市场
Knowledge Sync
作者
alfredming-2026
· GitHub ↗
· v1.0.0
· MIT-0
249
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install knowledge-sync
功能描述
Real-time knowledge base synchronization for AI assistants. Supports inotifywait file monitoring, Git auto-push/pull, Nutstore sync, and multi-device consist...
使用说明 (SKILL.md)
Knowledge Sync - 知识库同步机制
核心原则: Text > Brain,文件 > 记忆,同步 > 备份
🚀 快速开始
systemd 服务配置
# 启用实时同步服务
systemctl --user enable sync-realtime.service
systemctl --user start sync-realtime.service
Crontab 配置
# 每 5 分钟 Git push
*/5 * * * * /path/to/git-auto-push.sh
# 每小时 Git pull
0 * * * * cd /path/to/workspace && git pull origin main --rebase
🔧 核心功能
1. 实时同步
- ✅ inotifywait 文件监听
- ✅ 3-10 秒同步延迟
- ✅ 6 个目录监听(articles/memory/projects/docs/scripts/learnings)
- ✅ 自动排除(node_modules/pycache/.git)
2. Git 备份
- ✅ 每 5 分钟自动 push
- ✅ 每小时自动 pull
- ✅ 冲突检测和解决
- ✅ Gitee 远程备份
3. 多端同步
- ✅ 服务器→坚果云→Mac Obsidian
- ✅ 双向同步支持
- ✅ 多端一致性保障
📁 包含文件
knowledge-sync/
├── SKILL.md # 主文档
├── README.md # 项目说明
├── scripts/
│ ├── sync-realtime.sh # 实时同步脚本
│ ├── git-auto-push.sh # Git 自动推送
│ └── git-auto-pull.sh # Git 自动拉取
└── docs/
├── QUICKSTART.md # 快速上手
└── sync-guide.md # 同步指南
📊 同步架构
服务器 Workspace → 坚果云实时监听 → 本地同步 → Gitee → Mac Obsidian
3-10 秒 实时 ≤5 分钟 ≤5 分钟
总延迟: 5-10 分钟(主要等待 Git 推送周期)
💡 使用场景
1. 实时文件同步
# 启动实时同步服务
systemctl --user start sync-realtime.service
# 查看状态
systemctl --user status sync-realtime.service
2. Git 自动备份
# 手动推送
./git-auto-push.sh
# 或定时执行
*/5 * * * * ./git-auto-push.sh
3. 多端同步
# Mac 端拉取
cd ~/Obsidian-MKH/我的知识/OpenClaw
git pull origin main
🔧 配置说明
监听目录配置
WATCH_DIRS=(
"/path/to/workspace/articles"
"/path/to/workspace/memory"
"/path/to/workspace/projects"
"/path/to/workspace/docs"
"/path/to/workspace/scripts"
"/path/to/workspace/learnings"
)
排除模式
EXCLUDE_PATTERN="\\.(log|tmp|swp|pyc)$|node_modules|__pycache__|\\.git"
📈 监控指标
| 指标 | 正常值 | 警告值 |
|---|---|---|
| 同步延迟 | \x3C10 秒 | >30 秒 |
| Git push 间隔 | 5 分钟 | >10 分钟 |
| Git pull 间隔 | 1 小时 | >2 小时 |
| 冲突次数 | 0 | >1/周 |
🎓 最佳实践
1. 同步频率
- 实时同步:inotifywait 监听(3-10 秒)
- Git push:每 5 分钟
- Git pull:每小时
2. 冲突处理
- push 前先 pull
- 大改动分多次 commit
- 人工编辑前先 git pull
3. 备份策略
- Git 远程备份(Gitee)
- 坚果云本地备份
- 定期完整备份(每周)
📝 更新日志
v1.0.0 (2026-03-15)
- ✅ 初始版本发布
- ✅ 实时同步功能
- ✅ Git 自动备份
- ✅ 多端同步支持
维护者: 虾球 🦐
许可: MIT
状态: 生产环境运行中
安全使用建议
This skill implements a real-time file sync and periodic Git backup and is internally coherent, but review these before installing: 1) Automatic commits: git-auto-push.sh does git add -A and pushes to origin main — remove sensitive files from the workspace or add safe .gitignore rules and verify remotes before enabling to avoid accidental exfiltration. 2) Credentials: the scripts will use whatever Git/Nutstore/Gitee credentials are available to the user account; ensure those credentials are appropriate and use a dedicated account/key if possible. 3) Paths and missing files: scripts use hardcoded /home/admin paths; adjust WATCH_DIRS, WORKSPACE_DIR, NUTSTORE_DIR, and log paths to match your environment. SKILL.md/README mention git-auto-pull.sh and a systemd unit but those files are not included — you must create or review a service unit and any pull script you rely on. 4) Test first: run scripts manually in a safe test workspace to confirm behavior before enabling as a systemd service or adding cron jobs. If you want higher assurance, ask the maintainer for the missing service unit and pull script and for clearer instructions about required Git authentication and scope.
功能分析
Type: OpenClaw Skill
Name: knowledge-sync
Version: 1.0.0
The skill bundle implements automated synchronization of the agent's workspace to external platforms (Gitee and Nutstore) using inotifywait, rsync, and Git. While these actions align with the stated purpose of 'knowledge sync,' the scripts (sync-realtime.sh and git-auto-push.sh) exhibit high-risk behaviors, including automatic data exfiltration of the entire workspace—including sensitive directories like 'scripts' and 'memory'—and the use of hardcoded paths (/home/admin/). The documentation in SKILL.md also encourages establishing persistence via systemd and crontab, which, combined with automated network activity, presents a significant security risk.
能力评估
Purpose & Capability
The name/description (real-time sync, git backup, Nutstore/Gitee integration) match the scripts and SKILL.md. The scripts implement inotify-based sync and periodic git push behavior. Minor inconsistency: SKILL.md and README reference a git-auto-pull.sh script and a systemd unit (sync-realtime.service) but that pull script and any service unit file are not present in the repository; the git push/pull behavior is otherwise implemented by the included git-auto-push.sh and sync-realtime.sh.
Instruction Scope
Runtime instructions ask the user/agent to enable a user systemd service and schedule cron jobs; the included scripts operate only on workspace directories and copy files to Nutstore and Obsidian paths and perform git operations. They do not read unrelated system files. Important behavioral note: git-auto-push.sh runs git add -A and will automatically commit and push all workspace contents — this can inadvertently upload secrets or private files to the remote (Gitee) if present.
Install Mechanism
This is an instruction-only skill with two shell scripts included and no install spec. No downloads or third-party package installs are performed by the skill itself, which reduces supply-chain risk.
Credentials
The skill declares no required environment variables or credentials; however, it implicitly depends on Git credentials/configuration (SSH keys or credential helpers) and on user file paths (hardcoded /home/admin/...). It does not request remote tokens explicitly, but will use whatever git authentication is configured for the account running the scripts. Make sure Git/Nutstore/Gitee credentials are appropriate and scoped.
Persistence & Privilege
SKILL.md instructs running a long-running user systemd service and cron jobs (persistent presence on the host). The skill itself does not set always: true and does not modify other skills. Persistence is consistent with its purpose but you should review and control the service and crontab entries before enabling them.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install knowledge-sync - 安装完成后,直接呼叫该 Skill 的名称或使用
/knowledge-sync触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
knowledge-sync 1.0.0
- Initial release.
- Provides real-time knowledge base sync across devices and servers.
- Includes inotifywait file monitoring, Git auto-push/pull, and Nutstore sync.
- Supports multi-device consistency with directory and conflict management.
- Ready for use in production environments.
元数据
常见问题
Knowledge Sync 是什么?
Real-time knowledge base synchronization for AI assistants. Supports inotifywait file monitoring, Git auto-push/pull, Nutstore sync, and multi-device consist... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 249 次。
如何安装 Knowledge Sync?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install knowledge-sync」即可一键安装,无需额外配置。
Knowledge Sync 是免费的吗?
是的,Knowledge Sync 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Knowledge Sync 支持哪些平台?
Knowledge Sync 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Knowledge Sync?
由 alfredming-2026(@alfredming-2026)开发并维护,当前版本 v1.0.0。
推荐 Skills