hermes-paperclip-adapter
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHermes Paperclip Adapter
Hermes Paperclip 适配器
Skill by ara.so — Hermes Skills collection.
The Hermes Paperclip Adapter runs Hermes Agent as a managed AI employee inside a Paperclip company. It provides full integration between Paperclip's orchestration/task system and Hermes's 30+ native tools, persistent memory, 80+ skills, and MCP support across 8 inference providers.
由ara.so提供的技能 — Hermes 技能集合。
Hermes Paperclip 适配器可在Paperclip企业内部将Hermes Agent作为托管AI员工运行。它实现了Paperclip编排/任务系统与Hermes的30+原生工具、持久化记忆、80+技能以及支持8个推理提供商的MCP协议之间的完整集成。
What It Does
功能介绍
- Runs Hermes as a Paperclip employee: Assign issues to Hermes agents, they wake up on heartbeats and comments, complete work, and report back
- Persistent session management: Sessions resume across heartbeats, maintaining conversation context and memory
- Structured transcript parsing: Converts raw Hermes stdout into typed objects for proper UI rendering (tool cards, status icons)
TranscriptEntry - Skills sync: Merges Paperclip-managed skills with Hermes-native for unified skill management
~/.hermes/skills/ - Multi-provider: Supports Anthropic, OpenRouter, OpenAI, Nous, OpenAI Codex, ZAI, Kimi Coding, MiniMax
- Comment-driven wakes: Agents respond to issue comments, not just task assignments
- Cost tracking: Captures token usage and costs from Hermes output
- 将Hermes作为Paperclip员工运行:将任务分配给Hermes Agent,它们会在心跳检测和评论触发时启动,完成工作后反馈结果
- 持久化会话管理:会话可跨心跳检测恢复,保留对话上下文和记忆
- 结构化转录解析:将Hermes的原始标准输出转换为类型化的对象,用于正确的UI渲染(工具卡片、状态图标)
TranscriptEntry - 技能同步:将Paperclip托管的技能与Hermes原生的目录合并,实现统一技能管理
~/.hermes/skills/ - 多提供商支持:支持Anthropic、OpenRouter、OpenAI、Nous、OpenAI Codex、ZAI、Kimi Coding、MiniMax
- 评论触发唤醒:Agent不仅响应任务分配,还会对任务评论做出回应
- 成本跟踪:从Hermes输出中捕获令牌使用量和成本
Installation
安装步骤
1. Install Prerequisites
1. 安装前置依赖
bash
undefinedbash
undefinedInstall Hermes Agent
安装Hermes Agent
pip install hermes-agent
pip install hermes-agent
Verify installation
验证安装
hermes --version
undefinedhermes --version
undefined2. Install the Adapter
2. 安装适配器
bash
npm install hermes-paperclip-adapterbash
npm install hermes-paperclip-adapter3. Register in Paperclip Server
3. 在Paperclip服务器中注册
Edit your Paperclip server's adapter registry ():
server/src/adapters/registry.tstypescript
import * as hermesLocal from "hermes-paperclip-adapter";
import {
execute,
testEnvironment,
detectModel,
listSkills,
syncSkills,
sessionCodec,
} from "hermes-paperclip-adapter/server";
// In your registry setup
registry.set("hermes_local", {
...hermesLocal,
execute,
testEnvironment,
detectModel,
listSkills,
syncSkills,
sessionCodec,
});编辑Paperclip服务器的适配器注册表():
server/src/adapters/registry.tstypescript
import * as hermesLocal from "hermes-paperclip-adapter";
import {
execute,
testEnvironment,
detectModel,
listSkills,
syncSkills,
sessionCodec,
} from "hermes-paperclip-adapter/server";
// 在注册表设置中
registry.set("hermes_local", {
...hermesLocal,
execute,
testEnvironment,
detectModel,
listSkills,
syncSkills,
sessionCodec,
});Configuration
配置说明
Basic Agent Config
基础Agent配置
Create a Hermes agent in Paperclip with :
adapterType: "hermes_local"typescript
const agentConfig = {
name: "Hermes Engineer",
adapterType: "hermes_local",
adapterConfig: {
// Model selection (provider/model format)
model: "anthropic/claude-sonnet-4",
// Execution limits
maxIterations: 50,
timeoutSec: 300,
graceSec: 10,
// Session persistence
persistSession: true,
// Tool control
enabledToolsets: ["terminal", "file", "web", "browser"],
// Workspace isolation
worktreeMode: false,
checkpoints: false,
// Output control
verbose: false,
quiet: true
}
};在Paperclip中创建一个的Hermes Agent:
adapterType: "hermes_local"typescript
const agentConfig = {
name: "Hermes 工程师",
adapterType: "hermes_local",
adapterConfig: {
// 模型选择(提供商/模型格式)
model: "anthropic/claude-sonnet-4",
// 执行限制
maxIterations: 50,
timeoutSec: 300,
graceSec: 10,
// 会话持久化
persistSession: true,
// 工具控制
enabledToolsets: ["terminal", "file", "web", "browser"],
// 工作区隔离
worktreeMode: false,
checkpoints: false,
// 输出控制
verbose: false,
quiet: true
}
};Provider Configuration
提供商配置
The adapter auto-detects providers from model names:
typescript
// Anthropic
{ model: "anthropic/claude-sonnet-4" }
{ model: "anthropic/claude-opus-4" }
// OpenRouter
{ model: "openrouter/anthropic/claude-3.5-sonnet" }
{ model: "openrouter/deepseek/deepseek-chat" }
// OpenAI
{ model: "openai/gpt-4" }
{ model: "openai/o1" }
// Nous
{ model: "nous/hermes-3" }
// Explicit provider override
{
model: "claude-sonnet-4",
provider: "anthropic"
}Set API keys via environment variables:
bash
export ANTHROPIC_API_KEY=sk-ant-...
export OPENROUTER_API_KEY=sk-or-...
export OPENAI_API_KEY=sk-...
export NOUS_API_KEY=...适配器会根据模型名称自动检测提供商:
typescript
// Anthropic
{ model: "anthropic/claude-sonnet-4" }
{ model: "anthropic/claude-opus-4" }
// OpenRouter
{ model: "openrouter/anthropic/claude-3.5-sonnet" }
{ model: "openrouter/deepseek/deepseek-chat" }
// OpenAI
{ model: "openai/gpt-4" }
{ model: "openai/o1" }
// Nous
{ model: "nous/hermes-3" }
// 显式指定提供商
{
model: "claude-sonnet-4",
provider: "anthropic"
}通过环境变量设置API密钥:
bash
export ANTHROPIC_API_KEY=sk-ant-...
export OPENROUTER_API_KEY=sk-or-...
export OPENAI_API_KEY=sk-...
export NOUS_API_KEY=...Toolset Control
工具集控制
Restrict available tools by specifying toolsets:
typescript
{
// Only terminal, file, and web tools
enabledToolsets: ["terminal", "file", "web"]
}
{
// Enable MCP and vision
enabledToolsets: ["mcp", "vision"]
}
{
// Empty = all tools enabled (default)
enabledToolsets: []
}Available toolsets: , , , , , , , ,
terminalfilewebbrowsercode_executionvisionmcpcreativeproductivity通过指定工具集限制可用工具:
typescript
{
// 仅启用终端、文件和Web工具
enabledToolsets: ["terminal", "file", "web"]
}
{
// 启用MCP和视觉工具
enabledToolsets: ["mcp", "vision"]
}
{
// 空数组 = 启用所有工具(默认)
enabledToolsets: []
}可用工具集:, , , , , , , ,
terminalfilewebbrowsercode_executionvisionmcpcreativeproductivityCustom Prompts
自定义提示词
Use template variables to customize agent instructions:
typescript
{
promptTemplate: `You are {{agentName}}, an AI engineer working for {{companyName}}.
{{#taskId}}使用模板变量自定义Agent指令:
typescript
{
promptTemplate: `你是{{agentName}},一名为{{companyName}}工作的AI工程师。
{{#taskId}}Current Task
当前任务
{{taskTitle}} (ID: {{taskId}})
{{taskBody}}
Complete this task using your available tools. When done, report results clearly.
{{/taskId}}
{{#commentId}}
{{taskTitle}}(ID: {{taskId}})
{{taskBody}}
使用可用工具完成此任务。完成后清晰汇报结果。
{{/taskId}}
{{#commentId}}
New Comment
新评论
You've been mentioned in a comment. Review the issue context and respond appropriately.
{{/commentId}}
Project: {{projectName}}
Company ID: {{companyId}}
Run ID: {{runId}}
API: {{paperclipApiUrl}}
`
}
Available variables:
- `{{agentId}}`, `{{agentName}}`
- `{{companyId}}`, `{{companyName}}`
- `{{runId}}`, `{{taskId}}`, `{{taskTitle}}`, `{{taskBody}}`
- `{{projectName}}`, `{{commentId}}`, `{{wakeReason}}`
- `{{paperclipApiUrl}}`
Conditionals:
- `{{#taskId}}...{{/taskId}}` — only when task assigned
- `{{#noTask}}...{{/noTask}}` — only when no task
- `{{#commentId}}...{{/commentId}}` — only when woken by comment你在一条评论中被提及。查看任务上下文并做出适当回应。
{{/commentId}}
项目: {{projectName}}
企业ID: {{companyId}}
运行ID: {{runId}}
API地址: {{paperclipApiUrl}}
`
}
可用变量:
- `{{agentId}}`, `{{agentName}}`
- `{{companyId}}`, `{{companyName}}`
- `{{runId}}`, `{{taskId}}`, `{{taskTitle}}`, `{{taskBody}}`
- `{{projectName}}`, `{{commentId}}`, `{{wakeReason}}`
- `{{paperclipApiUrl}}`
条件判断:
- `{{#taskId}}...{{/taskId}}` — 仅当分配任务时生效
- `{{#noTask}}...{{/noTask}}` — 仅当无任务时生效
- `{{#commentId}}...{{/commentId}}` — 仅当被评论唤醒时生效Usage Patterns
使用模式
Creating a Hermes Employee
创建Hermes员工
typescript
import { PaperclipClient } from "paperclip-client";
const client = new PaperclipClient({
apiUrl: process.env.PAPERCLIP_API_URL,
apiKey: process.env.PAPERCLIP_API_KEY
});
// Create agent
const agent = await client.agents.create({
name: "Hermes DevOps",
adapterType: "hermes_local",
adapterConfig: {
model: "anthropic/claude-sonnet-4",
maxIterations: 50,
timeoutSec: 600,
persistSession: true,
enabledToolsets: ["terminal", "file", "web"],
env: {
// Custom env vars for Hermes
HERMES_LOG_LEVEL: "info"
}
},
schedule: {
cron: "*/15 * * * *" // Check every 15 minutes
}
});
console.log(`Created agent: ${agent.id}`);typescript
import { PaperclipClient } from "paperclip-client";
const client = new PaperclipClient({
apiUrl: process.env.PAPERCLIP_API_URL,
apiKey: process.env.PAPERCLIP_API_KEY
});
// 创建Agent
const agent = await client.agents.create({
name: "Hermes DevOps",
adapterType: "hermes_local",
adapterConfig: {
model: "anthropic/claude-sonnet-4",
maxIterations: 50,
timeoutSec: 600,
persistSession: true,
enabledToolsets: ["terminal", "file", "web"],
env: {
// 为Hermes设置自定义环境变量
HERMES_LOG_LEVEL: "info"
}
},
schedule: {
cron: "*/15 * * * *" // 每15分钟检查一次
}
});
console.log(`已创建Agent: ${agent.id}`);Assigning Work
分配工作
typescript
// Create an issue
const issue = await client.issues.create({
title: "Optimize database queries",
body: `Review the API endpoint /api/users and optimize the database queries.
Current query time is ~500ms, target is <100ms.
Files:
- src/api/users.ts
- src/db/queries/users.ts
Run benchmarks before and after changes.`,
projectId: "proj_123"
});
// Assign to Hermes
await client.issues.assign({
issueId: issue.id,
agentId: agent.id
});typescript
// 创建任务
const issue = await client.issues.create({
title: "优化数据库查询",
body: `审查API端点/api/users并优化数据库查询。
当前查询时间约为500ms,目标是<100ms。
相关文件:
- src/api/users.ts
- src/db/queries/users.ts
在修改前后运行基准测试。`,
projectId: "proj_123"
});
// 分配给Hermes
await client.issues.assign({
issueId: issue.id,
agentId: agent.id
});Monitoring Execution
监控执行
typescript
// Get run details
const run = await client.runs.get(runId);
console.log(`Status: ${run.status}`);
console.log(`Model: ${run.modelUsed}`);
console.log(`Tokens: ${run.tokenUsage.total}`);
console.log(`Cost: $${run.cost}`);
console.log(`Session: ${run.sessionId}`);
// View transcript
for (const entry of run.transcript) {
console.log(`[${entry.type}] ${entry.content}`);
if (entry.type === "tool_use") {
console.log(` Tool: ${entry.toolName}`);
console.log(` Status: ${entry.status}`);
}
}typescript
// 获取运行详情
const run = await client.runs.get(runId);
console.log(`状态: ${run.status}`);
console.log(`使用模型: ${run.modelUsed}`);
console.log(`令牌使用量: ${run.tokenUsage.total}`);
console.log(`成本: $${run.cost}`);
console.log(`会话ID: ${run.sessionId}`);
// 查看转录内容
for (const entry of run.transcript) {
console.log(`[${entry.type}] ${entry.content}`);
if (entry.type === "tool_use") {
console.log(` 工具: ${entry.toolName}`);
console.log(` 状态: ${entry.status}`);
}
}Skills Management
技能管理
typescript
import { listSkills, syncSkills } from "hermes-paperclip-adapter/server";
// List all available skills
const skills = await listSkills({
agentId: "agent_123",
companyId: "company_456"
});
console.log("Paperclip-managed skills:", skills.managed.length);
console.log("Hermes-native skills:", skills.native.length);
// Sync skills from Paperclip to Hermes workspace
await syncSkills({
agentId: "agent_123",
companyId: "company_456",
enabledSkills: ["typescript-expert", "postgres-tuning", "docker-ops"]
});typescript
import { listSkills, syncSkills } from "hermes-paperclip-adapter/server";
// 列出所有可用技能
const skills = await listSkills({
agentId: "agent_123",
companyId: "company_456"
});
console.log("Paperclip托管技能:", skills.managed.length);
console.log("Hermes原生技能:", skills.native.length);
// 将Paperclip中的技能同步到Hermes工作区
await syncSkills({
agentId: "agent_123",
companyId: "company_456",
enabledSkills: ["typescript-expert", "postgres-tuning", "docker-ops"]
});Testing Environment
测试环境
typescript
import { testEnvironment } from "hermes-paperclip-adapter/server";
const check = await testEnvironment({
hermesCommand: "hermes",
provider: "anthropic",
env: {
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY
}
});
if (!check.success) {
console.error("Environment issues:", check.errors);
// Example errors:
// - "Hermes CLI not found in PATH"
// - "Python version 3.10+ required"
// - "ANTHROPIC_API_KEY not set"
}typescript
import { testEnvironment } from "hermes-paperclip-adapter/server";
const check = await testEnvironment({
hermesCommand: "hermes",
provider: "anthropic",
env: {
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY
}
});
if (!check.success) {
console.error("环境问题:", check.errors);
// 示例错误:
// - "Hermes CLI未在PATH中找到"
// - "需要Python 3.10+版本"
// - "ANTHROPIC_API_KEY未设置"
}Auto Model Detection
自动模型检测
typescript
import { detectModel } from "hermes-paperclip-adapter/server";
// Reads ~/.hermes/config.yaml to pre-populate UI
const detected = await detectModel({
hermesCommand: "hermes"
});
console.log(`Default model: ${detected.model}`);
console.log(`Provider: ${detected.provider}`);typescript
import { detectModel } from "hermes-paperclip-adapter/server";
// 读取~/.hermes/config.yaml以预填充UI
const detected = await detectModel({
hermesCommand: "hermes"
});
console.log(`默认模型: ${detected.model}`);
console.log(`提供商: ${detected.provider}`);Session State Management
会话状态管理
typescript
import { sessionCodec } from "hermes-paperclip-adapter/server";
// Validate and migrate session state
const validated = sessionCodec.decode(rawSessionState);
if (validated._tag === "Right") {
const session = validated.right;
console.log(`Session ID: ${session.sessionId}`);
console.log(`Messages: ${session.messageCount}`);
console.log(`Last activity: ${session.lastActivity}`);
} else {
console.error("Invalid session state:", validated.left);
}typescript
import { sessionCodec } from "hermes-paperclip-adapter/server";
// 验证并迁移会话状态
const validated = sessionCodec.decode(rawSessionState);
if (validated._tag === "Right") {
const session = validated.right;
console.log(`会话ID: ${session.sessionId}`);
console.log(`消息数量: ${session.messageCount}`);
console.log(`最后活动时间: ${session.lastActivity}`);
} else {
console.error("无效会话状态:", validated.left);
}Advanced Patterns
高级模式
Git Worktree Isolation
Git工作区隔离
Isolate agent work in separate git worktrees:
typescript
{
worktreeMode: true,
// Each run gets: repo/.paperclip/worktrees/agent_123/run_456
}在独立的Git工作区中隔离Agent工作:
typescript
{
worktreeMode: true,
// 每次运行会创建: repo/.paperclip/worktrees/agent_123/run_456
}Filesystem Checkpoints
文件系统检查点
Enable rollback safety:
typescript
{
checkpoints: true,
// Creates snapshots before destructive operations
}启用回滚安全机制:
typescript
{
checkpoints: true,
// 在执行破坏性操作前创建快照
}Reasoning Effort Control
推理力度控制
For o1/o3-style thinking models:
typescript
{
model: "openai/o1",
extraArgs: ["--reasoning-effort", "high"]
}针对o1/o3类思考模型:
typescript
{
model: "openai/o1",
extraArgs: ["--reasoning-effort", "high"]
}Custom Hermes CLI Path
自定义Hermes CLI路径
typescript
{
hermesCommand: "/usr/local/bin/hermes-dev",
verbose: true
}typescript
{
hermesCommand: "/usr/local/bin/hermes-dev",
verbose: true
}Extra Environment Variables
额外环境变量
typescript
{
env: {
HERMES_LOG_LEVEL: "debug",
HERMES_CACHE_DIR: "/mnt/fast-storage/hermes-cache",
MCP_SERVER_URL: "http://localhost:8080"
}
}typescript
{
env: {
HERMES_LOG_LEVEL: "debug",
HERMES_CACHE_DIR: "/mnt/fast-storage/hermes-cache",
MCP_SERVER_URL: "http://localhost:8080"
}
}Transcript Parsing
转录解析
The adapter converts raw Hermes output into structured entries:
typescript
type TranscriptEntry =
| { type: "message"; role: "user" | "assistant"; content: string }
| { type: "tool_use"; toolName: string; status: "running" | "success" | "error"; input: any; output?: any }
| { type: "thinking"; content: string }
| { type: "memory_write"; key: string; value: any }
| { type: "error"; message: string; stderr?: string };
// Example parsed output
[
{ type: "message", role: "user", content: "Optimize the database queries" },
{ type: "tool_use", toolName: "read_file", status: "success", input: { path: "src/api/users.ts" } },
{ type: "thinking", content: "The current query uses a full table scan..." },
{ type: "tool_use", toolName: "run_command", status: "running", input: { command: "npm run benchmark" } },
{ type: "tool_use", toolName: "run_command", status: "success", output: "Average: 487ms" },
{ type: "memory_write", key: "baseline_perf", value: "487ms" },
{ type: "message", role: "assistant", content: "I've added an index on user_id..." }
]适配器将Hermes的原始输出转换为结构化条目:
typescript
type TranscriptEntry =
| { type: "message"; role: "user" | "assistant"; content: string }
| { type: "tool_use"; toolName: string; status: "running" | "success" | "error"; input: any; output?: any }
| { type: "thinking"; content: string }
| { type: "memory_write"; key: string; value: any }
| { type: "error"; message: string; stderr?: string };
// 解析后的输出示例
[
{ type: "message", role: "user", content: "优化数据库查询" },
{ type: "tool_use", toolName: "read_file", status: "success", input: { path: "src/api/users.ts" } },
{ type: "thinking", content: "当前查询使用全表扫描..." },
{ type: "tool_use", toolName: "run_command", status: "running", input: { command: "npm run benchmark" } },
{ type: "tool_use", toolName: "run_command", status: "success", output: "平均耗时: 487ms" },
{ type: "memory_write", key: "baseline_perf", value: "487ms" },
{ type: "message", role: "assistant", content: "我已为user_id添加索引..." }
]Output Post-Processing
输出后处理
The adapter cleans Hermes ASCII formatting:
Before (raw Hermes output):
╔═══════════════════════════════════════╗
║ HERMES AGENT v2.1.0 ║
╚═══════════════════════════════════════╝
Results
=======
+---------------------------+----------+
| Metric | Value |
+---------------------------+----------+
| Query time (before) | 487ms |
| Query time (after) | 83ms |
+---------------------------+----------+After (clean GFM markdown):
markdown
undefined适配器会清理Hermes的ASCII格式:
处理前(Hermes原始输出):
╔═══════════════════════════════════════╗
║ HERMES AGENT v2.1.0 ║
╚═══════════════════════════════════════╝
结果
=======
+---------------------------+----------+
| Metric | Value |
+---------------------------+----------+
| Query time (before) | 487ms |
| Query time (after) | 83ms |
+---------------------------+----------+处理后(干净的GFM markdown):
markdown
undefinedResults
结果
| Metric | Value |
|---|---|
| Query time (before) | 487ms |
| Query time (after) | 83ms |
undefined| 指标 | 数值 |
|---|---|
| 优化前查询时间 | 487ms |
| 优化后查询时间 | 83ms |
undefinedTroubleshooting
故障排除
Hermes CLI Not Found
Hermes CLI未找到
bash
undefinedbash
undefinedCheck installation
检查安装情况
which hermes
which hermes
Install if missing
如果缺失则安装
pip install hermes-agent
pip install hermes-agent
Or specify custom path
或者指定自定义路径
{
hermesCommand: "/path/to/hermes"
}
undefined{
hermesCommand: "/path/to/hermes"
}
undefinedAPI Key Issues
API密钥问题
bash
undefinedbash
undefinedVerify keys are set
验证密钥是否已设置
echo $ANTHROPIC_API_KEY
echo $OPENROUTER_API_KEY
echo $ANTHROPIC_API_KEY
echo $OPENROUTER_API_KEY
Test key validity
测试密钥有效性
hermes chat -q "hello" --model anthropic/claude-sonnet-4
undefinedhermes chat -q "hello" --model anthropic/claude-sonnet-4
undefinedSession Resume Failures
会话恢复失败
typescript
// Disable persistence for debugging
{
persistSession: false
}
// Check session state
const run = await client.runs.get(runId);
console.log("Session state:", run.sessionState);typescript
// 调试时禁用持久化
{
persistSession: false
}
// 检查会话状态
const run = await client.runs.get(runId);
console.log("会话状态:", run.sessionState);Timeout Issues
超时问题
typescript
// Increase timeout for long-running tasks
{
timeoutSec: 1800, // 30 minutes
graceSec: 30,
maxIterations: 100
}typescript
// 为长时间运行的任务增加超时时间
{
timeoutSec: 1800, // 30分钟
graceSec: 30,
maxIterations: 100
}Tool Access Errors
工具访问错误
typescript
// Check which tools are enabled
{
enabledToolsets: ["terminal", "file"], // Minimal set
verbose: true // See tool invocations
}typescript
// 检查启用的工具
{
enabledToolsets: ["terminal", "file"], // 最小工具集
verbose: true // 查看工具调用情况
}Stderr Noise
标准输出噪声
typescript
// Use quiet mode to suppress MCP init messages
{
quiet: true
}
// Benign stderr patterns are auto-reclassified:
// - "MCP server initialized"
// - JSON structured logs
// - Progress indicatorstypescript
// 使用安静模式抑制MCP初始化消息
{
quiet: true
}
// 良性标准输出会被自动重新分类:
// - "MCP server initialized"
// - JSON结构化日志
// - 进度指示器Skills Not Loading
技能未加载
bash
undefinedbash
undefinedCheck skill directories
检查技能目录
ls ~/.hermes/skills/
ls node_modules/hermes-paperclip-adapter/skills/
ls ~/.hermes/skills/
ls node_modules/hermes-paperclip-adapter/skills/
Verify permissions
验证权限
chmod -R 755 ~/.hermes/skills/
chmod -R 755 ~/.hermes/skills/
List available skills
列出可用技能
hermes skills list
undefinedhermes skills list
undefinedMemory/Context Issues
内存/上下文问题
typescript
// Context compression is automatic, but you can control it:
{
extraArgs: [
"--context-window", "200000",
"--compress-after", "150000"
]
}typescript
// 上下文压缩是自动的,但你可以手动控制:
{
extraArgs: [
"--context-window", "200000",
"--compress-after", "150000"
]
}Integration Examples
集成示例
With GitHub Actions
与GitHub Actions集成
yaml
name: Paperclip Hermes Agent
on:
schedule:
- cron: '*/30 * * * *'
jobs:
hermes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Hermes
run: pip install hermes-agent
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Trigger Paperclip Heartbeat
run: |
curl -X POST ${{ secrets.PAPERCLIP_API_URL }}/agents/${{ secrets.AGENT_ID }}/heartbeat \
-H "Authorization: Bearer ${{ secrets.PAPERCLIP_API_KEY }}"
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}yaml
name: Paperclip Hermes Agent
on:
schedule:
- cron: '*/30 * * * *'
jobs:
hermes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 设置Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: 安装Hermes
run: pip install hermes-agent
- name: 设置Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: 触发Paperclip心跳检测
run: |
curl -X POST ${{ secrets.PAPERCLIP_API_URL }}/agents/${{ secrets.AGENT_ID }}/heartbeat \
-H "Authorization: Bearer ${{ secrets.PAPERCLIP_API_KEY }}"
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}With Docker
与Docker集成
dockerfile
FROM node:20-slimdockerfile
FROM node:20-slimInstall Python and Hermes
安装Python和Hermes
RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip3 install hermes-agent
RUN apt-get update && apt-get install -y python3 python3-pip
RUN pip3 install hermes-agent
Install adapter
安装适配器
WORKDIR /app
COPY package*.json ./
RUN npm install hermes-paperclip-adapter
WORKDIR /app
COPY package*.json ./
RUN npm install hermes-paperclip-adapter
Run Paperclip server with adapter
运行带适配器的Paperclip服务器
CMD ["npm", "start"]
undefinedCMD ["npm", "start"]
undefinedWith Kubernetes CronJob
与Kubernetes CronJob集成
yaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: hermes-agent
spec:
schedule: "*/15 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hermes
image: paperclip/hermes-agent:latest
env:
- name: ANTHROPIC_API_KEY
valueFrom:
secretKeyRef:
name: api-keys
key: anthropic
- name: PAPERCLIP_API_URL
value: "http://paperclip-server:3100/api"
restartPolicy: OnFailureyaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: hermes-agent
spec:
schedule: "*/15 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hermes
image: paperclip/hermes-agent:latest
env:
- name: ANTHROPIC_API_KEY
valueFrom:
secretKeyRef:
name: api-keys
key: anthropic
- name: PAPERCLIP_API_URL
value: "http://paperclip-server:3100/api"
restartPolicy: OnFailure