Skip to content

[ambient-context] Daily Ambient Context Optimizer - 2026-06-04 #36906

@github-actions

Description

@github-actions

Executive Summary

  • 4 runs sampled across 4 distinct workflows from the last 24 hours
  • Workflows: Typist - Go Type Analysis, Package Specification Enforcer, Smoke Claude, Daily Agentic Workflow Token Usage Audit
  • Median first-request size: 21,125 chars; P95: 22,833 chars
  • Every sampled prompt contains an identical 2,476-char safe-outputs instruction block — this is the single highest-leverage deduplication target. The Smoke Claude prompt additionally carries a 2,320-char safe-output-tools docstring block. Combined, these two injected sections account for ~22–46% of each first-request preamble.

Highest-Leverage Changes

  1. Extract the safe-outputs instruction block to a shared import — 2,476 chars repeated verbatim across every run; centralizing it would cut ~10% from each first-request prompt system-wide.
  2. Reduce Smoke Claude's safe-output-tools tool-docstring block — 2,320 chars of tool documentation in the preamble for a smoke test; trim to a short tool list.
  3. Collapse Typist A/B tone-variant duplication — mission/phase sections duplicated for tone_style experiment variants, roughly doubling prose where only a phrase differs.
  4. Trim Typist Phase 2 over-specification — 1,654 chars of bash command sequences already covered by the tools.bash allowlist in the frontmatter.
  5. Trim spec-enforcer inline code-fence examples — 11 code fences with full example bodies in a 490-line prompt; replace with short skeletons (~400–600 chars saved).
  6. Reduce Typist heading density — 60 headings across 627 lines (1 heading per ~10 lines); merge or eliminate low-value sub-headings.
  7. Enable gh-proxy / cli-proxy on agentic-token-audit — the prompt contains raw gh aw shell guidance but neither proxy is active; enabling them and rewriting to explicit agentic-workflows MCP-tool calls would replace verbose shell explanations with direct tool references.

Key Metrics

Metric Value
Sampled runs 4
Distinct workflows 4
Median chars 21,125
P95 chars 22,833
Largest sampled request Typist - Go Type Analysis (22,833 chars, 3.2M effective tokens)
Shared safe-outputs block 2,476 chars in all 4 prompts
Smoke Claude safe-output-tools block 2,320 chars (preamble only)
Per-Run First-Request Metrics
Run ID Workflow Chars Lines Headings Code Fences Dup-Line% Preamble Chars Effective Tokens
§26951325683 Typist - Go Type Analysis 22,833 627 60 9 2.9% 5,317 21,397,206
§26951451844 Package Specification Enforcer 21,125 490 41 11 1.2% 7,244 6,482,546
§26951642303 Smoke Claude 20,540 258 4 5 1.8% 11,443 844,281
26951803408 Daily Agentic Workflow Token Usage Audit 16,636 315 17 4 0.6% 7,702 794,760

Source: prompt.txt (all 4 runs). All workflows use Claude Code engine except Daily Token Audit (GitHub Copilot CLI).

Repeated Ambient Context Signals
  • <safe-outputs> instructions (2,476 chars): identical block in all 4 prompts — security guardrails, retry limits, tool call semantics, noop guidance, temporary_id format. This is injected system-wide and is the top dedup target.
  • <safe-output-tools> docstrings in Smoke Claude (2,320 chars): full per-tool documentation for 15 tools injected into the preamble; for a smoke test only a handful are used.
  • <mcp-clis> block (568 chars): present in all runs, explains agenticworkflows and safeoutputs CLIs — reasonable but contributes to baseline.
  • <github-context> block (varies 300–1,931 chars): largest in Smoke Claude (1,931 chars for PR/branch details) vs ~300 chars in simpler runs.
  • Typist A/B experiment variant blocks: Mission section and phase sections repeated under {{#if experiments.tone_style}} conditional forks, doubling prose for variant comparison.
  • Spec-enforcer injected cache-memory and branch-name preamble adds ~1,944 chars vs baseline; some content duplicates what is already in Phase 0.
Deterministic Analysis Output

Script: /tmp/gh-aw/ambient-context/analyze_requests.py (stdlib only)
Output: /tmp/gh-aw/ambient-context/request-analysis.json

Most relevant aggregate metrics:

  • All 4 prompts start with the <system> security policy block (~600 chars, consistent)
  • Preamble sizes range from 5,317 to 11,443 chars — Smoke Claude is 2.1× the smallest due to large safe-output-tools docstring
  • Heading density: Typist 60/627 lines (9.6%), spec-enforcer 41/490 lines (8.4%), vs Token Audit 17/315 lines (5.4%)
  • Duplicate line ratio: Typist 2.9% (highest; driven by A/B variant blocks), Token Audit 0.6% (lowest)
  • SKILL.md reference count: 0 in all sampled prompts — skills are not currently loaded as imports in these workflows

Recommendations by Category

Workflow Markdown

  1. [high] Extract safe-outputs instruction block to a shared import (workflow-md)

    • Affected: all workflows
    • Evidence: 2,476 chars identical in all 4 sampled prompts (~10–15% of total per run)
    • Action: Create shared/safe-outputs-instructions.md and reference it via - uses: import; this removes it from every individual workflow .md
    • Safe to apply immediately; content is infrastructure, not workflow-specific
  2. [high] Trim Typist A/B tone-variant experiment bloat (.github/workflows/typist.md)

    • Affected: Typist - Go Type Analysis
    • Evidence: Duplicate-line ratio 2.9% (highest in sample); Mission + phase sections appear twice under {{#if experiments.tone_style == ...}} forks
    • Action: Keep a single canonical phrasing and make only the differing short phrases (e.g., opening sentence) into small inline variant strings — not full section duplicates
    • Needs manual review to preserve A/B integrity
  3. [medium] Trim Phase 2 bash command over-specification in Typist (.github/workflows/typist.md)

    • Affected: Typist - Go Type Analysis
    • Evidence: Phase 2 is 1,654 chars of step-by-step bash sequences; allowed commands are already enumerated in frontmatter tools.bash
    • Action: Replace exhaustive command sequences with 1–2 outcome-oriented sentences; reference frontmatter allowlist
    • Safe to apply
  4. [medium] Enable gh-proxy and cli-proxy on agentic-token-audit (.github/workflows/agentic-token-audit.md)

    • Affected: Daily Agentic Workflow Token Usage Audit
    • Evidence: Neither tools.github.mode: gh-proxy nor tools.cli-proxy: true are active; prompt contains raw gh aw shell guidance (34 lines mentioning "workflow")
    • Action: Add tools.github.mode: gh-proxy and tools.cli-proxy: true to frontmatter; rewrite raw gh aw shell instructions to explicit agenticworkflows MCP-tool calls
    • Safe to apply; reduces shell explanation verbosity

Skills

  1. [high] Reduce Smoke Claude safe-output-tools docstring block (.github/workflows/smoke-claude.md)

    • Affected: Smoke Claude
    • Evidence: safe-output-tools preamble is 2,320 chars (15 tools with full docs); makes Smoke Claude preamble 11,443 chars vs 5,317 for Typist
    • Action: Replace the full tool docstring block with the short tool-list form (Tools: add_comment, create_issue, ...) that other workflows use; the smoke test does not need per-tool parameter docs
    • Safe to apply
  2. [medium] Reduce spec-enforcer inline code-fence example bodies (.github/workflows/spec-enforcer.md)

    • Affected: Package Specification Enforcer
    • Evidence: 11 code fences; ### Test File Structure is 1,344 chars — largest non-preamble section
    • Action: Shorten inline examples to 2–3 line skeletons with a comment noting the full pattern; saves ~400–600 chars without losing structural guidance
    • Safe to apply

Agents

  1. [medium] Reduce Typist heading density (.github/workflows/typist.md)
    • Affected: Typist - Go Type Analysis
    • Evidence: 60 headings in 627 lines — nearly 1 heading per 10 lines; creates token overhead for structural metadata
    • Action: Merge sibling sub-headings where the content is a single sentence or short bullet list; target ≤30 headings
    • Needs manual review to avoid losing navigation clarity

References

  • §26951325683 — Typist - Go Type Analysis (22,833 chars, 21.4M effective tokens)
  • §26951451844 — Package Specification Enforcer (21,125 chars, 6.5M effective tokens)
  • §26951642303 — Smoke Claude (20,540 chars, preamble 11,443 chars)

Generated by 🌫️ Daily Ambient Context Optimizer · sonnet46 2.6M ·

  • expires on Jun 11, 2026, 12:58 PM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions