assert-agent-story

assert-agent-story is a cursor rule for Cursor from FeatureFactory-io/mimir. It costs 546 tokens per session, scanned A, original, Apache-2.0.

A rule for testing agent workflows with integration tests, which check several parts working together. It requires scripted language-model responses and checks the resulting actions, tool calls, and state.

In plain words
What is it for?
Use it to prove both successful and rejected agent scenarios with pytest, a test framework for Python, and recorded test scripts.
Why use it?
It prevents tests from passing merely because an agent produced plausible text or because a loop exists; the test must show what the workflow actually did.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to prove both successful and rejected agent scenarios with pytest, a test framework for Python, and recorded test scripts.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/featurefactory-io/mimir/assert-agent-story
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/FeatureFactory-io/mimir

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for assert-agent-story

README.md
[![agentmods](https://agentmods.dev/badge/rules/featurefactory-io/mimir/assert-agent-story/github.svg)](https://agentmods.dev/rules/featurefactory-io/mimir/assert-agent-story)
Your own site
<a href="https://agentmods.dev/rules/featurefactory-io/mimir/assert-agent-story"><img src="https://agentmods.dev/badge/rules/featurefactory-io/mimir/assert-agent-story/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for assert-agent-story

Your own site · 80×15
<a href="https://agentmods.dev/rules/featurefactory-io/mimir/assert-agent-story"><img src="https://agentmods.dev/badge/rules/featurefactory-io/mimir/assert-agent-story.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 546 This file is loaded in full into every session.
When invoked 546 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00546 $0.00546
Opus 5.5 $0.00218 $0.00218
Sonnet 5.5 $0.00109 $0.00109
Haiku 4.5 $0.00055 $0.00055

Measured 18d ago against content hash 51b0a843e106, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

assert-agent-story scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 18d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/playbooks/rules/assert-agent-story.mdc · 31 lines

How it starts

The opening of the file, as written. The whole thing — 31 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Mimir metadata: slug do-assert-agent-story; always_apply: false (link to BPE-02 / MIN-04 / TFK-02 / DTA-19).

When a plan, iteration manifest, or SAO §17 row declares Agent proof scenarios (PRF-*, agent_proof_script[], or agent_proof_command), you MUST prove orchestration with pytest integration tests using CAP-004 ScriptedLLM and the shared trace helper — not by asserting chat prose, grepping logs/app.log alone, or "the agent loop exists" checklists.

Requirements

  1. For each PRF row mapped in SAO §17, a test asserts run trace beats (workflow, tools offered/called, domain effects, blackboard/plan state as applicable) via tests/support/agent_story.py → assert_agent_story(...).
  2. Cover happy and reject paths when the PRF is marked adverse or has a reject sketch (test_*_agent_story_happy / test_*_agent_story_reject).
  3. Use ordered LLM scripts from tests/fixtures/llm_scripts/<prf-id>/ injected through the agent factory — only CAP-004 ScriptedLLM may stand in for the LLM in integration tests.
  4. Agent-proof tests ship in the same commit as the CAP/worker behavior they prove — never a deferred "agent testing pass".
  5. Never assert on raw secrets, tokens, or passwords in trace or log lines.
  6. Do not mock domain services, tools, or brokers in @agent_proof tests — real DB and real tool registry per Test Trophy.

Relationship to log story

  • Log story (do-assert-log-story): proves logging beats at decision points (caplog).
  • Agent story: proves control-plane behavior (trace + domain) under scripted LLM turns.
  • Both may apply to the same slice; both must green in the same commit when declared.

Anti-patterns

  • Behavior test green while PRF trace absent or weakened to "agent completed"
  • FakeLLM that returns [] on exhaustion instead of raising (hides missing script turns)
  • Mocking ToolExecutor or domain services in @agent_proof integration tests
  • Skipping checkpoint.agent_proof_command when the manifest lists PRF proofs
  • Using live LLM in PR merge gate (belongs to lane 3/4 — see TFK-01 §6)

Read the full file on GitHub · 31 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 18d ago First seen · 31 lines · 546 tokens per session scan A 51b0a843e106

Subscribe to this mod's changes

assert-agent-story is a cursor rule published in the GitHub repository FeatureFactory-io/mimir (16 stars, last pushed 17d ago), licensed Apache-2.0. It adds 546 tokens to every session, about $0.0022 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-29.