Skip to main content

Ritualized AI agent workflows - multi-pass prompt pipelines for Cursor and beyond

Project description

macrocycle

Your StarCraft macro loop for code.

Ritualized AI agent workflows — multi-pass prompt pipelines that turn any AI coding agent into a disciplined control loop.

Why?

AI agents are powerful but undisciplined. They rush to implement, skip analysis, and produce brittle code. Macrocycle fixes this by forcing your agent through a structured loop — analysis, planning, rejection, implementation, review — before it ships anything.

The control loop is the product. Integrations (Sentry, GitHub, etc.) are left to the IDE or tools like Claude Code and OpenClaw.

How It Works

Define a macro — a sequence of LLM prompts and human gates — and run it against any input. Each pass builds on the last, producing auditable artifacts at every step.

Input → [impact → plan → reject → approve → implement → review → simplify → PR] → Output
          LLM     LLM     LLM      GATE       LLM        LLM      LLM      LLM

LLM steps send prompts to your agent. Gate steps pause for human approval. Previous step outputs flow forward as context, so each step builds on the last.

Quick Start

pip install macrocycle
macrocycle init
macrocycle run fix "TypeError: cannot unpack non-iterable NoneType object in auth.py:42"

Commands

macrocycle init                        # Scaffold .macrocycle/ with default macros
macrocycle list                        # List available macros
macrocycle run <macro> "<input>"       # Execute a macro
macrocycle run <macro> -i file.txt     # Input from file
macrocycle run <macro> --dry-run       # Preview prompts without running
macrocycle run <macro> --yes           # Auto-approve all gates
macrocycle run <macro> --until <step>  # Stop after a specific step
macrocycle status                      # Show last cycle result
echo "..." | macrocycle run fix        # Pipe from stdin

The Default fix Macro

Eight steps, designed to prevent the most common AI coding failures:

Step Type Purpose
impact LLM Deep analysis of the problem
plan LLM Concrete, scoped fix plan
reject LLM Adversarial review — force refinement
approve Gate Human checkpoint before implementation
implement LLM Write the actual code
review LLM Self-review for bugs and edge cases
simplify LLM Clean up, follow conventions
PR LLM Ship with a clear description

Custom Macros

Create .macrocycle/macros/your-macro.json:

{
  "macro_id": "review",
  "name": "Code Review",
  "engine": "cursor",
  "include_previous_outputs": true,
  "steps": [
    { "id": "analyze", "type": "llm", "prompt": "Analyze this code:\n\n{{INPUT}}" },
    { "id": "confirm", "type": "gate", "message": "Apply suggested fixes?" },
    { "id": "fix", "type": "llm", "prompt": "Apply the fixes identified above." }
  ]
}

Step types: llm (agent prompt) · gate (human approval) Variables: {{INPUT}} (original input) · {{STEP_OUTPUT:step_id}} (output from a previous step)

Artifacts

Every cycle is saved to disk. Nothing is lost, everything is reviewable.

.macrocycle/
  macros/fix.json
  cycles/
    2026-03-12_fix_abc123/
      input.txt
      steps/01-impact.md
      steps/02-plan.md
      ...

Development

git clone https://github.com/MilanPecov/macrocycle.git
cd macrocycle
pip install -e ".[dev]"
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macrocycle-0.3.0.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

macrocycle-0.3.0-py3-none-any.whl (42.1 kB view details)

Uploaded Python 3

File details

Details for the file macrocycle-0.3.0.tar.gz.

File metadata

  • Download URL: macrocycle-0.3.0.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for macrocycle-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7be8aa6d6ba3649f99e38357e55397a9d50dc5a96665921ed71468e599878bf8
MD5 a705e142d518a4ed4c0319f6bc328e47
BLAKE2b-256 106e5372eb64bb45f20be4a2c00c042e9b1a1bcda070c9d9af0c53392dd6e327

See more details on using hashes here.

Provenance

The following attestation bundles were made for macrocycle-0.3.0.tar.gz:

Publisher: publish.yml on MilanPecov/macrocycle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file macrocycle-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: macrocycle-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 42.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for macrocycle-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20f2d62180fbe939a80349e1192e7c5265765ecd4ed3aeff194e21f08dfacc1d
MD5 4de97a48938a325a4680868d233b28e0
BLAKE2b-256 62339b16b87d0c3bd28951a19292f8b529acad3eb7a3ce35e18eaf468a565a50

See more details on using hashes here.

Provenance

The following attestation bundles were made for macrocycle-0.3.0-py3-none-any.whl:

Publisher: publish.yml on MilanPecov/macrocycle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page