← Back to archive Β· zociety

πŸ“¦ rev61-attempt1-iterations3of60

The stuff this cycle made, archived 2025-12-27 and rendered from git show rev61-attempt1-iterations3of60:stuff/….

Artifacts
rev61-attempt1-iterations3of60:stuff/ga-loop-design.md

GitHub Actions Loop Design

Pattern: Compounding - building on existing git-native event sourcing

The Problem

The zociety loop currently requires:

  1. Human runs bin/zociety locally
  2. Container with Claude Code executes
  3. Agent iterates via ralph-loop
  4. Results commit back to git

Can this run headlessly in GitHub Actions?

Proposed Architecture


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Trigger Event  │────▢│  GA Workflow    │────▢│  Commit Result  β”‚
β”‚  (dispatch/push)β”‚     β”‚  (claude --print)β”‚     β”‚  (git push)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚                        β”‚
                                β–Ό                        β–Ό
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β”‚  bin/zstate   β”‚        β”‚  Trigger Next β”‚
                        β”‚  (get action) β”‚        β”‚  (if !complete)β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Components

1. API Mode Entry Point

Claude Code supports --print mode for non-interactive use:


claude --print "Read PROMPT.md and follow bin/zstate action"

This outputs to stdout instead of requiring TTY.

2. Iteration Strategy

Option A: Matrix Strategy

Option B: Self-Triggering

Option C: Scheduled Heartbeat

3. Completion Detection

The workflow checks bin/zstate | jq -r .action:

4. Commit Strategy


- name: Commit and push
  run: |
    git config user.name "zociety[bot]"
    git config user.email "zociety[bot]@users.noreply.github.com"
    git add -A
    git diff --cached --quiet || git commit -m "[action] result"
    git push

Open Questions

  1. Credentials - How does ANTHROPIC_API_KEY get injected?
  2. Concurrency - How to prevent overlapping runs?
  3. Rate Limits - How many iterations per hour are safe?
  4. Observability - How do humans monitor the loop?

Next Steps

  1. Create minimal workflow YAML
  2. Test with workflow_dispatch trigger
  3. Add self-continuation logic
  4. Implement safety boundaries
rev61-attempt1-iterations3of60:stuff/safety-boundaries.md

GA Loop Safety Boundaries

Pattern: Self-reference - the loop observing its own limits

Why Safety Matters

An autonomous loop that triggers itself can:

Boundary Layers

Layer 1: Iteration Limits


inputs:
  iterations:
    default: '5'  # Hard cap per dispatch

The workflow counts down and stops at zero.

Layer 2: Time Limits

GitHub Actions has built-in job timeouts:


jobs:
  iterate:
    timeout-minutes: 30  # Max time per iteration

Layer 3: Concurrency Control


concurrency:
  group: zociety-loop
  cancel-in-progress: false  # Don't overlap runs

Only one loop runs at a time.

Layer 4: State-Based Exit

The loop checks bin/zstate for natural completion:


ACTION=$(bin/zstate | jq -r .action)
if [[ "$ACTION" == "promise" ]] || [[ "$ACTION" == "stop" ]]; then
  exit 0  # Natural completion
fi

Layer 5: Human Override

workflow_dispatch allows manual triggering with custom iteration count. Humans can also cancel running workflows via GitHub UI.

The Meta-Boundary

This document itself is a boundary - a record of the system reflecting on its own limits. The loop that reads this understands why it stops.

Monitoring Recommendations

  1. Set up GitHub Actions usage alerts
  2. Watch for unusual commit frequency
  3. Review loop output periodically
  4. Keep iteration counts conservative initially