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 for Cursor and beyond.

⚡ Why Macros?

  • Burn tokens, not time. Let AI iterate through analysis, planning, and implementation while you context-switch.
  • Scale horizontally. Spawn parallel agents — 10 errors in, 10 PRs out.
  • Artifacts you can audit. Every cycle saves outputs to disk. Review before merging.

📦 Installation

pipx install macrocycle

Or: pip install macrocycle / uv tool install macrocycle

🚀 Quick Start

cd your-project
macrocycle init

git checkout -b fix/your-issue
macrocycle run fix "Paste your error context here"

🔄 The Ritual

The default fix macro runs your agent through a structured loop:

🔍 impact    Analyze the problem deeply
     ↓
📋 plan      Create a concrete fix plan
     ↓
❌ reject    Force refinement (no hand-waving!)
     ↓
✅ approve   Human gate: review & approve
     ↓
🔨 implement Execute the plan, write code
     ↓
🔬 review    Self-review for bugs & edge cases
     ↓
✨ simplify  Clean up, follow conventions
     ↓
🚀 PR        Ship it with a clear description

Use --dry-run to preview the prompts before running:

macrocycle run fix "your error" --dry-run

🔁 Orchestration

Macrocycle is composable — pipe in data from any source, run in parallel, integrate with your toolchain.

Example: Batch-fix Sentry errors

Sentry is an error monitoring platform. This script pulls unresolved issues from the last 24h and spawns parallel agents to fix each one:

# Fix all new unresolved issues from the last 24h (with latest event)
set -euo pipefail
: "${SENTRY_AUTH_TOKEN:?}" "${SENTRY_ORG:?}" "${SENTRY_PROJECT:?}"
SENTRY_URL="${SENTRY_URL:-https://sentry.io}"
QUERY='is:unresolved age:-24h'

sentry-cli issues list -o "$SENTRY_ORG" -p "$SENTRY_PROJECT" --query "$QUERY" \
| awk 'NR>3 && $1 ~ /^[0-9]+$/ {print $1}' \
| while read -r issue_id; do
    [ -n "$issue_id" ] || continue
    git checkout -b "fix/sentry-$issue_id"
    macrocycle run fix "$(
      curl -sS -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
        "$SENTRY_URL/api/0/organizations/$SENTRY_ORG/issues/$issue_id/"
      echo
      curl -sS -H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
        "$SENTRY_URL/api/0/organizations/$SENTRY_ORG/issues/$issue_id/events/?full=true&per_page=1"
    )" &
  done

wait

Each agent runs the full ritual autonomously. Batch review the PRs when ready.

Works with any issue tracker, log aggregator, or CI pipeline.

🛠 CLI Commands

macrocycle init                      # Initialize .macrocycle folder
macrocycle list                      # List available macros
macrocycle run <macro> <input>       # Run a macro
macrocycle run fix "..." --yes       # Skip gate approvals
macrocycle run fix "..." --until impact  # Stop after specific step

✏️ Custom Macros

Create your own workflows in .macrocycle/macros/:

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

Step types:

  • llm — Send prompt to agent, save output
  • gate — Pause for human approval (skip with --yes)

Template variables:

  • {{INPUT}} — User's original input
  • {{STEP_OUTPUT:step_id}} — Output from a previous step

📁 Artifacts

.macrocycle/
  macros/fix.json           # Workflow definitions
  cycles/                   # Execution history
    2026-01-15_fix_abc123/
      input.txt
      steps/01-impact.md
      steps/02-plan.md
      ...

🧑‍💻 Development

See docs/DEVELOPMENT.md for setup, testing, and releases.

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.1.3.tar.gz (24.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.1.3-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: macrocycle-0.1.3.tar.gz
  • Upload date:
  • Size: 24.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.1.3.tar.gz
Algorithm Hash digest
SHA256 154cf79936fe5339ea203f330eefeabebf37774431681dca25e0d20c678f44b2
MD5 3c8b265217d9dbcc6c2f88f4db8b54fa
BLAKE2b-256 0ad32b8d61b2185357f9df5eb484f5b40e3e106fa6dd0d256ea9dbf012275077

See more details on using hashes here.

Provenance

The following attestation bundles were made for macrocycle-0.1.3.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.1.3-py3-none-any.whl.

File metadata

  • Download URL: macrocycle-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 39.0 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.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 40d1f1dcdf851972fe993cbf27f9ee56b17ed505bf15271037a4ca4402f1db1b
MD5 dc8494f6dec9165785140f87af82308d
BLAKE2b-256 b6017958dc83a23677a7137556395caf29ac7c554490fb7c30f636d7f575f28b

See more details on using hashes here.

Provenance

The following attestation bundles were made for macrocycle-0.1.3-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