feat: add target-specific handoff presets

This commit is contained in:
OpenClaw Bot
2026-05-11 12:48:36 +02:00
parent 204e5ee64a
commit de1855838e
3 changed files with 47 additions and 6 deletions
+45 -4
View File
@@ -39,6 +39,45 @@ const renderFeature = (feature: Feature) => {
const sortPulsesNewestFirst = (pulses: PulseEvent[]) =>
[...pulses].sort((a, b) => b.timestamp.localeCompare(a.timestamp))
const targetPresets: Record<string, { intro: string; workingStyle: string[]; deliverBack: string[] }> = {
OpenClaw: {
intro: 'Work like a proactive operator: act, verify, and keep the slice small enough to ship cleanly.',
workingStyle: [
'Use local repo evidence before making claims.',
'Prefer direct fixes plus a quick verification gate.',
'Keep follow-up notes short and operational.',
],
deliverBack: ['What changed', 'Files touched', 'How you verified it', 'Any blocker or parked follow-up'],
},
'Claude Code': {
intro: 'Work like a careful coding pair: make the smallest coherent change, explain tradeoffs briefly, and leave the tree tidy.',
workingStyle: [
'Prefer narrowly scoped edits over broad rewrites.',
'Call out any assumption that could affect correctness.',
'End with concise verification notes and next-risk if any.',
],
deliverBack: ['Summary', 'Files changed', 'Verification', 'Risks or follow-ups'],
},
Codex: {
intro: 'Work like a focused implementation run: minimal scope, crisp diffs, and explicit evidence before claiming success.',
workingStyle: [
'Bias toward direct implementation over long discussion.',
'Preserve existing behavior unless the task explicitly changes it.',
'Name the exact verification step you ran.',
],
deliverBack: ['Changes made', 'Touched files', 'Verification run', 'Remaining follow-up'],
},
'Generic Agent': {
intro: 'Deliver one clean, well-bounded improvement without drifting into adjacent ideas.',
workingStyle: [
'Stay anchored to the focus feature.',
'Avoid speculative architecture work.',
'Return with concrete evidence, not just intention.',
],
deliverBack: ['What changed', 'Files touched', 'How you verified it', 'Any blocker or parked follow-up'],
},
}
export const createAgentSessionPrompt = (
state: AppState,
options?: {
@@ -48,6 +87,7 @@ export const createAgentSessionPrompt = (
) => {
const grouped = groupFeatures(state.features)
const target = options?.target || 'AI coding agent'
const preset = targetPresets[target] || targetPresets['Generic Agent']
const focusFeature = options?.featureId ? state.features.find((feature) => feature.id === options.featureId) ?? null : grouped.now[0] ?? null
const focusRelease = focusFeature?.release_id ? state.releases.find((release) => release.id === focusFeature.release_id) ?? null : null
const focusPhase = focusFeature?.phase_id ? state.phases.find((phase) => phase.id === focusFeature.phase_id) ?? null : null
@@ -75,6 +115,7 @@ export const createAgentSessionPrompt = (
return [
`You are the ${target} for ${state.project.name}.`,
'',
preset.intro,
'Read the project context below and ship the smallest high-quality improvement that satisfies the focus feature without scope creep.',
'',
'## Project',
@@ -118,11 +159,11 @@ export const createAgentSessionPrompt = (
'- Preserve working behavior and avoid needless rewrites.',
'- Prefer the smallest shippable step with clear evidence.',
'',
'## Working Style',
...preset.workingStyle.map((item) => `- ${item}`),
'',
'## Deliver back',
'- What changed',
'- Files touched',
'- How you verified it',
'- Any blocker or follow-up you intentionally parked',
...preset.deliverBack.map((item) => `- ${item}`),
].join('\n')
}