Skip to content

[ambient-context] Daily Ambient Context Optimizer - 2026-06-07 #37647

@github-actions

Description

@github-actions

Executive Summary

  • 4 runs sampled from 4 distinct workflows over the last 24 hours
  • Workflows covered: Design Decision Gate, Test Quality Sentinel, Documentation Unbloat, Linter Miner
  • Median first-request size: 23,656 chars · P95: 28,404 chars
  • Highest-cost run: Documentation Unbloat at AIC 527 / 68 turns — prompt size is modest (18.9K chars) but runaway turn count drives cost
  • Largest prompt: Design Decision Gate at 34,771 chars, where the imported adr-writer agent definition accounts for 43% of workflow content
  • All 4 workflows already have gh-proxy and cli-proxy enabled ✓

Highest-Leverage Changes

  1. [agents] Slim adr-writer.agent.md in Design Decision Gate — 11,713 chars (43%) is ADR template boilerplate loaded on every PR gate check; extract the normative spec/template to a lazy-loaded skill or strip to decision-only instructions
  2. [workflow-md] Fix Documentation Unbloat Step 2 — agent re-runs search()+find when candidate-files.txt is already pre-computed; eliminating this saves an estimated 10–20 turns per run (primary driver of AIC 527)
  3. [workflow-md] Scope serena-go.md import in Linter Miner to the code-pattern-scanner sub-agent — saves 3,432 chars (21% of first request) since the main agent never calls Serena tools directly
  4. [agents] Write Linter Miner sub-agent outputs to /tmp/gh-aw/agent/candidates.json instead of returning inline — likely driver of 669K effective tokens in a single-turn run
  5. [workflow-md] Remove duplicated exclusion guards from Documentation Unbloat Steps 2+3 — pre-flight bash already enforces all exclusions; ~900 chars of redundant prose
  6. [skills] Drop shared/otlp.md from Documentation Unbloat — 635 chars with no functional use in a doc-editing workflow
  7. [skills] Extract inline linter-writer agent body in Linter Miner to a reusable skill — ~60 lines of file layout and compilation commands duplicated from the existing go-linters skill

Key Metrics

Metric Value
Sampled runs 4
Distinct workflows 4
Median chars 23,656
P95 chars 28,404
Largest sampled request Design Decision Gate (34,771 chars)
Highest AIC run Documentation Unbloat (526.96 AIC, 68 turns)
Avg duplicate line ratio 7.7%
Per-Run First-Request Metrics
Run ID Workflow Chars AIC Effective Tokens Turns Dup Line % Code Fences Headings
§27098774407 Documentation Unbloat 18,909 526.96 1,756,540 68 6.8% 20 34
§27100128932 Linter Miner 16,161 132.66 669,577 1 4.9% 4 18
§27100525416 Design Decision Gate 34,771 100.04 333,459 8.9% 28 90
§27100525434 Test Quality Sentinel 28,404 115.80 386,007 10.1% 26 51
Repeated Ambient Context Signals
  • shared/reporting.md (2,231 chars) appears identically in 3 of 4 sampled prompts; loaded by 53 workflows total — expected baseline but confirms universal overhead
  • ADR template boilerplate (# ADR-{NNNN}: ..., **Date**: {YYYY-MM-DD}, ## Examples of ADR-Worthy Decisions) appears twice within the Design Decision Gate prompt — narrative template duplicated in the normative spec section
  • cat /tmp/gh-aw/agent/diff-numstat.txt appears twice in Test Quality Sentinel (Steps 1 and a later verification step)
  • "event": "REQUEST_CHANGES" JSON fragment appears twice in Test Quality Sentinel — duplicated across two verdict-path examples
  • Exclusion rules (blog/, frontmatter-full.md, disable-agentic-editing) appear 13 times in Documentation Unbloat Steps 2+3 despite pre-flight bash already enforcing them
  • The (preamble) section (system block + imports) is the largest single section in all 4 runs, ranging from 69–89 lines
Deterministic Analysis Output

Script: analyze_requests.py (stdlib only), reading 4 × run-*.txt / run-*.json samples.

Key computed metrics:

  • System block (runtime-injected): 5,667–7,702 chars depending on safe-output configuration
  • Workflow-specific content after </system>: 8,459–27,134 chars
  • adr-writer.agent.md inlined: 11,713 chars = 43.2% of Design Decision Gate workflow content
  • serena-go.md + transitive serena.md = 3,432 chars in Linter Miner preamble; main agent never calls Serena tools
  • shared/reporting.md = 2,231 chars; shared/otlp.md = 635 chars (loaded by Documentation Unbloat but functionally unused)
  • Code fence density highest in Design Decision Gate (28) and Test Quality Sentinel (26) — dense inline bash examples per step
  • Duplicate line ratios: Test Quality Sentinel 10.1%, Design Decision Gate 8.9%, Documentation Unbloat 6.8%, Linter Miner 4.9%

Recommendations by Category

Workflow Markdown

R1 — Documentation Unbloat: replace Step 2 file-discovery with cat candidate-files.txt · Impact: high · Safe to automate

  • Step 2 instructs the agent to call search() + find even though pre-agent-steps already writes /tmp/gh-aw/agent/candidate-files.txt with all exclusions applied
  • Step 0 acknowledges the file exists but Step 2 ignores it — forces ≥2 extra turns before file selection
  • With 68 turns × ~25K avg tokens/turn, each eliminated turn pair saves ~50K tokens
  • Fix: collapse Step 2 to a single cat /tmp/gh-aw/agent/candidate-files.txt instruction

R2 — Documentation Unbloat: deduplicate exclusion guards · Impact: medium · Safe to automate

  • Exclusion rules for blog/, frontmatter-full.md, disable-agentic-editing appear 13 times across Steps 2–3; pre-flight already enforces them
  • Removing inline NEVER/IMPORTANT warnings saves ~900 chars with no behavioral change

R3 — Linter Miner: scope serena-go.md import to code-pattern-scanner sub-agent · Impact: high · Safe to automate

  • serena-go.md + transitive serena.md = 3,432 chars injected in the main-agent preamble
  • Main agent never calls activate_project, find_symbol, search_for_pattern, or find_referencing_code_snippets — only code-pattern-scanner does
  • Move the import from top-level imports: to the code-pattern-scanner agent block
  • Saves 3,432 chars (21% of 16,161 first-request chars)

Skills

R4 — Documentation Unbloat: remove shared/otlp.md import · Impact: medium · Safe to automate

  • shared/otlp.md (635 chars, 26 lines) covers OTLP tracing configuration; a doc-editing workflow never emits traces
  • Removal cuts ~3.4% from the 18,909-char first request at zero functional cost

R5 — Linter Miner: extract linter-writer agent body to a reusable skill · Impact: medium · Needs manual review

  • Inline ## agent: linter-writer block duplicates file layout, package structure, and compilation commands partly covered by .github/skills/go-linters/SKILL.md
  • Extracting to .github/skills/linter-writer/SKILL.md makes the definition shareable across linter-creating workflows

Agents

R6 — Design Decision Gate: trim adr-writer agent to gate-check scope · Impact: high · Needs manual review

  • adr-writer.agent.md (270 lines, 9,787 bytes) fully inlined: 11,713 chars = 43% of workflow content on every PR gate check
  • Most runs only need the ## Procedure: Writing a New ADR section; the full RFC 2119 normative spec, dual-part template, and writing-quality standards are only needed when actually drafting
  • Options: (a) split into slim gate-check agent + separate ADR-drafting skill loaded lazily, or (b) move normative spec and template body to a skill referenced only when drafting

R7 — Linter Miner: write sub-agent candidate outputs to temp file · Impact: high · Needs manual review

  • discussion-miner and code-pattern-scanner return candidate lists inline into the main agent context, likely driving 669K effective tokens for a single-turn run
  • Pattern: instruct sub-agents to write output to /tmp/gh-aw/agent/candidates.json (consistent with existing prior-linters.json pattern); main agent reads the file in Step 3
  • Keeps sub-agent verbosity outside the main-agent context window

References

Generated by 🌫️ Daily Ambient Context Optimizer · 937.1 AIC · ⌖ 35.6 AIC · ⊞ 21K ·

  • expires on Jun 14, 2026, 12:17 PM UTC-08:00

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