Skip to content

[ambient-context] Daily Ambient Context Optimizer - 2026-06-14 #39279

Description

@github-actions

Executive Summary

  • 4 runs sampled across 4 distinct workflows (Smoke Copilot, Test Quality Sentinel, Linter Miner, Contribution Check)
  • Median first-request: 14,265 chars · P95: 14,746 chars · Largest: 26,348 chars (Test Quality Sentinel)
  • All 4 workflows already use gh-proxy and cli-proxy — no proxy-enablement gaps
  • Highest-leverage finding: Test Quality Sentinel embeds a 13,770-char verbatim HTML report template in its first request; removing it saves >50% of that workflow's prompt chars
  • Cross-workflow finding: 15 distinct boilerplate lines from the <system> block appear in every run (framework-injected); <safe-outputs> alone contributes ~2,607 chars per request and is the single largest repeated section
  • Low char/token ratios (0.49–0.98) confirm that runtime-injected tool definitions add large invisible token overhead beyond what prompt.txt captures

Highest-Leverage Changes

  1. [TQS] Move 13,770-char report template out of main prompt — extract to a dedicated skill or step and inject only when writing the PR comment (saves ~52% of TQS first-request chars)
  2. [smoke-copilot] Delete ## Tool Access Overview — 1,179-char section duplicates the framework-injected <mcp-clis> block already present in the preamble
  3. [smoke-copilot + TQS] Extract ## Report Structure Guidelines + ## Workflow Run References into a shared skill — 497 chars identical across both workflows, currently inlined in both
  4. [smoke-copilot + linter-miner] Extract ### Analysis Constraints + ## Serena Code Analysis into a shared skill — ~974 chars repeated verbatim across both workflows
  5. [TQS] Compress illustrative <details> blocks 2 & 3 — 1,710 chars of supplementary examples that restate instruction already in the main steps; inline as short prose
  6. [TQS] Flatten heading depth from 43 → ≤10 — 43 headings for 8 main steps fragments instructions into small named sections, adding token overhead without clarity gain

Key Metrics

Metric Value
Sampled runs 4
Distinct workflows 4
Median chars 14,265
P95 chars 14,746
Largest sampled request 26,348 chars (Test Quality Sentinel)
Framework <safe-outputs> overhead 2,607 chars (present in all 4 runs)
Shared boilerplate lines (all 4 runs) 15 distinct repeated lines
Per-Run First-Request Metrics
Run Workflow Chars Tokens AIC char/tok dup_line% Conclusion
§27507898911 Smoke Copilot 13,784 19,721 1015.5 0.70 0.9% failure
§27507998075 Test Quality Sentinel 26,348 26,843 932.5 0.98 0.9% success
§27507182843 Linter Miner 14,746 17,504 502.9 0.84 0.0% success
§27506199838 Contribution Check 11,994 24,738 503.3 0.49 0.0% success

Note on char/token < 1: prompt.txt captures only the workflow text. The full DLLM request also includes runtime-injected tool schema definitions (not in prompt.txt), which explains token counts exceeding prompt chars for Contribution Check.

Repeated Ambient Context Signals

Framework-injected (in all 4 runs, not changeable via workflow .md):

  • <safe-outputs> block: 2,607 chars per run — immutable security + guidance boilerplate
  • Security policy lines (4 sentences on injection/escape): ~600 chars repeated in every preamble
  • <temporary-files>, <environment-limitations>, <markdown-generation>, <mcp-clis>, <gh-cli>: minor but consistent

Cross-workflow duplicates (fixable in workflow .md files):

  • ## Report Structure Guidelines (248 chars): identical in smoke-copilot + test-quality-sentinel
  • ## Workflow Run References (249 chars): identical in smoke-copilot + test-quality-sentinel
  • ### Analysis Constraints (300 chars): identical in smoke-copilot + linter-miner
  • ## Serena Code Analysis (263–674 chars): similar across smoke-copilot + linter-miner

Single-workflow oversizing:

  • test-quality-sentinel <details> block 1: 13,770 chars — full HTML report template inlined
  • smoke-copilot ## Tool Access Overview: 1,179 chars — duplicates framework <mcp-clis> block
Deterministic Analysis Output

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

Key script-derived findings:

  • Test Quality Sentinel: heading_count=43, code_fence_count=24, list_item_count=85, html_details_count=9, table_rows=19 — substantially more structural markup than any other sampled workflow
  • Contribution Check: char/tok=0.485 — lowest ratio, suggesting high tool-definition injection overhead at runtime (prompt.txt is only 11,994 chars but 24,738 tokens actually sent)
  • 0 inline skills / skill SKILL.md refs across all 4 runs — no workflows in this sample use dynamic skill loading; all context is inlined in prompt.txt
  • 0 inline linters across all 4 runs
  • safe_output_lines per run: Contribution Check=19, Smoke Copilot=18, Linter Miner=16, TQS=13 — safe-output guidance dominates the <system> block across all runs
  • Most common fragment across runs (4×): entire <safe-outputs> content paragraphs (2,607 chars total per run)
  • Duplicate line ratio ≤ 0.9% in all runs — per-run duplication is low; the issue is cross-run repetition and oversized single sections

Recommendations by Category

Workflow Markdown

1. [HIGH] Extract Test Quality Sentinel's verbatim report template (test-quality-sentinel.md)

  • Evidence: The first <details> block (13,770 chars, 52% of prompt) is a static HTML/Markdown rendering template with placeholder variables like {TOTAL}, {DESIGN_COUNT}. It has no instructional value at first-request time.
  • Action: Move this template to a skill (e.g., tqs-report-template) or an external file. Reference it only in Step 7 when writing the PR comment.
  • Impact: HIGH — saves ~13,570 chars and reduces TQS first-request tokens by ~50%
  • Safe immediately: Yes — the template is purely a rendering guide; moving it to a skill does not change behavior

2. [HIGH] Remove ## Tool Access Overview from smoke-copilot.md

  • Evidence: 1,179 chars (8.5% of Smoke Copilot prompt). The framework already injects a <mcp-clis> block listing all CLI proxied servers with usage examples. This section is a verbatim restatement of that injected content.
  • Action: Delete the section entirely, or replace with a one-liner: "See <mcp-clis> above for CLI-proxy server usage."
  • Impact: HIGH — saves ~1,050 chars per Smoke Copilot run
  • Safe immediately: Yes — agents should rely on <mcp-clis> as the canonical source

3. [MEDIUM] Compress illustrative <details> blocks 2 & 3 in test-quality-sentinel.md

  • Evidence: Block 2 (928 chars, example flagged test) and Block 3 (782 chars, classification reference) total 1,710 chars of supplementary scaffolding that restates instruction already in the main workflow steps.
  • Action: Inline one compact example (~100 chars) directly under the relevant rule; fold the key classification distinction (design vs. implementation) into a single sentence under its parent heading. Delete both standalone <details> blocks.
  • Impact: MEDIUM — saves ~1,380 chars
  • Safe immediately: Yes

Skills

4. [MEDIUM] Extract cross-workflow boilerplate into a shared skill

  • Evidence: ## Report Structure Guidelines (248 chars) and ## Workflow Run References (249 chars) are byte-for-byte identical in smoke-copilot.md and test-quality-sentinel.md. ### Analysis Constraints (300 chars) is byte-for-byte identical in smoke-copilot.md and linter-miner.md.
  • Action: Create one shared skill (e.g., reporting-conventions) containing all three sections. Replace inline text with a skill import in each affected workflow.
  • Impact: MEDIUM — saves ~717 chars per affected workflow; simplifies cross-workflow maintenance
  • Safe immediately: Yes

5. [MEDIUM] Consolidate Serena Code Analysis into a shared skill

  • Evidence: ## Serena Code Analysis appears in both linter-miner.md (263 chars) and smoke-copilot.md (674 chars) with nearly identical instructions for activating the Serena MCP tool on the go workspace.
  • Action: Extract to a serena-go-analysis shared skill. Keep only workflow-specific overrides inline (~50 chars residual per workflow).
  • Impact: MEDIUM — saves ~520–870 chars combined; ensures Serena usage guidance stays consistent across all Go-analysis workflows
  • Safe immediately: Yes

Agents

6. [MEDIUM] Flatten test-quality-sentinel.md heading structure from 43 to ≤10 top-level headings

  • Evidence: heading_count=43, code_fence_count=24 for 8 logical steps. The deep nesting (e.g., ### 3a. Go — Test* functions, ### Red Flags to Detect, ### Calibration) fragments continuous instruction into small named sections without improving the agent's performance.
  • Action: Convert deeply nested sub-headings into bullet lists or inline prose under parent steps. Target ≤10 headings total.
  • Impact: MEDIUM — saves ~660 chars; reduces first-request structural overhead
  • Safe immediately: Needs manual review — verify the agent references headings programmatically before removing them

References

Generated by 🌫️ Daily Ambient Context Optimizer · 1.2K AIC · ⌖ 14.5 AIC · ⊞ 21.9K ·

  • expires on Jun 21, 2026, 12:24 PM UTC-08:00

Metadata

Metadata

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