agentation by supercent-io/skills-template
npx skills add https://github.com/supercent-io/skills-template --skill agentation连接人眼与智能体代码的缺失环节。
无需描述“侧边栏中的蓝色按钮”,您可以直接将
.sidebar > button.primary交给智能体。它可以直接grep这个选择器。
agent-browser + 自动驾驶模式进行自主设计评审 agentation (monorepo)
├── agentation → npm: agentation (React 工具栏组件)
│ └── src/index.ts → 导出 Agentation 组件 + 类型 + 工具函数
└── agentation-mcp → npm: agentation-mcp (MCP 服务器 + CLI)
├── src/cli.ts → agentation-mcp CLI (init, server, doctor)
└── src/server/ → HTTP REST API (端口 4747) + SSE 事件 + MCP stdio 工具
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
两种操作模式:
| 模式 | 工作原理 |
|---|---|
| 复制粘贴 | 用户批注 → 点击复制 → 将 Markdown 粘贴到智能体聊天中 |
| 智能体同步 | endpoint 属性将工具栏连接到 MCP 服务器 → 智能体使用 agentation_watch_annotations 循环 |
npm install agentation -D
# 或: pnpm add agentation -D / yarn add agentation -D / bun add agentation -D
要求:React 18+,桌面浏览器,除 React 外零运行时依赖(仅限桌面端 — 不支持移动端)
🔗 设计上本地优先:批注存储在本地,并在连接到 MCP 服务器时自动同步。
- 离线操作 — 无需服务器即可创建批注
- 会话连续性 — 页面刷新后同一会话持续存在,无重复
- 智能体优先 — 由智能体处理解决/驳回操作
最快的方法 — 自动检测所有已安装的智能体并进行配置(Claude Code、Cursor、Codex、Windsurf 以及 9+ 其他智能体):
npx add-mcp "npx -y agentation-mcp server"
或手动安装:
npm install agentation-mcp -D
npx agentation-mcp server # HTTP :4747 + MCP stdio
npx agentation-mcp server --port 8080 # 自定义端口
npx agentation-mcp doctor # 验证设置
推荐给 Claude Code 用户 — 自动处理框架检测、包安装和布局集成:
npx skills add benjitaylor/agentation
# 然后在 Claude Code 中:
/agentation
import { Agentation } from 'agentation';
function App() {
return (
<>
<YourApp />
{process.env.NODE_ENV === 'development' && <Agentation />}
</>
);
}
// app/layout.tsx
import { Agentation } from 'agentation';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
{children}
{process.env.NODE_ENV === 'development' && (
<Agentation endpoint="http://localhost:4747" />
)}
</body>
</html>
);
}
// pages/_app.tsx
import { Agentation } from 'agentation';
export default function App({ Component, pageProps }) {
return (
<>
<Component {...pageProps} />
{process.env.NODE_ENV === 'development' && (
<Agentation endpoint="http://localhost:4747" />
)}
</>
);
}
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
endpoint | string | — | 用于智能体同步模式的 MCP 服务器 URL |
sessionId | string | — | 要加入的现有会话 ID |
onAnnotationAdd | (a: Annotation) => void | — | 创建批注时的回调 |
onAnnotationDelete | (a: Annotation) => void | — | 删除批注时的回调 |
onAnnotationUpdate | (a: Annotation) => void | — | 编辑批注时的回调 |
onAnnotationsClear | (a: Annotation[]) => void | — | 全部清除时的回调 |
onCopy | (markdown: string) => void | — | 复制时带有 Markdown 的回调 |
onSubmit | (output: string, annotations: Annotation[]) => void | — | 点击“发送批注”时触发 |
copyToClipboard | boolean | true | 设置为 false 以禁止写入剪贴板 |
onSessionCreated | (sessionId: string) => void | — | 新会话创建时调用 |
webhookUrl | string | — | 接收批注事件的 Webhook URL |
最快的方法 — 通用 (自动检测 9+ 智能体):
npx add-mcp "npx -y agentation-mcp server"
add-mcp 自动检测 Claude Code、Cursor、Codex、Windsurf 等,并直接写入正确的配置。
启动服务器 / 验证:
npx agentation-mcp server # HTTP :4747 + MCP stdio
npx agentation-mcp server --port 8080 # 自定义端口
npx agentation-mcp doctor # 验证设置
.claude/)最简设置 — 官方 Claude Code 技能 (推荐):
npx skills add benjitaylor/agentation
# 在 Claude Code 中:
/agentation
通用 MCP 自动设置 (Claude Code + 9+ 智能体):
npx add-mcp "npx -y agentation-mcp server"
交互式向导 (仅限 Claude Code):
npx agentation-mcp init
选项 A — CLI (推荐):
claude mcp add agentation -- npx -y agentation-mcp server
选项 B — 配置文件 (~/.claude/claude_desktop_config.json 用于全局,或 .claude/mcp.json 用于项目级):
{
"mcpServers": {
"agentation": {
"command": "npx",
"args": ["-y", "agentation-mcp", "server"]
}
}
}
交互式向导 (仅限 Claude Code):
npx agentation-mcp init
UserPromptSubmit 钩子 — 在每条消息上自动注入待处理的批注。添加到 .claude/settings.json (项目) 或 ~/.claude/settings.json (全局):
{
"hooks": {
"UserPromptSubmit": [
{
"type": "command",
"command": "curl -sf --connect-timeout 1 http://localhost:4747/pending 2>/dev/null | python3 -c \"import sys,json;d=json.load(sys.stdin);c=d['count'];exit(0)if c==0 else[print(f'\\n=== AGENTATION: {c} UI annotations ===\\n'),*[print(f\\\"[{i+1}] {a['element']} ({a['elementPath']})\\n {a['comment']}\\n\\\")for i,a in enumerate(d['annotations'])],print('=== END ===\\n')]\" 2>/dev/null;exit 0"
}
]
}
}
~/.codex/)添加到 ~/.codex/config.toml:
# Agentation MCP Server
[[mcp_servers]]
name = "agentation"
command = "npx"
args = ["-y", "agentation-mcp", "server"]
# 可选:教导 Codex 关于监控循环
developer_instructions = """
When user says "watch mode" or "agentation watch", call agentation_watch_annotations in a loop.
For each annotation: acknowledge it, fix the code using the elementPath CSS selector, resolve with summary.
"""
编辑 config.toml 后重启 Codex CLI。
~/.gemini/)选项 A — CLI:
gemini mcp add agentation npx -y agentation-mcp server
# 或使用显式作用域
gemini mcp add -s user agentation npx -y agentation-mcp server
选项 B — 配置文件 (~/.gemini/settings.json 用于全局,.gemini/settings.json 用于项目):
{
"mcpServers": {
"agentation": {
"command": "npx",
"args": ["-y", "agentation-mcp", "server"]
}
}
}
AfterAgent 钩子 — 在每次智能体回合后触发批注检查:
{
"mcpServers": {
"agentation": {
"command": "npx",
"args": ["-y", "agentation-mcp", "server"]
}
},
"hooks": {
"AfterAgent": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "curl -sf --connect-timeout 1 http://localhost:4747/pending 2>/dev/null | python3 -c \"import sys,json;d=json.load(sys.stdin);c=d.get('count',0);[print(f'[agentation] {c} pending annotations'),exit(1)]if c>0 else exit(0)\" 2>/dev/null;exit 0",
"description": "Check for pending agentation annotations"
}
]
}
]
}
}
~/.config/opencode/)添加到 ~/.config/opencode/opencode.json:
{
"mcp": {
"agentation": {
"type": "local",
"command": ["npx", "-y", "agentation-mcp", "server"]
}
}
}
使用环境变量:
{
"mcp": {
"agentation": {
"type": "local",
"command": ["npx", "-y", "agentation-mcp", "server"],
"environment": {
"AGENTATION_STORE": "sqlite",
"AGENTATION_EVENT_RETENTION_DAYS": "7"
}
}
}
}
编辑后重启 OpenCode。MCP 工具 (agentation_*) 将立即可用。
适用于任何兼容 MCP 的智能体:
npx add-mcp "npx -y agentation-mcp server"
保存并运行 bash setup-agentation-mcp.sh [--all | --claude | --codex | --gemini | --opencode]:
#!/usr/bin/env bash
# setup-agentation-mcp.sh — 为所有智能体平台注册 agentation MCP
set -euo pipefail
SETUP_CLAUDE=false; SETUP_CODEX=false; SETUP_GEMINI=false; SETUP_OPENCODE=false
while [[ $# -gt 0 ]]; do
case "$1" in
--claude) SETUP_CLAUDE=true ;;
--codex) SETUP_CODEX=true ;;
--gemini) SETUP_GEMINI=true ;;
--opencode) SETUP_OPENCODE=true ;;
--all) SETUP_CLAUDE=true; SETUP_CODEX=true; SETUP_GEMINI=true; SETUP_OPENCODE=true ;;
esac
shift
done
[[ "$SETUP_CLAUDE$SETUP_CODEX$SETUP_GEMINI$SETUP_OPENCODE" == "falsefalsefalsefalse" ]] && \
SETUP_CLAUDE=true && SETUP_CODEX=true && SETUP_GEMINI=true && SETUP_OPENCODE=true
MCP_JSON='"agentation": {"command": "npx", "args": ["-y", "agentation-mcp", "server"]}'
# Claude Code
if [[ "$SETUP_CLAUDE" == "true" ]]; then
mkdir -p ~/.claude
CFG=~/.claude/claude_desktop_config.json
if [[ -f "$CFG" ]] && command -v jq &>/dev/null; then
jq ".mcpServers += {$MCP_JSON}" "$CFG" > "$CFG.tmp" && mv "$CFG.tmp" "$CFG"
else
echo "{\"mcpServers\": {$MCP_JSON}}" > "$CFG"
fi
echo "✅ Claude Code: $CFG"
fi
# Codex CLI
if [[ "$SETUP_CODEX" == "true" ]]; then
mkdir -p ~/.codex
CFG=~/.codex/config.toml
if ! grep -q "agentation" "$CFG" 2>/dev/null; then
printf '\n[[mcp_servers]]\nname = "agentation"\ncommand = "npx"\nargs = ["-y", "agentation-mcp", "server"]\n' >> "$CFG"
fi
echo "✅ Codex CLI: $CFG"
fi
# Gemini CLI
if [[ "$SETUP_GEMINI" == "true" ]]; then
mkdir -p ~/.gemini
CFG=~/.gemini/settings.json
if [[ -f "$CFG" ]] && command -v jq &>/dev/null; then
jq ".mcpServers += {$MCP_JSON}" "$CFG" > "$CFG.tmp" && mv "$CFG.tmp" "$CFG"
else
echo "{\"mcpServers\": {$MCP_JSON}}" > "$CFG"
fi
echo "✅ Gemini CLI: $CFG"
fi
# OpenCode
if [[ "$SETUP_OPENCODE" == "true" ]]; then
mkdir -p ~/.config/opencode
CFG=~/.config/opencode/opencode.json
ENTRY='"agentation": {"type": "local", "command": ["npx", "-y", "agentation-mcp", "server"]}'
if [[ -f "$CFG" ]] && command -v jq &>/dev/null; then
jq ".mcp += {$ENTRY}" "$CFG" > "$CFG.tmp" && mv "$CFG.tmp" "$CFG"
else
echo "{\"mcp\": {$ENTRY}}" > "$CFG"
fi
echo "✅ OpenCode: $CFG"
fi
echo ""
echo "Done. Restart your agent(s) and run: npx agentation-mcp server"
| 工具 | 参数 | 描述 |
|---|---|---|
agentation_list_sessions | 无 | 列出所有活动的批注会话 |
agentation_get_session | sessionId: string | 获取包含所有批注的会话 |
agentation_get_pending | sessionId: string | 获取会话的待处理批注 |
agentation_get_all_pending | 无 | 获取所有会话中待处理的批注 |
agentation_acknowledge | annotationId: string | 将批注标记为已确认(智能体正在处理) |
agentation_resolve | annotationId: string, summary?: string | 标记为已解决,可附带摘要 |
agentation_dismiss | annotationId: string, reason: string | 驳回,需提供原因 |
agentation_reply | annotationId: string, message: string | 向批注线程添加回复 |
agentation_watch_annotations | sessionId?: string, batchWindowSeconds?: number (默认 10, 最大 60), timeoutSeconds?: number (默认 120, 最大 300) | 阻塞直到新批注到达 — 核心监控循环工具 |
1. 用户在浏览器中打开应用
2. 点击 agentation 工具栏 → 激活
3. 点击元素 → 添加评论 → 点击复制
4. 将 Markdown 输出粘贴到智能体聊天中
5. 智能体接收 CSS 选择器、elementPath、boundingBox
6. 智能体使用选择器进行 grep/编辑代码
智能体: agentation_watch_annotations (最多阻塞 120 秒)
→ 用户在浏览器中添加批注
→ 智能体立即接收批注批次
→ 智能体: agentation_acknowledge(annotationId)
→ 智能体使用 elementPath 作为 grep 目标进行代码更改
→ 智能体: agentation_resolve(annotationId, "将按钮颜色更改为 #3b82f6")
→ 智能体: agentation_watch_annotations (再次循环)
CLAUDE.md / GEMINI.md / Codex developer_instructions — 为自动化监控添加:
When I say "watch mode" or "agentation watch", call agentation_watch_annotations in a loop.
For each annotation received:
1. Call agentation_acknowledge(annotationId)
2. Use elementPath to locate the code: Grep(elementPath) or search codebase for CSS class
3. Make the minimal change described in the comment
4. Call agentation_resolve(annotationId, "<brief summary of what was changed>")
Continue watching until I say stop, or until timeout.
第 4 节中的钩子会自动将待处理批注附加到每条智能体消息 — 无需“监控模式”。适用于所有平台。
双智能体设置,用于完全自主的 UI 评审循环:
会话 1 (评审者 — 使用 agent-browser):
# 启动指向开发服务器的有头浏览器
agent-browser open http://localhost:3000
agent-browser snapshot -i
# 智能体通过 agentation 工具栏导航、点击元素、添加评审意见
# 批注自动流向 agentation MCP 服务器
会话 2 (修复者 — 监控 MCP):
agentation_watch_annotations → 接收评审意见 → 确认 → 编辑 → 解决 → 循环
<Agentation webhookUrl="https://your-server.com/webhook" />
# 或环境变量:
# AGENTATION_WEBHOOK_URL=https://your-server.com/webhook
type Annotation = {
// 核心
id: string;
x: number; // 视口宽度的百分比 (0-100)
y: number; // 距离文档顶部的像素值
comment: string; // 用户的反馈文本
element: string; // 标签名称: "button", "div" 等
elementPath: string; // CSS 选择器: "body > main > button.cta" ← grep 目标
timestamp: number;
// 上下文
selectedText?: string;
boundingBox?: { x: number; y: number; width: number; height: number };
nearbyText?: string;
cssClasses?: string;
nearbyElements?: string;
computedStyles?: string;
fullPath?: string;
accessibility?: string;
reactComponents?: string; // "App > Dashboard > Button" ← 组件 grep 目标
isMultiSelect?: boolean;
isFixed?: boolean;
// 生命周期 (服务器同步)
sessionId?: string;
url?: string;
intent?: "fix" | "change" | "question" | "approve";
severity?: "blocking" | "important" | "suggestion";
status?: "pending" | "acknowledged" | "resolved" | "dismissed";
thread?: ThreadMessage[];
createdAt?: string;
updatedAt?: string;
resolvedAt?: string;
resolvedBy?: "human" | "agent";
};
批注生命周期:
pending → acknowledged → resolved
↘ dismissed (requires reason)
# 会话
POST /sessions # 创建会话
GET /sessions # 列出所有会话
GET /sessions/:id # 获取会话 + 批注
# 批注
POST /sessions/:id/annotations # 添加批注
GET /annotations/:id # 获取批注
PATCH /annotations/:id # 更新批注
DELETE /annotations/:id # 删除批注
GET /sessions/:id/pending # 会话的待处理批注
GET /pending # 所有会话中的待处理批注
# 事件 (SSE 流)
GET /sessions/:id/events # 会话流
GET /events # 全局流 (?domain=filter)
# 健康检查
GET /health
GET /status
| 变量 | 描述 | 默认值 |
|---|---|---|
AGENTATION_STORE | memory 或 sqlite | sqlite |
AGENTATION_WEBHOOK_URL | 单个 webhook URL | — |
AGENTATION_WEBHOOKS | 逗号分隔的 webhook URL 列表 | — |
AGENTATION_EVENT_RETENTION_DAYS | 保留事件的天数 | 7 |
SQLite 存储:~/.agentation/store.db
import {
identifyElement, identifyAnimationElement,
getElementPath, getNearbyText, getElementClasses,
isInShadowDOM, getShadowHost, closestCrossingShadow,
loadAnnotations, saveAnnotations, getStorageKey,
type Annotation, type Session, type ThreadMessage,
} from 'agentation';
| 平台 | 配置文件 | MCP 键 | 钩子 |
|---|---|---|---|
| Claude Code | ~/.claude/claude_desktop_config.json | mcpServers | settings.json 中的 hooks.UserPromptSubmit |
| Codex CLI | ~/.codex/config.toml | [[mcp_servers]] (TOML) | developer_instructions + notify |
| Gemini CLI | ~/.gemini/settings.json | mcpServers | settings.json 中的 hooks.AfterAgent |
| OpenCode | ~/.config/opencode/opencode.json | mcp (type: "local") | 技能系统 (无需钩子) |
| Cursor / Windsurf | .cursor/mcp.json / .windsurf/mcp.json | mcpServers | — |
NODE_ENV === 'development' 来限制 <Agentation> — 切勿发布到生产环境agentation_acknowledge — 向用户发出信号agentation_resolve 中包含 summary — 为用户提供可追溯性severity: "blocking" 的批注elementPath 作为代码中的主要 grep/搜索目标 — 它是一个有效的 CSS 选择器reactComponents 字段 — 直接匹配组件名称agentation 的有头模式下使用 agent-browseragentation 集成为 jeo 技能的 VERIFY_UI 阶段。这遵循与在
planui/ExitPlanMode中运行的 plannotator 相同的模式。annotate是主要关键字。agentui作为向后兼容的别名保留。
plannotator (planui): agentation (annotate):
Write plan.md 在应用 UI 中挂载 <Agentation>
↓ blocking ↓ blocking
Run plannotator agentation_watch_annotations
↓ ↓
Approve/Feedback in UI 在 UI 中创建批注
↓ ↓
Confirm approved:true 批注 确认→修复→解决
↓ ↓
Enter EXECUTE 下一步或循环
| 关键字 | 平台 | 动作 |
|---|---|---|
annotate | Claude Code | agentation_watch_annotations MCP 阻塞调用 |
annotate | Codex | ANNOTATE_READY 信号 → jeo-notify.py HTTP 轮询 |
annotate | Gemini | GEMINI.md 指令: HTTP REST 轮询模式 |
/jeo-annotate | OpenCode | opencode.json mcp.agentation + 指令 |
agentui (已弃用) | 所有平台 | 与上述相同的行为 — 向后兼容的别名 |
UI review | 所有平台 | 与 annotate 相同 |
# 1. 安装 jeo 时自动注册 agentation
bash .agent-skills/jeo/scripts/install.sh --with-agentation
# 或完整安装:
bash .agent-skills/jeo/scripts/install.sh --all
# 2. 在应用中挂载 agentation 组件
# app/layout.tsx 或 pages/_app.tsx:
# <Agentation endpoint="http://localhost:4747" />
# 3. 启动 MCP 服务器
npx agentation-mcp server
# 4. 在智能体中输入 annotate 关键字 → 监控循环启动 (agentui 也可作为向后兼容的别名)
# Claude Code: 直接 MCP 工具调用
# Codex: 输出 ANNOTATE_READY (或 AGENTUI_READY) → notify 钩子自动轮询
# Gemini: GEMINI.md HTTP 轮询模式
# OpenCode: /jeo-annotate 斜杠命令 (或 /jeo-agentui — 已弃用)
plannotator 和 agentation 使用相同的阻塞循环模式,但仅在不同的阶段运行:
| 工具 | 允许的阶段 | 钩子守卫 |
|---|---|---|
| plannotator | 仅 plan | jeo-state.json → phase === "plan" |
| agentation | 仅 verify / verify_ui | jeo-state.json → phase === "verify_ui" |
每个平台的钩子脚本都会检查 jeo-state.json 中的 phase 字段,以防止在错误的阶段执行。没有此守卫,两个工具可能会在 Gemini 的 AfterAgent 钩子中同时运行。
进入 VERIFY_UI 前的 3 步检查:
GET /health — agentation-mcp 服务器是否正在运行GET /sessions — <Agentation> 组件是否已挂载GET /pending — 要处理的批注数量通过后,将 jeo-state.json 中的 phase 设置为 "verify_ui",并将 agentation.active 设置为 true。
# 运行 agentation 监控循环集成测试
bash .agent-skills/agentation/scripts/verify-loop.sh
# 快速测试 (跳过错误情况)
bash .agent-skills/agentation/scripts/verify-loop.sh --quick
4 步验证:服务器健康 → 批注 CRUD → ACK-RESOLVE 循环 → 错误情况
jeo "<task>"
│
[1] PLAN (plannotator 循环) ← 批准 plan.md
[2] EXECUTE (team/bmad)
[3] VERIFY
├─ agent-browser 快照
├─ 飞行前检查 (服务器 + 会话 + 待处理)
└─ annotate → VERIFY_UI (agentation 循环) ← 此阶段 (agentui 也向后兼容)
├─ ACK → FIND → FIX → RESOLVE
├─ 重新快照 (agent-browser) ← 修复后重新检查
└─ 更新 jeo-state.json 中的 agentation 字段
[4] CLEANUP
有关详细的 jeo 集成:请参阅 jeo SKILL.md 第 3.3.1 节详细工作流
agentation@2.2.1, agentation-mcp@1.2.0每周安装
5.4K
仓库
GitHub 星标
88
首次出现
2026年3月4日
安全审计
安装在
gemini-cli5.3K
codex5.3K
opencode5.3K
github-copilot5.2K
cursor5.2K
cline5.2K
The missing link between human eyes and agent code.
Instead of describing "the blue button in the sidebar," you hand the agent
.sidebar > button.primary. It cangrepfor that directly.
agent-browser + self-driving patternagentation (monorepo)
├── agentation → npm: agentation (React toolbar component)
│ └── src/index.ts → exports Agentation component + types + utilities
└── agentation-mcp → npm: agentation-mcp (MCP server + CLI)
├── src/cli.ts → agentation-mcp CLI (init, server, doctor)
└── src/server/ → HTTP REST API (port 4747) + SSE events + MCP stdio tools
Two modes of operation:
| Mode | How it works |
|---|---|
| Copy-Paste | Human annotates → clicks Copy → pastes markdown into agent chat |
| Agent Sync | endpoint prop connects toolbar to MCP server → agent uses agentation_watch_annotations loop |
npm install agentation -D
# or: pnpm add agentation -D / yarn add agentation -D / bun add agentation -D
Requirements : React 18+, desktop browser, zero runtime deps beyond React (desktop only — no mobile)
🔗 Local-first by design : Annotations are stored locally and auto-sync when connected to the MCP server.
- Offline operation — Annotations can be created without a server
- Session continuity — Same session persists after page refresh, no duplicates
- Agent-first — resolve/dismiss is handled by the agent
Fastest method — Auto-detects all installed agents and configures them (Claude Code, Cursor, Codex, Windsurf, and 9+ more agents):
npx add-mcp "npx -y agentation-mcp server"
Or install manually:
npm install agentation-mcp -D
npx agentation-mcp server # HTTP :4747 + MCP stdio
npx agentation-mcp server --port 8080 # custom port
npx agentation-mcp doctor # verify setup
Recommended for Claude Code users — automatically handles framework detection, package installation, and layout integration:
npx skills add benjitaylor/agentation
# then in Claude Code:
/agentation
import { Agentation } from 'agentation';
function App() {
return (
<>
<YourApp />
{process.env.NODE_ENV === 'development' && <Agentation />}
</>
);
}
// app/layout.tsx
import { Agentation } from 'agentation';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
{children}
{process.env.NODE_ENV === 'development' && (
<Agentation endpoint="http://localhost:4747" />
)}
</body>
</html>
);
}
// pages/_app.tsx
import { Agentation } from 'agentation';
export default function App({ Component, pageProps }) {
return (
<>
<Component {...pageProps} />
{process.env.NODE_ENV === 'development' && (
<Agentation endpoint="http://localhost:4747" />
)}
</>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
endpoint | string | — | MCP server URL for Agent Sync mode |
sessionId | string | — | Pre-existing session ID to join |
onAnnotationAdd | (a: Annotation) => void | — |
Fastest method — Universal (auto-detects 9+ agents):
npx add-mcp "npx -y agentation-mcp server"
add-mcp auto-detects Claude Code, Cursor, Codex, Windsurf, and more, writing directly to the correct config.
Start server / verify:
npx agentation-mcp server # HTTP :4747 + MCP stdio
npx agentation-mcp server --port 8080 # custom port
npx agentation-mcp doctor # verify setup
.claude/)Minimal setup — Official Claude Code Skill (Recommended):
npx skills add benjitaylor/agentation
# In Claude Code:
/agentation
Universal MCP auto-setup (Claude Code + 9+ agents):
npx add-mcp "npx -y agentation-mcp server"
Interactive wizard (Claude Code only):
npx agentation-mcp init
Option A — CLI (recommended):
claude mcp add agentation -- npx -y agentation-mcp server
Option B — config file (~/.claude/claude_desktop_config.json for global, or .claude/mcp.json for project-level):
{
"mcpServers": {
"agentation": {
"command": "npx",
"args": ["-y", "agentation-mcp", "server"]
}
}
}
Interactive wizard (Claude Code only):
npx agentation-mcp init
UserPromptSubmit hook — auto-inject pending annotations on every message. Add to .claude/settings.json (project) or ~/.claude/settings.json (global):
{
"hooks": {
"UserPromptSubmit": [
{
"type": "command",
"command": "curl -sf --connect-timeout 1 http://localhost:4747/pending 2>/dev/null | python3 -c \"import sys,json;d=json.load(sys.stdin);c=d['count'];exit(0)if c==0 else[print(f'\\n=== AGENTATION: {c} UI annotations ===\\n'),*[print(f\\\"[{i+1}] {a['element']} ({a['elementPath']})\\n {a['comment']}\\n\\\")for i,a in enumerate(d['annotations'])],print('=== END ===\\n')]\" 2>/dev/null;exit 0"
}
]
}
}
~/.codex/)Add to ~/.codex/config.toml:
# Agentation MCP Server
[[mcp_servers]]
name = "agentation"
command = "npx"
args = ["-y", "agentation-mcp", "server"]
# Optional: teach Codex about watch-loop
developer_instructions = """
When user says "watch mode" or "agentation watch", call agentation_watch_annotations in a loop.
For each annotation: acknowledge it, fix the code using the elementPath CSS selector, resolve with summary.
"""
Restart Codex CLI after editing config.toml.
~/.gemini/)Option A — CLI:
gemini mcp add agentation npx -y agentation-mcp server
# or with explicit scope
gemini mcp add -s user agentation npx -y agentation-mcp server
Option B — config file (~/.gemini/settings.json for global, .gemini/settings.json for project):
{
"mcpServers": {
"agentation": {
"command": "npx",
"args": ["-y", "agentation-mcp", "server"]
}
}
}
AfterAgent hook — trigger annotation check after each agent turn:
{
"mcpServers": {
"agentation": {
"command": "npx",
"args": ["-y", "agentation-mcp", "server"]
}
},
"hooks": {
"AfterAgent": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "curl -sf --connect-timeout 1 http://localhost:4747/pending 2>/dev/null | python3 -c \"import sys,json;d=json.load(sys.stdin);c=d.get('count',0);[print(f'[agentation] {c} pending annotations'),exit(1)]if c>0 else exit(0)\" 2>/dev/null;exit 0",
"description": "Check for pending agentation annotations"
}
]
}
]
}
}
~/.config/opencode/)Add to ~/.config/opencode/opencode.json:
{
"mcp": {
"agentation": {
"type": "local",
"command": ["npx", "-y", "agentation-mcp", "server"]
}
}
}
With environment variables:
{
"mcp": {
"agentation": {
"type": "local",
"command": ["npx", "-y", "agentation-mcp", "server"],
"environment": {
"AGENTATION_STORE": "sqlite",
"AGENTATION_EVENT_RETENTION_DAYS": "7"
}
}
}
}
Restart OpenCode after editing. MCP tools (agentation_*) will be available immediately.
Works for any MCP-compatible agent:
npx add-mcp "npx -y agentation-mcp server"
Save and run bash setup-agentation-mcp.sh [--all | --claude | --codex | --gemini | --opencode]:
#!/usr/bin/env bash
# setup-agentation-mcp.sh — Register agentation MCP for all agent platforms
set -euo pipefail
SETUP_CLAUDE=false; SETUP_CODEX=false; SETUP_GEMINI=false; SETUP_OPENCODE=false
while [[ $# -gt 0 ]]; do
case "$1" in
--claude) SETUP_CLAUDE=true ;;
--codex) SETUP_CODEX=true ;;
--gemini) SETUP_GEMINI=true ;;
--opencode) SETUP_OPENCODE=true ;;
--all) SETUP_CLAUDE=true; SETUP_CODEX=true; SETUP_GEMINI=true; SETUP_OPENCODE=true ;;
esac
shift
done
[[ "$SETUP_CLAUDE$SETUP_CODEX$SETUP_GEMINI$SETUP_OPENCODE" == "falsefalsefalsefalse" ]] && \
SETUP_CLAUDE=true && SETUP_CODEX=true && SETUP_GEMINI=true && SETUP_OPENCODE=true
MCP_JSON='"agentation": {"command": "npx", "args": ["-y", "agentation-mcp", "server"]}'
# Claude Code
if [[ "$SETUP_CLAUDE" == "true" ]]; then
mkdir -p ~/.claude
CFG=~/.claude/claude_desktop_config.json
if [[ -f "$CFG" ]] && command -v jq &>/dev/null; then
jq ".mcpServers += {$MCP_JSON}" "$CFG" > "$CFG.tmp" && mv "$CFG.tmp" "$CFG"
else
echo "{\"mcpServers\": {$MCP_JSON}}" > "$CFG"
fi
echo "✅ Claude Code: $CFG"
fi
# Codex CLI
if [[ "$SETUP_CODEX" == "true" ]]; then
mkdir -p ~/.codex
CFG=~/.codex/config.toml
if ! grep -q "agentation" "$CFG" 2>/dev/null; then
printf '\n[[mcp_servers]]\nname = "agentation"\ncommand = "npx"\nargs = ["-y", "agentation-mcp", "server"]\n' >> "$CFG"
fi
echo "✅ Codex CLI: $CFG"
fi
# Gemini CLI
if [[ "$SETUP_GEMINI" == "true" ]]; then
mkdir -p ~/.gemini
CFG=~/.gemini/settings.json
if [[ -f "$CFG" ]] && command -v jq &>/dev/null; then
jq ".mcpServers += {$MCP_JSON}" "$CFG" > "$CFG.tmp" && mv "$CFG.tmp" "$CFG"
else
echo "{\"mcpServers\": {$MCP_JSON}}" > "$CFG"
fi
echo "✅ Gemini CLI: $CFG"
fi
# OpenCode
if [[ "$SETUP_OPENCODE" == "true" ]]; then
mkdir -p ~/.config/opencode
CFG=~/.config/opencode/opencode.json
ENTRY='"agentation": {"type": "local", "command": ["npx", "-y", "agentation-mcp", "server"]}'
if [[ -f "$CFG" ]] && command -v jq &>/dev/null; then
jq ".mcp += {$ENTRY}" "$CFG" > "$CFG.tmp" && mv "$CFG.tmp" "$CFG"
else
echo "{\"mcp\": {$ENTRY}}" > "$CFG"
fi
echo "✅ OpenCode: $CFG"
fi
echo ""
echo "Done. Restart your agent(s) and run: npx agentation-mcp server"
| Tool | Parameters | Description |
|---|---|---|
agentation_list_sessions | none | List all active annotation sessions |
agentation_get_session | sessionId: string | Get session with all annotations |
agentation_get_pending | sessionId: string | Get pending annotations for a session |
agentation_get_all_pending |
1. Human opens app in browser
2. Clicks agentation toolbar → activates
3. Clicks element → adds comment → clicks Copy
4. Pastes markdown output into agent chat
5. Agent receives CSS selectors, elementPath, boundingBox
6. Agent greps/edits code using selector
Agent: agentation_watch_annotations (blocks up to 120s)
→ Human adds annotation in browser
→ Agent receives batch immediately
→ Agent: agentation_acknowledge(annotationId)
→ Agent makes code changes using elementPath as grep target
→ Agent: agentation_resolve(annotationId, "Changed button color to #3b82f6")
→ Agent: agentation_watch_annotations (loops again)
CLAUDE.md / GEMINI.md / Codex developer_instructions — add for automated watch:
When I say "watch mode" or "agentation watch", call agentation_watch_annotations in a loop.
For each annotation received:
1. Call agentation_acknowledge(annotationId)
2. Use elementPath to locate the code: Grep(elementPath) or search codebase for CSS class
3. Make the minimal change described in the comment
4. Call agentation_resolve(annotationId, "<brief summary of what was changed>")
Continue watching until I say stop, or until timeout.
The hook from Section 4 auto-appends pending annotations to every agent message — no "watch mode" needed. Works across all platforms.
Two-agent setup for fully autonomous UI review cycles:
Session 1 (Critic — usesagent-browser):
# Start headed browser pointing at your dev server
agent-browser open http://localhost:3000
agent-browser snapshot -i
# Agent navigates, clicks elements via agentation toolbar, adds critique
# Annotations flow to agentation MCP server automatically
Session 2 (Fixer — watches MCP):
agentation_watch_annotations → receives critique → acknowledge → edit → resolve → loop
<Agentation webhookUrl="https://your-server.com/webhook" />
# or env var:
# AGENTATION_WEBHOOK_URL=https://your-server.com/webhook
type Annotation = {
// Core
id: string;
x: number; // % of viewport width (0-100)
y: number; // px from document top
comment: string; // User's feedback text
element: string; // Tag name: "button", "div", etc.
elementPath: string; // CSS selector: "body > main > button.cta" ← grep target
timestamp: number;
// Context
selectedText?: string;
boundingBox?: { x: number; y: number; width: number; height: number };
nearbyText?: string;
cssClasses?: string;
nearbyElements?: string;
computedStyles?: string;
fullPath?: string;
accessibility?: string;
reactComponents?: string; // "App > Dashboard > Button" ← component grep target
isMultiSelect?: boolean;
isFixed?: boolean;
// Lifecycle (server-synced)
sessionId?: string;
url?: string;
intent?: "fix" | "change" | "question" | "approve";
severity?: "blocking" | "important" | "suggestion";
status?: "pending" | "acknowledged" | "resolved" | "dismissed";
thread?: ThreadMessage[];
createdAt?: string;
updatedAt?: string;
resolvedAt?: string;
resolvedBy?: "human" | "agent";
};
Annotation lifecycle:
pending → acknowledged → resolved
↘ dismissed (requires reason)
# Sessions
POST /sessions # Create session
GET /sessions # List all sessions
GET /sessions/:id # Get session + annotations
# Annotations
POST /sessions/:id/annotations # Add annotation
GET /annotations/:id # Get annotation
PATCH /annotations/:id # Update annotation
DELETE /annotations/:id # Delete annotation
GET /sessions/:id/pending # Pending for session
GET /pending # ALL pending across sessions
# Events (SSE streaming)
GET /sessions/:id/events # Session stream
GET /events # Global stream (?domain=filter)
# Health
GET /health
GET /status
| Variable | Description | Default |
|---|---|---|
AGENTATION_STORE | memory or sqlite | sqlite |
AGENTATION_WEBHOOK_URL | Single webhook URL | — |
AGENTATION_WEBHOOKS | Comma-separated webhook URLs | — |
AGENTATION_EVENT_RETENTION_DAYS |
SQLite storage: ~/.agentation/store.db
import {
identifyElement, identifyAnimationElement,
getElementPath, getNearbyText, getElementClasses,
isInShadowDOM, getShadowHost, closestCrossingShadow,
loadAnnotations, saveAnnotations, getStorageKey,
type Annotation, type Session, type ThreadMessage,
} from 'agentation';
| Platform | Config File | MCP Key | Hook |
|---|---|---|---|
| Claude Code | ~/.claude/claude_desktop_config.json | mcpServers | hooks.UserPromptSubmit in settings.json |
| Codex CLI | ~/.codex/config.toml | [[mcp_servers]] (TOML) | developer_instructions + |
<Agentation> with NODE_ENV === 'development' — never ship to productionagentation_acknowledge immediately when starting a fix — signals humansummary in agentation_resolve — gives human traceabilityseverity: "blocking" annotations first in the watch loopelementPath as the primary grep/search target in code — it's a valid CSS selectorreactComponents field when the codebase is React — matches component names directlyagentation integrates as the VERIFY_UI phase of the jeo skill. This follows the same pattern as plannotator operating in
planui/ExitPlanMode.annotateis the primary keyword.agentuiis kept as a backward-compatible alias.
plannotator (planui): agentation (annotate):
Write plan.md Mount <Agentation> in app UI
↓ blocking ↓ blocking
Run plannotator agentation_watch_annotations
↓ ↓
Approve/Feedback in UI Create annotation in UI
↓ ↓
Confirm approved:true annotation ack→fix→resolve
↓ ↓
Enter EXECUTE Next step or loop
| Keyword | Platform | Action |
|---|---|---|
annotate | Claude Code | agentation_watch_annotations MCP blocking call |
annotate | Codex | ANNOTATE_READY signal → jeo-notify.py HTTP polling |
annotate | Gemini | GEMINI.md instruction: HTTP REST polling pattern |
/jeo-annotate |
# 1. agentation auto-registered when installing jeo
bash .agent-skills/jeo/scripts/install.sh --with-agentation
# Or full install:
bash .agent-skills/jeo/scripts/install.sh --all
# 2. Mount agentation component in app
# app/layout.tsx or pages/_app.tsx:
# <Agentation endpoint="http://localhost:4747" />
# 3. Start MCP server
npx agentation-mcp server
# 4. Enter annotate keyword in agent → watch loop starts (agentui also works as backward-compatible alias)
# Claude Code: direct MCP tool call
# Codex: output ANNOTATE_READY (or AGENTUI_READY) → notify hook auto-polls
# Gemini: GEMINI.md HTTP polling pattern
# OpenCode: /jeo-annotate slash command (or /jeo-agentui — deprecated)
plannotator and agentation use the same blocking loop pattern but only operate in different phases :
| Tool | Allowed phase | Hook Guard |
|---|---|---|
| plannotator | plan only | jeo-state.json → phase === "plan" |
| agentation | verify / verify_ui only | jeo-state.json → phase === "verify_ui" |
Each platform's hook script checks the phase field in jeo-state.json to prevent execution in the wrong phase. Without this guard, both tools could run simultaneously in Gemini's AfterAgent hook.
3-step check before entering VERIFY_UI:
GET /health — whether agentation-mcp server is runningGET /sessions — whether <Agentation> component is mountedGET /pending — number of annotations to processAfter passing, set phase in jeo-state.json to "verify_ui" and agentation.active to true.
# Run agentation watch loop integration test
bash .agent-skills/agentation/scripts/verify-loop.sh
# Quick test (skip error cases)
bash .agent-skills/agentation/scripts/verify-loop.sh --quick
4-step verification: Server Health → Annotation CRUD → ACK-RESOLVE Cycle → Error Cases
jeo "<task>"
│
[1] PLAN (plannotator loop) ← approve plan.md
[2] EXECUTE (team/bmad)
[3] VERIFY
├─ agent-browser snapshot
├─ Pre-flight check (server + session + pending)
└─ annotate → VERIFY_UI (agentation loop) ← this phase (agentui also backward-compatible)
├─ ACK → FIND → FIX → RESOLVE
├─ RE-SNAPSHOT (agent-browser) ← re-check after fix
└─ update agentation fields in jeo-state.json
[4] CLEANUP
For detailed jeo integration: see jeo SKILL.md Section 3.3.1 detailed workflow
agentation@2.2.1, agentation-mcp@1.2.0Weekly Installs
5.4K
Repository
GitHub Stars
88
First Seen
Mar 4, 2026
Security Audits
Gen Agent Trust HubFailSocketWarnSnykWarn
Installed on
gemini-cli5.3K
codex5.3K
opencode5.3K
github-copilot5.2K
cursor5.2K
cline5.2K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
105,000 周安装
PostHog Analytics Skill:产品分析、事件跟踪与功能标志的完整解决方案
365 周安装
Excalidraw子代理委托指南:高效处理JSON图表,节省AI上下文预算
365 周安装
AI周报生成器 | 一键创建专业周报模板(个人/团队/高管/客户)
365 周安装
Python PPTX 操作技能:自动化创建编辑 PowerPoint 演示文稿,python-pptx 库教程
365 周安装
Claude项目工作流技能:9个命令自动化项目生命周期,节省35-55分钟
365 周安装
CMake 完整指南:现代 C/C++ 项目构建、依赖管理与交叉编译教程
365 周安装
| Callback when annotation created |
onAnnotationDelete | (a: Annotation) => void | — | Callback when annotation deleted |
onAnnotationUpdate | (a: Annotation) => void | — | Callback when annotation edited |
onAnnotationsClear | (a: Annotation[]) => void | — | Callback when all cleared |
onCopy | (markdown: string) => void | — | Callback with markdown on copy |
onSubmit | (output: string, annotations: Annotation[]) => void | — | On "Send Annotations" click |
copyToClipboard | boolean | true | Set false to suppress clipboard write |
onSessionCreated | (sessionId: string) => void | — | Called on new session creation |
webhookUrl | string | — | Webhook URL to receive annotation events |
| none |
| Get pending annotations across ALL sessions |
agentation_acknowledge | annotationId: string | Mark annotation as acknowledged (agent is working on it) |
agentation_resolve | annotationId: string, summary?: string | Mark as resolved with optional summary |
agentation_dismiss | annotationId: string, reason: string | Dismiss with required reason |
agentation_reply | annotationId: string, message: string | Add reply to annotation thread |
agentation_watch_annotations | sessionId?: string, batchWindowSeconds?: number (default 10, max 60), timeoutSeconds?: number (default 120, max 300) | Block until new annotations arrive — core watch-loop tool |
| Days to keep events |
7 |
notify| Gemini CLI | ~/.gemini/settings.json | mcpServers | hooks.AfterAgent in settings.json |
| OpenCode | ~/.config/opencode/opencode.json | mcp (type: "local") | Skills system (no hook needed) |
| Cursor / Windsurf | .cursor/mcp.json / .windsurf/mcp.json | mcpServers | — |
agent-browseragentation| OpenCode |
opencode.json mcp.agentation + instructions |
agentui (deprecated) | All platforms | Same behavior as above — backward-compatible alias |
UI review | All platforms | Same as annotate |