跳到正文
DEV Community· Im Woojin·· 3 小時前AI 評分58

Vicem 如何讓我在 Claude Code、Codex 和 Cursor 間切換時免於重述專案脈絡

How I stopped re-explaining my repo when switching between Claude Code, Codex, and Cursor

AI 導讀

Im Woojin 開發 Vicem,這款零依賴 CLI、本機網頁 GUI 及 MCP 伺服器,可把目前的編碼工作脈絡整理成 Context Baton,供另一個 Agent 接手。

正文

If you use multiple AI coding agents daily—say, Claude Code for deep multi-file refactors, OpenAI Codex for tough algorithmic bugs, and Cursor or Gemini CLI for interactive edits—you have probably hit the same wall I kept hitting:

  1. You are 45 minutes into a complex refactor in Claude Code, and you hit the 5-hour usage quota.
  2. Or your current agent gets stuck in a loop trying to fix a failing test, and you want a second opinion from Codex.
  3. You open the next agent in the same repository... and it has zero idea what you were doing, what approaches already failed, or what step comes next.

You end up spending 10 minutes writing a long prompt: "Okay, look at git diff, I was trying to fix the auth middleware, don't touch file X, run test Y next..."

I got tired of manually playing courier between my own local coding agents. So I built Vicem—a zero-dependency CLI, local web GUI, and MCP server that extracts your active coding context into a deterministic Context Baton (.vicem/BATON.md) and mounts it cleanly for the next agent.

GitHub logo RAKKUNN / vicem

Zero-dependency AI agent context baton & diet suite. Hand off sessions between Claude Code, Codex, Gemini, and Cursor with 80% fewer tokens.

Vicem Logo

Vicem — Diet the Context, Pass the Baton

Vicem MCP server rated A on Glama Listed on mcpservers.org npm vicem-cli Release v1.1.5 Zero Dependencies MIT License

Hit Claude Code's 5-hour quota mid-feature? Or watching Cursor / Codex slow to a crawl after 150k tokens of context rot?

Vicem compacts your active coding session by 80–99% (via deterministic AST code skeletonization + lossless MCP on-demand rehydration) and hands off a clean .vicem/BATON.md across Claude Code, Cursor, Codex CLI, Gemini CLI, Windsurf, Antigravity IDE, and Web AI in 3 seconds — with 0 npm dependencies and 0 network calls.

⭐ Tip: Click Star (top-right) to bookmark this repo for the next time your coding agent hits a 5-hour quota limit or context rot.


⚡ 10-Second Quick Start (npx — Zero Install)

1. Run the Local Handoff GUI or Pass a Baton Immediately

# Launch the local Handoff GUI (3-step guided handoff, preview confirmation & manual recovery)
npx -y vicem-cli gui
# Or pack a compressed baton from your

…


What is a "Context Baton"?

Instead of calling an external LLM API to summarize your session (which costs money, adds latency, and often hallucinates file paths), Vicem harvests deterministic state already sitting on your machine in ~50ms:

  • Live Git State: Current branch, modified/untracked files, and a token-budgeted diff summary.
  • Local Agent Session Logs: Your recent task goal and progress harvested from local session transcripts (~/.claude, ~/.codex, ~/.cursor, etc.).
  • Verification & Next Step: A concrete Immediate NEXT instruction so the receiving agent knows what to verify first without repeating finished work.
  • Automatic Secret Redaction: Any API keys (sk-..., ghp_..., AKIA..., AIza..., Slack/Stripe tokens, or high-entropy secrets) are scrubbed locally before a single byte is written to disk or copied to your clipboard.

Here is what the generated .vicem/BATON.md looks like:

<!-- VICEM-BATON-START -->
# BATON: Fix failing token refresh race condition in auth middleware
> Source: Claude Code | Target: Codex | Prepared: 2026-10-30 | Reception: unconfirmed

## 1. Goal
Resolve the concurrent refresh token race condition in `src/auth/middleware.ts` without breaking existing session cookies.

## 2. Immediate NEXT
1. Read this handoff and verify the current diff in `src/auth/middleware.ts`.
2. Fix the failing test in `test/auth-race.test.ts` and run `npm test`.

## 3. Completed and verified
- Isolated the race condition to concurrent calls in `refreshSession()`.
- Added reproduction test in `test/auth-race.test.ts`.
<!-- VICEM-BATON-END -->

Designing for Non-Destructive Safety

The biggest concern developers (myself included) have with tools that touch CLAUDE.md, AGENTS.md, or .cursor/rules/ is: "Will this overwrite my existing project instructions?"

To guarantee that never happens, I designed Vicem's RuleMountAdapter around three strict invariants:

  1. Balanced Marker Mounting: Vicem only inserts or updates content inside <!-- VICEM-BATON-START --> ... <!-- VICEM-BATON-END --> markers. Your custom notes above, below, or even between blocks are preserved byte-for-byte.
  2. Preview Before Delivery: Both the CLI (--preview) and the local web GUI let you inspect and edit the exact .vicem/BATON.md before anything is mounted or launched.
  3. One-Command --undo: Once the target agent has picked up the task, running npx @rakkunn/vicem@latest --undo strips the mounted block cleanly and archives the baton in .vicem/history/.

Vicem Light Mode UI


Bonus: Fighting "Context Rot" with AST Skeletons + MCP Rehydration

Sometimes the problem isn't switching agents—it's that your current session is bloated from reading 2,000-line files over and over.

Vicem includes a deterministic AST Code Skeletonizer (--diet). It collapses unchanged function bodies into compact placeholders (/* [VICEM_BODY:id] */) while keeping all imports, types, and function signatures intact—cutting file token weight by 65–75%.

The original function bodies are stored locally in .vicem/ledger.json. When an agent actually needs to inspect or edit a specific function, it can call Vicem's built-in MCP server (vicem --mcp) using vicem_expand_symbol to rehydrate just that symbol on demand.


Why Zero Dependencies?

If a developer tool is meant to rescue you when you're in the middle of a broken build or a quota limit, the last thing you want is npx downloading 180 transitive npm packages or failing on a native C++ binding.

Vicem is written in pure ES Modules using only Node.js built-ins (node:fs, node:http, node:child_process, node:crypto).

  • dependencies in package.json: 0
  • External network calls / telemetry: 0
  • Startup time: Instant

Try It Out in 10 Seconds

You don't need to install anything globally to test it in a Git repository:

# 1. Open the local 3-step Web GUI (binds strictly to 127.0.0.1)
npx @rakkunn/vicem@latest

# 2. Or hand off directly from the terminal (e.g., to OpenAI Codex or Claude Code)
npx @rakkunn/vicem@latest --to codex --goal "Fix failing auth middleware tests"

# 3. Clean up the mounted rule block once you're done
npx @rakkunn/vicem@latest --undo

Or if you use the Agent Skills ecosystem across Claude Code, Cursor, and Codex:

npx skills add RAKKUNN/vicem -g

Honest Limitations & What I'd Love Feedback On

  • Desktop App Auto-Launch across OSes: Packing .vicem/BATON.md and mounting rule files are 100% deterministic and tested in native CI across macOS, Linux, and Windows (Node 22 & 24). Automatically spawning a new terminal tab or focusing a desktop IDE works smoothly on macOS, while on Windows/Linux GUI environments it is best-effort—so Vicem always provides a Manual Recovery panel with one-click copyable commands and prompts whenever auto-launch isn't available.

If you bounce between Claude Code, Codex, Cursor, or Web AI chats in your daily workflow, I'd love to hear what context you wish carried over automatically. Feedback, edge cases, and issues are very welcome!

GitHub logo RAKKUNN / vicem

Zero-dependency AI agent context baton & diet suite. Hand off sessions between Claude Code, Codex, Gemini, and Cursor with 80% fewer tokens.

來源:DEV Community · dev.to