Skip to content

Repository files navigation

Baton

Baton (Chinese: 接力棒) is a small, fast, local-first desktop app for handing coding-agent context from one agent to another.

It never forges or writes another agent's private session database. On handoff, Baton read-only parses the source session, writes a neutral baton.json and HANDOFF.md on disk, then launches a new session in the target agent from your system terminal.

中文说明

Supported agents

Agent Read as source Launch as target
Codex Yes Yes
Claude Code Yes Yes
Pi Yes Yes
OpenCode Yes Yes
Kiro CLI Yes: v2 JSON/JSONL sessions Yes
Cursor Agent Partial: user prompts only Yes

Kiro CLI legacy .history files are input history only. They have no reliable assistant messages or workspace boundary, so they are not used as source sessions. Cursor's full session format is unpublished. Baton does not guess or mutate those private formats, so Cursor handoff packets are marked as possibly missing assistant replies.

Features

  • Fully local: no accounts, cloud services, telemetry, or remote fonts
  • Session lists read indexes or JSONL metadata only; selecting a session does not load the full transcript
  • Transcripts are read and normalized only when you actually hand off
  • System prompts, hidden reasoning, tool-call details, and tool output are excluded by default
  • Best-effort local redaction for common API keys, tokens, Authorization headers, JWTs, URL credentials, and private keys
  • Compact keeps the first task plus the latest 20 context turns; Full keeps all safely readable user/assistant text
  • Handoff directories are 0700 and files are 0600 on Unix
  • Target agents keep their own permission prompts; Baton never adds dangerous permission flags

Stack

  • Tauri 2
  • Rust
  • Preact + TypeScript + Vite
  • npm

Development

You need Node.js, npm, Rust, and Tauri system prerequisites.

npm install
npm run tauri dev

Check and build:

npm run check
npm run build
cd src-tauri && cargo test
npm run tauri build -- --bundles app

On macOS this produces src-tauri/target/release/bundle/macos/接力棒.app. Local builds use ad-hoc signing so you can try the app immediately. Public releases should still be signed and notarized with an Apple Developer ID.

Running the Vite frontend alone shows “cannot connect to the local service”. That is expected: session discovery and handoff live in the Tauri Rust backend.

Local data

Handoff packets live under the app data directory at handoffs/<uuid>/:

handoffs/<uuid>/
├── baton.json
├── HANDOFF.md
└── launch.command

Source-agent files stay read-only. Baton only writes inside its own app data directory. After launch, the target agent creates a new session using its normal behavior.

At most 40 packets are kept. Packets older than 7 days are cleaned up on the next handoff.

Redaction is a guardrail, not a general secret scanner. Packets can still contain project context. Treat them as private local data and do not upload them to public places.

Agent notes

Repository rules live in AGENTS.md. UI changes must follow the locked design constraints in .agents/skills/emil-design-eng/.


中文

接力棒 是一个小型、快速、local-first 的桌面工具,用来把编码 Agent 的会话上下文交给另一个 Agent 继续处理。

它不会伪造或写入任何 Agent 的私有会话数据库。接力时只读解析源会话,在本机生成中立的 baton.jsonHANDOFF.md,然后在系统终端中启动目标 Agent 的新会话。

当前支持

Agent 读取源会话 作为接棒目标
Codex
Claude Code
Pi
OpenCode
Kiro CLI 是:v2 JSON/JSONL 会话
Cursor Agent 部分:安全读取用户提示

Kiro CLI 的 legacy .history 只是输入历史,没有可靠的助手消息和工作区边界,因此不作为源会话。Cursor 的完整会话格式没有公开。接力棒不会猜测或修改这些私有格式,因此来自 Cursor 的接力包会明确标注可能缺少助手回复。

特性

  • 全程本机运行,无账号、云服务、遥测或远程字体
  • 会话列表只读取索引或 JSONL 元数据,选择会话时不加载完整正文
  • 真正交棒时才读取并规范化 transcript
  • 默认排除 system prompt、隐藏 reasoning、工具调用细节和工具输出
  • 对常见 API Key、token、Authorization 头、JWT、URL 凭据和私钥做尽力而为的本地遮罩
  • 精简 模式保留第一条任务和最近 20 条上下文;完整 模式保留可安全读取的全部用户/助手文本
  • 接力包目录权限为 0700,文件权限为 0600(Unix)
  • 目标 Agent 保持自身原有的权限确认策略,不自动加入危险权限参数

开发

需要 Node.js、npm、Rust 和 Tauri 的系统依赖。

npm install
npm run tauri dev

检查与构建:

npm run check
npm run build
cd src-tauri && cargo test
npm run tauri build -- --bundles app

macOS 会生成 src-tauri/target/release/bundle/macos/接力棒.app。本地构建使用 ad-hoc 签名便于直接试用;对外发布时仍应使用 Apple Developer ID 签名并公证。

只运行前端时,页面会显示“无法连接本地服务”,这是预期行为;会话发现和交棒都由 Tauri 的本地 Rust 后端提供。

本机数据

接力包保存在应用数据目录的 handoffs/<uuid>/ 下。源 Agent 的文件始终只读。生成的接力包最多保留 40 份,并在超过 7 天后于下次接力时自动清理。

遮罩是一道防护,不是泛用秘密检测器。接力包仍可能包含项目上下文,请把它当作本机私密数据,不要上传到公开位置。

About

Local-first desktop app for handing coding-agent context from one agent to another

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages