handoff-mcp

handoff-mcp

A dependency-free stdio MCP server that enables coding agents to persist and restore project task state, memory, decisions, and next steps across sessions using the .handoff contract.

Category
访问服务器

README

TaskHandoff

DeepSeek-friendly long-task project memory & cross-session handoff for coding agents.

长任务做到一半换会话 / 上下文被压掉 / 换模型 —— Agent 忘了目标、决策和下一步。
TaskHandoff 把状态写进仓库 .handoff/:任何能读项目文件的 Harness 都能恢复任务状态,并拿到结构化的下一步上下文。
「能恢复」有自动化测试证据;「LLM 一定把活干完」仍需 harness 级评测。

License: MIT Python 3.9+ CI GitHub

Repo https://github.com/sutongwuyanzu/TaskHandoff
Skill name task-handoff
CLI handoffpip install -e . 后)
MCP handoff-mcp(纯 stdlib,无额外依赖)见 references/mcp.md
DSH Skill + CLI + MCP 同一 .handoff/ 契约(见 references/deepseek-notes.md

TaskHandoff terminal demo

initsave --autorecall --briefdoctor
怎么录 / 怎么重渲:examples/how-to-record-gif.md

Continuity evidence(跨会话可恢复)

命令 角色
pytest tests/test_continuity.py -q 完整 CI 证据(hooks 闭环、save --auto、brief→完成 next#1 toy、强断言)
python scripts/continuity_proof.py 约 15 秒 smoke demo(显式 save → recall only;不覆盖 hooks/--auto/toy)
# Full evidence (what CI runs via pytest -q):
pytest tests/test_continuity.py -q

# Quick human-readable smoke (not a substitute for the suite):
python scripts/continuity_proof.py

The suite proves disk-level continuity across independent processes.
LLM execution quality still requires harness-level evaluation.
Details: examples/continuity-proof.md


30 秒心智模型

会话 A 干到一半  →  handoff save [--auto]  →  写入 .handoff/
新开会话 / 换模型 →  handoff recall --brief →  恢复 goal + next 1..3
                         (Agent 可据此继续;执行成败取决于模型/harness)
文件 作用
.handoff/MEMORY.md 长期记忆(偏好、架构、坑)
.handoff/handoffs/LATEST.md 上一会话状态 + 下一步 3 条
.handoff/todos.json / decisions.jsonl 结构化待办与决策日志

安装(推荐最低完整版)

需要 Python 3.9+零第三方运行时依赖

git clone https://github.com/sutongwuyanzu/TaskHandoff.git
cd TaskHandoff
pip install -e .

# 验证
handoff --version
# 或
python -m taskhandoff --version

MCP(stdio,零额外依赖)

pip install -e .
handoff-mcp
# 或
python -m taskhandoff.mcp_server

把 stdio server 配进 Claude Desktop / Cursor 等(示例:examples/mcp-config.sample.json,说明:references/mcp.md)。

不装包也可以用 CLI:

python scripts/handoff_cli.py init --root /path/to/project

装成 Agent Skill

# 一键脚本(推荐)— 在仓库根目录执行
# Windows PowerShell:
powershell -ExecutionPolicy Bypass -File scripts/install-skill.ps1

# macOS / Linux:
bash scripts/install-skill.sh

# 或手动
cp -r TaskHandoff ~/.claude/skills/task-handoff

装好后对 Agent 说:交接 / 接着做 / handoff。
SKILL.md 是剧本;handoff CLI / MCP 是执行层。


快速演示:init → save → recall

在任意项目里:

cd /path/to/your-app

# 1) 初始化(每个仓库一次)
handoff init --root .

# 2) 会话结束前交接(推荐 --auto:自动带上 git 变更/最近 commit)
handoff save --root . --auto \
  --goal "Ship JWT auth" \
  --done "Middleware scaffolded" \
  --decision "Refresh token in httpOnly cookie" \
  --next "Finish refresh endpoint" \
  --next "Add 401/403 tests" \
  --next "Document env vars" \
  --memory-delta "Auth: access token memory-only; refresh httpOnly cookie"

# 3) 新会话只读 brief(短、稳、给 Agent 直接开干)
handoff recall --root . --brief

# 4) 需要全文时
handoff recall --root . --budget 2500

# 5) 健康检查(含密钥扫描)
handoff doctor --root .
handoff status --root .

自然语言(Agent 读 SKILL.md

你说 Agent 应做
交接 / handoff handoff save(能加 --auto 就加)
接着做 / continue / resume handoff recall --brief → 执行 Next #1
记住我们用 pnpm handoff memory --append "..."
handoff 状态 handoff status / doctor

示例交接包

完整样例见 examples/filled-LATEST.md

recall --brief 输出形态:

# Resume brief (TaskHandoff)
- project: `your-app`
- goal: Ship JWT auth
- next:
  1. Finish refresh endpoint
  2. Add 401/403 tests
  3. Document env vars
- instruction: Execute next action #1 now. ...

安全

  • 默认拒绝把疑似密钥写进 handoff(GitHub PAT、JWT、私钥块、常见 api_key= 等)
  • 误报时才用:handoff save ... --allow-secrets(不推荐)
  • handoff doctor 会扫描已有 LATEST.md

目录结构

TaskHandoff/
  SKILL.md                 # Agent skill 剧本
  taskhandoff/             # 可安装 Python 包(CLI)
  scripts/handoff_cli.py   # 兼容入口
  templates/               # MEMORY / handoff 模板
  references/              # schema + DSH 接入说明
  examples/                # 示例流程与 filled handoff
  tests/                   # pytest 契约测试
  APPLY.md                 # DSH 内测报名文案
  pyproject.toml

项目内生成:

your-app/.handoff/
  config.json
  MEMORY.md
  todos.json
  decisions.jsonl
  handoffs/LATEST.md
  handoffs/LATEST.json

契约说明:references/schema.md


DeepSeek Harness (DSH)

  • 类型:Skill + CLI + MCP(同一 .handoff/ 契约)
  • 无私有二进制格式:纯 Markdown + JSON
  • Token 预算:recall --budget / --brief
  • 发布日接入计划:references/deepseek-notes.md

报名文案:APPLY.md


更多示例

开发与测试

pip install -e ".[dev]"
pytest -q
handoff info --root .

CI:GitHub Actions 在 main 上跑 Python 3.9 / 3.12。


设计原则

  1. Portable — 状态在仓库里,不绑云
  2. Token-thrifty — 固定章节 + brief
  3. Harness-agnostic — Claude Code / Codex / 未来 DSH
  4. Safe by default — 密钥扫描

Roadmap

  • [x] 可安装 CLI(handoff
  • [x] save --auto(git + 上次 handoff)
  • [x] recall --brief 固定复述
  • [x] 密钥拒绝写入 + doctor
  • [x] pytest 契约测试
  • [x] 纯 stdlib MCP server(同一 .handoff/ 契约)
  • [x] GitHub Actions CI + skill 安装脚本 + 仓库 dogfood
  • [x] 会话 hook 样例(Claude Code / generic / DSH 映射)
  • [x] README 终端 GIF(assets/terminal-demo.gif + 可重渲脚本)

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选