Skip to content

0xshugo/Knowledge-Curator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Syncthing-based Knowledge Sync System

Version: 1.0.0 Status: Design Phase Project: Aoi-factory Knowledge Management System Repository: https://github.com/0xshugo/Knowledge-Curator


概要

Syncthing-based Knowledge Sync System は、iPhone、Mac、VPS間でObsidian vaultをリアルタイム同期し、VPS上でAIエージェント(knowledge-curator)による自動処理を実現するシステムです。

主な機能

  • 3デバイス間同期: iPhone、Mac、VPSで双方向リアルタイム同期(< 5秒)
  • AI自動処理: VPS上でファイル変更を検知し、knowledge-curatorが自動実行
  • Git履歴管理: 1時間ごとに自動commitで完全な監査証跡を確保
  • 暗号化バックアップ: Cloudflare R2へ日次バックアップ(GPG暗号化、365日保持)
  • セキュリティ・バイ・デザイン: STRIDE脅威モデル、TLS 1.3、デバイス認証

ドキュメント構成

ドキュメント 担当エージェント 内容
01-requirements.md product-strategist 要件定義、ユースケース、KPI、ROI分析
02-security-design.md security-architect STRIDE脅威モデル、セキュリティ要件、緩和策
03-technical-architecture.md tech-architect システムアーキテクチャ、実装詳細、デプロイ計画

システムアーキテクチャ

┌─────────────┐
│   iPhone    │ ← Möbius Sync / Syncthing iOS
│  (Obsidian) │
└──────┬──────┘
       │ TLS 1.3
       ▼
┌─────────────┐      ┌──────────────────────┐
│     Mac     │ ←──→ │        VPS           │
│  (Obsidian) │      │  - Syncthing Server  │
└─────────────┘      │  - inotify-tools     │
                     │  - knowledge-curator │
                     │  - Git (hourly)      │
                     │  - Prometheus/Grafana│
                     └──────────────────────┘
                              │
                              ▼
                     ┌──────────────────────┐
                     │  External Services   │
                     │  - GitHub (Git)      │
                     │  - Cloudflare R2     │
                     │  - Claude API        │
                     └──────────────────────┘

実装計画(3フェーズ、3-4週間)

Phase 1: Basic Sync(Week 1)

目標: 3デバイス間でSyncthing同期確立

  • VPS Syncthing設定
  • iPhone Syncthing設定
  • Mac Syncthing設定
  • 同期動作確認(< 5秒遅延)

ドキュメント: implementation/phase-1-basic-sync.md


Phase 2: AI Integration(Week 2)

目標: knowledge-curatorとファイル監視の統合

  • inotify-tools導入
  • file-monitor.sh + systemdサービス
  • trigger-curator.sh(Docker実行)
  • 動作確認(編集 → 30秒後にcurator起動)

ドキュメント: implementation/phase-2-ai-integration.md


Phase 3: Monitoring & Git(Week 3-4)

目標: Git自動化、バックアップ、監視

  • Git Repository初期化(GPG署名)
  • auto-commit.sh + systemd timer(hourly)
  • backup-daily.sh + Cloudflare R2
  • Prometheus + Grafana導入
  • ダッシュボード作成

ドキュメント: implementation/phase-3-monitoring.md


技術スタック

コンポーネント 技術 バージョン
同期エンジン Syncthing 1.27+
OS(VPS) Ubuntu Server 22.04 LTS
ファイル監視 inotify-tools 3.22+
AIエージェント knowledge-curator 1.0.0
LLM Claude API Sonnet 4.5
バージョン管理 Git 2.40+
監視 Prometheus + Grafana Latest
バックアップ Cloudflare R2 -
暗号化 GPG 2.2+

セキュリティ対策

カテゴリ 対策
通信暗号化 TLS 1.3(Syncthing P2P通信)
デバイス認証 Device whitelist(3デバイスのみ)
データ暗号化 GPG暗号化(バックアップ)
完全性保証 Git commit署名(GPG)
入力検証 Path traversal防止(knowledge-curator)
監査証跡 Git履歴 + Prometheus logs

セキュリティリスク評価: 🔴 HIGH (7.2/10) → 緩和策実装後 🟡 MEDIUM (4.5/10)

詳細: 02-security-design.md


コスト・効果分析

初期投資

  • 実装工数: 16時間
  • コスト: ¥40,000

月間削減効果

  • 削減時間: 215分/月
  • 削減コスト: ¥8,900/月

ROI

  • 投資対効果: 167%
  • 投資回収期間: 4.5ヶ月

詳細: 01-requirements.md


クイックスタート

前提条件

  • Ubuntu 22.04 LTS VPS(2 vCPU、4GB RAM、50GB SSD)
  • iPhone(iOS 17+)
  • Mac(macOS 14+)
  • Claude API key
  • Cloudflare R2アカウント

Phase 1セットアップ(基本同期)

# 1. VPS Syncthing インストール
sudo apt update
sudo apt install syncthing

# 2. Syncthing起動
systemctl --user enable syncthing
systemctl --user start syncthing

# 3. Web UI アクセス
# http://VPS_IP:8384

# 4. デバイス追加
# iPhone、Macの Device ID を追加(config.xml)

詳細: implementation/phase-1-basic-sync.md


設定ファイル

すべての設定ファイルサンプルは config/ ディレクトリに格納されています:

  • config/syncthing-config.xml - Syncthing設定例
  • config/docker-compose.yml - 監視スタック(Prometheus + Grafana)
  • config/prometheus.yml - Prometheusメトリクス収集設定
  • config/.env.example - 環境変数テンプレート

実装スクリプト

すべての実装用スクリプトは scripts/ ディレクトリに格納されています:

  • scripts/file-monitor.sh - ファイル変更監視(inotify)
  • scripts/trigger-curator.sh - knowledge-curator起動スクリプト
  • scripts/auto-commit.sh - Git hourly auto-commit
  • scripts/backup-daily.sh - Cloudflare R2日次バックアップ
  • scripts/restore-from-r2.sh - R2からの復元スクリプト

トラブルシューティング

同期が遅い(> 5秒)

  • Syncthing Web UIで接続状態を確認: http://VPS_IP:8384
  • Relay Server経由の場合は遅延が増加(直接接続を推奨)
  • ネットワーク帯域を確認

knowledge-curator が起動しない

  • ログ確認: tail -f /var/log/sync-system/curator-execution.log
  • Docker実行確認: docker ps -a | grep curator
  • Claude API key確認: echo $ANTHROPIC_API_KEY

Git push が失敗する

  • SSH key確認: ssh -T git@github.com
  • GPG key確認: git config --global user.signingkey
  • リモートリポジトリ確認: git remote -v

関連リンク


ライセンス

MIT License


貢献者

  • product-strategist - 要件定義
  • security-architect - セキュリティ設計
  • tech-architect - 技術アーキテクチャ
  • governance-controller - 最終承認(予定)

変更履歴

Version Date Changes
1.0.0 2025-12-10 初回設計完了(product-strategist, security-architect, tech-architect)

Generated by: Aoi-factory Multi-Agent System Last Updated: 2025-12-10

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •