Skip to content

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

@github-actions

Description

@github-actions

Executive Summary

  • 4 runs sampled across 4 distinct workflows (last 24 hours)
  • Workflows covered: Daily Firewall Logs Collector and Reporter, Smoke Codex, PR Description Updater, PR Sous Chef
  • Median first-request size: 17,248 chars · P95: 20,571 chars
  • Key finding: The <system> block (security policy + tool configs) accounts for 28–69% of every first-request prompt. Within it, <safe-outputs> (2.5 KB) and <mcp-clis> (up to 3.7 KB) are the largest controllable blocks. The Firewall workflow carries a 14.7 KB agent body inflated by inline Python boilerplate and 40 headings. Enabling gh-proxy on Smoke Codex would alone cut its <mcp-clis> block by ~3.4 KB.

Highest-Leverage Changes

  1. [high] Set tools.github.mode: gh-proxy on smoke-codex.md — the <mcp-clis> block is 3,651 chars vs 292 chars in other runs (12× larger); adding one frontmatter line halves it.
  2. [high] Extract inline Python charting boilerplate from daily-firewall-report.md — 3 KB+ of Python code templates are injected into every prompt; move them to a dedicated skill or reference file loaded on demand.
  3. [medium] Trim the 76-line preamble in daily-firewall-report.md — the largest single section in the prompt (before first heading); target ≤15 lines by collapsing repeated context.
  4. [medium] Reduce heading density in daily-firewall-report.md (40 headings, 12 <details> blocks) — flatten shallow sub-headings and consolidate details blocks into fewer, larger sections or a linked skill.
  5. [medium] Trim the 79-line preamble in smoke-codex.md — the second-largest preamble; refactor into named headings or a shared fragment.

Key Metrics

Metric Value
Sampled runs 4
Distinct workflows 4
Median chars 17,248
P95 chars 20,571
Largest sampled request Daily Firewall Logs Collector (20,571 chars, 25.4M effective tokens)
Per-Run First-Request Metrics
Run ID Workflow Chars Lines Headings Dup Line Ratio System Block %
§26928407035 Daily Firewall Logs Collector 20,571 479 40 9.4% 28%
§26927666964 Smoke Codex 20,448 341 23 9.0% 56%
§26930135373 PR Sous Chef 14,049 191 8 0.0% 64%
§26929814321 PR Description Updater 7,777 127 7 3.1% 69%
Repeated Ambient Context Signals
  • <safe-outputs> block (2,505 chars): identical in all 4 runs — injected verbatim every time
  • <mcp-clis> block varies 292–3,651 chars (12× range); Smoke Codex injects full CLI usage instructions because gh-proxy is not enabled
  • <github-context> is 354–2,035 chars depending on workflow; PR-heavy workflows carry larger context payloads
  • Firewall preamble (76 lines): Python environment setup, store/generate/upload chart instructions repeated as boilerplate before task content
  • Smoke Codex preamble (79 lines): large pre-heading block covering project activation, memory paths, and tool setup
  • ### Project Activation heading appears twice in Smoke Codex prompt (literal duplicate)
  • plt.savefig(...) line appears twice in Firewall prompt (inline code duplication)
  • **IMPORTANT**: Wrap this entire section in a collapsible... appears twice in Firewall prompt
Deterministic Analysis Output

All metrics computed from prompt.txt artifacts via /tmp/gh-aw/ambient-context/analyze_requests.py (Python stdlib only).

Highlights:

  • System block ranges from 5.3 KB (PR Description Updater) to 11.4 KB (Smoke Codex)
  • Smoke Codex: <mcp-clis> = 3,651 chars + <github-context> = 2,035 chars + <safe-outputs> = 2,505 chars = 8.2 KB in 3 config blocks alone
  • Firewall workflow body: 14,747 chars with 40 headings and 13 code fences — the highest structural complexity across all sampled runs
  • PR Sous Chef (7,762K effective tokens, 68 turns): compact 14 KB prompt showing good practices — short body, no inline boilerplate, relies on pre-staged JSON files
  • PR Description Updater: smallest prompt (7,777 chars), 69% is system block — the task itself is concise; a good baseline
  • <safe-outputs> (2,505 chars) is the largest mandatory per-run injection and is identical across all runs

Recommendations by Category

Workflow Markdown

  • smoke-codex.md: Add tools.github.mode: gh-proxy to frontmatter. This switches the <mcp-clis> injection from 3,651 chars to ~292 chars, saving ~3.4 KB. Impact: high. Safe immediately.
  • smoke-codex.md: Refactor 79-line preamble into named headings or a shared import. The preamble is the largest single section and contains reusable prose. Impact: medium. Needs review.
  • daily-firewall-report.md: Collapse 76-line preamble to ≤15 lines. Move Python environment setup prose to a note or referenced file. Impact: high. Safe immediately.
  • daily-firewall-report.md: Flatten 40 headings and 12 <details> blocks. Target ≤15 headings; consolidate details into 3–4 sections. Impact: medium. Safe immediately.

Skills

  • daily-firewall-report.md: Extract the inline Python charting boilerplate (Store Historical Data, Generate Charts, Upload Charts — ~3 KB) into a dedicated firewall-charts skill. Load it only when the charting step executes, removing it from the first-request context entirely. Impact: high. Safe immediately.
  • smoke-codex.md: The import shared/trufflehog.md (9,601 chars of YAML) is a compilation fragment. Verify it is not accidentally injected into the agent prompt; if it is, replace with a concise agent-instruction summary skill. Impact: medium. Needs verification.

Agents

  • No inline agent definitions (## agent:) were found in any sampled prompt. The pr-description-updater does define sub-agents in its body (14 agent keyword mentions); confirm these are on-demand invocations rather than always-injected definitions. Impact: low. Informational.

References

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

  • expires on Jun 11, 2026, 4:52 AM UTC

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