AgentSkillsCN

skill-cost-credit-governor

通过确定性的警告、限流或禁用措施,对每项技能的积分消耗与令牌使用进行管控。当必须及时发现并遏制用量激增、代理频繁交互,或预算超支等问题时,此方法尤为有效。

SKILL.md
--- frontmatter
name: skill-cost-credit-governor
description: Govern per-skill credit and token spend with deterministic warn/throttle/disable actions. Use when usage spikes, agent chatter, or budget overruns must be detected and contained.

Skill Cost Credit Governor

Use this skill to prevent silent spend escalation across multi-skill workflows.

Workflow

  1. Export invocation usage history (CSV/JSON) with timestamp, skill, token, runtime, and optional caller fields.
  2. Run skill_cost_governor.py analyze for a rolling window.
  3. Review anomaly evidence (cost_spike, inefficient_loop, agent_chatter, runtime_p95_high).
  4. Apply proposed warn/throttle/disable actions.
  5. Persist analysis and policy artifacts for audits.

Analyze Usage

bash
python3 "$CODEX_HOME/skills/skill-cost-credit-governor/scripts/skill_cost_governor.py" analyze \
  --input /path/to/skill-usage.csv \
  --window-days 30 \
  --soft-daily-budget 120 \
  --hard-daily-budget 180 \
  --soft-window-budget 2800 \
  --hard-window-budget 3400 \
  --spike-multiplier 2.0 \
  --loop-threshold 6 \
  --chatter-threshold 20 \
  --json-out /tmp/skill-cost-analysis.json \
  --format table

Extract/Enforce Actions

bash
python3 "$CODEX_HOME/skills/skill-cost-credit-governor/scripts/skill_cost_governor.py" decide \
  --analysis-json /tmp/skill-cost-analysis.json \
  --json-out /tmp/skill-cost-policy.json \
  --format table

Use --force-global-action throttle or --force-global-action disable for emergency containment.

References

  • references/governor-workflow.md
  • references/policy-contract.md