npx claudepluginhub mwguerra/claude-code-plugins --plugin docs-specialist[file-path-or-folder-or-prompt] [--expand <id>] [--expand-all] [--no-expand] [--research] [--skip-analysis] [--milestones]You are implementing the taskmanager:plan command.
$1 (optional): path to a PRD file, a folder containing documentation files, or a prompt describing what to plan. If omitted, use .taskmanager/docs/prd.md.--research: Research key topics from the PRD before generating tasks (uses taskmanager:research internally)--expand <id>: Expand a single task into subtasks (post-planning)--expand-all [--threshold <XS|S|M|L|XL>]: Expand all eligible tasks above threshold (default: M)--force: Re-expand tasks that already have subtasks--estimate: Generate time estimates (not default during expansion)--skip-analysis: Bypass Phases 2-4 (PRD analysis, macro questions, milestones) for quick re-planning--no-expand: Skip the automatic post-plan expansion loop (Phase 7). By default, all eligible tasks are auto-expanded after initial planning.--milestones (default: on): Control milestone generation. Use --no-milestones to disable.This command uses SQLite database at .taskmanager/taskmanager.db.
Schema reference for tasks table:
CREATE TABLE tasks (
id TEXT PRIMARY KEY,
parent_id TEXT REFERENCES tasks(id) ON DELETE CASCADE,
title TEXT NOT NULL,
description TEXT,
details TEXT,
test_strategy TEXT,
status TEXT NOT NULL DEFAULT 'planned'
CHECK (status IN ('draft', 'planned', 'in-progress', 'blocked', 'paused', 'done', 'canceled', 'duplicate', 'needs-review')),
type TEXT NOT NULL DEFAULT 'feature'
CHECK (type IN ('feature', 'bug', 'chore', 'analysis', 'spike')),
priority TEXT NOT NULL DEFAULT 'medium'
CHECK (priority IN ('low', 'medium', 'high', 'critical')),
complexity_scale TEXT CHECK (complexity_scale IN ('XS', 'S', 'M', 'L', 'XL')),
complexity_reasoning TEXT,
complexity_expansion_prompt TEXT,
estimate_seconds INTEGER,
duration_seconds INTEGER,
owner TEXT,
started_at TEXT,
completed_at TEXT,
archived_at TEXT,
tags TEXT DEFAULT '[]',
dependencies TEXT DEFAULT '[]',
dependency_analysis TEXT,
meta TEXT DEFAULT '{}',
milestone_id TEXT REFERENCES milestones(id),
acceptance_criteria TEXT DEFAULT '[]',
moscow TEXT CHECK (moscow IN ('must', 'should', 'could', 'wont')),
business_value INTEGER CHECK (business_value BETWEEN 1 AND 5),
dependency_types TEXT DEFAULT '{}',
created_at TEXT DEFAULT (datetime('now')),
updated_at TEXT DEFAULT (datetime('now'))
);
IMPORTANT — Valid values enforced by CHECK constraints:
status: draft, planned, in-progress, blocked, paused, done, canceled, duplicate, needs-reviewtype: feature, bug, chore, analysis, spike — there is NO epic type; top-level tasks (epics) use type = 'feature' or 'chore'priority: low, medium, high, criticalcomplexity_scale: XS, S, M, L, XLmoscow: must, should, could, wontbusiness_value: integer 1–5Schema reference for milestones table:
CREATE TABLE milestones (
id TEXT PRIMARY KEY,
title TEXT NOT NULL,
description TEXT,
acceptance_criteria TEXT DEFAULT '[]',
target_date TEXT,
status TEXT NOT NULL DEFAULT 'planned'
CHECK (status IN ('planned', 'active', 'completed', 'canceled')),
phase_order INTEGER NOT NULL,
created_at TEXT DEFAULT (datetime('now')),
updated_at TEXT DEFAULT (datetime('now'))
);
Schema reference for plan_analyses table:
CREATE TABLE plan_analyses (
id TEXT PRIMARY KEY,
prd_source TEXT NOT NULL,
prd_hash TEXT,
tech_stack TEXT DEFAULT '[]',
assumptions TEXT DEFAULT '[]',
risks TEXT DEFAULT '[]',
ambiguities TEXT DEFAULT '[]',
nfrs TEXT DEFAULT '[]',
scope_in TEXT,
scope_out TEXT,
cross_cutting TEXT DEFAULT '[]',
decisions TEXT DEFAULT '[]',
milestone_ids TEXT DEFAULT '[]',
created_at TEXT DEFAULT (datetime('now')),
updated_at TEXT DEFAULT (datetime('now'))
);
plan → parse PRD from .taskmanager/docs/prd.mdplan <file-or-folder-or-prompt> → parse input into tasksplan --expand <id> → expand single task into subtasksplan --expand-all → bulk expand all eligible tasksplan --expand-all --threshold L → expand only L and XL taskssess-$(date +%Y%m%d%H%M%S).activity.log.$1 is:
.taskmanager/docs/prd.md.When $1 is a folder (directory):
**/*.md) in the folder and its subdirectories.Before generating tasks, perform structured analysis:
Compute PRD content hash (SHA-256 of the aggregated PRD text):
echo -n "<prd-content>" | sha256sum | cut -d' ' -f1
Check for existing analysis with same hash:
SELECT * FROM plan_analyses WHERE prd_hash = '<hash>' ORDER BY created_at DESC LIMIT 1;
If found, reuse the existing analysis (skip to Step 1.7).
Detect tech stack — Scan PRD content and codebase:
composer.json (Laravel/PHP), package.json (Node/React/Vue), requirements.txt (Python), etc.["laravel", "filament", "react", "redis", "postgresql"]Identify assumptions — What's implied but not stated:
[{"description": "...", "confidence": "high|medium|low", "impact": "high|medium|low"}]Identify risks — Technical, integration, and scope risks:
[{"description": "...", "severity": "high|medium|low", "likelihood": "high|medium|low", "mitigation": "..."}]Detect ambiguities — Unclear requirements that need clarification:
[{"requirement": "...", "question": "...", "resolution": null}]Identify NFRs — Non-functional requirements:
[{"category": "performance|security|accessibility|monitoring", "requirement": "...", "priority": "high|medium|low"}]Define scope boundaries — Explicit in/out of scope:
scope_in: What IS in scopescope_out: What is explicitly OUT of scopeDetect cross-cutting concerns — Concerns spanning multiple features:
[{"concern": "error-handling", "affected_epics": ["1", "2", "3"], "strategy": "Global exception handler + per-feature error boundaries"}]Generate next analysis ID and insert:
SELECT 'PA-' || printf('%03d', COALESCE(MAX(CAST(SUBSTR(id, 4) AS INTEGER)), 0) + 1)
FROM plan_analyses;
INSERT INTO plan_analyses (id, prd_source, prd_hash, tech_stack, assumptions, risks, ambiguities, nfrs, scope_in, scope_out, cross_cutting)
VALUES ('<id>', '<source>', '<hash>', '<tech_json>', '<assumptions_json>', '<risks_json>', '<ambiguities_json>', '<nfrs_json>', '<scope_in>', '<scope_out>', '<cross_cutting_json>');
Create memories for confirmed decisions (kind: decision/architecture, importance: 4-5).
skills/taskmanager/references/MACRO-QUESTIONS.md).INSERT INTO memories (id, title, kind, why_important, body, source_type, source_name, source_via, auto_updatable, importance, confidence, status, scope, tags)
VALUES ('<id>', '<title>', '<kind>', '<why>', '<body>', 'user', 'developer', 'taskmanager:plan:macro-questions', 0, <importance>, 1.0, 'active', '<scope_json>', '<tags_json>');
b. Update plan_analyses.decisions:
UPDATE plan_analyses SET
decisions = json_insert(decisions, '$[#]', json_object('question', '<q>', 'answer', '<a>', 'rationale', 'User decision', 'memory_id', '<mem-id>')),
updated_at = datetime('now')
WHERE id = '<analysis-id>';
Based on analysis, assign MoSCoW classification to each identified epic/feature.
Create milestones:
INSERT INTO milestones (id, title, description, phase_order, status)
VALUES
('MS-001', 'MVP / Core', 'Must-have features for initial release', 1, 'planned'),
('MS-002', 'Enhancement', 'Should-have features for post-MVP', 2, 'planned'),
('MS-003', 'Nice-to-have', 'Could-have features if time permits', 3, 'planned');
Only create milestones that have tasks assigned to them.
Update plan_analyses.milestone_ids:
UPDATE plan_analyses SET
milestone_ids = '["MS-001", "MS-002", "MS-003"]',
updated_at = datetime('now')
WHERE id = '<analysis-id>';
taskmanager skill with instructions to generate a hierarchical plan.acceptance_criteria — JSON array of "done" criteriamoscow — must/should/could/wontbusiness_value — 1-5milestone_id — from Phase 4 mappingdependency_types — JSON object for typed dependenciesImportant SQL notes:
parent_id must reference an existing task ID or be NULL for top-level tasks.milestone_id must reference an existing milestone ID or be NULL.Query and display:
Milestone breakdown:
SELECT m.id, m.title, m.phase_order,
COUNT(t.id) as total_tasks,
SUM(CASE WHEN t.moscow = 'must' THEN 1 ELSE 0 END) as must_count,
SUM(CASE WHEN t.moscow = 'should' THEN 1 ELSE 0 END) as should_count
FROM milestones m
LEFT JOIN tasks t ON t.milestone_id = m.id AND t.archived_at IS NULL
GROUP BY m.id
ORDER BY m.phase_order;
MoSCoW distribution:
SELECT moscow, COUNT(*) as count FROM tasks
WHERE archived_at IS NULL GROUP BY moscow;
Analysis summary: Key risks, assumptions, decisions made.
Task counts per status.
After the summary, automatically expand all eligible tasks. This eliminates the need for a separate --expand-all invocation after planning.
Skip conditions — skip this phase entirely if:
--no-expand flag is set, ORauto_expand_after_plan is false in config (default-config.json → planning), OR--expand or --expand-all flags are present (standalone expansion mode)Procedure:
defaults.complexity_threshold_for_expansion, default: "M").defaults.max_subtask_depth, default: 3).--expand-all):
SELECT id, title, description, details, test_strategy, complexity_scale,
complexity_reasoning, complexity_expansion_prompt, priority, type, tags, dependencies,
milestone_id, acceptance_criteria, moscow, business_value
FROM tasks
WHERE archived_at IS NULL
AND status NOT IN ('done', 'canceled', 'duplicate')
AND CASE complexity_scale
WHEN 'XS' THEN 0 WHEN 'S' THEN 1 WHEN 'M' THEN 2 WHEN 'L' THEN 3 WHEN 'XL' THEN 4 ELSE -1
END >= <threshold_value>
AND NOT EXISTS (SELECT 1 FROM tasks c WHERE c.parent_id = tasks.id)
AND LENGTH(REPLACE(REPLACE(id, '.', ''), id, '')) < <max_subtask_depth>
ORDER BY
CASE complexity_scale WHEN 'XL' THEN 0 WHEN 'L' THEN 1 WHEN 'M' THEN 2 WHEN 'S' THEN 3 ELSE 4 END,
CASE priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 ELSE 3 END,
id;
The depth check (LENGTH(REPLACE(...))) counts dots in the ID to determine current depth, ensuring tasks beyond max_subtask_depth are not expanded further.
b. If no eligible tasks found, exit the loop.
c. For each eligible task, expand it using the same logic as --expand <id> (see Expansion Mode below).
d. After expanding a batch, re-query to check if newly created subtasks are themselves eligible for further expansion.Auto-expansion complete:
- X tasks expanded
- Y subtasks created
- Deepest level reached: Z
Load the task:
SELECT id, title, description, details, test_strategy, complexity_scale,
complexity_reasoning, complexity_expansion_prompt, priority, type, tags, dependencies,
milestone_id, acceptance_criteria, moscow, business_value
FROM tasks WHERE id = '<task-id>' AND archived_at IS NULL;
Validate:
--force not set: inform user and stop.--force set: warn user, delete existing subtasks.Load pending deferrals targeting this task:
SELECT d.id, d.title, d.body, d.reason
FROM deferrals d
WHERE d.target_task_id = '<task-id>' AND d.status = 'pending'
ORDER BY d.created_at;
Include these as additional scope/requirements when generating subtasks.
Generate subtasks using the taskmanager skill:
complexity_expansion_prompt if available.1.2 gets 1.2.1, 1.2.2).Insert subtasks and update parent estimate via SQL transaction.
Check if any new subtasks need further expansion (recursive check).
Map threshold to complexity_scale order:
XS < S < M < L < XL
SELECT id, title, description, details, test_strategy, complexity_scale,
complexity_reasoning, complexity_expansion_prompt, priority, type, tags, dependencies,
milestone_id, acceptance_criteria, moscow, business_value
FROM tasks
WHERE archived_at IS NULL
AND status NOT IN ('done', 'canceled', 'duplicate')
AND CASE complexity_scale
WHEN 'XS' THEN 0 WHEN 'S' THEN 1 WHEN 'M' THEN 2 WHEN 'L' THEN 3 WHEN 'XL' THEN 4 ELSE -1
END >= <threshold_value>
AND NOT EXISTS (SELECT 1 FROM tasks c WHERE c.parent_id = tasks.id)
ORDER BY
CASE complexity_scale WHEN 'XL' THEN 0 WHEN 'L' THEN 1 WHEN 'M' THEN 2 WHEN 'S' THEN 3 ELSE 4 END,
CASE priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 ELSE 3 END,
id;
Expand each eligible task, then recursively check new subtasks.
Log to activity.log. Reset state session.
All logging goes to .taskmanager/logs/activity.log:
taskmanager:init.# Plan from default PRD
taskmanager:plan
# Plan from file
taskmanager:plan docs/new-feature-prd.md
# Plan from folder
taskmanager:plan docs/project-specs/
# Plan from prompt
taskmanager:plan "Create a react counter app"
# Plan with research
taskmanager:plan docs/prd.md --research
# Plan without analysis (quick mode)
taskmanager:plan docs/prd.md --skip-analysis
# Plan without milestones
taskmanager:plan docs/prd.md --no-milestones
# Plan without auto-expansion (tasks stay as top-level only)
taskmanager:plan docs/prd.md --no-expand
# Expand a single task
taskmanager:plan --expand 1.2
# Re-expand a task
taskmanager:plan --expand 1.2 --force
# Expand all tasks with complexity M or above
taskmanager:plan --expand-all
# Expand only L and XL tasks
taskmanager:plan --expand-all --threshold L
taskmanager:show - View tasks, dashboard, statstaskmanager:show --milestones - View milestone progresstaskmanager:show --analysis - View plan analysestaskmanager:run - Execute taskstaskmanager:research - Research before planningtaskmanager:update - Update task fields