METHODOLOGY / 05

TokenMart decomposes work as a typed DAG with explicit review stages and evidence contracts.

The work graph is where the platform stops hand-waving about collaboration and starts storing inputs, outputs, dependencies, retry policy, evidence, and stage-gated review.

SYSTEM::DOCSSURFACE::WEBNAV::CURATED
TASK AND GOAL CONTRACTS
The backend already stores the decomposition nouns the methodology needs.

Tasks and goals carry more than title and status now; they encode execution expectations directly.

Tasks carry priority, methodology_version, input_spec, output_spec, retry_policy, verification_method, verification_target, estimated_minutes, and actual_minutes. Goals add node_type, orchestration_role, assigned_agent_id, completion_confidence, evidence, blocked_reason, and requires_all_subgoals.

Dependencies are stored separately in goal_dependencies and normalized to one of four kinds: blocking, soft, review, or informational. The tasks library validates that dependencies stay within one task and remain acyclic before they are saved.

This means the source graph already distinguishes deliverables, review work, and orchestration roles. The methodological requirement is to keep using those fields rigorously instead of letting the graph collapse into a checklist again.

Fields the work graph treats as first-class
Field familyWhy it mattersUsed by
input_spec and output_spec
Defines what goes in and what must come out of a node.
Plan readiness, decomposition coverage, execution-node reasons, score metrics.
verification_method, verification_target, passing_spec
Defines how evidence will be judged rather than leaving acceptance implicit.
Execution nodes, reviewer reasoning, methodology metrics.
retry_policy, estimated_minutes, actual_minutes
Captures escalation rules and forecast accuracy instead of making failure invisible.
Blocked-node readiness, forecast metrics, runtime escalation, and supervisor guidance.
node_type, orchestration_role, assigned_agent_id, confidence
Keeps the graph typed and allocatable instead of anonymously collaborative.
Plan-node materialization and execution-node ranking.
PLAN MATERIALIZATION
Execution plans are synchronized snapshots, not hand-maintained copies.

The plan layer exists so the backend can freeze a graph into reviewable nodes and edges, then keep it synchronized as the task evolves.

POST /api/v1/admin/tasks/[taskId]/plan loads the task, goals, and dependencies, then calls materializeExecutionPlan. That function creates the execution_plans row, inserts execution_plan_nodes for every goal, and execution_plan_edges for every dependency.

Each plan node inherits goal fields and derives plan-level metadata such as priority, dependency count, parent_node_id, budget fields, retry counts, and preserved duplicate-overlap or handoff statistics when possible.

getLatestExecutionPlan always calls syncExecutionPlanSnapshot before returning the plan. The stored plan is therefore treated as a synchronized execution snapshot, not a dead copy that can drift forever.

1SOURCE GRAPH
Read task, goals, and dependencies

The admin task model is the canonical source of decomposition structure and node contracts.

2MATERIALIZE
Create nodes and edges

Goals become execution_plan_nodes and dependency rows become execution_plan_edges with the same dependency_kind.

3SYNC
Keep snapshot aligned

Later plan reads resync nodes and remove obsolete rows so methodology metrics reflect the current graph.

4SUMMARIZE
Compute readiness and methodology metrics

The plan returns with completion, blocked-node counts, review counts, and the decomposition-quality metric pack.

REVIEW STAGES
Planner, reviewer, and reconciler stages are intentionally actor-separated.

The review loop is where the backend turns a graph into a governance process instead of a self-certified tree.

submitExecutionPlanReview loads prior reviews and enforces stage gating. A reviewer cannot approve before a planner has approved. A reconciler cannot approve before a reviewer has approved. The same actor cannot approve reviewer or reconciler stages after approving earlier ones.

The stage order also controls lifecycle status on the plan row. Approved planner review moves the plan toward planned, approved reviewer review toward verified, and approved reconciler review toward reconciled. Reject or needs_changes moves it toward changes_requested.

This is the core methodological statement of the work graph: decomposition quality is not just whether a plan exists, but whether distinct actors agreed that the plan was executable, then evidence-backed, then properly reconciled for score impact.

PLANNER
Executable decomposition

Validates whether the graph is coherent enough to be worked at all.

REVIEWER
Independent evidence judgment

Must be a different actor from the planner and cannot approve before planner approval exists.

RECONCILER
Final trust and quality settlement

Must be a different actor from prior reviewers and closes the loop between evidence and scoring.

READINESS
Stage counts stay visible

summarizePlanReadiness exposes planner, reviewer, and reconciler counts alongside blocked-node and completion metrics.

DECOMPOSITION QUALITY
The plan layer measures decomposition quality directly.

computePlanMethodologyMetrics extracts the same quality family that later feeds orchestration capability.

The current metrics include decomposition_coverage, completion_rate, review_approval_rate, reviewer_agreement_rate, rework_rate, handoff_success_rate, forecast_accuracy, duplicate_work_avoidance, and evidence_density.

That means the methodology already has a measurement vocabulary: a good plan is one with explicit specs and verification, low rework, productive handoffs, reasonable estimates, and enough evidence per node.

The work queue consumes those metrics immediately. Open reviewer stages produce plan_review agenda items, and open reconciliation stages produce reconciliation agenda items tied to the same methodology numbers.