PromptReports

Plan: Tell an agent what broke here before it edits

Partly builtopenspec/changes/wf-before-an-edit

Written for an AI agent to fetch and follow: it says what to connect, which steps to build with which product, what a person must approve, and how to check the result. Steps that depend on a part that is not built say so, and tell the agent to record the gap instead of guessing.

URL pattern: /use-cases/<id>/openspec.md, all plans at /use-cases/index.json. Checkboxes on this page are for reading only.

openspec/changes/wf-before-an-edit/proposal.md

Why

An agent edits a file behind two incidents last month and repeats the same mistake. What went wrong sits in RepoOps, and the agent never asked. A team pays for a mistake once when every agent reads what went wrong on a file before it changes it.

What Changes

  • Add the before-an-edit workflow to the PromptReports workflow library, run by the workflow runner as an agent acting for a person.
  • RepoOps: Read what went wrong on these files: recent AI changes with their findings, rollbacks and reverts, and past cases the diff repeats (get_pre_edit_context) (today: Built).
  • RepoOps: Search the brain for lessons that name these files, in one repository when the start names it (search_brain) (today: Built).
  • ContextFile: Return a starter packet of verified context for the edit (context_packet) (today: Built).
  • Write a signed record at the end of each run and count one workflow request.

Impact

  • Products: RepoOps, ContextFile.
  • Outside the family: GitHub.
  • State: Partly built. The workflow manifest is merged (promptcompute.ai #816, with its outcome reworded in #822); the production run is still to do. It reads only, asks no person for an approval, and changes nothing. An agent can start it through the family MCP server (start_run), or a person can.
  • Plan row: none yet (Proposed).
openspec/changes/wf-before-an-edit/tasks.md

1. Connect and authorize

  • 1.1 Confirm the org has a connection for each of: RepoOps, ContextFile. 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 Confirm no step writes; this workflow reads only.

2. Build the steps

  • 2.1 RepoOps: Read what went wrong on these files: recent AI changes with their findings, rollbacks and reverts, and past cases the diff repeats (get_pre_edit_context).
  • 2.2 RepoOps: Search the brain for lessons that name these files, in one repository when the start names it (search_brain).
  • 2.3 ContextFile: Return a starter packet of verified context for the edit (context_packet).

3. Verify and record

  • 3.1 Run a dry run with the user's inputs: Files = lib/billing.mjs, lib/cart.mjs (1 to 10); Planned diff = The unified diff (optional); Repository = repo-dashboard (optional).
  • 3.2 Run it once for real; approve each gate as the user.
  • 3.3 Measure the outcomes: Files asked about that came back with past incidents or lessons; Edits that repeat a past case after the agent read it: target 0.
  • 3.4 Confirm the run left a signed record with a task id and one workflow request counted.
openspec/changes/wf-before-an-edit/specs/workflow-before-an-edit/spec.md

ADDED Requirements

Requirement: It changes nothing

The workflow SHALL only read, and SHALL NOT ask a person for an approval or write to any product.

Scenario: It changes nothing

  • WHEN an agent starts it before an edit
  • THEN it returns the context and the run record, and no product changes

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