No description
Find a file
openhands 7fd913596b fix: write_state_entry defined after call site — crashes dev-agent
Function was defined at line 867 but called at line 550. Bash requires
functions to be defined before invocation. Moved to top with other
helpers. Also removed duplicate definition.
2026-03-14 11:01:05 +00:00
dev fix: write_state_entry defined after call site — crashes dev-agent 2026-03-14 11:01:05 +00:00
factory factory: learned — keccak-derived FEE_DEST requires anvil_setBalance before impersonation 2026-03-13 22:34:44 +00:00
gardener fix: gardener must ACTION or ESCALATE every tech-debt issue, never skip 2026-03-14 08:40:19 +00:00
lib refactor: ci-debug to lib, rewrite README 2026-03-12 18:10:25 +00:00
review feat: dark factory — autonomous CI/CD agents for harb 2026-03-12 12:44:15 +00:00
.env.example feat: dark factory — autonomous CI/CD agents for harb 2026-03-12 12:44:15 +00:00
.gitignore fix: gitignore *.log.old, *.log.*, escalations.jsonl 2026-03-13 10:43:37 +00:00
README.md refactor: ci-debug to lib, rewrite README 2026-03-12 18:10:25 +00:00

🏭 Dark Factory

Autonomous CI/CD factory for harb. Three agents, zero supervision needed.

Architecture

cron (*/10) ──→ factory-poll.sh   ← supervisor (bash checks, zero tokens)
                 ├── all clear? → exit 0
                 └── problem? → claude -p (diagnose, fix, or escalate)

cron (*/10) ──→ dev-poll.sh       ← pulls ready issues, spawns dev-agent
                 └── dev-agent.sh  ← claude -p: implement → PR → CI → review → merge

cron (*/10) ──→ review-poll.sh    ← finds unreviewed PRs, spawns review
                 └── review-pr.sh  ← claude -p: review → approve/request changes

Setup

# 1. Clone
git clone ssh://git@codeberg.org/johba/dark-factory.git
cd dark-factory

# 2. Configure
cp .env.example .env
# Fill in your tokens (see .env.example for descriptions)

# 3. Install cron (staggered — supervisor first, then review, then dev)
crontab -e
# Add:
#   0,10,20,30,40,50 * * * * /path/to/dark-factory/factory/factory-poll.sh
#   3,13,23,33,43,53 * * * * /path/to/dark-factory/review/review-poll.sh
#   6,16,26,36,46,56 * * * * /path/to/dark-factory/dev/dev-poll.sh

# 4. Verify
bash factory/factory-poll.sh   # should log "all clear"

Directory Structure

dark-factory/
├── .env.example        # Template — copy to .env, add secrets
├── .gitignore          # Excludes .env, logs, state files
├── lib/
│   ├── env.sh          # Shared: load .env, PATH, API helpers
│   └── ci-debug.sh     # Woodpecker CI log/failure helper
├── dev/
│   ├── dev-poll.sh     # Cron entry: find ready issues
│   └── dev-agent.sh    # Implementation agent (claude -p)
├── review/
│   ├── review-poll.sh  # Cron entry: find unreviewed PRs
│   └── review-pr.sh    # Review agent (claude -p)
└── factory/
    ├── factory-poll.sh # Supervisor: health checks + claude -p
    ├── PROMPT.md       # Supervisor's system prompt
    ├── update-prompt.sh# Self-learning: append to best-practices
    └── best-practices/ # Progressive disclosure knowledge base
        ├── memory.md
        ├── disk.md
        ├── ci.md
        ├── codeberg.md
        ├── dev-agent.md
        ├── review-agent.md
        └── git.md

Design Principles

  • Bash for checks, AI for judgment — health checks are shell scripts; AI is only invoked when something needs diagnosing or fixing
  • Pull over push — dev-agent derives readiness from merged dependencies, not labels or manual assignment
  • Progressive disclosure — the supervisor reads only the best-practices file relevant to the current problem, not all of them
  • Self-improving — when the AI fixes something new, it appends the lesson to best-practices for next time

Requirements