# Business Flow → Story Parity Check

## Context

App: {{APP_NAME}}
Business flow docs: {{BUSINESS_FLOW_DOCS}}
Story docs: {{STORY_DOCS}}

## Instructions

1. Read ALL business flow docs at the paths above
2. Read ALL story docs at the paths above
3. For each business flow, extract flow steps and referenced actors
4. For each story, extract the actor and the flow step it covers
5. Run every parity check below against each business flow
6. Return results as JSON per the Output Format section

## Extraction: Business Flow Docs

From each business flow README.md, extract:

### Flow Steps

- Each numbered step or substep in the flow
- The actor responsible for each step
- Any story links referenced (format: `./story/<actor>--<name>.md`)

### Actors

- All actors mentioned in the flow
- Actor doc links (format: `../../actors/<actor>.md`)

## Extraction: Story Docs

From each story doc, extract:

- The actor (from filename pattern `<actor>--<name>.md` or from content)
- The scenario patterns and user actions described
- Screen references (format: `../../../screen/<screen>.md`)

## Parity Checks

For each business flow's steps and actors:

| Check ID        | Question                                                 |
| --------------- | -------------------------------------------------------- |
| story_existence | Does each flow step have a corresponding story?          |
| actor_coverage  | Are all actors in the flow represented in stories?       |
| link_validity   | Do story links in the flow README resolve to real files? |

### How to Check

1. List all flow steps from each business flow README
2. For each step, verify a story doc exists that covers it
3. Verify all actors mentioned in the flow appear as story actors
4. Validate that all `./story/<actor>--<name>.md` links resolve to actual files in STORY_DOCS

## Link Format Reference

| From          | To    | Format                       |
| ------------- | ----- | ---------------------------- |
| Business Flow | Story | `./story/<actor>--<name>.md` |
| Business Flow | Actor | `../../actors/<actor>.md`    |

## Common Gap Patterns

- **Missing stories**: Flow step describes an action but no story doc exists for it
- **Actor mismatch**: Flow mentions an actor not represented in any story
- **Broken story links**: Flow README links to a story file that does not exist
- **Incomplete coverage**: Some flow steps have stories but others are skipped

## Output Format

Return a JSON object:

```json
{
  "check_type": "business-flow-story-parity",
  "app": "{{APP_NAME}}",
  "gaps": [...],
  "inconsistencies": [...],
  "summary": { "total_checks": N, "passed": N, "failed": N, "skipped": N }
}
```

See [parity-report-format.md](parity-report-format.md) for field definitions.
