Data Models#
Core data structures used throughout Marcus.
Auto-generated from source code docstrings.
Core Models Module#
This module contains all data models used throughout Marcus.
Core data models for Marcus.
This module defines the fundamental data structures used throughout the Marcus system, including tasks, workers, assignments, and project state tracking.
- class src.core.models.TaskStatus[source]#
Bases:
EnumEnumeration of possible task states.
- TODO = 'todo'#
- IN_PROGRESS = 'in_progress'#
- DONE = 'done'#
- BLOCKED = 'blocked'#
- class src.core.models.RiskLevel[source]#
Bases:
EnumEnumeration of risk severity levels.
- LOW = 'low'#
- MEDIUM = 'medium'#
- HIGH = 'high'#
- CRITICAL = 'critical'#
- class src.core.models.Priority[source]#
Bases:
EnumEnumeration of task priority levels.
- LOW = 'low'#
- MEDIUM = 'medium'#
- HIGH = 'high'#
- URGENT = 'urgent'#
- class src.core.models.RecoveryInfo[source]#
Bases:
objectInformation about task recovery from a previous agent.
This is operational data that the next agent needs to avoid duplicating work or taking conflicting approaches.
- Parameters:
recovered_at (
datetime) – When the recovery occurredrecovered_from_agent (
str) – Agent ID that previously worked on this taskprevious_progress (
int) – Progress percentage (0-100) at time of recoverytime_spent_minutes (
float) – Total time spent by previous agent in minutesrecovery_reason (
str) – Why recovery happened (e.g., “lease_expired”, “agent_crashed”)instructions (
str) – Multi-line guidance for next agent about what to checkprevious_agent_branch (
Optional[str]) – Git branch the previous agent was working on (e.g., “marcus/agent-3”). In worktree mode, each agent works on an isolated branch. The new agent should merge this branch to pick up committed work.recovery_expires_at (
Optional[datetime]) – When this recovery info becomes stale (default 24 hours)
Notes
Recovery info expires after 24 hours by default. After expiration, the info is considered stale and should be moved to audit trail only.
- classmethod from_dict(data)[source]#
Create from dictionary (for deserialization).
- __init__(recovered_at, recovered_from_agent, previous_progress, time_spent_minutes, recovery_reason, instructions, previous_agent_branch=None, recovery_expires_at=None)#
- class src.core.models.Task[source]#
Bases:
objectRepresents a work item in the project management system.
- Parameters:
id (
str) – Unique identifier for the taskname (
str) – Short descriptive name of the taskdescription (
str) – Detailed description of what needs to be donestatus (
TaskStatus) – Current state of the taskpriority (
Priority) – Urgency level of the taskassigned_to (
Optional[str]) – ID of the worker assigned to this taskcreated_at (
datetime) – Timestamp when task was createdupdated_at (
datetime) – Timestamp of last modificationestimated_hours (
float) – Estimated time to complete in hoursactual_hours (
float) – Actual time spent on taskdependencies (
List[str]) – List of task IDs that must be completed firstproject_id (
Optional[str]) – ID of the project this task belongs toproject_name (
Optional[str]) – Name of the project this task belongs tois_subtask (
bool) – Whether this task is a subtask of a parent taskparent_task_id (
Optional[str]) – ID of the parent task if this is a subtasksubtask_index (
Optional[int]) – Position within parent task’s subtasks (for ordering)provides (
Optional[str]) – What interface/functionality this task provides for dependent tasksrequires (
Optional[str]) – What this task needs from its dependenciesresponsibility (
Optional[str]) – Contract interface or module this task is responsible for implementing when the project is decomposed by contract-first decomposition (GH-320 PR 2). Names a specific interface from the shared contract artifact — e.g."implements GameEngine interface from src/types.ts". When set, the agent prompt frames the task as ownership of this contract interface rather than a generic implementation task, and the agent is directed to read the contract artifact before writing code. None for tasks produced by the legacy feature-based decomposer.
Notes
Dependencies and labels are initialized as empty lists if not provided. Project context fields are optional for backwards compatibility. The unified dependency graph fields (is_subtask, parent_task_id, subtask_index) enable subtasks to be first-class citizens in the dependency graph while preserving organizational hierarchy. The provides/requires fields enable automatic cross-parent dependency wiring by matching semantic contracts between subtasks. The responsibility field is orthogonal to provides/requires: provides/requires describe the contract this task SATISFIES at the dependency-wiring layer; responsibility names the contract interface this task OWNS from an authoritative shared contract file the agent must read.
- status: TaskStatus#
- recovery_info: RecoveryInfo | None = None#
- __init__(id, name, description, status, priority, assigned_to, created_at, updated_at, due_date, estimated_hours, actual_hours=0.0, dependencies=<factory>, dependency_types=<factory>, labels=<factory>, project_id=None, project_name=None, source_type=None, source_context=None, completion_criteria=None, acceptance_criteria=<factory>, validation_spec=None, is_subtask=False, parent_task_id=None, subtask_index=None, provides=None, requires=None, responsibility=None, output_paths=<factory>, recovery_info=None)#
- Parameters:
id (str)
name (str)
description (str)
status (TaskStatus)
priority (Priority)
assigned_to (str | None)
created_at (datetime)
updated_at (datetime)
due_date (datetime | None)
estimated_hours (float)
actual_hours (float)
project_id (str | None)
project_name (str | None)
source_type (str | None)
validation_spec (str | None)
is_subtask (bool)
parent_task_id (str | None)
subtask_index (int | None)
provides (str | None)
requires (str | None)
responsibility (str | None)
recovery_info (RecoveryInfo | None)
- Return type:
None
- class src.core.models.ProjectState[source]#
Bases:
objectRepresents the current state of the entire project.
- Parameters:
board_id (
str) – Unique identifier of the project boardproject_name (
str) – Name of the projecttotal_tasks (
int) – Total number of tasks in the projectcompleted_tasks (
int) – Number of tasks marked as donein_progress_tasks (
int) – Number of tasks currently being worked onblocked_tasks (
int) – Number of tasks that are blockedprogress_percent (
float) – Overall project completion percentage (0-100)overdue_tasks (
List[Task]) – Tasks that have passed their due dateteam_velocity (
float) – Average tasks completed per time periodrisk_level (
RiskLevel) – Overall project risk assessmentlast_updated (
datetime) – Timestamp of last state update
- __init__(board_id, project_name, total_tasks, completed_tasks, in_progress_tasks, blocked_tasks, progress_percent, overdue_tasks, team_velocity, risk_level, last_updated)#
- class src.core.models.WorkerStatus[source]#
Bases:
objectRepresents the current state and capabilities of a worker agent.
- Parameters:
worker_id (
str) – Unique identifier for the workername (
str) – Display name of the workerrole (
str) – Job role or specialization (e.g., “Frontend Developer”)current_tasks (
List[Task]) – Tasks currently assigned to this workercompleted_tasks_count (
int) – Total number of tasks completed by this workercapacity (
int) – Maximum hours per week the worker can workavailability (
Dict[str,bool]) – Days of week when worker is availableperformance_score (
float) – Performance rating (0.0-2.0, where 1.0 is baseline)
Examples
>>> worker = WorkerStatus( ... worker_id="dev-001", ... name="Alice Smith", ... role="Backend Developer", ... email="alice@example.com", ... current_tasks=[], ... completed_tasks_count=15, ... capacity=40, ... skills=["Python", "Django", "PostgreSQL"], ... availability={"monday": True, "tuesday": True, ...} ... )
- __init__(worker_id, name, role, email, current_tasks, completed_tasks_count, capacity, skills, availability, performance_score=1.0)#
- class src.core.models.TaskAssignment[source]#
Bases:
objectRepresents a task assignment to a specific worker.
- Parameters:
task_id (
str) – Unique identifier of the tasktask_name (
str) – Name of the task being assigneddescription (
str) – What needs to be doneinstructions (
str) – Detailed instructions for completing the taskestimated_hours (
float) – Expected time to completepriority (
Priority) – Task urgency leveldependencies (
List[str]) – Other tasks that must be completed firstassigned_to (
str) – Worker ID receiving the assignmentassigned_at (
datetime) – Timestamp of assignmentworkspace_path (
Optional[str]) – Path to the workspace directory for this taskforbidden_paths (
List[str]) – Paths the worker should not access
Notes
The workspace_path and forbidden_paths are used for security isolation to prevent workers from accessing unauthorized directories.
- __init__(task_id, task_name, description, instructions, estimated_hours, priority, dependencies, assigned_to, assigned_at, due_date, workspace_path=None, forbidden_paths=<factory>)#
- class src.core.models.BlockerReport[source]#
Bases:
objectRepresents a blocker or impediment reported by a worker.
- Parameters:
task_id (
str) – ID of the blocked taskreporter_id (
str) – ID of the worker reporting the blockerdescription (
str) – Detailed description of the blockerseverity (
RiskLevel) – How severely this impacts the taskreported_at (
datetime) – When the blocker was reportedresolved (
bool) – Whether the blocker has been resolvedresolution (
Optional[str]) – Description of how the blocker was resolvedresolved_at (
Optional[datetime]) – When the blocker was resolved
Examples
>>> blocker = BlockerReport( ... task_id="TASK-123", ... reporter_id="dev-001", ... description="Cannot access production database", ... severity=RiskLevel.HIGH, ... reported_at=datetime.now(timezone.utc) ... )
- __init__(task_id, reporter_id, description, severity, reported_at, resolved=False, resolution=None, resolved_at=None)#
- class src.core.models.ProjectRisk[source]#
Bases:
objectRepresents an identified risk to the project.
- Parameters:
risk_type (
str) – Category of risk (e.g., “technical”, “resource”, “timeline”)description (
str) – Detailed description of the riskseverity (
RiskLevel) – Potential impact severityprobability (
float) – Likelihood of occurrence (0.0-1.0)impact (
str) – Description of potential impact if risk materializesmitigation_strategy (
str) – Plan to reduce or eliminate the riskidentified_at (
datetime) – When the risk was identified
Examples
>>> risk = ProjectRisk( ... risk_type="technical", ... description="Legacy API may be deprecated", ... severity=RiskLevel.MEDIUM, ... probability=0.3, ... impact="Would require rewriting integration layer", ... mitigation_strategy="Begin migration to new API", ... identified_at=datetime.now(timezone.utc) ... )