Skip to content

[ambient-context] Daily Ambient Context Optimizer - 2026-06-05 #37192

@github-actions

Description

@github-actions

Executive Summary

  • 4 runs sampled across 4 distinct workflows from the last 24 hours
  • Workflows covered: UK AI Operational Resilience, Contribution Check, Matt Pocock Skills Reviewer, [aw] Failure Investigator (6h)
  • Median first-request size: 12,497 chars | P95: 12,606 chars | Largest: 15,125 chars (Matt Pocock Skills Reviewer)
  • Framework-injected system preamble accounts for ~5,600–5,800 chars (46–47% of each request) — this is immutable. Actionable savings are in the remaining 6,500–9,400 chars of workflow-specific content.
  • Key finding: shared/reporting.md (~2,200–2,527 chars of formatting boilerplate) is injected at first-request time in at least 2 workflows where it is only needed at the final output phase, compounding cost over 111 and 39 turns respectively.

Highest-Leverage Changes

  1. [workflow-md] Defer shared/reporting.md injection to the output phase — saves ~2,200–2,527 chars on first request in every workflow using shared/daily-audit-base.md. High compounding benefit (111-turn runs).
  2. [workflow-md] Prune safe-output repetition and derivable role bullets in contribution-check.md## Important (1,110 chars) has 10 bullets, several restate facts the system preamble already guarantees. Saves ~500–800 chars; fixes the highest duplicate_line_ratio (0.053) in the sample.
  3. [workflow-md] Compress phases 1–4 strategy prose in uk-ai-operational-resilience.md — 91 list items in 6,556 chars; narrative elaboration re-enters context as prefix on each of 111 turns. Target ≤40 items with one imperative sentence per phase.
  4. [workflow-md] Replace code-fenced pseudo-instructions with compact bullet lists in contribution-check.md — 8 code fences (highest in sample); ### How to dispatch and ### Posting comments together exceed 1,800 chars with illustrative example payloads. Converting to bullet prose saves ~400–500 chars.
  5. [workflow-md] Add tools.github.mode: gh-proxy to mattpocock-skills-reviewer.md — the only sampled workflow missing this setting. All other sampled workflows already have it. Safe to apply immediately.
  6. [skills] Extract ## Sub-agent orchestration rules to shared/sub-agent-orchestration.md — 458-char workflow-agnostic block in UK AI; extracting it lets all orchestrator workflows share a single maintained copy. Low but safe to automate.

Key Metrics

Metric Value
Sampled runs 4
Distinct workflows 4
Median chars 12,497
P95 chars 12,606
Largest sampled request Matt Pocock Skills Reviewer — 15,125 chars
System preamble (immutable) ~5,600–5,800 chars (~47% of request)
Shared reporting.md block (2 workflows) ~2,200–2,527 chars per first request
Highest duplicate_line_ratio Contribution Check — 0.053
Most code fences Contribution Check — 8
Per-Run First-Request Metrics
Run Workflow Chars Lines Headings List Items Code Fences Dup Line Ratio AIC Turns Result
§27026326901 UK AI Operational Resilience 12,201 263 21 91 4 0.015 1,057.78 111 ❌ failure
§27029915215 Contribution Check 12,388 183 12 19 8 0.053 853.28 82 ❌ failure
§27036058710 Matt Pocock Skills Reviewer 15,125 263 20 68 10 0.032 669.91 38 ✅ success
§27035312477 [aw] Failure Investigator (6h) 12,606 217 21 47 2 0.013 258.65 39 ✅ success
Repeated Ambient Context Signals
  • shared/reporting.md in 2/4 sampled prompts verbatim## Report Structure Guidelines (2,200–2,527 chars) + ## Workflow Run References appear in both UK AI and Failure Investigator via shared/daily-audit-base.md → shared/reporting.md. This block contains formatting philosophy and markdown examples needed only at the reporting phase.
  • Safe-output instructions restated in workflow body — Contribution Check has 8 safe-output mentions in its workflow-specific section. The injected system preamble already covers these rules fully; the restatements drive the highest duplicate_line_ratio (0.053) in the sample.
  • Role-assignment bullets in ## Important — "You are the orchestrator", "Subagent does the analysis" are derivable from workflow structure and add no execution constraint. Removing them from the 10-bullet Important section recovers ~500–650 chars.
  • Code-fenced example payloads in dispatch instructions### How to dispatch and ### Posting comments embed schema-illustrating JSON payloads that duplicate validation already enforced by the safe-output tooling.
  • Inline skill descriptions in Matt Pocock## Available Matt Pocock Skills (1,158 chars) lists 5 skills with descriptions inline. These are installed at runtime and already discoverable via find; the inline copy is partially redundant.
Deterministic Analysis Output

Analysis script: /tmp/gh-aw/ambient-context/analyze_requests.py (stdlib only)
Outputs: request-analysis.json, request-analysis.md

Top 5 sections by size across runs:

Workflow Section Chars
(all) System preamble (immutable) 5,600–5,800
Matt Pocock ### Step 4: Review Using Selected Skills 1,562
Contribution Check ## Important 1,110
Matt Pocock ## Available Matt Pocock Skills 1,127
[aw] Failure Investigator ## Tone Variant Instructions 773
UK AI / Failure Investigator ## Report Structure Guidelines (shared/reporting.md) 2,183–2,527

Ambient context tokens from audit (2 most expensive runs):

  • UK AI: 20,566 ambient_context input_tokens — re-injected 111 turns → ~2.3M compounded tokens
  • Contribution Check: 24,314 ambient_context input_tokens — re-injected 82 turns → ~2.0M compounded tokens

Recommendations by Category

Workflow Markdown

R1 — Defer shared/reporting.md to output phase (uk-ai-operational-resilience.md, aw-failure-investigator.md)
Remove the top-level shared/daily-audit-base.md import of shared/reporting.md and re-inject the block inline only at the Phase 5 / output step header. The block is formatting boilerplate with no execution value before the final phase. Saves 2,183–2,527 chars from first request; multiplied over many turns.

  • Expected impact: high | Needs manual review (verify phase 5 placement)

R2 — Prune ## Important in contribution-check.md
Reduce from 10 bullets to ~4 that express non-obvious constraints (failure handling, ordering invariants, turn budget). Remove role-assignment and safe-output restatement bullets. Saves ~500–800 chars; fixes highest dup_line_ratio in sample.

  • Expected impact: high | Needs manual review

R3 — Compress multi-phase strategy in uk-ai-operational-resilience.md
Apply a prose-compression pass to phases 1–4: one imperative sentence per phase stating goal and output artifact only. Preserve detail only in Phase 5 output spec. Target: ≤40 list items (currently 91). Saves ~1,200–1,800 chars with compounding benefit over 111 turns.

  • Expected impact: medium | Needs manual review

R4 — Replace fenced dispatch examples with bullet lists in contribution-check.md
Rewrite ### How to dispatch (943 chars) and ### Posting comments (935 chars) as tight imperative bullets. Remove illustrative JSON example payloads that duplicate safe-output schema already enforced by tooling. Saves ~400–500 chars.

  • Expected impact: medium | Needs manual review

R5 — Add tools.github.mode: gh-proxy to mattpocock-skills-reviewer.md
Only sampled workflow without gh-proxy. Add github: { mode: gh-proxy } under tools:. Already has cli-proxy: true. No workflow logic changes required.

  • Expected impact: medium | Safe to apply immediately

Skills

R6 — Extract ## Sub-agent orchestration rules to shared/sub-agent-orchestration.md (uk-ai-operational-resilience.md)
The 458-char orchestration rules block (parallelism, retries, handoff) is workflow-agnostic. Extract verbatim into a new shared file and replace with an import reference. All orchestrator workflows benefit without content changes.

  • Expected impact: low | Safe to automate

Agents

No agent-level changes recommended from this sample. The sampled runs dispatch sub-agents appropriately; no inline agent definitions or unjustified agent spawning patterns were found in the first-request prompts.


References

  • §27026326901 — UK AI Operational Resilience (AIC 1,057, 111 turns, failure)
  • §27029915215 — Contribution Check (AIC 853, 82 turns, failure)
  • §27036058710 — Matt Pocock Skills Reviewer (AIC 669, 38 turns, success)

Generated by 🌫️ Daily Ambient Context Optimizer · agent 855 AIC · threat-detection 26 AIC ·

  • expires on Jun 12, 2026, 8:31 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