Smith migrate system paths

From ATTCKDigital/smith · View interactive version

Smith migrate system paths is an AI agent skill from the GitHub repository ATTCKDigital/smith. One-time migration to add `paths:` YAML frontmatter to existing `.specify/systems/<id>/spec.md` files. Scans prose for path-like references (services/<X>/, backend/<X>/, frontend/<X>/, etc.), proposes a per-system list, and writes accepted frontmatter ABOVE the existing body. Use when a project grew

How to use this skill

Skill file

Smith System Path Migration

Add paths: YAML frontmatter to existing system specs without disturbing their hand-authored prose. After migration, the Smith manifest v2 path-resolver tier 1 reads these paths: entries and routes source files into the correct system bucket.

Arguments: $ARGUMENTS

When to use

When NOT to use

Behavior overview

This skill operates on .specify/systems/system-*/spec.md files in the current project. For each file:

  1. Skip if it already has a non-empty paths: list in its YAML frontmatter (idempotency check).
  2. Scan the prose body with a heuristic regex matcher (see scripts/propose_paths.py) to identify candidate path prefixes (services/<X>/, backend/<X>/, frontend/<X>/, apps/<X>/, packages/<X>/, backticked dirs, backticked files, bulleted paths, code-fenced file paths).
  3. Score and rank each candidate by frequency × position_weight (earlier mentions in the file get higher weight — prose near the top is usually scope-defining).
  4. Present the top-N proposals to the operator with each prefix's score, raw match count, and up to two line-quoted excerpts. The operator chooses Accept / Skip per system.
  5. On accept, inject YAML frontmatter into the file:
  1. On skip, leave the file unchanged.

After processing every system, print a summary line: migrated: N | skipped (already): M | skipped (no proposal): P | skipped (by user): Q.

Flags

| Flag | Default | Meaning |

|---|---|---|

| --dry-run | off | Show proposals, do NOT write any files. |

| --auto-confirm | off | Accept all proposals without prompting. Intended for tests — production runs should always prompt the operator per-system. |

| --top-n N | 5 | Maximum number of proposed prefixes per system. |

| --non-interactive | off | Suppress prompts entirely. Combine with --auto-confirm to run unattended. |

| --project-root <path> | cwd | Where to find .specify/systems/. |

Workflow (interactive default)

When the user invokes /smith-migrate-system-paths, Claude:

  1. Verify .specify/systems/ exists in the current project. If not, abort with a friendly message pointing the user to /smith Phase 4.8.
  1. Enumerate .specify/systems/system-*/spec.md files (sorted by directory name).
  1. For each spec file:

a. Read the file. Determine whether it already has YAML frontmatter and whether that frontmatter contains a non-empty paths: field. If it does, print a one-line "already migrated" message and continue to the next file.

b. Strip the frontmatter (if any) and run the prose body through scripts/propose_paths.py to get up to --top-n proposed prefixes.

c. Present the proposals to the operator:

```

System system-05-communication-triage — proposed paths:

| This system handles triage of inbound communications. Implementation lives in backend/src/services/triage/...

| - backend/src/services/triage/router.py

| with frontend bindings in frontend/src/lib/triage/...

Accept these paths for system-05-communication-triage? [Y/n]

```

d. Wait for operator input. Accepted responses:

e. On accept (with or without edits):

  1. After all specs processed, print the summary report:

```

============================================================

Migration summary

============================================================

migrated: 7

skipped (already has paths): 3

skipped (no prose hints): 1

skipped (by user): 0

```

Implementation

Claude runs the orchestrator via the bundled helper script:

python3 skills/smith-migrate-system-paths/scripts/migrate.py [flags]

For interactive workflow, run WITHOUT --auto-confirm so the helper prompts per-system through stdin. Claude relays each prompt to the user and feeds their answer to the script (or, in environments where stdin-piping isn't clean, Claude can read each spec, call propose_paths.propose() directly via a one-shot Python invocation, present the proposals in chat, await user confirmation, and then call migrate.migrate_one(spec, auto_confirm=True) per file after each user accept).

For an unattended dry-run preview:

python3 skills/smith-migrate-system-paths/scripts/migrate.py --dry-run --non-interactive --auto-confirm

This prints the proposals every spec would receive without modifying any files.

Idempotency guarantee

Re-running /smith-migrate-system-paths on a previously-migrated project is a no-op. The skill detects existing non-empty paths: fields and skips those files. A file that was skipped by the user (or had no prose hints) on a prior run is eligible for re-proposal on subsequent runs.

Safety notes

Related

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.