contextos-agents 1.7.0 → 2.0.0-beta.3

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 (313) hide show
  1. package/.agents/AGENTS.md +16 -50
  2. package/.agents/adapters/aider/export.js +117 -99
  3. package/.agents/adapters/claude/export.js +68 -26
  4. package/.agents/adapters/copilot/export.js +90 -53
  5. package/.agents/adapters/cursor/export.js +100 -104
  6. package/.agents/adapters/drift-detector.js +196 -0
  7. package/.agents/adapters/gemini/export.js +76 -45
  8. package/.agents/adapters/pure-compiler.js +443 -0
  9. package/.agents/adapters/zed/export.js +104 -96
  10. package/.agents/compiled/registry.v2.json +504 -0
  11. package/.agents/compiled/registry.v2.sha256 +1 -0
  12. package/.agents/compiler/manifest-compiler.js +963 -0
  13. package/.agents/compiler/vendor/yaml.LICENSE.txt +13 -0
  14. package/.agents/compiler/vendor/yaml.SBOM.json +6 -0
  15. package/.agents/compiler/vendor/yaml.js +139 -0
  16. package/.agents/core/profiles/init.yaml +25 -0
  17. package/.agents/core/skills/context-manager/skill.yaml +3 -5
  18. package/.agents/core/skills/context-os/SKILL.md +3 -6
  19. package/.agents/core/skills/context-os/skill.yaml +3 -8
  20. package/.agents/core/skills/engineering-workflow/skill.yaml +1 -7
  21. package/.agents/core/skills/gemini-precision/skill.yaml +1 -6
  22. package/.agents/core/skills/gstack-roles/skill.yaml +3 -6
  23. package/.agents/core/skills/ponytail-mindset/skill.yaml +1 -7
  24. package/.agents/core/skills/security/skill.yaml +15 -3
  25. package/.agents/ctx.js +537 -112
  26. package/.agents/customization-dx.js +282 -0
  27. package/.agents/doctor.js +855 -66
  28. package/.agents/filesystem/index.js +71 -0
  29. package/.agents/filesystem/journaled-transaction.js +451 -0
  30. package/.agents/filesystem/lockfile-v2.js +275 -0
  31. package/.agents/filesystem/platform-hardening.js +222 -0
  32. package/.agents/filesystem/project-lock.js +218 -0
  33. package/.agents/filesystem/safe-path.js +256 -0
  34. package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
  35. package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
  36. package/.agents/plugins/contextos/plugin.json +1 -1
  37. package/.agents/plugins.js +278 -64
  38. package/.agents/profiles.js +486 -51
  39. package/.agents/resolver/canonical-resolver.js +1348 -0
  40. package/.agents/resolver.js +50 -534
  41. package/.agents/rules/rule-catalog.js +525 -0
  42. package/.agents/schemas/attestation.review.v1.json +111 -0
  43. package/.agents/schemas/attestation.verification.v1.json +85 -0
  44. package/.agents/schemas/lockfile.v2.schema.json +134 -0
  45. package/.agents/schemas/profile.v2.schema.json +114 -0
  46. package/.agents/schemas/runtime.thread.v1.json +192 -0
  47. package/.agents/schemas/skill.manifest.v2.json +177 -0
  48. package/.agents/schemas/verification.spec.v1.json +39 -0
  49. package/.agents/schemas/workspace.graph.schema.json +106 -0
  50. package/.agents/skills-index.json +6 -166
  51. package/.agents/stats.js +9 -9
  52. package/.agents/transaction-core/event-store.js +288 -0
  53. package/.agents/transaction-core/idempotency.js +129 -0
  54. package/.agents/transaction-core/ipc-lock.js +311 -0
  55. package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
  56. package/.agents/validate.js +44 -1
  57. package/.agents/watch.js +354 -102
  58. package/.agents/workspace/workspace-graph.js +778 -0
  59. package/README.md +59 -387
  60. package/benchmarks/v2/analysis/statistics.js +140 -0
  61. package/benchmarks/v2/analysis/stats.js +69 -0
  62. package/benchmarks/v2/arms/arm-definitions.js +79 -0
  63. package/benchmarks/v2/dataset.schema.json +34 -0
  64. package/benchmarks/v2/evaluators/index.js +25 -0
  65. package/benchmarks/v2/evaluators/verified-success.js +116 -0
  66. package/benchmarks/v2/harness/runner.js +88 -0
  67. package/benchmarks/v2/pilot-tasks.json +392 -0
  68. package/bin/commands/recover.js +88 -0
  69. package/bin/commands/update.js +80 -17
  70. package/bin/commands.js +62 -25
  71. package/bin/index.js +138 -81
  72. package/bin/lib/lockfile.js +5 -3
  73. package/bin/lib/safe-writer.js +34 -3
  74. package/package.json +87 -72
  75. package/registry.json +2 -2
  76. package/registry.v2.schema.json +86 -0
  77. package/.agents/core/profiles/backend.yaml +0 -47
  78. package/.agents/core/profiles/enterprise.yaml +0 -46
  79. package/.agents/core/profiles/frontend.yaml +0 -46
  80. package/.agents/core/profiles/hackathon.yaml +0 -45
  81. package/.agents/core/profiles/mvp.yaml +0 -44
  82. package/.agents/core/profiles/startup.yaml +0 -48
  83. package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
  84. package/.agents/core/skills/adapters/SKILL.md +0 -105
  85. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
  86. package/.agents/core/skills/adapters/VALIDATION.json +0 -12
  87. package/.agents/core/skills/adapters/skill.yaml +0 -16
  88. package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
  89. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
  90. package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -12
  91. package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
  92. package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
  93. package/.agents/core/skills/brutalist-design/skill.yaml +0 -12
  94. package/.agents/core/skills/database/EXAMPLES.md +0 -74
  95. package/.agents/core/skills/database/SKILL.md +0 -101
  96. package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
  97. package/.agents/core/skills/database/VALIDATION.json +0 -11
  98. package/.agents/core/skills/database/skill.yaml +0 -31
  99. package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
  100. package/.agents/core/skills/ddd/SKILL.md +0 -247
  101. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
  102. package/.agents/core/skills/ddd/VALIDATION.json +0 -12
  103. package/.agents/core/skills/ddd/ddd.md +0 -178
  104. package/.agents/core/skills/ddd/skill.yaml +0 -17
  105. package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
  106. package/.agents/core/skills/decisions/SKILL.md +0 -90
  107. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
  108. package/.agents/core/skills/decisions/VALIDATION.json +0 -12
  109. package/.agents/core/skills/decisions/skill.yaml +0 -16
  110. package/.agents/core/skills/docker/EXAMPLES.md +0 -56
  111. package/.agents/core/skills/docker/SKILL.md +0 -63
  112. package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
  113. package/.agents/core/skills/docker/VALIDATION.json +0 -11
  114. package/.agents/core/skills/docker/skill.yaml +0 -29
  115. package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
  116. package/.agents/core/skills/fastapi/SKILL.md +0 -148
  117. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
  118. package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
  119. package/.agents/core/skills/fastapi/fastapi.md +0 -112
  120. package/.agents/core/skills/fastapi/skill.yaml +0 -17
  121. package/.agents/core/skills/generators/EXAMPLES.md +0 -19
  122. package/.agents/core/skills/generators/SKILL.md +0 -112
  123. package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
  124. package/.agents/core/skills/generators/VALIDATION.json +0 -12
  125. package/.agents/core/skills/generators/skill.yaml +0 -25
  126. package/.agents/core/skills/generators/templates/API.md +0 -77
  127. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
  128. package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
  129. package/.agents/core/skills/generators/templates/DECISION.md +0 -46
  130. package/.agents/core/skills/generators/templates/PRD.md +0 -67
  131. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
  132. package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
  133. package/.agents/core/skills/generators/templates/TASKS.md +0 -43
  134. package/.agents/core/skills/generators/templates/UI.md +0 -73
  135. package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
  136. package/.agents/core/skills/graphify/SKILL.md +0 -130
  137. package/.agents/core/skills/graphify/VALIDATION.json +0 -12
  138. package/.agents/core/skills/graphify/skill.yaml +0 -18
  139. package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
  140. package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
  141. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
  142. package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
  143. package/.agents/core/skills/impeccable-design/skill.yaml +0 -20
  144. package/.agents/core/skills/interview-me/SKILL.md +0 -97
  145. package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
  146. package/.agents/core/skills/interview-me/skill.yaml +0 -12
  147. package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
  148. package/.agents/core/skills/microservices/SKILL.md +0 -164
  149. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
  150. package/.agents/core/skills/microservices/VALIDATION.json +0 -12
  151. package/.agents/core/skills/microservices/microservices.md +0 -119
  152. package/.agents/core/skills/microservices/skill.yaml +0 -17
  153. package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
  154. package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
  155. package/.agents/core/skills/minimalist-design/skill.yaml +0 -12
  156. package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
  157. package/.agents/core/skills/nestjs/SKILL.md +0 -139
  158. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
  159. package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
  160. package/.agents/core/skills/nestjs/nestjs.md +0 -103
  161. package/.agents/core/skills/nestjs/skill.yaml +0 -17
  162. package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
  163. package/.agents/core/skills/nextjs/SKILL.md +0 -163
  164. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
  165. package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
  166. package/.agents/core/skills/nextjs/nextjs.md +0 -67
  167. package/.agents/core/skills/nextjs/skill.yaml +0 -17
  168. package/.agents/core/skills/node/EXAMPLES.md +0 -80
  169. package/.agents/core/skills/node/SKILL.md +0 -128
  170. package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
  171. package/.agents/core/skills/node/VALIDATION.json +0 -12
  172. package/.agents/core/skills/node/node.md +0 -87
  173. package/.agents/core/skills/node/skill.yaml +0 -17
  174. package/.agents/core/skills/performance/EXAMPLES.md +0 -30
  175. package/.agents/core/skills/performance/SKILL.md +0 -75
  176. package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
  177. package/.agents/core/skills/performance/VALIDATION.json +0 -12
  178. package/.agents/core/skills/performance/performance.md +0 -52
  179. package/.agents/core/skills/performance/skill.yaml +0 -17
  180. package/.agents/core/skills/react/EXAMPLES.md +0 -79
  181. package/.agents/core/skills/react/SKILL.md +0 -132
  182. package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
  183. package/.agents/core/skills/react/VALIDATION.json +0 -12
  184. package/.agents/core/skills/react/react.md +0 -93
  185. package/.agents/core/skills/react/skill.yaml +0 -17
  186. package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
  187. package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
  188. package/.agents/core/skills/react-best-practices/skill.yaml +0 -14
  189. package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
  190. package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
  191. package/.agents/core/skills/redesign-audit/skill.yaml +0 -12
  192. package/.agents/core/skills/soft-design/SKILL.md +0 -108
  193. package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
  194. package/.agents/core/skills/soft-design/skill.yaml +0 -12
  195. package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
  196. package/.agents/core/skills/state-management/SKILL.md +0 -48
  197. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
  198. package/.agents/core/skills/state-management/VALIDATION.json +0 -11
  199. package/.agents/core/skills/state-management/skill.yaml +0 -28
  200. package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -117
  201. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
  202. package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -12
  203. package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
  204. package/.agents/core/skills/system-design/SKILL.md +0 -419
  205. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
  206. package/.agents/core/skills/system-design/VALIDATION.json +0 -12
  207. package/.agents/core/skills/system-design/skill.yaml +0 -20
  208. package/.agents/core/skills/system-design/system-design.md +0 -112
  209. package/.agents/core/skills/testing/EXAMPLES.md +0 -71
  210. package/.agents/core/skills/testing/SKILL.md +0 -70
  211. package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
  212. package/.agents/core/skills/testing/VALIDATION.json +0 -11
  213. package/.agents/core/skills/testing/skill.yaml +0 -32
  214. package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
  215. package/.agents/core/skills/typescript/SKILL.md +0 -112
  216. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
  217. package/.agents/core/skills/typescript/VALIDATION.json +0 -12
  218. package/.agents/core/skills/typescript/skill.yaml +0 -17
  219. package/.agents/core/skills/typescript/typescript.md +0 -71
  220. package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
  221. package/.agents/core/skills/ui-design/SKILL.md +0 -124
  222. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
  223. package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
  224. package/.agents/core/skills/ui-design/skill.yaml +0 -17
  225. package/.agents/core/skills/ui-design/ui.md +0 -88
  226. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
  227. package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
  228. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
  229. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
  230. package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -19
  231. package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
  232. package/.agents/core/skills/ux-design/SKILL.md +0 -116
  233. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
  234. package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
  235. package/.agents/core/skills/ux-design/skill.yaml +0 -17
  236. package/.agents/core/skills/ux-design/ux.md +0 -80
  237. package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
  238. package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
  239. package/.agents/core/skills/vercel-optimize/scripts/collect-signals.mjs +0 -131
  240. package/.agents/core/skills/vercel-optimize/scripts/gate-investigations.mjs +0 -142
  241. package/.agents/core/skills/vercel-optimize/scripts/merge-signals.mjs +0 -143
  242. package/.agents/core/skills/vercel-optimize/scripts/scan-codebase.mjs +0 -174
  243. package/.agents/core/skills/vercel-optimize/skill.yaml +0 -18
  244. package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
  245. package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
  246. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
  247. package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
  248. package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
  249. package/.agents/core/skills/web-accessibility/skill.yaml +0 -17
  250. package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
  251. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
  252. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
  253. package/.agents/generated/claude/skills/database/SKILL.md +0 -191
  254. package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
  255. package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
  256. package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
  257. package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
  258. package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
  259. package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
  260. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
  261. package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
  262. package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
  263. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
  264. package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
  265. package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
  266. package/.agents/generated/claude/skills/node/SKILL.md +0 -224
  267. package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
  268. package/.agents/generated/claude/skills/react/SKILL.md +0 -227
  269. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
  270. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
  271. package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
  272. package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
  273. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -110
  274. package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
  275. package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
  276. package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
  277. package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
  278. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
  279. package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
  280. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
  281. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
  282. package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
  283. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
  284. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
  285. package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
  286. package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
  287. package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
  288. package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
  289. package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
  290. package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
  291. package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
  292. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
  293. package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
  294. package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
  295. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
  296. package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
  297. package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
  298. package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
  299. package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
  300. package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
  301. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
  302. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
  303. package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
  304. package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
  305. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -116
  306. package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
  307. package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
  308. package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
  309. package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
  310. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
  311. package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
  312. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
  313. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
package/.agents/AGENTS.md CHANGED
@@ -1,4 +1,4 @@
1
- # ContextOS — AI Project Operating System
1
+ # ContextOS — Deterministic context compiler and policy engine for AI coding agents.
2
2
 
3
3
  You are working inside a project managed by **ContextOS**. This file is the **single source of truth** for how you must behave, think, and which skills to activate for every task.
4
4
 
@@ -37,71 +37,37 @@ Skills are loaded on-demand. To keep the agent context window efficient:
37
37
 
38
38
  ## Skill Registry
39
39
 
40
- All skills live in `.agents/core/skills/`. Here is what each does and when to use it:
40
+ ### Built-in Core Skills (Bundled in `.agents/core/skills/`)
41
41
 
42
- ### Core Skills (Always Considered)
42
+ These 7 skills are always present in ContextOS Core:
43
43
 
44
44
  | Skill | File | Activate When |
45
45
  |-------|------|--------------|
46
46
  | **engineering-workflow** | `engineering-workflow/SKILL.md` | **Every task** — defines the DEFINE→PLAN→BUILD→VERIFY→REVIEW→SHIP pipeline |
47
47
  | **gstack-roles** | `gstack-roles/SKILL.md` | **Every task** — declare your specialist role before each phase |
48
48
  | **ponytail-mindset** | `ponytail-mindset/SKILL.md` | **Every BUILD phase** — run the 7-rung ladder before writing any code |
49
- | **interview-me** | `interview-me/SKILL.md` | **Before /spec** — when requirements are ambiguous or need interactive clarification |
50
- | **subagent-orchestrator** | `subagent-orchestrator/SKILL.md` | **Parallel tasks** — decompose and delegate work across isolated subagents |
51
49
  | **gemini-precision** | `gemini-precision/SKILL.md` | **All Gemini tasks** — zero assumptions, zero placeholders, surgical blast radius, test proof |
50
+ | **security** | `security/SKILL.md` | Any feature with auth, data access, user input, external integration |
51
+ | **context-os** | `context-os/SKILL.md` | Managing context rules, compiler pipelines, project policies |
52
+ | **context-manager** | `context-manager/SKILL.md` | Context selection, dynamic skill resolution, project graph traversal |
52
53
 
53
- ### Frontend Skills
54
+ ### Extended Catalog Skills (Installed on Demand via `contextos skill add <name>`)
54
55
 
55
- | Skill | File | Activate When |
56
- |-------|------|--------------|
57
- | **ui-ux-pro** | `ui-ux-pro/SKILL.md` | Any UI task — planning guide, design decisions, color systems |
58
- | **brutalist-design** | `brutalist-design/SKILL.md` | When explicitly asked for brutalist, high contrast, industrial, or sharp UI |
59
- | **minimalist-design** | `minimalist-design/SKILL.md` | When explicitly asked for clean, minimal, editorial, or Notion-like UI |
60
- | **soft-design** | `soft-design/SKILL.md` | When explicitly asked for calm, soft, premium, or low-contrast UI |
61
- | **redesign-audit** | `redesign-audit/SKILL.md` | When tasked to audit or redesign an existing complex UI codebase without breaking it |
62
- | **impeccable-design** | `impeccable-design/SKILL.md` | REVIEW phase for UI — run as hard QA checklist before shipping |
63
- | **react** | `react/SKILL.md` | React component work |
64
- | **react-best-practices** | `react-best-practices/SKILL.md` | Deep React component refactoring, hooks, and strict pattern enforcement |
65
- | **nextjs** | `nextjs/SKILL.md` | Next.js App Router, Server Actions, routing |
66
- | **typescript** | `typescript/SKILL.md` | Type-safe code, generics, config |
67
- | **state-management** | `state-management/SKILL.md` | Zustand, TanStack Query, client/server state |
68
- | **ui-design** | `ui-design/SKILL.md` | Component library design, tokens |
69
- | **ux-design** | `ux-design/SKILL.md` | User flow design, interaction patterns |
70
- | **web-accessibility** | `web-accessibility/SKILL.md` | ARIA, WCAG compliance |
71
-
72
- ### Backend Skills
73
-
74
- | Skill | File | Activate When |
75
- |-------|------|--------------|
76
- | **system-design** | `system-design/SKILL.md` | Any backend architecture — mandatory pre-design checklist |
77
- | **node** | `node/SKILL.md` | Node.js server code |
78
- | **fastapi** | `fastapi/SKILL.md` | FastAPI / Python backend |
79
- | **nestjs** | `nestjs/SKILL.md` | NestJS framework |
80
- | **microservices** | `microservices/SKILL.md` | Service decomposition |
81
- | **ddd** | `ddd/SKILL.md` | Domain modeling, bounded contexts |
82
- | **database** | `database/SKILL.md` | PostgreSQL, Prisma, Drizzle, migrations, indexing |
56
+ The following domain skills are available in the extended catalog and can be added to your project on demand:
83
57
 
84
- ### Cross-Cutting Skills
85
-
86
- | Skill | File | Activate When |
87
- |-------|------|--------------|
88
- | **security** | `security/SKILL.md` | Any feature with auth, data access, user input |
89
- | **performance** | `performance/SKILL.md` | Optimization tasks, Core Web Vitals |
90
- | **vercel-optimize** | `vercel-optimize/SKILL.md` | Edge caching, Vercel deployments, Next.js optimization |
91
- | **testing** | `testing/SKILL.md` | Vitest, RTL, Playwright, TDD/BDD testing |
92
- | **docker** | `docker/SKILL.md` | Dockerfiles, multi-stage, container security, compose |
93
- | **decisions** | `decisions/SKILL.md` | Making architectural choices |
94
- | **architecture-diagrams** | `architecture-diagrams/SKILL.md` | Interactive animated SVG/HTML architecture and sequence diagrams |
95
- | **adapters** | `adapters/SKILL.md` | Building system integrations |
96
- | **generators** | `generators/SKILL.md` | Code generation patterns |
97
- | **graphify** | `graphify/SKILL.md` | Codebase mapping, AST dependency knowledge graph, blast-radius analysis |
58
+ | Domain | Skills | Install Command |
59
+ |--------|--------|-----------------|
60
+ | **Frontend** | `react`, `react-best-practices`, `nextjs`, `typescript`, `ui-ux-pro`, `impeccable-design`, `state-management`, `ui-design`, `ux-design`, `web-accessibility`, `brutalist-design`, `minimalist-design`, `soft-design`, `redesign-audit` | `contextos skill add <name>` |
61
+ | **Backend** | `system-design`, `node`, `fastapi`, `nestjs`, `microservices`, `ddd`, `database` | `contextos skill add <name>` |
62
+ | **Cross-Cutting** | `testing`, `docker`, `decisions`, `architecture-diagrams`, `adapters`, `generators`, `graphify`, `performance`, `vercel-optimize` | `contextos skill add <name>` |
98
63
 
99
64
  ---
100
65
 
101
66
  ## Automatic Skill Activation Rules (Proactive Routing)
102
67
 
103
- The following rules are **deterministic** — no judgment needed. If the condition is true, the skill is loaded.
104
- **PROACTIVE ROUTING RULE**: If a user request matches a skill trigger, DO NOT simply answer them ad-hoc. You must proactively load the skill and follow its workflow. Skills contain multi-step workflows, checklists, and quality gates that always produce better results than an unstructured response.
68
+ The following rules are **deterministic** — no judgment needed. If the condition is true, the skill is loaded.
69
+
70
+ > **Availability Guard**: Load only skills that are physically installed in `.agents/core/skills/`. For uninstalled catalog skills, rely on core skills (`engineering-workflow`, `ponytail-mindset`, `gemini-precision`, `security`) and recommend `contextos skill add <name>` when deep domain checklists are needed.
105
71
 
106
72
  ### By Task Type
107
73
 
@@ -1,28 +1,28 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter, readMeaningfulMarkdown } = require('../shared.js');
4
-
5
- // Aider config goes to project root
6
- const CONF_FILE = path.join(process.cwd(), '.aider.conf.yml');
7
- const CONVENTIONS_FILE = path.join(process.cwd(), 'CONVENTIONS.md');
8
-
9
1
  /**
10
- * Aider adapter — export.js
11
- *
12
- * Aider uses two complementary files:
13
- * 1. `.aider.conf.yml` — config file that points Aider to conventions
14
- * 2. `CONVENTIONS.md` — flat Markdown with all skills compiled in
15
- *
16
- * The config tells Aider to load CONVENTIONS.md via `read:` directive and
17
- * pre-loads it as a read-only context file on every session.
18
- *
19
- * Format spec: https://aider.chat/docs/config/aider_conf.html
2
+ * .agents/adapters/aider/export.js
3
+ * ContextOS Aider Pure Adapter (.aider.conf.yml & CONVENTIONS.md)
20
4
  */
21
5
 
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter } = require('../shared.js');
9
+ const { registerAdapter, applyArtifacts, createProvenanceHeader } = require('../pure-compiler.js');
10
+
11
+ const GENERATOR_ID = 'aider@2';
12
+
13
+ function describe() {
14
+ return {
15
+ name: 'aider',
16
+ version: '2.0.0',
17
+ description: 'Compiles configuration and conventions for Aider (.aider.conf.yml and CONVENTIONS.md)',
18
+ targetPattern: '{.aider.conf.yml,CONVENTIONS.md}',
19
+ };
20
+ }
21
+
22
22
  function buildSkillSection(skillDir) {
23
- const skillName = path.basename(skillDir);
24
- const skillMdPath = path.join(skillDir, 'SKILL.md');
25
- const yamlPath = path.join(skillDir, 'skill.yaml');
23
+ const skillName = path.basename(skillDir);
24
+ const skillMdPath = path.join(skillDir, 'SKILL.md');
25
+ const yamlPath = path.join(skillDir, 'skill.yaml');
26
26
 
27
27
  let title = skillName;
28
28
  let description = '';
@@ -47,93 +47,111 @@ function buildSkillSection(skillDir) {
47
47
  return `\n## Skill: ${title}\n${descLine}${skillRef}`;
48
48
  }
49
49
 
50
- function generateAiderConf() {
51
- const conf = `# .aider.conf.yml
52
- # Auto-generated by: node .agents/ctx.js export aider
53
- # Source: .agents/core/skills/ · Do not edit manually.
54
-
55
- # Load project conventions as a read-only context file on every session
56
- read:
57
- - CONVENTIONS.md
58
-
59
- # Recommended model settings (override as needed)
60
- # model: gpt-4o
61
- # editor-model: gpt-4o-mini
62
-
63
- # Auto-commit after every accepted change
64
- auto-commits: true
65
-
66
- # Show diffs in git format
67
- pretty: true
68
- `;
69
- return conf;
70
- }
71
-
72
- function run() {
73
- console.log('Starting Aider adapter export...');
74
-
75
- // ── 1. Write .aider.conf.yml ─────────────────────────────────────────────────
76
- fs.writeFileSync(CONF_FILE, generateAiderConf());
77
- console.log(`Generated .aider.conf.yml → ${CONF_FILE}`);
78
-
79
- // ── 2. Build CONVENTIONS.md ──────────────────────────────────────────────────
80
- const sections = [];
81
-
82
- sections.push(
83
- `# CONVENTIONS.md — ContextOS Project Conventions\n\n` +
84
- `> Auto-generated by: node .agents/ctx.js export aider\n` +
85
- `> Source: .agents/core/skills/ · Do not edit manually.\n\n` +
86
- `Aider loads this file as read-only context on every session.\n` +
87
- `To keep your context window lean, load specific skill files on-demand using \`/read <path>\`.\n`
50
+ function render(context) {
51
+ const projectRoot = context?.projectRoot || '.';
52
+ const agentsMdPath = fs.existsSync(path.join(projectRoot, '.agents', 'AGENTS.md'))
53
+ ? path.join(projectRoot, '.agents', 'AGENTS.md')
54
+ : AGENTS_MD_PATH;
55
+
56
+ const yamlProv = createProvenanceHeader({
57
+ generator: GENERATOR_ID,
58
+ sourceGraphHash: context?.sourceGraphHash,
59
+ profileId: context?.profileId,
60
+ profileHash: context?.profileHash,
61
+ }, 'yaml');
62
+
63
+ const mdProv = createProvenanceHeader({
64
+ generator: GENERATOR_ID,
65
+ sourceGraphHash: context?.sourceGraphHash,
66
+ profileId: context?.profileId,
67
+ profileHash: context?.profileHash,
68
+ }, 'markdown');
69
+
70
+ // 1. .aider.conf.yml
71
+ const aiderConfContent = [
72
+ yamlProv,
73
+ '# Load project conventions as a read-only context file on every session',
74
+ 'read:',
75
+ ' - CONVENTIONS.md',
76
+ '',
77
+ '# Auto commit edits with standard git format',
78
+ 'auto-commits: true',
79
+ 'dirty-commits: true',
80
+ '',
81
+ ].join('\n');
82
+
83
+ // 2. CONVENTIONS.md
84
+ const convSections = [];
85
+ convSections.push(
86
+ mdProv +
87
+ `# ContextOS — Project Conventions for Aider\n\n` +
88
+ `> **Core law: Do not read everything. Read only what the current task requires.**\n\n`
88
89
  );
89
90
 
90
- // Project rules with Step 0
91
- sections.push(
92
- `\n---\n\n## Project Rules\n\n` +
93
- `### Step 0 — Identify Before Acting\n\n` +
94
- `Before writing a single line of code or plan, state:\n` +
95
- `\`\`\`\n1. WHAT DOMAIN? → Frontend / Backend / Architecture / Full-Stack / DevOps\n2. WHAT PHASE? → Define / Plan / Build / Verify / Review / Ship\n3. WHAT ROLE? → Declare specialist role for this phase\n\`\`\`\n` +
96
- `> **Anti-Spam Invariant**: Declare this strictly once at the start of a task or phase. Never repeat before intermediate tool calls or step updates.\n\n` +
97
- `### Non-Negotiable Rules\n\n` +
98
- `- **Zero-Assumption Investigation**: Never guess file paths or signatures. Inspect before modifying.\n` +
99
- `- **Zero-Placeholder Production Code**: Never emit lazy stubs, \`// TODO\`, or partial code.\n` +
100
- `- **Mandatory Proof-of-Work Verification**: Always run tests and validators before claiming completion.\n` +
101
- `- **Surgical Blast Radius**: Modify only files strictly within scope.\n` +
102
- `- **Fast-Track Exception**: Routine maintenance, git commands, version bumps, typo fixes, and diagnostics skip spec/plan ceremonies.\n`
103
- );
91
+ if (fs.existsSync(agentsMdPath)) {
92
+ const agentsMd = fs.readFileSync(agentsMdPath, 'utf8');
93
+ convSections.push(`## Core Operational Rules\n\n${agentsMd}\n\n---\n`);
94
+ }
104
95
 
105
- // Skills Router Table
106
- sections.push('\n---\n\n## Skill Router\n\n');
107
- sections.push('Read the corresponding skill file only when the task matches the trigger:\n\n');
108
- sections.push('| Trigger / Domain | Skill | On-Demand Command |\n');
109
- sections.push('| --- | --- | --- |\n');
96
+ convSections.push(`\n## Available Specialist Skills\n\n` +
97
+ `Skills are loaded on demand. Use \`/read .agents/skills/<skill>/SKILL.md\` when needed.\n\n` +
98
+ `### Skill Index\n`);
110
99
 
111
- const skills = collectSkillDirectories();
100
+ const skills = collectSkillDirectories(context?.profile);
112
101
  for (const skill of skills) {
113
- const skillName = path.basename(skill);
114
- const yamlPath = path.join(skill, 'skill.yaml');
115
- let tags = skillName;
116
- if (fs.existsSync(yamlPath)) {
117
- const yaml = fs.readFileSync(yamlPath, 'utf8');
118
- const rawTags = extractYamlField(yaml, 'tags');
119
- if (rawTags) tags = rawTags.replace(/[\[\]]/g, '');
120
- }
121
- sections.push(`| \`${tags}\` | **${skillName}** | \`/read .agents/core/skills/${skillName}/SKILL.md\` |\n`);
102
+ const section = buildSkillSection(skill);
103
+ if (section) convSections.push(section);
122
104
  }
123
105
 
124
- // Skills
125
- sections.push('\n---\n\n# Skills\n');
126
- let count = 0;
127
- for (const skill of skills) {
128
- const section = buildSkillSection(skill);
129
- if (section) {
130
- sections.push(section);
131
- count++;
106
+ return [
107
+ {
108
+ path: '.aider.conf.yml',
109
+ content: aiderConfContent.replace(/\r\n/g, '\n'),
110
+ mediaType: 'application/yaml',
111
+ kind: 'generated-adapter',
112
+ generator: GENERATOR_ID,
113
+ sourceSkillIds: [],
114
+ inputsHash: context?.sourceGraphHash || 'none',
115
+ },
116
+ {
117
+ path: 'CONVENTIONS.md',
118
+ content: convSections.join('\n').replace(/\r\n/g, '\n'),
119
+ mediaType: 'text/markdown',
120
+ kind: 'generated-adapter',
121
+ generator: GENERATOR_ID,
122
+ sourceSkillIds: skills.map(s => path.basename(s)),
123
+ inputsHash: context?.sourceGraphHash || 'none',
124
+ },
125
+ ];
126
+ }
127
+
128
+ function validate(artifacts) {
129
+ const diagnostics = [];
130
+ for (const art of artifacts) {
131
+ if (!art.content || art.content.length === 0) {
132
+ diagnostics.push({ path: art.path, message: 'Empty artifact content' });
132
133
  }
133
134
  }
135
+ return diagnostics;
136
+ }
134
137
 
135
- fs.writeFileSync(CONVENTIONS_FILE, sections.join('\n'));
136
- console.log(`Generated CONVENTIONS.md (${count} skills) → ${CONVENTIONS_FILE}`);
138
+ function run(options = {}) {
139
+ const { loadCompilerContext } = require('../pure-compiler.js');
140
+ const projectRoot = options.projectRoot || '.';
141
+ const context = loadCompilerContext(projectRoot, options);
142
+ const artifacts = render(context);
143
+ const result = applyArtifacts(projectRoot, artifacts, { command: 'export aider', context });
144
+ console.log(`✓ Aider export complete: ${result.appliedCount} files applied (tx: ${result.txId})`);
145
+ return result;
137
146
  }
138
147
 
139
- module.exports = { run };
148
+ const adapter = {
149
+ describe,
150
+ render,
151
+ validate,
152
+ run,
153
+ };
154
+
155
+ registerAdapter('aider', adapter);
156
+
157
+ module.exports = adapter;
@@ -1,55 +1,97 @@
1
+ /**
2
+ * .agents/adapters/claude/export.js
3
+ * ContextOS Claude Code Pure Adapter
4
+ */
5
+
1
6
  const fs = require('fs');
2
7
  const path = require('path');
3
- const { collectSkillDirectories, resetDirectory, readMeaningfulMarkdown } = require('../shared.js');
8
+ const { collectSkillDirectories, readMeaningfulMarkdown } = require('../shared.js');
9
+ const { registerAdapter, applyArtifacts } = require('../pure-compiler.js');
4
10
 
5
- const GENERATED_SKILLS_PATH = path.join(__dirname, '..', '..', 'generated', 'claude', 'skills');
11
+ const GENERATOR_ID = 'claude@2';
6
12
 
7
- /**
8
- * Claude Code skill format:
9
- * - Plain Markdown, no YAML frontmatter required
10
- * - First line is the skill name as an H1 comment
11
- * - Content is preserved as-is (Claude reads raw Markdown well)
12
- */
13
- function generateClaudeSkill(skillDir) {
13
+ function describe() {
14
+ return {
15
+ name: 'claude',
16
+ version: '2.0.0',
17
+ description: 'Compiles clean markdown skills for Claude Code CLI',
18
+ targetPattern: '.agents/generated/claude/skills/**/SKILL.md',
19
+ };
20
+ }
21
+
22
+ function renderClaudeSkill(skillDir, context) {
14
23
  const skillName = path.basename(skillDir);
15
24
  const existingSkillMdPath = path.join(skillDir, 'SKILL.md');
16
- const outputDir = path.join(GENERATED_SKILLS_PATH, skillName);
17
25
 
18
26
  if (!fs.existsSync(existingSkillMdPath)) {
19
- console.log(`Skipping ${skillName} (no SKILL.md)`);
20
- return;
27
+ return null;
21
28
  }
22
29
 
23
30
  let content = fs.readFileSync(existingSkillMdPath, 'utf8');
24
-
31
+
25
32
  const examples = readMeaningfulMarkdown(path.join(skillDir, 'EXAMPLES.md'));
26
33
  if (examples) {
27
34
  content += '\n\n' + examples;
28
35
  }
29
-
36
+
30
37
  const troubleshooting = readMeaningfulMarkdown(path.join(skillDir, 'TROUBLESHOOTING.md'));
31
38
  if (troubleshooting) {
32
39
  content += '\n\n' + troubleshooting;
33
40
  }
34
41
 
35
- // Strip YAML frontmatter if present (Claude doesn't need it)
42
+ // Strip YAML frontmatter
36
43
  content = content.replace(/^---[\s\S]*?---\r?\n/, '');
37
44
 
38
- // Write the cleaned Markdown
39
- fs.mkdirSync(outputDir, { recursive: true });
40
- fs.writeFileSync(path.join(outputDir, 'SKILL.md'), content.trimStart());
41
- console.log(`Generated SKILL.md for ${skillName} (claude)`);
45
+ return {
46
+ path: `.agents/generated/claude/skills/${skillName}/SKILL.md`,
47
+ content: content.trimStart().replace(/\r\n/g, '\n'),
48
+ mediaType: 'text/markdown',
49
+ kind: 'generated-adapter',
50
+ generator: GENERATOR_ID,
51
+ sourceSkillIds: [skillName],
52
+ inputsHash: context?.sourceGraphHash || 'none',
53
+ };
42
54
  }
43
55
 
44
- function run() {
45
- console.log('Starting Claude adapter export...');
46
- resetDirectory(GENERATED_SKILLS_PATH);
56
+ function render(context) {
57
+ const skills = collectSkillDirectories(context?.profile);
58
+ const artifacts = [];
47
59
 
48
- const skills = collectSkillDirectories();
49
60
  for (const skill of skills) {
50
- generateClaudeSkill(skill);
61
+ const art = renderClaudeSkill(skill, context);
62
+ if (art) artifacts.push(art);
51
63
  }
52
- console.log('Export complete. Skills are in generated/claude/skills');
64
+
65
+ return artifacts;
66
+ }
67
+
68
+ function validate(artifacts) {
69
+ const diagnostics = [];
70
+ for (const art of artifacts) {
71
+ if (!art.content || art.content.length === 0) {
72
+ diagnostics.push({ path: art.path, message: 'Empty artifact content' });
73
+ }
74
+ }
75
+ return diagnostics;
53
76
  }
54
77
 
55
- module.exports = { run };
78
+ function run(options = {}) {
79
+ const { loadCompilerContext } = require('../pure-compiler.js');
80
+ const projectRoot = options.projectRoot || '.';
81
+ const context = loadCompilerContext(projectRoot, options);
82
+ const artifacts = render(context);
83
+ const result = applyArtifacts(projectRoot, artifacts, { command: 'export claude', context });
84
+ console.log(`✓ Claude export complete: ${result.appliedCount} files applied (tx: ${result.txId})`);
85
+ return result;
86
+ }
87
+
88
+ const adapter = {
89
+ describe,
90
+ render,
91
+ validate,
92
+ run,
93
+ };
94
+
95
+ registerAdapter('claude', adapter);
96
+
97
+ module.exports = adapter;
@@ -1,24 +1,28 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter, readMeaningfulMarkdown } = require('../shared.js');
4
-
5
- // GitHub Copilot reads from .github/copilot-instructions.md
6
- const OUTPUT_FILE = path.join(process.cwd(), '.github', 'copilot-instructions.md');
7
-
8
1
  /**
9
- * GitHub Copilot adapter — export.js
10
- *
11
- * Copilot reads `.github/copilot-instructions.md` as a plain Markdown file.
12
- * We compile AGENTS.md + all skills into one document with clear section
13
- * headings so Copilot can reference them contextually.
14
- *
15
- * Format spec: https://docs.github.com/en/copilot/customizing-copilot/adding-repository-instructions
2
+ * .agents/adapters/copilot/export.js
3
+ * ContextOS GitHub Copilot Pure Adapter (.github/copilot-instructions.md)
16
4
  */
17
5
 
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const { collectSkillDirectories, extractYamlField, stripFrontmatter } = require('../shared.js');
9
+ const { registerAdapter, applyArtifacts, createProvenanceHeader } = require('../pure-compiler.js');
10
+
11
+ const GENERATOR_ID = 'copilot@2';
12
+
13
+ function describe() {
14
+ return {
15
+ name: 'copilot',
16
+ version: '2.0.0',
17
+ description: 'Compiles instructions for GitHub Copilot (.github/copilot-instructions.md)',
18
+ targetPattern: '.github/copilot-instructions.md',
19
+ };
20
+ }
21
+
18
22
  function buildSkillSection(skillDir) {
19
- const skillName = path.basename(skillDir);
20
- const skillMdPath = path.join(skillDir, 'SKILL.md');
21
- const yamlPath = path.join(skillDir, 'skill.yaml');
23
+ const skillName = path.basename(skillDir);
24
+ const skillMdPath = path.join(skillDir, 'SKILL.md');
25
+ const yamlPath = path.join(skillDir, 'skill.yaml');
22
26
 
23
27
  let title = skillName;
24
28
  let description = '';
@@ -43,40 +47,39 @@ function buildSkillSection(skillDir) {
43
47
  return `\n### ${title}\n${descLine}${skillRef}`;
44
48
  }
45
49
 
46
- function run() {
47
- console.log('Starting GitHub Copilot adapter export...');
48
-
50
+ function render(context) {
49
51
  const lines = [];
50
52
 
51
- // ── Header ───────────────────────────────────────────────────────────────────
53
+ const prov = createProvenanceHeader({
54
+ generator: GENERATOR_ID,
55
+ sourceGraphHash: context?.sourceGraphHash,
56
+ profileId: context?.profileId,
57
+ profileHash: context?.profileHash,
58
+ });
59
+
52
60
  lines.push(
53
- `# GitHub Copilot Instructions — ContextOS\n`,
54
- `<!-- Auto-generated by: node .agents/ctx.js export copilot -->\n`,
55
- `<!-- Source: .agents/core/skills/ · Do not edit manually. -->\n\n`
61
+ prov +
62
+ `# GitHub Copilot Instructions — ContextOS\n\n` +
63
+ `## Project Rules\n\n` +
64
+ `### Step 0 — Identify Before Acting\n\n` +
65
+ `Before writing a single line of code or plan, state:\n` +
66
+ `\`\`\`\n1. WHAT DOMAIN? → Frontend / Backend / Architecture / Full-Stack / DevOps\n2. WHAT PHASE? → Define / Plan / Build / Verify / Review / Ship\n3. WHAT ROLE? → Declare specialist role for this phase\n\`\`\`\n\n` +
67
+ `> **Anti-Spam Invariant**: Declare this strictly once at the start of a task or phase. Never repeat before intermediate tool calls or step updates.\n\n` +
68
+ `### Non-Negotiable Rules\n\n` +
69
+ `- **Zero-Assumption Investigation**: Never guess file paths or signatures. Inspect before modifying.\n` +
70
+ `- **Zero-Placeholder Production Code**: Never emit lazy stubs, \`// TODO\`, or partial code.\n` +
71
+ `- **Mandatory Proof-of-Work Verification**: Always run tests and validators before claiming completion.\n` +
72
+ `- **Surgical Blast Radius**: Modify only files strictly within scope.\n` +
73
+ `- **Fast-Track Exception**: Routine maintenance, git commands, version bumps, typo fixes, and diagnostics skip spec/plan ceremonies.\n\n` +
74
+ `---\n\n` +
75
+ `## Skills Library\n\n` +
76
+ `ContextOS uses on-demand progressive disclosure. Read the relevant \`SKILL.md\` file only when your task matches the trigger.\n\n` +
77
+ `### Skill Routing Table\n\n` +
78
+ `| Trigger / Domain | Skill | Path |\n` +
79
+ `| --- | --- | --- |\n`
56
80
  );
57
81
 
58
- // ── Project rules & Step 0 ───────────────────────────────────────────────────
59
- lines.push(`## Project Rules\n\n`);
60
- lines.push(`### Step 0 — Identify Before Acting\n\n`);
61
- lines.push(`Before writing a single line of code or plan, state:\n`);
62
- lines.push(`\`\`\`\n1. WHAT DOMAIN? → Frontend / Backend / Architecture / Full-Stack / DevOps\n2. WHAT PHASE? → Define / Plan / Build / Verify / Review / Ship\n3. WHAT ROLE? → Declare specialist role for this phase\n\`\`\`\n`);
63
- lines.push(`> **Anti-Spam Invariant**: Declare this strictly once at the start of a task or phase. Never repeat before intermediate tool calls or step updates.\n\n`);
64
- lines.push(`### Non-Negotiable Rules\n\n`);
65
- lines.push(`- **Zero-Assumption Investigation**: Never guess file paths or signatures. Inspect before modifying.\n`);
66
- lines.push(`- **Zero-Placeholder Production Code**: Never emit lazy stubs, \`// TODO\`, or partial code.\n`);
67
- lines.push(`- **Mandatory Proof-of-Work Verification**: Always run tests and validators before claiming completion.\n`);
68
- lines.push(`- **Surgical Blast Radius**: Modify only files strictly within scope.\n`);
69
- lines.push(`- **Fast-Track Exception**: Routine maintenance, git commands, version bumps, typo fixes, and diagnostics skip spec/plan ceremonies.\n\n`);
70
- lines.push(`---\n`);
71
-
72
- // ── Skills ───────────────────────────────────────────────────────────────────
73
- lines.push(`\n## Skills Library\n\n`);
74
- lines.push(`ContextOS uses on-demand progressive disclosure. Read the relevant \`SKILL.md\` file only when your task matches the trigger.\n\n`);
75
- lines.push(`### Skill Routing Table\n\n`);
76
- lines.push(`| Trigger / Domain | Skill | Path |\n`);
77
- lines.push(`| --- | --- | --- |\n`);
78
-
79
- const skills = collectSkillDirectories();
82
+ const skills = collectSkillDirectories(context?.profile);
80
83
  for (const skill of skills) {
81
84
  const skillName = path.basename(skill);
82
85
  const yamlPath = path.join(skill, 'skill.yaml');
@@ -91,19 +94,53 @@ function run() {
91
94
  }
92
95
  lines.push(`\n---\n`);
93
96
 
94
- let count = 0;
95
97
  for (const skill of skills) {
96
98
  const section = buildSkillSection(skill);
97
99
  if (section) {
98
100
  lines.push(section);
99
- count++;
100
101
  }
101
102
  }
102
103
 
103
- // ── Write ────────────────────────────────────────────────────────────────────
104
- fs.mkdirSync(path.dirname(OUTPUT_FILE), { recursive: true });
105
- fs.writeFileSync(OUTPUT_FILE, lines.join(''));
106
- console.log(`Generated .github/copilot-instructions.md (${count} skills) → ${OUTPUT_FILE}`);
104
+ return [
105
+ {
106
+ path: '.github/copilot-instructions.md',
107
+ content: lines.join('').replace(/\r\n/g, '\n'),
108
+ mediaType: 'text/markdown',
109
+ kind: 'generated-adapter',
110
+ generator: GENERATOR_ID,
111
+ sourceSkillIds: skills.map(s => path.basename(s)),
112
+ inputsHash: context?.sourceGraphHash || 'none',
113
+ },
114
+ ];
115
+ }
116
+
117
+ function validate(artifacts) {
118
+ const diagnostics = [];
119
+ for (const art of artifacts) {
120
+ if (!art.content || art.content.length === 0) {
121
+ diagnostics.push({ path: art.path, message: 'Empty artifact content' });
122
+ }
123
+ }
124
+ return diagnostics;
107
125
  }
108
126
 
109
- module.exports = { run };
127
+ function run(options = {}) {
128
+ const { loadCompilerContext } = require('../pure-compiler.js');
129
+ const projectRoot = options.projectRoot || '.';
130
+ const context = loadCompilerContext(projectRoot, options);
131
+ const artifacts = render(context);
132
+ const result = applyArtifacts(projectRoot, artifacts, { command: 'export copilot', context });
133
+ console.log(`✓ Copilot export complete: ${result.appliedCount} files applied (tx: ${result.txId})`);
134
+ return result;
135
+ }
136
+
137
+ const adapter = {
138
+ describe,
139
+ render,
140
+ validate,
141
+ run,
142
+ };
143
+
144
+ registerAdapter('copilot', adapter);
145
+
146
+ module.exports = adapter;