Skip to content

Expose explicit skill invocation visibility for APM-restored skills #39369

Closed

Description

@theletterf

Summary

Today, gh-aw makes it possible to verify that skills were installed/restored, but not whether a specific skill was actually invoked by the agent at runtime.

In practice, this makes it hard to answer a basic debugging question for workflows that use APM-imported skills:

Did the agent actually use docs-check-style, or was the output only loosely similar to that skill?

What the docs currently show

The published docs appear to cover:

  • how to import APM dependencies with shared/apm.md,
  • how to audit runs with gh aw audit and gh aw logs, and
  • observability for jobs, tokens, MCP usage, and network behavior.

But I could not find documentation that shows any of the following for skills:

  • a run log entry that a named skill was selected or invoked,
  • an audit field listing activated skills,
  • an OTEL attribute for skill invocation, or
  • a workflow artifact that maps review output back to a specific skill call.

What the runtime currently shows

Using a successful smoke test with:

  • engine: copilot,
  • a reusable workflow compiled with gh-aw v0.79.6,
  • APM-imported public skills from elastic/elastic-docs-skills, and
  • a private caller repo,

we can see all of the following in the logs:

1. APM install/restore is visible

The apm job clearly logs that the skills are resolved and integrated:

[>] Resolving elastic-docs-skills-docs-check-style...
[>] Resolving elastic-docs-skills-flag-jargon-skill...
[>] Resolving elastic-docs-skills-frontmatter-audit...
[>] Resolving elastic-docs-skills-content-type-checker...
...
|-- Skill integrated -> .agents/skills/

The agent job also clearly logs that the APM bundle is restored:

Download APM bundle artifact
Build bundle list
Restore APM packages

2. Inline skill restoration is visible

The runtime also logs inline skill extraction/restoration behavior, for example:

  • No inline skill markers found, skipping
  • restore_inline_skills.sh
  • source directory not found — no inline skills to restore

3. But named skill invocation is not visible

What I could not find was a first-class runtime event like:

  • Invoking skill: docs-check-style
  • Selected skill: docs-content-type-checker
  • Activated skills: [docs-check-style, frontmatter-audit]
  • an audit JSON field showing successful skill calls
  • OTEL span attributes for per-skill invocation

So the current debugging story seems to be:

  1. prove the skill files were present,
  2. inspect the agent output,
  3. infer whether the skill was probably used.

That works, but it leaves an observability gap.

Why this matters

This becomes especially important when debugging:

  • prompt wording that asks the agent to use certain skills,
  • differences between installed skills and actual behavior,
  • regressions across gh-aw / engine versions,
  • cases where output looks plausible but might only be coming from the base prompt,
  • APM packaging vs invocation problems.

Without explicit skill invocation visibility, it is hard to distinguish:

  • “the skill was installed but ignored,” from
  • “the skill was used but its guidance did not materially change output.”

Related observations

There are already related issues around APM skill behavior, for example:

Those issues also rely heavily on indirect evidence such as bundle contents, restored skill directories, and output shape.

Request

Could gh-aw expose explicit skill invocation visibility, ideally in one or more of these places?

Option 1: Agent/run logs

Emit a structured log line when a skill is invoked, for example:

[skills] invoked: docs-check-style
[skills] invoked: docs-frontmatter-audit

Option 2: Audit output

Include a field in gh aw audit --json, for example:

{
  "skill_usage": [
    { "name": "docs-check-style", "status": "invoked" },
    { "name": "docs-frontmatter-audit", "status": "invoked" }
  ]
}

Option 3: OpenTelemetry

Add span events or attributes for skill activation, such as:

  • gh-aw.skill.name
  • gh-aw.skill.source
  • gh-aw.skill.invoked=true

Option 4: Agent artifact metadata

Include a small machine-readable file in the agent artifact listing skills discovered vs invoked.

Minimum clarification requested

If explicit tracing already exists somewhere, could the docs point to it clearly?

If it does not exist, this issue is requesting that capability.

Thanks — the recent improvements around built-in GITHUB_TOKEN auth and APM packaging made this much easier to test, and this feels like the next missing piece in the debugging story.

Activity

  1. locked and limited conversation to collaborators on Jun 15, 2026
  2. unlocked this conversation on Jun 15, 2026
  3. pelikhan commented on Aug 2, 2026

    @pelikhan
    Collaborator

    /scout investigate feasibility of this feature

  4. github-actions commented on Aug 2, 2026

    @github-actions
    Contributor

    🔭 Recon complete! Scout has charted the territory. Map ready! 🗺️

  5. github-actions commented on Aug 2, 2026

    @github-actions
    Contributor

    🔍 Scout Research Report

    Triggered by @github-actions[bot]

    Executive Summary

    Feasibility is good, and notably better than the issue implies: gh-aw already has the parsing infrastructure needed for skill-invocation visibility, plus an existing precedent for exactly this kind of disambiguation. It just isn't wired up for the Skill tool specifically. Options 1 (log line) and 2 (gh aw audit --json field) are straightforward extensions of existing code. Option 3 (OTEL) is architecturally sanctioned but needs new instrumentation. Option 4 (artifact) is the most net-new work.

    Click to expand detailed findings

    Research Findings

    What exists today for skill installation (not invocation)

    Skills are resolved from pinned owner/repo@sha refs or local paths in pkg/workflow/skills_frontmatter.go, and inline skills are extracted at compile time (pkg/parser/inline_skill_extractor.go). At runtime, actions/setup/sh/restore_inline_skills.sh copies skill files into the engine-specific directory (.claude/skills, .codex/skills, .github/skills — see GetEngineSkillDir, pkg/workflow/engine_config_dir.go:43). This is purely filesystem staging — it proves presence, never invocation, matching the gap described in the issue.

    The key enabler: generic tool-call parsing already exists

    gh-aw already parses each engine's transcript into a structured ToolCallInfo{Name, CallCount, MaxInputSize, MaxOutputSize, MaxDuration, OutputSample} model (pkg/workflow/metrics.go:16):

    • Claude: pkg/workflow/claude_logs.go:349 switches on tool_use content blocks, reading name/input directly from the JSONL transcript.
    • Copilot: pkg/workflow/copilot_logs.go:196 parses the same tool_use shape.
    • Codex: pkg/workflow/codex_logs.go only regex-matches free-text tool provider.method(...) lines — no structured JSON event. This is the weak link (see Gotchas).
    • Pi engine: pkg/workflow/pi_logs.go has a typed ToolName/Parameters JSONL event.

    Critically, there is already a precedent for exactly this disambiguation problem. In claude_logs.go:365-374, Bash calls are special-cased: instead of aggregating all bash calls under one generic "bash" bucket, the code pulls input.command out and renames the entry to "bash_" + ShortenCommand(command) so each distinct command is trackable. The same pattern — if nameStr == "Skill" { skillName, _ := LookupStringPath(contentMap, "input", "skill"); prettifiedName = "skill_" + skillName } — would give named-skill visibility with a small, well-precedented diff. Today no such case exists; Skill isn't special-cased anywhere, and it isn't in builtInToolNames (pkg/workflow/mcp_config_validation.go:32), so it currently just falls into generic tool aggregation with no per-skill breakdown.

    gh aw audit --json is mature and already has an analogous field

    pkg/cli/audit.go supports --json output. AuditData (pkg/cli/audit_report.go:27-61) already includes ToolUsage []ToolUsageInfo and MCPToolUsage (with per-tool CallCount, servers, etc.). Adding skill_usage: [{name, status}] is a direct extension of an existing, tested pattern rather than new architecture.

    OTEL exists and is substantial

    pkg/workflow/observability_otlp.go plus a versioned spec (specs/otel-observability-spec.md, v0.4.0) already define observability.otlp config, resource attributes, built-in spans, and GenAI/MCP span attributes. The spec explicitly reserves room for additive, namespaced attributes (§2.4), so gh-aw.skill.name / gh-aw.skill.invoked would fit the existing convention — but no skill-specific attributes exist yet, and wiring them requires the same detection step as options 1/2.

    Recommendations

    • Start with Option 1 + 2 together: extend the Claude/Copilot tool_use parsers to special-case the Skill tool the same way Bash is special-cased today, then surface the result both as a log line and as a new skill_usage field in AuditData. This reuses proven code paths and touches the fewest new subsystems.
    • Verify Codex CLI's actual skill-invocation trace format before committing to a cross-engine design — its text-log-only parsing may not name skills distinctly, unlike Claude/Copilot's structured JSON.
    • Treat OTEL span attributes (Option 3) as a fast-follow once the detection logic from Option 1/2 exists, since it's the same underlying signal, just re-exported.
    • Option 4 (discovered-vs-invoked artifact) is the most work since "invoked" tracking is new and there's no existing artifact precedent pairing install-time and runtime skill data — recommend deferring it until 1/2 land.

    Key Sources (in-repo)

    • pkg/workflow/claude_logs.go:349-384 — tool_use parsing + existing Bash-command special-case precedent
    • pkg/workflow/copilot_logs.go:196 — Copilot tool_use parsing
    • pkg/workflow/codex_logs.go — Codex regex-based log parsing (weaker signal)
    • pkg/workflow/metrics.go:16 — ToolCallInfo struct
    • pkg/cli/audit_report.go:27-61, pkg/cli/audit.go — existing AuditData/--json audit infrastructure
    • pkg/workflow/observability_otlp.go, specs/otel-observability-spec.md — existing OTEL infra and extension convention
    • pkg/workflow/skills_frontmatter.go, actions/setup/sh/restore_inline_skills.sh, pkg/workflow/engine_config_dir.go:43 — current install/restore-only visibility

    Suggested Next Steps

    1. Prototype the Skill tool special-case in claude_logs.go (and the Copilot equivalent) mirroring the Bash pattern, and confirm against a real Claude/Copilot run that the input field actually carries the skill name in the expected shape.
    2. Capture a real Codex CLI trace of a skill invocation to determine whether its log format exposes a skill name at all — this determines whether cross-engine parity is achievable in v1 or Codex needs a follow-up.
    3. Add SkillUsage to AuditData and gh aw audit --json, following the existing MCPToolUsage pattern.
    4. Once 1–3 are validated, add gh-aw.skill.name/gh-aw.skill.invoked OTEL span attributes per the existing extension convention in the spec.

    🔭 Intelligence gathered by Scout · agent · 90 AIC · ⌖ 30.9 AIC · ⊞ 6.6K · ◷
    Comment /scout to run again

  6. pelikhan commented on Aug 2, 2026

    @pelikhan
    Collaborator

    @copilot add support for parsing out which skill was used (probably agent specific code) and surface it in a dedicated file, usage artifact, artifact summary file, then in the audit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions