Skip to content

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧬 Personal Life-OS

個人生活操作系統 (Personal Life Operating System) — AI 驅動、理論賦能、人性化動態管理系統。


🌟 系統理念

你是否也曾遇到這些問題?

  • ❌ 待辦清單一大堆,但永遠不知道先做哪個
  • ❌ 計畫很完美,執行兩天就放棄
  • ❌ 生病、聚會、突發狀況打亂計畫後,直接擺爛一整週
  • ❌ 筆記工具、任務管理、日曆同步混亂,越管越累

Life-OS 的解法

AI 承載複雜度,你只負責過生活 — 所有數學打分、權重計算由 Hermes AI 在背景自動完成 ✅ 四大系統模式 — 高能衝刺、日常執行、生病保護、放鬆豁免,人性化切換 ✅ 量化但不焦慮 — EER (精力加權產出率) 取代死板打卡,關注你的精力狀態 ✅ 雙軌道數據流 — 每日時間盒同步至 Outlook/CalDAV 日曆(硬執行層);週/月 EER 復盤歸檔至 Obsidian(長線沉澱層)


🏗️ 架構總覽

                +----------------------------------+
                |           使用者 User             |
                +----------------+-----------------+
                                 |
                          自然語言 (語音/文字/Telegram)
                                 |
                                 v
                +----------------------------------+
                |         Hermes LLM (API)         |
                |  (DeepSeek - Function Calling)    |
                +----------------+-----------------+
                                 |
                   (識別意圖,自動觸發 Tool Call)
                                 |
                                 v
                +----------------------------------+
                |        tool_executors.py         |
                |  (8 個核心工具函數)               |
                +-----+--------------------+-------+
                      |                    |
          (日曆 API/ICS) |            (Markdown 生成) |
                      v                    v
+----------------------------------+  +----------------------------------+
|  Outlook/CalDAV 日曆 (執行層)    |  |  Obsidian Vault (歸檔層)        |
|  - 每日時間盒 (硬塊/軟塊)        |  |  - 01_OKR_Tracker.md            |
|  - 顏色分類 深藍/橙紅/淺綠       |  |  - Archive/週月 EER 復盤        |
+----------------------------------+  +----------------------------------+

🧠 核心理論

理論 應用 說明
OKR 頂層目標導向 用目標(Objective) + 關鍵結果(KR) 拆解願景
AHP 宏觀權重 成對比較矩陣確定學業/健康/技能等生命維度權重
MAUT 微觀效用 學習價值(40%) + 延展度(30%) + 難度(30%) 評估任務價值
艾森豪威爾矩陣 象限分類 Q2(重要不緊急)=1.5 權重最高,鼓勵長期投入
時間盒 (Timeboxing) 日程安排 硬塊(課程) + 軟塊(彈性任務)
EER 量化評估 精力加權產出率 = Σ(價值×完成度) / Σ(時間×精力係數)
PDCA 動態迭代 Hermes 每日回饋,動態重置計畫
雙軌道 工具分工 日曆管每日執行(高頻),Obsidian 管長線歸檔(低頻)

📦 倉庫結構

Personal-Life-OS/
├── README.md                   # 系統總覽與快速開始
├── LICENSE                     # MIT 開源協議
├── docker-compose.yml          # 可選部署配置
├── .gitignore                  # 敏感資料隔離
├── docs/                       # 理論推導文檔
│   ├── 01-AHP-MAUT-weight-math.md
│   ├── 02-EER-energy-efficiency.md
│   ├── 03-system-modes.md
│   └── 04-dual-track-architecture.md   # 雙軌道架構
├── schemas/                    # 資料 Schema
│   ├── Task_Schema.json
│   └── OKR_Schema.json
├── templates/                  # Obsidian 模板
│   ├── Today_Dashboard.md
│   ├── 01_OKR_Tracker.md
│   ├── 02_Weekly_EER_Review.md
│   └── 03_Monthly_PDCA_Summary.md
├── hermes_agent/               # Hermes AI 執行層
│   ├── system_prompt.md        # AI 角色提示詞
│   ├── tools_definition.json   # Function Calling Schema
│   ├── tool_executors.py       # Python 工具執行層
│   └── config.json             # 系統配置
├── data/                       # 本地資料 (gitignored)
│   └── life_os.db             # SQLite 資料庫
└── scripts/                    # 輔助腳本

🚀 快速開始

前提

⚠️ 本文件中的 為佔位符 — 部署前替換為你的 GitHub 用戶名。

  • Python 3.10+
  • DeepSeek 或兼容 OpenAI API 的 LLM API Key
  • (可選) Obsidian 作為展示儀表板

1. 複製倉庫

git clone https://github.com/YOUR_USERNAME/Personal-Life-OS.git
cd Personal-Life-OS

2. 初始化資料庫

cd hermes_agent
python3 tool_executors.py

首次運行會自動在 data/ 下建立 life_os.db 並插入範例數據。

3. 配置 API

編輯 hermes_agent/config.json 中的設定,或透過環境變數傳遞 API Key。

4. 開始使用

tools_definition.jsonsystem_prompt.md 餵給你的 LLM API 通道,即可以自然語言與 Hermes 互動。


🎮 系統模式

模式 指令範例 效果
標準 (Normal) 「恢復正常模式」 默認狀態,EER 正常計算
高能 (Overdrive) 「準備衝刺期中考」 壓縮軟塊,優先高權重任務
低空飛行 (Low Battery) 「今天生病了」 凍結考核,任務平攤,安慰模式
豁免 (Joker Hour) 「今晚宿舍聚餐」 完全靜默,不發任何提醒

📊 EER 計算公式

$$\text{EER} = \frac{\sum (Score(T_i) \times C_i)}{\sum (Hours_i \times K_{energy_i})}$$

  • $Score = W_{AHP} \times W_{quadrant} \times Utility_{MAUT}$
  • $C_i$:任務完成度 (0.0 ~ 1.0)
  • $K_{energy}$:精力係數 (1.0 ~ 1.5)

📜 授權

MIT License — 你可以自由使用、修改、分發,僅需保留版權聲明。


🔄 新機器 10 分鐘恢復(換機 Runbook)

這份文件是災難恢復手冊:新電腦 / 重裝系統時照做。

前提

  • GitHub 帳號(主倉庫 + 私有備份倉庫 Personal-Life-OS-Data 的存取權)
  • Python 3.10+(含 pip)

步驟

# 1. 取得代碼(私有倉庫需要 PAT 或 SSH)
git clone https://github.com/{{ GITHUB_USER }}/Personal-Life-OS.git
cd Personal-Life-OS

# 2. 還原個人資料(從私有備份倉庫)
git clone https://github.com/{{ GITHUB_USER }}/Personal-Life-OS-Data.git /tmp/lifeos-restore
cp -r /tmp/lifeos-restore/data hermes_agent/data
cp -r /tmp/lifeos-restore/Obsidian_Vault hermes_agent/Obsidian_Vault
cp /tmp/lifeos-restore/user_profile.json hermes_agent/user_profile.json
rm -rf /tmp/lifeos-restore

# 3. 初始化資料庫(會自動做 schema 遷移,舊資料相容)
cd hermes_agent
python3 tool_executors.py        # 只 init_db(),不會寫入範例數據
python3 -c "import sqlite3; c=sqlite3.connect('data/life_os.db'); print(c.execute('SELECT COUNT(*) FROM tasks').fetchone())"  # 應輸出任務數

# 4. 驗證資料完整性(還原演練)
python3 -c "
import sqlite3
c = sqlite3.connect('data/life_os.db')
print('integrity:', c.execute('PRAGMA integrity_check').fetchone())
print('tasks:', c.execute('SELECT COUNT(*) FROM tasks').fetchone()[0])
print('okrs:', c.execute('SELECT COUNT(*) FROM okrs').fetchone()[0])
"

# 5. 重新授權 Outlook 日曆(一鍵流程)
python3 ms_graph.py auth
# → 瀏覽器打開顯示的網址,輸入 code,回車等待自動輪詢完成

# 6. 依賴安裝(如需要)
pip install pytest        # 跑測試用
pip install caldav        # 可選:CalDAV 推送

# 7. 跑測試確認一切正常
python3 -m pytest tests/ -q

憑證清單(換機最難恢復的不是程式碼,是這些)

憑證 存放位置 重新取得方式
GitHub PAT(主倉庫 push) ~/.hermes/credentials/github_pat(備份腳本讀取) GitHub → Settings → Developer settings → Personal access tokens
GitHub PAT(備份倉庫 push) 同上(同一 token 需有兩個 repo 的權限) 同上,權限勾 repo
QQ Bot AppID/Secret ~/.hermes/.envQQ_APP_ID / QQ_CLIENT_SECRET)+ ~/.hermes/config.yaml QQ 開放平台 → 應用管理
DeepSeek API key ~/.hermes/.envDEEPSEEK_API_KEY)+ ~/.bashrc platform.deepseek.com → API keys
Microsoft Graph token ~/.hermes/credentials/msgraph_token.json(含 refresh_token 自動續期) 一鍵重新授權:python3 ms_graph.py auth
Sub2API key ~/.hermes/.env 中转站後台

完整還原演練(含憑證 re-auth)

上次只驗證了資料,這次連憑證一起驗:

# 1. 代碼
git clone https://github.com/{{ GITHUB_USER }}/Personal-Life-OS.git && cd Personal-Life-OS

# 2. 資料(DB + Obsidian + 畫像)
git clone https://github.com/{{ GITHUB_USER }}/Personal-Life-OS-Data.git /tmp/lifeos-restore
cp -r /tmp/lifeos-restore/data hermes_agent/data
cp -r /tmp/lifeos-restore/Obsidian_Vault hermes_agent/Obsidian_Vault
cp /tmp/lifeos-restore/user_profile.json hermes_agent/user_profile.json
rm -rf /tmp/lifeos-restore

# 3. 初始化 + 驗證
cd hermes_agent && python3 tool_executors.py
python3 -c "import sqlite3; c=sqlite3.connect('data/life_os.db'); print(c.execute('PRAGMA integrity_check').fetchone()); print(c.execute('SELECT COUNT(*) FROM tasks').fetchone())"

# 4. 憑證
mkdir -p ~/.hermes/credentials
echo "<你的 PAT>" > ~/.hermes/credentials/github_pat && chmod 600 ~/.hermes/credentials/github_pat
# QQ/DeepSeek key → 複製舊機 ~/.hermes/.env
# Outlook → python3 ms_graph.py auth(瀏覽器輸 code,自動輪詢)

# 5. cron 腳本(repo 內版本化)
mkdir -p ~/.hermes/scripts
cp scripts/lifeos_backup.py scripts/lifeos_morning_brief.py \
   scripts/lifeos_remind.py scripts/lifeos_weekly_review.py ~/.hermes/scripts/
chmod +x ~/.hermes/scripts/*.py
# 在 Hermes 中用 cronjob 工具重建 6 個 job(見 crontab.example)

# 6. 測試
python3 -m pytest tests/ -q

常見問題

症狀 解法
no such table: mode_change_log 正常 — 跑一次 python3 tool_executors.py 自動遷移
FOREIGN KEY constraint failed 正常 — FK 已啟用,表示防呆生效
Outlook 事件不見 重跑 python3 ms_graph.py auth
時間偏移 檢查 config.json 的 timezone(預設 Asia/Shanghai)

由 Nous Hermes AI 賦能 · 為個人生活掌控而設計

About

個人生活操作系統 (Personal Life-OS) — AI 驅動、人性化的個人動態管理系統

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages