๐Ÿ Agent Hive

Self-hosted coding agent server. Send tasks, get code. With auto-review, auto-PR, and thinking-level routing.

Open App โ†’ GitHub

Features

๐Ÿง 

Self-Check Loop

After completing a task, the agent automatically reviews its own work โ€” checks for syntax errors, runs tests, and fixes issues. Toggle on/off per request.

๐Ÿ”„

Auto-PR Pipeline

One-shot: prompt โ†’ code โ†’ review โ†’ commit โ†’ pull request. The agent generates the commit message and opens the PR via GitHub CLI.

๐ŸŽฏ

Smart Thinking Router

Automatically selects thinking level based on prompt complexity. Simple tasks get no thinking overhead, complex tasks get deeper reasoning.

๐Ÿ”Œ

MCP Compatible

Works with any MCP client โ€” OpenClaw, Claude Code, Cursor, Windsurf. Install the standalone package or use the REST API directly.

๐Ÿ™

GitHub Integration

Browse repos, search public repos, fork, clone, branch, and push โ€” all from the web UI. Agent works directly in cloned repos.

๐Ÿ”’

Secure by Default

Zero public ports. CF Tunnel for HTTPS. Bearer token auth. GitHub token server-side only. Path traversal protection.

Quick Start

1. Get an API token

Generate a random token for authentication:

openssl rand -hex 32

2. Configure your MCP client

OpenClaw (openclaw.json):

{
  "mcp": {
    "servers": {
      "agent-hive": {
        "command": "npx",
        "args": ["github:stansz/hive-mcp"],
        "env": {
          "HIVE_URL": "https://hive.ogsapps.cc",
          "HIVE_TOKEN": "your-token-here"
        }
      }
    }
  }
}

Claude Code (.claude/settings.json):

{
  "mcpServers": {
    "agent-hive": {
      "command": "npx",
      "args": ["github:stansz/hive-mcp"],
      "env": {
        "HIVE_URL": "https://hive.ogsapps.cc",
        "HIVE_TOKEN": "your-token-here"
      }
    }
  }
}

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "agent-hive": {
      "command": "npx",
      "args": ["github:stansz/hive-mcp"],
      "env": {
        "HIVE_URL": "https://hive.ogsapps.cc",
        "HIVE_TOKEN": "your-token-here"
      }
    }
  }
}

3. Start coding

Use the tools from any connected client:

// Simple task โ€” thinking auto-detected as "off"
hive_snippet(prompt="rename variable 'foo' to 'bar'", code="let foo = 1;")

// Complex task โ€” thinking auto-detected as "low"  
hive_prompt(prompt="Implement JWT authentication with refresh tokens")

// Full pipeline โ€” code + review + PR
hive_prompt_pr(prompt="Add rate limiting middleware", branch="feat/rate-limit")

MCP Tools

Tool Description Key Params
hive_prompt Start a coding task. Auto-review on by default. prompt, model?, autoReview?, autoPR?
hive_prompt_pr Full pipeline: prompt โ†’ review โ†’ commit โ†’ PR prompt, branch, baseBranch?, prTitle?
hive_snippet Quick code task without a repo prompt, code, language?
hive_status Check session state (running/done) sessionId
hive_messages Get full conversation history sessionId
hive_result Get session metadata sessionId
hive_abort Cancel a running session sessionId

Auto-Review Pipeline

When enabled (default), after the agent finishes its task, it receives a second prompt:

Review the changes you just made:
1. Check for syntax errors, broken imports, or unused variables
2. Run any available tests (npm test, pytest, go test, etc.)
3. Fix any issues you find
4. If everything looks good, say "LGTM"

This catches common mistakes without any human intervention. Disable it with autoReview: false.

Smart Thinking Router

When no explicit thinkingLevel is provided, the router analyzes the prompt:

LevelWhen UsedSignals
off Simple, quick tasks Short prompt, simple keywords (rename, delete, format, explain)
minimal Straightforward changes Medium prompt, basic keywords (fix, update, add)
low Feature work, refactoring Longer prompt, implementation keywords (implement, integrate, refactor)
medium Complex, multi-step tasks Architecture, security, multi-file, debugging complex issues

Always overridable: pass thinkingLevel: "high" explicitly to force deep reasoning.

REST API

All endpoints require Authorization: Bearer <token> unless noted.

MethodEndpointDescription
POST/promptStart a coding task
POST/prompt/prFull pipeline with auto-PR
POST/snippetQuick code task
GET/status/:idSession status
GET/messages/:idSession messages
POST/abort/:idCancel session
WS/events/:idReal-time streaming
GET/api/github/reposList your repos
GET/api/github/search?q=โ€ฆSearch public repos
POST/api/github/cloneClone a repo
POST/api/github/forkFork + clone a repo
POST/api/github/pushCommit + push changes
GET/healthHealth check no auth

Self-Host

Agent Hive runs on any Linux VPS with Node.js 22+. Total cost: ~$2-8/mo.

# Clone and configure
git clone https://github.com/stansz/agent-hive.git
cd agent-hive
cp .env.example .env  # Edit with your keys
npm install && npx -p typescript tsc

# Run
node dist/index.js

# Or install as a systemd service
sudo cp agent-hive.service /etc/systemd/system/
sudo systemctl enable --now agent-hive

See GitHub for the full setup guide including CF Tunnel, UFW, and security hardening.