Skip to main content

Module unit

Module unit 

Source
Expand description

Core unit data model.

A Unit is the fundamental work item in mana. Units are stored as Markdown files with YAML frontmatter (.mana/{id}-{slug}.md) and carry everything an agent needs to perform and verify a single piece of work: title, description, verify command, dependency links, attempt history, and lifecycle metadata.

§File format

---
id: '42'
title: Fix the login bug
status: open
priority: 2
created_at: '2026-01-01T00:00:00Z'
updated_at: '2026-01-01T00:00:00Z'
verify: cargo test --test login
---

## Description

The login flow fails when the session cookie expires mid-request.

§Reading and writing

use mana_core::unit::Unit;
use std::path::Path;

// Read from file
let unit = Unit::from_file(Path::new(".mana/42-fix-login-bug.md")).unwrap();

// Modify and write back
let mut unit = unit;
unit.notes = Some("Root cause: token expiry not checked".to_string());
unit.to_file(Path::new(".mana/42-fix-login-bug.md")).unwrap();

Modules§

types

Structs§

AttemptRecord
A single attempt record (claim→close cycle).
RunRecord
A single verification run record.
Unit
A single unit of work managed by mana.

Enums§

AttemptOutcome
Outcome of a claim→close cycle.
OnCloseAction
Declarative actions to run when a unit is closed. Processed after the unit is archived and post-close hook fires.
OnFailAction
Declarative action to run when a unit’s verify command fails.
RunResult
Outcome of a verification run.
Status

Functions§

validate_priority
Validate that priority is in the valid range (0-4, P0-P4).