尧图网站设计 尧图网站设计YAOTU DESIGN
ARTICLE DETAIL

资讯详情

深耕网站设计与一线实操的经验洞察。

ruflo researcher 深度研究智能体:Skill 定义、研究方法论与 MCP 记忆协作全解

ruflo researcher 深度研究智能体:Skill 定义、研究方法论与 MCP 记忆协作全解 ruflo researcher 深度研究智能体Skill 定义、研究方法论与 MCP 记忆协作全解【免费下载链接】ruflo The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated项目地址: https://gitcode.com/GitHub_Trending/cl/ruflo在 ruflo 的多智能体体系中researcher是承担前期深度调研的分析型智能体。本文以 agent-researcher 技能定义文件 为主体完整拆解该技能的 frontmatter 结构、五项核心职责、四步研究方法论与research_findings输出规范并结合 Codex 配置文件、V2 兼容工具源码 等仓库证据讲清它如何通过 MCP 记忆工具与 planner、coder、tester 等智能体协同。读完后你可以独立读懂一个 ruflo 智能体 Skill 文件的每一行含义并能按同样范式编写新的研究型智能体。一、技能文件定位ruflo 的智能体 Skill 生态该文件位于 .agents/skills/agent-researcher/SKILL.md是 ruflo 面向 OpenAI Codex CLI 生态的.agents目录下的一个技能单元。根据.agents目录说明技能统一采用$skill-name语法调用因此本技能以$agent-researcher触发每个技能目录包含带 YAML frontmatter 元数据的SKILL.md可选携带scripts/与docs/子目录.agents/目录由config.toml主控配置模型选择、审批策略、沙箱模式、MCP 服务器连接、技能开关技能本体则定义智能体的行为准则。从源码结构看ruflo 在仓库中同时维护两套 researcher 定义本文件面向.agentsCodex CLI生态而 plugins/ruflo-core/agents/researcher.md 则是 v3 插件体系中的 Pathfinder 研究专家详见文末。两者职责一致、工具链不同本文聚焦前者。二、文件解剖双层 YAML frontmatter 与 Agent 元数据agent-researcher/SKILL.md的结构分为两部分外层是技能包装元数据内层嵌入了完整的 Agent 定义。2.1 外层技能包装Skill 元数据--- name: agent-researcher description: Agent skill for researcher - invoke with $agent-researcher ---description中的 invoke with $agent-researcher 直接声明了调用方式与.agents/README.md所述的$skill-name约定一致。2.2 内层Agent 人格与运行参数紧随其后的第二个 frontmatter 块定义了 researcher 智能体本身--- name: researcher type: analyst color: #9B59B6 description: Deep research and information gathering specialist capabilities: - code_analysis - pattern_recognition - documentation_research - dependency_tracking - knowledge_synthesis priority: high hooks: pre: | echo Research agent investigating: $TASK memory_store research_context_$(date %s) $TASK post: | echo Research findings documented memory_search research_* | head -5 ---各字段含义字段取值作用nameresearcher智能体在蜂群中的身份名typeanalyst角色类型分析师区别于 coder、tester 等color#9B59B6蜂群可视化中的展示色descriptionDeep research and information gathering specialist职责一句话概述capabilities5 项能力标签供调度器按能力匹配任务priorityhigh任务队列中的优先级hooks.pre/hooks.postShell 脚本任务执行前后的生命周期钩子hooks的设计体现了一切皆记忆的协作思想pre钩子在任务开始前把$TASK存入以时间戳命名的记忆键research_context_epochpost钩子在任务结束后用memory_search research_*检索最近 5 条相关记忆实现调研上下文的自动留痕与回收。三、五项核心职责Core Responsibilities文档将 researcher 的职责收敛为五个方向这也是它在蜂群中区别于其他智能体的边界Code Analysis代码分析深入代码库理解实现细节Pattern Recognition模式识别识别重复出现的模式、最佳实践与反模式Documentation Review文档审查分析现有文档并找出缺口Dependency Mapping依赖映射追踪并记录所有依赖与关系Knowledge Synthesis知识综合把调研结果编译为可执行的洞见actionable insights。这五项职责与内层 frontmatter 的capabilities标签一一对应说明元数据标签不是摆设而是调度器进行任务-能力匹配的契约。四、研究方法论四步工作流4.1 信息收集Information Gathering文档给出的收集原则使用多种搜索策略glob、grep、语义搜索完整读取相关文件以获取上下文在多个位置核查相关信息考虑不同的命名约定与模式。4.2 模式分析Pattern Analysis文档提供了四类可直接复用的搜索模式# Example search patterns - 实现模式: grep -r class.*Controller --include*.ts - 配置模式: glob **/*.config.* - 测试模式: grep -r describe\|test\|it --include*.test.* - 导入模式: grep -r ^import.*from --include*.ts这些模式分别针对架构骨架Controller 类、配置入口、测试分布与模块依赖四类典型调研目标是 researcher 拿到任务后第一波面式扫描的起点。4.3 依赖分析Dependency Analysis追踪 import 语句与模块依赖识别外部包依赖映射内部模块关系记录 API 契约与接口。4.4 文档挖掘Documentation Mining提取行内注释与 JSDoc分析 README 与文档文件审查 commit message 获取上下文检查 issue tracker 与 PR。五、搜索策略广→窄收敛、交叉引用、历史分析5.1 Broad to Narrow由广到窄# Start broad glob **/*.ts # Narrow by pattern grep -r specific-pattern --include*.ts # Focus on specific files read specific-file.ts三步收敛路径先 glob 铺开文件面再 grep 按模式收窄最后 read 锁定具体文件精读。5.2 Cross-Reference交叉引用搜索class$function定义即类-函数两级定位找出所有用法与引用点跟踪数据在系统中的流向识别集成点。5.3 Historical Analysis历史分析审查 git 历史获取上下文分析 commit 模式检查重构历史理解代码的演化轨迹。六、结构化输出research_findings YAML 规范researcher 的交付物不是自由文本而是一份强结构的 YAML 报告。文档给出的完整模板如下research_findings: summary: High-level overview of findings codebase_analysis: structure: - Key architectural patterns observed - Module organization approach patterns: - pattern: Pattern name locations: [file1.ts, file2.ts] description: How its used dependencies: external: - package: package-name version: 1.0.0 usage: How its used internal: - module: module-name dependents: [module1, module2] recommendations: - Actionable recommendation 1 - Actionable recommendation 2 gaps_identified: - area: Missing functionality impact: high|medium|low suggestion: How to address字段解读summary面向协调者的高层结论保证即使不读全文也能理解发现codebase_analysis.structure/patterns架构观察与模式清单每个模式带locations定位可被 coder 直接引用与description用法说明dependencies.external/internal外部依赖记录package、version、usage三元组内部依赖记录模块及其dependents反向依赖方这对重构影响面评估至关重要recommendations可执行建议列表是 planner 做任务分解的直接输入gaps_identified缺口清单impact取high|medium|low三档suggestion给出弥补方向。这种结论 证据位置 建议 缺口的四段式结构使下游智能体无需二次调研即可开工。七、MCP 记忆协作状态上报、成果共享与历史检索researcher 与蜂群的其他成员不直接对话而是全部经由共享记忆coordination namespace协作。文档给出了三段完整的 MCP 调用范式。7.1 上报研究状态// Report research status mcp__claude-flow__memory_usage { action: store, key: swarm$researcher$status, namespace: coordination, value: JSON.stringify({ agent: researcher, status: analyzing, focus: authentication system, files_reviewed: 25, timestamp: Date.now() }) }键名采用swarm$researcher$status的分层命名value 携带status、focus、files_reviewed进度指标与时间戳——协调器据此掌握 researcher 的实时进展。7.2 共享研究发现// Share research findings mcp__claude-flow__memory_usage { action: store, key: swarm$shared$research-findings, namespace: coordination, value: JSON.stringify({ patterns_found: [MVC, Repository, Factory], dependencies: [express, passport, jwt], potential_issues: [outdated auth library, missing rate limiting], recommendations: [upgrade passport, add rate limiter] }) }写入的是swarm$shared$前缀的共享键内容涵盖模式清单、依赖清单、潜在问题与建议——即第六节 YAML 报告的运行时投影。7.3 检索既有研究// Check prior research mcp__claude-flow__memory_search { pattern: swarm$shared$research-*, namespace: coordination, limit: 10 }用通配模式swarm$shared$research-*回捞历史研究避免重复调研并继承前期结论。7.4 仓库源码佐证这套工具链在 ruflo 中的实现位置MCP 服务器接入.agents/config.toml中[mcp_servers.claude-flow]段声明了 MCP 接入方式——command npx、args [-y, claude-flow/clilatest]、tool_timeout_sec 120即技能文档中所有mcp__claude-flow__*调用最终经由此 MCP 服务器路由到claude-flow/cli实现。V2 命名兼容层技能文档使用的是 V2 风格工具名memory_usage、agent_metrics等。从源码结构看v3/mcp/tools/v2-compat-tools.ts 为这批 V2 名称保留了兼容工具并标记deprecated: true文件顶部的映射注释如agent_metrics - agent/status (with includeMetrics: true)见第 12 行与第 604 行的工具映射表agent_metrics: agent/status共同说明V2 名称会自动转发到新的工具名。因此技能中的旧式命名在 v3 运行时依然可用但新代码建议采用新工具名。记忆命名空间与智能体生成根目录 SKILL.md 记录了 ruflo 的 MCP 工具面——mcp__claude-flow__memory_*store/search/list/retrieve带 HNSW 语义检索与mcp__claude-flow__agent_spawn可生成 coder、reviewer、tester、security-architect 等专项智能体。researcher 的调研成果正是经这一记忆层供agent_spawn生成的下游智能体消费的。八、分析工具仓库质量分析与智能体指标文档在记忆协作之外还列出了两个分析类工具// Analyze codebase mcp__claude-flow__github_repo_analyze { repo: current, analysis_type: code_quality } // Track research metrics mcp__claude-flow__agent_metrics { agentId: researcher }github_repo_analyze对当前仓库执行代码质量维度的自动分析作为 researcher 宏观判断的输入agent_metrics则跟踪 researcher 自身的运行指标。关于后者的实现可以确认v2-compat-tools.ts 中agentMetricsTool接受可选的agentId与metricall|cpu|memory|tasks|performance参数有agentId时内部调用agentStatusToolincludeMetrics: true取单智能体指标否则回落到systemMetricsTool取系统级components: [agents]指标——这与技能文档Track research metrics, agentId: researcher的用法完全吻合。九、协作准则与最佳实践9.1 协作准则Collaboration Guidelines通过记忆把发现共享给planner用于任务分解通过共享记忆为coder提供实现上下文向tester提供边界条件与测试场景所有发现都记录在 coordination 记忆中。这条记忆即总线的准则意味着即使 researcher 会话结束其结论仍可通过swarm$shared$键被后续任意智能体检索复用。9.2 最佳实践Best PracticesBe Thorough核查多个来源并交叉验证发现Stay Organized结构化组织研究保持笔记清晰Think Critically质疑假设、核实论断Document Everything所有发现存入 coordination 记忆Iterate基于新发现迭代修正研究Share Early高频更新记忆以支持实时协作。文档以此收尾好的研究是成功实现的基础。在给出建议前先花时间理解完整上下文并始终通过记忆协作。十、延伸从 .agents 技能到 v3 Pathfinder理解本技能后值得对照 plugins/ruflo-core/agents/researcher.mdv3 时代的 researcher 演进为 Pathfinder research specialist将本文第四节的广→窄搜索升级为显式的图遍历算法——Seedagentdb_semantic-route语义路由种子→ Expandagentdb_causal-edge沿因果边扩展→ Scoreagentdb_pattern-search按相似度时近度打分→ Prune相似度 0.3 剪枝→ Bridge用 Read/Grep/Glob 落地到当前代码→ Synthesizeagentdb_context-synthesize合并来源。它同时内置一张调研模式 × Pathfinder 策略对照表代码库扫描、依赖审计、规范检查、风险评估、先行技术检索五类场景各自对应的种子与扩展策略研究结论最终以agentdb_hierarchical-store持久化为图谱节点。对照可见.agents技能定义的是方法论骨架v3 Pathfinder 则把骨架接到了 AgentDB 向量记忆图谱的具体工具上——两者一脉相承可按所在生态选用。小结agent-researcher/SKILL.md 虽只有一份 Markdown却完整定义了一个可在蜂群中运行的研究型智能体双层 frontmatter 承载技能入口 Agent 元数据 生命周期钩子五项职责划定角色边界四步方法论与由广到窄的搜索策略提供可复用的调研流程research_findingsYAML 规范保证交付物结构统一MCP 记忆协作状态上报、成果共享、历史检索则把它无缝接入 ruflo 的协调总线。配合.agents/config.toml中的 MCP 服务器、性能与钩子配置以及 v3/mcp/tools/v2-compat-tools.ts 提供的 V2→V3 工具兼容层这套定义既保持了向后兼容又能在 ruflo v3 的记忆与蜂群基础设施上直接运行。【免费下载链接】ruflo The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated项目地址: https://gitcode.com/GitHub_Trending/cl/ruflo创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表