> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bepurple.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Standards

> Markdown rules at purple/standards/ that p0 reads before the agent writes code.

Standards are markdown files at `purple/standards/` inside your [workspace](/workspaces). p0 reads them before the agent writes code so it knows your stack, conventions, and constraints.

## Where standards live

Inside a workspace, standards live at:

```
{workspace}/purple/standards/{category}/{name}.md
```

The current Purple workspace ships these category folders:

* **`global/`** — conventions that apply everywhere (tech stack, auth, code style, testing, analytics).
* **`backend/`** — API, database, data model rules.
* **`frontend/`** — components and styling, split by surface (web, electron, cli).
* **`electron/`** — desktop-app architecture and state-management rules.
* **`business/`** — product context (general, value prop, pricing).

Categories are folder names — p0 picks up any folder under `purple/standards/`. The in-app viewer renders dedicated icons for `global`, `backend`, `frontend`, and `business`; any other category gets a generic document icon.

## How p0 surfaces standards

Once a workspace has standards, p0 shows them in two places:

* **Sidebar dropdown** — collapsible list grouped by category, with the last sync time underneath each section. Conflicts between local and remote versions surface here.
* **Standards viewer** — full-page view (category tabs, search, edit mode). Empty categories prompt you to sync from the server.

A file watcher is running while a workspace is active. When `.md` files change under `purple/standards/`, p0 imports them into its local DB and pushes them to the cloud — no manual sync needed.

## Creating standards

There are two paths.

### Generate from your codebase

Inside a p0 chat session, run `/create-standards`. The command analyzes the repos in your workspace. It then walks you through each standard interactively — summary first, then one clarifying question at a time. Output lands at `purple/standards/{group}/{name}.md`. The minimal set it tries to produce.

* `global/`. Tech stack, authentication, code style, testing.
* `backend/`. Database, api, payments, models.
* `frontend/`. Components, styling, responsiveness.
* `business/`. General description, value prop, pricing model.

While it's running, p0 shows a *Creating Coding Standards — Analyzing {workspace} conventions...* card, ending in *Standards Created Successfully*.

### Write them by hand

Add or edit `.md` files directly in `purple/standards/{category}/`. The file watcher picks up changes on disk, imports them, and uploads to the cloud automatically. The in-app editor in the standards viewer does the same round-trip.

## Onboarding banner

For a workspace with no standards, p0 shows a card titled *Unlock fully autonomous development* with a single **Create Standards** button. Clicking it runs the `/create-standards` flow described above.
