Source profileQuality 94/100Review permissions

sunholo-data/ailang/.claude/skills/trace-debugger/SKILL.md

trace-debugger

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.

Source repository stars
33
Declared platforms
2
Static risk flags
2
Last source update
2026-08-28
Source checked
2026-08-28

Decision brief

What it does: where it fits

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.

Best for

  • User asks to debug slow compilation or type checking
  • User wants to analyze benchmark performance
  • User mentions "bottleneck", "slow", "hang", or "performance"

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeDeclaredSource recordInstall path and trigger
CursorNot declaredNo explicit evidencePortability before use
Gemini CLIDeclaredSource recordInstall path and trigger
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/sunholo-data/ailang --skill ".claude/skills/trace-debugger"
Safe inspection promptEditorial

Inspect the Agent Skill "trace-debugger" from https://github.com/sunholo-data/ailang/blob/fb85250a127dcc6e8308c6653f153d9c59f08d62/.claude/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

What the source asks the agent to do

  1. 01

    Quick Start

    Review the “Quick Start” section in the pinned source before continuing.

    Review and apply the “Quick Start” source section.
  2. 02

    4. Analyze timing breakdown per phase

    Review the “4. Analyze timing breakdown per phase” section in the pinned source before continuing.

    Review and apply the “4. Analyze timing breakdown per phase” source section.
  3. 03

    Observatory Dashboard Setup (v0.6.3+)

    The Observatory provides a local dashboard for viewing traces from Claude Code, Gemini CLI, and AILANG.

    The Observatory provides a local dashboard for viewing traces from Claude Code, Gemini CLI, and AILANG.
  4. 04

    Workflow

    Expected output shows either GCP or OTLP mode enabled. If disabled, set environment variables.

    Expected output shows either GCP or OTLP mode enabled. If disabled, set environment variables.Run the operation that's slow/problematic:
  5. 05

    User says: "Why is compilation slow?"

    Review the “User says: "Why is compilation slow?"” section in the pinned source before continuing.

    Review and apply the “User says: "Why is compilation slow?"” source section.

Permission review

Static risk signals and limitations

Runs scripts

medium · line 47

The documentation asks the agent to run terminal commands or scripts.

docker run -d -p 16686:16686 -p 4318:4318 jaegertracing/all-in-one

Network access

medium · line 48

The documentation includes network, browsing, or remote request actions.

export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318

Network access

medium · line 52

The documentation includes network, browsing, or remote request actions.

# View traces at http://localhost:1957 → Observatory tab

Runs scripts

medium · line 145

The documentation asks the agent to run terminal commands or scripts.

Run a Claude Code or Gemini CLI command

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score94/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars33SourceRepository attention, not individual Skill quality
Compatibility2 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
sunholo-data/ailang
Skill path
.claude/skills/trace-debugger/SKILL.md
Commit
fb85250a127dcc6e8308c6653f153d9c59f08d62
License
Apache-2.0
Collected
2026-08-28
Default branch
dev
View the original SKILL.md

Trace Debugger

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.

Quick Start

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>

When to Use This Skill

Invoke this skill when:

  • User asks to debug slow compilation or type checking
  • User wants to analyze benchmark performance
  • User mentions "bottleneck", "slow", "hang", or "performance"
  • User wants to understand execution flow across components
  • User asks "why is X taking so long?"
  • User needs to compare timing between runs

Telemetry Prerequisites

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

Observatory Dashboard Setup (v0.6.3+)

The Observatory provides a local dashboard for viewing traces from Claude Code, Gemini CLI, and AILANG.

Start the Server

ailang server
# Or: make services-start

Configure Claude Code

Add to ~/.claude/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 Claude Code sends: Events via OTLP logs (token counts, costs, model, session info)

Configure Gemini CLI

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 session
  • ailang.task_id - Added by Coordinator for delegated tasks
  • ailang.workspace - Groups traces by project

What Gemini CLI sends to GCP: Full traces (complete span hierarchy with parent-child relationships, token counts, model info, prompts)

Environment Variables Reference

Claude Code (direct OTLP export to Observatory):

VariablePurposeExample
CLAUDE_CODE_ENABLE_TELEMETRYEnable Claude Code telemetry1
OTEL_LOGS_EXPORTERLog export protocolotlp
OTEL_METRICS_EXPORTERMetrics export protocolotlp
OTEL_EXPORTER_OTLP_PROTOCOLTransport protocolhttp/json
OTEL_EXPORTER_OTLP_ENDPOINTObservatory URLhttp://localhost:1957
OTEL_RESOURCE_ATTRIBUTESSpan metadataailang.source=user

Gemini CLI (GCP Cloud Trace only - configure via ~/.gemini/settings.json):

SettingPurposeValue
telemetry.enabledEnable telemetrytrue
telemetry.targetExport destinationgcp
telemetry.logPromptsInclude prompt texttrue

OTLP Endpoints

The Observatory receives data on:

  • /v1/traces - Trace spans (Gemini CLI, AILANG)
  • /v1/logs - Log records (Claude Code events)
  • /v1/metrics - Metrics data

Both protobuf and JSON formats are supported.

Verify Telemetry is Working

  1. Ensure ailang server is running
  2. Run a Claude Code or Gemini CLI command
  3. Open http://localhost:1957 → Observatory tab
  4. New traces should appear automatically

Note: If server is not running, OTLP exports fail silently (no impact on CLI tools).

Available Scripts

scripts/check_traces.sh [hours] [filter]

Quick check for recent traces with optional filtering.

Usage:

# Check last hour of traces
.claude/skills/trace-debugger/scripts/check_traces.sh

# Check last 4 hours, filter by eval
.claude/skills/trace-debugger/scripts/check_traces.sh 4 "eval.suite"

# Check compilation traces
.claude/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
.claude/skills/trace-debugger/scripts/analyze_compilation.sh examples/runnable/factorial.ail

Workflow

1. Verify Telemetry Configuration

ailang trace status

Expected output shows either GCP or OTLP mode enabled. If disabled, set environment variables.

2. Reproduce the Issue with Tracing

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

3. Query Recent Traces

# 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"

4. Analyze Trace Hierarchy

# Get full trace details
ailang trace view <trace-id>

Look for:

  • Deep nesting: Indicates recursive operations
  • Long durations: Shows bottlenecks
  • Missing child spans: May indicate early exit or error
  • Parallel spans: Shows concurrent operations

5. Interpret Results

Compiler Pipeline Spans:

SpanWhat to Look For
compile.parseLong = complex syntax, large file
compile.elaborateLong = many surface→core transforms
compile.typecheckLong = complex type inference, possible hang
compile.validateLong = many nodes to validate
compile.lowerLong = complex operator lowering

Eval Harness Spans:

SpanWhat to Look For
eval.suiteTotal benchmark run time
eval.benchmarkIndividual benchmark, check benchmark.success
*.generateAI API call time (openai, anthropic, gemini)

Messaging Spans:

SpanWhat to Look For
messages.sendMessage creation time
messages.listQuery time, check list.result_count
messages.searchSemantic search time

Instrumented Components

Current trace coverage in AILANG:

✅ Fully Instrumented

  • Compiler Pipeline (compile.*) - All 6 phases traced
  • Eval Harness (eval.suite, eval.benchmark) - Suite and per-benchmark
  • Messaging (messages.*) - Send, list, read, search
  • AI Providers (anthropic.generate, openai.generate, gemini.generate, ollama.generate)
  • Server (HTTP middleware) - Request/response tracing
  • Coordinator (coordinator.execute_task) - Task lifecycle

🔜 Prioritized Future Instrumentation

Based on analysis of 280+ implemented design docs and actual bug patterns:

PriorityComponentSpansDebug Value
P1Type Systemtypes.unify, types.substitute4+ hours saved per cyclic type/metadata bug
P2Module Resolutionmodules.resolve, modules.load1-2 hours saved per import error
P3Codegencodegen.type_lookup, codegen.recordCatch fallbacks before Go compile
P4Pattern Matchingmatch.compile, match.coverageRare but complex debugging

See resources/trace_patterns.md for detailed span definitions and implementation patterns.

Resources

Trace Patterns Reference

See resources/trace_patterns.md for:

  • Common debugging patterns
  • Trace attribute reference
  • Performance baseline expectations

Span Reference

See docs/docs/guides/telemetry.md for:

  • Complete span list with attributes
  • Environment variable configuration
  • Architecture diagrams

Progressive Disclosure

This skill loads information progressively:

  1. Always loaded: This SKILL.md file (workflow overview)
  2. Execute as needed: Scripts in scripts/ directory
  3. Load on demand: resources/trace_patterns.md (detailed patterns)

Notes

  • Traces require telemetry environment variables set
  • GCP traces may take 30-60 seconds to appear in console
  • Local Jaeger provides instant visibility
  • Zero overhead when telemetry is disabled
  • Use --json flag for programmatic trace analysis

Proactive Trace Improvement

When debugging with traces, actively look for opportunities to add more instrumentation!

If you encounter:

  • A debugging session where traces didn't help identify the issue
  • A component that would benefit from finer-grained spans
  • Missing attributes that would have been useful

Suggest adding traces by:

  1. Noting the component and what information would help
  2. Proposing span name and attributes (see resources/trace_patterns.md)
  3. Creating a design doc for significant additions

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.

Tracing Scope Limitation

Traces only cover AILANG tooling, NOT generated Go code!

What IS TracedWhat is NOT Traced
ailang compile phasesGenerated Go binary execution
ailang run (AILANG interpreter)Go code after go build
ailang eval-suite benchmarksThe actual AI-generated code running
ailang messages operationsUser application runtime

To debug generated Go code:

  • Use Go's standard profiling (go tool pprof)
  • Add your own tracing in generated code templates
  • Use DEBUG_CODEGEN=1 to see what code is generated
  • Add log.Printf to internal/codegen/templates/ if needed

Future possibility: Generate OTEL spans INTO Go code for runtime tracing (not implemented)

Frequently asked questions

What to verify before installation and use

What does the trace-debugger source document cover?

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.

How do I install trace-debugger?

The source record exposes this install command: npx skills add https://github.com/sunholo-data/ailang --skill ".claude/skills/trace-debugger". Inspect the command and pinned source before running it.

Which Agent platforms does the source record declare?

The pinned source record declares support for: claude code, gemini cli.

Which permission-related actions were detected?

Static rules flagged exec-script, network in the source; the page lists the matching lines and excerpts.

Alternatives

Compare before choosing