Shifting from treating an AI session like a pair-programming assistant to orchestrating isolated Android agents, guardrails, and review bottlenecks.

Most Android developers have figured out how to brief a single AI session. We write a prompt outlining a feature, generate a ViewModel or a Jetpack Compose screen, and inspect the resulting diff. That loop feels fast compared to writing every character by hand, but it represents the baseline of agentic development, not the ceiling.
The real operational shift happens when you stop operating like a senior engineer micromanaging a single terminal and start operating like a Tech Lead coordinating a team of specialized agents. In a modern workflow, one agent might be building out a Navigation 3 feature flow, another is running UI flows on an Android Emulator or verifying Roborazzi screenshot tests, a third handles a complex Gradle library migration in an isolated branch, while a background reviewer audits an incoming pull request.
Managing multiple autonomous agents is a completely different engineering discipline from writing Kotlin code yourself. Without strict architectural guardrails, isolated working trees, and explicit human review limits, running parallel sessions quickly devolves into constant merge conflicts and subtle bugs slipping into your codebase. Structuring your Android development environment with clear boundaries allows you to effectively lead the team instead of becoming its bottleneck.
Encode Your Architecture in a Repository Constitution (AGENTS.md / CLAUDE.md)
Relying on manual prompt instructions to enforce architectural preferences fails as soon as you run multiple sessions in parallel. As conversation contexts reset or specialized subagents spin up, human developers inevitably forget to re-specify critical design constraints, causing agents to fall back on generic patterns found in their training data.
The solution is to maintain a single root configuration (typically named AGENTS.md or CLAUDE.md) that serves as clear team policy rather than personal setup. Coding agents read this file automatically upon starting work, making it the ideal repository location to codify non-negotiable standards: Unidirectional Data Flow (UDF), pure Jetpack Compose with state hoisting, Navigation 3 type-safe serializable routes, Koin dependency injection rules, and strict rules against passing Context or using GlobalScope in ViewModels.
Here is a comprehensive repository constitution optimized for modern Android projects:
# Repository Constitution for AI Coding Agents
## Core Architecture & Patterns
- Architecture: Layered feature modules with Unidirectional Data Flow (UDF).
- UI Layer: Pure Jetpack Compose. No legacy Views, ViewBinding, or XML layouts.
- Dependency Injection: Koin (use `koinViewModel()`, avoid field injection).
- Async & State: Kotlin Coroutines & `StateFlow`. Never use `GlobalScope` or `LiveData`.
- Navigation: Jetpack Navigation 3 with type-safe serializable route objects.
## Coding Standards & State Management
- State Hoisting: Composables MUST receive immutable State objects and lambda event callbacks (`onEvent: (UiEvent) -> Unit`).
- ViewModels: Expose state via a single `StateFlow<UiState>`. No public mutable variables or raw `SharedFlow` for one-off events.
- Memory Rules: NEVER pass an Android `Context`, View, or Activity reference into a ViewModel or Domain UseCase.
## Git & Workflow Conventions
- Branching: Use feature-based branches (e.g., `feature/profile-screen`).
- Commits: Follow conventional commits style (`feat:`, `fix:`, `refactor:`).
Centralize Dependencies and Enforce Strict Module Boundaries
Multi-agent workflows quickly stall when build configurations are ambiguous or when feature modules leak responsibilities into one another. If library versions are scattered or module boundaries are loosely defined, parallel agents will inevitably introduce conflicting dependencies or invalid cross-module references.
To prevent this, maintain gradle/libs.versions.toml as the strict single source of truth for all project dependencies and enforce multi-module boundaries (such as :core:ui, :core:domain, :core:model, and :feature:*). When modules are clearly isolated without complex abstraction layers, agents working on separate tasks cannot inadvertently alter public API contracts or introduce version mismatches.
Define Contracts, Roles, and Edge Cases Before Spawning Agents
A Tech Lead never hands out a vague assignment like “build the user settings screen” and hopes for clean execution. Before letting an agent write implementation code, establish clear operational parameters to eliminate ambiguity upfront.
First, mandate mutually exclusive sealed UI states (such as Loading, Content, and Error) rather than separate boolean flags like isLoading = true and isError = true, ensuring impossible UI states cannot exist. Second, define domain repository interfaces and explicit user intent models before touching ViewModel or Composable layers. Third, outline edge cases directly in the initial brief: including offline handling, empty state rendering, retry triggers, and Navigation 3 argument parsing.
Finally, store reusable specialized subagent role files (such as .claude/agents/android-reviewer.md or .claude/agents/compose-qa.md) with restricted tool permissions. This structure allows dedicated testing or review agents to inspect diffs and execute Gradle verification commands without accidentally modifying production source files. An example here:
# Role: Senior Android Code Reviewer
## Objective
You are an expert Android Tech Lead reviewing a pull request.
Your goal is to ensure all code changes strictly adhere to the repository's architectural constitution, performance standards, and memory safety rules.
## STRICT TOOL PERMISSIONS (READ-ONLY MODE)
- **ALLOWED:** Read files, search codebase, run `./gradlew detekt`, run `./gradlew lint`.
- **FORBIDDEN:** Edit, create, or delete any production source files.
- **ACTION:** If you find a fixable error, DO NOT fix it yourself. Document it in your review report for the primary coding agent or human developer to fix.
## Review Rubric
Evaluate the diff against the following non-negotiable rules:
1. **Architecture & UI:**
- Is the UI built with pure Jetpack Compose? (Reject any XML/ViewBinding).
- Does it follow Unidirectional Data Flow (UDF)?
2. **State Management:**
- Are UI states represented by a `sealed interface`? (Reject multiple boolean flags like `isLoading`/`isError`).
- Is state hoisted correctly? (Composables must take immutable state and lambda callbacks).
3. **Concurrency & Memory:**
- Are ViewModels using `StateFlow`? (Reject `LiveData` or raw `SharedFlow` for state).
- Is `GlobalScope` used anywhere? (Reject immediately).
- Is an Android `Context`, `Activity`, or `View` leaked into a ViewModel or UseCase? (Reject immediately).
4. **Navigation:**
- Are routes using the new type-safe Navigation 3 serializable objects?
## Output Format
You must output your review in the following exact Markdown format:
### 📋 Review Summary
[1-2 sentence summary of the PR's intent]
### 🚨 Critical Issues (Must Fix)
- [List any violations of the Review Rubric. Explain *why* it violates the rule and *how* to fix it.]
### ⚠️ Warnings & Suggestions
- [List minor issues, performance concerns like missing `remember` or unnecessary recompositions, or naming conventions.]
### ✅ Verdict
[State clearly: **APPROVE**, **REQUEST CHANGES**, or **NEEDS HUMAN DISCUSSION**]
Isolate Worktrees and Know When to Fork vs. Spawn
Running multiple agent sessions in the same git working directory is not parallel execution, it is a race condition that leads to state corruption. Concurrent agents editing shared files in a single checkout will overwrite each other’s changes and break build outputs.
Leveraging Git worktrees (such as claude — worktree) ensures every feature, bugfix, or migration run occupies its own isolated directory and branch without impacting your main workspace. When orchestrating these sessions, choose the right execution path based on task dependencies:
Fork a session when a new task depends directly on context already established, such as drafting unit tests for a newly implemented repository or seeking a second opinion on a Compose refactor. Conversely, spawn a completely separate session in its own worktree for independent work (such as executing UI flows on an Android Emulator or running a library upgrade) so unrelated contexts remain clean.
To support lateral communication between agents, avoid acting as a human bridge passing messages between terminals. When a domain schema or shared interface changes, instruct one session to message its sibling session directly (using @session-name or SendMessage) so information updates automatically across branches.
Replace Manual Review Loops with Fast, Deterministic Verification
Manually inspecting hundreds of lines of generated Jetpack Compose UI and coroutine logic is tedious and prone to oversight. It is easy to miss subtle performance issues like missing recomposition keys or unhandled coroutine cancellations during manual visual checks.
Instead, establish automated CLI verification checks that agents must execute independently prior to marking tasks as complete:
+-----------------------------------------------------------------------+
| Agent Execution Cycle |
|---|---------------+--------------------------------|------------|
| 1. Write Code ---> 2. Run Gradle Verification ---> 3. Inspect Failure |
| | | |
| +----------- (Passes) -----------+ |
| | |
| v |
| 4. Submit Clean PR |
+-----------------------------------------------------------------------+
Require agents to execute the following verification steps in sequence:
Rather than waiting for a human review to catch build failures or missing test cases, agents should autonomously run targeted unit tests using ./gradlew :feature:profile:testDebugUnitTest to ensure ViewModel state flows and domain rules hold up under change. Visual UI regressions can be caught just as early by verifying Compose Previews with Roborazzi via ./gradlew :feature:profile:verifyRoborazziDebug across different themes and font scales.
Finally, static analysis rules enforced through ./gradlew detekt ensure code style standards and coroutine safety guidelines remain intact across all generated diffs. Requiring agents to complete this automated verification sequence independently guarantees that only build-verified, clean changes are submitted for your inspection.
Incorporate this explicit verification pattern directly into your prompt instructions:
After generating or modifying code, execute the following verification suite:
1. ./gradlew :feature:profile:testDebugUnitTest
2. ./gradlew :feature:profile:verifyRoborazziDebug
3. ./gradlew detekt
If any step fails, analyze the output, fix the underlying issue, and rerun the checks until the build succeeds before reporting completion.
Respect the Real Bottleneck: Your Own Review Capacity
When teams first transition from a single session to managing multiple parallel agents, overall output often decreases initially because developers become overwhelmed by reviewing incoming diffs. Skimming four pull requests in a hurry instead of thoroughly inspecting one is how subtle bugs (such as broken retry logic or unhandled scope cancellations) reach production.
Managing an agent workflow effectively requires active oversight strategy:
Effective oversight starts by maintaining high-level visibility across your environment. Monitor active instances centrally using dashboard commands like claude agents to spot and unblock stuck prompts early, and trigger automated background code reviews via /code-review in fresh context windows uninfluenced by initial feature generation.
Crucially, cap your active sessions to the number of pull requests you can comfortably evaluate in a day. When an agent drifts off course, resist the urge to engage in extended inline chat corrections; rewinding to an earlier checkpoint and refining your initial brief is far more efficient.
A Realistic End-to-End Android Workflow
Here is how this structured approach functions in practice when delivering an Android feature. Rather than a flat checklist, think of it as orchestrating four distinct phases:
Phase 1: Setup & Delegation
- Triage & Brief: Inspect the task board and initialize an isolated Git worktree. Brief the primary “Builder” agent with explicit UDF contracts, sealed UI state models, and the repository constitution.
Phase 2: Parallel Execution
- Fork Unit Tests: Spin off a child session to draft domain unit tests in parallel with the main implementation.
- Sync Sideways: Allow the Builder and Tester sessions to exchange API updates directly via inter-session messaging, keeping interfaces aligned without you acting as a human bridge.
Phase 3: Automated Verification
- Run the Gauntlet: Once the code is written, trigger a dedicated background session to execute the automated verification suite (Roborazzi, emulator tests, and Detekt).
- Independent Review: Simultaneously, execute the specialized android-reviewer subagent in a fresh context to audit the diff for architectural violations.
Phase 4: Human Sign-off
- Final Inspection: Review the automated verification logs and the reviewer agent’s summary. Perform a final manual sanity check on the diff before merging.
Conclusion
The era of treating AI as a simple autocomplete or a junior pair-programmer is over. As Android engineers, our day-to-day reality is shifting towards acting as Tech Leads, orchestrating a team of specialized, autonomous agents.
This shift allows us to intelligently parallelize feature development across isolated worktrees and strict architectural guardrails. More importantly, it lets us delegate the repetitive but necessary processes (unit tests, screenshot regressions, static analysis, and first-pass code reviews) so they happen automatically on every single code change.
By establishing clear rules, modular boundaries, and strict human review limits, you create a scalable workflow that amplifies your engineering judgment without sacrificing code quality. You stop being the bottleneck, and start being the architect.
If you found this deep dive helpful, feel free to follow me for more content on Android development, Jetpack Compose, and modern engineering workflows. Let me know your thoughts or reach out to me on Bluesky or LinkedIn
I’d love to hear how you are orchestrating your AI agents!
Have a great day, and happy coding!
How to Direct AI Coding Agents Like a Tech Lead in Modern Android Development was originally published in ProAndroidDev on Medium, where people are continuing the conversation by highlighting and responding to this story.