(pattern: Pattern)
| 191 | } |
| 192 | |
| 193 | function buildLoopBudgetMd(pattern: Pattern): string { |
| 194 | const b = PATTERN_BUDGET[pattern]; |
| 195 | return `# Loop Budget — YOUR_PROJECT |
| 196 | |
| 197 | > Primary loop: **${b.name}** (scaffolded by loop-init) |
| 198 | |
| 199 | ## Daily limits |
| 200 | |
| 201 | | Loop | Max runs/day | Max tokens/day | Max sub-agent spawns/run | |
| 202 | |------|--------------|----------------|--------------------------| |
| 203 | | ${b.name} | ${b.maxRunsPerDay} | ${formatTokenCap(b.dailyCap)} | ${b.maxSpawnsL1} (L1) / ${b.maxSpawnsL2} (L2) | |
| 204 | |
| 205 | ## On budget exceed |
| 206 | |
| 207 | 1. Pause schedulers (\`scheduler_delete\` or disable automations) |
| 208 | 2. Append event to \`loop-run-log.md\` |
| 209 | 3. Notify human (Slack / issue / STATE.md High Priority) |
| 210 | |
| 211 | ## Kill switch |
| 212 | |
| 213 | - Command or issue label: \`loop-pause-all\` |
| 214 | - Resume only after human clears the flag in STATE.md |
| 215 | |
| 216 | ## Estimate spend |
| 217 | |
| 218 | \`\`\`bash |
| 219 | npx @cobusgreyling/loop-cost --pattern ${pattern} |
| 220 | \`\`\` |
| 221 | `; |
| 222 | } |
| 223 | |
| 224 | async function scaffoldObservability( |
| 225 | pattern: Pattern, |
no test coverage detected