architecture

A set of rules for organizing a software system into layers with fixed dependency directions. It defines a trip-building application whose core combines events, transport, and accommodation into travel packages.

In plain words
What is it for?
Use it to decide where domain logic, data sources, optional enrichment, orchestration, web pages, and MCP adapters belong.
Why use it?
It prevents higher-level delivery code from containing business rules and makes the core logic easier to test and keep predictable.

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

Made for: Cursor.

Per session 1,189 This file is loaded in full into every session.
When invoked 1,189 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.01189 $0.01189
Opus 5 $0.00594 $0.00594
Sonnet 5 $0.00238 $0.00238
Haiku 4.5 $0.00119 $0.00119

Measured 2d ago against content hash 27a83dcd244a, 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 2d 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/architecture.mdc · 93 lines

How it starts

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

Architecture and boundaries

Zaezd assembles a whole trip from a reason to travel. An event catalogue (confcal) says where and when, Tutu says how to get there and where to sleep, and a deterministic composer turns both into at most three explainable packages. Full specification in specs/02-arhitektura.md.

Layers

Dependencies point downward only. A module may import from its own layer and from lower layers, never from a higher one.

Layer Location Depends on Nature
L0 domain core src/composer/{types,dates,selection,feasibility,pricing,hotels,packages,checkout-labels}.ts nothing pure, deterministic, no I/O, no clock
L1 sources src/sources/{types,normalize,cache,replay,mcp-client,confcal,tutu}.ts L0 I/O, protocol, normalization
L2 enrichment src/enrich/{calendar,geo,weather}.ts L0, L1 optional, each with a timeout and a fallback
L3 orchestration src/composer/{build-trip,build-checkout,trip-id}.ts L0, L1, L2 fan-out, budgets, assembly
L4 delivery src/web/**, src/mcp/** L3 adapters, no business logic

Two consequences worth stating outright. Business rules never live in L4: if a price or a date is computed in a route handler or in a template, it is in the wrong file. And L0 is reachable by unit tests without a single mock, which is why it is where correctness is actually proven.

Fixed decisions

These were settled in the specs and reviewed twice. Do not relitigate them in code.

  • Gateway, not a direct browser connection. CORS blocks it, the Tutu manifest is about 25.5k tokens, and their responses arrive as a JSON string inside a text block with no outputSchema. Normalization happens in one place.
  • Three outward tools, not sixteen. find_event_trips, get_trip_details, create_trip_checkout. See @mcp-layer.mdc.
  • The web screen is primary, the MCP App is secondary. One client-side renderer serves GET / and ui://zaezd/trip-board. What is shared is the renderer, not a finished document: the web page gets the TripResult embedded by the server, the ui:// resource gets it from the host through ui/notifications/tool-result, because an MCP App resource loads independently of the tool call. If the renderer forks, both channels lose.
  • No server-side trip state. trip_id is a compact encoding of the request, not a key in a store. /t/:id recomputes or replays; switching packages is a choice among already computed ones.
  • Leaflet, not MapLibre. Raster tiles as plain img elements: no WebGL, no blob: workers, so the map survives a host CSP of default-src 'none' on a single img-src exception. Markers are L.divIcon with inline SVG, because Leaflet's stock CSS pulls its marker images by relative URL and they 404 once the CSS is inlined. Reasoning in docs/decisions.md.
  • In-memory cache with TTL plus file fixtures. Two modes only: live and replay. Recording is a script (scripts/record.ts), not a server mode.
  • One computed event per request. Up to five candidates are listed; only the first is assembled. A fan-out over five events is a spinner, not a product.
  • Deterministic dates in code. Three identical live runs produced three different night counts and a 1.5x price spread. The algorithm belongs in src/composer/dates.ts, never in a model prompt. See @composer-core.mdc.

Read the full file on GitHub · 93 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. 2d ago First seen · 93 lines · 1,189 tokens per session scan A 27a83dcd244a

Subscribe to this mod's changes

architecture is a cursor rule published in the GitHub repository EvilFreelancer/zaezd (1 stars, last pushed 13d ago), licensed MIT. It adds 1,189 tokens to every session, about $0.0059 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.