Codefactory
Autonomous GitHub PR babysitter — watches your repos, triages review feedback, and dispatches AI agents to fix code.
Install / Use
/learn @yungookim/CodefactoryQuality Score
Category
Development & EngineeringSupported Platforms
README
Code Factory - get to unsupervised software development
<p align="center"> <img width="409" height="409" alt="image__7_-removebg-preview" src="https://github.com/user-attachments/assets/ca339a71-40d9-4619-900f-55825f30a57f" /> </p>Autonomous GitHub PR babysitter — watches your repos, triages review feedback, and dispatches AI agents to fix code.
Stop babysitting pull requests manually. Code Factory watches your GitHub repos, syncs review comments into a local dashboard, auto-triages feedback, and launches Claude Code CLI or Codex agents to fix everything — all running on your machine.
Note: This project is intended for those obsessed with development speed
<img width="1365" height="686" alt="SCR-20260318-qsva-2" src="https://github.com/user-attachments/assets/66dfa082-c732-4989-8b05-f19aa550acb5" />
Why Code Factory?
This is what Code Factory is good at:
- Watch the PR to check for PR feedback from humans, agents, failing lint/tests, conflicts etc and auto-fix them
- Automatically generate lacking tests for all open PR
- Auto-generate and update user-facing documents
Code Factory runs locally and uses the CLI coding agents that are already installed in your machine. No need to add OPEN_API_KEY or any such. Just install & have it running and let it do its thing.
Managing PR feedback across multiple repositories is tedious. Review comments pile up, context-switching kills productivity, and small fixes sit idle for hours. Code Factory automates the entire feedback loop:
- Watch one or more GitHub repositories for open pull requests
- Sync review comments, reviews, and discussion threads into persistent local storage
- Triage feedback into
accept,reject, orflagbuckets — automatically or manually - Dispatch Claude or Codex agents in isolated git worktrees to apply approved changes
- Ask follow-up questions about PR status, feedback, and activity from the dashboard
- Resolve merge conflicts automatically using AI-powered conflict resolution
- Push verified fixes back to the PR branch with full audit logs
All of this happens locally on your machine. No hosted service, no data leaving your environment.
How It Works
On startup, Code Factory restores the watcher schedule, resumes interrupted runs, and starts a sync cycle immediately.
<img width="969" height="572" alt="image" src="https://github.com/user-attachments/assets/b9dbd102-ae2e-4837-a862-a0282bdfa0b8" />- Add a repository to the watch list or register a PR directly by URL.
- The watcher polls GitHub, auto-registers open PRs, archives PRs that closed upstream, and queues babysitter runs.
- Each run syncs PR metadata and review feedback into SQLite and mirrored logs while preserving prior decisions and run state.
- The babysitter evaluates pending comments and failing CI statuses with the configured agent; accepted items become actionable tasks.
- If work is needed, Code Factory prepares an app-owned repo cache and isolated worktree under
~/.codefactory, and resolves merge conflicts there when needed. - The agent works inside that isolated worktree, runs verification, commits, and pushes directly to the PR branch.
- Code Factory re-syncs GitHub, posts follow-up comments, resolves review threads, polls CI on the new commit, and returns the PR to
watching.
Features
| Feature | Description | |---------|-------------| | Multi-repo watching | Monitor multiple GitHub repos simultaneously | | PR registration | Add individual PRs by URL for one-off tracking | | Smart triage | Auto-categorize feedback with manual override support | | Agent flexibility | Choose between Claude and Codex for code remediation | | PR Q&A | Ask the configured agent questions about a PR and get context-aware answers from feedback and logs | | Isolated worktrees | Agent runs happen in detached git worktrees — zero risk to your working copy | | Persistent state | SQLite-backed storage survives restarts | | Activity logs | Daily mirrored log files with full run details | | Trusted reviewers | Configure whose feedback gets auto-accepted | | Conflict resolution | Automatically resolve merge conflicts using AI agents | | Bot filtering | Ignore noise from dependabot, codecov, and other bots | | Real-time dashboard | React-based UI with live status, triage controls, PR Q&A, and config management |
Tech Stack
| Layer | Technology |
|-------|-----------|
| Server | Node.js 22+, TypeScript (strict), Express 5 |
| Client | React 18, Vite, TanStack Query, Tailwind CSS, shadcn/ui |
| Storage | SQLite via node:sqlite, Drizzle ORM |
| GitHub | Octokit + gh auth token fallback |
| Agents | Claude CLI or Codex CLI |
| Testing | Node test runner with tsx |
Quick Start
Prerequisites
- Node.js 22+ (tested with Node v24.12.0)
- npm
- git
- A GitHub token (via
GITHUB_TOKEN, app config, orgh auth login) - Either
codexorclaudeCLI installed
Install & Run
# Clone the repository
git clone https://github.com/yungookim/codefactory.git
cd codefactory
# Install dependencies
npm install
# Start in development mode
npm run dev
The server starts on port 5001 (configurable via PORT) and serves both the API and the dashboard.
Production Build
npm run build # Build the production bundle
npm run start # Start the production server
Other Commands
npm run check # TypeScript strict typecheck
npm run lint # ESLint validation
npm run test # Run all tests
npm run db:push # Push Drizzle schema changes
Authentication
GitHub auth is resolved in order:
GITHUB_TOKENenvironment variable- Token stored in app config (via the dashboard)
gh auth token(GitHub CLI fallback)
Configuration
All configuration is managed through the dashboard or the API. Persisted settings include:
| Setting | Description |
|---------|-------------|
| Agent | codex or claude |
| Model | Model name for the selected agent |
| Max turns | Maximum agent conversation turns |
| Polling interval | How often to check GitHub for updates |
| Batch window | Time window for batching feedback |
| Max changes per run | Limit on changes per agent execution |
| Watched repositories | List of repos to monitor |
| Trusted reviewers | Reviewers whose feedback is auto-accepted |
| Ignored bots | Bot accounts to filter out (defaults: dependabot, codecov, github-actions) |
Local State & Filesystem
| Path | Purpose |
|------|---------|
| ~/.codefactory/state.sqlite | Durable app state |
| ~/.codefactory/log/ | Daily mirrored activity logs |
| ~/.codefactory/repos/ | App-owned repo caches used to create clean PR worktrees |
| ~/.codefactory/worktrees/ | Isolated PR worktrees for agent runs |
Override the root path with the CODEFACTORY_HOME environment variable.
API Reference
The dashboard communicates with the server through a REST API:
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /api/repos | List watched repositories |
| POST | /api/repos | Add a repository to watch |
| GET | /api/prs | List tracked pull requests |
| GET | /api/prs/:id | Get PR details with feedback |
| POST | /api/prs | Register a PR by URL |
| DELETE | /api/prs/:id | Remove a tracked PR |
| POST | /api/prs/:id/fetch | Force-refresh PR feedback |
| POST | /api/prs/:id/triage | Run triage on a PR |
| POST | /api/prs/:id/apply | Apply accepted changes via agent |
| POST | /api/prs/:id/babysit | Run full babysit cycle |
| PATCH | /api/prs/:id/feedback/:feedbackId | Update feedback triage status |
| GET | /api/prs/:id/questions | List PR question/answer history |
| POST | /api/prs/:id/questions | Ask the configured agent a question about the PR |
| GET | /api/logs | Retrieve activity logs |
| GET | /api/config | Get current configuration |
| PATCH | /api/config | Update configuration |
Project Structure
client/ React dashboard (Vite + Tailwind + shadcn/ui)
server/ Express API, babysitter logic, GitHub integration, storage
shared/ Shared Zod schemas and TypeScript types
script/ Build tooling
docs/plans/ Design and implementation planning documents
tasks/ Project lessons and working notes
For OpenClaw agents
This section is addressed to you, the OpenClaw agent. Read it in full before interacting with Code Factory.
What you can do
You have access to Code Factory via its MCP server. Code Factory is a local PR babysitter: it watches GitHub repositories, syncs review feedback, triages it, and dispatches AI agents to apply fixes. Every feature is available to you as an MCP tool.
Step 1 — Check whether Code Factory is already running
Before doing anything, verify the server is up:
GET http://localhost:5001/api/runtime
If you get a 200 response, Code Factory is running and you can proceed to Step 3. If the connection is refused, go to Step 2.
Step 2 — Install and start Code Factory
Run these shell commands on the local machine:
git clone https://github.com/yungookim/codefactory.git
cd codefactory
npm install
npm run dev &
Wait until you see serving on port 5001 in the output, then confirm with GET http://localhost:5001/api/runtime before continuing.
Step 3 — How to use your MCP tools
All tools communicate with `http://l
Related Skills
apple-reminders
336.9kManage Apple Reminders via remindctl CLI (list, add, edit, complete, delete). Supports lists, date filters, and JSON/plain output.
bluebubbles
336.9kUse when you need to send or manage iMessages via BlueBubbles (recommended iMessage integration). Calls go through the generic message tool with channel="bluebubbles".
gh-issues
336.9kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
imsg
336.9kiMessage/SMS CLI for listing chats, history, and sending messages via Messages.app.
