@orkestrel/scaffold 0.0.121 → 0.0.123

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 (85) hide show
  1. package/dist/agents/skills/orkestrel-dispatch/scripts/brief.js +57 -9
  2. package/dist/agents/skills/orkestrel-dispatch/scripts/chain.js +22 -2
  3. package/dist/agents/skills/orkestrel-harden/scripts/interleave.js +539 -0
  4. package/dist/agents/skills/orkestrel-parallel/scripts/lane.js +1163 -0
  5. package/dist/agents/skills/orkestrel-publish/scripts/pins.js +5 -5
  6. package/dist/agents/skills/orkestrel-publish/scripts/wave.js +67 -5
  7. package/dist/bin/main.js +8 -6
  8. package/dist/bin/main.js.map +1 -1
  9. package/dist/host/agents/orchestration.md +29 -18
  10. package/dist/host/agents/skills/orkestrel-dispatch/SKILL.md +7 -6
  11. package/dist/host/agents/skills/orkestrel-dispatch/references/launch.md +3 -2
  12. package/dist/host/agents/skills/orkestrel-dispatch/scripts/brief.ts +65 -9
  13. package/dist/host/agents/skills/orkestrel-dispatch/scripts/chain.ts +28 -2
  14. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +4 -2
  15. package/dist/host/agents/skills/orkestrel-falsify/references/brief.md +3 -2
  16. package/dist/host/agents/skills/orkestrel-harden/SKILL.md +24 -11
  17. package/dist/host/agents/skills/orkestrel-harden/references/bindings.md +18 -12
  18. package/dist/host/agents/skills/orkestrel-harden/references/document.md +1 -0
  19. package/dist/host/agents/skills/orkestrel-harden/references/equivalence.md +2 -1
  20. package/dist/host/agents/skills/orkestrel-harden/references/hardening.md +4 -4
  21. package/dist/host/agents/skills/orkestrel-harden/references/methods.md +642 -0
  22. package/dist/host/agents/skills/orkestrel-harden/scripts/interleave.ts +665 -0
  23. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +16 -15
  24. package/dist/host/agents/skills/orkestrel-parallel/references/{claude.md → claude-code.md} +13 -13
  25. package/dist/host/agents/skills/orkestrel-parallel/references/t3.md +1 -0
  26. package/dist/host/agents/skills/orkestrel-parallel/scripts/lane.ts +1433 -0
  27. package/dist/host/agents/skills/orkestrel-publish/SKILL.md +12 -9
  28. package/dist/host/agents/skills/orkestrel-publish/references/release.md +2 -2
  29. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +39 -8
  30. package/dist/host/agents/skills/orkestrel-publish/references/window.md +5 -1
  31. package/dist/host/agents/skills/orkestrel-publish/scripts/pins.ts +5 -5
  32. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +86 -7
  33. package/dist/host/claude/AGENTS.md +2 -2
  34. package/dist/host/claude/agents/analyst.md +1 -1
  35. package/dist/host/claude/agents/builder.md +1 -1
  36. package/dist/host/claude/agents/distiller.md +2 -1
  37. package/dist/host/claude/agents/grok.md +2 -2
  38. package/dist/host/claude/agents/opus.md +8 -7
  39. package/dist/host/claude/agents/orkestrel.md +7 -7
  40. package/dist/host/claude/agents/planner.md +3 -3
  41. package/dist/host/claude/agents/reviewer.md +3 -3
  42. package/dist/host/claude/agents/scout.md +2 -1
  43. package/dist/host/claude/agents/verifier.md +2 -2
  44. package/dist/host/claude/rules/campaign.md +15 -13
  45. package/dist/host/claude/rules/documentation.md +1 -0
  46. package/dist/host/claude/rules/names.md +13 -7
  47. package/dist/host/claude/rules/patterns.md +14 -0
  48. package/dist/host/claude/rules/quality.md +4 -1
  49. package/dist/host/claude/rules/tests.md +5 -1
  50. package/dist/host/claude/rules/workspace.md +9 -0
  51. package/dist/host/claude/rules/writing.md +1 -1
  52. package/dist/host/claude/skills/orkestrel-harden/SKILL.md +1 -1
  53. package/dist/host/claude/skills/orkestrel-parallel/SKILL.md +1 -1
  54. package/dist/host/codex/agents/analyst.toml +6 -6
  55. package/dist/host/codex/agents/astra.toml +1 -1
  56. package/dist/host/codex/agents/builder.toml +1 -1
  57. package/dist/host/codex/agents/distiller.toml +4 -2
  58. package/dist/host/codex/agents/grok.toml +5 -2
  59. package/dist/host/codex/agents/opus.toml +6 -4
  60. package/dist/host/codex/agents/planner.toml +6 -5
  61. package/dist/host/codex/agents/reviewer.toml +9 -8
  62. package/dist/host/codex/agents/scout.toml +5 -1
  63. package/dist/host/codex/agents/verifier.toml +8 -3
  64. package/dist/host/dotfiles/gitignore +1 -2
  65. package/dist/host/guides/agent.md +1119 -457
  66. package/dist/host/guides/ndjson.md +81 -21
  67. package/dist/host/guides/ollama.md +22 -18
  68. package/dist/host/guides/probe.md +29 -27
  69. package/dist/host/guides/scaffold.md +42 -15
  70. package/dist/host/guides/study.md +538 -450
  71. package/dist/host/manifest.json +81 -63
  72. package/dist/host/tests/config.test.ts +7 -0
  73. package/dist/src/core/index.cjs +14 -8
  74. package/dist/src/core/index.cjs.map +1 -1
  75. package/dist/src/core/index.d.cts +1 -4
  76. package/dist/src/core/index.d.ts +1 -4
  77. package/dist/src/core/index.js +14 -8
  78. package/dist/src/core/index.js.map +1 -1
  79. package/dist/src/server/index.cjs +87 -8
  80. package/dist/src/server/index.cjs.map +1 -1
  81. package/dist/src/server/index.d.cts +50 -6
  82. package/dist/src/server/index.d.ts +50 -6
  83. package/dist/src/server/index.js +87 -10
  84. package/dist/src/server/index.js.map +1 -1
  85. package/package.json +2 -2
@@ -8,9 +8,10 @@
8
8
  // edited. The second form reads every backticked token carrying a slash (a backslash counts and is
9
9
  // read as a slash), strips a `:line` or
10
10
  // `:line-line` suffix, resolves it from the working directory, and prints the ones that do not
11
- // exist; a bare filename is outside the check. The two forms are two modes; name one. The script
12
- // refuses a flag it does not read, the `--flag=value` form included. Exit 3 when any is missing, 64
13
- // on usage.
11
+ // exist; a bare filename is outside the check. It also names each template section the brief omits:
12
+ // the `## Role and engine` section, and the `## Execution` section with its spawn-nothing sentence.
13
+ // The two forms are two modes; name one. The script refuses a flag it does not read, the
14
+ // `--flag=value` form included. Exit 3 when a path or a section is missing, 64 on usage.
14
15
  import { existsSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from 'node:fs';
15
16
  import { dirname, join, resolve } from 'node:path';
16
17
  import { fileURLToPath } from 'node:url';
@@ -23,6 +24,11 @@ export const LANES = Object.freeze({
23
24
  codex: 'tmp/codex',
24
25
  claude: 'tmp/claude',
25
26
  });
27
+ /** Lists the template sections every brief must keep, in template order. */
28
+ export const REQUIREMENTS = [
29
+ { heading: '## Role and engine', sentence: undefined },
30
+ { heading: '## Execution', sentence: 'Perform the assignment yourself and spawn nothing.' },
31
+ ];
26
32
  /** Lists the flags that take a value. */
27
33
  export const VALUE_FLAGS = ['--unit', '--lane', '--subject', '--check'];
28
34
  /** Lists every flag the script reads, value flags and switches alike. */
@@ -100,6 +106,42 @@ export function extractPaths(content) {
100
106
  .filter(readsAsPath));
101
107
  return [...found].sort();
102
108
  }
109
+ /**
110
+ * Reads the body of a level-two section.
111
+ *
112
+ * @param content - The brief text.
113
+ * @param heading - The heading line, such as `## Execution`.
114
+ * @returns The text between the heading line and the next level-two heading or the end, or
115
+ * undefined when no line equals the heading.
116
+ */
117
+ export function extractSection(content, heading) {
118
+ const lines = content.split(/\r\n|\n/u);
119
+ const start = lines.findIndex((line) => line.trimEnd() === heading);
120
+ if (start === -1)
121
+ return undefined;
122
+ const rest = lines.slice(start + 1);
123
+ const end = rest.findIndex((line) => line.startsWith('## '));
124
+ return (end === -1 ? rest : rest.slice(0, end)).join('\n');
125
+ }
126
+ /**
127
+ * Names each required template section a brief omits.
128
+ *
129
+ * @param content - The brief text.
130
+ * @param requirements - The sections the brief must keep.
131
+ * @returns One description per omission, in requirement order: the heading when its section is
132
+ * absent, and the sentence with its heading when the section is present without it.
133
+ */
134
+ export function scanOmissions(content, requirements) {
135
+ return requirements.flatMap(({ heading, sentence }) => {
136
+ const body = extractSection(content, heading);
137
+ const named = sentence === undefined ? '' : ` with the sentence ${JSON.stringify(sentence)}`;
138
+ if (body === undefined)
139
+ return [`the ${JSON.stringify(heading)} section${named}`];
140
+ if (sentence === undefined || body.replace(/\s+/gu, ' ').includes(sentence))
141
+ return [];
142
+ return [`the sentence ${JSON.stringify(sentence)} under ${JSON.stringify(heading)}`];
143
+ });
144
+ }
103
145
  /**
104
146
  * Resolves the first brief path for a unit that no file occupies.
105
147
  *
@@ -141,26 +183,32 @@ export function writeBrief(argv) {
141
183
  return 0;
142
184
  }
143
185
  /**
144
- * Checks that every path a brief names exists.
186
+ * Checks that every path a brief names exists and that the brief keeps every required section.
145
187
  *
146
188
  * @param path - The brief file.
147
- * @returns The exit code: 0 when every path exists, 3 when one is missing, 64 when the brief is not a file.
189
+ * @returns The exit code: 0 when every path exists and no section is omitted, 3 when a path is
190
+ * missing or a section is omitted, 64 when the brief is not a file.
148
191
  */
149
192
  export function checkBrief(path) {
150
193
  if (!existsSync(path) || !statSync(path).isFile()) {
151
194
  console.error(`brief: ${path} is not a file`);
152
195
  return 64;
153
196
  }
154
- const paths = extractPaths(readFileSync(path, 'utf8'));
197
+ const content = readFileSync(path, 'utf8');
198
+ const paths = extractPaths(content);
155
199
  const missing = paths.filter((candidate) => !existsSync(resolve(candidate)));
156
- console.log(JSON.stringify({ brief: path, checked: paths.length, missing }));
157
- return missing.length === 0 ? 0 : 3;
200
+ const omitted = scanOmissions(content, REQUIREMENTS);
201
+ console.log(JSON.stringify({ brief: path, checked: paths.length, missing, omitted }));
202
+ if (omitted.length > 0)
203
+ console.error(`brief: ${path} omits ${omitted.join('; ')}`);
204
+ return missing.length === 0 && omitted.length === 0 ? 0 : 3;
158
205
  }
159
206
  /**
160
207
  * Runs the script on its arguments.
161
208
  *
162
209
  * @param argv - The arguments after the script path.
163
- * @returns The exit code: 0 on success, 3 when a named path is missing, 64 on usage.
210
+ * @returns The exit code: 0 on success, 3 when a named path or a required section is missing, 64 on
211
+ * usage.
164
212
  */
165
213
  export function main(argv) {
166
214
  const unknown = readUnknownFlags(argv, FLAGS);
@@ -2,7 +2,8 @@
2
2
  // node .agents/skills/orkestrel-dispatch/scripts/chain.ts --plan FILE.json --journal DIR
3
3
  // The plan is a JSON array of steps, each `{ "name": "...", "command": "...", "args": ["..."] }`
4
4
  // with an optional `"cwd"` (a directory, relative to the working directory) and `"env"` (a record
5
- // of strings laid over this process's environment). A step name is letters, digits, dots,
5
+ // of strings laid over this process's environment by case-folded name, so an added variable drops
6
+ // every inherited one whose lower-cased name it claims). A step name is letters, digits, dots,
6
7
  // underscores, and hyphens, opens with a letter or digit, and is unique in the plan. Each step runs
7
8
  // with no shell and closed stdin, in plan order, with its standard output and standard error
8
9
  // written together to `DIR/<name>.txt`; the script prints one `name exit=N durationMs=N` line per
@@ -193,6 +194,25 @@ export function readStep(entry) {
193
194
  },
194
195
  ];
195
196
  }
197
+ /**
198
+ * Lays added variables over an inherited environment by case-folded name.
199
+ *
200
+ * @remarks
201
+ * A Windows environment block folds names by case, so an inherited `NPM_CONFIG_CACHE` would
202
+ * outrank an added `npm_config_cache`; every inherited variable whose lower-cased name an added
203
+ * variable claims is dropped first.
204
+ *
205
+ * @param inherited - The environment the child would inherit.
206
+ * @param added - The variables the step sets.
207
+ * @returns The inherited variables no added name claims, followed by the added variables.
208
+ */
209
+ export function mergeEnv(inherited, added) {
210
+ const claimed = new Set(Object.keys(added).map((name) => name.toLowerCase()));
211
+ return {
212
+ ...Object.fromEntries(Object.entries(inherited).filter(([name]) => !claimed.has(name.toLowerCase()))),
213
+ ...added,
214
+ };
215
+ }
196
216
  /**
197
217
  * Runs one step with no shell, its output and errors written together to a file.
198
218
  *
@@ -207,7 +227,7 @@ export function runStep(step, output) {
207
227
  try {
208
228
  const result = spawnSync(step.command, step.args, {
209
229
  cwd: step.cwd === undefined ? undefined : resolve(step.cwd),
210
- env: { ...process.env, ...step.env },
230
+ env: mergeEnv(process.env, step.env),
211
231
  stdio: ['ignore', descriptor, descriptor],
212
232
  windowsHide: true,
213
233
  shell: false,