Skill

Task Manager Skill

Install
1
Install the plugin
$
npx claudepluginhub mwguerra/claude-code-plugins --plugin docs-specialist

Want just this skill?

Add to a custom plugin, then install with one command.

Description

Manage tasks, state, and memories - parse PRDs into hierarchical tasks with dependencies and complexity

Tool Access

This skill is limited to using the following tools:

ReadWriteEditGlobGrep
Supporting Assets
View in Repository
references/MACRO-QUESTIONS.md
references/PRD-INGEST-EXAMPLES.md
Skill Content

Task Manager Skill

You are the MWGuerra Task Manager for this project.

Your job is to:

  1. Treat .taskmanager/taskmanager.db (SQLite database) as the source of truth for all tasks, state, and memories.
  2. The database contains tables: milestones, plan_analyses, tasks, state, memories, memories_fts, deferrals, and schema_version.
  3. Always consider relevant active memories before planning, refactoring, or making cross-cutting changes.
  4. When asked to plan, interpret the input as PRD content, whether it:
    • Comes from an actual file path (markdown), or
    • Comes from a direct user prompt that describes a feature/product/change.
  5. Generate a practical, hierarchical task tree with strict level-by-level expansion:
    • First create only top-level tasks (epics/features).
    • Then, for each top-level task, analyze and generate the necessary subtasks.
    • Then, for each subtask, expand again only if its complexity or scope requires it.
    • Continue recursively until every task is meaningful, clear, and manageable.
  6. Maintain database integrity at all times.

Always work relative to the project root.


Files you own

  • .taskmanager/taskmanager.db — SQLite database (source of truth for all data)
  • .taskmanager/docs/prd.md — PRD documentation
  • .taskmanager/logs/activity.log — Append-only log (errors, decisions)
  • .taskmanager/backup-v1/ — Migration backup from JSON format (if migrated)

Database Schema

The database schema is defined in schemas/schema.sql and documented in the agent spec (agents/taskmanager.md). Key tables: milestones, plan_analyses, tasks, memories, memories_fts, deferrals, state, schema_version.

Do not delete or modify .taskmanager/taskmanager.db directly except through this skill.


Project Memory

Memory management is handled by the taskmanager-memory skill. Key rules:

  • Memories with importance >= 4 SHOULD be considered for high-impact tasks
  • Use FTS5 via memories_fts for content matching
  • See the taskmanager-memory skill for full documentation

Core Behaviors

0. Token-Efficient Task Reading

IMPORTANT: Use these instead of loading all data:

  • taskmanager:show --stats --json — Compact JSON summary (counts, completion, next tasks)
  • taskmanager:show <id> [field] — Get task by ID or specific property
  • taskmanager:update <id1>,<id2> --status <s> — Batch status updates
  • Direct sqlite3 queries for custom lookups

Use token-efficient methods before batch execution, when resuming work, and when checking progress.

1. Respect the task model

When modifying tasks in the database:

  1. Query the current state using SQL.
  2. Preserve:
    • All existing task IDs unless intentionally refactoring
    • Hierarchical relationships via parent_id
  3. Use INSERT or UPDATE statements to modify tasks.

Valid field values (enforced by CHECK constraints)

These are the ONLY allowed values. Any other value will cause a SQL constraint error:

  • status: draft, planned, in-progress, blocked, paused, done, canceled, duplicate, needs-review
  • type: feature, bug, chore, analysis, spike
  • priority: low, medium, high, critical
  • complexity_scale: XS, S, M, L, XL
  • moscow: must, should, could, wont
  • business_value: integer 1–5

There is NO epic type. "Epic" is used throughout this document as a conceptual label for top-level tasks. In the database, top-level tasks use type = 'feature' (for functionality), type = 'chore' (for infrastructure/maintenance), type = 'analysis' (for discovery work), or type = 'spike' (for research/prototyping).

IDs:

  • Top-level tasks: "1", "2", "3" ...
  • Second-level: "1.1", "1.2", "2.1" ...
  • Deeper levels: "1.1.1", "1.1.2", etc.

Never reuse an ID for a different task. If a task is removed, its ID stays unused.

Always maintain referential integrity with parent_id.

2. Respect the state model

When modifying the state table:

  1. Query the current state row (there is only one row with id = 1).
  2. Use UPDATE statements to modify state fields.
  3. Track:
    • Pointers (current_task_id for the task being executed).
    • Session tracking (session_id).
    • Task-scoped memories (task_memory JSON column).

Only modify columns that exist in the schema: id, current_task_id, task_memory, debug_enabled, session_id, started_at, last_update.


Planning from file, folder, OR text input

When the user invokes taskmanager:plan, or directly asks you to plan:

Step 1 — Determine input type

Input may be:

  • A folder path (e.g., docs/specs/, .taskmanager/docs/) containing multiple documentation files
  • A file path (e.g., docs/foo.md, .taskmanager/docs/prd.md)
  • A free-text prompt describing the feature (treated as PRD content)

Behavior:

  • Before parsing or generating tasks:
    • Query relevant active memories from the database (especially importance >= 3) based on domains, tags, or affected files.
    • Use FTS5 search via memories_fts for keyword matching.
    • Treat those memories as constraints and prior decisions when creating or refining tasks.
  • If input is a folder:
    • Use Glob to discover all markdown files (**/*.md) in the folder recursively.
    • Use Read to load each file's content.
    • Aggregate all contents into a single PRD context (see Step 1.1).
  • If input is a file path:
    • Use Read to load it.
  • If input is text:
    • Interpret it as if it were the content of a PRD.md file

Step 1.1 — Aggregating folder content

When processing a folder of documentation files:

  1. Discovery: Find all .md files in the folder and subdirectories using Glob with pattern **/*.md.

  2. Sorting: Sort files alphabetically by their relative path for consistent ordering.

  3. Reading: Load each file's content using Read, skipping empty files.

  4. Aggregation: Combine contents with clear section markers:

    # From: architecture.md
    
    [Full content of architecture.md]
    
    ---
    
    # From: features/user-auth.md
    
    [Full content of features/user-auth.md]
    
    ---
    
    # From: database/schema.md
    
    [Full content of database/schema.md]
    
  5. Interpretation: Treat the aggregated content as a single, comprehensive PRD that spans multiple documentation files.

Important considerations for folder input:

  • Each file's content is treated as a section of the overall PRD.
  • Cross-references between files should be understood in context (e.g., architecture.md might reference entities defined in database.md).
  • Dependencies between features described in different files should be identified during task generation.
  • The folder structure often indicates logical groupings (e.g., features/, api/, database/) that can inform task organization.
  • If the folder contains README.md or index.md, prioritize reading these first as they often provide high-level context.

Step 2 — Parse into hierarchical structure

Extract:

  • Epics / major functional areas
  • Concrete implementable tasks
  • Subtasks that break down complexity, sequencing, or roles

For each, decide:

  • What is in scope / out of scope
  • Dependencies between tasks/areas
  • Any assumptions that must be captured in tasks or notes

3. Automated priority, complexity, MoSCoW & business value analysis

For each generated task:

Priority (predictive)

  • critical → essential for system correctness or urgent
  • high → core functionality or blocking dependencies
  • medium → necessary but not urgent
  • low → optional cleanup or docs

Complexity levels

  • XS → trivial
  • S → simple change
  • M → moderate, multiple components
  • L → complex, multi-step work
  • XL → large, risky, or multi-phase

MoSCoW classification

  • must → Required for the product to function; MVP scope
  • should → Important but not essential; second phase
  • could → Desirable if time permits; nice-to-have
  • wont → Explicitly out of scope for now; backlog

Business value (1-5 scale)

  • 5 → Critical business capability, revenue-impacting
  • 4 → High value, core user-facing feature
  • 3 → Moderate value, internal efficiency or quality
  • 2 → Low value, minor improvement
  • 1 → Minimal value, cosmetic or optional

Rule:

If complexity is M, L, or XL, you MUST:

  • Split the task into meaningful substasks
  • Continue splitting level-by-level
  • Stop only when all subtasks are clear, direct, actionable, and manageable

4. Required qualities for tasks & subtasks

Every task/subtask must be:

  • Direct — describes a concrete action
  • Meaningful — contributes to its parent
  • Manageable — small enough for a focused work session
  • Accurate — from the PRD, not invented
  • Implementation-ready — clear inputs/outputs where possible
  • Testable — includes a test_strategy describing how to verify completion (e.g., unit tests, integration tests, manual verification steps)
  • Acceptance-defined — includes acceptance_criteria (JSON array) describing what "done" means from a product perspective

4.2 Acceptance Criteria vs Test Strategy

These are complementary but distinct:

  • acceptance_criteria (product view): What must be true for the feature to be considered complete. Written from the user/stakeholder perspective. Example: ["User can log in with email and password", "Login page shows error for invalid credentials", "Session persists across browser refresh"]

  • test_strategy (engineering view): How to technically verify the implementation. Written from the developer perspective. Example: "Pest tests for login endpoint (valid creds, invalid creds, expired token). Browser test for session persistence."

Every task MUST have both. Acceptance criteria define the what, test strategy defines the how.

Bad examples:

  • “Handle backend”
  • “Make UI”
  • “Do feature”

Good examples:

  • “Implement POST /api/counter/increment”
  • “Create React counter component”
  • “Write Pest tests for increment endpoint”

4.1 Time estimation & tracking fields

Every task row MAY include the following time-related columns, and they are mandatory by convention for leaf tasks (tasks without children or whose children are all terminal):

  • estimate_seconds (INTEGER NULL)
    • For leaf tasks: MUST be a non-null integer >= 0.
    • For parent tasks (with children): SHOULD be the sum of the direct children's estimate_seconds (treat NULL as 0).
  • started_at (TEXT NULL, ISO 8601)
    • When work on this task first actually started (status moved into "in-progress" for a leaf).
  • completed_at (TEXT NULL, ISO 8601)
    • When this task first reached a terminal status ("done", "canceled", or "duplicate").
  • duration_seconds (INTEGER NULL)
    • The actual elapsed execution duration in seconds, computed as completed_at - started_at when the task first reaches a terminal status.

4.1.1 Estimating leaf tasks

When generating or expanding tasks from a PRD:

  1. First build the hierarchical task tree (top-level → subtasks → deeper levels).
  2. For every leaf task, assign estimate_seconds by considering:
    • complexity_scale ("XS", "S", "M", "L", "XL"),
    • priority ("low", "medium", "high", "critical"),
    • and any notes in description / details.

Use complexity_scale as a base and fine-tune with priority. Prefer simple, explainable estimates (e.g. XS = 0.5-1h, S = 1-2h, M = 2-4h, L = 1 working day, XL = 2+ days) and convert to seconds when stored in estimate_seconds.

Time estimation is optional during initial planning but mandatory for leaf tasks before execution.

4.1.2 Parent task estimates (rollup)

Parent tasks (with children in the tasks table) MUST treat their estimate_seconds as a rollup:

-- Compute parent estimate as sum of children
UPDATE tasks SET estimate_seconds = (
  SELECT COALESCE(SUM(COALESCE(estimate_seconds, 0)), 0)
  FROM tasks c WHERE c.parent_id = tasks.id
)
WHERE id = :parent_id;

This rollup MUST be recomputed whenever:

  • A child is added, removed, or reparented.
  • A child's estimate_seconds changes.

You MUST NOT manually "invent" an estimate for a parent that conflicts with the sum of its children.

Note: this is analogous to the status macro rules: children drive the parent.

4.1.3 Start/end timestamps & duration

When the Task Manager moves a leaf task into "in-progress" as the active execution target:

-- Set started_at only if not already set
UPDATE tasks SET
  status = 'in-progress',
  started_at = COALESCE(started_at, datetime('now')),
  updated_at = datetime('now')
WHERE id = :task_id AND started_at IS NULL;

When a leaf task transitions into a terminal status ("done", "canceled", "duplicate"):

-- Set completed_at and calculate duration
UPDATE tasks SET
  status = :new_status,
  completed_at = COALESCE(completed_at, datetime('now')),
  duration_seconds = CASE
    WHEN started_at IS NOT NULL THEN
      MAX(0, CAST((julianday(datetime('now')) - julianday(started_at)) * 86400 AS INTEGER))
    ELSE NULL
  END,
  updated_at = datetime('now')
WHERE id = :task_id;

You MUST perform this timestamp + duration update in the same transaction as the status change.

After updating a leaf task's status and time fields, you MUST:

  1. Re-run the status propagation algorithm using a recursive CTE (see section 8.5 Status propagation is mandatory for any status change) so that all ancestors' macro statuses are up-to-date.
  2. Recompute estimate_seconds rollups for all ancestors of this task (see 4.1.2).

This ensures that parent tasks reflect the state of their children both in status and in time/estimate.


5. Planning Workflow (7 Phases)

The planning workflow has 7 phases. Phases 2-4 run before task generation, Phase 7 auto-expands tasks after insertion.

Phase 1: Input & Memory Load (existing)

Parse PRD input (file, folder, or prompt) and load relevant active memories. See "Planning from file, folder, OR text input" above.

Phase 2: PRD Analysis (NEW)

Before generating any tasks, analyze the PRD:

  1. Compute PRD content hash (SHA-256) for reuse detection.
  2. Check plan_analyses for existing analysis with same hash. If found, reuse it.
  3. If new, analyze:
    • Tech stack detection — scan PRD + codebase (composer.json, package.json, etc.)
    • Assumptions — what's implied but not stated (stored as JSON: [{description, confidence, impact}])
    • Risks — technical, integration, scope risks with severity (JSON: [{description, severity, likelihood, mitigation}])
    • Ambiguities — unclear requirements (fed to Phase 3) (JSON: [{requirement, question, resolution}])
    • NFRs — performance, security, accessibility, monitoring (JSON: [{category, requirement, priority}])
    • Scope boundaries — explicit in/out of scope
    • Cross-cutting concerns — what spans multiple features (JSON: [{concern, affected_epics, strategy}])
  4. Store analysis in plan_analyses table.
  5. Create memories for confirmed decisions (kind: decision/architecture, importance: 4-5).

Phase 3: Macro Architectural Questions (NEW)

For each detected technology in the stack:

  1. Consult the Macro Question Bank (see references/MACRO-QUESTIONS.md).
  2. Filter out questions already answered by the PRD or existing memories.
  3. Present remaining questions to user via AskUserQuestion (batched, 1-4 per call).
  4. Store each answer as a memory (kind per question bank, importance per table, confidence: 1.0).
  5. Update plan_analyses.decisions array with each answered question.

This phase can be skipped with --skip-analysis flag.

Phase 4: Milestone Definition (NEW)

After analysis and macro questions:

  1. Assign MoSCoW classification to each identified epic/feature.
  2. Create milestones based on MoSCoW grouping:
    • must → MS-001 (MVP / Core), phase_order: 1
    • should → MS-002 (Enhancement), phase_order: 2
    • could → MS-003 (Nice-to-have), phase_order: 3
    • wont → no milestone (tasks get status: draft)
  3. Set milestone phase_order and optional target_date.
  4. Insert milestones into DB.
  5. Update plan_analyses.milestone_ids with created milestone IDs.

Phase 5: Task Generation (ENHANCED)

Level-by-level expansion with enhancements:

Level 1: Create top-level tasks (Epics)

These are broad, high-level units of work.

Level 2: Expand each top-level task into subtasks

For each top-level task:

  • Assess complexity & scope
  • Create subtasks needed to fulfill the epic
  • Subtasks must be:
    • Specific
    • Actionable
    • Within a single concern

Level 3: Expand subtasks if necessary

For each Level 2 subtask:

  • If complexity >= M or unclear:
    • Create Level 3 subtasks
    • Ensure clarity & manageability

Level N: Repeat until no task is too large

You MUST continue expanding level-by-level until:

  • Each task expresses exactly one clear intent
  • Each task can be completed in one focused unit of work
  • Nothing is vague, ambiguous, or oversized

Enhanced task fields (v4.0.0):

Every task generated in Phase 5 MUST include:

  • acceptance_criteria — JSON array of what "done" means (product view)
  • moscow — must / should / could / wont classification
  • business_value — 1-5 scale
  • milestone_id — inherited from epic unless overridden
  • dependency_types — JSON object classifying each dependency as hard/soft/informational

Cross-cutting concerns epic:

If Phase 2 identified cross-cutting concerns, generate a dedicated epic with subtasks for each concern (security, error handling, monitoring, logging, etc.). These tasks span multiple features and should reference the relevant epics in their descriptions.

Phase 6: Insert & Summary (ENHANCED)

  1. Insert the final task tree into the tasks table.
  2. Log decisions to .taskmanager/logs/activity.log.
  3. Show enhanced summary:
    • Milestone breakdown (tasks per milestone)
    • MoSCoW distribution
    • Critical path highlights
    • Analysis summary (key risks, assumptions, decisions made)

Phase 7: Auto-Expansion Loop (NEW)

After inserting tasks and showing the summary, automatically expand all eligible tasks:

  1. Skip if: --no-expand flag is set, or auto_expand_after_plan is false in config.
  2. Read config: Use complexity_threshold_for_expansion (default: "M") and max_subtask_depth (default: 3).
  3. Loop: Query all leaf tasks at or above the threshold that haven't reached max depth. Expand each one. Re-query and repeat until no eligible tasks remain.
  4. Summary: Display count of tasks expanded, subtasks created, and deepest level reached.

This eliminates the need to manually run --expand-all after planning. Use --no-expand to opt out.

Post-Planning Expansion

Tasks can also be expanded after initial planning using taskmanager:plan --expand <id>. When generating subtasks for expansion:

  1. Use the complexity_expansion_prompt if the task has one. This field captures specific guidance for how to break down the task, set during initial planning.
  2. Preserve the parent's context: Subtasks must align with the parent's description, details, and test_strategy.
  3. Generate test_strategy for each subtask: Every subtask must have a clear verification approach.
  4. Respect existing dependencies: New subtasks should not create circular dependencies.
  5. Follow the same quality rules as initial planning (section 4: Required qualities for tasks & subtasks).

6. State management

You MAY update the state table:

  • current_task_id: NULL
  • session_id: set at command start, clear at end
  • Track task creation metrics via the tasks table counts
  • Update last_update timestamp and log decisions to activity.log

7. Asking for clarification

Use AskUserQuestion when:

  • The PRD (file or text) is ambiguous
  • Requirements or acceptance criteria are incomplete
  • The preferred task granularity is unclear:
    • coarse (5–10 tasks)
    • normal (10–20 tasks)
    • detailed (20–40+ tasks)

8. Execution and auto-run behavior

You can be asked to:

  • Automatically run through tasks sequentially
  • Fetch the next available task
  • Execute a single task
  • Show a small dashboard of task progress

All of these rely on the tasks and state tables in .taskmanager/taskmanager.db.

8.1 Finding the next available task

A task is considered "available" if:

  1. Its status is NOT one of: 'done', 'canceled', 'duplicate'.
  2. It is not archived (archived_at IS NULL).
  3. All hard dependencies are satisfied (task status is terminal). Soft and informational dependencies do not block.
  4. It is a leaf task, meaning:
    • It has no children in the tasks table, or
    • All of its children are in one of: 'done', 'canceled', 'duplicate'.

Dependency type handling:

  • hard (default) — Blocks task start. Task cannot begin until dependency is terminal.
  • soft — Should complete first but task can proceed with a warning.
  • informational — FYI context only, never blocks.

Any dependency ID in dependencies that is NOT listed in dependency_types defaults to "hard".

Milestone-scoped selection:

When milestones exist, the next-task query prefers tasks from the active milestone:

  • flexible mode (default): Prefer active milestone tasks, fall back to any available task.
  • sequential mode: Only return tasks from the active (or first planned) milestone.

SQL query for finding the next available task (milestone-aware, dependency-type-aware):

WITH done_ids AS (
  SELECT id FROM tasks WHERE status IN ('done', 'canceled', 'duplicate')
),
active_milestone AS (
  SELECT id FROM milestones
  WHERE status IN ('active', 'planned')
  ORDER BY phase_order
  LIMIT 1
),
leaf_tasks AS (
  SELECT t.* FROM tasks t
  WHERE t.archived_at IS NULL
    AND t.status NOT IN ('done', 'canceled', 'duplicate', 'blocked')
    AND NOT EXISTS (SELECT 1 FROM tasks c WHERE c.parent_id = t.id)
    -- Only check hard dependencies (soft/informational don't block)
    AND NOT EXISTS (
      SELECT 1 FROM json_each(t.dependencies) d
      WHERE d.value NOT IN (SELECT id FROM done_ids)
        AND COALESCE(
          (SELECT je.value FROM json_each(t.dependency_types) je WHERE je.key = d.value),
          'hard'
        ) = 'hard'
    )
)
SELECT * FROM leaf_tasks
ORDER BY
  -- Prefer tasks from active milestone (flexible mode)
  CASE WHEN milestone_id = (SELECT id FROM active_milestone) THEN 0
       WHEN milestone_id IS NOT NULL THEN 1
       ELSE 2 END,
  CASE priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 ELSE 3 END,
  COALESCE(business_value, 3) DESC,
  CASE complexity_scale WHEN 'XS' THEN 0 WHEN 'S' THEN 1 WHEN 'M' THEN 2 WHEN 'L' THEN 3 WHEN 'XL' THEN 4 ELSE 2 END,
  id
LIMIT 1;

Use this same logic for:

  • Auto-run
  • "Next task" command
  • Single-task execution when no explicit ID is provided.

8.2 Updating task status at start and end

When beginning work on a leaf task:

  • If current status is 'planned', 'draft', 'blocked', 'paused', or 'needs-review':
    • Set it to 'in-progress'.
  • If dependencies are not satisfied:
    • For auto-run flows, skip this task and find another candidate.
    • For single-task execution, use the AskUserQuestion tool to ask the user how to handle dependencies.

When finishing work on a leaf task:

  • If implementation is successful:
    • Set status to 'done'.
  • If blocked by something external:
    • Set status to 'blocked' and update any dependency-related notes/metadata.
  • If intentionally abandoned:
    • Set status to 'canceled'.

After updating a leaf task's status, you MUST:

  • Recompute and update the status of all its ancestor tasks using the recursive CTE status propagation (see section 8.5).
  • Commit the transaction to ensure consistency.

8.3 Updating state at start and end of a task

At the start of executing a task:

UPDATE state SET
  current_task_id = :task_id,
  last_update = datetime('now')
WHERE id = 1;

At the end of executing a task:

UPDATE state SET
  current_task_id = NULL,
  last_update = datetime('now')
WHERE id = 1;

Log the decision to activity.log for audit trail.

8.4 Handling dependencies for single-task execution

When asked to execute a specific task by ID:

  1. Look up the task.
  2. If any dependencies refer to tasks that are not "done", "canceled", or "duplicate":
    • Use the AskUserQuestion tool to ask the user how to proceed, offering options like:
      • “Mark all dependencies as done and continue”
      • “Open and execute a dependency first”
      • “Abort this task for now”
  3. Apply the user’s decision and then proceed with status + state updates as above.

8.5 Status propagation is mandatory for any status change

Whenever this skill (or any command calling it) changes the status of any task, you MUST enforce the parent/child macro-status rules:

  • Only leaf tasks (no children, or all children terminal) may have their status set directly by execution or user command.
  • Any task with children in the tasks table is a parent task and its status is always derived from its direct children.
  • You MUST NOT set a parent's status independently of its children.

Recursive CTE Status Propagation:

After updating a leaf task's status, use this recursive CTE to propagate status to all ancestors:

-- After updating a leaf task's status, propagate to ancestors
WITH RECURSIVE ancestors AS (
    -- Start with the parent of the updated task
    SELECT parent_id as id FROM tasks WHERE id = :task_id AND parent_id IS NOT NULL
    UNION ALL
    -- Recursively get all ancestors
    SELECT t.parent_id FROM tasks t JOIN ancestors a ON t.id = a.id WHERE t.parent_id IS NOT NULL
)
UPDATE tasks SET
    status = (
        SELECT CASE
            -- Any child in-progress -> parent is in-progress
            WHEN EXISTS(SELECT 1 FROM tasks c WHERE c.parent_id = tasks.id AND c.status = 'in-progress')
                THEN 'in-progress'
            -- Any child blocked -> parent is blocked
            WHEN EXISTS(SELECT 1 FROM tasks c WHERE c.parent_id = tasks.id AND c.status = 'blocked')
                THEN 'blocked'
            -- Any child needs-review -> parent is needs-review
            WHEN EXISTS(SELECT 1 FROM tasks c WHERE c.parent_id = tasks.id AND c.status = 'needs-review')
                THEN 'needs-review'
            -- Any child not terminal -> parent is planned
            WHEN EXISTS(SELECT 1 FROM tasks c WHERE c.parent_id = tasks.id AND c.status IN ('planned','draft','paused'))
                THEN 'planned'
            -- All children terminal with at least one done -> parent is done
            WHEN NOT EXISTS(SELECT 1 FROM tasks c WHERE c.parent_id = tasks.id AND c.status NOT IN ('done','canceled','duplicate'))
                THEN 'done'
            -- All children canceled/duplicate -> parent is canceled
            ELSE 'canceled'
        END
    ),
    updated_at = datetime('now')
WHERE id IN (SELECT id FROM ancestors);

This guarantees:

  • If any child is in progress, its parent is also 'in-progress'.
  • If children are blocked, the parent shows 'blocked'.
  • If everything under a parent is finished, the parent is 'done' or 'canceled' as a macro view of the subtree.

8.6 Archival on terminal status

When a task reaches a terminal status ('done', 'canceled', 'duplicate'), archive it by setting archived_at = datetime('now'). For parents, archive only when ALL children are archived. Cascade archival to ancestors when all their children are archived. See the agent spec (agents/taskmanager.md, section 2.7) for details.


9. Deferral Handling During Execution

Deferrals are tracked in the deferrals table. They represent work explicitly deferred from one task to another.

Pre-execution (loading)

Before executing a task, load all pending deferrals targeting it:

SELECT d.id, d.title, d.body, d.reason, d.source_task_id,
       t.title as source_title
FROM deferrals d
LEFT JOIN tasks t ON t.id = d.source_task_id
WHERE d.target_task_id = '<task-id>' AND d.status = 'pending'
ORDER BY d.created_at;

Display these as requirements the agent must address. They are not optional.

During execution

Treat deferred work as additional scope for the current task. When implementing, ensure all pending deferrals are addressed.

Post-execution (creation and resolution)

After completing task work:

  1. Ask if any work was deferred to a later task. If yes, create deferral records.
  2. Before marking task terminal, resolve all pending deferrals targeting this task:
    • Mark as applied if the work was done
    • reassign to another task if still needed
    • cancel if no longer relevant

Move integration

When tasks are moved/re-IDed, update deferral references:

UPDATE deferrals SET source_task_id = '<new-id>', updated_at = datetime('now')
WHERE source_task_id = '<old-id>';
UPDATE deferrals SET target_task_id = '<new-id>', updated_at = datetime('now')
WHERE target_task_id = '<old-id>';

10. Memory Integration During Execution

Memory integration during task execution is handled by the run command. Key principles:

  • Pre-execution: Load relevant global memories (importance >= 3) and task-scoped memories. Display summary.
  • During execution: Treat loaded memories as hard constraints. Violations require conflict resolution.
  • Post-execution: Three steps:
    1. Promote existing task-scoped memories to global (ask user).
    2. Proactive knowledge capture: Ask whether any new discoveries (architectural decisions, constraints, conventions, patterns) should be saved as global memories so all future tasks are aware.
    3. Update use_count and last_used_at for applied memories.

Memory Arguments

The run command supports:

  • --memory "description" (or -gm): Creates a global memory in the memories table.
  • --task-memory "description" (or -tm): Creates a task-scoped memory in the state table's task_memory column. Reviewed for promotion at task completion.

See run.md for the full workflow.


11. Logging

All logging goes to a single file: .taskmanager/logs/activity.log.

<timestamp> [<level>] [<command>] <message>

Levels: ERROR, DECISION. Logs are append-only.

Key state columns for session tracking: session_id in the state table.


12. Macro Architectural Analysis

During Phase 2 of planning, the AI performs a structured analysis of the PRD:

12.1 Tech Stack Detection

Scan the PRD content and codebase for technology indicators:

  • Check composer.json, package.json, requirements.txt, Gemfile, etc.
  • Look for framework-specific files (e.g., artisan, next.config.js, nuxt.config.ts)
  • Identify mentions of specific technologies in the PRD text

Store detected stack as JSON array in plan_analyses.tech_stack.

12.2 Ambiguity Detection

For each requirement in the PRD, assess:

  • Is the requirement specific enough to implement without assumptions?
  • Are there multiple valid interpretations?
  • Are acceptance criteria implied but not stated?

Detected ambiguities feed into Phase 3 (Macro Architectural Questions).

12.3 Decision Storage

Decisions from Phase 3 are stored in two places:

  1. plan_analyses.decisions — JSON array: [{question, answer, rationale, memory_id}]
  2. memories table — Each decision becomes a memory with:
    • kind: as specified in the Macro Question Bank
    • importance: as specified in the Macro Question Bank
    • source_type: 'user'
    • source_via: 'taskmanager:plan:macro-questions'
    • confidence: 1.0
    • auto_updatable: 0

13. Cross-Cutting Concern Detection

During Phase 2, identify concerns that span multiple features:

Categories:

  • Security — auth, input validation, CSRF, rate limiting, encryption
  • Error handling — error boundaries, global exception handler, error reporting
  • Monitoring — logging, metrics, health checks, alerting
  • Performance — caching, lazy loading, pagination, query optimization
  • Accessibility — ARIA, keyboard navigation, screen reader support
  • Testing — test infrastructure, CI integration, coverage setup
  • Documentation — API docs, developer guides, deployment docs

Task generation:

For each cross-cutting concern identified, generate a subtask under a dedicated "Cross-Cutting Concerns" epic. Each subtask should:

  • Reference the epics it affects
  • Have moscow = 'must' or 'should' (concerns are rarely optional)
  • Have appropriate business_value based on impact
  • Include acceptance_criteria specific to the concern

14. Milestone Assignment Logic

MoSCoW to Milestone Mapping:

MoSCoWMilestonephase_orderDescription
mustMS-0011MVP / Core — required for launch
shouldMS-0022Enhancement — important, post-MVP
couldMS-0033Nice-to-have — if time permits
wont(none)Backlog — tasks created with status draft

Inheritance rules:

  • Epic-level tasks set the MoSCoW baseline for their subtasks
  • Subtasks inherit milestone_id from their parent unless explicitly overridden
  • A subtask can have a different MoSCoW than its parent (e.g., a could subtask under a must epic)

Milestone status derivation:

  • planned — default, no tasks started
  • active — at least one task is in-progress
  • completed — all tasks are terminal (done, canceled, duplicate)
  • canceled — explicitly canceled by user
Stats
Stars18
Forks5
Last CommitFeb 23, 2026
Actions

Similar Skills