From 48392469c637e40338da177b9c3993033f8a946b Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 11:10:59 -0800 Subject: [PATCH 01/15] docs(rfc): propose the OpenShell Software Factory Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 342 +++++++++++++++++++++++++++ 1 file changed, 342 insertions(+) create mode 100644 rfc/0026-openshell-factory/README.md diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md new file mode 100644 index 0000000000..27469836e9 --- /dev/null +++ b/rfc/0026-openshell-factory/README.md @@ -0,0 +1,342 @@ +--- +authors: + - "@purp" +state: draft +links: + - https://github.com/ai-openshell/openshell/issues/6092 +--- + +# RFC 0026 - OpenShell Software Factory + + + +## Summary + +This RFC proposes the OpenShell Software Factory: a structure within which teams of single-purpose agents turn issues and pull requests into acceptable code across the project's repositories. The factory runs as a shared service that assesses incoming work, implements it, and reviews it without a human driving each step. It automates as much of the software development lifecycle as possible and focuses human attention on the decisions that matter. + +This is an umbrella RFC. It asks reviewers to agree on four things: + +1. the purpose of the factory +2. its structure and the approach to building it +3. the contract for adding and triggering agents +4. the way the project decides how much human supervision a piece of work needs + +The details are fleshed out in this RFC's companion documents as well as follow-on RFCs. + +## Motivation + +OpenShell needs the leverage of a fully agentic software development lifecycle (or agentic SDLC) to speed development velocity, built on OpenShell to take advantage of the safety it brings as well as to help identify improvements needed by using our own runtime in our daily development work. + +OpenShell is currently built agent-first, but for the most part its agents are driven by humans directly on their own local hardware. This limits the project's velocity to the current interest, time, and focus the humans involved in the project can marshall at any given time as well as the number of parallel development threads they can properly shepherd from start to finish. + +Work in OpenShell is also currently reviewed by human contributors using agentic tools. A review typically is requested by on contributor, both in GitHub as well as in Slack, and another contributor will direct agents to review the PR while sometimes also spending time digging into the architectural and implementation choices made. + +Additionally, OpenShell attracts between 150-300 new contributions weekly in the form of both issues and pull requests (PRs). Each of these must be assessed, validated, and a decision of whether to accept or decline the work must be made. This volume has outstripped the maintainer team's ability to clarify and make choices while manually driving a workflow supported by agentic tooling. + +Finally, the factory is OpenShell relying on its own primary function of providing safe, sandboxed runtimes for autonomous agents. Running the project's own development fleet in OpenShell sandboxes will exercise the platform under real load and surface the gaps that both developers and OpenShell operators might encounter. + +## Proposal + +### Purpose and goals + +The factory turns issues and PRs into acceptable code. Its goals: + +1. Protect the project from bad code. +2. Enable high-velocity software and feature development. +3. Don't spend time or tokens on low-value work. +4. Keep the codebase efficient and healthy. + +Humans keep the decisions that matter: whether the project wants the work, how to design it, and whether a risky change lands. A risk score identifies the work that needs them; see [Risk and supervision](#risk-and-supervision). + +- **Removing humans from design and acceptance decisions.** The factory routes those decisions to humans faster. + +### Invariants and constraints + +- Every factory agent runs in an OpenShell sandbox. Any layer above the sandbox handles orchestration only: event intake, scheduling, queueing, and budget. + - The project adopts an open source orchestration layer or builds its own. It does not buy one. +- The factory serves the project's repositories as a shared service. It is not a single-repository tool. + +### Non-goals + +This RFC explicitly does not intend any of the following: + +- **Agent packaging details.** Directory layout, entrypoint, and image build belong to a follow-on RFC. +- **Agent identity.** How an agent authenticates and posts as itself belongs to a follow-on RFC. Agent identity is distinct from sandbox identity because one agent spans many sandboxes. +- **Enforced developer workflow.** Developers bring their own tooling and workflow for any work they do, and that work easily enters the factory. +- **A complete agent catalog.** This RFC names categories and a starting set. +- **Replacing GitHub as the system of record for issues, PRs, and reviews.** + +### Acceptable code + +**Acceptable code** is a high-quality change the project is willing to merge. It implements [accepted work](../../CONTRIBUTING.md#accepted-work), passes every required review gate according to the level of risk the change embodies, and meets the project's standards. + +### Factory model + +The factory has three stages: Assessment, Implementation, and Review. Agents suited to each stage staff it. Work enters at any stage: + +- **A new issue** enters at Assessment, where agents assess the value and risk of the proposed item, as well as whether architectural design work or other human intervention is needed. + - High risk items require human-supervised design and implementation. + - Medium risk items may be implemented unsupervised, but require human review and approval. + - Sufficiently low risk items may be implemented unsupervised. +- **A PR** enters at Review. It loops between Implementation and Review, with or without human involvement depending on the level of defect found in review and whether or not it can be rememdied by an agent without significant risk, until it lands. + - Any PR judged as medium or high risk requires maintainer approval to land. +- **A local coding session** enters at Implementation. A contributor's agent can direct factory agents as subagents in its own session; the resulting PR enters at Review. +- **A schedule** starts an assessor or an implementer. + - A flaky-test finder is an assessor that files issues to fix broken tests it finds + - A refactorer is an implementer that opens PRs with more efficient implementations that keep the same functionality + +```mermaid +flowchart LR + issue[new issue] --> assess[Assessment] + sched[schedule] --> assess + sched --> impl + local[local session] --> impl[Implementation] + pr[new PR] --> review[Review] + assess -->|ready-for-agent| impl + impl -->|PR| review + review -->|changes needed| impl + review --> merged[acceptable code] +``` + + +#### Assessment + +Assessors decide whether work is well formed, how risky it is, and whether the project wants it. Risk is a factor in acceptance. + +```mermaid +flowchart LR + in[issue or schedule] --> triage{triage} + triage -->|submission defect| author[back to author] + author -->|author submits changes| triage + triage -->|well formed| risk[risk score] + risk --> accept{acceptance} + accept -->|decline| closed[close with reason] + accept -->|accept, low or medium risk| rfa[ready-for-agent] + accept -->|accept, high risk| rfh[ready-for-human] +``` + +#### Implementation + +Implementers produce a change and open a PR. Work that needs a design gets a spec first, and a human reviews the spec. + +```mermaid +flowchart LR + in[ready-for-agent work, local session, or schedule] --> design{needs a design?} + design -->|yes| spec[write spec] --> specrev[human reviews spec] --> build + design -->|no| build[implement] + build --> checks{checks pass?} + checks -->|no, under the cap| build + checks -->|no, cap reached| rfh[ready-for-human] + checks -->|yes| pr[open PR] +``` + +#### Review + +Reviewers each judge one concern, cheapest first. The risk tier decides whether a human reviews before merge. + +```mermaid +flowchart LR + pr[PR] --> cheap[deterministic checks] --> focused[single-concern reviewers] --> deep[expensive reviewers] + cheap -->|fail| impl[back to Implementation] + focused -->|changes needed| impl + deep -->|changes needed| impl + deep -->|pass| tier{risk tier} + tier -->|low| merged[acceptable code] + tier -->|medium or high| human[human review] --> merged +``` + +#### Agent categories + +| Category | Job | Examples | +|---|---|---| +| Assessors | Decide what a piece of work is, what it is worth, and how risky it is | Labeler, triage, acceptance classifier, failed-test analyzer, flaky-test finder | +| Implementers | Produce a change | Spec writer, implementer, rebaser, refactorer, CI optimizer | +| Reviewers | Judge a change against one concern | Spec, architecture, code, security, compatibility, end-to-end acceptance, concision | + +Two labels say who advances a piece of work next: `ready-for-agent` when the next step belongs to a factory agent, and `ready-for-human` when it belongs to a person. Assessors set the label. A human hands work back by switching it to `ready-for-agent`. The names follow the triage labels in Matt Pocock's skills. + +Principles: + +- **Decompose into focused agents.** Each agent has one job. We use evals to decide the appropriate boundaries for each agent, judged by quality of work, time taken, and tokens consumed. +- **Scheduled upkeep is a trigger, not a category.** A refactorer is an implementer that runs on a schedule. A flaky-test finder is an assessor that runs on a schedule and files issues into the normal flow. Scheduled work passes the same risk gates as any other work. +- **A run never waits for a human.** An agent that needs a decision records what it needs, sets `ready-for-human`, and ends. The human's change in GitHub starts a new run. +- **Review progressively.** A change receives expensive review only after it passes the cheaper gates. +- **Shift left.** Deterministic, fast checks move into pre-commit. Adding a check triggers a review of the pre-commit time budget. +- **Agents sit on a spectrum.** Some are deterministic, close to a triggered cron job. Others are model-driven with tool use. Both kinds share one contract. + +### Agent contract + +Every agent declares: + +| Element | Meaning | +|---|---| +| Purpose | The one job it does | +| Trigger | GitHub event, another agent, schedule, or manual invocation | +| Preconditions | What must hold before it does any work | +| End conditions and limits | When it stops, including iteration caps | +| Outputs | A defined result, plus provenance metadata on anything it writes | +| Metrics | What it emits so maintainers can observe and tune the fleet | + +A deterministic precheck wraps every agent and answers three questions: should this agent run, does it have what it needs to run, and is another run already doing this work. A skipped run starts no model session. The labeler already works this way. + +```mermaid +flowchart LR + trig[trigger] --> pre{precheck} + pre -->|skip| rec[record skip] + pre -->|run| box[OpenShell sandbox] + box --> work[agent work, within limits] + work --> out[outputs and provenance] + work --> tel[telemetry] +``` + +Limits are iteration caps, such as a maximum number of CI retry rounds. + +Gator is the reference for packaging: an `agent.yaml` manifest, a sandbox image, a sandbox policy, declared providers, and a payload baked into the image. The packaging RFC generalizes that shape and defines how it expresses the contract above. + +### Triggering and orchestration + +Repositories send events to the factory, and agents react to them. This layer does more than GitHub Actions does today: it takes in issue, PR, and comment events, runs schedules, hands work from agent to agent, queues it, and applies budget and priority before spending agent time. + +The event delivery RFC decides who provides this layer. GitHub Actions remains one of the factory's triggers whatever that RFC decides. The contract above keeps agents portable across triggers. + +### Supporting components + +Below the orchestration layer, the factory incorporates NVIDIA's open source agent components where it needs them, and chooses another option only where it is superior. Where a component falls short, the project records the gap and raises it with the owning project. + +| Layer | Component | Status | +|---|---|---| +| Sandbox | OpenShell | Fixed by this RFC | +| Harness abstraction | NeMo Fabric | To evaluate | +| Telemetry | OpenShell OTel and OCSF streams, with NeMo Relay for harness sessions | To evaluate | +| Evals | NeMo Helix | To evaluate | +| Model routing | NeMo Switchyard | To evaluate | + +### Risk and supervision + +Three supervision modes match three levels of risk. + +| Mode | Low risk | Medium risk | High risk | +|---|---|---|---| +| Unsupervised | Allowed | Not allowed | Not allowed | +| Unsupervised, then reviewed | Not needed | Allowed | Not allowed | +| Paired with a human, then reviewed | Not needed | Allowed, discouraged | Required | + +An assessor scores risk before Implementation starts and again when a change widens. Inputs to the score: + +- Reversibility. Irreversible changes add risk. +- Blast radius, estimated from leading indicators: how likely the change or defect is to affect the target core configuration, and how crippling it is. +- Complexity and dependencies. +- Expanding range of affected functionality. A change that widens triggers deeper review. + +The score sets the label. Work in the two unsupervised lanes is `ready-for-agent`. Work that needs pairing is `ready-for-human`, and the contributor who picks it up directs factory agents from a local session. + +Decomposition is the main way to shift work to agents. Splitting high-risk work into pieces that an agent completes and verifies one at a time drops it into the unsupervised-then-reviewed lane. + +### Agent lifecycle and evals + +An agent joins the factory in steps: + +1. Build a skill. +2. Wrap it as an invocable agent that meets the contract. +3. Tune and test it with direct invocation. +4. Build evals that judge its output. +5. Tune model, effort, and prompts against the evals. +6. Measure its value against its cost for as long as it runs. + +The same evals decide scope. If a narrower agent scores better per token or per minute, maintainers split the agent. They retire an agent whose cost exceeds its value. + +### Metrics and telemetry + +Metrics influence both human behavior and agent choices. + +| Group | Metrics | +|---|---| +| Flow | Time to an accept or decline decision on new issues and PRs, time to first review, time to merge, time to human decision, work in flight, CI speed | +| Safety | Velocity of safe change, days since the last accident | +| Fleet | Per-agent run time, token usage, cost, harness, model, and skip rate | + +Agents return a defined result, and measurements move to OpenShell's own observability streams wherever possible. OpenShell does not emit per-agent token, cost, and run-time metrics today. OpenShell issues track that work. + +### Follow-on RFCs and companion documents + +| Follow-on RFC | Scope | +|---|---| +| Agent packaging and runtime | Directory layout, manifest, entrypoint, image build, multiple harnesses. Gator as reference | +| Agent identity | How an agent authenticates to GitHub and posts as itself across many sandboxes | +| Event delivery and control plane | Event intake, scheduling, budget and prioritization, multi-repository and extension onboarding, installing OpenShell plus the factory | +| Branch ownership | Agent branches in the main repository and maintainer takeover | + +Companion documents in this folder cover the risk scoring rubric, the reviewer catalog, and the metrics schema. + +## Implementation plan + +The project builds the factory incrementally, starting from agents that already run. + +1. **Inventory.** Describe the existing agents in the contract's terms: Gator, the labeler, the Issue Triage Gate, the Codex Compatibility Review, and the Codex Security Review. Record where each one departs from the contract. +2. **Packaging.** Land the packaging RFC and migrate Gator to it, building on [#5723](https://github.com/ai-openshell/openshell/issues/5723). +3. **Telemetry.** Define the metrics schema and add the OpenShell emission work it needs. Start collecting flow and fleet metrics for existing agents. +4. **Risk scoring.** Ship the scoring rubric and a risk assessor in advisory mode. Compare its scores with maintainer judgment before it gates anything. +5. **Orchestration.** Land the event delivery RFC and decide who provides the orchestration layer. +6. **Fill the pipeline.** Add reviewers and implementers one at a time through the lifecycle, lowest-risk work first. Each new automated trigger starts throttled, with human review on every PR it produces. +7. **Scheduled upkeep.** Add the flaky-test finder, refactorer, and CI optimizer once the risk gates are in force. +8. **Widen.** Onboard further repositories, then extensions. + +## Risks + +- **Unsafe autonomy.** An agent merges a harmful change. Mitigation: risk tiers, advisory mode before gating, iteration caps, and sandbox policy. +- **Cost growth.** A fleet of agents spends more than it returns. Mitigation: prechecks, budget gates, and per-agent value-versus-cost review. +- **Component dependency.** Adopting components the project does not control ties factory progress to other projects' roadmaps. Mitigation: a contract that keeps agents portable, and adopting only what is needed. +- **Review load.** A factory that produces changes faster than maintainers review them moves the bottleneck instead of removing it. Mitigation: throttled triggers, progressive review before asking a human, and small changes. +- **Fragmentation.** Many small agents are harder to reason about than a few large ones. Mitigation: evals decide agent scope, and the catalog stays in one place. +- **Scoring error.** A wrong risk score sends work to the wrong lane. Mitigation: advisory mode, and a human override in both directions. +- **Public project exposure.** Agents act on input from outside contributors. Mitigation: read-only agents by default, with writes limited to narrow, declared outputs. + +## Alternatives + +### Keep driving agents from contributors' machines + +This is the current path. It needs no new design. The time and focus of the people involved keep capping velocity, review keeps depending on one contributor asking another, and incoming issues and PRs keep outpacing the maintainers. + +### Keep adding bespoke GitHub Actions agents + +This extends the few agents that already run in CI. Each agent keeps its own trigger, packaging, and identity, and nothing measures or budgets the fleet. Cost grows with every agent added. + +### One large general-purpose agent + +A single agent handling an issue from intake to merge is simpler to operate. It is harder to evaluate and harder to bound, and it puts every task at the supervision level of its riskiest step. + +### Adopt an open source orchestration platform wholesale + +Kelos, GitHub Agentic Workflows, and Fabro each cover part of the problem. None runs agents in OpenShell sandboxes, and none offers risk-tiered supervision that this review found. The project pulls patterns from them. + +### Build the orchestration layer in OpenShell + +This gives full control and the strongest dogfooding. It also spends the project's effort on a layer that existing tooling may already provide. + +## Prior art + +- **Kelos.** An image contract with a fixed entrypoint and output markers for branch, PR, tokens, and cost. The lesson is a small, checkable agent interface. +- **GitHub Agentic Workflows.** A read-only agent whose writes go through separate, narrow output jobs with short-lived tokens. +- **Matt Pocock's `software-factory` skill.** A [vocabulary](https://github.com/mattpocock/skills/tree/main/skills/in-progress/software-factory) of tasks, triggers, runs, and runners. The lessons: a run never waits for a human, a cap ends every loop before it asks a human, and triggers arrive one at a time behind checks, automated review, and human review. +- **Superpowers.** A [development methodology](https://github.com/obra/superpowers) delivered as skills for many harnesses, in which a local session works through a plan by dispatching subagents and reviewing their work. This is the shape of the local session entry. +- **Prime Radiant's tooling.** [github-triage](https://github.com/prime-radiant-inc/github-triage) runs a read-only security review of a PR before any checkout and has labeler agents only propose, with a deterministic script checking the proposals. [shepherd-pr](https://github.com/prime-radiant-inc/shepherd-pr) takes a PR through CI and review within a bounded number of observations. [superpowers-evals](https://github.com/prime-radiant-inc/superpowers-evals) grades real agent CLIs on workflow compliance across harnesses. +- **Stripe's Minions.** Blueprints that mix deterministic and agent steps, and a hard cap on CI retry rounds. +- **Prow.** Chat-command plugins and a merge robot. The lesson is event-driven automation that maintainers steer from the PR. +- **OpenAI's harness engineering notes.** Scheduled agents that refactor and collect garbage in the codebase. + +## Open questions + +- When does work require a human? The matrix allows paired work at medium risk and discourages it. Should the matrix disallow it? +- Which transitions between `ready-for-agent` and `ready-for-human` may an agent make, and which belong to maintainers alone? +- What are the gates, and where do budget and prioritization live? +- The orchestration layer needs GitHub issue, PR, and comment event intake, an access model that works with outside contributors, budget and queueing controls, iteration caps, and approval gates. Which option provides them? +- Which of NeMo Fabric, Relay, Helix, and Switchyard does the factory need, and in what order? +- What work does OpenShell need to emit per-agent tokens, cost, and run time? +- How does the factory run more than one harness? +- How does agent identity on GitHub work when one agent spans many sandboxes? +- Agent branches in the main repository let maintainers take over. Is there another way to get the same takeover? +- When does the rebase agent run? +- How do vendors and extensions engage with the factory, and how do they supply the resources to run it against their extensions? +- Which leading indicators of severity and blast radius can an assessor compute from an issue alone? From 0d930040b167ba562283701769de94a04ffd7f08 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 11:42:26 -0800 Subject: [PATCH 02/15] docs(rfc): add candidate agents to the Software Factory RFC Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 27469836e9..eab9bc716c 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -247,6 +247,17 @@ An agent joins the factory in steps: The same evals decide scope. If a narrower agent scores better per token or per minute, maintainers split the agent. They retire an agent whose cost exceeds its value. +### Candidate agents + +Agents the factory could add beyond the starting set. This list is open: propose additions in review. + +| Agent | Category | Job | +|---|---|---| +| Upgrade tester | Assessor | Exercise upgrades from released versions to a candidate build and file issues for regressions | +| Red team reviewer | Reviewer | Attack a change's sandbox and policy boundaries before it merges | +| Human notifier | Assessor | Tell the right person when work becomes `ready-for-human` | +| Post-merge refactorer | Implementer | Simplify code a recent merge touched while keeping the same functionality | + ### Metrics and telemetry Metrics influence both human behavior and agent choices. From 031b107ec70d88149aeb18d65f8652ccd1d792ec Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 14:50:51 -0800 Subject: [PATCH 03/15] docs(rfc): add design review rules and restructure the factory model Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 74 ++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 21 deletions(-) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index eab9bc716c..312fffae51 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -74,7 +74,20 @@ This RFC explicitly does not intend any of the following: ### Factory model -The factory has three stages: Assessment, Implementation, and Review. Agents suited to each stage staff it. Work enters at any stage: +The factory has three stages: Assessment, Implementation, and Review. Agents suited to each stage staff it. + +#### Principles + +- **Decompose into focused agents.** Each agent has one job. We use evals to decide the appropriate boundaries for each agent, judged by quality of work, time taken, and tokens consumed. +- **A run never waits for a human.** An agent that needs a decision records what it needs, sets `ready-for-human`, and ends. +- **Assess, Implement, and Review progressively.** A change receives expensive attention only after it passes the cheaper gates. +- **Shift left.** Deterministic, fast checks move into pre-commit. Adding a check triggers a review of the pre-commit time budget. +- **Agents sit on a spectrum.** Some are highly deterministic, almost like a triggered cron job. Others are model-driven with tool use. The factory serves all of them using the same standards and contract. +- **Agents can be triggered by manually, by events, or on a schedule.** A developer may invoke a labeling or merge conflict resolving agent as part of an interactive coding session. Triage and review agents will be triggered by GitHub Actions. A refactoring agent or a flaky test finder may run on a scheduled basis. Their code changes progress through the factory like any others. + +#### Workflow + +Work enters at any stage: - **A new issue** enters at Assessment, where agents assess the value and risk of the proposed item, as well as whether architectural design work or other human intervention is needed. - High risk items require human-supervised design and implementation. @@ -94,13 +107,12 @@ flowchart LR sched --> impl local[local session] --> impl[Implementation] pr[new PR] --> review[Review] - assess -->|ready-for-agent| impl + assess --> impl impl -->|PR| review review -->|changes needed| impl review --> merged[acceptable code] ``` - #### Assessment Assessors decide whether work is well formed, how risky it is, and whether the project wants it. Risk is a factor in acceptance. @@ -117,21 +129,27 @@ flowchart LR accept -->|accept, high risk| rfh[ready-for-human] ``` +Examples: labeler, triage, acceptance classifier, failed-test analyzer, flaky-test finder. + #### Implementation -Implementers produce a change and open a PR. Work that needs a design gets a spec first, and a human reviews the spec. +Implementers produce a change and open a PR. Work that needs a design gets a spec first. A human reviews the spec before the build starts or together with the PR; see [Design review](#design-review). ```mermaid flowchart LR - in[ready-for-agent work, local session, or schedule] --> design{needs a design?} - design -->|yes| spec[write spec] --> specrev[human reviews spec] --> build + in[ready-for-agent work,
local session, or scheduled run] --> design{needs a design?} design -->|no| build[implement] + design -->|yes| spec[write spec] --> early{review before build?} + early -->|yes| specrev[human reviews spec] --> build + early -->|no, review with the PR| build build --> checks{checks pass?} checks -->|no, under the cap| build - checks -->|no, cap reached| rfh[ready-for-human] + checks -->|no, cap reached| rfh[ready-for-human
for human intervention] checks -->|yes| pr[open PR] ``` +Examples: spec writer, implementer, rebaser, refactorer, CI optimizer. + #### Review Reviewers each judge one concern, cheapest first. The risk tier decides whether a human reviews before merge. @@ -147,24 +165,15 @@ flowchart LR tier -->|medium or high| human[human review] --> merged ``` -#### Agent categories +Examples: spec, architecture, code, security, compatibility, end-to-end acceptance, and concision reviewers. -| Category | Job | Examples | -|---|---|---| -| Assessors | Decide what a piece of work is, what it is worth, and how risky it is | Labeler, triage, acceptance classifier, failed-test analyzer, flaky-test finder | -| Implementers | Produce a change | Spec writer, implementer, rebaser, refactorer, CI optimizer | -| Reviewers | Judge a change against one concern | Spec, architecture, code, security, compatibility, end-to-end acceptance, concision | +#### Division of labor -Two labels say who advances a piece of work next: `ready-for-agent` when the next step belongs to a factory agent, and `ready-for-human` when it belongs to a person. Assessors set the label. A human hands work back by switching it to `ready-for-agent`. The names follow the triage labels in Matt Pocock's skills. +All work in the factory is either waiting for a human or an agent to drive the next action to move it forward, and it's marked accordingly as either `ready-for-human` or `ready-for-agent`. -Principles: +The labels are chosen to follow the triage labels in Matt Pocock's skills as they're both popular and unambiguously named. -- **Decompose into focused agents.** Each agent has one job. We use evals to decide the appropriate boundaries for each agent, judged by quality of work, time taken, and tokens consumed. -- **Scheduled upkeep is a trigger, not a category.** A refactorer is an implementer that runs on a schedule. A flaky-test finder is an assessor that runs on a schedule and files issues into the normal flow. Scheduled work passes the same risk gates as any other work. -- **A run never waits for a human.** An agent that needs a decision records what it needs, sets `ready-for-human`, and ends. The human's change in GitHub starts a new run. -- **Review progressively.** A change receives expensive review only after it passes the cheaper gates. -- **Shift left.** Deterministic, fast checks move into pre-commit. Adding a check triggers a review of the pre-commit time budget. -- **Agents sit on a spectrum.** Some are deterministic, close to a triggered cron job. Others are model-driven with tool use. Both kinds share one contract. + ### Agent contract @@ -234,6 +243,29 @@ The score sets the label. Work in the two unsupervised lanes is `ready-for-agent Decomposition is the main way to shift work to agents. Splitting high-risk work into pieces that an agent completes and verifies one at a time drops it into the unsupervised-then-reviewed lane. +#### Design review + +Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec. High-risk work is paired, so a human shapes the design directly. + +A human reviews every spec. The question is when: before the build starts, or together with the implementation in the PR. + +A human reviews the spec before the build starts when any of these hold: + +- The work is high risk. +- The design changes a public contract or a security boundary: proto, CLI, config, policy schema, crypto, or sandbox policy. +- The design is irreversible, such as a data migration. +- The design adds a dependency or new architecture. +- A reviewer agent flags the spec, or the spec writer records open questions. + +Otherwise a human reviews the spec and the implementation together in the PR when any of these hold: + +- **The build is cheap.** Implementing and re-implementing costs little time and few tokens, so a rejected design wastes little. +- **A human already made the design decision.** The spec implements an accepted RFC, a maintainer-written design in the issue, or one piece of a parent spec a human approved. +- **The design follows an established pattern.** For example, another provider or driver built on an existing template. +- **The design is internal and reversible.** It changes no public contract or security boundary, and a revert undoes it. + +A spec that fits neither list gets human review before the build starts. + ### Agent lifecycle and evals An agent joins the factory in steps: From 719234f2ec1b9e440355234048d2faf07a9fccbc Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 15:15:24 -0800 Subject: [PATCH 04/15] docs(rfc): list component alternatives and regroup the agent sections Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 48 +++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 312fffae51..be0a203cc1 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -173,9 +173,9 @@ All work in the factory is either waiting for a human or an agent to drive the n The labels are chosen to follow the triage labels in Matt Pocock's skills as they're both popular and unambiguously named. - +### Agents -### Agent contract +#### Agent contract Every agent declares: @@ -188,19 +188,29 @@ Every agent declares: | Outputs | A defined result, plus provenance metadata on anything it writes | | Metrics | What it emits so maintainers can observe and tune the fleet | -A deterministic precheck wraps every agent and answers three questions: should this agent run, does it have what it needs to run, and is another run already doing this work. A skipped run starts no model session. The labeler already works this way. +#### Agent workflow + +A deterministic precheck wraps every agent and answers three questions: + +1. Should this agent run? +2. Does it have what it needs to run? +3. Is another run already doing this work? + +A skipped run starts no model session. ```mermaid flowchart LR trig[trigger] --> pre{precheck} pre -->|skip| rec[record skip] pre -->|run| box[OpenShell sandbox] - box --> work[agent work, within limits] - work --> out[outputs and provenance] - work --> tel[telemetry] + box --> work[agent work, within iteration limits] + work -.-> out[outputs and provenance] + work -.-> tel[telemetry] ``` -Limits are iteration caps, such as a maximum number of CI retry rounds. +The [labeler agent](../../.agents/agents/labeler/) is a good reference for this. + +#### Agent packaging Gator is the reference for packaging: an `agent.yaml` manifest, a sandbox image, a sandbox policy, declared providers, and a payload baked into the image. The packaging RFC generalizes that shape and defines how it expresses the contract above. @@ -212,15 +222,15 @@ The event delivery RFC decides who provides this layer. GitHub Actions remains o ### Supporting components -Below the orchestration layer, the factory incorporates NVIDIA's open source agent components where it needs them, and chooses another option only where it is superior. Where a component falls short, the project records the gap and raises it with the owning project. +Below the orchestration layer, the factory incorporates open source agent components where it needs them, and chooses another option only where it is superior. Where a component falls short, the project records the gap and raises it with the owning project. -| Layer | Component | Status | +| Layer | Possible Components | Status | |---|---|---| | Sandbox | OpenShell | Fixed by this RFC | -| Harness abstraction | NeMo Fabric | To evaluate | -| Telemetry | OpenShell OTel and OCSF streams, with NeMo Relay for harness sessions | To evaluate | -| Evals | NeMo Helix | To evaluate | -| Model routing | NeMo Switchyard | To evaluate | +| Harness abstraction | NeMo Fabric, Agent Client Protocol (ACP), or a thin adapter over each harness's headless CLI | To evaluate | +| Telemetry | OpenShell OTel and OCSF streams, with NeMo Relay, Langfuse, or Arize Phoenix for harness sessions | To evaluate | +| Evals | NeMo Helix, Inspect AI, or promptfoo | To evaluate | +| Model routing | NeMo Switchyard, LiteLLM, or Envoy AI Gateway | To evaluate | ### Risk and supervision @@ -229,8 +239,8 @@ Three supervision modes match three levels of risk. | Mode | Low risk | Medium risk | High risk | |---|---|---|---| | Unsupervised | Allowed | Not allowed | Not allowed | -| Unsupervised, then reviewed | Not needed | Allowed | Not allowed | -| Paired with a human, then reviewed | Not needed | Allowed, discouraged | Required | +| Unsupervised, then reviewed | Not needed | Required | Not allowed | +| Paired with a human, then reviewed | Not needed | Allowed | Required | An assessor scores risk before Implementation starts and again when a change widens. Inputs to the score: @@ -239,13 +249,15 @@ An assessor scores risk before Implementation starts and again when a change wid - Complexity and dependencies. - Expanding range of affected functionality. A change that widens triggers deeper review. -The score sets the label. Work in the two unsupervised lanes is `ready-for-agent`. Work that needs pairing is `ready-for-human`, and the contributor who picks it up directs factory agents from a local session. +The score sets the label. Work in the two unsupervised lanes is `ready-for-agent`. Work that needs pairing is `ready-for-human`, and the contributor who picks it up directs agents, factory or otherwise, from a local session. + +Decomposition as a way to reduce risk is encouraged. Splitting a high-risk work item into low and medium risk items increases velocity by allowing more unsupervised agentic work. -Decomposition is the main way to shift work to agents. Splitting high-risk work into pieces that an agent completes and verifies one at a time drops it into the unsupervised-then-reviewed lane. + #### Design review -Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec. High-risk work is paired, so a human shapes the design directly. +Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec other than the issue description. High-risk work is handled by a human paired with an agent, so a human shapes the design and implementation directly. A human reviews every spec. The question is when: before the build starts, or together with the implementation in the PR. From 98373c4d9ef9a82cde93af62e887dd17ce3cefc9 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 16:48:25 -0800 Subject: [PATCH 05/15] docs(rfc): specify factory metrics and resolve review placeholders Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 146 ++++++++++++++++----------- 1 file changed, 85 insertions(+), 61 deletions(-) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index be0a203cc1..2721b50822 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -218,7 +218,7 @@ Gator is the reference for packaging: an `agent.yaml` manifest, a sandbox image, Repositories send events to the factory, and agents react to them. This layer does more than GitHub Actions does today: it takes in issue, PR, and comment events, runs schedules, hands work from agent to agent, queues it, and applies budget and priority before spending agent time. -The event delivery RFC decides who provides this layer. GitHub Actions remains one of the factory's triggers whatever that RFC decides. The contract above keeps agents portable across triggers. +The agent orchestration RFC decides who provides this layer. GitHub Actions remains one of the factory's triggers whatever that RFC decides. The contract above keeps agents portable across triggers. ### Supporting components @@ -227,10 +227,10 @@ Below the orchestration layer, the factory incorporates open source agent compon | Layer | Possible Components | Status | |---|---|---| | Sandbox | OpenShell | Fixed by this RFC | -| Harness abstraction | NeMo Fabric, Agent Client Protocol (ACP), or a thin adapter over each harness's headless CLI | To evaluate | +| Harness abstraction | Agent Client Protocol (ACP), NeMo Fabric, or a thin adapter over each harness's headless CLI | To evaluate | | Telemetry | OpenShell OTel and OCSF streams, with NeMo Relay, Langfuse, or Arize Phoenix for harness sessions | To evaluate | | Evals | NeMo Helix, Inspect AI, or promptfoo | To evaluate | -| Model routing | NeMo Switchyard, LiteLLM, or Envoy AI Gateway | To evaluate | +| Model routing | Envoy AI Gateway, NeMo Switchyard, or LiteLLM | To evaluate | ### Risk and supervision @@ -238,9 +238,9 @@ Three supervision modes match three levels of risk. | Mode | Low risk | Medium risk | High risk | |---|---|---|---| -| Unsupervised | Allowed | Not allowed | Not allowed | -| Unsupervised, then reviewed | Not needed | Required | Not allowed | -| Paired with a human, then reviewed | Not needed | Allowed | Required | +| Unsupervised implementation and review | Preferred | Not allowed | Not allowed | +| Unsupervised implementation, human reviewed | Allowed | Preferred | Not allowed | +| Supervised implementation and review | Not needed | Allowed | Required | An assessor scores risk before Implementation starts and again when a change widens. Inputs to the score: @@ -253,30 +253,27 @@ The score sets the label. Work in the two unsupervised lanes is `ready-for-agent Decomposition as a way to reduce risk is encouraged. Splitting a high-risk work item into low and medium risk items increases velocity by allowing more unsupervised agentic work. - - #### Design review -Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec other than the issue description. High-risk work is handled by a human paired with an agent, so a human shapes the design and implementation directly. - -A human reviews every spec. The question is when: before the build starts, or together with the implementation in the PR. - -A human reviews the spec before the build starts when any of these hold: +Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec other than the issue description. High-risk work is handled by a human paired with an agent, so a human directly shapes the design and implementation directly. -- The work is high risk. -- The design changes a public contract or a security boundary: proto, CLI, config, policy schema, crypto, or sandbox policy. -- The design is irreversible, such as a data migration. -- The design adds a dependency or new architecture. -- A reviewer agent flags the spec, or the spec writer records open questions. - -Otherwise a human reviews the spec and the implementation together in the PR when any of these hold: +A human reviews every spec. When the work item is medium risk, the spec may be reviewed together with the implementation in the PR when any of these are true: - **The build is cheap.** Implementing and re-implementing costs little time and few tokens, so a rejected design wastes little. - **A human already made the design decision.** The spec implements an accepted RFC, a maintainer-written design in the issue, or one piece of a parent spec a human approved. - **The design follows an established pattern.** For example, another provider or driver built on an existing template. - **The design is internal and reversible.** It changes no public contract or security boundary, and a revert undoes it. -A spec that fits neither list gets human review before the build starts. +Human spec review gates implementation when any of these hold: + +- **The work is high risk.** +- **The design changes a public contract or a security boundary:** proto, CLI, config, policy schema, crypto, or sandbox policy. +- **The design contains an irreversible change,** such as a data migration. +- **The design adds a dependency or new architecture.** +- **A reviewer agent flags the spec for review.** +- **The spec writer records open questions.** + +A spec that fits neither list gets human review before implementation. ### Agent lifecycle and evals @@ -302,53 +299,71 @@ Agents the factory could add beyond the starting set. This list is open: propose | Human notifier | Assessor | Tell the right person when work becomes `ready-for-human` | | Post-merge refactorer | Implementer | Simplify code a recent merge touched while keeping the same functionality | + + ### Metrics and telemetry Metrics influence both human behavior and agent choices. -| Group | Metrics | -|---|---| -| Flow | Time to an accept or decline decision on new issues and PRs, time to first review, time to merge, time to human decision, work in flight, CI speed | -| Safety | Velocity of safe change, days since the last accident | -| Fleet | Per-agent run time, token usage, cost, harness, model, and skip rate | - -Agents return a defined result, and measurements move to OpenShell's own observability streams wherever possible. OpenShell does not emit per-agent token, cost, and run-time metrics today. OpenShell issues track that work. - -### Follow-on RFCs and companion documents - -| Follow-on RFC | Scope | +| Group | Metric | Measures | +|---|---|---| +| Flow | Time to disposition | From an issue or PR opening to its accept or decline decision | +| Flow | Time to first review | From a PR opening to its first review, by an agent or a human | +| Flow | Time to merge | From a PR opening to its merge | +| Flow | Time to human decision | From `ready-for-human` to the human's next action | +| Flow | Work in flight | Open items at each stage, split by routing label | +| Flow | Check duration | Median and 95th percentile time of pre-commit and of required CI checks | +| Safety | Safe change rate | Merged changes per week that are not later reverted, by risk tier | +| Safety | Reverts and escaped defects | Merged changes later reverted, and bugs traced to a merged change, by risk tier and supervision mode | +| Safety | Days since the last accident | Time since a merged change last caused harm | +| Safety | Risk score agreement | How often a maintainer overrides the assessor's risk score, and in which direction | +| Fleet | Run volume | Runs per agent, with skip rate and the rate of runs that reach an iteration cap | +| Fleet | Run cost | Run time, tokens, and cost per run, by agent, harness, and model | +| Fleet | Output acceptance | Share of an agent's output that stands without human correction: PRs merged unedited, findings acted on, labels left in place | + +Agents return a defined result, and measurements move to OpenShell's own observability streams wherever possible. OpenShell does not emit per-agent token, cost, and run-time metrics today. That emission work is out of scope for this RFC, and OpenShell issues track it. + +### Companion documents + +Companion documents live in this folder. + +| Companion document | Scope | |---|---| -| Agent packaging and runtime | Directory layout, manifest, entrypoint, image build, multiple harnesses. Gator as reference | -| Agent identity | How an agent authenticates to GitHub and posts as itself across many sandboxes | -| Event delivery and control plane | Event intake, scheduling, budget and prioritization, multi-repository and extension onboarding, installing OpenShell plus the factory | -| Branch ownership | Agent branches in the main repository and maintainer takeover | - -Companion documents in this folder cover the risk scoring rubric, the reviewer catalog, and the metrics schema. +| Risk scoring rubric | Inputs to the score, how they combine, and the thresholds for each risk tier | +| Reviewer catalog | Each reviewer, the one concern it judges, its place in the review order, and its cost | +| Metrics schema | Metric names, definitions, dimensions, and the stream that carries each | ## Implementation plan The project builds the factory incrementally, starting from agents that already run. -1. **Inventory.** Describe the existing agents in the contract's terms: Gator, the labeler, the Issue Triage Gate, the Codex Compatibility Review, and the Codex Security Review. Record where each one departs from the contract. -2. **Packaging.** Land the packaging RFC and migrate Gator to it, building on [#5723](https://github.com/ai-openshell/openshell/issues/5723). -3. **Telemetry.** Define the metrics schema and add the OpenShell emission work it needs. Start collecting flow and fleet metrics for existing agents. -4. **Risk scoring.** Ship the scoring rubric and a risk assessor in advisory mode. Compare its scores with maintainer judgment before it gates anything. -5. **Orchestration.** Land the event delivery RFC and decide who provides the orchestration layer. -6. **Fill the pipeline.** Add reviewers and implementers one at a time through the lifecycle, lowest-risk work first. Each new automated trigger starts throttled, with human review on every PR it produces. -7. **Scheduled upkeep.** Add the flaky-test finder, refactorer, and CI optimizer once the risk gates are in force. +1. **Inventory and Conformance.** Describe the existing agents in the contract's terms: Gator, the labeler, the Issue Triage Gate, the Codex Compatibility Review, and the Codex Security Review. Record where each one departs from the contract, then align each in turn. +2. **Risk scoring.** Ship the scoring rubric and a risk assessor in advisory mode. Compare its scores with maintainer judgment before it gates anything. +3. **Packaging.** Land the packaging RFC and migrate Gator to it, building on [#5723](https://github.com/ai-openshell/openshell/issues/5723). +4. **Fill the pipeline.** Add reviewers and implementers one at a time through the lifecycle, lowest-risk work first. Each new automated trigger starts throttled, with human review on every PR it produces. +5. **Scheduled upkeep.** Add the flaky-test finder, refactorer, and CI optimizer once the risk gates are in force. +6. **Orchestration.** Land the agent orchestration RFC and decide who provides the orchestration layer. +7. **Telemetry.** Define the metrics schema and add the OpenShell emission work it needs. Start collecting flow and fleet metrics for existing agents. 8. **Widen.** Onboard further repositories, then extensions. ## Risks -- **Unsafe autonomy.** An agent merges a harmful change. Mitigation: risk tiers, advisory mode before gating, iteration caps, and sandbox policy. -- **Cost growth.** A fleet of agents spends more than it returns. Mitigation: prechecks, budget gates, and per-agent value-versus-cost review. -- **Component dependency.** Adopting components the project does not control ties factory progress to other projects' roadmaps. Mitigation: a contract that keeps agents portable, and adopting only what is needed. -- **Review load.** A factory that produces changes faster than maintainers review them moves the bottleneck instead of removing it. Mitigation: throttled triggers, progressive review before asking a human, and small changes. -- **Fragmentation.** Many small agents are harder to reason about than a few large ones. Mitigation: evals decide agent scope, and the catalog stays in one place. -- **Scoring error.** A wrong risk score sends work to the wrong lane. Mitigation: advisory mode, and a human override in both directions. -- **Public project exposure.** Agents act on input from outside contributors. Mitigation: read-only agents by default, with writes limited to narrow, declared outputs. - -## Alternatives +- **Unsafe autonomy.** An agent merges a harmful change. + - *Mitigation:* risk tiers, advisory mode before gating, iteration caps, and sandbox policy. +- **Cost growth.** A fleet of agents spends more than it returns. + - *Mitigation:* prechecks, budget gates, and per-agent value-versus-cost review. +- **Component dependency.** Adopting components the project does not control ties factory progress to other projects' roadmaps. + - *Mitigation:* a contract that keeps agents portable, and adopting only what is needed. +- **Review load.** A factory that produces changes faster than maintainers review them moves the bottleneck instead of removing it. + - *Mitigation:* throttled triggers, progressive review before asking a human, and small changes. +- **Fragmentation.** Many small agents are harder to reason about than a few large ones. + - *Mitigation:* evals decide agent scope, and the catalog stays in one place. +- **Scoring error.** A wrong risk score sends work to the wrong lane. + - *Mitigation:* advisory mode, and a human override in both directions. +- **Public project exposure.** Agents act on input from outside contributors. + - *Mitigation:* read-only agents by default, with writes limited to narrow, declared outputs. + +## Alternatives evaluated ### Keep driving agents from contributors' machines @@ -356,7 +371,7 @@ This is the current path. It needs no new design. The time and focus of the peop ### Keep adding bespoke GitHub Actions agents -This extends the few agents that already run in CI. Each agent keeps its own trigger, packaging, and identity, and nothing measures or budgets the fleet. Cost grows with every agent added. +This extends the few agents that already run in CI. Each agent keeps its own trigger, packaging, credentials, and identity, and nothing measures or budgets the fleet. Cost grows with every agent added. ### One large general-purpose agent @@ -364,7 +379,7 @@ A single agent handling an issue from intake to merge is simpler to operate. It ### Adopt an open source orchestration platform wholesale -Kelos, GitHub Agentic Workflows, and Fabro each cover part of the problem. None runs agents in OpenShell sandboxes, and none offers risk-tiered supervision that this review found. The project pulls patterns from them. +Kelos, GitHub Agentic Workflows, and Fabro each cover part of the problem. None runs agents in OpenShell sandboxes today, and none ships risk-tiered supervision that this review found. Neither gap rules a platform out. An adapter can run a platform's agents in OpenShell sandboxes, and Fabro appears adaptable to the risk model above. Adopting one unchanged does not meet the factory's needs, so the remaining costs are the adaptation work and a dependency on another project's roadmap. The agent orchestration RFC weighs each platform on those costs. ### Build the orchestration layer in OpenShell @@ -372,14 +387,23 @@ This gives full control and the strongest dogfooding. It also spends the project ## Prior art -- **Kelos.** An image contract with a fixed entrypoint and output markers for branch, PR, tokens, and cost. The lesson is a small, checkable agent interface. -- **GitHub Agentic Workflows.** A read-only agent whose writes go through separate, narrow output jobs with short-lived tokens. +- **[Kelos](https://github.com/kelos-dev/kelos).** An [image contract](https://github.com/kelos-dev/kelos/blob/main/docs/agent-image-interface.md) with a fixed entrypoint and output markers for branch, PR, tokens, and cost. The lesson is a small, checkable agent interface. +- **[GitHub Agentic Workflows](https://github.com/github/gh-aw).** An [architecture](https://github.github.com/gh-aw/introduction/architecture/) built on a read-only agent whose writes go through separate, narrow output jobs with short-lived tokens. - **Matt Pocock's `software-factory` skill.** A [vocabulary](https://github.com/mattpocock/skills/tree/main/skills/in-progress/software-factory) of tasks, triggers, runs, and runners. The lessons: a run never waits for a human, a cap ends every loop before it asks a human, and triggers arrive one at a time behind checks, automated review, and human review. - **Superpowers.** A [development methodology](https://github.com/obra/superpowers) delivered as skills for many harnesses, in which a local session works through a plan by dispatching subagents and reviewing their work. This is the shape of the local session entry. - **Prime Radiant's tooling.** [github-triage](https://github.com/prime-radiant-inc/github-triage) runs a read-only security review of a PR before any checkout and has labeler agents only propose, with a deterministic script checking the proposals. [shepherd-pr](https://github.com/prime-radiant-inc/shepherd-pr) takes a PR through CI and review within a bounded number of observations. [superpowers-evals](https://github.com/prime-radiant-inc/superpowers-evals) grades real agent CLIs on workflow compliance across harnesses. -- **Stripe's Minions.** Blueprints that mix deterministic and agent steps, and a hard cap on CI retry rounds. -- **Prow.** Chat-command plugins and a merge robot. The lesson is event-driven automation that maintainers steer from the PR. -- **OpenAI's harness engineering notes.** Scheduled agents that refactor and collect garbage in the codebase. +- **[Stripe's Minions](https://stripe.dev/blog/minions-stripes-one-shot-end-to-end-coding-agents-part-2).** Blueprints that mix deterministic and agent steps, and a hard cap on CI retry rounds. +- **[Prow](https://docs.prow.k8s.io/docs/overview/).** Chat-command plugins and a merge robot. The lesson is event-driven automation that maintainers steer from the PR, as well as enhanced ChatOps via Slack. +- **[OpenAI's harness engineering notes](https://openai.com/index/harness-engineering/).** Scheduled agents that refactor and collect garbage in the codebase. + +## Follow-on RFCs + +| Follow-on RFC | Scope | +|---|---| +| Agent packaging and runtime | Directory layout, manifest, entrypoint, image build, multiple harnesses. Gator as reference | +| Agent identity | How an agent authenticates to GitHub and posts as itself across many sandboxes | +| Agent orchestration | Event intake, scheduling, budget and prioritization, multi-repository and extension onboarding, installing OpenShell plus the factory | +| Branch ownership | Agent branches in the main repository and maintainer takeover | ## Open questions From 8567f47ec32f38b3e8c4fb1f6fc035af245eb735 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 17:02:43 -0800 Subject: [PATCH 06/15] docs(rfc): add companion stubs and scope out telemetry emission Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 51 +++++++++---------- rfc/0026-openshell-factory/metrics-schema.md | 10 ++++ .../reviewer-catalog.md | 11 ++++ .../risk-scoring-rubric.md | 11 ++++ 4 files changed, 57 insertions(+), 26 deletions(-) create mode 100644 rfc/0026-openshell-factory/metrics-schema.md create mode 100644 rfc/0026-openshell-factory/reviewer-catalog.md create mode 100644 rfc/0026-openshell-factory/risk-scoring-rubric.md diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 2721b50822..9275b828fc 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -65,6 +65,7 @@ This RFC explicitly does not intend any of the following: - **Agent packaging details.** Directory layout, entrypoint, and image build belong to a follow-on RFC. - **Agent identity.** How an agent authenticates and posts as itself belongs to a follow-on RFC. Agent identity is distinct from sandbox identity because one agent spans many sandboxes. - **Enforced developer workflow.** Developers bring their own tooling and workflow for any work they do, and that work easily enters the factory. +- **Telemetry emission in OpenShell.** Emitting per-agent tokens, cost, and run time is OpenShell work, tracked in OpenShell issues. - **A complete agent catalog.** This RFC names categories and a starting set. - **Replacing GitHub as the system of record for issues, PRs, and reviews.** @@ -212,13 +213,13 @@ The [labeler agent](../../.agents/agents/labeler/) is a good reference for this. #### Agent packaging -Gator is the reference for packaging: an `agent.yaml` manifest, a sandbox image, a sandbox policy, declared providers, and a payload baked into the image. The packaging RFC generalizes that shape and defines how it expresses the contract above. +Gator is the reference for packaging: an `agent.yaml` manifest, a sandbox image, a sandbox policy, declared providers, and a payload baked into the image. The packaging RFC will generalize that shape and define how it expresses the contract above. ### Triggering and orchestration Repositories send events to the factory, and agents react to them. This layer does more than GitHub Actions does today: it takes in issue, PR, and comment events, runs schedules, hands work from agent to agent, queues it, and applies budget and priority before spending agent time. -The agent orchestration RFC decides who provides this layer. GitHub Actions remains one of the factory's triggers whatever that RFC decides. The contract above keeps agents portable across triggers. +The agent orchestration RFC will decide who provides this layer. GitHub Actions remains one of the factory's triggers whatever that RFC decides. The contract above keeps agents portable across triggers. ### Supporting components @@ -257,7 +258,7 @@ Decomposition as a way to reduce risk is encouraged. Splitting a high-risk work Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec other than the issue description. High-risk work is handled by a human paired with an agent, so a human directly shapes the design and implementation directly. -A human reviews every spec. When the work item is medium risk, the spec may be reviewed together with the implementation in the PR when any of these are true: +A human reviews every design spec. When the work item is medium risk, the spec may be reviewed together with the implementation in the PR when any of these are true: - **The build is cheap.** Implementing and re-implementing costs little time and few tokens, so a rejected design wastes little. - **A human already made the design decision.** The spec implements an accepted RFC, a maintainer-written design in the issue, or one piece of a parent spec a human approved. @@ -299,29 +300,27 @@ Agents the factory could add beyond the starting set. This list is open: propose | Human notifier | Assessor | Tell the right person when work becomes `ready-for-human` | | Post-merge refactorer | Implementer | Simplify code a recent merge touched while keeping the same functionality | - - ### Metrics and telemetry Metrics influence both human behavior and agent choices. -| Group | Metric | Measures | +| Metric | Group | Measures | |---|---|---| -| Flow | Time to disposition | From an issue or PR opening to its accept or decline decision | -| Flow | Time to first review | From a PR opening to its first review, by an agent or a human | -| Flow | Time to merge | From a PR opening to its merge | -| Flow | Time to human decision | From `ready-for-human` to the human's next action | -| Flow | Work in flight | Open items at each stage, split by routing label | -| Flow | Check duration | Median and 95th percentile time of pre-commit and of required CI checks | -| Safety | Safe change rate | Merged changes per week that are not later reverted, by risk tier | -| Safety | Reverts and escaped defects | Merged changes later reverted, and bugs traced to a merged change, by risk tier and supervision mode | -| Safety | Days since the last accident | Time since a merged change last caused harm | -| Safety | Risk score agreement | How often a maintainer overrides the assessor's risk score, and in which direction | -| Fleet | Run volume | Runs per agent, with skip rate and the rate of runs that reach an iteration cap | -| Fleet | Run cost | Run time, tokens, and cost per run, by agent, harness, and model | -| Fleet | Output acceptance | Share of an agent's output that stands without human correction: PRs merged unedited, findings acted on, labels left in place | - -Agents return a defined result, and measurements move to OpenShell's own observability streams wherever possible. OpenShell does not emit per-agent token, cost, and run-time metrics today. That emission work is out of scope for this RFC, and OpenShell issues track it. +| Time to disposition | Flow | From an issue or PR opening to its accept or decline decision | +| Time to first review | Flow | From a PR opening to its first review, by an agent or a human | +| Time to merge | Flow | From a PR opening to its merge | +| Time to human response | Flow | From `ready-for-human` to the human's next action | +| Work in flight | Flow | Open items at each stage, split by routing label | +| Check duration | Flow | Median and 95th percentile time of pre-commit and of required CI checks | +| Safe change rate | Safety | Merged changes per week that are not later reverted, by risk tier | +| Reverts and escaped defects | Safety | Merged changes later reverted, and bugs traced to a merged change, by risk tier and supervision mode | +| Days since the last accident | Safety | Time since a merged change last caused harm | +| Risk score agreement | Safety | How often a maintainer overrides the assessor's risk score, and in which direction | +| Run volume | Fleet | Runs per agent, with skip rate and the rate of runs that reach an iteration cap | +| Run cost | Fleet | Run time, tokens, and cost per run, by agent, harness, and model | +| Output acceptance | Fleet | Share of an agent's output that stands without human correction: PRs merged unedited, findings acted on, labels left in place | + +Agents return a defined result, and measurements move to OpenShell's own observability streams wherever possible. OpenShell does not emit per-agent token, cost, and run-time metrics today. That emission work is out of scope for this RFC; instead, it should be tracked in OpenShell issues. ### Companion documents @@ -329,9 +328,9 @@ Companion documents live in this folder. | Companion document | Scope | |---|---| -| Risk scoring rubric | Inputs to the score, how they combine, and the thresholds for each risk tier | -| Reviewer catalog | Each reviewer, the one concern it judges, its place in the review order, and its cost | -| Metrics schema | Metric names, definitions, dimensions, and the stream that carries each | +| [Risk scoring rubric](risk-scoring-rubric.md) | Inputs to the score, how they combine, and the thresholds for each risk tier | +| [Reviewer catalog](reviewer-catalog.md) | Each reviewer, the one concern it judges, its place in the review order, and its cost | +| [Metrics schema](metrics-schema.md) | Metric names, definitions, dimensions, and the stream that carries each | ## Implementation plan @@ -343,7 +342,7 @@ The project builds the factory incrementally, starting from agents that already 4. **Fill the pipeline.** Add reviewers and implementers one at a time through the lifecycle, lowest-risk work first. Each new automated trigger starts throttled, with human review on every PR it produces. 5. **Scheduled upkeep.** Add the flaky-test finder, refactorer, and CI optimizer once the risk gates are in force. 6. **Orchestration.** Land the agent orchestration RFC and decide who provides the orchestration layer. -7. **Telemetry.** Define the metrics schema and add the OpenShell emission work it needs. Start collecting flow and fleet metrics for existing agents. +7. **Telemetry.** Define the metrics schema and file OpenShell issues for the emission it needs. Start collecting flow metrics for existing agents, and add fleet metrics as OpenShell emits them. 8. **Widen.** Onboard further repositories, then extensions. ## Risks @@ -379,7 +378,7 @@ A single agent handling an issue from intake to merge is simpler to operate. It ### Adopt an open source orchestration platform wholesale -Kelos, GitHub Agentic Workflows, and Fabro each cover part of the problem. None runs agents in OpenShell sandboxes today, and none ships risk-tiered supervision that this review found. Neither gap rules a platform out. An adapter can run a platform's agents in OpenShell sandboxes, and Fabro appears adaptable to the risk model above. Adopting one unchanged does not meet the factory's needs, so the remaining costs are the adaptation work and a dependency on another project's roadmap. The agent orchestration RFC weighs each platform on those costs. +Kelos, GitHub Agentic Workflows, and Fabro each cover part of the problem. None runs agents in OpenShell sandboxes today, and none ships risk-tiered supervision that this review found. Neither gap rules a platform out. An adapter can run a platform's agents in OpenShell sandboxes, and Fabro appears adaptable to the risk model above. Adopting one unchanged does not meet the factory's needs, so the remaining costs are the adaptation work and a dependency on another project's roadmap. The agent orchestration RFC will weigh each platform on those costs. ### Build the orchestration layer in OpenShell diff --git a/rfc/0026-openshell-factory/metrics-schema.md b/rfc/0026-openshell-factory/metrics-schema.md new file mode 100644 index 0000000000..d2f5849dc4 --- /dev/null +++ b/rfc/0026-openshell-factory/metrics-schema.md @@ -0,0 +1,10 @@ +# Metrics schema + +Companion to [RFC 0026](README.md#metrics-and-telemetry). This document is a stub. + +It defines, for each metric: + +- Its name and definition. +- Its unit and dimensions. +- The source of the data and the stream that carries it. +- Whether OpenShell emits the data today. diff --git a/rfc/0026-openshell-factory/reviewer-catalog.md b/rfc/0026-openshell-factory/reviewer-catalog.md new file mode 100644 index 0000000000..e60e33a666 --- /dev/null +++ b/rfc/0026-openshell-factory/reviewer-catalog.md @@ -0,0 +1,11 @@ +# Reviewer catalog + +Companion to [RFC 0026](README.md#review). This document is a stub. + +It lists each reviewer with: + +- The one concern it judges. +- Its trigger and its place in the review order. +- Whether it is deterministic or model-driven. +- Its cost in time and tokens. +- The result it returns and what a failure sends back to Implementation. diff --git a/rfc/0026-openshell-factory/risk-scoring-rubric.md b/rfc/0026-openshell-factory/risk-scoring-rubric.md new file mode 100644 index 0000000000..bca8521936 --- /dev/null +++ b/rfc/0026-openshell-factory/risk-scoring-rubric.md @@ -0,0 +1,11 @@ +# Risk scoring rubric + +Companion to [RFC 0026](README.md#risk-and-supervision). This document is a stub. + +It defines: + +- The inputs to the risk score and how an assessor measures each one. +- How the inputs combine into a score. +- The thresholds that separate low, medium, and high risk. +- When a change is scored again. +- How a maintainer overrides a score. From 7664612627b7a13b5446a3eddd136da826e65b25 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 17:34:01 -0800 Subject: [PATCH 07/15] docs(rfc): draft companion documents and settle open questions Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 28 +++++------ rfc/0026-openshell-factory/metrics-schema.md | 27 +++++++--- .../reviewer-catalog.md | 29 ++++++++--- .../risk-scoring-rubric.md | 50 ++++++++++++++++--- 4 files changed, 100 insertions(+), 34 deletions(-) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 9275b828fc..6e8578ced4 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -168,6 +168,10 @@ flowchart LR Examples: spec, architecture, code, security, compatibility, end-to-end acceptance, and concision reviewers. +The factory steps up its attention to a piece of work at two points. The first is when the work is [accepted](../../CONTRIBUTING.md#accepted-work). The second is when its PR is **merge-ready**: every required review gate has passed, every review comment is addressed, and the intent is to land it. + +The rebaser acts only on merge-ready PRs. It resolves conflicts with the base as soon as they block landing. Before a PR is merge-ready, conflicts belong to whoever is implementing the change. + #### Division of labor All work in the factory is either waiting for a human or an agent to drive the next action to move it forward, and it's marked accordingly as either `ready-for-human` or `ready-for-agent`. @@ -215,11 +219,13 @@ The [labeler agent](../../.agents/agents/labeler/) is a good reference for this. Gator is the reference for packaging: an `agent.yaml` manifest, a sandbox image, a sandbox policy, declared providers, and a payload baked into the image. The packaging RFC will generalize that shape and define how it expresses the contract above. +An agent declares the harness or harnesses it runs on. No agent is required to run on several, and none is prohibited from it. + ### Triggering and orchestration Repositories send events to the factory, and agents react to them. This layer does more than GitHub Actions does today: it takes in issue, PR, and comment events, runs schedules, hands work from agent to agent, queues it, and applies budget and priority before spending agent time. -The agent orchestration RFC will decide who provides this layer. GitHub Actions remains one of the factory's triggers whatever that RFC decides. The contract above keeps agents portable across triggers. +The agent orchestration RFC will decide who provides this layer. It will evaluate each option against these criteria: GitHub issue, PR, and comment event intake; an access model that works with outside contributors; budget and queueing controls; iteration caps; and approval gates. GitHub Actions remains one of the factory's triggers whatever that RFC decides. The contract above keeps agents portable across triggers. ### Supporting components @@ -254,6 +260,10 @@ The score sets the label. Work in the two unsupervised lanes is `ready-for-agent Decomposition as a way to reduce risk is encouraged. Splitting a high-risk work item into low and medium risk items increases velocity by allowing more unsupervised agentic work. +The decision to split a work item requires human review. The agent recommends a split and shows how it scores the risk of each item. Once a human approves, the agent makes the split and labels each item by its risk. Each resulting item is a full vertical slice that stands on its own. A split never ships the docs in one item and the code they describe in another. + +The same pattern holds for every label change. An agent sets `ready-for-agent` only on work that scores below the risk bar, and work that shows any sign of more risk is scored at the next level up. An agent never moves work from `ready-for-human` to `ready-for-agent` without a human's approval. + #### Design review Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec other than the issue description. High-risk work is handled by a human paired with an agent, so a human directly shapes the design and implementation directly. @@ -402,19 +412,9 @@ This gives full control and the strongest dogfooding. It also spends the project | Agent packaging and runtime | Directory layout, manifest, entrypoint, image build, multiple harnesses. Gator as reference | | Agent identity | How an agent authenticates to GitHub and posts as itself across many sandboxes | | Agent orchestration | Event intake, scheduling, budget and prioritization, multi-repository and extension onboarding, installing OpenShell plus the factory | -| Branch ownership | Agent branches in the main repository and maintainer takeover | ## Open questions -- When does work require a human? The matrix allows paired work at medium risk and discourages it. Should the matrix disallow it? -- Which transitions between `ready-for-agent` and `ready-for-human` may an agent make, and which belong to maintainers alone? -- What are the gates, and where do budget and prioritization live? -- The orchestration layer needs GitHub issue, PR, and comment event intake, an access model that works with outside contributors, budget and queueing controls, iteration caps, and approval gates. Which option provides them? -- Which of NeMo Fabric, Relay, Helix, and Switchyard does the factory need, and in what order? -- What work does OpenShell need to emit per-agent tokens, cost, and run time? -- How does the factory run more than one harness? -- How does agent identity on GitHub work when one agent spans many sandboxes? -- Agent branches in the main repository let maintainers take over. Is there another way to get the same takeover? -- When does the rebase agent run? -- How do vendors and extensions engage with the factory, and how do they supply the resources to run it against their extensions? -- Which leading indicators of severity and blast radius can an assessor compute from an issue alone? +- What unit does a budget cap: a run, an agent, a work item, or a day? Who sets it? The agent orchestration RFC will answer this. +- Which supporting layers must exist before the first new agent ships? The working answer is telemetry and evals. Harness abstraction and model routing wait until a second harness or model needs them. +- Who pays for factory runs against an extension's repository: the project, or the extension's owner with their own credentials and compute? diff --git a/rfc/0026-openshell-factory/metrics-schema.md b/rfc/0026-openshell-factory/metrics-schema.md index d2f5849dc4..54c59703a6 100644 --- a/rfc/0026-openshell-factory/metrics-schema.md +++ b/rfc/0026-openshell-factory/metrics-schema.md @@ -1,10 +1,25 @@ # Metrics schema -Companion to [RFC 0026](README.md#metrics-and-telemetry). This document is a stub. +Companion to [RFC 0026](README.md#metrics-and-telemetry). This document is a first draft. -It defines, for each metric: +| Metric | Unit | Dimensions | Source | Available today | +|---|---|---|---|---| +| Time to disposition | Duration | Repository, issue or PR | GitHub events | Yes | +| Time to first review | Duration | Repository, reviewer kind | GitHub events | Yes | +| Time to merge | Duration | Repository, risk tier | GitHub events | Yes, without risk tier | +| Time to human response | Duration | Repository, stage | GitHub label events | No. Needs the routing labels | +| Work in flight | Count | Stage, routing label | GitHub labels | No. Needs the routing labels | +| Check duration | Duration, median and 95th percentile | Check name | GitHub Actions for CI, local reporting for pre-commit | CI only | +| Safe change rate | Changes per week | Risk tier | GitHub events | Yes, without risk tier | +| Reverts and escaped defects | Count | Risk tier, supervision mode | GitHub events, plus a link from a bug to the change that caused it | Reverts only | +| Days since the last accident | Days | Repository | An accident record | No. Needs a definition of an accident | +| Risk score agreement | Share of scores overridden | Direction of the override | Risk assessor results and maintainer overrides | No. Needs the risk assessor | +| Run volume | Count | Agent, result, skipped, cap reached | Agent results | Partly, from workflow runs | +| Run cost | Duration, tokens, cost | Agent, harness, model | OpenShell observability streams | No. Needs OpenShell emission | +| Output acceptance | Share of output unchanged | Agent, output kind | GitHub events | Partly | -- Its name and definition. -- Its unit and dimensions. -- The source of the data and the stream that carries it. -- Whether OpenShell emits the data today. +## Open definitions + +- What counts as an accident. +- How a bug links to the change that caused it. +- The fields of an agent's result. diff --git a/rfc/0026-openshell-factory/reviewer-catalog.md b/rfc/0026-openshell-factory/reviewer-catalog.md index e60e33a666..cd027dfd96 100644 --- a/rfc/0026-openshell-factory/reviewer-catalog.md +++ b/rfc/0026-openshell-factory/reviewer-catalog.md @@ -1,11 +1,26 @@ # Reviewer catalog -Companion to [RFC 0026](README.md#review). This document is a stub. +Companion to [RFC 0026](README.md#review). This document is a first draft. -It lists each reviewer with: +Reviewers run in three tiers, cheapest first. A change reaches a tier only after it passes the one before. -- The one concern it judges. -- Its trigger and its place in the review order. -- Whether it is deterministic or model-driven. -- Its cost in time and tokens. -- The result it returns and what a failure sends back to Implementation. +| Tier | Reviewer | Concern | Kind | +|---|---|---|---| +| 1. Deterministic checks | Format, lint, and tests | The change builds, passes its tests, and meets style rules | Deterministic | +| 1. Deterministic checks | Commit checks | Commits are signed, signed off, and follow Conventional Commits | Deterministic | +| 1. Deterministic checks | Issue acceptance | The PR links accepted work | Deterministic | +| 2. Single-concern reviewers | Spec | The change does what its spec says, and no more | Model-driven | +| 2. Single-concern reviewers | Code | The change is correct and maintainable | Model-driven | +| 2. Single-concern reviewers | Compatibility | Public contracts stay compatible | Model-driven | +| 2. Single-concern reviewers | Concision | Docs, comments, and code carry no needless words or unrequested additions | Model-driven | +| 3. Expensive reviewers | Architecture | The change fits crate boundaries and the existing design | Model-driven | +| 3. Expensive reviewers | Security | The change keeps sandbox, policy, credential, and crypto boundaries intact | Model-driven | +| 3. Expensive reviewers | End-to-end acceptance | The change does what the issue asks in a running system | Model-driven | + +## Results + +Each reviewer returns pass or changes needed. Changes needed sends the PR back to Implementation with the reviewer's findings. + +## Cost + +Each reviewer's cost in time and tokens comes from the fleet metrics in the [metrics schema](metrics-schema.md). Cost decides a reviewer's tier. diff --git a/rfc/0026-openshell-factory/risk-scoring-rubric.md b/rfc/0026-openshell-factory/risk-scoring-rubric.md index bca8521936..ea3a24cd1d 100644 --- a/rfc/0026-openshell-factory/risk-scoring-rubric.md +++ b/rfc/0026-openshell-factory/risk-scoring-rubric.md @@ -1,11 +1,47 @@ # Risk scoring rubric -Companion to [RFC 0026](README.md#risk-and-supervision). This document is a stub. +Companion to [RFC 0026](README.md#risk-and-supervision). This document is a first draft. -It defines: +## Inputs -- The inputs to the risk score and how an assessor measures each one. -- How the inputs combine into a score. -- The thresholds that separate low, medium, and high risk. -- When a change is scored again. -- How a maintainer overrides a score. +An assessor rates each input as low, medium, or high. + +| Input | Low | Medium | High | +|---|---|---|---| +| Reversibility | A revert undoes the change | A revert needs a follow-up step, such as a config or cache change | Irreversible: a data migration, a published release, or a protocol change | +| Blast radius | One component, off the default path | Several components, or the default path | A sandbox boundary, gateway authentication, policy enforcement, or every user | +| Complexity and dependencies | A small change with no dependency changes | A change across crates, or a dependency update | A new dependency or new architecture | +| Widening | The change stays inside the scope the issue states | The change touches adjacent functionality | The change expands the range of affected functionality | +| Contracts and boundaries | No public contract or security boundary changes | An additive change to a public contract | A breaking change to a public contract, or any change to a security boundary | + +Public contracts are proto, CLI, config, and policy schema. Security boundaries include crypto and sandbox policy. + +## Combining the inputs + +The risk tier is the highest rating any input reaches. When a signal is ambiguous, the assessor rates that input at the next level up. Work that needs a design is at least medium risk; see [Design review](README.md#design-review). + +## Leading indicators + +An assessor scores an issue before any code exists. It reads these signals from the issue alone: + +- The area and topic labels. +- The components, crates, or files the issue names. +- Whether the issue names a public contract or a security boundary. +- Words that signal irreversibility, such as migration, breaking, or removal. +- Whether the issue asks for new behavior or a change to existing behavior. + +## Scoring again + +An assessor scores a piece of work: + +- Before Implementation starts. +- When its PR opens. +- When the change widens: the PR touches paths outside the ones the last score covered. + +## Overrides + +A maintainer overrides a score in either direction and records the reason. Overrides feed the [risk score agreement](README.md#metrics-and-telemetry) metric. + +## Advisory mode + +The risk assessor starts in advisory mode. It posts scores, and maintainers compare them with their own judgment before any score gates work. From cc2c9aa6716d4d96312be8dd7b0c0c05eafda45a Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 18:38:35 -0800 Subject: [PATCH 08/15] docs(rfc): rework risk rubric inputs and define an accident Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/metrics-schema.md | 2 +- .../risk-scoring-rubric.md | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/rfc/0026-openshell-factory/metrics-schema.md b/rfc/0026-openshell-factory/metrics-schema.md index 54c59703a6..1f5031c1aa 100644 --- a/rfc/0026-openshell-factory/metrics-schema.md +++ b/rfc/0026-openshell-factory/metrics-schema.md @@ -20,6 +20,6 @@ Companion to [RFC 0026](README.md#metrics-and-telemetry). This document is a fir ## Open definitions -- What counts as an accident. +- What counts as an accident. Working definition: a merged change causes harm that reaches users, or blocks the main branch or a release pipeline until it is reverted or fixed. A revert during a period the project declares in advance as unstable, such as a repository migration, is not an accident. Still open: who declares such a period, and who records an accident. - How a bug links to the change that caused it. - The fields of an agent's result. diff --git a/rfc/0026-openshell-factory/risk-scoring-rubric.md b/rfc/0026-openshell-factory/risk-scoring-rubric.md index ea3a24cd1d..5612273f9a 100644 --- a/rfc/0026-openshell-factory/risk-scoring-rubric.md +++ b/rfc/0026-openshell-factory/risk-scoring-rubric.md @@ -9,13 +9,33 @@ An assessor rates each input as low, medium, or high. | Input | Low | Medium | High | |---|---|---|---| | Reversibility | A revert undoes the change | A revert needs a follow-up step, such as a config or cache change | Irreversible: a data migration, a published release, or a protocol change | -| Blast radius | One component, off the default path | Several components, or the default path | A sandbox boundary, gateway authentication, policy enforcement, or every user | -| Complexity and dependencies | A small change with no dependency changes | A change across crates, or a dependency update | A new dependency or new architecture | +| Criticality of impact | An operator sees wrong or missing information, or a build step breaks visibly | A sandbox or gateway cannot start, stop, or stay connected, or works unreliably. PRs or releases are blocked | Enforcement or isolation fails | +| Complexity | The touched functions are simple and the change adds little | The touched functions branch heavily, or the change adds substantial logic | The change adds new architecture or rewrites complex code | +| Dependents | Little other code depends on the touched code | Several crates or many callers depend on it | Most of the workspace depends on it | | Widening | The change stays inside the scope the issue states | The change touches adjacent functionality | The change expands the range of affected functionality | -| Contracts and boundaries | No public contract or security boundary changes | An additive change to a public contract | A breaking change to a public contract, or any change to a security boundary | +| Contracts and boundaries | No public contract, security boundary, or dependency changes | An additive change to a public contract, or a dependency update | A breaking change to a public contract, any change to a security boundary, or a new dependency | +| Testing | Reliable tests exercise the changed code | Tests exercise part of the changed code, or some of them are flaky or skipped | No tests exercise the changed code | Public contracts are proto, CLI, config, and policy schema. Security boundaries include crypto and sandbox policy. +The testing input rates how much of the changed code the tests exercise and how reliable those tests are. The project measures neither test coverage nor test reliability today, so the assessor judges both from the change and the test history. + +Complexity rates the code being changed, by the cyclomatic complexity of the touched functions and by how much the change adds. Dependents rates how much other code relies on the touched code, counted as dependent crates and callers. The project measures neither today. `cargo metadata` gives dependent crates, and the assessor judges the rest. + +### Criticality of impact + +Criticality rates what fails if the change is wrong. + +| Rating | What fails if the change is wrong | Examples | +|---|---|---| +| High | Enforcement or isolation: a policy decision, the sandbox boundary, credentials | Policy evaluation, L7 enforcement, seccomp mediation, credential injection | +| Medium | A sandbox or gateway cannot start, stop, or stay connected, or works unreliably. Contributors cannot put up a PR, or the project cannot ship a release | Sandbox creation, compute drivers, supervisor session, provisioning, policy DNS lookups, required PR checks, release workflows | +| Low | An operator sees wrong or missing information, or a build or CI step breaks in a way that is easy to see and quick to fix | Listing sandboxes, gateways, and workspaces, TUI display, CLI help, docs, most build and CI changes | + +How often the code runs adjusts the rating. Code that runs on every request, connection, lookup, or syscall raises a low rating to medium, because an intermittent failure there is close to a complete one. Frequency never raises a rating to high. + +The assessor scores a change as if every option it adds is turned on. Shipping a change off by default does not lower its rating. + ## Combining the inputs The risk tier is the highest rating any input reaches. When a signal is ambiguous, the assessor rates that input at the next level up. Work that needs a design is at least medium risk; see [Design review](README.md#design-review). From 96a0e4a6d38522cf8ff57701d73ff993523cc1a6 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Mon, 30 Nov 2026 19:01:23 -0800 Subject: [PATCH 09/15] docs(rfc): set the ready-for-agent bar and the rubric's starting point Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 4 ++-- .../risk-scoring-rubric.md | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 6e8578ced4..1173f98c7a 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -153,7 +153,7 @@ Examples: spec writer, implementer, rebaser, refactorer, CI optimizer. #### Review -Reviewers each judge one concern, cheapest first. The risk tier decides whether a human reviews before merge. +Reviewers each judge one concern, cheapest first. The risk tier decides whether a human reviews before merge. On medium-risk work, agents review the PR and the implementer fixes what they find before a human reviews it, so the human sees a change that has already passed every agent gate. ```mermaid flowchart LR @@ -262,7 +262,7 @@ Decomposition as a way to reduce risk is encouraged. Splitting a high-risk work The decision to split a work item requires human review. The agent recommends a split and shows how it scores the risk of each item. Once a human approves, the agent makes the split and labels each item by its risk. Each resulting item is a full vertical slice that stands on its own. A split never ships the docs in one item and the code they describe in another. -The same pattern holds for every label change. An agent sets `ready-for-agent` only on work that scores below the risk bar, and work that shows any sign of more risk is scored at the next level up. An agent never moves work from `ready-for-human` to `ready-for-agent` without a human's approval. +The same pattern holds for every label change. An agent sets `ready-for-agent` only on work that scores low or medium risk, and work that shows any sign of more risk is scored at the next level up. An agent never moves work from `ready-for-human` to `ready-for-agent` without a human's approval. #### Design review diff --git a/rfc/0026-openshell-factory/risk-scoring-rubric.md b/rfc/0026-openshell-factory/risk-scoring-rubric.md index 5612273f9a..486a3e7f05 100644 --- a/rfc/0026-openshell-factory/risk-scoring-rubric.md +++ b/rfc/0026-openshell-factory/risk-scoring-rubric.md @@ -40,6 +40,24 @@ The assessor scores a change as if every option it adds is turned on. Shipping a The risk tier is the highest rating any input reaches. When a signal is ambiguous, the assessor rates that input at the next level up. Work that needs a design is at least medium risk; see [Design review](README.md#design-review). +## From tier to label + +| Tier | Label an agent may set | Path | +|---|---|---| +| Low | `ready-for-agent` | Agents implement, review, and merge | +| Medium | `ready-for-agent` | Agents implement, review, and fix. The PR lands only after a human reviews it | +| High | `ready-for-human` | A human directs the work | + +An agent never moves work from `ready-for-human` to `ready-for-agent` without a human's approval. + +### Starting point + +This rubric is strict by design. Every input must rate low for work to be low risk, ambiguity rounds up, and three inputs rest on judgment. Most work scores medium at first, so a human reviews nearly every agent PR before it lands. + +The project loosens the rubric from evidence. The risk score agreement metric shows where humans approve medium-risk work without changes, and those cases justify relaxing a specific input. + +Reviewers of this RFC are invited to say whether this starting point is right, and which classes of work should land without human review from the start. + ## Leading indicators An assessor scores an issue before any code exists. It reads these signals from the issue alone: From 268a66f5b6ff4f21f134781dd793323ad78a8389 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Tue, 1 Dec 2026 09:10:17 -0800 Subject: [PATCH 10/15] docs(rfc): rescore risk at PR open and rename the metrics catalog Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 15 +++++++-------- .../{metrics-schema.md => metrics-catalog.md} | 2 +- rfc/0026-openshell-factory/reviewer-catalog.md | 2 +- rfc/0026-openshell-factory/risk-scoring-rubric.md | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) rename rfc/0026-openshell-factory/{metrics-schema.md => metrics-catalog.md} (99%) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 1173f98c7a..11e8f8109e 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -50,8 +50,6 @@ The factory turns issues and PRs into acceptable code. Its goals: Humans keep the decisions that matter: whether the project wants the work, how to design it, and whether a risky change lands. A risk score identifies the work that needs them; see [Risk and supervision](#risk-and-supervision). -- **Removing humans from design and acceptance decisions.** The factory routes those decisions to humans faster. - ### Invariants and constraints - Every factory agent runs in an OpenShell sandbox. Any layer above the sandbox handles orchestration only: event intake, scheduling, queueing, and budget. @@ -62,6 +60,7 @@ Humans keep the decisions that matter: whether the project wants the work, how t This RFC explicitly does not intend any of the following: +- **Removing humans from design and acceptance decisions.** The factory routes those decisions to humans faster. - **Agent packaging details.** Directory layout, entrypoint, and image build belong to a follow-on RFC. - **Agent identity.** How an agent authenticates and posts as itself belongs to a follow-on RFC. Agent identity is distinct from sandbox identity because one agent spans many sandboxes. - **Enforced developer workflow.** Developers bring their own tooling and workflow for any work they do, and that work easily enters the factory. @@ -153,15 +152,15 @@ Examples: spec writer, implementer, rebaser, refactorer, CI optimizer. #### Review -Reviewers each judge one concern, cheapest first. The risk tier decides whether a human reviews before merge. On medium-risk work, agents review the PR and the implementer fixes what they find before a human reviews it, so the human sees a change that has already passed every agent gate. +An assessor scores risk again when the PR opens, because a low-risk change can be implemented in a risky way. The PR takes the higher of its own tier and the tier of the work it implements. Reviewers each judge one concern, cheapest first. The PR's risk tier decides whether a human reviews before merge. On medium-risk work, agents review the PR and the implementer fixes what they find before a human reviews it, so the human sees a change that has already passed every agent gate. ```mermaid flowchart LR - pr[PR] --> cheap[deterministic checks] --> focused[single-concern reviewers] --> deep[expensive reviewers] + pr[PR] --> score[risk scored again] --> cheap[deterministic checks] --> focused[single-concern reviewers] --> deep[expensive reviewers] cheap -->|fail| impl[back to Implementation] focused -->|changes needed| impl deep -->|changes needed| impl - deep -->|pass| tier{risk tier} + deep -->|pass| tier{PR risk tier} tier -->|low| merged[acceptable code] tier -->|medium or high| human[human review] --> merged ``` @@ -249,7 +248,7 @@ Three supervision modes match three levels of risk. | Unsupervised implementation, human reviewed | Allowed | Preferred | Not allowed | | Supervised implementation and review | Not needed | Allowed | Required | -An assessor scores risk before Implementation starts and again when a change widens. Inputs to the score: +An assessor scores risk before Implementation starts, again when the PR opens, and again when a change widens. Inputs to the score: - Reversibility. Irreversible changes add risk. - Blast radius, estimated from leading indicators: how likely the change or defect is to affect the target core configuration, and how crippling it is. @@ -340,7 +339,7 @@ Companion documents live in this folder. |---|---| | [Risk scoring rubric](risk-scoring-rubric.md) | Inputs to the score, how they combine, and the thresholds for each risk tier | | [Reviewer catalog](reviewer-catalog.md) | Each reviewer, the one concern it judges, its place in the review order, and its cost | -| [Metrics schema](metrics-schema.md) | Metric names, definitions, dimensions, and the stream that carries each | +| [Metrics catalog](metrics-catalog.md) | Metric names, definitions, dimensions, and the stream that carries each | ## Implementation plan @@ -352,7 +351,7 @@ The project builds the factory incrementally, starting from agents that already 4. **Fill the pipeline.** Add reviewers and implementers one at a time through the lifecycle, lowest-risk work first. Each new automated trigger starts throttled, with human review on every PR it produces. 5. **Scheduled upkeep.** Add the flaky-test finder, refactorer, and CI optimizer once the risk gates are in force. 6. **Orchestration.** Land the agent orchestration RFC and decide who provides the orchestration layer. -7. **Telemetry.** Define the metrics schema and file OpenShell issues for the emission it needs. Start collecting flow metrics for existing agents, and add fleet metrics as OpenShell emits them. +7. **Telemetry.** Define the metrics in the catalog and file OpenShell issues for the emission it needs. Start collecting flow metrics for existing agents, and add fleet metrics as OpenShell emits them. 8. **Widen.** Onboard further repositories, then extensions. ## Risks diff --git a/rfc/0026-openshell-factory/metrics-schema.md b/rfc/0026-openshell-factory/metrics-catalog.md similarity index 99% rename from rfc/0026-openshell-factory/metrics-schema.md rename to rfc/0026-openshell-factory/metrics-catalog.md index 1f5031c1aa..69cfec1bb1 100644 --- a/rfc/0026-openshell-factory/metrics-schema.md +++ b/rfc/0026-openshell-factory/metrics-catalog.md @@ -1,4 +1,4 @@ -# Metrics schema +# Metrics catalog Companion to [RFC 0026](README.md#metrics-and-telemetry). This document is a first draft. diff --git a/rfc/0026-openshell-factory/reviewer-catalog.md b/rfc/0026-openshell-factory/reviewer-catalog.md index cd027dfd96..fac0e97450 100644 --- a/rfc/0026-openshell-factory/reviewer-catalog.md +++ b/rfc/0026-openshell-factory/reviewer-catalog.md @@ -23,4 +23,4 @@ Each reviewer returns pass or changes needed. Changes needed sends the PR back t ## Cost -Each reviewer's cost in time and tokens comes from the fleet metrics in the [metrics schema](metrics-schema.md). Cost decides a reviewer's tier. +Each reviewer's cost in time and tokens comes from the fleet metrics in the [metrics catalog](metrics-catalog.md). Cost decides a reviewer's tier. diff --git a/rfc/0026-openshell-factory/risk-scoring-rubric.md b/rfc/0026-openshell-factory/risk-scoring-rubric.md index 486a3e7f05..0ae6203a2a 100644 --- a/rfc/0026-openshell-factory/risk-scoring-rubric.md +++ b/rfc/0026-openshell-factory/risk-scoring-rubric.md @@ -73,7 +73,7 @@ An assessor scores an issue before any code exists. It reads these signals from An assessor scores a piece of work: - Before Implementation starts. -- When its PR opens. +- When its PR opens. A low-risk change can be implemented in a risky way, so the assessor scores the diff itself. The PR takes the higher of its own tier and the tier of the work it implements. - When the change widens: the PR touches paths outside the ones the last score covered. ## Overrides From 32055d769190d3352d957cf4ef37200c3b99aae6 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Tue, 1 Dec 2026 10:32:24 -0800 Subject: [PATCH 11/15] docs(rfc): lead the factory goals with velocity Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 11e8f8109e..6a38057949 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -43,8 +43,8 @@ Finally, the factory is OpenShell relying on its own primary function of providi The factory turns issues and PRs into acceptable code. Its goals: -1. Protect the project from bad code. -2. Enable high-velocity software and feature development. +1. Enable high-velocity software and feature development. +2. Protect the project from bad code. 3. Don't spend time or tokens on low-value work. 4. Keep the codebase efficient and healthy. From 63a2c1832a2a0ebca18f9d02fbf5e5f610a2aa3f Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Tue, 1 Dec 2026 11:30:18 -0800 Subject: [PATCH 12/15] docs(rfc): address review comments on the factory model Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 62 +++++++++++++++++----------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 6a38057949..75ad62ba28 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -31,7 +31,7 @@ OpenShell needs the leverage of a fully agentic software development lifecycle ( OpenShell is currently built agent-first, but for the most part its agents are driven by humans directly on their own local hardware. This limits the project's velocity to the current interest, time, and focus the humans involved in the project can marshall at any given time as well as the number of parallel development threads they can properly shepherd from start to finish. -Work in OpenShell is also currently reviewed by human contributors using agentic tools. A review typically is requested by on contributor, both in GitHub as well as in Slack, and another contributor will direct agents to review the PR while sometimes also spending time digging into the architectural and implementation choices made. +Work in OpenShell is also currently reviewed by human contributors using agentic tools. A review typically is requested by one contributor, both in GitHub as well as in Slack, and another contributor will direct agents to review the PR while sometimes also spending time digging into the architectural and implementation choices made. Additionally, OpenShell attracts between 150-300 new contributions weekly in the form of both issues and pull requests (PRs). Each of these must be assessed, validated, and a decision of whether to accept or decline the work must be made. This volume has outstripped the maintainer team's ability to clarify and make choices while manually driving a workflow supported by agentic tooling. @@ -65,7 +65,7 @@ This RFC explicitly does not intend any of the following: - **Agent identity.** How an agent authenticates and posts as itself belongs to a follow-on RFC. Agent identity is distinct from sandbox identity because one agent spans many sandboxes. - **Enforced developer workflow.** Developers bring their own tooling and workflow for any work they do, and that work easily enters the factory. - **Telemetry emission in OpenShell.** Emitting per-agent tokens, cost, and run time is OpenShell work, tracked in OpenShell issues. -- **A complete agent catalog.** This RFC names categories and a starting set. +- **A complete agent catalog.** This RFC names categories and lists agents that could staff each stage. - **Replacing GitHub as the system of record for issues, PRs, and reviews.** ### Acceptable code @@ -74,7 +74,7 @@ This RFC explicitly does not intend any of the following: ### Factory model -The factory has three stages: Assessment, Implementation, and Review. Agents suited to each stage staff it. +The factory has three stages: Assessment, Implementation, and Review. Agents suited to each stage staff it. Each stage below lists agents that could staff it. The lists are open: propose additions in review. #### Principles @@ -83,7 +83,7 @@ The factory has three stages: Assessment, Implementation, and Review. Agents sui - **Assess, Implement, and Review progressively.** A change receives expensive attention only after it passes the cheaper gates. - **Shift left.** Deterministic, fast checks move into pre-commit. Adding a check triggers a review of the pre-commit time budget. - **Agents sit on a spectrum.** Some are highly deterministic, almost like a triggered cron job. Others are model-driven with tool use. The factory serves all of them using the same standards and contract. -- **Agents can be triggered by manually, by events, or on a schedule.** A developer may invoke a labeling or merge conflict resolving agent as part of an interactive coding session. Triage and review agents will be triggered by GitHub Actions. A refactoring agent or a flaky test finder may run on a scheduled basis. Their code changes progress through the factory like any others. +- **Agents can be triggered manually, by events, or on a schedule.** A developer may invoke a labeling or merge conflict resolving agent as part of an interactive coding session. Triage and review agents will be triggered by GitHub Actions. A refactoring agent or a flaky test finder may run on a scheduled basis. Their code changes progress through the factory like any others. #### Workflow @@ -92,13 +92,13 @@ Work enters at any stage: - **A new issue** enters at Assessment, where agents assess the value and risk of the proposed item, as well as whether architectural design work or other human intervention is needed. - High risk items require human-supervised design and implementation. - Medium risk items may be implemented unsupervised, but require human review and approval. - - Sufficiently low risk items may be implemented unsupervised. + - Low risk items may be implemented unsupervised. - **A PR** enters at Review. It loops between Implementation and Review, with or without human involvement depending on the level of defect found in review and whether or not it can be rememdied by an agent without significant risk, until it lands. - Any PR judged as medium or high risk requires maintainer approval to land. - **A local coding session** enters at Implementation. A contributor's agent can direct factory agents as subagents in its own session; the resulting PR enters at Review. -- **A schedule** starts an assessor or an implementer. - - A flaky-test finder is an assessor that files issues to fix broken tests it finds - - A refactorer is an implementer that opens PRs with more efficient implementations that keep the same functionality +- **A scheduled agent** starts in that agent's stage of work, and its output progresses from there like any other work in the workflow. + - A flaky-test finder is an assessor that files an issue for each flaky test it finds. The issue is assessed like any other. When it scores low risk it is set `ready-for-agent`, an implementer fixes the test and opens a PR, and the PR enters Review. + - A refactorer is an implementer that opens PRs with more efficient implementations that keep the same functionality. Its PRs enter Review. ```mermaid flowchart LR @@ -129,11 +129,20 @@ flowchart LR accept -->|accept, high risk| rfh[ready-for-human] ``` -Examples: labeler, triage, acceptance classifier, failed-test analyzer, flaky-test finder. +Agents that could staff Assessment: + +- **Labeler.** Applies area and topic labels to issues and PRs. +- **Triage agent.** Checks that a submission is well formed and asks its author for what is missing. +- **Risk assessor.** Scores the risk of an issue or PR against the [risk scoring rubric](risk-scoring-rubric.md). +- **Acceptance classifier.** Weighs value against risk and recommends whether the project accepts the work. +- **Failed-test analyzer.** Works out whether a failed test run points to broken code, a broken test, or a flaky test. +- **Flaky-test finder.** Finds tests that fail intermittently and files an issue for each. +- **Upgrade tester.** Exercises upgrades from released versions to a candidate build and files issues for regressions. +- **Human notifier.** Tells the right person when work becomes `ready-for-human`. #### Implementation -Implementers produce a change and open a PR. Work that needs a design gets a spec first. A human reviews the spec before the build starts or together with the PR; see [Design review](#design-review). +Implementers produce a change and open a PR. Work that needs a design gets a spec first. A spec is a design document that spells out the architectural and implementation choices that guide the build, and it is much lighter than an RFC. A spec lives in the issue its PRs implement and not in the repository, so that agents do not pick up stale guidance from old specs. A human reviews the spec before the build starts or together with the PR; see [Design review](#design-review). ```mermaid flowchart LR @@ -148,7 +157,14 @@ flowchart LR checks -->|yes| pr[open PR] ``` -Examples: spec writer, implementer, rebaser, refactorer, CI optimizer. +Agents that could staff Implementation: + +- **Spec writer.** Writes the spec for work that needs a design. +- **Implementer.** Builds the change and opens a PR. +- **Rebaser.** Resolves conflicts with the base on merge-ready PRs. +- **Refactorer.** Opens PRs that simplify code while keeping the same functionality. +- **Post-merge refactorer.** Simplifies code a recent merge touched while keeping the same functionality. +- **CI optimizer.** Makes CI faster while keeping the same coverage and risk. #### Review @@ -165,7 +181,16 @@ flowchart LR tier -->|medium or high| human[human review] --> merged ``` -Examples: spec, architecture, code, security, compatibility, end-to-end acceptance, and concision reviewers. +Agents that could staff Review. The [reviewer catalog](reviewer-catalog.md) places each in a tier: + +- **Spec reviewer.** Checks that the change does what its spec says, and no more. +- **Code reviewer.** Checks that the change is correct and maintainable. +- **Compatibility reviewer.** Checks that public contracts stay compatible. +- **Concision reviewer.** Checks that docs, comments, and code carry no needless words or unrequested additions. +- **Architecture reviewer.** Checks that the change fits crate boundaries and the existing design. +- **Security reviewer.** Checks that the change keeps sandbox, policy, credential, and crypto boundaries intact. +- **End-to-end acceptance reviewer.** Checks that the change does what the issue asks in a running system. +- **Red team reviewer.** Attacks a change's sandbox and policy boundaries before it merges. The factory steps up its attention to a piece of work at two points. The first is when the work is [accepted](../../CONTRIBUTING.md#accepted-work). The second is when its PR is **merge-ready**: every required review gate has passed, every review comment is addressed, and the intent is to land it. @@ -175,7 +200,7 @@ The rebaser acts only on merge-ready PRs. It resolves conflicts with the base as All work in the factory is either waiting for a human or an agent to drive the next action to move it forward, and it's marked accordingly as either `ready-for-human` or `ready-for-agent`. -The labels are chosen to follow the triage labels in Matt Pocock's skills as they're both popular and unambiguously named. +The labels are chosen to follow the triage labels in [Matt Pocock's skills](https://github.com/mattpocock/skills) as they're both popular and unambiguously named. ### Agents @@ -298,17 +323,6 @@ An agent joins the factory in steps: The same evals decide scope. If a narrower agent scores better per token or per minute, maintainers split the agent. They retire an agent whose cost exceeds its value. -### Candidate agents - -Agents the factory could add beyond the starting set. This list is open: propose additions in review. - -| Agent | Category | Job | -|---|---|---| -| Upgrade tester | Assessor | Exercise upgrades from released versions to a candidate build and file issues for regressions | -| Red team reviewer | Reviewer | Attack a change's sandbox and policy boundaries before it merges | -| Human notifier | Assessor | Tell the right person when work becomes `ready-for-human` | -| Post-merge refactorer | Implementer | Simplify code a recent merge touched while keeping the same functionality | - ### Metrics and telemetry Metrics influence both human behavior and agent choices. From 24ddee4712756a185ef9ee9e92dd9a2bb836d22f Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Tue, 1 Dec 2026 16:29:13 -0800 Subject: [PATCH 13/15] docs(rfc): turn the reviewer catalog into an agent catalog Rename reviewer-catalog.md to agent-catalog.md and list agents for all three stages with job, trigger, output, and status. Split reviewers into one table per tier. Add a Measures column to the metrics catalog. In the README, point to the rubric for risk scoring detail, broaden the sources of factory events, add the agent tuner, sync agent names with the catalog, and say incident in place of accident. Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/README.md | 124 +++++++++--------- rfc/0026-openshell-factory/agent-catalog.md | 82 ++++++++++++ rfc/0026-openshell-factory/metrics-catalog.md | 34 ++--- .../reviewer-catalog.md | 26 ---- .../risk-scoring-rubric.md | 2 +- 5 files changed, 161 insertions(+), 107 deletions(-) create mode 100644 rfc/0026-openshell-factory/agent-catalog.md delete mode 100644 rfc/0026-openshell-factory/reviewer-catalog.md diff --git a/rfc/0026-openshell-factory/README.md b/rfc/0026-openshell-factory/README.md index 75ad62ba28..4047e52658 100644 --- a/rfc/0026-openshell-factory/README.md +++ b/rfc/0026-openshell-factory/README.md @@ -52,7 +52,8 @@ Humans keep the decisions that matter: whether the project wants the work, how t ### Invariants and constraints -- Every factory agent runs in an OpenShell sandbox. Any layer above the sandbox handles orchestration only: event intake, scheduling, queueing, and budget. +- Every factory agent runs in an OpenShell sandbox. +- Any layer above the sandbox handles orchestration only: event intake, scheduling, queueing, and budget. - The project adopts an open source orchestration layer or builds its own. It does not buy one. - The factory serves the project's repositories as a shared service. It is not a single-repository tool. @@ -65,7 +66,7 @@ This RFC explicitly does not intend any of the following: - **Agent identity.** How an agent authenticates and posts as itself belongs to a follow-on RFC. Agent identity is distinct from sandbox identity because one agent spans many sandboxes. - **Enforced developer workflow.** Developers bring their own tooling and workflow for any work they do, and that work easily enters the factory. - **Telemetry emission in OpenShell.** Emitting per-agent tokens, cost, and run time is OpenShell work, tracked in OpenShell issues. -- **A complete agent catalog.** This RFC names categories and lists agents that could staff each stage. +- **A complete agent catalog.** This RFC names categories; the supporting agent catalog document lists potential agents in each stage. The catalog is meant as illustration and is not intended to be exhaustive nor complete. - **Replacing GitHub as the system of record for issues, PRs, and reviews.** ### Acceptable code @@ -74,15 +75,15 @@ This RFC explicitly does not intend any of the following: ### Factory model -The factory has three stages: Assessment, Implementation, and Review. Agents suited to each stage staff it. Each stage below lists agents that could staff it. The lists are open: propose additions in review. +**The factory has three stages: Assessment, Implementation, and Review.** Agents suited to each stage staff it; examples of agents in each stage are listed below, as well as in the [agent catalog supporting document](agent-catalog.md). #### Principles -- **Decompose into focused agents.** Each agent has one job. We use evals to decide the appropriate boundaries for each agent, judged by quality of work, time taken, and tokens consumed. +- **Decompose factory work into focused agents.** Each agent has one job. We use evals to decide the appropriate boundaries for each agent, judged by quality of work, time taken, and tokens consumed. - **A run never waits for a human.** An agent that needs a decision records what it needs, sets `ready-for-human`, and ends. - **Assess, Implement, and Review progressively.** A change receives expensive attention only after it passes the cheaper gates. -- **Shift left.** Deterministic, fast checks move into pre-commit. Adding a check triggers a review of the pre-commit time budget. -- **Agents sit on a spectrum.** Some are highly deterministic, almost like a triggered cron job. Others are model-driven with tool use. The factory serves all of them using the same standards and contract. +- **Shift left.** Seek to provide actionable feedback quickly and as early in the process as possible. Deterministic, fast checks move into pre-commit hooks. Some less expensive agents may run locally during supervised implementation work. +- **Agents cover a spectrum from deterministic to not.** Some are highly deterministic, almost like a triggered cron job. Others are model-driven with tool use. The factory serves all of them using the same standards and contract. - **Agents can be triggered manually, by events, or on a schedule.** A developer may invoke a labeling or merge conflict resolving agent as part of an interactive coding session. Triage and review agents will be triggered by GitHub Actions. A refactoring agent or a flaky test finder may run on a scheduled basis. Their code changes progress through the factory like any others. #### Workflow @@ -96,9 +97,9 @@ Work enters at any stage: - **A PR** enters at Review. It loops between Implementation and Review, with or without human involvement depending on the level of defect found in review and whether or not it can be rememdied by an agent without significant risk, until it lands. - Any PR judged as medium or high risk requires maintainer approval to land. - **A local coding session** enters at Implementation. A contributor's agent can direct factory agents as subagents in its own session; the resulting PR enters at Review. -- **A scheduled agent** starts in that agent's stage of work, and its output progresses from there like any other work in the workflow. - - A flaky-test finder is an assessor that files an issue for each flaky test it finds. The issue is assessed like any other. When it scores low risk it is set `ready-for-agent`, an implementer fixes the test and opens a PR, and the PR enters Review. - - A refactorer is an implementer that opens PRs with more efficient implementations that keep the same functionality. Its PRs enter Review. +- **A scheduled agent** starts in that agent's stage of work, and its output progresses from there like any other work in the factory. + - A flaky-test finder is an assessor that files an issue for each flaky test it finds. The issue is then triaged like any other. If it's low risk, it's labeled `ready-for-agent`, an implementer fixes the test and opens a PR, and the PR enters Review. + - A refactorer is an implementer that opens PRs with more efficient implementations with the same functionality. Its PRs enter Review like any other proposed code changes. ```mermaid flowchart LR @@ -129,20 +130,20 @@ flowchart LR accept -->|accept, high risk| rfh[ready-for-human] ``` -Agents that could staff Assessment: +Potential Assessment agents: - **Labeler.** Applies area and topic labels to issues and PRs. -- **Triage agent.** Checks that a submission is well formed and asks its author for what is missing. +- **Triage agent.** Checks that a submission is well formed and asks its author for anything that's missing. - **Risk assessor.** Scores the risk of an issue or PR against the [risk scoring rubric](risk-scoring-rubric.md). - **Acceptance classifier.** Weighs value against risk and recommends whether the project accepts the work. - **Failed-test analyzer.** Works out whether a failed test run points to broken code, a broken test, or a flaky test. - **Flaky-test finder.** Finds tests that fail intermittently and files an issue for each. -- **Upgrade tester.** Exercises upgrades from released versions to a candidate build and files issues for regressions. -- **Human notifier.** Tells the right person when work becomes `ready-for-human`. +- **Install/Upgrade tester.** Exercises fresh installs and upgrades from released versions to a candidate build and files issues for regressions. +- **Notifier.** Tells the right person when work becomes `ready-for-human`. #### Implementation -Implementers produce a change and open a PR. Work that needs a design gets a spec first. A spec is a design document that spells out the architectural and implementation choices that guide the build, and it is much lighter than an RFC. A spec lives in the issue its PRs implement and not in the repository, so that agents do not pick up stale guidance from old specs. A human reviews the spec before the build starts or together with the PR; see [Design review](#design-review). +Implementers produce a change and open a PR. Work that needs a design gets a spec first that spells out the architectural and implementation choices that guide the build. A human reviews the spec before the build starts or together with the PR; see [Design review](#design-review). ```mermaid flowchart LR @@ -157,22 +158,24 @@ flowchart LR checks -->|yes| pr[open PR] ``` -Agents that could staff Implementation: +Potential Implementation agents: - **Spec writer.** Writes the spec for work that needs a design. -- **Implementer.** Builds the change and opens a PR. -- **Rebaser.** Resolves conflicts with the base on merge-ready PRs. +- **Coder.** Builds the change and opens a PR. +- **Merge Conflict Resolver.** Resolves conflicts with the base on merge-ready PRs. - **Refactorer.** Opens PRs that simplify code while keeping the same functionality. -- **Post-merge refactorer.** Simplifies code a recent merge touched while keeping the same functionality. -- **CI optimizer.** Makes CI faster while keeping the same coverage and risk. +- **CI optimizer.** Finds the fastest CI that provides the same protection. +- **Agent tuner.** Tunes a factory agent's model, effort, and prompts against its evals and metrics. Bespoke agents benefit most, though it can tune any configurable agent. #### Review -An assessor scores risk again when the PR opens, because a low-risk change can be implemented in a risky way. The PR takes the higher of its own tier and the tier of the work it implements. Reviewers each judge one concern, cheapest first. The PR's risk tier decides whether a human reviews before merge. On medium-risk work, agents review the PR and the implementer fixes what they find before a human reviews it, so the human sees a change that has already passed every agent gate. +Reviewers each judge one concern, cheapest first. The PR's risk tier decides whether a human reviews before merge. On medium-risk work, agents review the PR and the implementer fixes what they find before a human reviews it, so the human sees a change that has already passed every agent gate. + +An assessor scores the PR's risk at the beginning of each pass through Review to be sure that the PR's implementation matches its projected risk, or the measured risk of its previous implementation. ```mermaid flowchart LR - pr[PR] --> score[risk scored again] --> cheap[deterministic checks] --> focused[single-concern reviewers] --> deep[expensive reviewers] + pr[PR] --> score[PR risk scored] --> cheap[deterministic checks] --> focused[single-concern reviewers] --> deep[expensive reviewers] cheap -->|fail| impl[back to Implementation] focused -->|changes needed| impl deep -->|changes needed| impl @@ -181,7 +184,7 @@ flowchart LR tier -->|medium or high| human[human review] --> merged ``` -Agents that could staff Review. The [reviewer catalog](reviewer-catalog.md) places each in a tier: +Potential Review agents: - **Spec reviewer.** Checks that the change does what its spec says, and no more. - **Code reviewer.** Checks that the change is correct and maintainable. @@ -192,9 +195,9 @@ Agents that could staff Review. The [reviewer catalog](reviewer-catalog.md) plac - **End-to-end acceptance reviewer.** Checks that the change does what the issue asks in a running system. - **Red team reviewer.** Attacks a change's sandbox and policy boundaries before it merges. -The factory steps up its attention to a piece of work at two points. The first is when the work is [accepted](../../CONTRIBUTING.md#accepted-work). The second is when its PR is **merge-ready**: every required review gate has passed, every review comment is addressed, and the intent is to land it. +The factory steps up its attention to a piece of work at two points. The first is when the work is [accepted](../../CONTRIBUTING.md#accepted-work). The second is when its PR is **merge-ready**: every required review gate has passed, every review comment is addressed, and the intent is to land it. The [agent catalog's Review agents section](agent-catalog.md#review-agents) places each in a tier. -The rebaser acts only on merge-ready PRs. It resolves conflicts with the base as soon as they block landing. Before a PR is merge-ready, conflicts belong to whoever is implementing the change. +As an example, the Merge Conflict Resolver acts only on merge-ready PRs. It resolves conflicts with the base as soon as they block landing. Before a PR is merge-ready, conflicts belong to whoever is implementing the change. #### Division of labor @@ -204,6 +207,10 @@ The labels are chosen to follow the triage labels in [Matt Pocock's skills](http ### Agents +We expect to use open source, commercial, and bespoke agents in the factory. + +These agents are spelled out more completely in the [agent catalog](agent-catalog.md). + #### Agent contract Every agent declares: @@ -211,7 +218,7 @@ Every agent declares: | Element | Meaning | |---|---| | Purpose | The one job it does | -| Trigger | GitHub event, another agent, schedule, or manual invocation | +| Trigger | GitHub event, another agent, schedule, and/or manual invocation | | Preconditions | What must hold before it does any work | | End conditions and limits | When it stops, including iteration caps | | Outputs | A defined result, plus provenance metadata on anything it writes | @@ -241,23 +248,38 @@ The [labeler agent](../../.agents/agents/labeler/) is a good reference for this. #### Agent packaging -Gator is the reference for packaging: an `agent.yaml` manifest, a sandbox image, a sandbox policy, declared providers, and a payload baked into the image. The packaging RFC will generalize that shape and define how it expresses the contract above. +Agents are packaged with what's needed to run them in a factory sandbox: an `agent.yaml` manifest, a sandbox image, a sandbox policy, declared providers, and a payload baked into the image. An agent declares the harness or harnesses it runs on. No agent is required to run on several, nor prohibited from it. + +The packaging RFC will generalize that shape and define how it expresses the contract above. Gator is an excellent example and is used as the reference for agent packaging. + +#### Agent lifecycle and evals + +An agent joins the factory in steps: + +1. Build a skill. +2. Wrap it as an invocable agent that meets the contract. +3. Tune and test it with direct manual invocation. +4. Build evals that judge its output. +5. Tune model, effort, and prompts against the evals. +6. Measure its value against its cost for as long as it runs. + +The same evals decide scope. If a narrower agent scores better per token or per minute, maintainers split the agent. They retire an agent whose cost exceeds its value. -An agent declares the harness or harnesses it runs on. No agent is required to run on several, and none is prohibited from it. +Agents return a defined result, and measurements move to OpenShell's own observability streams wherever possible. OpenShell does not emit per-agent token, cost, and run-time metrics today. That emission work is out of scope for this RFC; instead, it should be tracked in OpenShell issues. -### Triggering and orchestration +### Factory orchestration and triggering -Repositories send events to the factory, and agents react to them. This layer does more than GitHub Actions does today: it takes in issue, PR, and comment events, runs schedules, hands work from agent to agent, queues it, and applies budget and priority before spending agent time. +Events reach the factory from repositories, people, schedules, and other agents, and agents react to them. Other sources, such as CI, release pipelines, and security feeds, plug in the same way. This layer does more than GitHub Actions does today: it takes in issue, PR, and comment events, runs schedules, hands work from agent to agent, queues it, and applies budget and priority before spending agent time. The agent orchestration RFC will decide who provides this layer. It will evaluate each option against these criteria: GitHub issue, PR, and comment event intake; an access model that works with outside contributors; budget and queueing controls; iteration caps; and approval gates. GitHub Actions remains one of the factory's triggers whatever that RFC decides. The contract above keeps agents portable across triggers. ### Supporting components -Below the orchestration layer, the factory incorporates open source agent components where it needs them, and chooses another option only where it is superior. Where a component falls short, the project records the gap and raises it with the owning project. +Below the orchestration layer, the factory incorporates open source agent components where it needs them, and chooses another option only where it is superior. While there's some intention to make it possible to configure the factory to use different components at each layer, this is a loosely held philosophy and not a requirement. | Layer | Possible Components | Status | |---|---|---| -| Sandbox | OpenShell | Fixed by this RFC | +| Sandbox | OpenShell | Defined by this RFC | | Harness abstraction | Agent Client Protocol (ACP), NeMo Fabric, or a thin adapter over each harness's headless CLI | To evaluate | | Telemetry | OpenShell OTel and OCSF streams, with NeMo Relay, Langfuse, or Arize Phoenix for harness sessions | To evaluate | | Evals | NeMo Helix, Inspect AI, or promptfoo | To evaluate | @@ -273,33 +295,24 @@ Three supervision modes match three levels of risk. | Unsupervised implementation, human reviewed | Allowed | Preferred | Not allowed | | Supervised implementation and review | Not needed | Allowed | Required | -An assessor scores risk before Implementation starts, again when the PR opens, and again when a change widens. Inputs to the score: +A risk assessor scores each issue and PR as low, medium, or high risk. The [risk scoring rubric](risk-scoring-rubric.md) defines the inputs to the score, how they combine, and when work is scored. Scoring sets a `risk:*` label. Work in the two unsupervised lanes is `ready-for-agent`. Work that needs pairing is `ready-for-human`, and the contributor who picks it up directs agents, factory or otherwise, from a local session. -- Reversibility. Irreversible changes add risk. -- Blast radius, estimated from leading indicators: how likely the change or defect is to affect the target core configuration, and how crippling it is. -- Complexity and dependencies. -- Expanding range of affected functionality. A change that widens triggers deeper review. +Decomposition as a way to reduce risk is encouraged. Splitting a high-risk work item into low and medium risk items increases velocity by allowing more unsupervised agentic work. The decision to split a work item requires human review. The agent recommends a split and shows how it scores the risk of each item. Once a human approves, the agent makes the split and labels each item by its risk. Each item resulting from a split is a full vertical slice that stands on its own; a split never ships the docs in one item and the code they describe in another. -The score sets the label. Work in the two unsupervised lanes is `ready-for-agent`. Work that needs pairing is `ready-for-human`, and the contributor who picks it up directs agents, factory or otherwise, from a local session. - -Decomposition as a way to reduce risk is encouraged. Splitting a high-risk work item into low and medium risk items increases velocity by allowing more unsupervised agentic work. - -The decision to split a work item requires human review. The agent recommends a split and shows how it scores the risk of each item. Once a human approves, the agent makes the split and labels each item by its risk. Each resulting item is a full vertical slice that stands on its own. A split never ships the docs in one item and the code they describe in another. - -The same pattern holds for every label change. An agent sets `ready-for-agent` only on work that scores low or medium risk, and work that shows any sign of more risk is scored at the next level up. An agent never moves work from `ready-for-human` to `ready-for-agent` without a human's approval. +The same pattern holds for every label change. An agent sets `ready-for-agent` only on work that scores low or medium risk, and work that shows any sign of more risk is scored at the next level up. An agent never moves work from `ready-for-human` to `ready-for-agent` without a human's approval. An agent never picks up `risk:high` items unsupervised. #### Design review -Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec other than the issue description. High-risk work is handled by a human paired with an agent, so a human directly shapes the design and implementation directly. +Work that needs a design is at least medium risk. Low-risk work needs no design, so the unsupervised lane has no spec other than the issue description. High-risk work is handled by a human paired with an agent, so a human shapes the design and implementation directly. -A human reviews every design spec. When the work item is medium risk, the spec may be reviewed together with the implementation in the PR when any of these are true: +A human reviews every design spec. When the work item is medium risk, factory agents may write the spec and immediately implement it when any of these are true: - **The build is cheap.** Implementing and re-implementing costs little time and few tokens, so a rejected design wastes little. - **A human already made the design decision.** The spec implements an accepted RFC, a maintainer-written design in the issue, or one piece of a parent spec a human approved. - **The design follows an established pattern.** For example, another provider or driver built on an existing template. - **The design is internal and reversible.** It changes no public contract or security boundary, and a revert undoes it. -Human spec review gates implementation when any of these hold: +Human spec review is required before implementation when any of these hold: - **The work is high risk.** - **The design changes a public contract or a security boundary:** proto, CLI, config, policy schema, crypto, or sandbox policy. @@ -310,19 +323,6 @@ Human spec review gates implementation when any of these hold: A spec that fits neither list gets human review before implementation. -### Agent lifecycle and evals - -An agent joins the factory in steps: - -1. Build a skill. -2. Wrap it as an invocable agent that meets the contract. -3. Tune and test it with direct invocation. -4. Build evals that judge its output. -5. Tune model, effort, and prompts against the evals. -6. Measure its value against its cost for as long as it runs. - -The same evals decide scope. If a narrower agent scores better per token or per minute, maintainers split the agent. They retire an agent whose cost exceeds its value. - ### Metrics and telemetry Metrics influence both human behavior and agent choices. @@ -337,14 +337,12 @@ Metrics influence both human behavior and agent choices. | Check duration | Flow | Median and 95th percentile time of pre-commit and of required CI checks | | Safe change rate | Safety | Merged changes per week that are not later reverted, by risk tier | | Reverts and escaped defects | Safety | Merged changes later reverted, and bugs traced to a merged change, by risk tier and supervision mode | -| Days since the last accident | Safety | Time since a merged change last caused harm | +| Days since the last incident | Safety | Time since a merged change last caused harm | | Risk score agreement | Safety | How often a maintainer overrides the assessor's risk score, and in which direction | | Run volume | Fleet | Runs per agent, with skip rate and the rate of runs that reach an iteration cap | | Run cost | Fleet | Run time, tokens, and cost per run, by agent, harness, and model | | Output acceptance | Fleet | Share of an agent's output that stands without human correction: PRs merged unedited, findings acted on, labels left in place | -Agents return a defined result, and measurements move to OpenShell's own observability streams wherever possible. OpenShell does not emit per-agent token, cost, and run-time metrics today. That emission work is out of scope for this RFC; instead, it should be tracked in OpenShell issues. - ### Companion documents Companion documents live in this folder. @@ -352,7 +350,7 @@ Companion documents live in this folder. | Companion document | Scope | |---|---| | [Risk scoring rubric](risk-scoring-rubric.md) | Inputs to the score, how they combine, and the thresholds for each risk tier | -| [Reviewer catalog](reviewer-catalog.md) | Each reviewer, the one concern it judges, its place in the review order, and its cost | +| [Agent catalog](agent-catalog.md) | Each agent by stage: its job, trigger, output, and whether it runs today. For reviewers, the concern each judges, its tier, and its cost | | [Metrics catalog](metrics-catalog.md) | Metric names, definitions, dimensions, and the stream that carries each | ## Implementation plan diff --git a/rfc/0026-openshell-factory/agent-catalog.md b/rfc/0026-openshell-factory/agent-catalog.md new file mode 100644 index 0000000000..19159ba267 --- /dev/null +++ b/rfc/0026-openshell-factory/agent-catalog.md @@ -0,0 +1,82 @@ +# Agent catalog + +Companion to [RFC 0026 Factory Model](README.md#factory-model). + +The catalog lists the agents that could staff each stage of the factory, and what each one does in the terms of the [agent contract](README.md#agent-contract). The catalog is open. To suggest an agent, or a change to one listed here, comment on the row or the section it belongs in. + +Each entry gives: + +- **Job:** the one thing the agent does. +- **Trigger:** what starts it. +- **Output:** what it leaves behind. +- **Status:** whether an agent does this job today. + +Every trigger and output below is a proposal. An agent marked as running today has not yet been checked against the contract; the RFC's implementation plan starts with that inventory. + +## Assessment agents + +Assessors decide whether work is well formed, how risky it is, and whether the project wants it. + +| Agent | Job | Trigger | Output | Status | +|---|---|---|---|---| +| Labeler | Apply area and topic labels to issues and PRs | An issue or PR opens or changes | Labels on GitHub issues and PRs | Runs today as the [labeler agent](../../.agents/agents/labeler/) | +| Triage agent | Check that a submission is well formed and ask its author for what is missing | An issue or PR opens, or its author responds | A comment naming what is missing, or a pass to risk scoring | Runs today in part as the Issue Triage Gate | +| Risk assessor | Score the risk of an issue or PR against the [risk scoring rubric](risk-scoring-rubric.md) | Triage passes, a PR opens, or a change widens | A risk tier with the rating for each input | Proposed | +| Acceptance classifier | Weigh value against risk and recommend whether the project accepts the work | A risk score is recorded | An accept or decline recommendation with reasons, and a routing label on accepted work | Proposed | +| Failed-test analyzer | Work out whether a failed test run points to broken code, a broken test, or a flaky test | A required check fails | A finding on the PR, and an issue for a broken or flaky test | Proposed | +| Flaky-test finder | Find tests that fail intermittently | Scheduled run | An issue for each flaky test | Proposed | +| Install/Upgrade tester | Exercise fresh installs and upgrades from released versions to a candidate build | Scheduled run, or a release candidate is cut | An issue for each regression | Proposed | +| Notifier | Tell the right person when work needs them | Work becomes `ready-for-human` | A notification to the person or group that owns the decision | Proposed | + +## Implementation agents + +Implementers produce a change and open a PR. + +| Agent | Job | Trigger | Output | Status | +|---|---|---|---|---| +| Spec writer | Write the spec for work that needs a design | Accepted work that needs a design becomes `ready-for-agent` | A spec in the issue, with any open questions recorded | Proposed | +| Coder | Build the change | Work becomes `ready-for-agent`, with its spec approved where one is required, or a reviewer returns changes needed | A PR, or `ready-for-human` when the iteration cap is reached | Proposed | +| Merge Conflict Resolver | Resolve conflicts with the base | A merge-ready PR conflicts with its base | An updated branch | Proposed | +| Refactorer | Simplify code while keeping the same functionality | Scheduled run | A PR | Proposed | +| CI optimizer | Find the fastest CI that provides the same protection | Scheduled run, or a change to a CI workflow | A PR | Proposed | +| Agent tuner | Tune a factory agent's model, effort, and prompts against its evals and metrics. Bespoke agents benefit most, though it can tune any configurable agent | Scheduled run, or an agent's eval scores or cost drift | A PR that changes the agent's configuration, with eval results before and after | Proposed | + +## Review agents + +Reviewers each judge one concern. They run in three tiers, cheapest first, and a change reaches a tier only after it passes the one before. + +### Tier 1: Deterministic checks + +Scripts and tools that give the same answer every time. They run first because they are fast and cost no tokens, so no model reviews a change that fails them. + +| Agent | Job | Trigger | Output | Status | +|---|---|---|---|---| +| Format, lint, and tests | Check that the change builds, passes its tests, and meets style rules | A PR opens or changes | Pass or fail on the PR | Runs today in pre-commit and CI | +| Commit checks | Check that commits are signed, signed off, and follow Conventional Commits | A PR opens or changes | Pass or fail on the PR | To be confirmed in the inventory | +| Issue acceptance | Check that the PR is accepted work | A PR opens or changes, or its linked issue changes | Pass or fail on the PR; acceptance label | Runs today as the PR Issue Acceptance check | + +### Tier 2: Single-concern reviewers + +Model-driven reviewers that read the diff and judge one concern each. They run second because each is cheap, and together they catch most problems before the costly reviews start. + +| Agent | Job | Trigger | Output | Status | +|---|---|---|---|---| +| Spec reviewer | Check that the change does what its spec says, and no more | Tier 1 passes | Pass, or findings on the PR | Proposed | +| Code reviewer | Check that the change is correct and maintainable | Tier 1 passes | Pass, or findings on the PR | Runs today in part as Gator, using the [principal engineer reviewer](../../.agents/agents/principal-engineer-reviewer/) prompt | +| Compatibility reviewer | Check that public contracts stay compatible | Tier 1 passes | Pass, or findings on the PR | Runs today as the Codex Compatibility Review | +| Concision reviewer | Check that docs, comments, and code carry no needless words or unrequested additions | Tier 1 passes | Pass, or findings on the PR | Proposed | + +### Tier 3: Holistic reviewers + +Model-driven reviewers that need the wider codebase or a running system. They run last because each costs the most time and tokens, so they see only changes that have passed everything else. + +| Agent | Job | Trigger | Output | Status | +|---|---|---|---|---| +| Architecture reviewer | Check that the change fits crate boundaries and the existing design | Tier 2 passes | Pass, or findings on the PR | Proposed | +| Security reviewer | Check that the change keeps sandbox, policy, credential, and crypto boundaries intact | Tier 2 passes | Pass, or findings on the PR | Runs today as the Codex Security Review | +| End-to-end acceptance reviewer | Check that the change does what the issue asks in a running system | Tier 2 passes | Pass, or findings on the PR | Proposed | +| Red team reviewer | Check that the change's sandbox and policy boundaries hold under attack | Tier 2 passes, or scheduled run | Pass, or findings on the PR | Proposed | + +### Results + +Failed checks and review findings from a Review tier sends the PR back to Implementation to address those findings. When all findings on a PR have been addressed (either by changes or in comments on the PR), review starts again at tier 1. diff --git a/rfc/0026-openshell-factory/metrics-catalog.md b/rfc/0026-openshell-factory/metrics-catalog.md index 69cfec1bb1..6530746a8c 100644 --- a/rfc/0026-openshell-factory/metrics-catalog.md +++ b/rfc/0026-openshell-factory/metrics-catalog.md @@ -1,25 +1,25 @@ # Metrics catalog -Companion to [RFC 0026](README.md#metrics-and-telemetry). This document is a first draft. +Companion to [RFC 0026 Metrics and Telemetry](README.md#metrics-and-telemetry). -| Metric | Unit | Dimensions | Source | Available today | -|---|---|---|---|---| -| Time to disposition | Duration | Repository, issue or PR | GitHub events | Yes | -| Time to first review | Duration | Repository, reviewer kind | GitHub events | Yes | -| Time to merge | Duration | Repository, risk tier | GitHub events | Yes, without risk tier | -| Time to human response | Duration | Repository, stage | GitHub label events | No. Needs the routing labels | -| Work in flight | Count | Stage, routing label | GitHub labels | No. Needs the routing labels | -| Check duration | Duration, median and 95th percentile | Check name | GitHub Actions for CI, local reporting for pre-commit | CI only | -| Safe change rate | Changes per week | Risk tier | GitHub events | Yes, without risk tier | -| Reverts and escaped defects | Count | Risk tier, supervision mode | GitHub events, plus a link from a bug to the change that caused it | Reverts only | -| Days since the last accident | Days | Repository | An accident record | No. Needs a definition of an accident | -| Risk score agreement | Share of scores overridden | Direction of the override | Risk assessor results and maintainer overrides | No. Needs the risk assessor | -| Run volume | Count | Agent, result, skipped, cap reached | Agent results | Partly, from workflow runs | -| Run cost | Duration, tokens, cost | Agent, harness, model | OpenShell observability streams | No. Needs OpenShell emission | -| Output acceptance | Share of output unchanged | Agent, output kind | GitHub events | Partly | +| Metric | Measures | Unit | Dimensions | Source | Available today | +|---|---|---|---|---|---| +| Time to disposition | How long it takes to accept or decline an issue or PR after it opens | Duration | Repository, issue or PR | GitHub events | Yes | +| Time to first review | How long a PR waits for its first review, by an agent or a human | Duration | Repository, reviewer kind | GitHub events | Yes | +| Time to merge | How long a PR takes from opening to merge | Duration | Repository, risk tier | GitHub events | Yes, without risk tier | +| Time to human response | How long work waits at `ready-for-human` before the human acts | Duration | Repository, stage | GitHub label events | No. Needs the routing labels | +| Work in flight | How many items are open at each stage, and who advances them | Count | Stage, routing label | GitHub labels | No. Needs the routing labels | +| Check duration | How long pre-commit and the required CI checks take | Duration, median and 95th percentile | Check name | GitHub Actions for CI, local reporting for pre-commit | CI only | +| Safe change rate | How many changes merge each week and are not later reverted | Changes per week | Risk tier | GitHub events | Yes, without risk tier | +| Reverts and escaped defects | How many merged changes are later reverted, and how many bugs trace to a merged change | Count | Risk tier, supervision mode | GitHub events, plus a link from a bug to the change that caused it | Reverts only | +| Days since the last incident | How long since a merged change last caused harm | Days | Repository | An incident record | No. Needs a definition of an incident | +| Risk score agreement | How often a maintainer overrides the assessor's risk score, and in which direction | Share of scores overridden | Direction of the override | Risk assessor results and maintainer overrides | No. Needs the risk assessor | +| Run volume | How often each agent runs, skips, or reaches an iteration cap | Count | Agent, result, skipped, cap reached | Agent results | Partly, from workflow runs | +| Run cost | How much time, how many tokens, and how much money each run takes | Duration, tokens, cost | Agent, harness, model | OpenShell observability streams | No. Needs OpenShell emission | +| Output acceptance | How much of an agent's output stands without human correction: PRs merged unedited, findings acted on, labels left in place | Share of output unchanged | Agent, output kind | GitHub events | Partly | ## Open definitions -- What counts as an accident. Working definition: a merged change causes harm that reaches users, or blocks the main branch or a release pipeline until it is reverted or fixed. A revert during a period the project declares in advance as unstable, such as a repository migration, is not an accident. Still open: who declares such a period, and who records an accident. +- What counts as an incident. Working definition: a merged change causes harm that reaches users, or blocks the main branch or a release pipeline until it is reverted or fixed. A revert during a period the project declares in advance as unstable, such as a repository migration, is not an incident. Still open: who declares such a period, and who records an incident. - How a bug links to the change that caused it. - The fields of an agent's result. diff --git a/rfc/0026-openshell-factory/reviewer-catalog.md b/rfc/0026-openshell-factory/reviewer-catalog.md deleted file mode 100644 index fac0e97450..0000000000 --- a/rfc/0026-openshell-factory/reviewer-catalog.md +++ /dev/null @@ -1,26 +0,0 @@ -# Reviewer catalog - -Companion to [RFC 0026](README.md#review). This document is a first draft. - -Reviewers run in three tiers, cheapest first. A change reaches a tier only after it passes the one before. - -| Tier | Reviewer | Concern | Kind | -|---|---|---|---| -| 1. Deterministic checks | Format, lint, and tests | The change builds, passes its tests, and meets style rules | Deterministic | -| 1. Deterministic checks | Commit checks | Commits are signed, signed off, and follow Conventional Commits | Deterministic | -| 1. Deterministic checks | Issue acceptance | The PR links accepted work | Deterministic | -| 2. Single-concern reviewers | Spec | The change does what its spec says, and no more | Model-driven | -| 2. Single-concern reviewers | Code | The change is correct and maintainable | Model-driven | -| 2. Single-concern reviewers | Compatibility | Public contracts stay compatible | Model-driven | -| 2. Single-concern reviewers | Concision | Docs, comments, and code carry no needless words or unrequested additions | Model-driven | -| 3. Expensive reviewers | Architecture | The change fits crate boundaries and the existing design | Model-driven | -| 3. Expensive reviewers | Security | The change keeps sandbox, policy, credential, and crypto boundaries intact | Model-driven | -| 3. Expensive reviewers | End-to-end acceptance | The change does what the issue asks in a running system | Model-driven | - -## Results - -Each reviewer returns pass or changes needed. Changes needed sends the PR back to Implementation with the reviewer's findings. - -## Cost - -Each reviewer's cost in time and tokens comes from the fleet metrics in the [metrics catalog](metrics-catalog.md). Cost decides a reviewer's tier. diff --git a/rfc/0026-openshell-factory/risk-scoring-rubric.md b/rfc/0026-openshell-factory/risk-scoring-rubric.md index 0ae6203a2a..843813c08b 100644 --- a/rfc/0026-openshell-factory/risk-scoring-rubric.md +++ b/rfc/0026-openshell-factory/risk-scoring-rubric.md @@ -1,6 +1,6 @@ # Risk scoring rubric -Companion to [RFC 0026](README.md#risk-and-supervision). This document is a first draft. +Companion to [RFC 0026](README.md#risk-and-supervision). ## Inputs From 8684ba86fc43348f3c6edb71b577be03fb7ba907 Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Tue, 1 Dec 2026 17:23:57 -0800 Subject: [PATCH 14/15] docs(rfc): rate size of change in the risk rubric Replace the Complexity input with Size of change, rated on a PR from lines added and files touched. Rename Dependents to Coupling. Score risk at the start of each pass through Review, with the latest score replacing the one before. Signed-off-by: Jim Meyer --- .../risk-scoring-rubric.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/rfc/0026-openshell-factory/risk-scoring-rubric.md b/rfc/0026-openshell-factory/risk-scoring-rubric.md index 843813c08b..a43048bdc1 100644 --- a/rfc/0026-openshell-factory/risk-scoring-rubric.md +++ b/rfc/0026-openshell-factory/risk-scoring-rubric.md @@ -10,8 +10,8 @@ An assessor rates each input as low, medium, or high. |---|---|---|---| | Reversibility | A revert undoes the change | A revert needs a follow-up step, such as a config or cache change | Irreversible: a data migration, a published release, or a protocol change | | Criticality of impact | An operator sees wrong or missing information, or a build step breaks visibly | A sandbox or gateway cannot start, stop, or stay connected, or works unreliably. PRs or releases are blocked | Enforcement or isolation fails | -| Complexity | The touched functions are simple and the change adds little | The touched functions branch heavily, or the change adds substantial logic | The change adds new architecture or rewrites complex code | -| Dependents | Little other code depends on the touched code | Several crates or many callers depend on it | Most of the workspace depends on it | +| Size of change | Up to 200 lines added and up to 10 files touched | More than that, up to 1,000 lines added and 30 files touched | More than 1,000 lines added, or more than 30 files touched | +| Coupling | Little other code depends on the touched code | Several crates or many callers depend on it | Most of the workspace depends on it | | Widening | The change stays inside the scope the issue states | The change touches adjacent functionality | The change expands the range of affected functionality | | Contracts and boundaries | No public contract, security boundary, or dependency changes | An additive change to a public contract, or a dependency update | A breaking change to a public contract, any change to a security boundary, or a new dependency | | Testing | Reliable tests exercise the changed code | Tests exercise part of the changed code, or some of them are flaky or skipped | No tests exercise the changed code | @@ -20,7 +20,9 @@ Public contracts are proto, CLI, config, and policy schema. Security boundaries The testing input rates how much of the changed code the tests exercise and how reliable those tests are. The project measures neither test coverage nor test reliability today, so the assessor judges both from the change and the test history. -Complexity rates the code being changed, by the cyclomatic complexity of the touched functions and by how much the change adds. Dependents rates how much other code relies on the touched code, counted as dependent crates and callers. The project measures neither today. `cargo metadata` gives dependent crates, and the assessor judges the rest. +Size of change counts the lines added and the files touched, leaving out tests, lockfiles, and generated files. A script computes both from the diff. A change rates low only when both counts are within the low limit. Size is rated on a PR only: an issue has no size, so this input never raises an issue's tier. The thresholds are a starting point taken from the sizes of changes merged to main, where about half fall within the low limit and about one in five exceeds the high one. + +Coupling rates how much other code relies on the touched code, counted as dependent crates and callers. The project does not measure it today. `cargo metadata` gives dependent crates, and the assessor judges the rest. ### Criticality of impact @@ -52,7 +54,7 @@ An agent never moves work from `ready-for-human` to `ready-for-agent` without a ### Starting point -This rubric is strict by design. Every input must rate low for work to be low risk, ambiguity rounds up, and three inputs rest on judgment. Most work scores medium at first, so a human reviews nearly every agent PR before it lands. +This rubric is strict by design. Every input must rate low for work to be low risk, ambiguity rounds up, and two inputs, coupling and testing, rest on judgment. Most work scores medium at first, so a human reviews nearly every agent PR before it lands. The project loosens the rubric from evidence. The risk score agreement metric shows where humans approve medium-risk work without changes, and those cases justify relaxing a specific input. @@ -68,13 +70,14 @@ An assessor scores an issue before any code exists. It reads these signals from - Words that signal irreversibility, such as migration, breaking, or removal. - Whether the issue asks for new behavior or a change to existing behavior. -## Scoring again +## Re-scoring An assessor scores a piece of work: -- Before Implementation starts. -- When its PR opens. A low-risk change can be implemented in a risky way, so the assessor scores the diff itself. The PR takes the higher of its own tier and the tier of the work it implements. -- When the change widens: the PR touches paths outside the ones the last score covered. +- Before Implementation starts. This score comes from the issue and projects the risk of the work. +- At the start of each pass through Review. The assessor scores the diff itself, because a low-risk change can be implemented in a risky way and a fix made during review can change the risk. + +Each Review score replaces the one from the pass before, so a PR that widens rates higher and a PR that shrinks or drops a risky piece rates lower. The PR's tier is the higher of its latest score and the tier of the work it implements. ## Overrides From 38070e3b80ad1c568b1576b9cacd25b8e779a82f Mon Sep 17 00:00:00 2001 From: Jim Meyer Date: Tue, 1 Dec 2026 18:01:43 -0800 Subject: [PATCH 15/15] docs(rfc): rate architecture and blocked releases in the risk rubric Signed-off-by: Jim Meyer --- rfc/0026-openshell-factory/risk-scoring-rubric.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rfc/0026-openshell-factory/risk-scoring-rubric.md b/rfc/0026-openshell-factory/risk-scoring-rubric.md index a43048bdc1..5d3c1027eb 100644 --- a/rfc/0026-openshell-factory/risk-scoring-rubric.md +++ b/rfc/0026-openshell-factory/risk-scoring-rubric.md @@ -8,9 +8,10 @@ An assessor rates each input as low, medium, or high. | Input | Low | Medium | High | |---|---|---|---| -| Reversibility | A revert undoes the change | A revert needs a follow-up step, such as a config or cache change | Irreversible: a data migration, a published release, or a protocol change | -| Criticality of impact | An operator sees wrong or missing information, or a build step breaks visibly | A sandbox or gateway cannot start, stop, or stay connected, or works unreliably. PRs or releases are blocked | Enforcement or isolation fails | +| Reversibility | A revert undoes the change | A revert needs a follow-up step, such as a config or cache change | Irreversible: a data migration, a change to an already published artifact, or a protocol change | +| Criticality of impact | An operator sees wrong or missing information, or a build step breaks visibly. A release is blocked until the change is reverted, or fails and spends a version number | A sandbox or gateway cannot start, stop, or stay connected, or works unreliably. PRs are blocked, so the revert needs a maintainer to bypass a required check | Enforcement or isolation fails | | Size of change | Up to 200 lines added and up to 10 files touched | More than that, up to 1,000 lines added and 30 files touched | More than 1,000 lines added, or more than 30 files touched | +| Architecture | The change follows existing structure and patterns | The change adds a module or a new pattern inside one crate | The change adds new architecture: a crate, a service or process, a boundary between components, or a pattern that replaces an existing one | | Coupling | Little other code depends on the touched code | Several crates or many callers depend on it | Most of the workspace depends on it | | Widening | The change stays inside the scope the issue states | The change touches adjacent functionality | The change expands the range of affected functionality | | Contracts and boundaries | No public contract, security boundary, or dependency changes | An additive change to a public contract, or a dependency update | A breaking change to a public contract, any change to a security boundary, or a new dependency | @@ -31,8 +32,8 @@ Criticality rates what fails if the change is wrong. | Rating | What fails if the change is wrong | Examples | |---|---|---| | High | Enforcement or isolation: a policy decision, the sandbox boundary, credentials | Policy evaluation, L7 enforcement, seccomp mediation, credential injection | -| Medium | A sandbox or gateway cannot start, stop, or stay connected, or works unreliably. Contributors cannot put up a PR, or the project cannot ship a release | Sandbox creation, compute drivers, supervisor session, provisioning, policy DNS lookups, required PR checks, release workflows | -| Low | An operator sees wrong or missing information, or a build or CI step breaks in a way that is easy to see and quick to fix | Listing sandboxes, gateways, and workspaces, TUI display, CLI help, docs, most build and CI changes | +| Medium | A sandbox or gateway cannot start, stop, or stay connected, or works unreliably. Contributors cannot merge a PR, so the revert cannot flow through the normal checks and needs a maintainer to bypass one | Sandbox creation, compute drivers, supervisor session, provisioning, policy DNS lookups, required PR checks | +| Low | An operator sees wrong or missing information, or a build or CI step breaks in a way that is easy to see and quick to fix. The project cannot ship a release until the change is reverted, or a release fails and spends a version number | Listing sandboxes, gateways, and workspaces, TUI display, CLI help, docs, most build and CI changes, release workflows | How often the code runs adjusts the rating. Code that runs on every request, connection, lookup, or syscall raises a low rating to medium, because an intermittent failure there is close to a complete one. Frequency never raises a rating to high. @@ -54,7 +55,7 @@ An agent never moves work from `ready-for-human` to `ready-for-agent` without a ### Starting point -This rubric is strict by design. Every input must rate low for work to be low risk, ambiguity rounds up, and two inputs, coupling and testing, rest on judgment. Most work scores medium at first, so a human reviews nearly every agent PR before it lands. +This rubric is strict by design. Every input must rate low for work to be low risk, ambiguity rounds up, and three inputs, architecture, coupling, and testing, rest on judgment. Most work scores medium at first, so a human reviews nearly every agent PR before it lands. The project loosens the rubric from evidence. The risk score agreement metric shows where humans approve medium-risk work without changes, and those cases justify relaxing a specific input.