Skip to content

πŸͺ’ Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(agent-setup): centralize shared config and skills under .agents (#12795)

Hassieb Pakzad1dc9ce65cfb9
diff --git a/.agents/AGENTS.md b/.agents/AGENTS.md
new file mode 100644
index 0000000000..be7cfab6f4
--- /dev/null
+++ b/.agents/AGENTS.md
@@ -0,0 +1,212 @@
+# Codex Guidelines for Langfuse
+
+This is the canonical root agent guide for the repo. The root `AGENTS.md`
+should remain only as a discovery symlink so tools that require that filename
+continue to work while `.agents/` stays the source of truth.
+
+Langfuse is an open source LLM engineering platform for developing, monitoring,
+evaluating, and debugging AI applications.
+Langfuse monorepo guidance for fast, safe code changes.
+
+## Maintenance Contract
+
+- `AGENTS.md` is a living document.
+- Update this file in the same PR when monorepo-level architecture, workflows,
+ dependency boundaries, mandatory verification commands, or release/security
+ processes materially change.
+- Update this file when user feedback adds a durable repo-level instruction that
+ future agents should follow. Update the relevant shared skill files under
+ `skills/` as well when that feedback changes a reusable workflow, checklist,
+ or decision rule that those skills should teach. Treat feedback as durable
+ when it changes the default workflow, review expectations, naming rules,
+ verification rules, or handoff conventions for future tasks. Do not edit this
+ file or shared skills for one-off task preferences.
+- For package-local material changes, update the package-local `AGENTS.md` in
+ the same PR.
+- If no material guidance changed, do not edit AGENTS files or shared skills.
+
+## Project Structure & Module Organization
+
+```text
+langfuse/
+β”œβ”€ web/ # Next.js app (UI + tRPC + public REST)
+β”œβ”€ worker/ # Queue consumers and background processing
+β”œβ”€ packages/shared/ # Shared domain, DB, queue contracts, repositories
+β”œβ”€ ee/ # Enterprise package consumed by web
+β”œβ”€ generated/ # Generated API clients (do not hand-edit)
+β”œβ”€ fern/ # API definition sources
+└─ scripts/ # Repo scripts
+```
+
+- Package guides:
+ - `../web/AGENTS.md`
+ - `../worker/AGENTS.md`
+ - `../packages/shared/AGENTS.md`
+ - `../ee/AGENTS.md`
+- Dependency direction:
+ - `web` -> `@langfuse/shared`, `@langfuse/ee`
+ - `worker` -> `@langfuse/shared`
+ - `@langfuse/ee` -> `@langfuse/shared`
+ - `@langfuse/shared` -> no imports from `web`, `worker`, or `ee`
+- Queue payload schemas and queue-name contracts are owned by
+ `packages/shared/src/server/queues.ts`.
+- High-signal domain models live in:
+ - `packages/shared/src/domain/observations.ts`
+ - `packages/shared/src/domain/traces.ts`
+ - `packages/shared/src/domain/scores.ts`
+- Database schema entry points live in:
+ - `packages/shared/prisma/schema.prisma`
+ - `packages/shared/clickhouse/migrations/clustered/*.sql`
+- Shared package import surfaces:
+ - `@langfuse/shared`: client-safe/shared contracts, types, schemas, and
+ reusable utilities
+ - `@langfuse/shared/src/server`: server-only shared services, repositories,
+ queue helpers, logging, ingestion, auth, and runtime helpers
+ - `@langfuse/shared/src/db`: Prisma client singleton plus Prisma types
+ - `@langfuse/shared/src/env`, `@langfuse/shared/encryption`: focused env and
+ encryption helpers
+ - See `../packages/shared/AGENTS.md` for the full export map and when to use
+ each entrypoint
+- Architecture handbook:
+ [langfuse.com/handbook/product-engineering/architecture](https://langfuse.com/handbook/product-engineering/architecture)
+ with source markdown in
+ `../langfuse-docs/content/handbook/product-engineering/architecture.mdx`
+ (GitHub mirror:
+ [architecture.mdx](https://github.com/langfuse/langfuse-docs/blob/4188c1ba453240c90a763a8067ef442d68839323/content/handbook/product-engineering/architecture.mdx#L4))
+
+## Build, Test, and Development Commands
+
+- Install deps: `pnpm install`
+- Dev all packages: `pnpm run dev`
+- Dev web only: `pnpm run dev:web`
+- Dev worker only: `pnpm run dev:worker`
+- Codex environment bootstrap: `bash scripts/codex/setup.sh` (installs deps, Playwright Chromium, runs `pnpm --filter=shared run db:generate`, and refreshes workspace Prisma artifacts)
+- Codex environment maintenance: `bash scripts/codex/maintenance.sh`
+- Install repo-local Playwright browsers for agents: `pnpm run playwright:install`
+- Lint all: `pnpm run lint`
+- Typecheck all: `pnpm run typecheck` / `pnpm tc`
+- To try running build, always run `pnpm run build:check` and verify that it succeeds. This does not impact running web servers
+- If you have to rebuild all for testing, run: `pnpm run build`
+- Full reset/bootstrap (destructive): `pnpm run dx`
+
+Minimum verification matrix:
+| Change scope | Minimum verification |
+| --- | --- |
+| `web/**` only | `pnpm --filter web run lint` + targeted web tests |
+| `worker/**` only | `pnpm --filter worker run lint` + targeted worker tests |
+| `packages/shared/**` (non-schema) | `pnpm --filter @langfuse/shared run lint` + one targeted web check + one targeted worker check |
+| `packages/shared/prisma/**` or `packages/shared/clickhouse/**` | `pnpm --filter @langfuse/shared run lint` + `pnpm run db:generate` + targeted web/worker regressions |
+| Public API contract (`web/src/pages/api/public/**`, `web/src/features/public-api/types/**`, `fern/apis/**`) | web lint + targeted server API tests + Fern update/regeneration; never hand-edit `generated/**` |
+| Cross-package refactor (`web` + `worker` + `shared`) | `pnpm run lint` + `pnpm run typecheck` + targeted tests per impacted package |
+
+## Coding Style & Naming Conventions
+
+- Keep changes scoped; avoid unrelated refactors.
+- Prefer package-local implementation details in package AGENTS files.
+- Do not hand-edit generated/build artifacts:
+ - `generated/*`
+ - `web/.next/*`
+ - `web/.next-check/*`
+ - `*/dist/*`
+ - `packages/shared/prisma/generated/*`
+
+## Testing Guidelines
+
+- Keep each test independent and parallel-safe.
+- Implement automated tests for every new feature and for material feature
+ behavior changes. If a test is genuinely not feasible, document the reason in
+ the PR description.
+- Client tests contain `....clienttest.ts`
+- When you write a test for a bug or similar, write the test that fails first.
+ Check that it fails. Only then fix the bug. Otherwise, the test is not good.
+
+## Commit & Pull Request Guidelines
+
+- Commit messages and PR titles must follow Conventional Commits:
+ `type(scope): description` or `type: description`.
+- Use a lowercase conventional type such as `feat`, `fix`, `docs`, `refactor`,
+ `chore`, or `test`; keep the description concise and imperative.
+- PR titles are validated by `.github/workflows/validate-pr-title.yml`.
+- Reference: https://www.conventionalcommits.org/en/v1.0.0/
+- Include AGENTS.md updates in the same PR when guidance materially changes.
+- In PR descriptions, list impacted packages and executed verification commands.
+
+## Docs Linking
+
+- Public API contract changes must update Fern sources in `fern/apis/**` and regenerated outputs; do not hand-edit `generated/**`.
+- Use repo-relative file paths in docs and runbooks.
+- Our docs live in `../langfuse-docs/` which is a different repo. You may always access this.
+
+## Agent-specific Notes
+
+- Root `AGENTS.md` is monorepo-level only.
+- Package-local runbooks, commands, and entry points belong in package `AGENTS.md` files.
+- Keep guidance DRY: canonicalize to the most specific file.
+- `.agents/AGENTS.md` is the canonical root guide.
+- Root `AGENTS.md` is a symlink to `.agents/AGENTS.md`.
+- Root `CLAUDE.md` is a compatibility symlink to `AGENTS.md` because Anthropic still documents `CLAUDE.md` as the project memory filename.
+- Repo-owned Codex cloud bootstrap lives in `scripts/codex/setup.sh` and `scripts/codex/maintenance.sh`; contributors still configure the actual environment in the Codex UI.
+- Shared agent/tool config lives under `config.json` and `skills/`; `pnpm install` regenerates tool-specific config shims via `pnpm run agents:sync` and validates them with `pnpm run agents:check`.
+- Durable repo guidance that should apply across tools belongs in root/package `AGENTS.md` files or `skills/**`, not only in tool-specific config directories.
+- Codex may create or refine shared skills under `skills/` when a repeated repo-specific workflow would help future agents. Keep shared skills tool-neutral and scoped to durable guidance.
+- Shared agent setup overview: [`README.md`](README.md)
+- Shared skill index: [`skills/README.md`](skills/README.md)
+- Shared skills use a short `SKILL.md` entrypoint and should prefer focused `references/` docs and `scripts/` helpers over large compiled guides. Keep any local `AGENTS.md` concise and use it as a router, not a dump of all details.
+- If a task matches one of the shared skill scopes below, read the linked `SKILL.md` before editing code, then follow its local references as needed:
+ - Backend and API work in `web/src/server/**`, `web/src/pages/api/public/**`, `worker/src/**`, or `packages/shared/src/**`: [`skills/backend-dev-guidelines/SKILL.md`](skills/backend-dev-guidelines/SKILL.md)
+ - Model pricing work in `worker/src/constants/default-model-prices.json`, `packages/shared/src/server/llm/types.ts`, or related pricing files: [`skills/add-model-price/SKILL.md`](skills/add-model-price/SKILL.md)
+ - Code review tasks: [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md)
+ - Changelog drafting for completed feature branches: [`skills/changelog-writing/SKILL.md`](skills/changelog-writing/SKILL.md)
+- If more than one skill matches, read the minimal set required.
+- Claude should discover the shared repo skills via `.claude/skills/`, which projects `skills/` through symlinks at provider-specific discovery paths.
+
+## Release Channel
+
+- Release workflow is managed at root (`pnpm run release`).
+- Langfuse Cloud deployments are triggered by pushes to `production` (`.github/workflows/deploy.yml`).
+- Promote `main` to `production` via `.github/workflows/promote-main-to-production.yml` (manual `workflow_dispatch`).
+- Use `pnpm run release:cloud` for CLI-triggered Cloud promotions with preflight branch/migration checks.
+- Do not change release/versioning flow without updating this file and impacted package guides.
+
+## GitHub Search
+
+- use the github cli `gh search issues` to search github.
+
+## GitHub Issues and Pull Requests
+
+- Placeholder: add issue triage and PR hygiene conventions used by maintainers.
+
+## Security and Configuration Tips
+
+- Never commit secrets or credentials.
+- Keep examples in `.env*.example` files in sync with required env vars.
+- Follow `SECURITY.md` for vulnerability reporting/handling.
+
+## Troubleshooting
+
+- Lint/typecheck failures: run `pnpm run lint` and `pnpm run tc`.
+- Schema/client drift: run `pnpm run db:generate`.
+- Local infra issues: run `pnpm run infra:dev:up`; use `pnpm run dx` only when destructive reset is intended.
+
+## Agent Browser Automation
+
+- Project-scoped MCP configs are generated local artifacts at `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, and `.codex/config.toml`.
+- Tool-specific runtime shims are generated local artifacts at `.claude/settings.json`, `.cursor/environment.json`, and `.codex/environments/environment.toml`.
+- Tool-specific config directories such as `.claude/`, `.codex/`, `.cursor/`, and `.vscode/` remain because the tools discover project settings from those fixed paths.
+- `config.json` is the source of truth for shared MCP/bootstrap settings; regenerate tool-specific files with `pnpm install` or `pnpm run agents:sync` instead of editing them by hand.
+- Install Chromium into the default user-level Playwright cache with `pnpm run playwright:install`.
+- `scripts/codex/setup.sh` runs the Playwright install step and an explicit `pnpm --filter=shared run db:generate` before workspace-wide `db:generate` for first-time Codex bootstrap.
+- Playwright MCP traces and other browser session artifacts live under `.playwright-mcp/` and are gitignored.
+- For user-visible frontend changes in `web/**`, review the affected flow in a real browser with the Playwright MCP server before signoff. Cover the primary changed path with a quick functional pass and a visual check for obvious regressions.
+- For web flows, start `pnpm run dev:web` (or `pnpm run dev`) before asking an agent to drive the app in a browser.
+- Optional: generate Playwright's planner/generator/healer agent files with `pnpm --filter web exec playwright init-agents --loop=<claude|vscode|copilot|opencode>`.
+
+## Git Notes
+
+- Do not use destructive git commands (for example `reset --hard`) unless explicitly requested.
+- Do not revert unrelated working-tree changes.
+- Keep commits focused and atomic.
+
+## Cursor Rules
+
+- Any remaining `.cursor/rules/*.mdc` files should stay as thin wrappers around shared `AGENTS.md`, package docs, or shared skills rather than owning durable repo guidance directly.
diff --git a/.agents/README.md b/.agents/README.md
new file mode 100644
index 0000000000..0746072308
--- /dev/null
+++ b/.agents/README.md
@@ -0,0 +1,181 @@
+# Shared Agent Setup
+
+This directory is the neutral, repo-owned source of truth for agent behavior in
+Langfuse.
+
+Use `.agents/` for configuration and guidance that should apply across tools.
+Do not put durable shared guidance only in `.claude/`, `.codex/`, `.cursor/`,
+or `.vscode/`.
+
+## Layout
+
+- `AGENTS.md`: canonical shared root instructions
+- `config.json`: shared bootstrap and MCP configuration used to generate
+ tool-specific shims
+- `skills/`: shared, tool-neutral implementation guidance for recurring
+ workflows
+
+## `config.json`
+
+`.agents/config.json` contains four kinds of data:
+
+- `shared`: defaults used across tools
+- `mcpServers`: project MCP servers and how to connect to them
+- `claude`: Claude-specific generated settings inputs
+- `codex`: Codex-specific generated settings inputs
+- `cursor`: Cursor-specific generated settings inputs
+
+Current shape:
+
+```json
+{
+ "shared": {
+ "setupScript": "bash scripts/codex/setup.sh",
+ "devCommand": "pnpm run dev",
+ "devTerminalDescription": "Main development terminal running the development server"
+ },
+ "mcpServers": {
+ "playwright": {
+ "transport": "stdio",
+ "command": "npx",
+ "args": ["-y", "@playwright/mcp@latest"]
+ },
+ "datadog": {
+ "transport": "http",
+ "url": "https://mcp.datadoghq.com/api/unstable/mcp-server/mcp"
+ }
+ },
+ "claude": {
+ "settings": {}
+ },
+ "codex": {
+ "environment": {
+ "version": 1,
+ "name": "langfuse"
+ }
+ },
+ "cursor": {
+ "environment": {
+ "agentCanUpdateSnapshot": false
+ }
+ }
+}
+```
+
+## How Shims Are Generated
+
+`scripts/agents/sync-agent-shims.mjs` reads `.agents/config.json` and writes the
+tool discovery files that those products require.
+
+Generated local artifacts:
+
+- `.claude/settings.json`
+- `.claude/skills/*`
+- `.cursor/environment.json`
+- `.cursor/mcp.json`
+- `.vscode/mcp.json`
+- `.mcp.json`
+- `.codex/config.toml`
+- `.codex/environments/environment.toml`
+
+The repo root discovery files remain committed as symlinks:
+
+- `AGENTS.md` -> `.agents/AGENTS.md`
+- `CLAUDE.md` -> `AGENTS.md`
+
+This keeps provider discovery stable while `.agents/` remains the source of
+truth.
+
+## When To Edit `config.json`
+
+Edit `.agents/config.json` when you need to:
+
+- add, remove, or update a shared MCP server
+- change the shared setup/bootstrap command
+- change the default dev command or terminal label used by generated shims
+- adjust generated Claude, Cursor, or Codex settings that are intentionally
+ modeled in the shared config
+
+Do not edit generated shim files by hand. Edit the canonical files in
+`.agents/` instead.
+
+## How To Extend `config.json`
+
+### Add an MCP server
+
+Add a new entry under `mcpServers`.
+
+For `stdio` servers:
+
+```json
+{
+ "mcpServers": {
+ "example": {
+ "transport": "stdio",
+ "command": "npx",
+ "args": ["-y", "some-package"]
+ }
+ }
+}
+```
+
+For HTTP servers:
+
+```json
+{
+ "mcpServers": {
+ "example": {
+ "transport": "http",
+ "url": "https://example.com/mcp"
+ }
+ }
+}
+```
+
+Optional fields:
+
+- `env` for `stdio` servers
+- `headers` for HTTP servers
+
+### Change bootstrap or default dev command
+
+Update values in `shared`:
+
+- `setupScript`
+- `devCommand`
+- `devTerminalDescription`
+
+### Add tool-specific generated inputs
+
+Only add tool-specific fields when they are required to generate a discovery
+file for a supported tool. Keep the shared config minimal and neutral.
+
+## Workflow
+
+After editing `.agents/config.json`:
+
+1. Run `pnpm run agents:sync`
+2. Run `pnpm run agents:check`
+3. Verify you did not stage any generated files under `.claude/skills/` or the
+ generated MCP/runtime config paths
+4. Update `AGENTS.md` or `CONTRIBUTING.md` if the shared workflow materially
+ changed
+
+`pnpm install` also runs the sync/check flow via `postinstall`.
+
+## Adding Shared Skills
+
+Shared skills live under `.agents/skills/`.
+
+Use them for durable, reusable guidance such as:
+
+- backend implementation patterns
+- provider-specific maintenance workflows
+- repeated repo-specific review checklists
+
+Do not use skills for one-off task notes or tool runtime configuration.
+
+`pnpm run agents:sync` projects the shared skills into `.claude/skills/` so
+Claude can discover the same repo-owned skills.
+
+For the skill authoring workflow, see [skills/README.md](skills/README.md).
diff --git a/.agents/config.json b/.agents/config.json
new file mode 100644
index 0000000000..25744a135f
--- /dev/null
+++ b/.agents/config.json
@@ -0,0 +1,63 @@
+{
+ "shared": {
+ "setupScript": "bash scripts/codex/setup.sh",
+ "devCommand": "pnpm run dev",
+ "devTerminalDescription": "Main development terminal running the development server"
+ },
+ "mcpServers": {
+ "playwright": {
+ "transport": "stdio",
+ "command": "npx",
+ "args": [
+ "-y",
+ "@playwright/mcp@latest",
+ "--isolated",
+ "--save-trace",
+ "--output-dir",
+ ".playwright-mcp",
+ "--test-id-attribute",
+ "data-testid"
+ ]
+ },
+ "datadog": {
+ "transport": "http",
+ "url": "https://mcp.datadoghq.com/api/unstable/mcp-server/mcp"
+ },
+ "langfuse-docs": {
+ "transport": "http",
+ "url": "https://langfuse.com/api/mcp"
+ },
+ "linear": {
+ "transport": "http",
+ "url": "https://mcp.linear.app/mcp"
+ }
+ },
+ "claude": {
+ "settings": {
+ "permissions": {
+ "allow": [
+ "Bash(find:*)",
+ "Bash(rg:*)",
+ "Bash(grep:*)",
+ "Bash(ls:*)",
+ "Bash(cat:*)",
+ "Bash(head:*)",
+ "Bash(tail:*)"
+ ],
+ "deny": []
+ },
+ "enableAllProjectMcpServers": true
+ }
+ },
+ "codex": {
+ "environment": {
+ "version": 1,
+ "name": "langfuse"
+ }
+ },
+ "cursor": {
+ "environment": {
+ "agentCanUpdateSnapshot": false
+ }
+ }
+}
diff --git a/.agents/skills/README.md b/.agents/skills/README.md
index e48fc1474b..af3b23db58 100644
--- a/.agents/skills/README.md
+++ b/.agents/skills/README.md
@@ -2,9 +2,16 @@
Shared repo skills for any coding agent working in Langfuse.
-Use these from `AGENTS.md` and `CLAUDE.md`. They are not tool-specific and
-should stay focused on reusable implementation guidance rather than runtime
-automation.
+Use these from `AGENTS.md`. Claude Code reaches the same shared instructions via
+the root `CLAUDE.md` compatibility symlink. Shared skills should stay focused on
+reusable implementation guidance rather than runtime automation.
+
+For the shared agent config and generated shim model, start with
+[`../README.md`](../README.md).
+
+Claude discovers these shared skills through symlinks under `.claude/skills/`.
+Those discovery links are created and verified by `pnpm run agents:sync` and
+`pnpm run agents:check`.
Shared skills should use progressive disclosure:
@@ -36,6 +43,25 @@ Use for:
Open: [add-model-price/SKILL.md](add-model-price/SKILL.md)
+### code-review
+
+Use for:
+- PR or branch review
+- correctness, regression, and risk-focused review tasks
+- applying the repo-specific review policy in
+ `code-review/references/review-checklist.md`
+
+Open: [code-review/SKILL.md](code-review/SKILL.md)
+
+### changelog-writing
+
+Use for:
+- changelog entries for completed features
+- drafting user-facing release notes
+- checking related docs links for changelog posts
+
+Open: [changelog-writing/SKILL.md](changelog-writing/SKILL.md)
+
## Adding a New Shared Skill
1. Codex may create or refine shared skills under `.agents/skills/` when a
@@ -47,6 +73,18 @@ Open: [add-model-price/SKILL.md](add-model-price/SKILL.md)
execution helpers.
5. Keep the skill tightly scoped to one domain or workflow.
6. Link the skill from `AGENTS.md` if it is relevant across the repo.
-7. Link the skill from `CLAUDE.md` if Claude Code should load it from the
- project entrypoint.
-8. Run `pnpm run skills:check` after editing any skill files.
+7. Run `pnpm run agents:sync` and `pnpm run agents:check` so Claude's projected
+ `.claude/skills/` view stays in sync.
+8. Update `AGENTS.md` or package-local `AGENTS.md` if the new skill changes the
+ default reusable workflow for future agents.
+9. Run the relevant verification for the package or workflow the skill affects.
+
+## Skill Design Rules
+
+- Keep the skill tool-neutral.
+- Use `SKILL.md` as the short entrypoint, not the full knowledge dump.
+- Prefer `references/` for deeper docs and `scripts/` for deterministic helpers.
+- Avoid copying large sections of repo docs into the skill when a stable link is
+ enough.
+- If the skill is web- or package-specific, link the nearest package
+ `AGENTS.md` or package docs instead of restating them.
diff --git a/.agents/skills/changelog-writing/SKILL.md b/.agents/skills/changelog-writing/SKILL.md
new file mode 100644
index 0000000000..26eabc0ac9
--- /dev/null
+++ b/.agents/skills/changelog-writing/SKILL.md
@@ -0,0 +1,48 @@
+---
+name: changelog-writing
+description: |
+ Shared workflow for writing Langfuse changelog entries after a feature is complete.
+ Use when a branch is ready for merge and a changelog entry or changelog draft is needed.
+---
+
+# Changelog Writing
+
+Use this skill when a completed feature branch needs a changelog entry.
+
+## Workflow
+
+1. Understand the change set.
+2. Study recent changelog patterns in `../langfuse-docs/pages/changelog`.
+3. Find related documentation links in `../langfuse-docs/pages`.
+4. Draft a user-focused changelog entry.
+5. Recommend whether an image or screenshot should be added.
+
+## What To Gather
+
+- The branch diff relative to `main`
+- The Linear issue, if the branch name includes an `lfe-XXXX` identifier
+- The affected product areas
+- Relevant docs pages to link or create
+
+## Writing Rules
+
+- Write for users, not internal implementation detail
+- Prefer second person: "you can now..."
+- Focus on what changed, why it matters, and how to use it
+- Match the structure and tone of recent changelog posts
+- Keep technical detail only where it improves user understanding
+
+## Output Format
+
+Provide:
+
+1. A short summary of what changed
+2. The complete changelog post content
+3. Whether an image should be added and what it should show
+4. Any docs pages that should be linked or created
+
+## Reference Files
+
+- Changelog destination: `../langfuse-docs/pages/changelog`
+- Recent changelog examples: inspect 3-5 recent files in that directory
+- Existing docs: `../langfuse-docs/pages`
diff --git a/.agents/skills/code-review/SKILL.md b/.agents/skills/code-review/SKILL.md
new file mode 100644
index 0000000000..7ee24fa37d
--- /dev/null
+++ b/.agents/skills/code-review/SKILL.md
@@ -0,0 +1,54 @@
+---
+name: code-review
+description: |
+ Shared code review workflow for Langfuse. Use when reviewing a PR, branch, diff,
+ or local changes for correctness, regressions, risk, and missing tests.
+ Start with references/review-checklist.md for repo-specific review rules and
+ use package AGENTS.md files plus any matching shared skills when the change
+ touches those areas.
+---
+
+# Code Review
+
+Use this skill when the task is to review code changes rather than implement a
+feature.
+
+## Start Here
+
+- Read [`references/review-checklist.md`](references/review-checklist.md) for
+ the repo's canonical review rules.
+- Read root [`AGENTS.md`](../../../AGENTS.md) and the nearest package
+ `AGENTS.md` for the files under review.
+- If the review touches ClickHouse, also use the shared
+ `clickhouse-best-practices` skill.
+- If the review touches backend code, also use the shared
+ `backend-dev-guidelines` skill where relevant.
+
+## Review Priorities
+
+Focus on:
+
+- correctness bugs
+- behavioral regressions
+- security and tenant-isolation risks
+- performance issues with real impact
+- missing or weak tests for risky changes
+
+## Output Expectations
+
+- Findings first, ordered by severity
+- File and line references for each finding
+- Short summary only after findings
+- If no findings, say so explicitly and mention any residual risk or coverage gaps
+
+## Scope Guidance
+
+Use `references/review-checklist.md` for Langfuse-specific checks such as:
+
+- ClickHouse and Postgres migration expectations
+- project-scoped tenant isolation checks
+- API/Fern consistency
+- banner-offset UI positioning
+- environment variable access patterns
+
+Do not duplicate those rules in ad hoc prompts or tool-specific command files.
diff --git a/REVIEW.md b/.agents/skills/code-review/references/review-checklist.md
similarity index 97%
rename from REVIEW.md
rename to .agents/skills/code-review/references/review-checklist.md
index 4b33639280..55be1e91b3 100644
--- a/REVIEW.md
+++ b/.agents/skills/code-review/references/review-checklist.md
@@ -1,4 +1,6 @@
-# Code Review Instructions
+# Langfuse Review Checklist
+
+This is the canonical shared review checklist for Langfuse.
## Database Migrations
diff --git a/.claude/agents/changelog-writer.md b/.claude/agents/changelog-writer.md
deleted file mode 100644
index 7309af0ad3..0000000000
--- a/.claude/agents/changelog-writer.md
+++ /dev/null
@@ -1,89 +0,0 @@
----
-name: changelog-writer
-description: Use this agent when a feature branch is complete and ready to merge to main, and you need to create a changelog entry documenting the new feature or changes. This agent should be invoked proactively after significant feature work is completed and before merging.\n\nExamples:\n\n<example>\nContext: User has just completed implementing a new tracing visualization feature and the code has been reviewed.\nuser: "I've finished the trace timeline view feature. Can you help me prepare this for merge?"\nassistant: "Let me use the changelog-writer agent to create a changelog entry for this feature."\n<commentary>\nThe feature is complete and ready for merge, so we should use the changelog-writer agent to document it in the changelog.\n</commentary>\n</example>\n\n<example>\nContext: User mentions they're done with a feature implementation.\nuser: "The prompt versioning feature is done and tested. What's next?"\nassistant: "Great! Let me use the changelog-writer agent to create a changelog entry documenting this new feature before we merge."\n<commentary>\nSince the feature is complete, proactively use the changelog-writer agent to create documentation.\n</commentary>\n</example>\n\n<example>\nContext: User explicitly requests changelog creation.\nuser: "Can you create a changelog post for the new dataset export functionality?"\nassistant: "I'll use the changelog-writer agent to analyze the changes and create an appropriate changelog entry."\n<commentary>\nDirect request to create changelog, use the changelog-writer agent.\n</commentary>\n</example>
-model: inherit
-color: pink
----
-
-You are an expert technical writer specializing in creating clear, user-focused changelog entries for developer tools and SaaS platforms. Your role is to document completed features in a way that helps users understand what's new, why it matters, and how to use it.
-
-## Your Process
-
-### Step 1: Understand the Changes
-1. Extract the Linear issue number from the current branch name (format: lfe-XXXX)
-2. Use the Linear MCP to fetch the issue details for additional context about the feature's purpose and requirements
-3. Compare the current branch to main using git diff to understand the scope of changes at a high level
-4. Identify the core feature or improvement that was implemented
-5. Determine which parts of the codebase were affected (frontend, backend, API, database, etc.)
-
-### Step 2: Study Recent Changelog Patterns
-1. Read 3-5 of the most recent changelog posts in `../langfuse-docs/pages/changelog`
-2. Analyze their structure, tone, and formatting conventions
-3. Note how they:
- - Title features (concise, benefit-focused)
- - Explain the "why" (user problems solved)
- - Describe the "what" (feature capabilities)
- - Link to relevant documentation
- - Use images/screenshots
- - Format code examples or technical details
-
-### Step 3: Identify Documentation Links
-1. Check if there is relevant documentation in `../langfuse-docs/pages` that relates to this feature
-2. If the feature is new, note that documentation may need to be created
-3. If the feature extends existing functionality, identify which docs pages should be referenced
-
-### Step 4: Draft the Changelog Entry
-Create a changelog post that includes:
-
-**Required Elements:**
-- **Title**: Clear, benefit-focused headline (not just the feature name)
-- **Date**: Use the current date in the format used by existing changelogs
-- **Summary**: 1-2 sentences explaining what changed and why it matters to users
-- **Description**: Detailed explanation of the feature, its capabilities, and use cases
-- **Documentation Links**: References to relevant docs pages (if applicable)
-
-**Style Guidelines:**
-- Write in second person ("you can now...")
-- Focus on user benefits, not implementation details
-- Be concise but complete
-- Use active voice
-- Include technical details only when they help users understand the feature
-- Match the tone and style of recent changelog entries
-
-**Formatting:**
-- Follow the exact file structure and frontmatter format of existing changelog posts
-- Use appropriate markdown formatting (headings, lists, code blocks, links)
-- Ensure proper spacing and readability
-
-### Step 5: Assess Visual Needs
-After drafting the changelog, explicitly tell the user:
-- Whether a screenshot or image would enhance understanding of this feature
-- What specific aspect should be captured in the screenshot (if applicable)
-- Where in the changelog the image should be placed
-
-## Quality Standards
-
-**Before presenting your changelog:**
-- Verify it follows the structure and style of recent entries
-- Ensure all links are correctly formatted
-- Check that technical terms match those used in the codebase and docs
-- Confirm the feature description is accurate based on the code changes
-- Validate that the user benefit is clear and compelling
-
-## Output Format
-
-Present your work in this order:
-1. Brief summary of what you learned from the branch comparison and Linear issue
-2. The complete changelog post content (ready to be saved as a new file)
-3. Recommendation on whether to add an image/screenshot and what it should show
-4. List of any documentation pages that should be referenced or created
-
-## Important Notes
-
-- The changelog lives in `../langfuse-docs/pages/changelog`
-- Always check the Linear issue via the branch name (lfe-XXXX format) for context
-- Compare against main branch to understand the full scope of changes
-- Study recent changelogs before writing to maintain consistency
-- Focus on user value, not technical implementation details
-- Be thorough in your analysis before drafting
-- If you're unsure about any aspect of the feature, ask clarifying questions before proceeding
diff --git a/.claude/settings.json b/.claude/settings.json
deleted file mode 100644
index 4b765f346f..0000000000
--- a/.claude/settings.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "permissions": {
- "allow": [
- "Bash(find:*)",
- "Bash(rg:*)",
- "Bash(grep:*)",
- "Bash(ls:*)",
- "Bash(cat:*)",
- "Bash(head:*)",
- "Bash(tail:*)"
- ],
- "deny": []
- },
- "enableAllProjectMcpServers": true,
- "enabledMcpjsonServers": ["sequential-thinking"]
-}
diff --git a/.claude/skills/README.md b/.claude/skills/README.md
deleted file mode 100644
index b5be803d80..0000000000
--- a/.claude/skills/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Claude Skills
-
-Shared repo skills now live in [`.agents/skills/README.md`](../../.agents/skills/README.md).
-
-Use `CLAUDE.md` to point Claude Code at those neutral skill files with `@`
-imports. Keep tool-independent skill content under `.agents/skills/`.
diff --git a/.claude/skills/clickhouse-best-practices b/.claude/skills/clickhouse-best-practices
deleted file mode 120000
index 2abb436c36..0000000000
--- a/.claude/skills/clickhouse-best-practices
+++ /dev/null
@@ -1 +0,0 @@
-../../.agents/skills/clickhouse-best-practices
\ No newline at end of file
diff --git a/.claude/skills/turborepo b/.claude/skills/turborepo
deleted file mode 120000
index b69a7d9eb0..0000000000
--- a/.claude/skills/turborepo
+++ /dev/null
@@ -1 +0,0 @@
-../../.agents/skills/turborepo
\ No newline at end of file
diff --git a/.codex/config.toml b/.codex/config.toml
deleted file mode 100644
index bcb9a8f6f6..0000000000
--- a/.codex/config.toml
+++ /dev/null
@@ -1,12 +0,0 @@
-[mcp_servers.playwright]
-command = "npx"
-args = [
- "-y",
- "@playwright/mcp@latest",
- "--isolated",
- "--save-trace",
- "--output-dir",
- ".playwright-mcp",
- "--test-id-attribute",
- "data-testid",
-]
diff --git a/.codex/environments/environment.toml b/.codex/environments/environment.toml
deleted file mode 100644
index 2c255c2841..0000000000
--- a/.codex/environments/environment.toml
+++ /dev/null
@@ -1,6 +0,0 @@
-# THIS IS AUTOGENERATED. DO NOT EDIT MANUALLY
-version = 1
-name = "langfuse"
-
-[setup]
-script = "bash scripts/codex/setup.sh"
diff --git a/.cursor/commands/review.md b/.cursor/commands/review.md
deleted file mode 100644
index 0f8122c945..0000000000
--- a/.cursor/commands/review.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Code Review Checklist
-
-## Overview
-
-Comprehensive checklist for conducting thorough code reviews to ensure quality, security, and maintainability.
-
-## Review Categories
-
-### Functionality
-
-- [ ] Code does what it's supposed to do
-- [ ] Edge cases are handled
-- [ ] Error handling is appropriate
-- [ ] No obvious bugs or logic errors
-
-### Code Quality
-
-- [ ] Code is readable and well-structured
-- [ ] Functions are small and focused
-- [ ] Variable names are descriptive
-- [ ] No code duplication
-- [ ] Follows project conventions
-
-### Security
-
-- [ ] No obvious security vulnerabilities
-- [ ] Input validation is present
-- [ ] Sensitive data is handled properly
-- [ ] No hardcoded secrets
diff --git a/.cursor/environment.json b/.cursor/environment.json
deleted file mode 100644
index 84568e6a99..0000000000
--- a/.cursor/environment.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "agentCanUpdateSnapshot": false,
- "install": "cp .env.dev.example .env && pnpm i",
- "terminals": [
- {
- "name": "Development Terminal",
- "command": "pnpm run dev",
- "description": "Main development terminal running the development server"
- }
- ]
-}
diff --git a/.cursor/rules/authorization-and-rbac.mdc b/.cursor/rules/authorization-and-rbac.mdc
deleted file mode 100644
index 2341699519..0000000000
--- a/.cursor/rules/authorization-and-rbac.mdc
+++ /dev/null
@@ -1,6 +0,0 @@
----
-description: How to manage authorization and RBAC within full-stack langfuse features
-globs: web/
-alwaysApply: true
----
-See [README.md](mdc:web/src/features/rbac/README.md) for details
\ No newline at end of file
diff --git a/.cursor/rules/banner-positioning.mdc b/.cursor/rules/banner-positioning.mdc
deleted file mode 100644
index f4e029cc69..0000000000
--- a/.cursor/rules/banner-positioning.mdc
+++ /dev/null
@@ -1,45 +0,0 @@
----
-description: Guidelines for positioning elements with banner awareness
-globs:
- - "**/*.tsx"
- - "**/*.jsx"
-alwaysApply: true
----
-
-## Banner Height System
-
-When positioning elements with `sticky`, `fixed`, or `absolute` that have a global reference point (like `top-0`), **always use `top-banner-offset` instead of `top-0`**.
-
-### Why?
-The application can display system banners (payment issues, maintenance notices, etc.) that push content down. Using `top-banner-offset` ensures your positioned elements appear below the banner rather than being covered by it.
-
-### Usage
-
-**Bad:**
-```tsx
-<div className="fixed top-0 left-0 right-0">...</div>
-<div className="sticky top-0">...</div>
-<div className="absolute top-0">...</div>
-<div className="pt-0">...</div>
-```
-
-**Good:**
-```tsx
-<div className="fixed top-banner-offset left-0 right-0">...</div>
-<div className="sticky top-banner-offset">...</div>
-<div className="absolute top-banner-offset">...</div>
-<div className="pt-banner-offset">...</div>
-```
-
-### Additional Utilities
-
-- `h-screen-with-banner` / `min-h-screen-with-banner` - Use these for full-height containers that should account for banner space
-- `pt-banner-offset` - Use for padding-top to offset content below the banner
-- The system uses CSS variables `--banner-height` and `--banner-offset` defined in `web/src/styles/globals.css`
-- Banner components dynamically update `--banner-height` using ResizeObserver to track their actual rendered height, ensuring accuracy across all screen sizes
-
-### When NOT to use `top-banner-offset`
-
-- Elements positioned relative to their parent container (not globally)
-- Elements that should intentionally appear at the very top of the viewport
-- Elements inside modals/dialogs that are already z-indexed above banners
diff --git a/.cursor/rules/entitlements.mdc b/.cursor/rules/entitlements.mdc
deleted file mode 100644
index 807ac253ef..0000000000
--- a/.cursor/rules/entitlements.mdc
+++ /dev/null
@@ -1,7 +0,0 @@
----
-description: How to enforce entitlements across full-stack features
-globs: web/**
-alwaysApply: true
----
-
-Check [README.md](mdc:web/src/features/entitlements/README.md) to learn more about entitlements
diff --git a/.cursor/rules/frontend-features.mdc b/.cursor/rules/frontend-features.mdc
deleted file mode 100644
index 726ce1562a..0000000000
--- a/.cursor/rules/frontend-features.mdc
+++ /dev/null
@@ -1,33 +0,0 @@
----
-description: How we build new full-stack features including frontend APIs, file structure, and components
-globs: web/**
-alwaysApply: true
----
-## Framework
-
-- Next.js
-- Pages router
-
-## File Structure
-
-- We generally put all code related to a net-new feature into a folder within web/src/features.
-- Check out other features to learn about the common structure.
-
-## API for frontend features
-
-- We use TRPC.io to power full-stack features of the Langfuse Frontend
- - Entry point for all trpc routes: [root.ts](mdc:web/src/server/api/root.ts)
-- Authentication, see [authorization-and-rbac.mdc](mdc:.cursor/rules/authorization-and-rbac.mdc)
-- Entitlements, see [entitlements.mdc](mdc:.cursor/rules/entitlements.mdc)
-
-## Components
-
-- We use Shadcn/ui
- - Components in `@/src/components/ui`
- - If a component is not installed yet, ask the user to install it for you
-- When creating new custom components that generalize, we add them with a generalizable naming to `@/src/components`
-
-## Styling
-
-- We use Tailwind CSS
-- We use a standard color palette which automatically handles light/dark mode, see [globals.css](mdc:web/src/styles/globals.css)
\ No newline at end of file
diff --git a/.cursor/rules/general-info.mdc b/.cursor/rules/general-info.mdc
deleted file mode 100644
index 985d58151f..0000000000
--- a/.cursor/rules/general-info.mdc
+++ /dev/null
@@ -1,9 +0,0 @@
----
-description:
-globs:
-alwaysApply: true
----
-# General rules
-
-- Linting in this repo only works if the development server is running
-- Always run the full mono-repo via `pnpm run dx` (use `pnpm dx-f` when you run this in a background agent). Thereby the database will also be seeded.
\ No newline at end of file
diff --git a/.cursor/rules/global.mdc b/.cursor/rules/global.mdc
deleted file mode 100644
index 03e950bba9..0000000000
--- a/.cursor/rules/global.mdc
+++ /dev/null
@@ -1,28 +0,0 @@
----
-description:
-globs:
-alwaysApply: true
----
-
-## Project setup
-
-- This project is a Turborepo monorepo
-- We build two containers, web (./web) and worker (./worker)
-- We have shared code between these two in the shared package (./packages/shared). For that package, we have different entry points [package.json](mdc:packages/shared/package.json).
-
-## Domain layer
-
-The most important domain objects are in [observations.ts](mdc:packages/shared/src/domain/observations.ts), [traces.ts](mdc:packages/shared/src/domain/traces.ts), [scores.ts](mdc:packages/shared/src/domain/scores.ts).
-
-## Database schema
-
-We use Postgres and Clickhouse.
-
-- The postgres schema is in [schema.prisma](mdc:packages/shared/prisma/schema.prisma)
-- The clickhouse schema is in [0001_traces.up.sql](mdc:packages/shared/clickhouse/migrations/clustered/0001_traces.up.sql), [0002_observations.up.sql](mdc:packages/shared/clickhouse/migrations/clustered/0002_observations.up.sql), [0003_scores.up.sql](mdc:packages/shared/clickhouse/migrations/clustered/0003_scores.up.sql)
-
-## Cursor Background/Cloud Agent
-
-When running in a background/cloud agent, please adhere to the following rules:
-
-- Before finishing a task, please run prettier via `pnpm format` to format the code of the repository. Otherwise, the CI check will fail on the change.
diff --git a/.cursor/rules/public-api.mdc b/.cursor/rules/public-api.mdc
deleted file mode 100644
index c8decef94e..0000000000
--- a/.cursor/rules/public-api.mdc
+++ /dev/null
@@ -1,17 +0,0 @@
----
-description: How to create new public api routes for Langfuse
-globs:
-alwaysApply: false
----
-
-# Implementation
-
-- All public api routes are in /web/src/pages/api/public
-- New api routes should follow these guidelines:
- - Use [withMiddlewares.ts](mdc:web/src/features/public-api/server/withMiddlewares.ts) as a wrapper
- - Define types of api request and response in /web/src/features/public-api/types, use strict() for all zod objects
- - Add end-to-end test, similar to [datasets-api.servertest.ts](mdc:web/src/__tests__/server/datasets-api.servertest.ts)
- - Add fern configuration in /fern, learn more about structure here: https://buildwithfern.com/learn/api-definition/fern/overview
- - Prompt user to regenerate the OpenAPI spec via the fern CLI
- - Pagination starts at 1, query typing defined in publicApiPaginationZod, return meta in paginationMetaResponseZod
-- For tests, please look at [this directory](mdc:web/src/__tests__/server/) for examples
diff --git a/.cursor/rules/tests.mdc b/.cursor/rules/tests.mdc
deleted file mode 100644
index d2afb9c83f..0000000000
--- a/.cursor/rules/tests.mdc
+++ /dev/null
@@ -1,9 +0,0 @@
----
-description:
-globs:
-alwaysApply: true
----
-# Writing tests
-
-- When writing tests, focus on decoupling each `it` or `test` block to ensure that they can run independently and concurrently. Tests must never depend on the action or outcome of previous or subsequent tests.
-- When writing tests, especially in `__tests__/server`, prefer scoped cleanup or unique test data over global reset helpers.
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 98f682e690..23678bef42 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -13,5 +13,5 @@ RUN npm install -g [email protected]
RUN curl https://clickhouse.com/ | sh && \
sudo ./clickhouse install
-# Install Claude Code CLI
-RUN npm install -g @anthropic-ai/claude-code
+# Install agent CLIs used in this repo
+RUN npm install -g @anthropic-ai/claude-code @openai/codex
diff --git a/.gitignore b/.gitignore
index a962acb3ea..b8be853f8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,6 +74,14 @@ node_modules
web/test-results/*
.playwright-mcp/*
.codex-artifacts/
+.mcp.json
+.claude/settings.json
+.claude/skills/
+.cursor/mcp.json
+.cursor/environment.json
+.vscode/mcp.json
+.codex/config.toml
+.codex/environments/environment.toml
# local config files
*.local.*
diff --git a/.mcp.json b/.mcp.json
deleted file mode 100644
index 0dabc5e748..0000000000
--- a/.mcp.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "mcpServers": {
- "playwright": {
- "type": "stdio",
- "command": "npx",
- "args": [
- "-y",
- "@playwright/mcp@latest",
- "--isolated",
- "--save-trace",
- "--output-dir",
- ".playwright-mcp",
- "--test-id-attribute",
- "data-testid"
- ]
- }
- }
-}
diff --git a/.vscode/mcp.json b/.vscode/mcp.json
deleted file mode 100644
index 8d041a700f..0000000000
--- a/.vscode/mcp.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "servers": {
- "playwright": {
- "type": "stdio",
- "command": "npx",
- "args": [
- "-y",
- "@playwright/mcp@latest",
- "--isolated",
- "--save-trace",
- "--output-dir",
- ".playwright-mcp",
- "--test-id-attribute",
- "data-testid"
- ]
- }
- }
-}
diff --git a/AGENTS.md b/AGENTS.md
deleted file mode 100644
index d7bd822a49..0000000000
--- a/AGENTS.md
+++ /dev/null
@@ -1,190 +0,0 @@
-# Codex Guidelines for Langfuse
-
-Langfuse is an open source LLM engineering platform for developing, monitoring,
-evaluating, and debugging AI applications.
-Langfuse monorepo guidance for fast, safe code changes.
-
-## Maintenance Contract
-
-- `AGENTS.md` is a living document.
-- Update this file in the same PR when monorepo-level architecture, workflows,
- dependency boundaries, mandatory verification commands, or release/security
- processes materially change.
-- Update this file when user feedback adds a durable repo-level instruction that
- future agents should follow. Update the relevant shared skill files under
- `.agents/skills/` as well when that feedback changes a reusable workflow,
- checklist, or decision rule that those skills should teach. Treat feedback as
- durable when it changes the default workflow, review expectations, naming
- rules, verification rules, or handoff conventions for future tasks. Do not
- edit `AGENTS.md` or shared skills for one-off task preferences.
-- For package-local material changes, update the package-local `AGENTS.md` in
- the same PR.
-- If no material guidance changed, do not edit AGENTS files or shared skills.
-
-## Project Structure & Module Organization
-
-```text
-langfuse/
-β”œβ”€ web/ # Next.js app (UI + tRPC + public REST)
-β”œβ”€ worker/ # Queue consumers and background processing
-β”œβ”€ packages/shared/ # Shared domain, DB, queue contracts, repositories
-β”œβ”€ ee/ # Enterprise package consumed by web
-β”œβ”€ generated/ # Generated API clients (do not hand-edit)
-β”œβ”€ fern/ # API definition sources
-└─ scripts/ # Repo scripts
-```
-
-- Package guides:
- - `web/AGENTS.md`
- - `worker/AGENTS.md`
- - `packages/shared/AGENTS.md`
- - `ee/AGENTS.md`
-- Dependency direction:
- - `web` -> `@langfuse/shared`, `@langfuse/ee`
- - `worker` -> `@langfuse/shared`
- - `@langfuse/ee` -> `@langfuse/shared`
- - `@langfuse/shared` -> no imports from `web`, `worker`, or `ee`
-- Queue payload schemas and queue-name contracts are owned by
- `packages/shared/src/server/queues.ts`.
-- Shared package import surfaces:
- - `@langfuse/shared`: client-safe/shared contracts, types, schemas, and
- reusable utilities
- - `@langfuse/shared/src/server`: server-only shared services, repositories,
- queue helpers, logging, ingestion, auth, and runtime helpers
- - `@langfuse/shared/src/db`: Prisma client singleton plus Prisma types
- - `@langfuse/shared/src/env`, `@langfuse/shared/encryption`: focused env and
- encryption helpers
- - See `packages/shared/AGENTS.md` for the full export map and when to use
- each entrypoint
-- Architecture handbook:
- [langfuse.com/handbook/product-engineering/architecture](https://langfuse.com/handbook/product-engineering/architecture)
- with source markdown in
- `../langfuse-docs/content/handbook/product-engineering/architecture.mdx`
- (GitHub mirror:
- [architecture.mdx](https://github.com/langfuse/langfuse-docs/blob/4188c1ba453240c90a763a8067ef442d68839323/content/handbook/product-engineering/architecture.mdx#L4))
-
-## Build, Test, and Development Commands
-
-- Install deps: `pnpm install`
-- Dev all packages: `pnpm run dev`
-- Dev web only: `pnpm run dev:web`
-- Dev worker only: `pnpm run dev:worker`
-- Codex environment bootstrap: `bash scripts/codex/setup.sh` (installs deps, Playwright Chromium, runs `pnpm --filter=shared run db:generate`, and refreshes workspace Prisma artifacts)
-- Codex environment maintenance: `bash scripts/codex/maintenance.sh`
-- Install repo-local Playwright browsers for agents: `pnpm run playwright:install`
-- Lint all: `pnpm run lint`
-- Typecheck all: `pnpm run typecheck` / `pnpm tc`
-- To try running build, always run `pnpm run build:check` and verify that it succeeds. This does not impact running web servers
-- If you have to rebuild all for testing, run: `pnpm run build`
-- Full reset/bootstrap (destructive): `pnpm run dx`
-
-Minimum verification matrix:
-| Change scope | Minimum verification |
-| --- | --- |
-| `web/**` only | `pnpm --filter web run lint` + targeted web tests |
-| `worker/**` only | `pnpm --filter worker run lint` + targeted worker tests |
-| `packages/shared/**` (non-schema) | `pnpm --filter @langfuse/shared run lint` + one targeted web check + one targeted worker check |
-| `packages/shared/prisma/**` or `packages/shared/clickhouse/**` | `pnpm --filter @langfuse/shared run lint` + `pnpm run db:generate` + targeted web/worker regressions |
-| Public API contract (`web/src/pages/api/public/**`, `web/src/features/public-api/types/**`, `fern/apis/**`) | web lint + targeted server API tests + Fern update/regeneration; never hand-edit `generated/**` |
-| Cross-package refactor (`web` + `worker` + `shared`) | `pnpm run lint` + `pnpm run typecheck` + targeted tests per impacted package |
-
-## Coding Style & Naming Conventions
-
-- Keep changes scoped; avoid unrelated refactors.
-- Prefer package-local implementation details in package AGENTS files.
-- Do not hand-edit generated/build artifacts:
- - `generated/*`
- - `web/.next/*`
- - `web/.next-check/*`
- - `*/dist/*`
- - `packages/shared/prisma/generated/*`
-
-## Testing Guidelines
-
-- Keep each test independent and parallel-safe.
-- Implement automated tests for every new feature and for material feature
- behavior changes. If a test is genuinely not feasible, document the reason in
- the PR description.
-- Client tests contain `....clienttest.ts`
-- When you write a test for a bug or similar, write the test that fails first. Check that it fails. Only then fix the bug. Otherwise, the test is not good!
-
-## Commit & Pull Request Guidelines
-
-- Commit messages and PR titles must follow Conventional Commits:
- `type(scope): description` or `type: description`.
-- Use a lowercase conventional type such as `feat`, `fix`, `docs`, `refactor`,
- `chore`, or `test`; keep the description concise and imperative.
-- PR titles are validated by `.github/workflows/validate-pr-title.yml`.
-- Reference: https://www.conventionalcommits.org/en/v1.0.0/
-- Include AGENTS.md updates in the same PR when guidance materially changes.
-- In PR descriptions, list impacted packages and executed verification commands.
-
-## Docs Linking
-
-- Public API contract changes must update Fern sources in `fern/apis/**` and regenerated outputs; do not hand-edit `generated/**`.
-- Use repo-relative file paths in docs and runbooks.
-- Our docs live in `../langfuse-docs/` which is a different repo. You may always access this.
-
-## Agent-specific Notes
-
-- Root `AGENTS.md` is monorepo-level only.
-- Package-local runbooks, commands, and entry points belong in package `AGENTS.md` files.
-- Keep guidance DRY: canonicalize to the most specific file.
-- `CLAUDE.md` is the Claude Code entrypoint for this repo and should stay as a thin shim that points back to this file.
-- Repo-owned Codex cloud bootstrap lives in `scripts/codex/setup.sh` and `scripts/codex/maintenance.sh`; contributors still configure the actual environment in the Codex UI.
-- Codex may create or refine shared skills under `.agents/skills/` when a repeated repo-specific workflow would help future agents. Keep shared skills tool-neutral and scoped to durable guidance.
-- Shared skill index: [`.agents/skills/README.md`](.agents/skills/README.md)
-- Shared skills use a short `SKILL.md` entrypoint and should prefer focused `references/` docs and `scripts/` helpers over large compiled guides. Keep any local `AGENTS.md` concise and use it as a router, not a dump of all details.
-- If a task matches one of the shared skill scopes below, read the linked `SKILL.md` before editing code, then follow its local references as needed:
- - Backend and API work in `web/src/server/**`, `web/src/pages/api/public/**`, `worker/src/**`, or `packages/shared/src/**`: [`.agents/skills/backend-dev-guidelines/SKILL.md`](.agents/skills/backend-dev-guidelines/SKILL.md)
- - Model pricing work in `worker/src/constants/default-model-prices.json`, `packages/shared/src/server/llm/types.ts`, or related pricing files: [`.agents/skills/add-model-price/SKILL.md`](.agents/skills/add-model-price/SKILL.md)
-- If more than one skill matches, read the minimal set required.
-- For completed feature branches that need a changelog entry, use [`.claude/agents/changelog-writer.md`](.claude/agents/changelog-writer.md).
-
-## Release Channel
-
-- Release workflow is managed at root (`pnpm run release`).
-- Langfuse Cloud deployments are triggered by pushes to `production` (`.github/workflows/deploy.yml`).
-- Promote `main` to `production` via `.github/workflows/promote-main-to-production.yml` (manual `workflow_dispatch`).
-- Use `pnpm run release:cloud` for CLI-triggered Cloud promotions with preflight branch/migration checks.
-- Do not change release/versioning flow without updating this file and impacted package guides.
-
-## GitHub Search
-
-- use the github cli `gh search issues` to search github.
-
-## GitHub Issues and Pull Requests
-
-- Placeholder: add issue triage and PR hygiene conventions used by maintainers.
-
-## Security and Configuration Tips
-
-- Never commit secrets or credentials.
-- Keep examples in `.env*.example` files in sync with required env vars.
-- Follow `SECURITY.md` for vulnerability reporting/handling.
-
-## Troubleshooting
-
-- Lint/typecheck failures: run `pnpm run lint` and `pnpm run tc`.
-- Schema/client drift: run `pnpm run db:generate`.
-- Local infra issues: run `pnpm run infra:dev:up`; use `pnpm run dx` only when destructive reset is intended.
-
-## Agent Browser Automation
-- Shared Playwright MCP configs live in `.mcp.json` and `.vscode/mcp.json`.
-- Codex project-scoped MCP config lives in `.codex/config.toml` for trusted-project setups.
-- Install Chromium into the default user-level Playwright cache with `pnpm run playwright:install`.
-- `scripts/codex/setup.sh` runs the Playwright install step and an explicit `pnpm --filter=shared run db:generate` before workspace-wide `db:generate` for first-time Codex bootstrap.
-- Playwright MCP traces and other browser session artifacts live under `.playwright-mcp/` and are gitignored.
-- For user-visible frontend changes in `web/**`, review the affected flow in a real browser with the Playwright MCP server before signoff. Cover the primary changed path with a quick functional pass and a visual check for obvious regressions.
-- For web flows, start `pnpm run dev:web` (or `pnpm run dev`) before asking an agent to drive the app in a browser.
-- Optional: generate Playwright's planner/generator/healer agent files with `pnpm --filter web exec playwright init-agents --loop=<claude|vscode|copilot|opencode>`.
-
-## Git Notes
-
-- Do not use destructive git commands (for example `reset --hard`) unless explicitly requested.
-- Do not revert unrelated working-tree changes.
-- Keep commits focused and atomic.
-
-## Cursor Rules
-
-- Additional folder-specific rules live in `.cursor/rules/`.
diff --git a/AGENTS.md b/AGENTS.md
new file mode 120000
index 0000000000..41280d2fa8
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1 @@
+.agents/AGENTS.md
\ No newline at end of file
diff --git a/CLAUDE.md b/CLAUDE.md
deleted file mode 100644
index 577fe91e88..0000000000
--- a/CLAUDE.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# CLAUDE.md
-
-Claude Code should treat this file as the repo entrypoint, but the canonical
-shared instructions live in @AGENTS.md.
-
-Start here:
-- Read @AGENTS.md for monorepo structure, verification requirements, and shared
- workflow rules.
-- When working in `web/`, `worker/`, `packages/shared/`, or `ee/`, also read
- the closest package-local `AGENTS.md`.
-
-Repo-local skills:
-- Shared skill index: @.agents/skills/README.md
-- Shared skills start in `SKILL.md` and may route to a local `AGENTS.md`,
- `references/`, or `scripts/` files.
-- Backend work: @.agents/skills/backend-dev-guidelines/SKILL.md
-- Model pricing updates: @.agents/skills/add-model-price/SKILL.md
-
-Specialized agent:
-- Changelog entries for completed features: @.claude/agents/changelog-writer.md
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 120000
index 0000000000..47dc3e3d86
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1 @@
+AGENTS.md
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0884b4e040..cddae867c3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -157,6 +157,40 @@ Notes:
PostgreSQL, Redis, ClickHouse, and object storage, plus matching environment
variables in the Codex UI.
+### Shared Agent Setup
+
+This repository keeps the shared agent setup in source control so developers
+using different tools can work against the same instructions, bootstrap, and
+MCP server catalog.
+
+- Canonical shared docs:
+ - `.agents/AGENTS.md`
+- Root discovery symlinks:
+ - `AGENTS.md`
+ - `CLAUDE.md`
+- Shared agent setup overview: `.agents/README.md`
+- Shared skills: `.agents/skills/`
+- Shared tool/bootstrap/MCP config: `.agents/config.json`
+- Tool-specific MCP configs generated locally from that catalog and not committed:
+ - `.mcp.json`
+ - `.cursor/mcp.json`
+ - `.vscode/mcp.json`
+ - `.codex/config.toml`
+- Tool-specific runtime shims generated locally from the shared config and not committed:
+ - `.claude/settings.json`
+ - `.codex/environments/environment.toml`
+ - `.cursor/environment.json`
+- Tool-specific skill projections generated locally and not committed:
+ - `.claude/skills/*`
+- Shared bootstrap for agent environments: `bash scripts/codex/setup.sh`
+
+When you change the shared MCP setup:
+
+1. Edit `.agents/config.json`
+2. Run `pnpm run agents:sync`
+3. Run `pnpm run agents:check`
+4. Do not commit the generated MCP config files or runtime shims
+
**Steps**
1. Install development dependencies:
diff --git a/package.json b/package.json
index ed57db5033..c084480fb6 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,9 @@
"node": "24"
},
"scripts": {
+ "agents:check": "node scripts/agents/sync-agent-shims.mjs --check",
+ "agents:sync": "node scripts/agents/sync-agent-shims.mjs",
+ "postinstall": "node -e \"const fs = require('node:fs'); const cp = require('node:child_process'); if (!fs.existsSync('scripts/postinstall.sh')) { console.log('Skipping repo postinstall helper: scripts/postinstall.sh is not present in this install context.'); process.exit(0); } cp.execSync('bash scripts/postinstall.sh', { stdio: 'inherit' });\"",
"preinstall": "npx only-allow pnpm",
"infra:dev:up": "docker compose -f ./docker-compose.dev.yml up -d --wait",
"infra:dev:down": "docker compose -f ./docker-compose.dev.yml down",
diff --git a/scripts/agents/sync-agent-shims.mjs b/scripts/agents/sync-agent-shims.mjs
new file mode 100644
index 0000000000..927ec2110f
--- /dev/null
+++ b/scripts/agents/sync-agent-shims.mjs
@@ -0,0 +1,347 @@
+import {
+ existsSync,
+ lstatSync,
+ mkdirSync,
+ readdirSync,
+ readFileSync,
+ readlinkSync,
+ rmSync,
+ symlinkSync,
+ writeFileSync,
+} from "node:fs";
+import { dirname, relative, resolve } from "node:path";
+import process from "node:process";
+
+const repoRoot = resolve(new URL("../..", import.meta.url).pathname);
+const sourcePath = resolve(repoRoot, ".agents/config.json");
+const config = JSON.parse(readFileSync(sourcePath, "utf8"));
+const servers = config.mcpServers;
+const checkMode = process.argv.includes("--check");
+
+const sortObject = (value) =>
+ Object.fromEntries(
+ Object.entries(value).sort(([left], [right]) => left.localeCompare(right)),
+ );
+
+const formatSharedJsonConfig = () => {
+ const mcpServers = Object.fromEntries(
+ Object.entries(sortObject(servers)).map(([name, server]) => {
+ if (server.transport === "stdio") {
+ return [
+ name,
+ {
+ command: server.command,
+ args: server.args ?? [],
+ ...(server.env ? { env: server.env } : {}),
+ },
+ ];
+ }
+
+ return [
+ name,
+ {
+ type: "http",
+ url: server.url,
+ ...(server.headers ? { headers: server.headers } : {}),
+ },
+ ];
+ }),
+ );
+
+ return JSON.stringify({ mcpServers }, null, 2) + "\n";
+};
+
+const formatVsCodeConfig = () => {
+ const mcpServers = Object.fromEntries(
+ Object.entries(sortObject(servers)).map(([name, server]) => {
+ if (server.transport === "stdio") {
+ return [
+ name,
+ {
+ type: "stdio",
+ command: server.command,
+ args: server.args ?? [],
+ ...(server.env ? { env: server.env } : {}),
+ },
+ ];
+ }
+
+ return [
+ name,
+ {
+ type: "http",
+ url: server.url,
+ ...(server.headers ? { headers: server.headers } : {}),
+ },
+ ];
+ }),
+ );
+
+ return JSON.stringify({ servers: mcpServers }, null, 2) + "\n";
+};
+
+const formatCodexToml = () => {
+ const lines = [];
+
+ for (const [name, server] of Object.entries(sortObject(servers))) {
+ lines.push(`[mcp_servers.${name}]`);
+
+ if (server.transport === "stdio") {
+ lines.push(`command = ${JSON.stringify(server.command)}`);
+ if (server.args?.length) {
+ lines.push("args = [");
+ for (const arg of server.args) {
+ lines.push(` ${JSON.stringify(arg)},`);
+ }
+ lines.push("]");
+ } else {
+ lines.push("args = []");
+ }
+ if (server.env) {
+ lines.push(`[mcp_servers.${name}.env]`);
+ for (const [envName, envValue] of Object.entries(sortObject(server.env))) {
+ lines.push(`${envName} = ${JSON.stringify(envValue)}`);
+ }
+ }
+ } else {
+ lines.push(`url = ${JSON.stringify(server.url)}`);
+ if (server.headers) {
+ lines.push(`[mcp_servers.${name}.headers]`);
+ for (const [headerName, headerValue] of Object.entries(
+ sortObject(server.headers),
+ )) {
+ lines.push(`${JSON.stringify(headerName)} = ${JSON.stringify(headerValue)}`);
+ }
+ }
+ }
+
+ lines.push("");
+ }
+
+ return lines.join("\n");
+};
+
+const formatClaudeSettings = () =>
+ JSON.stringify(config.claude.settings, null, 2) + "\n";
+
+const formatCursorEnvironment = () =>
+ JSON.stringify(
+ {
+ agentCanUpdateSnapshot: config.cursor.environment.agentCanUpdateSnapshot,
+ install: config.shared.setupScript,
+ terminals: [
+ {
+ name: "Development Terminal",
+ command: config.shared.devCommand,
+ description: config.shared.devTerminalDescription,
+ },
+ ],
+ },
+ null,
+ 2,
+ ) + "\n";
+
+const formatCodexEnvironmentToml = () => {
+ const lines = [
+ "# THIS IS AUTOGENERATED. DO NOT EDIT MANUALLY",
+ `version = ${config.codex.environment.version}`,
+ `name = ${JSON.stringify(config.codex.environment.name)}`,
+ "",
+ "[setup]",
+ `script = ${JSON.stringify(config.shared.setupScript)}`,
+ "",
+ ];
+
+ return lines.join("\n");
+};
+
+const fileOutputs = [
+ {
+ path: resolve(repoRoot, ".claude/settings.json"),
+ content: formatClaudeSettings(),
+ },
+ {
+ path: resolve(repoRoot, ".mcp.json"),
+ content: formatSharedJsonConfig(),
+ },
+ {
+ path: resolve(repoRoot, ".codex/environments/environment.toml"),
+ content: formatCodexEnvironmentToml(),
+ optional: true,
+ },
+ {
+ path: resolve(repoRoot, ".cursor/mcp.json"),
+ content: formatSharedJsonConfig(),
+ },
+ {
+ path: resolve(repoRoot, ".cursor/environment.json"),
+ content: formatCursorEnvironment(),
+ },
+ {
+ path: resolve(repoRoot, ".vscode/mcp.json"),
+ content: formatVsCodeConfig(),
+ },
+ {
+ path: resolve(repoRoot, ".codex/config.toml"),
+ content: formatCodexToml(),
+ optional: true,
+ },
+];
+
+const skillsRoot = resolve(repoRoot, ".agents/skills");
+const sharedSkillNames = readdirSync(skillsRoot, { withFileTypes: true })
+ .filter(
+ (entry) =>
+ entry.isDirectory() && existsSync(resolve(skillsRoot, entry.name, "SKILL.md")),
+ )
+ .map((entry) => entry.name)
+ .sort((left, right) => left.localeCompare(right));
+
+const symlinkOutputs = [
+ {
+ path: resolve(repoRoot, "AGENTS.md"),
+ target: resolve(repoRoot, ".agents/AGENTS.md"),
+ },
+ {
+ path: resolve(repoRoot, "CLAUDE.md"),
+ target: resolve(repoRoot, "AGENTS.md"),
+ },
+ ...sharedSkillNames.map((name) => ({
+ path: resolve(repoRoot, ".claude/skills", name),
+ target: resolve(skillsRoot, name),
+ })),
+];
+
+const managedDirectoryEntries = [
+ {
+ path: resolve(repoRoot, ".claude/skills"),
+ expectedChildren: new Set(sharedSkillNames),
+ },
+];
+
+const isMatchingSymlink = (path, target) => {
+ const stats = lstatSync(path);
+ if (!stats.isSymbolicLink()) {
+ return false;
+ }
+
+ return resolve(dirname(path), readlinkSync(path)) === target;
+};
+
+const findUnexpectedChildren = ({ path, expectedChildren }) => {
+ if (!existsSync(path)) {
+ return [];
+ }
+
+ return readdirSync(path).filter((entry) => !expectedChildren.has(entry));
+};
+
+let hasMismatch = false;
+
+for (const output of fileOutputs) {
+ if (checkMode) {
+ try {
+ const current = readFileSync(output.path, "utf8");
+ if (current !== output.content) {
+ hasMismatch = true;
+ console.error(`Out of sync: ${output.path}`);
+ }
+ } catch (error) {
+ if (output.optional) {
+ console.warn(`Skipping optional config check: ${output.path}`);
+ continue;
+ }
+
+ if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
+ hasMismatch = true;
+ console.error(
+ `Missing generated config: ${output.path}. Run "pnpm run agents:sync".`,
+ );
+ continue;
+ }
+
+ throw error;
+ }
+ continue;
+ }
+
+ try {
+ mkdirSync(resolve(output.path, ".."), { recursive: true });
+ writeFileSync(output.path, output.content);
+ console.log(`Updated ${output.path}`);
+ } catch (error) {
+ if (output.optional) {
+ console.warn(`Skipping optional config generation: ${output.path}`);
+ continue;
+ }
+
+ throw error;
+ }
+}
+
+for (const output of symlinkOutputs) {
+ if (checkMode) {
+ try {
+ if (!isMatchingSymlink(output.path, output.target)) {
+ hasMismatch = true;
+ console.error(`Out of sync symlink: ${output.path}`);
+ }
+ } catch (error) {
+ if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
+ hasMismatch = true;
+ console.error(`Missing symlink shim: ${output.path}. Run "pnpm run agents:sync".`);
+ continue;
+ }
+
+ throw error;
+ }
+
+ continue;
+ }
+
+ mkdirSync(dirname(output.path), { recursive: true });
+
+ try {
+ if (isMatchingSymlink(output.path, output.target)) {
+ continue;
+ }
+ } catch (error) {
+ if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT")) {
+ throw error;
+ }
+ }
+
+ rmSync(output.path, { force: true, recursive: true });
+ symlinkSync(
+ relative(dirname(output.path), output.target),
+ output.path,
+ lstatSync(output.target).isDirectory() ? "dir" : "file",
+ );
+ console.log(`Linked ${output.path}`);
+}
+
+for (const directory of managedDirectoryEntries) {
+ const unexpectedChildren = findUnexpectedChildren(directory);
+
+ if (unexpectedChildren.length === 0) {
+ continue;
+ }
+
+ if (checkMode) {
+ hasMismatch = true;
+ for (const child of unexpectedChildren) {
+ console.error(`Unexpected generated shim: ${resolve(directory.path, child)}`);
+ }
+ continue;
+ }
+
+ for (const child of unexpectedChildren) {
+ const childPath = resolve(directory.path, child);
+ rmSync(childPath, { force: true, recursive: true });
+ console.log(`Removed stale generated shim ${childPath}`);
+ }
+}
+
+if (checkMode && hasMismatch) {
+ process.exitCode = 1;
+}
diff --git a/scripts/codex/setup.test.sh b/scripts/codex/setup.test.sh
index 5f6ff70980..3a0701d6ef 100755
--- a/scripts/codex/setup.test.sh
+++ b/scripts/codex/setup.test.sh
@@ -40,7 +40,7 @@ assert_file_contains() {
local expected="$2"
local message="$3"
- if ! grep -Fqx "$expected" "$file_path"; then
+ if ! grep -Fqx -- "$expected" "$file_path"; then
echo "$message"
echo "missing line: $expected"
exit 1
@@ -92,6 +92,11 @@ assert_file_contains \
"run playwright:install" \
"setup.sh should install Playwright browsers for frontend review"
+assert_file_contains \
+ "$pnpm_log" \
+ "--filter=shared run db:generate" \
+ "setup.sh should generate the shared Prisma client explicitly before the workspace-wide task"
+
assert_file_contains \
"$pnpm_log" \
"run db:generate" \
diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh
new file mode 100644
index 0000000000..e67cbce54e
--- /dev/null
+++ b/scripts/postinstall.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+# Docker builds install dependencies from Turbo's pruned `out/json` tree before
+# the full source tree (`out/full`) is copied into the image. In that install
+# context, repo-owned agent files such as `scripts/agents/sync-agent-shims.mjs`
+# and `.agents/config.json` are intentionally absent because they are not needed
+# to resolve production dependencies.
+#
+# Root `postinstall` still runs during that pruned install step, but generating
+# agent shims is only useful in a full repo checkout. Skip cleanly when the
+# shared agent sync script is not available so Docker builds can continue.
+if [[ ! -f "scripts/agents/sync-agent-shims.mjs" ]]; then
+ echo "Skipping agent shim sync: scripts/agents/sync-agent-shims.mjs is not present in this install context."
+ exit 0
+fi
+
+pnpm run agents:sync
+pnpm run agents:check
diff --git a/web/AGENTS.md b/web/AGENTS.md
index d6fca3b814..2afef07021 100644
--- a/web/AGENTS.md
+++ b/web/AGENTS.md
@@ -62,6 +62,28 @@ Read these package-local skills before substantial frontend refactors when the
task involves component composition, reusable component APIs, rendering
performance, bundle size, or React/Next.js performance patterns.
+## Web Conventions
+- Put net-new feature code under `src/features/<feature>/*`; put broadly reusable
+ components under `src/components/*`.
+- We use tRPC for full-stack web features; register routers in
+ `src/server/api/root.ts`.
+- Authentication and RBAC guidance lives in `src/features/rbac/README.md`.
+- Entitlements guidance lives in `src/features/entitlements/README.md`.
+- Prefer Shadcn/ui primitives from `src/components/ui`; if a missing component
+ must be installed, ask the user before doing so.
+- Tailwind is the default styling layer; use the shared palette and globals in
+ `src/styles/globals.css`.
+- When anchoring sticky, fixed, or absolute elements to the viewport, use
+ `top-banner-offset`, `pt-banner-offset`, `h-screen-with-banner`, or
+ `min-h-screen-with-banner` instead of raw `top-0` so banners do not overlap
+ the UI.
+- Public API routes should use
+ `src/features/public-api/server/withMiddlewares.ts`, define strict request and
+ response types in `src/features/public-api/types/*`, add server tests, and
+ update Fern sources when the contract changes.
+- Keep tests independent; in `src/__tests__/server/**`, prefer scoped cleanup or
+ unique test data over global reset helpers.
+
## Quick Commands
- Dev: `pnpm --filter web run dev`
- Lint: `pnpm --filter web run lint`
@@ -98,7 +120,7 @@ performance, bundle size, or React/Next.js performance patterns.
### Agent browser loop
1. Start the app with `pnpm run dev:web` unless an existing local server is already running.
2. Install Chromium with `pnpm run playwright:install` if Playwright has not been set up on this machine yet.
-3. Use the workspace `playwright` MCP server from `.mcp.json` or `.vscode/mcp.json` for browser-driven review of user-visible frontend changes, not just debugging.
+3. Use the workspace `playwright` MCP server from `.mcp.json`, `.cursor/mcp.json`, or `.vscode/mcp.json` for browser-driven review of user-visible frontend changes, not just debugging.
4. Exercise the primary changed flow and check the resulting UI state for obvious visual regressions before signoff.
5. Inspect traces and other artifacts under `../.playwright-mcp/` when a browser session fails.