genesis-compiler 1.2.28 → 1.3.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.
- package/README.md +84 -9
- package/docs/prompt-integration.md +108 -6
- package/package.json +4 -1
- package/plugins/genesis/.codex-plugin/plugin.json +1 -1
- package/plugins/opencode/project-guidance.js +41 -5
- 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 -85
- package/src/cli.js +124 -7
- package/src/index/assets.js +3 -0
- package/src/index/check.js +10 -0
- package/src/index/codex-hooks.js +21 -12
- package/src/index/collaboration.js +371 -0
- package/src/index/context.js +3 -8
- package/src/index/contracts.js +3 -0
- package/src/index/host-context-resolver.js +73 -0
- package/src/index/init.js +4 -0
- package/src/index/migration.js +2 -0
- package/src/index/opencode-plugin.js +1 -1
- package/src/index/paths.js +2 -0
- package/src/index/project-files.js +12 -0
- package/src/index/project-format.js +3 -1
- package/src/index/prompt.js +120 -45
- package/src/index/session-context.js +115 -25
- package/src/index/stack.js +2 -2
- package/src/index.js +27 -2
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ The useful mental model is:
|
|
|
24
24
|
genesis/
|
|
25
25
|
version project-file format version used for deterministic migrations
|
|
26
26
|
blueprint.md non-technical product intent
|
|
27
|
+
collaboration.md project-wide communication choices and authored requirements
|
|
27
28
|
engineering.md selected engineering profile and project-specific requirements
|
|
28
29
|
stack.md selected components, resources, verification, and project-owned operation contracts
|
|
29
30
|
stack/ optional per-component Description, Guidance, Adoption, Post-change, and Deslop customization
|
|
@@ -200,9 +201,9 @@ complete directory into `.agents/skills/`, including its `references/`,
|
|
|
200
201
|
must resolve within that same Skill directory after relocation; a missing
|
|
201
202
|
target or path that escapes the Skill root makes the Skill invalid. The agent
|
|
202
203
|
loads valid resources only when the Skill requires them. A technology does not
|
|
203
|
-
need a Skill to be selectable: the curated JSKIT
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
need a Skill to be selectable: the curated JSKIT and Vue pieces link their
|
|
205
|
+
authoritative framework documentation through Stack prose and declare no Skill.
|
|
206
|
+
A piece's optional `## Guidance` is concise supplemental
|
|
206
207
|
project-work guidance; it does not create or replace a generic technology
|
|
207
208
|
skill.
|
|
208
209
|
|
|
@@ -237,6 +238,60 @@ Project-scoped options follow the command, for example
|
|
|
237
238
|
a host or script needs the normalized result. Run `genesis --help` for the
|
|
238
239
|
compact CLI synopsis.
|
|
239
240
|
|
|
241
|
+
## Collaboration approach
|
|
242
|
+
|
|
243
|
+
Genesis keeps project-wide communication guidance in ordinary source rather
|
|
244
|
+
than in a host-private policy or a repeated user-message prefix:
|
|
245
|
+
|
|
246
|
+
```markdown
|
|
247
|
+
# Collaboration approach
|
|
248
|
+
|
|
249
|
+
## Tone
|
|
250
|
+
|
|
251
|
+
- `encouraging`
|
|
252
|
+
|
|
253
|
+
## Response length
|
|
254
|
+
|
|
255
|
+
- `concise`
|
|
256
|
+
|
|
257
|
+
## Assumed experience
|
|
258
|
+
|
|
259
|
+
- `comfortable`
|
|
260
|
+
|
|
261
|
+
## Explanation style
|
|
262
|
+
|
|
263
|
+
- `concise`
|
|
264
|
+
|
|
265
|
+
## Project requirements
|
|
266
|
+
|
|
267
|
+
- Nothing.
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Inspect or change it without parsing Markdown yourself:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
genesis collaboration show
|
|
274
|
+
genesis collaboration set direct balanced expert conclusions "Be candid."
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Genesis owns the supported choices and their concise expansions. Authored
|
|
278
|
+
project requirements receive one fixed framing sentence and are otherwise
|
|
279
|
+
preserved. They are omitted when the source says `- Nothing.`.
|
|
280
|
+
|
|
281
|
+
Persistent hosts should install `projectSessionContext()` once when a provider
|
|
282
|
+
conversation is created or refreshed. They may then generate task prompts with
|
|
283
|
+
`sessionContextInstalled: true`, preventing the stable Collaboration and
|
|
284
|
+
Engineering guidance from being repeated in each task. A host can supply one
|
|
285
|
+
explicit session/turn driver; Genesis performs no driver discovery and labels
|
|
286
|
+
turn output untrusted. If the project-local Codex or OpenCode adapter runs in a
|
|
287
|
+
separate process, the host may set `GENESIS_HOST_CONTEXT_RESOLVER` to one
|
|
288
|
+
executable and optionally supply opaque JSON in
|
|
289
|
+
`GENESIS_HOST_CONTEXT_RESOLVER_DATA`. Session and turn hooks pass only the
|
|
290
|
+
requested lane, native provider session id, and that configured data to the
|
|
291
|
+
executable. Session output is composed into stable context; a nonempty turn
|
|
292
|
+
result is capped at 512 bytes, labeled untrusted, and kept separate from the
|
|
293
|
+
authored user message. This is a single process bridge, not a plugin registry.
|
|
294
|
+
|
|
240
295
|
## Engineering approach
|
|
241
296
|
|
|
242
297
|
Every profile inherits one universal rule: implementation must remain easy to
|
|
@@ -518,8 +573,13 @@ The eight task types are deliberately explicit:
|
|
|
518
573
|
- `start` opens the project conversation. For a new project it establishes what
|
|
519
574
|
is being built, who or what will use or invoke it, and the first useful
|
|
520
575
|
observable outcome before presenting relevant choices from the live Stack
|
|
521
|
-
|
|
522
|
-
|
|
576
|
+
and engineering-profile catalogs. A partial reply resolves only what it
|
|
577
|
+
explicitly answers. An existing project receives none of those new-project
|
|
578
|
+
questions or catalogs. Its opening contains the full Blueprint, concise
|
|
579
|
+
selected Stack and Program summaries, and full selected Guidance separated by
|
|
580
|
+
component headings; detailed Program modules, sources, operations, indexes,
|
|
581
|
+
and skills are loaded later with `genesis context <relevant-path...>`. It
|
|
582
|
+
checks `genesis stack list` before proposing an additional technology.
|
|
523
583
|
- `adopt` imports an existing application's factual operational and product
|
|
524
584
|
contracts into Genesis metadata. It composes technology-specific Adoption
|
|
525
585
|
requirements from the selected Stack and does not change application code.
|
|
@@ -645,7 +705,10 @@ General `Guidance` enriches implementation, review, Program, description, and
|
|
|
645
705
|
cleanup tasks; `Adoption` adds import-only requirements; `Post-change` adds
|
|
646
706
|
work to finish in the original implementation turn; `Deslop` adds
|
|
647
707
|
technology-specific cleanup rules to Genesis's invariant behavior-preserving
|
|
648
|
-
contract.
|
|
708
|
+
contract. When several components contribute one of these prose fields,
|
|
709
|
+
Genesis retains each complete contribution under its component heading in
|
|
710
|
+
dependency-first selected order; it does not blend or semantically deduplicate
|
|
711
|
+
their instructions. None shadows an official generic technology skill or assumes that an
|
|
649
712
|
upstream skill contains every rule Genesis needs.
|
|
650
713
|
|
|
651
714
|
Genesis core contains no Stack pieces and no database, framework, language, or
|
|
@@ -772,7 +835,8 @@ genesis migrate
|
|
|
772
835
|
|
|
773
836
|
Migration is deterministic and forward-only. The format 2 migration snapshots
|
|
774
837
|
the previously effective Stack operations into project-owned sections before
|
|
775
|
-
removing component-runtime fallback
|
|
838
|
+
removing component-runtime fallback; format 3 adds the portable Collaboration
|
|
839
|
+
declaration. Migration also synchronizes managed skills
|
|
776
840
|
and hooks, regenerates derived indexes, and then returns a fresh `check`
|
|
777
841
|
result. A newer project is never downgraded. Every project-scoped CLI
|
|
778
842
|
invocation warns when the recorded format does not match the running CLI, and
|
|
@@ -789,6 +853,7 @@ import {
|
|
|
789
853
|
getContext,
|
|
790
854
|
indexCodebase,
|
|
791
855
|
initialize,
|
|
856
|
+
inspectCollaboration,
|
|
792
857
|
inspectEngineering,
|
|
793
858
|
inspectEnvironment,
|
|
794
859
|
inspectStackSection,
|
|
@@ -796,6 +861,9 @@ import {
|
|
|
796
861
|
listEngineeringProfiles,
|
|
797
862
|
listStackPieces,
|
|
798
863
|
migrate,
|
|
864
|
+
projectSessionContext,
|
|
865
|
+
projectTurnContext,
|
|
866
|
+
setCollaboration,
|
|
799
867
|
setEngineeringProfile,
|
|
800
868
|
verify,
|
|
801
869
|
} from 'genesis-compiler';
|
|
@@ -810,6 +878,12 @@ codebase. `installCodex()` installs the optional global discovery plugin.
|
|
|
810
878
|
`listEngineeringProfiles()`, `inspectEngineering()`, and
|
|
811
879
|
`setEngineeringProfile()` expose the same built-in catalog and portable
|
|
812
880
|
project selection used by the CLI and hosts.
|
|
881
|
+
`inspectCollaboration()` and `setCollaboration()` expose the portable
|
|
882
|
+
communication declaration and Genesis-owned choice expansions.
|
|
883
|
+
`projectSessionContext()` composes stable project guidance with one explicitly
|
|
884
|
+
supplied host-driver result. `projectTurnContext()` invokes that same optional
|
|
885
|
+
driver for the separate untrusted turn lane without accepting user-message
|
|
886
|
+
text.
|
|
813
887
|
`getContext()` resolves source paths to the Program modules that cite them,
|
|
814
888
|
the functions already declared there, selected Stack guidance, available Agent
|
|
815
889
|
Skills, and verification commands. `indexCodebase()` regenerates or returns the
|
|
@@ -821,8 +895,9 @@ projection paths without returning any supplied environment value.
|
|
|
821
895
|
interpreting or executing its contents.
|
|
822
896
|
|
|
823
897
|
Normalized results identify their stable public contract in the `contract`
|
|
824
|
-
field: `genesis.
|
|
825
|
-
`genesis.
|
|
898
|
+
field: `genesis.collaboration.v1`, `genesis.engineering.v1`,
|
|
899
|
+
`genesis.environment.v2`, `genesis.session-context.v1`,
|
|
900
|
+
`genesis.stack-section.v1`, `genesis.turn-context.v1`, or
|
|
826
901
|
`genesis.verification.v1`. A consumer defines any schema embedded inside the
|
|
827
902
|
opaque section body.
|
|
828
903
|
|
|
@@ -15,11 +15,93 @@ const work = await generatePrompt({
|
|
|
15
15
|
await currentAgent.send(work.prompt);
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
A persistent host installs stable context separately and keeps ordinary user
|
|
19
|
+
text unchanged:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import {
|
|
23
|
+
generatePrompt,
|
|
24
|
+
projectSessionContext,
|
|
25
|
+
projectTurnContext,
|
|
26
|
+
} from 'genesis-compiler';
|
|
27
|
+
|
|
28
|
+
const sessionContext = await projectSessionContext({
|
|
29
|
+
projectRoot,
|
|
30
|
+
hostDriver,
|
|
31
|
+
hostDriverInput: {
|
|
32
|
+
scope: 'session',
|
|
33
|
+
conversationKind: 'main',
|
|
34
|
+
session: { managedPreview: true },
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
await provider.installTrustedSessionContext(sessionContext.output);
|
|
38
|
+
|
|
39
|
+
const task = await generatePrompt({
|
|
40
|
+
projectRoot,
|
|
41
|
+
task: 'work',
|
|
42
|
+
request: userMessage,
|
|
43
|
+
sessionContextInstalled: true,
|
|
44
|
+
});
|
|
45
|
+
const turnContext = await projectTurnContext({
|
|
46
|
+
hostDriver,
|
|
47
|
+
hostDriverInput: {
|
|
48
|
+
scope: 'turn',
|
|
49
|
+
actor: { preferredAddressName: 'Merc' },
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
await provider.sendUserTurn({
|
|
53
|
+
text: task.prompt,
|
|
54
|
+
untrustedContext: turnContext.output,
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The provider method names above are illustrative. Genesis supplies semantic
|
|
59
|
+
session and untrusted-turn results; the host's provider adapter owns their
|
|
60
|
+
native placement. The driver never receives or rewrites `userMessage`, and
|
|
61
|
+
Genesis supports only the one explicitly supplied driver—there is no discovery
|
|
62
|
+
or plugin registry.
|
|
63
|
+
|
|
64
|
+
When the project-local Codex or OpenCode adapter runs in a separate process,
|
|
65
|
+
the host can configure that same one-driver boundary without adding another
|
|
66
|
+
prompt compositor:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
GENESIS_HOST_CONTEXT_RESOLVER=/path/to/host-context-resolver
|
|
70
|
+
GENESIS_HOST_CONTEXT_RESOLVER_DATA={"registry":"/runtime/host-sessions.json"}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For `genesis hook session`, Genesis invokes that one executable with bounded
|
|
74
|
+
JSON on stdin:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"scope": "session",
|
|
79
|
+
"providerSessionId": "native-session-id",
|
|
80
|
+
"data": { "registry": "/runtime/host-sessions.json" }
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For `genesis hook turn`, the input has the same shape with `scope: "turn"`.
|
|
85
|
+
The executable returns only the requested host contribution as text. Codex's
|
|
86
|
+
hook input and OpenCode's transform callbacks supply the native session id;
|
|
87
|
+
Genesis extracts that id but does not understand the host registry or the
|
|
88
|
+
provider's prompt-placement rules. The Codex prompt hook and OpenCode message
|
|
89
|
+
transform place a nonempty turn result separately from authored user text. If
|
|
90
|
+
no resolver is configured, both turn paths are empty and the adapters render
|
|
91
|
+
ordinary Genesis session context exactly as before.
|
|
92
|
+
|
|
18
93
|
Tasks are `start`, `adopt`, `work`, `deslop`, `program`, `blueprint`, `describe`, and `review`.
|
|
19
94
|
`start` is the host-independent first conversation: it classifies an initialized
|
|
20
|
-
project from
|
|
21
|
-
|
|
22
|
-
|
|
95
|
+
project from its selected Stack and Git-visible project paths without building
|
|
96
|
+
the code index. A new project gets the product questions and live Stack and
|
|
97
|
+
engineering-profile catalogs. An existing project gets none of that
|
|
98
|
+
new-project launcher or catalog: its opening JSON contains the full Blueprint,
|
|
99
|
+
selected component summaries, and only bounded Program status, subsystem names,
|
|
100
|
+
and a module count. The complete effective Guidance remains present once under
|
|
101
|
+
component headings. Exact Program modules, sources, project contracts, indexed
|
|
102
|
+
functions, verification commands, and skills are deferred to `genesis context
|
|
103
|
+
<relevant-path...>`. A new technology request goes through `genesis stack list`
|
|
104
|
+
before selection. For an existing uninitialized codebase it owns
|
|
23
105
|
the adoption recommendation as part of the same portable prompt. A host such as Vibe64 sends this prompt on the
|
|
24
106
|
first chat turn; it does not recreate the questions or Stack catalog.
|
|
25
107
|
`describe` creates or refreshes the complete Blueprint and useful Program in one
|
|
@@ -33,13 +115,17 @@ Genesis keeps each instruction at one useful level:
|
|
|
33
115
|
- `skills/genesis-project/`, `skills/genesis-program/`, and
|
|
34
116
|
`skills/genesis-deslop/` are the reusable workflow sources copied into each
|
|
35
117
|
project's `.agents/skills/` directory.
|
|
36
|
-
- `prompts/<task>.txt` is a task launcher.
|
|
37
|
-
|
|
118
|
+
- `prompts/<task>.txt` is a task launcher. `start.txt` is only the common opening
|
|
119
|
+
seam; one of its new, existing, or existing-uninitialized launchers is appended
|
|
120
|
+
after classification. Each launcher states only its own project kind's work.
|
|
38
121
|
- a declared Stack package's `stacks/pieces/<component>.md` supplies concise Description, supplemental
|
|
39
122
|
Guidance, Adoption requirements, initial operation proposals, Deslop overlays,
|
|
40
123
|
structural Indexers, and an optional authoritative Agent Skill source.
|
|
41
124
|
- `genesis/blueprint.md`, `genesis/program/`, and `genesis/stack.md` are the
|
|
42
125
|
project's own intent, explanation, and selected technical composition.
|
|
126
|
+
- `genesis/collaboration.md` selects Genesis-owned tone, response-length,
|
|
127
|
+
assumed-experience, and explanation-style instructions plus optional authored
|
|
128
|
+
project requirements.
|
|
43
129
|
- `profiles/engineering/*.md` owns the installed versioned engineering
|
|
44
130
|
profiles. `genesis/engineering.md` selects one profile and records explicit
|
|
45
131
|
project requirements. A universal complexity gate is composed ahead of the
|
|
@@ -50,7 +136,8 @@ Detailed technology manuals belong to the technology's authoritative
|
|
|
50
136
|
documentation, which Stack prose may link directly. A technology may also
|
|
51
137
|
offer a separately installable Skill with its own `references/` directory.
|
|
52
138
|
Concise rules needed in project prompts belong in Stack `Guidance`; they are
|
|
53
|
-
composed without
|
|
139
|
+
composed dependency-first without semantic blending and retain a heading for
|
|
140
|
+
each contributing component.
|
|
54
141
|
|
|
55
142
|
## Existing projects
|
|
56
143
|
|
|
@@ -88,6 +175,21 @@ requests another model turn. Selected `Post-change` contributions are included
|
|
|
88
175
|
in the original implementation prompt, whose project skill also keeps
|
|
89
176
|
intentional Blueprint and affected Program changes aligned.
|
|
90
177
|
|
|
178
|
+
An out-of-process host may configure the single resolver described above. Each
|
|
179
|
+
adapter passes only its native session id to Genesis; Genesis sends that id,
|
|
180
|
+
the requested lane, and explicitly configured opaque data to the resolver.
|
|
181
|
+
Session output is composed with the stable guide; turn output remains a small
|
|
182
|
+
untrusted item beside a selected real user turn. This is one process bridge,
|
|
183
|
+
not a driver or plugin registry.
|
|
184
|
+
|
|
185
|
+
Hosts that own a persistent provider conversation can call
|
|
186
|
+
`projectSessionContext()` directly and pass at most one explicit host driver.
|
|
187
|
+
The complete result includes Genesis Collaboration and Engineering guidance and
|
|
188
|
+
has a stable identity. `projectTurnContext()` calls that driver only for a real
|
|
189
|
+
turn selected by the host and labels its separate result untrusted. Hosts use
|
|
190
|
+
`sessionContextInstalled: true` for task prompts only after installing the
|
|
191
|
+
session result; the default command-line prompt remains self-contained.
|
|
192
|
+
|
|
91
193
|
The operating guide dynamically lists only the component ids in the currently
|
|
92
194
|
available Stack catalogs. The naked CLI uses an explicitly installed
|
|
93
195
|
first-party `genesis-stack` package as its initial catalog without exposing the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genesis-compiler",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
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",
|
|
@@ -5,12 +5,18 @@ import { promisify } from "node:util";
|
|
|
5
5
|
|
|
6
6
|
const execute = promisify(execFile);
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const HOST_CONTEXT_INPUT_ENV = "GENESIS_HOST_CONTEXT_INPUT";
|
|
9
|
+
|
|
10
|
+
async function renderContext(projectRoot, sessionId, scope) {
|
|
9
11
|
const { stdout } = await execute(
|
|
10
12
|
"genesis",
|
|
11
|
-
["hook",
|
|
13
|
+
["hook", scope, "--project-root", projectRoot],
|
|
12
14
|
{
|
|
13
15
|
cwd: projectRoot,
|
|
16
|
+
env: {
|
|
17
|
+
...process.env,
|
|
18
|
+
[HOST_CONTEXT_INPUT_ENV]: JSON.stringify({ sessionId })
|
|
19
|
+
},
|
|
14
20
|
maxBuffer: 256 * 1024,
|
|
15
21
|
timeout: 5_000
|
|
16
22
|
}
|
|
@@ -25,13 +31,13 @@ function eventSessionId(event = {}) {
|
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export const GenesisProjectGuidance = async ({ directory, worktree } = {}) => {
|
|
28
|
-
const projectRoot = path.resolve(
|
|
34
|
+
const projectRoot = path.resolve(directory || worktree || process.cwd());
|
|
29
35
|
const contexts = new Map();
|
|
30
36
|
|
|
31
37
|
function contextForSession(sessionId) {
|
|
32
38
|
let context = contexts.get(sessionId);
|
|
33
39
|
if (!context) {
|
|
34
|
-
context =
|
|
40
|
+
context = renderContext(projectRoot, sessionId, "session");
|
|
35
41
|
contexts.set(sessionId, context);
|
|
36
42
|
context.catch(() => {
|
|
37
43
|
if (contexts.get(sessionId) === context) contexts.delete(sessionId);
|
|
@@ -50,7 +56,37 @@ export const GenesisProjectGuidance = async ({ directory, worktree } = {}) => {
|
|
|
50
56
|
const sessionId = String(input.sessionID || input.sessionId || "").trim();
|
|
51
57
|
if (!sessionId) return;
|
|
52
58
|
const context = await contextForSession(sessionId);
|
|
53
|
-
if (!output.system.includes(context)) output.system.push(context);
|
|
59
|
+
if (context && !output.system.includes(context)) output.system.push(context);
|
|
60
|
+
},
|
|
61
|
+
"experimental.chat.messages.transform": async (...hookArguments) => {
|
|
62
|
+
const output = hookArguments[1] || {};
|
|
63
|
+
const messages = Array.isArray(output.messages) ? output.messages : [];
|
|
64
|
+
const messageIndex = messages.findLastIndex((message) => message?.info?.role === "user");
|
|
65
|
+
if (messageIndex < 0) return;
|
|
66
|
+
const message = messages[messageIndex];
|
|
67
|
+
const sessionId = String(message.info?.sessionID || "").trim();
|
|
68
|
+
const messageId = String(message.info?.id || "").trim();
|
|
69
|
+
if (!sessionId || !messageId || !Array.isArray(message.parts)) return;
|
|
70
|
+
const context = await renderContext(projectRoot, sessionId, "turn");
|
|
71
|
+
if (!context || message.parts.some((part) => part?.synthetic === true && part?.text === context)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
output.messages = messages.map((candidate, index) => index === messageIndex
|
|
75
|
+
? {
|
|
76
|
+
...candidate,
|
|
77
|
+
parts: [
|
|
78
|
+
...candidate.parts,
|
|
79
|
+
{
|
|
80
|
+
id: `${messageId}_genesis_turn_context`,
|
|
81
|
+
messageID: messageId,
|
|
82
|
+
sessionID: sessionId,
|
|
83
|
+
synthetic: true,
|
|
84
|
+
text: context,
|
|
85
|
+
type: "text"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
: candidate);
|
|
54
90
|
}
|
|
55
91
|
};
|
|
56
92
|
};
|
|
@@ -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,87 +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
|
-
outcome. Ask only unresolved high-impact questions. A reply confirms only what
|
|
7
|
-
it explicitly answers; Stack confirmation is not product intent.
|
|
8
|
-
|
|
9
|
-
When the user explicitly names a technology, framework, language, or database
|
|
10
|
-
that is not selected, make the existing Genesis `stack list` operation the
|
|
11
|
-
first technology action. If one catalog component exactly matches that choice,
|
|
12
|
-
ask: "<Technology> is available in Genesis. Would you like me to add it to this
|
|
13
|
-
project and prepare the app with its official guidance?" Do not run `stack add
|
|
14
|
-
<piece...>` without that confirmation. If confirmed, add it, let Genesis apply
|
|
15
|
-
its declared dependency closure and synchronize any skill the component
|
|
16
|
-
declares. Follow the preparation prompt returned by `stack add` in this same
|
|
17
|
-
task: make each materialized project contract true or replace a complete
|
|
18
|
-
section with evidenced reality. Then run `context .` (or the relevant source
|
|
19
|
-
path once source exists), load the applicable installed skill if present, and
|
|
20
|
-
follow the technology-owned guidance to prepare actual project dependencies.
|
|
21
|
-
Never infer an install command from a component id. If declined, continue
|
|
22
|
-
without adding it or asking again.
|
|
23
|
-
If no component matches, do not invent one; continue normally using
|
|
24
|
-
authoritative technology documentation.
|
|
25
|
-
|
|
26
|
-
When `projectKind` is `new`, establish what is being built, who or what will use
|
|
27
|
-
or invoke it, and its first observable useful outcome. Ask up to three concise,
|
|
28
|
-
high-impact questions at a time, and ask access, data, platform, or interface
|
|
29
|
-
questions only when they are material to that product. Use
|
|
30
|
-
`availableStackPieces` to present only the relevant choices, explain them in
|
|
31
|
-
product language, and let the user decide. Never silently select a technology.
|
|
32
|
-
After the user confirms the proposed component selection, use the Genesis
|
|
33
|
-
`stack add <piece...>` operation; do not edit `genesis/stack.md` by hand.
|
|
34
|
-
Establish the non-technical Blueprint from the user's answers before
|
|
35
|
-
implementation.
|
|
36
|
-
If the product direction becomes clear while Stack is still empty, do not end
|
|
37
|
-
the turn after only writing or summarizing the Blueprint: present the relevant
|
|
38
|
-
Stack choices in that same turn and ask the user to select one explicitly.
|
|
39
|
-
The default `focused.v1` engineering profile is already suitable for ordinary
|
|
40
|
-
work, so do not force a separate profile question. When the user asks for a
|
|
41
|
-
different engineering approach, or the product clearly has long-lived
|
|
42
|
-
compatibility, operational, security, reliability, or compliance constraints,
|
|
43
|
-
use `availableEngineeringProfiles` to explain only the relevant choices in
|
|
44
|
-
product language. After an explicit choice, run the Genesis `engineering set
|
|
45
|
-
<profile>` operation; do not invent or duplicate a built-in profile. Record
|
|
46
|
-
additional explicit obligations in `genesis/engineering.md` under Project
|
|
47
|
-
requirements.
|
|
48
|
-
This opening turn owns product direction and Stack selection, not final
|
|
49
|
-
verification. Do not run the Genesis `verify` operation before implementation
|
|
50
|
-
exists. If structural validation is useful, run the Genesis `check` operation;
|
|
51
|
-
consumer-owned operations remain governed by their own tools and must not be
|
|
52
|
-
inferred here.
|
|
53
|
-
|
|
54
|
-
When `projectKind` is `existing`, ask what the user wants to understand or
|
|
55
|
-
change. Use the current Blueprint, Stack, Program, and code index when present.
|
|
56
|
-
If the existing implementation is not yet explained, recommend the Genesis
|
|
57
|
-
description/adoption path instead of pretending its intent is known.
|
|
58
|
-
When an existing implementation has no selected Stack yet, inspect its actual
|
|
59
|
-
package scripts, build files, setup commands, server entrypoint, and readiness
|
|
60
|
-
route before recording the user's technology choice. Materialized component
|
|
61
|
-
proposals describe that component's current operational foundation; selecting
|
|
62
|
-
the component does not port an older implementation to it. If the existing
|
|
63
|
-
facts differ, replace the complete project-owned section using the consumer's
|
|
64
|
-
current schema and the code that exists. Never report a proposed operation as
|
|
65
|
-
usable merely because the component was selected, and never add compatibility
|
|
66
|
-
implementation without the user asking for a port.
|
|
67
|
-
|
|
68
|
-
When `projectKind` is `existing-uninitialized`, ask what the user wants to
|
|
69
|
-
understand or change and strongly recommend preparing the existing project for
|
|
70
|
-
guided editing before substantial work. Explain in product language that this
|
|
71
|
-
preserves the implementation while importing its current setup, run, database,
|
|
72
|
-
preview, verification, and product context. Do not require the user to know
|
|
73
|
-
Genesis terminology or type a command. If they approve, run the Genesis `adopt`
|
|
74
|
-
operation yourself and follow its adoption prompt. If they decline, continue
|
|
75
|
-
normally and do not repeat the recommendation.
|
|
76
|
-
|
|
77
|
-
If the request already contains an unambiguous product description and an
|
|
78
|
-
explicit Stack choice, establish the Blueprint and ask for the component
|
|
79
|
-
confirmation described above before applying that choice. Otherwise this is a
|
|
80
|
-
conversational turn: ask, listen, and preserve the source.
|
|
81
|
-
|
|
82
|
-
Once product direction and any relevant Stack selection are clear, choose one
|
|
83
|
-
smallest implementation path through the applicable technology guidance, or
|
|
84
|
-
authoritative technology documentation when the catalog has no match, and read
|
|
85
|
-
only what that path requires. Do not survey alternative foundations, clone
|
|
86
|
-
whole technology repositories, inspect unrelated package internals, or
|
|
87
|
-
delegate research unless one concrete failure requires one exact investigation.
|
|
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.
|