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"

🖥️ Interactive TUI

Launch the interactive terminal UI for batch processing:

macrocycle tui

The TUI guides you through:

  1. Select a source — Connect to Sentry, GitHub, or other integrations
  2. Pick issues — Multi-select work items to process
  3. Choose workflow — Select which macro to apply
  4. Watch progress — Live progress bars for parallel execution
  5. Review results — Summary of succeeded/failed items

Perfect for processing multiple issues without writing scripts.

🔄 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
macrocycle tui                       # Launch interactive TUI
macrocycle work sources              # List available integrations
macrocycle work list -s sentry       # List issues from a source
macrocycle work fix <id> -s sentry   # Fix a specific issue

✏️ 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.2.0.tar.gz (49.2 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.2.0-py3-none-any.whl (75.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for macrocycle-0.2.0.tar.gz
Algorithm Hash digest
SHA256 69ad2466e0c86e2f484d6e5cce1b61af1dc648622289e14b0c3461e6e94c776d
MD5 4edf5bf72eef94d480a92680a09dd85c
BLAKE2b-256 f39771215fce1c260824fb6e12f1f7ef8b847c074a14a8529ff613c2a92a578b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: macrocycle-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 75.4 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2da1c17571c67761459902862f0ad8eaa81d58c7f750fa5346629be6826bd976
MD5 e01b6e81c719b12e7f1c3fb7978529da
BLAKE2b-256 be7a38638581dc7e98c2647c1997d18248e39398d49dc933f504ffb763ce4a07

See more details on using hashes here.

Provenance

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