Skip to content
Back to skills

Realign

ASecurity

Apply accepted instruction-placement audit findings behind a per-item human gate (artifact-driven; whole move per finding; no blanket-approve; never re-judges; hard-denied safety excluded). Use when: 'apply the placement findings', 'execute finding IP-004', 'realign our instruction layer'. Not for proposing moves: /instruction-placement:audit.

  • 34 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 2, 2026
ai-agentsrustgoshellbashgit

Works with

  • claude code
  • cli

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add melodic-software/claude-code-plugins --skill realign --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Realign?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Realign
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/melodic-software-realign/badge)](https://www.skillsdirectory.com/skills/melodic-software-realign)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: "Apply accepted instruction-placement audit findings behind a per-item human gate (artifact-driven; whole move per finding; no blanket-approve; never re-judges; hard-denied safety excluded). Use when: 'apply the placement findings', 'execute finding IP-004', 'realign our instruction layer'. Not for proposing moves: /instruction-placement:audit."
argument-hint: "[finding-id ...] [--repo <repo> ...]"
user-invocable: true
disable-model-invocation: false
allowed-tools:
  [
    "Bash(${CLAUDE_PLUGIN_ROOT}/scripts/quote-check.sh)",
    "Bash(${CLAUDE_PLUGIN_ROOT}/scripts/precompute.sh:*)",
    "Bash(${CLAUDE_PLUGIN_ROOT}/scripts/glob-tools.sh:*)",
    "Bash(${CLAUDE_PLUGIN_ROOT}/scripts/render-index.sh:*)",
    "Bash(${CLAUDE_PLUGIN_ROOT}/scripts/verify-load.sh:*)",
    "Read",
    "Edit",
    "Write",
    "Grep",
    "Glob",
  ]
shell: bash
metadata:
  workflow-stage: implement
  summary: Apply accepted placement findings behind a per-item human gate
---

# Realign

**Arguments.** `[finding-id ...] [--repo <repo> ...]`. Default: every finding awaiting a decision,
in ranked order, in this checkout. `--repo` and the other target forms: "Over several
repositories" below

## Pre-computed context

!`"${CLAUDE_PLUGIN_ROOT}/scripts/precompute.sh" realign 2>/dev/null || echo "- Orientation unavailable"`

## Purpose

Execute what the audit found, one finding at a time, with the operator deciding each one. This is
the mutating surface for audit findings (`/instruction-placement:migrate` is the other mutating
skill, and it owns a repository's move to `AGENTS.md`), and the per-item gate below is the entire
reason it is safe to point at a repository nobody has reviewed.

What makes these edits unusual is their target: every file this skill touches is a file that steers
the agent's own behavior. A bad code edit fails a test. A bad instruction edit quietly changes what
the agent does in every future session, and nothing goes red.

## Read these before executing anything

Not restated here. A paraphrase inside a proposal is a drift seed.

| Read | For |
|---|---|
| [`../../context/findings-artifact.md`](../../context/findings-artifact.md) | The artifact's location, fields, status vocabulary, merge rules, and the finding-id constituents a suppression entry is keyed by |
| [`../../reference/consumer-config.md`](../../reference/consumer-config.md) | The suppression surface a decline is recorded on: its layers, its per-key merge, and the offered-never-taken rule |
| [`../../context/routing-rubric.md`](../../context/routing-rubric.md) | The hard-deny classes and what each destination means |
| [`../../context/verified-mechanics.md`](../../context/verified-mechanics.md) | When the shim is what makes a nested `AGENTS.md` load, and why the index exists |
| [`context/apply-recipes.md`](context/apply-recipes.md) | The exact edit sequence per destination, and the verification each one owes |

## The per-item gate

**Nothing mutates without an explicit acceptance of that finding, from the operator, at the moment
it is presented.** Say so in the run's opening line, then hold it literally.

- **One finding, one acceptance.** Accepting IP-003 authorizes IP-003 and nothing else, not its
  neighbors, not the rest of its file, not the obvious next one.
- **Blanket approval is not the gate.** "Approve everything", "do whatever the audit says", and a
  standing authorization from earlier in the session are all declined, out loud, with an offer to
  walk the findings one at a time. This is not pedantry: the whole value of the gate is that a human
  looked at each destination, and a blanket yes means nobody did.
- **Present before asking.** The source and its line range, the destination, the exact `paths:` glob
  with its validated match count, what leaves the always-loaded budget, and the cost: that the
  content is not inherited by a subagent and announces itself nowhere, and post-compaction behavior
  for that destination. Then the deciding sentence of each record its `Mechanics` field names, with
  this run's quote-check result and label (below).
- **A decline is recorded, not argued.** Write `declined` into the artifact and move on. A declined
  finding is not re-proposed by a later audit.

## Recording a decline so it survives the checkout

The artifact is memory tier: branch-keyed, invisible from every other worktree, and gone with the
memory root. A decline written only there is a judgment the next checkout never sees, and the
operator is asked again. So a decline has **two** writes, and the second is what makes it durable.

1. **`declined` into the findings artifact.** Unchanged, and still the record this branch's run
   reads.
2. **An entry on the tracked suppression file**, `<home>/instruction-placement.yaml`.
   Here and below, `<home>` is the convention home that the marked pointer region in the root
   `AGENTS.md` or `CLAUDE.md` binds, `docs/conventions` when no region binds one
   (`consumer-config.md` "Layers and merge semantics"). It is not the memory-tier home the findings
   artifact lives under, which is gitignored and checkout-local. Git carries that file to every checkout whose branch holds the commit, which is the only mechanism
   that crosses checkouts at all.

The entry's five required keys, its `finding_id`, and the layer rules are owned by the two documents
in the table above. Do not invent a format here. Four rules bind the write:

- **Offered, never taken.** Show the composed entry in full (`check`, `claim`, `sites`, the `reason`
  in the operator's own words, `date`), and write it only on an explicit yes. Declining a *finding*
  and agreeing to *never be asked again* are two decisions, and the second silences a future report.
- **A reason is required, and it is theirs, not yours.** An entry with no stated reason cannot be
  reviewed or retired later. If the operator gives none, ask once; if they still give none, record
  `declined` in the artifact only and say the decline will not survive this checkout.
- **Team layer only.** Write `<home>/instruction-placement.yaml` at the repository root (on a
  multi-repository run, the worktree's: "Over several repositories"), and name that path in the
  shown entry. Never write `~/.claude/**`, an old path, or the `.local.yaml` personal override: a
  personal-layer entry the team layer does not carry is reported `personal-only, not applied` and
  suppresses nothing, so writing one would look like recording a decision while recording none.
- **Say that it needs committing.** The file is tracked, and an uncommitted entry has reached no
  other worktree yet. Name that rather than implying the decision is already everywhere.

## Check the mechanics quotes first

The audit priced each finding on the docs records its `Mechanics` field names, and a page can change
between that audit and this run. So the first command of a run, before the artifact is read, is:

```bash
"${CLAUDE_PLUGIN_ROOT}/scripts/quote-check.sh"
```

It takes no arguments and fetches only the pages `${CLAUDE_PLUGIN_ROOT}/context/mechanics-sources.tsv` lists. It prints
one line per record: `verified <id>`; `drift <id> <url>`, with the stored and fetched sentences on
the next two lines; or `unverified <id> as of <date>` when the page could not be read fresh. It
exits 0 whatever the results, so a run with no network still completes. Its grant names the script
with no `*` (how such a rule matches:
<https://code.claude.com/docs/en/permissions#wildcard-patterns>).

- **Drift goes first.** Before the gate opens, list each `drift` result: the record id, its section
  URL, the stored wording and the fetched one. A finding whose `Mechanics` field names a drifted
  record is not applied on either wording: present it with both wordings and the unverified label
  below, say that it looks wrong until re-audited, and offer the re-audit.
- **Quote the deciding sentence** of each record the finding's `Mechanics` field names, from the
  record's `quote` column, with this run's result beside it.
- **Label what was not read.** A finding that relies on an `unverified` or a drifted record is
  presented labeled "unverified as of `<date>`": the date the `unverified` line printed, or for a
  drifted record its `as_of` in the list. For an `unverified` record the operator still decides.
- **A finding with no `Mechanics` field** came from an audit that predates the check. Say so when it
  is presented and offer a re-audit. Leave its records unnamed: naming them here would re-judge it.

## Prerequisites

Read the artifact from the memory-tier home `findings-artifact.md` "Where it lives" defines.

If it is absent, say no audit has been run for this branch and offer to run one. Do **not** fall back
to another path or another branch's artifact: findings cite line ranges, and a range derived
elsewhere points at different text here. Name such a file a leftover and run a fresh audit instead.

Then, **before the first finding is presented**, resolve `<home>/instruction-placement.yaml` across
its layers (`consumer-config.md` "Layers and merge semantics"), and drop every finding the merged surface
covers, reporting each as suppressed with its reason, date, and contributing layer. Match on the `finding_id` the artifact's `Suppression key`
already carries; **do not derive one here.** This skill has no detector stream, and a second
derivation is a second heading parse whose disagreement produces a decline nothing ever matches.

The ordering is the point, and the case it protects is ordinary. This checkout's artifact is memory
tier: whatever the last local `audit` left behind, knowing nothing about a decline another checkout
recorded and committed since, which arrives here when that commit does. Present first and consult
the surface later, and the operator is asked to re-judge what their team already settled, which is
the rubber-stamping this gate exists to prevent. A suppressed finding is never presented, never
accepted, never applied.

Then four checks before the first edit, because acting on a stale artifact edits the wrong lines:

1. **Suppression sweep.** The step above has run and its suppressed set is reported. A finding that
   reaches the gate unswept is a question the team already answered.
2. **Branch match.** The artifact's `branch:` frontmatter against the current branch. On a mismatch,
   stop and re-audit. The directory a file sits in never proves which branch it describes.
3. **Source drift.** For each finding, that the cited content still exists at the cited location.
   Content that moved is re-audited, not guessed at. A finding whose status is `accepted` and whose
   source changed is **not** applied: the acceptance was for text that is gone, so it returns to
   `pending` and is presented again.
4. **Version drift.** The artifact's `claude_code_version` against the running one. On a material
   difference, re-verify the mechanics before trusting destination choices that depend on them.

## Over several repositories

With no target form, the run applies this checkout's findings. A target form
selects the repositories a multi-repository `audit` covered, resolved as
[`${CLAUDE_PLUGIN_ROOT}/reference/target-scope.md`](../../reference/target-scope.md) "Target forms"
and "Resolving repositories" say. What differs here:

- **An acceptance names its repository.** An `IP-<n>` handle is unique within its repository only,
  so an acceptance is `owner/name IP-<n>`. With more than one repository in scope, a bare id is a
  question, not an acceptance: ask which repository it means.
- **Apply in the audit's worktree.** The artifact is checkout-local, so it is not in the clone a
  repository resolves to. Select the entry on the branch `instruction-placement/realign` in
  `git -C <root> worktree list --porcelain`, never another worktree of the clone, and run the whole
  procedure there: `--root` set to it on every `glob-tools.sh`, `render-index.sh` and
  `verify-load.sh` call, the worktree's branch as the branch identity for the memory-tier home and the branch
  match, every edit under it, and a decline's suppression entry written to its
  `<home>/instruction-placement.yaml`, not this checkout's. A repository with no worktree on that
  branch, or no artifact in it, is reported as "no audit run" and skipped.
- **The quote check runs once.** It reads docs pages, not a repository: run it once, with no
  arguments, before the first repository's artifact is read.
- **One repository at a time.** Finish one repository's accepted findings before the next starts.
  Its changes stay uncommitted in that worktree, for that repository's own pull request, per
  "Writes stay per repository".

## Execution

Per accepted finding, in ranked order, following the recipe for its destination:

1. Re-validate the glob immediately before writing it. The repository may have changed since the
   audit, and a glob that now matches nothing must not be committed.
2. Perform the move: create the destination, then excise the source. In that order, so an
   interruption leaves content duplicated rather than deleted.
3. Regenerate the index:

   ```bash
   "${CLAUDE_PLUGIN_ROOT}/scripts/render-index.sh" write --file <index-file>
   ```

   `<index-file>` is the file `/instruction-placement:check` resolves (its precedence table), so
   the write updates the existing block instead of adding a second one.

4. Verify statically: the destination file's frontmatter parses, its glob resolves, the index is in
   sync and its target is reachable, and the source no longer carries the moved content.
5. Verify empirically when the operator wants proof, or when the destination is one you are unsure
   of:

   ```bash
   "${CLAUDE_PLUGIN_ROOT}/scripts/verify-load.sh" \
     --trigger <a file the new surface covers> --expect <the new surface>
   ```

   This drives the real CLI with an `InstructionsLoaded` hook and reports what actually loaded,
   the only check in this plugin that observes Claude Code rather than reasoning about it, and the
   one that catches a surface passing every static gate while never entering context. It costs a
   model call, so it earns its place on the first move of a migration and on anything unusual, not
   on every finding. `VERDICT UNKNOWN` means the probe could not run: that is never a pass, and
   never grounds for marking the finding applied.
6. Record `applied` in the artifact, with the destination path.

**One finding is one reviewable unit of work.** Do not batch several findings into one edit sweep
even when they share a destination file. A reviewer needs to see which change came from which
accepted proposal.

## Hard rules

- **No blanket approval, ever.** Not on request, not for a batch, not for "the trivial ones". That
  covers suppression entries too: a standing "and never ask me about any of these again" is declined
  the same way, with an offer to compose one entry at a time.
- **Hard-denied content is not applicable.** The held-back section carries no destination and there
  is no code path that gives it one. If the operator asks for one, explain the class and offer
  compression in place. This is the one place where the operator's instruction does not carry.
- **Never re-judge the surface.** This skill executes classifications the audit made; it does not
  reclassify, discover new candidates, or improve a destination it thinks the audit got wrong. If a
  finding looks wrong, say so and stop. The fix is a re-audit, not an improvised alternative.
- **Never rewrite content while moving it.** The move is a relocation. Tightening prose during a
  relocation makes the diff unreviewable and smuggles an unapproved edit past the gate.
- **The shim is what carries a blocked `AGENTS.md`.** We treat a nested `AGENTS.md` as blocked
  where a `CLAUDE.md` on its own path, the root's included, is read *instead* of it
  ([which files count](https://code.claude.com/docs/en/memory#when-claude-code-reads-agents-md)).
  Without its shim a blocked file reaches nothing. Write the shim wherever `render-index.sh wiring` would report the
  file `UNWIRED`; where it reports `NATIVE`, nothing blocks the file and the shim is not what makes
  it load there, though it stays the cover for sessions that cannot read `AGENTS.md` at all.
- **Never leave the index stale.** Regenerating it is part of the move, not a follow-up. An
  un-indexed demotion is exactly the subagent gap this plugin exists to close.
- **Stop on a failed verification.** Report what failed and leave the finding `blocked`. Do not
  proceed to the next finding on a broken tree.

## Spoke paths

The `context/` files write the plugin's root directory as `<plugin-root>`, which is
`${CLAUDE_PLUGIN_ROOT}`. Put that path in place of the placeholder before running a command or
writing it into a brief, and never pass a `${…}` token from those files to the Bash tool. Basis:
the plugins reference,
<https://code.claude.com/docs/en/plugins/manifest-reference#where-each-variable-resolves>.

## Related

- No audit artifact exists for this branch: /instruction-placement:audit.
- Migrating CLAUDE.md content home to AGENTS.md: /instruction-placement:migrate.
- Migrating legacy suppression config files: /instruction-placement:setup.
- Opening a PR for applied moves: /source-control:pull-request.

## Gotchas

Observed failure modes. Every one leaves a repository that looks migrated and is not.

- **Writing the nested `AGENTS.md` without the `CLAUDE.md` shim, in a repository whose root carries
  a `CLAUDE.md`.** The most likely mistake in this whole plugin, because the result reviews as
  correct: a well-written conventions file, in the right directory, that Claude Code never loads,
  because the `CLAUDE.md` above it is read instead. Measured, not inferred.
- **Forgetting the index regeneration.** The move succeeds, the rule fires when Claude works with a
  file its glob covers (which tool calls count, by version: `../../context/verified-mechanics.md`), and
  nothing tells any agent the rule exists until then. In a delegation-heavy repo a worker briefed
  to create or change files under that glob can act before the rule arrives. The index is part
  of the move, not a follow-up task.
- **Excising before creating.** An interruption between the two then deletes the only copy. The
  ordering is not stylistic; it is the difference between a recoverable and an unrecoverable
  failure.
- **Tightening prose "while you're in there".** It makes the diff unreviewable and slips an edit
  past the gate the operator thought they were approving. Relocate verbatim.
- **Treating a run-level "yes, all good" as acceptance.** An operator who has skimmed the findings
  has not gated each destination. The gate is per item because the value is per item.
- **Acting on line numbers from an artifact written before the file changed.** Excising a stale
  line range removes the wrong content, and the audit's own record then describes something that
  never happened. The staleness checks run before the first edit for this reason.
- **Re-proposing a declined finding.** A `declined` status is a decision, not a gap to be filled on
  the next run. Resurrecting it trains the operator to stop reading carefully, which is how a
  per-item gate degrades into a rubber stamp.
- **Marking a report-only rung `applied`.** A mechanism or skill routing has no destination this
  skill builds. `blocked` there means "executed elsewhere", and recording it as applied hides work
  that still needs doing.

Files in this skill

  • SKILL.md10.1 KB
  • context/apply-recipes.md7.5 KB
  • evals/evals.json7.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.