Loading repository data…
Loading repository data…
sun-praise / repository
Issue/PR-driven autonomous development system for GitHub, built with FastAPI, agent workers, and local/runtime automation.
English | 简体中文
software-factory is a lightweight FastAPI-based issue/PR-driven autonomous development system.
It focuses on turning issue intake, PR review feedback, autofix execution, and write-back into a traceable, extensible, locally runnable loop.
This project is intended for local development and validation only. Many security checks and deployment hardening steps are still incomplete, so it should not be exposed directly to production or untrusted networks.
The core idea is simple: issues, hooks, and GitHub webhooks decide when work should start; the agent worker executes the change flow; and the web UI only exposes the operational state that matters.
In a typical review workflow, the repetitive loop is often:
"read comments -> summarize issues -> ask AI to fix them again".
This project aims to standardize that loop into an automated closed system:
Non-goals:
This project is not trying to become a general CI/CD platform, and it does not aim to cover the full DevOps lifecycle. A more accurate description is:
Issue/PR-driven Autonomous Development SystemAI-native GitHub Issue & PR OrchestratorIts scope is specifically:
Compared with familiar open-source systems, it is closer to:
OpenHands or SWE-agent style AI execution agentsProw or Zuul style event-driven review / CI orchestration systemsAnd not to broader DevOps products such as Harness or GitLab.
Hook (Claude Code lifecycle)
-> Local Orchestrator API
-> State Store / Queue
-> GitHub Webhook Adapter
-> Review Normalizer
-> Agent Worker
-> Thin Web
Main responsibilities:
Milestone overview:
/hook-events and /github/webhook endpointsOpenCode Review + Pytest)pull_request_review, pull_request_review_comment, and issue_comment supportP0-P3), and noise filteringlint / test)MAX_AUTOFIX_PER_PR)Anything not explicitly described here should be treated as out of scope for the current project stage.
Before you run it:
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
cp example.env .env
DB_PATH for every local process. See docs/local-runtime.md for the rule and failure mode.export DB_PATH="$(pwd)/data/software_factory.db"
python scripts/init_db.py
env DB_PATH="$DB_PATH" uvicorn app.main:app --host 127.0.0.1 --port 8001 --reload
DB_PATH.env DB_PATH="$DB_PATH" python scripts/run_worker.py --loop --workspace-dir "$(pwd)"
Copy this into Codex / Claude / OpenCode when you want an agent to install and verify the project locally. The detailed install steps now live in docs/agent-install.md. Repository: https://github.com/sun-praise/software-factory
Install and verify the GitHub repository https://github.com/sun-praise/software-factory locally.
If the repository is not already open, clone or open it first.
Then work from the repository root and follow docs/agent-install.md and docs/local-runtime.md exactly.
Do not modify application code just to make local setup pass.
If something fails, report the exact failing command, the root cause, and the smallest fix.
See docs/local-runtime.md for local runtime details and DB_PATH constraints.
Local runtime warning:
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements.txt
Runtime requirements:
autofix_runs queue claiming uses RETURNING; older versions automatically fall back to a compatibility path)cp example.env .env
Edit .env as needed. Values in parentheses are defaults:
Base settings:
APP_ENV (development): runtime environment labelHOST (127.0.0.1): bind addressPORT (8000): listen portDB_PATH (./data/software_factory.db): SQLite file pathGITHUB_WEBHOOK_SECRET (empty): can be left empty for local debugging; production should enable signature verificationGITEE_WEBHOOK_SECRET (empty): used when WEBHOOK_PROVIDER=giteeGITHUB_TOKEN (empty): GitHub API token for PR metadata, comments, and webhook enrichmentGITEE_TOKEN (empty): Gitee API token for PR metadata, comments, and webhook enrichmentFORGE_PROVIDER (github): forge provider, set to gitee to create/comment/query PRs on GiteeTASK_SOURCE_PROVIDER (github): task-source provider, set to gitee to resolve Gitee task URLsWEBHOOK_PROVIDER (github): webhook provider, set to gitee for Gitee webhook headers/signaturesGIT_REMOTE_PROVIDER (github): remote URL provider, set to gitee for clone and PR linksWebhook settings:
GITHUB_WEBHOOK_DEBOUNCE_SECONDS (60): debounce window in secondsReliability settings (M6):
MAX_AUTOFIX_PER_PR (3): max autofix attempts per PRMAX_CONCURRENT_RUNS (3): max concurrent runsPR_LOCK_TTL_SECONDS (900): PR lock TTL in secondsMAX_RETRY_ATTEMPTS (3): max retry attemptsRETRY_BACKOFF_BASE_SECONDS (30): base retry delayRETRY_BACKOFF_MAX_SECONDS (1800): max retry delayFiltering settings (M6):
BOT_LOGINS (empty): comma-separated bot accounts, for example github-actions[bot],dependabot[bot]NOISE_COMMENT_PATTERNS (empty): comma-separated noise comment regex patterns, for example ^/retest\b,^/resolve\bMANAGED_REPO_PREFIXES (empty): comma-separated managed repo prefixes, for example acme/,widgets/AUTOFIX_COMMENT_AUTHOR (software-factory[bot]): autofix comment author labelLogging settings (M6):
LOG_DIR (logs): log directoryLOG_ARCHIVE_SUBDIR (archive): log archive subdirectoryLOG_RETENTION_DAYS (7): log retention daysWORKER_ID (worker-default): worker identifierAgent runner settings:
Ralph, Claude Agent SDK, and OpenHandsRALPH_COMMAND (default ralph): optional env override for the Ralph CLI command used by the workerRALPH_COMMAND_TIMEOUT_SECONDS (default 1800): optional env override for Ralph execution timeoutralph executable in PATH if Ralph mode is enabled or selected as primarypython scripts/init_db.py
This creates four core tables: sessions, pull_requests, review_events, and autofix_runs.
uvicorn app.main:app --host 127.0.0.1 --port 8001 --reload
web and worker in the background.chmod +x scripts/start_system_bg.sh
./scripts/start_system_bg.sh start
Common management commands:
./scripts/start_system_bg.sh status
./scripts/start_system_bg.sh logs
./scripts/start_system_bg.sh stop
Notes:
.env from the repository root firstweb and worker are forced to share the same DB_PATH.runtime/local/Health check:
curl -i http://127.0.0.1:8001/healthz
Simulate a hook event (/hook-events):
curl -i -X POST http://127.0.0.1:8001/hook-events \
-H 'content-type: application/json' \
-d '{"event":"UserPromptSubmit","session_id":"sess_demo","repo":"owner/repo","branch":"feat/demo","cwd":"/tmp/software-factory","timestamp":"2026-03-12T12:00:00Z"}'
Note: the current implementation identifies the event type via the JSON body event field and does not read the x-event-type header.
Simulate a GitHub webhook (/github/webhook):
curl -i -X POST http://127.0.0.1:8001/github/webhook \
-H 'content-type: application/json' \
-H 'x-github-event: pull_request_review' \
-d '{"action":"submitted","review":{"id":123},"pull_request":{"number":10}}'
Note: /github/webhook already validates signatures. In production, `GITHUB_