genesis-compiler 1.0.0 → 1.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 (70) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/README.md +423 -0
  3. package/bin/genesis.js +15 -0
  4. package/docs/assurance-model.md +26 -0
  5. package/docs/prompt-integration.md +92 -0
  6. package/docs/stack-components.md +269 -0
  7. package/package.json +56 -7
  8. package/plugins/genesis/.codex-plugin/plugin.json +19 -0
  9. package/plugins/genesis/hooks.json +18 -0
  10. package/prompts/blueprint.txt +9 -0
  11. package/prompts/describe.txt +17 -0
  12. package/prompts/deslop.txt +14 -0
  13. package/prompts/program.txt +12 -0
  14. package/prompts/reconcile.txt +12 -0
  15. package/prompts/review.txt +12 -0
  16. package/prompts/work.txt +21 -0
  17. package/skills/genesis-deslop/SKILL.md +36 -0
  18. package/skills/genesis-deslop/agents/openai.yaml +4 -0
  19. package/skills/genesis-program/SKILL.md +66 -0
  20. package/skills/genesis-program/agents/openai.yaml +4 -0
  21. package/skills/genesis-project/SKILL.md +53 -0
  22. package/skills/genesis-project/agents/openai.yaml +4 -0
  23. package/src/cli.js +276 -0
  24. package/src/index/agent-skills.js +425 -0
  25. package/src/index/assets.js +18 -0
  26. package/src/index/blueprint.js +38 -0
  27. package/src/index/check.js +102 -0
  28. package/src/index/code-index.js +283 -0
  29. package/src/index/code-indexers/ast-grep.js +414 -0
  30. package/src/index/codex-hooks.js +367 -0
  31. package/src/index/codex-plugin.js +73 -0
  32. package/src/index/context.js +137 -0
  33. package/src/index/errors.js +26 -0
  34. package/src/index/git.js +26 -0
  35. package/src/index/init.js +48 -0
  36. package/src/index/launch.js +34 -0
  37. package/src/index/paths.js +10 -0
  38. package/src/index/process.js +78 -0
  39. package/src/index/program.js +181 -0
  40. package/src/index/project-files.js +24 -0
  41. package/src/index/project-state.js +87 -0
  42. package/src/index/prompt.js +239 -0
  43. package/src/index/stack-catalog.js +72 -0
  44. package/src/index/stack-command.js +65 -0
  45. package/src/index/stack-composition.js +38 -0
  46. package/src/index/stack-launch.js +428 -0
  47. package/src/index/stack-piece.js +277 -0
  48. package/src/index/stack-preflight.js +25 -0
  49. package/src/index/stack-process.js +25 -0
  50. package/src/index/stack-workspace-setup.js +117 -0
  51. package/src/index/stack.js +272 -0
  52. package/src/index/utils.js +85 -0
  53. package/src/index/verification.js +77 -0
  54. package/src/index/workspace-setup.js +30 -0
  55. package/src/index.js +97 -0
  56. package/stacks/pieces/cpp.md +22 -0
  57. package/stacks/pieces/csharp.md +22 -0
  58. package/stacks/pieces/go.md +22 -0
  59. package/stacks/pieces/java.md +22 -0
  60. package/stacks/pieces/jskit-mysql.md +37 -0
  61. package/stacks/pieces/jskit.md +66 -0
  62. package/stacks/pieces/kotlin.md +22 -0
  63. package/stacks/pieces/mysql.md +18 -0
  64. package/stacks/pieces/nodejs.md +25 -0
  65. package/stacks/pieces/php.md +23 -0
  66. package/stacks/pieces/python.md +23 -0
  67. package/stacks/pieces/ruby.md +22 -0
  68. package/stacks/pieces/rust.md +22 -0
  69. package/stacks/pieces/shell.md +23 -0
  70. package/stacks/pieces/vue.md +19 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "genesis",
3
+ "interface": {
4
+ "displayName": "Genesis"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "genesis",
9
+ "source": {
10
+ "source": "local",
11
+ "path": "./plugins/genesis"
12
+ },
13
+ "policy": {
14
+ "installation": "AVAILABLE",
15
+ "authentication": "ON_INSTALL"
16
+ },
17
+ "category": "Productivity"
18
+ }
19
+ ]
20
+ }
package/README.md ADDED
@@ -0,0 +1,423 @@
1
+ # Genesis
2
+
3
+ Genesis is an agent-independent prompt, code-index, and verification companion
4
+ for local codebases. It combines product intent, concise codebase explanation,
5
+ selected technology guidance, an existing-function inventory, and an optional
6
+ user request into a complete prompt for the coding agent you already use.
7
+
8
+ Genesis outputs text. The agent or host you already use owns execution and
9
+ interaction.
10
+
11
+ ## Project files
12
+
13
+ ```text
14
+ genesis/
15
+ blueprint.md non-technical product intent
16
+ stack.md selected technology guidance, checks, setup, and launch data
17
+ stack/ optional per-component Description, Guidance, and Deslop customization
18
+ program/ concise explanations grouped into conceptual subsystems
19
+ .agents/skills/
20
+ genesis-* Genesis workflow skills
21
+ <technology>/ authoritative skills installed by selected Stack pieces
22
+ .codex/hooks.json optional project-local Codex lifecycle integration
23
+ .genesis/
24
+ machine-city.json derived detailed source and function map
25
+ program-city.json derived simple subsystem and operation map
26
+ ```
27
+
28
+ Program paths describe public operations rather than languages or source
29
+ layout:
30
+
31
+ ```text
32
+ genesis/program/notes/list-notes.md
33
+ genesis/program/notes/create-note.md
34
+ ```
35
+
36
+ The directory is a conceptual subsystem. Each file describes one public
37
+ operation provided by that subsystem: an exported method, API action, route,
38
+ command, UI operation, or equivalent entry point. Each module cites one or more
39
+ real files under `## Sources`. There is no 1:1 source mapping: one operation may
40
+ span several files, helper files may be omitted, and one source may support
41
+ multiple operations.
42
+
43
+ An optional `## Implementation map` records only the internal helpers and seams
44
+ that materially help a future agent change or debug that operation. It is
45
+ informational, not part of the public contract, and `check` does not pretend to
46
+ prove it current. Program omits incidental framework glue, generated files,
47
+ tests, fixtures, and migrations. It is useful documentation, not proof that it
48
+ completely or correctly explains the implementation.
49
+
50
+ ## Start
51
+
52
+ Genesis requires Node.js 22 or newer and Git.
53
+
54
+ For an existing codebase, `adopt` is the direct entry point:
55
+
56
+ ```bash
57
+ cd my-existing-project
58
+ git init # if needed
59
+ genesis adopt "Optional product guidance"
60
+ ```
61
+
62
+ It preserves the implementation, initializes the Genesis files and local
63
+ hooks, and prints the `describe` prompt that creates the first useful Blueprint
64
+ and Program. Give that prompt to the agent already working in the repository.
65
+ For a large codebase, the prompt explicitly lets that agent decide whether to
66
+ delegate inspection to subagents and requires it to synthesize one coherent
67
+ result. “Adopt” is intentional: Genesis neither imports nor moves the project.
68
+
69
+ For a new or empty project, initialize first and write the product intent:
70
+
71
+ ```bash
72
+ cd my-project
73
+ git init # if needed
74
+ genesis init
75
+ vi genesis/blueprint.md
76
+ codex
77
+ ```
78
+
79
+ Codex users may also install Genesis's optional discovery plugin once:
80
+
81
+ ```bash
82
+ genesis codex install
83
+ ```
84
+
85
+ When Codex opens a nonempty Git project without `genesis/blueprint.md`, the
86
+ plugin's `SessionStart` hook runs before the first user prompt and adds a strong
87
+ instruction to recommend `genesis adopt`. Codex cannot display an ordinary
88
+ assistant reply until the user speaks, so the recommendation appears in its
89
+ first reply. It never runs adoption without approval and does nothing in an
90
+ empty or already-adopted project.
91
+
92
+ `genesis init` creates an empty Blueprint, an empty optional Stack, three
93
+ project Agent Skills, and project-local Codex hooks. The skills are ordinary
94
+ [Agent Skills](https://agentskills.io): `genesis-project`, `genesis-program`,
95
+ and `genesis-deslop`, each with standard `SKILL.md` and `agents/openai.yaml`
96
+ metadata. Open `/hooks` once in Codex to review and trust the hooks. After
97
+ that, use Codex normally. No technology is assumed until you explicitly select
98
+ Stack components:
99
+
100
+ ```bash
101
+ genesis stack add nodejs # or jskit jskit-mysql
102
+ ```
103
+
104
+ Genesis does not install substitute generic `nodejs`, `vue`, `php`, or similar
105
+ skills. Official, user, or host skills retain their normal names. A Stack piece
106
+ may instead name one authoritative technology skill; Genesis copies that
107
+ complete directory into `.agents/skills/`, including its `references/`,
108
+ `scripts/`, `assets/`, and agent metadata. The agent loads those resources only
109
+ when the skill requires them. For example, the JSKIT piece installs the JSKIT
110
+ package's own `jskit` skill. A piece's optional `## Guidance` is concise
111
+ supplemental project-work guidance; it does not create or replace a generic
112
+ technology skill.
113
+
114
+ `.agents/skills/.genesis-managed.json` records only copies Genesis owns.
115
+ Genesis never overwrites an unmanaged skill and preserves locally modified
116
+ managed skills. Run `genesis init` after manually editing `genesis/stack.md`,
117
+ or use `genesis stack add`, to synchronize selected skills.
118
+
119
+ Hosts that create dependency-empty workspaces can call the public
120
+ `inspectWorkspaceSetup()` API. A concrete Stack piece may declare one exact,
121
+ ordered `## Workspace setup` recipe with labels, argument arrays expressed as
122
+ backticked tokens, abstract runtimes, and optional project-relative working
123
+ directories. The built-in `jskit` piece declares `npm install`; generic
124
+ `nodejs` and `php` deliberately declare no installer. One project section in
125
+ `genesis/stack.md` replaces all component defaults, including with
126
+ `- Nothing.`. Without that override, exactly one component recipe is used;
127
+ multiple component recipes are reported as ambiguous and never merged.
128
+ Genesis does not run the recipe. Stack resources such as database variables do
129
+ not gate dependency installation.
130
+
131
+ Hosts that provide previews can call the public `inspectLaunch()` API. An
132
+ optional readable `## Launch` section in `genesis/stack.md` declares labeled
133
+ targets, exact backticked argument tokens, relative working directories,
134
+ abstract runtime requirements, `{host}`/`{port}` substitutions, and an optional
135
+ application-owned Preview identity block. Concrete components may provide a
136
+ default: `jskit` declares build followed by `npm start`; generic `nodejs` and
137
+ `php` do not guess. Genesis starts nothing itself. It returns preview identity
138
+ command metadata and environment variable names, never their values. The host
139
+ continues to own pinned runtimes, ports, processes, readiness, identity-command
140
+ execution and secrets, browser binaries, Git, and credentials. See
141
+ [`docs/stack-components.md`](docs/stack-components.md) for the v1 contract.
142
+
143
+ At session start, Codex receives only a short explanation of how Genesis is
144
+ organized. After it locates the source involved in a request, it can load the
145
+ specific explanatory and technology context with:
146
+
147
+ ```bash
148
+ genesis context src/path/to/file
149
+ ```
150
+
151
+ Before introducing another helper or public operation, query the current
152
+ function inventory:
153
+
154
+ ```bash
155
+ genesis index normalizeNote
156
+ genesis index src/notes
157
+ ```
158
+
159
+ `genesis index` regenerates two deterministic projections. Machine City is the
160
+ detailed physical view: indexed files, line and byte weights, public and
161
+ internal functions or methods, signatures, source/test role, language, and
162
+ extractor provenance. Program City is intentionally smaller: conceptual
163
+ subsystems, Program operations, informational helper maps, and links to their
164
+ implementing source files.
165
+ Both are derived JSON, not receipts, authority, or correctness claims. An
166
+ extractor warning does not stop ordinary work.
167
+
168
+ The selected Stack decides which structural extractors run. Genesis uses the
169
+ Tree-sitter-backed [ast-grep JavaScript API](https://ast-grep.github.io/guide/api-usage/js-api.html)
170
+ through one shared engine. Built-in adapters cover JavaScript/TypeScript,
171
+ Python, Java, C#, C/C++, PHP, Go, Rust, Ruby, Kotlin, and Shell. A future technology
172
+ adds its adapter through its Stack piece rather than teaching Genesis prompts
173
+ to parse that language.
174
+
175
+ At the end of a turn that changed Git-visible project files, the Stop hook asks
176
+ Codex for two separate, bounded follow-up turns. The first reconciles the
177
+ Blueprint and affected Program explanations from the changed paths and actual
178
+ Git diff, then Genesis deterministically refreshes both City projections. The
179
+ second performs the focused, behavior-preserving Deslop pass, after which both
180
+ Cities are refreshed again to reflect any cleanup. A project with no selected
181
+ Stack uses only the `genesis-deslop` skill. Selected Stack components enrich
182
+ reconciliation and cleanup with their general Guidance, and enrich cleanup
183
+ further with technology-specific Deslop guidance.
184
+
185
+ The hook never starts another Codex process. Its small per-session phase is
186
+ limited to `implementation -> reconcile -> deslop -> done`, so it cannot keep
187
+ continuing recursively. Question-only and unchanged turns finish normally.
188
+
189
+ Projects can customize a selected technology through its matching file, such
190
+ as `genesis/stack/jskit.md`:
191
+
192
+ ```markdown
193
+ # Stack customization: jskit
194
+
195
+ ## Add
196
+
197
+ ### Description
198
+
199
+ Additional project-specific context about how JSKIT is used here.
200
+
201
+ ### Guidance
202
+
203
+ - Additional project-specific implementation and review guidance.
204
+
205
+ ### Deslop
206
+
207
+ - Additional project-specific cleanup guidance.
208
+
209
+ ## Override
210
+
211
+ ### Description
212
+
213
+ A replacement for the installed JSKIT description.
214
+
215
+ ### Guidance
216
+
217
+ - Replacement installed implementation and review guidance.
218
+
219
+ ### Deslop
220
+
221
+ - Replacement installed cleanup guidance.
222
+ ```
223
+
224
+ Every field is optional. For each field, Genesis uses the installed value,
225
+ replaces it when `Override` supplies that field, then appends the corresponding
226
+ `Add` content. Customization affects only `Description`, `Guidance`, and
227
+ `Deslop`; component dependencies, Agent Skill source, resources, and
228
+ verification commands retain their installed contracts. `genesis stack add`
229
+ preserves these matching customization files.
230
+
231
+ Prompt generation remains available for other agents and explicit tasks:
232
+
233
+ ```bash
234
+ genesis prompt
235
+ ```
236
+
237
+ Give the printed prompt to Vibe64 or another coding agent with access to the
238
+ project. Review ordinary edits through Git.
239
+
240
+ An immediate improvement request can be included directly:
241
+
242
+ ```bash
243
+ genesis prompt "Add filtering by note title"
244
+ ```
245
+
246
+ ## Prompt tasks
247
+
248
+ ```bash
249
+ genesis prompt # implementation work
250
+ genesis prompt "Add filtering by note title"
251
+ genesis prompt --task deslop # explicit cleanup
252
+ genesis prompt --task deslop "Only review billing"
253
+ genesis prompt --task program # refresh explanation
254
+ genesis prompt --task blueprint "Start on notes" # update product intent
255
+ genesis prompt --task describe # create/refresh Blueprint and complete Program
256
+ genesis prompt --task review # compare intent, code, and explanation
257
+ ```
258
+
259
+ The six task types are deliberately explicit:
260
+
261
+ - `work` implements the Blueprint and optional request using current code,
262
+ Program, selected Stack context, and progressively loaded Agent Skills.
263
+ - `deslop` requests cleanup explicitly. Codex projects also receive a bounded
264
+ automatic Deslop turn after their separate explanatory reconciliation turn.
265
+ - `program` edits only `genesis/program/` to explain the code that exists, with
266
+ selected Stack guidance available for technology-specific correctness.
267
+ - `blueprint` edits only `genesis/blueprint.md` from explicit user intent. It
268
+ must not infer product requirements from accidental implementation behavior.
269
+ - `describe` creates or refreshes both the non-technical Blueprint and the
270
+ complete useful Program from the current codebase, optional user guidance,
271
+ and selected Stack guidance where it affects accurate explanation.
272
+ - `review` is read-only. It asks the agent to compare Blueprint, code, Program,
273
+ and tests, identify contradictions and gaps, and distinguish evidence from
274
+ inference.
275
+
276
+ Prompt generation is read-only. Missing external resources are reported in
277
+ the prompt but do not prevent its generation. Genesis never invents values.
278
+
279
+ Use `--json` to receive the prompt and its machine-readable context as one
280
+ object.
281
+
282
+ ## Stack
283
+
284
+ List and select the built-in Stack components:
285
+
286
+ ```bash
287
+ genesis stack list
288
+ genesis stack add jskit jskit-mysql
289
+ ```
290
+
291
+ `genesis/stack.md` records component ids and optional project verification
292
+ commands. Selecting no components is valid. Built-in components include the
293
+ eleven common language families listed above, plus Vue, MySQL, JSKIT, and JSKIT
294
+ with MySQL. Components may contribute:
295
+
296
+ - a concise description and supplemental Guidance used across relevant tasks;
297
+ - one authoritative Agent Skill directory when the component owns one;
298
+ - generic external-resource requirements;
299
+ - cleanup advice used by explicit and automatic Deslop prompts;
300
+ - structural code indexers used by Machine City and function lookup;
301
+ - default verification commands.
302
+
303
+ Technology-specific supplemental rules intentionally remain in Stack pieces.
304
+ General `Guidance` enriches implementation, review, Program, description, and
305
+ cleanup tasks; `Deslop` adds cleanup-only rules. Neither shadows an official
306
+ generic technology skill nor assumes that an upstream skill contains every rule
307
+ Genesis needs.
308
+
309
+ Genesis core contains no MySQL, JSKIT, Vue, Laravel, or other platform-specific
310
+ controller behavior. See [Stack components](docs/stack-components.md).
311
+
312
+ ## Verification
313
+
314
+ Run the Stack's declared checks explicitly:
315
+
316
+ ```bash
317
+ genesis verify
318
+ ```
319
+
320
+ Genesis first evaluates generic Stack resource declarations, then runs each
321
+ declared command without a shell. A complete successful run writes only
322
+ `.genesis/verification.json`, recording:
323
+
324
+ - the exact Git-visible code hash;
325
+ - the selected Stack hash;
326
+ - the commands that passed.
327
+
328
+ The evidence becomes stale when code, selected components, declared resources,
329
+ or verification commands change. Description, Guidance, Agent Skill, and Deslop
330
+ prose do not rewrite what an already-run command proved. A failed verification
331
+ removes prior passing evidence before running. Verification does not claim
332
+ whole-product correctness.
333
+
334
+ A project can replace component defaults in `genesis/stack.md`:
335
+
336
+ ```markdown
337
+ ## Commands
338
+
339
+ - Verify `tests`: `npm` `test`
340
+ - Verify `build`: `npm` `run` `build`
341
+ ```
342
+
343
+ ## Inspection
344
+
345
+ ```bash
346
+ genesis check
347
+ ```
348
+
349
+ `check` is read-only. It reports only structural or recorded facts:
350
+
351
+ - Blueprint and Stack validity;
352
+ - selected Agent Skill presence and structural validity;
353
+ - Program presence and structural validity;
354
+ - missing Stack-declared environment inputs (without claiming the service is
355
+ reachable);
356
+ - verification evidence as `current`, `stale`, `missing`, `invalid`, or
357
+ `unconfigured`.
358
+
359
+ Here, “valid” means parseable and internally consistent: referenced source
360
+ files exist, declared environment inputs are non-placeholder, and recorded
361
+ hashes match. It does not mean that the product behavior makes sense. Generate
362
+ `genesis prompt --task review` for that semantic, evidence-based comparison.
363
+
364
+ Genesis does not label Program semantically current. Program is ordinary
365
+ Markdown reviewed through Git.
366
+
367
+ ## Public API
368
+
369
+ ```js
370
+ import {
371
+ adoptProject,
372
+ addStack,
373
+ check,
374
+ generatePrompt,
375
+ getContext,
376
+ indexCodebase,
377
+ initialize,
378
+ inspectLaunch,
379
+ inspectWorkspaceSetup,
380
+ installCodex,
381
+ listStackPieces,
382
+ verify,
383
+ } from 'genesis-compiler';
384
+ ```
385
+
386
+ `initialize()` installs the project files, Genesis workflow skills, selected
387
+ Stack skills, and local Codex hooks.
388
+ `adoptProject()` also returns the initial `describe` prompt for an existing
389
+ codebase. `installCodex()` installs the optional global discovery plugin.
390
+ `getContext()` resolves source paths to the Program modules that cite them,
391
+ the functions already declared there, selected Stack guidance, available Agent
392
+ Skills, and verification commands. `indexCodebase()` regenerates or returns the
393
+ detailed Machine City and simple Program City projections.
394
+ `inspectWorkspaceSetup()` returns one normalized, shell-free workspace
395
+ preparation recipe—or an explicit unconfigured or ambiguous result—for a host
396
+ to execute with its own pinned runtimes, caches, process isolation, and
397
+ credentials.
398
+ `inspectLaunch()` returns a validated, normalized Stack launch declaration for
399
+ a host to execute with its own runtime, port, process, readiness, preview
400
+ identity, secret, and browser policy.
401
+
402
+ A host such as Vibe64 can send the generated prompt to its existing agent:
403
+
404
+ ```js
405
+ const work = await generatePrompt({
406
+ projectRoot,
407
+ task: 'work',
408
+ request: userMessage,
409
+ });
410
+
411
+ await currentAgent.send(work.prompt);
412
+ ```
413
+
414
+ The host retains model choice, conversation context, reasoning presentation,
415
+ steering, interruption, permissions, and lifecycle ownership.
416
+
417
+ ## Promise
418
+
419
+ Genesis generates transparent context-rich prompts, performs deterministic
420
+ project operations, and records exact verification evidence. Code, tests, Git
421
+ review, and the user's chosen agent remain responsible for implementation. It
422
+ does not claim universal semantic convergence, exhaustive coverage, or
423
+ whole-product correctness.
package/bin/genesis.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+
3
+ import process from "node:process";
4
+
5
+ import { runCli } from "../src/cli.js";
6
+
7
+ let stdoutClosed = false;
8
+ process.stdout.on("error", (error) => {
9
+ if (error?.code !== "EPIPE") throw error;
10
+ stdoutClosed = true;
11
+ process.exitCode = 0;
12
+ });
13
+
14
+ const status = await runCli(process.argv.slice(2));
15
+ process.exitCode = stdoutClosed ? 0 : status;
@@ -0,0 +1,26 @@
1
+ # Assurance model
2
+
3
+ Genesis reports only facts it can establish mechanically:
4
+
5
+ 1. Blueprint, Stack, and Program files satisfy their small structural formats.
6
+ 2. Program operations live in conceptual subsystem directories and cite real
7
+ source files. Optional helper maps are not mechanically certified.
8
+ 3. Stack-declared environment inputs are present and non-placeholder. This does
9
+ not prove that an external service is reachable; a verification command must
10
+ establish that when it matters.
11
+ 4. Named verification commands exited successfully against one exact code and
12
+ Stack identity.
13
+ 5. Selected project Agent Skills have valid standard metadata and exist at the
14
+ expected paths. Genesis preserves unmanaged and locally customized skills
15
+ rather than claiming ownership of them.
16
+ 6. Machine City records what selected structural parsers observed, and Program
17
+ City projects the Program modules and source citations that exist. Neither
18
+ proves semantic equivalence, complete dynamic dispatch, or true duplication.
19
+
20
+ Prompt text, Stack Description/Guidance/Deslop prose, Program prose, Agent Skill
21
+ content, and agent output are not assurance evidence. Genesis does not claim
22
+ that product intent and code have converged, that Program is complete or
23
+ semantically current, or that passing checks prove the whole product correct.
24
+
25
+ Git remains the review and recovery boundary. The host running the generated
26
+ prompt owns the agent and its interaction.
@@ -0,0 +1,92 @@
1
+ # Prompt integration
2
+
3
+ Genesis does not start or manage an AI agent. A host asks Genesis for a prompt
4
+ and sends that prompt to the conversation it already owns:
5
+
6
+ ```js
7
+ import { generatePrompt } from 'genesis-compiler';
8
+
9
+ const work = await generatePrompt({
10
+ projectRoot,
11
+ task: 'work',
12
+ request: userMessage,
13
+ });
14
+
15
+ await currentAgent.send(work.prompt);
16
+ ```
17
+
18
+ Tasks are `work`, `deslop`, `program`, `blueprint`, `describe`, and `review`.
19
+ `describe` creates or refreshes the complete Blueprint and useful Program in one
20
+ agent task. The host owns the agent and its interaction. Genesis owns only
21
+ transparent prompt construction and deterministic project operations.
22
+
23
+ ## Instruction sources
24
+
25
+ Genesis keeps each instruction at one useful level:
26
+
27
+ - `skills/genesis-project/`, `skills/genesis-program/`, and
28
+ `skills/genesis-deslop/` are the reusable workflow sources copied into each
29
+ project's `.agents/skills/` directory.
30
+ - `prompts/<task>.txt` is a short task launcher. It selects the relevant
31
+ workflow skill and states only that turn's edit boundary.
32
+ - `stacks/pieces/<component>.md` supplies concise Description, supplemental
33
+ Guidance, Resources, Deslop overlays, structural Indexers, verification
34
+ Commands, and an optional authoritative Agent Skill source.
35
+ - `genesis/blueprint.md`, `genesis/program/`, and `genesis/stack.md` are the
36
+ project's own intent, explanation, and selected technical composition.
37
+ - The generated JSON block contains current structural facts and warnings.
38
+
39
+ Detailed technology manuals belong in the technology skill's `references/`
40
+ directory. Concise rules Genesis needs beyond that skill belong in Stack
41
+ `Guidance`; they are composed into relevant prompts without creating a
42
+ colliding generic skill.
43
+
44
+ ## Existing projects
45
+
46
+ `genesis adopt [product guidance...]` is the explicit starting point for a
47
+ nonempty project. It preserves source, calls the same idempotent initialization
48
+ used by `genesis init`, and prints a `describe` prompt for the current agent to
49
+ follow. The description prompt may direct a large-project agent to use
50
+ subagents at its discretion, but the primary agent must reconcile their work
51
+ into one Blueprint and one subsystem-oriented Program.
52
+
53
+ Codex users can run `genesis codex install` once to install the packaged
54
+ Genesis discovery plugin. Its `SessionStart` hook executes before the first
55
+ user prompt. In a nonempty Git repository without `genesis/blueprint.md`, it
56
+ injects an instruction that the first assistant reply strongly recommend
57
+ `genesis adopt`. It does not perform adoption automatically. If the user
58
+ accepts, Codex can run the command and follow its returned prompt in the same
59
+ conversation. Other hosts can call `adoptProject()` and send its `prompt`
60
+ directly.
61
+
62
+ Codex can instead use the project-local hooks installed by `genesis init`.
63
+ Those hooks inject a short operating guide, record whether the current turn
64
+ changed project files, then request two bounded continuations: first reconcile
65
+ Blueprint and affected Program explanations from the Git-visible changes, then
66
+ Deslop the implementation. They invoke the same Genesis project operations and
67
+ never start another agent process. A per-session phase permits only
68
+ `implementation -> reconcile -> deslop -> done`. Genesis refreshes both City
69
+ projections after reconciliation so Deslop sees the current explanation and
70
+ function inventory, then refreshes them again after Deslop in case cleanup
71
+ changed the implementation map.
72
+
73
+ Once Codex identifies relevant source, `genesis context <path...>` returns only
74
+ Program modules citing those paths plus concise selected Stack context, the
75
+ functions structurally indexed in those paths, available Agent Skill catalog,
76
+ and verification commands. `genesis index <name-or-path>` searches the complete
77
+ current function inventory and refreshes `.genesis/machine-city.json` and
78
+ `.genesis/program-city.json`. No model call or semantic subsystem guess is
79
+ involved.
80
+
81
+ `genesis init` installs the three Genesis workflow skills under
82
+ `.agents/skills/`. `genesis stack add` also installs any complete authoritative
83
+ Agent Skill directory declared by selected components. Generated prompts name
84
+ matching `SKILL.md` entrypoints rather than eagerly embedding their references.
85
+ This follows Agent Skills progressive disclosure and keeps official or
86
+ user-installed generic technology skills independent.
87
+
88
+ Matching files under `genesis/stack/<component>.md` may add to or override that
89
+ selected component's Description, Guidance, and Deslop fields. Effective
90
+ Guidance is used by work, review, Program, describe, Deslop, and path-context
91
+ generation. The Codex continuation flow also carries it into reconciliation and
92
+ cleanup; effective Deslop guidance remains cleanup-only.