@polderlabs/bizar 10.7.1 → 10.7.2

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 (142) hide show
  1. package/.claude/agents/_shared/AGENT_BASELINE.md +266 -0
  2. package/.claude/agents/_shared/CLAUDE_TOOLS.md +412 -0
  3. package/.claude/agents/_shared/SKILLS.md +109 -0
  4. package/.claude/agents/brand-designer.md +55 -0
  5. package/.claude/agents/exec-assistant.md +34 -0
  6. package/.claude/agents/help-desk.md +44 -0
  7. package/.claude/agents/it-lead.md +53 -0
  8. package/.claude/agents/knowledge-manager.md +49 -0
  9. package/.claude/agents/office-coordinator.md +39 -0
  10. package/.claude/agents/office-greeter.md +53 -0
  11. package/.claude/agents/office-manager.md +287 -0
  12. package/.claude/agents/principal-engineer.md +58 -0
  13. package/.claude/agents/qa-reviewer.md +51 -0
  14. package/.claude/agents/research-analyst.md +53 -0
  15. package/.claude/agents/senior-engineer.md +55 -0
  16. package/.claude/agents/support-tech.md +87 -0
  17. package/.claude/agents/vp-engineering.md +54 -0
  18. package/.claude/commands/audit.md +48 -0
  19. package/.claude/commands/bizar.md +22 -0
  20. package/.claude/commands/cron.md +36 -0
  21. package/.claude/commands/explain.md +17 -0
  22. package/.claude/commands/goal.md +99 -0
  23. package/.claude/commands/init.md +15 -0
  24. package/.claude/commands/learn.md +46 -0
  25. package/.claude/commands/plan.md +35 -0
  26. package/.claude/commands/plow-through.md +50 -0
  27. package/.claude/commands/pr-review.md +49 -0
  28. package/.claude/commands/setup-provider.md +96 -0
  29. package/.claude/commands/spec.md +47 -0
  30. package/.claude/commands/sprint.md +43 -0
  31. package/.claude/commands/tailscale-serve.md +100 -0
  32. package/.claude/commands/team.md +132 -0
  33. package/.claude/commands/test.md +62 -0
  34. package/.claude/commands/validate.md +68 -0
  35. package/.claude/commands/visual-plan.md +24 -0
  36. package/.claude/hooks/README.md +108 -0
  37. package/.claude/hooks/__tests__/pretooluse-editwrite.test.mjs +146 -0
  38. package/.claude/hooks/__tests__/sessionend-recall.test.mjs +256 -0
  39. package/.claude/hooks/__tests__/sessionstart-prime.test.mjs +325 -0
  40. package/.claude/hooks/__tests__/thinking-route.test.mjs +319 -0
  41. package/.claude/hooks/auto-instinct.sh +81 -0
  42. package/.claude/hooks/learning-extract.mjs +92 -0
  43. package/.claude/hooks/post-merge-audit.sh +93 -0
  44. package/.claude/hooks/posttooluse-editwrite.mjs +91 -0
  45. package/.claude/hooks/pretooluse-bash.mjs +87 -0
  46. package/.claude/hooks/pretooluse-editwrite.mjs +117 -0
  47. package/.claude/hooks/sessionend-recall.mjs +384 -0
  48. package/.claude/hooks/sessionstart-prime.mjs +278 -0
  49. package/.claude/hooks/thinking-route.mjs +314 -0
  50. package/.claude/hooks/worker-suggest.mjs +110 -0
  51. package/.claude/settings.json +167 -0
  52. package/.claude/skills/9router/SKILL.md +80 -0
  53. package/.claude/skills/9router-chat/SKILL.md +73 -0
  54. package/.claude/skills/9router-embeddings/SKILL.md +69 -0
  55. package/.claude/skills/9router-image/SKILL.md +86 -0
  56. package/.claude/skills/9router-stt/SKILL.md +79 -0
  57. package/.claude/skills/9router-tts/SKILL.md +80 -0
  58. package/.claude/skills/9router-web-fetch/SKILL.md +99 -0
  59. package/.claude/skills/9router-web-search/SKILL.md +91 -0
  60. package/.claude/skills/agent-browser/SKILL.md +64 -0
  61. package/.claude/skills/bizar/README.md +9 -0
  62. package/.claude/skills/bizar/SKILL.md +447 -0
  63. package/.claude/skills/cpp-coding-standards/README.md +28 -0
  64. package/.claude/skills/cpp-coding-standards/SKILL.md +634 -0
  65. package/.claude/skills/cpp-coding-standards/references/concurrency.md +320 -0
  66. package/.claude/skills/cpp-coding-standards/references/error-handling.md +229 -0
  67. package/.claude/skills/cpp-coding-standards/references/memory-safety.md +216 -0
  68. package/.claude/skills/cpp-coding-standards/references/modern-idioms.md +282 -0
  69. package/.claude/skills/cpp-coding-standards/references/review-checklist.md +96 -0
  70. package/.claude/skills/cpp-testing/README.md +28 -0
  71. package/.claude/skills/cpp-testing/SKILL.md +304 -0
  72. package/.claude/skills/cpp-testing/references/coverage.md +370 -0
  73. package/.claude/skills/cpp-testing/references/framework-compare.md +175 -0
  74. package/.claude/skills/cpp-testing/references/host-test-for-embedded.md +499 -0
  75. package/.claude/skills/cpp-testing/references/mocking.md +364 -0
  76. package/.claude/skills/cpp-testing/references/tdd-workflow.md +308 -0
  77. package/.claude/skills/cubesandbox/SKILL.md +148 -0
  78. package/.claude/skills/de-sloppify/SKILL.md +38 -0
  79. package/.claude/skills/de-sloppify/cleanup.mjs +253 -0
  80. package/.claude/skills/de-sloppify/cleanup.test.mjs +189 -0
  81. package/.claude/skills/embedded-esp-idf/README.md +41 -0
  82. package/.claude/skills/embedded-esp-idf/SKILL.md +439 -0
  83. package/.claude/skills/embedded-esp-idf/references/freertos-patterns.md +214 -0
  84. package/.claude/skills/embedded-esp-idf/references/host-tests.md +164 -0
  85. package/.claude/skills/embedded-esp-idf/references/idf-py-commands.md +157 -0
  86. package/.claude/skills/embedded-esp-idf/references/kconfig.md +159 -0
  87. package/.claude/skills/embedded-esp-idf/references/logging-discipline.md +118 -0
  88. package/.claude/skills/embedded-esp-idf/references/memory-and-iram.md +137 -0
  89. package/.claude/skills/embedded-esp-idf/references/nvs.md +121 -0
  90. package/.claude/skills/embedded-esp-idf/references/packed-structs.md +192 -0
  91. package/.claude/skills/embedded-esp-idf/scripts/idf_env.sh +47 -0
  92. package/.claude/skills/embedded-esp-idf/scripts/size_check.sh +77 -0
  93. package/.claude/skills/glyph/SKILL.md +163 -0
  94. package/.claude/skills/harness-engineering/SKILL.md +142 -0
  95. package/.claude/skills/lightrag/SKILL.md +81 -0
  96. package/.claude/skills/memory-protocol/SKILL.md +105 -0
  97. package/.claude/skills/obsidian/SKILL.md +306 -0
  98. package/.claude/skills/read-the-damn-docs/SKILL.md +113 -0
  99. package/.claude/skills/self-improvement/SKILL.md +64 -0
  100. package/.claude/skills/skillopt/SKILL.md +129 -0
  101. package/.claude/skills/thinking-archetypes/SKILL.md +90 -0
  102. package/.claude/skills/thinking-bayesian/SKILL.md +267 -0
  103. package/.claude/skills/thinking-bounded-rationality/SKILL.md +406 -0
  104. package/.claude/skills/thinking-circle-of-competence/SKILL.md +216 -0
  105. package/.claude/skills/thinking-cynefin/SKILL.md +70 -0
  106. package/.claude/skills/thinking-debiasing/SKILL.md +192 -0
  107. package/.claude/skills/thinking-dual-process/SKILL.md +282 -0
  108. package/.claude/skills/thinking-effectuation/SKILL.md +366 -0
  109. package/.claude/skills/thinking-feedback-loops/SKILL.md +464 -0
  110. package/.claude/skills/thinking-fermi-estimation/SKILL.md +263 -0
  111. package/.claude/skills/thinking-first-principles/SKILL.md +167 -0
  112. package/.claude/skills/thinking-five-whys-plus/SKILL.md +139 -0
  113. package/.claude/skills/thinking-inversion/SKILL.md +195 -0
  114. package/.claude/skills/thinking-jobs-to-be-done/SKILL.md +363 -0
  115. package/.claude/skills/thinking-kepner-tregoe/SKILL.md +154 -0
  116. package/.claude/skills/thinking-leverage-points/SKILL.md +390 -0
  117. package/.claude/skills/thinking-lindy-effect/SKILL.md +331 -0
  118. package/.claude/skills/thinking-map-territory/SKILL.md +111 -0
  119. package/.claude/skills/thinking-margin-of-safety/SKILL.md +330 -0
  120. package/.claude/skills/thinking-model-combination/SKILL.md +406 -0
  121. package/.claude/skills/thinking-model-router/SKILL.md +360 -0
  122. package/.claude/skills/thinking-model-selection/SKILL.md +341 -0
  123. package/.claude/skills/thinking-occams-razor/SKILL.md +129 -0
  124. package/.claude/skills/thinking-ooda/SKILL.md +127 -0
  125. package/.claude/skills/thinking-opportunity-cost/SKILL.md +360 -0
  126. package/.claude/skills/thinking-pre-mortem/SKILL.md +170 -0
  127. package/.claude/skills/thinking-probabilistic/SKILL.md +324 -0
  128. package/.claude/skills/thinking-red-team/SKILL.md +142 -0
  129. package/.claude/skills/thinking-regret-minimization/SKILL.md +335 -0
  130. package/.claude/skills/thinking-reversibility/SKILL.md +326 -0
  131. package/.claude/skills/thinking-scientific-method/SKILL.md +162 -0
  132. package/.claude/skills/thinking-second-order/SKILL.md +184 -0
  133. package/.claude/skills/thinking-socratic/SKILL.md +198 -0
  134. package/.claude/skills/thinking-steel-manning/SKILL.md +332 -0
  135. package/.claude/skills/thinking-systems/SKILL.md +238 -0
  136. package/.claude/skills/thinking-theory-of-constraints/SKILL.md +338 -0
  137. package/.claude/skills/thinking-thought-experiment/SKILL.md +354 -0
  138. package/.claude/skills/thinking-triz/SKILL.md +171 -0
  139. package/.claude/skills/thinking-via-negativa/SKILL.md +358 -0
  140. package/cli/install/postinstall.mjs +54 -28
  141. package/cli/install/postinstall.test.mjs +98 -0
  142. package/package.json +7 -2
@@ -0,0 +1,306 @@
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
+ version: 2
5
+ ---
6
+
7
+ # Bizar Memory Service — Project Knowledge
8
+
9
+ **The Bizar Memory Service is the project's persistent knowledge layer.** It replaces the disabled Hindsight MCP service. Every Bizar project uses the same three-layer architecture; only the backend mode (`local-only` vs `managed`) and the vault location differ.
10
+
11
+ The user has been working on this project — their notes contain the real context, the gotchas, the failed approaches, the preferred patterns. **Read the relevant vault entries before making any non-trivial decision.**
12
+
13
+ ## Quick Start for Agents
14
+
15
+ **First-time setup** (if `.bizar/memory.json` is missing):
16
+ ```bash
17
+ bizar memory setup --remote git@github.com:you/bizar-memory.git
18
+ bizar memory status # confirm vault reachable
19
+ bizar memory doctor # schema + secrets + git state
20
+ ```
21
+
22
+ Memory is accessed via the `bizar memory` CLI — agents have `bash: allow` and can invoke it directly.
23
+
24
+ **Find the vault root:**
25
+ ```bash
26
+ bizar memory status
27
+ ```
28
+
29
+ **Search memory:**
30
+ ```bash
31
+ bizar memory search "<query>"
32
+ ```
33
+
34
+ **Read a specific note:**
35
+ ```bash
36
+ # 1. List notes to find the path
37
+ bizar memory list 2>/dev/null || ls ~/.local/share/bizar/memory/bizar-memory/projects/<projectId>/
38
+ # 2. Read the note
39
+ cat ~/.local/share/bizar/memory/bizar-memory/projects/<projectId>/<relpath>
40
+ ```
41
+
42
+ **Write a new note:**
43
+ ```bash
44
+ bizar memory write <relpath> \
45
+ --type <type> \
46
+ --status active \
47
+ --confidence verified \
48
+ --tag <tag1> --tag <tag2> \
49
+ --body "<body text>"
50
+ ```
51
+
52
+ `<relpath>` is relative to the project namespace root (e.g. `decisions/0001-foo.md`). Do NOT include the `projects/<projectId>/` prefix — that double-nests.
53
+
54
+ **Commit and push (if shared vault):**
55
+ ```bash
56
+ bizar memory sync
57
+ ```
58
+
59
+ **Health check:**
60
+ ```bash
61
+ bizar memory doctor
62
+ ```
63
+
64
+ ## The three layers
65
+
66
+ | Layer | Role | Backed by | Write path |
67
+ |---|---|---|---|
68
+ | **Markdown** | Canonical truth | Obsidian-flavoured `.md` files on disk | Author writes here; this is the only layer that is authoritative |
69
+ | **Git** | Collaboration / history | The vault directory is a Git repo (local-only mode keeps it as a local repo with no remote) | The `bizar memory sync` orchestrator runs `git add/commit/push` after a write |
70
+ | **LightRAG** (Phase 2) | Derived search index | A LightRAG server (disabled by default in `memory.json`) | NEVER write here directly — always rebuild from Markdown via `bizar memory reindex` |
71
+
72
+ **Rule of thumb:** if you wanted to "update the project's memory," write Markdown. Git and LightRAG follow.
73
+
74
+ ## Vault location
75
+
76
+ The root of the vault is determined by `.bizar/memory.json` in the active project. Two modes:
77
+
78
+ - **`local-only` (default)** — vault is `.obsidian/` inside this project. Single-machine. Stays out of any cross-project repo. Use this when the project is solo or when the project itself is private.
79
+ - **`managed`** — vault is `~/.local/share/bizar/memory/<repoName>/` (a user-level shared repo). Multiple projects contribute to the same Git repo under per-project namespaces. Use this when you want cross-project search and a single source of truth across all your Bizar projects.
80
+
81
+ `bizar memory status` prints the active mode and resolved paths; `bizar memory doctor` validates the vault is reachable and the Git state is consistent.
82
+
83
+ ## The three namespaces
84
+
85
+ Namespaces live at the vault root. Pick a namespace by deciding the SCOPE of the note, not the project.
86
+
87
+ | Namespace | Path (under vault root) | When to write here |
88
+ |---|---|---|
89
+ | **project** | `projects/<projectId>/` | Anything specific to THIS project — design decisions, postmortems, agent-tuning notes, project-local gotchas, daily logs of what happened in this repo |
90
+ | **global** | `global/bizar/` | Anything that applies to Bizar AS A SYSTEM, regardless of project — agent patterns, model-routing rules, CLI conventions, cross-project gotchas that should reach every project you work on |
91
+ | **user** | `users/<userId>/` | Anything that is purely personal — your preferences, your scratch notes, your "things I keep forgetting" |
92
+
93
+ Resolution rule: **memory root = `~/.local/share/bizar/memory/<repoName>/` (or `.obsidian/`) + the namespace you picked**. The `projectId` is the basename of the project root (e.g. `bizar` for `/path/to/bizar`); the `userId` is the OS username.
94
+
95
+ When in doubt, write to **project**. Promote to **global** only when the pattern repeats across another project; demote to **user** only when it's purely personal preference.
96
+
97
+ ## How to read vault entries
98
+
99
+ ### Via the dashboard REST API (canonical)
100
+
101
+ ```bash
102
+ # List notes under a namespace
103
+ curl -s http://127.0.0.1:4321/api/memory/notes?namespace=projects/bizar | jq
104
+
105
+ # Read a specific note (returns parsed frontmatter + body)
106
+ curl -s http://127.0.0.1:4321/api/memory/notes/projects/bizar/Architecture.md | jq
107
+
108
+ # Full-text search (Markdown content + frontmatter)
109
+ curl -s -X POST http://127.0.0.1:4321/api/memory/search \
110
+ -H 'Content-Type: application/json' \
111
+ -d '{"query":"router ordering","namespace":"projects/bizar"}' | jq
112
+ ```
113
+
114
+ ### Via the CLI
115
+
116
+ ```bash
117
+ bizar memory search "router ordering" # full-text search
118
+ bizar memory status # show mode + paths + git status
119
+ bizar memory doctor # health check
120
+ bizar memory log --tail 20 # recent operations log
121
+ bizar memory conflicts # list notes with status=conflict
122
+ ```
123
+
124
+ ## Operations
125
+
126
+ - **Open in Obsidian**: `/kb` — opens the project vault in Obsidian (resolves
127
+ from .bizar/memory.json; falls back to printing the path if Obsidian isn't
128
+ installed)
129
+
130
+ ### Via direct file read (acceptable for one-off reads)
131
+
132
+ ```bash
133
+ # local-only
134
+ cat .obsidian/projects/<projectId>/Architecture.md
135
+
136
+ # managed
137
+ cat ~/.local/share/bizar/memory/bizar-memory/projects/<projectId>/Architecture.md
138
+ ```
139
+
140
+ Direct reads bypass the dashboard, which is fine for diagnostics. Bypass the dashboard for writes too ONLY in an emergency (CI recovery, hook-driven bots) — always prefer the API for agent-driven writes so the schema, secret scan, and Git sync run.
141
+
142
+ ## How to write vault entries
143
+
144
+ ### Via the dashboard REST API (canonical)
145
+
146
+ ```bash
147
+ # Write or update a note — the API validates schema, scans for secrets, and
148
+ # runs the sync orchestrator (git commit) if memory.json.git.autoCommit is on.
149
+ curl -s -X POST http://127.0.0.1:4321/api/memory/notes \
150
+ -H 'Content-Type: application/json' \
151
+ -d '{
152
+ "path": "projects/bizar/adr/0001-router-ordering.md",
153
+ "namespace": "projects/bizar",
154
+ "frontmatter": {
155
+ "title": "Router ordering: Forseti before Tier 4/5",
156
+ "type": "architecture_decision",
157
+ "status": "active",
158
+ "confidence": "verified",
159
+ "date": "2026-06-29",
160
+ "tags": ["router", "agents"]
161
+ },
162
+ "body": "## Context\n...\n## Decision\n...\n## Consequences\n..."
163
+ }'
164
+
165
+ # LightRAG reindex — NEVER run during a write. Schedule from the
166
+ # orchestrator or run manually after a batch of writes.
167
+ curl -s -X POST http://127.0.0.1:4321/api/memory/reindex \
168
+ -H 'Content-Type: application/json' \
169
+ -d '{"namespace":"projects/bizar"}'
170
+ ```
171
+
172
+ The rich shape (path, namespace, frontmatter, body) is the canonical write. The legacy `/api/obsidian/notes` endpoint accepts the same body wrapped as `{ content: "<frontmatter + body>", path, namespace }` for back-compat.
173
+
174
+ ### Via the CLI
175
+
176
+ ```bash
177
+ bizar memory write "<path>" # opens $EDITOR for the body
178
+ bizar memory sync # git add/commit/push the staged notes
179
+ bizar memory commit -m "adr: 0001 router ordering"
180
+ bizar memory pull # fetch + rebase from configured remote
181
+ bizar memory push # push committed notes to remote
182
+ bizar memory reindex # rebuild LightRAG from Markdown (Phase 2)
183
+ bizar memory conflicts # human review surface for status=conflict
184
+ ```
185
+
186
+ ## When to read
187
+
188
+ - **At the start of every session** — skim the project namespace's index entries (`index/`, `_index.md`, anything tagged `type: project_index`).
189
+ - **Before any non-trivial implementation decision** — search the relevant namespace for prior art.
190
+ - **When you're about to suggest something the user has already tried** — search before recommending.
191
+ - **When the codebase feels like it's working around something you don't understand** — there's probably a vault entry explaining the why.
192
+ - **When you encounter a `// FIXME` or `// HACK` comment** — there's probably a vault entry explaining it.
193
+ - **Before claiming a pattern is "the Bizar way"** — global namespace might say otherwise.
194
+
195
+ ## When to write
196
+
197
+ - **After completing a meaningful piece of work** — what was decided, what was learned, what the consequences were.
198
+ - **On discovering a bug or postmortem** — `type: bug_postmortem` with the root cause, evidence links, and the fix.
199
+ - **When you find a pattern that should be reused** — `type: pattern`, with the rationale and a code snippet.
200
+ - **When the user corrects you** — `type: lesson_learned` with what was wrong, why, and the new rule.
201
+ - **When you make a design decision that should be remembered** — `type: architecture_decision` (the classic ADR format).
202
+ - **When you encode an active rule** that future sessions should follow — `type: active_rule`, and (importantly) also add it to `.bizar/AGENTS_SELF_IMPROVEMENT.md` under "Active Rules" so the orchestrator picks it up before vault lookups.
203
+
204
+ ## Write categories (matches the 11 schema `type` values)
205
+
206
+ | type | Use when |
207
+ |---|---|
208
+ | `architecture_decision` | ADR — context, decision, consequences |
209
+ | `pattern` | Reusable approach with code example |
210
+ | `lesson_learned` | A mistake or surprise the next agent should not repeat |
211
+ | `bug_postmortem` | Root-cause analysis of an actual bug, with evidence |
212
+ | `active_rule` | A standing rule for this project (mirror in `.bizar/AGENTS_SELF_IMPROVEMENT.md`) |
213
+ | `agent_memory` | Per-agent history — what THIS agent learned across sessions |
214
+ | `project_index` | Top-level entry points (`Architecture`, `Conventions`, `Entry-Points`) |
215
+ | `reference` | External API docs, tool notes, library gotchas |
216
+ | `workflow` | Multi-step procedure with prerequisites + steps + verification |
217
+ | `note` | Free-form scratch that doesn't fit another category |
218
+ | `adr` | Alias for `architecture_decision` (kept for legacy writers) |
219
+
220
+ ## Status values (frontmatter `status`)
221
+
222
+ | status | Meaning | When to use |
223
+ |---|---|---|
224
+ | `active` | Current truth | The note still reflects reality |
225
+ | `draft` | Work in progress | Agent is still thinking; do not auto-commit |
226
+ | `superseded` | Replaced by a newer note | **Always link `superseded_by` to the replacement** |
227
+ | `stale` | Probably outdated | Needs human review — the orchestrator tags these after a `--reindex` heuristic |
228
+ | `conflict` | Two versions disagree | **Requires human resolution** — never auto-resolve |
229
+ | `archived` | Kept for history, not searched | Visible only with explicit namespace filter |
230
+
231
+ ## Confidence values (frontmatter `confidence`)
232
+
233
+ | confidence | Meaning | Rule |
234
+ |---|---|---|
235
+ | `verified` | Proven with evidence | Always link the evidence file in the note body (`path:line` citation) |
236
+ | `inferred` | Likely true but unproven | Phrase the body as "appears to be" / "based on X, looks like" |
237
+ | `speculative` | Hypothesis to test | Mark with `type: pattern` and a clear "to verify" section |
238
+
239
+ **Prefer `verified`.** A note with no evidence is a hypothesis at best. The schema rejects writes missing required fields for `architecture_decision` and `lesson_learned`.
240
+
241
+ ## Conflict handling
242
+
243
+ The service NEVER auto-resolves a conflict. When the same path is written from two sources (e.g. local edit + remote pull that doesn't fast-forward), the orchestrator:
244
+
245
+ 1. Renames the incoming version to `<path>.conflict-<timestamp>.md`.
246
+ 2. Sets BOTH versions' `status: conflict`.
247
+ 3. Exits non-zero so the user can review.
248
+ 4. Lists both in `bizar memory conflicts`.
249
+
250
+ Human resolution:
251
+
252
+ 1. Read both versions.
253
+ 2. Decide which is canonical (usually the more recent or more evidence-backed).
254
+ 3. Edit the losing version: `status: superseded`, set `superseded_by: <winning-path>`, add a `## Why this was superseded` section.
255
+ 4. `bizar memory sync` to commit the resolution.
256
+
257
+ Never delete a superseded note — history matters.
258
+
259
+ ## Secret scanning (commit gate)
260
+
261
+ `bizar memory commit` (and the auto-commit path during a write) runs the secret scanner over the staged Markdown. Severities:
262
+
263
+ - **HIGH** — real API keys, bearer tokens, PEM blocks, password= assignments → **BLOCKS the commit**. Fix the leak first, then commit. Use `.template` files and `.gitignore` for live secrets (see `.bizar/AGENTS_SELF_IMPROVEMENT.md` rule #4 for the token-leak history).
264
+ - **MEDIUM** — credential-like patterns (e.g. `ghp_*` with weak validation), obvious test fixtures that could be mistaken for real keys → warns. Commit proceeds unless `--strict`.
265
+ - **LOW** — possible PII, dev URLs on non-public hosts → informational.
266
+
267
+ Override flags: `--allow-secrets` (HIGH-bypass), `--strict` (LOW-becomes-warning). Never use `--allow-secrets` to ship a real credential — fix the secret in the source, not the gate.
268
+
269
+ ## Markdown conventions (Obsidian-flavoured)
270
+
271
+ - **Frontmatter is YAML** between the leading and trailing `---` lines. Required keys depend on `type`; the validator in `memory-schema.mjs` enforces this.
272
+ - **`[[wikilinks]]`** point at note paths relative to the vault root (e.g. `[[projects/bizar/Architecture]]`, not `[[Architecture]]`).
273
+ - **Tag lists** (`tags: [a, b]`) drive search; keep them short and concrete.
274
+ - **Code blocks** with language tags survive parsing — use them for snippets longer than 2 lines.
275
+ - **Callouts** (`> [!note]`, `> [!warning]`) are preserved; use `> [!danger]` for HIGH-severity warnings.
276
+ - **Status emojis** are noise — keep notes emoji-free unless the user has put one in the frontmatter.
277
+
278
+ ## Sync model
279
+
280
+ The vault directory is a Git repo. `bizar memory sync` does, in order:
281
+
282
+ 1. **Pull** — `git fetch` and `git rebase` from the configured remote (no-op for local-only).
283
+ 2. **Schema check** — every staged file is validated by the schema in `memory-schema.mjs`. Bad files become `untracked` until fixed.
284
+ 3. **Secret scan** — staged content is scanned; HIGH blocks, MEDIUM warns.
285
+ 4. **Stage** — `git add` of all Markdown under the vault root.
286
+ 5. **Commit** — `git commit` with `commitMessageTemplate` (default `memory({projectId}): {summary}`).
287
+ 6. **Push** — only if `memory.json.git.autoPushOnSessionEnd` is true.
288
+
289
+ `autoCommitOnMemoryWrite` defaults to `false` — writes return success without committing. The user reviews and runs `bizar memory sync` themselves. This is the default for production deployments.
290
+
291
+ ## What NOT to write
292
+
293
+ - **Secrets, API keys, tokens** — the secret scanner blocks them, but defense in depth: never produce them in the first place.
294
+ - **Temporary scratch that won't be useful in 7 days** — keep that in a TODO comment in code, not the vault.
295
+ - **Long code dumps** — link with `path:line` so the note stays a living doc. Two-line snippets are fine.
296
+ - **Anything already obvious from reading the code** — the vault is for things code CAN'T say.
297
+ - **Notes that are already in another namespace** — search before writing to avoid duplicates; if you must mirror, link with `mirror_of: <other-path>`.
298
+
299
+ ## See also
300
+
301
+ - `.bizar/AGENTS_SELF_IMPROVEMENT.md` — project-specific active rules (read before vault lookups).
302
+ - `.bizar/PROJECT.md` — stack, conventions, entry points (Vör reads this first).
303
+ - `wiki/Architecture.md` — system-level architecture, including the Memory section.
304
+ - `wiki/Self-Improvement.md` — self-improvement log conventions.
305
+ - `config/skills/glyph/SKILL.md` — graphify knowledge graph (separate from the memory vault).
306
+ - `config/skills/obsidian-skills/SKILL.md` — Obsidian Markdown / Bases / Canvas / CLI (auto-installed by `install.sh` via `skills add kepano/obsidian-skills`).
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: read-the-damn-docs
3
+ description: When using a library, tool, or API you don't fully understand, READ THE DOCS before guessing. Don't infer behavior from function names. The source of truth is the official documentation and source code, not your prior assumptions.
4
+ version: 1
5
+ ---
6
+
7
+ # Read the Damn Docs
8
+
9
+ When you reach for a library, tool, or API you haven't used recently (or ever), **read the actual documentation** before writing code. Don't guess. Don't infer from function names. Don't assume "it probably works like X". The source of truth is the docs, then the source code, then examples. Everything else is noise.
10
+
11
+ ## Why this skill exists
12
+
13
+ LLMs are confidently wrong. They have a strong prior for "this is what libraries usually look like" — and that prior is sometimes right but often subtly wrong. Common failure modes:
14
+
15
+ - "The function is called `parseFoo` so it probably takes a string and returns an object" — wrong, it takes `{format, version}` and returns a promise
16
+ - "I'll just try it and see what error comes back" — wastes a turn, often hallucinates the fix
17
+ - "The README has an example, that's enough" — examples are cherry-picked; edge cases will bite you
18
+
19
+ The fix: spend 30-90 seconds reading the docs first. The cost is a single tool call. The benefit is a correct first attempt.
20
+
21
+ ## Hierarchy of truth
22
+
23
+ When resolving how a library/tool/API works, use this priority order:
24
+
25
+ 1. **Official documentation** (the canonical reference) — most authoritative
26
+ 2. **Source code** (the actual implementation) — definitive when docs are vague
27
+ 3. **Examples** (in the docs or repo) — show typical use, but don't trust edge cases
28
+ 4. **StackOverflow / GitHub issues** — useful for known footguns
29
+ 5. **Your prior model** — last resort, often wrong
30
+
31
+ **Stop at step 1 unless the docs are unclear.** If they are, drop to step 2.
32
+
33
+ ## Practical workflow
34
+
35
+ ```
36
+ 1. IDENTIFY: "I'm about to use library X for the first time (or first time in months)"
37
+ 2. READ: webfetch the official docs for the specific function/method I'll call
38
+ - Don't read the entire docs — read the specific section
39
+ 3. VERIFY: cross-check against source if anything is ambiguous
40
+ 4. NOTE: write down the gotchas in your agent memory or a relevant file
41
+ 5. USE: now write the code, knowing the actual API
42
+ ```
43
+
44
+ ## When to invoke this skill
45
+
46
+ Use it whenever:
47
+
48
+ - You're using a library you haven't touched in this session
49
+ - You're using a function/method whose exact signature you don't remember
50
+ - The function name is misleading or you have low confidence
51
+ - You're upgrading to a new major version of a library
52
+ - You're switching between similar libraries (axios vs fetch, etc.)
53
+ - You're using a CLI tool you don't have muscle memory for
54
+ - You're hitting an error you don't recognize and "guessing" the fix
55
+
56
+ ## Anti-patterns
57
+
58
+ ### "I'll just try it"
59
+
60
+ Don't write code, run it, see the error, and fix from there. That works for trivial cases but burns turns on anything non-trivial. Read the docs first.
61
+
62
+ ### "The function name tells me what it does"
63
+
64
+ `Array.prototype.flatMap`, `Promise.allSettled`, `fs.opendirSync` — names are hints, not specs. The actual behavior (sync vs async, return shape, error cases) is in the docs.
65
+
66
+ ### "I used this library before, I know it"
67
+
68
+ Libraries change. APIs deprecate. Defaults shift. Even if you used something 6 months ago, a pam doc check (30 seconds) saves 10 minutes of debugging when your prior knowledge is stale.
69
+
70
+ ### "The README example is enough"
71
+
72
+ README examples are demos, not documentation. They show one happy path. The real API has edge cases, error modes, and options that aren't in the example.
73
+
74
+ ### "The error message is enough to fix it"
75
+
76
+ Sometimes. But error messages are often misleading or incomplete. Reading the docs for the function that errored often reveals the actual constraint.
77
+
78
+ ## Examples
79
+
80
+ ### Good: Read first
81
+
82
+ ```
83
+ [Agent wants to use the Vite `defineConfig` API for the first time]
84
+ Agent: "Let me check the Vite docs for the exact shape of `defineConfig`."
85
+ [webfetch https://vitejs.dev/config/]
86
+ Agent: "OK, `defineConfig` accepts a UserConfig object with `plugins`, `build`, etc.
87
+ I need a `define` key for compile-time constants."
88
+ [Writes correct config]
89
+ ```
90
+
91
+ ### Bad: Guess
92
+
93
+ ```
94
+ [Agent wants to use the Vite `defineConfig` API for the first time]
95
+ Agent: "defineConfig is probably a function that takes a config object with
96
+ common options like plugins and build. Let me just write it."
97
+ [Writes config with `define: { __VERSION__: '1.0' }`]
98
+ [Runs vite build, gets a warning about an unexpected option]
99
+ Agent: "Hmm, the docs must have changed. Let me guess it's a different syntax."
100
+ [Wastes 2-3 turns guessing before reading the docs]
101
+ ```
102
+
103
+ ## Where to read
104
+
105
+ - **Webfetch** the official docs URL: `webfetch <url>` — fast, gives you the actual current docs
106
+ - **Source code** via Semble search: `semble search "functionName" <repo>` — useful when docs are vague
107
+ - **Local docs** if available: `semble search "<query>" --content docs` for the project's own docs
108
+
109
+ ## See also
110
+
111
+ - [[obsidian]] — write postmortems and patterns to the project vault
112
+ - [[glyph]] — create a glyph when the design decision is non-trivial
113
+ - The agent baseline — `simplest thing that works` rule
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: self-improvement
3
+ description: Use when setting up, configuring, or debugging the project-level self-improvement system. Every task records lessons learned to .bizar/AGENTS_SELF_IMPROVEMENT.md for agent behavior improvement across sessions.
4
+ ---
5
+
6
+ # Self Improvement
7
+
8
+ Project-level learning system. Every task records what worked, what didn't, and what patterns to follow next time — stored in `.bizar/AGENTS_SELF_IMPROVEMENT.md` at the project root.
9
+
10
+ ## How It Works
11
+
12
+ 1. **Session start**: Odin reads `.bizar/AGENTS_SELF_IMPROVEMENT.md` from project root and factors active rules into routing
13
+ 2. **During work**: Agents follow documented patterns and avoid previously-caught mistakes
14
+ 3. **Task completion**: Odin dispatches @brenda to append a structured entry to the file
15
+ 4. **Next session**: The cycle repeats — agents get smarter over time
16
+
17
+ ## File Format
18
+
19
+ The file lives at `<project-root>/.bizar/AGENTS_SELF_IMPROVEMENT.md`. Structure:
20
+
21
+ ```markdown
22
+ # Self Improvement
23
+
24
+ ## Active Rules
25
+ <!-- Keep top 5-10 actionable patterns here. Extract from recent entries. -->
26
+
27
+ ## Log
28
+
29
+ ### 2026-06-16: Brief descriptive title
30
+ - **Context**: What was the task
31
+ - **Lesson**: What we learned
32
+ - **Pattern**: What to do next time
33
+ - **Files**: src/foo.ts, src/bar.ts
34
+ - **Agent**: todd, karen
35
+ ```
36
+
37
+ ## Entry Rules for Agents
38
+
39
+ When writing an entry:
40
+
41
+ - **File per project** — `.bizar/AGENTS_SELF_IMPROVEMENT.md` at the root of whatever project you're working in
42
+ - **If file doesn't exist**, create it with the header template
43
+ - **Entry format**: H3 date header, bullet list with Context, Lesson, Pattern, Files, Agent
44
+ - **Active Rules**: At the top, keep 5-10 distilled patterns from recent entries. If adding a new entry makes it necessary, add a rule too or promote a pattern from an entry.
45
+ - **Deduplicate**: Don't repeat the same lesson. If the same lesson comes up again, update the existing entry's date instead.
46
+ - **Be specific**: "Always use strictNullChecks" not "TypeScript is good"
47
+ - **Agent tag**: Use the subagent name (todd, karen, brenda, greg, etc.)
48
+
49
+ ## Setup
50
+
51
+ For a new project where no such file exists yet, create the initial file:
52
+
53
+ ```
54
+ # Self Improvement
55
+
56
+ Template for project-specific agent learning. Entries are auto-appended by Odin
57
+ at task completion and read at session start.
58
+
59
+ ## Active Rules
60
+
61
+ <!-- Top 5-10 actionable patterns extracted from recent entries -->
62
+
63
+ ## Log
64
+ ```
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: skillopt
3
+ description: Microsoft's SkillOpt trains skill files via rollouts + reflection against a frozen target model. Install with `pip install skillopt` and produce a `best_skill.md`. Always human-review.
4
+ ---
5
+
6
+ # SkillOpt Workflow
7
+
8
+ ## Overview
9
+
10
+ SkillOpt (microsoft/SkillOpt, MIT-licensed) is a Microsoft Research Python tool that **optimizes skill files for a specific target model**. Given a starting `SKILL.md`, a target model (frozen), a benchmark of inputs, and a reward signal, SkillOpt runs a rollout → reflect → aggregate → select → update → evaluate loop and emits a `best_skill.md` artifact that scores higher against the held-out validation gate.
11
+
12
+ It is *not* a general prompt editor and *not* a free-form rewriting tool. It is a closed-loop optimizer: it changes the skill text, runs the agent under the new skill against the benchmark, measures reward, and keeps mutations that improve the score.
13
+
14
+ **Core Principle:** SkillOpt trains a skill file the way you'd fine-tune a model — with a held-out validation gate, a frozen target, and a reward signal — not by hand-tweaking prose. Don't commit the output without human review; treat `best_skill.md` as a candidate, not a verdict.
15
+
16
+ ## When to Use
17
+
18
+ - A skill's quality is measurably degrading on a benchmark (success rate dropping, regression in eval)
19
+ - You have a benchmark of representative inputs and a reward signal (task success / rubric score / pass-rate)
20
+ - You want to A/B a new skill variant against the current one against the same target model
21
+ - A skill has grown organically past ~200 lines and you suspect prose bloat is hurting recall
22
+
23
+ Decision flow:
24
+
25
+ ```
26
+ Skill quality question?
27
+ → Do you have a benchmark + reward + frozen target model? → no → DON'T RUN SKILLOPT (you can't measure without them)
28
+ → Is the skill underperforming on the gate? → no → no work to do
29
+ → Yes to both → see the 6-phase loop below
30
+ ```
31
+
32
+ ## When NOT to Use
33
+
34
+ - **No benchmark, no reward, no frozen target.** SkillOpt needs all three. If any is missing, the loop has nothing to optimize against — you'll burn compute on something you can't evaluate. Compose the benchmark first or skip SkillOpt entirely.
35
+ - **For a one-off skill polish.** SkillOpt is a multi-rollout loop with token cost on the order of dozens to hundreds of completions. For "rewrite this paragraph to be clearer," edit the skill by hand. Reach for SkillOpt when you have evidence the skill underperforms and a way to measure the fix.
36
+ - **On a non-frozen target model.** If the target model is updating daily, the rollout scores are non-reproducible and the held-out gate stops meaning anything. Pin the model version and don't retrain against a moving target.
37
+ - **Without human review of `best_skill.md`.** SkillOpt optimizes the reward signal — that is not the same as "is this skill correct, well-bounded, and aligned with what we want the agent to do." A skill that scores higher on the rubric can still be narrower, more brittle, or subtly off-vibe. Always review before committing.
38
+
39
+ ## The 6-Phase Loop
40
+
41
+ ```
42
+ ┌─ Phase 1: Rollout ─ run the agent under the current skill against benchmark inputs
43
+
44
+ ├─ Phase 2: Reflect ─ for each rollout, capture which skill instructions helped vs hurt
45
+
46
+ ├─ Phase 3: Aggregate ─ across all rollouts, find recurring failure modes and structural patterns
47
+
48
+ ├─ Phase 4: Select ─ choose one mutation hypothesis (a concrete edit) to try next
49
+
50
+ ├─ Phase 5: Update ─ apply the mutation to produce a candidate skill
51
+
52
+ └─ Phase 6: Evaluate ─ run the candidate against the HELD-OUT validation set; keep if it improves, drop if not
53
+ ↑ │
54
+ └────────────── next iteration reuses the kept variant ─────────┘
55
+ ```
56
+
57
+ ### Phase 1 — Rollout
58
+
59
+ Run the agent under the **frozen target model** with the current skill against the benchmark. Capture outputs + per-input scores. Don't peek at the validation set during this phase.
60
+
61
+ ### Phase 2 — Reflect
62
+
63
+ For each rollout, ask: which lines of the skill contributed to the success or failure? Mark helpful / neutral / harmful spans. This is the closest you get to a teacher signal without a human labeler.
64
+
65
+ ### Phase 3 — Aggregate
66
+
67
+ Across all rollouts this iteration, find the recurring failure modes. If 4 of 5 failures on a particular input pattern come from the same missing instruction in the skill, that's the highest-leverage next mutation.
68
+
69
+ ### Phase 4 — Select
70
+
71
+ Pick **one** mutation to try. SkillOpt is not a search-and-replace shotgun; it's one edit per round. Co-edits entangle effects and make the held-out gate stop carrying signal.
72
+
73
+ ### Phase 5 — Update
74
+
75
+ Apply the mutation. Save the candidate as a sibling file (e.g. `candidate-3.md`); never overwrite `SKILL.md` mid-loop.
76
+
77
+ ### Phase 6 — Evaluate
78
+
79
+ Run the candidate against the **held-out validation set** (never been seen during Phases 1–5). If it improves the held-out gate, promote it to the next iteration's starting point. If it regresses, drop it and try a different mutation. Do not cherry-pick from a known input; the held-out gate is what makes the loop trustworthy.
80
+
81
+ ## How Bizar Agents Use It
82
+
83
+ ```bash
84
+ # 1. Install (do this once per machine)
85
+ pip install skillopt
86
+
87
+ # 2. Set up a benchmark directory (you write this — SkillOpt doesn't generate it)
88
+ # benchmark/
89
+ # ├── inputs.jsonl # one prompt per line, hold-out set included
90
+ # ├── reward.py # your scoring fn: takes (prompt, completion) → float
91
+ # └── target_model.json # the frozen target model spec (id + version pin)
92
+
93
+ # 3. Run the loop against a draft skill
94
+ python -m skillopt.cli optimize \
95
+ --skill config/skills/thinking-some-skill/SKILL.md \
96
+ --benchmark ./benchmark \
97
+ --out ./skillopt-out
98
+
99
+ # 4. Inspect the output before committing anything
100
+ ls skillopt-out/
101
+ cat skillopt-out/best_skill.md
102
+ diff config/skills/thinking-some-skill/SKILL.md skillopt-out/best_skill.md
103
+
104
+ # 5. If the diff is genuinely better (held-out improvement + human review passes),
105
+ # replace the source. Otherwise discard and tune the benchmark.
106
+ cp skillopt-out/best_skill.md config/skills/thinking-some-skill/SKILL.md
107
+ ```
108
+
109
+ We do **not** vendor SkillOpt into the Bizar JS harness — the tool lives in Python (`pip install skillopt`), runs offline, and writes a markdown artifact. The Bizar loop is: write draft → run SkillOpt → human review `best_skill.md` → commit if better.
110
+
111
+ ## Pitfalls
112
+
113
+ - **Don't retrain daily.** The target model is frozen for a reason; if your benchmark doesn't drift, the skill shouldn't either. Bumping SkillOpt runs on every PR turns the skill into a moving target the agent can't build a stable intuition against.
114
+ - **Don't bypass the held-out gate.** It's tempting to "peek" at validation items to bias the mutation — that converts the loop into a curve-fit on a small set and the held-out number stops meaning anything. Hold-out integrity is the whole point.
115
+ - **Never auto-commit `best_skill.md`.** It is a *candidate*. The reward signal optimizes task success; it does not optimize for tone, scope, or alignment with sibling skills in the same family. A/B test in shadow, then promote deliberately.
116
+ - **Don't use SkillOpt on skills you don't have a benchmark for.** If the input space and reward are unknown, you're optimizing prose against nothing and will learn something — just not something useful.
117
+ - **Don't optimize `thinking-*` skills together as one bundle.** They share front-matter shape but address different problem types; co-optimizing entangles their effects and makes individual improvements hard to attribute.
118
+
119
+ ## Relationship to Bizar's Existing Skill Pipeline
120
+
121
+ | Concern | Owner |
122
+ |---|---|
123
+ | What skills ship | `config/skills/<name>/SKILL.md` (canonical, provisioned) |
124
+ | Provision to user | `cli/provision.mjs:syncConfigExtras` + `writeBizarSkillLock` |
125
+ | Skill discovery at runtime | `~/.claude/skills/<name>/SKILL.md` (provisioned mirror) |
126
+ | Offline quality loop | SkillOpt (this skill) — run on a draft, produce `best_skill.md`, human-promote |
127
+ | Editing prose by hand | You + your editor — fine for one-off tweaks, don't loop it |
128
+
129
+ SkillOpt is a **research-quality tool** for the rare case where you have the benchmark, the reward, and the time. For 90% of skill edits, just write it well.