Best for
- User asks to debug slow compilation or type checking
- User wants to analyze benchmark performance
- User mentions "bottleneck", "slow", "hang", or "performance"
sunholo-data/ailang/.agents/skills/trace-debugger/SKILL.md
Debug performance issues and understand code flow using AILANG telemetry traces. Use when user asks to debug slow compilation, analyze benchmarks, find bottlenecks, investigate hangs, or understand system behavior.
Decision brief
Debug and analyze AILANG operations using OpenTelemetry distributed tracing. This skill helps identify performance bottlenecks, understand code flow, and debug issues using trace data from GCP Cloud Trace.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Declared | Source record | Install path and trigger |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Declared | Source record | Install path and trigger |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/sunholo-data/ailang --skill ".agents/skills/trace-debugger"Inspect the Agent Skill "trace-debugger" from https://github.com/sunholo-data/ailang/blob/fb85250a127dcc6e8308c6653f153d9c59f08d62/.agents/skills/trace-debugger/SKILL.md at commit fb85250a127dcc6e8308c6653f153d9c59f08d62. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Review the “Quick Start” section in the pinned source before continuing.
Review the “4. Analyze timing breakdown per phase” section in the pinned source before continuing.
The Observatory provides a local dashboard for viewing traces from Codex, Gemini CLI, and AILANG.
Expected output shows either GCP or OTLP mode enabled. If disabled, set environment variables.
Review the “User says: "Why is compilation slow?"” section in the pinned source before continuing.
Permission review
The documentation asks the agent to run terminal commands or scripts.
docker run -d -p 16686:16686 -p 4318:4318 jaegertracing/all-in-oneThe documentation includes network, browsing, or remote request actions.
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318The documentation includes network, browsing, or remote request actions.
# View traces at http://localhost:1957 → Observatory tabThe documentation asks the agent to run terminal commands or scripts.
Run a Codex or Gemini CLI commandEvidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 94/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 33 | Source | Repository attention, not individual Skill quality |
| Compatibility | 2 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Debug and analyze AILANG operations using OpenTelemetry distributed tracing. This skill helps identify performance bottlenecks, understand code flow, and debug issues using trace data from GCP Cloud Trace.
Most common usage:
# User says: "Why is compilation slow?"
# This skill will:
# 1. Check telemetry is configured
# 2. Run the slow operation with tracing
# 3. Query recent traces with ailang trace list
# 4. Analyze timing breakdown per phase
# 5. Identify the bottleneck
# Check telemetry status
ailang trace status
# List recent traces
ailang trace list --hours 2 --limit 20
# View specific trace hierarchy
ailang trace view <trace-id>
Invoke this skill when:
Before debugging with traces:
# Option 1: Google Cloud Trace (recommended)
export GOOGLE_CLOUD_PROJECT=your-project-id
# Option 2: Local Jaeger
docker run -d -p 16686:16686 -p 4318:4318 jaegertracing/all-in-one
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
# Option 3: AILANG Observatory Dashboard (local UI)
ailang server # Starts server on localhost:1957
# View traces at http://localhost:1957 → Observatory tab
# Verify configuration
ailang trace status
The Observatory provides a local dashboard for viewing traces from Codex, Gemini CLI, and AILANG.
ailang server
# Or: make services-start
Add to ~/.Codex/settings.json:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:1957",
"OTEL_RESOURCE_ATTRIBUTES": "ailang.source=user"
}
}
What Codex sends: Events via OTLP logs (token counts, costs, model, session info)
Important: Gemini CLI only supports local (file-based) or gcp (GCP Cloud Trace) telemetry targets.
It does NOT support direct OTLP export to custom endpoints.
Add to ~/.gemini/settings.json:
{
"telemetry": {
"enabled": true,
"target": "gcp",
"logPrompts": true
}
}
Architecture: Gemini traces go to GCP Cloud Trace, then Observatory pulls them via the GCP Trace API.
Trace Linking: The Observatory links Gemini traces to AILANG traces via:
session.id - Links tool invocations in the same sessionailang.task_id - Added by Coordinator for delegated tasksailang.workspace - Groups traces by projectWhat Gemini CLI sends to GCP: Full traces (complete span hierarchy with parent-child relationships, token counts, model info, prompts)
Codex (direct OTLP export to Observatory):
| Variable | Purpose | Example |
|---|---|---|
CLAUDE_CODE_ENABLE_TELEMETRY | Enable Codex telemetry | 1 |
OTEL_LOGS_EXPORTER | Log export protocol | otlp |
OTEL_METRICS_EXPORTER | Metrics export protocol | otlp |
OTEL_EXPORTER_OTLP_PROTOCOL | Transport protocol | http/json |
OTEL_EXPORTER_OTLP_ENDPOINT | Observatory URL | http://localhost:1957 |
OTEL_RESOURCE_ATTRIBUTES | Span metadata | ailang.source=user |
Gemini CLI (GCP Cloud Trace only - configure via ~/.gemini/settings.json):
| Setting | Purpose | Value |
|---|---|---|
telemetry.enabled | Enable telemetry | true |
telemetry.target | Export destination | gcp |
telemetry.logPrompts | Include prompt text | true |
The Observatory receives data on:
/v1/traces - Trace spans (Gemini CLI, AILANG)/v1/logs - Log records (Codex events)/v1/metrics - Metrics dataBoth protobuf and JSON formats are supported.
ailang server is runningNote: If server is not running, OTLP exports fail silently (no impact on CLI tools).
scripts/check_traces.sh [hours] [filter]Quick check for recent traces with optional filtering.
Usage:
# Check last hour of traces
.Codex/skills/trace-debugger/scripts/check_traces.sh
# Check last 4 hours, filter by eval
.Codex/skills/trace-debugger/scripts/check_traces.sh 4 "eval.suite"
# Check compilation traces
.Codex/skills/trace-debugger/scripts/check_traces.sh 1 "compile"
scripts/analyze_compilation.sh <file.ail>Run a file with tracing and analyze compilation phases.
Usage:
# Analyze compilation timing
.Codex/skills/trace-debugger/scripts/analyze_compilation.sh examples/runnable/factorial.ail
ailang trace status
Expected output shows either GCP or OTLP mode enabled. If disabled, set environment variables.
Run the operation that's slow/problematic:
# For compilation issues
GOOGLE_CLOUD_PROJECT=your-project ailang run --caps IO --entry main file.ail
# For eval issues
GOOGLE_CLOUD_PROJECT=your-project ailang eval-suite --models gpt5-mini --benchmarks simple_hello
# For message system issues
GOOGLE_CLOUD_PROJECT=your-project ailang messages list
# List recent traces
ailang trace list --hours 1 --limit 10
# Filter by operation type
ailang trace list --filter "compile"
ailang trace list --filter "eval.suite"
ailang trace list --filter "messages"
# Get full trace details
ailang trace view <trace-id>
Look for:
Compiler Pipeline Spans:
| Span | What to Look For |
|---|---|
compile.parse | Long = complex syntax, large file |
compile.elaborate | Long = many surface→core transforms |
compile.typecheck | Long = complex type inference, possible hang |
compile.validate | Long = many nodes to validate |
compile.lower | Long = complex operator lowering |
Eval Harness Spans:
| Span | What to Look For |
|---|---|
eval.suite | Total benchmark run time |
eval.benchmark | Individual benchmark, check benchmark.success |
*.generate | AI API call time (openai, anthropic, gemini) |
Messaging Spans:
| Span | What to Look For |
|---|---|
messages.send | Message creation time |
messages.list | Query time, check list.result_count |
messages.search | Semantic search time |
Current trace coverage in AILANG:
compile.*) - All 6 phases tracedeval.suite, eval.benchmark) - Suite and per-benchmarkmessages.*) - Send, list, read, searchanthropic.generate, openai.generate, gemini.generate, ollama.generate)coordinator.execute_task) - Task lifecycleBased on analysis of 280+ implemented design docs and actual bug patterns:
| Priority | Component | Spans | Debug Value |
|---|---|---|---|
| P1 | Type System | types.unify, types.substitute | 4+ hours saved per cyclic type/metadata bug |
| P2 | Module Resolution | modules.resolve, modules.load | 1-2 hours saved per import error |
| P3 | Codegen | codegen.type_lookup, codegen.record | Catch fallbacks before Go compile |
| P4 | Pattern Matching | match.compile, match.coverage | Rare but complex debugging |
See resources/trace_patterns.md for detailed span definitions and implementation patterns.
See resources/trace_patterns.md for:
See docs/docs/guides/telemetry.md for:
This skill loads information progressively:
scripts/ directoryresources/trace_patterns.md (detailed patterns)--json flag for programmatic trace analysisWhen debugging with traces, actively look for opportunities to add more instrumentation!
If you encounter:
Suggest adding traces by:
Example suggestion format:
Debugging [X] was difficult because traces didn't show [Y].
Suggested addition:
- Span: `component.operation`
- Attributes: `input`, `output`, `duration_ms`
- Location: `internal/package/file.go`
- Debug value: Would show [specific insight]
This helps continuously improve AILANG's observability based on real debugging needs.
Traces only cover AILANG tooling, NOT generated Go code!
| What IS Traced | What is NOT Traced |
|---|---|
ailang compile phases | Generated Go binary execution |
ailang run (AILANG interpreter) | Go code after go build |
ailang eval-suite benchmarks | The actual AI-generated code running |
ailang messages operations | User application runtime |
To debug generated Go code:
go tool pprof)DEBUG_CODEGEN=1 to see what code is generatedlog.Printf to internal/codegen/templates/ if neededFuture possibility: Generate OTEL spans INTO Go code for runtime tracing (not implemented)
Frequently asked questions
Debug and analyze AILANG operations using OpenTelemetry distributed tracing. This skill helps identify performance bottlenecks, understand code flow, and debug issues using trace data from GCP Cloud Trace.
The source record exposes this install command: npx skills add https://github.com/sunholo-data/ailang --skill ".agents/skills/trace-debugger". Inspect the command and pinned source before running it.
The pinned source record declares support for: codex, gemini cli.
Static rules flagged exec-script, network in the source; the page lists the matching lines and excerpts.
Alternatives
sunholo-data/ailang
Debug performance issues and understand code flow using AILANG telemetry traces. Use when user asks to debug slow compilation, analyze benchmarks, find bottlenecks, investigate hangs, or understand system behavior.
PramodDutta/qaskills
Gate RAG pipelines in CI with versioned golden eval sets, per-metric thresholds, baseline drift detection, and a build that fails when retrieval or answer quality regresses.
PramodDutta/qaskills
Optimize CI test pipelines through intelligent test splitting, parallelization, caching strategies, and selective test execution based on code changes.
PramodDutta/qaskills
Convert bug reports and incident post-mortems into automated regression tests that prevent recurrence of previously discovered defects.