Read when changing command intake, repair job creation, workflow dispatch, worker-capacity routing, automerge, issue implementation, or generated repair state.
ClawSweeper should stay simple at the orchestration boundary:
- Intake normalizes events and commands into a job or exact review request.
- The scheduler chooses priority and worker capacity.
- Codex owns review, repair, rebase, CI diagnosis, and narrow implementation.
- Deterministic code owns auth, repo boundaries, worker caps, exact-head merge safety, and GitHub mutations.
- Comments, records, ledgers, and dashboards are generated status surfaces, not independent sources of truth.
Repair jobs carry job_intent in frontmatter. This is the durable routing
contract shared by comment commands, automerge, issue implementation,
commit-finding repair, manual repair jobs, and low-signal cleanup.
Current intents:
repair_cluster: ordinary manually or scheduler-created repair workautomerge_pr: maintainer-approved PR repair/automerge loopimplement_issue: ClawSweeper-generated issue implementation PR lanecommit_finding: repair job created from a ClawSweeper commit findinglow_signal_pr_cleanup: narrow stale/low-signal PR cleanup
Older source values remain for compatibility, but new code should make
decisions from job_intent first and only fall back to source for legacy
jobs. Unknown intents fail job validation.
job_intent maps to worker capacity:
automerge_pr->automerge_repairimplement_issue->issue_implementation- all other repair jobs ->
repair
repair:dispatch derives the default live-worker cap from the job intent when
the caller does not pass --max-live-workers or set
CLAWSWEEPER_MAX_LIVE_WORKERS. Workflows may still pass an explicit cap when
they intentionally want a narrower lane.
GitHub workflows should do only setup, credential minting, script execution, artifact upload, and state publishing. Routing rules belong in TypeScript so webhook intake, repository-dispatch fallback, manual dispatch, and scheduled runs use the same behavior.
The activity observer is intentionally lossy and may cancel older in-progress observer runs. Review, repair, automerge, apply, and command-router jobs are not lossy.
Do not move these checks into model judgment:
- maintainer/write authorization
- target repository allow/deny boundaries
- protected labels and maintainer-authored close guards
- stale item drift and exact-head merge checks
- worker-budget enforcement
- final GitHub comments, labels, closes, pushes, and merges
- no direct local edits to foreign PRs by a human operator
Codex can decide what code needs to change; deterministic code decides whether the resulting mutation is allowed and applies it.