architecture

An architecture guide for Motia projects, a framework that discovers workflow steps from project files. It describes organizing API endpoints, event handlers, scheduled tasks, business logic, data access, and utilities under /src or /steps.

In plain words
What is it for?
Use it when deciding where to put Motia steps and supporting code, including APIs, event handlers, scheduled jobs, services, repositories, and utilities.
Why use it?
It gives a consistent place for each kind of code, making a Motia project easier to understand and maintain.

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/crypticsaiyan/githubwrapped/architecture
Clone the repo
git clone --depth 1 https://github.com/crypticsaiyan/githubwrapped

Made for: Cursor.

Per session 1,351 This file is loaded in full into every session.
When invoked 1,351 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.01351 $0.01351
Opus 5 $0.00675 $0.00675
Sonnet 5 $0.00270 $0.00270
Haiku 4.5 $0.00135 $0.00135

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

Security

Grade A, and why

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

.cursor/architecture/architecture.mdc · 193 lines

How it starts

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

Architecture Guide

Overview

This guide covers the architecture and best practices for structuring Motia projects.

Key Takeaway: Motia automatically discovers steps from anywhere in your project. Modern projects use /src for a familiar structure that works seamlessly with Domain-Driven Design.

File Structure

Motia automatically discovers step files from your project. You can organize steps in either:

  • /src folder (recommended) - Familiar pattern for most developers
  • /steps folder - Traditional Motia pattern
  • Both folders simultaneously

Recommended Structure (using /src)

project/
├── src/
│   ├── api/           # API endpoints
│   │   ├── users.step.ts
│   │   └── orders.step.ts
│   ├── events/        # Event handlers
│   │   ├── order-processing.step.ts
│   │   └── notifications.step.ts
│   ├── cron/          # Scheduled tasks
│   │   └── cleanup.step.ts
│   ├── services/      # Business logic
│   ├── repositories/  # Data access
│   └── utils/         # Utilities
└── motia.config.ts

Alternative Structure (using /steps)

project/
├── steps/
│   ├── api/
│   │   └── users.step.ts
│   ├── events/
│   │   └── order-processing.step.ts
│   └── cron/
│       └── cleanup.step.ts
├── src/
│   ├── services/
│   └── utils/
└── motia.config.ts

Create subfolders within your chosen directory to organize related steps into logical groups (domains, features, or flows).

Why /src is recommended:

  • Familiar to developers from other frameworks (Next.js, NestJS, etc.)
  • Natural co-location with services, repositories, and utilities
  • Works seamlessly with Domain-Driven Design patterns
  • Cleaner project root with fewer top-level folders

Step Naming Conventions

Typescript

  • Use kebab-case for filenames: resource-processing.step.ts
  • Include .step before language extension

Python

  • Use snake_case for filenames: data_processor_step.py
  • Include _step before language extension

Global

  • Match handler names to config names
  • Use descriptive, action-oriented names

Read the full file on GitHub · 193 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 · 193 lines · 1,351 tokens per session scan A 1765f8cf9285

Subscribe to this mod's changes

architecture is a cursor rule published in the GitHub repository crypticsaiyan/githubwrapped (5 stars, last pushed 8mo ago), licensed MIT. It adds 1,351 tokens to every session, about $0.0068 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.