cursorrules

Project rules for a cross-platform terminal emulator with a Rust core, Android code, and bridges between native and platform code.

In plain words
What is it for?
Use them when changing the terminal emulator, especially code that crosses Rust and Android, accesses virtual files, or handles process state.
Why use it?
They give coding agents safety requirements for JNI, file operations, process sessions, and platform-specific behavior.

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/cursorrules
Clone the repo
git clone --depth 1 https://github.com/MannanSaood/termi

Made for: Cursor.

Per session 922 This file is loaded in full into every session.
When invoked 922 The same file — it is already loaded in full.
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.00922 $0.00922
Opus 5 $0.00461 $0.00461
Sonnet 5 $0.00184 $0.00184
Haiku 4.5 $0.00092 $0.00092

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

Security

Grade A, and why

cursorrules 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.

.cursorrules · 100 lines

How it starts

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

Next-Gen Terminal Project Rules

Project Context

This is a cross-platform terminal emulator with:

  • Rust core (PTY, VFS, ANSI parsing)
  • Android: Kotlin + Jetpack Compose
  • iOS (future): Swift + SwiftUI
  • JNI/FFI bridges between native and platform code

Architecture

  • Rust core is platform-agnostic
  • Platform-specific code in android/ and ios/
  • VFS abstracts over Android SAF and iOS file picker
  • Session state tracks process lifecycle

Critical Safety Rules

JNI Safety (MANDATORY)

  1. NEVER use unwrap() in JNI boundary code
  2. ALWAYS check for JNI exceptions after call_method():
   if env.exception_check().unwrap_or(false) {
       env.exception_describe().ok();
       env.exception_clear().ok();
       return error_code;
   }
  1. ALWAYS validate handles before dereferencing
  2. Use safe wrappers from rust/src/jni_safe.rs
  3. Return error codes, never panic across FFI

VFS Safety (MANDATORY)

  1. ALWAYS check capabilities before operations:
   if !vfs.supports(path, VfsOperation::Chmod) {
       // Handle gracefully
   }
  1. Warn users about SAF limitations in UI
  2. Cache metadata to avoid slow ContentResolver calls
  3. Batch operations when possible

Session State (MANDATORY)

  1. Track session state everywhere (Active/Checkpointed/Restored/Failed)
  2. Checkpoint state periodically and on background
  3. Show state clearly in UI
  4. Design for "expect to die" not "hope to survive"

Code Style

  • Rust: Follow rustfmt defaults
  • Kotlin: Follow ktlint defaults
  • Error handling: Use Result<T, E>, not panic
  • Logging: Use log crate (Rust) and Timber (Android)

Documentation

  • Reference docs/LIMITATIONS.md for constraints
  • All public functions need doc comments
  • Explain WHY not just WHAT in complex code

Testing

  • Unit tests for all core logic
  • JNI safety tests mandatory
  • Test on Samsung/Xiaomi devices before claiming stability

When Suggesting Code

  • Show complete examples with error handling
  • Use safe patterns from jni_safe.rs
  • Explain Android/iOS platform differences
  • Point out performance implications

Read the full file on GitHub · 100 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 · 100 lines · 922 tokens per session scan A 15adc7dfef5a

Subscribe to this mod's changes

cursorrules is a cursor rule published in the GitHub repository MannanSaood/termi (8 stars, last pushed yesterday), licensed MIT. It adds 922 tokens to every session, about $0.0046 per session on Opus 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-08-31.