# Miri Dsp

> Run `cargo +nightly miri test` against a Rust DSP crate to detect undefined behaviour the compiler missed — out-of-bounds access, use-after-free, uninitialised memory reads, invalid pointer arithmetic. Miri is the cheapest sound UB detector for Rust; this skill wraps it with the right isolation flags for audio DSP crates.

- **Type:** Skill
- **Install:** `agentstack add skill-gertsylvest-meta-team-miri-dsp`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [gertsylvest](https://agentstack.voostack.com/s/gertsylvest)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [gertsylvest](https://github.com/gertsylvest)
- **Source:** https://github.com/gertsylvest/meta-team/tree/main/library/skills/miri-dsp

## Install

```sh
agentstack add skill-gertsylvest-meta-team-miri-dsp
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Miri DSP

`miri` interprets Rust's mid-level IR and catches a large class of undefined behaviour that `cargo test` will silently miss: out-of-bounds slice access, use-after-free, reads of uninitialised memory, invalid `unsafe` pointer arithmetic, and aliasing violations under the Stacked Borrows / Tree Borrows models.

Miri is most valuable on `no_std` DSP crates — they tend to contain hand-written `unsafe` for SIMD and ringbuffers where the compiler cannot prove safety. The cost is runtime speed (Miri is an interpreter, not a compiler), so this skill targets the unit tests of a single crate rather than a whole workspace.

## Limitations

- **Miri does not target `wasm32`.** It runs on the host triple. UB-free under Miri does not guarantee UB-free under wasm32 — but in practice the UB classes Miri catches are target-independent.
- **Floating-point intrinsics are slow under Miri.** Heavy DSP benchmark suites will time out. Focus tests on correctness invariants and `unsafe` boundaries, not on full audio renders.
- **`cargo bench` does not run under Miri** — use the `cargo-bench-rt` skill on native instead.

## Requirements

- **Rust nightly toolchain** with the miri component:
  ```bash
  rustup toolchain install nightly
  rustup +nightly component add miri
  ```

The script bootstraps both if missing.

## Instructions

The argument is in `$ARGUMENTS`. Pass it directly to the run script:

```bash
bash "$(dirname "$0")/run.sh" $ARGUMENTS
```

The argument is the path to the crate directory.

## Output sections

| Section | What it reports |
|---|---|
| `TOOLCHAIN` | Whether nightly + miri are installed |
| `MIRI` | Result of `cargo +nightly miri test` |

## Typical usage

```bash
# Run miri on a single DSP crate
bash run.sh ./rust/audio-dsp

# Run on every DSP crate in a workspace
for crate in rust/dsp-*; do bash run.sh "$crate"; done
```

## What to look for

- **`MIRI` failing with "Undefined Behavior"** — read the report carefully. Miri pinpoints the exact statement and explains the violation (e.g. "reading uninitialised bytes", "out-of-bounds pointer offset", "stacked borrows violation").
- **`MIRI` timing out** — narrow the test set. Mark long-running renders with `#[cfg(not(miri))]` so they are skipped under Miri while still running under `cargo test`.
- **`MIRI` reporting "unsupported operation"** — Miri does not support every libc or syscall. If the offending call is in a third-party dep, gate that path behind a feature flag the DSP crate does not enable; if it is in your own code, the operation probably should not be in a DSP crate at all.

## How often to run

Run on every change to an `unsafe` block in a DSP crate. Optional but valuable in CI on a nightly schedule.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [gertsylvest](https://github.com/gertsylvest)
- **Source:** [gertsylvest/meta-team](https://github.com/gertsylvest/meta-team)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-gertsylvest-meta-team-miri-dsp
- Seller: https://agentstack.voostack.com/s/gertsylvest
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
