Fork tasks from snapshots; snapshot only when text follows tool calls
This commit is contained in:
@@ -59,12 +59,26 @@ func (m *Manager) bounceProseQuestion(l *live) claude.HookFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func taskGuidance(task api.Task) string {
|
||||
if task.TodoItem == nil {
|
||||
return guidance
|
||||
func (m *Manager) taskGuidance(ctx context.Context, task api.Task) (string, error) {
|
||||
g := guidance
|
||||
if task.TodoItem != nil {
|
||||
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)
|
||||
}
|
||||
return guidance + 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.ForkedFrom == nil {
|
||||
return g, nil
|
||||
}
|
||||
src, err := m.store.GetTask(ctx, *task.ForkedFrom)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return g + forkGuidance(task, src), nil
|
||||
}
|
||||
|
||||
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.",
|
||||
src.Title, *task.ForkedAt, task.Branch, task.WorktreePath, src.WorktreePath, task.WorktreePath)
|
||||
}
|
||||
|
||||
func remindGuidance(text string) claude.HookFunc {
|
||||
|
||||
Reference in New Issue
Block a user