# openspec/changes/wf-a-person-on-every-risky-step/proposal.md

## Why

Coding agents get broad permissions, and nobody can say which actions waited for a person and which ran alone. When a key leaks, filing its replacement is a chore that slips. An agent should earn more room from its record, and a leaked key should get its replacement the same day it was revoked.

## What Changes

- Add the `a-person-on-every-risky-step` workflow to the PromptReports workflow library, run by the workflow runner as an agent acting for a person.
- PromptCompute: List the action types and which of them wait for a person (list_action_types) (today: Built).
- PromptCompute: Read what people approved and refused in the last 30 days (get_autonomy_report) (today: Built).
- PromptCompute: Read where autonomy could widen or narrow, read only (list_autonomy_suggestions) (today: Switching on).
- RepoOps: Read the allow rules no session used in 30 days, read only (list_least_agency_suggestions) (today: Built).
- RepoOps: Read the production incidents attributed to the agent, when the start names it (get_agent_incidents) (today: Built).
- RepoOps: File a rotation request for each leaked key a person approves (request_key_rotation) (today: Built).
- RepoOps: Propose a lesson a person approves (propose_brain_entry) (today: Built).
- Gate `repoops.request_key_rotation`, `repoops.brain_entry.propose` through PromptCompute approvals; each gated step runs only after `verifyResume` passes, with `final_args`.
- Write a signed record at the end of each run and count one workflow request.

## Impact

- Products: PromptCompute, RepoOps.
- Outside the family: None beyond the family.
- State: Partly built. The workflow manifest is merged (promptcompute.ai #816, with its outcome reworded in #822 and the least-agency read added in #836); the production run is still to do. RepoOps already revoked each leaked key; the run files a request for a person to issue each replacement, and each rotation waits for a person's approval. The run reads RepoOps's least-agency suggestions (allow rules no session used in 30 days), read only. RepoOps serves them on its local server only, so a run against the hosted server records the refusal and goes on. The autonomy suggestions step answers only once PromptCompute switches on its record tools.
- Plan row: none yet (Proposed).

# openspec/changes/wf-a-person-on-every-risky-step/tasks.md

## 1. Connect and authorize

- [ ] 1.1 Confirm the org has a connection for each of: PromptCompute, RepoOps. Stop and tell the user which is missing.
- [ ] 1.2 Get a PromptReports ID agent token for each product the run calls (RFC 8693 exchange). Where a product does not accept ID tokens yet, use its connect key.
- [ ] 1.3 Register policy for `repoops.request_key_rotation`, `repoops.brain_entry.propose` with `require_approval` as the default.

## 2. Build the steps

- [ ] 2.1 PromptCompute: List the action types and which of them wait for a person (list_action_types).
- [ ] 2.2 PromptCompute: Read what people approved and refused in the last 30 days (get_autonomy_report).
- [ ] 2.3 PromptCompute: Read where autonomy could widen or narrow, read only (list_autonomy_suggestions).
- [ ] 2.4 RepoOps: Read the allow rules no session used in 30 days, read only (list_least_agency_suggestions).
- [ ] 2.5 RepoOps: Read the production incidents attributed to the agent, when the start names it (get_agent_incidents).
- [ ] 2.6 RepoOps: File a rotation request for each leaked key a person approves (request_key_rotation).
- [ ] 2.7 RepoOps: Propose a lesson a person approves (propose_brain_entry).

## 3. Verify and record

- [ ] 3.1 Run a dry run with the user's inputs: Agent = agt_...; Agent name in RepoOps = billing-bot (optional); Leaked keys = STRIPE_SECRET_KEY at stripe, from case_7f3a (optional).
- [ ] 3.2 Run it once for real; approve each gate as the user.
- [ ] 3.3 Measure the outcomes: Risky action classes that waited for a person: target all; Leaked keys with a rotation filed: target all; Approvals and refusals in the last 30 days.
- [ ] 3.4 Confirm the run left a signed record with a task id and one workflow request counted.

# openspec/changes/wf-a-person-on-every-risky-step/specs/workflow-a-person-on-every-risky-step/spec.md

## ADDED Requirements

### Requirement: Each rotation waits for a person

The workflow SHALL file a rotation request for a leaked key only after a person approves it, with one approval per key.

#### Scenario: Each rotation waits for a person

- **WHEN** a person declines one key's rotation
- **THEN** that key gets no request and the run goes on to the next key

### Requirement: Suggestions are read only

The workflow SHALL only read autonomy suggestions and RepoOps's least-agency suggestions; a person SHALL apply a suggestion in PromptCompute or RepoOps.

#### Scenario: Suggestions are read only (1)

- **WHEN** PromptCompute's record tools are not switched on
- **THEN** the suggestions step returns nothing and the run goes on

#### Scenario: Suggestions are read only (2)

- **WHEN** RepoOps answers the least-agency read as local only
- **THEN** the step is recorded as refused and the run goes on

### Requirement: Evidence stays honest

Each step SHALL report what it saw as measured, inferred or missing, and SHALL never report missing as measured.

#### Scenario: A product part is not built

- **WHEN** a step depends on a part that is Planned or Proposed
- **THEN** the step records `missing`, names the part, and the approval card shows the gap

### Requirement: One run is one workflow request

The runner SHALL count one workflow request at the run's first connector action, and SHALL NOT count retries, resumes, dry runs or a run a filter stops first.

#### Scenario: A gated step resumes after two days

- **WHEN** a person approves a step and the run resumes
- **THEN** the org's usage does not change
