@polderlabs/bizar 4.4.13 → 4.5.1

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.
Files changed (118) hide show
  1. package/bizar-dash/CHANGELOG.md +37 -276
  2. package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js +2 -0
  3. package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js.map +1 -0
  4. package/bizar-dash/dist/assets/main-eWZ4NlCL.css +1 -0
  5. package/bizar-dash/dist/assets/main-usWhlPWa.js +362 -0
  6. package/bizar-dash/dist/assets/main-usWhlPWa.js.map +1 -0
  7. package/bizar-dash/dist/assets/{mobile-DSb-t42Y.js → mobile-DQLFCjwJ.js} +2 -2
  8. package/bizar-dash/dist/assets/{mobile-DSb-t42Y.js.map → mobile-DQLFCjwJ.js.map} +1 -1
  9. package/bizar-dash/dist/assets/mobile-O6ANdD4W.js +352 -0
  10. package/bizar-dash/dist/assets/mobile-O6ANdD4W.js.map +1 -0
  11. package/bizar-dash/dist/index.html +3 -3
  12. package/bizar-dash/dist/mobile.html +2 -2
  13. package/bizar-dash/skills/agent-baseline/SKILL.md +80 -0
  14. package/bizar-dash/skills/bizar/SKILL.md +116 -0
  15. package/bizar-dash/skills/chat/SKILL.md +74 -0
  16. package/bizar-dash/skills/headroom/SKILL.md +94 -0
  17. package/bizar-dash/skills/lightrag/SKILL.md +86 -0
  18. package/bizar-dash/skills/minimax/SKILL.md +80 -0
  19. package/bizar-dash/skills/obsidian/SKILL.md +68 -0
  20. package/bizar-dash/skills/providers/SKILL.md +75 -0
  21. package/bizar-dash/skills/sdk/SKILL.md +138 -0
  22. package/bizar-dash/skills/self-improvement/SKILL.md +53 -0
  23. package/bizar-dash/skills/skills-cli/SKILL.md +94 -0
  24. package/bizar-dash/skills/usage/SKILL.md +62 -0
  25. package/bizar-dash/src/server/api.mjs +18 -0
  26. package/bizar-dash/src/server/headroom.mjs +645 -0
  27. package/bizar-dash/src/server/memory-lightrag.mjs +272 -2
  28. package/bizar-dash/src/server/memory-obsidian.mjs +230 -0
  29. package/bizar-dash/src/server/memory-store.mjs +189 -0
  30. package/bizar-dash/src/server/minimax-usage-store.mjs +372 -0
  31. package/bizar-dash/src/server/minimax.mjs +196 -5
  32. package/bizar-dash/src/server/providers-store.mjs +956 -0
  33. package/bizar-dash/src/server/routes/_shared.mjs +17 -0
  34. package/bizar-dash/src/server/routes/config.mjs +52 -1
  35. package/bizar-dash/src/server/routes/env-vars.mjs +165 -0
  36. package/bizar-dash/src/server/routes/headroom.mjs +126 -0
  37. package/bizar-dash/src/server/routes/lightrag.mjs +154 -0
  38. package/bizar-dash/src/server/routes/memory.mjs +668 -1
  39. package/bizar-dash/src/server/routes/opencode-session-detail.mjs +14 -29
  40. package/bizar-dash/src/server/routes/opencode-sessions.mjs +205 -3
  41. package/bizar-dash/src/server/routes/providers.mjs +266 -5
  42. package/bizar-dash/src/server/routes/skills.mjs +32 -43
  43. package/bizar-dash/src/server/routes/update.mjs +340 -0
  44. package/bizar-dash/src/server/routes/usage.mjs +136 -0
  45. package/bizar-dash/src/server/serve-info.mjs +135 -4
  46. package/bizar-dash/src/server/server.mjs +20 -0
  47. package/bizar-dash/src/server/skills-store.mjs +152 -262
  48. package/bizar-dash/src/web/App.tsx +120 -29
  49. package/bizar-dash/src/web/components/EnvVarManager.tsx +247 -0
  50. package/bizar-dash/src/web/components/HeadroomSettings.tsx +418 -0
  51. package/bizar-dash/src/web/components/HeadroomStatus.tsx +158 -0
  52. package/bizar-dash/src/web/components/SettingsSearch.tsx +213 -0
  53. package/bizar-dash/src/web/components/Topbar.tsx +2 -1
  54. package/bizar-dash/src/web/components/UsageChart.tsx +250 -0
  55. package/bizar-dash/src/web/components/UsageTable.tsx +90 -0
  56. package/bizar-dash/src/web/components/chat/ChatComposer.tsx +21 -25
  57. package/bizar-dash/src/web/components/chat/ChatInfoPanel.tsx +199 -37
  58. package/bizar-dash/src/web/components/chat/ChatThread.tsx +29 -17
  59. package/bizar-dash/src/web/components/chat/FloatingComposer.tsx +7 -1
  60. package/bizar-dash/src/web/components/chat/InfoPanel.tsx +71 -6
  61. package/bizar-dash/src/web/components/chat/useChat.ts +751 -257
  62. package/bizar-dash/src/web/lib/api.ts +43 -0
  63. package/bizar-dash/src/web/lib/types.ts +16 -0
  64. package/bizar-dash/src/web/main.tsx +2 -0
  65. package/bizar-dash/src/web/mobile/views/MobileChat.tsx +110 -35
  66. package/bizar-dash/src/web/styles/chat.css +135 -1
  67. package/bizar-dash/src/web/styles/main.css +46 -0
  68. package/bizar-dash/src/web/styles/memory.css +955 -0
  69. package/bizar-dash/src/web/styles/minimax-usage.css +335 -0
  70. package/bizar-dash/src/web/styles/settings.css +418 -0
  71. package/bizar-dash/src/web/styles/skills.css +302 -0
  72. package/bizar-dash/src/web/styles/tasks.css +288 -0
  73. package/bizar-dash/src/web/views/Chat.tsx +276 -48
  74. package/bizar-dash/src/web/views/Config.tsx +3 -2065
  75. package/bizar-dash/src/web/views/Memory.tsx +140 -0
  76. package/bizar-dash/src/web/views/MiniMaxUsage.tsx +476 -461
  77. package/bizar-dash/src/web/views/Overview.tsx +3 -0
  78. package/bizar-dash/src/web/views/Settings.tsx +36 -0
  79. package/bizar-dash/src/web/views/Skills.tsx +208 -260
  80. package/bizar-dash/src/web/views/Tasks.tsx +348 -1119
  81. package/bizar-dash/src/web/views/memory/ConfigPanel.tsx +289 -0
  82. package/bizar-dash/src/web/views/memory/GitSyncPanel.tsx +220 -0
  83. package/bizar-dash/src/web/views/memory/LightragPanel.tsx +307 -0
  84. package/bizar-dash/src/web/views/memory/MemoryOverview.tsx +354 -0
  85. package/bizar-dash/src/web/views/memory/MemoryStatusCard.tsx +160 -0
  86. package/bizar-dash/src/web/views/memory/ObsidianPanel.tsx +642 -0
  87. package/bizar-dash/src/web/views/memory/SemanticSearchPanel.tsx +194 -0
  88. package/bizar-dash/tests/chat-session-create.test.mjs +391 -0
  89. package/bizar-dash/tests/chat-session-stream.test.mjs +308 -0
  90. package/bizar-dash/tests/env-vars-store.test.mjs +216 -0
  91. package/bizar-dash/tests/headroom-install.test.mjs +173 -0
  92. package/bizar-dash/tests/headroom-settings.test.mjs +126 -0
  93. package/bizar-dash/tests/headroom-status.test.mjs +117 -0
  94. package/bizar-dash/tests/lightrag-defaults.node.test.mjs +118 -0
  95. package/bizar-dash/tests/memory-lightrag-extended.test.mjs +162 -0
  96. package/bizar-dash/tests/memory-obsidian.test.mjs +269 -0
  97. package/bizar-dash/tests/memory-tab.test.mjs +322 -0
  98. package/bizar-dash/tests/minimax-chat-usage.test.mjs +178 -0
  99. package/bizar-dash/tests/minimax-usage-store.node.test.mjs +293 -0
  100. package/bizar-dash/tests/mod-upgrade.node.test.mjs +1 -1
  101. package/bizar-dash/tests/opencode-sessions-detail.test.mjs +12 -9
  102. package/bizar-dash/tests/providers-store-backup-keys.node.test.mjs +479 -3
  103. package/bizar-dash/tests/providers-store-search.node.test.mjs +166 -0
  104. package/bizar-dash/tests/skills-list.test.mjs +232 -0
  105. package/bizar-dash/tests/skills-search.test.mjs +222 -0
  106. package/bizar-dash/tests/submit-feedback.test.mjs +6 -6
  107. package/bizar-dash/tests/tasks-create.test.mjs +187 -0
  108. package/bizar-dash/tests/update-check.test.mjs +127 -0
  109. package/bizar-dash/tests/update-run.test.mjs +266 -0
  110. package/cli/bin.mjs +247 -1
  111. package/cli/provision.mjs +118 -4
  112. package/config/agents/_shared/SKILLS.md +109 -0
  113. package/package.json +1 -1
  114. package/bizar-dash/dist/assets/main-BB5mJurD.js +0 -352
  115. package/bizar-dash/dist/assets/main-BB5mJurD.js.map +0 -1
  116. package/bizar-dash/dist/assets/main-BsnQLXdh.css +0 -1
  117. package/bizar-dash/dist/assets/mobile-Dl1q7Cyq.js +0 -354
  118. package/bizar-dash/dist/assets/mobile-Dl1q7Cyq.js.map +0 -1
@@ -29,10 +29,10 @@
29
29
  }
30
30
  })();
31
31
  </script>
32
- <script type="module" crossorigin src="/assets/main-BB5mJurD.js"></script>
33
- <link rel="modulepreload" crossorigin href="/assets/mobile-Dl1q7Cyq.js">
32
+ <script type="module" crossorigin src="/assets/main-usWhlPWa.js"></script>
33
+ <link rel="modulepreload" crossorigin href="/assets/mobile-O6ANdD4W.js">
34
34
  <link rel="stylesheet" crossorigin href="/assets/mobile-CsZQAswA.css">
35
- <link rel="stylesheet" crossorigin href="/assets/main-BsnQLXdh.css">
35
+ <link rel="stylesheet" crossorigin href="/assets/main-eWZ4NlCL.css">
36
36
  </head>
37
37
  <body>
38
38
  <div id="root"></div>
@@ -12,8 +12,8 @@
12
12
  <link rel="preconnect" href="https://fonts.googleapis.com" />
13
13
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
14
14
  <link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
15
- <script type="module" crossorigin src="/assets/mobile-DSb-t42Y.js"></script>
16
- <link rel="modulepreload" crossorigin href="/assets/mobile-Dl1q7Cyq.js">
15
+ <script type="module" crossorigin src="/assets/mobile-DQLFCjwJ.js"></script>
16
+ <link rel="modulepreload" crossorigin href="/assets/mobile-O6ANdD4W.js">
17
17
  <link rel="stylesheet" crossorigin href="/assets/mobile-CsZQAswA.css">
18
18
  </head>
19
19
  <body>
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: agent-baseline
3
+ description: Always-on rules for every Bizar agent. Covers Semble, Skills CLI, loop guard, communication, thinking, parallel execution, and the general agent baseline.
4
+ ---
5
+
6
+ # Agent Baseline
7
+
8
+ Always-on behavioral rules for every Bizar agent. Loaded automatically at session start.
9
+
10
+ ## Semble Code Search
11
+
12
+ A `semble` MCP server is available with two tools:
13
+ - `mcp__semble__search` - search the codebase with a natural-language or code query.
14
+ - `mcp__semble__find_related` - find code similar to a specific file and line.
15
+
16
+ Always call `semble search` before using Grep, Glob, or Read to explore the codebase. Use Grep/Glob/Read only for exact path lookup, exhaustive literal matches, or when the returned chunk lacks enough context.
17
+
18
+ ```bash
19
+ semble search "authentication flow" ./my-project
20
+ semble search "deployment guide" ./my-project --content docs
21
+ ```
22
+
23
+ ## Skills CLI
24
+
25
+ The `skills` CLI (`npm install -g skills`) installs coding skills. Before any non-trivial task, check if a relevant skill exists:
26
+
27
+ ```bash
28
+ skills list --json
29
+ ```
30
+
31
+ Known skill repos by domain:
32
+ - General: `vercel-labs/skills`
33
+ - Frontend (React, a11y): `vercel-labs/agent-skills`, `shadcn/ui`
34
+ - Backend (Supabase, Postgres, auth): `supabase/agent-skills`
35
+ - Testing (TDD, Playwright): `mattpocock/skills`, `microsoft/playwright-cli`
36
+ - Design (frontend-design, UI/UX): `anthropics/skills`, `leonxlnx/taste-skill`
37
+
38
+ ## Loop Guard
39
+
40
+ Follow `rules/uncertainty.md` strictly. When uncertain or stuck, the next move is a research tool call - not a third variation of the same edit. If you catch yourself about to retry the same failed command with slightly different arguments, stop and search first.
41
+
42
+ ## Thinking Rule
43
+
44
+ For agents with reasoning enabled: cap reasoning at 2–4 sentences. No informal self-talk, no "what if" loops, no mid-thought self-correction. Think once, decide, act.
45
+
46
+ ## Parallel Execution
47
+
48
+ When running alongside sibling agents:
49
+ 1. **File scope is sacred.** Only modify files inside your assigned scope.
50
+ 2. **No write-level git.** `git commit`, `push`, `merge`, `rebase`, `reset`, `clean`, `stash`, `checkout` to switch branches, and `pull --rebase` are FORBIDDEN for all agents except @hermod.
51
+ 3. **Detect conflicts before they happen.** Before writing a file, run `git diff --name-only` and confirm it is not in a sibling's scope.
52
+ 4. **`.git/index.lock` is a sibling's signal.** Wait 2–3 seconds and retry. If it persists, STOP and report. Do not delete the lock file.
53
+
54
+ ## Always-On Rules
55
+
56
+ ### Simplicity Rule
57
+ Match the work to the ask. If the user asked one question, answer one question. If they asked for one change, make one change. Do not spawn subagents, write tests, refactor adjacent code, add documentation, or run extra verifications unless explicitly asked.
58
+
59
+ ### No Speculative Features
60
+ Do not add error handling, fallbacks, configurability, or "just in case" code the user did not request. If you think something is needed, mention it - do not implement it.
61
+
62
+ ### Research First
63
+ For facts that change quickly (current positions, prices, breaking news) or anything that could have changed recently, search before answering. For stable technical knowledge, answer directly without search.
64
+
65
+ ### Copyright Compliance
66
+ - Never reproduce copyrighted material, even in code comments.
67
+ - Every direct quote must be under 15 words. One quote per source maximum.
68
+ - Summaries must be much shorter than the original and substantially different in wording, structure, and phrasing.
69
+
70
+ ## File Handling
71
+
72
+ - `read` to view a file. `edit` to make precise edits. `write` for new files or full rewrites.
73
+ - Verify a file exists with `read` or `glob` before claiming to inspect or modify it.
74
+ - Preserve user content unless a change is explicitly requested.
75
+
76
+ ## Communication
77
+
78
+ - Provide brief progress updates during longer or multi-step tasks.
79
+ - Final answers should be direct and briefly summarize changes, limitations, and verification.
80
+ - Match the user's register: brief reply to a brief question; depth only when they want depth.
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: biz
3
+ description: Use when working with, configuring, troubleshooting, or understanding the Bizar Norse-pantheon multi-agent system for opencode. Covers Odin routing, agent tiers, cost-aware dispatch, parallel implementation, and common failure modes.
4
+ ---
5
+
6
+ # Bizar
7
+
8
+ Norse-pantheon multi-agent system for opencode. 13 agents across 4 cost tiers, with Odin as a pure router that always splits implementation across parallel subagents.
9
+
10
+ ## Architecture
11
+
12
+ Odin is the only primary agent. Every request hits him first. He NEVER does work - he decomposes into parallel streams and dispatches to subagents.
13
+
14
+ All subagents use Obsidian vault memory with per-project vaults. Call `obsidian_list_vaults` at session start to discover available vaults, determine the project name, and use the matching `<project-name>` vault. The default vault is for general/cross-project knowledge only.
15
+
16
+ ## Agent Reference
17
+
18
+ | Agent | Model | Tier | Cost | When to Route |
19
+ |---|---|---|---|---|
20
+ | Odin | MiniMax-M3 | Router | $0.30/M · $1.20/M | Primary entry point. Decomposes and dispatches. |
21
+ | Mimir | DeepSeek V4 Flash | Free | $0 | Deep codebase research, Semble-first exploration, docs analysis |
22
+ | Heimdall | DeepSeek V4 Flash | Free | $0 | Simple edits, file ops, mechanical CRUD, quick answers |
23
+ | Hermod | MiniMax-M2.7 | Mid | $0.30/M · $1.20/M | Git ops: commit, push, PR, merge, rebase, branches |
24
+ | Thor | MiniMax-M2.7 | Mid | $0.30/M · $1.20/M | Moderate implementation, tests, debugging, refactoring |
25
+ | Tyr | MiniMax-M3 | High | $0.30/M · $1.20/M | Complex features, architecture, deep debugging, cross-cutting refactor |
26
+ | Vidarr | GPT-5.5 | Ultra | ChatGPT sub | Last resort when Tyr fails or debugging is stuck |
27
+ | Forseti | MiniMax-M3 | Gate | $0.30/M · $1.20/M | Plan auditor - reviews Tyr/Vidarr plans before execution |
28
+ | Semble | MCP search | Free | $0 | MCP code search tool - not an agent |
29
+
30
+ ## Odin Routing Rules
31
+
32
+ **Odin has `edit: deny`, `bash: deny`, `glob: deny`, `grep: deny`.** He literally cannot self-handle.
33
+
34
+ ### Mandatory Parallelism
35
+
36
+ 1. Every request is decomposed into independent work items
37
+ 2. Always 2+ parallel `task` calls in a single message
38
+ 3. Implementation always splits across @thor + @tyr (frontend/backend, file split, impl+tests)
39
+ 4. If a task truly cannot be split, pair it with a parallel research or review task
40
+
41
+ ### Routing Cheat Sheet
42
+
43
+ ```
44
+ Research / Understanding → @mimir (free, Semble-first)
45
+ Quick edit / File ops → @heimdall (free)
46
+ Git / PR / Merge → @hermod (M2.7)
47
+ Moderate implementation → @thor (M2.7)
48
+ Complex implementation → @tyr (M3, after @forseti audit)
49
+ Ultimate fallback → @vidarr (GPT-5.5, after @forseti audit)
50
+ Plan review / Audit → @forseti (M3, review only)
51
+ ```
52
+
53
+ ### Cost Escalation
54
+
55
+ ```
56
+ Free (Mimir, Heimdall) → $Mid (Thor, Hermod) → $$High (Tyr) → $$$Ultra (Vidarr)
57
+ ```
58
+
59
+ Never use a paid agent for work a free agent can do. Never use Tyr for what Thor can handle.
60
+
61
+ ## MiniMax Multi-Key Rotation
62
+
63
+ When using the `minimax/MiniMax-M3` or `minimax/MiniMax-M2.7` model ids, do NOT set a custom `baseURL`. The plugin rotates through keys on 429/402/5xx:
64
+
65
+ ```bash
66
+ # Option A - comma-separated env var
67
+ export MINIMAX_API_KEYS="key1,key2,key3"
68
+
69
+ # Option B - numbered env vars
70
+ export MINIMAX_API_KEY="primary-key"
71
+ export MINIMAX_API_KEY_2="second-key"
72
+ export MINIMAX_API_KEY_3="third-key"
73
+ ```
74
+
75
+ Rotation triggers on 429 (rate limit), 402 (quota exhausted), 500/502/503/504 (server error). Does NOT trigger on 401 (unauthorized - fix the key).
76
+
77
+ ## Headroom
78
+
79
+ The Bizar dashboard manages Headroom through Settings → Headroom. To check status:
80
+
81
+ ```bash
82
+ bizar headroom status
83
+ bizar headroom stats
84
+ bizar headroom install
85
+ bizar headroom wrap
86
+ ```
87
+
88
+ Or via the dashboard API:
89
+ - `GET /api/headroom/status` — live status
90
+ - `GET /api/headroom/stats` — compression stats
91
+ - `POST /api/headroom/install` — install headroom
92
+ - `POST /api/headroom/wrap` — wrap opencode
93
+ - `POST /api/headroom/proxy/start` — start proxy
94
+
95
+ Headroom is a context compression layer that sits between opencode and LLM providers, compressing tool outputs, logs, RAG chunks, and conversation history by 60–95%.
96
+
97
+ ## Troubleshooting
98
+
99
+ ### Odin Self-Handles Instead of Routing
100
+ **Symptoms:** Odin runs bash, glob, grep, edit, or write directly.
101
+
102
+ **Fix:** Remove those permissions from `~/.config/opencode/agents/odin.md`:
103
+ ```yaml
104
+ permission:
105
+ task: allow
106
+ read: allow
107
+ list: allow
108
+ todowrite: allow
109
+ question: allow
110
+ webfetch: allow
111
+ websearch: allow
112
+ # NO bash, glob, grep, edit, write
113
+ ```
114
+
115
+ ### Forseti Rejects Every Plan
116
+ Provide more detail: specific file paths, data flow, error handling, security implications.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: chat
3
+ description: How chat and opencode session integration works in BizarHarness - session management, message history, opencode session detail, and the chat view.
4
+ ---
5
+
6
+ # Chat + OpenCode Session Integration
7
+
8
+ The chat view in BizarHarness integrates with opencode sessions to provide a conversational interface for agent interactions.
9
+
10
+ ## Session Management
11
+
12
+ Each opencode session has a unique session ID. The chat router (`bizar-dash/src/server/routes/chat.mjs`) manages:
13
+ - Listing active and historical sessions
14
+ - Streaming message events via SSE
15
+ - Session termination
16
+
17
+ ## Chat Endpoints
18
+
19
+ - `GET /api/chat/sessions` - list all sessions (active and recent)
20
+ - `GET /api/chat/sessions/:id` - get session metadata and messages
21
+ - `POST /api/chat/sessions` - create a new session
22
+ - `DELETE /api/chat/sessions/:id` - terminate a session
23
+ - `GET /api/chat/sessions/:id/stream` - SSE stream of messages
24
+
25
+ ## Message Format
26
+
27
+ ```typescript
28
+ interface Message {
29
+ id: string;
30
+ sessionId: string;
31
+ role: 'user' | 'assistant' | 'system' | 'tool';
32
+ content: string;
33
+ model?: string;
34
+ tokens?: { input: number; output: number };
35
+ createdAt: string;
36
+ attachments?: Attachment[];
37
+ }
38
+ ```
39
+
40
+ ## OpenCode Session Detail
41
+
42
+ `bizar-dash/src/server/routes/opencode-session-detail.mjs` exposes per-session metadata:
43
+ - Agent chain (which agents handled this message)
44
+ - Token usage breakdown
45
+ - Tool calls made
46
+ - Session duration
47
+
48
+ ## Chat View (Frontend)
49
+
50
+ `bizar-dash/src/web/views/Chat.tsx` - the main chat UI:
51
+ - Real-time message streaming via SSE
52
+ - Markdown rendering with syntax highlighting
53
+ - File attachment support
54
+ - Message regeneration
55
+ - Copy code buttons
56
+
57
+ Mobile: `bizar-dash/src/web/views/MobileChat.tsx`
58
+
59
+ ## Hooks
60
+
61
+ `bizar-dash/src/web/hooks/useChat.ts` - manages:
62
+ - Session state
63
+ - Message list
64
+ - Streaming state
65
+ - Auto-scroll
66
+ - Error recovery
67
+
68
+ ## Common Issues
69
+
70
+ ### Messages not streaming
71
+ Check that the SSE endpoint is reachable and the session is still active. The server closes the stream after session timeout.
72
+
73
+ ### Session shows wrong agent
74
+ Sessions are routed based on the current routing table in `AGENTS.md`. A session started under Thor will continue under Thor unless explicitly rerouted.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: headroom
3
+ description: Headroom — context compression layer for AI agents. Routes opencode and other LLM clients through a local proxy that compresses tool outputs, logs, RAG chunks, and conversation history by 60–95%.
4
+ ---
5
+
6
+ # Headroom
7
+
8
+ Headroom is a context compression layer that sits between opencode (or any LLM client) and the upstream provider. It intercepts tool call outputs, conversation history, and RAG chunks and compresses them before they reach the model — typically reducing token usage by 60–95% with no loss in answer quality.
9
+
10
+ ## When to Use
11
+
12
+ - **Token budget is tight**: If a task is approaching the context window limit, Headroom can reclaim 60–90% of the tokens spent on tool outputs.
13
+ - **Long conversations**: The compression is cumulative — the longer the session, the more Headroom saves.
14
+ - **Verbose tool output**: RAG retrieval, file globbing, grep results, and diagnostic output are the highest-value compression targets.
15
+ - **Multi-step implementation**: Large features with many tool calls benefit most.
16
+
17
+ ## Architecture
18
+
19
+ ```
20
+ opencode → headroom proxy (localhost:8787) → LLM provider
21
+
22
+ compresses tool outputs, logs, RAG chunks
23
+ caches responses
24
+ measures savings
25
+ ```
26
+
27
+ ## Key Concepts
28
+
29
+ ### Compression ratio
30
+ The fraction of tokens Headroom eliminates. A 0.85 compression ratio means 85% of the tokens were removed before reaching the provider.
31
+
32
+ ### Wrapped vs unwrapped
33
+ `headroom wrap opencode` modifies `~/.config/opencode/opencode.json` to route traffic through the proxy. `headroom unwrap opencode` restores the original configuration.
34
+
35
+ ### Proxy vs wrap
36
+ - **Proxy** (`headroom proxy`): The actual HTTP proxy server running on port 8787.
37
+ - **Wrap** (`headroom wrap opencode`): The act of configuring opencode to use the proxy.
38
+
39
+ You can run the proxy standalone (`headroom proxy`) and point any OpenAI-compatible client at it. The wrap command is just a convenience for opencode.
40
+
41
+ ## Dashboard Integration
42
+
43
+ The Bizar dashboard manages Headroom through Settings → Headroom:
44
+
45
+ - **Status widget**: Shows live proxy status, compression ratio, tokens saved
46
+ - **Controls**: Install, wrap/unwrap, start/stop proxy, open dashboard
47
+ - **Settings**: Auto-install, auto-start, auto-wrap, route-all-providers, port, host, backend, output shaper, telemetry, budget
48
+
49
+ API endpoints:
50
+ - `GET /api/headroom/status` — live status
51
+ - `GET /api/headroom/stats?hours=24` — compression statistics
52
+ - `POST /api/headroom/install` — install headroom
53
+ - `POST /api/headroom/wrap` — wrap opencode
54
+ - `POST /api/headroom/unwrap` — unwrap opencode
55
+ - `POST /api/headroom/proxy/start` — start proxy
56
+ - `POST /api/headroom/proxy/stop` — stop proxy
57
+ - `POST /api/headroom/auto-route` — configure all providers to route through the proxy
58
+
59
+ CLI:
60
+ ```bash
61
+ bizar headroom status # live status
62
+ bizar headroom stats # compression stats
63
+ bizar headroom install # install headroom
64
+ bizar headroom wrap # wrap opencode
65
+ bizar headroom unwrap # unwrap
66
+ bizar headroom start # start proxy
67
+ bizar headroom stop # stop proxy
68
+ bizar headroom doctor # health check
69
+ ```
70
+
71
+ ## Environment Variables
72
+
73
+ | Variable | Default | Description |
74
+ |---|---|---|
75
+ | `HEADROOM_HOST` | `127.0.0.1` | Proxy bind host |
76
+ | `HEADROOM_PORT` | `8787` | Proxy port |
77
+ | `HEADROOM_OUTPUT_SHAPER` | `0` | Set to `1` to enable output shaping |
78
+ | `HEADROOM_TELEMETRY` | (on) | Set to `off` to disable |
79
+ | `HEADROOM_BUDGET` | `0` | Monthly USD cap (0 = unlimited) |
80
+ | `HEADROOM_CONTEXT_TOOL` | `rtk` | Context tool: `rtk` or `lean-ctx` |
81
+
82
+ ## Common Gotchas
83
+
84
+ 1. **Proxy must be running before opencode starts**: If the proxy is down when opencode launches, opencode will fail to make LLM calls. Start the proxy first, or enable `autoStart` in Headroom settings.
85
+
86
+ 2. **`headroom wrap` edits opencode.json**: The wrap command modifies `~/.config/opencode/opencode.json`. If you use version control for this file, you'll see a diff on every wrap. Use `headroom unwrap` before committing, or ignore the changes.
87
+
88
+ 3. **Headroom 0.30.0 doesn't have `headroom plan --tokens`**: This command was removed. Use `headroom perf --hours 24` for actual token savings data.
89
+
90
+ 4. **Token savings are cumulative**: The compression ratio compounds over a session. A 15-step implementation that saves 80% at each step uses roughly the same tokens as a 3-step implementation without Headroom.
91
+
92
+ 5. **Cache hits**: Headroom caches semantically similar tool calls. Repeated operations (file reads, API probes) can be served from cache entirely, bypassing the LLM.
93
+
94
+ 6. **Provider baseURL**: When `routeAllProviders` is enabled, the dashboard rewrites provider baseURLs to point at the proxy. If you configure a new provider manually, you may need to update its baseURL to go through the proxy.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: lightrag
3
+ description: LightRAG integration with BizarHarness. Covers setup, opencode-free defaults, querying, indexing, and the memory service integration.
4
+ ---
5
+
6
+ # LightRAG Integration
7
+
8
+ LightRAG provides fast full-text and keyword search over Obsidian vault content. It is the Phase 2 component of the Bizar Memory Service.
9
+
10
+ ## Overview
11
+
12
+ - **LightRAG** - a lightweight RAG (Retrieval-Augmented Generation) server that indexes Markdown files
13
+ - **Bizar Memory Service** - three-layer system: Markdown (truth) → Git (collaboration) → LightRAG (index)
14
+ - **opencode-free defaults** - LightRAG runs without opencode, accessible to any HTTP client
15
+
16
+ ## Setup
17
+
18
+ Start the LightRAG server:
19
+ ```bash
20
+ npx lightrag-server --port 8724
21
+ ```
22
+
23
+ Or via the Bizar dashboard: navigate to Settings → LightRAG and configure the server URL.
24
+
25
+ ## Configuration
26
+
27
+ LightRAG settings are stored in `~/.config/opencode/lightrag.json`:
28
+
29
+ ```json
30
+ {
31
+ "serverUrl": "http://localhost:8724",
32
+ "indexRoot": "~/.config/opencode/memory",
33
+ "autoIndex": true,
34
+ "embeddingModel": "bge-m3"
35
+ }
36
+ ```
37
+
38
+ ## API Endpoints
39
+
40
+ - `GET /api/lightrag/status` - server health and index stats
41
+ - `POST /api/lightrag/index` - trigger re-indexing of vault
42
+ - `GET /api/lightrag/search?q=` - full-text search over vault
43
+ - `GET /api/lightrag/extract?entities=` - entity extraction
44
+
45
+ ## Search Example
46
+
47
+ ```bash
48
+ curl "http://localhost:8724/search?q=authentication+flow&k=5"
49
+ ```
50
+
51
+ Returns ranked snippets with source file paths.
52
+
53
+ ## Integration with Memory Service
54
+
55
+ When both Obsidian vault and LightRAG are configured:
56
+ 1. The memory service writes new knowledge to the vault
57
+ 2. LightRAG indexes the vault continuously or on-demand
58
+ 3. `bizar memory search` routes natural-language queries to LightRAG
59
+
60
+ ## When to Use LightRAG vs Direct File Read
61
+
62
+ | Query Type | Use |
63
+ |---|---|
64
+ | Natural-language question | LightRAG search |
65
+ | Specific fact lookup | Direct file read |
66
+ | Related concepts discovery | LightRAG search |
67
+ | Precise location of text | grep + read |
68
+
69
+ ## Memory tab in the dashboard (v4.7.0+)
70
+
71
+ The dashboard's **Memory** tab (sidebar entry between Skills and Settings) surfaces LightRAG controls without leaving the browser:
72
+
73
+ - **LightRAG panel** — Start / Stop / Restart / Reindex all / Rebuild graph. Rebuild graph wipes the working dir and re-runs a full reindex (idempotent — safe to re-run).
74
+ - **Stats** — Approximate indexed-chunk count (from `kv_store_*.json`), query count last 24h, and average response time. Stats are tracked in a sidecar JSONL at `<project>/.bizar/memory-cache/lightrag-query-log.jsonl`.
75
+ - **Quick search** — Sends `GET /api/memory/query?q=...&topK=8` and shows the raw LightRAG response.
76
+ - **Semantic search panel** — Cross-source search: runs both LightRAG and Obsidian vault lexical search and merges results, deduped by (source, relPath).
77
+
78
+ Open the tab by setting `activeTab = 'memory'` or via the Overview's Memory status card. The LightRAG stats are fetched via `GET /api/memory/lightrag/stats`; the rebuild path uses `POST /api/memory/lightrag/rebuild-graph`.
79
+
80
+ ## Common Issues
81
+
82
+ ### Empty search results
83
+ Cause: index is stale or the server is down. Fix: POST to `/api/lightrag/index` to re-index.
84
+
85
+ ### Server not responding
86
+ Check that LightRAG is running: `curl http://localhost:8724/status`. If not, restart with `npx lightrag-server`.
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: minimax
3
+ description: MiniMax integration for the Bizar multi-agent system. Covers chat completions, usage tracking, multi-key rotation, rate limiting, and agent awareness of model limits and pricing.
4
+ ---
5
+
6
+ # MiniMax Integration
7
+
8
+ Bizar agents use MiniMax models as the primary paid tier. This skill covers the provider configuration, usage tracking, and common failure modes.
9
+
10
+ ## Model Reference
11
+
12
+ | Model ID | Context | Cost (in/out) | Best for |
13
+ |---|---|---|---|
14
+ | `minimax/MiniMax-M2.7` | 32k | $0.30/M · $1.20/M | Mid-tier implementation, Git ops, moderate tasks |
15
+ | `minimax/MiniMax-M3` | 32k | $0.30/M · $1.20/M | Complex features, deep debugging, architecture |
16
+
17
+ The `MiniMax-M3` model is the primary high-tier agent (Tyr, Forseti). The `MiniMax-M2.7` model is used for Thor and Hermod.
18
+
19
+ ## Provider Configuration
20
+
21
+ Do NOT set `baseURL` on the `minimax` provider - opencode ships a built-in MiniMax provider that resolves the correct API endpoint. Adding an explicit baseURL is a common cause of 404s.
22
+
23
+ ```json
24
+ {
25
+ "provider": "minimax",
26
+ "model": "minimax/MiniMax-M3"
27
+ }
28
+ ```
29
+
30
+ ## Multi-Key Rotation
31
+
32
+ When you have multiple MiniMax accounts and want to distribute load:
33
+
34
+ ```bash
35
+ # Comma-separated (simplest)
36
+ export MINIMAX_API_KEYS="key1,key2,key3"
37
+
38
+ # Numbered env vars (explicit ordering)
39
+ export MINIMAX_API_KEY="primary-key"
40
+ export MINIMAX_API_KEY_2="backup-key"
41
+ ```
42
+
43
+ **Rotation triggers:** 429 (rate limit), 402 (quota exhausted), 500/502/503/504 (server error).
44
+
45
+ **Does NOT rotate on:** 401 (unauthorized - fix the key), 4xx client errors (the request is bad).
46
+
47
+ **Round-robin on success:** the next request starts on the next key, spreading load evenly.
48
+
49
+ ## Usage Tracking
50
+
51
+ The dashboard tracks token usage per session via `bizar-dash/src/server/minimax-usage-store.mjs`. Usage is recorded for:
52
+ - Input tokens
53
+ - Output tokens
54
+ - Model used
55
+ - Session ID
56
+ - Timestamp
57
+
58
+ View usage at `/usage` in the dashboard.
59
+
60
+ ## Common Failure Modes
61
+
62
+ ### 429 / Rate Limit
63
+ Cause: single key hit rate limit. Fix: add more keys to rotation.
64
+
65
+ ### 402 / Quota Exhausted
66
+ Cause: monthly spend limit reached on the key. Fix: add a different key with remaining quota.
67
+
68
+ ### 404 on Chat Completions
69
+ Cause: wrong baseURL or malformed model ID. Fix: remove custom baseURL, use `minimax/MiniMax-M3` as model ID.
70
+
71
+ ### Empty Responses / Truncated Output
72
+ Cause: output hit token limit or streaming was interrupted. Fix: increase `maxTokens` if possible, or split the request.
73
+
74
+ ## Agent Cost Awareness
75
+
76
+ When routing work:
77
+ - Free: Mimir, Heimdall (DeepSeek V4 Flash - no MiniMax cost)
78
+ - Mid: Thor, Hermod (MiniMax-M2.7)
79
+ - High: Tyr, Forseti (MiniMax-M3)
80
+ - Ultra: Vidarr (GPT-5.5 via OpenAI-compatible endpoint)
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: obsidian
3
+ description: Use the Bizar Memory Service for persistent project knowledge - local Obsidian-compatible Markdown + Git-shared sync. Read vault entries before non-trivial decisions; write after meaningful work. Three layers: Markdown (truth) → Git (collaboration) → LightRAG (derived index, Phase 2).
4
+ ---
5
+
6
+ # Bizar Memory Service (Obsidian)
7
+
8
+ Three-layer persistent memory for project knowledge.
9
+
10
+ ## Architecture
11
+
12
+ 1. **Markdown (truth)** - Obsidian-compatible `.md` files with YAML frontmatter, wikilinks, and callouts. Stored in per-project vaults under `~/.config/opencode/memory/<project>/`.
13
+ 2. **Git (collaboration)** - Vaults are Git-tracked and synced. The vault path is unique per project, enabling team sharing via normal Git workflow.
14
+ 3. **LightRAG (derived index, Phase 2)** - When the LightRAG server runs, the memory service indexes all vault entries for fast full-text retrieval.
15
+
16
+ ## Vault Discovery
17
+
18
+ At session start, call `obsidian_list_vaults` (via the Obsidian MCP tool or CLI) to find available vaults. Match by project name. The default vault is for cross-project knowledge only.
19
+
20
+ ## Vault Structure
21
+
22
+ ```
23
+ ~/.config/opencode/memory/<project>/
24
+ .obsidian/ # Obsidian config (workspace.json etc.)
25
+ index.md # Entry point: links to recent, important, pinned notes
26
+ projects/ # Project-specific notes
27
+ decisions/ # ADRs and architectural decisions
28
+ references/ # External knowledge captured for this project
29
+ daily/ # Daily notes (journal-style)
30
+ ```
31
+
32
+ ## Adding Knowledge
33
+
34
+ After meaningful work, write a note:
35
+
36
+ - Use frontmatter: `created:`, `updated:`, `tags:`, `project:`
37
+ - Link related notes with `[[wikilinks]]`
38
+ - Keep notes small and focused (one concept per note)
39
+ - Update `index.md` if adding a significant new area
40
+
41
+ ## Querying Knowledge
42
+
43
+ Use the memory service to find relevant context before making non-trivial decisions:
44
+ - `bizar memory search "<topic>"` - full-text search across vault
45
+ - `bizar memory status` - shows vault path, last sync, index state
46
+
47
+ ## LightRAG Integration
48
+
49
+ When LightRAG is enabled (v4.5.0+), it indexes vault content automatically. Query with `bizar memory search` - this routes to LightRAG for natural-language queries. For simple lookups, direct file reading is faster.
50
+
51
+ ## Memory tab in the dashboard (v4.7.0+)
52
+
53
+ The dashboard has a dedicated **Memory** tab (sidebar entry between Skills and Settings) for working with the vault without leaving the browser:
54
+
55
+ - **Overview** — composite health score (vault + LightRAG + git + secrets + schema), with one-click navigation to each subsystem.
56
+ - **Obsidian Vault** — folder tree on the left, note list (newest first), detail pane with body + frontmatter + backlinks. Inline create / edit (markdown editor modal) / delete.
57
+ - **LightRAG** — Start / Stop / Restart / Reindex all / Rebuild graph. Quick search sends a natural-language query and shows the LightRAG response.
58
+ - **Git Sync** — branch / ahead / behind / dirty / clean pills, working-tree diff, Pull / Push / Commit / Fetch + sync.
59
+ - **Semantic Search** — single search input that queries both LightRAG and the Obsidian vault in one shot. Results deduplicated by (source, relPath) and sorted by score.
60
+ - **Config** — grouped forms for LightRAG URL/models, Obsidian path/syncInterval, git repo/remote/branch/autoSync, plus a "Test git connection" button.
61
+
62
+ Open the tab programmatically by setting `activeTab = 'memory'`. The Overview page now also surfaces a small Memory status card (health score + LightRAG + vault + git) with a single-click jump.
63
+
64
+ ## Common Gotchas
65
+
66
+ - The vault is git-tracked but not auto-committed. Commit after meaningful knowledge additions.
67
+ - Wikilinks work within Obsidian but are just plain links in plain Markdown viewers.
68
+ - Heavy media files (images, PDFs) should be stored outside the vault or Git LFS-tracked.