Let task agents create and manage subtasks
This commit is contained in:
@@ -75,6 +75,13 @@ func (m *Manager) taskGuidance(ctx context.Context, task api.Task) (string, erro
|
||||
g += fmt.Sprintf("\n- This task was started from the item %q in %s at the repo root. When the work is done, remove that item from %s in this worktree, so the removal lands in the same merge as the work.",
|
||||
*task.TodoItem, todo.File, todo.File)
|
||||
}
|
||||
if task.ParentTaskId != nil {
|
||||
parent, err := m.store.GetTask(ctx, *task.ParentTaskId)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
g += subtaskGuidance(parent)
|
||||
}
|
||||
if task.ForkedFrom == nil {
|
||||
return g, nil
|
||||
}
|
||||
@@ -85,6 +92,12 @@ func (m *Manager) taskGuidance(ctx context.Context, task api.Task) (string, erro
|
||||
return g + forkGuidance(task, src), nil
|
||||
}
|
||||
|
||||
func subtaskGuidance(parent api.Task) string {
|
||||
return fmt.Sprintf("\n- This task is a subtask of byre task %q (%s), whose agent created it and manages it. Your final message at the end of each turn is sent to that agent, which may answer with more instructions. "+
|
||||
"Your work reaches %s's branch or the default branch when the subtask is merged.",
|
||||
parent.Title, parent.Id, parent.Id)
|
||||
}
|
||||
|
||||
func forkGuidance(task, src api.Task) string {
|
||||
return fmt.Sprintf("\n- This conversation was forked from byre task %q at its snapshot %d, into a task of its own: branch %s, worktree %s, which held that snapshot's files when the fork was made. "+
|
||||
"Everything before the fork happened in %s, which belongs to the other task: from now on read and change files only in %s, never in the other worktree, and use paths under it.",
|
||||
|
||||
Reference in New Issue
Block a user