geneseed 5.6.0 → 6.0.1

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 (114) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +2 -2
  3. package/SHIPPED.md +2 -2
  4. package/adapters/opencode/README.md +7 -4
  5. package/docs/concepts/agents.md +10 -0
  6. package/docs/concepts/exclusions.md +1 -1
  7. package/docs/concepts/foreman-mode.md +4 -2
  8. package/docs/concepts/kits.md +20 -2
  9. package/docs/concepts/loops.md +5 -0
  10. package/docs/concepts/skills.md +1 -1
  11. package/docs/concepts/superpowers-kit.md +79 -0
  12. package/docs/extending.md +11 -4
  13. package/docs/guides/install-scripted.md +1 -1
  14. package/docs/reference/cli.md +2 -0
  15. package/docs/reference/profiles.md +10 -5
  16. package/harness.config.json +1 -1
  17. package/js/README.md +3 -0
  18. package/js/build/args.mjs +4 -2
  19. package/js/build/driver.mjs +8 -8
  20. package/js/build/emit-claude.mjs +5 -3
  21. package/js/build/emit-opencode.mjs +2 -2
  22. package/js/build/generate.mjs +1 -1
  23. package/js/build/profile.mjs +15 -7
  24. package/js/build/render.mjs +81 -10
  25. package/js/build/source.mjs +75 -1
  26. package/js/cli-table.json +17 -2
  27. package/js/hosts/installs.mjs +50 -4
  28. package/js/hosts/native.mjs +125 -9
  29. package/js/hosts/opencode.mjs +13 -15
  30. package/js/inspect/checks-authoring.mjs +24 -1
  31. package/js/inspect/checks-build.mjs +43 -2
  32. package/js/inspect/checks-counts.mjs +72 -1
  33. package/js/inspect/diff.mjs +17 -3
  34. package/js/inspect/doctor.mjs +23 -2
  35. package/js/inspect/status.mjs +5 -1
  36. package/js/inspect/validate.mjs +1 -1
  37. package/js/loop/catalog.mjs +10 -0
  38. package/js/maintain/kit-migration.mjs +109 -0
  39. package/js/maintain/plugin-detect.mjs +150 -0
  40. package/js/maintain/profiles.mjs +46 -5
  41. package/js/maintain/setup.mjs +45 -11
  42. package/js/maintain/update.mjs +1 -1
  43. package/js/web/actions.mjs +28 -7
  44. package/js/web/agent-models-api.mjs +172 -0
  45. package/js/web/api.mjs +3 -1
  46. package/js/web/profiles-api.mjs +11 -7
  47. package/js/web/routes.mjs +5 -1
  48. package/package.json +1 -1
  49. package/profiles/autonomous.json +1 -0
  50. package/profiles/corporate.json +1 -1
  51. package/profiles/mentor.json +1 -0
  52. package/profiles/minimal.json +2 -1
  53. package/profiles/starter.json +1 -1
  54. package/src/AGENT.md.tmpl +1 -6
  55. package/src/agents/_template.md +4 -0
  56. package/src/agents/advocate.md +1 -0
  57. package/src/agents/architect.md +1 -0
  58. package/src/agents/developer.md +12 -4
  59. package/src/agents/empiricist.md +1 -0
  60. package/src/agents/explorer.md +1 -0
  61. package/src/agents/framer.md +1 -0
  62. package/src/agents/historian.md +1 -0
  63. package/src/agents/operator.md +1 -0
  64. package/src/agents/performance.md +2 -1
  65. package/src/agents/pragmatist.md +1 -0
  66. package/src/agents/react-reviewer.md +1 -0
  67. package/src/agents/researcher.md +1 -0
  68. package/src/agents/reviewer.md +1 -0
  69. package/src/agents/security.md +1 -0
  70. package/src/agents/skeptic.md +1 -0
  71. package/src/agents/spring-reviewer.md +1 -0
  72. package/src/agents/spring-security.md +1 -0
  73. package/src/agents/steward.md +1 -0
  74. package/src/agents/user-advocate.md +1 -0
  75. package/src/agents/visionary.md +1 -0
  76. package/src/bricks/ci-fix.md +12 -2
  77. package/src/kits/superpowers/missing.md +3 -0
  78. package/src/kits/superpowers/provider.md +7 -0
  79. package/src/kits/superpowers/rules.md +6 -0
  80. package/src/kits/superpowers.json +45 -0
  81. package/src/modes/foreman.md +18 -12
  82. package/src/skills/parallel-agents.md +2 -2
  83. package/src/skills/spring-boot/cloud.md +8 -2
  84. package/src/skills/spring-boot.md +3 -1
  85. package/src/skills/spring-testing.md +3 -3
  86. package/src/upstreams.json +1 -1
  87. package/web/dist/assets/{ActiveLoops-DOJCPPPc.js → ActiveLoops-6p44eD86.js} +1 -1
  88. package/web/dist/assets/{Activity-bUSPM3Dl.js → Activity-CIgrq5R1.js} +1 -1
  89. package/web/dist/assets/{ActivityDetail-AHRoXeFN.js → ActivityDetail-Brqv1u4f.js} +1 -1
  90. package/web/dist/assets/{Bonsai-B5XY9pid.js → Bonsai-8NtlFrPO.js} +1 -1
  91. package/web/dist/assets/{CopyButton-C0wwRR9H.js → CopyButton-BHqKgdjJ.js} +1 -1
  92. package/web/dist/assets/{Dashboard-DPAA96EI.js → Dashboard-CoveJ_-U.js} +2 -2
  93. package/web/dist/assets/{Docs-CpGDq165.js → Docs-C1jzrFnD.js} +1 -1
  94. package/web/dist/assets/{Factories-cNhETa5Q.js → Factories-D5pLnt5S.js} +1 -1
  95. package/web/dist/assets/{GreenhouseView-DO3ADmT9.js → GreenhouseView-ofAQ-V5h.js} +1 -1
  96. package/web/dist/assets/Installs-DpWgyT5j.js +3 -0
  97. package/web/dist/assets/{JournalView--W-Lw_V9.js → JournalView-CsuN3_B-.js} +1 -1
  98. package/web/dist/assets/{Kits-ChfehxY6.js → Kits-P4xspDuN.js} +1 -1
  99. package/web/dist/assets/{Laws-CNxYmV36.js → Laws-DK3OwGDl.js} +1 -1
  100. package/web/dist/assets/{LibRows-CiPvsRYB.js → LibRows-CGO25X3D.js} +1 -1
  101. package/web/dist/assets/Library-e-94YED6.js +3 -0
  102. package/web/dist/assets/{Loops-DAblKkyq.js → Loops-C9DSBj-A.js} +1 -1
  103. package/web/dist/assets/{OperatorHudView-QtSaSyYm.js → OperatorHudView-Cc8mlViW.js} +1 -1
  104. package/web/dist/assets/{Personal-DxSGv638.js → Personal-DVh2jYPO.js} +1 -1
  105. package/web/dist/assets/{Settings-CgTbhvRv.js → Settings-CknBI-Fx.js} +1 -1
  106. package/web/dist/assets/{Tabs-Cf4X1hdz.js → Tabs-C30JrkJH.js} +1 -1
  107. package/web/dist/assets/api-DxwG8y94.js +1 -0
  108. package/web/dist/assets/index-CUJ8AaAF.css +1 -0
  109. package/web/dist/assets/{index-B_pTwZra.js → index-MB7E-va_.js} +3 -3
  110. package/web/dist/index.html +3 -3
  111. package/web/dist/assets/Installs-D3dDyq10.js +0 -3
  112. package/web/dist/assets/Library-BxQvbwVU.js +0 -3
  113. package/web/dist/assets/api-CZ-x0iWG.js +0 -1
  114. package/web/dist/assets/index-CzfImiYb.css +0 -1
@@ -0,0 +1,109 @@
1
+ /**
2
+ * The one-time move of an install built before the `superpowers` kit existed.
3
+ *
4
+ * Before the kit, the five vendored superpowers Rites shipped in every install. An install's
5
+ * `Active kits:` line has never named the kit, so its next rebuild would drop all five. This reads
6
+ * the release the install was BUILT by (the `[release X.Y.Z]` in `.geneseed-version`, which every
7
+ * emit writes) and, for one built before `SUPERPOWERS_KIT_SINCE`, turns the kit on, unless the
8
+ * official plugin is seen (then the plugin already provides them, and two providers duplicate
9
+ * each other). One notice line per install says which, and why.
10
+ *
11
+ * `aware` (`kitAwareOfDir`): true: the carrier already shows a build that knows the kit, so the release
12
+ * number is not asked. That covers builds made after the kit but before the release that names it.
13
+ *
14
+ * A marker that is missing or reads as no release (a bundle, a hand-copied tree) is treated as
15
+ * built before: every such install did carry the five Rites. An install built at or after the
16
+ * release keeps what its `Active kits:` line says, so a kit turned off on purpose stays off.
17
+ *
18
+ * Runs inside `installProfile` (`js/build/profile.mjs`), the one read-back `rebuild-all`, `update`
19
+ * and `migrate` share, so `status` shows what a rebuild would do.
20
+ */
21
+ import path from 'node:path';
22
+ import { readText } from '../lib/fs.mjs';
23
+ import { versionIsNewer } from '../build/version.mjs';
24
+ import { HOSTS, VERSION_MARKER, isGlobalInstall } from '../hosts/hosts.mjs';
25
+ import { kitAwareOfDir, kitsOfDir } from '../hosts/installs.mjs';
26
+ import { loadKits } from '../build/source.mjs';
27
+ import { describeDetection, detectSuperpowers } from './plugin-detect.mjs';
28
+
29
+ /** The first release where the five Rites are a kit. A build older than this carried them as core. */
30
+ export const SUPERPOWERS_KIT_SINCE = '6.0.0';
31
+
32
+ /**
33
+ * The release an install was built by, or null (no marker, or one with no `[release …]`). The marker
34
+ * sits in `root` for a global install and an OpenCode project bundle, and in the host's layer folder
35
+ * (`<root>/.claude` and kin) for the Claude dialects' project installs.
36
+ */
37
+ export function builtByRelease(root, host = null, scope = 'global') {
38
+ const marker = scope === 'global' ? null : HOSTS.find((h) => h.host === host)?.projectMarker;
39
+ // OpenCode's project bundle keeps the marker at the root; the Claude dialects keep it in their layer folder.
40
+ for (const dir of marker ? [root, path.join(root, marker)] : [root]) {
41
+ try {
42
+ const m = /\[release ([^\]]+)\]/.exec(readText(path.join(dir, VERSION_MARKER)));
43
+ if (m) return m[1];
44
+ } catch { /* not here */ }
45
+ }
46
+ return null;
47
+ }
48
+
49
+ /**
50
+ * `kits`, plus `superpowers` when this install predates the kit and the plugin is not seen.
51
+ * @param {{ host: string, scope: string, root: string, kits: string[], notify?: ((line: string) => void) | null,
52
+ * aware?: boolean | null, knownKits?: string[], detectRoots?: Parameters<typeof detectSuperpowers>[1] }} a
53
+ */
54
+ export function migrateSuperpowersKit({ host, scope, root, kits, notify = null, knownKits = [], detectRoots = {}, aware = false }) {
55
+ if (kits.includes('superpowers') || !knownKits.includes('superpowers') || aware !== false) return kits;
56
+ const built = builtByRelease(root, host, scope);
57
+ // `versionIsNewer(a, b)` is a > b; null (unparseable) reads as old, never as current.
58
+ const old = built === null || versionIsNewer(SUPERPOWERS_KIT_SINCE, built) === true;
59
+ if (!old) return kits;
60
+ const d = detectSuperpowers(host, { projectDir: scope === 'project' ? root : null, ...detectRoots });
61
+ const was = built === null ? 'an install with no release marker' : `built by ${built}`;
62
+ if (d.seen) {
63
+ notify?.(`superpowers kit: off — ${was}, before the kit existed; the official plugin is ${describeDetection(d)}`);
64
+ return kits;
65
+ }
66
+ notify?.(`superpowers kit: on — ${was}, before the kit existed, so it keeps its five Rites; the official plugin is ${describeDetection(d)}`);
67
+ return [...kits, 'superpowers'].sort();
68
+ }
69
+
70
+ /**
71
+ * The WARN `doctor` and `status` give one install about its workflow provider, or null when it
72
+ * has exactly one. Two states are wrong, and a plugin is only ever read from a file, so each
73
+ * line names what was read (see `plugin-detect.mjs`):
74
+ * - the kit is on and the plugin is seen: two providers, duplicate Rites, about 800 tokens
75
+ * injected per session (start, clear and compact);
76
+ * - the kit is off and the plugin is not seen: no provider at all.
77
+ * @param {{ host: string, scope: string, root: string, kits: string[], detectRoots?: Parameters<typeof detectSuperpowers>[1] }} a
78
+ */
79
+ export function providerWarning({ host, scope, root, kits, detectRoots = {} }) {
80
+ const d = detectSuperpowers(host, { projectDir: scope === 'project' ? root : null, ...detectRoots });
81
+ const on = kits.includes('superpowers');
82
+ if (on && d.seen) {
83
+ return 'WARN: the superpowers kit is on and the official plugin is also loaded (' + describeDetection(d)
84
+ + '): the Rites are duplicated and the plugin injects about 800 tokens a session — turn off one of the two';
85
+ }
86
+ if (!on && !d.seen) {
87
+ return d.supported
88
+ ? `WARN: no workflow provider — the superpowers kit is off and the official plugin is ${describeDetection(d)}`
89
+ : `WARN: no workflow provider — the superpowers kit is off and ${host} has no superpowers plugin`;
90
+ }
91
+ return null;
92
+ }
93
+
94
+ /**
95
+ * `kitsOfDir` plus the migration of an install built before the kit: the set a rebuild of `dir`
96
+ * would build with. `installProfile` is the read-back `rebuild-all`, `update`, `migrate` and
97
+ * `status` share; the readers that render or rebuild one install without it (`diff`, the console's
98
+ * restore and build forms) call this instead, so a pre-kit install reads the same set everywhere,
99
+ * or its five Rites would read as drift in one place and be rebuilt away in another.
100
+ * The scope is read off the folder: a host's global config dir is global, anything else a project.
101
+ */
102
+ export function migratedKitsOfDir(dir, host = null, notify = null) {
103
+ let scope = 'project';
104
+ try { if (isGlobalInstall(host, dir)) scope = 'global'; } catch { /* cannot tell: a project */ }
105
+ return migrateSuperpowersKit({
106
+ host: host ?? '', scope, root: dir, kits: kitsOfDir(dir, host, notify), notify,
107
+ knownKits: [...loadKits().keys()], aware: kitAwareOfDir(dir, host),
108
+ });
109
+ }
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Is the official superpowers plugin installed on this machine? Read-only and best-effort.
3
+ *
4
+ * FILES ONLY, NEVER A PROCESS. `geneseed` may not start a process (a transitive `child_process` ban), and
5
+ * the plugin managers each hold their state in a file, so the answer is a file read. The answer
6
+ * is therefore one of two sentences, "seen in <file>" or "not seen in <files read>", and never
7
+ * "not enabled": a settings file can say `false` while the desktop app loads the plugin (the
8
+ * app keeps its own state under `rpm/`, undocumented, which is why that file is read last and
9
+ * labelled as app state).
10
+ *
11
+ * NOT ON THE HOOK PATH. `bin/geneseed-hook.mjs` never imports this: a detection costs file
12
+ * reads, and the hook's stdout is a signal channel (AGENTS.md, "What bites").
13
+ *
14
+ * EVERY ROOT IS A PARAMETER. A test passes fixture roots and never the machine's own; only the
15
+ * default arguments (`defaultRoots`) read `$HOME`, the environment and the platform.
16
+ */
17
+ import { existsSync, readdirSync } from 'node:fs';
18
+ import os from 'node:os';
19
+ import path from 'node:path';
20
+ import { readText } from '../lib/fs.mjs';
21
+ import { readJsonc } from '../lib/json.mjs';
22
+
23
+ /** The plugin's repository, as the desktop app's manifest records it (`upstreamRepoUrl`). */
24
+ export const SUPERPOWERS_REPO_URL = 'https://github.com/obra/superpowers';
25
+
26
+ /** Hosts whose plugin store this module can read; any other host has no plugin to look for. */
27
+ export const DETECTABLE_HOSTS = ['claude', 'opencode'];
28
+
29
+ /**
30
+ * The roots a real machine reads from. Called only when the caller names none.
31
+ * @param {{ env?: NodeJS.ProcessEnv, home?: string, platform?: string }} [from]
32
+ */
33
+ export function defaultRoots({ env = process.env, home = os.homedir(), platform = process.platform } = {}) {
34
+ const appData = platform === 'win32' ? env.APPDATA ?? path.join(home, 'AppData', 'Roaming')
35
+ : platform === 'darwin' ? path.join(home, 'Library', 'Application Support')
36
+ : env.XDG_CONFIG_HOME ?? path.join(home, '.config');
37
+ return {
38
+ claudeDir: env.CLAUDE_CONFIG_DIR || path.join(home, '.claude'),
39
+ opencodeDir: env.OPENCODE_CONFIG_DIR || path.join(env.XDG_CONFIG_HOME || path.join(home, '.config'), 'opencode'),
40
+ appDataDir: appData,
41
+ };
42
+ }
43
+
44
+ /** A settings file as an object: null when it is absent or unparseable (a miss, never an error). */
45
+ function readObject(file) {
46
+ try {
47
+ const [data] = readJsonc(readText(file));
48
+ return data !== null && typeof data === 'object' && !Array.isArray(data) ? data : null;
49
+ } catch { return null; }
50
+ }
51
+
52
+ const isSuperpowersKey = (k) => /^superpowers(@|$)/.test(String(k));
53
+
54
+ /** Claude Code: `enabledPlugins` holds a `superpowers@<marketplace>` key set to true. */
55
+ function claudeSettingsSee(data) {
56
+ const plugins = data?.enabledPlugins;
57
+ return plugins !== null && typeof plugins === 'object'
58
+ && Object.entries(plugins).some(([k, v]) => isSuperpowersKey(k) && v === true);
59
+ }
60
+
61
+ /** The desktop manifest: a `plugins` entry (or the file itself) whose `upstreamRepoUrl` is the plugin's repository. */
62
+ function manifestSees(d) {
63
+ const same = (u) => typeof u === 'string' && u.replace(/(\.git)?\/*$/, '').toLowerCase() === SUPERPOWERS_REPO_URL;
64
+ return same(d?.upstreamRepoUrl) || (Array.isArray(d?.plugins) && d.plugins.some((e) => same(e?.upstreamRepoUrl)));
65
+ }
66
+
67
+ /** OpenCode: `plugin` (V1) or `plugins` (V2) lists, or holds, a `superpowers@…` entry. */
68
+ function opencodeConfigSees(data) {
69
+ for (const key of ['plugin', 'plugins']) {
70
+ const v = data?.[key];
71
+ const names = Array.isArray(v) ? v.map((e) => (Array.isArray(e) ? e[0] : e)) : v && typeof v === 'object' ? Object.keys(v) : [];
72
+ if (names.some((n) => typeof n === 'string' && isSuperpowersKey(n))) return true;
73
+ }
74
+ return false;
75
+ }
76
+
77
+ /** The desktop app's plugin manifests: two folders below `<appData>/Claude/rpm`, each a `manifest.json`. */
78
+ function desktopManifests(appDataDir) {
79
+ const root = path.join(appDataDir, 'Claude', 'rpm');
80
+ const out = [];
81
+ try {
82
+ for (const a of readdirSync(root, { withFileTypes: true })) {
83
+ if (!a.isDirectory()) continue;
84
+ for (const b of readdirSync(path.join(root, a.name), { withFileTypes: true })) {
85
+ const f = path.join(root, a.name, b.name, 'manifest.json');
86
+ if (b.isDirectory() && existsSync(f)) out.push(f);
87
+ }
88
+ }
89
+ } catch { /* no rpm folder: no desktop app state to read */ }
90
+ return out.sort();
91
+ }
92
+
93
+ /**
94
+ * Look for the superpowers plugin for `host`. `{ seen, where, read, state }`: `where` the first
95
+ * file that showed it (null when none did), `read` every file looked at, `state` true when the
96
+ * evidence is the desktop app's own state rather than a settings file. A host with no plugin
97
+ * store to read (Bob, OpenClaude, the bundle) answers `{ seen: false, read: [], supported: false }`.
98
+ * @param {string} host
99
+ * @param {{ claudeDir?: string, opencodeDir?: string, appDataDir?: string, projectDir?: string | null }} [roots]
100
+ */
101
+ export function detectSuperpowers(host, roots = {}) {
102
+ if (!DETECTABLE_HOSTS.includes(host)) return { seen: false, where: null, read: [], state: false, supported: false };
103
+ const r = { ...defaultRoots(), ...roots };
104
+ const read = [];
105
+ const look = (files, sees) => {
106
+ for (const f of files) {
107
+ if (!existsSync(f)) continue;
108
+ read.push(f);
109
+ if (sees(readObject(f))) return f;
110
+ }
111
+ return null;
112
+ };
113
+ let where = null;
114
+ let state = false;
115
+ if (host === 'claude') {
116
+ where = look([
117
+ path.join(r.claudeDir, 'settings.json'), path.join(r.claudeDir, 'settings.local.json'),
118
+ ...(r.projectDir ? [path.join(r.projectDir, '.claude', 'settings.json'), path.join(r.projectDir, '.claude', 'settings.local.json')] : []),
119
+ ], claudeSettingsSee);
120
+ if (!where) {
121
+ where = look(desktopManifests(r.appDataDir), manifestSees);
122
+ state = where !== null;
123
+ }
124
+ } else {
125
+ where = look([
126
+ path.join(r.opencodeDir, 'opencode.json'), path.join(r.opencodeDir, 'opencode.jsonc'),
127
+ ...(r.projectDir ? [path.join(r.projectDir, 'opencode.json'), path.join(r.projectDir, 'opencode.jsonc')] : []),
128
+ ], opencodeConfigSees);
129
+ }
130
+ return { seen: where !== null, where, read, state, supported: true };
131
+ }
132
+
133
+ /** The one-line account of a detection, naming the file: never "not enabled". */
134
+ export function describeDetection(d) {
135
+ if (!d.supported) return 'no plugin store to read on this host';
136
+ if (d.seen) return `seen in ${d.where}${d.state ? ' (desktop app state, best-effort)' : ''}`;
137
+ return `not seen in ${d.read.length ? d.read.join(', ') : 'any settings file (none found)'}`;
138
+ }
139
+
140
+ /**
141
+ * A kit named in a profile's `kitsByDetection`, resolved: on when the plugin is NOT seen (the kit
142
+ * stands in for it), off when it is. A host with no plugin store (Bob, OpenClaude) has nothing to
143
+ * stand in for it, so the kit is on there. The wizard's default and the profile apply share this.
144
+ * @param {string} host
145
+ * @param {Parameters<typeof detectSuperpowers>[1]} [roots]
146
+ */
147
+ export function superpowersKitDefault(host, roots = {}) {
148
+ const d = detectSuperpowers(host, roots);
149
+ return { on: !d.seen, detection: d, line: describeDetection(d) };
150
+ }
@@ -27,7 +27,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from
27
27
  import path from 'node:path';
28
28
 
29
29
  import {
30
- CONTEXT_WINDOWS, DEFAULT_CONTEXT_WINDOW, discoverNames, GATE_SWITCHES, knownRuleIds, knownSkillIds, linkedSkillIds, loadKits, PACK_ORDER, ROOT,
30
+ CONTEXT_WINDOWS, DEFAULT_CONTEXT_WINDOW, DEFAULT_TIERS, TIERS_CHOICES, discoverNames, GATE_SWITCHES, knownRuleIds, knownSkillIds, linkedSkillIds, loadKits, PACK_ORDER, ROOT,
31
31
  } from '../build/source.mjs';
32
32
  import { installProfile, setupBuildArgs } from '../build/profile.mjs';
33
33
  import { PRESETS } from '../loop/score.mjs';
@@ -37,6 +37,7 @@ import { isDir, printErr, printOut } from '../lib/fs.mjs';
37
37
  import { machineDir } from '../lib/machine-dir.mjs';
38
38
  import { NOTE } from '../inspect/scan.mjs';
39
39
  import { expanduser, resolvePath } from '../hosts/hosts.mjs';
40
+ import { superpowersKitDefault } from './plugin-detect.mjs';
40
41
 
41
42
  /** Where the shipped profiles live: `profiles/` at the checkout (or package) root. */
42
43
  export const PROFILES_DIR = path.join(ROOT, 'profiles');
@@ -66,9 +67,12 @@ export const BASE_PROFILE = 'starter';
66
67
  * spec D37 (which supersedes D18 on that point): a profile has no scope, so a project-only field is
67
68
  * accepted, used by a project apply, and ignored by a global one, whose install owns the tier.
68
69
  * `contextWindow` (`--context-window`) is optional: absent is the default, `200k`.
70
+ * `tiers` (`--tiers`) is optional and means "the profile sets it" only when present: absent keeps the
71
+ * install's own recorded value (`profileBuildArgs`' `current`), `off` on a fresh install. No shipped
72
+ * profile turns it on.
69
73
  */
70
74
  export const PROFILE_KEYS = ['description', 'hosts', 'theme', 'footprint', 'posture', 'mode', 'trust',
71
- 'doctrines', 'excludeRules', 'excludeSkills', 'kits', 'sharedTier', 'contextWindow', 'gates', 'login'];
75
+ 'doctrines', 'excludeRules', 'excludeSkills', 'kits', 'kitsByDetection', 'sharedTier', 'contextWindow', 'tiers', 'gates', 'login'];
72
76
 
73
77
  /** A profile name: a file stem, never a path. */
74
78
  const NAME_RE = /^[a-z0-9][a-z0-9._-]*$/i;
@@ -139,6 +143,7 @@ export function profileProblems(p) {
139
143
  choice('mode', discoverNames('modes', 'direct'));
140
144
  choice('trust', Object.keys(PRESETS));
141
145
  choice('contextWindow', Object.keys(CONTEXT_WINDOWS));
146
+ choice('tiers', [...TIERS_CHOICES]);
142
147
  const packs = discoverNames('doctrines', PACK_ORDER[0]);
143
148
  if (p.doctrines !== undefined && p.doctrines !== 'all') {
144
149
  if (!stringList(p.doctrines)) errs.push(`'doctrines' must be 'all' or a list of: ${list(packs)}`);
@@ -163,6 +168,18 @@ export function profileProblems(p) {
163
168
  if (!stringList(p.kits)) errs.push(`'kits' must be a list of: ${list(kits)}`);
164
169
  else for (const k of p.kits.filter((x) => !kits.includes(x))) errs.push(`'kits': unknown kit '${k}' (valid: ${list(kits)})`);
165
170
  }
171
+ // A kit chosen at apply time by what the machine holds (`kitsByDetection`): only a kit that a
172
+ // plugin can stand in for (`replacedBy`) has anything to detect, and it is on, or by detection, never both.
173
+ if (p.kitsByDetection !== undefined) {
174
+ const all = loadKits();
175
+ const detectable = [...all].filter(([, m]) => m.replacedBy).map(([k]) => k);
176
+ if (!stringList(p.kitsByDetection)) errs.push(`'kitsByDetection' must be a list of: ${list(detectable)}`);
177
+ else {
178
+ for (const k of p.kitsByDetection.filter((x) => !all.has(x))) errs.push(`'kitsByDetection': unknown kit '${k}' (valid: ${list(detectable)})`);
179
+ for (const k of p.kitsByDetection.filter((x) => all.has(x) && !detectable.includes(x))) errs.push(`'kitsByDetection': kit '${k}' has no plugin to detect (valid: ${list(detectable)})`);
180
+ for (const k of p.kitsByDetection.filter((x) => Array.isArray(p.kits) && p.kits.includes(x))) errs.push(`'kitsByDetection': kit '${k}' is also in 'kits' — name it in one`);
181
+ }
182
+ }
166
183
  if (p.gates !== undefined) {
167
184
  const keys = GATE_SWITCHES.map((g) => g.key);
168
185
  if (!p.gates || typeof p.gates !== 'object' || Array.isArray(p.gates)) errs.push(`'gates' must be an object keyed by: ${list(keys)}`);
@@ -217,6 +234,20 @@ export function profileDoctrines(p) {
217
234
  return PACK_ORDER.filter((d) => want.includes(d));
218
235
  }
219
236
 
237
+ /**
238
+ * The kits profile `p` switches on for `host`: its `kits`, plus each `kitsByDetection` kit the
239
+ * plugin standing in for it is NOT seen for (`superpowersKitDefault`, the wizard's rule). A host
240
+ * with no plugin store to read gets the kit on. `detectRoots` names the roots to read; a test
241
+ * passes fixture roots, and the default is the machine's own.
242
+ */
243
+ export function profileKits(p, host, project = null, detectRoots = {}) {
244
+ const kits = new Set(p.kits ?? []);
245
+ for (const k of p.kitsByDetection ?? []) {
246
+ if (superpowersKitDefault(host, { ...detectRoots, projectDir: project ?? detectRoots.projectDir ?? null }).on) kits.add(k);
247
+ }
248
+ return [...kits].sort();
249
+ }
250
+
220
251
  /**
221
252
  * The generator argv that installs profile `p` into `host`: globally, or into the folder
222
253
  * `project` when one is given.
@@ -227,15 +258,18 @@ export function profileDoctrines(p) {
227
258
  * here; posture and mode elide only at the value the driver would take anyway. `--reset` last,
228
259
  * as the wizard does: a profile is a whole selection and wins over the install it lands on (D14).
229
260
  */
230
- export function profileBuildArgs(p, host, project = null) {
261
+ export function profileBuildArgs(p, host, project = null, current = null, detectRoots = {}) {
231
262
  // A stated selection, never null: `'all'` resolves to the packs, a list is the list.
232
263
  const doctrines = PACK_ORDER.filter((d) => profileDoctrines(p).includes(d));
233
264
  // PROJECT SCOPE (spec D32, D37): `--emit <host> --out <dir> --root <dir>`, and only here the
234
265
  // profile's `sharedTier`; a global install owns the tier, so a global apply ignores the field.
235
266
  const argv = setupBuildArgs(p.theme, project ? host : `${host}-global`, project, project, p.footprint,
236
267
  p.posture, p.mode, doctrines, PACK_ORDER, p.excludeRules ?? [], p.trust, p.excludeSkills ?? [],
237
- p.gates ?? {}, p.kits ?? [], project ? p.sharedTier === true : false,
238
- p.contextWindow ?? DEFAULT_CONTEXT_WINDOW);
268
+ p.gates ?? {}, profileKits(p, host, project, detectRoots), project ? p.sharedTier === true : false,
269
+ p.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
270
+ // The profile's own value, else the install's recorded one (`current`), else off: a profile
271
+ // without the key never turns a routed install back off by being applied over it.
272
+ p.tiers ?? current ?? DEFAULT_TIERS);
239
273
  if (!p.excludeSkills?.length) argv.push('--exclude-skills', 'none');
240
274
  argv.push('--reset');
241
275
  return argv;
@@ -267,6 +301,8 @@ export function profileFromInstall(info, description = '') {
267
301
  kits: [...(info.kits ?? [])].sort(),
268
302
  sharedTier: info.sharedTier === true,
269
303
  contextWindow: info.contextWindow ?? DEFAULT_CONTEXT_WINDOW,
304
+ // Written only when on, so a saved profile of a default install is what it always was.
305
+ ...(info.tiers && info.tiers !== DEFAULT_TIERS ? { tiers: info.tiers } : {}),
270
306
  gates,
271
307
  login: true,
272
308
  };
@@ -302,6 +338,11 @@ export function profileDiff(p, base) {
302
338
  if (t(p) !== t(base)) out.push({ key, base: t(base), now: t(p) });
303
339
  continue;
304
340
  }
341
+ if (key === 'tiers') {
342
+ const w = (prof) => prof.tiers ?? DEFAULT_TIERS;
343
+ if (w(p) !== w(base)) out.push({ key, base: w(base), now: w(p) });
344
+ continue;
345
+ }
305
346
  if (key === 'contextWindow') {
306
347
  const w = (prof) => prof.contextWindow ?? DEFAULT_CONTEXT_WINDOW;
307
348
  if (w(p) !== w(base)) out.push({ key, base: w(base), now: w(p) });
@@ -50,9 +50,10 @@ import { preserveRefusal } from '../build/profile.mjs';
50
50
  import { cmdLink } from '../hosts/link.mjs';
51
51
  import { autostartInstall, autostartState, transientRoot } from '../hosts/shim.mjs';
52
52
  import { loadProfile, profileBuildArgs, profileHosts } from './profiles.mjs';
53
+ import { superpowersKitDefault } from './plugin-detect.mjs';
53
54
  import { checkProjectFolder, globalLayering, layeringText } from './profile-scope.mjs';
54
55
  import { playLine } from '../ui/anim.mjs';
55
- import { DEFAULT_CONTEXT_WINDOW, discoverNames, GATE_SWITCHES, PACK_ORDER, ROOT, loadKits } from '../build/source.mjs';
56
+ import { DEFAULT_CONTEXT_WINDOW, DEFAULT_TIERS, discoverNames, GATE_SWITCHES, PACK_ORDER, ROOT, loadKits } from '../build/source.mjs';
56
57
  import { exportImprovements } from '../inspect/diff.mjs';
57
58
  import { cmdDoctor } from '../inspect/doctor.mjs';
58
59
  import { setupBuildArgs } from '../build/generate.mjs';
@@ -60,7 +61,7 @@ import { SHARED_TIER_BENEFIT, sharedTierCost, sharedTierFigure } from '../inspec
60
61
  import { GLOBAL_MANIFEST, HOSTS, opencodeConfigDir } from '../hosts/hosts.mjs';
61
62
  import {
62
63
  claudeCfg, defaultMode, defaultPosture, defaultTheme, EMIT_HOST_SCOPE, gatesOfDir, installedDefaults, installState,
63
- contextWindowOfDir, readJsonMaybe, sharedTierOfDir, themeFiles,
64
+ contextWindowOfDir, readJsonMaybe, sharedTierOfDir, themeFiles, tiersOfDir,
64
65
  } from '../hosts/installs.mjs';
65
66
  import { printOut, printErr } from '../lib/fs.mjs';
66
67
  import { inNpxCache, which } from '../lib/paths.mjs';
@@ -233,14 +234,25 @@ function askDoctrines(deployed = null) {
233
234
  * stdin it always did (and has no kit to carry: `kitsOfDir` drops an unshipped one).
234
235
  * Returns the kit list, or null for none (`setupBuildArgs` omits `--kits`).
235
236
  */
236
- export function askKits(deployed = null, kits = null) {
237
+ export function askKits(deployed = null, kits = null, host = null, detectRoots = {}) {
237
238
  try { kits ??= loadKits(); } catch (e) {
238
239
  process.stderr.write(`warning: kit question skipped — ${e.message}\n`);
239
240
  return null;
240
241
  }
241
242
  const on = (deployed ?? []).filter((k) => kits.has(k));
242
- const picked = [...kits].filter(([k, m]) => askChoice(`Kit ${k} — ${m.description ?? k}`,
243
- [['yes', `install the ${k} kit`], ['no', `leave ${k} out`]], on.includes(k) ? 'yes' : 'no') === 'yes');
243
+ // A kit a plugin can stand in for defaults by what this machine holds, not by what was deployed:
244
+ // plugin seen, `no`; not seen (or a host with no plugin, Bob), `yes`. The question names what it saw.
245
+ const picked = [...kits].filter(([k, m]) => {
246
+ let seen = '';
247
+ let def = on.includes(k) ? 'yes' : 'no';
248
+ if (m.replacedBy) {
249
+ const d = superpowersKitDefault(host ?? '', detectRoots);
250
+ seen = ` [the official ${m.replacedBy.upstream} plugin: ${d.line}]`;
251
+ def = d.on ? 'yes' : 'no';
252
+ }
253
+ return askChoice(`Kit ${k} — ${m.description ?? k}${seen}`,
254
+ [['yes', `install the ${k} kit`], ['no', `leave ${k} out`]], def) === 'yes';
255
+ });
244
256
  return picked.length ? picked.map(([k]) => k) : null;
245
257
  }
246
258
 
@@ -312,6 +324,22 @@ export function targetContextWindow(emit, out, machine = DEFAULT_CONTEXT_WINDOW)
312
324
  }
313
325
  }
314
326
 
327
+ /**
328
+ * The tier routing of the one install a setup answer re-runs, read off it: PRESERVED, NOT ASKED (the
329
+ * web picker owns the question), as `targetContextWindow` does. No install, or unreadable: off.
330
+ */
331
+ export function targetTiers(emit, out) {
332
+ const [host, scope] = EMIT_HOST_SCOPE.get(emit) ?? [];
333
+ try {
334
+ if (!host) return DEFAULT_TIERS;
335
+ const dir = scope === 'global'
336
+ ? HOSTS.find((h) => h.host === host).configDir() : resolveOut(out || '.');
337
+ return installState(dir, host, scope) === 'absent' ? DEFAULT_TIERS : tiersOfDir(dir, host);
338
+ } catch {
339
+ return DEFAULT_TIERS;
340
+ }
341
+ }
342
+
315
343
  export function collectSetupLines(kitMap = null) {
316
344
  printOut('Geneseed setup — answer a few questions; nothing is written until you confirm.\n');
317
345
  const inst = installedDefaults();
@@ -319,9 +347,10 @@ export function collectSetupLines(kitMap = null) {
319
347
  const posture = askChoice('Posture', postureOptions(), inst.posture || defaultPosture());
320
348
  const mode = askChoice('Mode', modeOptions(), inst.mode || defaultMode());
321
349
  const doctrines = askDoctrines(inst.doctrines);
322
- // Kits on stay on (spec A3); `kitsOfDir` already dropped a retired one.
323
- const kits = askKits(inst.kits, kitMap);
324
350
  const emit = askChoice('Install mode', EMIT_OPTIONS, inst.emit || 'opencode-global');
351
+ // Kits on stay on (spec A3); `kitsOfDir` already dropped a retired one. Asked after the install
352
+ // mode: a kit a plugin can replace defaults by what that host's plugin store holds.
353
+ const kits = askKits(inst.kits, kitMap, (EMIT_HOST_SCOPE.get(emit) ?? [])[0] ?? null);
325
354
  const footprint = askChoice('Footprint', FOOTPRINT_OPTIONS,
326
355
  inst.footprint || 'lean');
327
356
  let out = null;
@@ -359,9 +388,10 @@ export function collectSetupLines(kitMap = null) {
359
388
  const gates = targetGates(emit, out);
360
389
  const gated = Object.values(gates).some((on) => on === false);
361
390
  const contextWindow = targetContextWindow(emit, out, inst.contextWindow);
391
+ const tiers = targetTiers(emit, out);
362
392
  printOut(`\nAbout to run: geneseed build ${
363
393
  setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines, allPacks,
364
- excludeRules, undefined, excludeSkills, gates, kits, sharedTier, contextWindow).join(' ')} --reset\n`);
394
+ excludeRules, undefined, excludeSkills, gates, kits, sharedTier, contextWindow, tiers).join(' ')} --reset\n`);
365
395
  if (!confirm('Proceed?', true)) return null;
366
396
  // The key only when there is something to carry, so a selection that excludes no skill and
367
397
  // switches off no gate is the same object it was before either existed.
@@ -369,6 +399,7 @@ export function collectSetupLines(kitMap = null) {
369
399
  theme, posture, mode, doctrines, excludeRules, ...(excludeSkills ? { excludeSkills } : {}),
370
400
  ...(gated ? { gates } : {}), ...(kits ? { kits } : {}), ...(sharedTier ? { sharedTier } : {}),
371
401
  ...(contextWindow !== DEFAULT_CONTEXT_WINDOW ? { contextWindow } : {}),
402
+ ...(tiers !== DEFAULT_TIERS ? { tiers } : {}),
372
403
  emit, out, root, footprint,
373
404
  };
374
405
  }
@@ -564,7 +595,7 @@ export function setupLines() {
564
595
  const {
565
596
  theme, emit, out, root, footprint = 'lean', posture = 'peer', mode = 'direct',
566
597
  doctrines = null, excludeRules = null, excludeSkills = null, gates = {}, kits = null,
567
- sharedTier = false, contextWindow = DEFAULT_CONTEXT_WINDOW,
598
+ sharedTier = false, contextWindow = DEFAULT_CONTEXT_WINDOW, tiers = DEFAULT_TIERS,
568
599
  } = sel;
569
600
  if (emit === 'opencode-global') {
570
601
  // The build below overwrites the deployed global harness, which may carry hand edits (or
@@ -584,7 +615,7 @@ export function setupLines() {
584
615
  // one command and run another.
585
616
  const argv = setupBuildArgs(theme, emit, out, root, footprint, posture, mode, doctrines,
586
617
  doctrineOptions().map(([n]) => n), excludeRules, undefined, excludeSkills, gates, kits, sharedTier,
587
- contextWindow);
618
+ contextWindow, tiers);
588
619
  // `--reset`: the wizard's answers are a WHOLE selection, and `setupBuildArgs` elides an axis at
589
620
  // its default, so answering one back to it (mode direct, posture peer) over an install would
590
621
  // otherwise trip the preserve guard (js/build/profile.mjs). The plan line above says the same.
@@ -819,7 +850,10 @@ function foundHosts(rows) {
819
850
  export function profileBuilds(p, targets, { project = null, build, exportDrift, changes, configDir }) {
820
851
  const results = [];
821
852
  for (const t of targets) {
822
- const argv = profileBuildArgs(p, t.host, project);
853
+ // The install's own tier routing rides along unless the profile names one (`profileBuildArgs`).
854
+ let current = null;
855
+ try { current = tiersOfDir(project ? resolveOut(project) : configDir(t.host), t.host); } catch { /* unreadable: the default */ }
856
+ const argv = profileBuildArgs(p, t.host, project, current);
823
857
  const moved = changes(argv);
824
858
  let saved = null;
825
859
  if (!project) {
@@ -772,7 +772,7 @@ export async function installAxes(dir, { installProfile, setupBuildArgs }, notif
772
772
  if (!existsSync(path.join(String(dir), '.geneseed-emit'))) return [];
773
773
  const p = installProfile('opencode', 'global', String(dir), notify);
774
774
  return setupBuildArgs('', 'files', null, null, p.footprint, p.posture, p.mode, p.doctrines,
775
- undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits, p.sharedTier, p.contextWindow).slice(4);
775
+ undefined, p.excludeRules, p.trust, p.excludeSkills, p, p.kits, p.sharedTier, p.contextWindow, p.tiers).slice(4);
776
776
  }
777
777
 
778
778
  /**
@@ -27,14 +27,14 @@
27
27
  */
28
28
  import { spawn } from 'node:child_process';
29
29
  import {
30
- copyFileSync, existsSync, mkdirSync, mkdtempSync, realpathSync, renameSync, rmSync,
30
+ copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync,
31
31
  } from 'node:fs';
32
32
  import os from 'node:os';
33
33
  import path from 'node:path';
34
34
 
35
35
  import { emitGlobalInto } from '../build/driver.mjs';
36
36
  import {
37
- CONTEXT_WINDOWS, ROOT, discoverNames, knownRuleIds, loadKits, PACK_ORDER,
37
+ CONTEXT_WINDOWS, ROOT, TIERS_CHOICES, discoverNames, knownRuleIds, loadKits, PACK_ORDER,
38
38
  } from '../build/source.mjs';
39
39
  import { diffCollect, drifted, renderMemo, withStdoutSwallowed } from '../inspect/diff.mjs';
40
40
  import { SESSION_FILES } from '../hosts/hooks-context.mjs';
@@ -44,7 +44,7 @@ import { DEFAULT_PRESET, PRESETS } from '../loop/score.mjs';
44
44
  import { activeLoops, setLoopPreset } from '../loop/registry.mjs';
45
45
  import { HOSTS, resolvePath } from '../hosts/hosts.mjs';
46
46
  import {
47
- EMIT_FOR, EMIT_HOST_SCOPE, doctrinesForBuild, excludedRulesOfDir, excludedSkillsOfDir, kitsOfDir, sharedTierOfDir, contextWindowOfDir, renderedTier,
47
+ EMIT_FOR, EMIT_HOST_SCOPE, doctrinesForBuild, excludedRulesOfDir, excludedSkillsOfDir, sharedTierOfDir, contextWindowOfDir, tiersOfDir, renderedTier,
48
48
  footprintOfDir, gatesOfDir,
49
49
  installedDefaults, installState, installTargets, modeOfDir, postureOfDir, themeOfDir,
50
50
  trustOfDir,
@@ -58,6 +58,7 @@ import { NO_WINDOW } from '../lib/proc.mjs';
58
58
  import { normcase, which, within } from '../lib/paths.mjs';
59
59
  import { stripWhitespace } from '../lib/text.mjs';
60
60
  import { memoryDelete } from '../maintain/memory.mjs';
61
+ import { migratedKitsOfDir } from '../maintain/kit-migration.mjs';
61
62
  import { autostartInstall, autostartRemove } from '../hosts/shim.mjs';
62
63
  import { installDeactivate, installReactivate, installUninstall } from '../maintain/uninstall.mjs';
63
64
  import { checkProjectFolder } from '../maintain/profile-scope.mjs';
@@ -152,6 +153,15 @@ function bodySharedTier(body, root, host) {
152
153
  return typeof said === 'boolean' ? said : sharedTierOfDir(root, host);
153
154
  }
154
155
 
156
+ /**
157
+ * A request body's `tiers` (`--tiers`): `auto` or `off` only; anything else keeps the install's own
158
+ * answer, so a deploy or an apply that never heard of the option cannot turn the routing off.
159
+ */
160
+ function bodyTiers(body, root, host) {
161
+ const said = bget(body, 'tiers');
162
+ return typeof said === 'string' && TIERS_CHOICES.includes(said) ? said : tiersOfDir(root, host);
163
+ }
164
+
155
165
  /**
156
166
  * A request body's `contextWindow` (`--context-window`): only a value `CONTEXT_WINDOWS` names
157
167
  * counts; anything else keeps the install's own answer, so a malformed body changes nothing. An
@@ -653,6 +663,13 @@ export function apiRestore(state, files) {
653
663
  const tmp = mkdtempSync(path.join(os.tmpdir(), 'geneseed-restore-'));
654
664
  try {
655
665
  const expected = resolvePath(path.join(tmp, 'expected'));
666
+ // The user's own overrides (pins and the tiers map), seeded before the emit that reads them
667
+ // (`diff.mjs` `renderExpected`): or a restore writes the default model over a chosen one.
668
+ try {
669
+ const own = readFileSync(path.join(target, 'agent-overrides.json'));
670
+ mkdirSync(expected, { recursive: true });
671
+ writeFileSync(path.join(expected, 'agent-overrides.json'), own);
672
+ } catch { /* none: the emit seeds its stub */ }
656
673
  withStdoutSwallowed(() => emitGlobalInto(globalEmitHostFor(state.emit), {
657
674
  theme: state.theme,
658
675
  out: path.join(tmp, 'bundle'),
@@ -675,9 +692,11 @@ export function apiRestore(state, files) {
675
692
  excludeRules: excludedRulesOfDir(target),
676
693
  excludeSkills: excludedSkillsOfDir(target),
677
694
  // The kits: a restored AGENT.md keeps its Kits block and `Active kits:` line.
678
- kits: kitsOfDir(target),
695
+ kits: migratedKitsOfDir(target),
679
696
  sharedTier: sharedTierOfDir(target),
680
697
  contextWindow: contextWindowOfDir(target),
698
+ // The tier routing, or a restored AGENT.md drops its `Model tiers: auto` line and the agents their model lines.
699
+ tiers: tiersOfDir(target),
681
700
  // The gate switches: a restored AGENT.md must keep the install's `<gate>: off` lines.
682
701
  ...gatesOfDir(target),
683
702
  }));
@@ -792,7 +811,8 @@ export function apiInstallCmd(state, body) {
792
811
  const out = scope === 'global' ? null : String(root);
793
812
  const argv = setupBuildArgs(theme || 'neutral', emit, out, out, fp, pos, mode, doctrines,
794
813
  PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates,
795
- kits ?? kitsOfDir(root, host), sharedTier, bodyContextWindow(body, root, host, scope));
814
+ kits ?? migratedKitsOfDir(root, host), sharedTier, bodyContextWindow(body, root, host, scope),
815
+ bodyTiers(body, root, host));
796
816
  // `--reset`: this argv is a WHOLE selection — every axis is the body's or the install's own —
797
817
  // and `setupBuildArgs` elides an axis at its default, so returning one to it (a mode back to
798
818
  // direct, a gate re-armed) would otherwise trip the preserve guard (js/build/profile.mjs).
@@ -915,8 +935,9 @@ export function apiDeployCmd(state, body) {
915
935
  const gates = bodyGates(body, root, host);
916
936
  // project-scope emit name == host name (opencode / claude / bob / openclaude)
917
937
  const argv = setupBuildArgs(theme || 'neutral', host, root, root, fp, pos, mode, doctrines,
918
- PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates, kitsOfDir(root, host),
919
- bodySharedTier(body, root, host), bodyContextWindow(body, root, host, 'project'));
938
+ PACK_ORDER, excludeRules, trust, excludedSkillsOfDir(root, host), gates, migratedKitsOfDir(root, host),
939
+ bodySharedTier(body, root, host), bodyContextWindow(body, root, host, 'project'),
940
+ bodyTiers(body, root, host));
920
941
  // `--reset`, as in `apiInstallCmd`: the form's answers plus the folder's own are a whole selection.
921
942
  argv.push('--reset');
922
943
  return { cmd: [process.execPath, path.join(ROOT, 'bin', 'build-driver.mjs'), ...argv] };