# openspec/changes/wf-renewal-brief/proposal.md

## Why

At renewal nobody has the record of what was promised, what was delivered and which incidents hit the customer. You walk into the renewal knowing what the customer will raise, with the evidence in hand.

## What Changes

- Add the `renewal-brief` workflow to the PromptReports workflow library, run by the workflow runner as an agent acting for a person.
- CommitOps: Promises kept and broken for the account (today: Built).
- RepoOps: Incidents that touched the account (today: Proposed).
- Sales as Code: Renewal odds and their drivers (today: Built).
- AI Source of Truth: Check each figure (today: Built).
- PromptCompute: A person approves any customer-facing copy (today: Built).
- Gate `email.send`, `commitops.customer.notify` 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: CommitOps, Sales as Code, RepoOps, AI Source of Truth.
- Outside the family: HubSpot, Salesforce or Attio, Your email.
- State: Proposed. Not in the plan. Uses the CommitOps ledger, the Sales as Code forecast and RepoOps incidents.
- Plan row: none yet (Proposed).

# openspec/changes/wf-renewal-brief/tasks.md

## 1. Connect and authorize

- [ ] 1.1 Confirm the org has a connection for each of: CommitOps, Sales as Code, RepoOps, AI Source of Truth. 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 `email.send`, `commitops.customer.notify` with `require_approval` as the default.

## 2. Build the steps

- [ ] 2.1 CommitOps: Promises kept and broken for the account.
- [ ] 2.2 RepoOps: Incidents that touched the account. Blocked: this part is Proposed; until it ships, record the step's evidence as `missing` and continue.
- [ ] 2.3 Sales as Code: Renewal odds and their drivers.
- [ ] 2.4 AI Source of Truth: Check each figure.
- [ ] 2.5 PromptCompute: A person approves any customer-facing copy.

## 3. Verify and record

- [ ] 3.1 Run a dry run with the user's inputs: Account = Acme Freight; Renewal date = 2027-02-01.
- [ ] 3.2 Run it once for real; approve each gate as the user.
- [ ] 3.3 Measure the outcomes: Renewals with a brief 60 days out; Renewal rate for accounts with a brief.
- [ ] 3.4 Confirm the run left a signed record with a task id and one workflow request counted.

# openspec/changes/wf-renewal-brief/specs/workflow-renewal-brief/spec.md

## ADDED Requirements

### Requirement: Internal by default

The brief SHALL stay internal unless a person approves a customer-facing version.

#### Scenario: Internal by default

- **WHEN** an agent tries to email the brief to the customer
- **THEN** PromptCompute holds it for a person

### 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 when the first step starts, and SHALL NOT count retries, resumes or dry runs.

#### 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
