Communitygithub.com

自治Agent协调器

将Claude Code转变为功能完整的自治Agent系统,集成持久记忆、定时任务、计算机使用和任务队列,替代Hermes、AutoGPT等独立的Agent框架。

自治Agent协调器 是什么?

Autonomous Agent Harness 是一个针对Claude Code的引擎级技能,旨在将其打造成一个连续运行、上下文感知的自治Agent系统。该技能提供了一套模式而非始终在线的运行时,核心组件包括持久记忆(借助内置Markdown记忆系统和MCP记忆服务器)、定时操作(通过Claude Code原生循环任务和外部调度器)、远程Agent分发(通过CI工作流和Webhook)、计算机使用(需单独配置浏览器/桌面集成环境)以及跨会话任务队列。它支持多种平台,可在GitHub Actions、CI/CD管道和本地Shell环境下运行。使用前需用户明确授权自治范围,并提供安全边界和截止机制。该技能特别适合需要持续监控、定期审查、自动研究或会议准备的开发者,但需注意令牌消耗和权限管理。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/autonomous-agent-harness

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

自治Agent协调器 是做什么的?

将Claude Code的会话工具与独立配置的调度、记忆和计算机使用集成。这是一个设置模式,而非始终在线的运行时。

同意与安全边界

自治操作必须由用户明确请求并限定范围。除非用户已批准该能力以及当前设置的目标工作区,否则不得创建计划、分发远程Agent、写入持久记忆、使用计算机控制、对外发布、修改第三方资源或处理私人通信。

在启用定期或事件驱动操作前,优先使用试运行计划(dry-run)和本地队列文件。将凭据、私有工作区导出、个人数据集和账户特定自动化排除在可重用的ECC工件之外。

何时启用

  • 用户希望Agent持续运行或按计划运行
  • 搭建定期触发的自动化工作流
  • 构建跨会话记住上下文的个人AI助手
  • 用户说“每天运行这个”、“定期检查这个”、“持续监控”
  • 希望复制Hermes、AutoGPT或类似自治Agent框架的功能
  • 需要将计算机使用与定时执行结合使用

架构

┌──────────────────────────────────────────────────────────────┐
│                    Claude Code 运行时                         │
│                                                              │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌─────────────┐ │
│  │  Crons   │  │ Dispatch │  │ Memory   │  │ Computer    │ │
│  │ 计划任务  │  │ 远程Agent│  │ 记忆存储  │  │ 使用        │ │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘  └──────┬──────┘ │
│       │              │             │                │        │
│       ▼              ▼             ▼                ▼        │
│  ┌──────────────────────────────────────────────────────┐    │
│  │              ECC 技能 + Agent 层                       │    │
│  │                                                      │    │
│  │  skills/     agents/     commands/     hooks/        │    │
│  └──────────────────────────────────────────────────────┘    │
│       │              │             │                │        │
│       ▼              ▼             ▼                ▼        │
│  ┌──────────────────────────────────────────────────────┐    │
│  │              MCP 服务器层                              │    │
│  │                                                      │    │
│  │  memory    github    exa    supabase    browser-use  │    │
│  └──────────────────────────────────────────────────────┘    │
└──────────────────────────────────────────────────────────────┘

核心组件

1. 持久记忆

使用Claude Code内置的记忆系统,并通过MCP记忆服务器增强以支持结构化数据。

内置记忆(~/.claude/projects/*/memory/):

  • 用户偏好、反馈、项目上下文
  • 存储为带有前置元数据的Markdown文件
  • 会话启动时自动加载

MCP记忆服务器(结构化知识图谱):

  • 实体、关系、观察
  • 可查询的图结构
  • 跨会话持久化

记忆模式:

# 短期:当前会话上下文
使用TodoWrite进行会话内任务跟踪

# 中期:项目记忆文件
写入 ~/.claude/projects/*/memory/ 以实现跨会话回忆

# 长期:MCP知识图谱
使用 mcp__memory__create_entities 创建永久结构化数据
使用 mcp__memory__create_relations 进行关系映射
使用 mcp__memory__add_observations 为已知实体添加新事实

2. 定时操作(Crons)

使用Claude Code内置的定时任务在交互式会话内执行周期性提示。这些任务限定在会话范围内;如果工作需要在会话关闭后独立运行,则需要外部调度器。/loop 不需要调度MCP服务器。

设置定时任务:

# 在交互式Claude Code会话中
/loop 30m 审查此仓库中的开放PR并总结CI失败情况。

如果要通过Shell单次运行,请在调用CLI之前设置工作目录:

cd "/path/to/repo" && claude -p "审查开放PR并总结"

使用操作系统调度器或CI计划来重复调用该命令(当没有交互式会话运行时)。请单独配置运行器的认证和工具权限。

有用的定时模式:

模式计划使用场景
每日站会0 9 * * 1-5审查PR、问题、部署状态
每周回顾0 10 * * 1代码质量指标、测试覆盖率
每小时监控0 * * * *生产健康、错误率检查
夜间构建0 2 * * *运行完整测试套件、安全扫描
会前准备*/30 * * * *为即将到来的会议准备上下文

3. 分发/远程Agent

让已认证的CI作业或Webhook接收器在其拥有的工作区中调用Claude Code。支持的入口点是程序化CLI模式,而不是公共的Anthropic分发端点。

分发模式:

# 在CI工作区内运行
cd "/path/to/repo" && claude -p "主分支构建失败。诊断失败原因。"

# 从Webhook触发
# GitHub webhook -> 已认证的CI运行器 -> claude -p -> 可审查的结果

# 从另一个Agent触发
claude -p "分析安全扫描的输出,并为发现创建问题"

4. 计算机使用

计算机控制需要单独配置的集成。Anthropic的计算机使用工具和参考环境需要一个应用程序来在隔离的桌面环境中执行工具调用。添加MCP包名并不会自动提供该环境。

功能:

  • 浏览器自动化(导航、点击、填表、截图)
  • 桌面控制(打开应用程序、输入、鼠标控制)
  • 超出CLI的文件系统操作

在协调器中的使用场景:

  • Web UI的自动化测试
  • 表单填写和数据输入
  • 基于截图的监控
  • 多应用工作流

5. 任务队列

管理一个持久任务队列,该队列在会话边界间存续。

实现:

# 通过记忆实现任务持久化
将任务队列写入 ~/.claude/projects/*/memory/task-queue.md

# 任务格式
---
name: task-queue
type: project
description: 用于自治操作的持久任务队列
---

## 活跃任务
- [ ] PR #123: 审查并在CI通过时批准
- [ ] 监控部署:每30分钟检查一次/health,持续2小时
- [ ] 研究:在AI工具领域找到5个潜在客户

## 已完成
- [x] 每日站会:审查了3个PR,2个问题

替换 Hermes

Hermes 组件ECC 等效组件如何实现
Gateway/RouterCLI + 外部调度器已认证的运行器启动Agent会话
记忆系统Claude记忆 + MCP记忆服务器内置持久化 + 知识图谱
工具注册表MCP服务器动态加载工具提供者
编排ECC技能 + Agent技能定义指导Agent行为
计算机使用单独配置的集成隔离环境中的浏览器或桌面控制
上下文管理器会话管理 + 记忆ECC 2.0 会话生命周期
任务队列记忆持久化的任务列表TodoWrite + 记忆文件

设置指南

步骤1:配置MCP服务器

记忆MCP是可选的。MCP参考记忆服务器以@modelcontextprotocol/server-memory发布;版本2026.8.31于2026-09-07在公共npm注册表上验证。这是参考实现,而非ECC捆绑服务。

在审查该包并批准使用后,将此条目合并到用户范围的MCP配置中(~/.claude.json),保留现有设置。将MEMORY_FILE_PATH替换为您拥有的私有目录的绝对路径。有关CLI注册和Windows cmd /c npx配置,请参阅Claude Code MCP配置。

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/[email protected]"],
      "env": {
        "MEMORY_FILE_PATH": "/absolute/path/to/private/memory.jsonl"
      }
    }
  }
}

不要注册猜测的或未发布的npm包:npx -y 会执行以后在该名称下发布的任何内容。在添加其他服务器之前,请验证确切的包名、发布者和版本。调度和计算机使用不需要前面列出的三个未发布的包名。

步骤2:创建基本定时任务

对于交互式会话期间的轮询,请输入:

/loop 30m 审查此仓库中的开放PR并总结CI失败情况。

对于需要跨会话存续的每日或每周工作,请配置外部调度器(如操作系统cron作业或GitHub Actions)来运行核心组件步骤2中的一次性命令。调用 claude -p 来请求调度并不会提供始终在线的调度器。在启用之前,请明确选择计划、工作区和允许的操作。

步骤3:初始化记忆图谱

# 引导身份和上下文
claude -p "为我(用户资料)、我的项目、我的关键联系人创建记忆实体。添加关于当前优先级的观察。"

步骤4:启用计算机使用(可选)

遵循上面链接的计算机使用参考环境,或您已审查的特定浏览器集成的文档。仅授予所需的权限,并在添加到计划工作流之前,在隔离环境中验证一个无害的操作。

示例工作流

自治PR审查器

计划:工作时间内每30分钟
1. 检查受监控仓库上的新PR
2. 对于每个新PR:
   - 本地拉取分支
   - 运行测试
   - 使用代码审查Agent审查更改
   - 通过GitHub MCP发布审查评论
3. 更新记忆中的审查状态

个人研究Agent

计划:每天早上6点
1. 检查记忆中保存的搜索查询
2. 对每个查询运行Exa搜索
3. 总结新发现
4. 与昨天的结果进行比较
5. 将报告写入记忆
6. 标记高优先级事项以供早上审查

会议准备Agent

触发:每个日历事件前30分钟
1. 读取日历事件详情
2. 搜索记忆中关于与会者的上下文
3. 提取与与会者相关的近期邮件/Slack讨论
4. 准备谈话要点和议程建议
5. 将准备文档写入记忆

约束

  • 原生定时提示共享其交互式会话。除非显式恢复,否则外部调度器调用会启动新会话。
  • 计算机使用需要明确的权限授予。不要假定有权访问。
  • CLI自动化仍然消耗模型使用量,并受配置提供者的限制。选择适当的调度器间隔。
  • 记忆文件应保持简洁。归档旧数据,而不是让文件无限增长。
  • 始终验证定时任务是否成功完成。向定时提示添加错误处理。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能