Set Up Traceway
Analyze the application first, agree on its Traceway project structure with the user, help them create that structure in the dashboard, and only then integrate and verify it.
Operating Contract
- Inspect before asking for credentials or changing code.
- Explain what was detected, what is already tracked, and how each production component should report to Traceway.
- Present the proposed project map, or the one-line plan for a scoped run, and wait for the user to confirm it before implementation.
- There are two classes of credentials, treated differently:
- Setup tokens (prefix
tws_) are org-scoped, expire in 6 hours, and can only propose a setup plan; nothing is created until the user approves the plan on the Traceway website. They are designed to transit chat, and asking the user to paste one is expected.
- Project ingest tokens and upload tokens are long-lived. Never print their values, never ask the user to paste them into chat, and never commit them. When Step 3's apply script (or the
traceway CLI) writes an approved plan's ingest tokens into env files, read only the variable names and statuses from its output, never the values.
- Never print token values found in files or the environment. Report only that a value exists and the variable name that carries it.
- Never commit tokens or filled connection strings.
Invocation Forms
| Invocation carries |
Path |
| A project ingest token + url |
Fast Path for a single component, otherwise Steps 1-2, then integrate against the existing project |
A setup token (tws_) + url |
Steps 1-2, then Step 3 from "Write the plan file" (3b) |
| No token |
Steps 1-2, then Step 3 from the top |
Words naming one part of the codebase (track ai use, instrument the background jobs, only apps/worker), with or without a token |
"Scoped Runs" below; the token rows above still decide how the credential is obtained |
Every backend integrates with OpenTelemetry. There is one backend path, not one per language or web framework: Go, Node, Python, PHP, Java, .NET, Ruby, and everything else export OTLP/HTTP to <instance>/api/otel/*. The Traceway project is created with framework OpenTelemetry, which is the only backend option in the dashboard's framework picker. The native Traceway Go SDK is a deliberate exception used only when the user explicitly asks for it.
Fast Path
When all of the following hold, skip Steps 2 and 3 and go straight to the integration steps:
- the repository has exactly one deployable component, and
- the user supplied (or the environment already carries) an instance URL and a project ingest token (not a
tws_ setup token, which exists to create projects), and
- the token's project already matches that component.
Still run Step 1, because it decides how to instrument. Collapse "Propose and Confirm the Project Map" to a single confirmation line ("This is a Go API; it reports to your existing <name> project over OpenTelemetry") and skip the project-creation step entirely. The full map-and-creation ceremony exists for repositories with more than one deployable component, or where no project exists yet. Do not make a user who handed you a token sit through a project-map review for a single service.
Scoped Runs
The skill also runs on one part of a codebase. A request that names a part, instead of asking for the whole setup, is a scoped run: /traceway-setup track ai use, "instrument the background jobs", "add Traceway to apps/worker only", "check that the setup works". The words after the skill name, or the request that loaded the skill, carry the scope. A part is an area (one kind of telemetry) or a path (a directory, package or named component), and the two combine: "track AI use in services/assistant".
| The request names |
Typical wording |
Do |
| AI / LLM usage |
integrate, instrument, track or monitor: AI use, LLM or model calls, tokens, cost, prompts, agents, a chatbot |
Follow ai-usage.md from top to bottom. It carries its own analysis (its Steps A and B are rule 1 below for this scope), instrumentation and verification; read a step of this file only when it sends you here. |
| Background work |
tasks, jobs, cron, queues, workers, schedulers, CLI commands |
Step 1 items 1, 3 and 5, then Step 5, then the task check of Step 9 |
| Endpoints |
routes, endpoint grouping, request tracing |
Step 1 items 1-4, then Step 4 through "Verify endpoint grouping" |
| Errors, logs or metrics |
exceptions, issues; log shipping; custom or business metrics |
Step 1 items 1 and 3, then "Errors", "Logs" or "Metrics" in Step 4, then the matching check of Step 9 |
| Browser app |
frontend, RUM, web vitals, session replay, source maps |
Step 1 items 1, 3, 4 and 7, then the browser part of Step 7 with rum.md, then check 2 of Step 9 |
| Mobile app |
Flutter, React Native, Android, iOS, crashes, symbols |
Step 1 items 1, 3 and 8, then the mobile part of Step 7, then check 3 of Step 9 |
| Host or cluster metrics |
server metrics, the agent, Kubernetes |
Step 1 item 9, then Step 8 |
| Dashboard embedding |
embed a dashboard, customer-facing charts |
"Embedding Dashboards in the User's Application" |
| Verification |
verify, check, "is it working", "why is nothing showing up" |
Step 1 item 3, then Step 9 for what is already set up. Change nothing; report what fails and why. |
| A path or component |
a directory, "only the worker", "just the API" |
The whole flow with every step limited to that path. One component with a token is usually the Fast Path. |
For a verification-only request, use existing configuration and report missing prerequisites. The implementation and project-creation steps apply only when the user asks to set up instrumentation. Combine verification with any named area or path to select the relevant checks.
The wording varies, so match on meaning. When a request fits no row, name the scopes that exist and ask which one is meant. When it names no part at all, run the full setup.
Rules for every scoped run:
- Inspect first, but only what the scope needs. Always run Step 1 items 1 and 3 for the code in scope: the language, and the observability that is already there, including where it exports and which variable names carry the endpoint and token. Add the Step 1 items the table lists. Follow imports to shared clients and deployment configuration when the scoped component depends on them.
- Reuse what exists. A scoped run adds to the current setup: the same Traceway project, the same token variable, the same exporter and
service.name. Do not rebuild the project map, do not rename projects or variables, and do not touch instrumentation outside the scope, even when it looks wrong. Report it instead.
- Make sure the scope can reach Traceway. If the code in scope already exports to Traceway, build on that. If it exports OpenTelemetry somewhere else, ask whether Traceway replaces that destination or runs next to it. If it exports nothing, set up the minimum the scope needs (for a backend area: the exporter from "Exporter configuration" in Step 4 and the one signal the area uses) with the credential path from "Invocation Forms", limited to the one project this code reports to. Say plainly that the rest of the setup was not done.
- Confirm in one line, not with a project map. State the scope, the project it reports to and what will change ("I will trace the 4 OpenAI call sites in
src/llm/; they report to your existing Shop Backend project"). Wait for confirmation before changing code or provisioning a project.
- Verify only the scope, with the checks named in the table, and never report success for a check you did not run.
- Finish with a scope report: what changed, what was verified and how, what could not be verified, and what you noticed outside the scope, each with the scoped request that would handle it (for example "the nightly export job has no task span:
/traceway-setup instrument background jobs").
The Operating Contract applies unchanged: the same credential rules, and no code change before the user has seen what you found.
Step 1: Analyze the Architecture
Before changing anything, build a picture of what is deployed and what is already instrumented:
-
Frameworks and languages: detect them from package.json, go.mod, composer.json, requirements.txt/pyproject.toml, pubspec.yaml, build.gradle(.kts), Package.swift, *.xcodeproj/*.xcworkspace, Podfile, and source extensions. For iOS/Apple targets, note whether the sources are Swift or Objective-C. That choice picks the path in "Frontend and Mobile" (Swift gets the native SDK; Objective-C-only has none and falls back to OTel).
-
Deployable components and entry points: inventory APIs, SSR servers, browser apps, workers, schedulers, CLIs, and mobile applications. Treat code organization as evidence, not proof that something is deployed. Note the deployment target while you are here: Kubernetes manifests, a Helm chart, Kustomize overlays, Dockerfile plus a compose file, or cloud-init / Ansible / Terraform. It decides the host-metrics path in Step 8.
-
Existing observability: find OpenTelemetry configuration, Traceway SDKs, Sentry, Datadog, New Relic, Honeycomb, logging exporters, tracing middleware, source map or symbol upload steps, and observability environment-variable names. Explain whether Traceway will replace, coexist with, or extend each integration. Never display discovered credential values.
-
Production role of JS meta-frameworks (Next.js, SvelteKit, Remix, Nuxt): never assume full-stack.
- Frontend-only signals:
output: 'export' in next.config.* (static export, so there is no server in production); no API routes (app/api/**/route.*, pages/api/*) or only trivial ones; no 'use server' server actions; rewrites/proxy config or a NEXT_PUBLIC_API_URL-style env var pointing the browser at an external API; a separate backend service in this repo, another repo, or another language; static hosting in the deploy config (S3/CloudFront, GitHub Pages, nginx serving out/).
- Server signals: API routes with real logic,
'use server' server actions, database clients imported in server code, SSR reading its own data layer, next start or standalone output in the deploy config.
- Mixed or unclear: ask how the application is deployed and whether the framework server does production work worth tracking.
Frontend-only means integrate ONLY the browser side with the frontend SDK; do NOT add OTel to, or otherwise instrument, the framework's server side. A separate backend is its own component with its own Traceway project.
-
Background work: find cron jobs, queue consumers, schedulers, CLI commands, and long-running workers. Record whether libraries already emit CONSUMER spans.
-
AI/LLM usage: look for provider HTTP requests and shared model clients as well as dependencies for openai, @anthropic-ai/sdk, anthropic, langchain / @langchain/*, ai (Vercel AI SDK), litellm, google-generativeai, cohere, openrouter, and agent frameworks (langgraph, crewai, autogen / ag2, pydantic-ai, @openai/agents, @mastra/*, llamaindex / llama-index, semantic-kernel). Then decide whether this is a conversational product (chatbot, assistant, agent) rather than one-shot LLM calls: look for chat or streaming-chat routes (/chat, /completions, SSE or websocket handlers feeding an LLM), message-history persistence (a messages/conversations table or thread ids), tool/function-calling definitions passed to the model, or any agent framework above. When any of these turn up, the AI integration follows ai-usage.md in this skill directory (Step 6), which starts with a call-site inventory; if the product is conversational or tool-calling, also read ai-agent.md before proposing it.
-
Browser build and release flow: identify the bundler, output directory, source-map settings, deploy pipeline, and existing artifact uploads.
-
Mobile build and release flow: determine whether Flutter is obfuscated, Android uses R8/minification, iOS produces dSYMs, and whether multiple platform directories are one cross-platform product or independently released apps.
-
Deployment and host metrics: inspect Dockerfiles, Compose, Kubernetes, Helm, Terraform, Ansible, cloud-init, PaaS configs, and CI/CD. Determine whether the backend runs on a host where the Traceway OTel Agent is applicable.
Present the findings before asking questions: