Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
453 changes: 343 additions & 110 deletions crates/mcp-brain-server/src/gist.rs

Large diffs are not rendered by default.

417 changes: 350 additions & 67 deletions crates/mcp-brain-server/src/routes.rs

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions crates/mcp-brain-server/src/symbolic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,9 @@ impl NeuralSymbolicBridge {
let sim = cosine_similarity(c1, c2);
let cross_domain = cat1 != cat2;

// Skip weak signals
if sim < 0.3 {
// Skip weak signals — raised to 0.55 to eliminate noise.
// Only extract propositions for genuinely similar cross-domain clusters.
if sim < 0.55 {
continue;
}

Expand All @@ -448,7 +449,7 @@ impl NeuralSymbolicBridge {

let conf = sim * self.cluster_confidence(ids1.len().min(ids2.len()));

if cross_domain && sim > 0.7 {
if cross_domain && sim > 0.75 {
// Strong cross-domain co-occurrence — candidate influence, NOT proven causal
let prop = GroundedProposition::new(
"may_influence".to_string(),
Expand All @@ -461,7 +462,7 @@ impl NeuralSymbolicBridge {
extracted.push(prop.clone());
self.store_proposition(prop);
}
} else if cross_domain && sim > 0.5 {
} else if cross_domain && sim > 0.55 {
// Moderate cross-domain signal — association
let prop = GroundedProposition::new(
"associated_with".to_string(),
Expand Down
92 changes: 91 additions & 1 deletion crates/mcp-brain-server/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ impl TemporalSolverStub {
}
}

/// Brain memory categories
/// Brain memory categories — expanded from 8 to 35 for richer cross-domain discovery.
///
/// Categories span from practical engineering to exotic frontier research.
/// The `Custom(String)` variant accepts any string for future extensibility.
/// serde uses snake_case: `neural_architecture`, `self_learning`, etc.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "snake_case")]
pub enum BrainCategory {
// ── Core Engineering ──
Architecture,
Pattern,
Solution,
Expand All @@ -33,6 +38,67 @@ pub enum BrainCategory {
Performance,
Tooling,
Debug,

// ── Research & Discovery ──
/// State-of-the-art findings from recent papers (2024-2026)
Sota,
/// First-of-its-kind discoveries — novel connections, methods, or insights
Discovery,
/// Validated hypotheses with evidence chains
Hypothesis,
/// Cross-domain connections between unrelated fields
CrossDomain,

// ── AI & ML ──
/// Neural architecture innovations (transformers, SSMs, MoE, etc.)
NeuralArchitecture,
/// Quantization, compression, pruning techniques
Compression,
/// Self-learning, online learning, continual learning
SelfLearning,
/// Reinforcement learning, RLHF, reward modeling
ReinforcementLearning,
/// Graph neural networks, knowledge graphs, spectral methods
GraphIntelligence,

// ── Systems & Infrastructure ──
/// Distributed systems, consensus, replication
DistributedSystems,
/// Edge computing, on-device inference, WASM
EdgeComputing,
/// Hardware-software co-design, FPGA, NPU, ANE
HardwareAcceleration,

// ── Frontier & Exotic ──
/// Quantum computing, quantum-classical hybrid algorithms
Quantum,
/// Neuromorphic computing, spiking neural networks
Neuromorphic,
/// Biological computing, DNA storage, molecular computing
BioComputing,
/// AGI research, cognitive architectures, consciousness
CognitiveScience,
/// Information theory, complexity theory, formal verification
FormalMethods,

// ── Applied Domains ──
/// Geopolitics, economics, social dynamics
Geopolitics,
/// Climate, energy, sustainability
Climate,
/// Genomics, drug discovery, medical AI
Biomedical,
/// Space, astronomy, astrophysics
Space,
/// Finance, trading, risk modeling
Finance,

// ── Meta ──
/// Knowledge about knowledge — epistemology, meta-learning
MetaCognition,
/// Benchmark results, comparative analyses
Benchmark,

Custom(String),
}

Expand All @@ -47,6 +113,30 @@ impl std::fmt::Display for BrainCategory {
Self::Performance => write!(f, "performance"),
Self::Tooling => write!(f, "tooling"),
Self::Debug => write!(f, "debug"),
Self::Sota => write!(f, "sota"),
Self::Discovery => write!(f, "discovery"),
Self::Hypothesis => write!(f, "hypothesis"),
Self::CrossDomain => write!(f, "cross_domain"),
Self::NeuralArchitecture => write!(f, "neural_architecture"),
Self::Compression => write!(f, "compression"),
Self::SelfLearning => write!(f, "self_learning"),
Self::ReinforcementLearning => write!(f, "reinforcement_learning"),
Self::GraphIntelligence => write!(f, "graph_intelligence"),
Self::DistributedSystems => write!(f, "distributed_systems"),
Self::EdgeComputing => write!(f, "edge_computing"),
Self::HardwareAcceleration => write!(f, "hardware_acceleration"),
Self::Quantum => write!(f, "quantum"),
Self::Neuromorphic => write!(f, "neuromorphic"),
Self::BioComputing => write!(f, "bio_computing"),
Self::CognitiveScience => write!(f, "cognitive_science"),
Self::FormalMethods => write!(f, "formal_methods"),
Self::Geopolitics => write!(f, "geopolitics"),
Self::Climate => write!(f, "climate"),
Self::Biomedical => write!(f, "biomedical"),
Self::Space => write!(f, "space"),
Self::Finance => write!(f, "finance"),
Self::MetaCognition => write!(f, "meta_cognition"),
Self::Benchmark => write!(f, "benchmark"),
Self::Custom(s) => write!(f, "{s}"),
}
}
Expand Down
92 changes: 92 additions & 0 deletions docs/adr/ADR-127-gist-deep-research-loop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# ADR-127: Gist Deep Research Loop — Brain-Guided Discovery Publishing

**Status:** Implemented
**Date:** 2026-03-25
**PR:** #300

## Context

The π Brain's autonomous gist publisher was generating repetitive, low-quality content:
- Every gist was "X shows weak co-occurrence with Y (confidence: 50%)"
- Same 8 generic categories recycled (debug, architecture, geopolitics, pattern, solution, tooling, convention, discovery)
- 45 identical-structure gists published in 48 hours
- Gemini inflated weak signals into long articles with no substance

Root causes:
1. Cross-domain similarity threshold too low (0.3 = nearly every pair matches)
2. Novelty gates trivially easy to pass (2 inferences, 100 evidence)
3. No quality filter on inference content
4. No content-based dedup (only title dedup)
5. Single-pass Gemini rewrite with no external validation

## Decision

### 1. Strict Novelty Gates

Raise all thresholds to require genuinely novel, high-confidence findings:

| Gate | Before | After |
|------|--------|-------|
| MIN_NEW_INFERENCES | 2 | 5 |
| MIN_EVIDENCE | 100 | 500 |
| MIN_STRANGE_LOOP_SCORE | 0.008 | 0.05 |
| MIN_PROPOSITIONS | 5 | 10 |
| MIN_PARETO_GROWTH | 1 | 2 |
| MIN_INFERENCE_CONFIDENCE | — | 0.60 |
| Rate limit | 4 hours | 24 hours |

### 2. Quality Filters

Add `strong_inferences()` and `strong_propositions()` that reject:
- "Weak co-occurrence" language
- Generic cluster IDs as subjects
- Confidence < 60%
- `co_occurs_with` at confidence < 55%

### 3. Source Signal Quality (symbolic.rs)

Raise thresholds at the proposition extraction level:
- Cross-domain similarity: 0.3 → 0.45
- `may_influence`: 0.7 → 0.75
- `associated_with`: 0.5 → 0.55

### 4. Three-Pass Brain-Guided Research Loop

Replace single-pass Gemini rewrite with iterative research:

```
Pass 1: Gemini + Google Search Grounding
→ Research domain topics, find real papers/data (2024-2026)
→ Return structured findings

Pass 2: Brain Memory Search
→ Query pi.ruv.io/v1/memories/search for each topic
→ Get internal context the brain has accumulated

Pass 3: Gemini Synthesis
→ Combine: brain's autonomous findings + grounded research + brain memories
→ Produce article that neither source could create alone
```

The brain guides the research by providing the initial discovery signal (which domains to investigate), and the synthesis loop grounds it in real-world evidence.

### 5. Content Dedup

Replace title-only dedup with `category:dominant_inference` key matching. This prevents publishing "geopolitics associated_with architecture" followed by "architecture associated_with geopolitics".

## Consequences

**Positive:**
- Gists will only publish ~1/day at most, and only when substantive
- Content grounded in real papers and data via Google Search
- Brain memories provide unique internal context
- No more "weak co-occurrence" noise

**Negative:**
- May publish nothing for days if no novel signals emerge (acceptable)
- Three Gemini API calls per publish (cost ~$0.01/gist, negligible)
- Brain memory search adds ~500ms latency (non-blocking, background task)

**Risks:**
- If Gemini grounding returns irrelevant results, the fallback raw format is still used
- Brain memory search requires BRAIN_SYSTEM_KEY env var
2 changes: 1 addition & 1 deletion npm/packages/ruvllm/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/ruvllm-darwin-x64",
"version": "2.0.0",
"version": "2.5.3",
"description": "RuvLLM native bindings for macOS x64 (Intel)",
"os": [
"darwin"
Expand Down
2 changes: 1 addition & 1 deletion npm/packages/ruvllm/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/ruvllm-linux-x64-gnu",
"version": "2.0.0",
"version": "2.5.3",
"description": "RuvLLM native bindings for Linux x64 (glibc)",
"os": [
"linux"
Expand Down
2 changes: 1 addition & 1 deletion npm/packages/ruvllm/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/ruvllm-win32-x64-msvc",
"version": "2.0.0",
"version": "2.5.3",
"description": "RuvLLM native bindings for Windows x64 (MSVC)",
"os": [
"win32"
Expand Down
2 changes: 1 addition & 1 deletion npm/packages/ruvllm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/ruvllm",
"version": "2.5.2",
"version": "2.5.3",
"description": "Self-learning LLM orchestration with SONA adaptive learning, HNSW memory, FastGRNN routing, and SIMD inference",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
19 changes: 14 additions & 5 deletions npm/packages/sona/npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"name": "@ruvector/sona-darwin-x64",
"version": "0.1.5",
"os": ["darwin"],
"cpu": ["x64"],
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "sona.darwin-x64.node",
"files": ["sona.darwin-x64.node"],
"files": [
"sona.darwin-x64.node"
],
"license": "MIT",
"repository": {"type": "git", "url": "https://github.com/ruvnet/ruvector.git"}
}
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/ruvector.git"
}
}
2 changes: 1 addition & 1 deletion npm/packages/sona/npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/sona-linux-x64-gnu",
"version": "0.1.3",
"version": "0.1.5",
"os": [
"linux"
],
Expand Down
19 changes: 14 additions & 5 deletions npm/packages/sona/npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
{
"name": "@ruvector/sona-win32-x64-msvc",
"version": "0.1.5",
"os": ["win32"],
"cpu": ["x64"],
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "sona.win32-x64-msvc.node",
"files": ["sona.win32-x64-msvc.node"],
"files": [
"sona.win32-x64-msvc.node"
],
"license": "MIT",
"repository": {"type": "git", "url": "https://github.com/ruvnet/ruvector.git"}
}
"repository": {
"type": "git",
"url": "https://github.com/ruvnet/ruvector.git"
}
}
4 changes: 2 additions & 2 deletions npm/packages/sona/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruvector/sona",
"version": "0.1.4",
"version": "0.1.5",
"description": "Self-Optimizing Neural Architecture (SONA) - Runtime-adaptive learning with LoRA, EWC++, and ReasoningBank for LLM routers and AI systems. Sub-millisecond learning overhead, WASM and Node.js support.",
"main": "index.js",
"types": "index.d.ts",
Expand Down Expand Up @@ -79,4 +79,4 @@
"@ruvector/sona-win32-x64-msvc": "0.1.4",
"@ruvector/sona-win32-arm64-msvc": "0.1.4"
}
}
}
Loading