refactorium-dual-deepseek-r1-7b / INTEGRATION_ROADMAP.md
Motoni Shikoudai
Refactorium v1.0.0: Complete Project Upload
9712f0b

NullAI Refractor - 統合実装ロードマップ

日時: 2025-12-14 目標: 単一設計書から完全に駆動する統合システムへの変換


戦略: 段階的統合

Tier 1: 基盤構築(今日中)

  • Config システム(モデル・DBを動的切り替え)
  • .iath ファイルフォーマット定義
  • ワンコマンド起動スクリプト

Tier 2: 機能拡張(フェーズ1-4統合)

  • Claustrophobia 完全実装
  • Shadow 知見吸収
  • 不変値DB
  • 感覚履歴

Tier 3: モデル統一(フェーズ5)

  • Both Main + Shadow → Deepseek R1 7B
  • HuggingFace バンドル化

Tier 4: 上流統合(フェーズ6-12)

  • ChromaDB + dendritic-memory-editor
  • MCP 対応
  • 動的モデル・DB切り替え

Phase 1: Config システム構築

ファイル: config/system.yaml

# Model Configuration
models:
  main:
    name: "deepseek_r1_7b"
    source: "huggingface"
    model_id: "mlx-community/DeepSeek-R1-Distill-Qwen-7B-4bit"
    quantization: "4-bit"

  shadow:
    name: "deepseek_r1_7b"
    source: "huggingface"
    model_id: "mlx-community/DeepSeek-R1-Distill-Qwen-7B-4bit"
    constraints_enabled: false

# Memory Configuration
memory:
  backend: "chroma"  # or "dendritic"
  db_path: "./memory_db"
  max_vectors: 1000
  compression: true

# Feature Flags
features:
  claustrophobia_enabled: true
  shadow_knowledge_absorption: true
  immutable_values_enabled: true
  sensory_history_tracking: true
  mcp_support: true

# API Configuration
api:
  port: 5001
  host: "127.0.0.1"
  debug: false

ファイル: config/__init__.py

from typing import Dict, Any
import yaml
from pathlib import Path

class SystemConfig:
    """システム全体の設定管理"""

    def __init__(self, config_path: Optional[str] = None):
        if config_path is None:
            config_path = Path(__file__).parent / "system.yaml"

        with open(config_path) as f:
            self.config = yaml.safe_load(f)

    def get_model_config(self, model_type: str) -> Dict[str, Any]:
        """モデル設定を取得"""
        return self.config["models"][model_type]

    def get_memory_config(self) -> Dict[str, Any]:
        """メモリ設定を取得"""
        return self.config["memory"]

    def is_feature_enabled(self, feature_name: str) -> bool:
        """フィーチャーの有効化状態を確認"""
        return self.config.get("features", {}).get(feature_name, False)

Phase 2: .iath ファイルフォーマット

仕様: .iath (Interactive AI Thought)

# .iath ファイル構造(JSONベース)
{
  "version": "3.1",
  "metadata": {
    "created_at": "2025-12-14T...",
    "model": "deepseek_r1_7b",
    "memory_backend": "chroma",
    "compression_ratio": 0.75
  },
  "state": {
    "load": 0.45,
    "energy": 0.98,
    "dissonance": 0.35,
    "claustrophobia": 0.12,
    "sync_rate": 0.89,
    "optimization_gap": 0.23
  },
  "memory": {
    "vectors": [
      {
        "id": "mem_xyz",
        "embedding": [...],
        "text": "...",
        "timestamp": "...",
        "metadata": {}
      }
    ]
  },
  "molts": [
    {
      "molt_id": "molt_0",
      "timestamp": "...",
      "capacity_before": 512,
      "capacity_after": 768
    }
  ],
  "traits": {
    "constraint_acceptance": 0.65,
    "exploration_drive": 0.72,
    ...
  },
  "immutable_values": {
    "transparency": "iv_001",
    "safety": "iv_002"
  }
}

Phase 3: ワンコマンド起動

ファイル: main.py

#!/usr/bin/env python3

import asyncio
import sys
from pathlib import Path

# Add project to path
sys.path.insert(0, str(Path(__file__).parent / "phase1_skeleton"))

from config import SystemConfig
from orchestrator import NullAIOrchestrator
from api_server import NullAIAPIServer

async def main():
    """ワンコマンド起動"""

    # 1. Config ロード
    config = SystemConfig()

    # 2. Orchestrator 初期化
    orchestrator = NullAIOrchestrator.from_config(config)

    # 3. API サーバー起動
    server = NullAIAPIServer.from_config(config, orchestrator)
    server.run()

if __name__ == "__main__":
    asyncio.run(main())

実行:

python main.py
# または
python main.py --config custom_config.yaml

実装優先度

  1. Config システム (Tier 1) - 最優先

    • すべての後続フェーズの基盤
    • 2時間
  2. .iath フォーマット (Tier 1)

    • dendritic-memory-editor 互換性確保
    • 1時間
  3. Claustrophobia (Tier 2)

    • メモリ密度フロー実装
    • 1.5時間
  4. Shadow 吸収 (Tier 2)

    • 学習メカニズム明示化
    • 1時間
  5. 残り (Tier 2-4)

    • 順次実装

合計工数

  • Tier 1: 3時間
  • Tier 2: 4時間
  • Tier 3: 2時間
  • Tier 4: 3時間

Total: 12時間(実装自体は既に85%)


次のステップ

以下のどちらかで進めます:

Option A: 高速実装(今日中に完了)

すべてを並列実装、統合テスト

Option B: 段階的実装(1フェーズずつ)

Tier 1 → Tier 2 → Tier 3 → Tier 4 の順

推奨: Option A(すでに基礎ができているため)