20-android-kotlin

A set of Android and Kotlin development instructions for a project that also contains Rust code. It explains how to handle Kotlin when Android build tools may not be available and how Kotlin connects to Rust through JNI, a bridge between languages.

In plain words
What is it for?
Use it when changing Kotlin, Android build files, or the Kotlin-to-Rust connection in this project.
Why use it?
It makes the limits of automated Kotlin testing clear and helps prevent changes that conflict with the project's existing Android, Rust, or JNI interfaces.

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/20-android-kotlin
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 584 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.00584
Opus 5 $0.00000 $0.00292
Sonnet 5 $0.00000 $0.00117
Haiku 4.5 $0.00000 $0.00058

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

Security

Grade A, and why

20-android-kotlin 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 3d 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/20-android-kotlin.mdc · 60 lines

How it starts

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

Android / Kotlin Conventions

Important limitation for AI agents in this repo

There is no Android SDK/NDK available in most sandboxed dev environments (including the one this codebase was originally scaffolded in). Kotlin code in this repo has generally not been compiled or run by an AI agent — only reviewed for logical consistency. Treat Kotlin changes as higher-risk than Rust changes until a human (or a properly configured Gradle environment) actually builds and runs them. Say so explicitly if you're generating Kotlin you haven't been able to compile.

If Gradle/Android SDK is available in your environment, prefer to actually run:

cd android && ./gradlew testDebugUnitTest
cd android && ./gradlew lint

before considering a Kotlin change complete.

JNI boundary

All calls into the Rust core must go through the existing JNI method signatures — check rust/src/android_jni.rs for the authoritative list of exported functions before assuming a new one is needed. If a new Rust capability needs exposing to Kotlin (e.g. VfsService/HealthMonitor aren't wired up to JNI yet — see docs/PHASE1_STATUS.md), that JNI export needs to be added on the Rust side first, following the jni_safe.rs wrapper pattern, before Kotlin can call it.

Known scaffold TODOs (Phase 1, not yet built)

  • PermissionManager.kt — needs a checkHealth()-style method feeding the Rust PermissionProbe trait (rust/src/vfs/health.rs). See the TODO block already in that file.
  • CommandToolbar.kt — Esc/Home/End buttons added; still needs sticky-Ctrl modifier and swipe-based history cycling. See the TODO block in that file and .cursor/skills/add-keyboard-toolbar-gesture/SKILL.md.
  • Package manager UI has no corresponding Kotlin screen yet — Rust-side package/manager.rs and package/repository.rs are scaffolding only.

Don't silently "complete" these without flagging that they're new functionality, since they touch the JNI boundary and permission model — get a look from whoever owns this repo before merging.

Read the full file on GitHub · 60 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. 3d ago First seen · 60 lines · 0 tokens per session scan A e57988534ba7

Subscribe to this mod's changes

20-android-kotlin is a cursor rule published in the GitHub repository MannanSaood/termi (8 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 584 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.