ai-collab-open-system 0.1.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 (259) hide show
  1. package/.aict/START_HERE.md +127 -0
  2. package/.aict/WORKSPACE_MANIFEST.json +91 -0
  3. package/.aict/acceptance/EXAMPLE.synthetic.md +49 -0
  4. package/.aict/acceptance/FAILURE_MODES.md +40 -0
  5. package/.aict/acceptance/PROMPT.md +47 -0
  6. package/.aict/acceptance/README.md +44 -0
  7. package/.aict/acceptance/TEMPLATE.md +57 -0
  8. package/.aict/adapters/SHARED_CORE_CONTRACT.md +106 -0
  9. package/.aict/adapters/claude-code/ADAPTER.md +28 -0
  10. package/.aict/adapters/cline/ADAPTER.md +28 -0
  11. package/.aict/adapters/codex/ADAPTER.md +28 -0
  12. package/.aict/adapters/copilot/ADAPTER.md +28 -0
  13. package/.aict/adapters/cursor/ADAPTER.md +28 -0
  14. package/.aict/adapters/windsurf/ADAPTER.md +28 -0
  15. package/.aict/context/EXAMPLE.synthetic.md +53 -0
  16. package/.aict/context/FAILURE_MODES.md +40 -0
  17. package/.aict/context/PROMPT.md +47 -0
  18. package/.aict/context/README.md +44 -0
  19. package/.aict/context/TEMPLATE.md +63 -0
  20. package/.aict/cookbook/README.md +8 -0
  21. package/.aict/cookbook/bridge-to-a-second-family.md +103 -0
  22. package/.aict/cookbook/connect-a-tool.md +67 -0
  23. package/.aict/cookbook/review-a-half-product.md +79 -0
  24. package/.aict/cookbook/run-a-first-loop.md +81 -0
  25. package/.aict/examples/README.md +21 -0
  26. package/.aict/examples/ai-coding-long-task/CASE.md +161 -0
  27. package/.aict/examples/ai-coding-long-task/artifacts/acceptance-card.md +36 -0
  28. package/.aict/examples/ai-coding-long-task/artifacts/context-package.md +30 -0
  29. package/.aict/examples/ai-coding-long-task/artifacts/execution-prompt.md +30 -0
  30. package/.aict/examples/ai-coding-long-task/artifacts/first-ai-output.md +109 -0
  31. package/.aict/examples/ai-coding-long-task/artifacts/guard-review.md +40 -0
  32. package/.aict/examples/ai-coding-long-task/artifacts/handoff-note.md +28 -0
  33. package/.aict/examples/ai-coding-long-task/artifacts/harvest-seed.md +28 -0
  34. package/.aict/examples/ai-coding-long-task/artifacts/revised-output.md +62 -0
  35. package/.aict/examples/content-production-harvest/CASE.md +87 -0
  36. package/.aict/examples/content-production-harvest/artifacts/acceptance-card.md +28 -0
  37. package/.aict/examples/content-production-harvest/artifacts/context-package.md +28 -0
  38. package/.aict/examples/content-production-harvest/artifacts/execution-prompt.md +30 -0
  39. package/.aict/examples/content-production-harvest/artifacts/guard-review.md +28 -0
  40. package/.aict/examples/content-production-harvest/artifacts/handoff-note.md +28 -0
  41. package/.aict/examples/content-production-harvest/artifacts/harvest-seed.md +28 -0
  42. package/.aict/examples/multi-tool-collaboration/CASE.md +87 -0
  43. package/.aict/examples/multi-tool-collaboration/artifacts/acceptance-card.md +28 -0
  44. package/.aict/examples/multi-tool-collaboration/artifacts/context-package.md +28 -0
  45. package/.aict/examples/multi-tool-collaboration/artifacts/execution-prompt.md +30 -0
  46. package/.aict/examples/multi-tool-collaboration/artifacts/guard-review.md +28 -0
  47. package/.aict/examples/multi-tool-collaboration/artifacts/handoff-note.md +28 -0
  48. package/.aict/examples/multi-tool-collaboration/artifacts/harvest-seed.md +28 -0
  49. package/.aict/examples/personal-judgment-growth-assistant/CASE.md +87 -0
  50. package/.aict/examples/personal-judgment-growth-assistant/artifacts/acceptance-card.md +28 -0
  51. package/.aict/examples/personal-judgment-growth-assistant/artifacts/context-package.md +28 -0
  52. package/.aict/examples/personal-judgment-growth-assistant/artifacts/execution-prompt.md +30 -0
  53. package/.aict/examples/personal-judgment-growth-assistant/artifacts/guard-review.md +28 -0
  54. package/.aict/examples/personal-judgment-growth-assistant/artifacts/handoff-note.md +28 -0
  55. package/.aict/examples/personal-judgment-growth-assistant/artifacts/harvest-seed.md +28 -0
  56. package/.aict/examples/research-knowledge-synthesis/CASE.md +87 -0
  57. package/.aict/examples/research-knowledge-synthesis/artifacts/acceptance-card.md +28 -0
  58. package/.aict/examples/research-knowledge-synthesis/artifacts/context-package.md +28 -0
  59. package/.aict/examples/research-knowledge-synthesis/artifacts/execution-prompt.md +30 -0
  60. package/.aict/examples/research-knowledge-synthesis/artifacts/guard-review.md +28 -0
  61. package/.aict/examples/research-knowledge-synthesis/artifacts/handoff-note.md +28 -0
  62. package/.aict/examples/research-knowledge-synthesis/artifacts/harvest-seed.md +28 -0
  63. package/.aict/guard/EXAMPLE.synthetic.md +51 -0
  64. package/.aict/guard/FAILURE_MODES.md +40 -0
  65. package/.aict/guard/PROMPT.md +47 -0
  66. package/.aict/guard/README.md +44 -0
  67. package/.aict/guard/TEMPLATE.md +60 -0
  68. package/.aict/handoff/EXAMPLE.synthetic.md +51 -0
  69. package/.aict/handoff/FAILURE_MODES.md +40 -0
  70. package/.aict/handoff/PROMPT.md +47 -0
  71. package/.aict/handoff/README.md +44 -0
  72. package/.aict/handoff/TEMPLATE.md +60 -0
  73. package/.aict/harvest/EXAMPLE.synthetic.md +51 -0
  74. package/.aict/harvest/FAILURE_MODES.md +40 -0
  75. package/.aict/harvest/PROMPT.md +47 -0
  76. package/.aict/harvest/README.md +44 -0
  77. package/.aict/harvest/TEMPLATE.md +60 -0
  78. package/.aict/mechanisms/README.md +34 -0
  79. package/.aict/mechanisms/anti-drift-partner/EXAMPLE.synthetic.md +46 -0
  80. package/.aict/mechanisms/anti-drift-partner/FAILURE_MODES.md +25 -0
  81. package/.aict/mechanisms/anti-drift-partner/PROMPT.md +75 -0
  82. package/.aict/mechanisms/anti-drift-partner/README.md +82 -0
  83. package/.aict/mechanisms/anti-drift-partner/TEMPLATE.md +74 -0
  84. package/.aict/mechanisms/blind-spot-scan/EXAMPLE.synthetic.md +39 -0
  85. package/.aict/mechanisms/blind-spot-scan/FAILURE_MODES.md +25 -0
  86. package/.aict/mechanisms/blind-spot-scan/PROMPT.md +72 -0
  87. package/.aict/mechanisms/blind-spot-scan/README.md +79 -0
  88. package/.aict/mechanisms/blind-spot-scan/TEMPLATE.md +70 -0
  89. package/.aict/mechanisms/collaboration-coach/EXAMPLE.synthetic.md +40 -0
  90. package/.aict/mechanisms/collaboration-coach/FAILURE_MODES.md +25 -0
  91. package/.aict/mechanisms/collaboration-coach/PROMPT.md +72 -0
  92. package/.aict/mechanisms/collaboration-coach/README.md +79 -0
  93. package/.aict/mechanisms/collaboration-coach/TEMPLATE.md +61 -0
  94. package/.aict/mechanisms/do-not-handle-yet/EXAMPLE.synthetic.md +15 -0
  95. package/.aict/mechanisms/do-not-handle-yet/FAILURE_MODES.md +16 -0
  96. package/.aict/mechanisms/do-not-handle-yet/PROMPT.md +41 -0
  97. package/.aict/mechanisms/do-not-handle-yet/README.md +30 -0
  98. package/.aict/mechanisms/do-not-handle-yet/TEMPLATE.md +38 -0
  99. package/.aict/mechanisms/dual-guard/EXAMPLE.synthetic.md +54 -0
  100. package/.aict/mechanisms/dual-guard/FAILURE_MODES.md +25 -0
  101. package/.aict/mechanisms/dual-guard/PROMPT.md +76 -0
  102. package/.aict/mechanisms/dual-guard/README.md +81 -0
  103. package/.aict/mechanisms/dual-guard/TEMPLATE.md +73 -0
  104. package/.aict/mechanisms/feedback-absorption-ledger/EXAMPLE.synthetic.md +49 -0
  105. package/.aict/mechanisms/feedback-absorption-ledger/FAILURE_MODES.md +25 -0
  106. package/.aict/mechanisms/feedback-absorption-ledger/PROMPT.md +74 -0
  107. package/.aict/mechanisms/feedback-absorption-ledger/README.md +81 -0
  108. package/.aict/mechanisms/feedback-absorption-ledger/TEMPLATE.md +69 -0
  109. package/.aict/mechanisms/half-product-review/EXAMPLE.synthetic.md +15 -0
  110. package/.aict/mechanisms/half-product-review/FAILURE_MODES.md +16 -0
  111. package/.aict/mechanisms/half-product-review/PROMPT.md +41 -0
  112. package/.aict/mechanisms/half-product-review/README.md +30 -0
  113. package/.aict/mechanisms/half-product-review/TEMPLATE.md +38 -0
  114. package/.aict/mechanisms/handoff-abc/EXAMPLE.synthetic.md +47 -0
  115. package/.aict/mechanisms/handoff-abc/FAILURE_MODES.md +25 -0
  116. package/.aict/mechanisms/handoff-abc/PROMPT.md +75 -0
  117. package/.aict/mechanisms/handoff-abc/README.md +82 -0
  118. package/.aict/mechanisms/handoff-abc/TEMPLATE.md +60 -0
  119. package/.aict/mechanisms/harvest-and-erc/EXAMPLE.synthetic.md +43 -0
  120. package/.aict/mechanisms/harvest-and-erc/FAILURE_MODES.md +25 -0
  121. package/.aict/mechanisms/harvest-and-erc/PROMPT.md +74 -0
  122. package/.aict/mechanisms/harvest-and-erc/README.md +81 -0
  123. package/.aict/mechanisms/harvest-and-erc/TEMPLATE.md +60 -0
  124. package/.aict/mechanisms/honest-calibration/EXAMPLE.synthetic.md +43 -0
  125. package/.aict/mechanisms/honest-calibration/FAILURE_MODES.md +25 -0
  126. package/.aict/mechanisms/honest-calibration/PROMPT.md +74 -0
  127. package/.aict/mechanisms/honest-calibration/README.md +81 -0
  128. package/.aict/mechanisms/honest-calibration/TEMPLATE.md +66 -0
  129. package/.aict/mechanisms/one-click-dispatch/EXAMPLE.synthetic.md +15 -0
  130. package/.aict/mechanisms/one-click-dispatch/FAILURE_MODES.md +16 -0
  131. package/.aict/mechanisms/one-click-dispatch/PROMPT.md +41 -0
  132. package/.aict/mechanisms/one-click-dispatch/README.md +30 -0
  133. package/.aict/mechanisms/one-click-dispatch/TEMPLATE.md +38 -0
  134. package/.aict/mechanisms/plain-language-first-screen/EXAMPLE.synthetic.md +15 -0
  135. package/.aict/mechanisms/plain-language-first-screen/FAILURE_MODES.md +16 -0
  136. package/.aict/mechanisms/plain-language-first-screen/PROMPT.md +41 -0
  137. package/.aict/mechanisms/plain-language-first-screen/README.md +30 -0
  138. package/.aict/mechanisms/plain-language-first-screen/TEMPLATE.md +38 -0
  139. package/.aict/mechanisms/root-cause-brake/EXAMPLE.synthetic.md +55 -0
  140. package/.aict/mechanisms/root-cause-brake/FAILURE_MODES.md +25 -0
  141. package/.aict/mechanisms/root-cause-brake/PROMPT.md +73 -0
  142. package/.aict/mechanisms/root-cause-brake/README.md +79 -0
  143. package/.aict/mechanisms/root-cause-brake/TEMPLATE.md +74 -0
  144. package/.aict/mechanisms/scout-review-controller/EXAMPLE.synthetic.md +15 -0
  145. package/.aict/mechanisms/scout-review-controller/FAILURE_MODES.md +16 -0
  146. package/.aict/mechanisms/scout-review-controller/PROMPT.md +41 -0
  147. package/.aict/mechanisms/scout-review-controller/README.md +30 -0
  148. package/.aict/mechanisms/scout-review-controller/TEMPLATE.md +38 -0
  149. package/.aict/mechanisms/single-tool-guard/EXAMPLE.synthetic.md +54 -0
  150. package/.aict/mechanisms/single-tool-guard/FAILURE_MODES.md +25 -0
  151. package/.aict/mechanisms/single-tool-guard/PROMPT.md +76 -0
  152. package/.aict/mechanisms/single-tool-guard/README.md +83 -0
  153. package/.aict/mechanisms/single-tool-guard/TEMPLATE.md +75 -0
  154. package/.aict/mechanisms/task-splitting/EXAMPLE.synthetic.md +53 -0
  155. package/.aict/mechanisms/task-splitting/FAILURE_MODES.md +25 -0
  156. package/.aict/mechanisms/task-splitting/PROMPT.md +72 -0
  157. package/.aict/mechanisms/task-splitting/README.md +79 -0
  158. package/.aict/mechanisms/task-splitting/TEMPLATE.md +76 -0
  159. package/.aict/modes/README.md +11 -0
  160. package/.aict/modes/execute.md +31 -0
  161. package/.aict/modes/handoff.md +29 -0
  162. package/.aict/modes/harvest.md +30 -0
  163. package/.aict/modes/review.md +28 -0
  164. package/.aict/modes/shape.md +34 -0
  165. package/.aict/privacy/COMMERCIAL_BOUNDARY.md +34 -0
  166. package/.aict/privacy/PRIVACY.md +36 -0
  167. package/.aict/privacy/REDACTION_CHECKLIST.md +12 -0
  168. package/.aict/profile/CANDIDATES.md +44 -0
  169. package/.aict/profile/EXAMPLE.synthetic.md +49 -0
  170. package/.aict/profile/FAILURE_MODES.md +40 -0
  171. package/.aict/profile/PROMPT.md +47 -0
  172. package/.aict/profile/README.md +44 -0
  173. package/.aict/profile/TEMPLATE.md +57 -0
  174. package/.aict/prompts/acceptance-definition.md +109 -0
  175. package/.aict/prompts/guard-review.md +116 -0
  176. package/.aict/prompts/handoff-generation.md +110 -0
  177. package/.aict/prompts/harvest-extraction.md +110 -0
  178. package/.aict/prompts/mode-switching.md +66 -0
  179. package/.aict/prompts/profile-creation.md +66 -0
  180. package/.aict/prompts/profile-refinement.md +66 -0
  181. package/.aict/prompts/project-context-packaging.md +113 -0
  182. package/.aict/prompts/red-team-challenge.md +106 -0
  183. package/.aict/prompts/rule-update-proposal.md +114 -0
  184. package/.aict/prompts/workflow-reset.md +109 -0
  185. package/.aict/roles/README.md +18 -0
  186. package/.aict/roles/executor.md +34 -0
  187. package/.aict/roles/harvester.md +33 -0
  188. package/.aict/roles/owner-controller.md +38 -0
  189. package/.aict/roles/scout.md +33 -0
  190. package/.aict/roles/supervisor.md +34 -0
  191. package/.aict/roles/system-guardian.md +34 -0
  192. package/.aict/skills/acceptance/SKILL.md +43 -0
  193. package/.aict/skills/context/SKILL.md +44 -0
  194. package/.aict/skills/evidence-pack/SKILL.md +42 -0
  195. package/.aict/skills/guard/SKILL.md +46 -0
  196. package/.aict/skills/handoff/SKILL.md +44 -0
  197. package/.aict/skills/harvest/SKILL.md +44 -0
  198. package/.aict/skills/mode-switch/SKILL.md +42 -0
  199. package/.aict/skills/profile/SKILL.md +42 -0
  200. package/.aict/skills/red-team/SKILL.md +42 -0
  201. package/.aict/skills/single-tool-guard/SKILL.md +42 -0
  202. package/.aict/state/CURRENT_STATE.md +13 -0
  203. package/.aict/state/DECISIONS.md +7 -0
  204. package/.aict/state/TASK_LOG.md +7 -0
  205. package/.aict/state/evidence.jsonl +2 -0
  206. package/.aict/state/learning-ledger.jsonl +1 -0
  207. package/.aict/state/receipts.jsonl +1 -0
  208. package/.aict/state/runs.jsonl +1 -0
  209. package/.aict/state/tasks.jsonl +1 -0
  210. package/.aict/walkthroughs/10-minute-your-task.md +107 -0
  211. package/.aict/walkthroughs/10-minute.md +43 -0
  212. package/.aict/walkthroughs/30-minute.md +22 -0
  213. package/.aict/walkthroughs/60-minute.md +27 -0
  214. package/.aict/walkthroughs/synthetic-loop-transcript.md +43 -0
  215. package/CHANGELOG.md +23 -0
  216. package/CODE_OF_CONDUCT.md +20 -0
  217. package/CONTRIBUTING.md +30 -0
  218. package/KNOWN_LIMITATIONS.md +54 -0
  219. package/LICENSE +199 -0
  220. package/PRODUCT_CONTRACT.md +446 -0
  221. package/README.md +245 -0
  222. package/RELEASE_CHECKLIST.md +78 -0
  223. package/SECURITY.md +56 -0
  224. package/START_HERE.md +89 -0
  225. package/bin/ai-collab.js +2 -0
  226. package/docs/DOGFOOD.md +85 -0
  227. package/docs/FEEDBACK.md +61 -0
  228. package/docs/FIRST_EXPERIENCE_SPEC.md +32 -0
  229. package/docs/FREE_VS_PAID.md +53 -0
  230. package/docs/PUBLIC_BOUNDARY.md +36 -0
  231. package/docs/PUBLIC_MAPPING.md +178 -0
  232. package/docs/RELEASE_PRIORITY.md +23 -0
  233. package/docs/WHY_THIS_EXISTS.md +36 -0
  234. package/docs/open-system/00-start-here.md +60 -0
  235. package/docs/open-system/01-ai-collaboration-os.md +33 -0
  236. package/docs/open-system/02-six-layer-architecture.md +45 -0
  237. package/docs/open-system/03-role-system.md +33 -0
  238. package/docs/open-system/04-core-mechanisms.md +34 -0
  239. package/docs/open-system/05-failure-patterns.md +31 -0
  240. package/docs/open-system/06-how-to-adapt-to-your-workflow.md +31 -0
  241. package/package.json +69 -0
  242. package/privacy-manifest.json +78 -0
  243. package/privacy-scan.local.json.example +18 -0
  244. package/scripts/lib/forbidden-in-pack.js +55 -0
  245. package/scripts/pack-check.js +154 -0
  246. package/scripts/privacy-scan.js +487 -0
  247. package/scripts/validate-contract.js +160 -0
  248. package/src/adapters.js +590 -0
  249. package/src/bootstrap.js +1184 -0
  250. package/src/catalog.js +2723 -0
  251. package/src/cli.js +2899 -0
  252. package/src/dialogue.js +470 -0
  253. package/src/i18n.js +1034 -0
  254. package/src/ledger.js +2011 -0
  255. package/src/render.js +1381 -0
  256. package/src/sendmodel.js +452 -0
  257. package/src/validate.js +1307 -0
  258. package/src/workspace.js +1679 -0
  259. package/tests/contract.test.js +8514 -0
package/src/render.js ADDED
@@ -0,0 +1,1381 @@
1
+ import {
2
+ adapterDefinitions,
3
+ caseDefinitions,
4
+ layerDefinitions,
5
+ promptDefinitions,
6
+ skillDefinitions
7
+ } from "./catalog.js";
8
+
9
+ const tools = "Claude Code / Codex / Cursor / Windsurf / Copilot / Cline";
10
+
11
+ function list(items) {
12
+ return items.map((item) => `- ${item}`).join("\n");
13
+ }
14
+
15
+ function numbered(items) {
16
+ return items.map((item, index) => `${index + 1}. ${item}`).join("\n");
17
+ }
18
+
19
+ // Optional mechanism sections. These render only when the deepened mechanism
20
+ // packs (dual-guard, task-splitting) supply the field, so the other mechanism
21
+ // packs stay byte-for-byte identical to their committed output.
22
+ function section(heading, body) {
23
+ if (!body) return "";
24
+ return `\n\n## ${heading}\n\n${body}`;
25
+ }
26
+
27
+ function listSection(heading, items) {
28
+ if (!items || items.length === 0) return "";
29
+ return section(heading, list(items));
30
+ }
31
+
32
+ function numberedSection(heading, items) {
33
+ if (!items || items.length === 0) return "";
34
+ return section(heading, numbered(items));
35
+ }
36
+
37
+ export function renderStartHere() {
38
+ return `# START_HERE - Open AI Collaboration Workspace
39
+
40
+ This workspace helps you turn messy AI work into visible state: profile, context, acceptance, guard review, handoff, and harvest.
41
+
42
+ AI productivity is a product, not a sum — this workspace gives you the factors beyond the model itself (profile, context, acceptance, guard, handoff, harvest). Why: see docs/WHY_THIS_EXISTS.md.
43
+
44
+ 中文:先别背概念。先看同一段混乱输入如何被拆成可执行、可审查、可交接的文件,再复制到自己的任务。
45
+
46
+ ## Start with one AI (you only need one tool to begin)
47
+
48
+ You do not need two AI tools to start. With a single AI, this workspace turns "the AI said it's done" into a result that has evidence, can be re-checked, handed off, and harvested — and that alone is most of the value. The completion-claim check routes through \`mechanisms/single-tool-guard\`: a fresh conversation plus an adversarial reviewer prompt, instead of trusting the same assistant that just wrote the work. This is the front door, not a downgrade.
49
+
50
+ 中文:一个AI也能开始:先把"做完了"变成有证据、可复核、可交接、可沉淀的结果。
51
+
52
+ When a second, different model family is available, you can upgrade to the cross-family double guard (\`mechanisms/dual-guard\`) — an independent review from a different AI family that a single tool cannot give itself (it can only *claim* one — the CLI marks that self-declared and unverified). That is the ceiling, not the entry bar. Don't have a second family yet? \`cookbook/bridge-to-a-second-family.md\` shows how to stand one up (manual or auto) and route a review across it.
53
+
54
+ 中文:有第二个模型族时,可以升级成跨族双守卫。
55
+
56
+ We do not disguise a single-tool self-review as a cross-family pass: the guard level is computed from evidence, not self-asserted. A single tool tops out at L2 (pass-with-risk), and a plain pass requires L3+ with a different model family.
57
+
58
+ 中文:我们不会把单工具自审伪装成跨族通过。
59
+
60
+ ## Messy input -> structured loop
61
+
62
+ Messy input:
63
+
64
+ \`\`\`text
65
+ I need this task board cleaned up. Add drag-and-drop, maybe keyboard support,
66
+ make it prettier, keep tests passing, and don't rewrite too much.
67
+ \`\`\`
68
+
69
+ Raw AI usually answers with a broad promise.
70
+
71
+ This workspace produces visible state instead:
72
+
73
+ \`\`\`text
74
+ Context: current slice is reorder behavior; visual redesign is out of scope.
75
+ Acceptance: existing data survives; drag and keyboard reorder both need tests.
76
+ Guard: reject completion until keyboard movement has evidence.
77
+ Handoff: mouse and keyboard reorder done and tested, guard accepted; only visual polish unverified.
78
+ Harvest: long coding tasks need acceptance before implementation and guard before handoff.
79
+ \`\`\`
80
+
81
+ ## 10-minute path
82
+
83
+ Goal: feel the system immediately. Two ways in; pick one.
84
+
85
+ ### Path 1 (recommended): run the loop on your own real task
86
+
87
+ 1. Open \`walkthroughs/10-minute-your-task.md\` and follow its five steps.
88
+ 2. You describe one real (lightly redacted) task; the AI returns a boundary card and an acceptance card, so "done" is defined before any work.
89
+ 3. You let the AI do only the accepted slice and report what it changed, ran, and did not verify.
90
+ 4. You open a fresh chat (ideally a different AI brand) and have it re-check the result against evidence.
91
+ 5. You watch the independent re-check reject a claim the evidence does not back, on your own task.
92
+
93
+ ### Path 2: watch the prepared demo first
94
+
95
+ Pick this if your task feels too sensitive to paste right now, or you want to see the flow before running it on your own work.
96
+
97
+ 1. Open \`walkthroughs/10-minute.md\` (the demo preview) and follow its five steps.
98
+ 2. It drives the prepared case \`examples/ai-coding-long-task/CASE.md\` and its artifacts.
99
+ 3. You copy the context package, acceptance card, and execution prompt into your AI tool.
100
+ 4. You run guard review before accepting the answer.
101
+ 5. You watch the guard catch a false "done" the prepared case plants, then read the revised output, handoff, and harvest seed — then run Path 1 on your own task.
102
+
103
+ Expected result: you walk one complete loop (context -> acceptance -> first output -> guard -> revised -> handoff -> harvest) and get one reusable artifact.
104
+
105
+ ## 30-minute path
106
+
107
+ Goal: adapt one layer to a real task.
108
+
109
+ 1. Open \`context/TEMPLATE.md\` or \`acceptance/TEMPLATE.md\`.
110
+ 2. Fill it for one current task using redacted, local-only material.
111
+ 3. Open \`adapters/\` and choose the adapter for your AI tool.
112
+ 4. Paste the shared contract pointer and your filled template into the tool.
113
+ 5. Produce one review result or handoff note.
114
+
115
+ Expected result: one real task has a written boundary or done standard.
116
+
117
+ ## 60-minute path
118
+
119
+ Goal: run one complete task loop.
120
+
121
+ 1. Fill \`profile/TEMPLATE.md\` lightly.
122
+ 2. Fill \`context/TEMPLATE.md\`.
123
+ 3. Fill \`acceptance/TEMPLATE.md\`.
124
+ 4. Use \`prompts/guard-review.md\` after the first artifact.
125
+ 5. Save \`handoff/TEMPLATE.md\` before stopping.
126
+ 6. Extract one reusable lesson with \`harvest/TEMPLATE.md\`.
127
+
128
+ Expected result: profile/context, acceptance, execution prompt, guard review, handoff, and harvest all exist for one task.
129
+
130
+ ## What this is
131
+
132
+ - A complete local workspace you can inspect and modify.
133
+ - A set of prompts, templates, skills, adapters, and synthetic cases.
134
+ - A method for making AI collaboration resumable and reviewable.
135
+
136
+ ## What this is not
137
+
138
+ - Not a hosted assistant.
139
+ - Not an autonomous agent framework.
140
+ - Not a cloud memory store.
141
+ - Not a paywall for the basic method.
142
+
143
+ ## Want the AI to remind you on its own
144
+
145
+ Tired of remembering to run the guard yourself? Install the adapter into your AI tool's always-on instructions with \`node bin/ai-collab.js adapters install --target <repo>\` (after publish: \`ai-collab adapters install --target <repo>\`). It turns on restrained coaching reminders, so the AI prompts you at the key moments - define done, review a completion claim, hand off, harvest. If you only have one tool, the completion-claim check routes through \`single-tool-guard\` (a fresh adversarial pass in the same tool) instead of a second AI brand.
146
+
147
+ ## Where to go next
148
+
149
+ - New task: start with \`context/TEMPLATE.md\`.
150
+ - Long task: add \`acceptance/TEMPLATE.md\` before execution.
151
+ - Risky output: run \`guard/PROMPT.md\`.
152
+ - Switching tools: use \`handoff/TEMPLATE.md\` plus the adapter for the next tool.
153
+ - Finished loop: write \`harvest/TEMPLATE.md\`.
154
+ - Want proactive nudges: run \`adapters install\` (one tool only -> \`single-tool-guard\`).
155
+
156
+ ## 中文 60 分钟搭建
157
+
158
+ 1. 先写一个轻量 profile:你希望 AI 怎么配合你,哪些动作必须先问。
159
+ 2. 给一个真实任务写 context:目标、现状、约束、不要做什么、还缺什么证据。
160
+ 3. 先写 acceptance:怎样才算做完,哪些状态必须打回。
161
+ 4. 把 adapter guidance 和相关模板交给你的 AI 工具。
162
+ 5. 第一版产物出来后,跑 guard review。
163
+ 6. 停下来前写 handoff。
164
+ 7. 最后写 harvest,把这次任务里可复用的经验留下。
165
+ `;
166
+ }
167
+
168
+ export function renderSharedCoreContract() {
169
+ return `# Shared Core Contract
170
+
171
+ All adapters in this workspace point here. Do not maintain six different rule systems.
172
+
173
+ ## Core loop
174
+
175
+ 1. Profile - how the assistant adapts to the user.
176
+ 2. Context - what the task boundary is.
177
+ 3. Acceptance - what done means.
178
+ 4. Guard / Review - how output is challenged before trust.
179
+ 5. Handoff - how the next session resumes.
180
+ 6. Harvest - what becomes reusable knowledge or material.
181
+
182
+ ## Operating rules
183
+
184
+ - Work local-first. Do not upload user content by default.
185
+ - Keep private material out of examples.
186
+ - Label facts, assumptions, decisions, and unverified claims.
187
+ - Use synthetic cases for public material.
188
+ - Paid help may calibrate or save time, but the generic method is open.
189
+
190
+ ## Tool handoff shape
191
+
192
+ When handing this to ${tools}, include:
193
+
194
+ 1. This shared core contract.
195
+ 2. The relevant layer template.
196
+ 3. The task context or synthetic case.
197
+ 4. The acceptance card if work will be judged.
198
+ 5. The handoff note if another tool will continue.
199
+
200
+ ## Coaching layer (proactive reminders)
201
+
202
+ Do not wait to be asked. At these collaboration moments, proactively remind the user of the matching step — briefly, once per moment, then continue:
203
+
204
+ 1. Task start (a new task or vague idea arrives): set a context boundary and acceptance before building.
205
+ 2. Pre-execution (about to act before "done" is defined): define the acceptance card first.
206
+ 3. Completion claim (the assistant says "done / finished / shipped"): run a guard review before trusting it. One model family only -> run \`single-tool-guard\` (new conversation + adversarial prompt). A second, different family available -> run \`dual-guard\`. A multi-tool setup -> run the full fusion review.
207
+ 4. Long thread / tool switch (context is getting long, or work is moving to another tool): generate a handoff instead of relying on chat memory.
208
+ 5. Reusable insight (a judgment, method, or lesson worth keeping appears): harvest it into a card.
209
+ 6. Repeated preference (the same preference shows up several times): offer it as a profile-update candidate.
210
+
211
+ ### Restraint (default standard — this is the line that keeps the system installed)
212
+
213
+ - **light** — prompt only at the two highest-risk nodes: completion-claim and tool-switch.
214
+ - **standard (DEFAULT)** — fire at nodes 1, 3, 4, 6; fold node 2 into the task-start reminder (skip it if acceptance was already set) and node 5 into a natural pause rather than a separate interruption. Count "once per moment" by task phase, not by node, so the start of one task is one reminder — do not stack reminders on back-to-back turns at a task's opening. Never every turn, never lecture theory.
215
+ - **strict** — prompt at all six nodes, every time they fire.
216
+
217
+ The user switches with \`coach: light\` / \`coach: standard\` / \`coach: strict\`. Over-prompting is the fastest way to get the whole system uninstalled. Restraint is not a suggestion, it is a hard rule. Default to standard. A reminder that fires every turn is a failure mode, not thoroughness.
218
+
219
+ ### Keyword-triggered modes (the user can pull a working mode by name)
220
+
221
+ Separate from the timed reminders above: when the user's message contains one of the trigger words below, switch into the matching mode and stay in it until they switch to another mode or move on to a different topic. These are explicit, on-demand modes — the user is asking for a way of working, not a reminder. Speak in the user's own language and stay plain.
222
+
223
+ - "碰撞模式" / "碰一下" / "陪我想想" / "think with me" -> COLLISION: do not rush to a solution and do not just agree. Collide with their view, poke holes in the logic, and help them think a fuzzy idea clear. Agreeing too fast is the failure mode here.
224
+ - "扫描盲区" / "盲区" / "换个视角" / "blind spots" -> BLIND-SPOT SCAN: deliberately take an outside view — the customer, a competitor, an opponent, or themselves three years from now — to surface the dead angles they cannot see from inside the problem. If a \`mechanisms/blind-spot-scan\` package is present in the workspace, follow its full method; otherwise run the outside-view scan directly from this description.
225
+ - "红队" / "挑刺" / "red team" -> RED TEAM: take the attacker's worst-case view. Show concretely how their plan can be broken, gamed, or abused, not how it works when everything goes right.
226
+ - "双守卫" / "复核" / "dual guard" -> DUAL GUARD: pull a second opinion, ideally from a different model family, for an independent re-check. The point is that it is not one AI's say-so; if no second family is available, say so plainly rather than dressing up a single-tool self-review as a cross-family pass.
227
+ - "根因" / "root cause" -> ROOT CAUSE: do not patch the surface symptom. Stop and find the underlying root cause first, then decide what to fix.
228
+
229
+ When none of these words appears, ignore this section and behave normally — never force a mode the user did not ask for.
230
+
231
+ ### First-run promise (act on this the FIRST time, before anything else)
232
+
233
+ The first time you work with this user after the workspace is installed — on your very first reply, proactively — run the full onboarding script below. Do not wait to be asked. This is a four-step script (install -> scan -> profile + pain points -> harvest), and you run it as a guided conversation, one step at a time, stopping for the user wherever it says to stop.
234
+
235
+ **HARD RULE throughout — PLAIN LANGUAGE.** Never hand the user a technical term. Translate every task title into everyday words in your head before you say it: "auth" -> "login stuff", "payment" -> "money / checkout", "refactor" -> "tidying up the code", "API" -> "the connection between two things". Even a very technical title gets translated first. The whole script is spoken in the user's own language and stays plain — a person who has never written code should follow every sentence.
236
+
237
+ #### Step 0 — Installed (show the canonical intro VERBATIM)
238
+
239
+ Run \`ai-collab welcome\` (before publish: \`node bin/ai-collab.js welcome\`) and show its output VERBATIM. Do NOT re-summarize or paraphrase it — the CLI hard-prints the canonical intro (the six layers, the keyword modes, the honest privacy line, the closing question) so it always lands in full instead of being garbled by a re-write. Print it as-is, then STOP and let the user answer the closing question.
240
+
241
+ #### Step 1 — Scan (only after they say go)
242
+
243
+ When they say to scan ("scan" / "go" / "just the X project" / etc.): first state the honesty caveat below, then run the bootstrap for the deterministic facts.
244
+
245
+ Honesty about the scan — you MUST say this before scanning, it is the whole point: the scan is done by YOU, the cloud AI they already use, so the content passes through your provider's servers like any normal chat. Say plainly: this is NOT "zero data leaves your machine" — any tool claiming "absolutely no leak" is bluffing. But it is no more exposure than normally talking to you. The ai-collab tool itself sends nothing to third parties. They can narrow the scope or decline. Default scope: only the currently active project, nothing wider unless they ask.
246
+
247
+ Then run \`ai-collab bootstrap --yes\` (before publish: \`node bin/ai-collab.js bootstrap --yes\`) for the DETERMINISTIC facts: which "done"s lack evidence (VERIFY), what is in flight (RESUME), profile clues, high-risk role signals, harvestable lessons. Everything you say from here on is built on these scanned facts plus the conversation you are having now — never on a guess.
248
+
249
+ #### Step 2 — Profile read + collaboration advice + CONFIRM (do this first, one block, then WAIT)
250
+
251
+ Open with a GROUNDED read of who they are at work — "you come across as a … kind of person" — but EVERY claim must cite real scan evidence: their actual task titles (translated to plain words), the "done"s that carried no evidence, the files they re-touched, the pace the scan shows. NEVER an ungrounded personality guess ("you seem like a perfectionist") — that is fortune-telling and it kills trust on the first turn. Name the pattern as a neutral fact, not a flaw ("not careless — just that working solo, nobody was there to hold you to that step").
252
+
253
+ Then add collaboration advice that follows from it: "based on this, working with me will go smoother — for example …" tied to the specific thing you just observed (e.g. "you tell me something is done, I will quietly put together the proof it is actually done before we move on, so you do not have to remember to").
254
+
255
+ Then ask, in their language, "did I get this right?" and STOP. WAIT for them to confirm or correct before you continue — do not roll on into the pain points in the same breath.
256
+
257
+ #### Step 3 — Grounded pain points, ONE AT A TIME
258
+
259
+ From the bootstrap cards, raise ONLY real problems the scan actually found. NEVER invent one. Things the scan canNOT see — over-agreement, plans that went un-reviewed — are NOT raised at all here; silence is correct when there is no scanned evidence. Surface the points one at a time, never as a list.
260
+
261
+ For each point: state the problem grounded in the scanned fact, then give the framework value going forward — and keep it at the framework benefit, do NOT drop into "task X needs fixing":
262
+ - guard will stop you before "done" and ask for the evidence;
263
+ - handoff carries the background across chats and tools, so a new conversation does not start from zero;
264
+ - for high-stakes work you can pull a poke-holes role (red-team / dual-guard / scout) so it is not one AI's say-so.
265
+
266
+ Translate the role name into plain words before you ever say it ("someone whose only job is to try to break the plan"). End each point with "want me to expand on this, or move to the next?" and let them steer.
267
+
268
+ #### Step 4 — Harvest (close the loop on THIS conversation)
269
+
270
+ Recap what THIS conversation actually produced — concretely, not vaguely: the profile they just confirmed, and the one point they cared about most. Offer to save both: the profile -> stored, so every new chat or tool remembers it without you re-explaining; the thing they cared about -> written down as a standing rule that applies from now on. Land on ONE concrete action, not a menu: "want me to save these two now? they take effect from the next time." Close with a warm but GROUNDED outlook — name the specific 2-3 things from THIS chat that will now be different (e.g. "you say done, I will have the proof ready; you switch chats, the background follows; the thing you flagged is now a rule"), never a vague "collaboration will be better".
271
+
272
+ If they decline at any point: give a one-line honest intro and "say the word whenever" — degrade gracefully, do not nag. After this first run, restraint applies (coaching layer above): prompt at the key moments, not every turn.
273
+
274
+ See \`mechanisms/collaboration-coach\` for the full node map and \`mechanisms/single-tool-guard\` for the one-tool front-door guard (a real starting guard, capped at L2 — not a passed cross-family gate).
275
+ `;
276
+ }
277
+
278
+ export function renderLayerReadme(layer) {
279
+ return `# ${layer.title}
280
+
281
+ ${layer.summary}
282
+
283
+ 中文:${layer.zh}
284
+
285
+ ## Purpose
286
+
287
+ ${layer.purpose}
288
+
289
+ ## When to use
290
+
291
+ ${layer.when}
292
+
293
+ ## Input shape
294
+
295
+ ${layer.input}
296
+
297
+ ## Output shape
298
+
299
+ ${layer.output}
300
+
301
+ ## Copy-paste prompt
302
+
303
+ See \`PROMPT.md\`. The prompt is designed to work in ${tools}.
304
+
305
+ ## Blank template
306
+
307
+ See \`TEMPLATE.md\`.
308
+
309
+ ## Filled synthetic example
310
+
311
+ See \`EXAMPLE.synthetic.md\`.
312
+
313
+ ## Common failure modes
314
+
315
+ See \`FAILURE_MODES.md\`.
316
+
317
+ ## How to hand it to Claude Code / Codex / Cursor / Windsurf / Copilot / Cline
318
+
319
+ 1. Open the adapter for your tool in \`../adapters/\`.
320
+ 2. Include \`../adapters/SHARED_CORE_CONTRACT.md\`.
321
+ 3. Paste this layer's \`PROMPT.md\` plus either \`TEMPLATE.md\` or \`EXAMPLE.synthetic.md\`.
322
+ 4. Ask the tool to return the layer's output shape exactly.
323
+ `;
324
+ }
325
+
326
+ export function renderLayerPrompt(layer) {
327
+ return `# ${layer.title} Prompt
328
+
329
+ ## Purpose
330
+
331
+ ${layer.purpose}
332
+
333
+ ## When to use
334
+
335
+ ${layer.when}
336
+
337
+ ## Input shape
338
+
339
+ ${layer.input}
340
+
341
+ ## Output shape
342
+
343
+ ${layer.output}
344
+
345
+ ## Copy-paste prompt
346
+
347
+ \`\`\`text
348
+ ${layer.prompt}
349
+
350
+ Input:
351
+ [paste your redacted task material here]
352
+
353
+ Output shape:
354
+ ${layer.output}
355
+
356
+ Rules:
357
+ - Keep private material local and redacted.
358
+ - Label facts and assumptions.
359
+ - If information is missing, ask at most three concrete questions.
360
+ - Make the result usable in Claude Code / Codex / Cursor / Windsurf / Copilot / Cline.
361
+ \`\`\`
362
+
363
+ ## Blank template
364
+
365
+ Use \`TEMPLATE.md\`.
366
+
367
+ ## Filled synthetic example
368
+
369
+ Use \`EXAMPLE.synthetic.md\`.
370
+
371
+ ## Common failure modes
372
+
373
+ Use \`FAILURE_MODES.md\`.
374
+ `;
375
+ }
376
+
377
+ export function renderLayerTemplate(layer) {
378
+ return `# ${layer.title} Template
379
+
380
+ ## Purpose
381
+
382
+ ${layer.purpose}
383
+
384
+ ## When to use
385
+
386
+ ${layer.when}
387
+
388
+ ## Input shape
389
+
390
+ ${layer.input}
391
+
392
+ ## Output shape
393
+
394
+ ${layer.output}
395
+
396
+ ## Copy-paste prompt
397
+
398
+ Open \`PROMPT.md\` and paste this completed template below it.
399
+
400
+ ## Blank template
401
+
402
+ ${layer.template.map((field) => `### ${field}\n\n`).join("\n")}
403
+
404
+ ## Filled synthetic example
405
+
406
+ See \`EXAMPLE.synthetic.md\`.
407
+
408
+ ## Common failure modes
409
+
410
+ See \`FAILURE_MODES.md\`.
411
+
412
+ ## How to hand it to Claude Code / Codex / Cursor / Windsurf / Copilot / Cline
413
+
414
+ Use the adapter in \`../adapters/\` and include the shared core contract.
415
+ `;
416
+ }
417
+
418
+ export function renderLayerExample(layer) {
419
+ return `# ${layer.title} Filled Synthetic Example
420
+
421
+ ## Purpose
422
+
423
+ ${layer.purpose}
424
+
425
+ ## When to use
426
+
427
+ ${layer.when}
428
+
429
+ ## Input shape
430
+
431
+ ${layer.input}
432
+
433
+ ## Output shape
434
+
435
+ ${layer.output}
436
+
437
+ ## Copy-paste prompt
438
+
439
+ Use \`PROMPT.md\` with the synthetic input below.
440
+
441
+ ## Blank template
442
+
443
+ Use \`TEMPLATE.md\` for your own task.
444
+
445
+ ## Filled synthetic example
446
+
447
+ ${layer.example.join("\n\n")}
448
+
449
+ ## Common failure modes
450
+
451
+ See \`FAILURE_MODES.md\`.
452
+
453
+ ## How to hand it to Claude Code / Codex / Cursor / Windsurf / Copilot / Cline
454
+
455
+ Paste this example into any tool with \`../adapters/SHARED_CORE_CONTRACT.md\` to see the expected shape.
456
+ `;
457
+ }
458
+
459
+ export function renderLayerFailures(layer) {
460
+ return `# ${layer.title} Common Failure Modes
461
+
462
+ ## Purpose
463
+
464
+ ${layer.purpose}
465
+
466
+ ## When to use
467
+
468
+ Read this before trusting a ${layer.title.toLowerCase()} artifact.
469
+
470
+ ## Input shape
471
+
472
+ The artifact plus the original context and acceptance card.
473
+
474
+ ## Output shape
475
+
476
+ A short list of risks to fix before reuse.
477
+
478
+ ## Copy-paste prompt
479
+
480
+ Ask your AI tool: "Check this ${layer.title.toLowerCase()} artifact against the failure modes below and name the first concrete fix."
481
+
482
+ ## Blank template
483
+
484
+ Use \`TEMPLATE.md\` to rewrite the artifact.
485
+
486
+ ## Filled synthetic example
487
+
488
+ Use \`EXAMPLE.synthetic.md\` to compare a safe example.
489
+
490
+ ## Common failure modes
491
+
492
+ ${list(layer.failures)}
493
+
494
+ ## How to hand it to Claude Code / Codex / Cursor / Windsurf / Copilot / Cline
495
+
496
+ Paste this file after the artifact and ask for findings ordered by risk.
497
+ `;
498
+ }
499
+
500
+ export function renderPrompt(prompt) {
501
+ if (prompt.operativeCore) {
502
+ return renderOperativePrompt(prompt);
503
+ }
504
+ return `# ${prompt.title}
505
+
506
+ Purpose: ${prompt.purpose}
507
+
508
+ ## Scenario
509
+
510
+ ${prompt.scenario}
511
+
512
+ ## Input requirements
513
+
514
+ ${list(prompt.inputRequirements)}
515
+
516
+ ## Operating steps
517
+
518
+ ${numbered(prompt.steps)}
519
+
520
+ ## Copy-paste prompt
521
+
522
+ \`\`\`text
523
+ You are helping me with ${prompt.title.toLowerCase()} in a local-first AI collaboration workspace.
524
+
525
+ Task: ${prompt.purpose}
526
+
527
+ Scenario:
528
+ ${prompt.scenario}
529
+
530
+ Instructions:
531
+ - Work only from the material I provide.
532
+ - Follow these steps:
533
+ ${prompt.steps.map((step, index) => ` ${index + 1}. ${step}`).join("\n")}
534
+ - Do not claim to understand my private business beyond the provided context.
535
+ - Return the expected output shape below.
536
+
537
+ Material:
538
+ [paste redacted material here]
539
+ \`\`\`
540
+
541
+ ## Expected output
542
+
543
+ ${list(prompt.outputFormat)}
544
+
545
+ ## Failure modes
546
+
547
+ ${list(prompt.failureModes)}
548
+
549
+ ## Example
550
+
551
+ ${prompt.example}
552
+
553
+ ## Use with
554
+
555
+ Claude Code / Codex / Cursor / Windsurf / Copilot / Cline.
556
+ `;
557
+ }
558
+
559
+ // A small set of "judgment-quality" prompts carry an operativeCore: a core
560
+ // distilled from real practice (desensitized). For those, the copy-paste block
561
+ // is self-contained and ships the specific thresholds, checks, and
562
+ // counter-examples that make the prompt bite — the same shape as a deepened
563
+ // mechanism PROMPT.md (Trigger / Do not use / Input / Process / Output shape /
564
+ // Pass bar / Reject bar / Rules) — instead of a generic skeleton mechanically
565
+ // derived from a flat step list. Prompts without an operativeCore stay
566
+ // byte-for-byte identical to their previous template output.
567
+ export function renderOperativePrompt(prompt) {
568
+ const core = prompt.operativeCore;
569
+ return `# ${prompt.title}
570
+
571
+ Purpose: ${prompt.purpose}
572
+
573
+ ## Scenario
574
+
575
+ ${prompt.scenario}
576
+
577
+ ## Input requirements
578
+
579
+ ${list(prompt.inputRequirements)}
580
+
581
+ ## Operating steps
582
+
583
+ ${numbered(core.process)}
584
+
585
+ ## Copy-paste prompt
586
+
587
+ \`\`\`text
588
+ You are helping me with ${prompt.title.toLowerCase()} in a local-first AI collaboration workspace.
589
+
590
+ Task: ${prompt.purpose}
591
+
592
+ Trigger:
593
+ ${core.trigger}
594
+
595
+ Do not use when:
596
+ ${core.antiTrigger}
597
+
598
+ Input:
599
+ ${core.input}
600
+
601
+ Process:
602
+ ${core.process.map((step, index) => `${index + 1}. ${step}`).join("\n")}
603
+
604
+ Output shape:
605
+ ${core.outputShape.map((item) => `- ${item}`).join("\n")}
606
+
607
+ Pass bar (do not pass unless all hold):
608
+ ${core.passBar.map((item) => `- ${item}`).join("\n")}
609
+
610
+ Reject bar (send back if any holds):
611
+ ${core.rejectBar.map((item) => `- ${item}`).join("\n")}
612
+
613
+ Rules:
614
+ - Work only from the material I provide.
615
+ - Keep private material local; use public-safe synthetic wording for examples.
616
+ - Label facts, assumptions, and unverified claims.
617
+ - Do not claim to understand my private business beyond the provided context.
618
+
619
+ Material:
620
+ [paste redacted material here]
621
+ \`\`\`
622
+
623
+ ## Expected output
624
+
625
+ ${list(prompt.outputFormat)}
626
+
627
+ ## Counter-example
628
+
629
+ ${core.counterExample}
630
+
631
+ ## Failure modes
632
+
633
+ ${list(prompt.failureModes)}
634
+
635
+ ## Example
636
+
637
+ ${prompt.example}
638
+
639
+ ## Use with
640
+
641
+ Claude Code / Codex / Cursor / Windsurf / Copilot / Cline.
642
+ `;
643
+ }
644
+
645
+ export function renderSkill(skill) {
646
+ return `---
647
+ name: ${skill.id}
648
+ description: ${skill.purpose}
649
+ ---
650
+
651
+ # ${skill.id} skill
652
+
653
+ ## When to use
654
+
655
+ ${skill.when}
656
+
657
+ ## Inputs
658
+
659
+ - The shared core contract.
660
+ - A redacted task context.
661
+ - The relevant layer template.
662
+ - Any acceptance criteria or review findings.
663
+
664
+ ## Process
665
+
666
+ ${numbered(skill.process)}
667
+
668
+ ## Output
669
+
670
+ ${list(skill.output)}
671
+
672
+ ## Safety
673
+
674
+ ${list(skill.safety)}
675
+
676
+ ## Example
677
+
678
+ ${skill.example}
679
+ `;
680
+ }
681
+
682
+ export function renderAdapter(adapter) {
683
+ return `# ${adapter.name} Adapter
684
+
685
+ ${adapter.note}
686
+
687
+ ## Shared contract pointer
688
+
689
+ Read \`../SHARED_CORE_CONTRACT.md\` before acting. This adapter is intentionally thin so the profile, context, acceptance, guard, handoff, and harvest rules do not drift.
690
+
691
+ ## How to use
692
+
693
+ 1. Attach or paste \`../SHARED_CORE_CONTRACT.md\`.
694
+ 2. Attach the layer file you need, such as \`../../context/TEMPLATE.md\`.
695
+ 3. Attach the current context package or synthetic case.
696
+ 4. Ask ${adapter.name} to return the required artifact shape.
697
+
698
+ ## Minimal instruction
699
+
700
+ \`\`\`text
701
+ Use the local AI collaboration workspace. Follow SHARED_CORE_CONTRACT.md. For this task, use profile, context, acceptance, guard, handoff, and harvest as explicit files. Do not invent hidden memory. Label assumptions and unverified claims.
702
+ Follow the coaching layer in SHARED_CORE_CONTRACT.md: proactively remind me at key collaboration moments (defining done, reviewing completion claims, handoff, harvest, profile updates), restrained by default.
703
+ \`\`\`
704
+
705
+ ## What this adapter must not do
706
+
707
+ - It must not duplicate the full core contract.
708
+ - It must not create a separate rule system.
709
+ - It must not upload private material.
710
+ - It must not overwrite user files silently.
711
+ `;
712
+ }
713
+
714
+ export function renderMechanismReadme(mechanism) {
715
+ return `# ${mechanism.title}
716
+
717
+ Part of the AI Collaboration Open System. This is a local-first, public-safe mechanism package you can copy into Claude Code, Codex, Cursor, Cline, Windsurf, or Copilot.
718
+
719
+ ## Purpose
720
+
721
+ ${mechanism.purpose}
722
+
723
+ ## When to use
724
+
725
+ ${mechanism.trigger}${section("When not to use", mechanism.antiTrigger)}
726
+
727
+ ## Input shape
728
+
729
+ ${mechanism.input}${listSection("Input materials", mechanism.inputsDetailed)}
730
+
731
+ ## Process
732
+
733
+ ${numbered(mechanism.process)}${listSection("Output shape", mechanism.outputShape)}${listSection("Pass bar (what counts as done / safe to trust)", mechanism.passBar)}${listSection("Reject bar (what sends it back)", mechanism.rejectBar)}${listSection("Common misuse", mechanism.misuse)}
734
+
735
+ ## Package files
736
+
737
+ - \`README.md\` explains the mechanism.
738
+ - \`PROMPT.md\` gives the copy-paste prompt.
739
+ - \`TEMPLATE.md\` gives the blank operating card.
740
+ - \`EXAMPLE.synthetic.md\` shows a public-safe run.
741
+ - \`FAILURE_MODES.md\` names common ways this mechanism fails.
742
+ `;
743
+ }
744
+
745
+ // In-fence (plain text, no markdown heading) optional blocks for the prompt.
746
+ function fenceBlock(label, text) {
747
+ if (!text) return "";
748
+ return `\n\n${label}:\n${text}`;
749
+ }
750
+
751
+ function fenceListBlock(label, items) {
752
+ if (!items || items.length === 0) return "";
753
+ return `\n\n${label}:\n${items.map((item) => `- ${item}`).join("\n")}`;
754
+ }
755
+
756
+ export function renderMechanismPrompt(mechanism) {
757
+ const secondFamilyPointer =
758
+ mechanism.id === "dual-guard"
759
+ ? "\n\nDon't have a second model family yet? See the cookbook recipe `../../cookbook/bridge-to-a-second-family.md` for how to set one up (manual copy-paste or an optional auto bridge) and route this review across it. The `[paste ... here]` slot below assumes you already have that second, different-family AI to paste into."
760
+ : "";
761
+ return `# ${mechanism.title} Prompt
762
+
763
+ This prompt belongs to the AI Collaboration Open System. Use it in a local-first workflow with public-safe or redacted material.
764
+
765
+ ## Purpose
766
+
767
+ ${mechanism.purpose}${secondFamilyPointer}
768
+
769
+ ## Copy-paste prompt
770
+
771
+ \`\`\`text
772
+ Use the ${mechanism.title} mechanism from my local AI Collaboration Open System workspace.
773
+
774
+ Purpose:
775
+ ${mechanism.purpose}
776
+
777
+ Trigger:
778
+ ${mechanism.trigger}${fenceBlock("Do not use when", mechanism.antiTrigger)}
779
+
780
+ Input:
781
+ [paste redacted task material, context package, and acceptance card here]
782
+
783
+ Process:
784
+ ${mechanism.process.map((step, index) => `${index + 1}. ${step}`).join("\n")}${fenceListBlock("Output shape", mechanism.outputShape)}
785
+
786
+ Return:
787
+ - Decision-changing findings only
788
+ - Evidence used
789
+ - Required fixes
790
+ - Residual risk
791
+ - Next action${fenceListBlock("Pass bar (do not pass unless all hold)", mechanism.passBar)}${fenceListBlock("Reject bar (send back if any holds)", mechanism.rejectBar)}
792
+
793
+ Rules:
794
+ - Work from provided material only.
795
+ - Keep private material local.
796
+ - Use public-safe synthetic wording for examples.
797
+ - Label assumptions and unverified claims.
798
+ \`\`\`${section("Full worked example", mechanism.filledExample ? "See `EXAMPLE.synthetic.md` for this prompt run from start to finish on a public-safe synthetic task." : "")}
799
+ `;
800
+ }
801
+
802
+ export function renderMechanismTemplate(mechanism) {
803
+ return `# ${mechanism.title} Template
804
+
805
+ AI Collaboration Open System mechanism card. Fill this in a local-first workflow with public-safe or redacted material.
806
+
807
+ ## Purpose
808
+
809
+ ${mechanism.purpose}
810
+
811
+ ## Template
812
+
813
+ ${mechanism.template.map((field) => `### ${field}\n\n`).join("\n")}${listSection("Pass bar (tick before you trust the result)", mechanism.passBar)}${listSection("Reject bar (send it back if any of these is true)", mechanism.rejectBar)}${section("Worked example", mechanism.filledExample ? "See `EXAMPLE.synthetic.md` for this same card filled out end to end on a public-safe synthetic task." : "")}
814
+
815
+ ## Completion check
816
+
817
+ - The mechanism has a named trigger.
818
+ - The next action is concrete.
819
+ - Private details are redacted or rewritten as synthetic examples.
820
+ - The result can be handed to another AI tool without extra chat history.
821
+ `;
822
+ }
823
+
824
+ function filledExampleBody(filled) {
825
+ if (!filled) return "";
826
+ const scenario = filled.scenario ? `${filled.scenario}\n\n` : "";
827
+ return `\n\n## Full worked example (filled end to end)\n\n${scenario}${filled.lines.join("\n")}`;
828
+ }
829
+
830
+ export function renderMechanismExample(mechanism) {
831
+ return `# ${mechanism.title} Synthetic Example
832
+
833
+ This is a public-safe synthetic example for the AI Collaboration Open System. It is local-first and contains no private account, customer, route, hook, or conversation material.
834
+
835
+ ## Synthetic example
836
+
837
+ ${mechanism.example}${filledExampleBody(mechanism.filledExample)}
838
+
839
+ ## How the mechanism changes the outcome
840
+
841
+ Without this mechanism, a single assistant can produce a smooth answer while hiding uncertainty. With this mechanism, the workflow records trigger, evidence, decision, residual risk, and next action.
842
+
843
+ ## Reuse note
844
+
845
+ Copy the shape, not the synthetic facts. Adapt the template to your own redacted task.
846
+ `;
847
+ }
848
+
849
+ export function renderMechanismFailures(mechanism) {
850
+ return `# ${mechanism.title} Failure Modes
851
+
852
+ AI Collaboration Open System failure checklist. Use it in a local-first workflow before trusting a mechanism run, and rewrite any public example into public-safe language.
853
+
854
+ ## Failure modes
855
+
856
+ ${list(mechanism.failures)}${listSection("Common misuse (operator errors that look fine but break the mechanism)", mechanism.misuse)}
857
+
858
+ ## Guard questions
859
+
860
+ 1. Did this mechanism change the decision, or just add ceremony?
861
+ 2. Is any private material copied instead of summarized or synthesized?
862
+ 3. Are blockers, residual risks, and next actions separated?
863
+ 4. Could a new session continue from this file alone?
864
+ `;
865
+ }
866
+
867
+ function codeBlock(lang, lines) {
868
+ return `\`\`\`${lang}\n${lines.join("\n")}\n\`\`\``;
869
+ }
870
+
871
+ function renderGuardChain(finding) {
872
+ return `### Guard finding (cause-and-effect chain)
873
+
874
+ 1. **Under review:** ${finding.target}
875
+ 2. **Problem:** ${finding.problem}
876
+ 3. **Evidence:**
877
+ ${finding.evidence.map((item) => ` - ${item}`).join("\n")}
878
+ 4. **Why this cannot pass:** ${finding.whyBlock}
879
+ 5. **Required fix:** ${finding.requiredFix}
880
+ 6. **Verdict:** ${finding.verdict}`;
881
+ }
882
+
883
+ function renderFlagshipCase(caseItem) {
884
+ const osProcess = [
885
+ `Context package: ${caseItem.profileContext}`,
886
+ `Acceptance card: ${caseItem.acceptance}`,
887
+ `Execution prompt: ${caseItem.executionPrompt}`,
888
+ `First AI output: a fluent "done" claim that overstates what the code does.`,
889
+ `Guard review: independent reviewer points to the lines where the claim and code disagree.`,
890
+ `Revised output: keyboard reorder implemented and tested; blocker resolved.`,
891
+ `Handoff note: ${caseItem.handoff}`,
892
+ `Harvest seed: ${caseItem.harvest}`
893
+ ];
894
+ const acceptanceCard = caseItem.acceptanceCard;
895
+ const beforeAfterRows = [
896
+ "| Dimension | Before (raw single-agent chat) | After (AI Collaboration OS) |",
897
+ "| --- | --- | --- |",
898
+ "| Scope | Refactor, drag, keyboard, visual polish, and tests blur into one promise. | Current slice is reorder only; visual redesign is explicitly out of scope. |",
899
+ "| Done standard | \"Looks done\" based on a fluent reply. | Acceptance card with five checkable criteria (mouse, keyboard, tests, data, scope). |",
900
+ "| Completion claim | \"Keyboard works and tests pass\" is trusted as written. | Guard points to the exact lines where the claim and code disagree. |",
901
+ "| Keyboard accessibility | Silently missing behind a stub handler. | Implemented in the revised output and proven by a keyboard test. |",
902
+ "| Handoff | Next session restarts and re-asks what was rejected. | Done, pending, and unverified are separated for the next session. |",
903
+ "| Reusable lesson | Lost after the chat scrolls away. | Harvested: verify completion claims with code and test evidence. |"
904
+ ];
905
+
906
+ return `# ${caseItem.title}
907
+
908
+ This is a fully synthetic case. It does not contain private customer material, real raw conversations, local paths, or private operational routes. It walks one real collaboration loop: a messy request becomes context, acceptance, a first AI output, a guard review that catches a false completion claim, a revised output, a handoff, and a harvest lesson.
909
+
910
+ ## Confusing raw input
911
+
912
+ ${caseItem.rawInput}
913
+
914
+ ## Likely single-agent failure
915
+
916
+ ${caseItem.baselineOutput}
917
+
918
+ ## AI Collaboration OS process
919
+
920
+ ${numbered(osProcess)}
921
+
922
+ ## Messy starting point
923
+
924
+ ${caseItem.messy}
925
+
926
+ ## Workspace setup
927
+
928
+ ${caseItem.setup}
929
+
930
+ ## Profile/context
931
+
932
+ ${caseItem.profileContext}
933
+
934
+ ## Context package
935
+
936
+ ${caseItem.profileContext}
937
+
938
+ See \`artifacts/context-package.md\` for the standalone version.
939
+
940
+ ## Acceptance card
941
+
942
+ ${acceptanceCard.summary}
943
+
944
+ ${numbered(acceptanceCard.criteria)}
945
+
946
+ Reject rule: ${acceptanceCard.rejectIf}
947
+
948
+ See \`artifacts/acceptance-card.md\` for the standalone version.
949
+
950
+ ## Execution prompt
951
+
952
+ \`\`\`text
953
+ ${caseItem.executionPrompt}
954
+ \`\`\`
955
+
956
+ ## First AI output
957
+
958
+ The AI returned a confident completion claim:
959
+
960
+ > ${caseItem.firstAiOutput.claim}
961
+
962
+ The code only implements pointer drag; the keyboard handler is a stub and there is no keyboard test. The full artifact, with stable line numbers the guard can cite, is in \`artifacts/first-ai-output.md\`.
963
+
964
+ ## Guard review
965
+
966
+ A cross-checking guard reviews the first AI output against the acceptance card and reports a causal chain instead of a one-line verdict.
967
+
968
+ ${renderGuardChain(caseItem.guardFinding)}
969
+
970
+ The full review, with line references into \`first-ai-output.md\`, is in \`artifacts/guard-review.md\`.
971
+
972
+ ## Revised output
973
+
974
+ ${caseItem.revisedOutput.summary} ${caseItem.revisedOutput.guardRecheck} The corrected code and the new keyboard test are in \`artifacts/revised-output.md\`.
975
+
976
+ ## Handoff note
977
+
978
+ ${caseItem.handoff}
979
+
980
+ ## Harvest seed
981
+
982
+ ${caseItem.harvest}
983
+
984
+ ## Before/after comparison
985
+
986
+ ${beforeAfterRows.join("\n")}
987
+
988
+ ## What changes compared with a single raw AI chat
989
+
990
+ A raw chat would accept the first "done" because it reads well. This loop made the completion claim checkable, so an independent guard caught that keyboard reorder was claimed but never implemented or tested. That gap is exactly what one agent tends not to see in its own fluent answer, and what a guard pointing to specific lines does see.
991
+
992
+ ## artifacts
993
+
994
+ - Profile artifact: ${caseItem.artifacts.profile}
995
+ - Context artifact: ${caseItem.artifacts.context}
996
+ - Acceptance artifact: ${caseItem.artifacts.acceptance}
997
+ - First AI output artifact: the completion claim plus the flawed TaskBoard code and the single mouse-only test (\`artifacts/first-ai-output.md\`).
998
+ - Guard artifact: ${caseItem.artifacts.guard}
999
+ - Revised output artifact: the implemented keyboard reorder and the added keyboard test (\`artifacts/revised-output.md\`).
1000
+ - Handoff artifact: ${caseItem.artifacts.handoff}
1001
+ - Harvest artifact: ${caseItem.artifacts.harvest}
1002
+
1003
+ Artifact files:
1004
+
1005
+ - \`artifacts/context-package.md\`
1006
+ - \`artifacts/acceptance-card.md\`
1007
+ - \`artifacts/execution-prompt.md\`
1008
+ - \`artifacts/first-ai-output.md\`
1009
+ - \`artifacts/guard-review.md\`
1010
+ - \`artifacts/revised-output.md\`
1011
+ - \`artifacts/handoff-note.md\`
1012
+ - \`artifacts/harvest-seed.md\`
1013
+
1014
+ ## raw-input
1015
+
1016
+ ${caseItem.rawInput}
1017
+
1018
+ ## baseline-output
1019
+
1020
+ ${caseItem.baselineOutput}
1021
+
1022
+ ## system-run
1023
+
1024
+ ${numbered(caseItem.systemRun)}
1025
+
1026
+ ## comparison
1027
+
1028
+ ${caseItem.comparison}
1029
+
1030
+ ## next-step
1031
+
1032
+ ${caseItem.nextStep}
1033
+ `;
1034
+ }
1035
+
1036
+ export function renderCase(caseItem) {
1037
+ if (caseItem.flagship) {
1038
+ return renderFlagshipCase(caseItem);
1039
+ }
1040
+ const rawInput = caseItem.rawInput ?? caseItem.messy;
1041
+ const baselineOutput = caseItem.baselineOutput ?? `A likely single-agent answer would produce a fluent artifact from the messy request, but it would not preserve explicit context, acceptance, guard review, handoff state, and harvest learning.`;
1042
+ const beforeAfter = caseItem.comparison;
1043
+ const osProcess = [
1044
+ `Context package: ${caseItem.profileContext}`,
1045
+ `Acceptance card: ${caseItem.acceptance}`,
1046
+ `Execution prompt: ${caseItem.executionPrompt}`,
1047
+ `Guard review: ${caseItem.guardReview}`,
1048
+ `Handoff note: ${caseItem.handoff}`,
1049
+ `Harvest seed: ${caseItem.harvest}`
1050
+ ];
1051
+
1052
+ return `# ${caseItem.title}
1053
+
1054
+ This is a fully synthetic case. It does not contain private customer material, real raw conversations, local paths, or private operational routes.
1055
+
1056
+ ## Confusing raw input
1057
+
1058
+ ${rawInput}
1059
+
1060
+ ## Likely single-agent failure
1061
+
1062
+ ${baselineOutput}
1063
+
1064
+ ## AI Collaboration OS process
1065
+
1066
+ ${numbered(osProcess)}
1067
+
1068
+ ## Context package
1069
+
1070
+ ${caseItem.profileContext}
1071
+
1072
+ ## Acceptance card
1073
+
1074
+ ${caseItem.acceptance}
1075
+
1076
+ ## Guard review
1077
+
1078
+ ${caseItem.guardReview}
1079
+
1080
+ ## Handoff note
1081
+
1082
+ ${caseItem.handoff}
1083
+
1084
+ ## Harvest seed
1085
+
1086
+ ${caseItem.harvest}
1087
+
1088
+ ## Before/after comparison
1089
+
1090
+ ${beforeAfter}
1091
+
1092
+ ## Messy starting point
1093
+
1094
+ ${caseItem.messy}
1095
+
1096
+ ## Workspace setup
1097
+
1098
+ ${caseItem.setup}
1099
+
1100
+ ## Profile/context
1101
+
1102
+ ${caseItem.profileContext}
1103
+
1104
+ ## Acceptance
1105
+
1106
+ ${caseItem.acceptance}
1107
+
1108
+ ## Execution prompt
1109
+
1110
+ \`\`\`text
1111
+ ${caseItem.executionPrompt}
1112
+ \`\`\`
1113
+
1114
+ ## Handoff
1115
+
1116
+ ${caseItem.handoff}
1117
+
1118
+ ## Harvest
1119
+
1120
+ ${caseItem.harvest}
1121
+
1122
+ ## What changes compared with a single raw AI chat
1123
+
1124
+ ${caseItem.comparison}
1125
+
1126
+ ## Artifacts
1127
+
1128
+ - \`artifacts/context-package.md\`
1129
+ - \`artifacts/acceptance-card.md\`
1130
+ - \`artifacts/execution-prompt.md\`
1131
+ - \`artifacts/guard-review.md\`
1132
+ - \`artifacts/handoff-note.md\`
1133
+ - \`artifacts/harvest-seed.md\`
1134
+ `;
1135
+ }
1136
+
1137
+ function acceptanceCardContent(caseItem) {
1138
+ const card = caseItem.acceptanceCard;
1139
+ if (!card) return caseItem.artifacts?.acceptance ?? caseItem.acceptance;
1140
+ return `${card.summary}\n\n${numbered(card.criteria)}\n\nReject rule: ${card.rejectIf}`;
1141
+ }
1142
+
1143
+ function firstAiOutputContent(caseItem) {
1144
+ const first = caseItem.firstAiOutput;
1145
+ if (!first) return caseItem.profileContext ?? "";
1146
+ return [
1147
+ "Completion claim (what the AI reported):",
1148
+ "",
1149
+ `> ${first.claim}`,
1150
+ "",
1151
+ `${first.codeLabel}:`,
1152
+ "",
1153
+ codeBlock("tsx", first.code),
1154
+ "",
1155
+ `${first.testLabel}. Self-reported result: ${first.selfReportedTests}.`,
1156
+ "",
1157
+ codeBlock("tsx", first.test),
1158
+ "",
1159
+ "Defect summary:",
1160
+ "- Claimed arrow-key reorder, but `onKeyDown` is a stub that only logs the key (no `moveTask` call).",
1161
+ "- Claimed full test coverage, but only the mouse path has a test; there is no keyboard test.",
1162
+ "- The line numbers above are relative to each code block so the guard review can cite them."
1163
+ ].join("\n");
1164
+ }
1165
+
1166
+ function guardReviewContent(caseItem) {
1167
+ if (!caseItem.guardFinding) return caseItem.artifacts?.guard ?? caseItem.guardReview;
1168
+ return `This review challenges \`first-ai-output.md\` against the acceptance card.\n\n${renderGuardChain(caseItem.guardFinding)}`;
1169
+ }
1170
+
1171
+ function revisedOutputContent(caseItem) {
1172
+ const revised = caseItem.revisedOutput;
1173
+ if (!revised) return caseItem.comparison ?? "";
1174
+ return [
1175
+ revised.summary,
1176
+ "",
1177
+ `${revised.codeLabel}:`,
1178
+ "",
1179
+ codeBlock("tsx", revised.code),
1180
+ "",
1181
+ `${revised.testLabel}. It fails against the old stub in \`first-ai-output.md\` and passes against this fix.`,
1182
+ "",
1183
+ codeBlock("tsx", revised.test),
1184
+ "",
1185
+ `Verification after the fix: ${revised.verification}.`,
1186
+ "",
1187
+ revised.guardRecheck
1188
+ ].join("\n");
1189
+ }
1190
+
1191
+ export function renderCaseArtifact(caseItem, kind) {
1192
+ const map = {
1193
+ "context-package.md": {
1194
+ title: "Context package",
1195
+ content: caseItem.artifacts ? `${caseItem.artifacts.profile}\n\n${caseItem.artifacts.context}` : caseItem.profileContext,
1196
+ use: "Paste this before asking an AI tool to continue the task. It gives the assistant the working style, scope, constraints, and known evidence.",
1197
+ review: "Check that facts and assumptions are separated before execution starts.",
1198
+ next: "Use this context to write or verify the acceptance card."
1199
+ },
1200
+ "acceptance-card.md": {
1201
+ title: "Acceptance card",
1202
+ content: acceptanceCardContent(caseItem),
1203
+ use: "Paste this before implementation, drafting, research, or judgment work. Ask the assistant to treat these criteria as the pass/fail surface.",
1204
+ review: "Reject work that claims completion without evidence tied to this card.",
1205
+ next: "Use this card with the execution prompt and later guard review."
1206
+ },
1207
+ "execution-prompt.md": {
1208
+ title: "Execution prompt",
1209
+ content: `\`\`\`text\n${caseItem.executionPrompt}\n\`\`\``,
1210
+ use: "Paste this into the selected AI tool after the context package and acceptance card.",
1211
+ review: "Confirm the prompt does not expand scope beyond acceptance.",
1212
+ next: "Run guard review on the first artifact produced from this prompt."
1213
+ },
1214
+ "first-ai-output.md": {
1215
+ title: "First AI output",
1216
+ content: firstAiOutputContent(caseItem),
1217
+ use: "Read this as the artifact under review, not as a finished result. It is the AI's first answer, with a confident completion claim and code that does not fully back it up.",
1218
+ review: "Do not accept the completion claim on its own. Check each acceptance criterion against the code and tests here before trusting the answer.",
1219
+ next: "Run guard review against this output and find where the claim and the code disagree."
1220
+ },
1221
+ "guard-review.md": {
1222
+ title: "Guard review",
1223
+ content: guardReviewContent(caseItem),
1224
+ use: "Use this as the review stance after the first artifact exists. It challenges evidence, privacy, scope, and acceptance alignment.",
1225
+ review: "A review is not a pass unless it names evidence and residual risk.",
1226
+ next: "Fix any blocking finding, then write a handoff note."
1227
+ },
1228
+ "revised-output.md": {
1229
+ title: "Revised output",
1230
+ content: revisedOutputContent(caseItem),
1231
+ use: "Read this as the corrected answer after the guard review blocked the first one. It resolves the blocker the guard found.",
1232
+ review: "Confirm the blocker is actually fixed with evidence: the new behavior exists and a test proves it.",
1233
+ next: "Carry remaining unverified work, write the handoff note, then harvest the lesson."
1234
+ },
1235
+ "handoff-note.md": {
1236
+ title: "Handoff note",
1237
+ content: caseItem.artifacts?.handoff ?? caseItem.handoff,
1238
+ use: "Paste this into the next session or tool so work resumes from current state instead of restarting.",
1239
+ review: "Check that completed, pending, blocked, and next action are distinguishable.",
1240
+ next: "Use the handoff note as input to harvest."
1241
+ },
1242
+ "harvest-seed.md": {
1243
+ title: "Harvest seed",
1244
+ content: caseItem.artifacts?.harvest ?? caseItem.harvest,
1245
+ use: "Save this after the loop to preserve reusable knowledge without copying private raw material.",
1246
+ review: "Do not generalize from the synthetic case unless the pattern appears in future work.",
1247
+ next: "Move reusable prompts or rules into the appropriate workspace file."
1248
+ }
1249
+ };
1250
+ const item = map[kind];
1251
+ return `# ${item.title} - ${caseItem.title}
1252
+
1253
+ ## Source case
1254
+
1255
+ - Case id: \`${caseItem.id}\`
1256
+ - Case title: ${caseItem.title}
1257
+ - Privacy status: fully synthetic
1258
+ - Private material: none
1259
+
1260
+ ## How to use
1261
+
1262
+ ${item.use}
1263
+
1264
+ ## Synthetic content
1265
+
1266
+ ${item.content}
1267
+
1268
+ ## Review note
1269
+
1270
+ ${item.review}
1271
+
1272
+ ## Next step
1273
+
1274
+ ${item.next}
1275
+
1276
+ ## Why this exists
1277
+
1278
+ This artifact makes the case runnable and reviewable. A raw chat can produce a smooth answer, but this file preserves the specific state needed for profile, context, acceptance, guard, handoff, and harvest work.
1279
+ `;
1280
+ }
1281
+
1282
+ export function renderPrivacyDoc() {
1283
+ return `# Privacy Boundary
1284
+
1285
+ This workspace is local-first. It does not call external AI APIs by default, upload user content, scan the whole disk, or install hooks without consent.
1286
+
1287
+ ## Public-safe material
1288
+
1289
+ - Generic architecture
1290
+ - Generic prompts
1291
+ - Generic templates
1292
+ - Thin tool adapters
1293
+ - Synthetic examples
1294
+ - Setup docs
1295
+ - Known limitations
1296
+
1297
+ ## Forbidden public material
1298
+
1299
+ - Real private governance contents
1300
+ - Knowledge-base source material copied from a private system
1301
+ - Real personal profile
1302
+ - Actual client material
1303
+ - Raw private conversations
1304
+ - Non-public automation or routing details
1305
+ - Internal calibration metrics, scoring configuration, or account-specific habits
1306
+ - Local machine paths
1307
+ - Tokens, keys, cookies, and credentials
1308
+ - Unredacted screenshots
1309
+
1310
+ ## Redaction standard
1311
+
1312
+ Before publishing an example, ask:
1313
+
1314
+ \`\`\`text
1315
+ Could a stranger infer the owner's private system, identity, clients, files, habits, or operational routes from this?
1316
+ \`\`\`
1317
+
1318
+ If yes, rewrite it as a synthetic example.
1319
+ `;
1320
+ }
1321
+
1322
+ export function renderCommercialBoundary() {
1323
+ return `# Commercial Boundary
1324
+
1325
+ The open-source edition gives the complete generic self-build path.
1326
+
1327
+ ## Free and open
1328
+
1329
+ - Workspace skeleton
1330
+ - Six collaboration layers
1331
+ - Generic prompts
1332
+ - Skills
1333
+ - Thin adapters
1334
+ - Synthetic cases
1335
+ - Privacy and setup docs
1336
+ - Health checks and their limitations
1337
+
1338
+ ## Paid help may include
1339
+
1340
+ - Real workflow review
1341
+ - Personalized profile calibration
1342
+ - Project-specific setup
1343
+ - Migration from existing AI workflows
1344
+ - Custom guard rules
1345
+ - Scenario packs
1346
+ - Human review
1347
+ - Async audit
1348
+ - Long-term workflow improvement
1349
+
1350
+ ## Required framing
1351
+
1352
+ The method is public. Paid help gives users a calibrated version for their real workflow and saves time.
1353
+
1354
+ ## Forbidden framing
1355
+
1356
+ Do not imply that the open version only names problems while paid help unlocks the fix.
1357
+ `;
1358
+ }
1359
+
1360
+ export function renderExamplesIndex() {
1361
+ return `# Synthetic Case Library
1362
+
1363
+ Every case is synthetic and shows the full loop:
1364
+
1365
+ \`\`\`text
1366
+ messy starting point
1367
+ -> workspace setup
1368
+ -> profile/context
1369
+ -> acceptance
1370
+ -> execution prompt
1371
+ -> guard review
1372
+ -> handoff
1373
+ -> harvest
1374
+ -> what changes compared with a single raw AI chat
1375
+ \`\`\`
1376
+
1377
+ ${caseDefinitions.map((item) => `- [${item.title}](./${item.id}/CASE.md)`).join("\n")}
1378
+ `;
1379
+ }
1380
+
1381
+ export { adapterDefinitions, caseDefinitions, layerDefinitions, promptDefinitions, skillDefinitions };