Skip to content

Project

View source on GitHub

Project

Bases: BaseModel

A project, its persisted settings, and its managed files.

Attributes:

Name Type Description
root Path

Absolute project root directory.

hiraku_dir_name str

Name of the managed directory for Hiraku data.

Parameters:

Name Type Description Default
root Path | str

Project directory containing the settings file and managed data.

required
**data Any

Persisted project settings to validate and load.

{}

Create a project model from its root and persisted settings.

Parameters:

Name Type Description Default
root Path | str

Project directory.

required
**data Any

Project settings validated by Pydantic.

{}

root class-attribute instance-attribute

root: Path = Field(exclude=True)

hiraku_dir_name class-attribute instance-attribute

hiraku_dir_name: str = Field(
    default="hiraku",
    alias="hiraku_dir",
    min_length=1,
    exclude=True,
    frozen=True,
)

hiraku_dir property

hiraku_dir: Path

Return the resolved directory for Hiraku-managed project data.

path property

path: Path

Return the path to the project's root-level hiraku.yml file.

records_dir property

records_dir: Path

Return the directory containing research record files.

vault property

vault: Vault

Return this project's filesystem-backed record collection.

leaderboards_dir property

leaderboards_dir: Path

Return the directory containing named leaderboards.

workflows_dir property

workflows_dir: Path

Return the directory containing installed workflows.

jobs_dir property

jobs_dir: Path

Return the local directory for submission history.

psij_dir property

psij_dir: Path

Return the local directory for PSI/J launcher and executor files.

load classmethod

load(path: Path | str) -> Project

Load a project from its root-level hiraku.yml file.

Parameters:

Name Type Description Default
path Path | str

Path to the project configuration file.

required

Returns:

Type Description
Project

The project rooted at the configuration file's parent directory.

Raises:

Type Description
ValidationError

If the file or its settings are invalid.

View source on GitHub

discover classmethod

discover(start: Path | str | None = None) -> Project

Find the nearest project by searching start and its parents.

Parameters:

Name Type Description Default
start Path | str | None

Starting directory or file. Defaults to the current directory.

None

Returns:

Type Description
Project

The nearest discovered project.

Raises:

Type Description
ProjectNotFoundError

If no project is found.

View source on GitHub

to_dict

to_dict() -> dict[str, Any]

Return the persisted project settings.

View source on GitHub

save

save() -> None

Atomically save the project's settings to its root-level hiraku.yml.

Raises:

Type Description
ValidationError

If the configuration cannot be written.

View source on GitHub

create classmethod

create(
    root: Path | str = ".",
    *,
    install_skill: bool = True,
    install_mcp: bool = True,
) -> Project

Create a project and install its selected resources.

Parameters:

Name Type Description Default
root Path | str

Directory to initialize.

'.'
install_skill bool

Whether to install all included Hiraku skills.

True
install_mcp bool

Whether to add the project MCP server configuration.

True

Returns:

Type Description
Project

The initialized project.

Raises:

Type Description
ProjectExistsError

If root already has a project.

ValidationError

If settings or resources are invalid.

View source on GitHub

install_mcp

install_mcp() -> None

Register the stdio server in supported project agent configs.

Claude, Pi, and Codex configuration files are merged while preserving other configured MCP servers.

View source on GitHub