Skip to content

Crystallize

The crystallize command saves a structured prompt that instructs an AI agent to capture its current expertise as stato modules. There are two modes: one for coding agents and one for web AI.

Coding Agent Mode (Default)

Terminal window
stato crystallize

This saves the crystallize prompt to .stato/prompts/crystallize.md and prints a short instruction message. Tell your coding agent (Claude Code, Cursor, Codex): “Read and follow .stato/prompts/crystallize.md”. The agent reads the file and writes Python modules to .stato/.

To also print the full prompt to terminal:

Terminal window
stato crystallize --print

What the Agent Creates

After reading the crystallize prompt, the agent writes up to 5 module types:

ModuleFilePurpose
Skill.stato/skills/<name>.pyReusable procedures with parameters, run() method, and lessons learned
Plan.stato/plan.pyProject objective, steps (with status and dependencies), decision log
Memory.stato/memory.pyCurrent phase, tasks, known issues, reflection
Context.stato/context.pyProject name, description, datasets, environment, conventions
Protocol.stato/protocol.pyMulti-agent handoff schemas and validation rules

Each module is a Python class with typed fields. The compiler validates every module before writing to disk.

Two Capture Modes

The crystallize prompt supports two modes:

  • Session-specific capture (primary, richest mode): The agent has been working on the project, learned parameters, made decisions, hit failures. It captures that expertise directly from its session context.
  • Fresh session capture: The agent just started and has no session history. It reads the project’s existing code, configs, notebooks, and documentation, then infers expertise from what it can observe.

The agent automatically detects which mode applies based on whether it has session context.

Web AI Mode

Terminal window
stato crystallize --web

This prints a prompt designed for web AI conversations (Claude.ai, Gemini, ChatGPT) and also saves it to .stato/prompts/crystallize_web.md. Instead of writing files directly, the web AI outputs a single Python bundle file containing all modules.

For clipboard copy:

Terminal window
stato crystallize --web | pbcopy

Web AI Workflow

  1. Copy the web crystallize prompt
  2. Paste into your web AI conversation
  3. The AI outputs a bundle file (a single Python file with SKILLS, PLAN, MEMORY, CONTEXT variables)
  4. Save the output as stato_bundle.py
  5. Import into your project:
Terminal window
stato import-bundle stato_bundle.py

The bundle parser uses ast.parse (not exec) for safety, then validates each module through the 7-pass compiler before writing.

See Web AI Bridge for the complete workflow.

Options

FlagDescription
--printPrint full prompt to terminal (in addition to saving to file)
--webWeb AI prompt (prints to terminal, saves to crystallize_web.md)
--pathProject directory (default: .)