Communitygithub.com

自主代理框架

將 Claude Code 轉變為具備持久記憶、排程操作、電腦使用與任務佇列功能的完全自主代理系統。取代獨立的代理框架 (如 Hermes、AutoGPT),充分利用 Claude Code。

自主代理框架 是什麼?

這是一個將 Claude Code 轉化為可自主運作的代理系統的設定模式,而非一個捆綁式的持續運行環境。它整合了排程、記憶與電腦使用等分離配置的元件,讓開發者能建立持續監控、自動化工作流程或跨會話上下文的個人 AI 助理。此技能支援 Claude Code 平台,並透過 MCP 伺服器層提供擴充能力,如記憶知識圖譜、GitHub 整合、瀏覽器自動化等。其核心元件包括使用 Claude Code 內建記憶與 MCP 記憶伺服器的持久記憶、透過 `/loop` 命令或外部排程器實現的排程操作、經由 CI 或 Webhook 驅動的遠端代理調度、以及需分開設定的電腦使用功能。此技能特別適合取代 Hermes、AutoGPT 等自主代理框架,提供更靈活且與 Claude Code 緊密整合的替代方案。

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

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

自主代理框架 是做什麼的?

結合 Claude Code 的會話工具與分開配置的排程、記憶和電腦使用整合。這是一個設定模式,而非一個捆綁式的持續運行環境。

同意與安全邊界

自主操作必須由使用者明確要求並界定範圍。除非使用者已核准該功能及目前設定的目標工作區,否則請勿建立排程、派遣遠端代理、寫入持久記憶、使用電腦控制、對外發布、修改第三方資源,或處理私人通訊。

在啟用定期或事件驅動動作之前,建議先進行乾執行計畫並使用本地佇列檔案。請將憑證、私人工作區匯出檔、個人資料集以及帳戶專用的自動化流程排除在可重複使用的 ECC 成品之外。

何時啟用

  • 使用者希望有一個能持續執行或依排程執行的代理
  • 正在設定會定期觸發的自動化工作流程
  • 正在建立一個能跨會話記憶上下文的個人 AI 助理
  • 使用者說「每天執行這個」、「定期檢查這個」、「持續監控」
  • 想要複製 Hermes、AutoGPT 或類似自主代理框架的功能
  • 需要結合電腦使用與排程執行

架構

┌──────────────────────────────────────────────────────────────┐
│                    Claude Code 執行環境                        │
│                                                              │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌─────────────┐ │
│  │  排程    │  │  派遣    │  │  記憶    │  │  電腦使用   │ │
│  │          │  │  遠端代理  │  │  儲存    │  │             │ │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘  └──────┬──────┘ │
│       │              │             │                │        │
│       ▼              ▼             ▼                ▼        │
│  ┌──────────────────────────────────────────────────────┐    │
│  │              ECC 技能 + 代理層                        │    │
│  │                                                      │    │
│  │  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. 排程操作

使用 Claude Code 原生的排程任務在互動式會話中執行定期提示。這些任務是會話範圍內的;若需在開啟的會話之外獨立執行的工作,則需要外部排程器。排程操作不需要額外的 MCP 伺服器。

設定排程:

# 在互動式 Claude Code 會話中
/loop 30m 檢查此儲存庫中的開放 PR 並總結 CI 失敗。

如需從 shell 執行一次性任務,請在呼叫 CLI 前先設定工作目錄:

cd "/path/to/repo" && claude -p "Review open PRs and summarize"

當沒有互動式會話在執行時,請使用作業系統排程器或 CI 排程來重複呼叫該命令。請分別設定執行者的驗證和工具權限。

實用的排程模式:

模式排程使用案例
每日站立會議0 9 * * 1-5審查 PR、問題、部署狀態
每週回顧0 10 * * 1程式碼品質指標、測試覆蓋率
每小時監控0 * * * *生產環境健康狀態、錯誤率檢查
夜間建置0 2 * * *執行完整測試套件、安全掃描
會議前準備*/30 * * * *為即將到來的會議準備上下文

3. 派遣 / 遠端代理

讓已驗證的 CI 工作或 Webhook 接收器在其擁有的工作區中呼叫 Claude Code。支援的進入點是程式化 CLI 模式,而非公開的 Anthropic 派遣端點。

派遣模式:

# 在 CI 工作區內執行
cd "/path/to/repo" && claude -p "Build failed on main. Diagnose the failure."

# 從 Webhook 觸發
# GitHub webhook -> 已驗證的 CI 執行器 -> claude -p -> 可審查的結果

# 從另一個代理觸發
claude -p "Analyze the output of the security scan and create issues for findings"

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 等效元件方式
閘道器/路由器CLI + 外部排程器已驗證的執行器啟動代理會話
記憶系統Claude 記憶 + MCP 記憶伺服器內建持久性 + 知識圖譜
工具註冊表MCP 伺服器動態載入的工具提供者
編排ECC 技能 + 代理技能定義引導代理行為
電腦使用分開設定的整合隔離環境中的瀏覽器或桌面控制
上下文管理器會話管理 + 記憶ECC 2.0 會話生命週期
任務佇列記憶體持久化的任務清單TodoWrite + 記憶檔案

設定指南

步驟 1:設定 MCP 伺服器

記憶 MCP 是選用的。MCP 參考記憶伺服器 以 @modelcontextprotocol/server-memory 發布;版本 2026.8.31 已於 2026-09-07 在公開 npm 註冊表中驗證。這是一個參考實作,而非 ECC 捆綁的服務。

審查該套件並核准使用後,將此條目合併到 ~/.claude.json 中的使用者範圍 MCP 設定中,保留現有設定。將 MEMORY_FILE_PATH 替換為您擁有的私人目錄中的絕對路徑。請參閱 Claude Code MCP 設定 了解 CLI 註冊和 Windows cmd /c npx 設定。

{
  "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 "Create memory entities for: me (user profile), my projects, my key contacts. Add observations about current priorities."

步驟 4:啟用電腦使用 (選用)

請依照上述連結的電腦使用參考環境,或您已審查過的特定瀏覽器整合文件。僅授予必要的權限,並在將其加入排程工作流程之前,先在隔離環境中驗證一個無害的動作。

範例工作流程

自主 PR 審查者

排程:工作時間每 30 分鐘一次
1. 檢查已關注儲存庫的新 PR
2. 針對每個新 PR:
   - 在本地拉取分支
   - 執行測試
   - 使用程式碼審查代理審查變更
   - 透過 GitHub MCP 發布審查評論
3. 使用審查狀態更新記憶

個人研究代理

排程:每天上午 6 點
1. 檢查記憶中儲存的搜尋查詢
2. 為每個查詢執行 Exa 搜尋
3. 總結新的發現
4. 與前一天的結果進行比較
5. 將摘要寫入記憶
6. 標記高優先級項目供早上審查

會議準備代理

觸發:每個日曆事件前 30 分鐘
1. 讀取日曆事件詳細資料
2. 搜尋記憶以取得與會者的上下文
3. 拉取與與會者相關的最新電子郵件/Slack 討論串
4. 準備談話要點和議程建議
5. 將準備文件寫入記憶

限制

  • 原生排程提示與其互動式會話共用。外部排程器呼叫會啟動獨立的會話,除非明確恢復。
  • 電腦使用需要明確的權限授予。請勿假設有權限。
  • CLI 自動化仍會消耗模型使用量,並受設定提供者的限制。請選擇適當的排程器間隔。
  • 記憶檔案應保持簡潔。封存舊資料,而不是讓檔案無限制增長。
  • 務必驗證排程任務已成功完成。在 cron 提示中加入錯誤處理。

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/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

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.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相關技能