superlab 0.1.7 → 0.1.8

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 (69) hide show
  1. package/README.md +65 -17
  2. package/README.zh-CN.md +64 -15
  3. package/bin/superlab.cjs +232 -1
  4. package/lib/context.cjs +337 -0
  5. package/lib/i18n.cjs +673 -41
  6. package/lib/install.cjs +249 -51
  7. package/package-assets/claude/commands/lab/framing.md +11 -0
  8. package/package-assets/claude/commands/lab/idea.md +2 -1
  9. package/package-assets/claude/commands/lab/iterate.md +2 -1
  10. package/package-assets/claude/commands/lab/report.md +2 -1
  11. package/package-assets/claude/commands/lab/review.md +2 -1
  12. package/package-assets/claude/commands/lab/run.md +2 -1
  13. package/package-assets/claude/commands/lab/spec.md +2 -1
  14. package/package-assets/claude/commands/lab/write.md +2 -1
  15. package/package-assets/codex/prompts/lab-framing.md +9 -0
  16. package/package-assets/codex/prompts/lab-idea.md +2 -1
  17. package/package-assets/codex/prompts/lab-iterate.md +2 -1
  18. package/package-assets/codex/prompts/lab-report.md +2 -1
  19. package/package-assets/codex/prompts/lab-review.md +2 -1
  20. package/package-assets/codex/prompts/lab-run.md +2 -1
  21. package/package-assets/codex/prompts/lab-spec.md +2 -1
  22. package/package-assets/codex/prompts/lab-write.md +2 -1
  23. package/package-assets/shared/{templates → lab/.managed/templates}/design.md +3 -3
  24. package/package-assets/shared/lab/.managed/templates/framing.md +66 -0
  25. package/package-assets/shared/{templates → lab/.managed/templates}/paper-plan.md +1 -0
  26. package/package-assets/shared/{templates → lab/.managed/templates}/proposal.md +1 -1
  27. package/package-assets/shared/{templates → lab/.managed/templates}/spec.md +2 -2
  28. package/package-assets/shared/{templates → lab/.managed/templates}/tasks.md +2 -2
  29. package/package-assets/shared/{templates → lab/.managed/templates}/write-iteration.md +1 -0
  30. package/package-assets/shared/lab/changes/README.md +10 -0
  31. package/package-assets/shared/lab/config/workflow.json +6 -0
  32. package/package-assets/shared/lab/context/next-action.md +19 -0
  33. package/package-assets/shared/lab/context/session-brief.md +30 -0
  34. package/package-assets/shared/lab/context/summary.md +21 -0
  35. package/package-assets/shared/lab/context/terminology-lock.md +27 -0
  36. package/package-assets/shared/lab/system/core.md +41 -0
  37. package/package-assets/shared/skills/lab/SKILL.md +54 -37
  38. package/package-assets/shared/skills/lab/references/paper-writing/abstract.md +2 -17
  39. package/package-assets/shared/skills/lab/references/paper-writing/introduction.md +3 -63
  40. package/package-assets/shared/skills/lab/references/paper-writing/method.md +4 -34
  41. package/package-assets/shared/skills/lab/references/workflow.md +4 -4
  42. package/package-assets/shared/skills/lab/stages/framing.md +70 -0
  43. package/package-assets/shared/skills/lab/stages/idea.md +5 -5
  44. package/package-assets/shared/skills/lab/stages/iterate.md +8 -8
  45. package/package-assets/shared/skills/lab/stages/report.md +7 -6
  46. package/package-assets/shared/skills/lab/stages/review.md +6 -5
  47. package/package-assets/shared/skills/lab/stages/run.md +4 -4
  48. package/package-assets/shared/skills/lab/stages/spec.md +11 -11
  49. package/package-assets/shared/skills/lab/stages/write.md +14 -10
  50. package/package.json +1 -1
  51. package/package-assets/shared/changes/README.md +0 -10
  52. package/package-assets/shared/config/workflow.json +0 -5
  53. package/package-assets/shared/examples/minimal-uplift-workflow.md +0 -73
  54. /package/package-assets/shared/{scripts → lab/.managed/scripts}/eval_report.py +0 -0
  55. /package/package-assets/shared/{scripts → lab/.managed/scripts}/register_run.py +0 -0
  56. /package/package-assets/shared/{scripts → lab/.managed/scripts}/summarize_iterations.py +0 -0
  57. /package/package-assets/shared/{scripts → lab/.managed/scripts}/validate_results.py +0 -0
  58. /package/package-assets/shared/{templates → lab/.managed/templates}/final-report.md +0 -0
  59. /package/package-assets/shared/{templates → lab/.managed/templates}/idea.md +0 -0
  60. /package/package-assets/shared/{templates → lab/.managed/templates}/iteration-report.md +0 -0
  61. /package/package-assets/shared/{templates → lab/.managed/templates}/paper-section.md +0 -0
  62. /package/package-assets/shared/{templates → lab/.managed/templates}/paper-section.tex +0 -0
  63. /package/package-assets/shared/{templates → lab/.managed/templates}/paper.tex +0 -0
  64. /package/package-assets/shared/{templates → lab/.managed/templates}/review-checklist.md +0 -0
  65. /package/package-assets/shared/{context → lab/context}/decisions.md +0 -0
  66. /package/package-assets/shared/{context → lab/context}/evidence-index.md +0 -0
  67. /package/package-assets/shared/{context → lab/context}/mission.md +0 -0
  68. /package/package-assets/shared/{context → lab/context}/open-questions.md +0 -0
  69. /package/package-assets/shared/{context → lab/context}/state.md +0 -0
package/lib/install.cjs CHANGED
@@ -5,6 +5,9 @@ const { getLocalizedContent } = require("./i18n.cjs");
5
5
 
6
6
  const REPO_ROOT = path.resolve(__dirname, "..");
7
7
  const PACKAGE_VERSION = require(path.join(REPO_ROOT, "package.json")).version;
8
+ const LAYOUT_VERSION = 1;
9
+ const SUPERLAB_START = "<!-- superlab:start -->";
10
+ const SUPERLAB_END = "<!-- superlab:end -->";
8
11
 
9
12
  const ASSET_GROUPS = {
10
13
  codex: [
@@ -27,33 +30,20 @@ const ASSET_GROUPS = {
27
30
  to: path.join(".claude", "skills", "lab"),
28
31
  },
29
32
  ],
30
- shared: [
31
- {
32
- from: path.join(REPO_ROOT, "package-assets", "shared", "templates"),
33
- to: path.join(".superlab", "templates"),
34
- },
35
- {
36
- from: path.join(REPO_ROOT, "package-assets", "shared", "config"),
37
- to: path.join(".superlab", "config"),
38
- },
39
- {
40
- from: path.join(REPO_ROOT, "package-assets", "shared", "changes"),
41
- to: path.join(".superlab", "changes"),
42
- },
43
- {
44
- from: path.join(REPO_ROOT, "package-assets", "shared", "scripts"),
45
- to: path.join(".superlab", "scripts"),
46
- },
47
- {
48
- from: path.join(REPO_ROOT, "package-assets", "shared", "examples"),
49
- to: path.join(".superlab", "examples"),
50
- },
51
- {
52
- from: path.join(REPO_ROOT, "package-assets", "shared", "context"),
53
- to: path.join(".superlab", "context"),
54
- },
55
- ],
56
33
  };
34
+ const LAB_SOURCE_ROOT = path.join(REPO_ROOT, "package-assets", "shared", "lab");
35
+ const PROJECT_OWNED_LOCALIZED_PATHS = [
36
+ path.join(".lab", "config", "workflow.json"),
37
+ path.join(".lab", "context", "mission.md"),
38
+ path.join(".lab", "context", "state.md"),
39
+ path.join(".lab", "context", "decisions.md"),
40
+ path.join(".lab", "context", "evidence-index.md"),
41
+ path.join(".lab", "context", "open-questions.md"),
42
+ path.join(".lab", "context", "terminology-lock.md"),
43
+ path.join(".lab", "context", "summary.md"),
44
+ path.join(".lab", "context", "next-action.md"),
45
+ path.join(".lab", "context", "session-brief.md"),
46
+ ];
57
47
 
58
48
  function listFiles(dir) {
59
49
  const entries = fs.readdirSync(dir, { withFileTypes: true });
@@ -92,8 +82,90 @@ function copyDirectory(sourceDir, targetDir, force) {
92
82
  fs.cpSync(sourceDir, targetDir, { recursive: true, force });
93
83
  }
94
84
 
85
+ function copyMissingTree(sourceDir, targetDir) {
86
+ if (!fs.existsSync(sourceDir)) {
87
+ return;
88
+ }
89
+ fs.mkdirSync(targetDir, { recursive: true });
90
+ for (const entry of fs.readdirSync(sourceDir, { withFileTypes: true })) {
91
+ const sourcePath = path.join(sourceDir, entry.name);
92
+ const targetPath = path.join(targetDir, entry.name);
93
+ if (entry.isDirectory()) {
94
+ copyMissingTree(sourcePath, targetPath);
95
+ continue;
96
+ }
97
+ if (!fs.existsSync(targetPath)) {
98
+ fs.copyFileSync(sourcePath, targetPath);
99
+ }
100
+ }
101
+ }
102
+
103
+ function mergeJsonFile(defaultPath, targetPath) {
104
+ const defaults = JSON.parse(fs.readFileSync(defaultPath, "utf8"));
105
+ let existing = {};
106
+ if (fs.existsSync(targetPath)) {
107
+ existing = JSON.parse(fs.readFileSync(targetPath, "utf8"));
108
+ }
109
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true });
110
+ fs.writeFileSync(targetPath, JSON.stringify({ ...defaults, ...existing }, null, 2) + "\n");
111
+ }
112
+
113
+ function installLabAssets(targetDir, force) {
114
+ copyMissingTree(path.join(LAB_SOURCE_ROOT, "system"), path.join(targetDir, ".lab", "system"));
115
+ copyMissingTree(path.join(LAB_SOURCE_ROOT, "context"), path.join(targetDir, ".lab", "context"));
116
+ copyMissingTree(path.join(LAB_SOURCE_ROOT, "changes"), path.join(targetDir, ".lab", "changes"));
117
+ mergeJsonFile(
118
+ path.join(LAB_SOURCE_ROOT, "config", "workflow.json"),
119
+ path.join(targetDir, ".lab", "config", "workflow.json")
120
+ );
121
+ copyDirectory(
122
+ path.join(LAB_SOURCE_ROOT, ".managed"),
123
+ path.join(targetDir, ".lab", ".managed"),
124
+ force
125
+ );
126
+ }
127
+
128
+ function coreTemplateContent(lang) {
129
+ return (
130
+ getLocalizedContent(path.join(".lab", "system", "core.md"), lang) ||
131
+ fs.readFileSync(path.join(LAB_SOURCE_ROOT, "system", "core.md"), "utf8")
132
+ );
133
+ }
134
+
135
+ function writeManagedCoreFile(targetDir, lang, { force = false } = {}) {
136
+ const filePath = path.join(targetDir, ".lab", "system", "core.md");
137
+ const managedBody = coreTemplateContent(lang);
138
+
139
+ ensureParentDir(filePath);
140
+ if (!fs.existsSync(filePath)) {
141
+ fs.writeFileSync(filePath, managedShimBlock(managedBody));
142
+ return;
143
+ }
144
+
145
+ const existing = fs.readFileSync(filePath, "utf8");
146
+ const start = existing.indexOf(SUPERLAB_START);
147
+ const end = existing.indexOf(SUPERLAB_END);
148
+ if (start >= 0 && end >= 0 && end >= start) {
149
+ upsertManagedBlock(filePath, managedBody, { force });
150
+ return;
151
+ }
152
+
153
+ const canonicalVariants = ["en", "zh"].map((candidateLang) => coreTemplateContent(candidateLang).trim());
154
+ if (!existing.trim() || canonicalVariants.includes(existing.trim())) {
155
+ fs.writeFileSync(filePath, managedShimBlock(managedBody));
156
+ return;
157
+ }
158
+
159
+ if (force) {
160
+ fs.writeFileSync(filePath, `${existing.trimEnd()}\n\n${managedShimBlock(managedBody)}`);
161
+ return;
162
+ }
163
+
164
+ throw new Error(`${filePath} already exists. Re-run with --force to overwrite.`);
165
+ }
166
+
95
167
  function chmodScripts(targetDir) {
96
- const scriptsDir = path.join(targetDir, ".superlab", "scripts");
168
+ const scriptsDir = path.join(targetDir, ".lab", ".managed", "scripts");
97
169
  if (!fs.existsSync(scriptsDir)) {
98
170
  return;
99
171
  }
@@ -116,7 +188,7 @@ function registryFilePath({ env = process.env } = {}) {
116
188
  }
117
189
 
118
190
  function installMetadataPath(targetDir) {
119
- return path.join(targetDir, ".superlab", "install.json");
191
+ return path.join(targetDir, ".lab", ".managed", "install.json");
120
192
  }
121
193
 
122
194
  function ensureParentDir(filePath) {
@@ -137,6 +209,93 @@ function readProjectInstallMetadata(targetDir) {
137
209
  return JSON.parse(fs.readFileSync(filePath, "utf8"));
138
210
  }
139
211
 
212
+ function managedShimBlock(content) {
213
+ return `${SUPERLAB_START}\n${content.trimEnd()}\n${SUPERLAB_END}\n`;
214
+ }
215
+
216
+ function upsertManagedBlock(filePath, body, { force = false } = {}) {
217
+ const block = managedShimBlock(body);
218
+ if (!fs.existsSync(filePath)) {
219
+ fs.writeFileSync(filePath, block);
220
+ return;
221
+ }
222
+
223
+ const existing = fs.readFileSync(filePath, "utf8");
224
+ const start = existing.indexOf(SUPERLAB_START);
225
+ const end = existing.indexOf(SUPERLAB_END);
226
+
227
+ if (start >= 0 && end >= 0 && end >= start) {
228
+ const updated =
229
+ existing.slice(0, start) +
230
+ block +
231
+ existing.slice(end + SUPERLAB_END.length).replace(/^\n/, "");
232
+ fs.writeFileSync(filePath, updated);
233
+ return;
234
+ }
235
+
236
+ if (force) {
237
+ fs.writeFileSync(filePath, `${existing.trimEnd()}\n\n${block}`);
238
+ return;
239
+ }
240
+
241
+ throw new Error(`${filePath} already exists. Re-run with --force to overwrite.`);
242
+ }
243
+
244
+ function agentsShim(lang) {
245
+ if (lang === "zh") {
246
+ return `# Project Agent Notes
247
+
248
+ 本仓库使用项目级 \`.lab/\` 研究工作流。
249
+
250
+ 如果任务属于 research、experiment、report 或 paper-writing:
251
+ 1. 先读 \`.lab/system/core.md\`
252
+ 2. 再读 \`.lab/context/session-brief.md\`
253
+
254
+ 不要静默覆盖 \`.lab/context/*\`。
255
+ 非研究类工程任务不要强行进入 \`/lab:*\`。`;
256
+ }
257
+
258
+ return `# Project Agent Notes
259
+
260
+ This repository uses a project-level \`.lab/\` research workflow.
261
+
262
+ For research, experiment, reporting, or paper-writing tasks:
263
+ 1. Read \`.lab/system/core.md\`
264
+ 2. Then read \`.lab/context/session-brief.md\`
265
+
266
+ Do not silently overwrite \`.lab/context/*\`.
267
+ For non-research engineering tasks, do not force \`/lab:*\`.`;
268
+ }
269
+
270
+ function claudeShim(lang) {
271
+ if (lang === "zh") {
272
+ return `# Claude Project Notes
273
+
274
+ 本仓库使用项目级 \`.lab/\` 研究工作流。
275
+
276
+ @.lab/system/core.md
277
+ @.lab/context/session-brief.md
278
+
279
+ 不要静默覆盖 \`.lab/context/*\`。
280
+ 非研究类工程任务不要强行进入 \`/lab:*\`。`;
281
+ }
282
+
283
+ return `# Claude Project Notes
284
+
285
+ This repository uses a project-level \`.lab/\` research workflow.
286
+
287
+ @.lab/system/core.md
288
+ @.lab/context/session-brief.md
289
+
290
+ Do not silently overwrite \`.lab/context/*\`.
291
+ For non-research engineering tasks, do not force \`/lab:*\`.`;
292
+ }
293
+
294
+ function writePlatformShims(targetDir, lang, force) {
295
+ upsertManagedBlock(path.join(targetDir, "AGENTS.md"), agentsShim(lang), { force });
296
+ upsertManagedBlock(path.join(targetDir, "CLAUDE.md"), claudeShim(lang), { force });
297
+ }
298
+
140
299
  function detectLegacyPlatform(targetDir) {
141
300
  const hasCodex =
142
301
  fs.existsSync(path.join(targetDir, ".codex", "prompts")) ||
@@ -162,8 +321,14 @@ function looksChinese(text) {
162
321
  }
163
322
 
164
323
  function detectLegacyLanguage(targetDir) {
165
- const workflowConfigPath = path.join(targetDir, ".superlab", "config", "workflow.json");
166
- if (fs.existsSync(workflowConfigPath)) {
324
+ const workflowConfigPaths = [
325
+ path.join(targetDir, ".lab", "config", "workflow.json"),
326
+ path.join(targetDir, ".superlab", "config", "workflow.json"),
327
+ ];
328
+ for (const workflowConfigPath of workflowConfigPaths) {
329
+ if (!fs.existsSync(workflowConfigPath)) {
330
+ continue;
331
+ }
167
332
  try {
168
333
  const config = JSON.parse(fs.readFileSync(workflowConfigPath, "utf8"));
169
334
  if (config.workflow_language === "zh" || config.workflow_language === "en") {
@@ -177,6 +342,7 @@ function detectLegacyLanguage(targetDir) {
177
342
  const probeFiles = [
178
343
  path.join(targetDir, ".codex", "prompts", "lab-idea.md"),
179
344
  path.join(targetDir, ".claude", "commands", "lab", "idea.md"),
345
+ path.join(targetDir, ".lab", ".managed", "templates", "idea.md"),
180
346
  path.join(targetDir, ".superlab", "templates", "idea.md"),
181
347
  ];
182
348
 
@@ -203,6 +369,7 @@ function detectLegacyInstallMetadata(targetDir) {
203
369
  lang: detectLegacyLanguage(targetDir),
204
370
  package_version: "legacy",
205
371
  updated_at: null,
372
+ layout_version: 0,
206
373
  legacy: true,
207
374
  };
208
375
  }
@@ -266,13 +433,14 @@ function detectLanguage({ explicitLang, env = process.env } = {}) {
266
433
  return locale.includes("zh") ? "zh" : "en";
267
434
  }
268
435
 
269
- function localizeInstalledAssets(targetDir, lang) {
436
+ function localizeInstalledAssets(targetDir, lang, { newlyCreatedProjectOwnedPaths = new Set() } = {}) {
270
437
  if (lang !== "zh") {
271
438
  return;
272
439
  }
273
440
 
274
441
  const relativePaths = [
275
442
  path.join(".codex", "prompts", "lab-idea.md"),
443
+ path.join(".codex", "prompts", "lab-framing.md"),
276
444
  path.join(".codex", "prompts", "lab-spec.md"),
277
445
  path.join(".codex", "prompts", "lab-run.md"),
278
446
  path.join(".codex", "prompts", "lab-iterate.md"),
@@ -280,6 +448,7 @@ function localizeInstalledAssets(targetDir, lang) {
280
448
  path.join(".codex", "prompts", "lab-report.md"),
281
449
  path.join(".codex", "prompts", "lab-write.md"),
282
450
  path.join(".claude", "commands", "lab", "idea.md"),
451
+ path.join(".claude", "commands", "lab", "framing.md"),
283
452
  path.join(".claude", "commands", "lab", "spec.md"),
284
453
  path.join(".claude", "commands", "lab", "run.md"),
285
454
  path.join(".claude", "commands", "lab", "iterate.md"),
@@ -288,27 +457,36 @@ function localizeInstalledAssets(targetDir, lang) {
288
457
  path.join(".claude", "commands", "lab", "write.md"),
289
458
  path.join(".codex", "skills", "lab", "SKILL.md"),
290
459
  path.join(".codex", "skills", "lab", "stages", "idea.md"),
460
+ path.join(".codex", "skills", "lab", "stages", "framing.md"),
461
+ path.join(".codex", "skills", "lab", "stages", "spec.md"),
462
+ path.join(".codex", "skills", "lab", "stages", "run.md"),
463
+ path.join(".codex", "skills", "lab", "stages", "iterate.md"),
464
+ path.join(".codex", "skills", "lab", "stages", "review.md"),
465
+ path.join(".codex", "skills", "lab", "stages", "report.md"),
291
466
  path.join(".codex", "skills", "lab", "stages", "write.md"),
467
+ path.join(".codex", "skills", "lab", "references", "workflow.md"),
292
468
  path.join(".claude", "skills", "lab", "SKILL.md"),
293
469
  path.join(".claude", "skills", "lab", "stages", "idea.md"),
470
+ path.join(".claude", "skills", "lab", "stages", "framing.md"),
471
+ path.join(".claude", "skills", "lab", "stages", "spec.md"),
472
+ path.join(".claude", "skills", "lab", "stages", "run.md"),
473
+ path.join(".claude", "skills", "lab", "stages", "iterate.md"),
474
+ path.join(".claude", "skills", "lab", "stages", "review.md"),
475
+ path.join(".claude", "skills", "lab", "stages", "report.md"),
294
476
  path.join(".claude", "skills", "lab", "stages", "write.md"),
295
- path.join(".superlab", "templates", "idea.md"),
296
- path.join(".superlab", "templates", "proposal.md"),
297
- path.join(".superlab", "templates", "design.md"),
298
- path.join(".superlab", "templates", "spec.md"),
299
- path.join(".superlab", "templates", "tasks.md"),
300
- path.join(".superlab", "templates", "iteration-report.md"),
301
- path.join(".superlab", "templates", "review-checklist.md"),
302
- path.join(".superlab", "templates", "final-report.md"),
303
- path.join(".superlab", "templates", "paper-plan.md"),
304
- path.join(".superlab", "templates", "paper-section.md"),
305
- path.join(".superlab", "templates", "write-iteration.md"),
306
- path.join(".superlab", "config", "workflow.json"),
307
- path.join(".superlab", "context", "mission.md"),
308
- path.join(".superlab", "context", "state.md"),
309
- path.join(".superlab", "context", "decisions.md"),
310
- path.join(".superlab", "context", "evidence-index.md"),
311
- path.join(".superlab", "context", "open-questions.md"),
477
+ path.join(".claude", "skills", "lab", "references", "workflow.md"),
478
+ path.join(".lab", ".managed", "templates", "idea.md"),
479
+ path.join(".lab", ".managed", "templates", "framing.md"),
480
+ path.join(".lab", ".managed", "templates", "proposal.md"),
481
+ path.join(".lab", ".managed", "templates", "design.md"),
482
+ path.join(".lab", ".managed", "templates", "spec.md"),
483
+ path.join(".lab", ".managed", "templates", "tasks.md"),
484
+ path.join(".lab", ".managed", "templates", "iteration-report.md"),
485
+ path.join(".lab", ".managed", "templates", "review-checklist.md"),
486
+ path.join(".lab", ".managed", "templates", "final-report.md"),
487
+ path.join(".lab", ".managed", "templates", "paper-plan.md"),
488
+ path.join(".lab", ".managed", "templates", "paper-section.md"),
489
+ path.join(".lab", ".managed", "templates", "write-iteration.md"),
312
490
  ];
313
491
 
314
492
  for (const relativePath of relativePaths) {
@@ -321,6 +499,20 @@ function localizeInstalledAssets(targetDir, lang) {
321
499
  fs.writeFileSync(absolutePath, localized);
322
500
  }
323
501
  }
502
+
503
+ for (const relativePath of PROJECT_OWNED_LOCALIZED_PATHS) {
504
+ if (!newlyCreatedProjectOwnedPaths.has(relativePath)) {
505
+ continue;
506
+ }
507
+ const localized = getLocalizedContent(relativePath, lang);
508
+ if (!localized) {
509
+ continue;
510
+ }
511
+ const absolutePath = path.join(targetDir, relativePath);
512
+ if (fs.existsSync(absolutePath)) {
513
+ fs.writeFileSync(absolutePath, localized);
514
+ }
515
+ }
324
516
  }
325
517
 
326
518
  function installSuperlab({
@@ -338,19 +530,25 @@ function installSuperlab({
338
530
  if (platform === "claude" || platform === "both") {
339
531
  groups.push(...ASSET_GROUPS.claude);
340
532
  }
341
- groups.push(...ASSET_GROUPS.shared);
342
533
 
534
+ const resolvedLang = detectLanguage({ explicitLang: lang, env });
535
+ const newlyCreatedProjectOwnedPaths = new Set(
536
+ PROJECT_OWNED_LOCALIZED_PATHS.filter((relativePath) => !fs.existsSync(path.join(targetDir, relativePath)))
537
+ );
343
538
  for (const asset of groups) {
344
539
  copyDirectory(asset.from, path.join(targetDir, asset.to), force);
345
540
  }
346
- const resolvedLang = detectLanguage({ explicitLang: lang, env });
347
- localizeInstalledAssets(targetDir, resolvedLang);
541
+ installLabAssets(targetDir, force);
542
+ writePlatformShims(targetDir, resolvedLang, force);
543
+ writeManagedCoreFile(targetDir, resolvedLang, { force });
544
+ localizeInstalledAssets(targetDir, resolvedLang, { newlyCreatedProjectOwnedPaths });
348
545
  chmodScripts(targetDir);
349
546
  const metadata = {
350
547
  target_dir: path.resolve(targetDir),
351
548
  platform,
352
549
  lang: resolvedLang,
353
550
  package_version: PACKAGE_VERSION,
551
+ layout_version: LAYOUT_VERSION,
354
552
  updated_at: new Date().toISOString(),
355
553
  };
356
554
  writeProjectInstallMetadata(targetDir, metadata);
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: "LAB: Framing"
3
+ description: Lock paper-facing naming, title, and contribution framing before drafting
4
+ category: Workflow
5
+ tags: [workflow, research, framing]
6
+ ---
7
+
8
+ Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
9
+
10
+ Execute the requested `/lab:framing` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
11
+ This command runs the `/lab:framing` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -7,4 +7,5 @@ tags: [workflow, research, idea]
7
7
 
8
8
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
9
9
 
10
- This command runs the `/lab:idea` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
10
+ Execute the requested `/lab:idea` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
11
+ This command runs the `/lab:idea` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -7,4 +7,5 @@ tags: [workflow, research, iterate]
7
7
 
8
8
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
9
9
 
10
- This command runs the `/lab:iterate` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
10
+ Execute the requested `/lab:iterate` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
11
+ This command runs the `/lab:iterate` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -7,4 +7,5 @@ tags: [workflow, research, report]
7
7
 
8
8
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
9
9
 
10
- This command runs the `/lab:report` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
10
+ Execute the requested `/lab:report` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
11
+ This command runs the `/lab:report` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -7,4 +7,5 @@ tags: [workflow, research, review]
7
7
 
8
8
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
9
9
 
10
- This command runs the `/lab:review` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
10
+ Execute the requested `/lab:review` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
11
+ This command runs the `/lab:review` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -7,4 +7,5 @@ tags: [workflow, research, run]
7
7
 
8
8
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
9
9
 
10
- This command runs the `/lab:run` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
10
+ Execute the requested `/lab:run` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
11
+ This command runs the `/lab:run` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -7,4 +7,5 @@ tags: [workflow, research, spec]
7
7
 
8
8
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
9
9
 
10
- This command runs the `/lab:spec` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
10
+ Execute the requested `/lab:spec` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
11
+ This command runs the `/lab:spec` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -7,4 +7,5 @@ tags: [workflow, research, writing]
7
7
 
8
8
  Use the installed `lab` skill at `.claude/skills/lab/SKILL.md`.
9
9
 
10
- This command runs the `/lab:write` stage. It must read the matching section reference from `.claude/skills/lab/references/paper-writing/`, plus `paper-review.md` and `does-my-writing-flow-source.md`, build a mini-outline, and then revise only one section.
10
+ Execute the requested `/lab:write` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
11
+ This command runs the `/lab:write` stage. It requires an approved framing artifact from `/lab:framing`, must read the matching section reference from `.claude/skills/lab/references/paper-writing/`, plus `paper-review.md` and `does-my-writing-flow-source.md`, build a mini-outline, and then revise only one section.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Lock paper-facing naming, title, and contribution framing before drafting
3
+ argument-hint: naming, title, or contribution framing target
4
+ ---
5
+
6
+ Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
+
8
+ Execute the requested `/lab:framing` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
+ This command runs the `/lab:framing` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -5,4 +5,5 @@ argument-hint: idea or research problem
5
5
 
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
- This command runs the `/lab:idea` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
8
+ Execute the requested `/lab:idea` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
+ This command runs the `/lab:idea` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -5,4 +5,5 @@ argument-hint: iteration mission
5
5
 
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
- This command runs the `/lab:iterate` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
8
+ Execute the requested `/lab:iterate` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
+ This command runs the `/lab:iterate` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -5,4 +5,5 @@ argument-hint: report context
5
5
 
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
- This command runs the `/lab:report` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
8
+ Execute the requested `/lab:report` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
+ This command runs the `/lab:report` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -5,4 +5,5 @@ argument-hint: artifact or result to review
5
5
 
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
- This command runs the `/lab:review` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
8
+ Execute the requested `/lab:review` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
+ This command runs the `/lab:review` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -5,4 +5,5 @@ argument-hint: run context
5
5
 
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
- This command runs the `/lab:run` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
8
+ Execute the requested `/lab:run` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
+ This command runs the `/lab:run` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -5,4 +5,5 @@ argument-hint: approved idea context
5
5
 
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
- This command runs the `/lab:spec` stage. Follow the installed skill, stage guide, templates, and scripts under `.superlab/`.
8
+ Execute the requested `/lab:spec` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
+ This command runs the `/lab:spec` stage. Follow the installed skill, stage guide, and the project assets under `.lab/`.
@@ -5,4 +5,5 @@ argument-hint: section or writing target
5
5
 
6
6
  Use the installed `lab` skill at `.codex/skills/lab/SKILL.md`.
7
7
 
8
- This command runs the `/lab:write` stage. It must read the matching section reference from `.codex/skills/lab/references/paper-writing/`, plus `paper-review.md` and `does-my-writing-flow-source.md`, build a mini-outline, and then revise only one section.
8
+ Execute the requested `/lab:write` stage against the user's argument now. Do not only recommend another lab stage. If a blocking prerequisite is missing, say exactly what is missing and ask at most one clarifying question.
9
+ This command runs the `/lab:write` stage. It requires an approved framing artifact from `/lab:framing`, must read the matching section reference from `.codex/skills/lab/references/paper-writing/`, plus `paper-review.md` and `does-my-writing-flow-source.md`, build a mini-outline, and then revise only one section.
@@ -3,7 +3,7 @@
3
3
  ## Lab Change
4
4
 
5
5
  - Change id:
6
- - Target path: `.superlab/changes/<change-id>/design.md`
6
+ - Target path: `.lab/changes/<change-id>/design.md`
7
7
 
8
8
  ## Research Approach
9
9
 
@@ -29,5 +29,5 @@ Describe the method and why it is plausible.
29
29
 
30
30
  ## Change Links
31
31
 
32
- - Spec path: `.superlab/changes/<change-id>/spec.md`
33
- - Tasks path: `.superlab/changes/<change-id>/tasks.md`
32
+ - Spec path: `.lab/changes/<change-id>/spec.md`
33
+ - Tasks path: `.lab/changes/<change-id>/tasks.md`
@@ -0,0 +1,66 @@
1
+ # Paper Framing
2
+
3
+ ## Target
4
+
5
+ - Scope:
6
+ - Current paper-facing problem:
7
+ - Evidence boundary:
8
+
9
+ ## Canonical Terminology Audit
10
+
11
+ - Standard terms we should reuse:
12
+ - Adapted terms we can justify:
13
+ - Newly coined terms that need caution:
14
+ - Objects that must be explicit:
15
+ - Terms to avoid:
16
+
17
+ ## Candidate Framing Packs
18
+
19
+ ### Option 1
20
+
21
+ - Paper title:
22
+ - Method name:
23
+ - Short name or acronym:
24
+ - Module names:
25
+ - Contribution bullets:
26
+ - Why this works:
27
+ - Risks:
28
+
29
+ ### Option 2
30
+
31
+ - Paper title:
32
+ - Method name:
33
+ - Short name or acronym:
34
+ - Module names:
35
+ - Contribution bullets:
36
+ - Why this works:
37
+ - Risks:
38
+
39
+ ### Option 3
40
+
41
+ - Paper title:
42
+ - Method name:
43
+ - Short name or acronym:
44
+ - Module names:
45
+ - Contribution bullets:
46
+ - Why this works:
47
+ - Risks:
48
+
49
+ ## Recommended Framing Pack
50
+
51
+ - Paper title:
52
+ - Method name:
53
+ - Short name or acronym:
54
+ - Module names:
55
+ - Contribution bullets:
56
+
57
+ ## Forbidden Claims And Terms
58
+
59
+ - Claims to avoid:
60
+ - Terms to avoid:
61
+ - Why:
62
+
63
+ ## Approval Gate
64
+
65
+ - Approved framing:
66
+ - Open wording issues before `/lab:write`:
@@ -5,6 +5,7 @@
5
5
  - Venue or audience:
6
6
  - Paper status:
7
7
  - Core story in one sentence:
8
+ - Approved framing artifact:
8
9
  - Terminology lock:
9
10
 
10
11
  ## Section Status