ai-simplify-sweep
$
npx mdskill add arcasilesgroup/ai-engineering/ai-simplify-sweepAutomatically reduces code complexity weekly with human review.
- Eliminates dead branches and redundant guards from stale code.
- Integrates with the /ai-simplify tool as a scheduled wrapper.
- Gates changes by opening draft PRs instead of auto-merging.
- Triggers on weekly simplify sweep or scheduled simplification commands.
SKILL.md
.github/skills/ai-simplify-sweepView on GitHub ↗
--- name: ai-simplify-sweep description: Sweeps stale code complexity weekly via a scheduled /ai-simplify wrapper, gates the diff, and opens a draft PR for human review. Trigger for 'weekly simplify sweep', 'scheduled simplification', 'simplification sweep', 'simplify pass'. Never auto-merges. Not for in-flight feature work; use /ai-simplify instead. Not for security cleanup; use /ai-security instead. effort: cheap argument-hint: "[--dry-run] [--no-pr]" mode: agent tags: [meta, simplification, scheduled, autonomous] model_tier: haiku mirror_family: copilot-skills generated_by: ai-eng sync canonical_source: .claude/skills/ai-simplify-sweep/SKILL.md edit_policy: generated-do-not-edit --- # Simplify Sweep ## Purpose Codebases accumulate entropy: dead branches, redundant guards, copy-pasted helpers, layers of indirection. `/ai-simplify` already exists to fight that, but it requires manual invocation and humans rarely remember. This skill is a scheduled wrapper that runs simplify on a cadence, gates the diff, and opens a draft PR so a human reviews the proposed reductions before merge. ## When to Use - Weekly automated maintenance pass (recommended cadence). - Before a release-cut to clear obvious simplifications. - NOT for in-flight feature work — those should call `/ai-simplify` directly. ## Hard Rules - Never auto-merge. The PR is always opened with `--draft`. - Never run aggressive refactors. Conservative defaults only — guard clauses, early returns, dead-code removal, single-call-site inlines. - If the simplify diff is empty, exit cleanly with a status event; do NOT open an empty PR. ## Process ### Step 1 — Invoke `/ai-simplify` in non-interactive mode Read `.github/skills/ai-simplify/SKILL.md` (when present) to confirm whether an explicit `--auto` flag exists. If not, invoke with conservative defaults equivalent to: ``` /ai-simplify --conservative ``` Capture the diff. If the diff is empty, emit a `framework_operation` event with `operation=simplify_sweep_no_op` and exit 0. ### Step 2 — Gate the diff If the diff is non-empty, run the standard pre-commit gate locally: ```bash ai-eng gate run --cache-aware --json --mode=local ``` If the gate fails, emit `operation=simplify_sweep_gate_failed` with the failure summary and exit 1 — do NOT open a PR with broken code. ### Step 3 — Commit + open draft PR ```bash /ai-commit "chore(simplify-sweep): weekly automated simplification sweep" /ai-pr --draft --title "chore(simplify-sweep): weekly simplification" --body "Automated weekly entropy sweep. Review the diff before merge." ``` The PR title and body explicitly mark this as an automated entropy GC pass so reviewers can apply lighter scrutiny than for feature PRs but still verify the simplifications preserve behaviour. ## Scheduling Recommended invocation pattern (run once to register the routine): ``` /schedule weekly /ai-simplify-sweep ``` This skill does NOT auto-create the cron entry — that requires user authorization via `/ai-schedule`. Operators register the routine after reviewing the skill behaviour. ## Telemetry Each run emits one of: - `framework_operation` `operation=simplify_sweep_started` — at invocation. - `framework_operation` `operation=simplify_sweep_no_op` — empty diff, no PR opened. - `framework_operation` `operation=simplify_sweep_gate_failed` — diff produced but gate refused. - `framework_operation` `operation=simplify_sweep_pr_opened` — happy path, includes `pr_url`. ## Common Mistakes - Auto-merging the resulting PR. The skill MUST open a draft; merge requires a human. - Running aggressive simplify modes. Conservative only — simplify-sweep trades surface area for safety. - Scheduling more frequently than weekly. Sub-weekly cadence floods reviewers with noisy PRs. ## Examples ### Example 1 — manual weekly run User: "run the weekly simplify sweep on this repo" ``` /ai-simplify-sweep ``` Invokes `/ai-simplify --conservative`, gates the diff, and opens a draft PR titled `chore(simplify-sweep): weekly simplification`. ### Example 2 — dry-run before scheduling User: "preview what the simplify sweep would touch this week" ``` /ai-simplify-sweep --dry-run ``` Runs the simplify pass and prints the diff without staging a commit or PR — useful for reviewing scope before enabling a cron entry. ## Integration Called by: `/ai-schedule` (weekly cron) or operator manually. Calls: `/ai-simplify` (conservative mode), `/ai-commit`, `/ai-pr --draft`. See also: `/ai-branch-cleanup` (lifecycle sweep), `/ai-skill-improve` (skill-level improvement). - Telemetry: `framework_operation` events aggregated from `framework-events.ndjson`. ## Scheduled cadence (spec-121) The schedule layer should call the deterministic wrapper, not the slash command directly: ``` 0 4 * * 1 <project>/.ai-engineering/scripts/scheduled/simplify-sweep.sh ``` The wrapper resolves `$AIENG_PROJECT_ROOT` (or falls back to `git rev-parse --show-toplevel`), invokes `ai-eng simplify --conservative --no-pr` when the CLI is on PATH, and emits a `framework_operation` event (`operation=simplify_sweep_scheduled_run`) with `outcome=success|failure|skipped` for every cycle. Never auto-merges; PR opening stays the responsibility of the slash-command path. Activate via `/ai-schedule weekly <project>/.ai-engineering/scripts/scheduled/simplify-sweep.sh` or copy the cron line above into your scheduler. ## References - Skill source of truth: `.github/skills/ai-simplify-sweep/SKILL.md` - Related: `.github/skills/ai-simplify/SKILL.md`, `.github/skills/ai-schedule/SKILL.md` - Manifest entry: `.ai-engineering/manifest.yml` `skills.registry.ai-simplify-sweep` - Scheduled wrapper: `.ai-engineering/scripts/scheduled/simplify-sweep.sh`
More from arcasilesgroup/ai-engineering
- ai-adviseProactive governance advisor — checks standards, decisions, and quality trends during development. Always advisory, NEVER blocks. Three modes: `advise` (post-edit), `gate` (pre-dispatch), `drift` (on-demand decision audit). Trigger for 'governance check', 'advise on this change', 'check for drift', 'is this aligned with active decisions', 'shift-left advisory'. Not for blocking gates — use /ai-verify. Not for narrative code review — use /ai-review.
- ai-analyze-permissionsUse when Claude Code keeps asking to approve commands you have already approved, when settings.local.json has grown large, or when you want to consolidate permission grants into wildcard patterns. Trigger for 'too many permission prompts', 'clean up permissions', 'audit my settings', 'consolidate allow rules'. Claude Code only — not available in GitHub Copilot, Antigravity, or Codex.
- ai-animationDesigns motion, transitions, and micro-interactions for UI components: spring animations, gestures, easing, staggers — taste-driven detail compounding. Trigger for 'animate this', 'add transitions', 'micro-interactions for', 'gesture design', 'swipe to dismiss', 'easing for this', 'stagger the'. Not for design systems; use /ai-design instead. Not for visual art; use /ai-visual instead. Not for testing animation code; use /ai-test instead.
- ai-autopilotDelivers large multi-concern specs and backlog runs autonomously: decomposes specs into sub-specs (or normalizes work items into a backlog DAG), deep-plans with parallel agents, builds a dependency DAG, implements in waves, runs a single final quality loop with one bounded quality-remediation pass (verify+guard+review on full changeset), delivers via PR. Trigger for 'implement spec-NNN end to end', 'autopilot this', 'autonomous delivery', 'decompose and ship', 'run the backlog', 'execute these GitHub issues', 'process the sprint backlog'. Invocation is the approval gate. Not for small or single-concern tasks; use /ai-build instead. Not for ambiguous requirements; use /ai-brainstorm first.
- ai-boardOperates the project board (GitHub Projects v2 or Azure DevOps): discovers configuration after install (fields, state mappings, process templates) and syncs work-item state at lifecycle transitions. Trigger for 'set up the board', 'configure our ADO board', 'discover board fields', 'move this issue to in-review', 'update the board', 'mark as in progress', 'sync the work item state'. Two subcommands: `discover` (post-install configuration write) and `sync` (lifecycle state transitions). Auto-invoked via `sync` by /ai-brainstorm, /ai-build, and /ai-pr; fail-open. Not for backlog execution; use /ai-autopilot --backlog instead.
- ai-brainstormForces rigorous design interrogation BEFORE any code: explores approaches, surfaces ambiguity, gathers evidence, produces an approved spec that becomes the contract for /ai-plan. Trigger for 'lets add X', 'how should we handle Y', 'whats the best approach', 'I am thinking about', 'what should we build for'. Not for existing approved specs; use /ai-plan instead. Not for execution; use /ai-build instead.
- ai-branch-cleanupCleans branches safely: switches to the default branch, prunes merged and squash-merged branches, syncs to remote, sweeps stale specs, rotates `.ai-engineering/runtime/` per retention policy. Trigger for 'tidy up', 'tidy branches', 'sync to main', 'delete old branches', 'start fresh', 'rotate runtime'. Auto-invoked by /ai-pr after merge. Not for committing changes; use /ai-commit instead. Not for code-level dead-code removal; use /ai-simplify instead.
- ai-buildCanonical implementation gateway: reads approved plan.md, resolves stack from manifest, deterministic-routes each task to its adapter, dispatches the build agent in an isolated worktree, runs TDD self-validation per task, then a single final quality loop with one bounded quality-remediation pass on the full changeset before /ai-pr. Trigger for 'go', 'start building', 'execute the plan', 'implement it', 'lets do this', 'build the plan', 'resume', 'continue'. Not without an approved plan; run /ai-plan first. Not for multi-concern specs needing decomposition; use /ai-autopilot instead. Not for a single function or subcomponent; use /ai-code.
- ai-codeWrites production code that satisfies stack-context standards on the first pass: interface-first design, backward-compatibility checks, lightweight self-review. Trigger for 'implement this', 'write the code for', 'add X to Y', 'build this function', 'make this work'. Not for tests; use /ai-test instead. Not for debugging; use /ai-debug instead. Not for refactoring; use /ai-simplify instead. Not for executing an approved plan end-to-end; use /ai-build (the gateway).
- ai-commitRuns the governed commit pipeline: auto-branches from protected, stages selectively, formats and lints, scans for secrets, gates docs, composes a conventional message, pushes. Trigger for 'commit my changes', 'save my work', 'push this to remote', 'stage these files', 'ship it'. Not for opening a PR; use /ai-pr instead. Not for branch hygiene; use /ai-branch-cleanup instead.