heimdall-agent 1.0.0 → 1.2.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 (250) hide show
  1. package/README.md +57 -26
  2. package/README.pt-BR.md +443 -0
  3. package/agents/cloud-engineer.md +77 -0
  4. package/agents/code-sentinel.md +71 -34
  5. package/agents/database-architect.md +31 -25
  6. package/agents/frontend-designer.md +30 -28
  7. package/agents/mobile-designer.md +25 -24
  8. package/agents/modernizer.md +68 -0
  9. package/agents/orchestrator.md +107 -93
  10. package/agents/reviewer.md +102 -71
  11. package/agents/security-auditor.md +27 -27
  12. package/agents/tester.md +97 -90
  13. package/commands/grill-me.md +20 -4
  14. package/commands/orchestrate.md +16 -0
  15. package/commands/orchestrator.md +16 -0
  16. package/commands/plan.md +17 -1
  17. package/config/agents.json +31 -3
  18. package/config/mcp.json +72 -0
  19. package/config/models.json +26 -16
  20. package/config/profiles.json +2 -4
  21. package/config/skills.json +762 -573
  22. package/docs/SKILLS.md +393 -275
  23. package/docs/designs/old/2026-10-31 plan-lifecycle-backlog-and-clean-code-skill.md +87 -0
  24. package/docs/designs/old/2026-11-02 skill-upstream-audit-and-update.md +105 -0
  25. package/docs/designs/old/2026-11-05 communication-doctrine-bluf-ste.md +94 -0
  26. package/docs/designs/old/2026-11-06-cloud-engineer-and-resilience-synthesis.md +67 -0
  27. package/docs/designs/old/2026-11-06-herdr-native-agent-orchestration.md +45 -0
  28. package/docs/runs/skill-audit/2026-11-12-compare-report.json +1028 -0
  29. package/docs/runs/skill-audit/2026-11-12-upstream-audit.json +275 -0
  30. package/docs/runs/skill-audit/add_progressive_disclosure.cjs +30 -0
  31. package/docs/runs/skill-audit/check_heimdall_skills.ps1 +9 -0
  32. package/docs/runs/skill-audit/compare_classics.ps1 +26 -0
  33. package/docs/runs/skill-audit/compare_taste.ps1 +12 -0
  34. package/docs/runs/skill-audit/customization-report.json +380 -0
  35. package/docs/runs/skill-audit/diff_pending_skills.cjs +94 -0
  36. package/docs/runs/skill-audit/fetch_and_apply_skill.cjs +58 -0
  37. package/docs/runs/skill-audit/fetch_and_apply_taste_v2.cjs +65 -0
  38. package/docs/runs/skill-audit/inspect_pending_skills.cjs +71 -0
  39. package/docs/runs/skill-audit/inventory.json +308 -0
  40. package/docs/runs/skill-audit/list_local_taste.ps1 +1 -0
  41. package/docs/runs/skill-audit/phase5-update-plan.json +595 -0
  42. package/docs/runs/skill-audit/phase5-update-plan.md +138 -0
  43. package/docs/runs/skill-audit/probe.ps1 +16 -0
  44. package/docs/runs/skill-audit/probe_classics_branches.ps1 +3 -0
  45. package/docs/runs/skill-audit/probe_commits.ps1 +15 -0
  46. package/docs/runs/skill-audit/probe_repos.ps1 +17 -0
  47. package/docs/runs/skill-audit/probe_sentry_sec.ps1 +3 -0
  48. package/docs/runs/skill-audit/probe_sentry_sweep.ps1 +5 -0
  49. package/docs/runs/skill-audit/probe_snyk.ps1 +3 -0
  50. package/docs/runs/skill-audit/probe_snyk_recipes.ps1 +5 -0
  51. package/docs/runs/skill-audit/probe_taste_branches.ps1 +8 -0
  52. package/docs/runs/skill-audit/probe_taste_v19.ps1 +3 -0
  53. package/docs/runs/skill-audit/probe_user_repos.ps1 +19 -0
  54. package/docs/runs/skill-audit/prune_taste_skills.cjs +22 -0
  55. package/docs/runs/skill-audit/run_phase1_2.cjs +142 -0
  56. package/docs/runs/skill-audit/run_phase6_verification.cjs +107 -0
  57. package/docs/runs/skill-audit/show_16_details.ps1 +25 -0
  58. package/docs/runs/skill-audit/show_20_skills.ps1 +28 -0
  59. package/docs/runs/skill-audit/show_classics_diff.cjs +37 -0
  60. package/docs/runs/skill-audit/sync_agent_markdowns.cjs +30 -0
  61. package/docs/runs/skill-audit/taste-skill-upstream.md +542 -0
  62. package/docs/runs/skill-audit/update-manifest.md +88 -0
  63. package/docs/runs/skill-audit/update_config_skills.cjs +52 -0
  64. package/docs/runs/skill-audit/update_registry_phase7.cjs +83 -0
  65. package/docs/runs/skill-audit/upstream-status.json +563 -0
  66. package/docs/runs/skill-audit/verification-results.json +252 -0
  67. package/doctrine/AGENTS.md +42 -77
  68. package/hooks/git/pre-commit +11 -0
  69. package/hooks/heimdall-hook.cjs +81 -2
  70. package/hooks/herdr-agent-state.ps1 +55 -0
  71. package/hooks/hooks.json +0 -11
  72. package/lib/catalog-sync.cjs +167 -0
  73. package/lib/hermes-context.cjs +57 -0
  74. package/lib/model-context.cjs +123 -0
  75. package/lib/path-discovery.cjs +94 -0
  76. package/package.json +7 -3
  77. package/playbooks/01-interactive-grilling-gate.md +23 -6
  78. package/playbooks/02-fast-code-deep-verification.md +3 -2
  79. package/playbooks/03-adversarial-code-review.md +15 -7
  80. package/playbooks/05-canonical-plan-template.md +35 -19
  81. package/playbooks/06-model-registry-matrix.md +24 -13
  82. package/playbooks/07-legacy-code-modernization.md +74 -0
  83. package/playbooks/08-backlog-and-change-request-flow.md +122 -0
  84. package/setup.mjs +592 -172
  85. package/skills/antislop/SKILL.md +76 -56
  86. package/skills/antislop/VERSION +1 -0
  87. package/skills/antislop-copywriting/SKILL.md +407 -372
  88. package/skills/antislop-human/LICENSE-web-quality-skills +21 -0
  89. package/skills/antislop-human/SKILL.md +204 -147
  90. package/skills/antislop-human/contrast-check.py +168 -165
  91. package/skills/antislop-human/contrast-mcp.py +6 -3
  92. package/skills/antislop-human/references/A11Y-PATTERNS.md +249 -0
  93. package/skills/antislop-human/references/WCAG.md +127 -0
  94. package/skills/antislop-ui/LICENSE-web-quality-skills +21 -0
  95. package/skills/antislop-ui/SKILL.md +344 -304
  96. package/skills/antislop-ui/references/CORE-WEB-VITALS.md +181 -0
  97. package/skills/antislop-ui/references/WEB-BASELINE.md +28 -0
  98. package/skills/brainstorming/SKILL.md +296 -265
  99. package/skills/brainstorming/builder-check-prompt.md +23 -0
  100. package/skills/brainstorming/scripts/frame-template.html +213 -213
  101. package/skills/brainstorming/scripts/server.cjs +723 -723
  102. package/skills/brandkit/SKILL.md +798 -798
  103. package/skills/brutalist-skill/SKILL.md +93 -92
  104. package/skills/caveman/README.md +68 -0
  105. package/skills/caveman/SKILL.md +73 -38
  106. package/skills/claude-collaborator/SKILL.md +24 -44
  107. package/skills/clean-code/SKILL.md +152 -0
  108. package/skills/cloudflare-security-audit/AI-AND-LLM.md +83 -83
  109. package/skills/cloudflare-security-audit/ATTACK-CLASSES.md +130 -130
  110. package/skills/cloudflare-security-audit/CLIENT-SIDE.md +83 -83
  111. package/skills/cloudflare-security-audit/CLOUD-AND-DEPLOYMENT.md +86 -86
  112. package/skills/cloudflare-security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -84
  113. package/skills/cloudflare-security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -89
  114. package/skills/cloudflare-security-audit/HUNTING.md +251 -251
  115. package/skills/cloudflare-security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -101
  116. package/skills/cloudflare-security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -81
  117. package/skills/cloudflare-security-audit/RECONNAISSANCE.md +156 -156
  118. package/skills/cloudflare-security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -78
  119. package/skills/cloudflare-security-audit/SKILL.md +192 -192
  120. package/skills/cloudflare-security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -73
  121. package/skills/cloudflare-security-audit/VALIDATION-AND-REPORTING.md +186 -186
  122. package/skills/cloudflare-security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -105
  123. package/skills/cloudflare-security-audit/report-schema.json +461 -461
  124. package/skills/cloudflare-security-audit/validate-coverage-ledger.cjs +872 -872
  125. package/skills/cloudflare-security-audit/validate-coverage-ledger.test.cjs +740 -740
  126. package/skills/cloudflare-security-audit/validate-findings.cjs +773 -773
  127. package/skills/cloudflare-security-audit/validate-findings.test.cjs +652 -652
  128. package/skills/codebase-design/DEEPENING.md +37 -0
  129. package/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  130. package/skills/codebase-design/SKILL.md +114 -0
  131. package/skills/codex-collaborator/SKILL.md +24 -45
  132. package/skills/communication-doctrine/SKILL.md +89 -0
  133. package/skills/diagnosing-superpowers/SKILL.md +1 -1
  134. package/skills/diagnosing-superpowers/references/github-issues.md +3 -3
  135. package/skills/diagnosing-superpowers/templates/issue.md +23 -4
  136. package/skills/domain-modeling/ADR-FORMAT.md +47 -0
  137. package/skills/domain-modeling/GLOSSARY-FORMAT.md +60 -0
  138. package/skills/domain-modeling/SKILL.md +74 -0
  139. package/skills/executing-plans/SKILL.md +6 -56
  140. package/skills/executing-plans/scripts/task-done +52 -52
  141. package/skills/executing-plans/scripts/task-start +28 -28
  142. package/skills/gemini-collaborator/SKILL.md +24 -56
  143. package/skills/grill-me/SKILL.md +65 -0
  144. package/skills/handoff/SKILL.md +64 -0
  145. package/skills/herdr/SKILL.md +243 -0
  146. package/skills/image-to-code-skill/SKILL.md +1228 -1228
  147. package/skills/imagegen-frontend-mobile/SKILL.md +1465 -1465
  148. package/skills/imagegen-frontend-web/SKILL.md +987 -987
  149. package/skills/improve-codebase-architecture/HTML-REPORT.md +123 -0
  150. package/skills/improve-codebase-architecture/SKILL.md +71 -0
  151. package/skills/karpathy-guidelines/SKILL.md +67 -67
  152. package/skills/mcp-engineering/SKILL.md +74 -0
  153. package/skills/minimalist-skill/SKILL.md +87 -85
  154. package/skills/output-skill/SKILL.md +49 -49
  155. package/skills/owasp-security/reference/config-and-supply-chain.md +346 -344
  156. package/skills/owasp-security/reference/languages.md +378 -372
  157. package/skills/owasp-security/reference/owasp-report.md +1144 -1140
  158. package/skills/owasp-security/reference/review-checklist.md +134 -132
  159. package/skills/ponytail/SKILL.md +36 -52
  160. package/skills/postgres-best-practices/SKILL.md +30 -52
  161. package/skills/postgres-best-practices/references/backup-restore.md +372 -0
  162. package/skills/postgres-best-practices/references/bulk-loading.md +315 -0
  163. package/skills/postgres-best-practices/references/connection-pooling.md +310 -0
  164. package/skills/postgres-best-practices/references/hot-standby.md +221 -0
  165. package/skills/postgres-best-practices/references/indexing.md +318 -0
  166. package/skills/postgres-best-practices/references/logical-replication.md +610 -0
  167. package/skills/postgres-best-practices/references/major-version-upgrades.md +334 -0
  168. package/skills/postgres-best-practices/references/performance-diagnostics.md +553 -0
  169. package/skills/postgres-best-practices/references/query-optimization.md +294 -0
  170. package/skills/postgres-best-practices/references/query-patterns.md +566 -0
  171. package/skills/postgres-best-practices/references/schema-design.md +362 -0
  172. package/skills/postgres-best-practices/references/security-roles.md +489 -0
  173. package/skills/postgres-best-practices/references/transaction-isolation.md +344 -0
  174. package/skills/progressive-disclosure/SKILL.md +68 -0
  175. package/skills/pstack-discipline/SKILL.md +40 -0
  176. package/skills/receiving-code-review/SKILL.md +2 -23
  177. package/skills/requesting-code-review/SKILL.md +7 -36
  178. package/skills/soft-skill/SKILL.md +99 -98
  179. package/skills/stitch-skill/DESIGN.md +121 -121
  180. package/skills/stitch-skill/SKILL.md +185 -184
  181. package/skills/strix-security/SKILL.md +54 -53
  182. package/skills/subagent-driven-development/SKILL.md +35 -264
  183. package/skills/subagent-driven-development/references/batching.md +11 -0
  184. package/skills/subagent-driven-development/references/cannot-verify.md +10 -0
  185. package/skills/subagent-driven-development/references/final-review.md +47 -0
  186. package/skills/subagent-driven-development/references/fix-loop.md +77 -0
  187. package/skills/subagent-driven-development/references/handling-reports.md +15 -0
  188. package/skills/subagent-driven-development/references/preflight.md +26 -0
  189. package/skills/subagent-driven-development/references/resuming.md +12 -0
  190. package/skills/subagent-driven-development/scripts/review-package +53 -53
  191. package/skills/subagent-driven-development/scripts/sdd-workspace +87 -82
  192. package/skills/subagent-driven-development/scripts/task-brief +43 -43
  193. package/skills/systematic-debugging/SKILL.md +283 -306
  194. package/skills/taste-skill/SKILL.md +542 -1206
  195. package/skills/taste-skill/references/app-screens.md +1199 -0
  196. package/skills/taste-skill/references/colour.md +141 -0
  197. package/skills/taste-skill/references/copy.md +177 -0
  198. package/skills/taste-skill/references/critique.md +182 -0
  199. package/skills/taste-skill/references/imagery.md +791 -0
  200. package/skills/taste-skill/references/layout.md +292 -0
  201. package/skills/taste-skill/references/motion.md +980 -0
  202. package/skills/taste-skill/references/research.md +356 -0
  203. package/skills/taste-skill/references/scenes.md +174 -0
  204. package/skills/taste-skill/references/tells.md +115 -0
  205. package/skills/taste-skill/references/type.md +170 -0
  206. package/skills/test-driven-development/SKILL.md +330 -337
  207. package/skills/thermo/SKILL.md +67 -0
  208. package/skills/threat-modeling/SKILL.md +55 -0
  209. package/skills/to-spec/SKILL.md +75 -0
  210. package/skills/to-tickets/SKILL.md +105 -0
  211. package/skills/trailofbits-audit-context/SKILL.md +72 -72
  212. package/skills/trailofbits-insecure-defaults/commands/audit.md +35 -0
  213. package/skills/trailofbits-insecure-defaults/references/debug-features.json +13 -13
  214. package/skills/trailofbits-insecure-defaults/references/debug-features.md +75 -75
  215. package/skills/trailofbits-insecure-defaults/references/default-credentials.json +12 -12
  216. package/skills/trailofbits-insecure-defaults/references/default-credentials.md +76 -76
  217. package/skills/trailofbits-insecure-defaults/references/fail-open-security.json +11 -11
  218. package/skills/trailofbits-insecure-defaults/references/fail-open-security.md +70 -70
  219. package/skills/trailofbits-insecure-defaults/references/fallback-secrets.json +11 -11
  220. package/skills/trailofbits-insecure-defaults/references/fallback-secrets.md +70 -70
  221. package/skills/trailofbits-insecure-defaults/references/permissive-access.json +13 -13
  222. package/skills/trailofbits-insecure-defaults/references/permissive-access.md +62 -62
  223. package/skills/trailofbits-insecure-defaults/references/weak-crypto.json +13 -13
  224. package/skills/trailofbits-insecure-defaults/references/weak-crypto.md +71 -71
  225. package/skills/trailofbits-triage-brocards/SKILL.md +208 -208
  226. package/skills/verification-before-completion/SKILL.md +0 -14
  227. package/skills/wayfinder/SKILL.md +128 -0
  228. package/skills/writing-plans/SKILL.md +11 -15
  229. package/skills/writing-skills/SKILL.md +21 -303
  230. package/skills/writing-skills/references/CLAUDE_MD_TESTING.md +189 -0
  231. package/skills/writing-skills/references/anthropic-best-practices.md +1150 -0
  232. package/skills/writing-skills/references/bulletproofing.md +80 -0
  233. package/skills/writing-skills/references/discovery.md +201 -0
  234. package/skills/writing-skills/references/flowcharts.md +37 -0
  235. package/skills/writing-skills/references/graphviz-conventions.dot +172 -0
  236. package/skills/writing-skills/references/persuasion-principles.md +187 -0
  237. package/skills/writing-skills/references/testing-skills-with-subagents.md +384 -0
  238. package/tools/{claude-bridge.ps1 → archive/claude-bridge.ps1} +10 -7
  239. package/tools/{codex-bridge.ps1 → archive/codex-bridge.ps1} +1 -1
  240. package/tools/{gemini-bridge.ps1 → archive/gemini-bridge.ps1} +12 -19
  241. package/skills/gpt-tasteskill/SKILL.md +0 -74
  242. package/skills/taste-skill-v1/SKILL.md +0 -226
  243. /package/tools/{claude-bridge.cmd → archive/claude-bridge.cmd} +0 -0
  244. /package/tools/{claude-bridge.sh → archive/claude-bridge.sh} +0 -0
  245. /package/tools/{codex-bridge.cmd → archive/codex-bridge.cmd} +0 -0
  246. /package/tools/{codex-bridge.sh → archive/codex-bridge.sh} +0 -0
  247. /package/tools/{codexcli-bridge.cmd → archive/codexcli-bridge.cmd} +0 -0
  248. /package/tools/{codexcli-bridge.ps1 → archive/codexcli-bridge.ps1} +0 -0
  249. /package/tools/{gemini-bridge.cmd → archive/gemini-bridge.cmd} +0 -0
  250. /package/tools/{gemini-bridge.sh → archive/gemini-bridge.sh} +0 -0
package/setup.mjs CHANGED
@@ -18,6 +18,10 @@ import os from 'node:os';
18
18
  import readline from 'node:readline/promises';
19
19
  import { fileURLToPath } from 'node:url';
20
20
  import { execSync } from 'node:child_process';
21
+ import { resolveModelMaxContext, resolveCustomModelsEndpoint } from './lib/model-context.cjs';
22
+ import { updateHermesConfigContext } from './lib/hermes-context.cjs';
23
+ import { detectPathCandidates } from './lib/path-discovery.cjs';
24
+ import { syncCatalogCounts } from './lib/catalog-sync.cjs';
21
25
 
22
26
  const __filename = fileURLToPath(import.meta.url);
23
27
  const __dirname = path.dirname(__filename);
@@ -46,6 +50,7 @@ const profilesPath = path.join(__dirname, 'config', 'profiles.json');
46
50
  const modelsPath = path.join(__dirname, 'config', 'models.json');
47
51
  const agentsConfigPath = path.join(__dirname, 'config', 'agents.json');
48
52
  const skillsConfigPath = path.join(__dirname, 'config', 'skills.json');
53
+ const mcpConfigPath = path.join(__dirname, 'config', 'mcp.json');
49
54
 
50
55
  /**
51
56
  * Resolves the platform-specific Hermes Agent directory:
@@ -124,6 +129,98 @@ const targetHookPaths = {
124
129
  claude: path.join(userHome, '.claude', 'hooks')
125
130
  };
126
131
 
132
+ /**
133
+ * Resolves the root directory of a target agent harness.
134
+ */
135
+ function getAgentRootDir(agent) {
136
+ if (agent === 'claude') return path.join(userHome, '.claude');
137
+ if (agent === 'gemini') return path.join(userHome, '.gemini');
138
+ if (agent === 'codex') return path.join(userHome, '.codex');
139
+ if (agent === 'agents') return path.join(userHome, '.agents');
140
+ if (agent === 'hermes') return getHermesDir();
141
+ if (agent === 'openclaw') return getOpenClawDir();
142
+ if (agent === 'desktop') return getClaudeDesktopDir();
143
+ return null;
144
+ }
145
+
146
+ /**
147
+ * Checks whether an agent harness exists and has an existing root directory/configuration.
148
+ * Heimdall will only configure an agent harness if its root directory already exists.
149
+ */
150
+ function isAgentConfigurable(agent) {
151
+ if (agent === 'desktop') {
152
+ const status = detectClaudeDesktop();
153
+ return Boolean(status.configExists);
154
+ }
155
+ const rootDir = getAgentRootDir(agent);
156
+ return Boolean(rootDir && fs.existsSync(rootDir));
157
+ }
158
+
159
+
160
+
161
+ const pkgJsonPath = path.join(__dirname, 'package.json');
162
+ let currentVersion = '1.0.0';
163
+ try {
164
+ currentVersion = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8')).version || '1.0.0';
165
+ } catch {}
166
+
167
+ function isNewerVersion(current, latest) {
168
+ if (!latest || !current) return false;
169
+ const c = current.replace(/^v/, '').split('.').map(n => parseInt(n, 10) || 0);
170
+ const l = latest.replace(/^v/, '').split('.').map(n => parseInt(n, 10) || 0);
171
+ for (let i = 0; i < 3; i++) {
172
+ const cv = c[i] || 0;
173
+ const lv = l[i] || 0;
174
+ if (lv > cv) return true;
175
+ if (lv < cv) return false;
176
+ }
177
+ return false;
178
+ }
179
+
180
+ async function checkForUpdates() {
181
+ const cacheFile = path.join(userHome, '.heimdall-update.json');
182
+ let cache = { lastChecked: 0, latestVersion: null };
183
+
184
+ if (fs.existsSync(cacheFile)) {
185
+ try {
186
+ cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
187
+ } catch {}
188
+ }
189
+
190
+ const now = Date.now();
191
+ const ONE_DAY = 24 * 60 * 60 * 1000;
192
+ let latestVersion = cache.latestVersion;
193
+
194
+ if (now - (cache.lastChecked || 0) > ONE_DAY) {
195
+ try {
196
+ const res = await fetch('https://registry.npmjs.org/heimdall-agent/latest', {
197
+ headers: { 'Accept': 'application/json' },
198
+ signal: AbortSignal.timeout(1200)
199
+ });
200
+ if (res.ok) {
201
+ const data = await res.json();
202
+ if (data && data.version) {
203
+ latestVersion = data.version;
204
+ cache = { lastChecked: now, latestVersion };
205
+ try {
206
+ fs.writeFileSync(cacheFile, JSON.stringify(cache), 'utf8');
207
+ } catch {}
208
+ }
209
+ }
210
+ } catch {
211
+ // Offline, timeout, or registry unreachable - fail silently
212
+ }
213
+ }
214
+
215
+ if (latestVersion && isNewerVersion(currentVersion, latestVersion)) {
216
+ console.log(`${colors.yellow}╭────────────────────────────────────────────────────────────╮
217
+ │ ${colors.bold}Update available:${colors.reset}${colors.yellow} ${currentVersion} → ${colors.green}${colors.bold}${latestVersion}${colors.reset}${colors.yellow} │
218
+ │ Run: ${colors.cyan}npm install -g heimdall-agent${colors.reset}${colors.yellow} │
219
+ │ Or: ${colors.cyan}npx heimdall-agent@latest${colors.reset}${colors.yellow} │
220
+ ╰────────────────────────────────────────────────────────────╯${colors.reset}`);
221
+ }
222
+ }
223
+
127
224
  function printBanner() {
128
225
  console.log(`
129
226
  ${colors.cyan}${colors.bold} ██╗ ██╗███████╗██╗███╗ ███╗██████╗ █████╗ ██╗ ██╗
@@ -166,6 +263,249 @@ function getClaudeDesktopDir() {
166
263
  return path.join(configHome, 'Claude');
167
264
  }
168
265
 
266
+ /**
267
+ * Detects Claude Desktop by checking for an existing configuration file
268
+ * or the presence of the native desktop executable on OS-specific paths.
269
+ */
270
+ function detectClaudeDesktop() {
271
+ const configDir = getClaudeDesktopDir();
272
+ const configFile = path.join(configDir, 'claude_desktop_config.json');
273
+
274
+ if (fs.existsSync(configFile)) {
275
+ return { dir: configDir, file: configFile, detected: true, configExists: true };
276
+ }
277
+
278
+ const platform = os.platform();
279
+ let appInstalled = false;
280
+
281
+ if (platform === 'win32') {
282
+ const winCandidates = [
283
+ path.join(process.env.LOCALAPPDATA || '', 'Programs', 'Claude', 'Claude.exe'),
284
+ path.join(process.env.LOCALAPPDATA || '', 'Claude', 'Claude.exe'),
285
+ path.join(process.env.PROGRAMFILES || '', 'Claude', 'Claude.exe'),
286
+ path.join(process.env['ProgramFiles(x86)'] || '', 'Claude', 'Claude.exe')
287
+ ];
288
+ appInstalled = winCandidates.some(p => p && fs.existsSync(p));
289
+ } else if (platform === 'darwin') {
290
+ const macCandidates = [
291
+ '/Applications/Claude.app',
292
+ path.join(userHome, 'Applications', 'Claude.app')
293
+ ];
294
+ appInstalled = macCandidates.some(p => fs.existsSync(p));
295
+ } else {
296
+ appInstalled = !!checkCommand('claude-desktop') || fs.existsSync('/opt/Claude/claude');
297
+ }
298
+
299
+ return { dir: configDir, file: configFile, detected: appInstalled, configExists: false };
300
+ }
301
+
302
+ /**
303
+ * Dynamically resolves the active Open Design installation and MCP configuration.
304
+ */
305
+ function resolveOpenDesignMcpConfig() {
306
+ const platform = os.platform();
307
+ let fallbackConfig = null;
308
+ if (fs.existsSync(mcpConfigPath)) {
309
+ try {
310
+ const data = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8'));
311
+ fallbackConfig = data.mcpServers?.['open-design']?.config || null;
312
+ } catch {}
313
+ }
314
+
315
+ if (platform !== 'win32') return fallbackConfig;
316
+
317
+ const appData = process.env.APPDATA || path.join(userHome, 'AppData', 'Roaming');
318
+ const localAppData = process.env.LOCALAPPDATA || path.join(userHome, 'AppData', 'Local');
319
+ const odRoaming = path.join(appData, 'Open Design');
320
+
321
+ if (!fs.existsSync(odRoaming)) return fallbackConfig;
322
+
323
+ // 1. Locate executable
324
+ let odExe = null;
325
+ const enDir = path.join(odRoaming, 'en');
326
+ if (fs.existsSync(enDir)) {
327
+ try {
328
+ const subdirs = fs.readdirSync(enDir);
329
+ for (const sub of subdirs) {
330
+ const cand = path.join(enDir, sub, 'Open Design.exe');
331
+ if (fs.existsSync(cand)) {
332
+ odExe = cand;
333
+ break;
334
+ }
335
+ }
336
+ } catch {}
337
+ }
338
+ if (!odExe) {
339
+ const defaultLocalExe = path.join(localAppData, 'Programs', 'Open Design', 'Open Design.exe');
340
+ if (fs.existsSync(defaultLocalExe)) odExe = defaultLocalExe;
341
+ }
342
+
343
+ // 2. Locate daemon-cli.mjs in version payloads
344
+ let daemonCli = null;
345
+ const versionsDir = path.join(odRoaming, 'launcher', 'channels', 'stable', 'namespaces', 'release-stable-win', 'versions');
346
+ if (fs.existsSync(versionsDir)) {
347
+ try {
348
+ const versions = fs.readdirSync(versionsDir);
349
+ for (const ver of versions) {
350
+ const cand = path.join(versionsDir, ver, 'payload', 'resources', 'app', 'prebundled', 'daemon', 'daemon-cli.mjs');
351
+ if (fs.existsSync(cand)) {
352
+ daemonCli = cand;
353
+ break;
354
+ }
355
+ }
356
+ } catch {}
357
+ }
358
+
359
+ // 3. Locate active named pipe if running
360
+ let activePipe = null;
361
+ try {
362
+ const pipeCandidates = fs.readdirSync('\\\\.\\pipe');
363
+ const odPipe = pipeCandidates.find(p => p.startsWith('open-design-sidecar-'));
364
+ if (odPipe) {
365
+ activePipe = `\\\\.\\pipe\\${odPipe}`;
366
+ }
367
+ } catch {}
368
+
369
+ if (!odExe || !daemonCli) return fallbackConfig;
370
+
371
+ const dataDir = path.join(odRoaming, 'namespaces', 'release-stable-win', 'data');
372
+ const bootstrapExe = path.join(localAppData, 'Programs', 'Open Design', 'Open Design.exe');
373
+
374
+ return {
375
+ command: odExe,
376
+ args: [daemonCli, "mcp"],
377
+ env: {
378
+ OD_DATA_DIR: dataDir,
379
+ OD_SIDECAR_CLIENT_ENDPOINT: activePipe || fallbackConfig?.env?.OD_SIDECAR_CLIENT_ENDPOINT || "\\\\.\\pipe\\open-design-sidecar-active",
380
+ OD_MCP_BOOTSTRAP_COMMAND: fs.existsSync(bootstrapExe) ? bootstrapExe : odExe,
381
+ OD_MCP_BOOTSTRAP_ARGS: "[\"--headless\"]",
382
+ ELECTRON_RUN_AS_NODE: "1"
383
+ }
384
+ };
385
+ }
386
+
387
+ /**
388
+ * Synchronizes curated and dynamic MCP servers (including OpenDesign and Context7)
389
+ * across Antigravity, Claude Desktop, and Claude Code.
390
+ */
391
+ function syncMcpServers(detected, options = {}) {
392
+ let syncedAny = false;
393
+ let mcpRegistry = {};
394
+ if (fs.existsSync(mcpConfigPath)) {
395
+ try {
396
+ mcpRegistry = JSON.parse(fs.readFileSync(mcpConfigPath, 'utf8')).mcpServers || {};
397
+ } catch {}
398
+ }
399
+
400
+ const odConfig = resolveOpenDesignMcpConfig();
401
+
402
+ // 1. Antigravity (AGY)
403
+ const agyMcpFile = path.join(userHome, '.gemini', 'config', 'mcp_config.json');
404
+ if (fs.existsSync(path.dirname(agyMcpFile))) {
405
+ let agyConfig = { mcpServers: {} };
406
+ try {
407
+ if (fs.existsSync(agyMcpFile)) {
408
+ agyConfig = JSON.parse(fs.readFileSync(agyMcpFile, 'utf8'));
409
+ }
410
+ } catch {}
411
+ if (!agyConfig.mcpServers) agyConfig.mcpServers = {};
412
+
413
+ let agyUpdated = false;
414
+ if (odConfig && JSON.stringify(agyConfig.mcpServers['open-design']) !== JSON.stringify(odConfig)) {
415
+ agyConfig.mcpServers['open-design'] = odConfig;
416
+ agyUpdated = true;
417
+ }
418
+ if (mcpRegistry.context7?.config && !agyConfig.mcpServers['context7']) {
419
+ agyConfig.mcpServers['context7'] = mcpRegistry.context7.config;
420
+ agyUpdated = true;
421
+ }
422
+
423
+ if (agyUpdated && !options.dryRun) {
424
+ fs.writeFileSync(agyMcpFile, JSON.stringify(agyConfig, null, 2), 'utf8');
425
+ console.log(` ${colors.green}✔${colors.reset} Synchronized OpenDesign MCP for Google Antigravity`);
426
+ syncedAny = true;
427
+ }
428
+ }
429
+
430
+ // 2. Claude Desktop
431
+ const claudeDesktopDir = getClaudeDesktopDir();
432
+ const claudeDesktopFile = path.join(claudeDesktopDir, 'claude_desktop_config.json');
433
+ if (fs.existsSync(claudeDesktopFile)) {
434
+ let deskConfig = { mcpServers: {} };
435
+ try { deskConfig = JSON.parse(fs.readFileSync(claudeDesktopFile, 'utf8')); } catch {}
436
+ if (!deskConfig.mcpServers) deskConfig.mcpServers = {};
437
+
438
+ let deskUpdated = false;
439
+ if (odConfig && JSON.stringify(deskConfig.mcpServers['open-design']) !== JSON.stringify(odConfig)) {
440
+ deskConfig.mcpServers['open-design'] = odConfig;
441
+ deskUpdated = true;
442
+ }
443
+ if (mcpRegistry.context7?.config && !deskConfig.mcpServers['context7']) {
444
+ deskConfig.mcpServers['context7'] = mcpRegistry.context7.config;
445
+ deskUpdated = true;
446
+ }
447
+
448
+ if (deskUpdated && !options.dryRun) {
449
+ fs.writeFileSync(claudeDesktopFile, JSON.stringify(deskConfig, null, 2), 'utf8');
450
+ console.log(` ${colors.green}✔${colors.reset} Synchronized OpenDesign & Context7 MCP for Claude Desktop`);
451
+ syncedAny = true;
452
+ }
453
+ }
454
+
455
+ // 3. Claude Code CLI
456
+ const claudeConfigFile = path.join(userHome, '.claude.json');
457
+ if (fs.existsSync(claudeConfigFile)) {
458
+ let claudeConfig = {};
459
+ try { claudeConfig = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8')); } catch {}
460
+ if (!claudeConfig.mcpServers) claudeConfig.mcpServers = {};
461
+
462
+ let claudeUpdated = false;
463
+ if (odConfig && JSON.stringify(claudeConfig.mcpServers['open-design']) !== JSON.stringify(odConfig)) {
464
+ claudeConfig.mcpServers['open-design'] = odConfig;
465
+ claudeUpdated = true;
466
+ }
467
+
468
+ if (claudeUpdated && !options.dryRun) {
469
+ fs.writeFileSync(claudeConfigFile, JSON.stringify(claudeConfig, null, 2), 'utf8');
470
+ console.log(` ${colors.green}✔${colors.reset} Synchronized OpenDesign MCP for Claude Code`);
471
+ syncedAny = true;
472
+ }
473
+ }
474
+
475
+ return syncedAny;
476
+ }
477
+
478
+ /**
479
+ * Audits registered and configured MCP servers across harnesses.
480
+ */
481
+ function auditMcpServers() {
482
+ const results = [];
483
+ const agyMcpFile = path.join(userHome, '.gemini', 'config', 'mcp_config.json');
484
+ if (fs.existsSync(agyMcpFile)) {
485
+ try {
486
+ const cfg = JSON.parse(fs.readFileSync(agyMcpFile, 'utf8'));
487
+ results.push({ harness: 'Google Antigravity', server: 'open-design', configured: Boolean(cfg.mcpServers?.['open-design']) });
488
+ results.push({ harness: 'Google Antigravity', server: 'context7', configured: Boolean(cfg.mcpServers?.['context7']) });
489
+ } catch {}
490
+ }
491
+ const claudeDesktopFile = path.join(getClaudeDesktopDir(), 'claude_desktop_config.json');
492
+ if (fs.existsSync(claudeDesktopFile)) {
493
+ try {
494
+ const cfg = JSON.parse(fs.readFileSync(claudeDesktopFile, 'utf8'));
495
+ results.push({ harness: 'Claude Desktop', server: 'open-design', configured: Boolean(cfg.mcpServers?.['open-design']) });
496
+ results.push({ harness: 'Claude Desktop', server: 'context7', configured: Boolean(cfg.mcpServers?.['context7']) });
497
+ } catch {}
498
+ }
499
+ const claudeConfigFile = path.join(userHome, '.claude.json');
500
+ if (fs.existsSync(claudeConfigFile)) {
501
+ try {
502
+ const cfg = JSON.parse(fs.readFileSync(claudeConfigFile, 'utf8'));
503
+ results.push({ harness: 'Claude Code', server: 'open-design', configured: Boolean(cfg.mcpServers?.['open-design']) });
504
+ } catch {}
505
+ }
506
+ return results;
507
+ }
508
+
169
509
  /**
170
510
  * Resiliently discovers the OpenAI Codex CLI binary on PATH and standard Windows/POSIX install paths.
171
511
  */
@@ -283,53 +623,45 @@ function configureHermesExternalDirs(hermesDir, dryRun = false) {
283
623
  }
284
624
 
285
625
  /**
286
- * Dynamically discovers candidate tools/bin directories registered in the user's PATH.
287
- * Never assumes a hardcoded system path.
626
+ * Ensures Hermes Agent config.yaml has maximum context_length set for active models.
288
627
  */
289
- function detectPathCandidates() {
290
- const pathEnv = process.env.PATH || '';
291
- const delimiter = path.delimiter;
292
- const rawDirs = pathEnv.split(delimiter).map(d => d.trim()).filter(Boolean);
293
- const candidates = [];
294
- const seen = new Set();
295
-
296
- for (const raw of rawDirs) {
628
+ function configureHermesContextLimit(hermesDir, modelsList = null, dryRun = false) {
629
+ if (!fs.existsSync(path.join(hermesDir, 'config.yaml'))) return false;
630
+
631
+ let contextMap = {};
632
+ if (Array.isArray(modelsList) && modelsList.length > 0) {
633
+ for (const m of modelsList) {
634
+ if (m.id && m.context_window_tokens) {
635
+ contextMap[m.id] = m.context_window_tokens;
636
+ }
637
+ }
638
+ } else if (fs.existsSync(modelsPath)) {
297
639
  try {
298
- const resolved = path.resolve(raw);
299
- const lower = resolved.toLowerCase();
300
- if (seen.has(lower)) continue;
301
- seen.add(lower);
302
-
303
- if (fs.existsSync(resolved)) {
304
- // Exclude system directories
305
- const isSystem = lower.includes('\\windows\\system32') ||
306
- lower.includes('\\windows\\system') ||
307
- lower.includes('/usr/sbin') ||
308
- lower.includes('/sbin') ||
309
- lower.includes('\\powershell');
310
- if (!isSystem) {
311
- const isToolLike = lower.includes('tool') ||
312
- lower.includes('bin') ||
313
- lower.includes('.local') ||
314
- lower.includes('apps') ||
315
- lower.includes('npm') ||
316
- lower.includes('cargo') ||
317
- lower.includes('heimdall');
318
- if (isToolLike) {
319
- candidates.push(resolved);
320
- }
321
- }
640
+ const catalog = JSON.parse(fs.readFileSync(modelsPath, 'utf8'));
641
+ const allModels = [...(catalog.ghostcli || []), ...(catalog.custom_proxies || []), ...(catalog.google || [])];
642
+ for (const m of allModels) {
643
+ const resolved = resolveModelMaxContext(m, { prioritizeMax: true });
644
+ contextMap[m.id] = resolved.tokens;
322
645
  }
323
646
  } catch {}
324
647
  }
325
648
 
326
- // Fallback candidate if none detected
327
- const defaultUserTools = path.join(userHome, '.heimdall', 'bin');
328
- if (candidates.length === 0) {
329
- candidates.push(defaultUserTools);
649
+ // Ensure both canonical and [1m] suffixed model names are registered
650
+ for (const [id, tokens] of Object.entries({ ...contextMap })) {
651
+ if (!id.endsWith('[1m]')) {
652
+ contextMap[`${id}[1m]`] = tokens;
653
+ }
330
654
  }
331
655
 
332
- return candidates;
656
+ // Ensure default fallbacks for common models
657
+ if (!contextMap['claude-opus-5-5']) contextMap['claude-opus-5-5'] = 1000000;
658
+ if (!contextMap['claude-sonnet-5']) contextMap['claude-sonnet-5'] = 1000000;
659
+ if (!contextMap['claude-fable-5.1']) contextMap['claude-fable-5.1'] = 1000000;
660
+ if (!contextMap['gpt-6-astra']) contextMap['gpt-6-astra'] = 1000000;
661
+ if (!contextMap['z-ai/glm-5.3']) contextMap['z-ai/glm-5.3'] = 1000000;
662
+ if (!contextMap['z-ai/glm-5.3-flash']) contextMap['z-ai/glm-5.3-flash'] = 1000000;
663
+
664
+ return updateHermesConfigContext(hermesDir, contextMap, dryRun);
333
665
  }
334
666
 
335
667
  /**
@@ -381,9 +713,9 @@ function detectEnvironment() {
381
713
  detected.tools.cursor = checkCommand('cursor');
382
714
  detected.tools.windsurf = checkCommand('windsurf');
383
715
 
384
- // 2. Check Claude Desktop directory (Windows, macOS, Linux)
385
- const claudeDesktopDir = getClaudeDesktopDir();
386
- detected.tools.claudeDesktop = fs.existsSync(claudeDesktopDir) ? claudeDesktopDir : null;
716
+ // 2. Check Claude Desktop (executable or existing config file)
717
+ const desktopStatus = detectClaudeDesktop();
718
+ detected.tools.claudeDesktop = desktopStatus.detected ? desktopStatus.dir : null;
387
719
 
388
720
  // 3. Check Claude Code endpoint
389
721
  const claudeSettingsPath = path.join(userHome, '.claude', 'settings.json');
@@ -482,6 +814,7 @@ ${colors.dim}Note: 'heimdall' and 'node setup.mjs' are identical. 'heimdall' is
482
814
 
483
815
  ${colors.bold}PRIMARY SUBCOMMANDS:${colors.reset}
484
816
  ${colors.green}sync${colors.reset} (or ${colors.dim}--sync${colors.reset}) Scan PATH for newly installed AI tools and link skills (1-sec zero-drift)
817
+ ${colors.green}sync-docs${colors.reset} (or ${colors.dim}--sync-docs${colors.reset}) Synchronize documentation and config count references from Single Source of Truth
485
818
  ${colors.green}audit${colors.reset} (or ${colors.dim}--audit${colors.reset}) Audit installed harnesses, active API endpoints, and skill counts
486
819
  ${colors.green}uninstall${colors.reset} (or ${colors.dim}--uninstall${colors.reset}) Safely remove Heimdall skills and agent personas from all harnesses
487
820
  ${colors.green}sync-models${colors.reset} (or ${colors.dim}--sync-models${colors.reset}) Probe active proxy/endpoint (e.g. Custom Proxies / API or Custom Vendors) and refresh models.json
@@ -490,7 +823,7 @@ ${colors.bold}PRIMARY SUBCOMMANDS:${colors.reset}
490
823
  ${colors.green}help${colors.reset} (or ${colors.dim}--help, -h${colors.reset}) Display this parameter and command reference
491
824
 
492
825
  ${colors.bold}SETUP & BOOTSTRAP OPTIONS:${colors.reset}
493
- ${colors.yellow}--profile <name>${colors.reset} Skill profile tier: full (50), minimal (16), security (12), design (14) [default: full]
826
+ ${colors.yellow}--profile <name>${colors.reset} Skill profile tier: full (64), minimal (16), security (12), design (14) [default: full]
494
827
  ${colors.yellow}--agents <targets>${colors.reset} Comma-separated harnesses: claude, gemini, codex, hermes, openclaw, desktop, all [default: all]
495
828
  ${colors.yellow}--link / --no-link${colors.reset} Use live NTFS junctions / symlinks vs static copies [default: false in wizard, true recommended]
496
829
  ${colors.yellow}--clean${colors.reset} Wipe legacy skills from target directory before deploying
@@ -523,6 +856,7 @@ function parseArgs() {
523
856
  link: false,
524
857
  clean: false,
525
858
  sync: false,
859
+ syncDocs: false,
526
860
  uninstall: false,
527
861
  tools: true,
528
862
  doctrine: true,
@@ -545,6 +879,7 @@ function parseArgs() {
545
879
  if (arg === 'help' || arg === '--help' || arg === '-h') options.help = true;
546
880
  else if (arg === 'audit' || arg === '--audit') options.audit = true;
547
881
  else if (arg === 'sync' || arg === '--sync') options.sync = true;
882
+ else if (arg === 'sync-docs' || arg === '--sync-docs' || arg === 'syncdocs') options.syncDocs = true;
548
883
  else if (arg === 'uninstall' || arg === '--uninstall') options.uninstall = true;
549
884
  else if (arg === 'sync-models' || arg === '--sync-models' || arg === 'syncmodels') options.syncModels = true;
550
885
  else if (arg === 'skills' || arg === '--skills') options.listSkills = true;
@@ -600,7 +935,9 @@ function cleanTargetDirectory(targetDir, dryRun = false, preserveList = ['.syste
600
935
 
601
936
  function registerClaudeHooks(targetHookDir, dryRun = false) {
602
937
  if (dryRun) return;
603
- const claudeSettingsPath = path.join(userHome, '.claude', 'settings.json');
938
+ const claudeDir = path.join(userHome, '.claude');
939
+ if (!fs.existsSync(claudeDir)) return;
940
+ const claudeSettingsPath = path.join(claudeDir, 'settings.json');
604
941
  const hooksJsonSrc = path.join(hooksDir, 'hooks.json');
605
942
  if (!fs.existsSync(hooksJsonSrc)) return;
606
943
 
@@ -629,6 +966,8 @@ function registerClaudeHooks(targetHookDir, dryRun = false) {
629
966
 
630
967
  function linkDirectory(src, dest, dryRun = false) {
631
968
  if (dryRun) return;
969
+ const parentDir = path.dirname(dest);
970
+ if (!fs.existsSync(parentDir)) return;
632
971
  if (fs.existsSync(dest)) {
633
972
  try {
634
973
  const stat = fs.lstatSync(dest);
@@ -673,6 +1012,8 @@ function copyDirectory(src, dest, dryRun = false) {
673
1012
 
674
1013
  function deployAgentContracts(targetDir, link = false, clean = false, dryRun = false, agentsList = null) {
675
1014
  if (!fs.existsSync(agentsDir)) return 0;
1015
+ const parentDir = path.dirname(targetDir);
1016
+ if (!fs.existsSync(parentDir)) return 0;
676
1017
  const allFiles = fs.readdirSync(agentsDir).filter(f => f.endsWith('.md'));
677
1018
  const agentFiles = agentsList ? allFiles.filter(f => agentsList.includes(f)) : allFiles;
678
1019
 
@@ -747,17 +1088,7 @@ function deployGlobalShims(targetToolsDir, dryRun = false) {
747
1088
  async function syncModelsFromEndpoint() {
748
1089
  console.log(`${colors.cyan}${colors.bold}=== Live Model Synchronization ===${colors.reset}\n`);
749
1090
  const detected = detectEnvironment();
750
- let proxyUrl = detected.endpoints.claude || detected.endpoints.codex;
751
-
752
- let targetUrl = null;
753
- if (proxyUrl && proxyUrl.startsWith('http')) {
754
- if (proxyUrl.includes('ghostcli.cloud')) {
755
- targetUrl = 'https://ghostcli.cloud/v1/models';
756
- } else if (!proxyUrl.includes('api.anthropic.com') && !proxyUrl.includes('api.openai.com')) {
757
- const base = proxyUrl.replace(/\/+$/, '');
758
- targetUrl = base.endsWith('/v1') ? `${base}/models` : (base.endsWith('/models') ? base : `${base}/v1/models`);
759
- }
760
- }
1091
+ const targetUrl = resolveCustomModelsEndpoint(detected.endpoints);
761
1092
 
762
1093
  if (targetUrl) {
763
1094
  console.log(`Probing Proxy / Vendor Models API: ${colors.yellow}${targetUrl}${colors.reset}...`);
@@ -773,18 +1104,82 @@ async function syncModelsFromEndpoint() {
773
1104
  currentModels = JSON.parse(fs.readFileSync(modelsPath, 'utf8'));
774
1105
  }
775
1106
 
776
- const mapped = modelsList.map(m => ({
777
- id: m.id || m.slug,
778
- displayName: m.display_name || m.id,
779
- context: m.context_window ? `${Math.round(m.context_window / 1000)}K` : '1M',
780
- description: m.description || ''
1107
+ console.log(`Checking live health of discovered models...`);
1108
+ const apiKey = detected.endpoints.claude_key || detected.endpoints.codex_key || process.env.ANTHROPIC_API_KEY || process.env.GHOSTCLI_API_KEY || '';
1109
+ const baseUrl = targetUrl.replace(/\/v1\/models\/?$/, '');
1110
+
1111
+ const testedModels = await Promise.all(modelsList.map(async m => {
1112
+ const modelId = m.id || m.slug;
1113
+ let isAlive = true;
1114
+
1115
+ if (apiKey) {
1116
+ try {
1117
+ const controller = new AbortController();
1118
+ const timeout = setTimeout(() => controller.abort(), 8000);
1119
+ const testRes = await fetch(`${baseUrl}/v1/messages`, {
1120
+ method: 'POST',
1121
+ headers: {
1122
+ 'x-api-key': apiKey,
1123
+ 'anthropic-version': '2023-06-01',
1124
+ 'content-type': 'application/json'
1125
+ },
1126
+ body: JSON.stringify({
1127
+ model: modelId,
1128
+ max_tokens: 5,
1129
+ messages: [{ role: 'user', content: 'hi' }]
1130
+ }),
1131
+ signal: controller.signal
1132
+ });
1133
+ clearTimeout(timeout);
1134
+ isAlive = testRes.ok;
1135
+ } catch {
1136
+ isAlive = false;
1137
+ }
1138
+ }
1139
+
1140
+ return { raw: m, modelId, isAlive };
781
1141
  }));
782
1142
 
1143
+ const liveModels = testedModels.filter(t => t.isAlive);
1144
+ const deadModels = testedModels.filter(t => !t.isAlive);
1145
+
1146
+ if (deadModels.length > 0) {
1147
+ console.log(`${colors.yellow}⚠ Filtered out ${deadModels.length} unresponsive model(s): ${deadModels.map(d => d.modelId).join(', ')}${colors.reset}\n`);
1148
+ }
1149
+
1150
+ const mapped = liveModels.map(({ raw: m }) => {
1151
+ const resolved = resolveModelMaxContext(m, { prioritizeMax: true });
1152
+ return {
1153
+ id: m.id || m.slug,
1154
+ displayName: m.display_name || m.id,
1155
+ context: resolved.label,
1156
+ context_window_tokens: resolved.tokens,
1157
+ description: m.description || ''
1158
+ };
1159
+ });
1160
+
783
1161
  currentModels.custom_proxies = mapped;
784
1162
  currentModels.ghostcli = mapped;
785
1163
 
786
1164
  fs.writeFileSync(modelsPath, JSON.stringify(currentModels, null, 2));
787
1165
  console.log(`${colors.green}✔ Synchronized models catalog to config/models.json${colors.reset}\n`);
1166
+
1167
+ console.log(`${colors.bold}Available Models Catalog (${mapped.length} models):${colors.reset}`);
1168
+ mapped.forEach(m => {
1169
+ const idStr = `${colors.cyan}${m.id.padEnd(24)}${colors.reset}`;
1170
+ const ctxStr = `${colors.yellow}[${m.context}]${colors.reset}`;
1171
+ const descStr = m.description ? `${colors.dim}— ${m.description}${colors.reset}` : '';
1172
+ console.log(` • ${idStr} ${ctxStr} ${descStr}`);
1173
+ });
1174
+ console.log('');
1175
+
1176
+ const hermesDir = getHermesDir();
1177
+ if (fs.existsSync(hermesDir)) {
1178
+ const hermesContextUpdated = configureHermesContextLimit(hermesDir, mapped);
1179
+ if (hermesContextUpdated) {
1180
+ console.log(`${colors.green}✔ Enforced maximum context limits in Hermes config.yaml${colors.reset}\n`);
1181
+ }
1182
+ }
788
1183
  } else {
789
1184
  console.log(`${colors.yellow}Notice: Endpoint returned HTTP ${res.status}. Preserving cached models.json.${colors.reset}\n`);
790
1185
  }
@@ -798,6 +1193,12 @@ async function syncModelsFromEndpoint() {
798
1193
 
799
1194
  async function runSync(options, detected) {
800
1195
  console.log(`${colors.bold}${colors.cyan}=== Heimdall Auto-Sync Engine ===${colors.reset}\n`);
1196
+
1197
+ const countSyncResult = syncCatalogCounts(__dirname, options.dryRun);
1198
+ if (countSyncResult && countSyncResult.modified) {
1199
+ console.log(` ${colors.green}✔ Synchronized documentation & catalog counts (${countSyncResult.suiteCount} suites / ${countSyncResult.skillCount} modules)${colors.reset}\n`);
1200
+ }
1201
+
801
1202
  console.log(`Scanning for newly installed AI tools on PATH...\n`);
802
1203
 
803
1204
  const allAvailableSkills = fs.readdirSync(skillsDir, { withFileTypes: true })
@@ -811,17 +1212,17 @@ async function runSync(options, detected) {
811
1212
  let syncedAny = false;
812
1213
 
813
1214
  for (const [agent, targetDir] of Object.entries(targetPaths)) {
814
- let toolInstalled = false;
815
- if (agent === 'claude' && detected.tools.claude) toolInstalled = true;
816
- else if (agent === 'gemini' && (detected.tools.agy || fs.existsSync(path.join(userHome, '.gemini', 'antigravity-cli')))) toolInstalled = true;
817
- else if (agent === 'codex' && detected.tools.codex) toolInstalled = true;
818
- else if (agent === 'agents') toolInstalled = true;
819
- else if (agent === 'hermes' && (detected.tools.hermes || fs.existsSync(getHermesDir()))) {
820
- toolInstalled = true;
1215
+ if (!isAgentConfigurable(agent)) continue;
1216
+
1217
+ if (agent === 'hermes') {
821
1218
  configureHermesExternalDirs(getHermesDir(), false);
1219
+ const hermesContextUpdated = configureHermesContextLimit(getHermesDir(), null, false);
1220
+ if (hermesContextUpdated) {
1221
+ console.log(` ${colors.green}✔ Enforced maximum context limits in Hermes config.yaml${colors.reset}`);
1222
+ }
822
1223
  }
823
- else if (agent === 'openclaw' && (detected.tools.openclaw || fs.existsSync(getOpenClawDir()))) toolInstalled = true;
824
1224
 
1225
+ const toolInstalled = true;
825
1226
  if (toolInstalled) {
826
1227
  // Synchronize doctrine, playbooks & commands unconditionally for installed harnesses
827
1228
  const targetDocFile = targetDoctrinePaths[agent];
@@ -888,24 +1289,9 @@ async function runSync(options, detected) {
888
1289
  }
889
1290
  }
890
1291
 
891
- // Check Claude Desktop
892
- if (detected.tools.claudeDesktop) {
893
- const claudeDesktopFile = path.join(detected.tools.claudeDesktop, 'claude_desktop_config.json');
894
- let deskConfig = { mcpServers: {} };
895
- if (fs.existsSync(claudeDesktopFile)) {
896
- try { deskConfig = JSON.parse(fs.readFileSync(claudeDesktopFile, 'utf8')); } catch {}
897
- }
898
- if (!deskConfig.mcpServers?.context7) {
899
- if (!deskConfig.mcpServers) deskConfig.mcpServers = {};
900
- deskConfig.mcpServers.context7 = {
901
- command: "npx",
902
- args: ["-y", "@upstash/context7-mcp"]
903
- };
904
- fs.writeFileSync(claudeDesktopFile, JSON.stringify(deskConfig, null, 2));
905
- console.log(` ${colors.green}✔${colors.reset} Configured Context7 MCP for Claude Desktop`);
906
- syncedAny = true;
907
- }
908
- }
1292
+ // Synchronize Model Context Protocol (MCP) servers (OpenDesign, Context7, etc.)
1293
+ const mcpSynced = syncMcpServers(detected, options);
1294
+ if (mcpSynced) syncedAny = true;
909
1295
 
910
1296
  // Refresh bridge tools & shims
911
1297
  const activeToolsDir = options.toolsDir || detected.pathCandidates[0];
@@ -913,6 +1299,16 @@ async function runSync(options, detected) {
913
1299
  deployGlobalShims(activeToolsDir, false);
914
1300
  }
915
1301
 
1302
+ // Refresh active workspace doctrine files
1303
+ const srcDoc = path.join(doctrineDir, 'AGENTS.md');
1304
+ if (fs.existsSync(srcDoc)) {
1305
+ for (const cand of detected.doctrineCandidates) {
1306
+ if (fs.existsSync(cand)) {
1307
+ try { fs.copyFileSync(srcDoc, cand); } catch {}
1308
+ }
1309
+ }
1310
+ }
1311
+
916
1312
  if (syncedAny) {
917
1313
  console.log(`\n${colors.bold}${colors.green}✔ Auto-sync complete! All active AI tools are now synchronized.${colors.reset}\n`);
918
1314
  } else {
@@ -969,50 +1365,44 @@ function runAudit(options) {
969
1365
  const unlinkedTools = [];
970
1366
 
971
1367
  for (const [agent, targetDir] of Object.entries(targetPaths)) {
1368
+ const rootDir = getAgentRootDir(agent);
972
1369
  const targetAgentDir = targetAgentPaths[agent];
973
- if (fs.existsSync(targetDir)) {
974
- const entries = fs.readdirSync(targetDir, { withFileTypes: true })
975
- .filter(d => (d.isDirectory() || d.isSymbolicLink()) && d.name !== '.system');
976
-
977
- let linkedCount = 0;
978
- for (const entry of entries) {
979
- try {
980
- if (fs.lstatSync(path.join(targetDir, entry.name)).isSymbolicLink()) {
981
- linkedCount++;
982
- }
983
- } catch {}
984
- }
1370
+ if (isAgentConfigurable(agent)) {
1371
+ if (fs.existsSync(targetDir)) {
1372
+ const entries = fs.readdirSync(targetDir, { withFileTypes: true })
1373
+ .filter(d => (d.isDirectory() || d.isSymbolicLink()) && d.name !== '.system');
1374
+
1375
+ let linkedCount = 0;
1376
+ for (const entry of entries) {
1377
+ try {
1378
+ if (fs.lstatSync(path.join(targetDir, entry.name)).isSymbolicLink()) {
1379
+ linkedCount++;
1380
+ }
1381
+ } catch {}
1382
+ }
985
1383
 
986
- const installed = entries.map(d => d.name);
987
- const missing = availableSkills.filter(s => !installed.includes(s));
988
- const statusColor = missing.length === 0 ? colors.green : colors.yellow;
989
- const linkLabel = linkedCount === installed.length && installed.length > 0
990
- ? ` (${colors.cyan}Live Junctions / Single Source of Truth${colors.reset})`
991
- : linkedCount > 0 ? ` (${linkedCount} linked, ${installed.length - linkedCount} copies)` : ' (Static copies)';
1384
+ const installed = entries.map(d => d.name);
1385
+ const missing = availableSkills.filter(s => !installed.includes(s));
1386
+ const statusColor = missing.length === 0 ? colors.green : colors.yellow;
1387
+ const linkLabel = linkedCount === installed.length && installed.length > 0
1388
+ ? ` (${colors.cyan}Live Junctions / Single Source of Truth${colors.reset})`
1389
+ : linkedCount > 0 ? ` (${linkedCount} linked, ${installed.length - linkedCount} copies)` : ' (Static copies)';
992
1390
 
993
- const agentCount = fs.existsSync(targetAgentDir)
994
- ? fs.readdirSync(targetAgentDir).filter(f => f.endsWith('.md')).length
995
- : 0;
1391
+ const agentCount = fs.existsSync(targetAgentDir)
1392
+ ? fs.readdirSync(targetAgentDir).filter(f => f.endsWith('.md')).length
1393
+ : 0;
996
1394
 
997
- console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${statusColor}${installed.length} skills, ${agentCount} agents${colors.reset} in ${path.dirname(targetDir)}${linkLabel}`);
1395
+ console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${statusColor}${installed.length} skills, ${agentCount} agents${colors.reset} in ${rootDir}${linkLabel}`);
998
1396
 
999
- if (installed.length === 0) {
1397
+ if (installed.length === 0) {
1398
+ unlinkedTools.push(agent);
1399
+ }
1400
+ } else {
1401
+ console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${colors.yellow}INSTALLED BUT NOT LINKED (${targetDir})${colors.reset}`);
1000
1402
  unlinkedTools.push(agent);
1001
1403
  }
1002
1404
  } else {
1003
- const isHermesOrOpenClaw = agent === 'hermes' || agent === 'openclaw';
1004
- const isToolDetected = (agent === 'hermes' && (detected.tools.hermes || fs.existsSync(getHermesDir()))) ||
1005
- (agent === 'openclaw' && (detected.tools.openclaw || fs.existsSync(getOpenClawDir())));
1006
- if (!isHermesOrOpenClaw || isToolDetected) {
1007
- console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${colors.dim}NOT LINKED (${targetDir})${colors.reset}`);
1008
- }
1009
- if ((agent === 'claude' && detected.tools.claude) ||
1010
- (agent === 'gemini' && detected.tools.agy) ||
1011
- (agent === 'codex' && detected.tools.codex) ||
1012
- (agent === 'hermes' && (detected.tools.hermes || fs.existsSync(getHermesDir()))) ||
1013
- (agent === 'openclaw' && (detected.tools.openclaw || fs.existsSync(getOpenClawDir())))) {
1014
- unlinkedTools.push(agent);
1015
- }
1405
+ console.log(` ${colors.bold}${agent.toUpperCase().padEnd(8)}${colors.reset} -> ${colors.dim}Not found (${rootDir || 'unconfigured'})${colors.reset}`);
1016
1406
  }
1017
1407
  }
1018
1408
 
@@ -1038,6 +1428,17 @@ function runAudit(options) {
1038
1428
  console.log(` ${colors.dim}Not found at ${activeDoctrine}${colors.reset}`);
1039
1429
  }
1040
1430
 
1431
+ console.log(`\n${colors.bold}Model Context Protocol (MCP) Servers:${colors.reset}`);
1432
+ const mcpReport = auditMcpServers();
1433
+ if (mcpReport.length > 0) {
1434
+ for (const item of mcpReport) {
1435
+ const status = item.configured ? `${colors.green}Configured${colors.reset}` : `${colors.dim}Not configured${colors.reset}`;
1436
+ console.log(` ${item.harness.padEnd(20)} [${item.server}] -> ${status}`);
1437
+ }
1438
+ } else {
1439
+ console.log(` ${colors.dim}No MCP server harnesses detected.${colors.reset}`);
1440
+ }
1441
+
1041
1442
  console.log('');
1042
1443
  }
1043
1444
 
@@ -1204,40 +1605,54 @@ async function runUninstall(options, detected) {
1204
1605
 
1205
1606
  async function runPostInstallMenu(options, detected) {
1206
1607
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
1608
+ const hasCustomApi = Boolean(resolveCustomModelsEndpoint(detected.endpoints));
1207
1609
  try {
1208
1610
  console.log(`${colors.bold}${colors.cyan}=== Heimdall Management Hub ===${colors.reset}`);
1209
1611
  console.log(`Heimdall is currently installed and active across your environment.\n`);
1210
1612
  console.log(`What would you like to do?`);
1211
- console.log(` 1. Audit Environment & Health Check`);
1212
- console.log(` 2. Fast Sync Skills & Agents (1-sec zero-drift)`);
1213
- console.log(` 3. Refresh Dynamic Models (sync-models)`);
1214
- console.log(` 4. Uninstall Heimdall`);
1215
- console.log(` 5. Reinstall / Reconfigure Profile & Targets`);
1216
- console.log(` 6. Exit\n`);
1217
-
1218
- const answer = await rl.question(`Choose an option [1-6, default: 1]: `);
1613
+
1614
+ const menuItems = [
1615
+ { label: 'Audit Environment & Health Check', action: 'audit' },
1616
+ { label: 'Fast Sync Skills & Agents (1-sec zero-drift)', action: 'sync' },
1617
+ ...(hasCustomApi ? [{ label: 'Refresh Dynamic Models (sync-models)', action: 'sync-models' }] : []),
1618
+ { label: 'Uninstall Heimdall', action: 'uninstall' },
1619
+ { label: 'Reinstall / Reconfigure Profile & Targets', action: 'reinstall' },
1620
+ { label: 'Exit', action: 'exit' }
1621
+ ];
1622
+
1623
+ menuItems.forEach((item, idx) => {
1624
+ console.log(` ${idx + 1}. ${item.label}`);
1625
+ });
1626
+ console.log('');
1627
+
1628
+ const answer = await rl.question(`Choose an option [1-${menuItems.length}, default: 1]: `);
1219
1629
  const choice = answer.trim().toLowerCase();
1220
1630
 
1221
- if (choice === '1' || choice === '') {
1631
+ if (choice === 'q' || choice === 'exit') {
1632
+ console.log('Goodbye!');
1633
+ process.exit(0);
1634
+ }
1635
+
1636
+ const idx = choice === '' ? 0 : parseInt(choice, 10) - 1;
1637
+ const selected = menuItems[idx] ? menuItems[idx].action : 'audit';
1638
+
1639
+ if (selected === 'audit') {
1222
1640
  runAudit(options);
1223
1641
  process.exit(0);
1224
- } else if (choice === '2') {
1642
+ } else if (selected === 'sync') {
1225
1643
  await runSync(options, detected);
1226
1644
  process.exit(0);
1227
- } else if (choice === '3') {
1645
+ } else if (selected === 'sync-models') {
1228
1646
  await syncModelsFromEndpoint();
1229
1647
  process.exit(0);
1230
- } else if (choice === '4') {
1648
+ } else if (selected === 'uninstall') {
1231
1649
  await runUninstall(options, detected);
1232
1650
  process.exit(0);
1233
- } else if (choice === '5') {
1651
+ } else if (selected === 'reinstall') {
1234
1652
  return 'reinstall';
1235
- } else if (choice === '6' || choice === 'q' || choice === 'exit') {
1653
+ } else if (selected === 'exit') {
1236
1654
  console.log('Goodbye!');
1237
1655
  process.exit(0);
1238
- } else {
1239
- runAudit(options);
1240
- process.exit(0);
1241
1656
  }
1242
1657
  } finally {
1243
1658
  rl.close();
@@ -1287,7 +1702,7 @@ async function runInteractive(options, detected) {
1287
1702
  }
1288
1703
 
1289
1704
  console.log(`\n${colors.yellow}Select Installation Profile Tier:${colors.reset}`);
1290
- console.log(` 1. full - All 50 curated skills (Complete Powerhouse)`);
1705
+ console.log(` 1. full - All 64 curated skills (Complete Powerhouse)`);
1291
1706
  console.log(` 2. minimal - 16 core skills (Planning, TDD, Anti-Slop, Taste, Hygiene)`);
1292
1707
  console.log(` 3. security - 12 security skills (Differential HTTP probing, OWASP, Trail of Bits)`);
1293
1708
  console.log(` 4. design - 14 frontend skills (Taste, GSAP motion, Brandkit, Tokens)`);
@@ -1476,6 +1891,7 @@ function runUpdateSkill(targetSkill = 'all') {
1476
1891
 
1477
1892
  async function main() {
1478
1893
  printBanner();
1894
+ await checkForUpdates();
1479
1895
  const options = parseArgs();
1480
1896
  const detected = detectEnvironment();
1481
1897
 
@@ -1504,6 +1920,16 @@ async function main() {
1504
1920
  process.exit(0);
1505
1921
  }
1506
1922
 
1923
+ if (options.syncDocs) {
1924
+ const res = syncCatalogCounts(__dirname, options.dryRun);
1925
+ if (res) {
1926
+ console.log(`${colors.green}✔ Documentation and catalog counts synchronized (${res.suiteCount} suites / ${res.skillCount} modules).${colors.reset}\n`);
1927
+ } else {
1928
+ console.log(`${colors.red}Failed to synchronize catalog counts.${colors.reset}\n`);
1929
+ }
1930
+ process.exit(0);
1931
+ }
1932
+
1507
1933
  if (options.sync) {
1508
1934
  await runSync(options, detected);
1509
1935
  process.exit(0);
@@ -1564,21 +1990,25 @@ async function main() {
1564
1990
  // 2. Resolve destination agent directories
1565
1991
  let activeDestinations = [];
1566
1992
  if (options.agents.includes('all')) {
1567
- activeDestinations = Object.entries(targetPaths).filter(([agent]) => {
1568
- if (agent === 'openclaw') return Boolean(detected.tools.openclaw || fs.existsSync(getOpenClawDir()));
1569
- if (agent === 'hermes') return Boolean(detected.tools.hermes || fs.existsSync(getHermesDir()));
1570
- return true;
1571
- });
1993
+ activeDestinations = Object.entries(targetPaths).filter(([agent]) => isAgentConfigurable(agent));
1572
1994
  } else {
1573
1995
  for (const agent of options.agents) {
1574
1996
  if (targetPaths[agent]) {
1575
- activeDestinations.push([agent, targetPaths[agent]]);
1997
+ if (isAgentConfigurable(agent)) {
1998
+ activeDestinations.push([agent, targetPaths[agent]]);
1999
+ } else {
2000
+ const rootDir = getAgentRootDir(agent);
2001
+ console.log(`\n-> ${colors.bold}${agent.toUpperCase()}${colors.reset} directory not found at ${rootDir} (skipped; only configured if exists)`);
2002
+ }
1576
2003
  }
1577
2004
  }
1578
2005
  }
1579
2006
 
1580
2007
  // 3. Clean and deploy skills
1581
2008
  for (const [agent, targetDir] of activeDestinations) {
2009
+ const rootDir = getAgentRootDir(agent);
2010
+ if (!rootDir || !fs.existsSync(rootDir)) continue;
2011
+
1582
2012
  console.log(`\n-> Deploying to ${colors.bold}${agent.toUpperCase()}${colors.reset} (${targetDir})...`);
1583
2013
  if (!options.dryRun && !fs.existsSync(targetDir)) {
1584
2014
  fs.mkdirSync(targetDir, { recursive: true });
@@ -1611,6 +2041,10 @@ async function main() {
1611
2041
  if (hermesConfigured) {
1612
2042
  console.log(` ${colors.green}✔ Registered ~/.agents/skills in Hermes config.yaml external_dirs${colors.reset}`);
1613
2043
  }
2044
+ const hermesContextUpdated = configureHermesContextLimit(getHermesDir(), null, options.dryRun);
2045
+ if (hermesContextUpdated) {
2046
+ console.log(` ${colors.green}✔ Enforced maximum context limits in Hermes config.yaml${colors.reset}`);
2047
+ }
1614
2048
  }
1615
2049
  }
1616
2050
 
@@ -1640,35 +2074,16 @@ async function main() {
1640
2074
  }
1641
2075
  }
1642
2076
 
1643
- // 4. Configure Claude Desktop if selected or in 'all'
1644
- if (options.agents.includes('desktop') || options.agents.includes('all')) {
1645
- const claudeDesktopDir = getClaudeDesktopDir();
1646
- const claudeDesktopFile = path.join(claudeDesktopDir, 'claude_desktop_config.json');
1647
-
1648
- console.log(`\n-> Configuring Claude Desktop (${claudeDesktopFile})...`);
1649
- if (!options.dryRun) {
1650
- if (!fs.existsSync(claudeDesktopDir)) fs.mkdirSync(claudeDesktopDir, { recursive: true });
1651
- let deskConfig = { mcpServers: {} };
1652
- if (fs.existsSync(claudeDesktopFile)) {
1653
- try { deskConfig = JSON.parse(fs.readFileSync(claudeDesktopFile, 'utf8')); } catch {}
1654
- }
1655
- if (!deskConfig.mcpServers) deskConfig.mcpServers = {};
1656
- deskConfig.mcpServers.context7 = {
1657
- command: "npx",
1658
- args: ["-y", "@upstash/context7-mcp"]
1659
- };
1660
- fs.writeFileSync(claudeDesktopFile, JSON.stringify(deskConfig, null, 2));
1661
- }
1662
- console.log(` ${colors.green}✔ Configured Context7 MCP for Claude Desktop${colors.reset}`);
1663
- }
2077
+ // 4. Synchronize Model Context Protocol (MCP) servers (OpenDesign, Context7, etc.)
2078
+ syncMcpServers(detected, options);
1664
2079
 
1665
2080
  // 5. Deploy tools & global heimdall CLI shims if requested
1666
2081
  if (options.tools && options.toolsDir) {
1667
- console.log(`\n-> Deploying Bridge Tools & 'heimdall' CLI to ${colors.bold}${options.toolsDir}${colors.reset}...`);
1668
- if (!options.dryRun && !fs.existsSync(options.toolsDir)) {
1669
- fs.mkdirSync(options.toolsDir, { recursive: true });
1670
- }
1671
- const tools = fs.readdirSync(toolsDir);
2082
+ if (!fs.existsSync(options.toolsDir)) {
2083
+ console.log(`\n-> Tools directory not found at ${options.toolsDir} (skipped)`);
2084
+ } else {
2085
+ console.log(`\n-> Deploying Bridge Tools & 'heimdall' CLI to ${colors.bold}${options.toolsDir}${colors.reset}...`);
2086
+ const tools = fs.readdirSync(toolsDir).filter(f => fs.statSync(path.join(toolsDir, f)).isFile());
1672
2087
  for (const tool of tools) {
1673
2088
  const src = path.join(toolsDir, tool);
1674
2089
  const dest = path.join(options.toolsDir, tool);
@@ -1682,6 +2097,7 @@ async function main() {
1682
2097
  // Deploy global heimdall shim
1683
2098
  deployGlobalShims(options.toolsDir, options.dryRun);
1684
2099
  console.log(` ${colors.green}✔ Deployed ${tools.length} cross-model bridge tools + 'heimdall' global CLI shim${colors.reset}`);
2100
+ }
1685
2101
  }
1686
2102
 
1687
2103
  // 6. Deploy universal doctrine & playbooks if requested
@@ -1698,6 +2114,7 @@ async function main() {
1698
2114
 
1699
2115
  // Synchronize doctrine across all active harnesses
1700
2116
  for (const [agent, targetDocFile] of Object.entries(targetDoctrinePaths)) {
2117
+ if (!isAgentConfigurable(agent)) continue;
1701
2118
  const parentDir = path.dirname(targetDocFile);
1702
2119
  if (fs.existsSync(parentDir)) {
1703
2120
  fs.copyFileSync(srcDoc, targetDocFile);
@@ -1708,6 +2125,7 @@ async function main() {
1708
2125
  // Synchronize playbooks
1709
2126
  if (fs.existsSync(playbooksDir)) {
1710
2127
  for (const [agent, targetPlayDir] of Object.entries(targetPlaybookPaths)) {
2128
+ if (!isAgentConfigurable(agent)) continue;
1711
2129
  const parentDir = path.dirname(targetPlayDir);
1712
2130
  if (fs.existsSync(parentDir)) {
1713
2131
  if (options.link) {
@@ -1723,6 +2141,7 @@ async function main() {
1723
2141
  // Synchronize custom commands (Claude Code CLI)
1724
2142
  if (fs.existsSync(commandsDir)) {
1725
2143
  for (const [agent, targetCmdDir] of Object.entries(targetCommandPaths)) {
2144
+ if (!isAgentConfigurable(agent)) continue;
1726
2145
  const parentDir = path.dirname(targetCmdDir);
1727
2146
  if (fs.existsSync(parentDir)) {
1728
2147
  if (options.link) {
@@ -1738,6 +2157,7 @@ async function main() {
1738
2157
  // Synchronize lifecycle hooks (Claude Code CLI)
1739
2158
  if (fs.existsSync(hooksDir)) {
1740
2159
  for (const [agent, targetHookDir] of Object.entries(targetHookPaths)) {
2160
+ if (!isAgentConfigurable(agent)) continue;
1741
2161
  const parentDir = path.dirname(targetHookDir);
1742
2162
  if (fs.existsSync(parentDir)) {
1743
2163
  if (options.link) {