git:20260512.2331923 to git:20260512.a4ba040

39 added, 95 removed. Audit A to A.

---
name: aeon-skill-repair
description: |
- Auto-diagnose and fix a failing or degraded installed skill. Reads the SKILL.md plus recent error
- output, classifies the failure category (api-change / rate-limit / timeout / sandbox-limitation /
- prompt-bug / output-format / missing-secret / config), and applies the matching playbook. Every
- fix includes a verification block the operator can execute. Use when a previously-working skill
- has started failing or producing low-quality output.
- Triggers: "fix this skill", "skill X is broken", "diagnose this failure", "auto-repair my
- failing skill", "the output of X looks wrong".
+ Auto-diagnose and fix a failing or degraded installed skill. Reads the SKILL.md plus recent
+ error output, classifies the failure (api-change / rate-limit / timeout / sandbox-limitation /
+ prompt-bug / output-format / missing-secret / config), applies the smallest fix that addresses
+ the root cause, and attaches a verification recipe. Minimum-edit principle, never auto-applies
+ high-risk changes.
+ Triggers: "fix this skill", "skill X is broken", "diagnose this failure", "the output of X
+ looks wrong".
---
# aeon-skill-repair
- Targeted repair for a single failing skill. Builds a diagnostic dossier, classifies the failure into a known category, and applies the corresponding playbook with a minimum-edit principle. Every repair ships with a verification step.
-
- ## Phases
-
- `PREFLIGHT → DIAGNOSE → REPAIR → VERIFY`
-
- The skill stops at the appropriate exit code if any phase finds nothing actionable.
+ Targeted repair for one failing skill. Build a diagnostic dossier, classify the failure, apply the matching playbook, attach a verification recipe.
## Inputs
| Param | Description |
|---|---|
| `target` | Skill name or SKILL.md path. Required. |
- | `error_output` | Optional. The skill's recent failed output (paste from run log). If absent, the skill will ask for it before proceeding. |
- | `mode` | `repair` (default) — apply the fix. `dry-run` — diagnose and propose without writing. |
-
- ## Diagnostic dossier
+ | `error_output` | Recent failed output (paste from run log). Required if not auto-detectable. |
+ | `mode` | `repair` (default) or `dry-run` (diagnose only). |
- Before touching any file, the skill assembles:
+ ## Diagnosis sources
- 1. **Skill file** — reads the target SKILL.md. Identifies frontmatter, declared data sources, env-var references.
- 2. **Error analysis** — parses `error_output` for known signatures (HTTP status codes, common API error strings, rate-limit hits, timeout patterns, refusal markers).
- 3. **Source liveness check** — if the skill references URLs / APIs, WebFetch each to check for 404s, redirects, or schema changes.
- 4. **Frontmatter integrity** — verifies the skill's frontmatter is valid YAML.
- 5. **Reference parity** — if the skill links references files, verifies they exist.
+ - The skill file (frontmatter, declared sources, env-var references).
+ - Error output signature (HTTP codes, common API errors, rate-limit hits, refusal markers).
+ - Source liveness — WebFetch on referenced URLs to detect 404s, redirects, schema changes.
+ - Frontmatter integrity (valid YAML).
- ## Categories and playbooks
+ ## Failure categories and fix scope
- | Category | Detection signal | Playbook |
+ | Category | Detection | Fix scope |
|---|---|---|
- | **api-change** | 404, 410, schema mismatch, deprecated endpoint warning | WebFetch the live API spec / status page / release notes. Update endpoints, payload shape, headers, error codes. Cite the spec URL in the fix notes. |
- | **rate-limit** | 429, "too many requests", rolling-window quota error | Add backoff or fallback endpoint. Never raise the limit from the skill side. If the skill's invocation cadence is too aggressive, recommend reducing it but don't change it unilaterally. |
- | **timeout** | Skill takes too long, partial output, killed mid-run | Stage the work, add early-return on partial success, downgrade the model if it doesn't need the most capable tier. |
- | **sandbox-limitation** | Outbound curl fails with auth headers; secrets not expanded in shell | Convert curls to a prefetch pattern (write to a state file before the agent runs) or postprocess pattern (write requests to a queue, process after). |
- | **prompt-bug** | Hallucination, refusal ("as an AI..."), missing required output section | Minimum-edit specificity insertion. Add the missing constraint, a forbidden phrase, a required output structure. Don't rewrite — < 30 lines diff. |
- | **output-format / quality-regression** | Output passes execution but fails downstream parser; eval assertions fail | Cross-reference the skill's eval manifest if one exists; edit until the next run satisfies the failing assertion. |
- | **missing-secret** | `not configured`, `API key missing`, env var unset | **Do not modify the skill.** Identify the missing env var by name, write a short note for the operator. Exit `REPAIR_DIAGNOSED_NO_FIX`. |
- | **config** | Bad input config (watchlist, distribution list, RSS feeds) | Validate the config file shape, fix obvious errors (trailing commas, malformed YAML), but never invent entries. |
- | **unknown** | None of the above | Don't edit blindly. Append the full dossier to a `repair-notes.md` file next to the skill, exit `REPAIR_DIAGNOSED_NO_FIX`. Operator triages. |
+ | `api-change` | 404/410, schema mismatch | Update endpoints/payload/headers per live spec. Cite the spec URL. |
+ | `rate-limit` | 429, "too many requests" | Add backoff or fallback endpoint. Never raise the limit. |
+ | `timeout` | Killed mid-run, partial output | Stage the work, add early-return on partial success. |
+ | `sandbox-limitation` | Auth-bearing curl fails | Convert to prefetch / postprocess pattern. |
+ | `prompt-bug` | Hallucination, refusal, missing required section | Minimum-edit specificity insertion. < 30 lines diff. |
+ | `output-format` | Output passes execution but fails downstream parser | Edit until next run satisfies the failing assertion. |
+ | `missing-secret` | "API key missing", env var unset | **No code change.** Name the missing var for the operator. Exit `REPAIR_DIAGNOSED_NO_FIX`. |
+ | `config` | Bad input config (watchlist, list file) | Fix obvious shape errors. Never invent entries. |
+ | `unknown` | None of the above | Don't edit blindly. Append dossier to repair-notes, exit `REPAIR_DIAGNOSED_NO_FIX`. |
## Risk classes
- Every proposed fix is labeled:
-
- | Class | Scope | Auto-apply? |
- |---|---|---|
- | **LOW** | Clarifying prompt edit, fallback added, comment-only change, < 30 lines diff. | Yes |
- | **MED** | Data source change, new env-var reference (must already be available), output format edit. | Yes with verification |
- | **HIGH** | Touches behavior fundamentally, removes features, changes default config. | **No — operator review required.** |
-
- ## Verification block
-
- Every repair (except `REPAIR_DIAGNOSED_NO_FIX`) emits a verification recipe:
-
- ```
- ## Verification
-
- To verify this repair worked:
-
- 1. Re-run the skill: `<one-line invocation>`
- 2. Expected behavior: <category-specific signal — e.g. "no rate-limit errors in output" /
- "produces ≥ 200 words" / "output matches required pattern X">
- 3. If still failing: <fallback path — e.g. "the error category may have been mis-classified;
- delete the repair-history entry and re-run repair">
- ```
+ - **LOW** — fallback added, comment-only, < 30 lines. Auto-applied.
+ - **MED** — data source change, output format edit. Auto-applied with verification recipe.
+ - **HIGH** — touches behavior fundamentally, changes defaults. **Operator review required, not auto-applied.**
- ## Output
+ ## Verification recipe (every repair)
```
- *Skill Repair — token-movers — 2026-05-12*
-
- Diagnosis
- Category: api-change
- Signal: HTTP 410 from /v1/markets endpoint (consistent across 5 recent runs)
- Root cause: CoinGecko deprecated v1 in favor of /api/v3/coins/markets
-
- Fix applied
- Updated 3 endpoint references in skills/token-movers/SKILL.md
- Risk: MED (data source change, no new env vars)
- Diff: +12 -9 lines
-
- Verification
- Re-run: bankr-run token-movers
- Expected: output contains "Top movers" header, lists ≥ 5 coins, no HTTP 410 errors in trace
-
- Notes
- CoinGecko v1 deprecation announced 2026-02-15. v3 schema is broadly compatible — field names
- preserved. If field-level differences surface in production, re-run skill-repair against the
- new error signature.
+ 1. Re-run the skill: <one-line invocation>
+ 2. Expected: <category-specific signal — "no rate-limit in trace" / "≥ 200 words" / "matches pattern X">
+ 3. If still failing: <fallback path>
```
## Cooldown
- A skill cannot be auto-repaired more than once in a 24h window without operator confirmation. Prevents repair loops on fixes that didn't stick. The cooldown state is stored in a local `repair-history.json`.
-
- ## Guardrails
-
- - One target per run. Never bundles unrelated repairs.
- - Minimum-edit principle. Diffs are small.
- - Never modifies env-var configuration; missing secrets are flagged for the operator.
- - HIGH-risk fixes are proposed, not applied.
- - For repairs inside a git repo, changes land in a branch (`repair/${target}`), never directly on main.
-
- ## Required keys
-
- None directly. The `api-change` playbook may use WebFetch to look up live API specs.
+ 24h cooldown per skill — prevents repair loops on fixes that didn't stick. State in local `repair-history.json`.
- ## Pairs with
+ ## Rules
- - `aeon-skill-evals` upstream (surfaces what's failing).
- - `aeon-autoresearch` for quality lifts vs deterministic bugs.
+ - One target per run. Never bundle unrelated repairs.
+ - Minimum-edit principle. Small diffs.
+ - Never modify env-var configuration. Missing secrets are flagged for the operator.
+ - Inside a git repo: branch + diff, never directly to main.