Skip to main content
Glama

Cérebro 2.0

Kontextoptimierungsserver für OpenCode. Komprimiert LLM-Prompts über LLMLingua-2, injiziert Task-Protokolle und stellt einen Wissensgraphen für das 2. Gehirn bereit.

Architektur

┌─────────────────────────────────────────────────┐
│                  OpenCode                        │
│  ┌──────────────┐  ┌──────────────────────────┐ │
│  │ Plugin       │  │ MCP Client               │ │
│  │ (hooks)      │  │ (tools)                  │ │
│  └──────┬───────┘  └────────────┬─────────────┘ │
│         │                       │                │
└─────────┼───────────────────────┼────────────────┘
          │                       │
    ┌─────▼─────┐          ┌──────▼──────┐
    │ Compressor │          │ MCP Server  │
    │ LLMLingua-2│          │ + HTTP API  │
    └─────┬─────┘          └──────┬──────┘
          │                       │
    ┌─────▼───────────────────────▼──────┐
    │           @cerebro/core             │
    │  compressor · task-injector · brain │
    └────────────────────────────────────┘

Pakete

Paket

Beschreibung

@cerebro/core

Komprimierungs-Engine, Task-Injektor, Brain-Engine und Metriken

@cerebro/mcp-server

MCP-Stdio-Server + HTTP-API für das Dashboard

@cerebro/plugin

OpenCode-Plugin (Nachrichtenkomprimierung + Task-Injektion)

@cerebro/dashboard

Dashboard-UI mit Vite + React + Tailwind

Related MCP server: ContextStream MCP Server

Schnellstart

# Install dependencies
pnpm install

# Approve native builds (onnxruntime-node)
pnpm approve-builds

# Run tests
pnpm test

# Build all packages
pnpm -r build

# Start MCP server (stdio for OpenCode)
node packages/mcp-server/dist/index.js

# Start dashboard dev server
pnpm --filter @cerebro/dashboard dev

Konfiguration

Umgebungsvariablen (festgelegt in opencode.json unter environment):

Variable

Standard

Beschreibung

COMPRESSION_RATE

0.4

Komprimierungsrate (0.05–1.0, niedriger = mehr Komprimierung)

BRAIN_PATH

.context-brain

Pfad zur Wissensbasis des 2. Gehirns

DASHBOARD_PORT

4321

HTTP-API-Port für das Dashboard

ENABLE_TASK_INJECTION

true

Aktiviert die Injektion von Task-Protokollen

PROTECTED_PATTERNS

code,json,errors,system

Durch Kommas getrennte geschützte Blockmuster

OpenCode-Integration

Fügen Sie in opencode.json in Ihrem Projektstamm Folgendes hinzu:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "cerebro": {
      "type": "local",
      "command": ["node", "caminho/para/cerebro/packages/mcp-server/dist/index.js"],
      "environment": {
        "COMPRESSION_RATE": "0.4",
        "BRAIN_PATH": ".context-brain",
        "DASHBOARD_PORT": "4321",
        "ENABLE_TASK_INJECTION": "true"
      },
      "enabled": true
    }
  }
}

MCP-Tools

compress_prompt

Komprimiert Text mit LLMLingua-2 ONNX.

{ "text": "Your long prompt...", "rate": 0.4 }

brain_resolve

Fragt das 2. Gehirn nach einem Bildschirm und dessen per Wiki-Links verknüpften Abhängigkeiten ab.

{ "screen": "dashboard-vendas", "depth": 1 }

brain_index

Indiziert einen Bildschirm im Wissensgraphen oder aktualisiert ihn.

{
  "id": "dashboard-vendas",
  "content": "---\ntitle: Dashboard Vendas\n---\n\n# Dashboard Vendas\n\nMetrics for the sales dashboard."
}

brain_screens

Listet alle indizierten Bildschirme auf. Keine Parameter.

cerebro_metrics

Gibt Komprimierungsmetriken und Token-Ersparnisse aus. Keine Parameter.

cerebro_config

Ruft die Laufzeitkonfiguration ab oder setzt sie.

{ "key": "compressionRate", "value": 0.3 }

Dashboard

Das Dashboard läuft auf Port 4321 und bietet:

  • Métricas: Komprimierungsstatistiken, Token-Ersparnisse, letzten Ereignisse

  • 2º Cérebro: Durchsuchen Sie indizierte Bildschirme und deren Wiki-Links

  • Config: Laufzeitkonfiguration anzeigen und bearbeiten

pnpm --filter @cerebro/dashboard dev
# Open http://localhost:4321

Plugin-Hooks

Das OpenCode-Plugin bietet drei Hooks:

Hook

Beschreibung

experimental.chat.messages.transform

Komprimiert alte Nachrichten vor dem Senden an das LLM

experimental.chat.system.transform

Injiziert Task-Protokoll + Selbstheck in den System-Prompt

tool.execute.after

Protokolliert die Tool-Ausführung für die Sichtbarkeit im Dashboard

Entwicklung

# Type check all packages
pnpm -r typecheck

# Run tests
pnpm test

# Watch mode
npx vitest

# Build dashboard
pnpm --filter @cerebro/dashboard build

Tests

66 Tests in 6 Suiten:

packages/core/src/          task-injector.test.ts (18) · metrics.test.ts (5)
packages/mcp-server/src/    errors.test.ts (9) · rate-limiter.test.ts (7) · e2e.test.ts (10)
packages/plugin/src/        plugin.test.ts (8)

Ausführung mit: pnpm test oder npx vitest run

Lizenz

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Provides intelligent code context and analysis through semantic compression, AST parsing, and multi-language support. Offers 60-80% token reduction while enabling AI assistants to understand codebases through local analysis, OpenAI-enhanced insights, and GitHub repository integration.
    6
    12
    3
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Provides persistent memory and a codebase knowledge graph for AI coding assistants, enabling shared context across multiple tools like Claude, Cursor, and ChatGPT, with significant token reduction.
    5
    32
    MIT

View all related MCP servers

Related MCP Connectors

  • The project brain for AI coding agents — memory, decisions, sprints, knowledge base via MCP.

  • Persistent memory and knowledge graphs for AI agents. Hybrid search, context checkpoints, and more.

  • Universal memory for AI agents and tools. Save, organize and search context anywhere.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Wendell-A/cerebro2.0-lowvram'

If you have feedback or need assistance with the MCP directory API, please join our Discord server