quiver-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -0
- package/bin/quiver-cli.mjs +2 -0
- package/dist/cli.js +3074 -0
- package/package.json +55 -0
- package/template/.agents/AGENTS.md +25 -0
- package/template/.agents/commands/cp.md +116 -0
- package/template/.agents/commands/next-setup.md +1064 -0
- package/template/.agents/commands/tf-readme.md +38 -0
- package/template/.agents/config.json +60 -0
- package/template/.agents/skills/agent-browser/SKILL.md +55 -0
- package/template/.agents/skills/apps/skybridge/SKILL.md +46 -0
- package/template/.agents/skills/apps/skybridge/references/architecture.md +175 -0
- package/template/.agents/skills/apps/skybridge/references/copy-template.md +24 -0
- package/template/.agents/skills/apps/skybridge/references/csp.md +33 -0
- package/template/.agents/skills/apps/skybridge/references/deploy.md +33 -0
- package/template/.agents/skills/apps/skybridge/references/discover.md +84 -0
- package/template/.agents/skills/apps/skybridge/references/download-file.md +77 -0
- package/template/.agents/skills/apps/skybridge/references/fetch-and-render-data.md +151 -0
- package/template/.agents/skills/apps/skybridge/references/oauth.md +115 -0
- package/template/.agents/skills/apps/skybridge/references/open-external-links.md +71 -0
- package/template/.agents/skills/apps/skybridge/references/prompt-llm.md +20 -0
- package/template/.agents/skills/apps/skybridge/references/publish.md +19 -0
- package/template/.agents/skills/apps/skybridge/references/run-locally.md +51 -0
- package/template/.agents/skills/apps/skybridge/references/state-and-context.md +151 -0
- package/template/.agents/skills/apps/skybridge/references/ui-guidelines.md +205 -0
- package/template/.agents/skills/code/cleanup/SKILL.md +26 -0
- package/template/.agents/skills/code/vercel-react-best-practices/AGENTS.md +3810 -0
- package/template/.agents/skills/code/vercel-react-best-practices/README.md +123 -0
- package/template/.agents/skills/code/vercel-react-best-practices/SKILL.md +149 -0
- package/template/.agents/skills/code/vercel-react-best-practices/metadata.json +15 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/_sections.md +46 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/_template.md +28 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-effect-event-deps.md +56 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +37 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-defer-await.md +82 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-analyzable-paths.md +63 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-barrel-imports.md +60 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-flatmap-filter.md +60 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-request-idle-callback.md +105 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-resource-hints.md +85 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-script-defer-async.md +68 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-no-inline-components.md +82 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +64 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-deferred-value.md +59 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-hoist-static-io.md +149 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-no-shared-module-state.md +50 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +34 -0
- package/template/.agents/skills/code/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/template/.agents/skills/data/prisma-cli/SKILL.md +247 -0
- package/template/.agents/skills/data/prisma-cli/references/db-execute.md +78 -0
- package/template/.agents/skills/data/prisma-cli/references/db-pull.md +185 -0
- package/template/.agents/skills/data/prisma-cli/references/db-push.md +148 -0
- package/template/.agents/skills/data/prisma-cli/references/db-seed.md +188 -0
- package/template/.agents/skills/data/prisma-cli/references/debug.md +46 -0
- package/template/.agents/skills/data/prisma-cli/references/dev.md +157 -0
- package/template/.agents/skills/data/prisma-cli/references/format.md +48 -0
- package/template/.agents/skills/data/prisma-cli/references/generate.md +173 -0
- package/template/.agents/skills/data/prisma-cli/references/init.md +136 -0
- package/template/.agents/skills/data/prisma-cli/references/mcp.md +38 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-deploy.md +127 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-dev.md +145 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-diff.md +89 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-reset.md +78 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-resolve.md +57 -0
- package/template/.agents/skills/data/prisma-cli/references/migrate-status.md +65 -0
- package/template/.agents/skills/data/prisma-cli/references/studio.md +137 -0
- package/template/.agents/skills/data/prisma-cli/references/validate.md +53 -0
- package/template/.agents/skills/data/prisma-client-api/SKILL.md +216 -0
- package/template/.agents/skills/data/prisma-client-api/references/client-methods.md +223 -0
- package/template/.agents/skills/data/prisma-client-api/references/constructor.md +208 -0
- package/template/.agents/skills/data/prisma-client-api/references/filters.md +256 -0
- package/template/.agents/skills/data/prisma-client-api/references/model-queries.md +281 -0
- package/template/.agents/skills/data/prisma-client-api/references/query-options.md +276 -0
- package/template/.agents/skills/data/prisma-client-api/references/raw-queries.md +194 -0
- package/template/.agents/skills/data/prisma-client-api/references/relations.md +308 -0
- package/template/.agents/skills/data/prisma-client-api/references/transactions.md +184 -0
- package/template/.agents/skills/design/impeccable/SKILL.md +176 -0
- package/template/.agents/skills/design/impeccable/reference/adapt.md +311 -0
- package/template/.agents/skills/design/impeccable/reference/animate.md +201 -0
- package/template/.agents/skills/design/impeccable/reference/audit.md +133 -0
- package/template/.agents/skills/design/impeccable/reference/bolder.md +113 -0
- package/template/.agents/skills/design/impeccable/reference/brand.md +108 -0
- package/template/.agents/skills/design/impeccable/reference/clarify.md +288 -0
- package/template/.agents/skills/design/impeccable/reference/codex.md +105 -0
- package/template/.agents/skills/design/impeccable/reference/colorize.md +257 -0
- package/template/.agents/skills/design/impeccable/reference/craft.md +123 -0
- package/template/.agents/skills/design/impeccable/reference/critique.md +767 -0
- package/template/.agents/skills/design/impeccable/reference/delight.md +302 -0
- package/template/.agents/skills/design/impeccable/reference/distill.md +111 -0
- package/template/.agents/skills/design/impeccable/reference/document.md +429 -0
- package/template/.agents/skills/design/impeccable/reference/extract.md +69 -0
- package/template/.agents/skills/design/impeccable/reference/harden.md +347 -0
- package/template/.agents/skills/design/impeccable/reference/init.md +172 -0
- package/template/.agents/skills/design/impeccable/reference/interaction-design.md +189 -0
- package/template/.agents/skills/design/impeccable/reference/layout.md +161 -0
- package/template/.agents/skills/design/impeccable/reference/live.md +718 -0
- package/template/.agents/skills/design/impeccable/reference/onboard.md +234 -0
- package/template/.agents/skills/design/impeccable/reference/optimize.md +258 -0
- package/template/.agents/skills/design/impeccable/reference/overdrive.md +130 -0
- package/template/.agents/skills/design/impeccable/reference/polish.md +241 -0
- package/template/.agents/skills/design/impeccable/reference/product.md +60 -0
- package/template/.agents/skills/design/impeccable/reference/quieter.md +99 -0
- package/template/.agents/skills/design/impeccable/reference/shape.md +165 -0
- package/template/.agents/skills/design/impeccable/reference/typeset.md +279 -0
- package/template/.agents/skills/design/impeccable/scripts/cleanup-deprecated.mjs +284 -0
- package/template/.agents/skills/design/impeccable/scripts/command-metadata.json +94 -0
- package/template/.agents/skills/design/impeccable/scripts/context-signals.mjs +225 -0
- package/template/.agents/skills/design/impeccable/scripts/context.mjs +270 -0
- package/template/.agents/skills/design/impeccable/scripts/critique-storage.mjs +242 -0
- package/template/.agents/skills/design/impeccable/scripts/design-parser.mjs +835 -0
- package/template/.agents/skills/design/impeccable/scripts/detect-csp.mjs +198 -0
- package/template/.agents/skills/design/impeccable/scripts/detect.mjs +21 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/browser/injected/index.mjs +1733 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/cli/main.mjs +244 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns-browser.js +4551 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns.mjs +43 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/browser/detect-url.mjs +252 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/regex/detect-text.mjs +535 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +986 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/detect-html.mjs +208 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/findings.mjs +12 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/node/file-system.mjs +198 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/profile/profiler.mjs +166 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/registry/antipatterns.mjs +419 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/rules/checks.mjs +2316 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/color.mjs +124 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/constants.mjs +101 -0
- package/template/.agents/skills/design/impeccable/scripts/detector/shared/page.mjs +7 -0
- package/template/.agents/skills/design/impeccable/scripts/impeccable-paths.mjs +126 -0
- package/template/.agents/skills/design/impeccable/scripts/is-generated.mjs +69 -0
- package/template/.agents/skills/design/impeccable/scripts/live-accept.mjs +812 -0
- package/template/.agents/skills/design/impeccable/scripts/live-browser-session.js +123 -0
- package/template/.agents/skills/design/impeccable/scripts/live-browser.js +10316 -0
- package/template/.agents/skills/design/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
- package/template/.agents/skills/design/impeccable/scripts/live-complete.mjs +75 -0
- package/template/.agents/skills/design/impeccable/scripts/live-completion.mjs +19 -0
- package/template/.agents/skills/design/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
- package/template/.agents/skills/design/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
- package/template/.agents/skills/design/impeccable/scripts/live-event-validation.mjs +136 -0
- package/template/.agents/skills/design/impeccable/scripts/live-inject.mjs +557 -0
- package/template/.agents/skills/design/impeccable/scripts/live-insert-ui.mjs +458 -0
- package/template/.agents/skills/design/impeccable/scripts/live-insert.mjs +272 -0
- package/template/.agents/skills/design/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
- package/template/.agents/skills/design/impeccable/scripts/live-manual-edits-buffer.mjs +152 -0
- package/template/.agents/skills/design/impeccable/scripts/live-poll.mjs +379 -0
- package/template/.agents/skills/design/impeccable/scripts/live-resume.mjs +94 -0
- package/template/.agents/skills/design/impeccable/scripts/live-server.mjs +2322 -0
- package/template/.agents/skills/design/impeccable/scripts/live-session-store.mjs +289 -0
- package/template/.agents/skills/design/impeccable/scripts/live-status.mjs +61 -0
- package/template/.agents/skills/design/impeccable/scripts/live-svelte-component.mjs +826 -0
- package/template/.agents/skills/design/impeccable/scripts/live-sveltekit-adapter.mjs +274 -0
- package/template/.agents/skills/design/impeccable/scripts/live-ui-core.mjs +179 -0
- package/template/.agents/skills/design/impeccable/scripts/live-wrap.mjs +894 -0
- package/template/.agents/skills/design/impeccable/scripts/live.mjs +246 -0
- package/template/.agents/skills/design/impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/template/.agents/skills/design/impeccable/scripts/palette.mjs +633 -0
- package/template/.agents/skills/design/impeccable/scripts/pin.mjs +214 -0
- package/template/.agents/skills/design/shadcn/SKILL.md +242 -0
- package/template/.agents/skills/design/shadcn/agents/openai.yml +5 -0
- package/template/.agents/skills/design/shadcn/assets/shadcn-small.png +0 -0
- package/template/.agents/skills/design/shadcn/assets/shadcn.png +0 -0
- package/template/.agents/skills/design/shadcn/cli.md +257 -0
- package/template/.agents/skills/design/shadcn/customization.md +202 -0
- package/template/.agents/skills/design/shadcn/evals/evals.json +47 -0
- package/template/.agents/skills/design/shadcn/mcp.md +94 -0
- package/template/.agents/skills/design/shadcn/rules/base-vs-radix.md +306 -0
- package/template/.agents/skills/design/shadcn/rules/composition.md +195 -0
- package/template/.agents/skills/design/shadcn/rules/forms.md +192 -0
- package/template/.agents/skills/design/shadcn/rules/icons.md +101 -0
- package/template/.agents/skills/design/shadcn/rules/styling.md +162 -0
- package/template/.agents/skills/find-skills/SKILL.md +142 -0
- package/template/.agents/skills/integrations/langfuse/SKILL.md +142 -0
- package/template/.agents/skills/integrations/langfuse/references/cli.md +52 -0
- package/template/.agents/skills/integrations/langfuse/references/error-analysis.md +100 -0
- package/template/.agents/skills/integrations/langfuse/references/instrumentation.md +134 -0
- package/template/.agents/skills/integrations/langfuse/references/judge-calibration.md +288 -0
- package/template/.agents/skills/integrations/langfuse/references/prompt-migration.md +234 -0
- package/template/.agents/skills/integrations/langfuse/references/sdk-upgrade.md +175 -0
- package/template/.agents/skills/integrations/langfuse/references/skill-feedback.md +52 -0
- package/template/.agents/skills/integrations/langfuse/references/user-feedback.md +88 -0
- package/template/.agents/skills/integrations/posthog/SKILL.md +102 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-alerts.md +63 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-assigning-issues.md +77 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-fingerprints.md +57 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-monitoring.md +140 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-nextjs.md +490 -0
- package/template/.agents/skills/integrations/posthog/references/error-tracking-source-maps.md +45 -0
- package/template/.agents/skills/integrations/posthog/references/feature-flags-best-practices.md +139 -0
- package/template/.agents/skills/integrations/posthog/references/feature-flags-react.md +302 -0
- package/template/.agents/skills/integrations/posthog/references/identify-users.md +202 -0
- package/template/.agents/skills/integrations/posthog/references/integration-example.md +706 -0
- package/template/.agents/skills/integrations/posthog/references/integration-nextjs.md +385 -0
- package/template/.agents/skills/integrations/posthog/references/integration-step-1-begin.md +43 -0
- package/template/.agents/skills/integrations/posthog/references/integration-step-2-edit.md +37 -0
- package/template/.agents/skills/integrations/posthog/references/integration-step-3-revise.md +22 -0
- package/template/.agents/skills/integrations/posthog/references/integration-step-4-conclude.md +38 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-anthropic.md +200 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-basics.md +62 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-costs.md +197 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-manual-capture.md +397 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-traces.md +98 -0
- package/template/.agents/skills/integrations/posthog/references/llm-analytics-vercel-ai.md +120 -0
- package/template/.agents/skills/repo/repo-ci/SKILL.md +265 -0
- package/template/.agents/skills/repo/repo-init-next-js/SKILL.md +129 -0
- package/template/.agents/skills/repo/repo-init-next-js/references/file-contents.md +800 -0
- package/template/.agents/skills/repo/repo-init-next-js/scripts/setup.sh +47 -0
- package/template/.agents/skills/repo/repo-init-node/SKILL.md +196 -0
- package/template/.agents/skills/skill-creator/LICENSE.txt +202 -0
- package/template/.agents/skills/skill-creator/SKILL.md +485 -0
- package/template/.agents/skills/skill-creator/agents/analyzer.md +274 -0
- package/template/.agents/skills/skill-creator/agents/comparator.md +202 -0
- package/template/.agents/skills/skill-creator/agents/grader.md +223 -0
- package/template/.agents/skills/skill-creator/assets/eval_review.html +146 -0
- package/template/.agents/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/template/.agents/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/template/.agents/skills/skill-creator/references/schemas.md +430 -0
- package/template/.agents/skills/skill-creator/scripts/__init__.py +0 -0
- package/template/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/template/.agents/skills/skill-creator/scripts/generate_report.py +326 -0
- package/template/.agents/skills/skill-creator/scripts/improve_description.py +247 -0
- package/template/.agents/skills/skill-creator/scripts/package_skill.py +136 -0
- package/template/.agents/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/template/.agents/skills/skill-creator/scripts/run_eval.py +310 -0
- package/template/.agents/skills/skill-creator/scripts/run_loop.py +328 -0
- package/template/.agents/skills/skill-creator/scripts/utils.py +47 -0
- package/template/.agents/upstreams.json +80 -0
package/template/.agents/skills/integrations/posthog/references/llm-analytics-manual-capture.md
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
# Manual capture LLM analytics installation - Docs
|
|
2
|
+
|
|
3
|
+
1. 1
|
|
4
|
+
|
|
5
|
+
## Capture LLM events manually
|
|
6
|
+
|
|
7
|
+
If you're using a different server-side SDK or prefer to use the API, you can manually capture the data by calling the `capture` method or using the [capture API](/docs/api/capture.md).
|
|
8
|
+
|
|
9
|
+
## API
|
|
10
|
+
|
|
11
|
+
### Capture via API
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
curl -X POST "https://us.i.posthog.com/i/v0/e/" \
|
|
15
|
+
-H "Content-Type: application/json" \
|
|
16
|
+
-d '{
|
|
17
|
+
"api_key": "<ph_project_token>",
|
|
18
|
+
"event": "$ai_generation",
|
|
19
|
+
"properties": {
|
|
20
|
+
"distinct_id": "user_123",
|
|
21
|
+
"$ai_trace_id": "trace_id_here",
|
|
22
|
+
"$ai_model": "gpt-5-mini",
|
|
23
|
+
"$ai_provider": "openai",
|
|
24
|
+
"$ai_input": [{"role": "user", "content": "Tell me a fun fact about hedgehogs"}],
|
|
25
|
+
"$ai_input_tokens": 10,
|
|
26
|
+
"$ai_output_choices": [{"role": "assistant", "content": "Hedgehogs have around 5,000 to 7,000 spines on their backs!"}],
|
|
27
|
+
"$ai_output_tokens": 20,
|
|
28
|
+
"$ai_latency": 1.5,
|
|
29
|
+
"$ai_stream": true,
|
|
30
|
+
"$ai_time_to_first_token": 0.25
|
|
31
|
+
}
|
|
32
|
+
}'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Node.js
|
|
36
|
+
|
|
37
|
+
### 1\. Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install posthog-node
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2\. Initialize PostHog
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
import { PostHog } from 'posthog-node'
|
|
47
|
+
const client = new PostHog('<ph_project_token>', {
|
|
48
|
+
host: 'https://us.i.posthog.com'
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 3\. Capture Event
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
// After your LLM call
|
|
56
|
+
client.capture({
|
|
57
|
+
distinctId: 'user_123',
|
|
58
|
+
event: '$ai_generation',
|
|
59
|
+
properties: {
|
|
60
|
+
$ai_trace_id: 'trace_id_here',
|
|
61
|
+
$ai_model: 'gpt-5-mini',
|
|
62
|
+
$ai_provider: 'openai',
|
|
63
|
+
$ai_input: [{ role: 'user', content: 'Tell me a fun fact about hedgehogs' }],
|
|
64
|
+
$ai_input_tokens: 10,
|
|
65
|
+
$ai_output_choices: [{ role: 'assistant', content: 'Hedgehogs have around 5,000 to 7,000 spines on their backs!' }],
|
|
66
|
+
$ai_output_tokens: 20,
|
|
67
|
+
$ai_latency: 1.5,
|
|
68
|
+
// For streaming responses, also include:
|
|
69
|
+
// $ai_stream: true,
|
|
70
|
+
// $ai_time_to_first_token: 0.25
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
client.shutdown()
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Python
|
|
77
|
+
|
|
78
|
+
### 1\. Install
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install posthog
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 2\. Initialize PostHog
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from posthog import Posthog
|
|
88
|
+
posthog = Posthog("<ph_project_token>", host="https://us.i.posthog.com")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 3\. Capture Event
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
# After your LLM call
|
|
95
|
+
posthog.capture(
|
|
96
|
+
distinct_id='user_123',
|
|
97
|
+
event='$ai_generation',
|
|
98
|
+
properties={
|
|
99
|
+
'$ai_trace_id': 'trace_id_here',
|
|
100
|
+
'$ai_model': 'gpt-5-mini',
|
|
101
|
+
'$ai_provider': 'openai',
|
|
102
|
+
'$ai_input': [{'role': 'user', 'content': 'Tell me a fun fact about hedgehogs'}],
|
|
103
|
+
'$ai_input_tokens': 10,
|
|
104
|
+
'$ai_output_choices': [{'role': 'assistant', 'content': 'Hedgehogs have around 5,000 to 7,000 spines on their backs!'}],
|
|
105
|
+
'$ai_output_tokens': 20,
|
|
106
|
+
'$ai_latency': 1.5,
|
|
107
|
+
# For streaming responses, also include:
|
|
108
|
+
# '$ai_stream': True,
|
|
109
|
+
# '$ai_time_to_first_token': 0.25
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Go
|
|
115
|
+
|
|
116
|
+
### 1\. Install
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
go get github.com/posthog/posthog-go
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 2\. Initialize PostHog
|
|
123
|
+
|
|
124
|
+
```go
|
|
125
|
+
import "github.com/posthog/posthog-go"
|
|
126
|
+
client, _ := posthog.NewWithConfig("<ph_project_token>", posthog.Config{
|
|
127
|
+
Endpoint: "https://us.i.posthog.com",
|
|
128
|
+
})
|
|
129
|
+
defer client.Close()
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 3\. Capture Event
|
|
133
|
+
|
|
134
|
+
```go
|
|
135
|
+
// After your LLM call
|
|
136
|
+
client.Enqueue(posthog.Capture{
|
|
137
|
+
DistinctId: "user_123",
|
|
138
|
+
Event: "$ai_generation",
|
|
139
|
+
Properties: map[string]interface{}{
|
|
140
|
+
"$ai_trace_id": "trace_id_here",
|
|
141
|
+
"$ai_model": "gpt-5-mini",
|
|
142
|
+
"$ai_provider": "openai",
|
|
143
|
+
"$ai_input_tokens": 10,
|
|
144
|
+
"$ai_output_tokens": 20,
|
|
145
|
+
"$ai_latency": 1.5,
|
|
146
|
+
// For streaming responses, also include:
|
|
147
|
+
// "$ai_stream": true,
|
|
148
|
+
// "$ai_time_to_first_token": 0.25,
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Ruby
|
|
154
|
+
|
|
155
|
+
### 1\. Install
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
gem install posthog-ruby
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 2\. Initialize PostHog
|
|
162
|
+
|
|
163
|
+
```ruby
|
|
164
|
+
require 'posthog-ruby'
|
|
165
|
+
posthog = PostHog::Client.new({
|
|
166
|
+
api_key: '<ph_project_token>',
|
|
167
|
+
host: 'https://us.i.posthog.com'
|
|
168
|
+
})
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 3\. Capture Event
|
|
172
|
+
|
|
173
|
+
```ruby
|
|
174
|
+
# After your LLM call
|
|
175
|
+
posthog.capture({
|
|
176
|
+
distinct_id: 'user_123',
|
|
177
|
+
event: '$ai_generation',
|
|
178
|
+
properties: {
|
|
179
|
+
'$ai_trace_id' => 'trace_id_here',
|
|
180
|
+
'$ai_model' => 'gpt-5-mini',
|
|
181
|
+
'$ai_provider' => 'openai',
|
|
182
|
+
'$ai_input_tokens' => 10,
|
|
183
|
+
'$ai_output_tokens' => 20,
|
|
184
|
+
'$ai_latency' => 1.5
|
|
185
|
+
# For streaming responses, also include:
|
|
186
|
+
# '$ai_stream' => true,
|
|
187
|
+
# '$ai_time_to_first_token' => 0.25
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## PHP
|
|
193
|
+
|
|
194
|
+
### 1\. Install
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
composer require posthog/posthog-php
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### 2\. Initialize PostHog
|
|
201
|
+
|
|
202
|
+
```php
|
|
203
|
+
<?php
|
|
204
|
+
require_once __DIR__ . '/vendor/autoload.php';
|
|
205
|
+
use PostHog\PostHog;
|
|
206
|
+
PostHog::init('<ph_project_token>', [
|
|
207
|
+
'host' => 'https://us.i.posthog.com'
|
|
208
|
+
]);
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 3\. Capture Event
|
|
212
|
+
|
|
213
|
+
```php
|
|
214
|
+
// After your LLM call
|
|
215
|
+
PostHog::capture([
|
|
216
|
+
'distinctId' => 'user_123',
|
|
217
|
+
'event' => '$ai_generation',
|
|
218
|
+
'properties' => [
|
|
219
|
+
'$ai_trace_id' => 'trace_id_here',
|
|
220
|
+
'$ai_model' => 'gpt-5-mini',
|
|
221
|
+
'$ai_provider' => 'openai',
|
|
222
|
+
'$ai_input_tokens' => 10,
|
|
223
|
+
'$ai_output_tokens' => 20,
|
|
224
|
+
'$ai_latency' => 1.5
|
|
225
|
+
// For streaming responses, also include:
|
|
226
|
+
// '$ai_stream' => true,
|
|
227
|
+
// '$ai_time_to_first_token' => 0.25
|
|
228
|
+
]
|
|
229
|
+
]);
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Event Properties
|
|
233
|
+
|
|
234
|
+
Each event type has specific properties. See the tabs below for detailed property documentation for each event type.
|
|
235
|
+
|
|
236
|
+
## Generation
|
|
237
|
+
|
|
238
|
+
A generation is a single call to an LLM.
|
|
239
|
+
|
|
240
|
+
**Event name**: `$ai_generation`
|
|
241
|
+
|
|
242
|
+
### Core properties
|
|
243
|
+
|
|
244
|
+
| Property | Description |
|
|
245
|
+
| --- | --- |
|
|
246
|
+
| $ai_trace_id | The trace ID (a UUID to group AI events) like conversation_idMust contain only letters, numbers, and special characters: -, _, ~, ., @, (, ), !, ', :, \|Example: d9222e05-8708-41b8-98ea-d4a21849e761 |
|
|
247
|
+
| $ai_session_id | (Optional) Groups related traces together. Use this to organize traces by whatever grouping makes sense for your application (user sessions, workflows, conversations, or other logical boundaries).Example: session-abc-123, conv-user-456 |
|
|
248
|
+
| $ai_span_id | (Optional) Unique identifier for this generation |
|
|
249
|
+
| $ai_span_name | (Optional) Name given to this generationExample: summarize_text |
|
|
250
|
+
| $ai_parent_id | (Optional) Parent span ID for tree view grouping |
|
|
251
|
+
| $ai_model | The model usedExample: gpt-5-mini |
|
|
252
|
+
| $ai_provider | The LLM providerExample: openai, anthropic, gemini |
|
|
253
|
+
| $ai_input_tokens | The number of tokens in the input (often found in response.usage) |
|
|
254
|
+
| $ai_output_tokens | The number of tokens in the output (often found in response.usage) |
|
|
255
|
+
| $ai_latency | (Optional) The latency of the LLM call in seconds |
|
|
256
|
+
| $ai_time_to_first_token | (Optional) Time to first token in seconds. Only applicable for streaming responses. |
|
|
257
|
+
| $ai_http_status | (Optional) The HTTP status code of the response |
|
|
258
|
+
| $ai_base_url | (Optional) The base URL of the LLM providerExample: https://api.openai.com/v1 |
|
|
259
|
+
| $ai_request_url | (Optional) The full URL of the request made to the LLM APIExample: https://api.openai.com/v1/chat/completions |
|
|
260
|
+
| $ai_is_error | (Optional) Boolean to indicate if the request was an error |
|
|
261
|
+
| $ai_error | (Optional) The error message or object |
|
|
262
|
+
|
|
263
|
+
### Cost properties
|
|
264
|
+
|
|
265
|
+
Cost properties are optional as we can automatically calculate them from model and token counts. If you want, you can provide your own cost properties or custom pricing instead.
|
|
266
|
+
|
|
267
|
+
#### Pre-calculated costs
|
|
268
|
+
|
|
269
|
+
| Property | Description |
|
|
270
|
+
| --- | --- |
|
|
271
|
+
| $ai_input_cost_usd | (Optional) The cost in USD of the input tokens |
|
|
272
|
+
| $ai_output_cost_usd | (Optional) The cost in USD of the output tokens |
|
|
273
|
+
| $ai_request_cost_usd | (Optional) The cost in USD for the requests |
|
|
274
|
+
| $ai_web_search_cost_usd | (Optional) The cost in USD for the web searches |
|
|
275
|
+
| $ai_total_cost_usd | (Optional) The total cost in USD (sum of all cost components) |
|
|
276
|
+
|
|
277
|
+
#### Custom pricing
|
|
278
|
+
|
|
279
|
+
| Property | Description |
|
|
280
|
+
| --- | --- |
|
|
281
|
+
| $ai_input_token_price | (Optional) Price per input token (used to calculate $ai_input_cost_usd) |
|
|
282
|
+
| $ai_output_token_price | (Optional) Price per output token (used to calculate $ai_output_cost_usd) |
|
|
283
|
+
| $ai_cache_read_token_price | (Optional) Price per cached token read |
|
|
284
|
+
| $ai_cache_write_token_price | (Optional) Price per cached token write |
|
|
285
|
+
| $ai_request_price | (Optional) Price per request |
|
|
286
|
+
| $ai_request_count | (Optional) Number of requests (defaults to 1 if $ai_request_price is set) |
|
|
287
|
+
| $ai_web_search_price | (Optional) Price per web search |
|
|
288
|
+
| $ai_web_search_count | (Optional) Number of web searches performed |
|
|
289
|
+
|
|
290
|
+
### Cache properties
|
|
291
|
+
|
|
292
|
+
| Property | Description |
|
|
293
|
+
| --- | --- |
|
|
294
|
+
| $ai_cache_read_input_tokens | (Optional) Number of tokens read from cache |
|
|
295
|
+
| $ai_cache_creation_input_tokens | (Optional) Number of tokens written to cache (Anthropic-specific) |
|
|
296
|
+
| $ai_cache_reporting_exclusive | (Optional) Whether cache tokens are excluded from $ai_input_tokens. When true, cache tokens are separate from input tokens. When false, input tokens already include cache tokens. Defaults to true for Anthropic provider or Claude models, false otherwise. |
|
|
297
|
+
|
|
298
|
+
### Model parameters
|
|
299
|
+
|
|
300
|
+
| Property | Description |
|
|
301
|
+
| --- | --- |
|
|
302
|
+
| $ai_temperature | (Optional) Temperature parameter used in the LLM request |
|
|
303
|
+
| $ai_stream | (Optional) Whether the response was streamed |
|
|
304
|
+
| $ai_max_tokens | (Optional) Maximum tokens setting for the LLM response |
|
|
305
|
+
|
|
306
|
+
## Trace
|
|
307
|
+
|
|
308
|
+
A trace is a group that contains multiple spans, generations, and embeddings. Traces can be manually sent as events or appear as pseudo-events automatically created from child events.
|
|
309
|
+
|
|
310
|
+
**Event name**: `$ai_trace`
|
|
311
|
+
|
|
312
|
+
### Core properties
|
|
313
|
+
|
|
314
|
+
| Property | Description |
|
|
315
|
+
| --- | --- |
|
|
316
|
+
| $ai_trace_id | The trace ID (a UUID to group related AI events together)Must contain only letters, numbers, and special characters: -, _, ~, ., @, (, ), !, ', :, \|Example: d9222e05-8708-41b8-98ea-d4a21849e761 |
|
|
317
|
+
| $ai_session_id | (Optional) Groups related traces together. Use this to organize traces by whatever grouping makes sense for your application (user sessions, workflows, conversations, or other logical boundaries).Example: session-abc-123, conv-user-456 |
|
|
318
|
+
| $ai_latency | (Optional) The latency of the trace in seconds |
|
|
319
|
+
| $ai_span_name | (Optional) The name of the traceExample: chat_completion, rag_pipeline |
|
|
320
|
+
| $ai_is_error | (Optional) Boolean to indicate if the trace encountered an error |
|
|
321
|
+
| $ai_error | (Optional) The error message or object if the trace failed |
|
|
322
|
+
|
|
323
|
+
### Pseudo-trace Events
|
|
324
|
+
|
|
325
|
+
When you send generation (`$ai_generation`), span (`$ai_span`), or embedding (`$ai_embedding`) events with a `$ai_trace_id`, PostHog automatically creates a pseudo-trace event that appears in the dashboard as a parent grouping. These pseudo-traces:
|
|
326
|
+
|
|
327
|
+
- Are not actual events in your data
|
|
328
|
+
- Automatically aggregate metrics from child events (latency, tokens, costs)
|
|
329
|
+
- Provide a hierarchical view of your AI operations
|
|
330
|
+
- Do not require sending an explicit `$ai_trace` event
|
|
331
|
+
|
|
332
|
+
This means you can either:
|
|
333
|
+
|
|
334
|
+
1. Send explicit `$ai_trace` events to control the trace metadata
|
|
335
|
+
2. Let PostHog automatically create pseudo-traces from your generation/span events
|
|
336
|
+
|
|
337
|
+
## Span
|
|
338
|
+
|
|
339
|
+
A span is a single action within your application, such as a function call or vector database search.
|
|
340
|
+
|
|
341
|
+
**Event name**: `$ai_span`
|
|
342
|
+
|
|
343
|
+
### Core properties
|
|
344
|
+
|
|
345
|
+
| Property | Description |
|
|
346
|
+
| --- | --- |
|
|
347
|
+
| $ai_trace_id | The trace ID (a UUID to group related AI events together)Must contain only letters, numbers, and the following characters: -, _, ~, ., @, (, ), !, ', :, \|Example: d9222e05-8708-41b8-98ea-d4a21849e761 |
|
|
348
|
+
| $ai_session_id | (Optional) Groups related traces together. Use this to organize traces by whatever grouping makes sense for your application (user sessions, workflows, conversations, or other logical boundaries).Example: session-abc-123, conv-user-456 |
|
|
349
|
+
| $ai_span_id | (Optional) Unique identifier for this spanExample: bdf42359-9364-4db7-8958-c001f28c9255 |
|
|
350
|
+
| $ai_span_name | (Optional) The name of the spanExample: vector_search, data_retrieval, tool_call |
|
|
351
|
+
| $ai_parent_id | (Optional) Parent ID for tree view grouping (trace_id or another span_id)Example: 537b7988-0186-494f-a313-77a5a8f7db26 |
|
|
352
|
+
| $ai_latency | (Optional) The latency of the span in secondsExample: 0.361 |
|
|
353
|
+
| $ai_is_error | (Optional) Boolean to indicate if the span encountered an error |
|
|
354
|
+
|
|
355
|
+
## Embedding
|
|
356
|
+
|
|
357
|
+
An embedding is a single call to an embedding model to convert text into a vector representation.
|
|
358
|
+
|
|
359
|
+
**Event name**: `$ai_embedding`
|
|
360
|
+
|
|
361
|
+
### Core properties
|
|
362
|
+
|
|
363
|
+
| Property | Description |
|
|
364
|
+
| --- | --- |
|
|
365
|
+
| $ai_trace_id | The trace ID (a UUID to group related AI events together). Must contain only letters, numbers, and special characters: -, _, ~, ., @, (, ), !, ', :, \|Example: d9222e05-8708-41b8-98ea-d4a21849e761 |
|
|
366
|
+
| $ai_session_id | (Optional) Groups related traces together. Use this to organize traces by whatever grouping makes sense for your application (user sessions, workflows, conversations, or other logical boundaries).Example: session-abc-123, conv-user-456 |
|
|
367
|
+
| $ai_span_id | (Optional) Unique identifier for this embedding operation |
|
|
368
|
+
| $ai_span_name | (Optional) Name given to this embedding operationExample: embed_user_query, index_document |
|
|
369
|
+
| $ai_parent_id | (Optional) Parent span ID for tree-view grouping |
|
|
370
|
+
| $ai_model | The embedding model usedExample: text-embedding-3-small, text-embedding-ada-002 |
|
|
371
|
+
| $ai_provider | The LLM providerExample: openai, cohere, voyage |
|
|
372
|
+
| $ai_input | The text to embedExample: "Tell me a fun fact about hedgehogs" or array of strings for batch embeddings |
|
|
373
|
+
| $ai_input_tokens | The number of tokens in the input |
|
|
374
|
+
| $ai_latency | (Optional) The latency of the embedding call in seconds |
|
|
375
|
+
| $ai_http_status | (Optional) The HTTP status code of the response |
|
|
376
|
+
| $ai_base_url | (Optional) The base URL of the LLM providerExample: https://api.openai.com/v1 |
|
|
377
|
+
| $ai_request_url | (Optional) The full URL of the request made to the embedding APIExample: https://api.openai.com/v1/embeddings |
|
|
378
|
+
| $ai_is_error | (Optional) Boolean to indicate if the request was an error |
|
|
379
|
+
| $ai_error | (Optional) The error message or object if the embedding failed |
|
|
380
|
+
|
|
381
|
+
### Cost properties
|
|
382
|
+
|
|
383
|
+
Cost properties are optional as we can automatically calculate them from model and token counts. If you want, you can provide your own cost property instead.
|
|
384
|
+
|
|
385
|
+
| Property | Description |
|
|
386
|
+
| --- | --- |
|
|
387
|
+
| $ai_input_cost_usd | (Optional) Cost in USD for input tokens |
|
|
388
|
+
| $ai_output_cost_usd | (Optional) Cost in USD for output tokens (usually 0 for embeddings) |
|
|
389
|
+
| $ai_total_cost_usd | (Optional) Total cost in USD |
|
|
390
|
+
|
|
391
|
+
### Community questions
|
|
392
|
+
|
|
393
|
+
Ask a question
|
|
394
|
+
|
|
395
|
+
### Was this page useful?
|
|
396
|
+
|
|
397
|
+
HelpfulCould be better
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Traces - Docs
|
|
2
|
+
|
|
3
|
+
Traces are a collection of [generations](/docs/llm-analytics/generations.md) and [spans](/docs/llm-analytics/spans.md) that capture a full interaction between a user and an LLM. The [traces tab](https://app.posthog.com/llm-analytics/traces) lists them along with the properties autocaptured by PostHog like the person, total cost, total latency, and more.
|
|
4
|
+
|
|
5
|
+
## Sessions vs Traces
|
|
6
|
+
|
|
7
|
+
- **Trace** (`$ai_trace_id`): Groups related generations and spans together. Required for all LLM analytics events.
|
|
8
|
+
- **Session** (`$ai_session_id`): Optional property that groups multiple traces together based on your chosen grouping strategy.
|
|
9
|
+
|
|
10
|
+
See the [Sessions](/docs/llm-analytics/sessions.md) documentation for more details on how to use `$ai_session_id`.
|
|
11
|
+
|
|
12
|
+
## Trace timeline
|
|
13
|
+
|
|
14
|
+
Clicking on a trace opens a timeline of the interaction with all the generation and span events. The trace timeline enables you to see the entire conversation, profiling details, and the individual generations and spans.
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
A trace presents LLM event data in a timeline, tree-structured view
|
|
19
|
+
|
|
20
|
+
## Conversation display options
|
|
21
|
+
|
|
22
|
+
When viewing a trace, you can control how conversation messages are displayed using the display options dropdown. The available options are:
|
|
23
|
+
|
|
24
|
+
- **Expand all** - Shows the full content of all messages in the conversation
|
|
25
|
+
- **Expand user only** - Expands only user messages, keeping system and assistant messages collapsed for easier scanning of user inputs
|
|
26
|
+
- **Collapse except output and last input** - The default view that shows the model's output and the most recent user input, keeping earlier messages collapsed
|
|
27
|
+
|
|
28
|
+
## Tool calls
|
|
29
|
+
|
|
30
|
+
Traces display any [tools](/docs/llm-analytics/tools.md) called by the generations within them, shown as tags in the traces list. This makes it easy to see which conversations involved tool use at a glance.
|
|
31
|
+
|
|
32
|
+
## Sentiment classification
|
|
33
|
+
|
|
34
|
+
PostHog can classify the sentiment of user messages in a trace as negative, neutral, or positive. Sentiment is computed on-demand using a local model when you view a trace — no data is sent to third-party services. Each trace gets an overall sentiment label and score, with a per-generation and per-message breakdown. See [Sentiment classification](/docs/llm-analytics/sentiment.md) for more details.
|
|
35
|
+
|
|
36
|
+
## Search traces with PostHog AI
|
|
37
|
+
|
|
38
|
+
[PostHog AI](/docs/posthog-ai.md) can search and analyze your LLM traces using natural language. When you're on an [LLM Analytics page](https://app.posthog.com/llm-analytics), PostHog AI automatically switches to its LLM analytics mode, giving it access to tools for searching traces by date range, model, cost, error status, and other properties.
|
|
39
|
+
|
|
40
|
+
Example prompts you can try:
|
|
41
|
+
|
|
42
|
+
- "Show me recent LLM traces from the past week"
|
|
43
|
+
- "What are the most expensive LLM calls from today?"
|
|
44
|
+
- "Find traces with errors in the last 30 days"
|
|
45
|
+
- "What's happening in my most expensive trace?"
|
|
46
|
+
|
|
47
|
+
PostHog AI returns trace details including name, latency, cost, token counts, and error count. It can also read individual traces to provide a detailed summary of what happened.
|
|
48
|
+
|
|
49
|
+
## AI event hierarchy
|
|
50
|
+
|
|
51
|
+
flowchart TD S\["<strong>$ai\_session\_id</strong><br/>(optional)"\] A\[<strong>$ai\_trace</strong>\] A2\[<strong>$ai\_trace</strong>\] B\[<strong>$ai\_generation</strong>\] C@{ shape: processes, label: "<strong>$ai\_spans</strong>" } D\[<strong>$ai\_generation</strong>\] E@{ shape: processes, label: "<strong>$ai\_spans</strong>" } F\[<strong>$ai\_generation</strong>\] S -.-> A S -.-> A2 A --> B A --> C C --> D C --> E E --> F
|
|
52
|
+
|
|
53
|
+
Traces consist of the following event hierarchy:
|
|
54
|
+
|
|
55
|
+
1. (Optional) A session (`$ai_session_id`) can group multiple traces together.
|
|
56
|
+
2. A trace (`$ai_trace_id`) is the top-level required grouping for LLM events.
|
|
57
|
+
3. A trace can contain multiple spans and generations.
|
|
58
|
+
4. A span can be the parent of other spans.
|
|
59
|
+
5. A generation can be the child of a span or trace.
|
|
60
|
+
|
|
61
|
+
## Event properties
|
|
62
|
+
|
|
63
|
+
A trace is a group that contains multiple spans, generations, and embeddings. Traces can be manually sent as events or appear as pseudo-events automatically created from child events.
|
|
64
|
+
|
|
65
|
+
**Event name**: `$ai_trace`
|
|
66
|
+
|
|
67
|
+
### Core properties
|
|
68
|
+
|
|
69
|
+
| Property | Description |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| $ai_trace_id | The trace ID (a UUID to group related AI events together)Must contain only letters, numbers, and special characters: -, _, ~, ., @, (, ), !, ', :, \|Example: d9222e05-8708-41b8-98ea-d4a21849e761 |
|
|
72
|
+
| $ai_session_id | (Optional) Groups related traces together. Use this to organize traces by whatever grouping makes sense for your application (user sessions, workflows, conversations, or other logical boundaries).Example: session-abc-123, conv-user-456 |
|
|
73
|
+
| $ai_latency | (Optional) The latency of the trace in seconds |
|
|
74
|
+
| $ai_span_name | (Optional) The name of the traceExample: chat_completion, rag_pipeline |
|
|
75
|
+
| $ai_is_error | (Optional) Boolean to indicate if the trace encountered an error |
|
|
76
|
+
| $ai_error | (Optional) The error message or object if the trace failed |
|
|
77
|
+
|
|
78
|
+
### Pseudo-trace Events
|
|
79
|
+
|
|
80
|
+
When you send generation (`$ai_generation`), span (`$ai_span`), or embedding (`$ai_embedding`) events with a `$ai_trace_id`, PostHog automatically creates a pseudo-trace event that appears in the dashboard as a parent grouping. These pseudo-traces:
|
|
81
|
+
|
|
82
|
+
- Are not actual events in your data
|
|
83
|
+
- Automatically aggregate metrics from child events (latency, tokens, costs)
|
|
84
|
+
- Provide a hierarchical view of your AI operations
|
|
85
|
+
- Do not require sending an explicit `$ai_trace` event
|
|
86
|
+
|
|
87
|
+
This means you can either:
|
|
88
|
+
|
|
89
|
+
1. Send explicit `$ai_trace` events to control the trace metadata
|
|
90
|
+
2. Let PostHog automatically create pseudo-traces from your generation/span events
|
|
91
|
+
|
|
92
|
+
### Community questions
|
|
93
|
+
|
|
94
|
+
Ask a question
|
|
95
|
+
|
|
96
|
+
### Was this page useful?
|
|
97
|
+
|
|
98
|
+
HelpfulCould be better
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Vercel AI SDK LLM analytics installation - Docs
|
|
2
|
+
|
|
3
|
+
1. 1
|
|
4
|
+
|
|
5
|
+
## Install dependencies
|
|
6
|
+
|
|
7
|
+
Required
|
|
8
|
+
|
|
9
|
+
Install the PostHog AI package, the Vercel AI SDK, and the OpenTelemetry SDK.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @posthog/ai @ai-sdk/openai ai @opentelemetry/sdk-node @opentelemetry/resources
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**No proxy**
|
|
16
|
+
|
|
17
|
+
These SDKs **do not** proxy your calls. They only send analytics data to PostHog in the background.
|
|
18
|
+
|
|
19
|
+
2. 2
|
|
20
|
+
|
|
21
|
+
## Set up the OpenTelemetry exporter
|
|
22
|
+
|
|
23
|
+
Required
|
|
24
|
+
|
|
25
|
+
Initialize the OpenTelemetry SDK with PostHog's `PostHogTraceExporter`. This sends `gen_ai.*` spans directly to PostHog's OTLP ingestion endpoint. PostHog converts these into `$ai_generation` events automatically.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { NodeSDK } from '@opentelemetry/sdk-node'
|
|
29
|
+
import { resourceFromAttributes } from '@opentelemetry/resources'
|
|
30
|
+
import { PostHogTraceExporter } from '@posthog/ai/otel'
|
|
31
|
+
const sdk = new NodeSDK({
|
|
32
|
+
resource: resourceFromAttributes({
|
|
33
|
+
'service.name': 'my-ai-app',
|
|
34
|
+
}),
|
|
35
|
+
traceExporter: new PostHogTraceExporter({
|
|
36
|
+
apiKey: '<ph_project_token>',
|
|
37
|
+
host: 'https://us.i.posthog.com',
|
|
38
|
+
}),
|
|
39
|
+
})
|
|
40
|
+
sdk.start()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. 3
|
|
44
|
+
|
|
45
|
+
## Call Vercel AI with telemetry enabled
|
|
46
|
+
|
|
47
|
+
Required
|
|
48
|
+
|
|
49
|
+
Pass `experimental_telemetry` to your Vercel AI SDK calls. The `posthog_distinct_id` metadata field links events to a specific user in PostHog.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { generateText } from 'ai'
|
|
53
|
+
import { openai } from '@ai-sdk/openai'
|
|
54
|
+
const result = await generateText({
|
|
55
|
+
model: openai('gpt-5-mini'),
|
|
56
|
+
prompt: 'Tell me a fun fact about hedgehogs.',
|
|
57
|
+
experimental_telemetry: {
|
|
58
|
+
isEnabled: true,
|
|
59
|
+
functionId: 'my-ai-function',
|
|
60
|
+
metadata: {
|
|
61
|
+
posthog_distinct_id: 'user_123', // optional
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
console.log(result.text)
|
|
66
|
+
await sdk.shutdown()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
> **Note:** If you want to capture LLM events anonymously, omit the `posthog_distinct_id` metadata field. See our docs on [anonymous vs identified events](/docs/data/anonymous-vs-identified-events.md) to learn more.
|
|
70
|
+
|
|
71
|
+
You can expect captured `$ai_generation` events to have the following properties:
|
|
72
|
+
|
|
73
|
+
| Property | Description |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| $ai_model | The specific model, like gpt-5-mini or claude-4-sonnet |
|
|
76
|
+
| $ai_latency | The latency of the LLM call in seconds |
|
|
77
|
+
| $ai_time_to_first_token | Time to first token in seconds (streaming only) |
|
|
78
|
+
| $ai_tools | Tools and functions available to the LLM |
|
|
79
|
+
| $ai_input | List of messages sent to the LLM |
|
|
80
|
+
| $ai_input_tokens | The number of tokens in the input (often found in response.usage) |
|
|
81
|
+
| $ai_output_choices | List of response choices from the LLM |
|
|
82
|
+
| $ai_output_tokens | The number of tokens in the output (often found in response.usage) |
|
|
83
|
+
| $ai_total_cost_usd | The total cost in USD (input + output) |
|
|
84
|
+
| [[...]](/docs/llm-analytics/generations.md#event-properties) | See [full list](/docs/llm-analytics/generations.md#event-properties) of properties |
|
|
85
|
+
|
|
86
|
+
4. ## Verify traces and generations
|
|
87
|
+
|
|
88
|
+
Recommended
|
|
89
|
+
|
|
90
|
+
*Confirm LLM events are being sent to PostHog*
|
|
91
|
+
|
|
92
|
+
Let's make sure LLM events are being captured and sent to PostHog. Under **LLM analytics**, you should see rows of data appear in the **Traces** and **Generations** tabs.
|
|
93
|
+
|
|
94
|
+

|
|
95
|
+
|
|
96
|
+
[Check for LLM events in PostHog](https://app.posthog.com/llm-analytics/generations)
|
|
97
|
+
|
|
98
|
+
5. 4
|
|
99
|
+
|
|
100
|
+
## Next steps
|
|
101
|
+
|
|
102
|
+
Recommended
|
|
103
|
+
|
|
104
|
+
Now that you're capturing AI conversations, continue with the resources below to learn what else LLM Analytics enables within the PostHog platform.
|
|
105
|
+
|
|
106
|
+
| Resource | Description |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| [Basics](/docs/llm-analytics/basics.md) | Learn the basics of how LLM calls become events in PostHog. |
|
|
109
|
+
| [Generations](/docs/llm-analytics/generations.md) | Read about the $ai_generation event and its properties. |
|
|
110
|
+
| [Traces](/docs/llm-analytics/traces.md) | Explore the trace hierarchy and how to use it to debug LLM calls. |
|
|
111
|
+
| [Spans](/docs/llm-analytics/spans.md) | Review spans and their role in representing individual operations. |
|
|
112
|
+
| [Anaylze LLM performance](/docs/llm-analytics/dashboard.md) | Learn how to create dashboards to analyze LLM performance. |
|
|
113
|
+
|
|
114
|
+
### Community questions
|
|
115
|
+
|
|
116
|
+
Ask a question
|
|
117
|
+
|
|
118
|
+
### Was this page useful?
|
|
119
|
+
|
|
120
|
+
HelpfulCould be better
|