agora.core.project

Project state machine with the approve/loop-back gate.

Position: the project-level state above individual tasks. Where task tracks one unit’s status, this tracks the whole project’s phase and the approve/loop-back decision — the gate that either advances the project or sends a phase back for re-work (feeding the retry that the learning flywheel annotates).

Invariant: phase changes go through the validated PhaseTransition set; an illegal jump raises InvalidTransition rather than being silently applied.

Functions

can_advance(project)

Whether all tasks have reached a terminal state (DONE).

current_phase_tasks(project)

Tasks relevant to the current phase (active / not done).

transition_phase(project, new_phase, reason)

Validate and apply a phase transition.

Classes

PhaseChange

A single phase transition recorded on a Project.

PhaseTransition

One edge in the project phase state machine.

Project

A run-in-progress: agents, the task DAG, the phase state machine.

class agora.core.project.PhaseTransition[source]

Bases: NamedTuple

One edge in the project phase state machine.

The condition string is human-readable rationale shown in the observer surface; it does not gate the transition. Validity is determined by membership in VALID_TRANSITIONS.

from_phase: ProjectPhase

Alias for field number 0

to_phase: ProjectPhase

Alias for field number 1

condition: str

Alias for field number 2

static __new__(_cls, from_phase, to_phase, condition)

Create new instance of PhaseTransition(from_phase, to_phase, condition)

class agora.core.project.PhaseChange[source]

Bases: object

A single phase transition recorded on a Project.

Appended to Project.phase_history by transition_phase() with a UTC ISO timestamp so the run timeline is reconstructable from the project state alone.

from_phase: ProjectPhase
to_phase: ProjectPhase
reason: str
timestamp: str
__init__(from_phase, to_phase, reason, timestamp)
class agora.core.project.Project[source]

Bases: object

A run-in-progress: agents, the task DAG, the phase state machine.

Projects are immutable; mutations return a new instance via dataclasses.replace(). phase advances through the ProjectPhase state machine via transition_phase(), with each transition appended to phase_history for audit. git_repo_path is the per-project work tree where the orchestrator writes artefacts and runs auto-commits.

id: str
name: str
phase: ProjectPhase = 'init'
agents: tuple[str, ...] = ()
tasks: tuple[Task, ...] = ()
phase_history: tuple[PhaseChange, ...] = ()
git_repo_path: str = ''
created_at: str = ''
__init__(id, name, phase=ProjectPhase.INIT, agents=(), tasks=(), phase_history=(), git_repo_path='', created_at='')
agora.core.project.transition_phase(project, new_phase, reason)[source]

Validate and apply a phase transition. Returns a new Project.

agora.core.project.current_phase_tasks(project)[source]

Tasks relevant to the current phase (active / not done).

agora.core.project.can_advance(project)[source]

Whether all tasks have reached a terminal state (DONE).