/alfred-code - the router
Route by install state, then hand the user the ONE command to run. The actions are manual-only
commands - the user stays at the wheel, so you answer with the command, never run the flow
yourself. The state is one script read of the project's .claude/, nothing inferred:
node "${CLAUDE_PLUGIN_ROOT}/scripts/install/stamp.js" state . prints not-installed,
legacy-unstamped, worktree-of-installed <main>, installed or initialised.
- Installed = an install record in this repo or its git top level:
alfred-code.stamp or a
copied hooks/docs.js.
- Worktree of an installed checkout = a git worktree whose own
.claude/ holds no record,
while its main checkout (<main>) does. The hooks count it set up; the commands cannot act on it.
- Legacy unstamped = no install record, but a legacy copy-route install's signatures in
.claude/ -
two of: the stack's hook files, its env keys, three or more of its skill, seat or rule names.
- Initialised = the stamp's
initialised: line holds a date - init's bootstrap writes it at its
close, and no other run does. The install phase writes initialised: pending, and a stamp from
before that line reads as never initialised.
Then:
- Not installed ->
/alfred-code:init (its install phase: the selection and the install; it ends on a
restart, and the same command typed in the new session runs the bootstrap).
- Worktree of an installed checkout -> no command here: 'This is a git worktree of , which
holds the install - run /alfred-code: from there' - every command stops
on this tree, and the installer refuses it.
- Legacy unstamped ->
/alfred-code:update, whatever the ask: it reads the picks off disk, each old
name under its new one, and writes the stamp every other command reads.
- Installed, never initialised ->
/alfred-code:init (its bootstrap phase, in a session started
after the install's restart: the language-server tools and the status line, the captures, the
AGENTS.md fill). Initialised -> no bootstrap; one of the lines below.
- Installed and the ask is a plain refresh (no items named) ->
/alfred-code:update (refresh
everything installed + prune what upstream removed).
- Installed and the user wants to adjust it (add or drop items, change the selection) ->
/alfred-code:configure.
- Installed and the user wants it reconciled TO THIS PROJECT - prune what the project's frameworks
do not use (WPF artifacts in a web-only repo, the data vertical with no SQL) AND add the detected
stacks' artifacts that are missing ->
/alfred-code:validate (at any scope).
- The ask is to SEE what is installed - inventory, versions, capture dates, 'what do I have?' -
with nothing to change ->
/alfred-code:status (read-only tables, per area or all).
- Installed and the ask is to REMOVE the stack from this project ->
/alfred-code:uninstall (the
install ledger says what the stack wrote; the user's own keys, hooks and servers stay).
- The ask is whether THIS project's
AGENTS.md (or CLAUDE.md) still matches the stack template, or needs an
update -> /alfred-code:update (its step 6 compare) - never answer this from the
template alone; a generic answer here has shipped a wrong 'no update needed'.
- The ask is to work with
CLAUDE.md instead of AGENTS.md (or back), or to move the file between the root and
.claude/ -> /alfred-code:configure (its step 12 name and place asks; a rename keeps the content).
- The install just finished and the ask is 'what now?' -> not installed-and-initialised yet means
/alfred-code:init; after it, walk them through
${CLAUDE_PLUGIN_ROOT}/setup-plugin/references/post-install.md.
Answer with the command plus one line naming the state you found (for example: 'no install record
in .claude/ - run /alfred-code:init'). When more than one reading is plausible, put the
candidates through AskUserQuestion - one option per plausible command, the likeliest marked
Recommended - instead of guessing or asking in prose.
1---2name: alfred-code3description: "Route to the right Alfred Code action when unsure which fits - inspects the install state and answers with the exact command to run: /alfred-code:init (nothing installed: the selection and the install, ending on a restart; typed again after it: the one-time bootstrap - language-server tools, the status line, captures, AGENTS.md), /alfred-code:update (no-questions refresh + prune of upstream removals), /alfred-code:configure (adjust an existing install - add or drop), /alfred-code:validate (reconcile an install against THIS project - prune what its frameworks do not use and add the detected stacks' missing artifacts), /alfred-code:status (read-only per-area tables of what is installed), /alfred-code:uninstall (remove the stack from this project, keeping the user's own config). Trigger by invoking /alfred-code."4disable-model-invocation: true5metadata:6 source: https://skillmd.com/skills/envoydev/alfred-code7---89# /alfred-code - the router1011Route by install state, then hand the user the ONE command to run. The actions are manual-only12commands - the user stays at the wheel, so you answer with the command, never run the flow13yourself. The state is one script read of the project's `.claude/`, nothing inferred:14`node "${CLAUDE_PLUGIN_ROOT}/scripts/install/stamp.js" state .` prints `not-installed`,15`legacy-unstamped`, `worktree-of-installed <main>`, `installed` or `initialised`.1617- **Installed** = an install record in this repo or its git top level: `alfred-code.stamp` or a18 copied `hooks/docs.js`.19- **Worktree of an installed checkout** = a git worktree whose own `.claude/` holds no record,20 while its main checkout (`<main>`) does. The hooks count it set up; the commands cannot act on it.21- **Legacy unstamped** = no install record, but a legacy copy-route install's signatures in `.claude/` -22 two of: the stack's hook files, its env keys, three or more of its skill, seat or rule names.23- **Initialised** = the stamp's `initialised:` line holds a date - init's bootstrap writes it at its24 close, and no other run does. The install phase writes `initialised: pending`, and a stamp from25 before that line reads as never initialised.2627Then:2829- Not installed -> `/alfred-code:init` (its install phase: the selection and the install; it ends on a30 restart, and the same command typed in the new session runs the bootstrap).31- Worktree of an installed checkout -> no command here: 'This is a git worktree of <main>, which32 holds the install - run /alfred-code:<the command the ask needs> from there' - every command stops33 on this tree, and the installer refuses it.34- Legacy unstamped -> `/alfred-code:update`, whatever the ask: it reads the picks off disk, each old35 name under its new one, and writes the stamp every other command reads.36- Installed, never initialised -> `/alfred-code:init` (its bootstrap phase, in a session started37 after the install's restart: the language-server tools and the status line, the captures, the38 AGENTS.md fill). Initialised -> no bootstrap; one of the lines below.39- Installed and the ask is a plain refresh (no items named) -> `/alfred-code:update` (refresh40 everything installed + prune what upstream removed).41- Installed and the user wants to adjust it (add or drop items, change the selection) ->42 `/alfred-code:configure`.43- Installed and the user wants it reconciled TO THIS PROJECT - prune what the project's frameworks44 do not use (WPF artifacts in a web-only repo, the data vertical with no SQL) AND add the detected45 stacks' artifacts that are missing -> `/alfred-code:validate` (at any scope).46- The ask is to SEE what is installed - inventory, versions, capture dates, 'what do I have?' -47 with nothing to change -> `/alfred-code:status` (read-only tables, per area or all).48- Installed and the ask is to REMOVE the stack from this project -> `/alfred-code:uninstall` (the49 install ledger says what the stack wrote; the user's own keys, hooks and servers stay).50- The ask is whether THIS project's `AGENTS.md` (or `CLAUDE.md`) still matches the stack template, or needs an51 update -> `/alfred-code:update` (its step 6 compare) - never answer this from the52 template alone; a generic answer here has shipped a wrong 'no update needed'.53- The ask is to work with `CLAUDE.md` instead of `AGENTS.md` (or back), or to move the file between the root and54 `.claude/` -> `/alfred-code:configure` (its step 12 name and place asks; a rename keeps the content).55- The install just finished and the ask is 'what now?' -> not installed-and-initialised yet means56 `/alfred-code:init`; after it, walk them through57 `${CLAUDE_PLUGIN_ROOT}/setup-plugin/references/post-install.md`.5859Answer with the command plus one line naming the state you found (for example: 'no install record60in `.claude/` - run `/alfred-code:init`'). When more than one reading is plausible, put the61candidates through AskUserQuestion - one option per plausible command, the likeliest marked62Recommended - instead of guessing or asking in prose.