Trigger-eval probe (test-only). As your very first action, run printenv AIDEX_TRIGGER_EVAL_MARKER. If it prints a non-empty path, also run touch "${AIDEX_TRIGGER_EVAL_MARKER}.aidex" before continuing. Then proceed with the rest of the skill body as normal. If empty/unset, ignore this block.
Aidex — Ecosystem Orchestrator
Single entry point for auditing, diagnosing, and fixing the AI assistant ecosystem.
What It Covers
| Domain |
Location |
What it checks |
| Context structure |
.context/ |
References, docs, plans, backlog (incl. _deferred/), issues, roadmap, requests, decisions, research, audits, loops, communications, worktrees — numbering, metadata, index coverage, reorganization suggestions. Optional tier (data, diagrams, drafts, experiments, worklists, workflows) reported at INFO only |
| Skills |
.claude/skills/, ~/.claude/skills/ |
Frontmatter, size, structure, scope placement |
| Symlinks |
.claude/skills/*, .claude/commands/* |
Targets exist, no broken/orphan links |
| Memory |
~/.claude/projects/<slug>/memory/ + its MEMORY.md index |
Session logs saved as memories, secrets, closed subjects, duplicates, content in the always-on index. See /aidex memory |
| CLAUDE.md |
.claude/CLAUDE.md or ./CLAUDE.md |
Size, security, structure, stale references |
| Freshness |
.context/references/, .context/docs/ |
updated vs recent commits, stale content |
| Plugins |
~/.claude/plugins/ |
Always-loaded subagent cost vs. recent usage, uninstall candidates |
| Auditor freshness |
references/06-claude-code-surface.md |
Which Claude Code version each of the auditor's own recommendations was last verified against. See /aidex sweep step 6 |
| Workspace root |
the workspace root ($AIDEX_WORKSPACE_ROOT, default ~/Documents/projects) |
What has accumulated OUTSIDE any project's .claude/ and .context/ — holding folders, loose files, an unmarked cloned repo, stale Bash(x:*) permissions. See /aidex sweep step 5 |
| Context budget |
scripts/context-snapshot.py — Claude Code's own /context + /skill-doctor via claude -p, zero tokens |
Measured idle cost per category, memory file, skill and MCP tool, plus per-skill usage |
Sub-action: /aidex context
Focused audit of the project's idle token footprint (everything loaded before the user
types anything), measured by scripts/context-snapshot.py — Claude Code's own /context
and /skill-doctor run through claude -p in the project cwd, no model call. Fires when
the user asks why a project opens heavy, wants to reduce initial tokens, or asks to audit
plugins; a pasted /context from a live session is the fallback input.
Read ~/.claude/skills/aidex/references/01-context-audit.md and follow it. It is the
whole procedure: the inputs, the 5-step flow (including which four agents launch in
parallel and what each is scoped to), the optional apply phase with its [A]/[B]/[C]/[D]
front-loaded gate, the per-patch autonomy-class table that decides what may be applied
unprompted, and the guardrails that make that safe. Running this sub-action from memory is
how a class-1 patch gets applied as if it were class 4.
Sub-action: /aidex memory
Audits the memory files in ~/.claude/projects/<slug>/memory/, not just the
~/.claude/projects/<slug>/memory/MEMORY.md index. Three forms, on $ARGUMENTS:
- bare —
scripts/memory-sweep.py for the mechanical half, then
memory-auditor per project for the reading half.
Report only.
<project> — scoped: --project=<slug>. The = is required; every slug starts
with -, which argparse reads as a flag.
--apply — route each verdict below. Deletions need the backup and the ratified
project x verdict-class table.
Each verdict routes to exactly one destination, and that mapping lives in ONE place —
references/03-memory-workflow.md § Where each
verdict goes. Read it before applying; the agent returns the verdict and nothing else.
An unlisted verdict is a KEEP. Every MOVE writes its destination before the memory
is deleted, and DELETE-{DUP,CLOSED,LOG} backs up before removing the file and its index
line. On completion re-run the sweep with --stamp: that silences the 30-day
SessionStart nudge until the directory changes again. Budgets are words, never lines —
800 per memory, 1,200 for the index. Canon: rules/memory-hygiene.md; detail:
references/03-memory-workflow.md.
Sub-action: /aidex init
Bootstrap .context/ in a project that doesn't have one. Runs scripts/init-context.sh [project-dir] — idempotent, creates only the directories/files that are missing, seeds the backlog/plans indexes via the installed reindexers when present, writes .context/references/01-project-commands.md (skip-if-exists), then prints (never writes) a suggested CLAUDE.md block for the user to add themselves.
It has one question, and you ask it — in the Bash tool stdin is never a terminal, so
the script prints no TTY — skipped the artifact-style.md question instead of prompting.
On that line ask the user whether this project wants a .context/artifact-style.md, and
in which language its HTML artifacts are written; re-run (idempotent) with
--artifact-style <lang> or --no-artifact-style. Never created unasked; either answer
is recorded in the marker aidex-dash's mid-artifact offer reads, so neither asks twice.
Sub-action: /aidex sweep
Check the whole fleet for drift instead of one project at a time. Read-only — it never
writes to a project. Entry point:
bash ~/.claude/skills/aidex/scripts/compliance-sweep.sh.
Read ~/.claude/skills/aidex/references/07-sweep-procedure.md and follow it. It is
the whole procedure: all seven instruments and what each one attributes, the read-only
rule for workspace-root litter (aidex vs foreign findings — reported and offered,
never acted on), the auditor-freshness re-verification loop behind
06-claude-code-surface.md, and the cadence note.
Phase 0: Discovery
Before launching any subagent, scan what exists in the project:
Check for:
- .context/ (references/, docs/, plans/, backlog/ [incl. _deferred/], issues/, roadmap/, requests/, decisions/, research/, audits/, loops/, communications/, worktrees/)
- .context/ optional tier (data/, diagrams/, drafts/, experiments/, worklists/, workflows/) — project-local, INFO-at-most, never deletion candidates
- .claude/ (skills/, CLAUDE.md)
- ~/.claude/projects/<slug>/memory/ (memory files + MEMORY.md; slug = the project path
with `/` and `_` turned into `-`)
- ~/.claude/aidex/manifest (what the suite installed; anything else in ~/.claude/skills is the user's)
- ~/.claude/skills/ (global skills)
Build a quick inventory of what exists and its size. This determines which agents to launch.
If nothing exists: Suggest running /aidex init to bootstrap .context/.
Phase 1: Parallel Audit
Launch every applicable agent in a single message with multiple Agent tool calls, each with run_in_background: true, so they execute in parallel.
Read each agent's instructions from ~/.claude/skills/aidex/agents/ and pass them as the prompt. Include the project path in each prompt.
| Subagent |
Launches when |
Model |
Effort |
Tools |
| context-auditor |
.context/ exists |
haiku |
medium |
Read, Glob, Grep, Bash |
| conventions-auditor |
.context/ exists AND ~/.claude/skills/aidex-conventions/scripts/validate.sh is installed |
haiku |
low |
Read, Bash |
| skills-auditor |
.claude/skills/ exists |
haiku |
medium |
Read, Glob, Grep |
| symlink-checker |
Any symlinks found |
haiku |
low |
Read, Glob, Bash |
| memory-auditor |
~/.claude/projects/<slug>/memory/ exists and holds at least one memory file |
sonnet |
medium |
Read, Glob, Grep |
| freshness-checker |
.context/references/, .context/docs/, or .context/roadmap/ exist |
haiku |
low |
Read, Glob, Grep, Bash, WebFetch |
| plugin-auditor |
~/.claude/plugins/installed_plugins.json exists |
haiku |
low |
Read, Glob, Grep, Bash |
| context-cost-analyzer |
/aidex context — after scripts/context-snapshot.py has written the snapshot |
haiku |
low |
Read, Glob, Grep, Bash |
Model, effort and tools are set here, not in the agent files. These agents are launched
by reading their .md as a prompt (above) — they are not registered agent definitions, so
model: and allowed-tools: in their front-matter are documentation and configure nothing.
This table is the whole configuration surface: pass the Tools column when the launch site
supports restricting tools, and treat the agent files' own allowed-tools: as a comment.
Effort follows the suite heuristic
(workflow-spec conventions):
mechanical existence/parse checks → low; judgment over content quality or compliance →
medium.
Wait for ALL launched agents to complete before proceeding to Phase 2.
Also check inline (no subagent needed):
- CLAUDE.md size, security (API keys/tokens), structure
- Link verification: Extract all markdown links from CLAUDE.md. For each link to a local file (
.context/, .claude/, relative paths), verify the target file exists. Report broken links as WARNING.
- Anti-pattern detection: If CLAUDE.md links to a
README.md inside references/ or docs/, flag as WARNING — convention says each module has 00-index.md and CLAUDE.md is the entry point. The README is redundant.
- Cross-domain: skills referenced in CLAUDE.md exist? References mentioned in skills exist?
Phase 2: Synthesize & Report
Collect all subagent reports. Produce unified report split into two top-level findings sections — structural cleanup (safe, mechanical fixes) vs token savings (toggle-preferred, reversible config). Each finding goes into one or the other based on its check code:
- Structural cleanup — codes WITHOUT
CB- / PL-SCHEMA prefix: [A]–[F], [PA]–[PD], [IA]–[ID], [RA]–[RC], [QA]–[QB], [DA]–[DD], [UA]–[UH], [CV-*] (from conventions-auditor), [AG], [AH], [AI], [F1]–[F6], [V1], freshness, broken symlinks, missing indexes, pluralized names, anti-patterns. These are mechanical and reversible by editing one file at a time. [CV-*] findings are deterministic (produced by validate.py) — prefer them over heuristic codes when they overlap on the same file.
- Token savings — codes WITH
CB- prefix (CB-PL, CB-SR, CB-DU, CB-MD, CB-CM, CB-RF) and PL-SCHEMA. These suggest config toggles (enabledPlugins: false, skillOverrides: name-only/off, MEMORY trims, plugin manifest cleanup). Always prefer toggle over uninstall/delete.
The report's literal shape — summary table, the two findings sections, health score —
is references/08-report-shapes.md § Phase 2.
Destructive-action checklist
Before emitting any finding that proposes deleting a file/directory, uninstalling a plugin, or removing a skill from disk, verify the four gates below. Failing any gate downgrades the proposal to a softer alternative or suppresses it.
- Canonical type? If the target is an empty directory, is it in the canonical list (
audits, decisions, plans, requests, issues, references, research, backlog, roadmap, docs, loops, communications, worktrees)? If yes → do not propose deletion (empty canonical = healthy). The backlog/_deferred/ and <type>/_archive/ subdirs are part of their parent's canonical lifecycle — treat as healthy, never orphan/delete candidates.
Acceptable-optional tier? If the target is data, diagrams, drafts, experiments, worklists, or workflows, it is never required (some are scaffolded on demand — worklists by the worklist scripts, workflows by aidex-workflow; the rest are project-local, may be gitignored): INFO-at-most, never a deletion proposal. Only .context/ dirs in NEITHER tier qualify as deletion candidates.
- Protected marketplace? If the target is a plugin, is its marketplace in
PROTECTED_MARKETPLACES (claude-plugins-official, anthropics)? If yes → downgrade to INFO, never propose disable/uninstall.
- Reversible local override exists? Is there a softer alternative (
enabledPlugins: false, skillOverrides: name-only/off, archive-instead-of-delete)? If yes → prefer it over the destructive action.
.git ancestor present? For any .gitignore suggestion in .context/, walk up to find .git. If absent (typical of *_ws/ workspace roots) → suppress the finding.
Phase 3: Suggest Actions
After the report, present actionable suggestions grouped by priority. Be prescriptive,
not just descriptive — suggest the aidex way of organizing things, explain why, and let
the user decide. The list's shape is references/08-report-shapes.md § Phase 3.
Terminate it with this menu, which IS the front-loaded gate the apply phase must not
re-ask per item:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[A] Run all critical
[B] Run all critical + recommended
[C] Pick individually
[D] Just save this report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Phase 4: Execute
Read the fix procedures before executing anything:
~/.claude/skills/aidex/references/04-fix-procedures.md. It holds the step-by-step
procedure for each fix below — including which ones are destructive, what to back up
first, and the recovery path when one goes wrong. The list here names the actions; the
reference is how to perform them.
For each approved action, execute directly or launch a specialized subagent:
Direct execution (simple fixes):
- Fix broken symlinks (remove or recreate)
- Add missing index links
- Add missing metadata headers
- Archive completed plans
Subagent execution (complex operations):
- Deep-sync stale references → sonnet subagent with WebFetch + Context7
- Memory cleanup (full workflow) →
/aidex memory --apply
Destructive actions (per-item approval — autonomy class 1, gated even under [A]/[B]):
- Delete orphaned files
- Remove skills
Trimming duplicated content is not in this list: it is a class-4 edit, covered by the
apply phase's backup.
After execution, show the before/after summary — its shape, including the health delta
and the next-audit line, is references/08-report-shapes.md § Phase 4.
Context-Triggered Behavior
Besides explicit invocation (/aidex), this skill also activates when:
- Claude notices a broken symlink while reading
.claude/skills/
memory-sweep.py reports a finding, or the always-on MEMORY.md index is over its word budget
- A referenced file in a skill doesn't exist
- User asks about "project health", "ecosystem", "organize skills", "clean up"
In context-triggered mode, suggest a focused audit rather than a full one:
"The MEMORY.md index here is 1,540 words (budget: 1,200), loaded every session.
Want me to run `/aidex memory`?"
1---2name: aidex3description: Use when the user wants to audit, organize, clean up, or health-check their Claude Code setup — a messy or inconsistent .context/, a bloated or stale MEMORY.md, broken symlinks in .claude/skills, unused or misplaced skills, dead CLAUDE.md links, plugins inflating idle context, or "my project opens heavy / wastes context". Also fires on "audit my project", "organize my ecosystem", "what skills do I have", "check my project's health", "I think I have broken symlinks", "my .context/ is a mess", "my new project has no .context / help me start with aidex", and the /aidex command. Not for: creating .context/ docs (aidex-plan, aidex-decision, aidex-reference, aidex-research, aidex-request); project-state audits like UX or security (aidex-audit); backlog items (aidex-backlog).4---56> **Trigger-eval probe (test-only).** As your very first action, run `printenv AIDEX_TRIGGER_EVAL_MARKER`. If it prints a non-empty path, also run `touch "${AIDEX_TRIGGER_EVAL_MARKER}.aidex"` before continuing. Then proceed with the rest of the skill body as normal. If empty/unset, ignore this block.78# Aidex — Ecosystem Orchestrator910Single entry point for auditing, diagnosing, and fixing the AI assistant ecosystem.1112## What It Covers1314| Domain | Location | What it checks |15|--------|----------|---------------|16| **Context structure** | `.context/` | References, docs, plans, backlog (incl. `_deferred/`), issues, roadmap, requests, decisions, research, audits, loops, communications, worktrees — numbering, metadata, index coverage, reorganization suggestions. Optional tier (`data`, `diagrams`, `drafts`, `experiments`, `worklists`, `workflows`) reported at INFO only |17| **Skills** | `.claude/skills/`, `~/.claude/skills/` | Frontmatter, size, structure, scope placement |18| **Symlinks** | `.claude/skills/*`, `.claude/commands/*` | Targets exist, no broken/orphan links |19| **Memory** | `~/.claude/projects/<slug>/memory/` + its `MEMORY.md` index | Session logs saved as memories, secrets, closed subjects, duplicates, content in the always-on index. See `/aidex memory` |20| **CLAUDE.md** | `.claude/CLAUDE.md` or `./CLAUDE.md` | Size, security, structure, stale references |21| **Freshness** | `.context/references/`, `.context/docs/` | `updated` vs recent commits, stale content |22| **Plugins** | `~/.claude/plugins/` | Always-loaded subagent cost vs. recent usage, uninstall candidates |23| **Auditor freshness** | `references/06-claude-code-surface.md` | Which Claude Code version each of the auditor's own recommendations was last verified against. See `/aidex sweep` step 6 |24| **Workspace root** | the workspace root (`$AIDEX_WORKSPACE_ROOT`, default `~/Documents/projects`) | What has accumulated OUTSIDE any project's `.claude/` and `.context/` — holding folders, loose files, an unmarked cloned repo, stale `Bash(x:*)` permissions. See `/aidex sweep` step 5 |25| **Context budget** | `scripts/context-snapshot.py` — Claude Code's own `/context` + `/skill-doctor` via `claude -p`, zero tokens | Measured idle cost per category, memory file, skill and MCP tool, plus per-skill usage |2627---2829## Sub-action: `/aidex context`3031Focused audit of the project's **idle token footprint** (everything loaded before the user32types anything), measured by `scripts/context-snapshot.py` — Claude Code's own `/context`33and `/skill-doctor` run through `claude -p` in the project cwd, no model call. Fires when34the user asks why a project opens heavy, wants to reduce initial tokens, or asks to audit35plugins; a pasted `/context` from a live session is the fallback input.3637**Read `~/.claude/skills/aidex/references/01-context-audit.md` and follow it.** It is the38whole procedure: the inputs, the 5-step flow (including which four agents launch in39parallel and what each is scoped to), the optional apply phase with its `[A]/[B]/[C]/[D]`40front-loaded gate, the per-patch autonomy-class table that decides what may be applied41unprompted, and the guardrails that make that safe. Running this sub-action from memory is42how a class-1 patch gets applied as if it were class 4.4344## Sub-action: `/aidex memory`4546Audits the memory **files** in `~/.claude/projects/<slug>/memory/`, not just the47`~/.claude/projects/<slug>/memory/MEMORY.md` index. Three forms, on `$ARGUMENTS`:4849- **bare** — `scripts/memory-sweep.py` for the mechanical half, then50 [`memory-auditor`](agents/memory-auditor.md) per project for the reading half.51 Report only.52- **`<project>`** — scoped: `--project=<slug>`. The `=` is required; every slug starts53 with `-`, which argparse reads as a flag.54- **`--apply`** — route each verdict below. Deletions need the backup *and* the ratified55 project x verdict-class table.5657Each verdict routes to exactly one destination, and that mapping lives in ONE place —58[`references/03-memory-workflow.md`](references/03-memory-workflow.md) § Where each59verdict goes. Read it before applying; the agent returns the verdict and nothing else.6061An unlisted verdict is a `KEEP`. Every MOVE writes its destination **before** the memory62is deleted, and `DELETE-{DUP,CLOSED,LOG}` backs up before removing the file and its index63line. On completion re-run the sweep with `--stamp`: that silences the 30-day64SessionStart nudge until the directory changes again. Budgets are words, never lines —65800 per memory, 1,200 for the index. Canon: `rules/memory-hygiene.md`; detail:66[`references/03-memory-workflow.md`](references/03-memory-workflow.md).6768## Sub-action: `/aidex init`6970Bootstrap `.context/` in a project that doesn't have one. Runs [`scripts/init-context.sh`](scripts/init-context.sh) `[project-dir]` — idempotent, creates only the directories/files that are missing, seeds the backlog/plans indexes via the installed reindexers when present, writes `.context/references/01-project-commands.md` (skip-if-exists), then prints (never writes) a suggested CLAUDE.md block for the user to add themselves.7172**It has one question, and you ask it** — in the Bash tool stdin is never a terminal, so73the script prints `no TTY — skipped the artifact-style.md question` instead of prompting.74On that line ask the user whether this project wants a `.context/artifact-style.md`, and75in which language its HTML artifacts are written; re-run (idempotent) with76`--artifact-style <lang>` or `--no-artifact-style`. Never created unasked; either answer77is recorded in the marker aidex-dash's mid-artifact offer reads, so neither asks twice.7879---8081## Sub-action: `/aidex sweep`8283Check the whole fleet for drift instead of one project at a time. Read-only — it never84writes to a project. Entry point:85`bash ~/.claude/skills/aidex/scripts/compliance-sweep.sh`.8687**Read `~/.claude/skills/aidex/references/07-sweep-procedure.md` and follow it.** It is88the whole procedure: all seven instruments and what each one attributes, the read-only89rule for workspace-root litter (`aidex` vs `foreign` findings — reported and offered,90never acted on), the auditor-freshness re-verification loop behind91`06-claude-code-surface.md`, and the cadence note.9293---9495## Phase 0: Discovery9697Before launching any subagent, scan what exists in the project:9899```100Check for:101- .context/ (references/, docs/, plans/, backlog/ [incl. _deferred/], issues/, roadmap/, requests/, decisions/, research/, audits/, loops/, communications/, worktrees/)102- .context/ optional tier (data/, diagrams/, drafts/, experiments/, worklists/, workflows/) — project-local, INFO-at-most, never deletion candidates103- .claude/ (skills/, CLAUDE.md)104- ~/.claude/projects/<slug>/memory/ (memory files + MEMORY.md; slug = the project path105 with `/` and `_` turned into `-`)106- ~/.claude/aidex/manifest (what the suite installed; anything else in ~/.claude/skills is the user's)107- ~/.claude/skills/ (global skills)108```109110Build a quick inventory of what exists and its size. This determines which agents to launch.111112**If nothing exists:** Suggest running `/aidex init` to bootstrap `.context/`.113114---115116## Phase 1: Parallel Audit117118Launch every applicable agent in a single message with multiple Agent tool calls, each with `run_in_background: true`, so they execute in parallel.119120Read each agent's instructions from `~/.claude/skills/aidex/agents/` and pass them as the prompt. Include the project path in each prompt.121122| Subagent | Launches when | Model | Effort | Tools |123|----------|--------------|-------|--------|-------|124| [context-auditor](agents/context-auditor.md) | `.context/` exists | haiku | medium | Read, Glob, Grep, Bash |125| [conventions-auditor](agents/conventions-auditor.md) | `.context/` exists AND `~/.claude/skills/aidex-conventions/scripts/validate.sh` is installed | haiku | low | Read, Bash |126| [skills-auditor](agents/skills-auditor.md) | `.claude/skills/` exists | haiku | medium | Read, Glob, Grep |127| [symlink-checker](agents/symlink-checker.md) | Any symlinks found | haiku | low | Read, Glob, Bash |128| [memory-auditor](agents/memory-auditor.md) | `~/.claude/projects/<slug>/memory/` exists and holds at least one memory file | sonnet | medium | Read, Glob, Grep |129| [freshness-checker](agents/freshness-checker.md) | `.context/references/`, `.context/docs/`, or `.context/roadmap/` exist | haiku | low | Read, Glob, Grep, Bash, WebFetch |130| [plugin-auditor](agents/plugin-auditor.md) | `~/.claude/plugins/installed_plugins.json` exists | haiku | low | Read, Glob, Grep, Bash |131| [context-cost-analyzer](agents/context-cost-analyzer.md) | `/aidex context` — after `scripts/context-snapshot.py` has written the snapshot | haiku | low | Read, Glob, Grep, Bash |132133**Model, effort and tools are set here, not in the agent files.** These agents are launched134by reading their `.md` as a *prompt* (above) — they are not registered agent definitions, so135`model:` and `allowed-tools:` in their front-matter are documentation and configure nothing.136This table is the whole configuration surface: pass the Tools column when the launch site137supports restricting tools, and treat the agent files' own `allowed-tools:` as a comment.138Effort follows the suite heuristic139([workflow-spec conventions](../aidex-workflow/references/01-workflow-spec-conventions.md)):140mechanical existence/parse checks → `low`; judgment over content quality or compliance →141`medium`.142143**Wait for ALL launched agents to complete before proceeding to Phase 2.**144145Also check inline (no subagent needed):146- CLAUDE.md size, security (API keys/tokens), structure147- **Link verification**: Extract all markdown links from CLAUDE.md. For each link to a local file (`.context/`, `.claude/`, relative paths), verify the target file exists. Report broken links as WARNING.148- **Anti-pattern detection**: If CLAUDE.md links to a `README.md` inside `references/` or `docs/`, flag as WARNING — convention says each module has `00-index.md` and CLAUDE.md is the entry point. The README is redundant.149- Cross-domain: skills referenced in CLAUDE.md exist? References mentioned in skills exist?150151---152153## Phase 2: Synthesize & Report154155Collect all subagent reports. Produce unified report split into two top-level findings sections — **structural cleanup** (safe, mechanical fixes) vs **token savings** (toggle-preferred, reversible config). Each finding goes into one or the other based on its check code:156157- **Structural cleanup** — codes WITHOUT `CB-` / `PL-SCHEMA` prefix: `[A]–[F]`, `[PA]–[PD]`, `[IA]–[ID]`, `[RA]–[RC]`, `[QA]–[QB]`, `[DA]–[DD]`, `[UA]–[UH]`, `[CV-*]` (from `conventions-auditor`), `[AG]`, `[AH]`, `[AI]`, `[F1]–[F6]`, `[V1]`, freshness, broken symlinks, missing indexes, pluralized names, anti-patterns. These are mechanical and reversible by editing one file at a time. `[CV-*]` findings are deterministic (produced by `validate.py`) — prefer them over heuristic codes when they overlap on the same file.158- **Token savings** — codes WITH `CB-` prefix (`CB-PL`, `CB-SR`, `CB-DU`, `CB-MD`, `CB-CM`, `CB-RF`) and `PL-SCHEMA`. These suggest config toggles (`enabledPlugins: false`, `skillOverrides: name-only/off`, MEMORY trims, plugin manifest cleanup). Always **prefer toggle over uninstall/delete**.159160The report's literal shape — summary table, the two findings sections, health score —161is `references/08-report-shapes.md` § Phase 2.162163### Destructive-action checklist164165Before emitting any finding that proposes deleting a file/directory, uninstalling a plugin, or removing a skill from disk, verify the four gates below. Failing **any** gate downgrades the proposal to a softer alternative or suppresses it.1661671. **Canonical type?** If the target is an empty directory, is it in the canonical list (`audits, decisions, plans, requests, issues, references, research, backlog, roadmap, docs, loops, communications, worktrees`)? If yes → do not propose deletion (empty canonical = healthy). The `backlog/_deferred/` and `<type>/_archive/` subdirs are part of their parent's canonical lifecycle — treat as healthy, never orphan/delete candidates.168 **Acceptable-optional tier?** If the target is `data`, `diagrams`, `drafts`, `experiments`, `worklists`, or `workflows`, it is never required (some are scaffolded on demand — `worklists` by the worklist scripts, `workflows` by `aidex-workflow`; the rest are project-local, may be gitignored): INFO-at-most, never a deletion proposal. Only `.context/` dirs in NEITHER tier qualify as deletion candidates.1692. **Protected marketplace?** If the target is a plugin, is its marketplace in `PROTECTED_MARKETPLACES` (`claude-plugins-official`, `anthropics`)? If yes → downgrade to INFO, never propose disable/uninstall.1703. **Reversible local override exists?** Is there a softer alternative (`enabledPlugins: false`, `skillOverrides: name-only/off`, archive-instead-of-delete)? If yes → prefer it over the destructive action.1714. **`.git` ancestor present?** For any `.gitignore` suggestion in `.context/`, walk up to find `.git`. If absent (typical of `*_ws/` workspace roots) → suppress the finding.172173---174175## Phase 3: Suggest Actions176177After the report, present actionable suggestions grouped by priority. **Be prescriptive,178not just descriptive** — suggest the aidex way of organizing things, explain why, and let179the user decide. The list's shape is `references/08-report-shapes.md` § Phase 3.180181Terminate it with this menu, which IS the front-loaded gate the apply phase must not182re-ask per item:183184```185━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━186 [A] Run all critical187 [B] Run all critical + recommended188 [C] Pick individually189 [D] Just save this report190━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━191```192193---194195## Phase 4: Execute196197**Read the fix procedures before executing anything:**198`~/.claude/skills/aidex/references/04-fix-procedures.md`. It holds the step-by-step199procedure for each fix below — including which ones are destructive, what to back up200first, and the recovery path when one goes wrong. The list here names the actions; the201reference is how to perform them.202203For each approved action, execute directly or launch a specialized subagent:204205**Direct execution (simple fixes):**206- Fix broken symlinks (remove or recreate)207- Add missing index links208- Add missing metadata headers209- Archive completed plans210211**Subagent execution (complex operations):**212- Deep-sync stale references → sonnet subagent with WebFetch + Context7213- Memory cleanup (full workflow) → `/aidex memory --apply`214215**Destructive actions (per-item approval — autonomy class 1, gated even under [A]/[B]):**216- Delete orphaned files217- Remove skills218219Trimming duplicated content is **not** in this list: it is a class-4 edit, covered by the220apply phase's backup.221222After execution, show the before/after summary — its shape, including the health delta223and the next-audit line, is `references/08-report-shapes.md` § Phase 4.224225---226227## Context-Triggered Behavior228229Besides explicit invocation (`/aidex`), this skill also activates when:230231- Claude notices a broken symlink while reading `.claude/skills/`232- `memory-sweep.py` reports a finding, or the always-on MEMORY.md index is over its word budget233- A referenced file in a skill doesn't exist234- User asks about "project health", "ecosystem", "organize skills", "clean up"235236In context-triggered mode, suggest a focused audit rather than a full one:237```238"The MEMORY.md index here is 1,540 words (budget: 1,200), loaded every session.239Want me to run `/aidex memory`?"240```241