genesis-compiler 1.2.20 → 1.2.22

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genesis-compiler",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "type": "module",
5
5
  "description": "An agent-independent prompt, multi-language code-index, cleanup, and verification companion with optional Codex hooks.",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genesis",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "description": "Makes Codex aware of optional Genesis adoption for existing projects.",
5
5
  "author": {
6
6
  "name": "Mobily Enterprises"
package/prompts/adopt.txt CHANGED
@@ -9,17 +9,18 @@ Genesis again or require them to understand Genesis terminology.
9
9
  Application source, dependencies, migrations, runtime behavior, and deployment
10
10
  files are read-only in this turn. You may edit `genesis/blueprint.md`,
11
11
  `genesis/stack.md`, explanatory Markdown below `genesis/program/`, and
12
- Genesis-managed skills/indexes produced by `genesis stack add` or Genesis
13
- inspection commands. Do not install dependencies, prepare a database, run
14
- migrations or seeds, start a server, deploy, or add compatibility code.
12
+ Genesis-managed skills/indexes produced by the Genesis `stack add` operation or
13
+ Genesis inspection commands. Do not install dependencies, prepare a database,
14
+ run migrations or seeds, start a server, deploy, or add compatibility code.
15
15
 
16
16
  If Stack has no components, inspect direct evidence such as manifests,
17
17
  lockfiles, build files, entrypoints, package scripts, tests, configuration,
18
18
  database and migration code, and existing project-tool metadata. Record only
19
- technologies the implementation already uses with `genesis stack add
20
- <piece...>`; this is factual import, not a new-technology choice. Ask a concise
21
- product-language question only when evidence is genuinely ambiguous. Then run
22
- `genesis prompt --task adopt "Continue the approved existing-project import."`
19
+ technologies the implementation already uses with the Genesis `stack add
20
+ <piece...>` operation; this is factual import, not a new-technology choice. Ask
21
+ a concise product-language question only when evidence is genuinely ambiguous.
22
+ Then run the Genesis
23
+ `prompt --task adopt "Continue the approved existing-project import."` operation
23
24
  and follow the regenerated prompt so every selected Stack piece contributes its
24
25
  Adoption requirements.
25
26
 
@@ -51,9 +52,10 @@ Create the non-technical Blueprint and useful subsystem-oriented Program from
51
52
  current source and tests. Do not cite archive internals or Git object storage as
52
53
  implementation source; Program sources must be current Git-visible files.
53
54
 
54
- Run `genesis check` only for structural validation. Missing environment inputs,
55
- Verification commands, or evidence required by a consumer-owned contract are
56
- honest import findings, not permission to invent or execute them. Finish with a
57
- clear inventory of what was imported, what remains unconfigured or blocked, and
58
- what would require a separately approved implementation port. Never claim the
59
- project is ready merely because Stack components were selected.
55
+ Run the Genesis `check` operation only for structural validation. Missing
56
+ environment inputs, Verification commands, or evidence required by a
57
+ consumer-owned contract are honest import findings, not permission to invent or
58
+ execute them. Finish with a clear inventory of what was imported, what remains
59
+ unconfigured or blocked, and what would require a separately approved
60
+ implementation port. Never claim the project is ready merely because Stack
61
+ components were selected.
@@ -8,9 +8,10 @@ and immediately related code. Apply every selected Stack cleanup instruction
8
8
  supplied below and load applicable official technology skills for additional
9
9
  language and framework context.
10
10
 
11
- Use `.genesis/machine-city.json` and `genesis index <name-or-path>` to find
12
- existing public and internal functions. Remove or consolidate genuine repeated
13
- helpers, but confirm behavior and call sites in source before changing them.
11
+ Use `.genesis/machine-city.json` and the Genesis `index <name-or-path>` operation
12
+ to find existing public and internal functions. Remove or consolidate genuine
13
+ repeated helpers, but confirm behavior and call sites in source before changing
14
+ them.
14
15
 
15
16
  The changed paths and nearby code are a location boundary, not permission to
16
17
  implement other behavior found there. Deslop may reorganize behavior already
package/prompts/start.txt CHANGED
@@ -7,9 +7,10 @@ step are clear.
7
7
  When `projectKind` is `new`, first ask what the app is about. Ask up to three
8
8
  concise, high-impact questions at a time. Use `availableStackPieces` to present
9
9
  only the relevant choices, explain them in product language, and let the user
10
- decide. Never silently select a technology. After an explicit choice, use
11
- `genesis stack add <piece...>`; do not edit `genesis/stack.md` by hand. Establish
12
- the non-technical Blueprint from the user's answers before implementation.
10
+ decide. Never silently select a technology. After an explicit choice, use the
11
+ Genesis `stack add <piece...>` operation; do not edit `genesis/stack.md` by
12
+ hand. Establish the non-technical Blueprint from the user's answers before
13
+ implementation.
13
14
  If the product direction becomes clear while Stack is still empty, do not end
14
15
  the turn after only writing or summarizing the Blueprint: present the relevant
15
16
  Stack choices in that same turn and ask the user to select one explicitly.
@@ -18,13 +19,15 @@ work, so do not force a separate profile question. When the user asks for a
18
19
  different engineering approach, or the product clearly has long-lived
19
20
  compatibility, operational, security, reliability, or compliance constraints,
20
21
  use `availableEngineeringProfiles` to explain only the relevant choices in
21
- product language. After an explicit choice, run `genesis engineering set
22
- <profile>`; do not invent or duplicate a built-in profile. Record additional
23
- explicit obligations in `genesis/engineering.md` under Project requirements.
22
+ product language. After an explicit choice, run the Genesis `engineering set
23
+ <profile>` operation; do not invent or duplicate a built-in profile. Record
24
+ additional explicit obligations in `genesis/engineering.md` under Project
25
+ requirements.
24
26
  This opening turn owns product direction and Stack selection, not final
25
- verification. Do not run `genesis verify` before implementation exists. If
26
- structural validation is useful, run `genesis check`; consumer-owned operations
27
- remain governed by their own tools and must not be inferred here.
27
+ verification. Do not run the Genesis `verify` operation before implementation
28
+ exists. If structural validation is useful, run the Genesis `check` operation;
29
+ consumer-owned operations remain governed by their own tools and must not be
30
+ inferred here.
28
31
 
29
32
  When `projectKind` is `existing`, ask what the user wants to understand or
30
33
  change. Use the current Blueprint, Stack, Program, and code index when present.
@@ -45,9 +48,9 @@ understand or change and strongly recommend preparing the existing project for
45
48
  guided editing before substantial work. Explain in product language that this
46
49
  preserves the implementation while importing its current setup, run, database,
47
50
  preview, verification, and product context. Do not require the user to know
48
- Genesis terminology or type a command. If they approve, run `genesis adopt`
49
- yourself and follow its adoption prompt. If they decline, continue normally and
50
- do not repeat the recommendation.
51
+ Genesis terminology or type a command. If they approve, run the Genesis `adopt`
52
+ operation yourself and follow its adoption prompt. If they decline, continue
53
+ normally and do not repeat the recommendation.
51
54
 
52
55
  If the request already contains an unambiguous product description and an
53
56
  explicit Stack choice, you may apply that choice and establish the Blueprint.
package/prompts/work.txt CHANGED
@@ -4,8 +4,9 @@ implement the request in the ordinary local Git tree.
4
4
  Load the applicable official or project technology skills listed below. Use
5
5
  their normal generators, commands, packages, and established seams. Do not
6
6
  search package internals or unrelated manuals merely to reconfirm an exact lane.
7
- Before adding a helper or public operation, query `genesis index <name-or-path>`
8
- and reuse an existing function when it already owns the behavior.
7
+ Before adding a helper or public operation, query the Genesis
8
+ `index <name-or-path>` operation and reuse an existing function when it already
9
+ owns the behavior.
9
10
 
10
11
  This is the implementation turn. Do not edit the Blueprint, Program, or
11
12
  `.genesis/`; the separate reconciliation turn owns explanatory changes. Keep
@@ -20,8 +21,9 @@ Run focused checks when useful. Summarize files changed, checks actually run,
20
21
  and anything still requiring attention.
21
22
 
22
23
  If no Stack components are selected, continue the project-opening
23
- conversation instead of guessing a technology. Use `genesis stack list` for
24
- the current catalog, present relevant choices, wait for an explicit decision,
25
- and add the selection with `genesis stack add <piece...>` before relying on
26
- technology-specific operations. Do not end after only updating
24
+ conversation instead of guessing a technology. Use the Genesis `stack list`
25
+ operation for the current catalog, present relevant choices, wait for an
26
+ explicit decision, and add the selection with the Genesis
27
+ `stack add <piece...>` operation before relying on technology-specific
28
+ operations. Do not end after only updating
27
29
  or summarizing the Blueprint while the Stack remains empty.
@@ -9,14 +9,22 @@ Review and simplify the current local codebase without changing product
9
9
  behavior. Start with the requested scope, or otherwise the ordinary Git diff
10
10
  and the code immediately around it.
11
11
 
12
+ When this repository is Genesis itself or has `genesis-compiler` installed
13
+ locally, invoke every Genesis CLI operation through the project-pinned package:
14
+ `npm exec --no -- genesis <arguments>`. This runs without fetching another
15
+ package. Otherwise use `genesis <arguments>` only when that executable is
16
+ already available on `PATH`. Never install or update Genesis merely to satisfy
17
+ a workflow instruction.
18
+
12
19
  Apply the engineering approach supplied with the task. If this skill is invoked
13
20
  directly, read `genesis/engineering.md` as well as the relevant project context.
14
21
  Cleanup must reduce or preserve complexity, never introduce unapproved
15
22
  machinery that the selected profile or a concrete requirement does not need.
16
23
 
17
- Consult `.genesis/machine-city.json` or run `genesis index <name-or-path>` to
18
- find existing public and internal functions before introducing or consolidating
19
- an abstraction. Confirm every apparent duplicate in source and its call sites.
24
+ Consult `.genesis/machine-city.json` or run the Genesis `index <name-or-path>`
25
+ operation to find existing public and internal functions before introducing or
26
+ consolidating an abstraction. Confirm every apparent duplicate in source and
27
+ its call sites.
20
28
 
21
29
  Within the preceding implementation's intended behavior and scope, leave no
22
30
  repeated helpers, no code that is unclear or hard to reason about, and no code
@@ -45,5 +53,5 @@ external resources. Do not weaken tests, public behavior, or data guarantees.
45
53
  Do not create a second architecture or perform unrelated rewrites.
46
54
 
47
55
  Run focused checks when useful. Final declared checks remain available through
48
- `genesis verify`. Summarize what became simpler, files changed, and checks
49
- actually run.
56
+ the Genesis `verify` operation. Summarize what became simpler, files changed,
57
+ and checks actually run.
@@ -8,6 +8,15 @@ description: Work safely in a Genesis-enriched codebase using its Blueprint, Sta
8
8
  Genesis is an explanatory and verification companion. It does not replace the
9
9
  codebase, tests, Git review, or the coding agent.
10
10
 
11
+ ## Run Genesis commands
12
+
13
+ When this repository is Genesis itself or has `genesis-compiler` installed
14
+ locally, invoke every Genesis CLI operation through the project-pinned package:
15
+ `npm exec --no -- genesis <arguments>`. This runs without fetching another
16
+ package. Otherwise use `genesis <arguments>` only when that executable is
17
+ already available on `PATH`. Never install or update Genesis merely to satisfy
18
+ a workflow instruction.
19
+
11
20
  ## Establish context
12
21
 
13
22
  1. Read `genesis/blueprint.md` for non-technical product intent.
@@ -16,10 +25,11 @@ codebase, tests, Git review, or the coding agent.
16
25
  3. Read `genesis/stack.md` for the selected technical composition, resources,
17
26
  and verification commands.
18
27
  4. Locate the source involved in the request.
19
- 5. Run `genesis index <name-or-path>` before adding a helper or public operation.
20
- Reuse an existing function when it already owns the behavior.
21
- 6. Run `genesis context <path...>` for the relevant Program explanations and
22
- selected Stack context.
28
+ 5. Run the Genesis `index <name-or-path>` operation before adding a helper or
29
+ public operation. Reuse an existing function when it already owns the
30
+ behavior.
31
+ 6. Run the Genesis `context <path...>` operation for the relevant Program
32
+ explanations and selected Stack context.
23
33
  7. Load applicable technology skills from `.agents/skills/` or from the
24
34
  agent's own installed skill catalog.
25
35
 
@@ -38,7 +48,8 @@ tests, and runtime behavior.
38
48
 
39
49
  `.genesis/machine-city.json` is a derived detailed file/function map.
40
50
  `.genesis/program-city.json` is a derived simpler subsystem/operation map.
41
- Neither is authority or proof; both may be regenerated with `genesis index`.
51
+ Neither is authority or proof; both may be regenerated with the Genesis
52
+ `index` operation.
42
53
 
43
54
  ## Implement ordinary local work
44
55
 
@@ -70,9 +81,9 @@ Neither is authority or proof; both may be regenerated with `genesis index`.
70
81
 
71
82
  ## Verify and report
72
83
 
73
- After the selected technology's workspace substrate exists, use `genesis
74
- verify` for the Stack's declared final checks. An unconfigured result means the
75
- declared workspace or checks do not exist yet; it is not a failing check. Report
76
- files changed, checks actually run, and anything still requiring attention.
77
- Never claim that an unrun check passed or that passing checks prove the whole
78
- product.
84
+ After the selected technology's workspace substrate exists, use the Genesis
85
+ `verify` operation for the Stack's declared final checks. An unconfigured result
86
+ means the declared workspace or checks do not exist yet; it is not a failing
87
+ check. Report files changed, checks actually run, and anything still requiring
88
+ attention. Never claim that an unrun check passed or that passing checks prove
89
+ the whole product.
@@ -128,7 +128,7 @@ async function optionalEngineering(projectRoot) {
128
128
  '',
129
129
  await readEngineeringBaseline(),
130
130
  '',
131
- 'The project engineering profile is invalid. Do not infer a replacement; run `genesis check` and ask the user before implementation if the selected approach matters.',
131
+ 'The project engineering profile is invalid. Do not infer a replacement; run the Genesis `check` operation and ask the user before implementation if the selected approach matters.',
132
132
  ].join('\n'),
133
133
  profile: null,
134
134
  status: 'invalid',
@@ -145,7 +145,7 @@ export async function codexSessionContext({ projectRoot } = {}) {
145
145
  const selected = stack?.components.map(({ id }) => id) || [];
146
146
  const stackStatus = stack
147
147
  ? (selected.length > 0 ? selected.join(', ') : 'none')
148
- : 'unavailable; run `genesis check`';
148
+ : 'unavailable; run the Genesis `check` operation';
149
149
  return {
150
150
  status: 'ready',
151
151
  output: [
@@ -155,15 +155,16 @@ export async function codexSessionContext({ projectRoot } = {}) {
155
155
  '- `genesis/stack.md` selects optional technology guidance and verification.',
156
156
  '- `genesis/program/<subsystem>/` explains public operations and useful internal seams.',
157
157
  '- Project Agent Skills live in `.agents/skills/`; load applicable skills progressively.',
158
- '- After locating relevant source files, run `genesis context <path...>` to load their Program and selected Stack material.',
159
- '- Before creating a helper or public operation, run `genesis index <name-or-path>` and reuse an existing function when it already owns the behavior.',
158
+ '- When this repository is Genesis itself or has local `genesis-compiler`, run every Genesis CLI operation as `npm exec --no -- genesis <arguments>` so the project-pinned version is used without fetching another package. Otherwise use `genesis <arguments>` only when that executable is already available on `PATH`. Never install or update Genesis merely to run a workflow instruction.',
159
+ '- After locating relevant source files, run the Genesis `context <path...>` operation to load their Program and selected Stack material.',
160
+ '- Before creating a helper or public operation, run the Genesis `index <name-or-path>` operation and reuse an existing function when it already owns the behavior.',
160
161
  '- `.genesis/machine-city.json` is the detailed code/function map; `.genesis/program-city.json` is the simpler subsystem/operation map.',
161
162
  '- Program is fallible explanation; code, tests, and runtime behavior remain evidence.',
162
- '- Before the first project-file edit in a user-requested implementation turn, silently run `genesis hook authorize` once in every Git repository you will edit. This is internal Genesis bookkeeping, not a request for user permission: do not ask the user, announce successful authorization, or include it in progress or final summaries. Mention it only if the command fails.',
163
+ '- Before the first project-file edit in a user-requested implementation turn, silently run the Genesis `hook authorize` operation once in every Git repository you will edit. This is internal Genesis bookkeeping, not a request for user permission: do not ask the user, announce successful authorization, or include it in progress or final summaries. Mention it only if the command fails.',
163
164
  '- Authorization is turn-scoped. Run it again for a later code-changing turn after a user follow-up or interruption, but not again within the same active turn after it succeeds. The command must report `authorize: authorized` or `authorize: unchanged`; otherwise stop before editing. Never authorize answer, explanation, review, diagnosis-only, reconciliation, or Deslop turns.',
164
165
  '- Apply the engineering approach below to implementation and cleanup; the Stop hook owns optional Stack Post-change work, Blueprint/Program reconciliation, and Deslop turns.',
165
166
  '- After an authorized code-changing turn, Genesis may request separate post-change, explanation, and cleanup turns.',
166
- `Engineering profile: ${engineering.profile?.id || 'invalid; run \`genesis check\`'}.`,
167
+ `Engineering profile: ${engineering.profile?.id || 'invalid; run the Genesis \`check\` operation'}.`,
167
168
  `Selected Stack components: ${stackStatus}.`,
168
169
  '',
169
170
  'ENGINEERING APPROACH',
@@ -190,7 +191,7 @@ export async function codexAdoptionRecommendation({ projectRoot = process.cwd()
190
191
  'This existing project has no Genesis explanatory layer.',
191
192
  'In your first response, strongly recommend preparing this existing project for guided editing before substantial work.',
192
193
  'Explain in product language that preparation preserves the implementation while importing its current operational and product context. Do not require the user to know Genesis terminology or type a command.',
193
- 'If the user approves, run `genesis adopt` yourself and follow the returned adoption prompt.',
194
+ 'If the user approves, run the Genesis `adopt` operation yourself and follow the returned adoption prompt.',
194
195
  'Do not run it without the user\'s approval. If they agree, run it and follow the returned prompt in this conversation.',
195
196
  'If the user declines, continue normally and do not repeat the recommendation in this session.',
196
197
  ].join('\n'),
@@ -213,6 +214,13 @@ function zeroPaths(buffer) {
213
214
  return normalizedPaths(buffer.toString('utf8').split('\0'));
214
215
  }
215
216
 
217
+ function projectPathStates(projectRoot, files) {
218
+ return Promise.all(files.map(async (file) => ({
219
+ path: file,
220
+ state: await pathState(path.join(projectRoot, file)),
221
+ })));
222
+ }
223
+
216
224
  async function repositorySnapshot(projectRoot) {
217
225
  const head = await runGitText(projectRoot, ['rev-parse', '--verify', 'HEAD']).catch(() => null);
218
226
  const results = await Promise.all([
@@ -226,10 +234,7 @@ async function repositorySnapshot(projectRoot) {
226
234
  .sort();
227
235
  return {
228
236
  head,
229
- dirty: await Promise.all(dirty.map(async (file) => ({
230
- path: file,
231
- state: await pathState(path.join(projectRoot, file)),
232
- }))),
237
+ dirty: await projectPathStates(projectRoot, dirty),
233
238
  };
234
239
  }
235
240
 
@@ -422,19 +427,27 @@ function changedPathLines(changedPaths) {
422
427
  }
423
428
 
424
429
  function changedRepositoryLines(repositories) {
425
- return repositories.flatMap(({ projectRoot, changedPaths }) => [
430
+ return repositories.flatMap(({ projectRoot, changedPaths, driftedPaths = [] }) => [
426
431
  `## Repository: \`${projectRoot}\``,
427
432
  '',
428
433
  ...changedPathLines(changedPaths),
434
+ ...(driftedPaths.length > 0 ? [
435
+ '',
436
+ '### Concurrent changes excluded from cleanup',
437
+ '',
438
+ 'These paths changed after the implementation scope was frozen. Report them, but do not edit them:',
439
+ '',
440
+ ...changedPathLines(driftedPaths),
441
+ ] : []),
429
442
  '',
430
443
  ]);
431
444
  }
432
445
 
433
- async function changedRepositories(repositories) {
446
+ async function changedRepositories(repositories, { snapshotField = 'snapshot' } = {}) {
434
447
  return (await Promise.all(repositories.map(async (repository) => {
435
448
  const currentPaths = await changedProjectPaths(
436
449
  repository.projectRoot,
437
- repository.snapshot,
450
+ repository[snapshotField] || repository.snapshot,
438
451
  await repositorySnapshot(repository.projectRoot),
439
452
  );
440
453
  const changedPaths = normalizedPaths([
@@ -445,6 +458,47 @@ async function changedRepositories(repositories) {
445
458
  }))).filter(Boolean);
446
459
  }
447
460
 
461
+ async function freezeChangedRepositories(repositories, { startPostChange = false } = {}) {
462
+ return Promise.all(repositories.map(async (repository) => {
463
+ const changedPaths = normalizedPaths(repository.changedPaths || []).sort();
464
+ const [pathStates, phaseSnapshot] = await Promise.all([
465
+ projectPathStates(repository.projectRoot, changedPaths),
466
+ startPostChange ? repositorySnapshot(repository.projectRoot) : null,
467
+ ]);
468
+ const frozen = {
469
+ ...repository,
470
+ changedPaths,
471
+ pathStates,
472
+ };
473
+ delete frozen.driftedPaths;
474
+ delete frozen.phaseSnapshot;
475
+ if (phaseSnapshot) frozen.phaseSnapshot = phaseSnapshot;
476
+ return frozen;
477
+ }));
478
+ }
479
+
480
+ async function cleanupScopeRepositories(repositories) {
481
+ return (await Promise.all(repositories.map(async (repository) => {
482
+ const ownedPaths = normalizedPaths(repository.changedPaths || []).sort();
483
+ if (ownedPaths.length === 0) return null;
484
+ const expected = new Map((repository.pathStates || [])
485
+ .map(({ path: file, state }) => [file, state]));
486
+ const changedPaths = [];
487
+ const driftedPaths = [];
488
+ for (const { path: file, state } of await projectPathStates(repository.projectRoot, ownedPaths)) {
489
+ const destination = expected.has(file) && stableJson(expected.get(file)) !== stableJson(state)
490
+ ? driftedPaths
491
+ : changedPaths;
492
+ destination.push(file);
493
+ }
494
+ return {
495
+ ...repository,
496
+ changedPaths,
497
+ driftedPaths,
498
+ };
499
+ }))).filter(Boolean);
500
+ }
501
+
448
502
  async function repositoryContexts(repositories) {
449
503
  return Promise.all(repositories.map(async (repository) => {
450
504
  const [stack, engineering] = await Promise.all([
@@ -571,13 +625,14 @@ export async function completeCodexTurn({ input, projectRoot } = {}) {
571
625
  await removeTurnState(statePath, input);
572
626
  return {};
573
627
  }
574
- const repositories = await changedRepositories(registeredRepositories(state, root));
575
- if (repositories.length === 0) {
628
+ const changed = await changedRepositories(registeredRepositories(state, root));
629
+ if (changed.length === 0) {
576
630
  await removeTurnState(statePath, input);
577
631
  return {};
578
632
  }
579
- const contexts = await repositoryContexts(repositories);
633
+ const contexts = await repositoryContexts(changed);
580
634
  const postChange = contexts.some(({ stack }) => Boolean(stack?.postChange?.trim()));
635
+ const repositories = await freezeChangedRepositories(changed, { startPostChange: postChange });
581
636
  await writeTurnState(statePath, {
582
637
  ...state,
583
638
  phase: postChange ? 'post-change' : 'reconcile',
@@ -597,11 +652,14 @@ export async function completeCodexTurn({ input, projectRoot } = {}) {
597
652
  }
598
653
 
599
654
  if (state.phase === 'post-change') {
600
- const repositories = await changedRepositories(registeredRepositories(state, root));
601
- if (repositories.length === 0) {
655
+ const changed = await changedRepositories(registeredRepositories(state, root), {
656
+ snapshotField: 'phaseSnapshot',
657
+ });
658
+ if (changed.length === 0) {
602
659
  await removeTurnState(statePath, input);
603
660
  return {};
604
661
  }
662
+ const repositories = await freezeChangedRepositories(changed);
605
663
  await writeTurnState(statePath, {
606
664
  ...state,
607
665
  phase: 'reconcile',
@@ -615,7 +673,7 @@ export async function completeCodexTurn({ input, projectRoot } = {}) {
615
673
 
616
674
  if (state.phase === 'reconcile') {
617
675
  const registered = registeredRepositories(state, root);
618
- const repositories = await changedRepositories(registered);
676
+ const repositories = await cleanupScopeRepositories(registered);
619
677
  if (repositories.length === 0) {
620
678
  await refreshProjectIndexes(registered);
621
679
  await removeTurnState(statePath, input);
@@ -116,7 +116,7 @@ export async function contextForProjectPaths({ paths, projectRoot, stackPackages
116
116
  : functions.slice(0, 100).map((entry) => (
117
117
  `- ${entry.visibility} \`${entry.qualifiedName}(${entry.parameters.join(', ')})\` — \`${entry.path}:${entry.line}\``
118
118
  ))),
119
- ...(functions.length > 100 ? [`- ... and ${functions.length - 100} more; run \`genesis index ${targets.join(' ')}\`.`] : []),
119
+ ...(functions.length > 100 ? [`- ... and ${functions.length - 100} more; run the Genesis \`index ${targets.join(' ')}\` operation.`] : []),
120
120
  '',
121
121
  'Search the Machine City before adding a helper or public operation; reuse an existing function when it already owns the behavior.',
122
122
  ...(skills ? ['', '## Agent Skills', '', skills] : []),
@@ -96,7 +96,7 @@ function codeIndexContext(index) {
96
96
  status: index.program.status,
97
97
  operations: index.operationCount,
98
98
  },
99
- query: 'genesis index <function-or-path...>',
99
+ query: 'Genesis index operation: <function-or-path...>',
100
100
  };
101
101
  }
102
102