Compare commits
87 Commits
dc2e9fcbb6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5fbf8c1be2 | |||
| 33285c4f6f | |||
| a084858863 | |||
| 2a196dd576 | |||
| 2a98835f2f | |||
| d06c265003 | |||
| 5fd8081646 | |||
| 5adbf31d09 | |||
| 56bc2a53f7 | |||
| c58befd27a | |||
| c4865d3e62 | |||
| 394d149954 | |||
| ddbfe5a321 | |||
| 67e1c19dee | |||
| 7d368e52c2 | |||
| 76fa3117ca | |||
| e1399098f0 | |||
| e93a8c3bef | |||
| a842f38cc2 | |||
| a5c9c8d687 | |||
| 16aaa54d4f | |||
| 3211c9b953 | |||
| 87955f80e0 | |||
| d6759f9fd7 | |||
| 2e3d83cbab | |||
| fe76773cb5 | |||
| 9298ebf965 | |||
| 50000c0dc0 | |||
| e03ac06f03 | |||
| d95b580e5f | |||
| 3615ca15bc | |||
| 0f173943ee | |||
| 5428ccc4c2 | |||
| d2f91e941c | |||
| e0345a68fc | |||
| 6fa45102ca | |||
| 1dddeb3318 | |||
| b994fb85b8 | |||
| 148bec815b | |||
| 64b344b64c | |||
| 59c6dd974b | |||
| 58841a133b | |||
| 55156989c8 | |||
| 73a14eacb4 | |||
| 27050cd06c | |||
| d5a8d954a1 | |||
| b521283903 | |||
| 3caff4fa9f | |||
| 5420ee1cb7 | |||
| 3a291d78af | |||
| 9842015eaf | |||
| 5e0603c079 | |||
| efb2a4a1aa | |||
| 374ea026e8 | |||
| 09286f5abd | |||
| a8390dc49c | |||
| 5ef6acf77e | |||
| 7660209de8 | |||
| 3df2174a4a | |||
| d079e0eb5f | |||
| 70ebc57990 | |||
| 60e9188e53 | |||
| 649985db97 | |||
| 65fdd51495 | |||
| 5d0d72cbc4 | |||
| 7805305100 | |||
| 2a4cfcaee3 | |||
| 35e534e126 | |||
| b64bbad44a | |||
| 6c11196996 | |||
| fcfb6af1eb | |||
| c8ea5a5aa5 | |||
| 0d46d4a900 | |||
| 1a34b59f42 | |||
| 5d6d6f32d7 | |||
| 5cec3fd321 | |||
| 47c609c886 | |||
| 781526de56 | |||
| 1c36b771ff | |||
| 3dd382198d | |||
| b46bc8ef6a | |||
| f888bae907 | |||
| da764ab901 | |||
| 0a8e6b5ac9 | |||
| e89a6618d4 | |||
| ad9b6b7d98 | |||
| 5ab10d466d |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@ __pycache__/
|
||||
*.db-shm
|
||||
*.db-journal
|
||||
!state_*.db
|
||||
state_merged.db
|
||||
|
||||
@@ -26,4 +26,33 @@ RackNerd VPS (New Year Special):
|
||||
- Username: root
|
||||
- Root Password: Zg58Mb73C4ueHFYhq3
|
||||
- 已安装 hermes agent
|
||||
- 问题: Telegram 对话失联无响应
|
||||
- 问题: Telegram 对话失联无响应
|
||||
§
|
||||
## Hermes Sync 架构 (2026-04-14 建成)
|
||||
|
||||
Gitea: https://d.momix.cc/Mixer/hermes-sync
|
||||
|
||||
三台机器:
|
||||
- 本地 Linux (10-40-29-186): ~/.hermes-sync (symlink to ~/hermes-sync-tmp), ~/.hermes
|
||||
- VPS RackNerd (soe219028): ~/.hermes-sync, ~/.hermes
|
||||
- MacOS (MixdeMac-mini.local): /Users/moore/.hermes-sync, /Users/moore/.hermes
|
||||
|
||||
同步内容:memories/MEMORY.md, skills/, state.db(每机器一个 state_<hostname>.db)
|
||||
不同步:config.yaml, .env, auth.json 等配置
|
||||
|
||||
sync.sh 已稳定:217行,无checkpoint,直接copy到temp dir再处理,避免SQLite WAL锁冲突
|
||||
cron: 每2小时,VPS和MacOS用绝对路径 /Users/moore/.hermes-sync/sync.sh
|
||||
本地: 软链 ~/hermes-sync-tmp -> ~/hermes-sync
|
||||
|
||||
MacOS hostname: MixdeMac-mini.local
|
||||
|
||||
## macOS Hermes 路径
|
||||
- 数据目录: /Users/moore/.hermes/state.db
|
||||
- Hermes CLI: /Users/moore/.local/bin/hermes
|
||||
- 无systemd,用cron管理后台进程
|
||||
|
||||
## SQLite 多机同步关键经验
|
||||
- WAL模式的db不能直接copy,会损坏。用temp dir中转。
|
||||
- 不能对WAL模式的db做checkpoint(会造成malformed image),直接shutil.copy2即可,WAL会在下次连接时自动attach。
|
||||
- merge时sessions用INSERT OR REPLACE(去重),messages用INSERT OR IGNORE(避免重复插入)
|
||||
- 列数用PRAGMA table_info动态获取,不硬编码
|
||||
Binary file not shown.
Binary file not shown.
BIN
state_merged.db
BIN
state_merged.db
Binary file not shown.
Binary file not shown.
5
sync.sh
5
sync.sh
@@ -8,6 +8,11 @@ cd "$SYNC_DIR"
|
||||
|
||||
echo "[$(date '+%H:%M:%S')] Sync from $HOSTNAME..."
|
||||
|
||||
# ── Step 0: Clean local state_merged.db to avoid git pull conflicts ──────
|
||||
# The merged db is produced by this script, not tracked, and can conflict
|
||||
# with remote when pulling. Remove it before fetch+merge.
|
||||
rm -f "$SYNC_DIR/state_merged.db"
|
||||
|
||||
# ── Step 1: Export local state.db (via temp dir to avoid lock) ────────────
|
||||
python3 << PYEOF
|
||||
import sqlite3, os, shutil, tempfile
|
||||
|
||||
Reference in New Issue
Block a user