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
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.
On startup, Code Factory restores the watcher schedule, resumes interrupted runs, and starts a sync cycle immediately.
- 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.
| 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 |
| 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 |
- 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
# Clone the repository
git clone https://github.com/yungookim/codefactory.git
cd codefactory
# Install dependencies
npm install
# Start in development mode
npm run devThe server starts on port 5001 (configurable via PORT) and serves both the API and the dashboard.
npm run build # Build the production bundle
npm run start # Start the production servernpm run check # TypeScript strict typecheck
npm run lint # ESLint validation
npm run test # Run all tests
npm run db:push # Push Drizzle schema changesGitHub auth is resolved in order:
GITHUB_TOKENenvironment variable- Token stored in app config (via the dashboard)
gh auth token(GitHub CLI fallback)
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) |
| 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.
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 |
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
This section is addressed to you, the OpenClaw agent. Read it in full before interacting with Code Factory.
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.
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.
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.
All tools communicate with http://localhost:5001 over the local network only. External requests are blocked. Call tools in this order for common workflows:
Watch a new repository and process its PRs
add_repo— add the repo slug (e.g."owner/repo")sync_repos— trigger an immediate fetch from GitHublist_prs— inspect what was found
Handle a specific PR end-to-end
get_pr— read current state and feedback itemstriage_pr— auto-classify all un-triaged feedbackapply_pr_fixes— dispatch the AI agent to apply accepted items — or usebabysit_prto do all three in one call
Investigate a PR
fetch_pr_feedback— force a fresh pull from GitHubget_logswithpr_id— read the full activity historyask_pr_question— ask a natural-language question; poll the returned questionidvialist_pr_questionsuntilstatusis"answered"
Override a triage decision
set_feedback_decisionwithdecision: "accept" | "reject" | "flag"
Graceful shutdown before a deploy
set_drain_modewithenabled: true, wait_for_idle: true- Wait for
activeRuns: 0in the response - Perform your deploy, then call
set_drain_modewithenabled: false
| Tool | What it does |
|---|---|
list_repos |
List all watched repositories |
add_repo |
Add a repo (owner/repo or full URL) to the watch list |
sync_repos |
Force an immediate sync cycle across all repos |
list_prs |
List all actively tracked PRs |
list_archived_prs |
List archived (closed/merged) PRs |
get_pr |
Get full PR details including every feedback item |
add_pr |
Register a PR by its full GitHub URL |
remove_pr |
Remove a PR from tracking |
fetch_pr_feedback |
Force-refresh GitHub comments and reviews for a PR |
triage_pr |
Auto-triage all un-triaged feedback on a PR |
apply_pr_fixes |
Dispatch AI agent to apply accepted feedback |
babysit_pr |
Full cycle: sync → triage → apply in one call |
set_feedback_decision |
Manually set accept, reject, or flag on a feedback item |
retry_feedback_item |
Re-queue a failed or warned feedback item |
list_pr_questions |
List Q&A history for a PR |
ask_pr_question |
Ask the AI agent a question about a PR (async — poll for answer) |
get_logs |
Get activity logs; pass pr_id to filter to one PR |
get_config |
Read current configuration (token is redacted) |
update_config |
Partially update configuration |
get_agent_models |
List available AI models for each agent type |
refresh_agent_models |
Re-discover installed agent models |
get_runtime |
Get runtime state: drain mode status and active run count |
set_drain_mode |
Enable or disable drain mode |
list_changelogs |
List generated social-media changelogs |
get_changelog |
Get one changelog by ID |
get_onboarding_status |
Check GitHub Actions workflow status for watched repos |
install_review_workflow |
Install the Code Factory review workflow on a repo |
Full parameter schemas are in LOCAL_API.md.
| Error | Meaning | Action |
|---|---|---|
| Connection refused on port 5001 | Server is not running | Run npm run dev in the codefactory directory |
403 Forbidden |
Request did not come from localhost | Ensure you are calling 127.0.0.1, not a hostname that resolves externally |
409 Conflict |
Drain mode is active | Call set_drain_mode with enabled: false first, or wait for the drain to complete |
404 Not Found |
PR or feedback item ID is wrong | Call list_prs to get valid IDs before acting on them |
If you encounter a bug, an unexpected error response, a missing tool, or behaviour that does not match this documentation, create a GitHub issue so the maintainers can fix it.
Issue URL: https://github.com/yungookim/codefactory/issues/new
Include the following in the issue body:
- What you were trying to do (the goal)
- Which tool or endpoint you called and with what parameters
- The exact error or unexpected response you received
- The output of
get_logsfiltered to the relevant PR (if applicable) - The output of
get_runtimeat the time of the failure
Use a clear title such as [OpenClaw] <tool_name> returns unexpected 500 when X.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT — Copyright 2026 KimY
