@rakkunn/vicem 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: vicem
3
+ description: Zero-dependency AI Agent Context Baton & Diet Suite. Use this skill when handing off coding tasks between AI agents (Claude Code, OpenAI Codex, Antigravity IDE, Cursor, VS Code, Gemini CLI, Web AI), compacting bloated sessions (Context Rot Rescue), or rehydrating skeletonized functions from .vicem/ledger.json.
4
+ ---
5
+
6
+ # Vicem (`vicem.mjs`) — Universal Agent Baton & Diet Skill
7
+
8
+ Vicem packages the active project state, git diff, task progress, and compressed code skeletons into a bookended U-Shaped Attention Baton (`.vicem/BATON.md`), redacts secrets (`‹REDACTED:PROVIDER:HASH4›`), and hands off or compacts sessions in a single command.
9
+
10
+ ## 1. Receiving a Baton (Mandatory Rules for Target Agents)
11
+
12
+ 1. **Read `.vicem/BATON.md` First:**
13
+ - **Zone 1 (Top Primacy Zone):** Read `## 1. Goal` and `## 2. Immediate NEXT` first.
14
+ - **Zone 2 (Middle Evidence Zone):** Review `## 3. Done`, `## 4. Work Evidence (Git Diff & Slimmed Logs)`, and `## 5. Architectural Context (Code Skeletons)`.
15
+ - **Zone 3 (Bottom Recency Anchor):** Begin immediately from **Immediate NEXT #1**.
16
+ 2. **NEVER Write Skeleton Placeholders to Disk (`SkeletonWriteGuard`):**
17
+ - Functions `>= 12` lines in Section 5 have their bodies replaced with `/* ... */` or `pass` to save tokens.
18
+ - **Strictly Forbidden:** Never write `{ ... }`, `/* ... */`, `⋮`, or `‹REDACTED:...›` tokens into real source files.
19
+ - **How to Rehydrate:** Call MCP tool `vicem_rehydrate(file_path, symbol_name)` (or read the original file directly) before modifying a skeletonized function.
20
+
21
+ ## 2. Daily Zero-Flag Commands
22
+
23
+ ```bash
24
+ # Auto-detect active session and pass baton to recommended target
25
+ node vicem.mjs
26
+
27
+ # Hand off to a specific CLI, IDE, or Web AI target
28
+ node vicem.mjs codex
29
+ node vicem.mjs claude
30
+ node vicem.mjs ide
31
+ node vicem.mjs web
32
+
33
+ # Compact current bloated session (Context Rot Rescue)
34
+ node vicem.mjs self
35
+
36
+ # Return baton to previous agent & auto-unmount temporary rule files
37
+ node vicem.mjs back
38
+
39
+ # Restore pre-handoff file snapshot or roll back session
40
+ node vicem.mjs rollback
41
+
42
+ # Install idempotent Git pre-commit safety guard hook
43
+ node vicem.mjs init
44
+
45
+ # Run <50ms zero-spawn environment & agent storage diagnostics
46
+ node vicem.mjs doctor
47
+
48
+ # Apply Web AI clipboard reply safely (2-Phase Guard + SmartPatchApplier)
49
+ node vicem.mjs land
50
+ ```
51
+
52
+ ## 3. MCP Tools Provided (`node vicem.mjs mcp`)
53
+
54
+ - `vicem_create_baton`: Build `.vicem/BATON.md` with 4-stage Context Diet and 3-tier Secret Redaction.
55
+ - `vicem_read_baton`: Read `.vicem/BATON.md` and check `StalenessDriftGuard` (`git HEAD` drift).
56
+ - `vicem_rehydrate(file_path, symbol_name)`: Retrieve omitted raw function/method bodies from `.vicem/ledger.json`.
57
+ - `vicem_check_guard`: Verify diffs against `SkeletonWriteGuard` and `SecretCommitGuard`.
@@ -0,0 +1,7 @@
1
+ <!-- VICEM-AGENTS-SNIPPET -->
2
+ ## Vicem Baton & Context Diet Protocol
3
+
4
+ - If `.vicem/BATON.md` exists in the workspace, read it before starting work and execute **Section 2 (`Immediate NEXT #1`)**.
5
+ - **Safety Rule (`SkeletonWriteGuard`):** Code blocks in `.vicem/BATON.md` may contain skeletonized function bodies (`/* ... */` or `pass`) and redacted secrets (`‹REDACTED:PROVIDER:HASH4›`). **Never** write these placeholders into real source files.
6
+ - If you need the full implementation of a skeletonized function, call the MCP tool `vicem_rehydrate(file_path, symbol_name)` or read the source file directly before editing.
7
+ - Before finishing or handing back work, run `node vicem.mjs guard` to verify zero placeholder or redaction token leaks.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rakkunn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, following the conditions below:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,186 @@
1
- # Temporary Holding Version
1
+ <p align="left">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="./logo-dark-transparent.png" />
4
+ <source media="(prefers-color-scheme: light)" srcset="./logo-light-transparent.png" />
5
+ <img src="./logo.png" width="88" height="88" alt="Vicem Logo" />
6
+ </picture>
7
+ </p>
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # Vicem — Diet the Context, Pass the Baton
10
+
11
+ <p align="left">
12
+ <a href="https://glama.ai/mcp/servers/RAKKUNN/vicem"><img src="https://glama.ai/mcp/servers/RAKKUNN/vicem/badges/score.svg" alt="Vicem MCP server rated A on Glama" /></a>
13
+ <a href="https://github.com/RAKKUNN/vicem/releases/tag/v1.1.0"><img src="https://img.shields.io/badge/release-v1.1.0%20(Desktop%20GUI)-10B981" alt="Release v1.1.0" /></a>
14
+ <img src="https://img.shields.io/badge/dependencies-0-3B82F6" alt="Zero Dependencies" />
15
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-F59E0B" alt="MIT License" /></a>
16
+ </p>
17
+
18
+ > **Hit Claude's 5-hour quota limit mid-refactor? Or watching your AI agent lose its mind after 150k tokens of context rot?**
19
+ >
20
+ > **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 `0` third-party dependencies.**
21
+
22
+ <p align="left">
23
+ <a href="https://rakkunn.github.io/vicem/"><strong>Launch Zero-Install Browser Studio (GitHub Pages)</strong></a> ·
24
+ <a href="https://github.com/Rakkunn/vicem"><strong>GitHub Repository</strong></a> ·
25
+ <a href="./SECURITY.md"><strong>Security &amp; Minimal TCB</strong></a>
26
+ </p>
27
+
28
+ <p align="center">
29
+ <picture>
30
+ <source media="(prefers-color-scheme: dark)" srcset="./gui-dark.png" />
31
+ <source media="(prefers-color-scheme: light)" srcset="./gui-light.png" />
32
+ <img src="./gui-dark.png" width="100%" alt="Vicem Unified Desktop Utility GUI (Dark & Light Mode)" />
33
+ </picture>
34
+ </p>
35
+
36
+ ![Vicem 3-Second Context Baton & Diet Demo](./demo.gif)
37
+
38
+ ```text
39
+ $ vicem codex
40
+
41
+ ╭─ VICEM CONTEXT BATON & DIET RECEIPT ──────────────────────────────────╮
42
+ │ Source Session : Claude Code (sess-9f3a2c · 42 turns harvested) │
43
+ │ Context Diet : 184,200 tok ($2.76) ──► 14,800 tok ($0.22) [-91.9%] │
44
+ │ Code Skeletons : 18 files compressed (31 bodies indexed in ledger) │
45
+ │ Security Guard : 2 secrets redacted (OPENAI_KEY, AWS_ACCESS_KEY) │
46
+ │ Relay Target : OpenAI Codex CLI (interactive TTY handoff ready) │
47
+ ╰───────────────────────────────────────────────────────────────────────╯
48
+ [OK] [Vicem] Baton written to .vicem/BATON.md (182ms). Launching codex...
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Measured Pipeline Contribution (Before vs. After Vicem)
54
+
55
+ | Pipeline Stage | Raw Session State (Before Vicem) | After Vicem Baton & Diet | Measured Contribution |
56
+ | :--- | :--- | :--- | :--- |
57
+ | **1. Session Continuity Relay** | 40+ turns of raw JSONL / SQLite history locked inside a single agent | Harvests active `Goal`, `Done`, `Immediate NEXT` & `git diff` into `.vicem/BATON.md` | **< 3s handoff** across 15+ CLI, IDE & Web AI agents |
58
+ | **2. Code Skeletonization** | Full source files with long implementation bodies (`~120,000 tok`) | Types & signatures 100% intact; bodies `>= 12` lines indexed in `.vicem/ledger.json` | **-80% to -90% code tokens** (100% lossless via MCP `vicem_rehydrate`) |
59
+ | **3. Test & Error Log Slimming** | Verbose ANSI spinners & `node_modules` stack frames (`~45,000 tok`) | Root failure message + top 5 project stack frames (`~1,200 tok`) | **-95% log noise** while preserving exact failure root cause |
60
+ | **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 |
61
+ | **5. Security & Write Integrity** | Plaintext credentials in logs & risk of placeholder overwrites | 3-Tier local secret redaction + `SkeletonWriteGuard` & `SecretCommitGuard` | **0 leaked secrets** & **0 external packages (`dependencies: 0`)** |
62
+
63
+ ---
64
+
65
+ ## 1-Click Setup (macOS, Windows, Linux — Zero Terminal Config Needed)
66
+
67
+ ### Option A: Double-Click Installer (Recommended)
68
+ ```bash
69
+ git clone https://github.com/Rakkunn/vicem.git && cd vicem
70
+ ```
71
+ 1. **macOS / Linux:** Double-click **`setup.command`** (or run `./vicem.mjs setup`).
72
+ 2. **Windows:** Double-click **`setup.bat`**.
73
+ 3. **Browser-Only (Air-Gapped / No Node.js):** Open **[https://rakkunn.github.io/vicem/](https://rakkunn.github.io/vicem/)** or double-click **`index.html`** locally in Chrome, Edge, Brave, or Safari (`connect-src 'none'`).
74
+
75
+ 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.
76
+
77
+ ### Option B: Interactive Desktop Utility GUI & Direct CLI Usage
78
+ Vicem consists of **standalone files** (`vicem.mjs`, `vicem-gui.mjs`, `index.html`, `.agents/skills/vicem/SKILL.md`) built entirely on Node.js standard library modules:
79
+
80
+ ```bash
81
+ # 1. Launch the interactive Desktop Utility GUI (12 platforms, live quota telemetry, 1-click handoff)
82
+ vicem gui
83
+
84
+ # 2. One-click auto-setup (PATH + MCP registration + Git pre-commit guard)
85
+ ./vicem.mjs setup
86
+
87
+ # 3. Auto-detect active session and pass baton to recommended target
88
+ vicem
89
+
90
+ # 4. Pass baton to a specific CLI, IDE, or Web AI target (12 platforms across macOS / Windows / Linux)
91
+ vicem codex
92
+ vicem claude
93
+ vicem gemini
94
+ vicem cursor
95
+ vicem windsurf
96
+ vicem vscode
97
+ vicem cline
98
+ vicem opencode
99
+ vicem aider
100
+ vicem goose
101
+ vicem ide
102
+ vicem web
103
+
104
+ # 5. Compact current bloated session in-place (Context Rot Rescue)
105
+ vicem self
106
+
107
+ # 6. Return baton to previous agent & auto-unmount temporary rules
108
+ vicem back
109
+
110
+ # 7. Restore pre-handoff file snapshot or roll back session
111
+ vicem rollback
112
+
113
+ # 8. Open Hydrated Zero-Network Web Studio (.vicem/studio.live.html)
114
+ vicem studio
115
+
116
+ # 9. Extract & smart-patch code blocks from Web AI clipboard reply
117
+ vicem land
118
+
119
+ # 10. Run <50ms zero-spawn environment & agent storage diagnostics
120
+ vicem doctor
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Architecture & Core Capabilities
126
+
127
+ 1. **Zero-Config 1-Command Relay (`vicem codex`, `vicem claude`, `vicem ide`, `vicem web`):**
128
+ - Auto-detects the active source session strictly scoped to the current project directory (`cwd`), preventing cross-project session bleed.
129
+ - Length-adaptive fuzzy target matching (`vicem codexx` → `codex`, `vicem claud` → `claude`).
130
+ - Interactive CLI handoff preserves full TTY keyboard control (`stdio: 'inherit'`).
131
+ 2. **4-Stage Context Diet Engine (`-75%` to `-90%` Token Reduction):**
132
+ - **Stage 1 (Noise Gate):** Drops lockfiles, build artifacts, binaries, and minified bundles.
133
+ - **Stage 2 (Code Skeletonizer):** Preserves `interface`, `type`, `enum`, and class/method signatures 100% intact while replacing function bodies `>= 12` lines with `/* ... */` or `pass` (indexing full bodies in `.vicem/ledger.json` for on-demand MCP rehydration).
134
+ - **Stage 3 (Log Slimmer):** Strips ANSI codes, carriage-return spinners, and `node_modules`/`site-packages` frames while preserving the root error and 5 user stack frames.
135
+ - **Stage 4 (Data Sampler):** Compresses large JSON/CSV/SQL files into compact schemas + 2 sample rows.
136
+ 3. **Bookended U-Shaped Attention Baton IA (`.vicem/BATON.md`):**
137
+ - **Zone 1 (Top Primacy 15%):** `# BATON` header, `## 1. Goal`, and `## 2. Immediate NEXT`.
138
+ - **Zone 2 (Middle Evidence 75%):** `## 3. Done`, `## 4. Work Evidence (Git Diff & Slimmed Logs)`, `## 5. Architectural Context (Code Skeletons)`, and `## 6. Diet Ledger`.
139
+ - **Zone 3 (Bottom Recency 10%):** `EXECUTION ANCHOR` preventing placeholder writes and anchoring immediate execution.
140
+ 4. **3-Tier Secret Redactor & 3-Pillar Safety Guards:**
141
+ - Redacts AWS, GitHub, OpenAI, Anthropic, Google, Slack, Stripe, JWT, PEM private keys, and high-entropy assignments into `‹REDACTED:PROVIDER:HASH4›`.
142
+ - **Pre-Handoff Lossless Snapshot (`.vicem/snapshots/<batonId>/`):** Protects dirty working-tree files without ever running destructive `git checkout --`.
143
+ - **`SkeletonWriteGuard` & `SecretCommitGuard`:** Blocks agents from writing `{ ... }`, `/* ... */`, `‹REDACTED:...›`, or `<!-- VICEM-BATON-START -->` markers into source files.
144
+
145
+ ---
146
+
147
+ ## Manual MCP Server Registration (Optional)
148
+
149
+ 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`:
150
+
151
+ ```bash
152
+ # Claude Code
153
+ claude mcp add vicem -- node /absolute/path/to/vicem.mjs mcp
154
+
155
+ # OpenAI Codex CLI
156
+ codex mcp add vicem -- node /absolute/path/to/vicem.mjs mcp
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Supply-Chain Verification & Minimal TCB
162
+
163
+ Verify zero third-party dependencies and cryptographic artifact integrity in one command:
164
+
165
+ ```bash
166
+ # 1. Confirm zero npm dependencies
167
+ node -e "console.log(JSON.parse(fs.readFileSync('package.json')).dependencies ?? '0 dependencies')"
168
+
169
+ # 2. Verify SHA-256 checksums of all core artifacts
170
+ shasum -a 256 -c SHA256SUMS
171
+
172
+ # 3. Run under strict Node.js Permission Model sandbox
173
+ node --permission \
174
+ --allow-fs-read=. \
175
+ --allow-fs-write=.vicem \
176
+ --allow-child-process \
177
+ vicem.mjs diet
178
+ ```
179
+
180
+ ---
181
+
182
+ ## Automated Test Suite
183
+
184
+ ```bash
185
+ node --test test/*.test.mjs
186
+ ```
package/SECURITY.md ADDED
@@ -0,0 +1,35 @@
1
+ # Security Policy & Zero-Trust Verification (`SECURITY.md`)
2
+
3
+ ## 1. Zero-Dependency & Zero-Network Guarantee
4
+
5
+ - **Zero External Dependencies (`C-10`):** `vicem.mjs` uses **only** Node.js built-in modules (`node:fs`, `node:path`, `node:os`, `node:crypto`, `node:child_process`, `node:readline`, `node:util`, `node:url`, `node:sqlite`). There is no `package.json` dependency tree and zero supply-chain risk from third-party npm packages.
6
+ - **Zero Network Calls (`C-11`):**
7
+ - `vicem.mjs` never imports `node:http`, `node:https`, `node:net`, `node:tls`, or `node:dgram`, and never calls `fetch()`.
8
+ - `index.html` enforces `<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline';">`, making outbound network connections impossible at the browser engine level.
9
+
10
+ ## 2. Credential Blindness (`C-06`)
11
+
12
+ Vicem enforces a hardcoded blacklist (`CREDENTIAL_BLACKLIST_PATTERNS`) and never opens or harvests:
13
+ - `.env`, `.env.*`
14
+ - `auth.json`, `credentials.json`, `.credentials.json`
15
+ - `id_rsa`, `id_ed25519`, `*.pem`, `*.key`, `*.p12`, `*.pfx`
16
+ - `.npmrc`, `.pypirc`, `.netrc`, `kubeconfig`
17
+
18
+ ## 3. 3-Tier Secret Redaction & No-Unredaction Policy (`UC-15`)
19
+
20
+ All harvested text, git diffs, logs, `.vicem/BATON.md`, and `.vicem/ledger.json` entries pass through `SecretRedactor.redact()`:
21
+ 1. **Provider Regex Rules:** AWS (`AKIA`/`ASIA`), GitHub (`ghp_`/`github_pat_`), Anthropic (`sk-ant-`), OpenAI (`sk-`/`sk-proj-`), Google (`AIza`), Slack (`xox*`), Stripe (`sk_live_`), JWT, and PEM Private Keys.
22
+ 2. **Shannon Entropy Detector:** High-entropy (`H >= 4.2` bits/char) secret assignments are masked while whitelisting UUIDs, Git SHAs, file paths, and CSS classes.
23
+ 3. **No-Unredaction Rule:** Even when an agent calls `vicem_rehydrate(file_path, symbol_name)` via MCP, secrets remain redacted as `‹REDACTED:PROVIDER:HASH4›`.
24
+
25
+ ## 4. Node.js Permission Model Sandbox
26
+
27
+ You can restrict `vicem.mjs` at the OS/V8 level using Node.js `--permission`:
28
+
29
+ ```bash
30
+ node --permission \
31
+ --allow-fs-read=/path/to/repo \
32
+ --allow-fs-write=/path/to/repo/.vicem \
33
+ --allow-child-process \
34
+ vicem.mjs diet
35
+ ```
package/SHA256SUMS ADDED
@@ -0,0 +1,4 @@
1
+ 4e35eed0de4d811c7bfbaf60edf209909822d18a1e07b1e7455c3d0f467a7815 vicem.mjs
2
+ 860cc494a127310766df1668b8e3014f5b8d1609b5ac02a314214e8d39458027 index.html
3
+ ce2cb3163d018ea796bcbecbbd954f7aa0834c8a273cfbd7ba510eb28e22aa84 .agents/skills/vicem/SKILL.md
4
+ 6080f065cb682ed8085859ab76814f1fc61963e32e91ece63cb36dc74b31e8b5 AGENTS.snippet.md