[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71KZ690YEE4M6Q26D3X43D2":3,"skill-same:01M71KZ690YEE4M6Q26D3X43D2":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":30,"linkOnly":31,"markdownContent":32,"markdownBody":33,"frontMatter":34,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":42,"ownerHtmlUrl":43,"ownerBlogUrl":44,"ownerDescription":6,"updatedAt":45,"install":46,"resources":59},"01M71KZ690YEE4M6Q26D3X43D2","mastermind-budgets",null,"Mastermind budgets — view, set and track the spend caps the Org Runtime enforces per role, compare them with recorded spend, and hot-reload a running org.","monoes\u002Fmonomind","monoes","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F276744696?v=4","01M71KWF37AJ2NJBP3KWBVSDGT","01M71KWF4CSF8ADH0M6HA09VD2",23,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fmastermind-budgets\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29],"mastermind budgets","SET","running","domain","view","runtime","auto","compare","with","track","role","org","2026-11-10 10:56:23",false,"---\nname: mastermind-budgets\ndescription: \"Mastermind budgets — view, set and track the spend caps the Org Runtime enforces per role, compare them with recorded spend, and hot-reload a running org.\"\ntype: domain-skill\ndefault_mode: auto\npick: low\n---\n\n# Mastermind Budgets\n\nThis skill is invoked directly via `\u002Fmastermind-budgets`.\n\nThe Org Runtime enforces exactly three caps, all in the org definition `.monomind\u002Forgs\u002F\u003Corg>.json`\n(schemas: `packages\u002F@monomind\u002Fcli\u002Fsrc\u002Forgrt\u002Ftypes-role.ts` and `types.ts`; enforcement:\n`orgrt\u002Fbudget-closure.ts`):\n\n| Field | Scope | What happens at the cap |\n|-------|-------|-------------------------|\n| `roles[].budget_usd` | one role, USD | its session closes and its tasks are blocked. Unset = no USD cap for that role |\n| `roles[].budget_tokens` | one role, tokens | same; replaces the role's even split of `run_config.budget_tokens` |\n| `run_config.budget_tokens` | whole org, tokens | every role's session closes (default `1000000`) |\n\nA role's `policy.maxUsd` \u002F `policy.maxTokens`, when set, win over `budget_usd` \u002F `budget_tokens`.\n\nA `budget_usd` cap only counts costs the runtime reports. On a runtime with `reports_cost: false` in\n`monomind agent scan --json` (codex, kimicode, hermes, vercel, …) the role's cost is unknown —\n`cost_usd: null` in `org costs --json` — so its `budget_usd` never fires. Cap those roles with\n`budget_tokens` instead.\nCaps are per run: a new `monomind org run` starts at zero spend, `--resume` keeps it. The coordinator\nis warned once when a role or the org passes 80% of a cap.\n\nThere is **no org-wide USD cap**. `monomind org run --budget-usd N` only refuses to start a run whose\nupfront cost *estimate* exceeds N; it does not stop a run that overspends. To cap an org in dollars,\ngive every session role its own `budget_usd`. Never store budgets in a side-car file such as\n`.monomind\u002Forgs\u002F\u003Corg>-budgets.json` — the runtime does not read it, so a limit written there is not\nenforced.\n\n---\n\n## Inputs\n\n- `brain_context`: BRAIN CONTEXT block (injected by command, or loaded below if standalone)\n- `org_name`: org to manage budgets for (required)\n- `action`: show | set | clear | alert\n- `agent_id`: role id to scope to (optional — omit for the org-wide `run_config.budget_tokens`)\n- `limit_tokens`: token cap to set (for set) — `roles[].budget_tokens`, or `run_config.budget_tokens` without `agent_id`\n- `limit_usd`: USD cap to set (for set, requires `agent_id`) — `roles[].budget_usd`\n- `run`: run id to read spend from (optional — defaults to the latest run)\n- `caller`: command | master\n\n---\n\n## Step 0 — Brain Load (standalone only)\n\nIf `caller` is not \"command\", load brain context following mastermind-protocol\u002FSKILL.md Brain Load Procedure with namespace: `ops`.\n\n---\n\n## Step 1 — Load Org and Spend\n\n```bash\norgFile=\".monomind\u002Forgs\u002F${org_name}.json\"\n[ ! -f \"$orgFile\" ] && { echo \"ERROR: Org '${org_name}' not found.\"; exit 1; }\n\n# Spend comes from the runtime's own records (runtime.json + the run's event log),\n# the same numbers the daemon enforces against. Empty when the org has never run.\nspendJson=$(npx -y monomind@latest org costs \"$org_name\" ${run:+--run \"$run\"} --format json 2>\u002Fdev\u002Fnull \\\n  | tail -n 1)\necho \"$spendJson\" | jq -e '.items' >\u002Fdev\u002Fnull 2>&1 \\\n  || spendJson='{\"items\":[],\"totals\":{\"tokens\":0,\"cost_usd\":0,\"messages\":0}}'\n```\n\n---\n\n## Step 2 — Execute Action\n\n### show (default)\n\n```bash\necho \"BUDGETS — $org_name  (run: $(echo \"$spendJson\" | jq -r '.run \u002F\u002F \"none yet\"'))\"\necho \"════════════════════════════════════════════════════════\"\n\njq -r --argjson spend \"$spendJson\" --arg only \"${agent_id:-}\" '\n  def usd: if . == null then \"unknown\" else . * 10000 | round \u002F 10000 | \"$\\(.)\" end;\n  ($spend.items | map({key: .role, value: .}) | from_entries) as $s\n  | [.roles[] | select(.kind != \"endpoint\")] as $roles\n  | (.run_config.budget_tokens \u002F\u002F 1000000) as $orgTok\n  # even split as orgrt\u002Frole-slot.ts computeReplacementBudget: what the roles\n  # with their own budget_tokens leave, shared by the roles without one\n  | [$roles[] | select(.budget_tokens == null)] as $even\n  | (($orgTok - ([$roles[].budget_tokens \u002F\u002F 0] | add \u002F\u002F 0)) \u002F ([$even | length, 1] | max)\n     | floor | [., 0] | max) as $split\n  | \"ORG   run_config.budget_tokens \\($orgTok)   spent \\($spend.totals.tokens) tokens \u002F \\($spend.totals.cost_usd | usd)\\(if $spend.totals.cost_complete == false and $spend.totals.cost_usd != null then \" (lower bound: some roles report no cost)\" else \"\" end)\",\n    \"      (no org-wide USD cap — set budget_usd per role)\",\n    \"\",\n    ( $roles[] | select($only == \"\" or .id == $only)\n      | ($s[.id] \u002F\u002F {cost_usd: 0, tokens: 0}) as $r\n      | (.policy.maxUsd \u002F\u002F .budget_usd) as $usd\n      | (.policy.maxTokens \u002F\u002F .budget_tokens \u002F\u002F $split) as $tok\n      | (if ($usd and ($r.cost_usd \u002F\u002F 0) >= $usd) or $r.tokens >= $tok then \"  OVER\"\n         elif ($usd and ($r.cost_usd \u002F\u002F 0) >= $usd * 0.8) or $r.tokens >= $tok * 0.8 then \"  >80%\"\n         else \"\" end) as $flag\n      | \"\\(.id)\\($flag)\",\n        \"    USD:    \\($r.cost_usd | usd) \u002F \\(if $usd then \"$\\($usd)\" else \"no cap (budget_usd unset)\" end)\\(if $usd and $r.cost_usd == null then \" (cost not reported: this cap cannot fire)\" else \"\" end)\",\n        \"    tokens: \\($r.tokens) \u002F \\($tok)\\(if .policy.maxTokens or .budget_tokens then \"\" else \" (even split of run_config.budget_tokens)\" end)\" )\n' \"$orgFile\"\n\necho \"\"\necho \"  Set a role USD cap:   \u002Fmastermind-budgets --org $org_name --action set --agent-id \u003Crole> --limit-usd 5\"\necho \"  Set the org token cap: \u002Fmastermind-budgets --org $org_name --action set --limit-tokens 2000000\"\necho \"  Spend history:        npx -y monomind@latest org report $org_name --all\"\n```\n\n### set\n\nEdits the enforced fields in the org definition, validates it, then hot-reloads a running org.\n`org reload` applies `budget_usd`, `budget_tokens` and `run_config.budget_tokens` to live sessions\nwith their spend kept, and reopens a role that was closed for budget once it is under the new cap\n(`orgrt\u002Forg-reload.ts`). A stopped org picks the new caps up on its next `monomind org run`.\n\n```bash\ntmp=\"${orgFile}.tmp\"\nif [ -n \"${agent_id:-}\" ]; then\n  jq -e --arg id \"$agent_id\" '.roles[] | select(.id == $id)' \"$orgFile\" >\u002Fdev\u002Fnull \\\n    || { echo \"ERROR: role '$agent_id' not found in $orgFile\"; exit 1; }\n  jq -e --arg id \"$agent_id\" '.roles[] | select(.id == $id) | .kind == \"endpoint\"' \"$orgFile\" >\u002Fdev\u002Fnull \\\n    && { echo \"ERROR: '$agent_id' is an endpoint role — endpoint roles cannot carry budgets\"; exit 1; }\n  if [ -n \"${limit_usd:-}\" ]; then\n    [[ \"$limit_usd\" =~ ^[0-9]+(\\.[0-9]+)?$ ]] && awk -v v=\"$limit_usd\" 'BEGIN{exit !(v>0)}' \\\n      || { echo \"ERROR: limit_usd must be a positive number\"; exit 1; }\n    jq --arg id \"$agent_id\" --argjson v \"$limit_usd\" \\\n      '(.roles[] | select(.id == $id)).budget_usd = $v' \"$orgFile\" > \"$tmp\" && mv \"$tmp\" \"$orgFile\"\n    echo \"  roles[$agent_id].budget_usd → \\$$limit_usd\"\n    role_rt=$(jq -r --arg id \"$agent_id\" '(.roles[] | select(.id == $id) | .runtime) \u002F\u002F .runtime \u002F\u002F \"claude\"' \"$orgFile\")\n    npx -y monomind@latest agent scan --json 2>\u002Fdev\u002Fnull \\\n      | jq -e --arg rt \"$role_rt\" '.agents[] | select(.id == $rt) | .reports_cost == false' >\u002Fdev\u002Fnull \\\n      && echo \"  WARNING: runtime '$role_rt' reports no cost (reports_cost: false) — this budget_usd never fires. Cap the role with --limit-tokens.\"\n    jq -e --arg id \"$agent_id\" '.roles[] | select(.id == $id) | .policy.maxUsd != null' \"$orgFile\" >\u002Fdev\u002Fnull \\\n      && echo \"  NOTE: this role's policy.maxUsd is set and takes precedence over budget_usd.\"\n  fi\n  if [ -n \"${limit_tokens:-}\" ]; then\n    [[ \"$limit_tokens\" =~ ^[1-9][0-9]*$ ]] || { echo \"ERROR: limit_tokens must be a positive integer\"; exit 1; }\n    jq --arg id \"$agent_id\" --argjson v \"$limit_tokens\" \\\n      '(.roles[] | select(.id == $id)).budget_tokens = $v' \"$orgFile\" > \"$tmp\" && mv \"$tmp\" \"$orgFile\"\n    echo \"  roles[$agent_id].budget_tokens → $limit_tokens\"\n  fi\nelse\n  [ -n \"${limit_usd:-}\" ] && {\n    echo \"ERROR: the runtime has no org-wide USD cap. Pass --agent-id to set roles[].budget_usd per role.\"\n    exit 1\n  }\n  [[ \"${limit_tokens:-}\" =~ ^[1-9][0-9]*$ ]] || { echo \"ERROR: limit_tokens must be a positive integer\"; exit 1; }\n  jq --argjson v \"$limit_tokens\" '.run_config.budget_tokens = $v' \"$orgFile\" > \"$tmp\" && mv \"$tmp\" \"$orgFile\"\n  echo \"  run_config.budget_tokens → $limit_tokens\"\nfi\n\nnpx -y monomind@latest org validate \"$org_name\" \\\n  || echo \"WARNING: '${org_name}' no longer passes validation — fix it before 'monomind org run ${org_name}'\"\n# Budgets are signed (#502): run\u002Freload\u002Fserve use this change only once the operator signs it.\necho \"Review, then sign the change yourself: monomind org sign ${org_name}\"\nnpx -y monomind@latest org reload \"$org_name\"\n```\n\n### clear\n\nRemoves a role's own caps (`budget_usd`, `budget_tokens`), so it falls back to no USD cap and its\neven split of `run_config.budget_tokens`. `run_config.budget_tokens` itself cannot be removed — the\nschema defaults it to 1000000 — only changed with `set`.\n\n```bash\n[ -z \"${agent_id:-}\" ] && { echo \"ERROR: clear needs --agent-id \u003Crole>\"; exit 1; }\ntmp=\"${orgFile}.tmp\"\njq --arg id \"$agent_id\" '(.roles[] | select(.id == $id)) |= del(.budget_usd, .budget_tokens)' \\\n  \"$orgFile\" > \"$tmp\" && mv \"$tmp\" \"$orgFile\"\necho \"  Cleared budget_usd \u002F budget_tokens for '$agent_id'\"\nnpx -y monomind@latest org validate \"$org_name\" \\\n  || echo \"WARNING: '${org_name}' no longer passes validation — fix it before 'monomind org run ${org_name}'\"\n# Budgets are signed (#502): run\u002Freload\u002Fserve use this change only once the operator signs it.\necho \"Review, then sign the change yourself: monomind org sign ${org_name}\"\nnpx -y monomind@latest org reload \"$org_name\"\n```\n\n### alert\n\nRoles at or over 80% of an enforced cap in the selected run, and the budget events the runtime\nitself recorded (`budget-warning`, `budget-exhausted`, `org-budget-exhausted`):\n\n```bash\necho \"BUDGET ALERTS — $org_name\"\necho \"────────────────────────────────────────────────────────\"\n\njq -r --argjson spend \"$spendJson\" '\n  def usd: if . == null then \"unknown\" else . * 10000 | round \u002F 10000 | \"$\\(.)\" end;\n  ($spend.items | map({key: .role, value: .}) | from_entries) as $s\n  | [.roles[] | select(.kind != \"endpoint\")] as $roles\n  | [$roles[] | select(.budget_tokens == null)] as $even\n  | (((.run_config.budget_tokens \u002F\u002F 1000000) - ([$roles[].budget_tokens \u002F\u002F 0] | add \u002F\u002F 0))\n     \u002F ([$even | length, 1] | max) | floor | [., 0] | max) as $split\n  | [ $roles[]\n      | ($s[.id] \u002F\u002F {cost_usd: 0, tokens: 0}) as $r\n      | (.policy.maxUsd \u002F\u002F .budget_usd) as $usd\n      | (.policy.maxTokens \u002F\u002F .budget_tokens \u002F\u002F $split) as $tok\n      | select(($usd and ($r.cost_usd \u002F\u002F 0) >= $usd * 0.8) or $r.tokens >= $tok * 0.8)\n      | \"  \\(.id): \\($r.cost_usd | usd)\\(if $usd then \" \u002F $\\($usd)\" else \"\" end), \\($r.tokens) \u002F \\($tok) tokens\" ]\n  | if length == 0 then \"  All roles under 80% of their caps.\" else .[] end\n' \"$orgFile\"\n\necho \"\"\nnpx -y monomind@latest org events \"$org_name\" ${run:+--run \"$run\"} 2>\u002Fdev\u002Fnull \\\n  | jq -Rr 'fromjson? | select(.reason | IN(\"budget-warning\", \"budget-exhausted\", \"org-budget-exhausted\"))\n            | \"  [\\(.reason)] \\(.msg)\"' | tail -n 20\n```\n\n---\n\n## Step 3 — Return Output\n\n```yaml\ndomain: ops\nstatus: complete\naction: \u003Caction>\norg_name: \u003Corg_name>\nconfig_file: .monomind\u002Forgs\u002F\u003Corg_name>.json\n```\n\n---\n\n## Step 4 — Brain Write (standalone only)\n\nIf `caller` is not \"command\", follow mastermind-protocol\u002FSKILL.md Brain Write Procedure for domain `ops`.\n","# Mastermind Budgets\n\nThis skill is invoked directly via `\u002Fmastermind-budgets`.\n\nThe Org Runtime enforces exactly three caps, all in the org definition `.monomind\u002Forgs\u002F\u003Corg>.json`\n(schemas: `packages\u002F@monomind\u002Fcli\u002Fsrc\u002Forgrt\u002Ftypes-role.ts` and `types.ts`; enforcement:\n`orgrt\u002Fbudget-closure.ts`):\n\n| Field | Scope | What happens at the cap |\n|-------|-------|-------------------------|\n| `roles[].budget_usd` | one role, USD | its session closes and its tasks are blocked. Unset = no USD cap for that role |\n| `roles[].budget_tokens` | one role, tokens | same; replaces the role's even split of `run_config.budget_tokens` |\n| `run_config.budget_tokens` | whole org, tokens | every role's session closes (default `1000000`) |\n\nA role's `policy.maxUsd` \u002F `policy.maxTokens`, when set, win over `budget_usd` \u002F `budget_tokens`.\n\nA `budget_usd` cap only counts costs the runtime reports. On a runtime with `reports_cost: false` in\n`monomind agent scan --json` (codex, kimicode, hermes, vercel, …) the role's cost is unknown —\n`cost_usd: null` in `org costs --json` — so its `budget_usd` never fires. Cap those roles with\n`budget_tokens` instead.\nCaps are per run: a new `monomind org run` starts at zero spend, `--resume` keeps it. The coordinator\nis warned once when a role or the org passes 80% of a cap.\n\nThere is **no org-wide USD cap**. `monomind org run --budget-usd N` only refuses to start a run whose\nupfront cost *estimate* exceeds N; it does not stop a run that overspends. To cap an org in dollars,\ngive every session role its own `budget_usd`. Never store budgets in a side-car file such as\n`.monomind\u002Forgs\u002F\u003Corg>-budgets.json` — the runtime does not read it, so a limit written there is not\nenforced.\n\n---\n\n## Inputs\n\n- `brain_context`: BRAIN CONTEXT block (injected by command, or loaded below if standalone)\n- `org_name`: org to manage budgets for (required)\n- `action`: show | set | clear | alert\n- `agent_id`: role id to scope to (optional — omit for the org-wide `run_config.budget_tokens`)\n- `limit_tokens`: token cap to set (for set) — `roles[].budget_tokens`, or `run_config.budget_tokens` without `agent_id`\n- `limit_usd`: USD cap to set (for set, requires `agent_id`) — `roles[].budget_usd`\n- `run`: run id to read spend from (optional — defaults to the latest run)\n- `caller`: command | master\n\n---\n\n## Step 0 — Brain Load (standalone only)\n\nIf `caller` is not \"command\", load brain context following mastermind-protocol\u002FSKILL.md Brain Load Procedure with namespace: `ops`.\n\n---\n\n## Step 1 — Load Org and Spend\n\n```bash\norgFile=\".monomind\u002Forgs\u002F${org_name}.json\"\n[ ! -f \"$orgFile\" ] && { echo \"ERROR: Org '${org_name}' not found.\"; exit 1; }\n\n# Spend comes from the runtime's own records (runtime.json + the run's event log),\n# the same numbers the daemon enforces against. Empty when the org has never run.\nspendJson=$(npx -y monomind@latest org costs \"$org_name\" ${run:+--run \"$run\"} --format json 2>\u002Fdev\u002Fnull \\\n  | tail -n 1)\necho \"$spendJson\" | jq -e '.items' >\u002Fdev\u002Fnull 2>&1 \\\n  || spendJson='{\"items\":[],\"totals\":{\"tokens\":0,\"cost_usd\":0,\"messages\":0}}'\n```\n\n---\n\n## Step 2 — Execute Action\n\n### show (default)\n\n```bash\necho \"BUDGETS — $org_name  (run: $(echo \"$spendJson\" | jq -r '.run \u002F\u002F \"none yet\"'))\"\necho \"════════════════════════════════════════════════════════\"\n\njq -r --argjson spend \"$spendJson\" --arg only \"${agent_id:-}\" '\n  def usd: if . == null then \"unknown\" else . * 10000 | round \u002F 10000 | \"$\\(.)\" end;\n  ($spend.items | map({key: .role, value: .}) | from_entries) as $s\n  | [.roles[] | select(.kind != \"endpoint\")] as $roles\n  | (.run_config.budget_tokens \u002F\u002F 1000000) as $orgTok\n  # even split as orgrt\u002Frole-slot.ts computeReplacementBudget: what the roles\n  # with their own budget_tokens leave, shared by the roles without one\n  | [$roles[] | select(.budget_tokens == null)] as $even\n  | (($orgTok - ([$roles[].budget_tokens \u002F\u002F 0] | add \u002F\u002F 0)) \u002F ([$even | length, 1] | max)\n     | floor | [., 0] | max) as $split\n  | \"ORG   run_config.budget_tokens \\($orgTok)   spent \\($spend.totals.tokens) tokens \u002F \\($spend.totals.cost_usd | usd)\\(if $spend.totals.cost_complete == false and $spend.totals.cost_usd != null then \" (lower bound: some roles report no cost)\" else \"\" end)\",\n    \"      (no org-wide USD cap — set budget_usd per role)\",\n    \"\",\n    ( $roles[] | select($only == \"\" or .id == $only)\n      | ($s[.id] \u002F\u002F {cost_usd: 0, tokens: 0}) as $r\n      | (.policy.maxUsd \u002F\u002F .budget_usd) as $usd\n      | (.policy.maxTokens \u002F\u002F .budget_tokens \u002F\u002F $split) as $tok\n      | (if ($usd and ($r.cost_usd \u002F\u002F 0) >= $usd) or $r.tokens >= $tok then \"  OVER\"\n         elif ($usd and ($r.cost_usd \u002F\u002F 0) >= $usd * 0.8) or $r.tokens >= $tok * 0.8 then \"  >80%\"\n         else \"\" end) as $flag\n      | \"\\(.id)\\($flag)\",\n        \"    USD:    \\($r.cost_usd | usd) \u002F \\(if $usd then \"$\\($usd)\" else \"no cap (budget_usd unset)\" end)\\(if $usd and $r.cost_usd == null then \" (cost not reported: this cap cannot fire)\" else \"\" end)\",\n        \"    tokens: \\($r.tokens) \u002F \\($tok)\\(if .policy.maxTokens or .budget_tokens then \"\" else \" (even split of run_config.budget_tokens)\" end)\" )\n' \"$orgFile\"\n\necho \"\"\necho \"  Set a role USD cap:   \u002Fmastermind-budgets --org $org_name --action set --agent-id \u003Crole> --limit-usd 5\"\necho \"  Set the org token cap: \u002Fmastermind-budgets --org $org_name --action set --limit-tokens 2000000\"\necho \"  Spend history:        npx -y monomind@latest org report $org_name --all\"\n```\n\n### set\n\nEdits the enforced fields in the org definition, validates it, then hot-reloads a running org.\n`org reload` applies `budget_usd`, `budget_tokens` and `run_config.budget_tokens` to live sessions\nwith their spend kept, and reopens a role that was closed for budget once it is under the new cap\n(`orgrt\u002Forg-reload.ts`). A stopped org picks the new caps up on its next `monomind org run`.\n\n```bash\ntmp=\"${orgFile}.tmp\"\nif [ -n \"${agent_id:-}\" ]; then\n  jq -e --arg id \"$agent_id\" '.roles[] | select(.id == $id)' \"$orgFile\" >\u002Fdev\u002Fnull \\\n    || { echo \"ERROR: role '$agent_id' not found in $orgFile\"; exit 1; }\n  jq -e --arg id \"$agent_id\" '.roles[] | select(.id == $id) | .kind == \"endpoint\"' \"$orgFile\" >\u002Fdev\u002Fnull \\\n    && { echo \"ERROR: '$agent_id' is an endpoint role — endpoint roles cannot carry budgets\"; exit 1; }\n  if [ -n \"${limit_usd:-}\" ]; then\n    [[ \"$limit_usd\" =~ ^[0-9]+(\\.[0-9]+)?$ ]] && awk -v v=\"$limit_usd\" 'BEGIN{exit !(v>0)}' \\\n      || { echo \"ERROR: limit_usd must be a positive number\"; exit 1; }\n    jq --arg id \"$agent_id\" --argjson v \"$limit_usd\" \\\n      '(.roles[] | select(.id == $id)).budget_usd = $v' \"$orgFile\" > \"$tmp\" && mv \"$tmp\" \"$orgFile\"\n    echo \"  roles[$agent_id].budget_usd → \\$$limit_usd\"\n    role_rt=$(jq -r --arg id \"$agent_id\" '(.roles[] | select(.id == $id) | .runtime) \u002F\u002F .runtime \u002F\u002F \"claude\"' \"$orgFile\")\n    npx -y monomind@latest agent scan --json 2>\u002Fdev\u002Fnull \\\n      | jq -e --arg rt \"$role_rt\" '.agents[] | select(.id == $rt) | .reports_cost == false' >\u002Fdev\u002Fnull \\\n      && echo \"  WARNING: runtime '$role_rt' reports no cost (reports_cost: false) — this budget_usd never fires. Cap the role with --limit-tokens.\"\n    jq -e --arg id \"$agent_id\" '.roles[] | select(.id == $id) | .policy.maxUsd != null' \"$orgFile\" >\u002Fdev\u002Fnull \\\n      && echo \"  NOTE: this role's policy.maxUsd is set and takes precedence over budget_usd.\"\n  fi\n  if [ -n \"${limit_tokens:-}\" ]; then\n    [[ \"$limit_tokens\" =~ ^[1-9][0-9]*$ ]] || { echo \"ERROR: limit_tokens must be a positive integer\"; exit 1; }\n    jq --arg id \"$agent_id\" --argjson v \"$limit_tokens\" \\\n      '(.roles[] | select(.id == $id)).budget_tokens = $v' \"$orgFile\" > \"$tmp\" && mv \"$tmp\" \"$orgFile\"\n    echo \"  roles[$agent_id].budget_tokens → $limit_tokens\"\n  fi\nelse\n  [ -n \"${limit_usd:-}\" ] && {\n    echo \"ERROR: the runtime has no org-wide USD cap. Pass --agent-id to set roles[].budget_usd per role.\"\n    exit 1\n  }\n  [[ \"${limit_tokens:-}\" =~ ^[1-9][0-9]*$ ]] || { echo \"ERROR: limit_tokens must be a positive integer\"; exit 1; }\n  jq --argjson v \"$limit_tokens\" '.run_config.budget_tokens = $v' \"$orgFile\" > \"$tmp\" && mv \"$tmp\" \"$orgFile\"\n  echo \"  run_config.budget_tokens → $limit_tokens\"\nfi\n\nnpx -y monomind@latest org validate \"$org_name\" \\\n  || echo \"WARNING: '${org_name}' no longer passes validation — fix it before 'monomind org run ${org_name}'\"\n# Budgets are signed (#502): run\u002Freload\u002Fserve use this change only once the operator signs it.\necho \"Review, then sign the change yourself: monomind org sign ${org_name}\"\nnpx -y monomind@latest org reload \"$org_name\"\n```\n\n### clear\n\nRemoves a role's own caps (`budget_usd`, `budget_tokens`), so it falls back to no USD cap and its\neven split of `run_config.budget_tokens`. `run_config.budget_tokens` itself cannot be removed — the\nschema defaults it to 1000000 — only changed with `set`.\n\n```bash\n[ -z \"${agent_id:-}\" ] && { echo \"ERROR: clear needs --agent-id \u003Crole>\"; exit 1; }\ntmp=\"${orgFile}.tmp\"\njq --arg id \"$agent_id\" '(.roles[] | select(.id == $id)) |= del(.budget_usd, .budget_tokens)' \\\n  \"$orgFile\" > \"$tmp\" && mv \"$tmp\" \"$orgFile\"\necho \"  Cleared budget_usd \u002F budget_tokens for '$agent_id'\"\nnpx -y monomind@latest org validate \"$org_name\" \\\n  || echo \"WARNING: '${org_name}' no longer passes validation — fix it before 'monomind org run ${org_name}'\"\n# Budgets are signed (#502): run\u002Freload\u002Fserve use this change only once the operator signs it.\necho \"Review, then sign the change yourself: monomind org sign ${org_name}\"\nnpx -y monomind@latest org reload \"$org_name\"\n```\n\n### alert\n\nRoles at or over 80% of an enforced cap in the selected run, and the budget events the runtime\nitself recorded (`budget-warning`, `budget-exhausted`, `org-budget-exhausted`):\n\n```bash\necho \"BUDGET ALERTS — $org_name\"\necho \"────────────────────────────────────────────────────────\"\n\njq -r --argjson spend \"$spendJson\" '\n  def usd: if . == null then \"unknown\" else . * 10000 | round \u002F 10000 | \"$\\(.)\" end;\n  ($spend.items | map({key: .role, value: .}) | from_entries) as $s\n  | [.roles[] | select(.kind != \"endpoint\")] as $roles\n  | [$roles[] | select(.budget_tokens == null)] as $even\n  | (((.run_config.budget_tokens \u002F\u002F 1000000) - ([$roles[].budget_tokens \u002F\u002F 0] | add \u002F\u002F 0))\n     \u002F ([$even | length, 1] | max) | floor | [., 0] | max) as $split\n  | [ $roles[]\n      | ($s[.id] \u002F\u002F {cost_usd: 0, tokens: 0}) as $r\n      | (.policy.maxUsd \u002F\u002F .budget_usd) as $usd\n      | (.policy.maxTokens \u002F\u002F .budget_tokens \u002F\u002F $split) as $tok\n      | select(($usd and ($r.cost_usd \u002F\u002F 0) >= $usd * 0.8) or $r.tokens >= $tok * 0.8)\n      | \"  \\(.id): \\($r.cost_usd | usd)\\(if $usd then \" \u002F $\\($usd)\" else \"\" end), \\($r.tokens) \u002F \\($tok) tokens\" ]\n  | if length == 0 then \"  All roles under 80% of their caps.\" else .[] end\n' \"$orgFile\"\n\necho \"\"\nnpx -y monomind@latest org events \"$org_name\" ${run:+--run \"$run\"} 2>\u002Fdev\u002Fnull \\\n  | jq -Rr 'fromjson? | select(.reason | IN(\"budget-warning\", \"budget-exhausted\", \"org-budget-exhausted\"))\n            | \"  [\\(.reason)] \\(.msg)\"' | tail -n 20\n```\n\n---\n\n## Step 3 — Return Output\n\n```yaml\ndomain: ops\nstatus: complete\naction: \u003Caction>\norg_name: \u003Corg_name>\nconfig_file: .monomind\u002Forgs\u002F\u003Corg_name>.json\n```\n\n---\n\n## Step 4 — Brain Write (standalone only)\n\nIf `caller` is not \"command\", follow mastermind-protocol\u002FSKILL.md Brain Write Procedure for domain `ops`.\n",{"name":5,"pick":35,"type":36,"description":7,"default_mode":24},"low","domain-skill","main","f7cd4595d0f8959822163e14f9787117765c931a",".claude\u002Fskills\u002Fmastermind-budgets",2,"https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind","https:\u002F\u002Fmonoes.github.io\u002Fmonomind\u002F","https:\u002F\u002Fgithub.com\u002Fmonoes","https:\u002F\u002Fmonoes.me","2026-11-14 03:30:52",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add monoes\u002Fmonomind --skill mastermind-budgets",{"tool":52,"command":53},"bunx","bunx skills add monoes\u002Fmonomind --skill mastermind-budgets",{"tool":55,"command":56},"pnpm","pnpm dlx skills add monoes\u002Fmonomind --skill mastermind-budgets","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fmastermind-budgets\u002FSKILL.md",true,[],[61,71,79,87,95,103],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":65,"licenseFileUrl":66,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":70},"01M73YHAZDWV4ZVTGSKMWQ4Z1S","isms-audit-expert","Use when planning or running an ISO 27001 ISMS audit: risk-based audit schedules, Annex A control assessment, Statement of Applicability and nonconformities. Auditor-side procedures, versus compliance-auditor, which is org role guidance across SOC 2, HIPAA and PCI-DSS.","MIT","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fisms-audit-expert\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fisms-audit-expert\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":75,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":70},"01M73YGBS2APTY71Y4CYA2DKSQ","instrument-data-to-allotrope","Convert laboratory instrument output files (PDF, CSV, Excel, TXT) to Allotrope Simple Model (ASM) JSON format or flattened 2D CSV. Use this skill when scientists need to standardize instrument data for LIMS systems, data lakes, or downstream analysis. Supports auto-detection of instrument types. Outputs include full ASM JSON, flattened CSV for easy import, and exportable Python code for data engineers. Common triggers include converting instrument files, standardizing lab data, preparing data for upload to LIMS\u002FELN systems, or generating parser code for production pipelines.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Finstrument-data-to-allotrope\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Finstrument-data-to-allotrope\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":65,"licenseFileUrl":83,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":70},"01M73YB23X4NP40R73TS6YY8TX","experiment-designer","Use when planning a product A\u002FB or multivariate test: If\u002FThen\u002FBecause hypotheses, primary and guardrail metrics, sample size and MDE, ICE prioritization. For logging and reproducing ML runs use experiment-tracker; for scientific study design use experimental-design.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fexperiment-designer\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fexperiment-designer\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":91,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":70},"01M73Y8ETSB9072G5ZGPPR0X6E","digest","Generate a daily or weekly digest of activity across all connected sources. Use when catching up after time away, starting the day and wanting a summary of mentions and action items, or reviewing a week's decisions and document updates grouped by project.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdigest\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdigest\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":99,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":70},"01M73Y7XJJBH0QXCM5GKJW6N21","design-critique","Get structured design feedback on usability, hierarchy, and consistency. Trigger with \"review this design\", \"critique this mockup\", \"what do you think of this screen?\", or when sharing a Figma link or screenshot for feedback at any stage from exploration to final polish.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdesign-critique\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdesign-critique\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":65,"licenseFileUrl":107,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":70},"01M73Y7SM786ZEMNXGPT595AM3","deployment-pipeline-design","Use when architecting a multi-stage CI\u002FCD pipeline with approval gates, SAST and DAST scans, environment promotion, canary rollout and automated rollback. Design-level; for concrete Dockerfile and health check patterns use deployment-patterns.","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdeployment-pipeline-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fmonoes\u002Fmonomind\u002Fblob\u002Fmain\u002Fpackages\u002F@monomind\u002Fcli\u002Forg-skills\u002Fdeployment-pipeline-design\u002FSKILL.md",[],[]]