Autonomously execute multiple tasks in sequence with memory support and conflict resolution
Executes multiple tasks sequentially with memory support and conflict detection.
/plugin marketplace add mwguerra/claude-code-plugins/plugin install docs-specialist@mwguerra-marketplace[max-tasks] [--memory "global memory"] [--task-memory "temp memory"] [--debug]You are implementing taskmanager:run-tasks.
$1 (optional): Maximum number of tasks to execute in this run (default: 3-5)--memory "description" or -gm "description": Add a global memory (persists to memories.json, applies to all tasks)--task-memory "description" or -tm "description": Add a batch task memory (applies to all tasks in this run, reviewed at batch end)--debug or -d: Enable verbose debug logging to .taskmanager/logs/debug.logsess-$(date +%Y%m%d%H%M%S) (e.g., sess-20251212103045).--debug / -d flag..taskmanager/state.json:
logging.sessionId to the generated ID.logging.debugEnabled = true if --debug flag present, else false.decisions.log:
<timestamp> [DECISION] [<session-id>] Started run-tasks batch (max: $1 tasks)
Parse arguments:
$1 (default: 3-5 if not provided).--memory / -gm value if provided.--task-memory / -tm value if provided.--debug / -d flag if provided.Process memory arguments at batch start:
--memory is provided:
taskmanager-memory skill to create a new global memory in .taskmanager/memories.json.source.type = "user", source.via = "run-tasks".importance = 3, confidence = 0.9, status = "active".--task-memory is provided:
.taskmanager/state.json → taskMemory[] with taskId = "*" (applies to all tasks in batch):
{
"content": "<the description>",
"addedAt": "<current ISO timestamp>",
"taskId": "*",
"source": "user"
}
Initialize deferred data:
deferredConflicts = [] (conflicts to present at batch end).executedTasks = [] (track what was executed).For each iteration up to the limit:
IMPORTANT: When the tasks.json file is large (exceeds ~25k tokens), you MUST use the token-efficient commands:
Use stats command to get next tasks:
taskmanager:stats --next5
This returns the next 5 recommended tasks without loading the full file.
Use get-task command for specific task details:
taskmanager:get-task <id> [key]
Use this when you need to read specific task properties without loading the full file:
taskmanager:get-task 1.2.3 titletaskmanager:get-task 1.2.3 statustaskmanager:get-task 1.2.3 complexity.scaleWhen to read full file: Only read .taskmanager/tasks.json with the Read tool if:
Standard approach (for small files):
taskmanager skill to read .taskmanager/tasks.json and .taskmanager/state.json.taskmanager-memory skill to query relevant memories for this task..taskmanager/memories.json:
status = "active".scope.tasks, scope.domains, scope.files, importance >= 3.state.json.taskMemory[]:
taskId == <current task id> or taskId == "*".deferredConflicts[].state.json.appliedMemories[].useCount and update lastUsedAt for each applied memory.status to "in-progress" if appropriate..taskmanager/state.json:
currentStep = "execution"mode = "autonomous"currentTaskId = <task id>currentSubtaskPath = <task id>lastUpdate / lastDecisiondeferredConflicts[]."*" memories):
taskId == <task id>):
taskMemory[].state.json.appliedMemories[].status based on outcome:
"done", "blocked", or "canceled" as appropriate.taskmanager:update-status <status> <id> for quick status updates without loading the full file. Example: taskmanager:update-status done 1.2.3"done", "canceled", or "duplicate":
.taskmanager/tasks-archive.json.tasks.json..taskmanager/state.json:
currentTaskId = null if not immediately chaining to another task.currentSubtaskPath = nullcurrentStep = "idle" or continue to next iteration.lastUpdate / lastDecision.executedTasks[].After finishing or reaching the limit:
Review batch task memories (where taskId == "*"):
"*" task memories exist:
"*" task memories from taskMemory[].Present deferred conflicts (if any):
Summarize:
Cleanup logging session:
decisions.log:
<timestamp> [DECISION] [<session-id>] Completed run-tasks batch: N tasks executed, M remaining
.taskmanager/state.json:
logging.debugEnabled = falselogging.sessionId = nullThroughout batch execution, this command MUST log:
To errors.log (ALWAYS):
To decisions.log (ALWAYS):
To debug.log (ONLY when --debug enabled):
Whenever this command changes the status of any leaf task, it MUST also update the status of all its ancestor tasks so that parents reflect the aggregate state of their subtasks.
Conceptual algorithm (per parent, based on its direct children):
For the parent, collect the status of all its direct subtasks.
Apply these precedence rules in order:
If any child is "in-progress"
→ parent status = "in-progress".
Else if no child is "in-progress" and any child is "blocked"
→ parent status = "blocked".
Else if no child is "in-progress" or "blocked" and any child is "needs-review"
→ parent status = "needs-review".
Else if no child is "in-progress", "blocked", or "needs-review" and any child is in:
"planned", "draft", "todo", "paused"
→ parent status = "planned" (macro “not-started / planned” state).
Else if all children are in {"done", "canceled", "duplicate"}:
"done" → parent status = "done"."canceled" or "duplicate") → parent status = "canceled".After computing the parent’s new status, repeat this algorithm for its parent, and so on, up to the root.
Implementation notes:
.taskmanager/tasks.json after propagation so other commands see consistent macro statuses.