loadout-ai 0.4.0 → 0.5.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 (48) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/MASTER_PLAN.md +173 -9
  3. package/README.md +57 -19
  4. package/catalog/discovered.json +8422 -6957
  5. package/catalog/packages.json +26 -0
  6. package/dist/src/cli.js +140 -68
  7. package/dist/src/core/active-policy.js +216 -42
  8. package/dist/src/core/active-set.js +14 -5
  9. package/dist/src/core/adopt.js +1 -1
  10. package/dist/src/core/catalog-coverage.js +2 -1
  11. package/dist/src/core/catalog-install.js +23 -8
  12. package/dist/src/core/cli-guide.js +5 -2
  13. package/dist/src/core/codex-mcp.js +49 -5
  14. package/dist/src/core/completion.js +0 -3
  15. package/dist/src/core/health.js +19 -11
  16. package/dist/src/core/install.js +6 -39
  17. package/dist/src/core/mcp-recipes.js +13 -4
  18. package/dist/src/core/mcp.js +6 -5
  19. package/dist/src/core/model-config.js +1 -1
  20. package/dist/src/core/portable.js +1 -1
  21. package/dist/src/core/recommend.js +129 -27
  22. package/dist/src/core/remove.js +28 -2
  23. package/dist/src/core/runtime-tool-recipe.js +2 -2
  24. package/dist/src/core/runtime-tools.js +15 -4
  25. package/dist/src/core/snapshot.js +20 -0
  26. package/dist/src/core/state.js +9 -0
  27. package/dist/src/core/sync.js +1 -1
  28. package/dist/src/core/target-occupancy.js +50 -0
  29. package/dist/src/core/transaction.js +2 -1
  30. package/dist/src/shared/schemas.js +1 -0
  31. package/docs/CATALOG.md +3 -2
  32. package/docs/DISCOVERED.md +253 -255
  33. package/docs/FEATURE_TEST_MATRIX.md +19 -32
  34. package/docs/GITHUB_AUTHORIZATION.md +2 -2
  35. package/docs/TESTING.md +3 -16
  36. package/docs/USER_TEST_GUIDE.md +39 -13
  37. package/docs/assets/loadout-workflow.png +0 -0
  38. package/docs/evidence/readme-claims.json +0 -8
  39. package/docs/superpowers/plans/2026-07-20-loadout-readme-explainer.md +116 -0
  40. package/docs/superpowers/plans/2026-07-20-project-activation-safety.md +469 -0
  41. package/docs/superpowers/specs/2026-07-20-loadout-readme-explainer-design.md +55 -0
  42. package/docs/superpowers/specs/2026-07-20-project-activation-safety-design.md +228 -0
  43. package/package.json +4 -6
  44. package/dashboard/app.js +0 -607
  45. package/dashboard/index.html +0 -249
  46. package/dashboard/styles.css +0 -384
  47. package/dist/src/core/demo.js +0 -136
  48. package/dist/src/dashboard.js +0 -421
@@ -0,0 +1,228 @@
1
+ # Project Activation Safety and Relevance Design
2
+
3
+ **Status:** Approved direction; awaiting written-spec review
4
+ **Date:** 2026-07-20
5
+ **Release target:** Loadout 0.4.1
6
+
7
+ ## Problem
8
+
9
+ The founder acceptance run of `loadout activate --project . --agents
10
+ codex,claude-code --limit 30` exposed three connected defects:
11
+
12
+ 1. The preview reported `0/30 active` even though Claude Code already had 12
13
+ unmanaged skills. The planner counted only active Loadout records, so applying the
14
+ proposal could exceed the disclosed per-agent limit.
15
+ 2. An earlier rollback correctly restored recursively empty skill directories. The
16
+ activation planner treated the existence of those empty directories as occupied
17
+ content and blocked safe activation for both agents.
18
+ 3. Project detection recognized only JavaScript/TypeScript and Playwright. It missed
19
+ strong local evidence that this repository is a Node CLI, an npm package, a Vitest
20
+ project, an MCP-related tool, and a release/supply-chain project. Ranking then used
21
+ the entire 30-slot budget as a quota and proposed redundant or mismatched skills,
22
+ including several overlapping Playwright workflows and a Jest skill for a Vitest
23
+ repository.
24
+
25
+ No activation was applied. The Maximum library remains disabled, and the founder's
26
+ 12 unmanaged Claude skills remain unchanged.
27
+
28
+ ## Goals
29
+
30
+ - Make `--limit` a truthful ceiling over all active skills visible to each selected
31
+ agent, whether managed by Loadout or not.
32
+ - Plan and explain capacity separately for every selected agent.
33
+ - Treat recursively empty rollback residue as unoccupied while continuing to refuse
34
+ every non-empty, symlinked, unreadable, or unsupported target.
35
+ - Improve local project recognition enough to distinguish this Node CLI/npm/Vitest
36
+ repository from a generic Playwright web application.
37
+ - Select a compact, diverse working set instead of filling every available slot with
38
+ weak or redundant matches.
39
+ - Preserve a preview-first, transactional, rollback-safe mutation path.
40
+
41
+ ## Non-goals
42
+
43
+ - No model or external API call is required for recommendation or activation.
44
+ - No project source, filename, dependency, or outcome data leaves the machine.
45
+ - This work does not claim that a deterministic recommendation proves global package
46
+ quality.
47
+ - This work does not install deferred MCP servers or collect credentials.
48
+ - Dashboard removal remains a separate 0.4.1 task.
49
+
50
+ ## Design
51
+
52
+ ### 1. One shared definition of an occupied skill target
53
+
54
+ Loadout will use one filesystem predicate for both initial installation and later
55
+ library activation:
56
+
57
+ - A missing path is unoccupied.
58
+ - A real directory containing no entries at any depth is unoccupied.
59
+ - A regular file, symlink, special entry, unreadable directory, or directory with any
60
+ non-directory descendant is occupied.
61
+ - Recursive inspection is bounded to 10,000 entries. Reaching the bound is treated as
62
+ occupied, never as empty.
63
+
64
+ Activation will re-check this predicate inside the transaction immediately before
65
+ copying. This closes the preview/apply race without deleting or adopting user content.
66
+ Empty target directories may be removed immediately before the copy because they
67
+ contain no bytes to preserve; rollback still restores the pre-transaction topology.
68
+
69
+ ### 2. Per-agent total active capacity
70
+
71
+ For each requested agent, the planner will scan the agent's real skill root and count
72
+ every directory containing a valid `SKILL.md`. This inventory already distinguishes
73
+ managed and unmanaged skills and will be the capacity source of truth.
74
+
75
+ For agent `a`:
76
+
77
+ ```text
78
+ available(a) = max(0, limit - inventory(a).total)
79
+ ```
80
+
81
+ Candidate ranking is deterministic and shared, but selection is sliced independently
82
+ to each agent's available capacity. In the founder fixture, Claude Code has 12 active
83
+ unmanaged skills and may receive at most 18 additions; Codex has zero active skills and
84
+ may receive at most 30. An agent at its limit receives no changes and a clear warning;
85
+ it does not prevent another requested agent from using its own available capacity.
86
+
87
+ The plan must never count an empty directory as an active skill. Existing managed
88
+ skills already in the desired state count toward capacity but are not proposed again.
89
+
90
+ ### 3. Project signals
91
+
92
+ Project scanning remains deterministic, bounded, and local-only. It will read known
93
+ root manifests/configuration and a bounded set of repository filenames. For Node
94
+ projects it will derive explicit signals from `package.json`:
95
+
96
+ - `bin` -> Node CLI
97
+ - package name plus `publishConfig` or non-private package -> npm package/release
98
+ - `vitest` -> Vitest
99
+ - `jest` -> Jest
100
+ - `@playwright/test` or Playwright config -> Playwright
101
+ - `commander` -> command-line application
102
+ - `zod` -> schema validation
103
+ - scripts containing `prepack`, package-smoke, or release checks -> package/release
104
+
105
+ Repository filenames add delivery, security, MCP, and documentation signals only when
106
+ matching explicit reviewed patterns such as `.github/workflows`, `SECURITY.md`, MCP-
107
+ named modules, and package/release scripts. The scanner does not recursively read
108
+ arbitrary project source or send any data elsewhere.
109
+
110
+ Human output will name the important detected roles, for example:
111
+
112
+ ```text
113
+ Detected: TypeScript, Node CLI, npm package, Vitest, Playwright, MCP tooling
114
+ ```
115
+
116
+ ### 4. Relevant and diverse selection
117
+
118
+ The existing source-priority tie-break remains, but a capacity ceiling is not a quota.
119
+ Selection stops when no candidate reaches the evidence threshold.
120
+
121
+ Ranking will:
122
+
123
+ - reward exact tool and role matches such as Vitest, CLI design, npm packaging,
124
+ TypeScript, MCP security, release verification, and documentation;
125
+ - reject framework mismatches such as Jest-only guidance when Vitest is detected and
126
+ Jest is not;
127
+ - group close alternatives into capability families such as browser testing, code
128
+ review, documentation, planning, security, and architecture;
129
+ - select the highest-evidence representative before taking another member of the same
130
+ family;
131
+ - cap weak generic foundation choices so they cannot crowd out project-specific
132
+ evidence;
133
+ - continue to honor explicit `--pin` selectors, while disclosing when a pin consumes a
134
+ slot or conflicts with the limit.
135
+
136
+ The same skill name from multiple repositories remains an alternative, not two active
137
+ copies. Multiple distinct skills in one family are allowed only when each has separate
138
+ strong project evidence.
139
+
140
+ ### 5. Recommendation type clarity
141
+
142
+ Package-level `loadout recommend` output will label every suggestion as one of:
143
+
144
+ - `skill library` — eligible for disabled-library activation;
145
+ - `MCP/runtime setup` — requires a separate explicit preview and may require a
146
+ non-model credential;
147
+ - `unavailable` — not prepared locally, with the reason.
148
+
149
+ Playwright MCP and GitHub MCP must not look like ordinary automatically activatable
150
+ skills. The command will show the next preview command for explicit integrations and
151
+ will continue to state that recommendations are rule-selected, not proof of quality.
152
+
153
+ ### 6. Preview and apply output
154
+
155
+ The default human preview will begin with one compact block per agent:
156
+
157
+ ```text
158
+ Claude Code: 12 active (0 managed, 12 unmanaged), 18/30 slots available
159
+ Codex: 0 active, 30/30 slots available
160
+ ```
161
+
162
+ It will then show additions grouped by agent and capability, followed by blockers. A
163
+ recursively empty target is not printed as a blocker. A real conflict prints the exact
164
+ target and a non-destructive next action. JSON output retains full scores, reasons,
165
+ alternatives, per-agent budgets, targets, and blocker details.
166
+
167
+ `--yes` is rejected when any proposed target is blocked. A successful apply creates
168
+ one transaction snapshot covering every selected agent and prints the exact rollback
169
+ command.
170
+
171
+ ## Data flow
172
+
173
+ 1. Scan project metadata into local project signals.
174
+ 2. Scan each requested agent's active skill inventory.
175
+ 3. Read reviewed disabled-library records and local-only outcomes.
176
+ 4. Score and diversify eligible candidates.
177
+ 5. Slice the ordered candidates independently to each agent's available capacity.
178
+ 6. Build exact activation changes and inspect targets with the shared occupancy rule.
179
+ 7. Print the preview; stop unless `--yes` is present.
180
+ 8. Inside the transaction, re-read state, re-check capacity and target occupancy, copy
181
+ reviewed library bytes, fingerprint the result, persist activation state, and emit
182
+ the rollback snapshot.
183
+
184
+ ## Failure handling
185
+
186
+ - If inventory scanning fails for an agent, activation for that agent is blocked; its
187
+ capacity is never guessed.
188
+ - If the project manifest is malformed, show the exact manifest error and continue
189
+ only with signals that remain trustworthy.
190
+ - If state or filesystem contents change between preview and apply, abort the entire
191
+ multi-agent transaction without partial activation.
192
+ - If fewer candidates meet the evidence threshold than available slots, activate only
193
+ those candidates and explain that unused capacity is intentional.
194
+
195
+ ## Tests and acceptance criteria
196
+
197
+ Automated tests must prove:
198
+
199
+ 1. A recursively empty target does not block preview or apply.
200
+ 2. A target containing a file, symlink, unreadable entry, or more than the inspection
201
+ bound remains blocked and unchanged.
202
+ 3. Empty-directory handling is identical in initial setup and project activation.
203
+ 4. Twelve unmanaged Claude skills plus an 18-skill proposal never exceeds a limit of 30.
204
+ 5. The same plan may select 18 additions for Claude and 30 for an empty Codex profile.
205
+ 6. An agent already at capacity receives no additions while another agent can proceed.
206
+ 7. Apply re-checks inventory and occupancy and aborts atomically when either changes.
207
+ 8. The Loadout repository fixture detects Node CLI, npm package, Vitest, Playwright,
208
+ Commander, Zod, release, security, and MCP signals.
209
+ 9. A Vitest-only fixture never recommends a Jest-only skill.
210
+ 10. Redundant Playwright/browser candidates do not consume most of the active set.
211
+ 11. Recommendation output distinguishes skill libraries from explicit MCP/runtime
212
+ setup.
213
+ 12. Human output shows per-agent managed/unmanaged counts and unused capacity; JSON
214
+ exposes the same facts structurally.
215
+ 13. Existing Stable, Power, Maximum, rollback, and non-overwrite tests remain green.
216
+
217
+ Founder acceptance resumes only after the published release candidate previews a
218
+ non-blocked plan, reports Claude's existing 12 skills, respects both per-agent limits,
219
+ applies transactionally, and restores its explicit snapshot without changing unmanaged
220
+ content.
221
+
222
+ ## Compatibility
223
+
224
+ Existing `loadout activate` and `loadout optimize` flags remain valid. The meaning of
225
+ `--limit` is corrected from an implicit managed-only count to the documented total
226
+ active skill ceiling. JSON consumers must migrate from one global `activeBefore` and
227
+ `capacity` pair to per-agent budget records; the 0.4.1 changelog will call out this
228
+ schema correction.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loadout-ai",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Universal upgrade manager for AI coding agents",
@@ -10,7 +10,6 @@
10
10
  },
11
11
  "files": [
12
12
  "dist/src",
13
- "dashboard",
14
13
  "catalog",
15
14
  "docs",
16
15
  "README.md",
@@ -41,17 +40,17 @@
41
40
  "node": ">=20"
42
41
  },
43
42
  "scripts": {
43
+ "clean": "node scripts/clean-dist.mjs",
44
+ "prebuild": "npm run clean",
44
45
  "build": "tsc -p tsconfig.json",
45
46
  "prepack": "npm run build",
46
47
  "dev": "tsx src/cli.ts",
47
- "dashboard": "tsx src/dashboard.ts",
48
48
  "format": "prettier --write .",
49
49
  "format:check": "prettier --check .",
50
50
  "lint": "eslint src tests vitest.config.ts",
51
51
  "test": "vitest run",
52
52
  "test:watch": "vitest",
53
53
  "test:e2e": "npm run test:e2e:cli",
54
- "test:e2e:dashboard": "playwright test",
55
54
  "pretest:e2e:cli": "npm run build",
56
55
  "test:e2e:cli": "node scripts/cli-product-flow.mjs",
57
56
  "test:e2e:readme": "node scripts/readme-product-flow.mjs",
@@ -66,7 +65,7 @@
66
65
  "check:evidence": "node scripts/check-catalog-attribution.mjs && node scripts/check-discovery-artifacts.mjs && npm run check:readme-claims && node --import tsx scripts/check-release-claims.ts",
67
66
  "feed:build": "node --import tsx scripts/build-intelligence-feed.ts",
68
67
  "verify": "npm run format:check && npm run lint && npm run typecheck && npm run check:evidence && npm test -- --run && npm run test:e2e:cli && npm run test:e2e:readme && npm run test:package && npm run test:performance",
69
- "verify:full": "npm run verify && npm run test:e2e:dashboard"
68
+ "verify:full": "npm run verify"
70
69
  },
71
70
  "dependencies": {
72
71
  "commander": "^12.1.0",
@@ -74,7 +73,6 @@
74
73
  },
75
74
  "devDependencies": {
76
75
  "@eslint/js": "^9.39.5",
77
- "@playwright/test": "^1.61.1",
78
76
  "@types/node": "^22.10.0",
79
77
  "eslint": "^9.39.5",
80
78
  "eslint-config-prettier": "^10.1.8",