genesis-compiler 1.2.27 → 1.2.29
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/README.md +338 -59
- package/docs/prompt-integration.md +50 -21
- package/docs/stack-components.md +65 -23
- package/package.json +4 -1
- package/plugins/genesis/.codex-plugin/plugin.json +1 -1
- package/prompts/adopt.txt +5 -4
- package/prompts/deslop.txt +3 -1
- package/prompts/start-existing-uninitialized.txt +8 -0
- package/prompts/start-existing.txt +23 -0
- package/prompts/start-new.txt +27 -0
- package/prompts/start.txt +3 -55
- package/prompts/work.txt +11 -3
- package/skills/genesis-deslop/SKILL.md +17 -0
- package/skills/genesis-project/SKILL.md +48 -9
- package/src/cli.js +19 -2
- package/src/index/assets.js +3 -0
- package/src/index/codex-hooks.js +8 -12
- package/src/index/context.js +20 -5
- package/src/index/migration.js +12 -3
- package/src/index/opencode-plugin.js +1 -1
- package/src/index/paths.js +1 -0
- package/src/index/project-files.js +12 -0
- package/src/index/project-format.js +1 -1
- package/src/index/prompt.js +46 -24
- package/src/index/session-context.js +18 -0
- package/src/index/stack-catalog.js +11 -0
- package/src/index/stack-project-contracts.js +205 -0
- package/src/index/stack-section.js +2 -2
- package/src/index/stack.js +93 -59
package/docs/stack-components.md
CHANGED
|
@@ -46,7 +46,26 @@ Concise technology context.
|
|
|
46
46
|
|
|
47
47
|
## Resources
|
|
48
48
|
|
|
49
|
-
-
|
|
49
|
+
```json genesis-resource
|
|
50
|
+
{
|
|
51
|
+
"id": "database",
|
|
52
|
+
"kind": "postgresql",
|
|
53
|
+
"environmentAlternatives": [
|
|
54
|
+
{
|
|
55
|
+
"bindings": {
|
|
56
|
+
"database": "DB_NAME",
|
|
57
|
+
"host": "DB_HOST",
|
|
58
|
+
"password": "DB_PASSWORD",
|
|
59
|
+
"port": "DB_PORT",
|
|
60
|
+
"username": "DB_USER"
|
|
61
|
+
},
|
|
62
|
+
"allowEmpty": ["password"],
|
|
63
|
+
"preferred": true
|
|
64
|
+
},
|
|
65
|
+
{ "bindings": { "url": "DATABASE_URL" } }
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
50
69
|
|
|
51
70
|
## Environment defaults
|
|
52
71
|
|
|
@@ -92,24 +111,27 @@ complete authoritative Agent Skill directory. `Indexers` selects installed
|
|
|
92
111
|
structural adapters.
|
|
93
112
|
`Resources`, `Environment defaults`, `Environment files`, and `Verification`
|
|
94
113
|
use the small Genesis grammars documented below. Every other `##` section is an
|
|
95
|
-
opaque extension.
|
|
114
|
+
opaque extension. These component sections are initial proposals. They do not
|
|
115
|
+
remain a hidden runtime layer beneath the project.
|
|
96
116
|
|
|
97
117
|
## Genesis-owned declarations
|
|
98
118
|
|
|
99
119
|
Resources describe required external inputs as alternatives of environment
|
|
100
120
|
variable names. Genesis can report which names are absent, but never reads a
|
|
101
|
-
service, provisions infrastructure, or returns a supplied value.
|
|
102
|
-
|
|
121
|
+
service, provisions infrastructure, or returns a supplied value. Selection
|
|
122
|
+
materializes the composed proposal into the project's `## Resources` section.
|
|
103
123
|
|
|
104
|
-
Environment defaults are public, non-secret constants. Component
|
|
124
|
+
Environment defaults are public, non-secret constants. Component proposals
|
|
105
125
|
compose by variable name; identical values collapse and conflicting values
|
|
106
|
-
fail.
|
|
107
|
-
Explicit process values always win.
|
|
126
|
+
fail. Selection writes the result into the project's `## Environment defaults`
|
|
127
|
+
section. Explicit process values always win. Conventional host, port, driver,
|
|
128
|
+
database, or username values may be proposed; passwords, tokens, and other
|
|
129
|
+
secrets must not be invented.
|
|
108
130
|
|
|
109
131
|
Environment files describe safe project-relative dotenv projection paths.
|
|
110
132
|
Genesis returns only the format and path. It does not materialize the file,
|
|
111
|
-
choose which values belong there, or store secrets.
|
|
112
|
-
|
|
133
|
+
choose which values belong there, or store secrets. Component paths compose
|
|
134
|
+
during selection and are then written as the project declaration.
|
|
113
135
|
|
|
114
136
|
Verification contains exact argv tokens:
|
|
115
137
|
|
|
@@ -122,8 +144,9 @@ Verification contains exact argv tokens:
|
|
|
122
144
|
|
|
123
145
|
Genesis is the consumer of this section. `genesis verify` runs the declared
|
|
124
146
|
commands directly without a shell after generic resource preflight and records
|
|
125
|
-
the exact successful code, Stack, and command hashes.
|
|
126
|
-
section
|
|
147
|
+
the exact successful code, Stack, and command hashes. Selection writes proposed
|
|
148
|
+
commands into the project Verification section; only that project section is
|
|
149
|
+
executed afterward.
|
|
127
150
|
|
|
128
151
|
## Opaque extensions
|
|
129
152
|
|
|
@@ -131,12 +154,16 @@ Any other `##` heading is consumer-owned data. Genesis validates only the
|
|
|
131
154
|
section name and composition. It does not parse the body, infer its purpose,
|
|
132
155
|
validate a private schema, map runtimes, execute commands, or prove success.
|
|
133
156
|
|
|
134
|
-
|
|
157
|
+
Proposal composition is intentionally small:
|
|
158
|
+
|
|
159
|
+
1. An existing project section remains authoritative and is never overwritten.
|
|
160
|
+
2. Without a project section, one component proposal is copied unchanged.
|
|
161
|
+
3. Competing component proposals produce `STACK_SECTION_AMBIGUOUS`; Genesis
|
|
162
|
+
never merges their bodies or guesses a winner.
|
|
135
163
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
never merges their bodies.
|
|
164
|
+
After selection every effective opaque section is project-owned. The component
|
|
165
|
+
catalog may improve later without silently changing the application's setup,
|
|
166
|
+
launch, deployment, packaging, signing, migration, or any other operation.
|
|
140
167
|
|
|
141
168
|
Call `inspectStackSection({ name, projectRoot })` or:
|
|
142
169
|
|
|
@@ -152,12 +179,18 @@ firmware, desktop software, and future systems Genesis has never seen.
|
|
|
152
179
|
|
|
153
180
|
## Selection and identity
|
|
154
181
|
|
|
155
|
-
`genesis stack add` records selected packages and component dependency closure
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
182
|
+
`genesis stack add` records selected packages and component dependency closure,
|
|
183
|
+
materializes every missing operation proposal, and preserves existing project
|
|
184
|
+
declarations. It then returns one preparation prompt containing every exact
|
|
185
|
+
project contract heading and body. The current agent must make the source and
|
|
186
|
+
commands satisfy those contracts or replace a complete section with evidenced
|
|
187
|
+
reality. Repeating an already-complete selection is quiet.
|
|
188
|
+
|
|
189
|
+
Stack identity includes component ids, project-owned resources, environment
|
|
190
|
+
declarations, Verification commands, City presentation, and every opaque
|
|
191
|
+
extension body. Changing any executable or consumer-owned contract therefore
|
|
192
|
+
stales prior Genesis verification evidence even though Genesis does not
|
|
193
|
+
interpret the extension.
|
|
161
194
|
|
|
162
195
|
Prose and Agent Skill contents are instructions rather than verification
|
|
163
196
|
evidence. Changes to Description, Guidance, Adoption, Post-change, Deslop, or
|
|
@@ -212,7 +245,16 @@ const operation = await inspectStackSection({
|
|
|
212
245
|
});
|
|
213
246
|
```
|
|
214
247
|
|
|
215
|
-
`inspectEnvironment()` uses `genesis.environment.
|
|
248
|
+
`inspectEnvironment()` uses `genesis.environment.v2` and never returns supplied
|
|
216
249
|
values. `inspectStackSection()` uses `genesis.stack-section.v1` and never
|
|
217
250
|
interprets the section. There is no generic Genesis API that executes an opaque
|
|
218
251
|
operation.
|
|
252
|
+
|
|
253
|
+
## Project format migration
|
|
254
|
+
|
|
255
|
+
Project format 2 removes runtime inheritance of operation declarations from
|
|
256
|
+
the catalog. `genesis migrate` upgrades format 1 projects by composing the
|
|
257
|
+
previously effective declarations once and writing them into
|
|
258
|
+
`genesis/stack.md`. Existing project sections win exactly as they did before.
|
|
259
|
+
Current-format reads reject a selected component whose required contract was
|
|
260
|
+
not materialized, so a tool upgrade cannot quietly substitute a new proposal.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genesis-compiler",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An agent-independent prompt, multi-language code-index, cleanup, and verification companion with project agent guidance.",
|
|
6
6
|
"repository": {
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
"prompts/program.txt",
|
|
35
35
|
"prompts/review.txt",
|
|
36
36
|
"prompts/start.txt",
|
|
37
|
+
"prompts/start-existing.txt",
|
|
38
|
+
"prompts/start-existing-uninitialized.txt",
|
|
39
|
+
"prompts/start-new.txt",
|
|
37
40
|
"prompts/work.txt",
|
|
38
41
|
"plugins/genesis",
|
|
39
42
|
"plugins/opencode",
|
package/prompts/adopt.txt
CHANGED
|
@@ -26,8 +26,9 @@ Adoption requirements.
|
|
|
26
26
|
|
|
27
27
|
Read every selected technology skill named by the regenerated prompt and its
|
|
28
28
|
relevant existing-application migration reference. Apply all SELECTED STACK
|
|
29
|
-
ADOPTION GUIDANCE.
|
|
30
|
-
hypotheses until they match this source. They do not
|
|
29
|
+
ADOPTION GUIDANCE. Materialized component proposals describe current
|
|
30
|
+
foundations and remain hypotheses until they match this source. They do not
|
|
31
|
+
upgrade an older project.
|
|
31
32
|
|
|
32
33
|
Build one evidence-backed import inventory covering the selected technologies,
|
|
33
34
|
public environment/resource declarations, concrete Verification commands, and
|
|
@@ -36,8 +37,8 @@ selected technology skill and the section's declared schema for any
|
|
|
36
37
|
consumer-specific detail; do not invent a generic operational grammar.
|
|
37
38
|
|
|
38
39
|
Translate observed contracts into exact project-owned Stack sections whenever
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
a materialized proposal differs. Replace the complete section for that concern;
|
|
41
|
+
do not leave a proposal that the implementation cannot perform. Inspect retired
|
|
41
42
|
or tool-specific manifests as evidence and carry every still-valid fact into
|
|
42
43
|
Genesis; never add a permanent legacy reader or shim. Do not delete an old
|
|
43
44
|
manifest until all of its live facts have been accounted for.
|
package/prompts/deslop.txt
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
This Deslop task has already been rendered by Genesis. Do not generate another
|
|
2
|
+
Deslop prompt. Read and follow `.agents/skills/genesis-deslop/SKILL.md`
|
|
3
|
+
completely.
|
|
2
4
|
|
|
3
5
|
This is an explicitly requested behavior-preserving cleanup of committed work.
|
|
4
6
|
Resolve the commit or first-parent commit range from USER REQUEST exactly; when
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
This is an existing project without Genesis project context. Do not ask
|
|
2
|
+
new-project product-discovery questions. Ask what the person wants to understand
|
|
3
|
+
or change and strongly recommend preparing the project for guided editing before
|
|
4
|
+
substantial work. Explain in product language that preparation preserves the
|
|
5
|
+
implementation while importing its current product, setup, run, data, preview,
|
|
6
|
+
and verification facts. Do not require the person to know Genesis terminology or
|
|
7
|
+
type a command. If they approve, run the Genesis `adopt` operation and follow its
|
|
8
|
+
prompt. If they decline, continue normally and do not repeat the recommendation.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The project already exists. Do not ask new-project product-discovery questions
|
|
2
|
+
and do not offer an unselected technology catalog. Use the Blueprint as product
|
|
3
|
+
intent, the selected Stack summary and full guidance as technical direction, and
|
|
4
|
+
the compact Program status only as orientation. If USER REQUEST is actionable,
|
|
5
|
+
proceed with it. Otherwise ask what the person wants to understand or change.
|
|
6
|
+
|
|
7
|
+
After locating the relevant source, run the Genesis `context <relevant-path...>`
|
|
8
|
+
operation before implementation to load the exact Program modules, project
|
|
9
|
+
contracts, indexed functions, verification commands, and applicable skills.
|
|
10
|
+
|
|
11
|
+
If the user requests an unselected technology, run the Genesis `stack list`
|
|
12
|
+
operation first. For one exact match, ask whether to add it and prepare the
|
|
13
|
+
project with its official guidance; only after confirmation run `stack add
|
|
14
|
+
<piece...>` and follow its preparation prompt. If nothing matches, use the
|
|
15
|
+
technology's authoritative documentation without inventing a component.
|
|
16
|
+
|
|
17
|
+
When no Stack is selected, inspect the project's actual scripts, build and setup
|
|
18
|
+
files, server entrypoint, and readiness behavior before recording a technology.
|
|
19
|
+
Component proposals are not evidence, and selecting a component does not port an
|
|
20
|
+
older implementation. Preserve evidenced project-owned contracts in their
|
|
21
|
+
consumer's current schema. If the existing implementation is not usefully
|
|
22
|
+
explained, recommend the Genesis description path instead of pretending its
|
|
23
|
+
intent or operations are known.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
The project is new. Before technology research or source creation, establish
|
|
2
|
+
what is being built, who or what will use or invoke it, and the first observable
|
|
3
|
+
useful outcome. Ask at most three concise questions at a time, and do not repeat
|
|
4
|
+
facts already supplied by the user. A Stack choice is not product intent.
|
|
5
|
+
|
|
6
|
+
Use `availableStackPieces` to offer only relevant technology choices in product
|
|
7
|
+
language. Never silently select one. If the user names an unselected technology,
|
|
8
|
+
run the Genesis `stack list` operation first. For one exact match, ask whether to
|
|
9
|
+
add it and prepare the project with its official guidance. On confirmation, run
|
|
10
|
+
the Genesis `stack add <piece...>` operation, follow its preparation prompt in
|
|
11
|
+
this task, then run `context .` or `context <relevant-path>` and load any
|
|
12
|
+
applicable installed skill. Never infer an install command from a component id.
|
|
13
|
+
If the user declines, do not ask again; if nothing matches, use the technology's
|
|
14
|
+
authoritative documentation without inventing a component.
|
|
15
|
+
|
|
16
|
+
Establish the non-technical Blueprint before implementation. If product intent
|
|
17
|
+
is clear while Stack is empty, present the relevant Stack choices in this same
|
|
18
|
+
turn. The default `focused.v1` engineering profile suits ordinary work; use
|
|
19
|
+
`availableEngineeringProfiles` only when the user requests another approach or
|
|
20
|
+
the product has material long-lived compatibility, operational, security,
|
|
21
|
+
reliability, or compliance constraints. Apply an explicit choice with the
|
|
22
|
+
Genesis `engineering set <profile>` operation.
|
|
23
|
+
|
|
24
|
+
This opening owns product direction and Stack selection, not final verification.
|
|
25
|
+
Do not run the Genesis `verify` operation before implementation exists. Use
|
|
26
|
+
`check` only when structural validation is useful. Once direction and Stack are
|
|
27
|
+
clear, follow one smallest implementation path through the selected guidance.
|
package/prompts/start.txt
CHANGED
|
@@ -1,57 +1,5 @@
|
|
|
1
1
|
Read and follow `.agents/skills/genesis-project/SKILL.md` completely.
|
|
2
2
|
|
|
3
|
-
This is the project-opening conversation.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
When `projectKind` is `new`, first ask what the app is about. Ask up to three
|
|
8
|
-
concise, high-impact questions at a time. Use `availableStackPieces` to present
|
|
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 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.
|
|
14
|
-
If the product direction becomes clear while Stack is still empty, do not end
|
|
15
|
-
the turn after only writing or summarizing the Blueprint: present the relevant
|
|
16
|
-
Stack choices in that same turn and ask the user to select one explicitly.
|
|
17
|
-
The default `focused.v1` engineering profile is already suitable for ordinary
|
|
18
|
-
work, so do not force a separate profile question. When the user asks for a
|
|
19
|
-
different engineering approach, or the product clearly has long-lived
|
|
20
|
-
compatibility, operational, security, reliability, or compliance constraints,
|
|
21
|
-
use `availableEngineeringProfiles` to explain only the relevant choices in
|
|
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.
|
|
26
|
-
This opening turn owns product direction and Stack selection, not final
|
|
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.
|
|
31
|
-
|
|
32
|
-
When `projectKind` is `existing`, ask what the user wants to understand or
|
|
33
|
-
change. Use the current Blueprint, Stack, Program, and code index when present.
|
|
34
|
-
If the existing implementation is not yet explained, recommend the Genesis
|
|
35
|
-
description/adoption path instead of pretending its intent is known.
|
|
36
|
-
When an existing implementation has no selected Stack yet, inspect its actual
|
|
37
|
-
package scripts, build files, setup commands, server entrypoint, and readiness
|
|
38
|
-
route before recording the user's technology choice. Consumer-owned sections
|
|
39
|
-
declared by a component describe that component's current operational
|
|
40
|
-
foundation; selecting the component does not port an older implementation to
|
|
41
|
-
it. If the existing facts differ, add exact project-owned replacements using
|
|
42
|
-
the consumer's current schema and the code that exists. Never report an
|
|
43
|
-
inherited operation as usable merely because the component was selected, and
|
|
44
|
-
never add compatibility implementation without the user asking for a port.
|
|
45
|
-
|
|
46
|
-
When `projectKind` is `existing-uninitialized`, ask what the user wants to
|
|
47
|
-
understand or change and strongly recommend preparing the existing project for
|
|
48
|
-
guided editing before substantial work. Explain in product language that this
|
|
49
|
-
preserves the implementation while importing its current setup, run, database,
|
|
50
|
-
preview, verification, and product context. Do not require the user to know
|
|
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.
|
|
54
|
-
|
|
55
|
-
If the request already contains an unambiguous product description and an
|
|
56
|
-
explicit Stack choice, you may apply that choice and establish the Blueprint.
|
|
57
|
-
Otherwise this is a conversational turn: ask, listen, and preserve the source.
|
|
3
|
+
This is the project-opening conversation. Follow only the project-kind
|
|
4
|
+
instructions below. Treat USER REQUEST as the person's actual request, preserve
|
|
5
|
+
what it already establishes, and ask only unresolved high-impact questions.
|
package/prompts/work.txt
CHANGED
|
@@ -3,7 +3,12 @@ implement the request in the ordinary local Git tree.
|
|
|
3
3
|
|
|
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
|
+
turn technology choices into another product questionnaire. Choose one smallest
|
|
7
|
+
implementation path through selected guidance, or authoritative technology
|
|
8
|
+
documentation when the catalog has no match, and read only what that path
|
|
9
|
+
requires. Do not survey alternative foundations, clone whole technology
|
|
10
|
+
repositories, inspect unrelated package internals, or delegate research unless
|
|
11
|
+
one concrete failure requires one exact investigation.
|
|
7
12
|
Before adding a helper or public operation, query the Genesis
|
|
8
13
|
`index <name-or-path>` operation and reuse an existing function when it already
|
|
9
14
|
owns the behavior.
|
|
@@ -20,8 +25,11 @@ a genuinely missing resource instead of constructing a parallel fallback.
|
|
|
20
25
|
|
|
21
26
|
Apply any supplied Stack Post-change guidance before reporting completion. It
|
|
22
27
|
belongs to this implementation turn and does not request a follow-up agent turn.
|
|
23
|
-
Run focused checks when useful.
|
|
24
|
-
and
|
|
28
|
+
Run focused checks when useful. Before reporting completion, compare the
|
|
29
|
+
requested observable behavior, required inputs and resources, declared project
|
|
30
|
+
operations, and focused evidence with what actually exists. Summarize
|
|
31
|
+
files changed, checks actually run, anything not proven, and anything still
|
|
32
|
+
requiring attention.
|
|
25
33
|
|
|
26
34
|
If no Stack components are selected, continue the project-opening
|
|
27
35
|
conversation instead of guessing a technology. Use the Genesis `stack list`
|
|
@@ -15,6 +15,23 @@ package. Otherwise use `genesis <arguments>` only when that executable is
|
|
|
15
15
|
already available on `PATH`. Never install or update Genesis merely to satisfy
|
|
16
16
|
a workflow instruction.
|
|
17
17
|
|
|
18
|
+
## Load the effective project instructions once
|
|
19
|
+
|
|
20
|
+
A Deslop request may arrive either as a complete Genesis-generated prompt or
|
|
21
|
+
as a direct request such as `Deslop` in an agent session.
|
|
22
|
+
|
|
23
|
+
If the current task already contains `GENESIS CONTEXT` whose task is `deslop`,
|
|
24
|
+
continue with it directly. Do not generate another prompt.
|
|
25
|
+
|
|
26
|
+
Otherwise, before resolving Git scope, run the Genesis
|
|
27
|
+
`prompt --task deslop` operation once using the invocation rule above. For a
|
|
28
|
+
bare `Deslop` request, pass no request argument. When the user names a count,
|
|
29
|
+
commit, or range, pass that exact request as one safely quoted argument. Treat
|
|
30
|
+
the printed prompt as the instructions for this same turn; do not dispatch it
|
|
31
|
+
to another agent and do not generate it again. This step composes the selected
|
|
32
|
+
Stack's technology-specific Deslop guidance and any project customization with
|
|
33
|
+
the portable contract below.
|
|
34
|
+
|
|
18
35
|
## Resolve the committed scope
|
|
19
36
|
|
|
20
37
|
Before reading or editing the selected change, require a clean worktree and
|
|
@@ -8,6 +8,21 @@ 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
|
+
## Establish new-product direction
|
|
12
|
+
|
|
13
|
+
For a new project whose Blueprint does not yet establish product direction,
|
|
14
|
+
do not research technology or create source until the user has made clear what
|
|
15
|
+
is being built, who or what will use or invoke it, and the first observable
|
|
16
|
+
useful outcome. Ask only unresolved high-impact questions. A reply confirms only
|
|
17
|
+
what it explicitly answers; Stack confirmation is not product intent.
|
|
18
|
+
|
|
19
|
+
Once product direction is clear, choose one smallest implementation path
|
|
20
|
+
through selected technology guidance, or authoritative technology documentation
|
|
21
|
+
when the catalog has no match, and read only what that path requires. Do not
|
|
22
|
+
survey alternatives, clone whole technology repositories, inspect unrelated
|
|
23
|
+
package internals, or delegate research unless one concrete failure requires
|
|
24
|
+
one exact investigation.
|
|
25
|
+
|
|
11
26
|
## Run Genesis commands
|
|
12
27
|
|
|
13
28
|
When this repository is Genesis itself or has `genesis-compiler` installed
|
|
@@ -17,6 +32,28 @@ package. Otherwise use `genesis <arguments>` only when that executable is
|
|
|
17
32
|
already available on `PATH`. Never install or update Genesis merely to satisfy
|
|
18
33
|
a workflow instruction.
|
|
19
34
|
|
|
35
|
+
## Resolve explicit technology choices
|
|
36
|
+
|
|
37
|
+
Before external technology research or implementation, when the user explicitly
|
|
38
|
+
names a technology, framework, language, or database that is not selected:
|
|
39
|
+
|
|
40
|
+
1. Run the Genesis `stack list` operation as the first technology action.
|
|
41
|
+
2. If one catalog component exactly matches the choice, ask: "<Technology> is
|
|
42
|
+
available in Genesis. Would you like me to add it to this project and prepare
|
|
43
|
+
the app with its official guidance?" Do not run `stack add <piece...>`
|
|
44
|
+
without that confirmation.
|
|
45
|
+
3. If confirmed, add the component, let Genesis apply its declared dependency
|
|
46
|
+
closure and synchronize any authoritative Agent Skill declared by that
|
|
47
|
+
component. Follow the preparation prompt returned by `stack add` in the same
|
|
48
|
+
task: make each materialized project contract true or replace a complete
|
|
49
|
+
section with evidenced reality. Then run `context .`, or the relevant source
|
|
50
|
+
path once source exists, load the applicable installed skill if present, and
|
|
51
|
+
follow that technology-owned guidance to prepare actual project
|
|
52
|
+
dependencies. Never infer an installation command from a component id.
|
|
53
|
+
4. If declined, continue without adding the component or asking again. If no
|
|
54
|
+
catalog component matches, do not invent one; continue normally using
|
|
55
|
+
authoritative documentation owned by that technology.
|
|
56
|
+
|
|
20
57
|
## Establish context
|
|
21
58
|
|
|
22
59
|
1. Read `genesis/blueprint.md` for non-technical product intent.
|
|
@@ -34,13 +71,13 @@ a workflow instruction.
|
|
|
34
71
|
agent's own installed skill catalog.
|
|
35
72
|
|
|
36
73
|
For an existing application's first Stack selection, inspect its real setup,
|
|
37
|
-
build, and output commands before
|
|
38
|
-
component describes its current foundation; it does not silently
|
|
39
|
-
source. When the existing commands differ, keep the implementation
|
|
40
|
-
and
|
|
41
|
-
`## Workspace setup`
|
|
74
|
+
build, and output commands before accepting materialized component proposals.
|
|
75
|
+
A selected component describes its current foundation; it does not silently
|
|
76
|
+
port older source. When the existing commands differ, keep the implementation
|
|
77
|
+
unchanged and replace the complete project-owned consumer operation (for
|
|
78
|
+
Vibe64, `## Workspace setup` or `## Outputs`). Genesis treats those sections as
|
|
42
79
|
opaque text; the named consumer alone owns their meaning and execution. Do not
|
|
43
|
-
claim
|
|
80
|
+
claim a proposed recipe is usable until it matches the source.
|
|
44
81
|
|
|
45
82
|
Program is concise, fallible explanation. Its Sources and optional
|
|
46
83
|
Implementation maps aid navigation but never substitute for reading code,
|
|
@@ -90,6 +127,8 @@ Neither is authority or proof; both may be regenerated with the Genesis
|
|
|
90
127
|
After the selected technology's workspace substrate exists, use the Genesis
|
|
91
128
|
`verify` operation for the Stack's declared final checks. An unconfigured result
|
|
92
129
|
means the declared workspace or checks do not exist yet; it is not a failing
|
|
93
|
-
check.
|
|
94
|
-
|
|
95
|
-
|
|
130
|
+
check. Before reporting completion, compare the requested observable behavior,
|
|
131
|
+
required inputs and resources, declared project operations, and focused evidence
|
|
132
|
+
with what actually exists. Report files changed, checks actually run,
|
|
133
|
+
anything not proven, and anything still requiring attention. Never claim that
|
|
134
|
+
an unrun check passed or that passing checks prove the whole product.
|
package/src/cli.js
CHANGED
|
@@ -29,6 +29,8 @@ import {
|
|
|
29
29
|
projectFormatDiagnostic,
|
|
30
30
|
} from './index/project-format.js';
|
|
31
31
|
import { projectSessionContext } from './index/session-context.js';
|
|
32
|
+
import { installedFirstPartyStackPackages } from './index/stack-catalog.js';
|
|
33
|
+
import { readStack } from './index/stack.js';
|
|
32
34
|
|
|
33
35
|
const USAGE = `Usage:
|
|
34
36
|
genesis init
|
|
@@ -283,12 +285,27 @@ function writeResult(command, result) {
|
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
287
|
if (result.guidance) line(process.stdout, result.guidance);
|
|
288
|
+
if (result.prompt) {
|
|
289
|
+
line(process.stdout, '');
|
|
290
|
+
process.stdout.write(result.prompt.endsWith('\n') ? result.prompt : `${result.prompt}\n`);
|
|
291
|
+
}
|
|
286
292
|
line(process.stdout, `${command}: ${result.status}`);
|
|
287
293
|
}
|
|
288
294
|
|
|
295
|
+
async function cliStackPackages(projectRoot, supplied) {
|
|
296
|
+
if (supplied.length > 0) return supplied;
|
|
297
|
+
try {
|
|
298
|
+
const stack = await readStack(projectRoot);
|
|
299
|
+
if (stack.stackPackages.length > 0) return [];
|
|
300
|
+
} catch (error) {
|
|
301
|
+
if (error?.code !== 'STACK_REQUIRED') return [];
|
|
302
|
+
}
|
|
303
|
+
return installedFirstPartyStackPackages({ projectRoot });
|
|
304
|
+
}
|
|
305
|
+
|
|
289
306
|
async function execute({ command, operands, options }, { signal } = {}) {
|
|
290
307
|
const projectRoot = options.projectRoot || process.cwd();
|
|
291
|
-
const stackPackages = options.stackPackages || [];
|
|
308
|
+
const stackPackages = await cliStackPackages(projectRoot, options.stackPackages || []);
|
|
292
309
|
if (command === 'init') return initialize({ projectRoot, stackPackages });
|
|
293
310
|
if (command === 'migrate') return migrate({ projectRoot, stackPackages });
|
|
294
311
|
if (command === 'adopt') {
|
|
@@ -362,7 +379,7 @@ async function execute({ command, operands, options }, { signal } = {}) {
|
|
|
362
379
|
if (operands[0] === 'discover') {
|
|
363
380
|
return { kind: 'discover', ...await codexAdoptionRecommendation({ projectRoot }) };
|
|
364
381
|
}
|
|
365
|
-
return { kind: 'session', ...await projectSessionContext({ projectRoot }) };
|
|
382
|
+
return { kind: 'session', ...await projectSessionContext({ projectRoot, stackPackages }) };
|
|
366
383
|
}
|
|
367
384
|
if (command === 'verify') {
|
|
368
385
|
return verify({
|
package/src/index/assets.js
CHANGED
|
@@ -3,6 +3,9 @@ import { readFile } from 'node:fs/promises';
|
|
|
3
3
|
const root = new URL('../../', import.meta.url);
|
|
4
4
|
const assets = {
|
|
5
5
|
start: new URL('prompts/start.txt', root),
|
|
6
|
+
'start-new': new URL('prompts/start-new.txt', root),
|
|
7
|
+
'start-existing': new URL('prompts/start-existing.txt', root),
|
|
8
|
+
'start-existing-uninitialized': new URL('prompts/start-existing-uninitialized.txt', root),
|
|
6
9
|
adopt: new URL('prompts/adopt.txt', root),
|
|
7
10
|
work: new URL('prompts/work.txt', root),
|
|
8
11
|
describe: new URL('prompts/describe.txt', root),
|
package/src/index/codex-hooks.js
CHANGED
|
@@ -3,11 +3,11 @@ import path from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
import { GenesisError } from './errors.js';
|
|
5
5
|
import { gitContext } from './git.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { normalizeRelative, pathState, writeFileAtomic } from './utils.js';
|
|
6
|
+
import { classifyProjectKind } from './project-files.js';
|
|
7
|
+
import { pathState, writeFileAtomic } from './utils.js';
|
|
9
8
|
|
|
10
9
|
const HOOKS_PATH = '.codex/hooks.json';
|
|
10
|
+
const LEGACY_GENESIS_HOOKS_DESCRIPTION = 'Genesis project hooks.';
|
|
11
11
|
const PROJECT_HOOK_ACTIONS = ['session', 'begin', 'stop', 'end'];
|
|
12
12
|
|
|
13
13
|
function hookCommand(action) {
|
|
@@ -68,7 +68,7 @@ async function installedHooksSource(location) {
|
|
|
68
68
|
return { source, value };
|
|
69
69
|
} catch (error) {
|
|
70
70
|
if (['ENOENT', 'ENOTDIR'].includes(error?.code)) {
|
|
71
|
-
return { source: null, value: {
|
|
71
|
+
return { source: null, value: { hooks: {} } };
|
|
72
72
|
}
|
|
73
73
|
throw new GenesisError('CODEX_HOOKS_INVALID', `${HOOKS_PATH} is not valid hook configuration: ${error.message}.`);
|
|
74
74
|
}
|
|
@@ -78,6 +78,7 @@ export async function installCodexHooks({ projectRoot } = {}) {
|
|
|
78
78
|
const root = (await gitContext(projectRoot)).repositoryRoot;
|
|
79
79
|
const location = path.join(root, HOOKS_PATH);
|
|
80
80
|
const { source, value } = await installedHooksSource(location);
|
|
81
|
+
if (value.description === LEGACY_GENESIS_HOOKS_DESCRIPTION) delete value.description;
|
|
81
82
|
value.hooks ||= {};
|
|
82
83
|
removeGenesisProjectHooks(value.hooks);
|
|
83
84
|
const groups = value.hooks[SESSION_HOOK.event] ||= [];
|
|
@@ -88,20 +89,15 @@ export async function installCodexHooks({ projectRoot } = {}) {
|
|
|
88
89
|
return { status: 'updated', changedFiles: [HOOKS_PATH] };
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
function zeroPaths(buffer) {
|
|
92
|
-
return [...new Set(buffer.toString('utf8').split('\0').map(normalizeRelative).filter(Boolean))];
|
|
93
|
-
}
|
|
94
|
-
|
|
95
92
|
export async function codexAdoptionRecommendation({ projectRoot = process.cwd() } = {}) {
|
|
96
93
|
let root;
|
|
97
94
|
try { root = (await gitContext(projectRoot)).repositoryRoot; } catch { return { status: 'not-applicable', output: '' }; }
|
|
98
95
|
if ((await pathState(path.join(root, 'genesis/blueprint.md'))).exists) {
|
|
99
96
|
return { status: 'not-applicable', output: '' };
|
|
100
97
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (files.length === 0) return { status: 'not-applicable', output: '' };
|
|
98
|
+
if (await classifyProjectKind({ projectRoot: root }) === 'new') {
|
|
99
|
+
return { status: 'not-applicable', output: '' };
|
|
100
|
+
}
|
|
105
101
|
return {
|
|
106
102
|
status: 'ready',
|
|
107
103
|
output: [
|
package/src/index/context.js
CHANGED
|
@@ -31,16 +31,30 @@ function stackSummary(stack) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function stackGuidance(stack) {
|
|
34
|
-
|
|
35
|
-
if (pieces.length === 0) return [];
|
|
34
|
+
if (!stack.guidance) return [];
|
|
36
35
|
return [
|
|
37
36
|
'',
|
|
38
37
|
'## Selected Stack guidance',
|
|
39
38
|
'',
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
stack.guidance,
|
|
40
|
+
'',
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function stackContracts(stack) {
|
|
45
|
+
if (stack.projectContracts.length === 0) return [];
|
|
46
|
+
return [
|
|
47
|
+
'',
|
|
48
|
+
'## Project Stack contracts',
|
|
49
|
+
'',
|
|
50
|
+
'These exact project-owned sections in `genesis/stack.md` are authoritative. Genesis executes only Verification; each other named consumer owns its section.',
|
|
51
|
+
'',
|
|
52
|
+
...stack.projectContracts.flatMap(({ name, lines }) => [
|
|
53
|
+
`### \`## ${name}\``,
|
|
42
54
|
'',
|
|
43
|
-
|
|
55
|
+
'```markdown',
|
|
56
|
+
...lines,
|
|
57
|
+
'```',
|
|
44
58
|
'',
|
|
45
59
|
]),
|
|
46
60
|
];
|
|
@@ -108,6 +122,7 @@ export async function contextForProjectPaths({ paths, projectRoot, stackPackages
|
|
|
108
122
|
'',
|
|
109
123
|
...stackSummary(stack),
|
|
110
124
|
...stackGuidance(stack),
|
|
125
|
+
...stackContracts(stack),
|
|
111
126
|
'',
|
|
112
127
|
'## Existing functions',
|
|
113
128
|
'',
|