@comfanion/workflow 4.38.1-dev.7 → 4.38.1-dev.9
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/package.json
CHANGED
package/src/build-info.json
CHANGED
|
@@ -911,6 +911,74 @@ This is /dev-epic autopilot mode. Execute stories sequentially until epic done.`
|
|
|
911
911
|
4. Update todo/story when task complete`
|
|
912
912
|
}
|
|
913
913
|
|
|
914
|
+
function buildBriefing(agent: string | null, ss: SessionState | null, ctx: SessionContext, readCommands: string): string {
|
|
915
|
+
const lines: string[] = []
|
|
916
|
+
|
|
917
|
+
// 1. WHO you are
|
|
918
|
+
if (agent) {
|
|
919
|
+
lines.push(`You are @${agent} (→ .opencode/agents/${agent}.md).`)
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
// 2. WHAT you are doing
|
|
923
|
+
if (ss) {
|
|
924
|
+
const cmd = ss.command || "unknown command"
|
|
925
|
+
if (ss.epic) {
|
|
926
|
+
lines.push(`You are executing ${cmd} ${ss.epic.id}: ${ss.epic.title}.`)
|
|
927
|
+
} else if (ss.story) {
|
|
928
|
+
lines.push(`You are executing ${cmd} ${ss.story.id}: ${ss.story.title}.`)
|
|
929
|
+
} else {
|
|
930
|
+
lines.push(`You are executing ${cmd}.`)
|
|
931
|
+
}
|
|
932
|
+
} else if (ctx.activeCommand) {
|
|
933
|
+
lines.push(`You are executing ${ctx.activeCommand}.`)
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// 3. WHERE you stopped
|
|
937
|
+
if (ss?.story) {
|
|
938
|
+
const task = ss.story.current_task || "review"
|
|
939
|
+
lines.push(`You were on story ${ss.story.id}: ${ss.story.title}, task ${task}.`)
|
|
940
|
+
if (ss.story.completed_tasks.length > 0) {
|
|
941
|
+
lines.push(`Completed: ${ss.story.completed_tasks.join(", ")}.`)
|
|
942
|
+
}
|
|
943
|
+
if (ss.story.pending_tasks.length > 0) {
|
|
944
|
+
lines.push(`Remaining: ${ss.story.pending_tasks.join(", ")}.`)
|
|
945
|
+
}
|
|
946
|
+
} else if (ss?.epic) {
|
|
947
|
+
lines.push(`Epic progress: ${ss.epic.progress}.`)
|
|
948
|
+
} else if (ctx.story) {
|
|
949
|
+
lines.push(`You were on story: ${ctx.story.title}, task ${ctx.story.currentTask || "review"}.`)
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// 4. WHAT to do next
|
|
953
|
+
if (ss?.next_action) {
|
|
954
|
+
lines.push(`\nNext action: ${ss.next_action}`)
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
// 5. READ these files
|
|
958
|
+
lines.push(`\n${readCommands}`)
|
|
959
|
+
|
|
960
|
+
// 6. KEY DECISIONS (if any)
|
|
961
|
+
if (ss?.key_decisions && ss.key_decisions.length > 0) {
|
|
962
|
+
lines.push(`\nKey decisions from your session:`)
|
|
963
|
+
for (const d of ss.key_decisions) {
|
|
964
|
+
lines.push(`- ${d}`)
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
// 7. TODO status (brief)
|
|
969
|
+
if (ctx.todos.length > 0) {
|
|
970
|
+
const inProgress = ctx.todos.filter(t => t.status === "in_progress")
|
|
971
|
+
const pending = ctx.todos.filter(t => t.status === "pending")
|
|
972
|
+
const completed = ctx.todos.filter(t => t.status === "completed")
|
|
973
|
+
lines.push(`\nTODO: ${completed.length} done, ${inProgress.length} in progress, ${pending.length} pending.`)
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
// 8. RULES
|
|
977
|
+
lines.push(`\nDO NOT ask user what to do. Read files above, then resume automatically.`)
|
|
978
|
+
|
|
979
|
+
return lines.join("\n")
|
|
980
|
+
}
|
|
981
|
+
|
|
914
982
|
return {
|
|
915
983
|
// Track active agent from chat messages
|
|
916
984
|
"chat.message": async (input, output) => {
|
|
@@ -967,24 +1035,10 @@ This is /dev-epic autopilot mode. Execute stories sequentially until epic done.`
|
|
|
967
1035
|
const instructions = await formatInstructions(ctx)
|
|
968
1036
|
const readCommands = await generateReadCommands(agent, ctx.story, ctx.activeCommand, ctx.sessionState)
|
|
969
1037
|
|
|
970
|
-
//
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
output.context.push(`# Session Continuation
|
|
976
|
-
|
|
977
|
-
${agentIdentity}
|
|
978
|
-
|
|
979
|
-
${readCommands}
|
|
980
|
-
|
|
981
|
-
---
|
|
982
|
-
|
|
983
|
-
${context}
|
|
984
|
-
|
|
985
|
-
---
|
|
986
|
-
|
|
987
|
-
${instructions}`)
|
|
1038
|
+
// Build agentic briefing
|
|
1039
|
+
const ss = ctx.sessionState
|
|
1040
|
+
const briefing = buildBriefing(agent, ss, ctx, readCommands)
|
|
1041
|
+
output.context.push(briefing)
|
|
988
1042
|
|
|
989
1043
|
await log(directory, ` -> output.context pushed (${output.context.length} items)`)
|
|
990
1044
|
await log(directory, `=== COMPACTION DONE ===`)
|
|
@@ -82,9 +82,11 @@ metadata:
|
|
|
82
82
|
|
|
83
83
|
<action name="execute-story">
|
|
84
84
|
Follow /dev-story logic:
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
85
|
+
- Read ONE story file
|
|
86
|
+
- Execute tasks ONE BY ONE (or parallel if independent)
|
|
87
|
+
- NEVER delegate entire story to @coder in one prompt
|
|
88
|
+
- After each task: verify, mark done, next task
|
|
89
|
+
- Clear task TODO when story done
|
|
88
90
|
</action>
|
|
89
91
|
|
|
90
92
|
<action name="mark-done">
|
|
@@ -90,18 +90,28 @@ metadata:
|
|
|
90
90
|
</example>
|
|
91
91
|
</phase>
|
|
92
92
|
|
|
93
|
-
<phase name="3-
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
93
|
+
<phase name="3-execute" title="Execute Tasks — One by One or Parallel">
|
|
94
|
+
<critical>DO NOT delegate entire story to @coder in one prompt!</critical>
|
|
95
|
+
<strategy>
|
|
96
|
+
For each task in TODO:
|
|
97
|
+
1. Check task dependencies (from story file)
|
|
98
|
+
2. If independent tasks exist → delegate in parallel (different files only)
|
|
99
|
+
3. If task depends on previous → delegate ONE task, wait for result
|
|
100
|
+
4. After @coder returns → verify, mark done, then next task
|
|
101
|
+
</strategy>
|
|
102
|
+
<loop>
|
|
103
|
+
<step n="1">Pick next task(s) from TODO</step>
|
|
104
|
+
<step n="2">Transform task → executable instruction (phase 2)</step>
|
|
105
|
+
<step n="3">Delegate to @coder using template below</step>
|
|
106
|
+
<step n="4">Verify result: tests pass, files compile</step>
|
|
107
|
+
<step n="5">Mark task ✅ in story file + TODO</step>
|
|
108
|
+
<step n="6">Update .opencode/session-state.yaml</step>
|
|
109
|
+
<step n="7">Next task or story complete</step>
|
|
110
|
+
</loop>
|
|
111
|
+
<parallel-rules>
|
|
112
|
+
OK to parallel: T01 (domain) + T02 (dto) — different files, no deps
|
|
113
|
+
NOT OK: T03 (service) depends on T01 (domain) — wait for T01 first
|
|
114
|
+
</parallel-rules>
|
|
105
115
|
</phase>
|
|
106
116
|
|
|
107
117
|
</workflow>
|
|
@@ -168,9 +178,16 @@ This file survives compaction and tells the agent where to resume.
|
|
|
168
178
|
</template>
|
|
169
179
|
|
|
170
180
|
<rules name="delegation">
|
|
181
|
+
<rule name="task-by-task" critical="true">
|
|
182
|
+
Delegate ONE task at a time (or parallel group if independent).
|
|
183
|
+
NEVER delegate entire story as one big prompt.
|
|
184
|
+
</rule>
|
|
171
185
|
<rule name="parallel">
|
|
172
186
|
Each task gets full context. No shared state. Different files only.
|
|
173
187
|
</rule>
|
|
188
|
+
<rule name="verify-between">
|
|
189
|
+
After each task: run tests, verify, mark done, THEN next task.
|
|
190
|
+
</rule>
|
|
174
191
|
<rule name="no-code">
|
|
175
192
|
Give direction, NOT solution. @coder writes implementation.
|
|
176
193
|
</rule>
|