nitm-ai-dev-toolkit 3.0.23 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/README.md +33 -2
  3. package/bin/cli.js +4 -1
  4. package/package.json +1 -1
  5. package/src/monorepo/.claude/commands/ponytail-audit.md +4 -6
  6. package/src/monorepo/.claude/commands/ponytail-debt.md +3 -5
  7. package/src/monorepo/.claude/commands/ponytail-gain.md +2 -4
  8. package/src/monorepo/.claude/commands/ponytail-help.md +2 -4
  9. package/src/monorepo/.claude/commands/ponytail-review.md +3 -5
  10. package/src/monorepo/.claude/commands/ponytail.md +3 -5
  11. package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +32 -17
  12. package/src/monorepo/.claude/prompt-snippets/bootstrap-upgrade.md +76 -51
  13. package/src/monorepo/.claude/prompt-snippets/bootstrap.md +35 -16
  14. package/src/monorepo/.github/prompts/review-staged.prompt.md +1 -1
  15. package/src/monorepo/.opencode/agents/admin-portal.md +10 -4
  16. package/src/monorepo/.opencode/agents/api-specialist.md +10 -4
  17. package/src/monorepo/.opencode/agents/backend-architect.md +10 -4
  18. package/src/monorepo/.opencode/agents/documenter.md +10 -4
  19. package/src/monorepo/.opencode/agents/feature-builder.md +13 -5
  20. package/src/monorepo/.opencode/agents/frontend-developer.md +10 -4
  21. package/src/monorepo/.opencode/agents/green.md +10 -4
  22. package/src/monorepo/.opencode/agents/implementer.md +10 -4
  23. package/src/monorepo/.opencode/agents/planner.md +10 -4
  24. package/src/monorepo/.opencode/agents/red.md +10 -4
  25. package/src/monorepo/.opencode/agents/refactor.md +10 -4
  26. package/src/monorepo/.opencode/agents/researcher.md +10 -4
  27. package/src/monorepo/.opencode/agents/reviewer.md +10 -4
  28. package/src/monorepo/.opencode/agents/tdd.md +13 -5
  29. package/src/monorepo/.opencode/opencode.jsonc +8 -10
  30. package/src/monorepo/AGENTS.md +8 -0
  31. package/src/monorepo/CLAUDE.md +1 -1
  32. package/src/monorepo/README.md +14 -0
  33. package/src/repo/.claude/agents/documenter.agent.md +1 -1
  34. package/src/repo/.claude/agents/planner.agent.md +1 -1
  35. package/src/repo/.claude/agents/researcher.agent.md +1 -1
  36. package/src/repo/.claude/agents/reviewer.agent.md +1 -1
  37. package/src/repo/.claude/commands/ponytail-audit.md +4 -6
  38. package/src/repo/.claude/commands/ponytail-debt.md +3 -5
  39. package/src/repo/.claude/commands/ponytail-gain.md +2 -4
  40. package/src/repo/.claude/commands/ponytail-help.md +2 -4
  41. package/src/repo/.claude/commands/ponytail-review.md +3 -5
  42. package/src/repo/.claude/commands/ponytail.md +3 -5
  43. package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +32 -17
  44. package/src/repo/.claude/prompt-snippets/bootstrap-upgrade.md +87 -77
  45. package/src/repo/.claude/prompt-snippets/bootstrap.md +41 -54
  46. package/src/repo/.opencode/agents/admin-portal.md +10 -4
  47. package/src/repo/.opencode/agents/api-specialist.md +10 -4
  48. package/src/repo/.opencode/agents/backend-architect.md +10 -4
  49. package/src/repo/.opencode/agents/documenter.md +10 -4
  50. package/src/repo/.opencode/agents/feature-builder.md +13 -5
  51. package/src/repo/.opencode/agents/frontend-developer.md +10 -4
  52. package/src/repo/.opencode/agents/green.md +10 -4
  53. package/src/repo/.opencode/agents/implementer.md +10 -4
  54. package/src/repo/.opencode/agents/planner.md +10 -4
  55. package/src/repo/.opencode/agents/red.md +10 -4
  56. package/src/repo/.opencode/agents/refactor.md +10 -4
  57. package/src/repo/.opencode/agents/researcher.md +10 -4
  58. package/src/repo/.opencode/agents/reviewer.md +10 -4
  59. package/src/repo/.opencode/agents/tdd.md +13 -5
  60. package/src/repo/.opencode/opencode.jsonc +8 -10
  61. package/src/repo/AGENTS.md +8 -0
  62. package/src/repo/CLAUDE.md +1 -1
  63. package/src/repo/README.md +14 -0
  64. package/src/monorepo/.opencode/plugins/ponytail.mjs +0 -93
  65. package/src/repo/.opencode/plugins/ponytail.mjs +0 -93
package/CHANGELOG.md CHANGED
@@ -7,8 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Migration
11
+
12
+ - Toolkit v4 / package 4.0.0 requires native OpenCode V2 for OpenCode use; oh-my-opencode-slim >=3.0.0 requires OpenCode >=2.0.7. Native host config uses plural maps, ordered permissions, skill directories, and `mcp.servers`. Back up V1 (converted files are incompatible with it), preserve user/global settings and Slim's separate strict schema, leave the external starter unchanged, and activate on the next run/restart. Config `instructions` are ignored, ambient `AGENTS.md` works, `@refs` require explicit reads, and `request.body.temperature` is preserved but not currently sent by the runner. Preserve `lsp: true`; use project checks, not unavailable V2 LSP tools. Plugin/runtime integration is untested; publishing has not been executed.
13
+ - Removed all three local Ponytail plugin copies (root, repo template, monorepo template). Both templates register the author's native V2 `@dietrichgebert/ponytail@4.12.0` package locally; `opentmux` remains commented as V1-only. No API port or bridge was added. The toolkit root alone omits `plugins` to inherit existing user/global registrations; no global config was changed. Existing targets remove only known obsolete toolkit Ponytail `.js`/`.mjs`/`.ts` copies after backup and approval, preserving unrelated plugins and deduplicating upstream registration locally.
14
+
10
15
  ### Fixed
11
16
 
17
+ - All six repo/monorepo bootstrap flows now require a fail-closed `opencode --version` preflight before changes for confirmed OpenCode use: accept an optional leading `v`, reject V1 before OpenCode customization/migration or toolkit 4.0.0 marking, and stop on a missing CLI or unparseable version. Slim >=3.0.0 enforces OpenCode >=2.0.7; other-harness-only setup is unaffected. Focused instruction-order/version-metadata regression checks cover the guard.
12
18
  - Bootstrap audit/creation examples are explicitly conditional on confirmed Copilot use; completion reports describe performed harness-specific checks without assuming OpenCode configuration, Codex trust/loading, or Copilot/Cursor readiness. Codex-scoped install documentation now includes linked standards and their wrapper sources without implying other harness activation.
13
19
 
14
20
  ### Added
@@ -32,7 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
32
38
  - `bkt-cli` skill — Bitbucket CLI (`bkt`) command reference for repo and monorepo templates
33
39
  - `glab-cli` skill — GitLab CLI (`glab`) command reference for repo and monorepo templates
34
40
  - Ponytail skill bundle — 6 YAGNI/stdlib/native/minimum-discipline skills (`ponytail`, `ponytail-audit`, `ponytail-debt`, `ponytail-gain`, `ponytail-help`, `ponytail-review`)
35
- - Ponytail OpenCode plugin (`.opencode/plugins/ponytail.mjs`) loaded via the `plugin` config key
41
+ - Author's upstream Ponytail OpenCode plugin registration (`@dietrichgebert/ponytail@4.12.0`) in both template configs; no bundled local plugin source
36
42
  - 7 ponytail hooks in `hooks/` (`ponytail-activate`, `ponytail-config`, `ponytail-instructions`, `ponytail-mode-tracker`, `ponytail-runtime`, `ponytail-statusline.sh`, `ponytail-statusline.ps1`), plus 2 hook configuration files for Claude/Codex and Copilot (`claude-codex-hooks.json`, `copilot-hooks.json`)
37
43
  - Ponytail rule in `.agents/rules/` and `.cursor/rules/` for ambient agent context
38
44
  - 6 ponytail commands (`ponytail`, `ponytail-audit`, `ponytail-debt`, `ponytail-gain`, `ponytail-help`, `ponytail-review`) with thin-wrapper sources in `.claude/prompt-snippets/`
@@ -74,7 +80,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
74
80
  - Added missing templates referenced in templates/README.md
75
81
  - `scripts/pre-commit-check.sh` — early-exit when no files are staged so the CHANGELOG check no longer fires on empty commits (PR #20 review)
76
82
  - `scripts/check-parity.sh` — removed duplicate `check_body_match` call for the cursor ↔ github prompt body (PR #20 review)
77
- - `.opencode/plugins/ponytail.mjs` — wrapped `writeMode` in a try/catch so an unwritable state directory no longer crashes the plugin (PR #20 review)
78
83
  - `ponytail-help` SKILL.md and prompt snippet — added missing `ponytail-audit`, `ponytail-debt`, and `/ponytail-gain` entries; corrected OpenCode slash-command count to six; rewrote the Claude-Code-specific Update section to describe the template update flow (PR #20 review)
79
84
  - `ponytail-gain` SKILL.md and prompt snippet (repo, monorepo, root) — replaced the phantom `benchmarks/` source reference with the upstream `DietrichGebert/ponytail` repo link (PR #20 review)
80
85
  - `README.md` — corrected "8 activation hooks" to "7 activation hooks" to match CHANGELOG and the actual hook count (PR #20 review)
package/README.md CHANGED
@@ -65,7 +65,7 @@ This repository serves as a **template source** for AI development instructions
65
65
  ├── .cursor/ # This toolkit's own Cursor config
66
66
  ├── .github/ # This toolkit's own GitHub config
67
67
  ├── .opencode/ # This toolkit's own OpenCode config
68
- │ └── plugins/ # OpenCode plugins (ponytail mode manager, etc.)
68
+ │ └── plugins/ # Other local OpenCode plugins (Ponytail uses upstream)
69
69
  ├── hooks/ # Claude Code / Copilot activation hooks (ponytail, etc.)
70
70
  └── AGENTS.md # This toolkit's agent context
71
71
  ```
@@ -181,6 +181,37 @@ npx nitm-ai-dev-toolkit omo-slim-starter install
181
181
 
182
182
  After `install`, ask your AI agent to read and follow `.nitm/BOOTSTRAP.md`. Harnesses that supply a toolkit `/bootstrap` wrapper can also use it; **Codex has no native toolkit `/bootstrap` command**. Use `doctor` to verify the result.
183
183
 
184
+ ### Native OpenCode V2 (toolkit 4.0.0)
185
+
186
+ Toolkit v4 requires **OpenCode V2 (major >=2)** for OpenCode use; **oh-my-opencode-slim >=3.0.0** requires **OpenCode >=2.0.7**. All repo/monorepo bootstrap, patch, and upgrade flows run `opencode --version` before changes, accepting an optional leading `v`. V1 must stop before OpenCode customization/migration or marking toolkit 4.0.0: upgrade OpenCode or remain on toolkit 3.x. A missing CLI or unparseable version stops OpenCode steps and version marking until the user confirms/installs a supported version. Confirm harness use from runtime evidence or ask; scaffold directories are not proof. Other-harness-only setup is unaffected.
187
+
188
+ Publishing 4.0.0 has not been executed. The external `nitm-opencode-starter` is a separate package, not automatically upgraded.
189
+
190
+ With user approval, merge this reproducible registration without replacing user/global plugins:
191
+
192
+ ```jsonc
193
+ { "plugins": ["oh-my-opencode-slim@3.0.0"] }
194
+ ```
195
+
196
+ The toolkit root deliberately omits `plugins` to inherit user/global registrations; its existing upstream Ponytail registration is unchanged. Both target templates register the author's native V2 package `@dietrichgebert/ponytail@4.12.0` in their local `plugins` arrays, alongside `opencode-mem` and `@tarquinen/opencode-dcp@latest`; `opentmux` remains commented as V1-only. The local `ponytail.mjs` files are removed from the toolkit root and both templates; no local API port or bridge replaces them.
197
+
198
+ For existing targets, back up and obtain approval before removing only known obsolete toolkit `.opencode/plugins/ponytail.js`, `.mjs`, or `.ts` copies. Preserve unrelated local plugins; merge/deduplicate upstream package registration locally where appropriate, without editing or overwriting global plugins. Native local plugins are discovered automatically, so do not register them twice. Slim's separate strict schema keeps its own `prompt`, `permission`, and `variant`: do not host-migrate plugin-owned fields. The root's no-`plugins` policy is specific to this toolkit repository, not target templates.
199
+
200
+ | Setting | Native V2 form |
201
+ | --- | --- |
202
+ | Agents | `agents`, JSON `system` (Markdown body for file agents), `request.body.temperature`, model `provider/model#variant` |
203
+ | Permissions | Ordered `permissions` with `action`, `resource`, `effect`; `shell`/`subagent` actions; last match wins |
204
+ | Commands | `commands`; delegated commands use `subagent` |
205
+ | Plugins | `plugins`; options use `{ "package": "…", "options": {} }` |
206
+ | Skills | Directory-path array, e.g. `[".agents/skills"]`, not Markdown globs |
207
+ | MCP | `mcp.servers`; `disabled` inverts legacy `enabled`; `timeout.catalog`/`timeout.execution` |
208
+
209
+ Follow official V2 [migration](https://opencode.ai/v2/docs/migrate-v1), [config](https://opencode.ai/v2/docs/config), [agents](https://opencode.ai/v2/docs/agents), and [plugins](https://opencode.ai/v2/docs/build/plugins) docs. The published `https://opencode.ai/config.json` schema may describe V1; it is not native V2 validation authority.
210
+
211
+ **Runtime limits:** config `instructions` entries are accepted but not loaded; ambient `AGENTS.md` works. `@refs` are ordinary text, not automatic attachments: agents must read referenced snippets explicitly. `request.body.temperature` remains in config, but the current runner does not send it. Plugin/runtime integration has not been tested. Preserve `lsp: true`, but V2 currently exposes no LSP tools or diagnostics: use project lint/typecheck/compiler commands.
212
+
213
+ `--env opencode` includes minimal shared references for wrappers and AGENTS-linked standards without activating other harnesses. Merge, don't clobber: back up V1, preserve models/providers and user/global plugins, and ask before changes. Native-converted files are **incompatible with V1**. Activate on the next run/restart, then check behavior with the installed V2 runtime. `doctor` checks scaffold files/placeholders, not runtime behavior; do not substitute a V1 API/schema fetch or claim checks that were not run.
214
+
184
215
  ### Native Codex
185
216
 
186
217
  - `--env codex` includes `.codex/`, `.agents/`, and shared context, plus `.github/instructions/` and `.claude/rules-snippets/` solely to supply the standards linked from `AGENTS.md` and those standards' wrapper source content. It does not install other harness command, agent, or config directories. These reference files neither establish Copilot/Claude use nor load automatically as Codex rules; other harness scopes are unchanged.
@@ -701,7 +732,7 @@ This toolkit includes **32 pre-installed universal skills** in the `.agents/skil
701
732
 
702
733
  **These skills are ready to use immediately after copying the templates.** No `npx -y skills add -a <agent> <owner/repo> --skill '*' --agent github-copilot cursor` commands needed.
703
734
 
704
- The **ponytail** skill bundle is an integrated optional skill set from [DietrichGebert/ponytail](https://github.com/DietrichGebert/ponytail) that adds YAGNI/stdlib/native/one-line/minimum discipline to your AI agents. It includes 6 skills, 6 commands, an OpenCode plugin, 7 activation hooks, and ambient agent rules — all pre-configured and ready to use.
735
+ The **ponytail** skill bundle is an integrated optional skill set from [DietrichGebert/ponytail](https://github.com/DietrichGebert/ponytail) that adds YAGNI/stdlib/native/one-line/minimum discipline to your AI agents. It includes 6 skills, 6 commands, 7 activation hooks, and ambient agent rules. OpenCode uses the author's upstream `@dietrichgebert/ponytail@4.12.0` package, not a bundled local plugin. See [native setup](#native-opencode-v2-toolkit-400); scaffolding alone does not establish activation.
705
736
 
706
737
  ### Additional Recommended Skills
707
738
 
package/bin/cli.js CHANGED
@@ -19,7 +19,10 @@ const ENV_DIRS = {
19
19
  codex: ['.codex', '.agents', path.join('.github', 'instructions'), path.join('.claude', 'rules-snippets')],
20
20
  copilot: ['.github', '.vscode'],
21
21
  cursor: ['.cursor'],
22
- opencode: ['.opencode'],
22
+ // Shared reference sources, not other harnesses' active config/agent wrappers.
23
+ opencode: ['.opencode', path.join('.agents', 'skills'),
24
+ path.join('.claude', 'agents-snippets'), path.join('.claude', 'prompt-snippets'),
25
+ path.join('.claude', 'rules-snippets'), path.join('.github', 'instructions')],
23
26
  };
24
27
  const ENV_INFO = {
25
28
  claude: { name: 'Claude Code', command: '/bootstrap (Claude Code command in .claude/commands/)' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitm-ai-dev-toolkit",
3
- "version": "3.0.23",
3
+ "version": "4.0.0",
4
4
  "description": "Scaffold AI agent config (Cursor, GitHub Copilot, Claude Code, OpenCode, Codex) into any repo, then hand off to your AI agent to finish setup.",
5
5
  "bin": {
6
6
  "nitm-ai-dev-toolkit": "bin/cli.js"
@@ -1,15 +1,13 @@
1
1
  ---
2
- description: Audit the whole repo for over-engineering and identify what can be deleted
3
- allowed-tools: "Read, Grep, Bash"
2
+ description: Audit the whole repo for over-engineering — find what can be deleted
3
+ allowed-tools: "Read, Grep"
4
4
  argument-hint: "no arguments required"
5
5
  ---
6
6
 
7
- ## Agent Dispatch
7
+ # Ponytail Audit
8
8
 
9
+ ## Agent Dispatch
9
10
  > **Recommended agent:** `oracle`
10
11
  > Whole-repo over-engineering analysis
11
12
 
12
-
13
- # Ponytail Audit
14
-
15
13
  Follow the prompt defined in [.claude/prompt-snippets/ponytail-audit.md](../prompt-snippets/ponytail-audit.md).
@@ -1,15 +1,13 @@
1
1
  ---
2
2
  description: "Harvest ponytail: comments into a tracked debt ledger"
3
- allowed-tools: "Read, Grep, Bash"
3
+ allowed-tools: "Read, Grep"
4
4
  argument-hint: "no arguments required"
5
5
  ---
6
6
 
7
- ## Agent Dispatch
7
+ # Ponytail Debt
8
8
 
9
+ ## Agent Dispatch
9
10
  > **Recommended agent:** `fixer`
10
11
  > Debt ledger harvesting
11
12
 
12
-
13
- # Ponytail Debt
14
-
15
13
  Follow the prompt defined in [.claude/prompt-snippets/ponytail-debt.md](../prompt-snippets/ponytail-debt.md).
@@ -4,12 +4,10 @@ allowed-tools: "Read"
4
4
  argument-hint: "no arguments required"
5
5
  ---
6
6
 
7
- ## Agent Dispatch
7
+ # Ponytail Gain
8
8
 
9
+ ## Agent Dispatch
9
10
  > **Recommended agent:** `fixer`
10
11
  > Impact scoreboard display
11
12
 
12
-
13
- # Ponytail Gain
14
-
15
13
  Follow the prompt defined in [.claude/prompt-snippets/ponytail-gain.md](../prompt-snippets/ponytail-gain.md).
@@ -4,12 +4,10 @@ allowed-tools: "Read"
4
4
  argument-hint: "no arguments required"
5
5
  ---
6
6
 
7
- ## Agent Dispatch
7
+ # Ponytail Help
8
8
 
9
+ ## Agent Dispatch
9
10
  > **Recommended agent:** `fixer`
10
11
  > Quick-reference display
11
12
 
12
-
13
- # Ponytail Help
14
-
15
13
  Follow the prompt defined in [.claude/prompt-snippets/ponytail-help.md](../prompt-snippets/ponytail-help.md).
@@ -1,15 +1,13 @@
1
1
  ---
2
- description: Review changes for over-engineering and identify what can be deleted
2
+ description: Review changes for over-engineering — find what can be deleted
3
3
  allowed-tools: "Read, Grep"
4
4
  argument-hint: "no arguments required"
5
5
  ---
6
6
 
7
- ## Agent Dispatch
7
+ # Ponytail Review
8
8
 
9
+ ## Agent Dispatch
9
10
  > **Recommended agent:** `oracle`
10
11
  > Diff-level over-engineering review
11
12
 
12
-
13
- # Ponytail Review
14
-
15
13
  Follow the prompt defined in [.claude/prompt-snippets/ponytail-review.md](../prompt-snippets/ponytail-review.md).
@@ -1,15 +1,13 @@
1
1
  ---
2
2
  description: Switch ponytail intensity level (lite/full/ultra/off)
3
- allowed-tools: "Read, Grep, Bash, Edit, Write"
3
+ allowed-tools: "Read, Grep"
4
4
  argument-hint: "optional level (lite/full/ultra/off)"
5
5
  ---
6
6
 
7
- ## Agent Dispatch
7
+ # Ponytail
8
8
 
9
+ ## Agent Dispatch
9
10
  > **Recommended agent:** `fixer`
10
11
  > Apply YAGNI/stdlib discipline
11
12
 
12
-
13
- # Ponytail
14
-
15
13
  Follow the prompt defined in [.claude/prompt-snippets/ponytail.md](../prompt-snippets/ponytail.md).
@@ -1,9 +1,17 @@
1
- You are helping to patch AI instructions in this project by comparing against the latest templates from the ai-assisted-dev-toolkit repository and applying any updates.
1
+ You are helping to patch AI instructions by comparing against supported toolkit v4.x templates from the ai-assisted-dev-toolkit repository's `v4.x` branch and merging updates into this project.
2
+
3
+ ## OpenCode version preflight (before any changes)
4
+
5
+ - Confirm OpenCode use from actual session/runtime evidence or ask the user; directory presence alone is not proof. If only other harnesses are used, skip this preflight and all OpenCode steps.
6
+ - For confirmed OpenCode use, run `opencode --version` before any project writes. Trim output and parse numeric major/minor/patch components, accepting an optional leading `v`; toolkit 4.x requires `major >= 2`.
7
+ - If OpenCode V1 (`major < 2`) is detected, **STOP** before customizing/migrating OpenCode files or writing `.toolkit-version` as `4.0.0`. Ask the user to upgrade OpenCode to V2 or remain on toolkit 3.x.
8
+ - If the CLI is missing, fails, or output is unparseable, **STOP OpenCode steps** and leave the version marker unchanged; ask the user to confirm/install a supported OpenCode version, then rerun this check. Never assume V2.
9
+ - If oh-my-opencode-slim >=3.0.0 is used or planned, require OpenCode >=2.0.7 (compare version components numerically); otherwise **STOP** before changes and ask to upgrade. Proceed only after this gate passes.
2
10
 
3
11
  ## Orchestrator Checkpoint
4
12
 
5
13
  > **🛑 Before starting**: This command involves fetching, diffing, and applying changes across many files.
6
- > Dispatch parallel subagents for independent file groups (rules, commands, prompts, instructions, skills, agents).
14
+ > Complete Step 1's source/version gates before dispatching parallel diff agents for independent file groups (rules, commands, prompts, instructions, skills, agents).
7
15
  > See `.claude/rules-snippets/subagent-workflow.md` for patterns.
8
16
 
9
17
  ## Usage
@@ -23,13 +31,16 @@ You are helping to patch AI instructions in this project by comparing against th
23
31
 
24
32
  1. **Fetch Latest Templates**:
25
33
 
26
- Clone or fetch the latest ai-assisted-dev-toolkit templates:
34
+ Fetch only the supported `v4.x` source branch:
27
35
 
28
36
  ```bash
37
+ set -e
29
38
  TOOLKIT_TEMP=$(mktemp -d)
30
- git clone --depth 1 https://github.com/ninjasitm/ai-assisted-dev-toolkit.git "$TOOLKIT_TEMP"
39
+ git clone --depth 1 --branch v4.x https://github.com/ninjasitm/ai-assisted-dev-toolkit.git "$TOOLKIT_TEMP"
31
40
  ```
32
41
 
42
+ **Source availability gate:** If the clone fails or `v4.x` is unavailable (for example, not yet published), **STOP** before diff/apply/version marking. Do not fall back to the default branch or V3, and do not push/publish a branch to unblock this task; ask for an approved available v4.x source.
43
+
33
44
  Determine the correct source path based on project structure:
34
45
  - **Single repo**: Use `$TOOLKIT_TEMP/src/repo/`
35
46
  - **Monorepo**: Use `$TOOLKIT_TEMP/src/monorepo/`
@@ -42,9 +53,11 @@ You are helping to patch AI instructions in this project by comparing against th
42
53
 
43
54
  Check for a `.toolkit-version` file in the project root:
44
55
  - If exists: Read the version string (e.g., `2.0.10`, `3.0.0`)
45
- - If missing: Assume legacy version (pre-3.0.0)
56
+ - If missing: Verify the installed version or legacy state with the user; absence alone does not prove a pre-3.0 installation
46
57
 
47
- Read the toolkit's version from `$TOOLKIT_TEMP/.toolkit-version` to compare.
58
+ Read the toolkit's version from the `version` field in `$TOOLKIT_TEMP/package.json` to compare; `.toolkit-version` tracks the target project's installed version.
59
+
60
+ **Source version guard (before diff/apply/version marking):** Parse source/target versions as SemVer and compare them (major/minor/patch numerically). If the fetched package's major is not `4`, or its version is older than the target `.toolkit-version`, **STOP** without diffing, applying changes, or updating the marker. Unknown/unparseable versions must also **STOP** and ask rather than guess. Never auto-downgrade.
48
61
 
49
62
  **Version Comparison:**
50
63
  - **Same version**: No structural changes expected
@@ -76,20 +89,20 @@ You are helping to patch AI instructions in this project by comparing against th
76
89
  | **OpenCode Commands** | `.opencode/commands/*.md` | `src/{type}/.opencode/commands/*.md` |
77
90
  | **OpenCode Rules** | `.opencode/rules/*.md` | `src/{type}/.opencode/rules/*.md` |
78
91
  | **OpenCode Agents** | `.opencode/agents/*.md` | `src/{type}/.opencode/agents/*.md` |
79
- | **OpenCode Plugins** | `.opencode/plugins/*.mjs` | `src/{type}/.opencode/plugins/*.mjs` |
92
+ | **OpenCode Local Plugins** | `.opencode/plugins/*.{js,mjs,ts}` | Inventory only; preserve unrelated plugins |
80
93
  | **Hooks** | `hooks/*.{js,sh,ps1}` | `src/{type}/hooks/*.{js,sh,ps1}` |
81
94
  | **Agent Rules** | `.agents/rules/*.md` | `src/{type}/.agents/rules/*.md` |
82
- | **Toolkit Version** | `.toolkit-version` | `.toolkit-version` (root of toolkit) |
83
-
84
- **⚠️ OpenCode `opencode.jsonc` Schema Validation:**
85
-
86
- When patching `.opencode/opencode.jsonc`, **only add or modify supported top-level keys**. The schema is defined at `https://opencode.ai/config.json`. Do NOT add unsupported keys.
95
+ | **Toolkit Version** | `.toolkit-version` | `package.json` `version` (toolkit root) |
87
96
 
88
- **Supported top-level keys:** `$schema`, `instructions`, `skills`, `agent`, `default_agent`, `model`, `small_model`, `provider`, `mcp`, `tools`, `permission`, `lsp`, `formatter`, `server`, `shell`, `command`, `plugin`, `watcher`, `snapshot`, `share`, `autoupdate`, `compaction`, `attachment`, `logLevel`, `disabled_providers`, `enabled_providers`, `tool_output`, `enterprise`, `experimental`
97
+ **OpenCode native V2 merge checks (confirmed OpenCode use only):**
89
98
 
90
- **Do NOT add** keys like `rules`, `agents`, `commands`, `prompts` as top-level keys — OpenCode uses the `.opencode/` directory structure and `instructions` array instead.
99
+ Follow official V2 [migration](https://opencode.ai/v2/docs/migrate-v1), [config](https://opencode.ai/v2/docs/config), [agents](https://opencode.ai/v2/docs/agents), and [plugins](https://opencode.ai/v2/docs/build/plugins) docs. The published schema may describe V1; neither it nor a V1 API fetch validates native V2. Plural keys are intentional.
91
100
 
92
- > **Watch out:** the ponytail template uses the `plugin` key (singular). If you see `plugins` (plural) in your `opencode.jsonc`, that's a typo and the plugin won't load.
101
+ - Use `agents`/`system`, `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`, last match wins), `commands`/`subagent`, `plugins` with `{ "package": "…", "options": {} }`, skill-directory arrays, and `mcp.servers` with inverse `disabled` and `timeout.catalog`/`timeout.execution`.
102
+ - The version preflight must pass before changes. Back up V1 before native conversion (converted files are incompatible with V1). Preserve models/providers/user-global plugins. Only with approval, merge `"plugins": ["oh-my-opencode-slim@3.0.0"]` locally. Slim's separate strict schema keeps `prompt`/`permission`/`variant`; do not host-migrate it or silently upgrade the separate external starter.
103
+ - **Ponytail replacement (plan here; apply after backup and approval in Step 5):** Remove only known obsolete toolkit-owned `.opencode/plugins/ponytail.js`, `.opencode/plugins/ponytail.mjs`, and `.opencode/plugins/ponytail.ts` copies. Preserve unrelated local plugins. Merge/deduplicate the author's native V2 `@dietrichgebert/ponytail@4.12.0` registration in the local `plugins` array where appropriate, retaining other registrations/options; do not edit global config. Keep `opentmux` commented as V1-only. Do not port local APIs or add bridges; runtime integration is untested. Native local discovery needs no duplicate registration.
104
+ - `instructions` entries are accepted but not loaded; ambient root/nested `AGENTS.md` works. `@refs` are ordinary text: explicitly read snippets. `request.body.temperature` remains in config, but the current runner does not send it. Preserve `lsp: true`; use workspace lint/typecheck/compiler commands (no V2 LSP tools/diagnostics currently).
105
+ - `--env opencode` supplies minimal shared references without other harness activation. Activate on the next run/restart and report only installed-V2 checks actually run, not assumed runtime validation. Publishing 4.0.0 has not been executed.
93
106
 
94
107
  3. **Diff Analysis** (parallelizable — dispatch one subagent per category):
95
108
 
@@ -100,7 +113,7 @@ You are helping to patch AI instructions in this project by comparing against th
100
113
  - **📝 Updated**: Exists in both but template has newer content → candidate for merge
101
114
  - **✅ Current**: Exists in both and content matches → no action needed
102
115
  - **🔧 Customized**: Exists in both, project version has non-placeholder customizations → careful merge
103
- - **⚠️ Missing in Template**: Exists in project but not in template → project-specific, keep as-is
116
+ - **⚠️ Missing in Template**: Exists in project but not in template → project-specific, keep as-is except the approved obsolete toolkit Ponytail removal above
104
117
 
105
118
  b. **For updated files, generate a structured diff**:
106
119
  - Preserve project-specific `{{PLACEHOLDER}}` replacements (already-bootstrapped values)
@@ -161,7 +174,9 @@ You are helping to patch AI instructions in this project by comparing against th
161
174
  a. **New files**: Copy directly from template
162
175
  b. **Updated files (no customization)**: Replace with template version
163
176
  c. **Updated files (customized)**: Apply structural additions while preserving project values
164
- d. **Git commit**: Stage and commit all changes with message:
177
+ d. **OpenCode plugins**: Apply only the approved Ponytail replacement above after backing up the known obsolete toolkit copies and local config; preserve all unrelated local/global plugins.
178
+ e. **Toolkit version**: Update `.toolkit-version` to the fetched toolkit version (`4.0.0` for this migration) only after the approved migration and OpenCode preflight pass (or OpenCode is confirmed out of scope).
179
+ f. **Git commit**: Stage and commit all changes with message:
165
180
  ```bash
166
181
  git add -A
167
182
  git commit -m "chore: patch AI instructions from toolkit [$(date +%Y-%m-%d)]"
@@ -1,12 +1,32 @@
1
1
  # Bootstrap Upgrade — Monorepo
2
2
 
3
- Migrate this monorepo's AI instruction files from the pre-3.0 inline pattern to the 3.0+ snippet-based architecture.
3
+ Upgrade this monorepo to toolkit 4.0.0, including native OpenCode V2 for confirmed OpenCode users. For pre-3.0 installations, also migrate inline content to snippet-based architecture. Only modify confirmed harness targets; preserve unrelated harness/Codex behavior.
4
+
5
+ ## OpenCode version preflight (before any changes)
6
+
7
+ - Confirm OpenCode use from actual session/runtime evidence or ask the user; directory presence alone is not proof. If only other harnesses are used, skip this preflight and all OpenCode steps.
8
+ - For confirmed OpenCode use, run `opencode --version` before any project writes. Trim output and parse numeric major/minor/patch components, accepting an optional leading `v`; toolkit 4.x requires `major >= 2`.
9
+ - If OpenCode V1 (`major < 2`) is detected, **STOP** before customizing/migrating OpenCode files or writing `.toolkit-version` as `4.0.0`. Ask the user to upgrade OpenCode to V2 or remain on toolkit 3.x.
10
+ - If the CLI is missing, fails, or output is unparseable, **STOP OpenCode steps** and leave the version marker unchanged; ask the user to confirm/install a supported OpenCode version, then rerun this check. Never assume V2.
11
+ - If oh-my-opencode-slim >=3.0.0 is used or planned, require OpenCode >=2.0.7 (compare version components numerically); otherwise **STOP** before changes and ask to upgrade. Proceed only after this gate passes.
12
+
13
+ ## Toolkit version routing (before parallel dispatch)
14
+
15
+ Read `.toolkit-version` and select the route before dispatching agents or changing files; apply only confirmed harness scopes:
16
+
17
+ - **>=4.0.0**: Use bootstrap-patch and **STOP** this upgrade without rewrites or version marking.
18
+ - **v3 (`3.x`)**: **Skip Steps 2–6 and 8–10.** Run only the relevant native OpenCode migration in Step 7 (confirmed OpenCode use only), then applicable approved merge/validation/version/report steps 11–15. Preserve existing snippet bodies/frontmatter and unrelated harness files.
19
+ - **Pre-3.0 or missing marker**: Steps 2–6 and applicable approved legacy steps 8–10 require a verified legacy inline installation. A missing marker alone is not legacy evidence; if snippets already exist or the installed version cannot be verified, **STOP** and ask rather than extracting/rewriting them. Back up before legacy conversion and preserve existing customizations.
20
+ - **Invalid or unverified version**: **STOP** and ask; never guess a route or downgrade.
21
+
22
+ ## OpenCode migration guardrails
23
+
24
+ Back up V1; native-converted files are incompatible with V1. Preserve models/providers/user-global plugins. Templates register the author's native V2 package `@dietrichgebert/ponytail@4.12.0`; obsolete toolkit-local Ponytail copies are replaced only after backup and approval (Step 7), with no API port or bridge. Keep `opentmux` commented as V1-only. Only with approval, merge pinned `"plugins": ["oh-my-opencode-slim@3.0.0"]` locally without replacing other registrations. Slim's separate strict schema retains `prompt`/`permission`/`variant`; do not host-migrate it or silently upgrade the separate external starter. Activate on the next run/restart; plugin/runtime integration is untested and publishing 4.0.0 has not been executed.
4
25
 
5
26
  ## Orchestrator Checkpoint
6
27
 
7
28
  > **🛑 Before starting**: This command involves reading, extracting, and rewriting many files across multiple directories.
8
- > Dispatch parallel subagents for independent file groups (`.claude/`, `.github/`, `.cursor/`, `.opencode/`).
9
- > Steps 3-6 can run in parallel per directory. Steps 7-15 are sequential.
29
+ > Complete version routing above before parallel dispatch; only the verified legacy route may dispatch Steps 3–6, for confirmed harnesses. Applicable Steps 7–15 are sequential.
10
30
 
11
31
  ## Usage
12
32
 
@@ -25,9 +45,7 @@ Migrate this monorepo's AI instruction files from the pre-3.0 inline pattern to
25
45
 
26
46
  1. **Confirm monorepo structure**: Verify `apps/` and `packages/` directories exist at root. If not, abort and suggest using the single-repo upgrade command instead.
27
47
 
28
- 2. **Check existing version**: Read `.toolkit-version` if it exists.
29
- - If version is `>= 3.0.0` and snippet directories exist → **abort**: "Already on v3.0+. No migration needed."
30
- - If version is `< 3.0.0` or missing → proceed.
48
+ 2. **Check existing version**: Apply the route selected above; inventory and confirm only its applicable steps and confirmed harness targets.
31
49
 
32
50
  3. **Detect build system** (for CLAUDE.md update in Step 10):
33
51
  - `turbo.json` → Turborepo
@@ -53,17 +71,17 @@ Migrate this monorepo's AI instruction files from the pre-3.0 inline pattern to
53
71
  5. **Present summary and ask for confirmation**:
54
72
 
55
73
  ```markdown
56
- ## 🔄 Monorepo Upgrade: Pre-3.0 → v3.0.0 (Snippet Architecture)
74
+ ## 🔄 Monorepo Upgrade: toolkit v4.0.0
57
75
 
58
- ### What will change
76
+ **Selected route**: verified legacy | v3 native OpenCode
59
77
 
60
- - Create `.claude/rules-snippets/`, `.claude/prompt-snippets/`, `.claude/agents-snippets/`
61
- - Extract content from {{N}} files into snippet files
62
- - Convert originals to thin wrappers referencing snippets
63
- - Create `.opencode/` directory with thin wrappers
64
- - Clean up duplicate skill directories
65
- - Update CLAUDE.md with multi-tool sections
66
- - Write `.toolkit-version` with `3.0.0`
78
+ ### What will change (omit skipped steps for the selected route)
79
+
80
+ - Verified legacy only: create missing snippet directories, extract inline content from {{N}} files, and convert confirmed harness wrappers (Steps 2–6)
81
+ - Confirmed OpenCode only: merge native V2 host files and approved missing wrappers (Step 7)
82
+ - Verified legacy only: approved hook installation and verified identical duplicate skill cleanup (Steps 8–10); preserve custom skills
83
+ - Merge only applicable missing documentation and validate the selected route; v3 keeps existing snippet bodies/frontmatter unchanged
84
+ - Write `.toolkit-version` with `4.0.0` after the approved migration
67
85
 
68
86
  ### Monorepo-specific changes
69
87
 
@@ -76,6 +94,8 @@ Migrate this monorepo's AI instruction files from the pre-3.0 inline pattern to
76
94
 
77
95
  ### Step 2: Create Snippet Directories
78
96
 
97
+ **Steps 2–6 are verified-legacy-only.** Skip this entire block for v3; never extract or rewrite existing snippet bodies/frontmatter. Process only confirmed harness targets.
98
+
79
99
  Create these directories if they don't exist:
80
100
 
81
101
  ```bash
@@ -233,27 +253,29 @@ Follow the rules defined in [.claude/rules-snippets/{{NAME}}.md](../../.claude/r
233
253
  2. If no matching snippet: extract body → create `.claude/agents-snippets/<name>.md`
234
254
  3. Replace body with thin wrapper referencing `../../.claude/agents-snippets/{{NAME}}.md`
235
255
 
236
- ### Step 7: Create .opencode/ Directory
256
+ ### Step 7: Create .opencode/ Directory (confirmed OpenCode use only)
257
+
258
+ For the v3 route, merge only relevant native OpenCode host fields; preserve existing wrapper bodies, modes, unrelated frontmatter, and shared snippet bodies/frontmatter. The wrapper examples below apply only to approved missing files, not replacement of existing wrappers.
237
259
 
238
- 1. Create `.opencode/opencode.jsonc` using only supported schema keys:
260
+ 1. Merge `.opencode/opencode.jsonc` using native V2 fields:
239
261
 
240
262
  ```json
241
263
  {
242
- "$schema": "https://opencode.ai/config.json",
243
- "instructions": ["AGENTS.md", ".opencode/rules/*.md"],
244
- "skills": {
245
- "paths": [".agents/skills/**/*.md", ".claude/skills/**/*.md"]
246
- },
247
- "lsp": true
264
+ "$schema": "https://opencode.ai/config.json",
265
+ "instructions": ["AGENTS.md", ".opencode/rules/*.md"],
266
+ "skills": [".agents/skills"],
267
+ "plugins": ["@dietrichgebert/ponytail@4.12.0"],
268
+ "lsp": true
248
269
  }
249
270
  ```
250
271
 
251
- **⚠️ Schema Validation:** Only use supported top-level keys from `https://opencode.ai/config.json`. Do NOT add unsupported keys like `rules`, `commands`, or `agents` as top-level entries — OpenCode discovers these via the `.opencode/` directory structure and the `instructions`/`skills` config arrays.
272
+ Follow official V2 [migration](https://opencode.ai/v2/docs/migrate-v1), [config](https://opencode.ai/v2/docs/config), [agents](https://opencode.ai/v2/docs/agents), and [plugins](https://opencode.ai/v2/docs/build/plugins) docs. The published schema may describe V1; do not use it or a V1 API fetch as native V2 validation authority. Use `agents`/JSON `system` (Markdown bodies for file agents), `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`, last match wins), `commands`/`subagent`, `plugins` with `{ "package": "…", "options": {} }`, skill-directory arrays, and `mcp.servers` with inverse `disabled` and `timeout.catalog`/`timeout.execution`.
252
273
 
253
- **Supported top-level keys:** `$schema`, `instructions`, `skills`, `agent`, `default_agent`, `model`, `small_model`, `provider`, `mcp`, `tools`, `permission`, `lsp`, `formatter`, `server`, `shell`, `command`, `plugin`, `watcher`, `snapshot`, `share`, `autoupdate`, `compaction`, `attachment`, `logLevel`, `disabled_providers`, `enabled_providers`, `tool_output`, `enterprise`, `experimental`
274
+ `instructions` entries are accepted but not loaded; ambient root/nested `AGENTS.md` works. `@refs` are ordinary text, not attachments: wrappers must explicitly tell agents to read referenced snippets. `request.body.temperature` remains in config, but the current runner does not send it. Preserve `lsp: true`; use workspace lint/typecheck/compiler commands (no current V2 LSP tools/diagnostics). `--env opencode` supplies minimal shared references without other harness activation. Verify using installed V2 after the next run/restart; report only checks actually run.
254
275
 
255
- 2. **Copy OpenCode plugins**:
256
- - Copy any `.opencode/plugins/*.mjs` files from the template
276
+ 2. **Replace obsolete toolkit Ponytail (backup and approval only)**:
277
+ - Back up the local config and known obsolete toolkit-owned `.opencode/plugins/ponytail.js`, `.opencode/plugins/ponytail.mjs`, and `.opencode/plugins/ponytail.ts` copies; obtain approval before removing only those copies. Preserve unrelated local plugins.
278
+ - Merge/deduplicate the author's native V2 `@dietrichgebert/ponytail@4.12.0` package in the local `plugins` array where appropriate, preserving other registrations/options. Do not edit global config or overwrite global plugins. Keep `opentmux` commented as V1-only; do not copy local Ponytail source, port APIs, or introduce bridges. Native local discovery needs no duplicate explicit registration; runtime integration remains untested.
257
279
 
258
280
  3. Create `.opencode/commands/*.md` — one thin wrapper per `.claude/commands/*.md`:
259
281
 
@@ -265,7 +287,7 @@ Follow the rules defined in [.claude/rules-snippets/{{NAME}}.md](../../.claude/r
265
287
 
266
288
  # {{TITLE}}
267
289
 
268
- @.claude/prompt-snippets/{{NAME}}.md
290
+ Read and follow `.claude/prompt-snippets/{{NAME}}.md` before executing this command.
269
291
  ```
270
292
 
271
293
  4. Create `.opencode/rules/*.md` — one thin wrapper per `.claude/rules/*.md`:
@@ -273,7 +295,7 @@ Follow the rules defined in [.claude/rules-snippets/{{NAME}}.md](../../.claude/r
273
295
  ```markdown
274
296
  # {{TITLE}}
275
297
 
276
- @.claude/rules-snippets/{{NAME}}.md
298
+ Read and follow `.claude/rules-snippets/{{NAME}}.md` when these standards apply.
277
299
  ```
278
300
 
279
301
  5. Create `.opencode/agents/*.md` — one thin wrapper per `.claude/agents/*.agent.md`:
@@ -286,7 +308,7 @@ Follow the rules defined in [.claude/rules-snippets/{{NAME}}.md](../../.claude/r
286
308
 
287
309
  # {{AGENT_NAME}}
288
310
 
289
- @.claude/agents-snippets/{{NAME}}.md
311
+ Read and follow `.claude/agents-snippets/{{NAME}}.md` before performing this role.
290
312
  ```
291
313
 
292
314
  ### Step 8: Install Pre-Commit Hook
@@ -317,16 +339,14 @@ Use `git commit --no-verify` to bypass.
317
339
 
318
340
  ### Step 10: Clean Up Duplicate Skills
319
341
 
320
- - Copy `.agents/rules/*.md` from the template
321
-
322
- 1. Keep `.agents/skills/` as the source of truth
323
- 2. For each of `.claude/skills/`, `.cursor/skills/`, `.github/skills/`:
324
- - If directory exists, remove all subdirectories except `README.md`
325
- 3. Remove any nested duplicates: `subagent-driven-development/subagent-driven-development/`
342
+ - Merge approved `.agents/rules/*.md` additions without overwriting custom content; skip this step on the v3 route.
343
+ - Preserve custom, unmatched, modified, and nested skill content; name or location alone does not prove duplication.
344
+ - A candidate in a confirmed harness skill directory may be removed only after the same-name canonical `.agents/skills/<skill-name>/` copy exists and a complete recursive comparison (`diff -qr` or equivalent, including nested content) proves them identical. Missing canonical copy, differences, or comparison errors mean preserve and report, not delete.
345
+ - Back up the verified identical duplicate and obtain explicit approval before removing only that duplicate; keep the canonical copy intact. No bulk deletion or name/location-based nested cleanup.
326
346
 
327
347
  ### Step 11: Update CLAUDE.md
328
348
 
329
- Read the existing `CLAUDE.md` and add missing sections:
349
+ If `CLAUDE.md` is an applicable confirmed harness target, merge only missing relevant sections; preserve existing bodies/frontmatter:
330
350
 
331
351
  1. **Multi-tool sections** — add if missing:
332
352
  - GitHub Copilot section (references `.github/instructions/`, `.github/prompts/`, `.github/agents/`)
@@ -354,32 +374,37 @@ Read the existing `CLAUDE.md` and add missing sections:
354
374
  - `.cursor/rules/*.mdc` → `.claude/rules-snippets/`
355
375
  - `.cursor/commands/*.md` → `.claude/prompt-snippets/`
356
376
  - `.cursor/agents/*.agent.md` → `.claude/agents-snippets/`
357
- - `.opencode/{commands,rules,agents}/*.md` → `@.claude/{snippet-type}/`
377
+ - `.opencode/{commands,rules,agents}/*.md` → explicit read instructions for `.claude/{snippet-type}/` (no automatic `@ref` attachment)
358
378
  ```
359
379
 
360
380
  ### Step 12: Create .toolkit-version File
361
381
 
362
- Write `3.0.0` to `.toolkit-version`.
382
+ Write `4.0.0` to `.toolkit-version` only after the approved migration and OpenCode preflight pass (or OpenCode is confirmed out of scope).
363
383
 
364
384
  ### Step 13: Validation
365
385
 
366
- Run these checks (parallelizable):
386
+ Run only checks applicable to the selected route and confirmed harnesses (parallelizable); on v3 compare retained snippet bodies/frontmatter to backups:
367
387
 
368
388
  1. **Snippet completeness**: Every `.md` file in `.claude/rules-snippets/`, `.claude/prompt-snippets/`, `.claude/agents-snippets/` must have content (not empty)
369
389
  2. **Thin wrapper correctness**: Every thin wrapper must contain a reference to its snippet with the correct relative path
370
390
  3. **Monorepo `paths:` preserved**: For files that had `paths:` frontmatter in `.claude/rules/`, verify the snippet also contains `paths:`
371
391
  4. **No lost placeholders**: Scan all snippet files — any `{{` in original must appear in snippet
372
392
  5. **No broken paths**: Verify all relative paths resolve correctly (e.g., `../rules-snippets/` from `.claude/rules/`)
393
+ 6. **Custom skills preserved**: Only approved verified identical duplicates were removed; canonical copies and custom, unmatched, and nested content remain
373
394
 
374
395
  If `--verbose`: log each check result.
375
396
 
376
397
  ### Step 14: Generate Upgrade Report
377
398
 
399
+ Include only operations/checks actually performed for the selected route; omit legacy extraction/cleanup rows on v3 and never pre-mark skipped checks as passed.
400
+
378
401
  ```markdown
379
- ## ✅ Monorepo Upgrade Complete: v3.0.0 (Snippet Architecture)
402
+ ## ✅ Monorepo Upgrade Complete: v4.0.0
380
403
 
381
404
  ### Build System: {{BUILD_SYSTEM}}
382
405
 
406
+ **Selected route**: verified legacy | v3 native OpenCode
407
+
383
408
  ### Directories Created
384
409
 
385
410
  | Directory | Files |
@@ -410,22 +435,22 @@ If `--verbose`: log each check result.
410
435
  | File | Purpose |
411
436
  | -------------------------- | -------------------------- |
412
437
  | `.opencode/opencode.jsonc` | OpenCode configuration |
413
- | `.toolkit-version` | Version tracking (`3.0.0`) |
438
+ | `.toolkit-version` | Version tracking (`4.0.0`) |
414
439
 
415
440
  ### Validation Results
416
441
 
417
442
  | Check | Status |
418
443
  | ------------------------------ | ------------------------------------------ |
419
- | Snippet completeness | ✅ All snippets have content |
420
- | Thin wrapper references | ✅ All wrappers reference correct snippets |
421
- | `paths:` frontmatter preserved | ✅ Monorepo scoping intact |
422
- | No lost placeholders | ✅ All `{{VAR}}` preserved |
423
- | No broken paths | ✅ All relative paths resolve |
444
+ | Snippet completeness | Report actual applicable checks |
445
+ | Thin wrapper references | Report actual applicable checks |
446
+ | `paths:` frontmatter preserved | Report actual checks; v3 snippets unchanged |
447
+ | No lost placeholders | Report actual `{{VAR}}` preservation checks |
448
+ | No broken paths | Report actual applicable checks |
424
449
 
425
450
  ### Cleanup
426
451
 
427
- - Removed duplicate skill directories from `.claude/skills/`, `.cursor/skills/`, `.github/skills/`
428
- - Kept `.agents/skills/` as source of truth
452
+ - Removed only verified identical duplicates after comparison, backup, and approval (if performed)
453
+ - Preserved custom, unmatched, and nested skill content and canonical `.agents/skills/` copies
429
454
 
430
455
  ### Next Steps
431
456
 
@@ -439,7 +464,7 @@ If `--verbose`: log each check result.
439
464
 
440
465
  ```bash
441
466
  git add -A
442
- git commit -m "chore: upgrade AI instructions to toolkit v3.0.0 (snippet architecture)"
467
+ git commit -m "chore: upgrade AI instructions to toolkit v4.0.0"
443
468
  ```
444
469
 
445
470
  ## Error Handling
@@ -447,7 +472,7 @@ git commit -m "chore: upgrade AI instructions to toolkit v3.0.0 (snippet archite
447
472
  - If a `.claude/rules/*.md` file is already a thin wrapper (< 20 lines with a snippet reference), skip it
448
473
  - If `.github/instructions/*.instructions.md` already references `.claude/rules-snippets/`, skip it
449
474
  - If a snippet file already exists with content, do not overwrite — log a warning
450
- - If `.opencode/` already exists, merge new files without overwriting existing ones
475
+ - If `.opencode/` already exists, add missing files and propose native V2 conversion of existing host files; preserve customizations and skip files already migrated
451
476
 
452
477
  ## Notes
453
478