Skill477 estrellas del repoactualizado today
sponsio
Sponsio is a runtime contract layer for LLM agents that blocks or logs unsafe tool calls and validates output quality against declared rules. Use it to set up safety guardrails on an existing agent, generate or refine contract files (sponsio.yaml), audit tool configurations for security risks, tune rules in observe mode before enforcing them, or diagnose why specific safety contracts are or aren't triggering.
Instalar en Claude Code
Copiargit clone --depth 1 https://github.com/SponsioLabs/Sponsio /tmp/sponsio && cp -r /tmp/sponsio/ts/packages/sdk/skills ~/.claude/skills/sponsioDespués abre una sesión nueva de Claude Code; el skill carga automáticamente.
Definición
SKILL.md
# Sponsio — Agent Safety Lifecycle Companion
Sponsio is a Python/TypeScript runtime safety layer for LLM agents: it evaluates deterministic contracts against each tool call and can block (enforce) or just log (observe) violations. The engine is deterministic-only. This skill covers the full lifecycle — first-time setup, contract authoring/review, observe-mode tuning, and flipping to enforce — by orchestrating Sponsio's CLI and explaining its output in plain language.
This skill does NOT reimplement Sponsio's logic; it calls the CLI and interprets results.
## When to use this skill
Dispatch by what the user is trying to do. Pick ONE workflow and follow it; do not run multiple workflows in one turn.
| User is… | → Workflow |
|---|---|
| Setting up Sponsio for the first time in a project ("add sponsio", "install sponsio", "add guardrails") | **W1 — Initial setup** |
| Handing you a codebase and asking "what could go wrong?" / wants a fresh contract file from scratch / has a policy doc to encode | **W2 — Audit & refine** |
| Has Sponsio running in observe mode and wants to review violations, tune thresholds, silence false positives | **W3 — Tune in observe** |
| Wants to re-mine contracts from accumulated production traces / periodically maintain the library | **W3b — Refresh from traces** |
| Ready to ship — wants to move from observe to enforce, needs regression confidence | **W4 — Flip to enforce** |
| Sponsio errored, a rule isn't firing when it should, a rule is firing when it shouldn't | **W5 — Troubleshoot** |
Do NOT trigger for: general LLM-safety discussions not tied to a specific codebase; non-agent code review (linting, correctness).
## Prerequisites (run silently before any workflow)
```bash
sponsio --version
```
- Not found → install: `pip install sponsio` (or `pip install -e ".[all]"` from a local clone).
- For `--llm` inference, check: `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `GEMINI_API_KEY` / `GOOGLE_API_KEY`. Absent → still proceed; AST-based extraction and all of W3/W4/W5 work with zero keys.
---
## W1 — Initial setup
Goal: from "project has no Sponsio" to "agent runs under observe mode with a sane contract file", in one command.
### Steps
1. Run the one-shot entry point:
```bash
sponsio onboard . --apply
```
`onboard` detects framework (langgraph / langchain / crewai / openai_agents / claude_agent / vercel-ai / no-framework), picks an LLM provider if available, auto-selects contract packs (see "Auto-selected packs" below), writes `sponsio.yaml` in **observe** mode, and with `--apply` patches the agent entry file with a two-line wrap (backup at `.sponsio.bak`). Falls back to printing the patch snippet if the framework isn't auto-patchable.
2. After `onboard` finishes, show the user three things — do not skip any:
- The generated `sponsio.yaml` (read it back and summarize: packs included, tools renamed, mode).
- The applied patch (from `report.apply_result.diff`) or the printed snippet.
- Any `sponsio doctor` warn/fail lines.
3. Explain observe mode explicitly: "Nothing is blocked on day 1. Every contract is still evaluated; violations are logged to `~/.sponsio/sessions/<agent_id>/*.jsonl` and (if a dashboard is configured) pushed there. Use `sponsio report --since 24h` after a day of real traffic to see what would have been blocked."
4. If `sponsio doctor` failed (not warned, failed), stop and surface it — don't let the user run their agent thinking the install is healthy when it isn't.
### Auto-selected packs
`sponsio onboard` uses simple, conservative heuristics:
| Pack | Auto-included when… | Notes |
|---|---|---|
| `sponsio:core/universal` | Always | Empty stub, kept so existing `include:` lines don't error. |
| `sponsio:core/runaway` | Framework runs a multi-step loop (langgraph/crewai/…) | token budget, delegation depth, loop detection; no LLM calls |
| `sponsio:capability/shell` | A tool name matches `{bash, shell, exec, execute, execute_command, run_command, run_shell, run_bash, terminal, subprocess}` | Auto-fills `tool_rename:` if the user's tool name isn't the canonical `exec` |
| `sponsio:capability/filesystem` | A tool name matches `{read, read_file, open_file, write, write_file, edit, edit_file, apply_patch, patch_file, ...}` | Auto-fills `tool_rename:` and `workspace:` |
| `sponsio:incident/openclaw` | Never auto-included — opt-in only | CVE-derived rules for a specific vendor incident |
`sponsio packs` lists all shipped packs with live rule counts and include specs.
### Do NOT
- Do NOT edit `sponsio/contracts/*.yaml` inside the installed package — those are the shipped packs; they're read-only. Adjustments go in the user's `sponsio.yaml` via `overrides:` or `contracts:`.
- Do NOT flip `mode: enforce` during W1. The whole point of observe mode is to find false positives before they break production.
---
## W2 — Audit & refine (from scratch, or deepen an existing yaml)
Goal: produce or improve a `sponsio.yaml` from code / policy docs / traces, and explain every contract in plain language.
### Decide which sources to use
Sponsio contracts come from four sources, mixable in one yaml:
| # | Source | What it is | Command |
|---|---|---|---|
| 1 | **Shipped packs** | Pre-built, parameterized rule sets (`sponsio:core/universal`, `sponsio:capability/shell`, …) | Hand-add `include: [sponsio:<spec>]` — or W1's `onboard` does it automatically |
| 2 | **Extraction** | AST + optional LLM inference from your code / policy docs / execution traces | `sponsio scan <paths> [--llm] [--policy <doc>] [-t <trace-glob>]` |
| 3 | **User input** | An NL sentence or a structured dict the user writes | Hand-edit `sponsio.yaml`; validate a single NL string with `sponsio validate "<NL>"` |
| 4 | **Pattern library** | Deterministic parameterized templates (`rate_limit`, `must_precede`, `arg_blacklist`, …) — full list via `sponsio patterns` | `sponsio patterns` to browse; hand-write the YAML entry |
Match the user's input to the source(