norboten · cheat sheet

A CI agent costs what its trigger, turn cap, model and tools allow — cheat sheet

claude-code, ai-agents
# one bounded classification
claude -p "…" --model haiku --tools "" --max-turns 3 \
  --json-schema '{"type":"object","properties":{"label":{"type":"string","enum":["bug","question"]}},"required":["label"]}' \
  --no-session-persistence --output-format json > out.json
jq -r '.structured_output.label // "question"' out.json
jq -c '{subtype, num_turns, is_error, total_cost_usd, models: (.modelUsage|keys)}' out.json

# other caps
claude -p "…" --max-budget-usd 0.50          # estimate-based, subagents included
MAX_THINKING_TOKENS=0 claude -p "…"          # no extended thinking for no-tool jobs

# is a run still going? (a job step that never ends)
timeout 300 sh ci/triage.sh; echo "exit $?"  # 124 = killed by timeout
# workflow shape
on:
  issues:
    types: [opened]
permissions:
  issues: write
  contents: read
concurrency:
  group: triage-${{ github.event.issue.number }}
jobs:
  triage:
    timeout-minutes: 10
    steps:
      - env:
          CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
          TITLE: ${{ github.event.issue.title }}     # data, not code
        run: printf '%s\n' "$TITLE" | sh ci/triage.sh
# audit a workflow for expressions pasted into shells
grep -n 'run:' -A20 .github/workflows/*.yml | grep -E '\$\{\{ *(secrets|github\.event)\.'