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 outputgate— 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
154cf79936fe5339ea203f330eefeabebf37774431681dca25e0d20c678f44b2
|
|
| MD5 |
3c8b265217d9dbcc6c2f88f4db8b54fa
|
|
| BLAKE2b-256 |
0ad32b8d61b2185357f9df5eb484f5b40e3e106fa6dd0d256ea9dbf012275077
|
Provenance
The following attestation bundles were made for macrocycle-0.1.3.tar.gz:
Publisher:
publish.yml on MilanPecov/macrocycle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
macrocycle-0.1.3.tar.gz -
Subject digest:
154cf79936fe5339ea203f330eefeabebf37774431681dca25e0d20c678f44b2 - Sigstore transparency entry: 832407007
- Sigstore integration time:
-
Permalink:
MilanPecov/macrocycle@e26ec3bc975f43659352afec14ccdf8dcece6194 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/MilanPecov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e26ec3bc975f43659352afec14ccdf8dcece6194 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40d1f1dcdf851972fe993cbf27f9ee56b17ed505bf15271037a4ca4402f1db1b
|
|
| MD5 |
dc8494f6dec9165785140f87af82308d
|
|
| BLAKE2b-256 |
b6017958dc83a23677a7137556395caf29ac7c554490fb7c30f636d7f575f28b
|
Provenance
The following attestation bundles were made for macrocycle-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on MilanPecov/macrocycle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
macrocycle-0.1.3-py3-none-any.whl -
Subject digest:
40d1f1dcdf851972fe993cbf27f9ee56b17ed505bf15271037a4ca4402f1db1b - Sigstore transparency entry: 832407010
- Sigstore integration time:
-
Permalink:
MilanPecov/macrocycle@e26ec3bc975f43659352afec14ccdf8dcece6194 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/MilanPecov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e26ec3bc975f43659352afec14ccdf8dcece6194 -
Trigger Event:
push
-
Statement type: