Upkeep routines
Upkeep routines run recurring repository maintenance — broken links, failing Renovate pull requests, documentation drift, unreachable code, flaky tests, duplicated helpers, and knowledge-base gaps — inside hard spend, open pull-request, and yield boundaries.
Every routine stays inert until you explicitly bind it on a Repository under spec.routines[]. Upkeep never auto-merges on its own: automatic merges still require a live merge policy.
How routines stay bounded
| Guardrail | Behavior |
|---|---|
| Explicit opt-in | Unbound Routine definitions never schedule or trigger runs |
| Isolated upkeep budget | Charged against budgets.upkeepDailyUSD (independent of human and interactive budgets) |
| Open PR cap and cooldown | Skips a slot when maxOpenPRs is reached or inside cooldown (open_cap, cooldown) |
| Zero-token probes | dead-links, renovate-red, actions-findings, and issues probes check deterministically before spending model tokens |
| Progressive delivery modes | Start in propose (read-only issue) or draft (draft PR) before graduating to pr |
| Yield breaker | Trips half_open or paused when consecutive closes/failures cross thresholds or rolling merge rate drops |
Ceilings on Routine | A Repository binding can only tighten maxOpenPRs, maxCostUSD, cooldown, egress, and breaker bounds — widening is refused |
Starter catalog
The agent-factory Helm chart installs seven starter Routine objects in the factory’s namespace (routines.catalog.enabled: true, labelled maku.ogenki.io/catalog):
| Routine | Probe | Workflow | Default ceilings | Requires |
|---|---|---|---|---|
dead-links | dead-links | quick | 1 open PR · $1/run · 24h | oracleClass |
renovate-red | renovate-red | standard | 1 open PR · $2/run · 24h | — |
doc-drift | none | standard | 1 open PR · $2/run · 24h | — |
dead-code | actions-findings | standard | 1 open PR · $2/run · 24h | probeWorkflow |
flaky-tests | actions-findings | standard | 1 open PR · $2/run · 24h | probeWorkflow |
dup-unifier | none | standard | 1 open PR · $2/run · 24h | — |
kb-gaps | issues | standard | 1 open PR · $2/run · 24h | — |
Adding a custom routine
Apply any Routine (maku.ogenki.io/v1alpha1) custom resource in the factory’s namespace. It appears immediately in /routines/catalog labelled custom:
apiVersion: maku.ogenki.io/v1alpha1
kind: Routine
metadata:
name: license-headers
namespace: agent-system
spec:
description: "Ensure new source files carry the Apache-2.0 SPDX header."
workflow: quick
dataClass: public
defaultPrompt: |
Add the missing Apache-2.0 SPDX header to tracked source files reported below.
If no file is missing a header, make no changes.
probe:
kind: actions-findings
requireConsecutive: 2
maxFindings: 5
requires: [probeWorkflow]
maxOpenPRs: 1
maxCostUSD: 1
cooldown: 24h
protectedPaths:
- '^\.github/agent-factory/'
breaker:
window: 10
minSamples: 5
minMergeRate: 0.25
maxConsecutiveClosed: 3
maxConsecutiveFailures: 3To replace a shipped catalog routine with your own manifest, add its name to routines.catalog.exclude in the chart values.
Drafting knowledge-base entries from gap issues
The kb-gaps routine turns the knowledge-gap issues RunLore files into one drafted entry per run. Its issues probe lists the bound repository’s open issues that probeAuthor (runlore[bot]) opened and whose title starts with probeTitlePrefix (knowledge-gap: ), and takes the oldest one still open as a gap. The text after the prefix is the gap’s resource, such as apps/image-gallery. The probe skips an issue when:
- it carries the
factory/skiplabel; - an entry at the repository root or under
incidents/on the default branch has frontmatterresource:equal to the resource; - a task works the same resource or issue number, started by this routine or by a maintainer’s
factory/readylabel: while it is open, forcooldownafter it ends, and for 30 days after its pull request is closed unmerged or reverted.
RunLore files a closed gap again under a new number, so the probe matches gaps by resource, not by number. The run is one task per run (the oldest uncovered gap), and a scheduled run and a manual one never start the same repository’s routine together. When every gap is covered, the probe starts nothing until the default branch changes. The task carries the issue’s title and body as untrusted, sanitised data inside a nonce fence after the routine’s defaultPrompt, and asks the pull request to say Refs #<issue>: closing the gap stays a maintainer’s call. probe.maxFindings must be 1, and the routine needs probeAuthor, probeTitlePrefix, or both. Without probeAuthor, anyone who can open an issue can start a run.
Bind it beside a merge policy narrower than docs, in shadow, so a maintainer reviews every drafted entry:
apiVersion: maku.ogenki.io/v1alpha1
kind: MergePolicy
metadata: {name: kb-gap-entries}
spec:
description: One new knowledge-base entry at the repository root.
allowedFiles: ['^[^/]+\.md$']
protectedFiles: ['^index\.md$', '^log\.md$', '^README\.md$', '^AGENTS\.md$', '^CONTRIBUTING\.md$', '^\.github/', '^\.policy\.yml$', '^incidents/']
maxPatchFiles: 1
maxModifiedLines: 90
holdoutChecks: [validate, leak-scan]
evidence: standard
maxPerDay: 2# Repository runlore-kb
mergePolicies:
- {name: kb-gap-entries, mode: shadow}
routines:
- {name: kb-gaps, mode: pr, cron: "0 6 * * 1"}maxModifiedLines: 90 ranks it stricter than the catalog’s docs policy (100 lines), so it decides these pull requests. Nothing in a diff proves an entry is new rather than an edit: the maintainer’s review and merge do, and evidence: standard asks for 20 agreed decisions before a promotion.
Managing routines in the Web UI
Overview (/routines)
Monitor every bound routine across repositories you can read on GitHub. Cards sort attention items (paused, half-open) first and show 14-day outcome sparklines, rolling merge rate, $/merged, open PR count, and next UTC run. Maintainers with write access can override the mode and click Run now, Pause, Resume, or Configure.

Routine catalog (/routines/catalog)
Browse shipped (catalog) and cluster-authored (custom) Routine definitions, pick a target repository, inspect ceilings and active consumers, and click Enable on repository → or Configure on repository →.

Guided configurator (/routines/<owner>/<repo>/<name>/edit)
Configure delivery mode (propose, draft, pr, disabled), pick a UTC cron schedule with live local and UTC previews of the next three runs, adjust bounds inside the Routine ceilings, and author a repository prompt (.github/agent-factory/upkeep/<routine>.md) with live validation (<= 4096 bytes, <= 5 ## sections, a ## Verify checklist, and no control or invisible characters).
Click Check & Generate YAML to validate against the factory and copy or download repository-<name>.yaml for GitOps. When routines.uiWrite: true is enabled on the factory, Save to cluster persists UI-managed bindings into ConfigMap agent-factory-routine-bindings; GitOps-defined bindings stay read-only in the cluster (409 defined_twice).

CLI, prompts, and Slack
- CLI: run
maku routine list,maku routine run <owner/name> <routine> [--mode propose|draft|pr] [--dry-run],maku routine pause|resume <owner/name> <routine>, andmaku config export --routinesto export UI-stored bindings back to GitOps manifests (CLI reference). - Repository prompts and skills: commit
.github/agent-factory/upkeep/<routine>.mdon the default branch (repoPrompt: true) or pointskill:at.agents/skills/<skill>/SKILL.mdto tailor instructions without editing cluster manifests. - Slack upkeep channel and weekly digest: configure
upkeepChannelon maku-slack to route routine proposals, breaker trips, and weekly summaries (GET /api/routines/digest) to a dedicated channel.
Full field schemas, skip codes, and API contracts live in The factory, Web UI reference, and API reference.