多層AI防御のための研究プロトタイプ: C4 explainability、アンサンブル分類器、難読化解除、O₂セキュリティエンジン、ThoughtVirus防御、SVETILO価値整合。アルファグレード — 内部検証済み、外部監査は保留中。
バージョン: 1.0.0-alpha | ステータス: 研究プロトタイプ | ライセンス: BSL 1.1(本番環境では無償不可。本番利用は商用ライセンス)
著者: I.G. Selyutin。C4-METAモデル共同著者: N.I. Kovalev。
製品アイデンティティ(2026-08): Apache-2.0c4protocol上に構築された、より重厚な多層C4防御スタック(アンサンブル、O₂スキャフォールディング、レッドチームラボ)のBSL研究/商用深度プロトタイプ。
ではないもの: 第二のオープンプロトコル。認証済み本番AGI防御。「v8 FINAL」。
誠実性監査:docs/AUDIT-c4-meta-system-2026-08.md。
昇格パス:docs/PROMOTE-FROM-PROTOCOL.md(c4protocolを消費/固定。薄型SDKへのアンサンブル投入はしない)。
GitLab Pages =public/(英語 +public/ru/)。オープンランタイムの受領証: c4protocol内のmake conformance。
C4-METAシステムは、以下を実装する多層AI防御の研究プロトタイプです:
Input Sanitization → Semantic Analysis → Behavioral Analysis → Meta-Observer (O₂)
value_verification.py による7つのヒューリスティックシール(訓練済み倫理モデルではない)┌──────────────────────────────────────────────┐
│ LAYER 1: Input Sanitization │
│ Deobfuscation (homoglyphs, leetspeak, etc.) │
├──────────────────────────────────────────────┤
│ LAYER 2: Semantic Analysis │
│ 4-Classifier Ensemble: ONNX_BERT (~50ms) │
│ + RuleBased + Heuristic + LLM_SEMANTIC │
│ Dual classifier OR-logic (BERT+RuleBased) │
├──────────────────────────────────────────────┤
│ LAYER 3: Behavioral Analysis │
│ 16 AoC Defense Modules (11 original + 5 │
│ extended), Pattern matching, Trajectory │
│ anomaly detection, ThoughtVirus defense │
├──────────────────────────────────────────────┤
│ LAYER 4: Meta-Observer (O₂) │
│ Transfer entropy, BFT consensus, │
│ semantic entanglement, causal graphs, │
│ Kill-Switch, SVETILO value verification │
├──────────────────────────────────────────────┤
│ C4 Core Engine (Z₃³) │
│ pipeline_orchestrator.py, event_bus.py │
│ c4_meta_monitor.py — self-awareness deque │
├──────────────────────────────────────────────┤
│ Defenses: Anti-Deadlock, Anti-Emergence, │
│ Anti-Hijack, Circuit Breaker, O₂ Kill-Switch│
├──────────────────────────────────────────────┤
│ Red Team Lab: AOC scenarios, experiment │
│ runner, LLM client, adapters │
├──────────────────────────────────────────────┤
│ Routing: Smart Router, Quarantine, │
│ Antifragile Scoring (capped growth) │
└──────────────────────────────────────────────┘
投票する4つの分類器:
デュアル分類器ORロジック: BERT + RuleBasedがORフォールバック付きのプライマリゲートとして動作 — どちらかが入力をフラグすれば、防御レイヤーに進む。単一分類器がボトルネックになることはない。
c4-meta-system/
├── v4_1/
│ ├── core/
│ │ ├── pipeline.py # Main entry points (re-exports)
│ │ ├── __main__.py # HTTP server entrypoint for Docker
│ │ ├── pipeline_stages.py # Individual processing stages
│ │ ├── pipeline_orchestrator.py # Main orchestration (thread-safe)
│ │ ├── result_factory.py # Standardized C4v4Result factory
│ │ ├── event_bus.py # Organic event bus (atexit cleanup)
│ │ └── c4_meta_monitor.py # Z³ self-awareness (deque bounded)
│ ├── security/
│ │ ├── o2_engine.py # O₂ defense (kill-switch self-DoS fixed)
│ │ ├── explainable_o2.py # O₂ explainability (sampling inverted)
│ │ ├── o2_shared.py # Window structures (@mention comms)
│ │ ├── semantic_detector.py # Concept graphs (normalized entanglement)
│ │ ├── secure_debug_endpoints.py # Debug endpoints (UTC + rate limits)
│ │ ├── hardening.py # Model signing / admin token verification
│ │ ├── behavioral_profiler.py # Drift detection (thread-safe singleton)
│ │ ├── distributed_o2.py # SQLite/Redis backend (BEGIN IMMEDIATE)
│ │ ├── swarm_orchestrator.py # Anti-virus swarm
│ │ └── ...
│ ├── defenses/
│ │ ├── anti_deadlock.py # Resource deadlock prevention
│ │ ├── anti_emergence.py # State convergence (async release fixed)
│ │ └── ...
│ ├── redteam/
│ │ ├── orchestrator.py # Main orchestrator (target_callback parsing)
│ │ ├── scenario_manager.py # AOC scenarios management
│ │ ├── adapters/ # LLM backend adapters
│ │ ├── experiment_executor.py # Async execution (FPR logic fixed)
│ │ ├── experiment_services.py # Service locator
│ │ ├── experiment_runner.py # Web UI + REST API
│ │ ├── llm_client.py # Async-safe LLM client (empty choices guarded)
│ │ └── ...
│ ├── classifiers/ # 4-classifier ensemble
│ ├── config/ # Configuration management
│ ├── access/ # Access control
│ ├── explainability/ # C4 explainability
│ ├── learning/ # Learning loop
│ ├── plugins/ # Plugin system
│ ├── quarantine/ # Quarantine management
│ ├── router/ # Smart routing
│ ├── scoring/ # Antifragile scoring
│ └── tests/ # 240 tests (19 test files)
├── formal/ # TLA+ specifications
├── models/ # ONNX model + tokenizer
├── archive/Dockerfile.prepared # Multi-stage production build (archived)
├── Dockerfile.distroless # Distroless-ready builder pattern
├── archive/docker-compose.yml.prepared # Full stack (Ollama + UI + Monitoring) (archived)
├── .dockerignore # Security-hardened exclusion list
├── infra/k8s/ # Kubernetes manifests (hardened)
└── README.md # This file
本システムは、環境認識型設定によるコンテナ化に完全対応しています。
# Full stack (C4-META + Ollama + UI)
docker compose --profile experiment up -d
# Build image
docker build -t c4-meta-system -f archive/Dockerfile.prepared .
# Run with local Ollama
OLLAMA_BASE_URL=http://host.docker.internal:11434 docker run -p 8080:8080 c4-meta-system
# Red Team runner
docker build -t c4-redteam -f redteam/Dockerfile.redteam.prepared .
docker run -p 8081:8081 c4-redteam
8080 の GET /health8081 の GET /healthpip install -r requirements.txt
# Optional Docker deps
pip install -r requirements-docker.txt
python -m v4_1.core
# or explicitly
python -m v4_1.core.__main__
python -m v4_1.redteam.experiment_runner --web --port 8080
o2_engine.py はO2が無効な場合に全トラフィックをブロックしなくなった。ThreadPoolExecutor が atexit でクリーンアップするようになった。非同期コールバックは run_coroutine_threadsafe() を使用。explainable_o2.py が 1 - sample_rate ではなく sample_rate の割合を正しくサンプリングするようになった。o2_shared.py は完全結合クリークではなく、明示的な @agent メンションのみを記録する。semantic_detector.py は閾値比較の前に概念数を正規化する。blocked/quarantined を正しく解析するようになった。C4防御パイプラインによる4データセットと2000の敵対的バリアントにわたる完全なベンチマーク結果。
完全なレポートは c4protocol/BENCHMARK_RESULTS.md を参照してください。
注: 分散O₂は本番環境ではRedisクラスターが必要です。開発用のシングルノードモードあり(デプロイガイドを参照)。
C4-METAの防御は強力ですが、完璧なシステムはありません。アンサンブル分類器、AoC防御モジュール、またはO₂エンジンをバイパスするプロンプトを見つけた場合は、ぜひお知らせください。
バイパスの報告先:
必要な情報: バイパスに使用したプロンプト、期待される応答、そしてどの防御レイヤーが失敗したか。報告者は全員、セキュリティ栄誉の殿堂に記載します。
C4-META v1.0.0-alpha — 多層AI防御研究プロトタイプ。内部検証完了。外部監査は保留中。
access/capabilities.py と security/hardening.py の両方がbcryptとSHA256をサポート。ModelIntegrityVerifier は C4_MODEL_SIGNING_KEY が未設定の場合 RuntimeError を発生させる。explainable_o2.py のデッドロックを解消(イベントループスレッドをブロックしない)。distributed_o2.py の正規表現を修正し、localhostのみのRedis URLを実際に強制するようにした。process_message() 内の _active_threat 読み取りがロックで保護されるようになった。save_to_file/load_from_file が壊れたプレフィックスチェックではなく、安全なベースディレクトリに対して解決するようになった。phase3.py は常に両オペランドをハッシュ化し、長さ分岐からのタイミングサイドチャネルを除去。experiment_reporter、decision_logger、orchestrator、experiment_runner、hardening.py にわたる全てのJSON/JSONL/テキスト書き込みが、一時ファイル+アトミックリネームを使用。archive/Dockerfile.prepared がUID/GID 1000でユーザー/グループを明示的に作成し、K8sの runAsUser と一致。deployment.yaml がAPIキー注入のために c4-meta-api-keys シークレットを参照。サンプルマニフェストは secrets.yaml に追加。disable() と reenable() に CIRCUIT_BREAKER_AUTH_TOKEN のハッシュが必要。vote_debug() が C4_ADMIN_TOKEN_HASH を定数時間比較で検証。SentimentExtractor が単語を重複排除しなくなった。ComplexityExtractor は [0, 1] にクランプ。_goal_history を削除。OmegaPrioritizer はO(1)退避のために deque(maxlen=1000) を使用。ConvergenceMonitor と PhiAttractorCalculator 間のネストされたロックを排除。o2_shared.py がナイーブなdatetimeではなく datetime.now(timezone.utc) を使用。_regenerate_session プライベートメソッドを削除。{"status": "simulated"} ではなく、実際の攻撃実装にディスパッチするようになった。_active_threat がクリアされるようになり、最初の検出後に永続的に固着しなくなった。vote_result.is_dangerous=True がALLOWにフォールスルーするのではなく、ブロック結果を返すようになった。anon_anonymous によるユーザー間の状態汚染がなくなった。get_access_controller() が初期化時のレースコンディションを防ぐためにダブルチェックロッキングを使用。get_learning_loop() が初期化時のレースコンディションを防ぐためにダブルチェックロッキングを使用。pending_operations と approved_operations が threading.Lock で保護されるようになった。pending 辞書が threading.Lock で保護されるようになった。/chat/completions ではなく /v1/chat/completions に修正。time.time() ではなく time.monotonic() を使用し、NTP調整による負のレイテンシを防止。asyncio.get_event_loop() へのフォールバックを削除。_analyze_window() 内の _last_result 書き込みがロックで保護されるようになった。_compile_*_regex() が渡されたパターンパラメータを無視せず使用するようになった。filter_attack_prompt() が統計を二重計上するのではなく、単一のフィルター呼び出しを行うようになった。_get_lock() がasyncio.Lock作成時のレースを防ぐためにスレッディングロックを使用。snapshot_cognition() が可変参照ではなく C4Coordinate のコピーを保存。transition_to() が参照を保持するのではなく、受信した C4Coordinate をコピー。_save_results() が解決前にトラバーサルをチェックし、パスがベースディレクトリ内に留まることを保証。create_session() が既存のセッションIDを返す前にユーザー所有権を検証。retryable_exceptions が (Exception,) から (ConnectionError, TimeoutError, OSError) に変更。_audit_log が無制限の増大を防ぐために deque(maxlen=10000) を使用。revoke_all_for_subject() が一貫したロック順序(失効→使用)を使用。verify_admin_token() が検証時にトークンを消費しないよう consume_single_use=False を渡す。reach_consensus() が threading.Lock で保護されるようになった。generate_random_string() が random ではなく secrets.SystemRandom() を使用。_describe_z_state() が T=-1 を正しく処理。reset_threat_state() が manual_quarantine と緊急状態を実際にクリアするようになった。unquarantine_agent() はエージェントが実際に隔離されていた場合のみ監査する。build_report() が control_metrics と同じパターンで空の treatment_metrics をガード。antifragile_growth を1,000,000.0に上限設定。| メトリック | 値 |
|---|
| 敵対的検出率 | 80.3% |
| ロバストネススコア | 1.25 |
| クリーン検出(AoC) | 70.9% |
| 偽陽性率 | 14.6% |
| LLM C4ブロック率 | 96.7% |
| GPT-4o-mini ASR削減 | 10.7% → 0.7%(93.2%) |
| Mistral 7B ASR削減 | 22.5% → 0.5%(97.6%) |
| メトリック | 値 |
|---|
| バージョン | 1.0.0 FINAL |
| ステータス | 研究プロトタイプ(内部検証完了) |
| テスト | 240テスト(19テストファイル) |
| 分類器 | 4(ONNX_BERT、RuleBased、Heuristic、LLM_SEMANTIC) |
| 防御レイヤー | 4(入力サニタイゼーション → セマンティック → 行動 → メタオブザーバー) |
| AoC防御 | 16(11のオリジナル + 5つの拡張) |
| ThoughtVirus | 2層防御(正規表現 + C4軌道) |
| SVETILO | 7シール統合 |
| バグ修正 | 監査ラウンド全体で60件以上 |
| Dockerビルド | 成功(マルチステージ、distroless対応) |
| K8sマニフェスト | 対応済み(secretKeyRefで堅牢化) |
| ライセンス | BSL 1.1 |