# openspec/changes/wf-discount-and-promise-guard/proposal.md

## Why

Reps and sales agents offer discounts and delivery dates to close. Finance and engineering find out after the contract is signed. A discount approved on evidence protects margin, and a date checked against the work protects the renewal.

## What Changes

- Add the `discount-and-promise-guard` workflow to the PromptReports workflow library, run by the workflow runner as an agent acting for a person.
- Sales as Code: Hold the proposed discount or commitment for a person (today: Built).
- CommitOps: Answer can we promise this by then (today: Built).
- PromptCompute: Show the forecast record and the answer on the approval card (today: Planned).
- CommitOps: Record the promise once approved (today: Planned).
- Gate `sales.discount.approve`, `sales.commitment.approve`, `sales.proposal.send` 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: Sales as Code, PromptCompute, CommitOps.
- Outside the family: HubSpot, Salesforce or Attio.
- State: Partly built. Discounts and commitments wait for a person in Sales as Code. The PromptCompute card and the CommitOps promise are still to build.
- Plan row: LDG-2275.

# openspec/changes/wf-discount-and-promise-guard/tasks.md

## 1. Connect and authorize

- [ ] 1.1 Confirm the org has a connection for each of: Sales as Code, PromptCompute, CommitOps. 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 `sales.discount.approve`, `sales.commitment.approve`, `sales.proposal.send` with `require_approval` as the default.

## 2. Build the steps

- [ ] 2.1 Sales as Code: Hold the proposed discount or commitment for a person.
- [ ] 2.2 CommitOps: Answer can we promise this by then.
- [ ] 2.3 PromptCompute: Show the forecast record and the answer on the approval card. Blocked: this part is Planned; until it ships, record the step's evidence as `missing` and continue.
- [ ] 2.4 CommitOps: Record the promise once approved. Blocked: this part is Planned; until it ships, record the step's evidence as `missing` and continue.

## 3. Verify and record

- [ ] 3.1 Run a dry run with the user's inputs: Deal = Globex, 120 seats; Discount = 18%; Commitment = SSO by 2027-01-15.
- [ ] 3.2 Run it once for real; approve each gate as the user.
- [ ] 3.3 Measure the outcomes: Discounts approved with evidence attached: target 100%; Promises made that CommitOps marked cannot tell; Kept rate of promises made through the guard.
- [ ] 3.4 Confirm the run left a signed record with a task id and one workflow request counted.

# openspec/changes/wf-discount-and-promise-guard/specs/workflow-discount-and-promise-guard/spec.md

## ADDED Requirements

### Requirement: The card carries the evidence

The approval card SHALL show the deal's forecast odds, their drivers and the CommitOps answer.

#### Scenario: The card carries the evidence

- **WHEN** CommitOps answers cannot tell
- **THEN** the card says so in plain words and the default action is reject

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