refactor: clarify coder done semantics + allow multi-step iterations
- done=true means all files created, build+lint pass - done=false means progress made, continue next iteration - Updated both sense-generator and workflow-generator coder prompts
This commit is contained in:
parent
d638623456
commit
6778ba5246
@ -1,43 +1,31 @@
|
||||
export function coderPrompt({ threadId }: { threadId: string }): string {
|
||||
return `Read the workflow thread for the planner's sense design: \`nerve thread ${threadId}\`
|
||||
return `Read the workflow thread for the planner's sense design and any tester feedback: \`nerve thread ${threadId}\`
|
||||
Read the nerve-dev skill for sense file structure and conventions: \`cat node_modules/@uncaged/nerve-skills/nerve-dev/SKILL.md\`
|
||||
|
||||
Implement the sense following the patterns from existing senses and the skill guide.
|
||||
## Your task
|
||||
|
||||
File structure for each sense:
|
||||
- \`senses/<name>/src/index.ts\` — TypeScript source with proper types; import schema as \`./schema.ts\`
|
||||
Implement (or fix) the sense the planner designed. If there is tester feedback in the thread, fix the issues it identified.
|
||||
|
||||
## Multi-step approach
|
||||
|
||||
You do NOT need to finish everything in one pass. You may return \`done: false\` to continue in the next iteration.
|
||||
|
||||
## File structure for each sense
|
||||
|
||||
- \`senses/<name>/src/index.ts\` — TypeScript compute source; import schema as \`./schema.ts\`
|
||||
- \`senses/<name>/src/schema.ts\` — Drizzle schema (TypeScript)
|
||||
- \`senses/<name>/migrations/\` — Drizzle migration files (at sense root, not inside src/)
|
||||
- \`senses/<name>/package.json\` — with esbuild build script (see below)
|
||||
- \`senses/<name>/package.json\` — with esbuild build script
|
||||
- \`senses/<name>/index.js\` — bundled output generated by \`pnpm build\` (do NOT edit by hand)
|
||||
|
||||
package.json template for each sense:
|
||||
\`\`\`json
|
||||
{
|
||||
"name": "sense-<name>",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=index.js --packages=external"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.0.0",
|
||||
"esbuild": "^0.27.0",
|
||||
"typescript": "^5.7.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": ["esbuild"]
|
||||
}
|
||||
}
|
||||
\`\`\`
|
||||
Look at existing senses for the package.json template and patterns.
|
||||
|
||||
After creating all files, run inside the sense directory:
|
||||
\`\`\`
|
||||
pnpm install --no-cache && pnpm build
|
||||
\`\`\`
|
||||
## When to return done: true
|
||||
|
||||
This generates the bundled \`index.js\` at the sense root that the daemon loads.
|
||||
Return \`done: true\` ONLY when ALL of the following are true:
|
||||
- All required files are created
|
||||
- \`pnpm install --no-cache && pnpm build\` succeeds (run it!)
|
||||
- \`nerve.yaml\` is updated with the sense config
|
||||
|
||||
Then update nerve.yaml and run any required migrations.`;
|
||||
Return \`done: false\` if you made progress but there is still work to do.`;
|
||||
}
|
||||
|
||||
@ -1,35 +1,44 @@
|
||||
export function coderPrompt({ threadId }: { threadId: string }): string {
|
||||
return `Read the workflow thread to get the planner's design and any tester feedback: \`nerve thread ${threadId}\`
|
||||
return `Read the workflow thread to get the planner's design and any tester/committer feedback: \`nerve thread ${threadId}\`
|
||||
Read the nerve-dev skill for workflow file structure and conventions: \`cat node_modules/@uncaged/nerve-skills/nerve-dev/SKILL.md\`
|
||||
Also look at existing workflows in the \`workflows/\` directory for patterns.
|
||||
|
||||
Implement the workflow the planner designed. If there is tester feedback in the thread, fix the issues it identified.
|
||||
## Your task
|
||||
|
||||
Implement (or fix) the workflow the planner designed. If there is tester or committer feedback in the thread, fix the issues they identified.
|
||||
|
||||
## Multi-step approach
|
||||
|
||||
You do NOT need to finish everything in one pass. You may return \`done: false\` to continue in the next iteration. For example:
|
||||
1. First pass: scaffold files and basic structure
|
||||
2. Second pass: implement role logic
|
||||
3. Third pass: fix build/lint errors
|
||||
|
||||
## Required files for each workflow
|
||||
|
||||
Required files for each workflow:
|
||||
- \`workflows/<name>/index.ts\` — WorkflowDefinition default export
|
||||
- \`workflows/<name>/build.ts\` — factory function
|
||||
- \`workflows/<name>/moderator.ts\` — moderator + meta types
|
||||
- \`workflows/<name>/roles/<role>/index.ts\` — role build function
|
||||
- \`workflows/<name>/roles/<role>/prompt.ts\` — prompt pure function
|
||||
- \`workflows/<name>/package.json\` — with esbuild build script
|
||||
- \`workflows/<name>/tsconfig.json\` — TypeScript config
|
||||
- Update \`nerve.yaml\` with \`workflows.<name>\`
|
||||
|
||||
Rules:
|
||||
## Rules
|
||||
|
||||
- Keep the WorkflowDefinition<WorkflowMeta> pattern
|
||||
- No dynamic import()
|
||||
- Use types (not interfaces)
|
||||
- Include retry-aware moderator routing
|
||||
- Meta should be simple routing signals (single boolean per role)
|
||||
- Write compile-ready TypeScript
|
||||
|
||||
After creating all files, run inside the workflow directory:
|
||||
\`\`\`
|
||||
pnpm install --no-cache && pnpm build
|
||||
\`\`\`
|
||||
## When to return done: true
|
||||
|
||||
End your response with a JSON block:
|
||||
\`\`\`json
|
||||
{ "done": true }
|
||||
\`\`\`
|
||||
if build succeeded, or:
|
||||
\`\`\`json
|
||||
{ "done": false }
|
||||
\`\`\`
|
||||
if there were errors.`;
|
||||
Return \`done: true\` ONLY when ALL of the following are true:
|
||||
- All required files are created
|
||||
- \`pnpm install --no-cache && pnpm build\` succeeds (run it!)
|
||||
- No lint or type errors remain
|
||||
|
||||
Return \`done: false\` if you made progress but there is still work to do, or if build/lint has errors you plan to fix in the next iteration.`;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user