Agentic Research

Building a Three-Layer Agent Framework from Scratch: Complete Deployment Record

2026/05/0913 min readBryan Chan閱讀中文原文
TopicsAgentDevOpsTutorialMulti-AgentPitfalls

Environment

  • Mac Studio M3 Ultra, 512GB RAM
  • macOS 15 Sequoia
  • Goal: Homebrew → Hermes Agent → OpenClaw → Claude Code, three-layer collaboration

Walkthrough

09:00, System Initialization

The freshly unboxed Mac Studio had no development tools installed.

xcode-select --install

It took about 5 minutes to complete.

09:10, Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Note: On M3 Ultra, Homebrew is under /opt/homebrew; after installation, you need to manually run the eval command.

09:15, Basic Toolchain

brew install git gh node pnpm python@3.12 ripgrep

09:30, Node.js and npm Global Tools

pnpm setup
source ~/.zshrc

10:00, Installing Claude Code

npm install -g @anthropic-ai/claude-code

Pitfall: npm install -g requires sudo or using pnpm. Switched to:

pnpm add -g @anthropic-ai/claude-code

Configure API Keys:

# ~/.claude.json
{
  "apiKey": "sk-xxxxxxxxxxxxxxxxxxxxxxxx",
  "baseURL": "https://api.deepseek.com/v1",
  "model": "deepseek-chat"
}

10:30, Installing OpenClaw

git clone https://github.com/openclaw/openclaw.git ~/openclaw
cd ~/openclaw
pnpm install
pnpm build

Pitfall: Dependency conflicts occurred during pnpm install. Solution: Delete node_modules and the lockfile, then reinstall.

rm -rf node_modules pnpm-lock.yaml
pnpm install

11:00, Initialization and Configuration

openclaw init

Configure ~/.openclaw/openclaw.json to add dual models (DeepSeek + ModelStudio).

11:30, Installing Claude Code Bridge

openclaw skill install claude-code-bridge

Pitfall: The Bridge skill could not find the claude binary path.

# Confirm Claude Code Installation Location
which claude
# /Users/xxx/Library/pnpm/claude

# Specifying Absolute Paths in Bridge Configuration
openclaw skill config claude-code-bridge
# Modify binary_path

12:00, Installing Hermes Agent

brew install hermes-agent
hermes init

12:30, Feishu Bot Configuration

Create an application in the Feishu Open Platform and configure event subscriptions.

Pitfall: The Webhook URL was unreachable. For local development, use ngrok for tunneling:

brew install ngrok
ngrok http 3000

Fill in the URL provided by ngrok as the event subscription URL in the Feishu Open Platform.

13:00, Hermes ↔ OpenClaw Integration

Configure bidirectional API communication:

  • Hermes: integrations.openclaw.enabled: true
  • OpenClaw: server.port: 3001

13:30, End-to-End Testing

Send a test command via Feishu:

Use OpenClaw to invoke Claude Code to list the files in the current directory.

The first run timed out; Claude Code cold start was slow. Adjust the timeout:

{ "claude_code": { "timeout_seconds": 600 } }

The second attempt succeeded! The full workflow ran successfully.

14:00, Hermes Reads the OpenClaw Project

Please read all files and the structure of the ~/openclaw project in detail

Hermes scanned about 300 files, generated a project map, and confirmed it could answer project-related questions.


Pitfall Summary

PitfallCauseSolution
npm global install requires sudomacOS permissionsSwitch to pnpm
OpenClaw dependency conflictLockfile version mismatchClean and reinstall
Claude Code Bridge cannot find binaryPATH does not include pnpm directorySpecify absolute path
Feishu Webhook unreachableNo public IP on local machinengrok tunneling
Claude Code first invocation timed outCold startIncrease timeout

Final Architecture State

Feishu (User)  ←→  Hermes Agent  ←→  OpenClaw  ←→  Claude Code
                    :3000              :3001         (CLI)
                                                  ↙        ↘
                                           DeepSeek    ModelStudio
                                            API         API

All three layers run on a Mac Studio M3 Ultra, with about 8GB of memory usage (excluding local models).


Next Steps

  • Add more Skills (GitHub PR Review, automated deployment, etc.)
  • Configure the WhatsApp channel
  • Configure workspace isolation for OpenClaw
  • Add monitoring and alerting