Skip to content

Commit d0221e1

Browse files
committed
feat(todo): add dependency tracking
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 08620ac commit d0221e1

13 files changed

Lines changed: 2830 additions & 463 deletions

README.md

Lines changed: 138 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -816,63 +816,156 @@ mcp:
816816

817817
### ✅ TODO Server
818818

819-
A shared TODO list management server that allows multiple agents to coordinate tasks with states and assignees. Perfect for agent team coordination.
819+
A shared TODO list management server that allows multiple agents to coordinate tasks with states, assignees, and dependencies. Perfect for agent team coordination with dependency management and role-based access control.
820820

821821
**Features:**
822822
- Shared TODO list accessible by multiple agents/processes
823823
- File-based persistence with atomic writes
824824
- File locking for concurrent access safety
825825
- Task states: pending, in_progress, done
826826
- Assignee tracking for task ownership
827+
- **Dependency management** - TODOs can depend on other TODOs
828+
- **Circular dependency detection** - Prevents invalid dependency chains
829+
- **Status validation** - Prevents starting/completing TODOs until dependencies are satisfied
830+
- **Role-based access control** - Admin mode for leader actions, agent mode for self-service
827831
- Full CRUD operations (add, update, remove, list)
828832
- Status summary with counts by state and assignee
833+
- Query ready and blocked TODOs
829834

830835
**Tools:**
831-
- `add_todo` - Add a new TODO item to the shared list
832-
- `update_todo_status` - Update the status of a TODO item (pending, in_progress, or done)
833-
- `update_todo_assignee` - Update the assignee of a TODO item
834-
- `remove_todo` - Remove a TODO item by ID
836+
837+
**Always Available (Agent & Admin):**
835838
- `list_todos` - List all TODO items
836839
- `get_todo_status` - Get a summary of the TODO list with counts by status and assignee
840+
- `get_ready_todos` - Get all TODO items that are ready to start (pending with all dependencies satisfied)
841+
- `get_blocked_todos` - Get all TODO items that are blocked by dependencies
842+
- `get_todo_dependencies` - Get dependencies for a TODO item (direct and optionally transitive)
843+
- `update_todo_status` - Update the status of a TODO item (pending, in_progress, or done)
844+
- In agent mode: Only allows updating TODOs assigned to the agent (requires `agent_name` parameter)
845+
- In admin mode: Allows updating any TODO (no `agent_name` required)
846+
847+
**Admin Only (requires `TODO_ADMIN_MODE=true`):**
848+
- `add_todo` - Add a new TODO item to the shared list
849+
- `remove_todo` - Remove a TODO item by ID
850+
- `update_todo_assignee` - Update the assignee of a TODO item
851+
- `add_todo_dependency` - Add a dependency to a TODO item
852+
- `remove_todo_dependency` - Remove a dependency from a TODO item
837853

838854
**Configuration:**
839855
- `TODO_FILE_PATH` - Environment variable to set the TODO file path (default: `/data/todos.json`)
856+
- `TODO_ADMIN_MODE` - Set to `true` to enable admin-only tools (add, remove, assign, manage dependencies). When not set, only read operations and self-service status updates are available.
840857

841858
**TODO Item Format:**
842859
```json
843860
{
844-
"id": "1703123456789000000",
861+
"id": "task-1",
845862
"title": "Implement feature X",
846863
"status": "in_progress",
847-
"assignee": "agent1"
864+
"assignee": "agent1",
865+
"depends_on": ["task-0"]
848866
}
849867
```
850868

851869
**Add TODO Input Format:**
852870
```json
853871
{
872+
"id": "task-1",
854873
"title": "Implement feature X",
855-
"assignee": "agent1"
874+
"assignee": "agent1",
875+
"depends_on": ["task-0"]
856876
}
857877
```
858878

879+
**Note:** The `id` field is **required** and must be unique. IDs are not auto-generated for predictability.
880+
859881
**Update Status Input Format:**
882+
883+
In admin mode:
860884
```json
861885
{
862-
"id": "1703123456789000000",
886+
"id": "task-1",
863887
"status": "done"
864888
}
865889
```
866890

891+
In agent mode (requires `agent_name`):
892+
```json
893+
{
894+
"id": "task-1",
895+
"status": "done",
896+
"agent_name": "agent1"
897+
}
898+
```
899+
900+
**Dependency Management:**
901+
902+
TODOs can depend on other TODOs. A TODO cannot transition to `in_progress` or `done` until all its dependencies are `done`. The system prevents:
903+
- Circular dependencies (A → B → A)
904+
- Starting/completing TODOs with unsatisfied dependencies
905+
- Removing TODOs that other TODOs depend on
906+
907+
**Get Ready TODOs Output Format:**
908+
```json
909+
{
910+
"items": [
911+
{
912+
"id": "task-2",
913+
"title": "Task 2",
914+
"status": "pending",
915+
"assignee": "agent1",
916+
"depends_on": ["task-1"]
917+
}
918+
],
919+
"count": 1
920+
}
921+
```
922+
923+
**Get Blocked TODOs Output Format:**
924+
```json
925+
{
926+
"items": [
927+
{
928+
"id": "task-3",
929+
"title": "Task 3",
930+
"status": "pending",
931+
"assignee": "agent2",
932+
"blocked_by": [
933+
{
934+
"id": "task-1",
935+
"title": "Task 1",
936+
"status": "pending"
937+
}
938+
]
939+
}
940+
],
941+
"count": 1
942+
}
943+
```
944+
945+
**Get TODO Dependencies Output Format:**
946+
```json
947+
{
948+
"direct": [
949+
{
950+
"id": "task-1",
951+
"title": "Task 1",
952+
"status": "done"
953+
}
954+
],
955+
"direct_count": 1
956+
}
957+
```
958+
867959
**List TODOs Output Format:**
868960
```json
869961
{
870962
"items": [
871963
{
872-
"id": "1703123456789000000",
964+
"id": "task-1",
873965
"title": "Implement feature X",
874966
"status": "in_progress",
875-
"assignee": "agent1"
967+
"assignee": "agent1",
968+
"depends_on": ["task-0"]
876969
}
877970
],
878971
"count": 1
@@ -886,6 +979,8 @@ A shared TODO list management server that allows multiple agents to coordinate t
886979
"pending": 3,
887980
"in_progress": 5,
888981
"done": 2,
982+
"blocked": 2,
983+
"ready": 1,
889984
"by_assignee": {
890985
"agent1": 4,
891986
"agent2": 6
@@ -894,11 +989,20 @@ A shared TODO list management server that allows multiple agents to coordinate t
894989
```
895990

896991
**Docker Image:**
992+
993+
Agent mode (read-only + self-service):
897994
```bash
898995
docker run -e TODO_FILE_PATH=/custom/path/todos.json -v /host/data:/data ghcr.io/mudler/mcps/todo:latest
899996
```
900997

998+
Admin mode (full access):
999+
```bash
1000+
docker run -e TODO_FILE_PATH=/custom/path/todos.json -e TODO_ADMIN_MODE=true -v /host/data:/data ghcr.io/mudler/mcps/todo:latest
1001+
```
1002+
9011003
**LocalAI configuration (to add to the model config):**
1004+
1005+
Agent mode:
9021006
```yaml
9031007
mcp:
9041008
stdio: |
@@ -918,6 +1022,29 @@ mcp:
9181022
}
9191023
```
9201024

1025+
Admin mode:
1026+
```yaml
1027+
mcp:
1028+
stdio: |
1029+
{
1030+
"mcpServers": {
1031+
"todo": {
1032+
"command": "docker",
1033+
"env": {
1034+
"TODO_FILE_PATH": "/data/todos.json",
1035+
"TODO_ADMIN_MODE": "true"
1036+
},
1037+
"args": [
1038+
"run", "-i", "--rm", "-v", "/host/data:/data",
1039+
"ghcr.io/mudler/mcps/todo:master"
1040+
]
1041+
}
1042+
}
1043+
}
1044+
```
1045+
1046+
**Note:** When `TODO_ADMIN_MODE` is not set or set to `false`, only read operations and self-service status updates are available. Agents can only update TODOs assigned to them by providing their `agent_name` in the `update_todo_status` request. Admin mode enables all tools including adding/removing TODOs, managing dependencies, and assigning tasks.
1047+
9211048
### 📬 Mailbox Server
9221049

9231050
A shared mailbox server that enables message exchange between different agents in a team. Each agent instance reads only its own messages while being able to send messages to any agent.

0 commit comments

Comments
 (0)