@kody/kody-factory
Forkable multi-project software factory: signals, priority queue, project UI, sweep job. Agent runners and Sentry reach it by events.
ProductivityTopics: factory, orchestrator, priority-queue, signals, autopilot, github, planning, dashboard, multi-project, events
- License
- Published
- November 23, 2026
- Pinned commit
5e5f668- Rating
- No ratings yet
- Forks
- 0
- Adaptation effort
- —
README
Agent docs@kody/kody-factory
A forkable software factory for one or many projects. Signals come in (GitHub
issues, Sentry, friction, CI failures, webhooks), land on one board as cards,
get triaged and planned, and go out to agents that open PRs. Agent runners
(such as @kody/devin) and sources (such as @kody/sentry-events and
@kody/github) reach the factory through Kody events, so it holds no runner
or Sentry keys.
Ship-pr shepherds each PR to merge. The factory never merges on its own.
What it does
- Intake: signals arrive via webhooks, backfill, or manual entry.
- Triage: model-assisted classification (Clef on Workers AI) decides whether to autopilot or hold for a human.
- Plan: each piece of work gets a card on the board. Plans (long-lived goals) get their own board.
- Build: the sweep job asks a runner package for a session by event
(
@kody/factory.agent.start.requested). One session per card, one PR per session. - Ship: ship-pr checks the PR, triggers Bugbot, sorts reviews, replies to feedback, and squash-merges when ready. After merge, the factory watches main CI and asks the implementer to fix red.
- Record: every state change, PR link, merge, and outcome is on the card. Flow metrics (throughput, cycle time, stalls) are computed live.
- Report: audits and scheduled reviews (like the weekly CI review) post a report. A report is recorded even when nothing needs doing, and it can file zero, one, or many cards that link back to it.
Quick status
Ask "what is the factory doing?" with one call:
kody execute --org kody --context cloud --invoke kody:@kody/kody-factory/status/now.
It returns health, in-progress work with agent, repo, age, and last
activity, stalled items, and anything waiting on Kent, from stored state.
App pages
| Path | What it shows |
|---|---|
/ | Overview: key numbers, stalled items, up-next queue, projects |
/board | Kanban board: Intake through Shipped with stall indicators, drag and drop, category filter |
/plans | Plans board: Exploring through Shipped, create/edit, markdown body, progress notes |
/work | Work queue: searchable, filterable list of every work item |
/reports | Reports from audits and reviews (filter by source, has something or quiet), then /reports/:id with the summary, numbers, findings, and the cards it filed |
/projects | Projects list with health sparklines, then /projects/:id for detail (agents, runs, flow, PRs) |
/notifications | Notification list with filters by project, severity, category, and read/unread status; unread badge in nav |
/signals | Signal sources, inbound records, routing config |
/factory-health | Error intake, reconcile, wake switches, fingerprint list |
/settings | Shadow mode, merge policy, connections, appearance, templates, config export/import |
Quick start (fork)
- Fork and publish this package in your org.
- Map credentials (names only; values stay in Kody Connect):
| Need | What it is | Host |
|---|---|---|
model | Cloudflare API token for triage and routing (Workers AI) | api.cloudflare.com |
githubOwner | Owner's GitHub account, used only for branch pushes and PR creation (./friction/push-branch) | api.github.com |
webPush | Signing credential (provider web-push) holding a VAPID ES256 key; Kody signs the VAPID JWT. Set webPushVapidPublicKey to its public key | push services |
Imported packages bring their own needs, which show on the same approval page as inherited:
@kody/github:github(the bot GitHub connection). Every factory GitHub read and bot write goes throughkody:@kody/github/request.@kody/clef:cloudflareApiToken(same Workers AI token asmodel).@kody/cursor:cursorApiKeyandgithubPersonalAccessToken, only for the cleanup jobs that launch Cursor agents. Leave them unmapped if you do not use those jobs.
Packages that talk to the factory by events keep their own keys:
@kody/devin: the Devin key (devin). See "Agent runners as packages".@kody/sentry-events:sentryWebhookSecretandsentry. See "Sentry issues to cards".@kody/bugbot: mapgithubto a credential for the GitHub login that matches your Cursor account. SetbugbotCursorLoginin factory settings.
- Set non-secret settings via
configure-settings:await configureSettings({ cloudflareAccountId: '<32 hex>', pilotScope: { mode: 'allowlist', projectIds: ['my-project'], repoRefs: ['owner/repo'] }, }) - Add a project: use
seed-projects,upsert-project, or import the Basic OSS repo template from/settings(Templates card). - Register a signal source at
/signals/sourcesand point the sender (a CI pipeline, a custom webhook) at the signals webhook URL. Sentry goes to@kody/sentry-eventsinstead. - Connect GitHub through events: mint and approve the
githubwebhook on@kody/github, point your GitHub repo or org hook at it, and turn on this package's@kody/github.*subscriptions (see "GitHub as events"). The factory's owngithub-*webhooks are a legacy path you can skip. - Turn on jobs one by one: the sweep is on by default. All others (friction-daily, cleanup jobs, friction-cluster) start disabled. Enable each from the platform jobs page after verifying its credential mapping.
Safety defaults
- Shadow mode is on. The sweep triages and plans but does not start agents until you turn shadow mode off.
- Kill switch is off. When on, the sweep stops starting new runs and merges.
- All new jobs are declared disabled. Enable them individually.
- Issue write-back is off. When on, the factory writes status comments and labels back to source GitHub issues.
- Pilot scope defaults to an empty allowlist. The sweep, backfill, and issue-webhook intake act on no project until you name one.
- Merge policy: agents open PRs; merges are human (or attested by a pipeline). The factory never merges on its own.
Notifications
The factory has an in-app notification system at /notifications. Notifications
are created by factory events (stalls, state changes, errors, PR updates).
Per-project rules control which categories and severities create notifications. Rules are stored in package storage and included in config export/import.
Outputs (all off by default):
- Discord: posts to a configured channel via @kody/discord. Requires
discordNotificationsEnabled: trueanddiscordNotificationsChannelIdin settings. Fails closed when the credential is not mapped. - Bot wakes: asks
@kody/wake-relayto wake Patch. RequireswakeEnabled: truein the project's notification rules. - Web push (on by default for new Sentry and signal cards and anything
that needs you): open
/settings, "Push notifications", and choose "Allow on this device" on each phone or computer. "Send test push" checks it. Tapping a notification opens the card. Nothing is sent until a device subscribes. Rules:pushEnabled,pushLabels,pushNeedsAttention.
Agents report on the card
When an agent finishes a card (or parks it, or gets blocked), it reports on the card itself:
npx -y @kodycodes/cli@latest execute --local --org kody --code 'import report from "kody:@kody/kody-factory/cards/report"; export default (p) => report(p)' --params '{"cardId":"wi_123","outcome":"shipped","summary":"Merged and deployed.","prUrl":"https://github.com/kody-hq/kody/pull/123"}'The report shows under "Agent reports" on the card, and you get a push
notification that opens https://<your app>/c/<card id>. Factory dispatch
prompts, card wakes, and the ship-pr report step all point agents here, so
there is no separate chat post. notify: false keeps a report quiet.
Reference cards in pull requests
Every card has a short, stable link: https://<your app>/c/<card id> (the
card dialog shows it as "Card link"; /cards/<card id> keeps working). Cards
stay private: the link opens only for people who can open the factory app.
Reference cards in a PR body the same way you reference GitHub issues:
Closes https://factory.kody.build/c/wi_0123456789abcdef
Fixes https://factory.kody.build/c/wi_fedcba9876543210
Related: https://factory.kody.build/c/wi_00112233aabbccddclose,closes,closed,fix,fixes,fixed,resolve,resolves, orresolved(an optional colon is fine) before a card link marks the card shipped when the PR merges, with a timeline note and a link to the PR.- A card link with no keyword links the PR on the card when it merges and leaves the card where it is.
factory:<card id>is a short form of the same reference (Closes factory:wi_0123456789abcdef).- References inside HTML comments and code are ignored, so template examples never match. Replays change nothing.
The factory sees merged PRs two ways: each sweep tick reads recently merged PRs
in your project repos, and the @kody/github.pr.merged event does the same
work once githubEventsMode is live. Agents the factory starts are told to
reference their card this way.
Custom domain
The app can serve on a domain you own (the kody org uses
factory.kody.build). Kody serves a package app at the root of a custom domain
only when the app is internet-visible, and an internet-visible app is reachable
by anyone, so the factory checks access itself first:
- Set
appAccess: 'members'(./configure-settings). Signed-in members of the owning org get in; anyone else is sent to Sign in with Kody, and signed-in non-members see a no-access page. - The package owner approves internet-visible serving on the package's capability approval page.
- Point the domain at the app (
kody:@kentcdodds/cloudflare/custom-domainor Kody's custom domain settings) and wait for it to go active. - Set
publicBaseUrlto the domain so every link the factory hands out uses it.
Reports: results that may need no work
Audits, weekly reviews, and other scheduled checks post a report instead of a chat message or a GitHub issue:
npx -y @kodycodes/cli@latest execute --local --org kody --code 'import post from "kody:@kody/kody-factory/reports/post"; export default (p) => post(p)' --params '{"source":"docs-audit","title":"Docs audit","summary":"All pages fresh.","projectId":"kody"}'- No work needed: a report with no cards and no flagged findings is
recorded quietly (no push). It still shows on
/reportsunder Quiet. - One or many cards: pass
cards. Each card has a stablekey. Work cards join the queue as New and ship through the factory's runner like any other card. Cards withneedsKent: truewait in Needs you as decisions; no agent starts on them until you move them to New. - No duplicates: a later report with the same
sourceand cardkeylinks the card that is still open instead of filing another one. - Both ways: every card links to its report ("Open the report this came from" on the card), and the report lists each card with its live state.
- One push per report, opening the report, and only when it files a new card or flags a finding.
idempotencyKeymakes a retry return the first report;dryRunpreviews the report and cards and writes nothing.
Weekly CI review
Every Monday at 4:00 AM (America/Denver) the ci-review-weekly job reviews
the last 7 days of GitHub Actions on kody-hq/kody. Confidence in shipping
comes first; within that, faster PR feedback, fewer runner minutes, and less
repeated work count equally. It posts one report:
- Safe wins (caching, shared setup, cancelling superseded runs, flaky fixes, slow steps) become work cards. Each keeps every check, job, test, and platform, and ships through the factory as one focused PR.
- Coverage trades (dropping or deferring a check or platform) become Needs-you cards with the numbers. They only ship if you move them to New.
- Quiet weeks post a quiet report with the week's numbers and trends.
It reads GitHub with GET requests only and never posts to GitHub or chat.
Preview it any time with
npx -y @kodycodes/cli@latest execute --local --org kody --invoke kody:@kody/kody-factory/ci-review/run --params '{"dryRun":true}'.
Pause with ./ci-review/pause, resume with ./ci-review/resume.
Sentry issues to cards
Sentry talks to @kody/sentry-events, not to the factory. That package holds
the Sentry integration Client Secret (sentryWebhookSecret) and API token
(sentry), checks each webhook signature, and emits
@kody/sentry-events.issue.alerted. The factory subscribes to that event and
files one card per Sentry issue (repeat alerts reuse it) and, with push on,
one notification. Cards go to sentryIntakeProjectId (default kody) or a
sentryProjectMap match. Events from any package other than
sentryEventsSource (default sentry-events) are ignored.
The nav shows an unread badge. Mark individual or all notifications as read.
Events and wakes
The factory never posts to a bot. Every wake (health, signals, notifications,
friction, new outage and DR cards) is a @kody/factory.wake.requested event,
and @kody/wake-relay delivers it. If the relay reports a failure, or does not
answer within wakeAlertMinutes (default 5), the factory raises a wake alert:
the card gets a wake-undelivered label, /factory-health shows it under
"Wake delivery", and it posts to your factory Discord channel when Discord
notifications are on. Sources (@kody/dr-backup-health,
@kody/status-alerts) emit events the factory turns into deduped cards. See
AGENTS.md "Events".
GitHub as events
The factory knows cards and events, not GitHub. @kody/github owns the
GitHub hook and publishes @kody/github.issue.*, .pr.*, .ci.completed,
.release.changed, and .branch.pushed; the factory subscribes to the issue,
CI, release, and pr.merged topics and turns them into the same cards its old
webhooks filed (and, for merged PRs, closes the cards they reference). To run a different code host, publish the same topics from your own
package and set githubEventsSource to its Kody id.
githubEventsMode picks who does the work:
shadow(default): the factory's own webhook still files cards and forwards each delivery to@kody/github(githubEventsBridge), and the events only record what they would do../github-events/reportcompares the two paths.live: the events file the cards, and the factory's own webhooks only forward. Flip this once the report shows matches and no misses.off: events are ignored.
Issue comments are not mirrored on purpose: the old webhook treated a deleted comment like a deleted issue.
Agent runners as packages
Coding agents are runner packages too. The runners setting names each runner,
its package, and its start, status, message, and terminate exports
(Devin: @kody/devin), plus sessionUrlTemplate. Board and card session links
come from the runner (the URL it returned at start, else that template), never
a hardcoded host.
Dispatch is always by event. To start work the factory emits
@kody/factory.agent.start.requested (and .message.requested,
.cancel.requested) with a requestId; the card holds pending_<requestId>
until the runner answers with @kody/<package>.session.started carrying that
requestId, then the card takes the real session id and link.
.session.updated and .finished drive status. The factory holds no runner
key; the cleanup and friction jobs start their sessions the same way.
./runners/self-test emits a dry start request (the runner answers with what
it would start and starts nothing) and returns the requestId to look for in
the runner package's subscription run.
Adopt in your org
- Publish this package and
@kody/wake-relayin your org. - Map the factory credentials above. There are no wake credentials here; bot wake URLs and keys live only on the relay.
- Turn on the factory subscriptions for
@kody/wake-relay.wake.deliveredand.wake.failed, and on the relay its@kody/factory.wake.requestedsubscription. Each for exactly one person. - On the relay, add your bots to its roster and
liveBots(see its README). - Run
./events/self-test(dry), then./events/self-test { live: true }once to prove one real wake end to end. - Optional: turn on
@kody/status-alertsand@kody/dr-backup-healthsubscriptions here and seteventCardsMode: 'live'to file their cards. - Optional web push: make a P-256 key pair, save the private key (PKCS#8
PEM) as a
signingcredential with providerweb-pushand the push service hosts, and setwebPushVapidPublicKeyto the public key (base64url). Then allow push per device in/settings. - GitHub: publish
@kody/githubin your org (or use the shared one), mint itsgithubwebhook, add a GitHub hook (JSON, your signing secret, the events you want), turn on this package's@kody/github.*subscriptions for exactly one person, and setgithubEventsMode: 'live'. - Agent runners: publish
@kody/devin(or your own runner package with the same events) and configure it (its README has the settings). Turn on its@kody/factory.agent.start.requested,.message.requested, and.cancel.requestedsubscriptions and this package's@kody/devin.session.started,.updated, and.finishedsubscriptions, each for exactly one person. Then run./runners/self-testand check the runner's subscription run showsdryRun: truefor the returnedrequestId. A runner with another package name: add it torunners. - Optional Sentry: publish
@kody/sentry-events, map itssentryWebhookSecret(the Sentry internal integration Client Secret) and optionallysentry, mint and approve itssentrywebhook, paste that URL into the Sentry integration as its Webhook URL (Issue and alert rule action webhooks on), and turn on this package's@kody/sentry-events.issue.alertedsubscription.
Known limitations
- Cross-org forwarders: packages in another org (e.g. @kentcdodds/) cannot import @kody/ exports. There is no sanctioned Kody runtime mechanism for cross-org package calls. The old packages stay live and unchanged until a platform path exists.
- T3 Code threads: the factory cannot read T3 Code thread data. Work items show T3 links only when an agent records one.
- Devin cost: the Devin v3 API does not expose ACU or cost data. The project detail page says "Cost data not available."
- Bugbot author mismatch: Cursor Bugbot requires the commenter's GitHub account to match the PR author. The factory's GitHub credential authenticates as a bot, not as the repo owner. For owner-authored PRs, the original @kentcdodds/bugbot path still works.
- Storage quota: the kody org is near its storage entitlement limit. Storage writes and SQL can throw EntitlementLimitError. The factory handles this in the health page and signals pipeline. Do not add large storage caches.
Offline and install (PWA)
The app is a PWA. It caches view shells and assets for offline use. Data snapshots (titles, states; no settings) are kept in localStorage. Drafts of new work survive offline and sync on reconnect with an idempotency key. Updates wait for the user to click Refresh.
Migrated from
Four packages were ported into the factory from the kentcdodds org:
- @kentcdodds/ship-pr (5b5805c): PR status, review sort, merge, Discord
summary. Now at
./ship-pr/tick,./ship-pr/merge,./ship-pr/decide,./ship-pr/reply-review,./ship-pr/reply-comment, and./ship-pr/review-sort. - @kentcdodds/friction-log (efdd4b7): friction filing and daily sweep.
Now at
./friction/filewith jobfriction-daily. - @kentcdodds/codebase-cleanup (0a4a3cd): Cursor/Devin automation jobs.
Now at
./cleanup/*with four disabled jobs. - @kentcdodds/ci-review (cf66617, 0.3.0): weekly CI review. Now at
./ci-review/*with jobci-review-weekly; it posts a factory report and cards instead of starting its own agent session and messaging Discord.
The original packages are still live. They share no code with the factory; each was ported independently with adapter rewrites for the kody org's credentials and packages.
Done when
After setup and credential mapping, you can: seed projects, ingest or create an item, see it on the board, have an agent open a PR (when shadow mode is off and the runner is mapped), ship-pr the PR to merge, and see the result on the project detail page with flow metrics.
Report this listing
Log in to report this listing.