代理整合
- 作者仓库星标 4,389
- 作者仓库 cli
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @entireio · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
通过二进制探测和文档研究发现代理的钩子机制、转录格式和配置。在`cmd/entire/cli/agent/$AGENT_PACKAGE/AGENT.md`生成一个实现单寻呼机,其他阶段将其用作代理特定信息的单一来源。阅读并遵循`.claude/skills/agent-integration/researcher.md`的研究程序。预期输出:在`cmd/entire/cli/agent/$AGENT_PACKAGE/AGENT.md`实现单页程序,在`scripts/test-$AGENT_SLUG-agent-integration.sh`实现测试脚本。
创建 E2E 代理运行程序,以便现有测试场景可以运行新代理。此阶段没有编写任何单元测试 - 也没有新的测试场景(现有的`ForEachAgent`测试是规范)。阅读并遵循`.claude/skills/agent-integration/test-writer.md`中的程序。预期输出:`e2e/agents/$AGENT_SLUG.go` 的 E2E 代理运行程序,编译并注册到测试框架。
使用严格的端到端优先 TDD 构建 Go 代理包。 E2E 测试推动每一步的开发 — 运行每一层,观察其失败,实施最低限度的修复,然后重复。仅在所有 E2E 层通过后才编写单元测试,并使用 E2E 运行的真实数据作为黄金固定装置。阅读并遵循`.claude/skills/agent-integration/implementer.md`的实施程序。预期输出:`cmd/entire/cli/agent/$AGENT_PACKAGE/` 处的完整代理程序包,所有 E2E 层均通过并且单元测试锁定行为。
# Agent Integration — Full Pipeline
Run all three phases of agent integration in a single session. Parameters are collected once and reused across all phases.
## Parameters
Collect these before starting (ask the user if not provided):
| Parameter | Description | How to derive |
|-----------|-------------|---------------|
| `AGENT_NAME` | Human-readable name (e.g., "Gemini CLI") | User provides |
| `AGENT_PACKAGE` | Go package dir name — **no hyphens** | Lowercase, remove hyphens/spaces |
| `AGENT_KEY` | Registry key for `agent.Register()` and `entire enable` | Check existing patterns in `cmd/entire/cli/agent/registry.go` |
| `AGENT_SLUG` | Filesystem/URL-safe slug (kebab-case) used in E2E runner filenames and script names | Kebab-case of agent name; align with existing entries in `e2e/agents/` |
| `AGENT_BIN` | CLI binary name | `command -v <binary>` |
| `LIVE_COMMAND` | Full command to launch agent | User provides |
| `EVENTS_OR_UNKNOWN` | Known hook event names, or "unknown" | From agent docs or "unknown" |
**Note:** These identifiers can differ. Run `grep -r 'AgentName\|func.*Name()' cmd/entire/cli/agent/*/` and `e2e/agents/` to see how existing agents handle the split.
## Architecture References
These documents define the agent integration contract:
- **Implementation guide**: `docs/architecture/agent-guide.md` — Step-by-step code templates, event mapping, testing patterns
- **Integration checklist**: `docs/architecture/agent-integration-checklist.md` — Design principles and validation criteria
## Scope
This skill targets **hook-capable agents** — those that support lifecycle hooks
(implementing `HookSupport` from `agent.go`). Agents that use file-based detection
(implementing `FileWatcher`) require a different integration approach not covered here.
Check `agent.go` for the current interface definitions.
## Core Rule: E2E-First TDD
This skill enforces strict E2E-first test-driven development. The rules:
1. **E2E tests are the spec.** The existing `ForEachAgent` test scenarios define what "working" means. The agent runner makes those tests runnable for the new agent.
2. **Run E2E tests at every step.** Each implementation tier starts by running the E2E test and watching it fail. You implement until it passes. No exceptions.
3. **Unit tests are written last.** After all E2E tiers pass (Step 14), you write unit tests using real data collected from E2E runs as golden fixtures.
4. **If you didn't watch it fail, you don't know if it tests the right thing.** Never write a test you haven't seen fail first.
5. **Minimum viable fix.** At each E2E failure, implement only the code needed to fix that failure. Don't anticipate future tiers.
6. **`/e2e:debug` is your debugger.** When an E2E test fails, use the artifact directory with `/e2e:debug` before guessing at fixes.
## Pipeline
Run these three phases in order. Each phase builds on the previous phase's output.
### Phase 1: Research
Discover the agent's hook mechanism, transcript format, and configuration through binary probing and documentation research. Produces an implementation one-pager at `cmd/entire/cli/agent/$AGENT_PACKAGE/AGENT.md` that the other phases use as their single source of agent-specific information.
Read and follow the research procedure from `.claude/skills/agent-integration/researcher.md`.
**Expected output:** Implementation one-pager at `cmd/entire/cli/agent/$AGENT_PACKAGE/AGENT.md` and a test script at `scripts/test-$AGENT_SLUG-agent-integration.sh`.
**Commit:** After the research phase completes, use `/commit` to commit all files.
**Gate:** If the verdict is INCOMPATIBLE, stop and discuss with the user before proceeding.
### Phase 2: Write E2E Runner
Create the E2E agent runner so existing test scenarios can exercise the new agent. No unit tests are written in this phase — no new test scenarios either (existing `ForEachAgent` tests are the spec).
Read and follow the procedure from `.claude/skills/agent-integration/test-writer.md`.
**Expected output:** E2E agent runner at `e2e/agents/$AGENT_SLUG.go` that compiles and registers with the test framework.
**Commit:** After the E2E runner compiles and registers, use `/commit` to commit all files.
### Phase 3: Implement (E2E-First, Unit Tests Last)
Build the Go agent package using strict E2E-first TDD. E2E tests drive development at every step — run each tier, watch it fail, implement the minimum fix, repeat. Unit tests are written only after all E2E tiers pass, using real data from E2E runs as golden fixtures.
Read and follow the implement procedure from `.claude/skills/agent-integration/implementer.md`.
**Expected output:** Complete agent package at `cmd/entire/cli/agent/$AGENT_PACKAGE/` with all E2E tiers passing and unit tests locking in behavior.
**Note:** `AGENT.md` is a living document — Phases 2 and 3 update it when they discover new information during testing or implementation.
## Final Validation
After all three phases, run the complete validation:
```bash
mise run fmt # Format
mise run lint # Lint
mise run test:ci # All tests (unit + integration)
```
Summarize:
- Compatibility verdict from Phase 1
- Files created in Phases 2 and 3
- Test coverage
- Any remaining TODOs or gaps
按说明文件中的顺序排列。
参数
架构参考
适用范围
核心规则:端到端优先 TDD
管道
文件/命令 -> AGENT_NAME · AGENT_PACKAGE · AGENT_KEY · agent.Register() · entire enable · cmd/entire/cli/agent/registry.go · AGENT_SLUG · e2e/agents/
内容校验值 -> 62b12118d5dc
当前原文的自动摘译,尚未人工审校。
参数
在开始之前收集这些(如果未提供,请询问用户): 参数 · 描述 · 如何导出
AGENT_NAME· 人类可读的名称(例如,“Gemini CLI”) · 用户提供AGENT_PACKAGE· Go 包目录名称 — 无连字符 · 小写,删除连字符/空格AGENT_KEY·agent.Register()和entire enable的注册表项 ·检查cmd/entire/cli/agent/registry.go中现有的模式架构参考
这些文档定义了代理集成合同: 实施指南:
docs/architecture/agent-guide.md— 分步代码模板、事件映射、测试模式 集成清单:docs/architecture/agent-integration-checklist.md— 设计原则和验证标准适用范围
该技能针对的是具有钩子功能的代理——那些支持生命周期钩子的代理(从
agent.go实现HookSupport)。使用基于文件的检测(实现FileWatcher)的代理需要不同的集成方法(此处未介绍)。检查agent.go当前的接口定义。核心规则:端到端优先 TDD
该技能强制实施严格的端到端优先的测试驱动开发。规则:E2E 测试是规范。现有的
ForEachAgent测试场景定义了“工作”的含义。代理运行程序使这些测试可以为新代理运行。每一步都运行 E2E 测试。每个实施层都从运行 E2E 测试并观察其失败开始。你实施直到它通过。没有例外。单元测试是最后编写的。所有 E2E 层通过后(步骤 14),您可以使用从 E2E 运行收集的真实数据作为黄金固定装置来编写单元测试。管道
按顺序运行这三个阶段。每个阶段都建立在前一阶段的输出之上。