# Project rules & context

> Anchor brand voice, domain terminology, pricing invariants, and non-goals in persistent project context so every future turn stays consistent without repetition.

- Canonical: https://exaspark.ai/docs/project-instructions/

## Why context drifts across long builds

On turn one, your product rules are fresh. By turn thirty — after adding member profiles, promo codes, an admin export view, and mobile polish — subtle inconsistencies start creeping in.

A new checkout screen says `"customers"` when the rest of your studio says `"members"`. A freshly added cancellation button forgets your 12-hour cutoff. A pricing card switches from calm editorial copy to hype marketing clichés.

Repeating five paragraphs of preferences in every prompt wastes time and clutters intent. Store enduring rules inside persistent project artifacts that the Agent reads alongside your live codebase on every turn.

## Four layers of persistent project context

ExaSpark grounds every turn in live project truth rather than fragile chat summaries alone. Combining four lightweight layers gives you stronger, versioned continuity than a flat notes box.

| Context layer | What it governs | Where it lives | When to update |
| --- | --- | --- | --- |
| **Project rules brief (`PROJECT_RULES.md`)** | Brand tone, domain glossary, pricing invariants, and non-goals | Versioned Markdown file in your project (**Code** tab or Desktop folder) | Whenever pricing, policies, terms, or scope change |
| **Adopted design tokens** | Palette, type scale, spacing rhythm, and surface rules | Locked on **Design Canvas** and compiled into app styles | Before major brand or visual refreshes |
| **Live Cloud schema & roles** | Table names, relationships, statuses, and server permissions | Isolated **Preview** and **Live** Cloud configuration | Whenever core entities or user tiers evolve |
| **Reference attachments** | Logos, product photos, menus, wireframes, and policy PDFs | Attached via **+** in chat and stored in project assets | When new photography or policies arrive |

Because `PROJECT_RULES.md` lives inside your repository alongside your code, it rolls back cleanly with **Undo** checkpoints, travels cleanly with **Official GitHub App** exports, and stays directly editable in **Web Studio** or the **Desktop App**.

## What belongs in your project rules brief

Keep your rules file under 100 concise lines so every invariant stays unmistakable instead of getting buried in narrative prose.

### Brand voice and domain glossary

Define how your product speaks and list exact vocabulary pairs to stop generic phrasing from leaking into specialized screens.

- **Tone boundaries.** State 2–3 crisp cues: `"Calm, warm, direct. Zero exclamation marks, button emojis, or fake urgency banners."`
- **Terminology pairs.** Specify `"Use 'Practitioner' (never 'Doctor'); use 'Session' (never 'Order'); use 'Studio Credit' (never 'Coins')."`
- **Formatting standards.** Lock currency (`$45` vs `$45.00`), timezone, and date formatting (`Oct 14, 2026`) across screens and emails.

### Pricing, billing, and business invariants

Document rules that must never silently break when new screens arrive.

- **Payment outcomes.** State exact prices, intervals, refund windows, and what unlocks immediately after Stripe confirmation.
- **Role fences.** Write one sentence per role defining who views, edits, refunds, or exports records, reinforcing server-side checks in **Cloud**.
- **Edge-case math.** Capture cancellation cutoffs, waitlist capacity rules, and tax-inclusive vs tax-exclusive labels explicitly.

### Hard non-goals and audience priorities

Telling the Agent what *not* to build prevents over-engineering. Name explicit scope fences (`"No public member feed"`, `"No guest checkout"`, `"No dark mode in v1"`), visual rules (`"Flat single-plane cards; no nested wrappers or decorative pills"`), and primary device context (`"Instructors check rosters on 390px phones between classes"`).

## Copyable project rules template

Ask the Agent to save an adapted version of this brief as `PROJECT_RULES.md` in your project root.

```text
# Project Rules — Northside Pilates Studio

## Brand Voice & Formatting
- Tone: Warm, calm editorial English. Concise labels, zero hype or emojis.
- Dates: "Thu, Oct 15 · 6:30 PM" (America/Chicago). Currency: USD ($32).

## Strict Domain Glossary
- Use "Member" (never "Customer", "Client", or "User" in UI copy).
- Use "Class" (never "Event" or "Appointment").
- Use "Class Pack" / "Unlimited Membership" (never "Plan" or "Bundle").

## Business & Payment Invariants
- Visitors browse schedules signed out; booking requires Google or email sign-in.
- Cancellation cutoff: free up to 12 hours before class; late cancels forfeit credit.
- Pricing: Drop-in $32, 5-Class Pack $145, Unlimited $169/mo via Stripe checkout.
- Roles: Members cancel own bookings; Instructors check in assigned rosters;
  only Admins edit schedules, prices, or refunds.

## UI Guardrails & Non-Goals
- Follow locked Design Canvas tokens (alabaster canvas, forest ink, flat hairlines).
- Single-column mobile forms, >= 16px inputs, >= 44px tap targets.
- Non-goals: no social feed, no guest checkout, no multi-currency switching in v1.
```

## Setting up and evolving project rules

Treat your rules brief as a living one-page contract that evolves cleanly alongside your product milestones.

1. **Create the brief after turn one** — Once your initial direction or MVP runs cleanly, ask the Agent to create `PROJECT_RULES.md` capturing tone, glossary, pricing, roles, and non-goals.
2. **Anchor major turns to it** — When adding a new surface such as referrals or admin billing, add one line: `"Follow PROJECT_RULES.md for terminology, roles, and visual rules."`
3. **Update rules alongside business pivots** — Whenever you change a price, role, or cutoff window, update `PROJECT_RULES.md` in the same turn so docs and code never diverge.
4. **Audit for drift every 10–15 turns** — Periodically ask the Agent to scan all pages, buttons, and emails against `PROJECT_RULES.md` and resolve mismatches.
5. **Prune outdated notes aggressively** — Delete superseded experiments so every line reflects active production truth.

Initialize a clean rules file from an existing app without modifying working features:

> **Example prompt (App):** Create a concise PROJECT_RULES.md in the project root capturing our brand tone, strict domain vocabulary, user roles, Stripe pricing rules, layout guardrails, and explicit non-goals. Inspect existing screens and Cloud tables first so every line matches live behavior, and do not change application code in this turn.

Before a major launch, run a targeted consistency sweep across screens and emails:

> **Example prompt (Web):** Audit all public pages, checkout modals, member screens, and email templates against PROJECT_RULES.md. Fix any terminology drift, inconsistent date or currency formatting, or missing cancellation notices while keeping existing Cloud schemas, sign-in rules, and Stripe handlers unchanged.

> **Note:** Keep `PROJECT_RULES.md` focused on stable product rules, not a turn-by-turn changelog. Your chat history and checkpoints already record past edits; this brief governs how future turns behave.

## Common context mistakes and fixes

Diagnose and repair persistent context issues cleanly using this reference table.

| Symptom | Root cause | Clean fix |
| --- | --- | --- |
| **Agent misses a rule in a 400-line file** | Critical invariants are buried in long narrative paragraphs | Trim `PROJECT_RULES.md` under 100 bullet lines with bold headings |
| **New screen shows old pricing or policy** | Live code pivoted earlier while `PROJECT_RULES.md` kept stale numbers | Update the rules brief in the same turn whenever pricing or policies change |
| **Contradictory behavior across turns** | Temporary experiment note left next to a permanent non-goal | Remove temporary overrides and keep one unambiguous rule per policy |
| **New pages clash visually with the homepage** | Aesthetics described only with vague adjectives | Lock tokens on [Design Canvas](https://exaspark.ai/docs/design-canvas/) and name exact roles in your brief |
| **Teammates ship conflicting wording on Pro seats** | Builders prompt from personal assumptions without shared standards | Align all 3 **Pro** seats around `PROJECT_RULES.md` before policy updates |

## Next steps

- [Writing good prompts](https://exaspark.ai/docs/prompting/) — Structure per-turn requests and attach up to 8 brand files cleanly.
- [Multi-turn best practices](https://exaspark.ai/docs/multi-turn-best-practices/) — Sequence milestones cleanly across dozens of turns without regressions.
- [Brand systems & typography](https://exaspark.ai/docs/design-systems-and-brands/) — Lock semantic color tokens, type hierarchy, and surface restraint early.
- [How ExaSpark works](https://exaspark.ai/docs/how-exaspark-works/) — See how live code, Cloud tables, and tokens ground every turn.

## From the blog

- [Common vibe coding mistakes](https://exaspark.ai/blog/vibe-coding-mistakes/) — Prevent prompt drift, contradiction loops, and tangled multi-turn builds.
- [How to describe an app](https://exaspark.ai/blog/describe-your-app/) — Translate domain terms and rules into clear product prompts.
- [How to sharpen a spark](https://exaspark.ai/blog/how-to-sharpen-a-spark/) — Define sharp scope fences and non-goals before writing code.
