compose-architecture

compose-architecture is a cursor rule for coding agents from RoninForge/roninforge-kotlin-compose. It costs 0 tokens per session (1,495 once invoked), scanned A, original, MIT.

A set of rules for organizing Android apps into separate feature and shared modules. It also describes how repositories, data sources, screen state, network calls, local storage, and background tasks should fit together.

In plain words
What is it for?
Use it when planning or implementing multi-screen Android apps with separate features, remote APIs, Room databases, ViewModels, and Kotlin coroutines.
Why use it?
It provides a consistent way to keep screens, business logic, network access, and databases from becoming tangled. This makes larger Android projects easier to change and maintain.

Cursor rule

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/roninforge/roninforge-kotlin-compose/compose-architecture
Clone the repo
git clone --depth 1 https://github.com/RoninForge/roninforge-kotlin-compose

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for compose-architecture

README.md
[![agentmods](https://agentmods.dev/badge/rules/roninforge/roninforge-kotlin-compose/compose-architecture.svg)](https://agentmods.dev/rules/roninforge/roninforge-kotlin-compose/compose-architecture)
Your own site
<a href="https://agentmods.dev/rules/roninforge/roninforge-kotlin-compose/compose-architecture"><img src="https://agentmods.dev/badge/rules/roninforge/roninforge-kotlin-compose/compose-architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,495 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.01495
Opus 5 $0.00000 $0.00747
Sonnet 5 $0.00000 $0.00299
Haiku 4.5 $0.00000 $0.00150

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

Security

Grade A, and why

compose-architecture scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

val fresh = remote.fetch(id)
rules/compose-architecture.mdc · 209 lines

How it starts

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

Android Architecture

Modularization

app/                            // app entry, nav graph
build-logic/                    // convention plugins (optional)
core/
  designsystem/                 // theme, tokens, shared composables
  domain/                       // pure Kotlin business types, no Android deps
  data/                         // repositories, data sources
  network/                      // Ktor / Retrofit setup
  database/                     // Room entities, DAOs
feature/
  home/                         // self-contained screen modules
  profile/
  settings/

Each feature module exposes a Route composable and a nav declaration. The app module wires them into the nav graph.

Repository pattern

// feature/profile/data/ProfileRepository.kt
interface ProfileRepository {
    suspend fun getUser(id: String): User
    fun observeUser(id: String): Flow<User>
}

class DefaultProfileRepository @Inject constructor(
    private val remote: ProfileRemoteDataSource,
    private val local: ProfileLocalDataSource,
) : ProfileRepository {

    override suspend fun getUser(id: String): User {
        val cached = local.get(id)
        if (cached != null) return cached
        val fresh = remote.fetch(id)
        local.put(fresh)
        return fresh
    }

    override fun observeUser(id: String): Flow<User> = local.observe(id)
}

Rules:

  • Repository is an interface; bind the default via Hilt.
  • Data sources are package-private inside the data module - the repo is the only public contract.
  • Suspend functions for one-shot reads, Flow<T> for observable streams.

ViewModel patterns

@HiltViewModel
class ProfileViewModel @Inject constructor(
    private val repo: ProfileRepository,
    savedState: SavedStateHandle,
) : ViewModel() {

    private val args = savedState.toRoute<Profile>()

    val state: StateFlow<ProfileUiState> = repo.observeUser(args.userId)
        .map { ProfileUiState.Success(it) as ProfileUiState }
        .catch { emit(ProfileUiState.Error(it.message ?: "Unknown")) }
        .stateIn(
            scope = viewModelScope,
            started = SharingStarted.WhileSubscribed(5_000),
            initialValue = ProfileUiState.Loading,
        )

    fun onIntent(intent: ProfileIntent) {
        when (intent) {
            ProfileIntent.Refresh -> viewModelScope.launch { repo.refresh(args.userId) }
        }
    }
}

Read the full file on GitHub · 209 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 · 209 lines · 0 tokens per session scan A d7bfa4cd49d5

Subscribe to this mod's changes

compose-architecture is a cursor rule published in the GitHub repository RoninForge/roninforge-kotlin-compose (1 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,495 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.