handy_prompt_lab
MCP server for building a user-approved transcript corpus from Handy, optimizing post-processing prompts against LM Studio, and promoting winning inference settings.
README
Handy Optimized Prompts
A local MCP app for building a user-approved transcript corpus from Handy, evaluating post-processing prompts against LM Studio, and promoting winning inference settings.
[!IMPORTANT] This repository is shared as an example for inspiration and adaptation. It reflects a personal local workflow and is not a production-ready package, supported product, or drop-in solution. Review and adapt its security, privacy, data-handling, and operational assumptions before using it.
Safety and data boundaries
- Handy's
history.dbandsettings_store.jsonare read-only. - Only
transcription_history.transcription_textis imported. Historical Handy post-processing output is ignored. - Proposals, approved targets, dataset splits, prompts, and evaluation results live in this project's SQLite database.
- Holdout examples are sealed after dataset creation. Optimization tools expose development examples and development failures only.
- LM Studio settings are changed only by the promotion tool after a form confirmation. The existing per-model configuration is backed up first.
- The project never downloads LM Studio models.
Requirements
- macOS
- Handy 0.9.0 or newer
- LM Studio 0.4.0 or newer
- Node.js 24 or newer
Default paths:
- Handy history:
~/Library/Application Support/com.pais.handy/history.db - Prompt-lab data:
./data/handy-prompts.sqlite - LM Studio:
~/.lmstudio - LM Studio API:
http://127.0.0.1:1234
Override them with HANDY_HISTORY_DB, HANDY_PROMPTS_DB, LM_STUDIO_HOME,
or LM_STUDIO_BASE_URL.
Install and verify
npm install
npm test
npm run smoke
The smoke test reads the live Handy history into a temporary database and deletes that database afterward.
Connect to Codex Desktop over STDIO
The MCP server communicates through stdin and stdout only. It does not open an HTTP listener.
[mcp_servers.handy_prompt_lab]
command = "node"
args = ["/absolute/path/to/handy-optimized-prompts/src/server.js", "--stdio"]
startup_timeout_sec = 20
tool_timeout_sec = 1800
Restart Codex after changing the server code or configuration.
Annotation workflow
Start a Codex task and say:
Let's update Handy annotations.
Codex should:
- Call
sync_handy_history. - Call
list_transcripts_needing_proposalswith a maximum of 20. - Generate conservative corrections and call
save_correction_proposals. - Call
show_annotation_lab.
The widget saves each user decision through save_annotation_and_next and
loads the next proposal directly. It does not use ui/message or
ui/update-model-context.
End the task after annotation. Do not optimize the prompt in the same task, because that task has seen the prospective holdout transcripts.
Optimization workflow
Start a fresh Codex task and say:
Optimize my Handy prompt using the approved annotations.
Codex should:
- Call
prepare_optimization_datasetwith the required fresh-task confirmation. - Inspect
get_development_examples. - Call
list_lm_studio_models. - Create a prompt/model/settings candidate with
create_prompt_candidate. - Call
run_development_eval. - Inspect detailed development failures with
get_development_failures. - Iterate until the development candidate is satisfactory.
- Freeze it with
freeze_prompt_candidate. - Call
run_holdout_evalonce. This returns aggregate metrics only.
The initial dataset uses a chronological split: the newest 20% are holdout. With fewer than five approved records, one record is held out when possible. Newly collected transcripts should supply rolling holdouts in later cycles.
Evaluation behavior
Candidates version:
- Handy prompt-template text containing the literal
${output}placeholder - LM Studio model key
- Temperature
- Maximum output tokens
- Optional top-p, top-k, min-p, and repeat penalty
For every evaluation record, the evaluator replaces ${output} with the raw
transcript and sends the complete rendered prompt as a single user message.
Candidates without ${output} are rejected. This matches Handy's legacy path
for custom providers that do not advertise structured-output support.
Evaluation requests match Handy 0.9.0's custom-provider behavior by sending
top-level reasoning_effort: "none". This is fixed rather than a candidate
setting because Handy does not expose it. Model-specific thinking toggles in
LM Studio remain unchanged during promotion.
The primary quality metric is normalized exact match. Normalization performs Unicode NFC cleanup, line-ending normalization, non-breaking-space conversion, outer trimming, and repeated horizontal-whitespace collapse. It preserves capitalization, punctuation, quote and dash style, numbers, words, word order, and line breaks.
The evaluator runs models sequentially. It records the initially loaded LM Studio models, loads the candidate model if necessary, and restores the originally loaded models after the run.
Promotion
plan_lm_studio_promotion shows the proposed per-model default changes.
promote_candidate_to_lm_studio requires:
- A frozen candidate
- A completed holdout evaluation
- An accepted form confirmation
Promotion updates inference fields in:
~/.lmstudio/.internal/user-concrete-model-default-config/<model-key>.json
It preserves unrelated fields such as model-specific thinking toggles and creates a timestamped backup. Reload the model after promotion. The tool returns the winning prompt for manual entry in Handy; it does not write Handy settings.
References
License
This example is shared under the Common Grace License 1.0.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。