agentleFS
langfuselangfuse/langfuse-docs/.agents/AGENTS.md

langfuse-docs

AGENTS.md245 starsChanged 8 months agoMITView on GitHub

This repository powers the Langfuse website hosted on langfuse.com, including both the marketing site and docs content (documentation, blog, changelog, FAQ).

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository6 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

20 rules. About 0 are common, 5 are distinctive, and 15 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 15

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Use pnpm (packageManager is configured in package.json).

    line 8
  2. Very specific:

    Do not hand-edit generated files in content/guides/cookbook/.

    line 55
  3. Very specific:

    Avoid pnpm build for routine edits or small UI/content changes.

    line 56
  4. Very specific:

    If you touched only files Prettier skips (e.g., a notebook, or a generated file listed in .prettierignore), the check will still pass — no …

    line 73
  5. Very specific:

    When in doubt, just run pnpm run format — it's fast and idempotent.

    line 74
  6. Distinctive:

    Check internal links you added/changed point to real pages or anchors.

    line 84
  7. Very specific:

    If you renamed or moved a page, also update any references and add a redirect in next.config.mjs if needed.

    line 86
  8. Distinctive:

    Use existing shadcn/ui patterns and components where possible.

    line 90
  9. Distinctive:

    Use Tailwind semantic tokens (avoid hard-coded color values).

    line 91
  10. Very specific:

    Add an <AvailabilityBanner /> to a feature's docs page when the feature is not available on every Langfuse plan or deployment type.

    line 117
  11. Distinctive:

    Follow the intro immediately with 2-3 concrete example use cases to show relevance.

    line 126
  12. Distinctive:

    Keep it concise — every sentence should add new information.

    line 127
  13. Very specific:

    Use visuals (screenshots, .mp4 videos) for UI changes, interleaved with text.

    line 128
  14. Very specific:

    If blocks of text or code are largely repeated on multiple documentation pages, suggest consolidating them in components-mdx to improve …

    line 139
  15. Very specific:

    When embedding videos from YouTube, make sure to embed from https://www.youtube-nocookie.com instead of https://www.youtube.com to avoid …

    line 140
  16. Very specific:

    Use one H1 per markdown file, with subsections in order (##, ###, etc.)—do not skip heading levels.

    line 141
  17. Very specific:

    When deep-linking to a section via a link that uses the # anchor, make sure the anchor is explicitly defined in the source page via …

    line 143
  18. Very specific:

    When linking to a Langfuse app page from docs, use https://cloud.langfuse.com/project/~/[path] — the ~ sentinel redirects to the reader's …

    line 145
  19. Very specific:

    First page load is slow: After pnpm dev starts ("Ready in ~1s"), the first HTTP request compiles on-demand and can take 20-40 seconds.

    line 152
  20. Very specific:

    No env file needed: All external integrations (OpenAI, Supabase, PostHog, etc.) degrade gracefully when keys are absent.

    line 154

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

This repository powers the Langfuse website hosted on langfuse.com, including both the marketing site and docs content (documentation, blog, changelog, FAQ).

Quickstart

  • Use Node.js 22 (package.json#engines).
  • Use pnpm (packageManager is configured in package.json).
  • Local dev server runs on http://localhost:3333.

Commands you will use most

Development

  • pnpm dev — start the local dev server on port 3333 (preferred default after install).
  • pnpm build — build the production site when you need to validate many pages and the dev server is too slow. This takes about 10 minutes, so do not run it by default for small changes.
  • pnpm start — run the production build on port 3333 when using the production build for broader checks.

Content and maintenance

  • bash scripts/update_cookbook_docs.sh — convert notebook-based cookbook content into docs markdown.
  • pnpm run format — format supported files with Prettier, including Markdown and MDX. Markdown prose wrapping is preserved and embedded-language formatting is disabled to avoid rendering or fenced-snippet changes.
  • pnpm run format:check — check Prettier formatting without writing files; CI runs this.
  • pnpm run link-check — validate markdown links.
  • pnpm run sitemap-check — validate links from generated sitemap.

Optional analysis

  • pnpm run analyze — run a bundle analysis build.

Repository map

  • content/ — site pages and MDX/Markdown content (marketing pages, docs, blog, changelog, FAQ).
  • components/ — reusable React components.
  • components-mdx/ — custom components used from MDX pages.
  • cookbook/ — source Jupyter notebooks for cookbook guides.
  • content/guides/cookbook/ — generated cookbook markdown output.
  • md-override/ — hand-authored Markdown for routes whose rendered pages are not sourced directly from Markdown/MDX. These files must stay synchronized with their corresponding pages.
  • public/ — static assets.
  • scripts/ — build and maintenance scripts.
  • lib/ — shared utilities/config helpers.

Core content types

  • Docs: content/docs/
  • Changelog: content/changelog/
  • Blog: content/blog/
  • Guides: content/guides/
  • FAQ: content/faq/

Important workflow rules

  1. For cookbook changes, edit notebook sources in cookbook/.
  2. Regenerate docs with bash scripts/update_cookbook_docs.sh.
  3. Do not hand-edit generated files in content/guides/cookbook/.
  4. Avoid pnpm build for routine edits or small UI/content changes. Prefer targeted checks or pnpm dev, and only run the full production build when it is necessary or explicitly requested.
  5. Always run pnpm run format before committing or opening a PR if you edited any file Prettier formats (see "Passing CI checks on the first try" below). The format CI job runs pnpm run format:check and fails the build on a single unformatted file.
  6. Always keep Markdown overrides synchronized. Before changing a page or route, check whether its URL has a corresponding file in md-override/. If it does, treat the rendered page and the Markdown override as one source pair: mirror user-facing copy, links, structure, and factual changes in both files in the same change. Do this even when the page does not include a comment pointing to the override.
  7. Preserve custom MDX components in Markdown output. When creating or adding a custom MDX component that contains user-facing content or links, make sure that content is not removed when the page is converted to plain Markdown. If the content only exists in component props or rendered JSX, add a Markdown renderer in lib/markdown-component-renderers.js. Run node scripts/copy_md_sources.js and inspect the corresponding file in public/md-src/ to verify that all content and links remain available to Markdown and PDF consumers.
  8. Users / adopters table archives. When adding or updating a row in components-mdx/adopters-table.mdx whose Reference cell is an external URL, always include a Wayback Machine [Archive](...) link. If no snapshot exists yet, request one (https://web.archive.org/save/{url}), wait until CDX returns a 200 capture, and cite https://web.archive.org/web/{timestamp}/{url}. Percent-encode the URL in CDX queries (curl -G --data-urlencode) so & in query strings is not parsed as another CDX parameter. Do not ship the row without that archive. Follow .agents/skills/add-customer-to-user-list/SKILL.md.

Passing CI checks on the first try

CI runs three required checks on every PR. Run these locally before pushing to avoid a re-run cycle:

1. Prettier format (format job) — this is the check that most often fails

CI runs pnpm run format:check. To fix locally, run pnpm run format and commit the result.

  • Prettier formats: .js, .jsx, .mjs, .cjs, .ts, .tsx, .json, .css, .scss, .md, .mdx, .yaml/.yml, .html. Any change to one of these — including tiny edits like a one-line tweak to an MDX page, a TSX component, or next.config.mjs — can trigger the check.
  • Prettier does not format files matched by .prettierignore (generated cookbook docs in content/guides/cookbook/**, content/workshop/**, lockfiles, generated assets in public/, etc.). Source notebooks (.ipynb in cookbook/) are also skipped because Prettier has no built-in parser for them.
  • Config (.prettierrc.json): proseWrap: "preserve" (don't reflow Markdown prose), embeddedLanguageFormatting: "off" (fenced code blocks are left alone), trailingComma: "all".
  • If you touched only files Prettier skips (e.g., a notebook, or a generated file listed in .prettierignore), the check will still pass — no need to run format.
  • When in doubt, just run pnpm run format — it's fast and idempotent.

2. H1 heading check (check_h1 job)

CI runs node scripts/check-h1-headings.js. It fails if any .md/.mdx file contains more than one top-level # heading (code-fenced examples are ignored; AGENTS.md is excluded because Next.js appends a managed agent-rules H1). Use exactly one H1 per markdown file; deeper sections use ##, ###, etc.

3. Build + link/sitemap checks (build-and-check-links, check-sitemap-links jobs)

These run pnpm build followed by pnpm link-check / pnpm sitemap-check. The full build is ~10 minutes locally — don't run it for routine edits. Instead, before pushing:

  • Check internal links you added/changed point to real pages or anchors.
  • For anchor links (...#some-id), make sure the target page defines the anchor explicitly with [#some-id] at the end of the heading line.
  • If you renamed or moved a page, also update any references and add a redirect in next.config.mjs if needed.

Styling and implementation guidelines

  • Use existing shadcn/ui patterns and components where possible.
  • Use Tailwind semantic tokens (avoid hard-coded color values).
  • Build mobile-first responsive layouts.

Key config files

  • next.config.mjs — Next.js config and redirects.
  • source.config.ts — declares all Fumadocs content collections (docs, blog, changelog, integrations, marketing, …).
  • lib/source.ts — exports a loader for each collection.
  • lib/section-registry.ts — maps URL slugs to layout types; all derived routing sets live here. Do not hardcode slugs elsewhere.
  • tailwind.config.js — Tailwind setup.
  • components.json — shadcn/ui component config.
  • lib/content-dir-map.js — single source of truth for mapping content/ top-level directories to URL prefixes; keep this updated when adding/renaming content sections so lib/source.ts and scripts/copy_md_sources.js stay in sync.

Third-party integrations

  • Inkeep — powers both in-site search and the "Ask AI" chat. Two separate embeds:
    • Search — Inkeep's embedded search widget. Components live in components/inkeep/ (InkeepSearchBar.tsx, search*.tsx, useInkeepSettings.ts).
    • Chat — Fumadocs' built-in Inkeep chat integration (ai-chat-shared.tsx, embedded-chat.tsx, ask-ai-button.tsx).

Writing guidelines

  • Use sentence case for user-facing headlines, section headings, and hero copy by default. Keep title case for short standalone navigation/UI labels where it reads more naturally (for example, paired nouns like "Questions & Answers" or conventional labels like "Get Started"). Always preserve proper nouns, acronyms, and official product names.
  • Route sales and Enterprise inquiries to the sales form instead of directing readers to enterprise@langfuse.com.
  • Add an <AvailabilityBanner /> to a feature's docs page when the feature is not available on every Langfuse plan or deployment type. Place it directly below the relevant heading: usually the H1, or an H2/H3 when availability applies only to that section.
  • Never reference internal ticket ids (LFE-1234, LFINT-1234) or Linear URLs in page content, commit messages, or PR descriptions. They mean nothing to readers of the public site or repo. Describe the change on its own terms; a ticket-prefixed branch name is the one place the identifier belongs.

Changelog entries

Changelog entries live in content/changelog/.

  • Title: describe what the user can now do, not an abstract concept. "Filter Observations by Tool Calls" > "Simplify for Scale". Never use the "Feature Name: Rephrasing of Feature Name" format (e.g., "Code-Based Evaluators: Deterministic Evaluation Without LLM Calls"). Keep titles short and punchy — e.g., "Code as a Judge" or "Code-Based Evaluators".
  • Lead with what's now possible, not what was missing before. Frame positively — don't highlight past limitations of Langfuse. Weave the value naturally into the intro, not in a "Why This Matters" section buried later.
  • Follow the intro immediately with 2-3 concrete example use cases to show relevance. Don't put them in a separate section.
  • Keep it concise — every sentence should add new information. Don't repeat what was already said.
  • Use visuals (screenshots, .mp4 videos) for UI changes, interleaved with text.
  • Be specific — name actual filters, metrics, commands. Avoid vague adjectives.
  • Tone: helpful and conversational, not marketing copy. No filler headings like "Why This Matters", or "Key Benefits."

Review guidelines

Please check the following:

  • Edited text is grammatically correct (American English).
  • Edited text has consistent punctuation.
  • Code blocks in core documentation include all imports to be self-contained (does not apply to notebooks/cookbooks).
  • If blocks of text or code are largely repeated on multiple documentation pages, suggest consolidating them in components-mdx to improve maintainability and consistency.
  • When embedding videos from YouTube, make sure to embed from https://www.youtube-nocookie.com instead of https://www.youtube.com to avoid cookies and tracking. Always add rel=0 to the embed URL so related videos are limited to the same channel.
  • Use one H1 per markdown file, with subsections in order (##, ###, etc.)—do not skip heading levels.
  • We never use .gif files, only .mp4 files uploaded to static.langfuse.com/docs-videos to optimize for size and performance.
  • When deep-linking to a section via a link that uses the # anchor, make sure the anchor is explicitly defined in the source page via [#anchor] at the end of the header line, e.g. ## Get Started [#get-started].
  • For every edited page or route, check md-override/ for a corresponding Markdown source. When one exists, verify the rendered page and override remain synchronized; a top-of-file comment is helpful but not required for this rule to apply.
  • When linking to a Langfuse app page from docs, use https://cloud.langfuse.com/project/~/[path] — the ~ sentinel redirects to the reader's last-used project and region automatically.
  • External /users adopters-table references must include a Wayback [Archive](...) link. Request a Save Page Now snapshot when none exists; do not omit the archive.

Cursor Cloud specific instructions

  • Single service: This is a Next.js website (not a monorepo). The only service to run is pnpm dev on port 3333. No databases, Docker, or external services are required for local development.
  • Dev server bind address: The dev script binds to 127.0.0.1 (-H 127.0.0.1), so use http://127.0.0.1:3333 (not localhost) when curling or testing.
  • First page load is slow: After pnpm dev starts ("Ready in ~1s"), the first HTTP request compiles on-demand and can take 20-40 seconds. Subsequent pages are much faster.
  • Langfuse SDK warnings are expected: The dev server logs [Langfuse SDK] [WARN] No exporter configured… on startup. These are harmless — the SDK keys are only needed for optional demo API routes and are not required for the docs site itself.
  • No env file needed: All external integrations (OpenAI, Supabase, PostHog, etc.) degrade gracefully when keys are absent. You do not need a .env file for routine development.
  • Site search is inert locally: The Ctrl/Cmd+K search dialog (powered by Inkeep) opens but returns no results without Inkeep keys. This is expected; use sidebar/link navigation to reach pages when testing docs locally.
  • postinstall runs agent shim sync: pnpm install triggers scripts/postinstall.sh, which syncs agent config shims. This is expected and idempotent.
  • Walkthrough screenshots and demo videos: Create these only for complex visual changes that cannot be understood from the diff alone — for example multi-step UI interactions, layout or responsive changes, or new interactive components. Do not create screenshots or demo videos for small edits such as copy changes, docs or markdown updates, simple style tweaks, or other changes that are clear from the code diff. In those cases, the diff is sufficient evidence.
<!-- BEGIN:nextjs-agent-rules -->

This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in node_modules/next/dist/docs/ (resolved from this file's directory; in monorepos the next package may not be visible from the repo root) before writing any code. Heed deprecation notices.

This block is written and re-added by next dev — verify at node_modules/next/dist/server/lib/generate-agent-files.js. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.

<!-- END:nextjs-agent-rules -->

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.