10-rust-core

Project rules for Rust coding conventions, build commands, testing, linting, and Android-target checks.

In plain words
What is it for?
Use them when changing the Rust core, running tests or Clippy, checking Android feature builds, or preparing code for CI.
Why use it?
They give contributors a consistent verification routine and help catch ordinary Rust errors and Android interface mismatches before code is committed.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/mannansaood/termi/10-rust-core
Clone the repo
git clone --depth 1 https://github.com/MannanSaood/termi

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,099 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.01099
Opus 5 $0.00000 $0.00549
Sonnet 5 $0.00000 $0.00220
Haiku 4.5 $0.00000 $0.00110

Measured yesterday against content hash bd1b13197fd6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

10-rust-core 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 yesterday.

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/10-rust-core.mdc · 88 lines

How it starts

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

Rust Core Conventions

Build/test commands — use these exact invocations

# Fast loop — no Android SDK/NDK required, this is what you should run
# after almost every change:
cd rust && cargo test

# Before committing, also verify the JNI-boundary code still type-checks
# (it won't *run* here, but a signature drift should be caught):
cd rust && cargo check --features android --all-targets

# Host `--features android` still uses *host* libc. ioctl request types
# and missing constants (TIOCGPTN) only fail on the Android target.
# Needs `rustup target add aarch64-linux-android`. No NDK required.
cd rust && cargo check --target aarch64-linux-android --features android --lib

# Full lint pass matching CI exactly:
cd rust && cargo clippy --all-targets -- -D warnings -D clippy::unwrap_used -D clippy::expect_used
cd rust && cargo clippy --features android -- -D warnings -D clippy::unwrap_used -D clippy::expect_used

If cargo test fails to build because it's trying to pull in the jni crate, check that you haven't accidentally added jni::-typed code (e.g. jni::sys::jlong) to a function outside a #[cfg(feature = "android")] block — see jni_safe.rs for the pattern of keeping handle-management logic host-testable while gating actual JNIEnv calls.

Module map

  • vfs/capabilities.rs — the capability model: what operations (chmod/symlink/rename/...) are supported per filesystem type, with human-readable reasons. Pure logic, no I/O.
  • vfs/provider.rs — the FsProvider trait every storage backend implements. chmod/symlink/readlink have default "not supported" implementations — only override them if the backend genuinely supports the operation (see InternalProvider for the real Unix implementation).
  • vfs/service.rsthe load-bearing piece. VfsService checks capabilities before dispatching to a provider and returns a VfsOutcome<T> (Ok / Blocked{reason,hint} / Degraded{value,caveat}) instead of a bare Result. Any new VFS operation should go through here, not directly through a provider, or the capability system silently stops applying to it.
  • vfs/health.rs — SAF permission health-check state machine (PermissionState, PermissionProbe trait, HealthMonitor). The actual Android-side probe isn't wired up yet — see the TODO in that file and in android/.../PermissionManager.kt.
  • jni_safe.rs — MANDATORY safety layer for all JNI calls. Never call raw JNIEnv methods outside this module's wrappers. Split into an always-compiled pure half and an android-feature-gated half — see the module doc comment for why.
  • utils/sync_ext.rsLockExt::lock_safe(): use this instead of .lock().unwrap() on any Mutex. See module doc for when NOT to use it (mutexes protecting real invariants, not just data buffers).

Read the full file on GitHub · 88 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. yesterday First seen · 88 lines · 0 tokens per session scan A bd1b13197fd6

Subscribe to this mod's changes

10-rust-core is a cursor rule published in the GitHub repository MannanSaood/termi (8 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,099 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.