Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ Results log to Braintrust under project `harmonica-facilitation` and are viewabl

`src/lib/braintrust.ts` provides `getBraintrustLogger()` for production LLM call logging and `traceOperation()` for hierarchical spans. Optional — logs a warning if `BRAINTRUST_API_KEY` is not set. The `/api/admin/evals` route queries Braintrust experiments for the admin dashboard.

**Observability safety rule:** All observability code (Braintrust, PostHog) in `LLM.chat()` is wrapped in its own try/catch. Observability must never crash a participant's response. If logging fails, warn to console and move on. When adding new tracing or analytics to the LLM path, always wrap in a non-fatal try/catch.

**Span context:** `traceOperation()` passes a `Span` object to its callback via `{ operation, span }`. When calling `LLM.chat()` inside a `traceOperation` callback, always pass `span` through so the SDK uses `span.log()` instead of the top-level `logger.log()` (which throws inside spans).

## Code Style

- Prefer React Server Components; minimize `'use client'`
Expand Down
6 changes: 6 additions & 0 deletions src/app/admin/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { usePathname } from 'next/navigation';
import {
Boxes, // For types/categories
FileText, // For instructions/prompts
LayoutTemplate, // For templates
FlaskConical, // For evals
Settings,
} from 'lucide-react';
Expand All @@ -22,6 +23,11 @@ const navigation = [
href: '/admin/prompts',
icon: FileText, // Changed to FileText to represent instructions/documents
},
{
name: 'Templates',
href: '/admin/templates',
icon: LayoutTemplate,
},
{
name: 'Evals',
href: '/admin/evals',
Expand Down
Loading