collection-iterators

collection-iterators is a cursor rule for Cursor from briangmilnes/APAS-VERUS. It costs 0 tokens per session (2,032 once invoked), scanned A, original, MIT.

A standard for adding iterators to collection modules in an APAS-VERUS Rust project. An iterator is an object that returns collection elements one at a time, with extra proof information about its position and contents.

In plain words
What is it for?
Use it when implementing or testing iterators for APAS-VERUS collections, including their runtime behavior and formal invariants.
Why use it?
It gives collection iterators a consistent structure and verification contract instead of leaving each module to invent its own approach.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when implementing or testing iterators for APAS-VERUS collections, including their runtime behavior and formal invariants.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/briangmilnes/apas-verus/collection-iterators
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/briangmilnes/APAS-VERUS

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 collection-iterators

README.md
[![agentmods](https://agentmods.dev/badge/rules/briangmilnes/apas-verus/collection-iterators/github.svg)](https://agentmods.dev/rules/briangmilnes/apas-verus/collection-iterators)
Your own site
<a href="https://agentmods.dev/rules/briangmilnes/apas-verus/collection-iterators"><img src="https://agentmods.dev/badge/rules/briangmilnes/apas-verus/collection-iterators/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 collection-iterators

Your own site · 80×15
<a href="https://agentmods.dev/rules/briangmilnes/apas-verus/collection-iterators"><img src="https://agentmods.dev/badge/rules/briangmilnes/apas-verus/collection-iterators.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,032 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.02032
Opus 5.5 $0.00000 $0.00813
Sonnet 5.5 $0.00000 $0.00406
Haiku 4.5 $0.00000 $0.00203

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

Security

Grade A, and why

collection-iterators 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 27d 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/rules/apas-verus/collection-iterators.mdc · 158 lines

How it starts

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

Collection Iterator Standard

Every APAS-VERUS collection module implements the verus 0.2026.09.13 prophetic iterator model. The verified reference implementations are the standards:

  • src/standards/iterators_standard.rs — delegated style (a Vec-backed collection returns the std iterator), with the loop idioms.
  • src/standards/prophetic_iterators_standard.rs — delegated and custom styles (a custom iterator implements IteratorSpecImpl).
  • src/standards/wrapping_iterators_standard.rs — a collection that wraps another re-exposes the inner iterator.

Prose reference: docs/PropheticIterators.md. Component checklist: docs/APAS-VERUSIterators.rs. Measurements: docs/StandardsUpgrade.md.

Required Components (all inside verus!)

Delegated style, for a collection whose elements live in a Vec<T>. vstd already supplies IteratorSpecImpl for std::slice::Iter and std::vec::IntoIter, so the collection defines no iterator struct, no iterator View and no ghost iterator.

# Component Section
1 fn iter(&self) -> std::slice::Iter<'_, T> with the three postconditions below 8 (trait), 9 (impl)
2 impl IntoIterator for &Self, same type, same postconditions 10
3 Optional: impl IntoIterator for Self -> std::vec::IntoIter<T> 10

Custom style, for a collection with no slice underneath: the iterator struct (private fields, #[verifier::type_invariant]), a closed elts() spec fn, impl Iterator with a plain next (no ensures), impl IteratorSpecImpl with the five spec fns (obeys_prophetic_iter_laws, remaining, will_return_none, decrease, peek), and a constructor with #[verifier::when_used_as_spec].

Constructor postconditions

fn iter(&self) -> (it: std::slice::Iter<'_, T>)
    ensures
        IteratorSpec::remaining(&it) == [email protected]_ref(),
        vstd::std_specs::slice::into_iter_elts(it) == self@,
        IteratorSpec::decrease(&it) is Some,

For a consuming iterator drop .as_ref() and use vstd::std_specs::vec::into_iter_elts. For a custom type the middle clause is IteratorSpec::remaining(&it) == it.elts().

Read the full file on GitHub · 158 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. 27d ago Changed · -27 lines f0946175c3b1
  2. 1mo ago First seen · 185 lines · 0 tokens per session scan A 2e4240f7235a

Subscribe to this mod's changes

collection-iterators is a cursor rule published in the GitHub repository briangmilnes/APAS-VERUS (10 stars, last pushed 23d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,032 tokens. 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-08-31.