Skip to content

Module Format

Every stato module is a Python file containing a single class. The compiler infers the module type from the class name, fields, and methods, then validates against the appropriate schema.

Module Types

TypeFile LocationPurpose
skill.stato/skills/<name>.pyReusable procedures with parameters
plan.stato/plan.pyProject roadmap with steps and dependencies
memory.stato/memory.pyWorking memory (phase, tasks, issues)
context.stato/context.pyProject-level metadata
protocol.stato/protocol.pyMulti-agent handoff schemas

Skill Module

Skills represent reusable procedures. They require a name field and a run() method.

class QualityControl:
"""Single-cell RNA-seq quality control filtering."""
name = "qc_filtering"
description = "Filter cells by gene count and mitochondrial percentage"
version = "1.2.0"
depends_on = ["normalize"]
default_params = {
"min_genes": 200,
"max_genes": 5000,
"max_pct_mito": 20,
}
lessons_learned = """
Mouse uses lowercase mt- prefix for mitochondrial genes.
FFPE samples need max_pct_mito=40.
"""
tags = ["qc", "scrna"]
def run(self, adata, params=None):
...

Schema

FieldTypeRequiredDescription
namestrYesUnique skill identifier
descriptionstrNoShort description
versionstrNoSemantic version (e.g. "1.2.0")
depends_onlistNoDependencies (other skill names or packages)
input_schemadictNoExpected input format
output_schemadictNoExpected output format
default_paramsdictNoDefault parameter values
lessons_learnedstrNoMarkdown-formatted lessons from experience
tagslistNoCategorization tags
context_requireslistNoRequired context fields

Required methods: run() (execution entry point)

Plan Module

Plans define a project roadmap with ordered steps.

class AnalysisPlan:
"""scRNA-seq analysis pipeline plan."""
name = "cortex_analysis"
objective = "Complete scRNA-seq analysis of mouse cortex P14"
version = "1.0.0"
steps = [
{"id": 1, "action": "load_data", "status": "complete", "depends_on": []},
{"id": 2, "action": "qc_filtering", "status": "complete", "depends_on": [1]},
{"id": 3, "action": "normalize", "status": "complete", "depends_on": [2]},
{"id": 4, "action": "find_hvg", "status": "pending", "depends_on": [3]},
{"id": 5, "action": "cluster", "status": "pending", "depends_on": [4]},
]
decision_log = """
Chose SCTransform over log-normalize for better variance stabilization.
"""

Schema

FieldTypeRequiredDescription
namestrYesPlan identifier
objectivestrYesWhat this plan achieves
stepslist[dict]YesStep dicts with id, action, status, optional output, depends_on
versionstrNoPlan version
decision_logstrNoRecord of key decisions
constraintslistNoConstraints on execution
created_bystrNoAuthor attribution

Step Format

Each step in the steps list is a dict:

FieldTypeRequiredDescription
idintYesUnique step identifier
actionstrYesWhat this step does
statusstrYes (auto-set if missing)One of: pending, running, complete, failed, blocked
depends_onlist[int]NoIDs of prerequisite steps
outputstrNoResult or notes from completed step

The compiler validates step ID uniqueness, dependency references, status values, and DAG acyclicity.

Memory Module

Memory tracks the current working state of the project.

class ProjectState:
"""Current working memory for the analysis."""
phase = "analysis"
tasks = [
"Run HVG selection with flavor='seurat_v3'",
"Test different resolution parameters for clustering",
]
known_issues = {
"batch_effect": "Samples 3 and 7 cluster separately, may need Harmony",
}
reflection = "QC removed 15% of cells, consistent with expectations for cortex."
last_updated = "2025-01-15"

Schema

FieldTypeRequiredDescription
phasestrYesCurrent work phase
taskslistNoActive task list
known_issuesdictNoKnown problems and descriptions
reflectionstrNoAgent’s current understanding
error_historylistNoRecord of errors encountered
decisionslistNoDecisions made
metadatadictNoArbitrary metadata
last_updatedstrNoTimestamp

Context Module

Context stores project-level metadata that rarely changes.

class ProjectContext:
"""Project metadata for cortex scRNA-seq analysis."""
project = "cortex_scrna"
description = "Mouse cortex P14 scRNA-seq analysis, 10x Chromium"
datasets = [
{"name": "cortex_p14", "path": "data/cortex_p14.h5ad", "cells": 12000},
]
environment = {
"python": "3.11",
"scanpy": "1.9.6",
"anndata": "0.10.3",
}
conventions = [
"Use scanpy naming conventions",
"Store results in adata.obs and adata.uns",
]

Schema

FieldTypeRequiredDescription
projectstrYesProject name
descriptionstrYesProject description
datasetslistNoData file paths
environmentdictNoTool versions
conventionslistNoProject conventions
toolslistNoRequired tools
pending_taskslistNoIncomplete tasks
completed_taskslistNoFinished tasks
teamlistNoTeam members
notesstrNoFree-form notes

Protocol Module

Protocols define schemas for multi-agent handoffs.

class AnalysisProtocol:
"""Handoff protocol for multi-agent analysis pipeline."""
name = "analysis_handoff"
handoff_schema = {
"required": ["adata_path", "completed_steps"],
"optional": ["parameters", "warnings"],
}
description = "Schema for passing analysis state between agents"
validation_rules = ["adata_path must exist", "completed_steps must be non-empty"]

Schema

FieldTypeRequiredDescription
namestrYesProtocol identifier
handoff_schemadictYesSchema for agent-to-agent handoff
descriptionstrNoProtocol description
validation_ruleslistNoRules for validating handoff data
error_handlingstrNoError handling strategy

Type Inference

The compiler infers the module type using these rules (in order):

  1. Class name ends with Context → context
  2. Class name ends with State → memory
  3. Class name ends with Protocol → protocol
  4. Has steps and objective fields → plan
  5. Has handoff_schema field → protocol
  6. Has phase field (no run() method) → memory
  7. Has project and description fields (no run() method) → context
  8. Has run() method → skill
  9. Fallback → skill (with low-confidence warning W006)

You can override inference by passing expected_type to the compiler.