Expand description
§mana-core
Core library for the mana work coordination system.
mana-core provides the full data model, I/O layer, and orchestration logic
for managing units (atomic work items) in a .mana/ project directory.
It is the single source of truth consumed by the mana CLI, GUI tooling,
MCP servers, and any other integration point.
§Crate layout
| Module | Purpose |
|---|---|
api | High-level public API — the recommended entry point |
unit | Core Unit data model and serialization |
config | Project and global configuration |
index | Fast unit cache (index.yaml) |
graph | Dependency graph utilities |
ops | Low-level operations (create, update, close, claim, …) |
error | Typed error and result types |
discovery | .mana/ directory and unit file discovery |
§Quick start
use mana_core::api::{find_mana_dir, load_index, get_unit, list_units};
use mana_core::ops::list::ListParams;
use std::path::Path;
// 1. Locate the .mana/ directory (walks up from the current path)
let mana_dir = find_mana_dir(Path::new(".")).expect("not inside a mana project");
// 2. Load the cached index (rebuilds from unit files if stale)
let index = load_index(&mana_dir).expect("failed to load index");
println!("{} units in project", index.units.len());
// 3. Read a specific unit by ID
let unit = get_unit(&mana_dir, "1").expect("unit not found");
println!("{}: {} ({:?})", unit.id, unit.title, unit.status);
// 4. List all open units
let open = list_units(&mana_dir, &ListParams::default()).expect("list failed");
for entry in open {
println!(" [{}] {}", entry.id, entry.title);
}§Design principles
&Pathas entry point — every function takesmana_dir: &Path. No global state, no singletons.- No stdout/stderr side effects — all output is returned as structured data.
- Serializable — all public types derive
Serialize/Deserializefor JSON-RPC, MCP, and Tauri IPC. - Thread-safe — no interior mutability or shared mutable globals.
Modules§
- agent_
presets - Agent presets and detection for known coding-agent CLIs.
- api
- mana-core Public API
- blocking
- config
- Project and global configuration.
- ctx_
assembler - discovery
- error
- failure
- graph
- Dependency graph utilities.
- history
- hooks
- index
- Fast unit index cache.
- locks
- File locking for concurrent agents.
- ops
- prompt
- Structured agent prompt builder.
- relevance
- unit
- Core unit data model.
- util
- Utility functions for unit ID parsing and status conversion.
- verify_
lint - worktree
- Git worktree detection and merge utilities.