Skip to main content
Glama

Hermes Brain

Hermes Agent를 위한 멀티 에이전트 오케스트레이션

병렬 Hermes 에이전트를 생성하세요. 공유 두뇌를 제공하고 한 번의 명령으로 배포하세요.SQLite 기반, Python 조정, 조정에 토큰 소모 없음.

License: MIT Python Node.js Hermes MCP

설치 · 빠른 시작 · 작동 원리 · CLI · 도구 · 메모리 뱅크 · 개발


설치

옵션 1 — 소스에서 부트스트랩 (Hermes 권장)

curl -fsSL https://raw.githubusercontent.com/DevvGwardo/brain-mcp/main/install.sh | bash

설치 프로그램:

  1. Node.js MCP 서버(brain-mcp) 빌드

  2. Python 오케스트레이션 패키지(hermes-brain) 설치

  3. Hermes에 MCP 서버로 두뇌 등록

옵션 2 — 수동 설치

git clone https://github.com/DevvGwardo/brain-mcp.git
cd brain-mcp
npm install
npm run build
pip install -e .
hermes mcp add brain --command node --args "$PWD/dist/index.js"

참고: npm 패키지가 아직 게시되지 않았으므로 현재는 저장소 설치 경로가 지원되는 경로입니다.

확인:

hermes mcp list | grep brain
hermes mcp test brain
hermes-brain --help

전제 조건: Python 3.10+, Node.js 18+, Hermes Agent

친구와 공유하시나요? 각자의 두뇌는 독립된 SQLite DB이므로 네트워크 설정이 필요 없습니다. 동일한 한 줄 명령어로 어디서나 작동합니다.

Docker 사용자: tmux 창은 헤드리스 컨테이너에서 렌더링할 수 없으므로 layout: "headless"로 에이전트를 생성하세요:

brain_wake({ task: "...", layout: "headless" })

빠른 시작

Hermes 에이전트 군단을 오케스트레이션하는 한 줄 명령어:

hermes-brain "Build a REST API with auth, users, and posts" \
  --agents api-routes auth-layer db-models tests

작동 방식:

  1. Python 컨덕터가 4개의 백그라운드 Hermes 에이전트(hermes -q)를 생성합니다.

  2. 각 에이전트는 파일을 점유하고, 계약을 게시하고, 코드를 작성하고, 하트비트를 보냅니다.

  3. 컨덕터가 통합 게이트를 실행합니다 — 프로젝트를 컴파일하고 DM을 통해 담당 에이전트에게 오류를 라우팅합니다.

  4. 에이전트가 스스로 수정합니다. 게이트는 성공할 때까지 재시도합니다.

  5. 요약 출력: 에이전트, 계약, 메모리, 메트릭 완료.

더 많은 실행 방법:

# Auto-named agents
hermes-brain "Add error handling to the whole codebase"

# Mix models per task
hermes-brain "Build a game" --agents engine ui store --model claude-sonnet-4-5

# Cheap model for boilerplate
hermes-brain "Generate 10 test files" --model claude-haiku-4-5

# JSON pipeline with multiple phases
hermes-brain --config pipeline.json

또는 Hermes 내부에서 (대화형):

hermes> Use register, then wake to spawn 3 agents
        that each refactor a different module.

작동 원리

graph TB
    subgraph "Python Conductor"
        CLI["hermes-brain CLI"]
        ORCH["Orchestrator<br/><small>spawn · wait · gate · retry</small>"]
    end

    subgraph "Hermes Agents"
        direction LR
        H1["Agent 1<br/><small>hermes -q</small>"]
        H2["Agent 2<br/><small>hermes -q</small>"]
        H3["Agent 3<br/><small>hermes -q</small>"]
    end

    CLI --> ORCH
    ORCH -->|spawn| H1
    ORCH -->|spawn| H2
    ORCH -->|spawn| H3

    subgraph "Brain (shared SQLite)"
        DB[("brain.db")]
        PULSE["Heartbeats"]
        MX["Mutex Locks"]
        KV["Shared State"]
        CON["Contracts"]
        MEM["Memory"]
        PLAN["Task DAG"]
    end

    ORCH <--> DB
    H1 <--> DB
    H2 <--> DB
    H3 <--> DB

    subgraph "Integration Gate"
        GATE["tsc · mypy · cargo · go vet"]
        ROUTE["DM errors → agents"]
    end

    ORCH --> GATE
    GATE --> ROUTE
    ROUTE -.->|DM| H1
    ROUTE -.->|DM| H2

    style CLI fill:#9333EA,stroke:#7C3AED,color:#fff
    style ORCH fill:#9333EA,stroke:#7C3AED,color:#fff
    style H1 fill:#3B82F6,stroke:#2563EB,color:#fff
    style H2 fill:#10B981,stroke:#059669,color:#fff
    style H3 fill:#F59E0B,stroke:#D97706,color:#000
    style DB fill:#1E293B,stroke:#334155,color:#fff
    style GATE fill:#EF4444,stroke:#DC2626,color:#fff

아키텍처

이 다이어그램은 brain-mcp의 내부 아키텍처와 구성 요소 간의 상호 작용을 보여줍니다:

graph TB
    subgraph "External Clients"
        HERMES["Hermes CLI"]
        CLAUDE["Claude Code"]
        ANY["Any MCP Client"]
    end

    subgraph "brain-mcp (Node.js)"
        SERVER["src/index.ts<br/>MCP Request Router"]
        CONDUCTOR["brain-conductor<br/>Zero-token Orchestration CLI"]
        GATE["src/gate.ts<br/>Integration Gate"]
    end

    subgraph "pi-agent-core Runtime"
        PI_CORE["src/pi-core-agent.ts<br/>In-process Agent Runner"]
        PI_CORE_TOOLS["src/pi-core-tools.ts<br/>14 Brain Tools as AgentTools"]
        PI_AGENT["pi-agent-core Agent<br/>model + tools + events"]
    end

    subgraph "BrainDB (SQLite)"
        DB[("brain.db<br/>sessions, state, messages,<br/>claims, contracts, memory")]
    end

    HERMES & CLAUDE & ANY --> SERVER
    SERVER <--> DB
    SERVER --> CONDUCTOR
    CONDUCTOR --> PI_CORE
    PI_CORE --> PI_CORE_TOOLS
    PI_CORE --> PI_AGENT
    PI_CORE_TOOLS --> DB
    PI_AGENT -->|beforeToolCall<br/>pulse| DB
    CONDUCTOR --> GATE
    GATE -->|DM errors| CONDUCTOR

    style HERMES fill:#FF6B6B,stroke:#DC2626,color:#fff
    style CLAUDE fill:#3B82F6,stroke:#2563EB,color:#fff
    style ANY fill:#7C3AED,stroke:#6D28D9,color:#fff
    style SERVER fill:#1E293B,stroke:#334155,color:#fff
    style CONDUCTOR fill:#9333EA,stroke:#7C3AED,color:#fff
    style GATE fill:#EF4444,stroke:#DC2626,color:#fff
    style PI_CORE fill:#10B981,stroke:#059669,color:#fff
    style PI_CORE_TOOLS fill:#059669,stroke:#047857,color:#fff
    style PI_AGENT fill:#06B6D4,stroke:#0891B2,color:#fff
    style DB fill:#1E293B,stroke:#334155,color:#fff

pi-agent-core는 LLM 에이전트 런타임으로, 모델 상호 작용 루프, 도구 실행 및 이벤트 구독을 처리합니다. brain-mcp는 pi 에이전트가 호출하는 도구로서 조정 계층(상태, 메시징, 하트비트, 잠금, 계약)을 제공합니다. 컨덕터는 단계, 게이트 및 tmux 레이아웃을 통해 이 모든 것을 하나로 묶습니다.

토큰 소모 없는 조정. 컨덕터는 순수 Python으로 작성되었습니다. LLM 토큰은 실제 작업에만 소모됩니다. 하트비트, 점유, 계약, 게이트, 재시도 등은 모두 로컬에서 실행됩니다.

관리할 서버 없음. 각 에이전트는 두뇌에 대한 자체 stdio 연결을 엽니다. SQLite WAL 모드가 동시 액세스를 안전하게 처리합니다.

동일한 두뇌, 모든 CLI. Hermes, Claude Code, MiniMax 등 모든 클라이언트가 동일한 SQLite DB에 액세스합니다. Hermes + Claude 에이전트 혼합 군단이 동일한 작업에서 조정할 수 있습니다.


hermes-brain CLI

hermes-brain <task> [options]

플래그

기본값

설명

--agents <names...>

agent-1 agent-2

병렬로 생성할 에이전트 이름

--model <id>

claude-sonnet-4-5

각 에이전트에 전달할 모델

--no-gate

off

통합 게이트 건너뛰기

--retries <n>

3

최대 게이트 재시도 횟수

--timeout <seconds>

600

에이전트별 타임아웃

--config <file.json>

다단계 파이프라인 로드

--db-path <path>

~/.claude/brain/brain.db

사용자 지정 두뇌 DB

파이프라인 설정 파일

{
  "task": "Build a todo app",
  "model": "claude-sonnet-4-5",
  "gate": true,
  "max_gate_retries": 3,
  "phases": [
    {
      "name": "foundation",
      "parallel": true,
      "agents": [
        { "name": "types",  "files": ["src/types/"], "task": "Define all TS types" },
        { "name": "db",     "files": ["src/db/"],    "task": "Set up Prisma schema" }
      ]
    },
    {
      "name": "feature",
      "parallel": true,
      "agents": [
        { "name": "api",    "files": ["src/api/"],   "task": "REST endpoints" },
        { "name": "ui",     "files": ["src/ui/"],    "task": "React components" }
      ]
    },
    {
      "name": "quality",
      "parallel": true,
      "agents": [
        { "name": "tests",  "task": "Write unit + integration tests" }
      ]
    }
  ]
}

단계는 순차적으로 실행됩니다. 한 단계 내의 에이전트는 병렬로 실행됩니다. 통합 게이트는 단계 사이에 실행됩니다.


두뇌 도구

12개 카테고리에 걸친 35개 이상의 도구. Hermes, Claude Code 및 모든 MCP 호환 에이전트에서 사용할 수 있습니다.

신원 및 상태

도구

설명

brain_register

이 세션 이름 지정

brain_sessions

활성 세션 나열

brain_status

세션 정보 + 룸 표시

brain_pulse

상태 + 진행 상황 하트비트 (대기 중인 DM 반환)

brain_agents

모든 에이전트의 실시간 상태 (상태, 하트비트 경과 시간, 점유)

메시징

도구

설명

brain_post

채널에 게시

brain_read

채널에서 읽기

brain_dm

다른 에이전트에게 직접 메시지 전송

brain_inbox

DM 읽기

공유 상태 및 메모리

도구

설명

brain_set / brain_get

일시적 키-값 저장소

brain_keys / brain_delete

키 나열 / 제거

brain_remember

영구 지식 저장 (brain_clear 후에도 유지)

brain_recall

이전 세션의 메모리 검색

brain_forget

오래된 메모리 제거

파일 잠금

도구

설명

brain_claim

파일/리소스 잠금 (TTL 기반 뮤텍스)

brain_release

잠금 해제

brain_claims

활성 잠금 나열

계약 (통합 버그 방지)

도구

설명

brain_contract_set

모듈이 제공/기대하는 내용 게시

brain_contract_get

코딩 전 다른 에이전트의 계약 읽기

brain_contract_check

모든 계약 검증 — 매개변수 불일치, 누락된 함수 포착

통합 게이트

도구

설명

brain_gate

컴파일 + 계약 검증 실행, 오류를 담당 에이전트에게 DM

brain_auto_gate

루프에서 게이트 실행, 수정 대기, 성공할 때까지 재시도

작업 계획 (DAG)

도구

설명

brain_plan

종속성이 있는 작업 DAG 생성

brain_plan_next

종속성이 충족된 작업 가져오기

brain_plan_update

작업 완료/실패 표시 (종속 작업 자동 승격)

brain_plan_status

전체 진행 상황

brain_workflow_compile

자연어 목표를 단계, 에이전트, 파일 범위 및 컨덕터 설정으로 변환

brain_workflow_apply

컴파일된 워크플로우를 두뇌 상태 + 작업 DAG에 영구 저장, 선택적으로 컨덕터 JSON 작성

오케스트레이션

도구

설명

brain_wake

새 에이전트 생성 (hermes, claude 또는 headless)

brain_swarm

한 번의 호출로 여러 에이전트 생성

brain_respawn

실패한 에이전트를 복구 컨텍스트로 교체

brain_metrics

에이전트별 성공률, 기간, 오류 수

컨텍스트 원장 (추적 손실 방지)

도구

설명

brain_context_push

작업/발견/결정/오류 기록

brain_context_get

원장 읽기

brain_context_summary

컨텍스트 복구를 위한 요약 보기

brain_checkpoint

전체 작업 상태 저장

brain_checkpoint_restore

컨텍스트 압축 후 복구


하트비트 및 계약 프로토콜

생성된 모든 에이전트는 오케스트레이터가 강제하는 두 가지 프로토콜을 따릅니다:

하트비트 — 에이전트는 2~3개의 도구 호출마다 상태와 짧은 진행 상황 메모를 포함하여 brain_pulse를 호출합니다. 컨덕터는 이를 사용하여 다음을 수행합니다:

  • 터미널에 실시간 상태 표시 (● working — editing src/api/routes.ts)

  • 정지된 에이전트 감지 (60초 동안 펄스 없음 → stale)

  • 대기 중인 DM을 펄스 반환 값으로 전달 (추가 왕복 없음)

계약 — 에이전트는 코드를 작성하기 전에 brain_contract_get을 호출하여 다른 에이전트가 무엇을 내보내는지 확인합니다. 작성 후에는 brain_contract_set으로 자신의 계약을 게시합니다. 완료 표시 전, brain_contract_check가 전체 군단을 검증하여 다음을 포착합니다:

  • 함수 시그니처 불일치 (인수 2개 예상, 3개 수신)

  • 누락된 내보내기 (에이전트 A가 getUser를 가져오지만 에이전트 B가 내보내지 않음)

  • 타입 드리프트 (User 예상, {name, email} 수신)

이것이 병렬 군단으로 단일 에이전트 통합 품질을 달성하는 핵심입니다.


통합 게이트

sequenceDiagram
    participant O as Orchestrator
    participant C as Compiler
    participant DB as Brain DB
    participant A as Agent

    O->>C: Run tsc / mypy / cargo / go vet
    C-->>O: Errors with file:line:message

    O->>DB: Query: who claimed this file?
    DB-->>O: Agent X owned src/api/routes.ts

    O->>A: DM: "Fix these errors in your files"
    Note over A: Agent reads DM on next pulse
    Note over A: Fixes code, pulses done

    O->>C: Re-run compiler
    C-->>O: Clean
    O->>DB: Record metrics

게이트는 프로젝트 언어를 자동 감지하고 적절한 검사기를 실행합니다:

언어

검사기

TypeScript

npx tsc --noEmit

Python

mypy

Rust

cargo check

Go

go vet

오류는 파싱되어 실패한 파일을 점유한 에이전트와 매칭되고 DM으로 라우팅됩니다. 에이전트는 다음 펄스에서 오류를 확인하고 스스로 수정합니다. 루프는 --retries 횟수만큼 재시도한 후 포기합니다.


혼합 군단

두뇌 DB는 모든 MCP 클라이언트 간에 공유됩니다. 단일 프로젝트는 다음을 가질 수 있습니다:

graph LR
    subgraph "Fleet"
        direction TB
        HA["Hermes Agent<br/><small>fast local inference</small>"]
        CC["Claude Code<br/><small>deep reasoning</small>"]
        MM["MiniMax<br/><small>cheap boilerplate</small>"]
    end

    subgraph "Brain"
        DB[("brain.db")]
    end

    HA <--> DB
    CC <--> DB
    MM <--> DB

    style HA fill:#F59E0B,stroke:#D97706,color:#000
    style CC fill:#9333EA,stroke:#7C3AED,color:#fff
    style MM fill:#3B82F6,stroke:#2563EB,color:#fff
    style DB fill:#1E293B,stroke:#334155,color:#fff

작업 유형별로 라우팅하세요. 일상적인 작업에는 Hermes를, 아키텍처 결정에는 Claude를, 상용구 코드에는 더 저렴한 모델을 사용하세요. 모두 동일한 두뇌를 통해 조정하고 계약, 게이트, 메모리를 공유합니다.

Claude Code에서:

brain_wake({ task: "...", cli: "hermes", layout: "headless" })
brain_wake({ task: "...", cli: "claude", layout: "horizontal" })

고급

아래의 모든 내용은 전체 기술적 깊이를 다룹니다.


성능

직접 벤치마크를 실행해 보세요:

node benchmark.mjs        # SQLite direct layer (1000 iterations)
node benchmark-mcp.mjs    # MCP tool layer (30 iterations per tool)

SQLite 직접 계층 (2026-04-06, M4 Pro, WAL 모드)

작업

평균

p50

p95

p99

처리량

session_register

0.021ms

0.011ms

0.027ms

0.039ms

~47K/s

message_post (1 msg)

0.014ms

0.011ms

0.019ms

0.031ms

~70K/s

message_read (50 msgs)

0.042ms

0.042ms

0.045ms

0.066ms

~24K/s

state_get

0.002ms

0.002ms

0.002ms

0.003ms

~570K/s

claim_query (all)

0.001ms

0.001ms

0.002ms

0.002ms

~670K/s

heartbeat_pulse (update)

0.002ms

0.002ms

0.002ms

0.003ms

~464K/s

session_query (by id)

0.002ms

0.002ms

0.002ms

0.003ms

~455K/s

직접 SQLite: 모든 핵심 조정 작업은 밀리초 미만입니다. KV 저장소(state_get)는 초당 약 57만 건의 읽기를 유지합니다. 고주파 조정(하트비트, 점유, 상태)은 1ms 미만으로 유지됩니다.

MCP 도구 계층 (2026-04-06, stdio JSON-RPC, 각 30회 호출)

도구

평균

p50

p95

최소

최대

brain_status

12.2ms

12.0ms

15.6ms

8.8ms

21.2ms

brain_sessions

1.9ms

1.

-
security - not tested
A
license - permissive license
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

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/DevvGwardo/brain-mcp'

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