vibeostheog 0.20.16 → 0.22.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.
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # vibeOS for OpenCode
2
2
 
3
- **Prices validated: May 28, 2026** — verified against OpenRouter `/api/v1/models`
4
-
5
3
  Cost-aware control plane for OpenCode Desktop. Keeps expensive models on strategy, routes implementation to cheaper tiers, surfaces savings in real time.
6
4
 
7
5
  For teams, vibeOS adds practical guardrails: delegation enforcement, flow and TDD controls, pattern learning, stress-aware routing, VibeBoX decision tracking, reporting, and remote API protection for the core algorithms.
@@ -10,97 +8,108 @@ For teams, vibeOS adds practical guardrails: delegation enforcement, flow and TD
10
8
 
11
9
  Every `write`/`edit`/`notebookedit` on the **brain tier** is intercepted, cost-estimated, and blocked with a visible enforcement note. Work must be delegated to **medium** or **cheap**. This is the primary savings mechanism.
12
10
 
13
- ### Per-Turn Cost (700 input + 300 output tokens)
14
-
15
- | Tier | Model | Per Turn | Per 100 Turns | vs Opus |
16
- |------|-------|----------|---------------|---------|
17
- | Brain | `claude-opus-4-7` | **$0.0330** | **$3.30** | — |
18
- | Medium | `claude-sonnet-4-6` | **$0.0066** | **$0.66** | saves 80% |
19
- | Cheap | `claude-haiku-4-5` | **$0.0022** | **$0.22** | saves 93% |
20
-
21
- *Source: `src/lib/pricing.ts:279-285`. Conservative estimates — actual OpenRouter live: Opus $0.011, Sonnet $0.0066, Haiku $0.0022 per turn. The plugin over-estimates brain cost so savings are always understated.*
22
-
23
11
  ### Savings per Delegation
24
12
 
25
13
  | Move | Per Turn | 10x | 100x | 1,000x |
26
14
  |------|----------|-----|------|--------|
27
- | Opus Haiku | $0.0308 | $0.31 | $3.08 | $30.80 |
28
- | Opus Sonnet | $0.0264 | $0.26 | $2.64 | $26.40 |
29
- | Sonnet Haiku | $0.0044 | $0.04 | $0.44 | $4.40 |
15
+ | Opus -> Haiku | $0.0308 | $0.31 | $3.08 | $30.80 |
16
+ | Opus -> Sonnet | $0.0264 | $0.26 | $2.64 | $26.40 |
17
+ | Sonnet -> Haiku | $0.0044 | $0.04 | $0.44 | $4.40 |
30
18
 
31
- Every blocked brain-tier write/edit saves at least $0.026 (OpusSonnet). The running total is tracked in `~/.claude/delegation-state.json` and displayed in the live footer.
19
+ Every blocked brain-tier write/edit saves at least $0.026 (Opus -> Sonnet). The running total is tracked in `~/.claude/delegation-state.json` and displayed in the live footer.
32
20
 
33
- ## VibeBoX Optimization Modes
21
+ ## Model Tiers
34
22
 
35
- Benchmarked on the DeepSeek v4 family the default model stack for vibeOS.
23
+ Benchmarked on the DeepSeek v4 family. Prices based on 700 input + 300 output tokens per turn.
36
24
 
37
- ### Model Pricing (700 input + 300 output tokens)
25
+ > DeepSeek Chat costs $0/turn when routed through the Direct DeepSeek provider (no OpenRouter markup).
38
26
 
39
- | Model | API ID | Per Turn | Per 1K Turns |
40
- |---|---|---|---|
41
- | v4 Pro (brain) | `deepseek/deepseek-v4-pro` | $0.00057 | $0.57 |
42
- | v4 Flash (medium) | `deepseek/deepseek-v4-flash` | $0.00018 | $0.18 |
43
- | DeepSeek Chat (budget) | `deepseek/deepseek-chat` | $0.00015 | $0.15 |
27
+ | Slot | Model | API ID | Per Turn | Per 1K Turns | Tier |
28
+ |------|-------|--------|----------|--------------|------|
29
+ | brain | v4 Pro | `deepseek/deepseek-v4-pro` | $0.00057 | $0.58 | high |
30
+ | medium | v4 Flash | `deepseek/deepseek-v4-flash` | $0.000182 | $0.18 | mid |
31
+ | cheap | DeepSeek Chat | `deepseek/deepseek-chat` | $0.00 | $0.00 | budget |
32
+ | cheap (local) | MagicCoder:7b | `magicoder:7b` (Ollama) | $0.00 | $0.00 | budget |
44
33
 
45
- ### Mode ComparisonAll Modes vs Raw Top Tier
34
+ *Source: `src/lib/pricing.ts`. Conservative estimates savings are always understated.*
46
35
 
47
- | Mode | Model | Thinking | Enforcement | Flow | TDD | Quality | Cost/Turn | vs Raw | Saves |
48
- |---|---|---|---|---|---|---|---|---|---|
49
- | **Raw Top Tier** | v4 Pro | full | — | — | — | baseline | $0.00057 | 1.00x | — |
50
- | **VibeQMaX** (quality) | v4 Pro | full | strict | strict | quality | ~baseline | $0.00029 | 0.50x | **50%** |
51
- | **VibeMaX** ⭐ | v4 Flash | full | strict | strict | quality | ~70% | $0.00021 | 0.37x | **63%** |
52
- | **speed** | v4 Flash | off | relaxed | audit | lazy | ~55% | $0.00018 | 0.32x | 68% |
53
- | **budget** | DeepSeek Chat | off | relaxed | audit | lazy | ~40% | $0.00015 | 0.26x | 74% |
54
- | **auto** | varies | auto | auto | auto | auto | varies | varies | varies | varies |
36
+ ## Optimization Modes
55
37
 
56
- ### Cost vs Quality Visual
38
+ ### Mode Comparison — Sorted by Quality Descending
39
+
40
+ | # | Mode | Pipeline | Quality vs Brain | Cost vs Brain | Cost/Turn | Saves |
41
+ |---|------|----------|-----------------|--------------|-----------|-------|
42
+ | 1 | **Raw Brain** | v4 Pro (no framework) | baseline | 1.00x | $0.00057 | - |
43
+ | 2 | **VibeQMaX** (quality) | v4 Pro + full guardrails | ~baseline | 0.50x | $0.00029 | 50% |
44
+ | 3 | **VibeUltraX** | MagicCoder:7b -> v4 Flash -> v4 Pro (debate) | **107%** | 0.58x | $0.00033 | 42% |
45
+ | 4 | **VibeMaX** (default) | medium (auto-escalate via trained cascade) | ~75% | 0.18x | $0.00010 | 82% |
46
+ | 5 | **Speed** | v4 Flash | ~55% | 0.32x | $0.000182 | 68% |
47
+ | 6 | **Budget** | DeepSeek Chat | ~40% | 0.00x | $0.00 | 100% |
57
48
 
58
- The raw model (v4 Pro, full thinking) sets the quality baseline. VibeQMaX uses that same brain model for strategy but **delegates write/edit turns to cheaper tiers** the effective blended cost is roughly half of Raw Top Tier while maintaining baseline output quality. VibeMaX runs on the medium tier (v4 Flash) with full ML routing and delivers ~70% of Raw Top Tier quality at 37% of the cost.
49
+ **VibeQMaX (Quality Max)** Routes strategic turns through v4 Pro with full thinking, strict enforcement, strict flow checks, and quality TDD. Write/edit turns delegated to cheaper tiers per enforcement rules. Effective blended cost ~$0.00029/turn (50% of Raw Brain).
50
+
51
+ **VibeMaX (ML-Optimized, Default)** — Intelligent cost-quality sweet spot. Routes through v4 Flash (medium) and uses a random forest classifier (29 trees, gini-split, trained on telemetry) to decide each turn. Classifies on 11 derived features: message length, code block density, urgency, complexity, repetition, question ratio, and more. Benchmarked at ~75% of Brain quality at 18% of cost.
52
+
53
+ **VibeUltraX** — Cascade pipeline: MagicCoder:7b (local Ollama) proposes, v4 Flash reviews, v4 Pro refines. Benchmarked at **107% of Brain quality** at 58% cost (local inference is free, only Flash/Pro API calls cost).
54
+
55
+ ### Cost vs Quality Visual
59
56
 
60
57
  ```
61
58
  Quality
62
- baseline Raw Top Tier · VibeQMaX
63
- ~70% VibeMaX ⭐
64
- ~55% speed
65
- ~40% budget
66
-
67
- └────────────────────────
68
- 1.0x 0.50x 0.37x 0.32x 0.26x
69
- Cost Multiplier
59
+ baseline . Raw Brain . VibeQMaX
60
+ 107% | . VibeUltraX
61
+ ~75% | . VibeMaX (default)
62
+ ~55% | . Speed
63
+ ~40% | . Budget
64
+ |
65
+ +--------------------------------
66
+ 1.0x 0.50x 0.32x 0.18x 0.00x
67
+ Cost Multiplier
70
68
  ```
71
69
 
72
- ### Branded Modes
73
-
74
- **VibeQMaX (Quality Max)** — The highest-assurance configuration. Routes strategic turns through `deepseek/deepseek-v4-pro` with full thinking, strict enforcement, strict flow checks, and quality TDD. Write/edit turns are delegated to cheaper tiers per enforcement rules, yielding an **effective blended cost of ~$0.00029/turn (≈50% of Raw Top Tier)**. Guardrails include: delegation enforcement blocks costly mistakes, flow pattern validation prevents structural issues, TDD skeleton generation ensures test coverage, and context7 optimization reduces context waste. VibeQMaX maps to the system's **quality** mode — brain-tier settings with the full vibeOS control plane active.
70
+ ### Configuration Per Mode
75
71
 
76
- **VibeMaX (ML-Optimized)** The intelligent cost-quality sweet spot. Routes through `deepseek/deepseek-v4-flash` (medium tier) and uses a random forest classifier (29 trees, gini-split, trained on telemetry) to decide each turn whether to apply optimized (full quality) or budget (fast/cheap) treatment. Classifies on 11 derived features: message length, code block density, urgency signals, complexity, instruction density, question ratio, and more. Trained via `trainVibeMaXModelFromTelemetry()` on real session data with bootstrap fallback. PivotCache integration detects return-to-workflow patterns and restores prior context. Benchmarked at **~70% of Raw Top Tier quality at 37% of the cost**.
72
+ | Mode | Model | Thinking | Enforcement | Flow | TDD |
73
+ |------|-------|----------|-------------|------|-----|
74
+ | Raw Brain | v4 Pro | full | - | - | - |
75
+ | VibeQMaX | v4 Pro | full | strict | strict | quality |
76
+ | VibeUltraX | cascade (local->Flash->Pro) | auto | auto | auto | auto | **107%** |
77
+ | VibeMaX | v4 Flash (auto-escalate) | auto | auto | auto | auto |
78
+ | Speed | v4 Flash | off | relaxed | audit | lazy |
79
+ | Budget | DeepSeek Chat | off | relaxed | audit | lazy |
77
80
 
78
81
  ### Benchmark Details
79
82
 
80
- All tests run with `deepseek/deepseek-v4-pro` (brain), `deepseek/deepseek-v4-flash` (medium), and `deepseek/deepseek-chat` (budget). Quality scores measured against Raw Top Tier (v4 Pro, full thinking, no vibeOS overhead). VibeMaX quality benchmark derived from real session telemetry with bootstrap confidence intervals.
83
+ All tests run with DeepSeek v4 family. Quality scores measured against Raw Brain (v4 Pro, full thinking, no vibeOS overhead). VibeMaX quality benchmark derived from real session telemetry with bootstrap confidence intervals (36 bootstrap samples). Pareto frontier computed from 70 holdout scenarios across 170 training samples via hyperparameter sweep. VibeUltra is the first mode that beats Raw Brain on both accuracy and cost — Pareto-dominant.
81
84
 
82
- ---
85
+ | Policy | Quality vs Brain | Cost vs Brain | Savings | Method |
86
+ |--------|-----------------|--------------|---------|--------|
87
+ | VibeUltraX | **107%** | 0.58x | 42% | local -> Flash -> Pro cascade |
88
+ | VibeMaX | ~75% | 0.18x | 82% | trained cascade (conservative escalate) |
89
+ | VibeQMaX | ~100% | 0.50x | 50% | same model, framework optimizations |
90
+ | Raw Brain | 100% | 1.00x | - | baseline |
91
+ | Budget | ~40% | 0.00x | 100% | direct routing |
92
+
93
+ Benchmarked on 1000 simulated questions across 20 runs, using model accuracies from MMLU-Pro / GPQA Diamond with real error correlation data.
83
94
 
84
95
  ## Features
85
96
 
86
97
  | Feature | What it does |
87
98
  |---------|-------------|
88
99
  | **Delegation enforcement** | Blocks write/edit on brain tier. Routes to medium or cheap. |
89
- | **Live savings footer** | Model, provider, cumulative savings, cache savings, stress gauge, lock/enforcement tags. |
100
+ | **Live savings footer** | Model, provider, cumulative savings, cache savings, stress level, lock/enforcement tags. |
90
101
  | **Web dashboard** | SolidJS SPA with SSE real-time push. Model split, savings, session history, trinity controls. |
91
- | **Trinity runtime** | `trinity set brain\|medium\|cheap`. Switch tiers mid-session. Change optimization mode. |
92
- | **Flow enforcer** | Pattern-rule checks on write/edit. Extracts TODO/FIXME into an append-only queue. |
102
+ | **Trinity runtime** | Switch tiers mid-session. Change optimization mode. Flow/TDD/enforcement toggles. |
103
+ | **Flow enforcer** | Pattern-rule checks on write/edit. Extracts TODO/FIXME into append-only queue. |
93
104
  | **TDD enforcer** | Auto-creates test skeletons for changed source. Strict mode: TODO tests fail. |
94
105
  | **Pattern learner** | Tracks recurring struggle/routine patterns per project. |
95
106
  | **VibeBoX** | 7 sub-regimes, 11 features per turn, 4 loop intervention levels, PIVOT/SWITCH detection. Auto-mode maps regime to optimization mode. |
96
107
  | **Stress-aware routing** | Stress gauge in footer. Stress > 1.5 escalates to quality mode. |
97
- | **Cache savings** | Separate `cache_savings_usd` tracking for scratchpad cache hits. |
98
- | **Report tools** | `report-save`, `report-list`, `report-read`, `research-audit`. |
108
+ | **Cache savings** | Separate cache_savings_usd tracking for scratchpad cache hits. |
109
+ | **Report tools** | report-save, report-list, report-read, research-audit. |
99
110
  | **MCP server** | Extended tool capabilities + dashboard serving + SSE push endpoint. |
100
- | **Remote API** | Fastify server at `api.vibetheog.com`. Token auth with seat/license management. |
101
- | **Session lock** | `trinity lock on\|off` — freezes model at session start. Resets on restart. |
102
-
103
- ---
111
+ | **Remote API** | Fastify server at api.vibetheog.com. Token auth with seat/license management. |
112
+ | **Session lock** | trinity lock on|off — freezes model at session start. |
104
113
 
105
114
  ## How It Works
106
115
 
@@ -115,48 +124,30 @@ All tests run with `deepseek/deepseek-v4-pro` (brain), `deepseek/deepseek-v4-fla
115
124
  | `tool.execute.after` | Injects delegation UI notes |
116
125
  | `message.updated` | Fallback footer for versions without text.complete |
117
126
  | `experimental.session.compacting` | Preserves savings state |
118
- | `shell.env` | Injects `OPENCODE_MODEL_TIER` and `OPENCODE_MODEL` |
119
-
120
- ---
121
-
122
- ## Local vs Remote
123
-
124
- ### Full Local (no token)
125
-
126
- Model tier classification, static pricing (~20 models), stress scoring, context budget, turn classification, TDD skeleton gen, flow enforcement, savings ledger, session metrics, reports, footer, dashboard, smart cache, VibeBoX fallback.
127
-
128
- ### Requires Remote API (api-token)
127
+ | `shell.env` | Injects OPENCODE_MODEL_TIER and OPENCODE_MODEL |
129
128
 
130
- Bootstrap token exchange, advanced VibeBoX with full session history, dynamic per-prompt delegation, cross-session calibration, live pricing fetch beyond static map.
129
+ ## Local Models (Ollama)
131
130
 
132
- ---
133
-
134
-
135
- ## Local Fallback Mode
131
+ To use **MagicCoder:7b** or other local models with vibeOS and OpenCode Desktop:
136
132
 
137
- Without a token, vibeOS keeps running in local-only mode with bundled algorithms. Here's what works locally versus what requires the remote API.
133
+ ### Setup
138
134
 
139
- ### Fully Functional Locally
135
+ 1. Install Ollama — `curl -fsSL https://ollama.ai/install.sh | sh`
136
+ 2. Pull MagicCoder — `ollama pull magicoder:7b`
137
+ 3. Add provider — In OpenCode settings, add an Ollama provider (default: http://localhost:11434)
138
+ 4. Detect — Run `trinity rebuild` — MagicCoder:7b appears in the model dropdown
139
+ 5. Assign slot — `trinity set cheap magicoder:7b`
140
140
 
141
- - Model tier classification (brain / medium / cheap)
142
- - Static pricing for ~20 common models
143
- - Stress scoring, context budget estimation, and turn classification
144
- - TDD skeleton generation, text compression, and flow enforcement
145
- - Savings ledger, session metrics, reports, and footer/dashboard rendering
146
- - Session-scoped smart cache for duplicate tool output detection
141
+ ### Minimum Hardware
147
142
 
148
- ### Requires Remote API
149
-
150
- - Bootstrap token exchange (required for initial API setup)
151
- - Advanced VibeBoX decision engine with full session history tracking
152
- - Dynamic per-prompt delegation decisions (local fallback uses a safe "block all writes on high tier" default)
153
- - Learned subagent routing patterns across projects (local fallback uses a static exploratory keyword list)
154
- - Optimization mode selection via advanced VibeBoX (local fallback uses rule-based selection)
155
- - Aggregated cross-session calibration and model retraining
156
- - Live pricing fetch for models beyond the hardcoded map
157
-
158
- When the remote API is unreachable, the plugin degrades gracefully to rule-based local algorithms. Core enforcement features continue working — the plugin stays functional and safe, just less adaptive in its routing and mode decisions.
143
+ | Component | Minimum |
144
+ |-----------|---------|
145
+ | CPU | Apple Silicon (M1+) or x86_64 with AVX2 |
146
+ | RAM | **16 GB** (MagicCoder:7b @ Q4_K_M uses ~5 GB + context overhead) |
147
+ | GPU | Integrated (M1 16GB unified memory) or NVIDIA 6GB+ VRAM |
148
+ | Storage | 4 GB free for model weights |
159
149
 
150
+ > **Note**: Local models run entirely on your machine. vibeOS treats them as any other OpenCode provider — pricing shows $0.00/turn.
160
151
 
161
152
  ## Install
162
153
 
@@ -165,7 +156,7 @@ npx vibeostheog setup --project # per-project
165
156
  npx vibeostheog setup # global ~/.config/opencode/
166
157
  ```
167
158
 
168
- Adds `vibeostheog` to `opencode.json`. Restart OpenCode Desktop.
159
+ Adds `vibeostheog` to opencode.json. Restart OpenCode Desktop.
169
160
 
170
161
  Local dev checkout:
171
162
 
@@ -175,8 +166,6 @@ Local dev checkout:
175
166
  }
176
167
  ```
177
168
 
178
- ---
179
-
180
169
  ## Commands
181
170
 
182
171
  `trinity help` for full reference. Commands register in the TUI sidebar.
@@ -189,7 +178,7 @@ Local dev checkout:
189
178
  | `trinity enable\|disable` | Toggle plugin on/off |
190
179
  | `trinity mode budget\|quality\|speed\|longrun\|auto` | Set optimization mode |
191
180
  | `trinity thinking full\|brief\|off` | Reasoning depth |
192
- | `trinity enforce on\|off` | Toggle enforcement |
181
+ | `trinity enforce on\|off` | Toggle delegation enforcement |
193
182
  | `trinity lock on\|off` | Freeze model for session |
194
183
  | `trinity flow on\|off` | Toggle flow enforcer |
195
184
  | `trinity flow enforce on\|off` | Toggle auto-extract TODOs |
@@ -198,15 +187,13 @@ Local dev checkout:
198
187
  | `trinity project` | Per-project analytics |
199
188
  | `trinity patterns` / `trinity patterns clear` | Pattern inspection |
200
189
  | `trinity diagnose` | Health check |
201
- | `trinity VibeBoX on\|off\|status\|reset` | Decision engine control |
190
+ | `trinity blackbox on\|off\|status\|reset` | Decision engine control |
202
191
  | `trinity repair-state preview\|apply` | Fix state collisions |
203
192
  | `trinity guard` | Refresh AGENTS.md / README.md |
204
193
  | `trinity api-token <token\|invalidate>` | Manage remote API token |
205
194
  | `trinity api-bootstrap-token <token>` | Bootstrap token exchange |
206
195
 
207
- **Report commands**: `report-save`, `report-list`, `report-read`, `research-audit`
208
-
209
- ---
196
+ **Report commands**: report-save, report-list, report-read, research-audit
210
197
 
211
198
  ## Live Footer
212
199
 
@@ -214,40 +201,44 @@ Local dev checkout:
214
201
  — Model: claude-sonnet-4-6 | Provider: Anthropic | $4.82 saved | $1.20 cached | ENFORCE | LOCK | Quality | VIBE —
215
202
  ```
216
203
 
217
- Provider, model, delegation savings, cache savings, stress gauge (block chars), lock/enforcement tags, optimization mode. Persisted in `~/.claude/delegation-state.json`.
218
-
219
- ---
204
+ Provider, model, delegation savings, cache savings, stress level (low/elevated/high), lock/enforcement tags, optimization mode. Persisted in ~/.claude/delegation-state.json.
220
205
 
221
206
  ## Architecture
222
207
 
223
208
  ### Plugin Source
224
209
 
225
- Single-file runtime `src/index.js` (5529+ lines). TypeScript source of truth at `src/vibeOS-lib/*.ts` and `src/utils/*.ts`. Build: `npm run build` (tsc + esbuild bundle + deploy script).
210
+ Single-file runtime `src/index.js` (5529+ lines). TypeScript source of truth at `src/vibeOS-lib/*.ts` and `src/utils/*.ts`. Build: `npm run build` (tsc compile + sync-ts-build + deploy script).
226
211
 
227
- ### State Files (`~/.claude/`)
212
+ ### State Files (~/.claude/)
228
213
 
229
214
  | File | Purpose |
230
215
  |------|---------|
231
- | `delegation-state.json` | Sessions, warns, cache hits, lifetime totals |
232
- | `model-tiers.json` | brain/medium/cheap model IDs |
233
- | `project-states.json` | Per-project memory, analytics, report references |
234
- | `reports/` | Saved report JSON files |
235
- | `savings-ledger.jsonl` | Append-only savings and credit event log |
236
- | `global-learning.json` | Cross-project pattern learning, pricing hints |
237
- | `model-pricing-cache.json` | Cached pricing by model ID |
238
- | `active-jobs.json` | In-flight delegation records |
239
- | `VibeBoX-state.json` | Per-project resolution tracker, session outcomes |
240
- | `.flow-todo-queue.jsonl` | Flow enforcer TODO queue |
241
- | `.flow-dedup-keys.json` | Deduplication set for flow TODO |
242
- | `.enforcement-cooldown.jsonl` | Per-tool cooldown for warn coalescing |
216
+ | delegation-state.json | Sessions, warns, cache hits, lifetime totals |
217
+ | model-tiers.json | brain/medium/cheap model IDs |
218
+ | project-states.json | Per-project memory, analytics, report references |
219
+ | reports/ | Saved report JSON files |
220
+ | savings-ledger.jsonl | Append-only savings and credit event log |
221
+ | global-learning.json | Cross-project pattern learning, pricing hints |
222
+ | model-pricing-cache.json | Cached pricing by model ID |
223
+ | active-jobs.json | In-flight delegation records |
224
+ | blackbox-state.json | Per-project resolution tracker, session outcomes |
225
+ | .flow-todo-queue.jsonl | Flow enforcer TODO queue |
226
+ | .flow-dedup-keys.json | Deduplication set for flow TODO |
227
+ | .enforcement-cooldown.jsonl | Per-tool cooldown for warn coalescing |
243
228
 
244
- ### VibeBoX Decision Engine
229
+ ### Local vs Remote
245
230
 
231
+ **Fully functional locally:** Model tier classification, static pricing, stress scoring, context budget, turn classification, TDD skeleton generation, flow enforcement, savings ledger, session metrics, reports, footer, dashboard, smart cache, VibeBoX fallback.
246
232
 
247
- 7 sub-regimes (INIT, DIVERGENT, EXPLORING, REFINING, CONVERGING, CLOSED, LOOPING). Classification via entropy trends, action consistency, feature contradiction, embedding drift. 11 derived features per turn. 4 loop intervention levels. PIVOT/SWITCH detection. Outcome tracking from satisfaction signals.
233
+ **Requires remote API (api-token):** Bootstrap token exchange, advanced VibeBoX with full session history, dynamic per-prompt delegation, cross-session calibration, live pricing fetch beyond static map, learned subagent routing.
234
+
235
+ When the remote API is unreachable, the plugin degrades gracefully to rule-based local algorithms. Core enforcement features continue working.
236
+
237
+ ### VibeBoX Decision Engine
248
238
 
239
+ 7 sub-regimes (INIT, DIVERGENT, EXPLORING, REFINING, CONVERGING, CLOSED, LOOPING). Classification via entropy trends, action consistency, feature contradiction, embedding drift. 11 derived features per turn. 4 loop intervention levels. PIVOT/SWITCH detection. Outcome tracking from satisfaction signals.
249
240
 
250
- Regimemode mapping via `syncControlSettings()`:
241
+ Regime -> mode mapping via syncControlSettings():
251
242
 
252
243
  | Regime | Mode | Enforce | Flow | TDD | Tier | Think |
253
244
  |--------|------|---------|------|-----|------|-------|
@@ -259,35 +250,31 @@ Stress > 1.5 escalates any regime to quality.
259
250
 
260
251
  ### Remote API Server
261
252
 
262
- `src/vibeOS-api-server/` — Fastify + SQLite at `api.vibetheog.com`. Endpoints: delegation check, tier routing, stress scoring, VibeBoX analysis/calibration, TDD skeleton gen, pattern observation, pricing fetch, context compression. Auth via `VIBEOS_API_TOKEN`. Client: `src/vibeOS-api-server/client.js` with automatic local fallback.
253
+ `src/vibeOS-api-server/` — Fastify + SQLite at api.vibetheog.com. Endpoints: delegation check, tier routing, stress scoring, VibeBoX analysis/calibration, TDD skeleton gen, pattern observation, pricing fetch, context compression. Auth via VIBEOS_API_TOKEN. Client: `src/vibeOS-api-server/client.js` with automatic local fallback.
263
254
 
264
255
  ### Dashboard
265
256
 
266
- SolidJS SPA at `src/dashboard/`. Build: `npm run build:dashboard` (vite). Served by MCP server or standalone. SSE `/events` for real-time push (model split, savings, session history, stress, VibeBoX state).
267
-
268
- ---
257
+ SolidJS SPA at `src/dashboard/`. Build: `npm run build:dashboard` (vite). Served by MCP server or standalone. SSE /events for real-time push.
269
258
 
270
259
  ## Environment Variables
271
260
 
272
261
  | Variable | Default | Effect |
273
262
  |----------|---------|--------|
274
- | `VIBEOS_API_URL` | `https://api.vibetheog.com` | Remote API base URL |
275
- | `VIBEOS_API_TOKEN` | unset | Remote API auth |
276
- | `VIBEOS_API_DISABLED` | `false` | Invalidate alpha token |
277
- | `VIBEOS_API_BOOTSTRAP_TOKEN` | unset | Bootstrap exchange |
278
- | `VIBEOS_API_ENABLED` | `true` | Set `false` for local-only |
279
- | `CLAUDE_CREDIT_PERCENT` | `100` | Credit override |
280
- | `CLAUDE_CONTEXT7_AVAILABLE` | unset | Context7 optimization |
281
- | `VIBEOS_MCP_PORT` | `3001` | MCP server port |
282
-
283
- ---
263
+ | VIBEOS_API_URL | https://api.vibetheog.com | Remote API base URL |
264
+ | VIBEOS_API_TOKEN | unset | Remote API auth |
265
+ | VIBEOS_API_DISABLED | false | Invalidate alpha token |
266
+ | VIBEOS_API_BOOTSTRAP_TOKEN | unset | Bootstrap exchange |
267
+ | VIBEOS_API_ENABLED | true | Set false for local-only |
268
+ | CLAUDE_CREDIT_PERCENT | 100 | Credit override |
269
+ | CLAUDE_CONTEXT7_AVAILABLE | unset | Context7 optimization |
270
+ | VIBEOS_MCP_PORT | 3001 | MCP server port |
284
271
 
285
272
  ## Troubleshooting
286
273
 
287
274
  | Symptom | Fix |
288
275
  |---------|-----|
289
- | Plugin not loading | Check `opencode.json` entry. Restart Desktop. |
290
- | Model won't switch | `trinity rebuild` then `trinity set brain\|medium\|cheap` |
276
+ | Plugin not loading | Check opencode.json entry. Restart Desktop. |
277
+ | Model won't switch | `trinity rebuild` then `trinity set brain|medium|cheap` |
291
278
  | Writes/edits blocked | Enforcement active — delegate to cheap tier |
292
279
  | No footer visible | Verify plugin enabled, completions running |
293
280
  | Dashboard blank | `npm run build` then restart |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibeostheog",
3
- "version": "0.20.16",
3
+ "version": "0.22.0",
4
4
  "description": "Cost-aware delegation enforcer for OpenCode. Tracks model usage, routes Task subagents to cheaper tiers, surfaces cumulative savings in chat. Includes research audit, reporting framework, project memory, progressive scratchpad decadence, and trinity CLI for brain/medium/cheap slot switching.",
5
5
  "scripts": {
6
6
  "release": "node scripts/release.mjs",
@@ -229,6 +229,15 @@ export class VibeOSApiClient {
229
229
  stress_score: stressScore,
230
230
  });
231
231
  }
232
+ async getModes() {
233
+ return this.request("/api/v1/modes", {}, "GET");
234
+ }
235
+ async selectMode(mode) {
236
+ return this.request("/api/v1/mode/select", { mode });
237
+ }
238
+ async classifyQuery(text, state) {
239
+ return this.request("/api/v1/mode/classify", { text, state: state || {} });
240
+ }
232
241
  async classifyTier(model, customRegex = null) {
233
242
  return this.request("/api/v1/tier/classify", { model, custom_regex: customRegex });
234
243
  }
package/src/lib/state.js CHANGED
@@ -1474,7 +1474,6 @@ function recordCacheSaving(tool, saveEst, meta = {}) {
1474
1474
  const now = new Date().toISOString();
1475
1475
  const delta = Number(saveEst || 0);
1476
1476
  s.lifetime ??= { warn_count: 0, total_savings_usd: 0, last_updated: "" };
1477
- s.lifetime.cache_savings_usd = roundUsd(Number(s.lifetime.cache_savings_usd || 0) + delta);
1478
1477
  s.lifetime.last_updated = now;
1479
1478
  s.sessions ??= {};
1480
1479
  const sid = _OC_SID;
@@ -1485,20 +1484,27 @@ function recordCacheSaving(tool, saveEst, meta = {}) {
1485
1484
  s.sessions[sid].project_name = currentProjectName;
1486
1485
  s.sessions[sid].session_cache_dir = getSessionScratchpadDir();
1487
1486
  s.sessions[sid].tool_counts[tool] = (s.sessions[sid].tool_counts[tool] || 0) + 1;
1488
- s.sessions[sid].cache_savings_usd = roundUsd(Number(s.sessions[sid].cache_savings_usd || 0) + delta);
1489
1487
  if (meta?.hash) {
1490
1488
  s.sessions[sid].cache_hits ??= [];
1491
- s.sessions[sid].cache_hits.push({
1492
- at: now,
1493
- tool,
1494
- hash: meta.hash,
1495
- est_savings_usd: roundUsd(delta),
1496
- });
1497
- if (s.sessions[sid].cache_hits.length > 200) {
1498
- console.error(`[vibeOS] session cache_hits truncated from ${s.sessions[sid].cache_hits.length} to 200 for ${sid}`);
1499
- s.sessions[sid].cache_hits = s.sessions[sid].cache_hits.slice(-200);
1489
+ if (!s.sessions[sid].cache_hits.some((h) => h.hash === meta.hash)) {
1490
+ s.sessions[sid].cache_hits.push({
1491
+ at: now,
1492
+ tool,
1493
+ hash: meta.hash,
1494
+ est_savings_usd: roundUsd(delta),
1495
+ });
1496
+ s.sessions[sid].cache_savings_usd = roundUsd(Number(s.sessions[sid].cache_savings_usd || 0) + delta);
1497
+ s.lifetime.cache_savings_usd = roundUsd(Number(s.lifetime.cache_savings_usd || 0) + delta);
1498
+ if (s.sessions[sid].cache_hits.length > 200) {
1499
+ console.error(`[vibeOS] session cache_hits truncated from ${s.sessions[sid].cache_hits.length} to 200 for ${sid}`);
1500
+ s.sessions[sid].cache_hits = s.sessions[sid].cache_hits.slice(-200);
1501
+ }
1500
1502
  }
1501
1503
  }
1504
+ else {
1505
+ s.sessions[sid].cache_savings_usd = roundUsd(Number(s.sessions[sid].cache_savings_usd || 0) + delta);
1506
+ s.lifetime.cache_savings_usd = roundUsd(Number(s.lifetime.cache_savings_usd || 0) + delta);
1507
+ }
1502
1508
  _pruneOldSessions(s);
1503
1509
  return s;
1504
1510
  });
@@ -1,6 +1,7 @@
1
1
  // @ts-nocheck
2
2
  import { join } from "node:path";
3
3
  import { LABEL_MODES, buildDeterministicTrinity, resolveExecutionIdentity } from "./pricing.js";
4
+ import { BRANDED_MODES, RUNTIME_MODES } from "./mode-router.js";
4
5
  import { invalidateApiToken } from "./api-client.js";
5
6
  export function createTrinityTool(deps) {
6
7
  return {
@@ -24,7 +25,7 @@ export function createTrinityTool(deps) {
24
25
  "Call this when the user says things like 'switch to medium', 'use cheap model', 'disable plugin', 'trinity status'.",
25
26
  args: {
26
27
  action: deps.tool.schema.enum(["status", "enable", "disable", "set", "mode", "thinking", "flow", "tdd", "setup", "project", "patterns", "rebuild", "diagnose", "help", "enforce", "repair-state", "blackbox", "report", "target", "guard", "api-token", "api-bootstrap-token", "todo", "todo-done", "todo-sync"]).optional(),
27
- slot: deps.tool.schema.enum(["brain", "medium", "cheap", "budget", "quality", "speed", "longrun", "auto", "on", "off", "enforce", "strict", "preview", "apply", "clear", "savings"]).optional(),
28
+ slot: deps.tool.schema.enum(["brain", "medium", "cheap", "budget", "quality", "speed", "longrun", "auto", "vibeultrax", "on", "off", "enforce", "strict", "preview", "apply", "clear", "savings"]).optional(),
28
29
  level: deps.tool.schema.enum(["full", "brief", "off", "on"]).optional(),
29
30
  token: deps.tool.schema.string().optional(),
30
31
  },
@@ -178,42 +179,33 @@ export function createTrinityTool(deps) {
178
179
  return `\u2705 Switched to ${slot} slot (${result.ocModel}). Active now (no restart needed).`;
179
180
  }
180
181
  if (action === "mode") {
182
+ const builtInIds = ["budget", "quality", "speed", "longrun"];
183
+ const brandedIds = BRANDED_MODES.map(m => m.id);
184
+ const allModeIds = [...builtInIds, "auto", ...brandedIds];
181
185
  if (!slot)
182
- return `Provide mode: budget | quality | speed | longrun | vibemax | vibeqmax | auto`;
186
+ return `Provide mode: ${builtInIds.join(" | ")} | auto | ${brandedIds.join(" | ")}`;
183
187
  const modeAlias = { vibemax: "vibemax", vibeqmax: "quality" };
184
188
  const resolvedSlot = modeAlias[slot] || slot;
185
- if (!["budget", "quality", "speed", "longrun", "vibemax", "auto"].includes(resolvedSlot)) {
186
- return `Provide mode: budget | quality | speed | longrun | vibemax | vibeqmax | auto`;
189
+ if (!allModeIds.includes(resolvedSlot)) {
190
+ return `Provide mode: ${builtInIds.join(" | ")} | auto | ${brandedIds.join(" | ")}`;
187
191
  }
188
192
  const ok = deps.saveOptimizationMode(resolvedSlot);
189
193
  if (!ok)
190
194
  return `Failed to write mode`;
191
- const tierMap = { budget: "cheap", quality: "brain", speed: "medium", longrun: "brain", vibemax: "medium" };
192
- const tierSlot = tierMap[slot] || "cheap";
193
- deps.writeSelection("active_slot", tierSlot);
194
- deps.writeSelection("onboarding_mode", slot === "quality" || slot === "longrun" ? "strict" : "assist");
195
- if (slot === "budget") {
196
- deps.writeSelection("delegation_enforce", false);
197
- deps.writeSelection("flow_enabled", false);
198
- deps.writeSelection("flow_enforce", false);
199
- deps.writeSelection("tdd_enforce", false);
200
- deps.writeSelection("thinking_level", "off");
201
- }
202
- else if (slot === "quality") {
203
- deps.writeSelection("delegation_enforce", true);
204
- deps.writeSelection("flow_enabled", true);
205
- deps.writeSelection("flow_enforce", true);
206
- deps.writeSelection("tdd_enforce", true);
207
- deps.writeSelection("thinking_level", "full");
208
- }
209
- else if (slot === "speed") {
210
- deps.writeSelection("delegation_enforce", false);
211
- deps.writeSelection("flow_enabled", false);
212
- deps.writeSelection("flow_enforce", false);
213
- deps.writeSelection("tdd_enforce", false);
214
- deps.writeSelection("thinking_level", "off");
215
- }
216
- return `Mode set to ${slot.toUpperCase()}. Tier: ${tierSlot}.`;
195
+ const allEntries = [...BRANDED_MODES, ...RUNTIME_MODES];
196
+ const modeEntry = allEntries.find(e => e.id === slot);
197
+ if (modeEntry) {
198
+ const tierSlot = modeEntry.pipeline[0] || "cheap";
199
+ deps.writeSelection("active_slot", tierSlot);
200
+ deps.writeSelection("onboarding_mode", modeEntry.tdd === "quality" || modeEntry.enforcement === "strict" ? "strict" : "assist");
201
+ deps.writeSelection("delegation_enforce", modeEntry.enforcement === "strict" || modeEntry.enforcement === "on");
202
+ deps.writeSelection("flow_enabled", modeEntry.flow === "strict" || modeEntry.flow === "on" || modeEntry.flow === "audit");
203
+ deps.writeSelection("flow_enforce", modeEntry.flow === "strict" || modeEntry.flow === "on");
204
+ deps.writeSelection("tdd_enforce", modeEntry.tdd === "quality" || modeEntry.tdd === "on" || modeEntry.tdd === "strict");
205
+ deps.writeSelection("thinking_level", modeEntry.thinking);
206
+ return `Mode set to ${slot.toUpperCase()}. Tier: ${tierSlot}.`;
207
+ }
208
+ return `Mode set to ${slot.toUpperCase()}.`;
217
209
  }
218
210
  if (action === "thinking") {
219
211
  if (!level || !["full", "brief", "off"].includes(level)) {
@@ -1105,6 +1097,7 @@ export function createTrinityTool(deps) {
1105
1097
  " trinity enable/disable Toggle vibeOS plugin on/off",
1106
1098
  " trinity enforce on Block brain-tier writes/edits (save $$)",
1107
1099
  " trinity lock on/off Lock model at session start (skip auto-reconcile)",
1100
+ " trinity mode <profile> Set optimization profile (built-in + branded modes)",
1108
1101
  " trinity thinking full|brief|off Set reasoning depth",
1109
1102
  "",
1110
1103
  "GUARDRAILS:",
@@ -3,11 +3,11 @@
3
3
  // @ts-nocheck
4
4
  // Blackbox — theWay decision core ported to TypeScript.
5
5
  // Barrel export for all blackbox modules.
6
- export { buildAdvice, buildDecisionBlock, computeModality, humanReadableAction, compressMetrics, compressUncertainty, compressEntropy, enforceClosure, stabilityScore, shouldUseFastPath, buildCautionNote, scoreUsefulness, getFallbackPlan, getActionSuggestion, getCuriosityPrompt, } from "./advice-layer.js";
7
- export { classifySituation, getActions, recommendAction, getSituationTypes, } from "./taxonomy.js";
6
+ export { buildAdvice, buildDecisionBlock, computeModality, humanReadableAction, compressMetrics, compressUncertainty, compressEntropy, enforceClosure, stabilityScore, shouldUseFastPath, buildCautionNote, scoreUsefulness, getFallbackPlan, getActionSuggestion, getCuriosityPrompt } from "./advice-layer.js";
7
+ export { classifySituation, getActions, recommendAction, getSituationTypes } from "./taxonomy.js";
8
8
  export { ResolutionTracker } from "./resolution-tracker.js";
9
9
  export { ExposureModel } from "./exposure-model.js";
10
- export { ACTION_TARGET, ACTION_TYPE, FALLBACK_PLANS, ACTION_SUGGESTIONS, CURIOSITY_PROMPTS, } from "./crew-constants.js";
11
- export { computeControlVector, buildControlHistoryEntry, REGIME_CONTROL_TABLE, } from "./meta-controller.js";
10
+ export { ACTION_TARGET, ACTION_TYPE, FALLBACK_PLANS, ACTION_SUGGESTIONS, CURIOSITY_PROMPTS } from "./crew-constants.js";
11
+ export { computeControlVector, buildControlHistoryEntry, REGIME_CONTROL_TABLE } from "./meta-controller.js";
12
12
  export { vibemaxSelectMode, vibemaxPipeline, predictVibeMaX, trainVibeMaXModelFromTelemetry, getVibeMaXModelMeta, resetVibeMaXPipeline } from "./vibemax.js";
13
13
  export { PivotCache } from "./pivot-cache.js";