# Project brief

> The single source of truth for *what* this app is and *why*. Keep it under two screens; link out for detail.

## Outcome

- **One-line product:** LexAI — BYO-LLM writing help as a Chrome MV3 extension and a VS Code extension, sharing one provider/prompt core.
- **Measurable outcome:** Select text → AI action (fix / rephrase / shorten / expand / explain / prompt) → replace in place (Chrome also supports Copy), with no LexAI backend and no subscription.
- **Primary user:** People who already hold an LLM API key and want inline writing help without a SaaS subscription.
- **Why now:** BYO-key writing help without accounts, telemetry, or a LexAI server in the path.

## Non-goals

- No LexAI backend, account, or subscription
- No telemetry; no transmission of text or API key except to the user’s chosen provider
- Not a full document editor
- VS Code v1: no floating toolbar, Prompt Builder UI, or Copy As; Firefox/Safari packaging not in scope

## Acceptance tests

1. `npm run typecheck` and `npm test -- --run` pass
2. `npm run build` yields a loadable `.output/chrome-mv3/`
3. Chrome: Replace works on `textarea`/`input` and `contenteditable` (load-unpacked — unit tests do not cover DOM timing)
4. Chrome: API key uses the encrypted path (`apiKeyEnc` + `encKey`) and is never logged or exfiltrated
5. `npm run vscode:typecheck` and `npm run vscode:build` succeed; VS Code stores the key in Secret Storage and replaces the editor selection

## Constraints

- **Deadline / milestones:** none fixed; track in Plane (LEXAI) and `docs/TASKS.md`
- **Budget / cost ceiling:** user pays their own provider; extension has no LexAI infra bill
- **Stack:** WXT ^0.20 + React 18 + TypeScript (Chrome); `packages/vscode` + esbuild (VS Code); shared `src/lib`; Node 22; providers OpenAI / Anthropic / Groq / OpenRouter
- **Security / compliance:** never log the key; Chrome encrypts in `chrome.storage.local`; VS Code uses Secret Storage; content/popup must not call providers
- **Team / bus factor:** solo owner; operating system in `AGENTS.md` + `CLAUDE.md` + `docs/`

## Stakeholders

| Role | Who | Decision authority |
| --- | --- | --- |
| Product owner | John Kevin | scope, priorities, release, reference-bar acceptance |
| Eng / harness | this Cursor kit + Claude kit in-repo | architecture proposals, implementation under gates |

## Unknowns

- Reference bar for selection-toolbar/card UX is proposed (Grammarly screenshots into `docs/reference/`) but **not yet concrete** — no gauntlet until artifacts exist
- Whether Cursor picker IDs match the profile-table slugs written in `docs/MODEL_ROUTING.md` (live scout verifies `fast`; mid/strong fail loudly on first Task if not)

## Source of truth

- **Issue tracker:** Plane (LEXAI)
- **Design / specs:** `docs/` (+ `DESIGN_SYSTEM.md` / `design/` when created)
- **This repo:** `AGENTS.md` (Cursor control plane), `CLAUDE.md` (Claude control plane), Chrome in `entrypoints/`, VS Code in `packages/vscode/`, shared core in `src/lib/`, tasks in `docs/TASKS.md`

---

*Related: `ARCHITECTURE.md` (how it's built), `DECISIONS.md` (why choices were made), `TASKS.md` (active work), `SELF_MODEL.md` (who the harness is building for).*
