# Index Check

> Run the Horizon AIOS index / context-cascade consistency checker — verifies every skill directory is indexed, every documentation file is indexed, every path pointer and $HORIZON_* variable in the always-loaded context set resolves, and every referenced slash-command exists, then reports passed/warnings/failures. Use when the user types /index-check, asks to "check the indexes", "find dead pointers", "verify the skill indexes", or after adding/renaming/moving a skill, a doc, or an entry in agents.md.

- Skill: `horizonbrute/index-check` (Agent Skill)
- Install (CLI): `npx skillmds@latest add horizonbrute/index-check`
- Raw SKILL.md: https://api.skillmd.com/api/skills/horizonbrute/index-check/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: HorizonBrute (https://skillmd.com/u/horizonbrute)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/horizonbrute/index-check

---


# Skill: /index-check

**Model preference:** `#lowcost` (per `horizon_aios_model_prefs.md`; overridable by a prompt directive).

Run the read-only Horizon AIOS index/context-cascade consistency check and surface its results. Use this after adding, renaming, or moving a skill directory or a documentation file, after editing `agents.md` / `projects/agents.md` / `horizon_aios_agents.md` / the options-packages cascade, or whenever a `$HORIZON_*` path or a `/slash-command` referenced in always-loaded context might have gone stale.

---

## When to invoke

The user types `/index-check`, or asks you to "check the indexes", "find dead pointers", "verify the skill indexes are in sync", or run a consistency pass after a skill/doc rename or move.

---

## Step-by-step execution

### Step 1 — Run the check

```
python "$HORIZON_SYSTEM/bin/horizon_aios_index_check.py"
```

Read-only — no elevation required, no arguments needed. Add `--json` for machine-readable output, `--strict` to also fail the run on WARN findings.

### Step 2 — Report the result

2.1 Relay the `VERDICT: {PASS|WARN|FAIL} (pass=N warn=N fail=N info=N)` line.

2.2 For each `[FAIL]` and `[WARN]`, surface the rule ID (`IDX-S1`, `IDX-D1`, `IDX-D2`, `IDX-P1`, `IDX-P2`, `IDX-C1`) and the message verbatim. Do not invent a fix — quote the script's own finding.

2.3 Exit code is `1` if any `[FAIL]` (or, with `--strict`, any `[WARN]`); `0` otherwise. Report success/failure accordingly.

---

## Repair mode (`--fix`)

```
python "$HORIZON_SYSTEM/bin/horizon_aios_index_check.py" --fix
```

Applies only the strictly-safe repair: appending a missing index row for a skill directory that has no row in `index.md`/`index.local.md`, using fields read from that skill's own `SKILL.md` frontmatter (never invented — a field that cannot be read is left as `TBD`, and a skill whose `SKILL.md` cannot be read at all is skipped and still reported as a finding). `--fix` never deletes a row, never rewrites prose, and never touches a documentation file's body.

---

## Rule reference

| Rule | Level | Checks |
|---|---|---|
| IDX-S1 | MUST | Every skill directory under `skills_bin/`/`skills_sbin/` has an index row, and every row resolves to a directory. `usr_skills/` is exempt (machine-local, not indexed by design). |
| IDX-D1 | MUST | Every `.md` under `documentation/` appears in its folder's `*.index.md`, and every row resolves to a file. |
| IDX-D2 | WARN | No two docs in the same folder look like near-duplicates by filename. |
| IDX-P1 | MUST | Every path pointer (`@`-import or backtick `$HORIZON_*` path) in the always-loaded context set resolves. Known-optional `.local.`/`.template` targets are exempt. |
| IDX-P2 | MUST | Every `$HORIZON_*` variable referenced in that context set is exported by `sbin/bootstrap.sh`. |
| IDX-C1 | MUST | Every `/slash-command` referenced in that context set resolves to an on-disk skill or an `index.local.md` row. |

---

## Notes for the executing agent

- `$HORIZON_SYSTEM` must be set, or pass `--horizon-root PATH` explicitly.
- This skill is purely diagnostic by default — `--fix` is the only mode that writes, and it only ever appends a table row.
- Do not reimplement any check — the script is the single source of truth. Run it and format its output.
- If the script itself cannot read a root-owned file (an ACL boundary), it reports that path as a `[WARN]` finding rather than crashing — relay it as a blocked item, not a defect in the checker.

