diff --git a/README-zh-CN.md b/README-zh-CN.md index 91965fc..fb9b97d 100644 --- a/README-zh-CN.md +++ b/README-zh-CN.md @@ -112,11 +112,14 @@ MCP 的调用流程尽量保持简单: ```text failed command output -> e2f_get_latest_failure_brief + -> 如果有历史检索能力,用返回的 summary 先检索相似问题 -> 信息够就直接回答 -> 信息不够再调用 e2f_query_failure_evidence -> 环境信息会影响判断时再调用 e2f_get_runtime_context ``` +如果 Agent 环境里有历史检索能力,可以用 brief 返回的 `summary` 和其他紧凑诊断字段作为查询线索;不要把原始 `stdout` 或 `stderr` 直接送去检索。如果没有历史检索能力,就继续走原来的 MCP 流程,不需要额外依赖。 + ## Benchmark 仓库里有一组早期 benchmark 数据,位置是 `benchmarks/failures`。每个 case 只保留原始日志 `raw.log`,脚本会自己组装 MCP 输入并生成结果。 diff --git a/README.md b/README.md index 6190849..60f6150 100644 --- a/README.md +++ b/README.md @@ -110,11 +110,17 @@ The intended agent flow is: ```text failed command output -> e2f_get_latest_failure_brief + -> optional history search with the returned summary if available -> answer if sufficient -> e2f_query_failure_evidence only if more detail is needed -> e2f_get_runtime_context only if environment context matters ``` +If the agent environment provides a history-search capability, use the brief +`summary` and other compact diagnostic fields as the query seed. Do not search +with raw `stdout` or `stderr`. When no history search is available, follow the +same MCP flow without any extra dependency. + ## Benchmark The repository includes an early MCP benchmark dataset under `benchmarks/failures`. diff --git a/packages/mcp/README.md b/packages/mcp/README.md index 233cc42..078cd4d 100644 --- a/packages/mcp/README.md +++ b/packages/mcp/README.md @@ -4,6 +4,8 @@ MCP server for agent-facing frontend `error2fix` diagnosis workflows. This package exposes compact frontend failure-analysis tools for IDEs and coding agents. It is currently focused on JavaScript/TypeScript frontend workflows such as package scripts, bundlers, framework compile errors, and dependency resolution. The client provides the raw failed command output, and the server returns small, structured responses that are safer for an LLM token budget than full log replay. +When the host agent has a history-search capability, use the returned brief `summary` and compact diagnostic fields to search for similar past failures. Do not pass raw `stdout` or `stderr` into history search. Without history search, use the same brief -> evidence -> runtime-context flow. + ## Tools - `e2f_get_latest_failure_brief`: compresses client-provided `stdout` and `stderr` into a diagnosis brief and creates a session. diff --git a/packages/mcp/src/constants/index.ts b/packages/mcp/src/constants/index.ts index c82b45f..e87ab1e 100644 --- a/packages/mcp/src/constants/index.ts +++ b/packages/mcp/src/constants/index.ts @@ -26,6 +26,7 @@ export const WORKFLOW_DESCRIPTION = [ 'Scope: use these tools for frontend JavaScript/TypeScript project failures such as npm/pnpm/yarn scripts, Vite, Next.js, React, Svelte, Tailwind, bundlers, test runners, dependency resolution, and framework compile errors.', 'Do not treat this server as a general-purpose diagnosis tool for arbitrary programming languages yet.', 'Recommended workflow: call e2f_get_latest_failure_brief first.', + 'If historical context search is available, use the returned summary and compact diagnostic fields as the search query before requesting more evidence; never search with raw stdout or stderr.', 'If next.canAnswerFromDiagnosis is true, answer without requesting raw logs.', 'If more frontend failure evidence is needed, call e2f_query_failure_evidence with evidence IDs or suggested queries from the diagnosis.', 'Call e2f_get_runtime_context only when frontend command facts, package manager, runtime versions, workspace files, git state, or safe environment details affect the fix.',