Token导航 LogoToken导航TokenDH.com
Clarifyprompt MCP logo
运维云端stdio官方级别未说明来源级核验

Clarifyprompt MCP

MCP Server

ClarifyPrompt MCP 是一款上下文感知的提示词优化编译器,能够将模糊的提示词转换为针对58+个AI平台优化的提示词,适用于创意媒体、代码生成、文档编写等多种场景。

工具数

15

提示词数

0

GitHub Stars

3

资源数

0
多平台支持TypeScriptClaude上下文感知ClaudeCursorWindsurf

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

LumabyteCo

提供方

LumabyteCo

最后核验

2026/5/17 20:23

运行时

Docker

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

docker run -e LLM_API_URL=http://host.docker.internal:11434/v1 -e LLM_MODEL=qwen2.5:7b clarifyprompt-mcp

详细介绍

澄清提示MCP

](https://www.npmjs.com/package/clarifyprompt-mcp) ![evals](https://github.com/LumabyteCo/clarifyprompt-mcp/actions/workflows/evals.yml) ![License: Apache-2.0](https://opensource.org/licenses/Apache-2.0) ](https://nodejs.org/)

A. 上下文感知MCP提示编译器 它将模糊的提示转换为7个类别的58个以上AI平台的平台优化提示,这些提示基于您的工作空间信号(CLAUDE.md、AGENTS.md、.cursorules、package.json)、解析意图和目标模型的功能。

发送原始提示。ClarifyPrompt收集正确的上下文,解析您实际要做的事情,并返回一个专门针对Midjourney、DALL-E、Sora、Runway、ElevenLabs、Claude、ChatGPT、Cursor或58个以上支持的平台中的任何一个进行优化的版本——具有正确的语法、参数、结构和基础。

运作原理

You write:    "a dragon flying over a castle at sunset"

ClarifyPrompt returns (for Midjourney):
  "a majestic dragon flying over a medieval castle at sunset
   --ar 16:9 --v 6.1 --style raw --q 2 --chaos 30 --s 700"

ClarifyPrompt returns (for DALL-E):
  "A majestic dragon flying over a castle at sunset. Size: 1024x1024"

同样的提示,不同的平台,完全不同的输出。ClarifyPrompt知道每个平台的期望——在1.2.0中,它也知道 *你正在做什么*.

1.5.2的新增功能

CI的eval gate(反对 gpt-4o-mini)我们接通电源的那一刻,门就卡住了三个真正的补丁 OPENAI_API_KEY 秘密:

  • 内存存储现在支持任何嵌入维度 (#2).持久vec表被硬编码为768 dims(nomic嵌入文本默认值),因此任何配置 EMBED_MODEL=text-embedding-3-small (1536), voyage-3 (1024), embed-english-v3.0 (1024),否则任何非768型号都会命中 Dimension mismatch: expected 768, got N 在第一 memory_search 电话。存储现在从嵌入器的实际维度导出表名,并在启动时创建特定于dim的表。现有的768个dim安装不受影响。
  • LLM_TIMEOUT_MS 一个是超控。 在LLM客户端上。默认值保持在30秒;在慢速托管模型上的用户可以使用它。eval工作流使用120秒 gpt-4o-mini.
  • Eval安全带加固 --当工具抛出异常时,不再崩溃(SDK返回纯文本错误响应;该工具用于 JSON.parse 他们死了)。一场糟糕的比赛不再能阻止整场比赛。
  • 现场疏散徽章。evals.yml 工作流在每次向main推送时运行。这 [![evals]](...) README顶部的徽章是它的实时状态。目前绿色为20/0/3·100% gpt-4o-mini.

没有新的MCP工具。没有环境变量表面更改(只有添加的可选项 LLM_TIMEOUT_MS).与1.5.x完全兼容。

1.5.1的新增功能

1.5.0之上的补丁发布。纯文档+发货流程改进; 运行时行为与1.5.0相同.

  • README营销界面刷新 --1.5.0版本附带的README在三个地方仍然是1.4.0版本(标题块引用、“X中的新功能”标题、“通过X累积”注释)。其他版本都会出现(package.json, package-lock.json, server.json, src/index.ts, CHANGELOG)这是正确的,但散文漂移了,因为没有任何自动化的东西触及它。1.5.1修复了这一点。
  • 两次新的船舶检查审计CP-11 (README营销表面连贯性)如果上述三项中的任何一项没有引用当前 package.json#version. CP-12 (平台包格式有效性)解析每个 packs/platforms/*.yaml 并断言模式有效性。CP-11在同一天被提升为用户范围(跨项目)的船舶检查技能,因此未来的项目也将受益。
  • 没有代码更改。 没有新的MCP工具。没有新的环境变量。与1.5.0相同的tarball解剖结构,加上几百字节的CHANGELOG。

1.5.0的新增功能

内置平台变成了声明式的。 58个以上的硬编码TypeScript平台数组转移到 packs/platforms/*.yaml --添加内置平台现在是YAML编辑,而不是TS编辑。TypeScript层变成了一个带有硬编码回退表的运行时加载器。格式错误的YAML永远无法软砖服务器。

packs/platforms/
  chat.yaml       9 platforms
  code.yaml       9
  document.yaml   8
  image.yaml     10
  music.yaml      4
  video.yaml     11
  voice.yaml      7
  README.md      contributor docs

要添加新的内置平台:将条目附加到相关类别文件中,运行 npm run build,打开PR。不需要TS编辑。通过运行时自定义平台(register_platform)对于用户安装的平台,其工作原理仍然相同。

  • 内存层评估覆盖率。 eval线束现在支持 setup: [{tool, args}, ...] --在主程序之前执行的MCP工具调用列表 input两个新的夹具使用它:一个内联加载知识包,并验证其中的块表面 grounding.sources 嵌入后→ 商店→ 检索→ 策划→ 地面管线;另一个证明了向量搜索的排名质量。 总共23个装置 (1.4.0中为20)。
  • 测试基础设施现代化。 用于断言文字版本字符串的集成+第2天测试电池(1.3.0, 16 tools)每次碰撞都会断裂。现在他们读 EXPECTED_VERSIONpackage.json 并断言工具的存在 *集* 而不是工具 *计数*未来的颠簸不会破坏测试。
  • 收养材料。 docs/adoption/ 附带可复制/粘贴的Show HN正文、Reddit帖子、Twitter帖子、出色的mcp服务器PR模板和目录提交规范(mcp.so、Smithery、mcp-get、PulseMCP、modelcontextprotocol/servers)。
  • 一个新的运行时dep: js-yaml 从devDependency升级为平台加载器(约200 KB)。
  • MCP工具表面与1.4相同。 20个工具,1个资源。没有新工具;未拆除工具;结果形状不变。

以前在1.4.0中——可组合管道

四个核心操作作为一流的MCP工具组成。独立使用任何工具,或在一次调用中运行整个链:

  ┌─────────────┐     ┌─────────────────────┐     ┌──────────────┐
  │  clarify    │ →   │  ground OR optimize │ →   │   critique   │
  │  (optional) │     │       (core)        │     │  (optional)  │
  └─────────────┘     └─────────────────────┘     └──────────────┘

  one call = compose_prompt(prompt, [sources], post_critique, auto_revise, ...)
  • clarify_with_user --给定一个模棱两可的草稿,返回1-3个有针对性的澄清问题,每个问题都有一个 suggested_answer 您可以逐字接受,可选2-4个快速选择 options和a dimension 标签(受众/范围/格式/长度/音调/约束/目标/平台)。短路 clarificationNeeded: false 在自信、条理清晰的提示下,它会干净地排在前面 optimize_prompt 无需支付每次通话的延迟税。
  • ground_prompt --严格的检索增强变体 optimize_prompt。呼叫者提供的来源被固定在 最高的 优先级——高于项目规则,高于固定指令——并在跟踪中单独跟踪为 user-source:N严格模式:零非空源→ 错误,无需沉默。每个源代码体上限(4000个字符),因此单个巨大的粘贴无法主导预算。
  • critique_prompt --LLM担任法官。在5个默认维度(清晰度、特异性、意图对齐、格式正确性、长度适当性)或您自己的标准上,用每个维度的基本原理+具体建议、总体得分和判断对候选人提示进行0-10的评分(accept / revise / reject).在......下面 revise_threshold (默认值7.0)它还返回一个 improvedPrompt 您可以在飞行前使用它(“对于昂贵的型号来说,这个提示足够好吗?”),在飞行后使用它(”提示是原因吗?“),或者A/B选择N个优化变体中的最佳变体。
  • compose_prompt --一个MCP调用运行规范管道。根据您是否通过,自动决定地面与优化分支 sources. pre_clarify: 'auto' | 'always' | 'never'. post_critique: true 添加法官通行证。 auto_revise: true 替换 final_prompt 当判决不成立时,重写 accept.返回每个阶段的a stages 审计数组,以便调用者确切地看到运行的内容。
  • Eval线束v0 --确定性回归测试 evals/.20 YAML夹具涵盖分析器、形状、意图叠加、接地、澄清、评论、接地和组合曲面。 npm run eval 生成控制台摘要+独立的深色主题HTML报告。多模型矩阵就是bash:run LLM_MODEL=... npm run eval -- --report-path evals/report-X.html 每种型号。
  • CI门控疏散(可选择加入) --何时 OPENAI_API_KEY 设置为repo机密,eval工具在CI中运行 gpt-4o-mini 作为释放之门。默认情况下关闭;没有秘密,任何东西都不会离开你的机器。
  • 5个新的MCP工具 (共20个)。 optimize_prompt 也获得了a userProvidedSources 注射点——两者都有 ground_promptcompose_prompt 在幕后使用它,但如果你想在没有严格模式验证的情况下进行显式控制,它可以直接使用。
从1.3延续而来:持久记忆+知识包+反思性学习。策展人继续对接地源进行评分,并将其放入目标模型的剩余窗口中。 explain_last_curation 仍然会给你一个每次通话的被选中和被拒绝的候选人的细分,并说明原因。

盒子里有什么(累计到1.5.2)

  • 上下文引擎 --自动收集工作区规则(CLAUDE.md, AGENTS.md, .cursorrules, .clinerules, clarify.md),从中检测框架和语言 package.json 和同级清单,跟踪活动文件摘录,并维护最近优化的每个会话环形缓冲区 及其结果.
  • 统一 PromptAnalyzer --一次LLM调用产生 { category, intent, recommendedMode, confidence } 一起。10个意图: production-code, brand-voice, stakeholder-comm, data-extract, creative-media, technical-spec, analysis, quick-draft, exploration, unknown意图在模糊性上胜过表面关键词。
  • 目标模型感知提示整形 --系统提示, maxTokens,以及 temperature 适应下游LLM的上下文窗口和解析的意图。小型本地模型得到紧凑的提示;克劳德/GPT-4/双子座得到了全部的财富。
  • 接地环境(单一,按优先级排序) --用户固定指令→ 项目规则→ 活动文件→ 先前接受的示例→ 网络搜索→ 工作区元数据→ 目标模型提示→ 自定义平台说明→ 内置语法提示。不再有并行的上下文孤岛。
  • 会话检索(save_result) --呼叫者报告 accepted | edited | rejected 每次优化;同一会话中类似的已接受输出作为少数镜头示例被注入到未来的类似提示中。持久内存在1.3中。
  • 本地JSONL跟踪 --每次优化都会写入一条结构化的跟踪线(现在为 shape, groundingSources, error 字段)到 $CLARIFYPROMPT_HOME/traces/YYYY-MM-DD.jsonl. 没有上传任何内容。 通过以下方式切换 CLARIFYPROMPT_TRACE=off.
  • 统一 $CLARIFYPROMPT_HOME --ClarifyPrompt写入的所有内容都有一个env变量。遗产 CLARIFYPROMPT_CONFIG_DIR / CLARIFYPROMPT_DATA_DIR 仍然有效(弃用提示,可沉默)。
  • 58+平台,7类,定制平台 --原始内核不变,完全向后兼容。
  • 任何法学硕士,任何提供者。 一个代码路径可用于 任何与OpenAI兼容的API --Ollama(本地+云)、LM Studio、vLLM、OpenAI、Google Gemini、xAI Grok、Groq、Mistral、DeepSeek、Cohere、Perplexity、Together、Fireworks、OpenRouter等等 人物克劳德 直接。推理模型(o1/o3/o4, deepseek-reasoner, gpt-oss, *-thinking)自动检测并给予更大的令牌预算,因此它们实际上会产生内容。 请参阅下面的15+预配置提供程序示例.
  • 阿帕奇-2.0,永远。 开源核心,无需重新授权。

快速开始

使用克劳德桌面

添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "clarifyprompt": {
      "command": "npx",
      "args": ["-y", "clarifyprompt-mcp"],
      "env": {
        "LLM_API_URL": "http://localhost:11434/v1",
        "LLM_MODEL": "qwen2.5:7b"
      }
    }
  }
}

使用克劳德代码

claude mcp add clarifyprompt -- npx -y clarifyprompt-mcp

启动前在shell中设置环境变量:

export LLM_API_URL=http://localhost:11434/v1
export LLM_MODEL=qwen2.5:7b

带光标

添加到您的 .cursor/mcp.json:

{
  "mcpServers": {
    "clarifyprompt": {
      "command": "npx",
      "args": ["-y", "clarifyprompt-mcp"],
      "env": {
        "LLM_API_URL": "http://localhost:11434/v1",
        "LLM_MODEL": "qwen2.5:7b"
      }
    }
  }
}

与AI管家

AI管家 是自托管的 个人AI代理运行时——单Go二进制、多通道聊天、MCP 生态系统枢纽。将ClarifyPrompt放入其 mcp.servers 配置和 代理将所有11个工具作为本地功能,可从调用 任何渠道(网络聊天、终端、Telegram、Slack等)。

编辑 ~/.aibutler/config.yaml:

configurations:
  mcp:
    servers:
      - name: clarifyprompt
        command: clarifyprompt-mcp
        env:
          LLM_API_URL: "http://localhost:11434/v1"
          LLM_MODEL: "qwen3-vl:8b"

重新启动AI管家。启动日志确认所有11个工具都已连接:

AI Butler boot log: mcp: connected to clarifyprompt (11 tools), 1/1 servers connected, then "Ready. Press Ctrl+C to stop." Verified live integration.

代理根据请求枚举整个表面——每个工具都有前缀 随着 clarifyprompt.:

端到端驱动上下文引擎

您可以预览引擎 *会* 收集(不运行 优化)使用 inspect_context:

Context Engine preview — analyzer output (Category=code, Intent=production-code, Recommended Mode=detailed, Confidence=Medium), session history, and the priority-ordered grounding stack the engine would merge into the system prompt. Closing takeaway about a language mismatch the engine detected between workspace (JS) and prompt (TypeScript).

然后为58个以上支持的平台中的任何一个运行实际的优化器:

optimize_prompt response — Midjourney-shaped optimized prompt for "a dragon flying over a castle at sunset" with --ar 16:9 and --v 6 parameters, plus the analysis section showing Resolved Intent="creative-media", Mode Source, and the grounding sources used

每次优化都会引入一行JSONL ~/.clarifyprompt/traces/YYYY-MM-DD.jsonl --严格的地方,从来没有 上传。这 list_traces 该工具将其转化为可查询的摘要 通过重播支持 get_trace:

list_traces table — trace ID, intent, input preview, platform, latency for recent optimizations. Below the table: a 3-point explanation of what tracing gives — privacy (local-only), observability (every optimization recorded), replay (use trace ID + get_trace to re-fetch the full system prompt)

完整的集成演练,包括从以下内容驱动的所有11个工具 聊天、配置选项和自然语言使用示例-- 在AI Butler文档中: 集成MCP服务器.

支持的平台(58+内置,无限制自定义)

类别平台默认
图像 (10)Midjourney、DALL-E 3、稳定扩散、通量、Ideogram、Leonardo AI、Adobe Firefly、Grok Aurora、谷歌Imagen 3、重新绘制Midjournal
视频 (11)Sora、Runway Gen-3、Pika Labs、Kling AI、Luma、Minimax/Hailuo、Google Veo 2、Wan、HeyGen、Synthesia、CogVideoXRunway
聊天 (9)克劳德、ChatGPT、双子座、骆驼、DeepSeek、Qwen、Kimi、GLM、Minimax克劳德
代码 (9)Claude、ChatGPT、Cursor、GitHub Copilot、Windsurf、DeepSeek程序员、Qwen程序员、程序员、GeminiClaude
文件 (8)克劳德、ChatGPT、Gemini、Jasper、Copy.ai、Notion ai、Grammarly、Writesonic克劳德
语音 (7)ElevenLabs、OpenAI TTS、Fish Audio、芝麻、谷歌TTS、PlayHT、KokoroElevenLab
音乐 (4)Suno AI,Udio,稳定音频,MusicGenSuno

工具

optimize_prompt

主要工具。优化特定AI平台的提示。

{
  "prompt": "a cat sitting on a windowsill",
  "category": "image",
  "platform": "midjourney",
  "mode": "concise"
}

除以下参数外的所有参数 prompt 是可选的。categoryplatform 如果省略,ClarifyPrompt会自动从提示内容中检测到它们。

三种通话模式:

模式示例
零配置{ "prompt": "sunset over mountains" }
仅类别{ "prompt": "...", "category": "image" }
完全明确{ "prompt": "...", "category": "image", "platform": "dall-e" }

参数:

参数必填说明
prompt优化提示
category没有chat, image, video, voice, music, code, document。省略时自动检测。
platform平台ID(例如。 midjourney, dall-e, sora, claude).省略时使用类别默认值。
mode输出样式: concise, detailed, structured, step-by-step, bullet-points, technical, simple默认值: detailed.
enrich_context设置 true 使用网络搜索来丰富上下文。违约: false.
session_id将相关的优化缝合在一起,这样会话内存可能会影响后续调用。省略时自动生成。
file_path活动文件路径--推断语言和形状平台提示。
file_language活动文件的显式语言覆盖。
file_excerpt活动文件的简短摘录(≤2 KB)以支持重写。
cwd要扫描的工作目录 CLAUDE.md / AGENTS.md / .cursorrules / package.json默认为服务器cwd。
user_locale区域设置提示(例如。 en-US, ar-EG)通知语气和语言。
user_pinned_instructions固定的、始终应用的用户指令(短核心内存块)。
include_bundle在响应中包含已解析的ContextBundle摘要。违约: false.
skip_intent_resolution跳过意图分类器LLM调用(更快;丢失意图信号)。违约: false.

响应(1.2.0):

{
  "id": "opt_mo9vlg9i_foohjx",
  "sessionId": "sess_mo9vlfn3_abc123",
  "originalPrompt": "a dragon flying over a castle at sunset",
  "optimizedPrompt": "a majestic dragon flying over a medieval castle at sunset --ar 16:9 --v 6.1 --style raw --q 2 --s 700",
  "category": "image",
  "platform": "midjourney",
  "mode": "concise",
  "modeSource": "analyzer",
  "analysis": {
    "category": "image",
    "intent": "creative-media",
    "recommendedMode": "detailed",
    "confidence": "high",
    "source": "llm"
  },
  "grounding": {
    "sources": ["project-rules", "workspace-meta", "target-model", "platform-hints"],
    "acceptedExamplesUsed": 0
  },
  "shape": {
    "systemPromptBudget": "standard",
    "maxTokens": 2048,
    "temperature": 0.9
  },
  "metadata": {
    "model": "qwen2.5:14b-instruct-q4_K_M",
    "processingTimeMs": 3911,
    "strategy": "ImageStrategy"
  },
  "detection": { "autoDetected": true, "detectedCategory": "image", "detectedPlatform": "midjourney", "confidence": "high" },
  "intent": { "detected": "creative-media", "confidence": "high" }
}

规范分类字段为 analysisThe detectionintent 字段为 已弃用别名 保留1.x个背部;它们将在2.x中删除。

modeSource 告诉最终模式是如何决定的(user 如果你通过了一个, analyzer 如果意图驱动, default 如果两者都没有)。

grounding.sources 按优先级顺序列出哪些接地上下文部分做出了贡献。 grounding.acceptedExamplesUsed 告诉你这台发动机有多少少火的例子 save_outcome 历史。

shape 告诉您的目标模型的系统提示大小。

clarify_with_user *(1.4.0中新增)*

给定一个模棱两可的草稿提示,返回1-3个有针对性的澄清问题,而不是猜测。将其用作前一阶段 optimize_prompt 当你无法判断用户的请求是否会产生良好的重写时。

{
  "prompt": "make it better",
  "force": true
}

答复:

{
  "clarificationNeeded": true,
  "reason": "Clarification recommended (analyzer confidence=low; intent=unknown; prompt is short (12 chars); caller passed force=true).",
  "questions": [
    {
      "question": "What outcome do you want from this prompt — what does success look like?",
      "reasoning": "The draft is ambiguous on the goal/audience dimension; pinning this typically resolves most downstream ambiguity.",
      "suggestedAnswer": "Make the email shorter, clearer, and more action-oriented.",
      "options": ["Make it shorter", "Make it more formal", "Make it more persuasive"],
      "dimension": "goal"
    }
  ],
  "analysis": { "category": "chat", "intent": "unknown", "confidence": "low" }
}

suggestedAnswer 始终填充——调用者可以逐字接受并继续移动。 options 是可选的;UI客户端可以将其呈现为快速选择按钮。这 dimension 标签对问题所针对的轴进行分类。

短路: 当分析器的置信度为 high 提示很长,工具返回 clarificationNeeded: false 在分析器之外没有LLM调用,因此您可以将其流水线化 optimize_prompt 无需对每次通话征收延迟税。通过 force: true 以禁用短路。

ground_prompt *(1.4.0中新增)*

严格的检索增强变体 optimize_prompt呼叫者提供的来源是 被固定在最高优先级 --上述项目规则和固定说明——因此重写是基于您提供的材料,而不是策展人认为相关的任何材料。

{
  "prompt": "rewrite the launch announcement to match our voice",
  "category": "document",
  "platform": "claude",
  "sources": [
    {
      "label": "Brand Voice Rules",
      "body": "Tone: warm, plain-spoken, no jargon. Always lead with the user benefit. Avoid 'leverage', 'synergy', 'robust'. Max sentence length: 18 words.",
      "kind": "rules"
    },
    {
      "label": "Launch Draft",
      "body": "Today we're launching FlowSync Pro — a tool to leverage AI synergy for robust team coordination...",
      "kind": "draft"
    }
  ]
}

返回与相同的形状 optimize_promptusedSources (哪些来源实际上落在了精心策划的背景中)以及 droppedSources (来源为空或已删除)。源在跟踪中显示为 user-source:0, user-source:1等等。

严格模式: 零非空源→ 错误,而不是无声的失败。每个源代码的正文上限为4000个字符,因此单个巨大的粘贴无法主导预算。

critique_prompt *(1.4.0中新增)*

LLM担任法官。在5个默认维度上对候选提示进行0-10的评分,并(当低于阈值时)返回改进的重写。

{
  "prompt": "make it good",
  "revise_threshold": 7
}

答复:

{
  "overallScore": 2.0,
  "verdict": "reject",
  "summary": "Reject — substantial rewrite required.",
  "dimensions": [
    { "name": "clarity", "score": 1, "rationale": "...", "suggestions": ["Specify what 'it' refers to", "..."] },
    { "name": "specificity", "score": 0, "rationale": "...", "suggestions": [...] },
    { "name": "intent_alignment", "score": 3, "rationale": "...", "suggestions": [...] },
    { "name": "format_fitness", "score": 2, "rationale": "...", "suggestions": [...] },
    { "name": "length_appropriateness", "score": 1, "rationale": "...", "suggestions": [...] }
  ],
  "improvedPrompt": "Improve the README's getting-started section: shorten...",
  "improvements": ["Specified the artifact (README's getting-started section)", "Added concrete success criteria", "..."],
  "judgeModel": "qwen2.5-coder:7b-instruct-q4_K_M"
}

参数:

参数默认值说明
prompt--考生提示评分。
original_prompt--在评论优化版本时,用户最初会问。用于 intent_alignment 尺寸。
criteria5个默认值自定义尺寸: [{ name, description }, ...]最多约8个维度。
revise_threshold7.0低于此的总分会触发重写通过
skip_rewritefalse完全跳过重写过程(更快;只返回分数)。

卫生检查: 如果法官膨胀 overall 超过每维度平均值2.5点,发动机会对其进行校正。

compose_prompt *(1.4.0中新增)*

规范管道。一通电话澄清→ 地面/优化→ 批评→ 可选自动修改。

{
  "prompt": "Write a TypeScript function that takes an array of email strings and returns only those that match RFC 5322 syntax. Include unit tests using Vitest with at least 6 test cases.",
  "pre_clarify": "auto",
  "post_critique": true,
  "auto_revise": true
}

响应(截断):

{
  "stages": [
    { "name": "clarify",  "ranAt": "...", "durationMs":  541, "summary": "no clarification needed (short-circuit)" },
    { "name": "optimize", "ranAt": "...", "durationMs": 3128, "summary": "5 grounding source(s) selected" },
    { "name": "critique", "ranAt": "...", "durationMs": 3422, "summary": "verdict=accept, score=8.4" }
  ],
  "finalPrompt": "Write a TypeScript function `validateEmails(emails: string[]): string[]` that...",
  "clarificationRequired": false,
  "clarification": { "clarificationNeeded": false, ... },
  "optimization": { "id": "opt_...", "optimizedPrompt": "...", ... },
  "critique": { "overallScore": 8.4, "verdict": "accept", ... }
}

finalPrompt 这是你应该向下游发送的。它等于 optimization.optimizedPrompt (或 grounding.optimizedPrompt)除非 auto_revise: true 而批评的结论不是 accept 还有一个 improvedPrompt --在这种情况下 finalPrompt 是重写和 revised: true.

分支:

输入路径
没有 sourcesoptimize_prompt 分支(自动管理接地)
非空 sourcesground_prompt 分支(严格,呼叫者提供的来源固定)
pre_clarify: "auto" (默认)澄清运行;在自信的提示下不出现问题的短路
pre_clarify: "always"如果出现问题,clear始终运行并停止链
pre_clarify: "never"完全跳过澄清
post_critique: true在优化/基础之后进行批评
auto_revise: true (与 post_critique: true)当判决!== accept 还有一个 improvedPrompt,替换 finalPrompt

硬停止: 如果澄清表面问题(仅在以下情况下发生 pre_clarify: "always",或 auto 在低置信度提示下),链停止并返回 clarificationRequired: true呼叫者回答问题,编辑提示以包含答案,然后重新呼叫(通常使用 pre_clarify: "never" 跳过第二次澄清环节)。

inspect_context *(1.2.0中新增)*

预览 ContextBundle ClarifyPrompt将根据给定的提示(工作区规则、框架、目标模型功能、解析意图和会话历史)进行组装,而无需运行完整的优化。有助于调试优化结果的原因。

{
  "prompt": "Write an email to finance explaining the Q2 spend variance",
  "category": "document",
  "cwd": "/path/to/your/project"
}

返回完整 ContextBundle JSON格式。

list_traces *(1.2.0中新增)*

本地跟踪器捕获的最近优化跟踪的摘要列表(当 CLARIFYPROMPT_TRACE=local,默认值)。

{ "day": "2026-04-22", "limit": 50 }

返回跟踪ID、输入预览、已解析意图、目标系列和延迟——从不返回完整的系统提示(使用 get_trace 为此)。省略 day 获取最近一天的数据。

get_trace *(1.2.0中新增)*

按ID获取单个优化的完整跟踪,包括确切的系统提示、捆绑包摘要和输出。

{ "id": "opt_xxx", "lookback_days": 7 }

save_outcome *(1.2.0中新增)*

告诉ClarifyPrompt过去的优化是否 accepted, edited,或 rejected接受的输出成为同一会话中类似未来提示的少数示例。在1.3+版本中,这也将为持久内存层提供数据。IDE/代理/调用者应在用户对优化进行操作后调用此函数。

{
  "optimization_id": "opt_xxx",
  "session_id": "sess_yyy",
  "verdict": "accepted",
  "diff": "optional: the user's edited version or a patch"
}

list_categories

列出所有7个类别,包括平台计数(内置和自定义)和默认值。

list_platforms

列出给定类别的可用平台,包括自定义注册平台。显示默认设置以及是否配置了自定义指令。

list_modes

列出所有7种输出模式及其说明。

register_platform

注册一个新的自定义AI平台以进行快速优化。

{
  "id": "my-llm",
  "category": "chat",
  "label": "My Custom LLM",
  "description": "Internal fine-tuned model",
  "syntax_hints": ["JSON mode", "max 2000 tokens"],
  "instructions": "Always use structured output format",
  "instructions_file": "my-llm.md"
}
参数必填说明
id唯一ID(小写、带连字符的字母数字)
category此平台所属的类别
label人类可读的平台名称
description简短描述
syntax_hints特定于平台的语法提示
instructions内联优化说明
instructions_file路径 .md 带有详细说明的文件

update_platform

更新自定义平台或向内置平台添加指令覆盖。

对于 内置平台 (例如Midjourney、Claude),您可以添加自定义指令和额外的语法提示,而无需修改原始指令:

{
  "id": "midjourney",
  "category": "image",
  "instructions": "Always use --v 6.1, prefer --style raw",
  "syntax_hints_append": ["--no plants", "--tile for patterns"]
}

对于 自定义平台,所有字段都可以更新。

unregister_platform

从内置平台中删除自定义平台或清除指令覆盖。

{
  "id": "my-llm",
  "category": "chat"
}

对于内置平台,请使用 remove_override_only: true 在不影响平台本身的情况下清除自定义指令。

定制平台和说明

ClarifyPrompt支持注册自定义平台并提供优化说明——类似于如何 .cursorrulesCLAUDE.md 引导AI行为。

运作原理

  1. 注册 定制平台通过 register_platform
  2. 提供说明 内联或作为 .md 文件
  3. 优化提示 针对您的自定义平台——指令被注入到优化管道中

指令文件

说明可以作为markdown文件提供,存储在 ~/.clarifyprompt/instructions/:

~/.clarifyprompt/
  config.json                    # custom platforms + overrides
  instructions/
    my-llm.md                   # instructions for custom platform
    midjourney-overrides.md     # extra instructions for built-in platform

示例指令文件(my-llm.md):

# My Custom LLM Instructions

## Response Format
- Always output valid JSON
- Include a "reasoning" field before the answer

## Constraints
- Max 2000 tokens
- Temperature should be set low (0.1-0.3) for factual queries

## Style
- Be concise and technical
- Avoid filler phrases

覆盖内置平台

您可以使用以下命令向58个内置平台中的任何一个添加自定义指令 update_platform。这允许您自定义如何为Midjourney、Claude或Sora等平台优化提示,而无需修改默认值。

配置目录

配置目录默认为 ~/.clarifyprompt/ 并且可以通过以下方式进行更改 CLARIFYPROMPT_CONFIG_DIR 环境变量。自定义平台和覆盖在服务器重新启动时仍然存在。

LLM配置

ClarifyPrompt使用LLM来优化提示。它与 任何与OpenAI兼容的API无烟煤API 直接。

环境变量

变量必填描述
LLM_API_URLAPI端点URL
LLM_API_KEY取决于API密钥(本地Ollama不需要)
LLM_MODEL型号名称/ID
CLARIFYPROMPT_HOME没有标准(1.2.0+) ClarifyPrompt编写的所有内容的根——自定义平台、指令 .md 文件、跟踪、内存数据库和知识包。违约: $XDG_DATA_HOME/clarifyprompt~/.clarifyprompt.
CLARIFYPROMPT_TRACE没有offlocalotel默认值: local跟踪是严格的本地JSONL;没有上传任何内容。
EMBED_API_URL没有(1.3.0+) 嵌入内存+知识包检索的端点。任何兼容OpenAI的 /v1/embeddings 终点。默认为 LLM_API_URL 未设置时,Ollama用户只需工作
EMBED_API_KEY没有(1.3.0+) 嵌入API密钥。默认为 LLM_API_KEY 未设置时;当地Ollama不需要。
EMBED_MODEL没有(1.3.0+) 违约: nomic-embed-text:v1.5 (768昏暗,拉 ollama pull nomic-embed-text).交换到 text-embedding-3-small 对于OpenAI, voyage-3 对于Voyage, embed-english-v3.0 对于Cohere。
EMBED_DIMENSION没有(1.3.0+) 嵌入输出维度。违约: 768。必须与您的嵌入模型匹配(1536 OpenAI text-embedding-3-small, 1024 用于航行等)。
SEARCH_PROVIDER可选的网络搜索丰富提供程序 enrich_context: true.其中之一 tavily (默认)braveserperserpapiexasearxng.
SEARCH_API_KEY配置的没有neneneba API密钥 SEARCH_PROVIDER。自托管SearXNG不需要。
SEARCH_API_URL搜索端点URL。仅自托管SearXNG(指向您的实例)需要。
CLARIFYPROMPT_SUPPRESS_LEGACY_WARN设置为 1 在以下情况下,沉默一行贬损提示 CLARIFYPROMPT_CONFIG_DIR / CLARIFYPROMPT_DATA_DIR 使用。
CLARIFYPROMPT_CONFIG_DIR没有遗产 别名 CLARIFYPROMPT_HOME。仍然有效;将在2.x中删除
CLARIFYPROMPT_DATA_DIR没有遗产 别名 CLARIFYPROMPT_HOME。仍然有效;将在2.x中删除

提供商示例

奥利玛(当地,免费):

LLM_API_URL=http://localhost:11434/v1
LLM_MODEL=qwen2.5:7b

Ollama——通过本地直通的云模型(推荐):

如果您当地的Ollama已登录Ollama Cloud,则任何 :cloud 模型通过它透明地路由——相同的URL,没有单独的API键。能力表自动检测 推理/思维变体 (gpt-oss, kimi-k2-thinking, qwen3-thinking, deepseek-r1等)和凸起 maxTokens 所以他们完成了思考,并实际制作了内容。

LLM_API_URL=http://localhost:11434/v1
LLM_MODEL=gpt-oss:20b-cloud        # or kimi-k2.6:cloud, qwen3-next:80b-cloud, glm-4.6:cloud, etc.

Ollama——直接云端点(无需本地安装):

LLM_API_URL=https://ollama.com/v1
LLM_API_KEY=your-ollama-cloud-key
LLM_MODEL=qwen2.5:7b

OpenAI:

LLM_API_URL=https://api.openai.com/v1
LLM_API_KEY=sk-...
LLM_MODEL=gpt-4o

人物克劳德:

LLM_API_URL=https://api.anthropic.com/v1
LLM_API_KEY=sk-ant-...
LLM_MODEL=claude-sonnet-4-20250514

谷歌双子座:

LLM_API_URL=https://generativelanguage.googleapis.com/v1beta/openai
LLM_API_KEY=your-gemini-key
LLM_MODEL=gemini-2.0-flash

Groq:

LLM_API_URL=https://api.groq.com/openai/v1
LLM_API_KEY=gsk_...
LLM_MODEL=llama-3.3-70b-versatile

DeepSeek:

LLM_API_URL=https://api.deepseek.com/v1
LLM_API_KEY=your-deepseek-key
LLM_MODEL=deepseek-chat

OpenRouter(任何型号):

LLM_API_URL=https://openrouter.ai/api/v1
LLM_API_KEY=your-openrouter-key
LLM_MODEL=anthropic/claude-sonnet-4

.env.example 查看20多个受支持的提供商的完整列表,包括Together AI、Fireworks、Mistral、xAI、Cohere、Perplexity、LM Studio、vLLM、LocalAI、Jan、GPT4All等。

网络搜索(可选)

通过设置启用上下文丰富 enrich_context: true 在你的 optimize_prompt 电话。ClarifyPrompt将在优化之前在网络上搜索相关上下文。

支持的搜索提供商:

提供者变量URL
Tavily(默认)SEARCH_API_KEYtavily.com
勇敢的搜索SEARCH_API_KEYbrave.com/search/api
SerperSEARCH_API_KEY瑟珀·德夫
SerpAPISEARCH_API_KEY蛇网
ExaSEARCH_API_KEY例如ai
SearXNG(自托管)--
SEARCH_PROVIDER=tavily
SEARCH_API_KEY=your-key

前后

图片(中途)

Before: "a cat sitting on a windowsill"

After:  "a tabby cat sitting on a sunlit windowsill, warm golden hour
         lighting, shallow depth of field, dust particles in light beams,
         cozy interior background, shot on 35mm film, warm amber color
         palette --ar 16:9 --v 6.1 --style raw --q 2"

视频(索拉)

Before: "a timelapse of a city"

After:  "Cinematic timelapse of a sprawling metropolitan skyline
         transitioning from golden hour to blue hour to full night.
         Camera slowly dollies forward from an elevated vantage point.
         Light trails from traffic appear as the city illuminates.
         Clouds move rapidly overhead. Duration: 10s.
         Style: documentary cinematography, 4K."

代码(克劳德)

Before: "write a function to validate emails"

After:  "Write a TypeScript function `validateEmail(input: string): boolean`
         that validates email addresses against RFC 5322. Handle edge cases:
         quoted local parts, IP address domains, internationalized domain
         names. Return boolean, no exceptions. Include JSDoc with examples
         of valid and invalid inputs. No external dependencies."

音乐(苏诺)

Before: "compose a chill lo-fi beat for studying"

After:  "Compose an instrumental chill lo-fi beat for studying.
         [Tempo: medium] [Genre: lo-fi] [Length: 2 minutes]"

上下文引擎(1.2.0)

每个优化都要经过五个集成过程,这些过程将一束上下文端到端地流动:

  1. 分析 --单身 analyzePrompt() LLM呼叫产生 category, intent,以及 recommendedMode 所以他们不能意见相左。当表面关键词发生冲突时,意图胜过表面关键词(例如。 "validate emails"codedocument).
  2. 模式协调 --显式用户 mode 胜利;否则,分析器的意图衍生建议适用; modeSource 在回应中告诉你是哪一个。
  3. 快速成型 --目标模型能力信号驱动 systemPromptBudget (小型本地型号紧凑,100K+ctx型号丰富), maxTokens, temperature (意识到意图),以及是否包括示例。
  4. 意图叠加 --根据意图进行短覆盖(production-code:需求错误处理+测试; data-extract:要求严格的模式; brand-voice:用语调引导;等等)折叠到策略的系统提示中。
  5. 接地背景 --合并用户固定指令的单个优先级排序块→ 项目规则→ 活动文件→ 会话几个镜头示例→ 网络搜索→ 工作区元数据→ 目标模型提示→ 自定义平台说明→ 内置语法提示。

收集了什么(ContextBundle)

  • 项目 --来自的第一个匹配文件 CLAUDE.md, AGENTS.md, .cursorrules, .clinerules, clarify.md, .clarify/rules.md. package.json 加上兄弟姐妹清单(pyproject.toml, Cargo.toml, go.mod, Gemfile, composer.json,…)驱动框架+语言检测。
  • 文件 --可选 file_path / file_language / file_excerpt 输入。
  • 会话 --最近优化和结果的环形缓冲区(20次操作/会话)。接受的输出将作为类似未来提示的少数镜头示例进行检索。
  • 目标模型 --LLM根据能力表进行重写。
  • 用户 --区域设置、首选模式、固定指令(最高优先级接地)。

检查发动机所见

使用 inspect_context 工具预览完整的捆绑包,而无需运行优化。形状与 optimize_prompt 返回时 include_bundle: true.

扩展上下文

放下 AGENTS.md / clarify.md / CLAUDE.md 在你的项目根。下一次优化会自动进行。要将接受的输出反馈到未来的重写中,请调用 save_outcome 在用户对结果进行操作之后。

追踪

$CLARIFYPROMPT_HOME/traces/YYYY-MM-DD.jsonl

每次优化都会写入一个JSONL行捕获 {id, ts, sessionId, category, platform, mode, input, bundleSummary, systemPrompt, output, model, strategy, latencyMs, shape, groundingSources, error}.使用 list_traces 总结和 get_trace 完整记录。

隐私姿态:

  • 痕迹是 严格当地。没有对任何ClarifyPrompt拥有的基础设施的出站网络呼叫。
  • 只呼唤 您配置的LLM终结点 (LLM_API_URL)可选 搜索提供程序 (SEARCH_API_KEY).
  • 完全禁用跟踪 CLARIFYPROMPT_TRACE=off.
  • 无遥测 在本次发布中。当遥测选项发货时,它将 选择加入,匿名,并在构建包含它之前进行记录。

已知限制和路线图

会话内存仅在内存中(今天)

save_outcome +很少有镜头检索循环写入每个进程的环形缓冲区。重新启动MCP服务器会清除会话状态;两台服务器不共享内存。这 MCP刀具表面故意保持稳定 --界面在1.3中不会改变。升级纯粹是后端交换 SQLite+SQLite-vec 磁盘持久性和更丰富的相似性。船舶目标: 1.3.

意图质量随运行分析仪的模型而变化

分析仪在相同的设备上运行 LLM_MODEL 这就是重写。在集成电池中:

  • 问题2.5 7B和14B→ 在每一次测试中都是正确的。
  • Llama 3.2 3B→ 偶尔在模棱两可的提示下过度提交(例如标记 "make it better" 作为 brand-voice/highunknown/low 是正确答案)。同一提示下的较大型号正确返回 unknown/low.

指导: 更喜欢7B+本地模型(或任何前沿托管模型) LLM_MODEL。对延迟敏感的呼叫者可以设置 skip_intent_resolution: true 跳过分析器;引擎退回到用户提示类别和默认模式,失去了意图驱动模式+叠加,但保持了基础+形状。一个系统 eval线束 随着公共设施的设置,土地 1.3(第3天) 因此,您可以根据自己的夹具对分析器进行评分,并检测模型或分类器变化之间的回归。

能力表并不详尽

今天的参赛作品:克劳德、GPT-4/o-series、双子座、格罗克、DeepSeek(聊天+推理)、Qwen、Llama、米斯特拉尔/编码、混音、Gemma、Phi、Cohere Command、Aya、Kimi、GLM、Minimax、GPT-OSS、Yi、Nemotron。未知型号回归 capabilities: {}standard 提示形状——仍然可用,只是没有模型感知尺寸。添加条目仅限于数据编辑 src/engine/context/targetModelSignals.ts.

推理/思维链模型

作为一级案件得到支持。发动机自动检测家庭级别的推理机(o1/o3/o4, deepseek-reasoner, gpt-oss)在变体级别(ID匹配的任何东西 /\b(thinking|reasoner|reasoning)\b//\br[12]\b/: kimi-k2-thinking:cloud, qwen3-thinking:72b, qwen-r1-distill等等)。对于这些, maxTokens 自动提升到≥8192,因此模型有思考和生成内容的空间。这 reasoning 字段永远不会作为优化的提示出现——只是 content

建筑

clarifyprompt-mcp/
  src/
    index.ts                           MCP server entry point (20 tools, 1 resource)
    engine/
      config/
        categories.ts                  CategoryConfig type + CATEGORIES const (loaded from YAML in 1.5.0)
        platformLoader.ts              (1.5.0) YAML pack loader — reads packs/platforms/*.yaml at boot
        paths.ts                       Unified $CLARIFYPROMPT_HOME resolver (1.2.0)
        persistence.ts                 ConfigStore — JSON config + .md file loading
        registry.ts                    PlatformRegistry — merges built-in + custom
      context/                         Context Engine (1.2.0)
        types.ts                       ContextBundle + signal types + AnalysisSignal
        projectSignals.ts              CLAUDE.md / AGENTS.md / .cursorrules / manifests scan
        fileSignals.ts                 Active-file path + language + excerpt
        sessionSignals.ts              In-memory per-session ring buffer + outcome retrieval
        targetModelSignals.ts          Model → capabilities mapping
        promptAnalyzer.ts              Unified analyzer: category + intent + recommendedMode
        bundle.ts                      Bundle orchestrator
      trace/                           Local tracing (1.2.0)
        types.ts                       TraceEntry schema (shape, groundingSources, error)
        writer.ts                      JSONL + OTel-stub writer, reader, lookup
      memory/                          Persistent memory + knowledge packs (1.3.0)
        store.ts                       SQLite + sqlite-vec; bi-temporal facts, outcomes, packs
        packs.ts                       Knowledge-pack loader (local / URL / inline)
        reflection.ts                  LLM fact extraction on save_outcome
      llm/client.ts                    Multi-provider LLM client (OpenAI + Anthropic)
      search/client.ts                 Web search (6 providers; results merge into Grounding Context)
      optimization/
        engine.ts                      Core orchestrator — analyzer, shape, grounding, retrieval, trace
        curator.ts                     Token-budget grounding curator (1.3.0)
        groundingContext.ts            Priority-ordered context assembly + mode/shape helpers
        types.ts                       OptimizationContext + result shape (UserProvidedSource)
        strategies/
          base.ts                      Bundle-aware base strategy (intent overlay + shape-aware sizing)
          chat.ts                      9 platforms
          image.ts                     10 platforms
          video.ts                     11 platforms
          voice.ts                     7 platforms
          music.ts                     4 platforms
          code.ts                      9 platforms
          document.ts                  8 platforms
      clarification/clarify.ts         (1.4.0) clarify_with_user — targeted questions w/ defaults
      grounding/ground.ts              (1.4.0) ground_prompt — strict caller-provided grounding
      critique/critique.ts             (1.4.0) critique_prompt — LLM-as-judge + optional rewrite
      composition/compose.ts           (1.4.0) compose_prompt — canonical clarify→ground/opt→critique pipeline
  evals/                                Eval harness v0 (1.3.0; setup: multi-call in 1.5.0)
    run.mjs                            YAML fixtures → MCP server → scored HTML report
    fixtures/*.yaml                    23 deterministic fixtures
    schema.json                        Fixture schema
  packs/                                (1.3.0) knowledge packs + (1.5.0) platform packs
    *.md                               Knowledge packs (community-contributable)
    platforms/*.yaml                   (1.5.0) built-in AI platform declarations — 7 files, 58 platforms
  docs/adoption/                        (1.5.0) launch-post drafts + catalog submission specs

码头工人

docker build -t clarifyprompt-mcp .
docker run -e LLM_API_URL=http://host.docker.internal:11434/v1 -e LLM_MODEL=qwen2.5:7b clarifyprompt-mcp

发展

git clone https://github.com/LumabyteCo/clarifyprompt-mcp.git
cd clarifyprompt-mcp
npm install
npm run build

MCP检验员测试:

npx @modelcontextprotocol/inspector node dist/index.js

在连接之前,在检查器的“环境变量”部分设置环境变量。

测试+评估

命令它的作用
npm run test:integration第一天集成电池(意图+接地+形状)
npm run test:day2第二天记忆+策展人+反射电池
npm run test:reasoning推理模型覆盖率(思维链maxTokens凹凸)
npm run test:wireMCP线路冒烟测试(服务器启动、工具列表、初始化往返)
npm run test:all四个电池按顺序排列
npm run eval运行20个确定性评估装置+渲染 evals/report.html
npm run eval -- --filter 只运行匹配的设备 `` (或标签)
npm run eval -- --quiet仅退出代码输出(CI友好)

评估线束细节、夹具格式和多模型矩阵说明: evals/README.md.

CI/质量门

该仓库提供了GitHub Actions工作流()有五份工作:

工作运行它的门
buildLinux+macOS上节点18/20/22上的每次推送+PR类型检查+构建+启动冒烟测试
secrets-audit跟踪文件中已知API-key前缀的每次推送+PRgit-grep
evals每次推送+公关(选择加入)npm run eval 反对 gpt-4o-mini.成功跳过 OPENAI_API_KEY 秘密尚未确定;块在配置后发布,任何夹具都会回退
docker每一次推送+公关docker build +集装箱行李箱烟雾测试
publish仅推送标签npm publish --provenance 当标签匹配时 package.json#version,对上述四项工作都进行了审查

要在叉子上启用疏散门作为释放门:

  1. Repo → 设置秘密和变量行动新存储库机密
  2. 姓名: OPENAI_API_KEY ·值:一个可访问的OpenAI API密钥 gpt-4o-mini
  3. 推送或重新运行任何工作流

成本:每次CI运行约0.005美元(17个活动夹具×约1500个输入令牌×约600个输出令牌,按gpt-4o-mini定价)。eval工具的HTML报告作为构建工件上传(保留30天),因此您可以检查任何故障,而无需在本地重新运行。

要在标签推送上启用npm发布: 添加一个 NPM_TOKEN 使用范围为的粒度访问令牌进行加密 clarifyprompt-mcp (bypass-2FA已启用)。相同的设置流程。

许可证

阿帕奇-2.0

目录标签

目录标签

多平台支持TypeScriptClaude上下文感知提示词优化本地部署AI平台适配自动化优化

支持客户端

ClaudeCursorWindsurf

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

运行时(runtime,运行环境)

Docker

工具数量(toolCount,工具数)

15

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP