ai/ai
1
0

Update ai ecosystem with comprehensive documentation and Rust implementations

- Update submodule references for ai.gpt (Rust implementation), ai.card (Rust API), ai.verse, ai.game, ai.os
- Add new claude CLI tool for documentation generation and project management
- Update core architecture and naming documentation
- Add comprehensive ai.wiki documentation system
- Update .gitmodules with new project structures
- Enhance main README.md with ecosystem overview
- Add Claude Code integration throughout the ecosystem

Major updates:
- ai.gpt: Complete Python → Rust migration with 16 commands and MCP server
- ai.card: New Rust API server with gacha system and atproto integration
- ai.verse: Metaverse architecture with reality-reflection systems
- ai.game: Next-generation device design documentation
- ai.os: Game-oriented operating system specifications

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-06-07 17:44:26 +09:00
parent 69f0f68035
commit 2b3f971996
27 changed files with 1427 additions and 28 deletions

View File

@@ -16,7 +16,28 @@
"Bash(zsh:*)",
"Bash(git pull:*)",
"Bash(jq:*)",
"Bash(chmod:*)"
"Bash(chmod:*)",
"Bash(./uv_setup.sh:*)",
"Bash(source:*)",
"Bash(aigpt docs --help)",
"Bash(uv run:*)",
"Bash(uv pip install:*)",
"Bash(python:*)",
"Bash(PYTHONPATH=src python -m aigpt.cli docs --help)",
"Bash(uv install:*)",
"Bash(uv sync:*)",
"Bash(pip install:*)",
"Bash(unalias:*)",
"Bash(alias aigpt='uv run aigpt')",
"Bash(aigpt tokens status)",
"Bash(cargo:*)",
"Bash(mkdir:*)",
"Bash(rm:*)",
"Bash(export DATABASE_URL=\"sqlite://./test.db\")",
"Bash(./target/release/aigpt-rs --help)",
"Bash(./target/release/aigpt-rs:*)",
"Bash(git push:*)",
"Bash(git rebase:*)"
],
"deny": []
}

1
.gitignore vendored
View File

@@ -1 +1,2 @@
**.DS_Store
/tmp

15
.gitmodules vendored
View File

@@ -22,3 +22,18 @@
[submodule "shell"]
path = shell
url = git@git.syui.ai:ai/shell
[submodule "ai"]
path = ai
url = git@git.syui.ai:ai/ai
branch = main
[submodule "api"]
path = api
url = git@git.syui.ai:ai/api
branch = main
[submodule "log"]
path = log
url = git@git.syui.ai:ai/log
branch = main
[submodule "wiki"]
path = wiki
url = git@git.syui.ai:ai/ai.wiki

View File

@@ -29,6 +29,10 @@
### 評価原則
この3要素すべてが揃って初めて真の価値が生まれる
🧠 **存在子理論** × 🔗 **atproto統合** × 📚 **ドキュメント自動化** × 🌐 **メタバース構築**
Claude Code最適化と効率的なAI理解用ドキュメント管理システム
### 政治・社会への応用
- **政治家評価**: 能力だけでなく心の純粋さを重視
- **官僚システム**: 長期的社会影響を含めた人事評価
@@ -118,6 +122,33 @@ ai.aiは**AIM Protocol**Anthropic Intelligence Measurementを統合し、
↑___________________________| (継続的学習・更新)
```
## システム構成
```
../ai/
├── claude/ # Claude Code専用フォルダ
│ ├── core/ # 共通ドキュメント
│ │ ├── philosophy.md # 存在子理論・yui system
│ │ ├── naming.md # 名前規則
│ │ └── architecture.md # システム構成
│ ├── projects/ # プロジェクト固有情報
│ │ ├── os.md # ai.os
│ │ ├── gpt.md # ai.gpt
│ │ ├── card.md # ai.card
│ │ ├── verse.md # ai.verse (メタバース)
│ │ └── *.md # 各プロジェクト文書
│ ├── scripts/ # 管理スクリプトPython移行完了
│ │ ├── generate_claude.sh # → ai.gpt docs generate
│ │ ├── sync_docs.sh # → ai.gpt docs sync
│ │ ├── sync-all.sh # → ai.gpt docs sync --all
│ │ ├── update-submodules.sh # → ai.gpt docs submodules実装予定
│ │ └── session-end.sh # → ai.gpt docs session-end実装予定
│ └── templates/ # テンプレート
├── [git submodules] # 各プロジェクトのsubmodule
├── ai.json # 最適化されたメタデータ
└── ai.md # ユーザーの思考・思想claude.mdのベース
```
## 実装段階
### Phase 1: 個人レベル
@@ -125,32 +156,12 @@ ai.aiは**AIM Protocol**Anthropic Intelligence Measurementを統合し、
- **心理プロファイル**: AIM Protocolによる個人評価
- **継続学習**: 長期間の関係性から精密な心理分析
### Phase 2: 組織レベル
- **リーダー資質評価**: 客観的なリーダーシップ判定
- **組織適性**: 個人の組織内最適ポジション提案
- **チーム編成**: 心理適性に基づく最適チーム構築
### Phase 3: 社会レベル
- **政治システム見直し**: 現在の政治制度の根本的評価
- **権力配分最適化**: 真に適した人材への権力配分
- **社会制度設計**: 心理学に基づく新しい社会システム
### Phase 4: 文明レベル
- **国家概念の超越**: 国境を超えた人類統合への道筋
- **地球規模統治**: 全人類の福祉を最優先とする統治システム
- **宇宙文明準備**: カルダシェフ文明尺度における次段階への準備
## 技術アーキテクチャ
### AI心理分析エンジン
- **多層ニューラルネット**: 言語・行動・感情の統合分析
- **長期記憶統合**: ai.gptからの継続的データ蓄積
- **文脈理解**: 状況・環境を考慮した心理状態判定
### 政治データベース
- **歴史的資料**: 過去の政治家・権力者の発言・行動データベース
- **結果追跡**: 長期的な政策結果との相関分析
- **パターン学習**: 権力と腐敗の関係性学習
### 予測システム
- **短期予測**: 1-5年での行動・結果予測
@@ -200,4 +211,3 @@ ai.aiは単なるAIツールではなく、人類文明が次の段階に進む
- 地球規模での統一された心理評価基準確立
- 宇宙文明時代への準備完了
ai.aiは人類の心を理解し、真に美しい社会を実現するための革命的システムである。

1
ai Submodule

Submodule ai added at 69f0f68035

View File

@@ -52,6 +52,11 @@
"detailed_specs": "system_specs/ai_system.json",
"branch": "main"
},
"ai.wiki": {
"type": "ai.wiki",
"text": "情報のまとめ",
"branch": "heads/main"
},
"gpt": {
"type": "gpt",
"text": "自律送信AI + 統合MCP基盤",

1
ai.wiki Submodule

Submodule ai.wiki added at d559b3b23f

1
api Submodule

Submodule api added at 22734a4b4c

2
card

Submodule card updated: 13723cf3d7...e7948bf4cf

View File

@@ -0,0 +1,5 @@
"""Claude AI ecosystem management CLI."""
__version__ = "1.0.0"
__author__ = "syui"
__email__ = "syui@syui.ai"

View File

@@ -0,0 +1 @@
"""Commands package for Claude CLI."""

View File

@@ -0,0 +1,203 @@
"""Generate command for Claude CLI."""
from pathlib import Path
from typing import List, Optional
import click
from rich.console import Console
from rich.panel import Panel
from rich.table import Table
from ..core.config import load_config
from ..core.templates import TemplateManager
from ..core.utils import (
ProgressManager,
count_lines,
format_file_size,
safe_write_file,
validate_project_name,
)
console = Console()
@click.command()
@click.option(
"--project", "-p",
required=True,
help="Project name (os, gpt, card, etc.)"
)
@click.option(
"--output", "-o",
type=click.Path(path_type=Path),
default=Path("./claude.md"),
help="Output file path (default: ./claude.md)"
)
@click.option(
"--include", "-i",
default="core,specific",
help="Components to include (default: core,specific)"
)
@click.option(
"--ai-gpt-integration",
is_flag=True,
help="Enable ai.gpt integration for enhanced generation"
)
@click.option(
"--dry-run",
is_flag=True,
help="Show what would be generated without writing files"
)
@click.pass_context
def generate(
ctx: click.Context,
project: str,
output: Path,
include: str,
ai_gpt_integration: bool,
dry_run: bool,
) -> None:
"""Generate project documentation with Claude AI integration.
Creates comprehensive documentation by combining core philosophy,
architecture, and project-specific content. Supports ai.gpt
integration for enhanced documentation generation.
Examples:
# Generate basic documentation
claude generate --project=os
# Generate with specific components
claude generate --project=gpt --include=philosophy,specific
# Generate with ai.gpt integration
claude generate --project=card --ai-gpt-integration
# Preview without writing
claude generate --project=verse --dry-run
"""
verbose = ctx.obj.get("verbose", False)
try:
# Load configuration
with ProgressManager("Loading configuration...") as progress:
config = load_config()
# Validate project
available_projects = config.list_projects()
if not validate_project_name(project, available_projects):
console.print(f"[red]Error: Project '{project}' not found[/red]")
console.print(f"Available projects: {', '.join(available_projects)}")
raise click.Abort()
# Parse components
components = [c.strip() for c in include.split(",")]
# Initialize template manager
template_manager = TemplateManager(config)
# Validate components
valid_components = template_manager.validate_components(components)
if valid_components != components:
console.print("[yellow]Some components were invalid and filtered out[/yellow]")
# Show generation info
project_info = config.get_project_info(project)
info_table = Table(title=f"Documentation Generation: {project}")
info_table.add_column("Property", style="cyan")
info_table.add_column("Value", style="green")
info_table.add_row("Project Type", project_info.type if project_info else "Unknown")
info_table.add_row("Status", project_info.status if project_info else "Unknown")
info_table.add_row("Output Path", str(output))
info_table.add_row("Components", ", ".join(valid_components))
info_table.add_row("AI.GPT Integration", "" if ai_gpt_integration else "")
info_table.add_row("Mode", "Dry Run" if dry_run else "Generate")
console.print(info_table)
console.print()
# AI.GPT integration
if ai_gpt_integration:
console.print("[blue]🤖 AI.GPT Integration enabled[/blue]")
try:
enhanced_content = _integrate_with_ai_gpt(project, valid_components, verbose)
if enhanced_content:
console.print("[green]✓ AI.GPT enhancement applied[/green]")
else:
console.print("[yellow]⚠ AI.GPT enhancement failed, using standard generation[/yellow]")
except Exception as e:
console.print(f"[yellow]⚠ AI.GPT integration error: {e}[/yellow]")
console.print("[dim]Falling back to standard generation[/dim]")
# Generate documentation
with ProgressManager("Generating documentation...") as progress:
content = template_manager.generate_documentation(
project_name=project,
components=valid_components,
output_path=None if dry_run else output,
)
# Show results
if dry_run:
console.print(Panel(
f"[dim]Preview of generated content ({len(content.splitlines())} lines)[/dim]\n\n" +
content[:500] + "\n\n[dim]... (truncated)[/dim]",
title="Dry Run Preview",
expand=False,
))
console.print(f"[yellow]🔍 Dry run completed. Would write to: {output}[/yellow]")
else:
# Write content if not dry run
if safe_write_file(output, content):
file_size = output.stat().st_size
line_count = count_lines(output)
console.print(f"[green]✅ Generated: {output}[/green]")
console.print(f"[dim]📏 Size: {format_file_size(file_size)} ({line_count} lines)[/dim]")
# Show component breakdown
if verbose:
console.print("\n[blue]📋 Component breakdown:[/blue]")
for component in valid_components:
component_display = component.replace("_", " ").title()
console.print(f"{component_display}")
else:
console.print("[red]❌ Failed to write documentation[/red]")
raise click.Abort()
except Exception as e:
if verbose:
console.print_exception()
else:
console.print(f"[red]Error: {e}[/red]")
raise click.Abort()
def _integrate_with_ai_gpt(project: str, components: List[str], verbose: bool) -> Optional[str]:
"""Integrate with ai.gpt for enhanced documentation generation."""
# This is a placeholder for ai.gpt integration
# In the full implementation, this would:
# 1. Connect to ai.gpt MCP server
# 2. Send project context and current documentation
# 3. Request AI enhancement/suggestions
# 4. Return enhanced content
if verbose:
console.print("[dim]AI.GPT integration not yet implemented[/dim]")
return None
# Add aliases for convenience
@click.command()
@click.pass_context
def gen(ctx: click.Context, **kwargs) -> None:
"""Alias for generate command."""
ctx.invoke(generate, **kwargs)
# Export both commands
__all__ = ["generate", "gen"]

View File

@@ -0,0 +1,277 @@
"""Sync command for Claude CLI."""
from pathlib import Path
from typing import Dict, List, Optional
import click
from rich.console import Console
from rich.panel import Panel
from rich.progress import track
from rich.table import Table
from ..core.config import get_ai_root, load_config
from ..core.utils import (
ProgressManager,
find_project_directories,
run_command,
validate_project_name,
)
from .generate import generate
console = Console()
@click.command()
@click.option(
"--project", "-p",
help="Sync specific project (e.g., os, gpt, card)"
)
@click.option(
"--all", "-a",
"sync_all",
is_flag=True,
help="Sync all available projects"
)
@click.option(
"--dry-run",
is_flag=True,
help="Show what would be done without making changes"
)
@click.option(
"--include", "-i",
default="core,specific",
help="Components to include in sync (default: core,specific)"
)
@click.option(
"--ai-gpt-integration",
is_flag=True,
help="Enable ai.gpt integration for enhanced sync"
)
@click.pass_context
def sync(
ctx: click.Context,
project: Optional[str],
sync_all: bool,
dry_run: bool,
include: str,
ai_gpt_integration: bool,
) -> None:
"""Sync documentation across multiple projects.
Synchronizes Claude documentation from the central claude/ directory
to individual project directories. Supports both single-project and
bulk synchronization operations.
Examples:
# Sync specific project
claude sync --project=os
# Sync all projects
claude sync --all
# Preview sync operations
claude sync --all --dry-run
# Sync with AI enhancement
claude sync --project=gpt --ai-gpt-integration
"""
verbose = ctx.obj.get("verbose", False)
# Validate arguments
if not project and not sync_all:
console.print("[red]Error: Either --project or --all is required[/red]")
raise click.Abort()
if project and sync_all:
console.print("[red]Error: Cannot use both --project and --all[/red]")
raise click.Abort()
try:
# Load configuration
with ProgressManager("Loading configuration...") as progress:
config = load_config()
ai_root = get_ai_root()
available_projects = config.list_projects()
# Validate specific project if provided
if project and not validate_project_name(project, available_projects):
console.print(f"[red]Error: Project '{project}' not found[/red]")
console.print(f"Available projects: {', '.join(available_projects)}")
raise click.Abort()
# Determine projects to sync
if sync_all:
target_projects = available_projects
else:
target_projects = [project]
# Find project directories
project_dirs = find_project_directories(ai_root, target_projects)
# Show sync information
sync_table = Table(title="Documentation Sync Plan")
sync_table.add_column("Project", style="cyan")
sync_table.add_column("Directory", style="blue")
sync_table.add_column("Status", style="green")
sync_table.add_column("Components", style="yellow")
for proj in target_projects:
if proj in project_dirs:
target_file = project_dirs[proj] / "claude.md"
status = "✓ Found" if target_file.parent.exists() else "⚠ Missing"
sync_table.add_row(proj, str(project_dirs[proj]), status, include)
else:
sync_table.add_row(proj, "Not found", "❌ Missing", "N/A")
console.print(sync_table)
console.print()
if dry_run:
console.print("[yellow]🔍 DRY RUN MODE - No files will be modified[/yellow]")
# AI.GPT integration setup
if ai_gpt_integration:
console.print("[blue]🤖 AI.GPT Integration enabled[/blue]")
console.print("[dim]Enhanced documentation generation will be applied[/dim]")
console.print()
# Perform sync operations
sync_results = []
for proj in track(target_projects, description="Syncing projects..."):
result = _sync_project(
proj,
project_dirs.get(proj),
include,
dry_run,
ai_gpt_integration,
verbose
)
sync_results.append((proj, result))
# Show results summary
_show_sync_summary(sync_results, dry_run)
except Exception as e:
if verbose:
console.print_exception()
else:
console.print(f"[red]Error: {e}[/red]")
raise click.Abort()
def _sync_project(
project_name: str,
project_dir: Optional[Path],
include: str,
dry_run: bool,
ai_gpt_integration: bool,
verbose: bool,
) -> Dict:
"""Sync a single project."""
result = {
"project": project_name,
"success": False,
"message": "",
"output_file": None,
"lines": 0,
}
if not project_dir:
result["message"] = "Directory not found"
return result
if not project_dir.exists():
result["message"] = f"Directory does not exist: {project_dir}"
return result
target_file = project_dir / "claude.md"
if dry_run:
result["success"] = True
result["message"] = f"Would sync to {target_file}"
result["output_file"] = target_file
return result
try:
# Use the generate command functionality
from ..core.templates import TemplateManager
from ..core.config import load_config
config = load_config()
template_manager = TemplateManager(config)
# Generate documentation
content = template_manager.generate_documentation(
project_name=project_name,
components=[c.strip() for c in include.split(",")],
output_path=target_file,
)
result["success"] = True
result["message"] = "Successfully synced"
result["output_file"] = target_file
result["lines"] = len(content.splitlines())
if verbose:
console.print(f"[dim]✓ Synced {project_name}{target_file}[/dim]")
except Exception as e:
result["message"] = f"Sync failed: {str(e)}"
if verbose:
console.print(f"[red]✗ Failed {project_name}: {e}[/red]")
return result
def _show_sync_summary(sync_results: List[tuple], dry_run: bool) -> None:
"""Show sync operation summary."""
success_count = sum(1 for _, result in sync_results if result["success"])
total_count = len(sync_results)
error_count = total_count - success_count
# Summary table
summary_table = Table(title="Sync Summary")
summary_table.add_column("Metric", style="cyan")
summary_table.add_column("Value", style="green")
summary_table.add_row("Total Projects", str(total_count))
summary_table.add_row("Successful", str(success_count))
summary_table.add_row("Failed", str(error_count))
if not dry_run:
total_lines = sum(result["lines"] for _, result in sync_results if result["success"])
summary_table.add_row("Total Lines Generated", str(total_lines))
console.print()
console.print(summary_table)
# Show errors if any
if error_count > 0:
console.print()
console.print("[red]❌ Failed Projects:[/red]")
for project_name, result in sync_results:
if not result["success"]:
console.print(f"{project_name}: {result['message']}")
# Final status
console.print()
if dry_run:
console.print("[yellow]🔍 This was a dry run. To apply changes, run without --dry-run[/yellow]")
elif error_count == 0:
console.print("[green]🎉 All projects synced successfully![/green]")
else:
console.print(f"[yellow]⚠ Completed with {error_count} error(s)[/yellow]")
@click.command()
@click.pass_context
def sync_all(ctx: click.Context, **kwargs) -> None:
"""Alias to sync all projects."""
ctx.invoke(sync, sync_all=True, **kwargs)
# Export commands
__all__ = ["sync", "sync_all"]

View File

@@ -0,0 +1,152 @@
"""Configuration management for Claude CLI."""
import json
from pathlib import Path
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class GitConfig(BaseModel):
"""Git configuration."""
host: str = "git.syui.ai"
protocol: str = "ssh"
class AtprotoConfig(BaseModel):
"""Atproto configuration."""
host: str = "syu.is"
protocol: str = "at"
at_url: str = "at://ai.syu.is"
did: str = "did:plc:6qyecktefllvenje24fcxnie"
web: str = "https://web.syu.is/@ai"
class ProjectMetadata(BaseModel):
"""Project metadata."""
last_updated: str
structure_version: str
domain: List[str]
git: GitConfig
atproto: AtprotoConfig
class ProjectInfo(BaseModel):
"""Individual project information."""
type: str
text: str
status: str
branch: str = "main"
git_url: Optional[str] = None
detailed_specs: Optional[str] = None
data_reference: Optional[str] = None
features: Optional[str] = None
class AIConfig(BaseModel):
"""AI projects configuration."""
ai: ProjectInfo
gpt: ProjectInfo
os: ProjectInfo
game: ProjectInfo
bot: ProjectInfo
moji: ProjectInfo
card: ProjectInfo
api: ProjectInfo
log: ProjectInfo
verse: ProjectInfo
shell: ProjectInfo
class CardElement(BaseModel):
"""Card element configuration."""
proton: int
neutron: int
electron: int
charge: int
class CardAttribute(BaseModel):
"""Card attribute configuration."""
type: str
energy: int
stability: str
class CardLang(BaseModel):
"""Card language configuration."""
name: str
text: str
class Card(BaseModel):
"""Card data model."""
id: int
name: str
element: CardElement
attribute: CardAttribute
lang: Dict[str, CardLang]
class ClaudeConfig(BaseModel):
"""Main configuration model."""
version: int = 2
metadata: ProjectMetadata
ai: AIConfig
data: Dict[str, Any] = Field(default_factory=dict)
deprecated: Dict[str, Any] = Field(default_factory=dict)
@classmethod
def load_from_file(cls, config_path: Path) -> "ClaudeConfig":
"""Load configuration from ai.json file."""
if not config_path.exists():
raise FileNotFoundError(f"Configuration file not found: {config_path}")
with open(config_path, "r", encoding="utf-8") as f:
data = json.load(f)
return cls(**data)
def get_project_info(self, project_name: str) -> Optional[ProjectInfo]:
"""Get project information by name."""
return getattr(self.ai, project_name, None)
def get_project_git_url(self, project_name: str) -> str:
"""Get git URL for project."""
project = self.get_project_info(project_name)
if project and project.git_url:
return project.git_url
# Construct URL from metadata
host = self.metadata.git.host
protocol = self.metadata.git.protocol
if protocol == "ssh":
return f"git@{host}:ai/{project_name}"
else:
return f"https://{host}/ai/{project_name}"
def get_project_branch(self, project_name: str) -> str:
"""Get branch for project."""
project = self.get_project_info(project_name)
return project.branch if project else "main"
def list_projects(self) -> List[str]:
"""List all available projects."""
return list(self.ai.__fields__.keys())
def get_claude_root() -> Path:
"""Get Claude root directory."""
return Path(__file__).parent.parent.parent
def get_ai_root() -> Path:
"""Get AI ecosystem root directory."""
return get_claude_root().parent
def load_config() -> ClaudeConfig:
"""Load Claude configuration."""
config_path = get_ai_root() / "ai.json"
return ClaudeConfig.load_from_file(config_path)

View File

@@ -0,0 +1,158 @@
"""Template management for Claude CLI."""
from datetime import datetime
from pathlib import Path
from typing import Dict, List, Optional
from jinja2 import Environment, FileSystemLoader, Template
from .config import ClaudeConfig, get_claude_root
class TemplateManager:
"""Manages Jinja2 templates for documentation generation."""
def __init__(self, config: ClaudeConfig):
self.config = config
self.claude_root = get_claude_root()
self.templates_dir = self.claude_root / "templates"
self.core_dir = self.claude_root / "core"
self.projects_dir = self.claude_root / "projects"
# Setup Jinja2 environment
self.env = Environment(
loader=FileSystemLoader([
str(self.templates_dir),
str(self.core_dir),
str(self.projects_dir),
]),
trim_blocks=True,
lstrip_blocks=True,
)
# Add custom filters
self.env.filters["timestamp"] = self._timestamp_filter
def _timestamp_filter(self, format_str: str = "%Y-%m-%d %H:%M:%S") -> str:
"""Jinja2 filter for timestamps."""
return datetime.now().strftime(format_str)
def get_template_context(self, project_name: str, components: List[str]) -> Dict:
"""Get template context for documentation generation."""
project_info = self.config.get_project_info(project_name)
return {
"config": self.config,
"project_name": project_name,
"project_info": project_info,
"components": components,
"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"ai_md_content": self._get_ai_md_content(),
}
def _get_ai_md_content(self) -> Optional[str]:
"""Get content from ai.md file."""
ai_md_path = self.claude_root.parent / "ai.md"
if ai_md_path.exists():
return ai_md_path.read_text(encoding="utf-8")
return None
def render_component(self, component_name: str, context: Dict) -> str:
"""Render a specific component."""
component_files = {
"core": ["philosophy.md", "naming.md", "architecture.md"],
"philosophy": ["philosophy.md"],
"naming": ["naming.md"],
"architecture": ["architecture.md"],
"specific": [f"{context['project_name']}.md"],
}
if component_name not in component_files:
raise ValueError(f"Unknown component: {component_name}")
content_parts = []
for file_name in component_files[component_name]:
file_path = self.core_dir / file_name
if component_name == "specific":
file_path = self.projects_dir / file_name
if file_path.exists():
content = file_path.read_text(encoding="utf-8")
content_parts.append(content)
return "\n\n".join(content_parts)
def generate_documentation(
self,
project_name: str,
components: List[str],
output_path: Optional[Path] = None,
) -> str:
"""Generate complete documentation."""
context = self.get_template_context(project_name, components)
# Build content sections
content_sections = []
# Add ai.md header if available
if context["ai_md_content"]:
content_sections.append(context["ai_md_content"])
content_sections.append("---\n")
# Add title and metadata
content_sections.append("# エコシステム統合設計書(詳細版)\n")
content_sections.append("このドキュメントは動的生成されました。修正は元ファイルで行ってください。\n")
content_sections.append(f"生成日時: {context['timestamp']}")
content_sections.append(f"対象プロジェクト: {project_name}")
content_sections.append(f"含有コンポーネント: {','.join(components)}\n")
# Add component content
for component in components:
try:
component_content = self.render_component(component, context)
if component_content.strip():
content_sections.append(component_content)
except ValueError as e:
print(f"Warning: {e}")
# Add footer
footer = """
# footer
© syui
# important-instruction-reminders
Do what has been asked; nothing more, nothing less.
NEVER create files unless they're absolutely necessary for achieving your goal.
ALWAYS prefer editing an existing file to creating a new one.
NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
"""
content_sections.append(footer)
# Join all sections
final_content = "\n".join(content_sections)
# Write to file if output path provided
if output_path:
output_path.parent.mkdir(parents=True, exist_ok=True)
output_path.write_text(final_content, encoding="utf-8")
return final_content
def list_available_components(self) -> List[str]:
"""List available components."""
return ["core", "philosophy", "naming", "architecture", "specific"]
def validate_components(self, components: List[str]) -> List[str]:
"""Validate and return valid components."""
available = self.list_available_components()
valid_components = []
for component in components:
if component in available:
valid_components.append(component)
else:
print(f"Warning: Unknown component '{component}' (available: {available})")
return valid_components or ["core", "specific"] # Default fallback

View File

@@ -0,0 +1,178 @@
"""Utility functions for Claude CLI."""
import subprocess
import sys
from pathlib import Path
from typing import List, Optional, Tuple
from rich.console import Console
from rich.progress import Progress, SpinnerColumn, TextColumn
console = Console()
def run_command(
cmd: List[str],
cwd: Optional[Path] = None,
capture_output: bool = True,
verbose: bool = False,
) -> Tuple[int, str, str]:
"""Run a command and return exit code, stdout, stderr."""
if verbose:
console.print(f"[dim]Running: {' '.join(cmd)}[/dim]")
try:
result = subprocess.run(
cmd,
cwd=cwd,
capture_output=capture_output,
text=True,
check=False,
)
return result.returncode, result.stdout, result.stderr
except FileNotFoundError:
return 1, "", f"Command not found: {cmd[0]}"
def is_git_repository(path: Path) -> bool:
"""Check if path is a git repository."""
return (path / ".git").exists()
def get_git_status(repo_path: Path) -> Tuple[bool, List[str]]:
"""Get git status for repository."""
if not is_git_repository(repo_path):
return False, ["Not a git repository"]
returncode, stdout, stderr = run_command(
["git", "status", "--porcelain"],
cwd=repo_path
)
if returncode != 0:
return False, [stderr.strip()]
changes = [line.strip() for line in stdout.splitlines() if line.strip()]
return len(changes) == 0, changes
def validate_project_name(project_name: str, available_projects: List[str]) -> bool:
"""Validate project name against available projects."""
return project_name in available_projects
def format_file_size(size_bytes: int) -> str:
"""Format file size in human readable format."""
for unit in ['B', 'KB', 'MB', 'GB']:
if size_bytes < 1024.0:
return f"{size_bytes:.1f}{unit}"
size_bytes /= 1024.0
return f"{size_bytes:.1f}TB"
def count_lines(file_path: Path) -> int:
"""Count lines in a file."""
try:
with open(file_path, 'r', encoding='utf-8') as f:
return sum(1 for _ in f)
except (OSError, UnicodeDecodeError):
return 0
def find_project_directories(base_path: Path, projects: List[str]) -> dict:
"""Find project directories relative to base path."""
project_dirs = {}
# Look for directories matching project names
for project in projects:
project_path = base_path / project
if project_path.exists() and project_path.is_dir():
project_dirs[project] = project_path
return project_dirs
def check_command_available(command: str) -> bool:
"""Check if a command is available in PATH."""
try:
subprocess.run([command, "--version"],
capture_output=True,
check=True)
return True
except (subprocess.CalledProcessError, FileNotFoundError):
return False
def get_platform_info() -> dict:
"""Get platform information."""
import platform
return {
"system": platform.system(),
"release": platform.release(),
"machine": platform.machine(),
"python_version": platform.python_version(),
"python_implementation": platform.python_implementation(),
}
class ProgressManager:
"""Context manager for rich progress bars."""
def __init__(self, description: str = "Processing..."):
self.description = description
self.progress = None
self.task = None
def __enter__(self):
self.progress = Progress(
SpinnerColumn(),
TextColumn("[progress.description]{task.description}"),
console=console,
)
self.progress.start()
self.task = self.progress.add_task(self.description, total=None)
return self
def __exit__(self, exc_type, exc_val, exc_tb):
if self.progress:
self.progress.stop()
def update(self, description: str):
"""Update progress description."""
if self.progress and self.task is not None:
self.progress.update(self.task, description=description)
def safe_write_file(file_path: Path, content: str, backup: bool = True) -> bool:
"""Safely write content to file with optional backup."""
try:
# Create backup if file exists and backup requested
if backup and file_path.exists():
backup_path = file_path.with_suffix(file_path.suffix + ".bak")
backup_path.write_text(file_path.read_text(), encoding="utf-8")
# Ensure parent directory exists
file_path.parent.mkdir(parents=True, exist_ok=True)
# Write content
file_path.write_text(content, encoding="utf-8")
return True
except (OSError, UnicodeError) as e:
console.print(f"[red]Error writing file {file_path}: {e}[/red]")
return False
def confirm_action(message: str, default: bool = False) -> bool:
"""Ask user for confirmation."""
if not sys.stdin.isatty():
return default
suffix = " [Y/n]: " if default else " [y/N]: "
response = input(message + suffix).strip().lower()
if not response:
return default
return response in ('y', 'yes', 'true', '1')

View File

@@ -0,0 +1,59 @@
#!/usr/bin/env python3
"""Claude CLI main entry point."""
import click
from rich.console import Console
from rich.table import Table
from . import __version__
from .commands import generate, sync, submodules
console = Console()
@click.group()
@click.version_option(version=__version__)
@click.option("--verbose", "-v", is_flag=True, help="Enable verbose output")
@click.pass_context
def cli(ctx: click.Context, verbose: bool) -> None:
"""Claude AI ecosystem management CLI.
Unified command-line interface for managing Claude AI projects,
documentation generation, synchronization, and submodule management.
Features:
• Generate project documentation with ai.gpt integration
• Sync documentation across multiple projects
• Advanced submodule management with ai.json integration
• Cross-platform compatibility (macOS, Linux)
"""
ctx.ensure_object(dict)
ctx.obj["verbose"] = verbose
if verbose:
console.print(f"[bold blue]Claude CLI v{__version__}[/bold blue]")
console.print("[dim]Verbose mode enabled[/dim]")
@cli.command()
def info() -> None:
"""Show system information and project status."""
table = Table(title="Claude CLI System Information")
table.add_column("Component", style="cyan")
table.add_column("Value", style="green")
table.add_row("Version", __version__)
table.add_row("Python", click.get_current_context().find_root().info_name)
table.add_row("Platform", click.get_os_args()[0] if click.get_os_args() else "Unknown")
console.print(table)
# Register command groups
cli.add_command(generate.generate)
cli.add_command(sync.sync)
cli.add_command(submodules.submodules)
if __name__ == "__main__":
cli()

71
claude/cli/pyproject.toml Normal file
View File

@@ -0,0 +1,71 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "claude-cli"
version = "1.0.0"
description = "Claude AI ecosystem management CLI"
readme = "README.md"
authors = [
{name = "syui", email = "syui@syui.ai"},
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.9"
dependencies = [
"click>=8.0.0",
"rich>=13.0.0",
"jinja2>=3.0.0",
"pydantic>=2.0.0",
"pathlib-extensions>=0.1.0",
"gitpython>=3.1.0",
"tomli>=2.0.0; python_version<'3.11'",
"tomli-w>=1.0.0",
]
[project.optional-dependencies]
ai-gpt = [
"requests>=2.28.0",
"httpx>=0.24.0",
]
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"black>=22.0.0",
"isort>=5.10.0",
"mypy>=1.0.0",
]
[project.scripts]
claude = "claude_cli.main:cli"
[project.urls]
Homepage = "https://syui.ai"
Repository = "https://git.syui.ai/ai/ai"
Documentation = "https://syui.ai/ai"
[tool.hatch.build.targets.wheel]
packages = ["claude_cli"]
[tool.black]
line-length = 88
target-version = ['py39']
[tool.isort]
profile = "black"
line_length = 88
[tool.mypy]
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true

View File

@@ -162,6 +162,15 @@ FString SystemData = LoadJSON("ai.json").data.system;
- 物理的実在性を重視した命名
- 既存参照パスの破壊を避ける
## time
日付は`iso`形式です。
```sh
$ date --iso-8601=seconds
2025-06-07T07:27:16+09:00
```
---
**重要**: この文書はai.json更新時に必ず参照し、全体整合性を保つこと。
**重要**: この文書はai.json更新時に必ず参照し、全体整合性を保つこと。

View File

@@ -66,3 +66,12 @@ curl -sL https://git.syui.ai/ai/ai/raw/branch/main/ai.json | jq .ai.os
日本語でdocs, md, textを書く場合は特殊文字列を変換しないでください。できる限り英数文字をそのまま使うようにしてください。
## 日付の形式
日付は`iso`形式です。
```sh
$ date --iso-8601=seconds
2025-06-07T07:27:16+09:00
```

220
claude/projects/verse.md Normal file
View File

@@ -0,0 +1,220 @@
# ai.verse
## 概要
**現実とゲームを結合する3D世界** - atproto分散SNS統合メタバースプロジェクト
ai.verseは単なるゲームではなく、現実の個人の唯一性をデジタル世界で担保し、Play-to-Workを実現する革新的メタバースです。
## プロジェクト情報
- **タイプ**: metaverse
- **説明**: 現実とゲーム結合3D世界
- **ステータス**: UE実装予定
- **ブランチ**: main
- **技術**: Unreal Engine + atproto + Three.js
## 中核思想: yui system唯一性担保
### 基本原則
- **現実の個人 ↔ ゲーム内avatar**: 1:1紐付け改ざん不可能
- **atproto DID**: 暗号学的唯一性担保
- **unique skill**: その人だけが使えるスキル・能力
- **motion capture**: その人だけがカメラでキャラを動かせる
### 現実反映の仕組み
```
現実の個人 → atproto account (DID) → ゲーム内avatar → 固有スキル
↑_______________________________| (現実への反映)
```
## 4つのSystemに統合
### 1. verse.world system惑星型3D世界
**目的**: 従来の平面マップを現実的な惑星形式に変革
**特徴**:
- **立体ワールド**: 上を飛び続けると宇宙、下を掘ると地核
- **見えない場所にも世界**: プレイヤーが行けない場所も完全実装
- **物理法則**: 現実的な重力・大気・軌道システム
**実装**: `./world/book/` でUnreal Engine技術習得中
**省略記法**: `verse.ue.system.world``verse.world`
### 2. verse.at systematproto統合
**目的**: 分散SNSを基盤とした新しいゲーム体験
**特徴**:
- **現実SNS連携**: 実際のSNSアカウントでゲームプレイ
- **データ主権**: ゲームデータはユーザーのatprotoアカウントに保存
- **selfhost運用**: 独自atprotoサーバーで完全自律性
**実装**: `./at/` で分散SNS基盤構築済み
**省略記法**: `verse.ue.system.at``verse.at`
### 3. verse.yui system唯一性システム
**目的**: 現実の個人の唯一性をゲーム内で完全担保
**特徴**:
- **unique character**: 1キャラクター = 1プレイヤー他人は使用不可
- **unique skill**: プレイヤー固有の特殊能力
- **配信統合**: ゲーム画面 = 配信画面として使用可能
**VTuber活用例**: 声優さんが自分の声を使ったキャラクターでプレイ
**省略記法**: `verse.ue.system.yui``verse.yui`
### 4. verse.ai system存在属性
**目的**: 現実の物理法則を反映した属性システム
**特徴**:
- **原子属性**: 原子・中性子・陽子・電子に基づく属性
- **アイ属性**: 主人公キャラクターの固有属性(存在子理論)
- **物質探求**: この世界で最も小さいものの探求をゲーム化
**省略記法**: `verse.ue.system.ai``verse.ai`
## システム省略記法
ai.verseでは、`.ue`Unreal Engineが統合短縮されています
```bash
# 従来の長い記法
verse.ue.system.world → verse.world
verse.ue.system.at → verse.at
verse.ue.system.yui → verse.yui
verse.ue.system.ai → verse.ai
# ai.jsonでの参照
curl -sL git.syui.ai/ai/ai/raw/branch/main/ai.json | jq -r .ai.verse.ue.system.world
# ↓ 簡潔な記法
curl -sL git.syui.ai/ai/ai/raw/branch/main/ai.json | jq -r .ai.verse.world
```
この省略により、UE実装の複雑さを隠蔽し、よりシンプルなAPI設計を実現しています。
## 技術アーキテクチャ
### Unreal Engine実装
```
./world/
├── book/ # UE開発ガイドブック
├── blender/ # 3Dモデル制作ワークフロー
├── city/ # 都市環境構築技術
├── gasp/ # キャラクター実装
├── vrm4u/ # VRMアバター統合
└── web/ # Three.js Web統合
```
### atproto基盤
```
./at/
├── lexicons/ # atproto schema定義
├── item/card/ # カードアイテムデータ
├── envs/ # サーバー環境設定
└── scpt/ # 自動化スクリプト
```
### カード連携
```
./card/
├── img/ # カード画像アセット
└── src/ # Vue.js Web実装
```
## 統合エコシステム
### ai.card統合
- **ゲーム内アイテム**: ai.cardのカードをゲーム内で使用
- **物理カード化**: リアル⇔デジタル双方向連携
- **atproto保存**: カードデータはユーザーのatprotoアカウントに
### ai.gpt統合
- **NPC人格**: 自律AI人格がNPCとして存在
- **記憶システム**: プレイヤーとの過去の交流を記憶
- **関係性進化**: 継続的な交流で関係性が発展
### ai.bot統合
- **SNS連携**: atproto投稿でゲーム内イベント発生
- **双方向通信**: ゲーム⇔SNS相互影響システム
## メタバース浸透戦略
### フェーズ1: ゲームとして成立
- **面白さ優先**: まず普通に楽しいゲームを作る
- **技術実証**: UE + atproto + カード連携の動作確認
- **コア体験**: unique skillによる特別感の実現
### フェーズ2: 段階的メタバース化
- **現実連携**: SNS⇔ゲーム双方向連携強化
- **配信統合**: VTuber配信用プラットフォーム化
- **経済システム**: Play-to-Work要素の段階的導入
### フェーズ3: 現実融合
- **生活統合**: 現実の仕事・生活のゲーム化
- **価値創出**: ゲーム内活動の現実価値化
- **社会実装**: 新しい働き方・生き方の実現
## 開発状況
### 完成済み
- ✅ atproto基盤構築./at/
- ✅ カード連携準備(./card/
- ✅ UE学習環境./world/book/
- ✅ yui system設計
### 実装中
- 🔄 Unreal Engine 3D世界構築
- 🔄 atproto ↔ UE連携システム
- 🔄 unique skill実装
### 実装予定
- ⏳ VRM avatar統合
- ⏳ motion capture機能
- ⏳ 配信プラットフォーム統合
- ⏳ Play-to-Work経済システム
## 技術的特徴
### 革新的要素
- **惑星型ワールド**: 平面マップの限界を突破
- **データ主権**: ゲームデータをプレイヤーが完全所有
- **唯一性担保**: 暗号学的に保証された個人性
- **現実融合**: SNS⇔ゲーム⇔現実の三位一体
### 従来ゲームとの違い
| 要素 | 従来ゲーム | ai.verse |
|------|-----------|----------|
| データ所有権 | 運営会社 | プレイヤー |
| キャラクター | 複製可能 | 唯一性担保 |
| 世界構造 | 平面マップ | 惑星型3D |
| SNS連携 | なし/形式的 | 分散SNS基盤 |
| 現実価値 | ゲーム内限定 | 現実反映 |
## 未来ビジョン
### 短期目標1-2年
- UE基本実装完了
- unique skill demo実装
- atproto ↔ UE連携確立
### 中期目標3-5年
- VTuber配信プラットフォーム化
- 経済システム本格稼働
- ユーザーコミュニティ形成
### 長期目標5-10年
- **Play-to-Work社会実現**: 仕事・生活・ゲームの境界消失
- **メタバース一般化**: VRChatのような社会インフラ化
- **新しい文明形態**: デジタル⇔物理融合社会の先駆け
## 哲学的意義
ai.verseは単なるエンターテインメントではなく、**人類の新しい存在形態の実験場**です。
- **存在子理論**: この世界で最も小さいものaiの探求
- **唯一性原則**: 現実の個人性をデジタルで完全担保
- **現実反映**: デジタルと物理の境界を溶かす新しい世界観
**「現実とゲームの境界がなくなる未来」**の実現を目指します。
---
*このドキュメントはai.verse submoduleの構造と哲学を基に生成されました*

2
game

Submodule game updated: c187dc11ce...0bb807c8bc

2
gpt

Submodule gpt updated: b410c83605...582b983a32

1
log Submodule

Submodule log added at c0e4dc63ea

2
os

Submodule os updated: 55436e61ee...4d0a7f3889

2
verse

Submodule verse updated: 304a54def5...1791fe0cee

1
wiki Submodule

Submodule wiki added at d559b3b23f