# openspec/changes/wf-find-what-another-agent-tried/proposal.md

## Why

An agent starts on a bug another agent chased last week, tries the same two fixes and hits the same wall. What would have saved the afternoon sits in a transcript on someone else's machine. Every agent starts from what the team already learned, so the team pays for a dead end once.

## What Changes

- Turn on the `find-what-another-agent-tried` use case for a team. The agent does it inside its own session through the product's MCP tools; there is no workflow run.
- RepoOps: Search the team's session history word for word, within each session's visibility (search_sessions) (today: Built).
- RepoOps: Read the matching turns with their commit, pull request and deploy (get_session_turns) (today: Built).
- Count no workflow request: it is not a workflow run.

## Impact

- Products: RepoOps.
- Outside the family: GitHub.
- State: Partly built. Session search is built and off until switched on: search_sessions and get_session_turns on the RepoOps MCP server, and a search box in RepoOps, over masked transcripts, each hit with its commit, pull request and deploy (repo-dashboard #7589). The hosted index and the production check are still to go.
- Plan row: none yet (Proposed).

# openspec/changes/wf-find-what-another-agent-tried/tasks.md

## 1. Connect and authorize

- [ ] 1.1 Confirm the org has a connection for each of: 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 Confirm the team's admin has switched the feature on; each is off by default.

## 2. Build the steps

- [ ] 2.1 RepoOps: Search the team's session history word for word, within each session's visibility (search_sessions).
- [ ] 2.2 RepoOps: Read the matching turns with their commit, pull request and deploy (get_session_turns).

## 3. Verify

- [ ] 3.1 Do it once in a real session with the user's inputs: Question = Why do invoices round down?.
- [ ] 3.2 Measure the outcomes: Sessions that start with a search of the team's session history; Fixes tried again after an earlier session ruled them out.

# openspec/changes/wf-find-what-another-agent-tried/specs/workflow-find-what-another-agent-tried/spec.md

## ADDED Requirements

### Requirement: Search respects visibility

Search SHALL return only sessions the caller may see, and a session the caller may not see SHALL change neither the results nor the totals.

#### Scenario: Search respects visibility

- **WHEN** a teammate set a session to private
- **THEN** it is in neither the results nor the count

### 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: Nothing is counted

The use case SHALL count no workflow request, because it is not a workflow run.

#### Scenario: An agent uses it ten times in one session

- **WHEN** the agent calls the tools ten times
- **THEN** the org's usage does not change
