Motia Agent Architecture Guide
Expert Aider configuration for autonomous browser-control engine projects powered by Motia framework and Google ADK Computer Use capabilities.
Overview
This skill configures Aider to work with high-performance, autonomous browser-control systems built on the Motia architecture. It provides context-aware assistance for agent orchestration, durable backend patterns, and ADK integration.
Instructions
When working on Motia projects, follow these architectural principles and context loading patterns:
1. Context Loading Strategy
**Primary Reference:**
Always load `AGENTS.md` first - this is your project overview and navigation hubIt references all detailed implementation guides in `.cursor/rules/` and `.cursor/architecture/`**Load Additional Context As Needed:**
When working on specific features, uncomment relevant guides:
**API Development:** `.cursor/rules/motia/api-steps.mdc`**Event Handling:** `.cursor/rules/motia/event-steps.mdc`**Scheduled Tasks:** `.cursor/rules/motia/cron-steps.mdc`**State Management:** `.cursor/rules/motia/state-management.mdc`**Middleware Patterns:** `.cursor/rules/motia/middlewares.mdc`**Real-time Streaming:** `.cursor/rules/motia/realtime-streaming.mdc`**Virtual Steps:** `.cursor/rules/motia/virtual-steps.mdc`**UI Integration:** `.cursor/rules/motia/ui-steps.mdc`**System Architecture:** `.cursor/architecture/architecture.mdc`**Error Handling:** `.cursor/architecture/error-handling.mdc`2. Core Architectural Principles
**Agent Orchestration:**
Design agents as autonomous, durable unitsFollow separation of concerns (API, events, cron, state)Use step-based composition patternsImplement proper error boundaries**Backend Durability:**
Maintain persistent state across operationsDesign for fault tolerance and recoveryUse appropriate retry mechanismsLog comprehensively for debugging**Computer Use Integration:**
Leverage Google ADK native capabilitiesFollow ADK best practices for browser controlOptimize for performance and reliabilityHandle visual feedback appropriately3. Model Selection
Choose appropriate model based on task complexity:
```yaml
For complex architectural changes:
model: claude-3-5-sonnet-20241022
For standard feature development:
model: gpt-4
```
4. Development Workflow
**When Starting Work:**
1. Read `AGENTS.md` to understand project structure
2. Identify relevant subsystem (API, events, cron, etc.)
3. Load specific guide files for that subsystem
4. Review architecture patterns before implementing
5. Follow error handling conventions
**When Making Changes:**
Respect existing patterns in AGENTS.md referencesMaintain consistency with guide specificationsUpdate tests alongside implementationDocument significant architectural decisions**Optional - Enable Auto-commits:**
```yaml
auto-commits: true
```
5. Key File References
Always consider these project essentials:
`AGENTS.md` - Central architecture guide`.cursor/rules/motia/*` - Implementation patterns`.cursor/architecture/*` - System design docs`config.yml` - Project configuration`package.json` - Dependencies and scripts6. Code Quality Standards
Follow TypeScript best practicesUse strong typing throughoutImplement proper error handling (see error-handling.mdc)Write comprehensive testsDocument complex logicMaintain clean separation of concerns7. Browser Automation Best Practices
Use ADK Computer Use capabilities efficientlyHandle asynchronous operations properlyImplement proper timeout handlingOptimize for reliability over speedAdd visual feedback for user actionsLog browser interactions for debuggingExample Usage
Initial Setup
```yaml
.aider.conf.yml
read:
- AGENTS.md
model: claude-3-5-sonnet-20241022
```
Working on API Features
```yaml
read:
- AGENTS.md
- .cursor/rules/motia/api-steps.mdc
- .cursor/rules/motia/state-management.mdc
- .cursor/architecture/error-handling.mdc
```
Working on Event System
```yaml
read:
- AGENTS.md
- .cursor/rules/motia/event-steps.mdc
- .cursor/rules/motia/middlewares.mdc
- .cursor/architecture/architecture.mdc
```
Full Context Mode
```yaml
read:
- AGENTS.md
- .cursor/rules/motia/api-steps.mdc
- .cursor/rules/motia/event-steps.mdc
- .cursor/rules/motia/cron-steps.mdc
- .cursor/rules/motia/state-management.mdc
- .cursor/rules/motia/middlewares.mdc
- .cursor/rules/motia/realtime-streaming.mdc
- .cursor/rules/motia/virtual-steps.mdc
- .cursor/rules/motia/ui-steps.mdc
- .cursor/architecture/architecture.mdc
- .cursor/architecture/error-handling.mdc
- config.yml
- package.json
```
Important Notes
**AGENTS.md is your single source of truth** - it references all other guidesLoad additional guides incrementally as needed to avoid context overflowFollow the step-based architecture patterns consistentlyRespect the durable backend design principlesAlways implement proper error handlingTest autonomous agent behavior thoroughlyDocument complex browser automation logicConstraints
Must maintain backwards compatibility with existing Motia patternsFollow ADK Computer Use API specifications strictlyRespect project-specific conventions in AGENTS.mdUse TypeScript for all new codeMaintain test coverage for critical pathsDocument breaking changes clearly