agentleFS
danielvm-gitdanielvm-git/bigpowers/.cursor/rules/trace-requirement.mdc

bigpowers / rules

Cursor rule252 starsChanged 3 months agoMITView on GitHub

Link story IDs from specs/release-plan.yaml + epic capsule directories to the implementing code and tests. Produces specs/TRACEABILITY_LATEST.md. Use when you want to verify coverage of a release plan, audit which stories are implemented, or find \"dark\" stories with no code.

The file

We split this trace-requirement.mdc into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read specs/release-plan.yaml + epic capsule directories fully before proceeding.

    line 16
  2. Very specific:

    Look for // story: X.Y or # story: X.Y comments in source files and tests:

    line 28

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
trace-requirement.mdc
---
description: "Link story IDs from specs/release-plan.yaml + epic capsule directories to the implementing code and tests. Produces specs/TRACEABILITY_LATEST.md. Use when you want to verify coverage of a release plan, audit which stories are implemented, or find \"dark\" stories with no code."
alwaysApply: false
---

# Trace Requirement

Build a traceability matrix from `specs/release-plan.yaml + epic capsule directories` to implementing code and tests. Surfaces gaps in both directions: stories with no code, and code with no story.

## Pre-flight

> **HARD GATE** — `specs/release-plan.yaml + epic capsule directories` must exist. If it doesn't, run `plan-release` first.

→ verify: `test -f specs/release-plan.yaml && test -d specs/epics`

Read `specs/release-plan.yaml + epic capsule directories` fully before proceeding.

## Process

### 1. Extract story IDs

From release-plan.yaml, collect all story IDs (e.g. `1.1`, `1.2`, `2.1`).

→ verify: `grep -rho 'e[0-9]\+s[0-9]\+' specs/release-plan.yaml specs/epics/*/epic.yaml 2>/dev/null | sort -u | head -1 | grep -q .`

### 2. Search for story tags in code

Look for `// story: X.Y` or `# story: X.Y` comments in source files and tests:

```
grep -rn "story: " . --include="*.ts" --include="*.js" --include="*.py" --include="*.sh" | grep -v node_modules
```

→ verify: `[ "$(grep -rl "story: " . --include="*.ts" --include="*.sh" --include="*.py" 2>/dev/null | wc -l | tr -d " ")" -gt 0 ]`

### 3. Build the matrix

For each story ID:
- **Implemented**: list files that contain `// story: X.Y`
- **Tested**: list test files that contain `// story: X.Y`
- **Dark**: story has no tag in any file — flag as unimplemented

For each tagged file with no matching story ID in release-plan.yaml:
- **Orphan**: code exists but story was removed or never planned — flag for cleanup

### 4. Write specs/TRACEABILITY_LATEST.md

```
## Story Coverage

| Story | Title              | Files | Tests | Status    |
|-------|--------------------|-------|-------|-----------|
| 1.1   | [title]            | 2     | 1     | Covered   |
| 1.2   | [title]            | 0     | 0     | Dark      |

## Orphan Code (no story tag)
- [file]: contains untagged implementation

## Gaps (dark stories)
- Story 1.2: no implementation found → run plan-work

## Coverage summary
Stories: [X] covered / [Y] dark / [Z] total
```

→ verify: `grep -c "Covered\|Dark" specs/TRACEABILITY_LATEST.md`

Suggest `plan-work` for each dark story found.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.