Agents + bash
diff --git a/loop/loop.go b/loop/loop.go
index 6cfa111..1ae99f8 100644
--- a/loop/loop.go
+++ b/loop/loop.go
@@ -15,16 +15,6 @@
 //go:embed CONVERSATION_RULES.md
 var systemPrompt string
 
-type Message struct {
-	Author   string `json:"author"`
-	Contents string `json:"contents"`
-	Done     bool   `json:"done"`
-}
-
-type Conversation struct {
-	Messages []Message `json:"message"`
-}
-
 var todo *ToDo
 
 func Run(pr PromptReader, client *Client, tools tools.Registry) error {
@@ -40,7 +30,7 @@
 	todo.AssignedTo = "assistant"
 	agents := []Agent{
 		&UserAgent{pr},
-		&AnthropicAgent{tools, client.c},
+		&AnthropicAgent{pr, tools, client.c},
 	}
 	var wg sync.WaitGroup
 	for _, a := range agents {
@@ -56,34 +46,6 @@
 	return nil
 }
 
-// func Loop(todo *ToDo, item *ToDo, pr PromptReader, client *Client, reg tools.Registry) error {
-// 	messages := []anthropic.MessageParam{
-// 		anthropic.NewUserMessage(anthropic.NewTextBlock(string(k))),
-// 		anthropic.NewUserMessage(anthropic.NewTextBlock(fmt.Sprintf("Work on TODO item: %s", item.ID))),
-// 	}
-// 	for {
-// 		fmt.Println(todo.String())
-// 		if item.AssignedTo == "user" {
-// 			fmt.Printf("YOU %s: ", item.ID)
-// 			prompt, err := pr.Read()
-// 			if err != nil {
-// 				return err
-// 			}
-// 			item.Discussion = append(item.Discussion, Comment{
-// 				Author:  "user",
-// 				Comment: prompt,
-// 			})
-// 			item.AssignedTo = "assistant"
-// 			messages = append(messages, anthropic.NewUserMessage(anthropic.NewTextBlock(prompt)))
-// 		} else {
-// 			if len(messages) == 0 {
-// 				messages = append(messages, anthropic.NewUserMessage(anthropic.NewTextBlock(fmt.Sprintf("Work on TODO item with id"))))
-// 			}
-// 		}
-
-// 	}
-// }
-
 func pickToDoItem(todo *ToDo) *ToDo {
 	if todo.Done {
 		return nil
@@ -108,15 +70,23 @@
 	return nil
 }
 
+type ToDoSubItem struct {
+	Title       string `json:"title" jsonschema:"title=title,description=high level title of the TODO item,required"`
+	Description string `json:"description" jsonschema:"title=description,description=detailed description what this TODO item is about"`
+	AssignedTo  string `json:"assignedTo" jsonschema:"title=assigned to,description=name of the person who shall work on this utem"`
+}
+
 type ToDoItem struct {
-	ParentID    string `json:"parentId"`
-	Title       string `json:"title"`
-	Description string `json:"description"`
-	AssignedTo  string `json:"assignedTo"`
+	ParentID    string        `json:"parentId" jsonschema:"title=parent item id,description=ID of the parent TODO item this one shall be added to as a sub-item"`
+	Title       string        `json:"title" jsonschema:"title=title,description=high level title of the TODO item,required"`
+	Description string        `json:"description" jsonschema:"title=description,description=detailed description what this TODO item is about"`
+	AssignedTo  string        `json:"assignedTo" jsonschema:"title=assigned to,description=name of the person who shall work on this utem"`
+	Items       []ToDoSubItem `json:"items" jsonschema:"title=sub items,description:array of sub-items"`
+	Parallel    bool          `json:"parallel" jsonschema:"title=parallel,description=if true sub-items may be worked on in parallel and there is no depencency between them, otherwise they shall be worked on sequentially"`
 }
 
 type ToDoAddItemArgs struct {
-	Items []ToDoItem `json:"items"`
+	Items []ToDoItem `json:"items" jsonschema:"title=items,description="items to add to the TODO list,required""`
 }
 
 func ToDoAddItem(args ToDoAddItemArgs) (string, error) {
@@ -131,13 +101,25 @@
 			Title:       td.Title,
 			Description: td.Description,
 			AssignedTo:  td.AssignedTo,
+			Parallel:    td.Parallel,
 		})
+		ti := item.Items[len(item.Items)-1]
+		for _, s := range td.Items {
+			sid := fmt.Sprintf("%s.%d", id, len(ti.Items)+1)
+			ti.Items = append(ti.Items, &ToDo{
+				ID:          sid,
+				Title:       s.Title,
+				Description: s.Description,
+				AssignedTo:  s.AssignedTo,
+			})
+		}
 	}
 	return "done", nil
 }
 
 type ToDoMarkItemDoneArgs struct {
-	ID string `json:"id"`
+	ID      string `json:"id" jsonschema:"title=id,description=id of the TODO item to mark as DONE,required"`
+	Summary string `json:"summary" jsonschem:"title=summary,description=detailed summary of current item and all of it's sub-item trees.,required"`
 }
 
 func ToDoMarkItemDone(args ToDoMarkItemDoneArgs) (string, error) {
@@ -146,13 +128,14 @@
 		return "error", fmt.Errorf("TODO item with given id not found: %s", args.ID)
 	}
 	item.Done = true
+	item.Summary = args.Summary
 	return "done", nil
 }
 
 type ToDoItemAddCommentArgs struct {
-	ID       string `json:"id"`
-	Comment  string `json:"comment"`
-	AssignTo string `json:"assignTo"`
+	ID       string `json:"id" jsonschema:"title=id,description=id of the TODO item to add comment to,required"`
+	Comment  string `json:"comment" jsonschema:"title=comment,description=actual comment text,required"`
+	AssignTo string `json:"assignTo" jsonschema:"title=assigned to,description=name of the person who shall be assigned to TODO item with given ID, if empty assignment does not chage"`
 }
 
 func ToDoItemAddComment(args ToDoItemAddCommentArgs) (string, error) {
@@ -167,7 +150,9 @@
 		Author:  "assistant",
 		Comment: args.Comment,
 	})
-	item.AssignedTo = args.AssignTo
+	if args.AssignTo != "" {
+		item.AssignedTo = args.AssignTo
+	}
 	return "done", nil
 }