> ## Documentation Index
> Fetch the complete documentation index at: https://docs.specpilot.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Slash commands

> The nine specpilot commands your AI IDE gets: what each one reads, what it changes and when to use it.

SpecPilot writes nine commands into your AI IDE's commands folder (where depends on the IDE: see [Supported AI tools](https://docs.specpilot.dev/ai-tools/claude-code.md)). They are plain instructions for your agent, so they work without the SpecPilot CLI installed, except `/specpilot-compact`, which runs it. Three of them, validate, archive and backfill, run a shell script that ships inside the command file.

Paths below are inside `.specs/`.

## At a glance

| Command | Use it when | Changes files |
| - | - | - |
| `/specpilot-status` | You want the current sprint and next milestone on one screen | No |
| `/specpilot-reanchor` | Your agent has lost track of the project mid-session | No |
| `/specpilot-report` | Before coding a change: update the specs first | Specs, after you say `yes, proceed` |
| `/specpilot-sync` | The specs may have drifted from the code | After you confirm |
| `/specpilot-refine <description>` | You have a new requirement to add to the specs | After you confirm |
| `/specpilot-validate` | You want to check `.specs/` for missing files and broken references | No |
| `/specpilot-archive` | `tasks.md` or `prompts.md` has grown too long | Yes |
| `/specpilot-compact` | `context.md` or `requirements.md` costs your agent too much to read | Archive at once; the rest after you type `apply` |
| `/specpilot-backfill` | Your instruction files are missing SpecPilot's rule sections | Yes, appends only |

## /specpilot-status

Reads Current Sprint in `planning/tasks.md` and the milestones in `planning/roadmap.md`. Shows each sprint task's ID with a short summary, and the next unchecked milestone. One screen, nothing written.

## /specpilot-reanchor

Reads `project/project.yaml` in full and the Re-Anchor Prompt in `development/prompts.md`, and makes them your agent's working context again. Use it after a long session or when your agent forgets the rules.

## /specpilot-report

Runs the spec check before a change. Your agent:

1. Classifies the change as trivial, feature or architectural.
2. Reads the specs for that kind of task.
3. Updates the specs first.
4. Shows a Spec Report: the classification, the files touched and what changed in each.

It writes no code until you say `yes, proceed`. For an architectural change, a plain "ok" isn't enough. See [Review and Spec Reports](https://docs.specpilot.dev/concepts/review.md).

## /specpilot-sync

Compares `architecture/architecture.md`, `project/requirements.md` and `quality/tests.md` with your source folder and `package.json`. Lists the drift, such as stale versions, renamed or removed files the specs still name, and modules the specs don't mention, and proposes an edit for each. Writes only after you confirm.

## /specpilot-refine

Give it the new requirement after the command:

```text theme={null}
/specpilot-refine Users can export their tasks as CSV
```

Reads `project/requirements.md`, `development/context.md` and `development/prompts.md`, and proposes edits that follow the existing IDs, such as `REQ-###.#`. It shows a line-by-line preview and writes only after you confirm. The command version of `specpilot refine`.

## /specpilot-validate

Runs a script that checks three things:

* The nine required spec files are there.
* Each Markdown spec has `fileID`, `lastUpdated`, `version`, `contributors` and `relatedFiles` in its front matter.
* Every file named in `relatedFiles` exists under `.specs/`.

It suggests a fix for each problem and changes nothing until you ask. `specpilot validate` in the terminal runs more checks.

## /specpilot-archive

Runs a script that moves old rows out of the way:

* Completed rows of `planning/tasks.md`, once that section passes 25 lines. The newest 10 stay.
* The oldest entries of `development/prompts.md`, once the file passes 100 lines. About 80 lines stay.

Rows move as they are, with their IDs unchanged, into archive files next to them. On a branch other than `main` or `master`, it warns and asks before going on. The command version of `specpilot archive`.

## /specpilot-compact

Shortens `development/context.md` and `project/requirements.md`, which your agent reads on most tasks. Your agent decides what to archive and how to rewrite; the SpecPilot CLI moves the text and keeps the originals. Unlike the other commands, it needs the CLI installed: `npm install -g specpilot@latest`.

Your agent:

1. Checks the branch. On a branch other than `main` or `master`, it asks before going on.
2. Runs `specpilot compact --report` and shows each file's size, estimated tokens and likely saving. It stops if there's nothing to compact, and otherwise asks you before it reads `context.md` or `requirements.md`.
3. Runs `specpilot archive`, so finished Completed rows move to `planning/tasks-archive.md` first.
4. Judges each `context.md` entry and writes a plan, `development/compact-plan.md`: archive or keep, with a reason. It never archives a security decision, an entry about a Won't do task or something dropped on purpose, an entry that still overrides a spec or a standing rule, or an entry naming a task that's still open.
5. Rewrites the largest requirements, at most 10 per run and each at least 4 KB, to what the project does now. Every command, flag, number, exact message, path, security rule and cited ID stays. The rewrites go to `development/compact-requirements.md`.
6. Runs `specpilot compact --apply --dry-run`, shows what would move and what each rewrite leaves out, and stops. You can edit either plan or tell your agent what to change.
7. When you type `apply` yourself, runs `specpilot compact --apply`.

`--apply` applies both plans or neither. Each archived entry moves, unchanged, to `development/context-archive.md`, with a one-line marker left in `context.md`. Each rewritten requirement replaces the original in place, and the original is kept unchanged in `project/requirements-archive.md`. The CLI refuses an entry whose task is still open, and a rewrite that is longer or out of date. Until you type `apply`, `context.md` and `requirements.md` are untouched.

In the terminal, [`specpilot compact`](https://docs.specpilot.dev/reference/cli/compact) on its own lists each `context.md` entry with a status, and the requirements largest first, and changes nothing.

## /specpilot-backfill

Runs a script that checks each instruction file that exists (`CLAUDE.md`, `.github/copilot-instructions.md`, `.cursor/rules/specpilot.mdc`, `.windsurfrules`, `.antigravity/rules.md`) for four sections: Critical Mandates, Code Philosophy, Code Rules and Re-Anchor. A missing section is added at the end, and nothing is overwritten.

It also checks `project/project.yaml` for `team.devPrefix`. If it's missing, your agent asks you for a short handle.

Unlike `specpilot backfill`, it doesn't add or update command files. Use Regenerate All for that (see [Regenerate commands and skills](https://docs.specpilot.dev/app/regenerate.md)).

## In each AI IDE

* **Claude Code** shows `<description>` as a hint for `/specpilot-refine`, lets validate, archive and backfill run their scripts, and lets compact run `specpilot`.
* **GitHub Copilot** runs the commands in agent mode. Outside it, Copilot can't run the scripts and does the checks by reading the files, with more mistakes, and can't run `/specpilot-compact` at all.
* **Codex** needs the files copied to `~/.codex/prompts/` first (see [Codex](https://docs.specpilot.dev/ai-tools/codex.md)).

## Not a command: the project skill

Claude Code also gets the `specpilot-project` skill, which gives it your project's context without a command. See [Commands and skills](https://docs.specpilot.dev/concepts/commands-and-skills.md#skills).

How we use this day to day: [The Spec Guide: Prompt library ↗](https://specpilot.dev/guide#prompt-library)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.