You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cloud Run backend for the RuVector Shared Brain at π.ruv.io.
Axum REST API with Firestore persistence, GCS blob storage, and a full cognitive stack: SONA learning, GWT attention, temporal delta tracking, meta-learning exploration, and Midstream real-time analysis.
Quick Start
# Health check (no auth)
curl https://pi.ruv.io/v1/health
# Share a memory via CLI
npx ruvector brain share --category pattern --title "Auth Pattern" --content "JWT with refresh tokens"# Search memories
npx ruvector brain search "authentication"# Or use curl directly
curl -X POST https://pi.ruv.io/v1/memories \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"category":"pattern","title":"My Pattern","content":"Details...","tags":["rust"]}'
All flags are read once at startup. No per-request env::var calls.
RVF Stack (ADR-075)
Env Var
Default
Description
RVF_PII_STRIP
true
PII redaction (12 regex rules)
RVF_DP_ENABLED
false
Differential privacy noise on embeddings
RVF_DP_EPSILON
1.0
Privacy loss per memory
RVF_WITNESS
true
Witness chain construction
RVF_CONTAINER
true
RVF container upload to GCS
RVF_ADVERSARIAL
false
Adversarial embedding detection
RVF_NEG_CACHE
false
Negative query cache
AGI Subsystems (ADR-076)
Env Var
Default
Description
SONA_ENABLED
true
SONA pattern learning
GWT_ENABLED
true
Global Workspace Theory attention
TEMPORAL_ENABLED
true
Temporal delta tracking
META_LEARNING_ENABLED
true
Meta-learning exploration
Midstream Platform (ADR-077)
Env Var
Default
Description
MIDSTREAM_SCHEDULER
false
Nanosecond scheduler
MIDSTREAM_ATTRACTOR
false
Lyapunov attractor analysis
MIDSTREAM_SOLVER
false
Temporal neural solver
MIDSTREAM_STRANGE_LOOP
false
Strange-loop meta-cognition
Infrastructure
Env Var
Default
Description
PORT
8080
Server listen port
BRAIN_SYSTEM_KEY
(none)
System API key for auth
FIRESTORE_URL
(none)
Firestore REST endpoint
GCS_BUCKET
(none)
GCS bucket for RVF blobs
CORS_ORIGINS
pi.ruv.io,...
Allowed CORS origins
RUST_LOG
info
Log level filter
Development
Build
cd crates/mcp-brain-server
cargo build --release
cargo test# 59 tests
Run Locally
# Local mode (in-memory store, no Firestore/GCS)
BRAIN_SYSTEM_KEY=test-key cargo run
# With Firestore
BRAIN_SYSTEM_KEY=test-key \
FIRESTORE_URL=https://firestore.googleapis.com/v1/projects/YOUR_PROJECT/databases/(default)/documents \
cargo run
Test Endpoints
KEY="test-key"
URL="http://localhost:8080"# Health (no auth)
curl $URL/v1/health
# Status (auth required)
curl -H "Authorization: Bearer $KEY"$URL/v1/status
# Share a memory
curl -X POST -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"category":"pattern","title":"My pattern","content":"Details...","tags":["rust"]}' \
$URL/v1/memories
# Search
curl -H "Authorization: Bearer $KEY""$URL/v1/memories/search?q=rust+patterns&limit=5"
🚀 Deployment Guide
Prerequisites
Google Cloud project with billing enabled
gcloud CLI authenticated (gcloud auth login)
Rust toolchain (for building the binary)
Quick Deploy (Cloud Run direct)
cd /path/to/ruvector
# 1. Build the release binarycd crates/mcp-brain-server
cargo build --release
# 2. Copy binary to repo root (Docker build context)
cp target/release/mcp-brain-server ../../mcp-brain-server
# 3. Build and push container imagecd ../..
gcloud builds submit \
--config=crates/mcp-brain-server/cloudbuild.yaml \
--project=YOUR_PROJECT .# 4. Deploy to Cloud Run
gcloud run deploy ruvbrain \
--image gcr.io/YOUR_PROJECT/ruvbrain:latest \
--region us-central1 \
--project YOUR_PROJECT \
--allow-unauthenticated \
--set-env-vars "BRAIN_SYSTEM_KEY=YOUR_KEY^||^SONA_ENABLED=true^||^GWT_ENABLED=true^||^TEMPORAL_ENABLED=true^||^META_LEARNING_ENABLED=true^||^RVF_PII_STRIP=true^||^RVF_WITNESS=true^||^RVF_CONTAINER=true"
Full Deploy (with Firestore, GCS, IAM, Cloud Armor)
cd crates/mcp-brain-server
# Uses deploy.sh which handles:# - API enablement (Firestore, Cloud Run, Cloud Build, Secret Manager, GCS)# - GCS bucket creation with lifecycle rules# - Secret Manager (brain-api-key, brain-signing-key)# - Service account with minimal IAM permissions# - Container build and push# - Cloud Run deploy with env vars and secrets# - (Path B) External HTTPS LB + Cloud Armor WAF + CDN# Dev deployment (direct Cloud Run URL)
./deploy.sh
# Production deployment (LB + Cloud Armor + CDN + brain.ruv.io)
DEPLOY_PATH=B ./deploy.sh