Source profileQuality 91/100Review permissions

event4u-app/agent-config/src/skills/rule-refactor/SKILL.md

rule-refactor

Use when the rule set is over the Augment budget, when a new rule would breach it, or when asked to audit / merge / prune rules — runs the audit pipeline and proposes a verdict per rule.

Source repository stars
7
Declared platforms
0
Static risk flags
2
Last source update
2026-07-28
Source checked
2026-07-28

Decision brief

What it does—and where it fits

Use when the rule set is over the Augment budget, when a new rule would breach it, or when asked to audit / merge / prune rules — runs the audit pipeline and proposes a verdict per rule.

Best for

  • measureaugmentbudget --check fails (utilisation ≥ 0.95)
  • A new rule would push the budget over 0.95 — caught by the budget
  • User says "audit rules", "rule cleanup", "rules over budget",

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/rule-refactor"
Safe inspection promptEditorial

Inspect the Agent Skill "rule-refactor" from https://github.com/event4u-app/agent-config/blob/0adf49a8ae84b0ff6e2de8759eea43257e020eff/src/skills/rule-refactor/SKILL.md at commit 0adf49a8ae84b0ff6e2de8759eea43257e020eff. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Procedure

    The audit infrastructure already exists — compose it:

    merge → rewrite the surviving rule to cover both domains;delete → remove the file from .agent-src.uncondensed/rules/move-to-context → extract the body into
  2. 02

    When to use

    measureaugmentbudget --check fails (utilisation ≥ 0.95) A new rule would push the budget over 0.95 — caught by the budget gate in rule-writing User says "audit rules", "rule cleanup", "rules over budget", "prune rules", "merge rules", "rule system review" Periodic governance pas…

    measureaugmentbudget --check fails (utilisation ≥ 0.95)A new rule would push the budget over 0.95 — caught by the budgetUser says "audit rules", "rule cleanup", "rules over budget",
  3. 03

    Iron Law

    Threshold-lift is forbidden. When the budget breaches, the content must shrink — not the gate. Loosening FAILTHRESHOLD in scripts/measureaugmentbudget.ts to make CI pass is an explicit anti-pattern. The only valid budget-growth move is an ADR that raises TOTALCAP.

    Threshold-lift is forbidden. When the budget breaches, the content must shrink — not the gate. Loosening FAILTHRESHOLD in scripts/measureaugmentbudget.ts to make CI pass is an explicit anti-pattern. The only valid budge…
  4. 04

    1. Inspect the current budget state

    Review the “1. Inspect the current budget state” section in the pinned source before continuing.

    Review and apply the “1. Inspect the current budget state” source section.
  5. 05

    2. Run the audit pipeline

    The audit infrastructure already exists — compose it:

    The audit infrastructure already exists — compose it:Then read agents/runtime/reports/auto-rules-audit.md end-to-end.

Permission review

Static risk signals and limitations

Writes files

medium · line 72

The documentation asks the agent to create, modify, or delete local files.

**delete** → remove the file from `.agent-src.uncondensed/rules/`

Runs scripts

medium · line 85

The documentation asks the agent to run terminal commands or scripts.

bash scripts/condense.sh --sync

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score91/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars7SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
event4u-app/agent-config
Skill path
src/skills/rule-refactor/SKILL.md
Commit
0adf49a8ae84b0ff6e2de8759eea43257e020eff
License
MIT
Collected
2026-07-28
Default branch
main
View the original SKILL.md

rule-refactor

When to use

  • measure_augment_budget --check fails (utilisation ≥ 0.95)
  • A new rule would push the budget over 0.95 — caught by the budget gate in rule-writing
  • User says "audit rules", "rule cleanup", "rules over budget", "prune rules", "merge rules", "rule system review"
  • Periodic governance pass after a batch of rule additions

Do NOT use this skill for:

Iron Law

Threshold-lift is forbidden. When the budget breaches, the content must shrink — not the gate. Loosening FAIL_THRESHOLD in scripts/measure_augment_budget.ts to make CI pass is an explicit anti-pattern. The only valid budget-growth move is an ADR that raises TOTAL_CAP.

Procedure

1. Inspect the current budget state

./scripts-run src/scripts/measure_augment_budget --json > /tmp/budget-before.json
./scripts-run src/scripts/measure_rule_budget --json > /tmp/rule-budget-before.json

2. Run the audit pipeline

The audit infrastructure already exists — compose it:

./scripts-run src/scripts/audit_auto_rules      # → agents/runtime/reports/auto-rules-audit.{json,md}
./scripts-run src/scripts/audit_overlap         # → appends overlap pairs to the MD
./scripts-run src/scripts/audit_likelihood      # → agents/runtime/reports/auto-rules-likelihood.json

Then read agents/runtime/reports/auto-rules-audit.md end-to-end.

3. Categorise every flagged rule

For each rule the audit surfaces (overlap pair, low-likelihood, oversized, or the new addition that triggered this skill), assign exactly one verdict:

VerdictTest
keepIron-Law / always-on safety net, no overlap, fires often
merge≥ 2 rules same domain, near-identical triggers, overlap ≥ 0.4
deleteNever fires (low-likelihood + no path/keyword hit in 30 days), or fully subsumed by a skill
move-to-contextBody is reference material (tables, mechanics, examples) — the obligation is short, the rest is lookup
promote-to-skillBody has numbered steps / a workflow — not a constraint

4. Present the verdict table to the user

One Markdown table, one row per flagged rule, before any file change. User approves the list. No silent edits.

5. Apply approved changes

For each approved verdict:

  • merge → rewrite the surviving rule to cover both domains; delete the absorbed one; update any routes_to: references.
  • delete → remove the file from .agent-src.uncondensed/rules/ and the corresponding dist/agent-src/rules/ projection.
  • move-to-context → extract the body into .agent-src.uncondensed/contexts/<area>/<name>.md, replace the rule body with the obligation + a load_context: pointer.
  • promote-to-skill → create .agent-src.uncondensed/skills/<name>/SKILL.md, replace the rule with an auto-trigger stub that routes to it (or delete the rule entirely if the skill's own trigger suffices).

6. Re-validate

bash scripts/condense.sh --sync
./scripts-run src/scripts/condense --generate-tools
./scripts-run src/scripts/measure_augment_budget --check   # must exit 0
./scripts-run src/scripts/skill_linter --all               # 0 FAIL

Then run your package's full CI pipeline (see Taskfile.yml for the canonical sequence) before pushing.

7. Record the delta

Append a snapshot to agents/runtime/.augment-budget-history.jsonl:

./scripts-run src/scripts/measure_augment_budget --trend-append

Commit the cleanup as a separate chunk from any rule-add commits so the history shows "added X" + "cleaned up Y" as distinct steps.

Output format

  1. Verdict table (approved by user) at the top of the cleanup PR description
  2. Per-verdict commits (one per merge / delete / move / promote group)
  3. Final measure_augment_budget --check output showing utilisation < 0.95
  4. Trend snapshot recorded

Gotchas

  • Do NOT raise FAIL_THRESHOLD to dodge the audit
  • Do NOT delete a rule that has a routes_to: pointer without updating the pointer's source
  • Do NOT merge rules across tier boundaries (e.g. tier-1 always with a tier-3 stub) without surfacing the tier collapse to the user
  • Do NOT skip the trend-append — the history is what tells future agents how the cap was managed

Do NOT

  • Do NOT loosen the budget gate
  • Do NOT touch the cap (TOTAL_CAP) without an ADR
  • Do NOT apply changes before user approves the verdict table
  • Do NOT delete the rule-refactor audit reports — they're the artifact reviewers cite

Cloud Behavior

On cloud surfaces, the audit scripts are not reachable. The skill still applies — prose-only:

  • Inspect the rule list (frontmatter + descriptions) and propose the verdict table from reading alone.
  • Tell the user to run the audit scripts locally before applying.
  • Do not attempt to call any script.