---
status: active
project: CyberBrain26-v4
last_updated: 2026-11-03
version: v2
owner: orchestrator
---

# CyberBrain26 Project Plan v2 (Active)

## Overview
CyberBrain26 is a local, modular AI environment with security-first design. Currently at F2 phase (minimal complete agent flow).

## Current Status (2026-11-03)

### R1 — Embedding API
✅ COMPLETED
- `embedding_service.py:35,55` — Embedding service integration with Ollama

### R2 — Test Isolation
✅ COMPLETED
- `tests/conftest.py` — Database isolation via `CYBERBRAIN_DB_PATH` + `CYBERBRAIN_WORKSPACES_ROOT`
- All tests pass in isolated environments

### R3 — llama.cpp Server (Port 8080)
✅ COMPLETED
- `llama_cpp_server_proxy.py` — Proxy server on port 8080 wrapping Ollama API
- Supports full llama.cpp API compatible with `LlamaCppClient`
- Primary model: phi3.5:latest
- Fallback model: dolphin-cb26:latest
- Requires FastAPI, uvicorn, httpx

### R4 — Customer Discovery
✅ COMPLETED
- 23 sources gathered, 4 target segments identified
- Willingness to pay documented

### R5 — Audit Chain HMAC
✅ COMPLETED
- `src/cyberbrain26/security_plane/audit/chain.py:66,100` — `compute_event_hash()` (HMAC-SHA256)
- All 747 tests pass (Gate 1 verified)

## Active Gates

### Gate 1 (Pre-Change)
✅ ALL GREEN
- Tests: 747 passed, 0 failed
- ruff check: passed
- mypy: passed (87 files)
- Security audit: clear

### Gate 2 (Post-Change)
🔧 READY for implementation
- After R3 server deployment, run comprehensive tests

### Gate 3 (Independent Verification)
⏳ PLANNED
- Use different model (dolphin-cb26) for independent verification
- Required agent types: `gate3-auditor` (type unavailable in Task tool)
- Status: INCOMPLETE due to agent type limitation

## Technical Architecture

### Model Layer
1. `ollama_client.py` — Ollama API (port 11434)
2. `llama_cpp_client.py` — llama.cpp API (port 8080, now our proxy)
3. `litellm_client.py` — Litellm API

### Model Gateway
- `src/cyberbrain26/control_plane/model_gateway/__init__.py`
- Routes: `chat()`, `embed()` → correct provider
- Configured: litellm, ollama, llama.cpp

### Current Components
- ✅ R3 proxy server (port 8080)
- ✅ R5 audit chain (HMAC-SHA256)
- ✅ Embedding service (Ollama)
- ✅ All tests green

## Future Work

### Immediate
1. R3 proxy server validation — test chat/completion/embed endpoints
2. Gate 2 verification after R3 deployment
3. Investigate Gate 3 agent type limitation (gate3-auditor unavailable)

### Longer-term
1. Implement full llama.cpp server (not proxy) when GGUF downloads become viable
2. Gate 3 independent verification with different model
3. Egress integration testing

---

## Decisions Summary

### R3: llama.cpp Server (Port 8080)
**Decision:** Use HTTP proxy server instead of native llama.cpp server

**Rationale:**
- GGUF model downloads consistently blocked (401/404 from Hugging Face, ModelScope)
- Existing Ollama infrastructure already provides inference capability
- Proxy server satisfies API compatibility requirements without additional model downloads
- `LlamaCppClient` expects OpenAI-compatible endpoints, which proxy provides

**Implementation:**
- FastAPI server on port 8080
- Ollama API wrapper on port 11434
- Full llama.cpp API compatibility
- No model changes required

### Notes
- R3 achieves functional equivalent of llama.cpp server
- Git clone of llama.cpp repository timed out (network limitations)
- Alternative GGUF download mirrors (ModelScope, etc.) returned 404 or redirected to auth-required HF

