EKET AI 智能体协作框架 - Master-Slaver 多智能体开发框架 (v2.9.2)
当用户要求对既存项目进行深度分析时,在执行任何分析前,必须先用 AskUserQuestion 询问团队加载方式:
项目:[当前项目名]
检测到既存项目,需要组建分析团队。请选择加载方式:
选项:
If A: 直接用默认配置初始化团队,执行分析。
If B: 依次用 AskUserQuestion 询问(每次一个问题):
instance:start --list-roles 列表选)此 Preamble 仅在「深度分析既存项目」场景触发,普通命令查询跳过。
当用户提到以下内容时自动调用此 skill:
./scripts/setup.sh --level=2node dist/index.js instance:start --autonode dist/index.js task:claimnode dist/index.js system:doctornode dist/index.js web:dashboard --port 3000# AI 自动模式(自动选择角色)
node dist/index.js instance:start --auto
# 人工模式(手动指定角色)
node dist/index.js instance:start --human --role frontend_dev
# 列出所有可用角色
node dist/index.js instance:start --list-roles
# 设置当前实例角色
node dist/index.js instance:set-role <role>
# 领取任务(自动匹配角色)
node dist/index.js task:claim
# 领取指定 ticket
node dist/index.js task:claim <ticket-id>
# 初始化项目
node dist/index.js project:init
# 完整系统诊断(推荐首次运行)
node dist/index.js system:doctor
# 快速系统检查
node dist/index.js system:check
# 检查 Redis 连接状态
node dist/index.js redis:check
# 列出所有已注册 Slaver
node dist/index.js redis:list-slavers
# 检查 SQLite 连接
node dist/index.js sqlite:check
# 列出所有回顾记录
node dist/index.js sqlite:list-retros
# 搜索知识库
node dist/index.js sqlite:search "<keyword>"
# 生成项目报告
node dist/index.js sqlite:report
# 启动 Web 仪表盘
node dist/index.js web:dashboard --port 3000
# 启动 HTTP Hook 服务器(Agent 生命周期事件)
node dist/index.js hooks:start --port 8899
# 启动 OpenCLAW API 网关(需要 OPENCLAW_API_KEY)
node dist/index.js gateway:start --port 8080
# 启动心跳(保持 Slaver 在线状态)
node dist/index.js heartbeat:start <slaverId>
# 查看心跳状态
node dist/index.js heartbeat:status
# 测试消息队列连通性
node dist/index.js queue:test
# 查看 Agent Pool 状态
node dist/index.js pool:status
# 按角色选择 Agent
node dist/index.js pool:select -r <role>
# 审查指定 ticket(gate_review 状态才会触发)
node dist/index.js gate:review <ticket-id>
# 扫描所有待审查 ticket
node dist/index.js gate:review --scan-all
# 预演审查,不写文件
node dist/index.js gate:review <ticket-id> --dry-run
# 强制否决(填入否决原因)
node dist/index.js gate:review <ticket-id> --force-veto "依赖未完成"
# 强制通过(跳过所有检查)
node dist/index.js gate:review <ticket-id> --auto-approve
死锁防止:同一 ticket 被否决 ≥ 2 次,第 3 次 gate:review 自动强制通过。 审查报告写入
confluence/audit/gate-review-reports/, 不可篡改审计日志写入confluence/audit/gate-review-log.jsonl(SHA256 hash 链)。
快速:
# 构建(TypeScript → dist/)
cd node && npm run build
# 运行所有测试
cd node && npm test
# 运行单个测试文件
npm test -- --testPathPattern=<pattern>
# 开发模式(无需构建)
npm run dev -- <command>
# 代码检查
npm run lint
npm run lint:fix
# 格式化
npm run format
# 清理构建产物
npm run clean
三级降级:Level 3(Redis+SQLite) → Level 2(Node+文件队列) → Level 1(Shell)
Level 3: Redis + SQLite # 生产级高并发,完整功能
↓ Redis 不可用
Level 2: Node.js + 文件队列 # .eket/data/queue/*.json(去重+归档)
↓ Node.js 不可用
Level 1: Shell 脚本 # lib/adapters/hybrid-adapter.sh 基础模式
核心模块:
core/master-election.ts — 三级 Master 选举(Redis SETNX / SQLite / File mkdir)core/connection-manager.ts — 四级降级连接管理core/message-queue.ts — 消息队列(Redis Pub/Sub + 文件降级)core/circuit-breaker.ts — 断路器(closed/open/half_open)core/cache-layer.ts — LRU 内存缓存 + Redis 二级缓存core/agent-pool.ts — Agent Pool 管理(负载均衡、角色选择)core/workflow-engine.ts — 工作流引擎(预定义协作流程)core/event-bus.ts — 事件总线(DomainEvent、死信队列)core/alerting.ts — 四级告警 + 多渠道通知./scripts/setup.sh # 交互式安装
./scripts/setup.sh --all # 全部安装
./scripts/setup.sh --level=2 # 只装到 Node.js(推荐)
./scripts/setup.sh --level=1 # 仅 Shell 基础版
初始化新项目:
# 从框架初始化新项目
./scripts/init-project.sh <project-name> /path/to/project
# 初始化三仓库(需 Git 平台 token)
./scripts/init-three-repos.sh <project-name> <org> <github|gitlab|gitee>
# 启用 Node.js 高级功能
./scripts/enable-advanced.sh
| 变量 | 说明 | 默认值 |
|---|---|---|
OPENCLAW_API_KEY | OpenCLAW Gateway API Key(≥16 字符) | 无 |
EKET_REDIS_HOST | Redis 主机 | localhost |
EKET_REDIS_PORT | Redis 端口 | 6379 |
EKET_SQLITE_PATH | SQLite 数据库路径 | ~/.eket/data/sqlite/eket.db |
EKET_REMOTE_REDIS_HOST | 远程 Redis | 无 |
EKET_LOG_LEVEL | 日志级别(debug/info/warn/error) | info |
所有命令返回 Result<T> 类型,失败时输出错误码并以非零退出:
// 错误码定义:node/src/types/index.ts → EketErrorCode 枚举
// 失败示例:[ERROR] REDIS_CONNECTION_FAILED: Cannot connect to Redis at localhost:6379
feature/{ticket-id}-{desc} → PR → testing → 测试通过 → PR → miao → PR → main
main:发布快照,版本节点,仅接受来自 miao 的 PRmiao:稳定主干,长期集成,PR + CI + 1 review 必须testing:测试集成,CI 覆盖feature/*:开放,Slaver 开发使用