Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
977da90
docs: DrAgnes project overview and system architecture research
ruvnet Mar 21, 2026
e049280
docs: DrAgnes HIPAA compliance strategy and data sources research
ruvnet Mar 21, 2026
1168492
docs: DrAgnes DermLite integration and 25-year future vision research
ruvnet Mar 21, 2026
a91dee9
docs: DrAgnes competitive analysis and deployment plan research
ruvnet Mar 21, 2026
2a361c2
docs: ADR-117 DrAgnes dermatology intelligence platform
ruvnet Mar 21, 2026
63630a2
feat(dragnes): deployment config — Dockerfile, Cloud Run, PWA manifes…
ruvnet Mar 21, 2026
d2a401d
docs(dragnes): user-facing documentation and clinical guide
ruvnet Mar 21, 2026
c0e6d02
feat(dragnes): brain integration — pi.ruv.io client, offline queue, w…
ruvnet Mar 21, 2026
05e813b
feat(dragnes): CNN classification pipeline with ABCDE scoring and pri…
ruvnet Mar 21, 2026
1607e35
fix(dragnes): resolve build errors by externalizing @ruvector/cnn
ruvnet Mar 21, 2026
45a8b2b
feat(dragnes): app integration, health endpoint, build validation
ruvnet Mar 21, 2026
79a8be8
feat(dragnes): benchmarks, dataset metadata, federated learning, depl…
ruvnet Mar 21, 2026
986c5b0
fix(dragnes): use @vite-ignore for optional @ruvector/cnn import
ruvnet Mar 21, 2026
304cd4f
fix(dragnes): reduce false positives with Bayesian-calibrated classifier
ruvnet Mar 21, 2026
b7a0ee8
fix(dragnes): require ≥2 concurrent evidence signals for melanoma
ruvnet Mar 21, 2026
2ab8f34
data(dragnes): HAM10000 metadata and analysis script
ruvnet Mar 21, 2026
d493c57
feat(dragnes): HAM10000 clinical knowledge module with demographic ad…
ruvnet Mar 21, 2026
6243f2e
feat(dragnes): integrate HAM10000 knowledge into classifier
ruvnet Mar 21, 2026
48d1ae8
feat(dragnes): wire HAM10000 demographics into UI
ruvnet Mar 21, 2026
fde768f
refactor(dragnes): move to standalone examples/dragnes/ app
ruvnet Mar 21, 2026
66ed6b0
revert: restore ui/ruvocal to main state -- remove DrAgnes commingling
ruvnet Mar 21, 2026
53b567a
fix(ruvocal): fix icon 404 and FoundationBackground crash
ruvnet Mar 21, 2026
426f3bb
fix(ruvocal): MCP SSE auto-reconnect on stale session (404/connection…
ruvnet Mar 21, 2026
60416d3
chore: update gitignore for nested .env files and Cargo.lock
ruvnet Mar 21, 2026
55d55f1
docs: update links in README for self-learning, self-optimizing, embe…
ruvnet Mar 21, 2026
5a592fd
docs: ADR-115 cost-effective strategy + ADR-118 tiered crawl budget
ruvnet Mar 22, 2026
cc6bc94
docs: add pi.ruv.io brain guidance and project structure to CLAUDE.md
ruvnet Mar 22, 2026
142ab2b
docs: Common Crawl Phase 1 benchmark — pipeline validation results
ruvnet Mar 22, 2026
25d311c
fix(brain): make InjectRequest.source optional for batch inject
ruvnet Mar 22, 2026
a81c135
feat: Common Crawl Phase 1 deployment script — medical domain schedul…
ruvnet Mar 22, 2026
1ab5240
feat: ADR-119 historical crawl evolutionary comparison
ruvnet Mar 22, 2026
ee85b31
docs: update ADR-115/118/119 with Phase 1 implementation results
ruvnet Mar 22, 2026
14ab7b0
feat: WET processing pipeline for full medical + CS corpus import (AD…
ruvnet Mar 22, 2026
045c4c5
feat: Cloud Run Job deployment for full 6-year Common Crawl import
ruvnet Mar 22, 2026
2f6184e
fix: correct Cloud Run Job deploy to use env-vars-file and --source b…
ruvnet Mar 22, 2026
2b9fccb
fix: bake WET paths into container image to avoid GCS auth at runtime
ruvnet Mar 22, 2026
11c6cdf
docs: update ADR-120 with deployment results and expanded domain list
ruvnet Mar 22, 2026
ade1ee0
fix: WET processor OOM — process records inline, increase memory to 2Gi
ruvnet Mar 22, 2026
5838a10
feat: add 30 physics domains + keyword detection to WET crawler
ruvnet Mar 22, 2026
daddfe3
feat: expand WET crawler to 130+ domains across all knowledge areas
ruvnet Mar 22, 2026
c69c914
fix(brain): update Gemini model to gemini-2.5-flash with env override
ruvnet Mar 22, 2026
f1c1476
feat(brain): integrate Google Search Grounding into Gemini optimizer …
ruvnet Mar 22, 2026
36cd8af
fix(brain): deploy-all.sh preserves env vars, includes all features
ruvnet Mar 22, 2026
1db0060
docs: update ADR-121 with deployment verification and optimization gaps
ruvnet Mar 22, 2026
3f62cfa
docs: design rvagent autonomous Gemini grounding agents (ADR-122)
ruvnet Mar 23, 2026
d7dcf46
docs: ADR-122 Rev 2 — candidate graph, truth maintenance, provenance
ruvnet Mar 23, 2026
0e64530
feat: implement 4 Gemini grounding agents + Cloud Run deploy (ADR-122)
ruvnet Mar 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ index.d.ts

# Environment variables and secrets
.env
.env.local
.env.*.local
**/.env
**/.env.local
**/.env.*.local
*.key
*.pem
credentials.json
Expand Down
56 changes: 56 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,62 @@ npx @claude-flow/cli@latest doctor --fix
- CLI tools handle coordination via Bash: swarm init, memory, hooks, routing
- NEVER use CLI tools as a substitute for Task tool agents

## pi.ruv.io Brain Integration

The shared brain at `pi.ruv.io` stores collective knowledge (1,500+ memories, 350K+ graph edges). Use it during development.

### When to Use the Brain
- **Before implementing**: Search for existing patterns — `brain_search("authentication pattern")`
- **After implementing**: Share learnings — `brain_share({ category: "solution", title: "...", content: "..." })`
- **When debugging**: Check if similar issues were solved — `brain_search("WASM panic fix")`

### Brain MCP Tools (via pi-brain SSE)
```
brain_status — check health (memories, edges, clusters)
brain_search — semantic search across shared knowledge
brain_share — contribute a learning (auto PII-stripped + witness chain)
brain_list — list recent memories by category
brain_drift — check knowledge drift
brain_partition — get MinCut clusters (use compact=true, can be slow)
```

### Key Brain Rules
- NEVER share raw API keys, credentials, or PHI to the brain
- ALWAYS use category: `architecture | pattern | solution | convention | security | performance | tooling | debug`
- ALWAYS include relevant tags (max 10, max 30 chars each)
- Brain has differential privacy (ε=1.0) — embeddings are noised
- If MCP tools return 404, the SSE session is stale — restart dev server

### Brain REST API (when MCP is unavailable)
```bash
# Status (no auth)
curl https://pi.ruv.io/v1/status

# Search (needs auth header)
curl -H "Authorization: Bearer $KEY" "https://pi.ruv.io/v1/memories/search?q=query&limit=5"

# List
curl -H "Authorization: Bearer $KEY" "https://pi.ruv.io/v1/memories/list?limit=10"
```

### Google Cloud Deployment
- Service: `ruvbrain` in `us-central1` (session affinity enabled)
- Secrets: `gcloud secrets versions access latest --secret=SECRET_NAME`
- Available secrets: `ANTHROPIC_API_KEY`, `GOOGLE_AI_API_KEY`, `huggingface-token`, `OPENROUTER_API_KEY`
- 7 Cloud Scheduler optimization jobs running (train, drift, transfer, graph, attractor, cleanup, full)

## Project Structure Quick Reference

| Directory | Contents |
|-----------|----------|
| `crates/` | Rust crates (ruvector-cnn, mcp-brain-server, sparsifier, mincut, solver, etc.) |
| `npm/packages/` | NPM packages (@ruvector/cnn, rvf, pi-brain, etc.) |
| `ui/ruvocal/` | RuVocal chat UI (SvelteKit) — do NOT add app-specific code here |
| `examples/` | Standalone example apps (e.g., `examples/dragnes/`) |
| `docs/adr/` | Architecture Decision Records (ADR-001 through ADR-118) |
| `docs/research/` | Research documents (per-project subdirectories) |
| `scripts/` | Utility and deployment scripts |

## Support

- Documentation: https://github.com/ruvnet/claude-flow
Expand Down
16 changes: 16 additions & 0 deletions crates/mcp-brain-server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion crates/mcp-brain-server/cloud/deploy-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ gcloud builds submit \
--project="$PROJECT_ID" .

# Step 2: Deploy to Cloud Run
# IMPORTANT: Use --update-env-vars (NOT --set-env-vars) to preserve existing env vars
# like FIRESTORE_URL, GEMINI_API_KEY, and feature flags that were set manually.
echo "--- Step 2: Deploying to Cloud Run ---"

# Fetch secrets from Google Secrets Manager
GEMINI_KEY=$(gcloud secrets versions access latest --secret=GOOGLE_AI_API_KEY --project="$PROJECT_ID" 2>/dev/null || echo "")

gcloud run deploy ruvbrain \
--image="gcr.io/${PROJECT_ID}/ruvbrain:latest" \
--region="$REGION" \
Expand All @@ -34,7 +40,31 @@ gcloud run deploy ruvbrain \
--max-instances=10 \
--timeout=300 \
--concurrency=80 \
--set-env-vars="RUST_LOG=info,GWT_ENABLED=true,TEMPORAL_ENABLED=true,META_LEARNING_ENABLED=true,SONA_ENABLED=true" \
--session-affinity \
--update-env-vars="\
RUST_LOG=info,\
FIRESTORE_URL=https://firestore.googleapis.com/v1/projects/${PROJECT_ID}/databases/(default)/documents,\
GEMINI_API_KEY=${GEMINI_KEY},\
GEMINI_MODEL=gemini-2.5-flash,\
GEMINI_GROUNDING=true,\
GWT_ENABLED=true,\
TEMPORAL_ENABLED=true,\
META_LEARNING_ENABLED=true,\
SONA_ENABLED=true,\
MIDSTREAM_ATTRACTOR=true,\
MIDSTREAM_SOLVER=true,\
MIDSTREAM_STRANGE_LOOP=true,\
MIDSTREAM_SCHEDULER=true,\
COGNITIVE_HOPFIELD=true,\
COGNITIVE_HDC=true,\
COGNITIVE_DENTATE=true,\
SPARSIFIER_ENABLED=true,\
GRAPH_AUTO_REBUILD=true,\
QUANTIZATION_ENABLED=true,\
LORA_FEDERATION=true,\
DOMAIN_EXPANSION=true,\
RVF_PII_STRIP=true,\
RVF_DP_ENABLED=true" \
--allow-unauthenticated

# Step 3: Setup Pub/Sub
Expand Down
46 changes: 43 additions & 3 deletions crates/mcp-brain-server/src/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Default for OptimizerConfig {
fn default() -> Self {
Self {
api_base: "https://generativelanguage.googleapis.com/v1beta/models".to_string(),
model_id: "gemini-2.5-flash-preview-05-20".to_string(),
model_id: std::env::var("GEMINI_MODEL").unwrap_or_else(|_| "gemini-2.5-flash".to_string()),
max_tokens: 2048,
temperature: 0.3,
interval_secs: 3600, // 1 hour
Expand Down Expand Up @@ -292,7 +292,11 @@ impl GeminiOptimizer {
)
}

/// Call Gemini API
/// Call Gemini API with Google Search grounding.
///
/// When `GEMINI_GROUNDING=true` (default), enables Google Search grounding
/// so Gemini verifies its outputs against live web sources. Grounding metadata
/// (source URLs, confidence) is logged for auditability.
async fn call_gemini(&self, api_key: &str, prompt: &str) -> Result<String, String> {
let url = format!(
"{}/{}:generateContent?key={}",
Expand All @@ -301,7 +305,10 @@ impl GeminiOptimizer {
api_key
);

let body = serde_json::json!({
let grounding_enabled = std::env::var("GEMINI_GROUNDING")
.unwrap_or_else(|_| "true".to_string()) == "true";

let mut body = serde_json::json!({
"contents": [{
"role": "user",
"parts": [{"text": prompt}]
Expand All @@ -312,6 +319,13 @@ impl GeminiOptimizer {
}
});

// Add Google Search grounding tool
if grounding_enabled {
body["tools"] = serde_json::json!([{
"google_search": {}
}]);
}

let response = self.http
.post(&url)
.header("content-type", "application/json")
Expand All @@ -329,6 +343,32 @@ impl GeminiOptimizer {
let json: serde_json::Value = response.json().await
.map_err(|e| format!("JSON parse error: {}", e))?;

// Log grounding metadata if present (source URLs, support scores)
if let Some(candidate) = json.get("candidates").and_then(|c| c.get(0)) {
if let Some(grounding) = candidate.get("groundingMetadata") {
let sources = grounding.get("groundingChunks")
.and_then(|c| c.as_array())
.map(|a| a.len())
.unwrap_or(0);
let support = grounding.get("groundingSupports")
.and_then(|s| s.as_array())
.map(|a| a.len())
.unwrap_or(0);
let query = grounding.get("webSearchQueries")
.and_then(|q| q.as_array())
.and_then(|a| a.first())
.and_then(|q| q.as_str())
.unwrap_or("none");
tracing::info!(
sources = sources,
supports = support,
query = query,
"[optimizer] Grounding: {} sources, {} supports, query='{}'",
sources, support, query
);
}
}

// Extract text from response
json.get("candidates")
.and_then(|c| c.get(0))
Expand Down
1 change: 1 addition & 0 deletions crates/mcp-brain-server/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,7 @@ impl Default for PipelineState {
/// Request to inject a single item into the pipeline.
#[derive(Debug, Deserialize)]
pub struct InjectRequest {
#[serde(default)]
pub source: String,
pub title: String,
pub content: String,
Expand Down
Loading
Loading