vicem
Relays the coding session and BATON to OpenAI Codex CLI and supports registering the Vicem MCP server with Codex for context handoff and rehydration.
Vicem — Diet the Context, Pass the Baton
Hit Claude's 5-hour quota limit mid-refactor? Or watching your AI agent lose its mind after 150k tokens of context rot?
Hand off your exact coding session, git diff, and compressed code skeletons to Codex, Gemini, Cursor, Antigravity IDE, or Web AI in 3 seconds — with up to 90% fewer tokens and
0third-party dependencies.

$ vicem codex
╭─ VICEM CONTEXT BATON & DIET RECEIPT ──────────────────────────────────╮
│ Source Session : Claude Code (sess-9f3a2c · 42 turns harvested) │
│ Context Diet : 184,200 tok ($2.76) ──► 14,800 tok ($0.22) [-91.9%] │
│ Code Skeletons : 18 files compressed (31 bodies indexed in ledger) │
│ Security Guard : 2 secrets redacted (OPENAI_KEY, AWS_ACCESS_KEY) │
│ Relay Target : OpenAI Codex CLI (interactive TTY handoff ready) │
╰───────────────────────────────────────────────────────────────────────╯
[OK] [Vicem] Baton written to .vicem/BATON.md (182ms). Launching codex...Measured Pipeline Contribution (Before vs. After Vicem)
Pipeline Stage | Raw Session State (Before Vicem) | After Vicem Baton & Diet | Measured Contribution |
1. Session Continuity Relay | 40+ turns of raw JSONL / SQLite history locked inside a single agent | Harvests active | < 3s handoff across 15+ CLI, IDE & Web AI agents |
2. Code Skeletonization | Full source files with long implementation bodies ( | Types & signatures 100% intact; bodies | -80% to -90% code tokens (100% lossless via MCP |
3. Test & Error Log Slimming | Verbose ANSI spinners & | Root failure message + top 5 project stack frames ( | -95% log noise while preserving exact failure root cause |
4. Data Sampling & Noise Gate | Lockfiles, build bundles, and multi-megabyte JSON / CSV / SQL dumps | Artifacts filtered; data files reduced to inferred schema + 2 sample rows | -98% data bloat & zero context window overflow |
5. Security & Write Integrity | Plaintext credentials in logs & risk of placeholder overwrites | 3-Tier local secret redaction + | 0 leaked secrets & 0 external packages ( |
Related MCP server: slimctx-token-optimizer
1-Click Setup (macOS, Windows, Linux — Zero Terminal Config Needed)
Option A: Double-Click Installer (Recommended)
git clone https://github.com/Rakkunn/vicem.git && cd vicemmacOS / Linux: Double-click
setup.command(or run./vicem.mjs setup).Windows: Double-click
setup.bat.Browser-Only (Air-Gapped / No Node.js): Open https://rakkunn.github.io/vicem/ or double-click
index.htmllocally in Chrome, Edge, Brave, or Safari (connect-src 'none').
Wait 2 seconds — Vicem automatically registers the global vicem command, configures MCP servers across your installed agents (Claude Code, Codex, Cursor, Windsurf, Antigravity IDE), and installs the .agents/skills/vicem/SKILL.md skill.
Option B: Direct Zero-Install CLI Usage
Vicem consists of standalone files (vicem.mjs, index.html, .agents/skills/vicem/SKILL.md) built entirely on Node.js standard library modules:
# 1. One-click auto-setup (PATH + MCP registration + Git pre-commit guard)
./vicem.mjs setup
# 2. Auto-detect active session and pass baton to recommended target
vicem
# 3. Pass baton to a specific CLI, IDE, or Web AI target
vicem codex
vicem claude
vicem gemini
vicem ide
vicem web
# 4. Compact current bloated session in-place (Context Rot Rescue)
vicem self
# 5. Return baton to previous agent & auto-unmount temporary rules
vicem back
# 6. Restore pre-handoff file snapshot or roll back session
vicem rollback
# 7. Open Hydrated Zero-Network Web Studio (.vicem/studio.live.html)
vicem studio
# 8. Extract & smart-patch code blocks from Web AI clipboard reply
vicem land
# 9. Run <50ms zero-spawn environment & agent storage diagnostics
vicem doctorArchitecture & Core Capabilities
Zero-Config 1-Command Relay (
vicem codex,vicem claude,vicem ide,vicem web):Auto-detects the active source session strictly scoped to the current project directory (
cwd), preventing cross-project session bleed.Length-adaptive fuzzy target matching (
vicem codexx→codex,vicem claud→claude).Interactive CLI handoff preserves full TTY keyboard control (
stdio: 'inherit').
4-Stage Context Diet Engine (
-75%to-90%Token Reduction):Stage 1 (Noise Gate): Drops lockfiles, build artifacts, binaries, and minified bundles.
Stage 2 (Code Skeletonizer): Preserves
interface,type,enum, and class/method signatures 100% intact while replacing function bodies>= 12lines with/* ... */orpass(indexing full bodies in.vicem/ledger.jsonfor on-demand MCP rehydration).Stage 3 (Log Slimmer): Strips ANSI codes, carriage-return spinners, and
node_modules/site-packagesframes while preserving the root error and 5 user stack frames.Stage 4 (Data Sampler): Compresses large JSON/CSV/SQL files into compact schemas + 2 sample rows.
Bookended U-Shaped Attention Baton IA (
.vicem/BATON.md):Zone 1 (Top Primacy 15%):
# BATONheader,## 1. Goal, and## 2. Immediate NEXT.Zone 2 (Middle Evidence 75%):
## 3. Done,## 4. Work Evidence (Git Diff & Slimmed Logs),## 5. Architectural Context (Code Skeletons), and## 6. Diet Ledger.Zone 3 (Bottom Recency 10%):
EXECUTION ANCHORpreventing placeholder writes and anchoring immediate execution.
3-Tier Secret Redactor & 3-Pillar Safety Guards:
Redacts AWS, GitHub, OpenAI, Anthropic, Google, Slack, Stripe, JWT, PEM private keys, and high-entropy assignments into
‹REDACTED:PROVIDER:HASH4›.Pre-Handoff Lossless Snapshot (
.vicem/snapshots/<batonId>/): Protects dirty working-tree files without ever running destructivegit checkout --.SkeletonWriteGuard&SecretCommitGuard: Blocks agents from writing{ ... },/* ... */,‹REDACTED:...›, or<!-- VICEM-BATON-START -->markers into source files.
Manual MCP Server Registration (Optional)
If you prefer manual registration over ./vicem.mjs setup, register vicem.mjs mcp so agents can call vicem_create_baton, vicem_read_baton, vicem_rehydrate, and vicem_check_guard:
# Claude Code
claude mcp add vicem -- node /absolute/path/to/vicem.mjs mcp
# OpenAI Codex CLI
codex mcp add vicem -- node /absolute/path/to/vicem.mjs mcpSupply-Chain Verification & Minimal TCB
Verify zero third-party dependencies and cryptographic artifact integrity in one command:
# 1. Confirm zero npm dependencies
node -e "console.log(JSON.parse(fs.readFileSync('package.json')).dependencies ?? '0 dependencies')"
# 2. Verify SHA-256 checksums of all core artifacts
shasum -a 256 -c SHA256SUMS
# 3. Run under strict Node.js Permission Model sandbox
node --permission \
--allow-fs-read=. \
--allow-fs-write=.vicem \
--allow-child-process \
vicem.mjs dietAutomated Test Suite
node --test test/*.test.mjsAvailable Tools
4 toolsvicem_check_guardC
Verifies code or git diff against SkeletonWriteGuard, SecretCommitGuard, and StalenessDriftGuard.
| Name | Required | Description | Default |
|---|---|---|---|
| diff_text | No | Optional diff or code text to inspect |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden, yet it never says whether this is a non-mutating inspection, what happens when a guard trips (blocking error vs. findings list), or whether omitting diff_text falls back to the working tree or staged changes. Only the set of checks is disclosed, not the behavior around them.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One front-loaded sentence with no filler. It is efficient, though the terseness borders on under-specification rather than tightness.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
No output schema and no annotations, so the description should explain the result shape (pass/fail, findings per guard) and default input behavior; it does neither. For a verification tool whose whole value is its verdict, that leaves the agent unable to predict what it gets back.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and the single optional parameter is documented in the schema, so the baseline applies. The description does not clarify the important implied semantics of omitting diff_text (what gets inspected by default) even though zero parameters are required.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
A concrete verb ("Verifies") plus resource ("code or git diff") that clearly separates it from the baton read/write/rehydrate siblings. The three guard names are internal jargon that the description never explains, so the agent knows it checks something but not what each guard enforces.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No statement of when to call this, no preconditions (e.g., before committing or writing skeleton files), and no reference to alternatives or when not to use it. The agent must infer the trigger point from the tool name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
vicem_create_batonB
Creates a compressed U-Shaped Context Baton (.vicem/BATON.md) from the current project and git/session state.
| Name | Required | Description | Default |
|---|---|---|---|
| goal | No | Primary engineering goal | |
| targetAgent | No | Target agent identifier (e.g., codex, claude, ide) | |
| budgetTokens | No | Token budget (default: 4000) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden, and it does disclose two useful behavioral facts the schema does not: the tool writes a file to a fixed path (.vicem/BATON.md) and derives content from current project plus git/session state. It omits critical mutation behavior — whether an existing BATON.md is overwritten, whether a backup exists, and what 'compressed' means operationally.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with no filler; the artifact path and derivation source come early. It is efficient, though the brevity contributes to the guidance gaps noted elsewhere rather than being a fault of structure.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-required-parameter file-writing tool with no output schema and no annotations, the description covers what is produced but not what the baton is for downstream (vicem_rehydrate) or what happens on a repeat call. Adequate minimum, with a real gap around idempotency and lifecycle.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, including the 4000-token default for budgetTokens, so the schema already documents all three parameters. The description adds no further semantics about how goal or targetAgent influence the emitted baton, so the baseline 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and artifact: creates a compressed U-Shaped Context Baton written to .vicem/BATON.md from the current project and git/session state. An agent can tell this is the write-side counterpart to vicem_read_baton from the name alone, but the description never explicitly contrasts itself with the read/rehydrate/guard siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no when-to-use guidance, no precondition (e.g., run at end of session, before handing off), and no mention of the alternatives vicem_rehydrate or vicem_read_baton. The agent must infer the handoff workflow entirely from the sibling names.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
vicem_read_batonB
Reads the current .vicem/BATON.md and checks for git HEAD drift.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. 'Reads' correctly signals a non-mutating operation and the drift check is a disclosed behavior beyond the name, but there is no explanation of what drift detection returns, whether drift makes the call fail or merely reports a flag, or what the agent should do with that result.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single tight sentence with the resource first and the drift check second. No filler, nothing redundant.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a zero-param read with no output schema, the definition should say roughly what comes back (baton contents, drift status, or an error on drift) and how it relates to vicem_rehydrate. It says what it touches but not what the caller receives or should do with a drift result.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so there is nothing for the description to clarify; the baseline for a parameterless tool applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('Reads the current .vicem/BATON.md') plus a secondary behavior ('checks for git HEAD drift'), which clearly separates it from vicem_create_baton. It does not distinguish itself from vicem_check_guard or vicem_rehydrate, which sound adjacent.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
There is no statement of when to call this versus vicem_rehydrate or vicem_check_guard, and no prerequisites or sequencing hints. The agent must infer that this is the cheap way to inspect current state before deciding on other actions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
vicem_rehydrateA
Restores the exact, secret-redacted source code of a skeletonized function/class from .vicem/ledger.json so you never write { ... } placeholders.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Relative file path (e.g. src/auth.ts) | |
| symbol_name | Yes | Function, method, or class name (e.g. verifyJwt) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden; it does disclose two meaningful traits: the data source (ledger.json) and that secrets are redacted in the returned code. It does not state what happens when a symbol is missing/not skeletonized, nor any permission or error behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single front-loaded sentence with zero waste; the core action and its justification are stated immediately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter read tool with no output schema and no annotations, the description conveys what comes back (exact redacted source) and where it comes from. Only failure/edge-case behavior is unstated, which is a minor gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so both parameters are already documented with examples. The description adds nothing beyond the schema, so the baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (restores) and resource (secret-redacted source code of a skeletonized function/class) with its source (.vicem/ledger.json). The operation is clearly distinct from the baton/guard siblings, though it does not explicitly name or contrast them.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'so you never write { ... } placeholders' implies the context of use (when a function body has been skeletonized), but there is no explicit when-to-use/when-not guidance or reference to alternatives such as vicem_read_baton.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v1.0.0- First observed
vicem_check_guard - First observed
vicem_create_baton - First observed
vicem_read_baton - First observed
vicem_rehydrate
TDQS
Scored across 4 tools
The four tools have mostly distinct purposes: creating/reading the baton, rehydrating source, and running guard checks. There is minor overlap because vicem_read_baton checks git HEAD drift while vicem_check_guard also verifies staleness drift, but the descriptions clarify the different scopes.
All tools use a consistent vicem_ prefix and mostly follow a verb_noun pattern: create_baton, read_baton, check_guard. vicem_rehydrate is verb-only, which is a minor deviation but still clear and readable.
Four tools are well-scoped for the server's purpose of managing compressed context batons and code skeletons. Each tool earns its place without feeling thin or bloated.
The surface covers the core lifecycle: creating and reading the baton, restoring skeletonized source, and checking guards. Minor gaps exist, such as no explicit delete/clear baton or list ledger entries operation, but agents can likely work around these.
Maintenance
Related MCP Connectors
Compress coding-agent context ~64%. Hosted Neural Keep MCP for Cursor/Claude/Codex.
A paid remote MCP for OpenAI Codex context compressor, built to return verdicts, receipts, usage log
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
51
Related MCP Servers
- AlicenseAqualityAmaintenanceLocal-first MCP server that watches your coding sessions and injects a compact summary at the start of each new session. 85.6% token reduction, SQLite storage, no cloud. Works with Claude Code, Cursor, Cline, and Windsurf.15643 npm9MIT
- AlicenseAqualityCmaintenanceProvides reversible context compression for AI agents, reducing token usage while preserving the ability to retrieve original content, and serves as an MCP server for integration with tools like GitHub Copilot and Claude Code.31Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA task-aware context compression layer for Agent workflows, RAG pipelines, and AI Coding assistants, reducing noisy logs, retrieval chunks, and code context into high-signal LLM inputs via CLI, Python SDK, and MCP.329MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI agents and MCP-compliant clients to dynamically shrink long-horizon context windows, pruning verbose tool outputs, HTML boilerplate, and semantic redundancy by roughly 40-70% without frontier LLM round-trips. Runs deterministically as a zero-dependency Python stdio server, accepting a payload plus optional compression and risk-bound options.7-