@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,330 @@
1
+ ---
2
+ name: thinking-margin-of-safety
3
+ description: Use when provisioning capacity, setting a timeout/limit, or committing to an estimate under uncertainty. Size a buffer to the cost of being wrong instead of optimizing to the edge.
4
+ ---
5
+
6
+ # Margin of Safety
7
+
8
+ ## Overview
9
+
10
+ Margin of Safety, borrowed from Benjamin Graham's investment philosophy and structural engineering, is the practice of building in buffers to account for unknown unknowns. In a world of uncertainty, systems optimized to the edge are brittle. Robust systems have slack, reserves, and room for error.
11
+
12
+ **Core Principle:** Build in buffers. The world is uncertain. Systems without margin fail when stressed.
13
+
14
+ ## When to Use
15
+
16
+ - Capacity planning
17
+ - Deadline and timeline estimation
18
+ - Architecture design
19
+ - Resource allocation
20
+ - Risk management
21
+ - SLA commitments
22
+ - Infrastructure provisioning
23
+ - Any commitment under uncertainty
24
+
25
+ Decision flow:
26
+
27
+ ```
28
+ Provisioning, setting a limit, or committing an estimate under uncertainty?
29
+ → Is there real uncertainty AND a cost to under-provisioning? → yes → SIZE A BUFFER TO THE FAILURE COST
30
+ → Are you optimizing to the edge to save a little? → yes → ADD SLACK unless the breach is cheap
31
+ → Estimate could be 2x off? → factor that into the buffer
32
+ ```
33
+
34
+ ## When NOT to Use
35
+
36
+ - **Cheap, instant, and reversible to adjust.** If under-provisioning is detected immediately and fixed at near-zero cost (auto-scaling that reacts in seconds, a limit you can bump live), a fat static buffer just wastes resources — let the system absorb it.
37
+ - **The buffer's cost exceeds the expected breach cost.** Margin isn't free; when `cost(buffer) > probability(breach) × cost(breach)`, the buffer is the wrong call. Right-size, don't max out.
38
+ - **You can eliminate the uncertainty instead of padding it.** If the real number is measurable or lookup-able, get it — a measured value beats a padded guess. (Margin covers *residual* uncertainty, not laziness about checking.)
39
+ - **This is a stopping-criterion problem, not a buffer problem.** If the question is "how long do I keep searching/optimizing?", that's `thinking-bounded-rationality` (set a good-enough threshold), not margin. *Margin sizes the buffer on a number; bounded-rationality decides when to stop looking for the number.*
40
+
41
+ ## Trigger Card
42
+
43
+ When provisioning capacity, setting a limit, or committing to an estimate under uncertainty:
44
+
45
+ 1. **Estimate the base number** — what's your best estimate without padding?
46
+ 2. **Assess the cost of being wrong** — if you undershoot, what breaks and how badly? The higher the cost, the larger the margin.
47
+ 3. **Size the buffer to the uncertainty** — add enough margin that the worst plausible miss doesn't cause a catastrophe. Commit with the buffered number.
48
+
49
+ If you can eliminate the uncertainty by measuring or looking up the real number, do that instead — a measured value beats a padded guess. If the question is "when do I stop searching?", that's `thinking-bounded-rationality`, not margin.
50
+
51
+ ## The Margin of Safety Framework
52
+
53
+ ### Step 1: Identify Your Estimate
54
+
55
+ What's your best guess for the requirement?
56
+
57
+ ```
58
+ Estimate: Need 100 requests/second capacity
59
+ Estimate: Project will take 6 weeks
60
+ Estimate: Need 500GB storage for year 1
61
+ ```
62
+
63
+ ### Step 2: Quantify Your Uncertainty
64
+
65
+ How confident are you, and what could you be missing?
66
+
67
+ ```markdown
68
+ ## Uncertainty Analysis
69
+
70
+ | Factor | Your Estimate | Uncertainty | Possible Range |
71
+ |--------|---------------|-------------|----------------|
72
+ | Traffic | 100 RPS | ±50% | 50-150 RPS |
73
+ | Spike multiplier | 3x | ±100% | 1.5x-6x |
74
+ | Growth rate | 20%/year | ±50% | 10-30%/year |
75
+ | Unknown unknowns | - | +50-100% | - |
76
+ ```
77
+
78
+ ### Step 3: Calculate Required Margin
79
+
80
+ Different contexts need different margins:
81
+
82
+ | Context | Typical Margin | Rationale |
83
+ |---------|---------------|-----------|
84
+ | Capacity planning | 2-3x | Traffic spikes unpredictable |
85
+ | Time estimation | 1.5-2x | Everything takes longer |
86
+ | Infrastructure | 2x headroom | Scaling takes time |
87
+ | SLA commitment | 1.5x buffer | Reputation at stake |
88
+ | New/unknown domain | 2-3x | High uncertainty |
89
+ | Well-understood domain | 1.3-1.5x | Lower uncertainty |
90
+
91
+ ### Step 4: Apply Margin
92
+
93
+ ```
94
+ Base estimate: 100 RPS
95
+ Margin: 2x (moderate uncertainty, spikes possible)
96
+ Provision: 200 RPS capacity
97
+
98
+ Base estimate: 6 weeks
99
+ Margin: 1.5x (experienced team, some unknowns)
100
+ Commit: 9 weeks
101
+ ```
102
+
103
+ ### Step 5: Monitor and Adjust
104
+
105
+ Track actuals against estimates to calibrate future margins:
106
+
107
+ ```markdown
108
+ ## Calibration Log
109
+
110
+ | Estimate | Margin Applied | Actual | Margin Accuracy |
111
+ |----------|----------------|--------|-----------------|
112
+ | 100 RPS | 2x (200) | 180 | Adequate |
113
+ | 6 weeks | 1.5x (9) | 10 weeks | Insufficient |
114
+ | 500 GB | 2x (1TB) | 400 GB | Excessive |
115
+
116
+ Insight: Time estimates need higher margin; storage was overprovisioned
117
+ ```
118
+
119
+ ## Margin Patterns
120
+
121
+ ### Capacity Margin
122
+
123
+ ```markdown
124
+ ## Capacity Planning with Margin
125
+
126
+ Base load: 1,000 RPS
127
+ Peak multiplier: 3x (historical)
128
+ Margin for unknowns: 1.5x
129
+ Margin for growth: 1.3x (6 months runway)
130
+
131
+ Required capacity: 1,000 × 3 × 1.5 × 1.3 = 5,850 RPS
132
+ Round up: 6,000 RPS
133
+
134
+ Rationale: Can handle 6x normal load, or 4x peak, or growth + peak
135
+ ```
136
+
137
+ ### Time Margin
138
+
139
+ ```markdown
140
+ ## Project Estimation with Margin
141
+
142
+ Task estimates:
143
+ - Feature A: 2 weeks
144
+ - Feature B: 3 weeks
145
+ - Integration: 1 week
146
+ - Testing: 1 week
147
+ Base total: 7 weeks
148
+
149
+ Adjustments:
150
+ - Optimistic bias: +30%
151
+ - Unknowns: +20%
152
+ - Dependencies: +15%
153
+ Margin total: 1.65x
154
+
155
+ Commitment: 7 × 1.65 = 11.5 → 12 weeks
156
+
157
+ Rule of thumb: Hofstadter's Law - "It always takes longer than you expect,
158
+ even when you take into account Hofstadter's Law."
159
+ ```
160
+
161
+ ### Financial Margin
162
+
163
+ ```markdown
164
+ ## Budget with Margin
165
+
166
+ Infrastructure estimate:
167
+ - Compute: $5,000/month
168
+ - Storage: $2,000/month
169
+ - Network: $1,000/month
170
+ Base: $8,000/month
171
+
172
+ Margin considerations:
173
+ - Traffic growth: +25%
174
+ - Unplanned incidents: +15%
175
+ - New features: +20%
176
+
177
+ Budget request: $8,000 × 1.6 = $12,800/month
178
+ Actual budget: $13,000/month (round up)
179
+ ```
180
+
181
+ ### Design Margin
182
+
183
+ ```markdown
184
+ ## Architectural Margin
185
+
186
+ Connection pool:
187
+ - Normal usage: 50 connections
188
+ - Peak: 100 connections
189
+ - Margin: 2x peak
190
+ - Configure: 200 connections
191
+
192
+ Queue depth:
193
+ - Normal processing: 1,000 messages
194
+ - Burst: 10,000 messages
195
+ - Margin: 2x burst
196
+ - Configure: 20,000 max depth
197
+
198
+ Timeout:
199
+ - P99 latency: 500ms
200
+ - Margin: 2x
201
+ - Set timeout: 1000ms
202
+ ```
203
+
204
+ ## When to Use Different Margins
205
+
206
+ ### High Margin (2-3x)
207
+
208
+ - New domain or technology
209
+ - Critical system (failure is very costly)
210
+ - External dependencies (unpredictable)
211
+ - Customer-facing SLAs
212
+ - Irreversible commitments
213
+
214
+ ### Moderate Margin (1.5-2x)
215
+
216
+ - Familiar domain with some unknowns
217
+ - Internal systems (can recover from issues)
218
+ - Controlled dependencies
219
+ - Reversible decisions
220
+
221
+ ### Low Margin (1.2-1.5x)
222
+
223
+ - Well-understood domain
224
+ - Historical data available
225
+ - Low consequence of being wrong
226
+ - Short time horizons
227
+ - Easy to adjust
228
+
229
+ ### No Margin (Optimize to Edge)
230
+
231
+ Almost never appropriate for:
232
+ - Public commitments
233
+ - Production systems
234
+ - External dependencies
235
+
236
+ Acceptable for:
237
+ - Internal experiments
238
+ - Temporary systems
239
+ - Cost optimization after proving stable
240
+
241
+ ## The Cost of Margin
242
+
243
+ Margin isn't free. Balance:
244
+
245
+ ```markdown
246
+ ## Margin Cost-Benefit
247
+
248
+ High margin:
249
+ + Handles unexpected loads
250
+ + Reduces stress/heroics
251
+ + Enables growth without emergency scaling
252
+ - Higher infrastructure cost
253
+ - Potentially wasted resources
254
+
255
+ Low margin:
256
+ + Lower cost
257
+ + Efficient resource use
258
+ - Risk of outages
259
+ - Constant firefighting
260
+ - Technical debt from pam fixes
261
+
262
+ Sweet spot: Margin where cost of buffer < expected cost of margin-breach × probability
263
+ ```
264
+
265
+ ## Margin of Safety Template
266
+
267
+ ```markdown
268
+ # Margin of Safety Analysis: [Context]
269
+
270
+ ## Base Estimate
271
+ What: [What you're estimating]
272
+ Estimate: [Your point estimate]
273
+ Confidence: [How confident you are]
274
+
275
+ ## Uncertainty Factors
276
+ | Factor | Impact | Probability | Adjustment |
277
+ |--------|--------|-------------|------------|
278
+ | [Factor 1] | +X% | Medium | |
279
+ | [Factor 2] | +Y% | Low | |
280
+ | Unknown unknowns | +Z% | - | |
281
+
282
+ ## Margin Calculation
283
+ Base: [X]
284
+ Uncertainty multiplier: [1.X]
285
+ Context multiplier: [1.Y] (high/medium/low stakes)
286
+ Total margin: [X × all multipliers]
287
+
288
+ ## Final Commitment/Design
289
+ With margin: [Final number]
290
+ Rationale: [Why this margin]
291
+
292
+ ## Monitoring Plan
293
+ How will you know if margin is adequate/excessive?
294
+ - [Metric to track]
295
+ - [Threshold for concern]
296
+ - [Review cadence]
297
+ ```
298
+
299
+ ## Verification Checklist
300
+
301
+ - [ ] Identified base estimate
302
+ - [ ] Quantified uncertainty factors
303
+ - [ ] Selected appropriate margin for context
304
+ - [ ] Applied margin to commitment/design
305
+ - [ ] Considered cost of margin vs. cost of breach
306
+ - [ ] Have monitoring to validate margin adequacy
307
+ - [ ] Calibrating based on actual outcomes
308
+
309
+ ## Key Questions
310
+
311
+ - "What happens if my estimate is wrong by 2x?"
312
+ - "How much margin does this uncertainty warrant?"
313
+ - "Am I building for best case or realistic case?"
314
+ - "What's the cost of being wrong vs. cost of margin?"
315
+ - "Have I accounted for unknown unknowns?"
316
+ - "Am I optimizing to the edge when I shouldn't be?"
317
+
318
+ ## Graham's Wisdom
319
+
320
+ "The margin of safety is always dependent on the price paid."
321
+
322
+ In engineering: The margin needed depends on the cost of failure. Critical systems need more margin. Experiments can run leaner.
323
+
324
+ "Confronted with the challenge to distill the secret of sound investment into three words, we venture the motto, Margin of Safety."
325
+
326
+ In systems: When in doubt, build in margin. The cost of over-provisioning is usually much less than the cost of under-provisioning when things go wrong.
327
+
328
+ "The function of the margin of safety is, in essence, that of rendering unnecessary an accurate estimate of the future."
329
+
330
+ You don't need to predict perfectly if you have adequate margin. Margin is insurance against your own estimation errors.