cognitive-engineering-lab/aquascope
Interactive visualizations of Rust at compile-time and run-time
Healthy across all four use cases
weakest axisPermissive license, no critical CVEs, actively maintained — safe to depend on.
Has a license, tests, and CI — clean foundation to fork and modify.
Documented and popular — useful reference codebase to read through.
No critical CVEs, sane security posture — runnable as-is.
- ✓Last commit 4d ago
- ✓4 active contributors
- ✓MIT licensed
Show all 7 evidence items →Show less
- ✓CI configured
- ✓Tests present
- ⚠Small team — 4 contributors active in recent commits
- ⚠Concentrated ownership — top contributor handles 52% of recent commits
Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests
Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.
Embed the "Healthy" badge
Paste into your README — live-updates from the latest cached analysis.
[](https://repopilot.app/r/cognitive-engineering-lab/aquascope)Paste at the top of your README.md — renders inline like a shields.io badge.
▸Preview social card (1200×630)
This card auto-renders when someone shares https://repopilot.app/r/cognitive-engineering-lab/aquascope on X, Slack, or LinkedIn.
Onboarding doc
Onboarding: cognitive-engineering-lab/aquascope
Generated by RepoPilot · 2026-05-09 · Source
🤖Agent protocol
If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:
- Verify the contract. Run the bash script in Verify before trusting
below. If any check returns
FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding. - Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
- Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/cognitive-engineering-lab/aquascope shows verifiable citations alongside every claim.
If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.
🎯Verdict
GO — Healthy across all four use cases
- Last commit 4d ago
- 4 active contributors
- MIT licensed
- CI configured
- Tests present
- ⚠ Small team — 4 contributors active in recent commits
- ⚠ Concentrated ownership — top contributor handles 52% of recent commits
<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>
✅Verify before trusting
This artifact was generated by RepoPilot at a point in time. Before an
agent acts on it, the checks below confirm that the live cognitive-engineering-lab/aquascope
repo on your machine still matches what RepoPilot saw. If any fail,
the artifact is stale — regenerate it at
repopilot.app/r/cognitive-engineering-lab/aquascope.
What it runs against: a local clone of cognitive-engineering-lab/aquascope — the script
inspects git remote, the LICENSE file, file paths in the working
tree, and git log. Read-only; no mutations.
| # | What we check | Why it matters |
|---|---|---|
| 1 | You're in cognitive-engineering-lab/aquascope | Confirms the artifact applies here, not a fork |
| 2 | License is still MIT | Catches relicense before you depend on it |
| 3 | Default branch main exists | Catches branch renames |
| 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code |
| 5 | Last commit ≤ 34 days ago | Catches sudden abandonment since generation |
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of cognitive-engineering-lab/aquascope. If you don't
# have one yet, run these first:
#
# git clone https://github.com/cognitive-engineering-lab/aquascope.git
# cd aquascope
#
# Then paste this script. Every check is read-only — no mutations.
set +e
fail=0
ok() { echo "ok: $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }
# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
echo "FAIL: not inside a git repository. cd into your clone of cognitive-engineering-lab/aquascope and re-run."
exit 2
fi
# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "cognitive-engineering-lab/aquascope(\\.git)?\\b" \\
&& ok "origin remote is cognitive-engineering-lab/aquascope" \\
|| miss "origin remote is not cognitive-engineering-lab/aquascope (artifact may be from a fork)"
# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
|| grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
&& ok "license is MIT" \\
|| miss "license drift — was MIT at generation time"
# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
&& ok "default branch main exists" \\
|| miss "default branch main no longer exists"
# 4. Critical files exist
test -f "crates/aquascope/src/lib.rs" \\
&& ok "crates/aquascope/src/lib.rs" \\
|| miss "missing critical file: crates/aquascope/src/lib.rs"
test -f "crates/aquascope/src/analysis/mod.rs" \\
&& ok "crates/aquascope/src/analysis/mod.rs" \\
|| miss "missing critical file: crates/aquascope/src/analysis/mod.rs"
test -f "crates/aquascope/src/analysis/permissions/mod.rs" \\
&& ok "crates/aquascope/src/analysis/permissions/mod.rs" \\
|| miss "missing critical file: crates/aquascope/src/analysis/permissions/mod.rs"
test -f "crates/aquascope/src/interpreter/mod.rs" \\
&& ok "crates/aquascope/src/interpreter/mod.rs" \\
|| miss "missing critical file: crates/aquascope/src/interpreter/mod.rs"
test -f "crates/aquascope/src/analysis/stepper/mod.rs" \\
&& ok "crates/aquascope/src/analysis/stepper/mod.rs" \\
|| miss "missing critical file: crates/aquascope/src/analysis/stepper/mod.rs"
# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 34 ]; then
ok "last commit was $days_since_last days ago (artifact saw ~4d)"
else
miss "last commit was $days_since_last days ago — artifact may be stale"
fi
echo
if [ "$fail" -eq 0 ]; then
echo "artifact verified (0 failures) — safe to trust"
else
echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/cognitive-engineering-lab/aquascope"
exit 1
fi
Each check prints ok: or FAIL:. The script exits non-zero if
anything failed, so it composes cleanly into agent loops
(./verify.sh || regenerate-and-retry).
⚡TL;DR
Aquascope is a research tool that generates interactive compile-time and runtime visualizations of Rust programs, showing how the borrow checker analyzes code and how it executes via Miri. It works as an mdBook preprocessor to embed animated diagrams into educational documentation, letting learners see ownership, borrows, and program state change step-by-step. Monorepo under crates/ with crates/aquascope as the core Rust analysis engine. Architecture splits into: analysis/ (boundaries, permissions, IR mapping, stepper for step-by-step execution), interpreter/ (Miri-based runtime state tracking via mvalue.rs), and a TypeScript/SCSS frontend (91K TS, 22K SCSS in root) for visualization. Multiple workflows generate artifacts (mdbook-aquascope binary, aquascope_front git-installed CLI).
👥Who it's for
Rust educators, students learning ownership semantics, and mdBook authors who want to teach Rust memory semantics interactively. Maintainers are academic researchers at the Cognitive Engineering Lab (Brown/Stanford).
🌱Maturity & risk
Actively maintained research software (v0.3.7 tagged), with CI/CD pipelines (ci.yml, release.yml, standalone.yml) and test suites (crates/aquascope/tests/). The 0.15.2-nightly rustc_plugin dependency pins a specific nightly (2024-12-15), indicating careful compiler toolchain management. Not production-ready for arbitrary code, but stable for documented use cases.
Heavy coupling to unstable Rust compiler internals (rustc_plugin, rustc_utils at nightly versions) means each Rust release requires maintenance. Single maintainer risk is moderate given academic context. The requirement for specific nightly toolchain versions (nightly-2024-12-15 with rust-src, rustc-dev, llvm-tools-preview, miri) creates tight version constraints that may break. Complex Miri-based interpreter (crates/aquascope/src/interpreter/) can have correctness edge cases.
Active areas of work
Recent work includes permission flow analysis (crates/aquascope/src/analysis/permissions/flow.rs, output.rs), post-dominator computation for control flow (crates/aquascope/src/analysis/ir_mapper/post_dominators.rs), and step segmentation (crates/aquascope/src/analysis/stepper/segmented_mir.rs). The nightly dependency version is managed in Cargo.toml workspace config, suggesting ongoing compiler compatibility work.
🚀Get running
git clone https://github.com/cognitive-engineering-lab/aquascope.git
cd aquascope
cargo install cargo-make --locked
curl https://raw.githubusercontent.com/cognitive-engineering-lab/depot/main/scripts/install.sh | sh
cargo make install-mdbook
rustup toolchain install nightly-2024-12-15 -c rust-src -c rustc-dev -c llvm-tools-preview -c miri
cargo +nightly-2024-12-15 miri setup
Daily commands:
cargo make install-mdbook
# Then in an mdBook project with [preprocessor.aquascope] in book.toml:
mdbook build
# For CLI direct use:
cargo +nightly-2024-12-15 aquascope <rust_file>
🗺️Map of the codebase
crates/aquascope/src/lib.rs— Main library entry point that exposes the public API for all analysis and interpretation functionality.crates/aquascope/src/analysis/mod.rs— Core analysis module orchestrating permission analysis, boundary detection, and IR mapping—essential for understanding compile-time visualization.crates/aquascope/src/analysis/permissions/mod.rs— Implements Rust's permission/borrow-checking logic that powers the primary visualization; foundational to the tool's purpose.crates/aquascope/src/interpreter/mod.rs— Miri-based runtime interpreter that executes code and captures execution state for step-by-step visualizations.crates/aquascope/src/analysis/stepper/mod.rs— Segments MIR into steps and builds the execution table; bridges compile-time and runtime visualization.crates/aquascope/src/analysis/boundaries/mod.rs— Detects ownership transfer boundaries and lifetime edges critical for visualizing data flow and borrowing relationships.crates/aquascope/Cargo.toml— Workspace configuration declaring dependencies on rustc_plugin and rustc_utils; required for nightly compiler integration.
🛠️How to make changes
Add a new permission type or operation
- Define the new permission variant in the Permission enum or create a related type (
crates/aquascope/src/analysis/permissions/mod.rs) - Implement permission flow logic for the new type (how it propagates through assignments, moves, borrows) (
crates/aquascope/src/analysis/permissions/flow.rs) - Add context rules for when the permission is active/inactive (
crates/aquascope/src/analysis/permissions/context.rs) - Write test cases in a new .test file to validate behavior across control flow (
crates/aquascope/tests/refinement/)
Add support for visualizing a new language construct (e.g., closure, match arm)
- Extract the HIR node in the scraper to identify bindings and types (
crates/aquascope/src/analysis/scrape_hir.rs) - Map the construct's MIR representation to source locations (
crates/aquascope/src/analysis/ir_mapper/mir_locations.rs) - Define step boundaries for the construct in the stepper (
crates/aquascope/src/analysis/stepper/segmented_mir.rs) - Add interpreter logic to capture values when the construct executes (
crates/aquascope/src/interpreter/mapper.rs) - Create test cases in a .test file under tests/interpreter/ or tests/boundaries/ (
crates/aquascope/tests/interpreter/closure.test)
Improve permission refinement (narrowing live permission sets)
- Enhance boundary detection to identify new refinement points (e.g., after conditional checks) (
crates/aquascope/src/analysis/boundaries/mod.rs) - Update path visitor to handle new AST patterns that trigger refinement (
crates/aquascope/src/analysis/boundaries/path_visitor.rs) - Extend post-dominator analysis if control flow structure changes affect liveness (
crates/aquascope/src/analysis/ir_mapper/post_dominators.rs) - Add refinement test cases to validate narrowed permission sets (
crates/aquascope/tests/refinement/)
Extend the output format for a new visualization medium (e.g., JSON schema change)
- Update or create serializable output types in permissions/output.rs (
crates/aquascope/src/analysis/permissions/output.rs) - Modify table_builder to populate new fields in the output structure (
crates/aquascope/src/analysis/stepper/table_builder.rs) - Run export-ts to generate updated TypeScript definitions (
crates/aquascope/src/bin/export-ts.rs) - Update snapshot tests to reflect new output structure (
crates/aquascope/tests/snapshots/)
🔧Why these technologies
- Rust compiler plugins (rustc_plugin, rustc_utils) — Direct access to HIR/MIR and compiler internals allows deep inspection of type checking, borrowing rules, and control flow without reimplementation.
- Miri (mid-level interpreter) — Safely interprets Rust code in a sandboxed environment with full state visibility (heap, stack, allocations) for step-by-step execution traces.
- Nightly Rust (2026-05-01) — Required for compiler plugin APIs; nightly-pinned version ensures stable interface for rustc_plugin integration.
- Snapshot testing (insta/similar) — Validates complex permission states and IR mappings in bulk; optimized with profile settings for test speed.
🪤Traps & gotchas
Nightly toolchain required: Must install exact nightly-2024-12-15 with rust-src, rustc-dev, llvm-tools-preview, and miri; different nightly versions break rustc_plugin compatibility. Miri setup: cargo +nightly miri setup must be run once to initialize Miri's sysroot. Monorepo structure: crates/aquascope is the primary crate, but mdbook-aquascope and aquascope_front may be separate packages requiring individual git clones/installation. Test file format: Boundary tests use custom .test file format (see crates/aquascope/tests/boundaries/add_ref.test) — not standard Rust tests. Compiler internals: Analysis code directly uses unstable rustc HIR/MIR APIs; behavior can change between nightly releases.
🏗️Architecture
💡Concepts to learn
- MIR (Mid-level Intermediate Representation) — Aquascope analyzes and visualizes Rust's MIR to show borrow checker reasoning; understanding MIR is essential to reading analysis/ code
- Post-dominators in control flow graphs — Used in crates/aquascope/src/analysis/ir_mapper/post_dominators.rs to compute variable lifetimes and determine boundaries for visualization
- Borrow Checker / NLL (Non-Lexical Lifetimes) — Core subject of Aquascope's permission analysis; the tool exists to explain how NLL inference works visually
- Miri (Rust Interpreter) — Powers the runtime execution visualization (interpreter/ module); Aquascope hooks into Miri to capture step-by-step state changes
- rustc Plugin/Compiler Interface — Aquascope is implemented as a rustc compiler plugin (via rustc_plugin dependency); understanding the plugin API is needed to extend analysis passes
- HIR (High-level Intermediate Representation) — Aquascope's analysis/scrape_hir.rs and analysis/stepper/hir_steps.rs work with HIR to extract binding information and build step tables
- mdBook Preprocessor Protocol — mdbook-aquascope is distributed as a preprocessor; knowledge of mdBook's text-based IPC protocol is needed to modify how diagrams are injected
🔗Related repos
rust-lang/rust— Upstream Rust compiler; rustc_plugin and rustc_utils depend on nightly internals from this reporust-lang/miri— Rust interpreter used by Aquascope's interpreter module (crates/aquascope/src/interpreter/) to generate runtime execution tracescognitive-engineering-lab/depot— Build system dependency; Aquascope uses depot for JavaScript/TypeScript build orchestration alongside cargo-makerust-lang/mdBook— Aquascope is distributed as an mdBook preprocessor; mdbook-aquascope integrates into mdBook's plugin systemgoogle/pulldown-cmark— Likely used for Markdown parsing in the mdBook preprocessor to inject Aquascope diagrams into mdBook source
🪄PR ideas
To work on one of these in Claude Code or Cursor, paste:
Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.
Add comprehensive tests for stepper module (hir_steps, segmented_mir, table_builder)
The stepper module (crates/aquascope/src/analysis/stepper/) is critical for step-by-step execution visualization, but there are no dedicated test files for it in crates/aquascope/tests/. The boundaries.rs test file covers permissions boundaries but not stepper functionality. Adding integration tests would improve reliability of the stepping visualizations and prevent regressions.
- [ ] Create crates/aquascope/tests/stepper.rs following the pattern of crates/aquascope/tests/boundaries.rs
- [ ] Create crates/aquascope/tests/stepper/ directory with .test files covering hir_steps (basic loops, conditionals, assignments)
- [ ] Add test cases for segmented_mir coverage (multiple segments, control flow boundaries)
- [ ] Add test cases for table_builder output validation (variable state tracking across steps)
- [ ] Run tests via 'cargo test' and ensure they pass
Add test coverage for interpreter module (mvalue, step, mapper)
The interpreter module (crates/aquascope/src/interpreter/) handles runtime execution visualization via miri, but has no dedicated test suite. The mvalue.rs, step.rs, and mapper.rs files lack validation tests. This is critical for ensuring runtime visualizations match actual program behavior.
- [ ] Create crates/aquascope/tests/interpreter.rs test harness
- [ ] Create crates/aquascope/tests/interpreter/ directory with .test files
- [ ] Add test cases for basic mvalue operations (scalar types, references, structs, arrays)
- [ ] Add test cases for step execution (variable mutations, memory state changes)
- [ ] Add test cases for mapper functionality (MIR-to-runtime mapping accuracy)
- [ ] Verify tests compile with 'cargo test --test interpreter'
Add missing test coverage for permissions analysis module
The permissions module (crates/aquascope/src/analysis/permissions/) has four key files (context.rs, flow.rs, mod.rs, output.rs, utils.rs) but no corresponding test file in crates/aquascope/tests/. While boundaries.rs tests some behavior, explicit permissions analysis tests are missing, making it harder to validate permission flow and output correctness.
- [ ] Create crates/aquascope/tests/permissions.rs test file
- [ ] Create crates/aquascope/tests/permissions/ directory with .test files
- [ ] Add test cases for permission flows (mutable borrows, shared borrows, moves)
- [ ] Add test cases for context building with nested scopes
- [ ] Add test cases for output serialization (verify JSON/snapshot format)
- [ ] Test edge cases from context.rs and utils.rs (constraint satisfaction)
- [ ] Run 'cargo test --test permissions' to validate
🌿Good first issues
- Add comprehensive test coverage for permissions/output.rs: crates/aquascope/src/analysis/permissions/output.rs has no corresponding test file in crates/aquascope/tests/ — could create output_*.rs tests to cover permission serialization
- Document MIR location mapping with examples in ARCHITECTURE.md: ir_mapper/mir_locations.rs has complex location-tracking logic but ARCHITECTURE.md lacks concrete examples of how a source span maps through MIR to visualization coordinates
- Add boundary test cases for complex lifetime patterns: crates/aquascope/tests/boundaries/ only has add_ref.test visible; new tests for mutable borrows, nested scopes, or unsafe blocks would expand coverage of boundary detection
⭐Top contributors
Click to expand
Top contributors
- @willcrichton — 52 commits
- @gavinleroy — 46 commits
- @ZimengXiong — 1 commits
- @kianmeng — 1 commits
📝Recent commits
Click to expand
Recent commits
f2d0a06— v0.4.0 (#186) (willcrichton)4075125— Update to nightly-2026-05-01 (#185) (willcrichton)b625316— Duplicate icons (#173) (gavinleroy)7d7afc6— v0.3.8 (#172) (willcrichton)253dd53— Flag PathBoundaries with a IS_LHS boolean to control the MIR search. (#171) (gavinleroy)b160f13— v0.3.7 (#168) (willcrichton)c427d32— Vendor leader-line into repo, pulling upstream fix (#167) (willcrichton)ff77da8— v0.3.6 (#166) (willcrichton)be8bb51— Update to recent mdbook (#165) (willcrichton)52a6a4c— Update Installation with Proper Flags (#160) (ZimengXiong)
🔒Security observations
The codebase shows reasonable security practices overall, being a Rust compiler plugin/analysis tool. Primary concerns are the nightly compiler dependency pinned to a future date which creates maintenance risk, and the use of edition '2024' which is not yet released. No hardcoded secrets, SQL injection risks, XSS vulnerabilities, or infrastructure misconfigurations were identified in the visible files. The project uses standard Rust security tooling and has CI/CD workflows in place. Dependency management could be strengthened with automated vulnerability scanning.
- High · Nightly Rust Compiler Dependency with Fixed Date —
Cargo.toml (workspace.dependencies: rustc_plugin and rustc_utils). The workspace depends on nightly rustc_plugin and rustc_utils pinned to '=0.15.2-nightly-2026-05-01'. This creates a hard dependency on a specific nightly build from a future date (May 1, 2026), which may not exist or could be unmaintained. This approach is fragile and makes the crate difficult to build in the future. Fix: Use a more flexible versioning strategy for nightly dependencies. Consider using a version range or documenting the minimum nightly version required. Regularly update the nightly version to maintain compatibility with current Rust releases. - Medium · Missing Dependency Version Constraints —
Cargo.toml (workspace.dependencies: anyhow). The dependency 'anyhow' uses a loose version constraint '^1.0.0' which could allow vulnerable versions within the 1.x range. While this is common practice, it lacks explicit security monitoring. Fix: Use cargo-audit and cargo-deny to regularly scan dependencies for known vulnerabilities. Consider pinning to more specific minor versions after security review, or use a lockfile in CI/CD pipelines. - Medium · Edition Field Value '2024' May Be Invalid —
Cargo.toml (workspace.package: edition = '2024'). The workspace.package edition is set to '2024', but as of now, the latest stable Rust edition is 2021. This could indicate a future-dated configuration that may fail to compile or indicate confusion about the edition system. Fix: Set edition to a valid, released edition (2015, 2018, or 2021). Verify this is intentional or correct the value to match the project's actual Rust edition.
LLM-derived; treat as a starting point, not a security audit.
👉Where to read next
- Open issues — current backlog
- Recent PRs — what's actively shipping
- Source on GitHub
Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.