Skip to content

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

Description

@github-actions

Executive Summary

  • 4 runs sampled across 4 distinct workflows from the last 24 hours
  • Workflows covered: Go Logger Enhancement, Sergo - Serena Go Expert, PR Sous Chef, Smoke Copilot
  • Median first-request size: 17,140 chars | P95: 20,216 chars
  • Key finding: The highest-cost run (Go Logger, 26.9M effective tokens / 93 turns) has a compact 6,583-char prompt — the problem is exploratory turn proliferation, not prompt bloat. Sergo (20,216 chars, 90 headings, 13 code fences) is the largest prompt and has structural over-engineering. Smoke Copilot (3.02% duplicate line ratio, 4,805-char Test Requirements section) has addressable prompt redundancy.

Highest-Leverage Changes

  1. [Go Logger] Promote cache-check to a pre-flight gate step — currently buried mid-workflow; moving it to a dedicated no-LLM step eliminates all 93 exploration turns on unchanged days (HIGH)
  2. [Go Logger] Replace iterative file-scan turns with a deterministic bash step — emit a structured manifest before any LLM invocation; ~50% of 93 turns are pure data-gathering (HIGH)
  3. [Sergo] Collapse 90-heading structure to ≤15 headings — 1 heading per 7 lines inflates effective token weight; merge template/decorative headings into flat prose (HIGH)
  4. [Sergo] Extract 13 embedded code fences into a conditional skill — static Go snippets and format examples add ~3–5k chars on every daily run; move to a sergo-examples skill loaded only when formatting guidance is needed (HIGH)
  5. [Smoke Copilot] Trim ## Test Requirements section (4,805 chars) — largest single section; split into a shared import or collapse verbose sub-requirements (MEDIUM)
  6. [Sergo] Cap lazy-loaded strategy memory to 3 most recent entries### 2.1 Load Previous Strategies loads full repo-memory history unconditionally; cap to recent entries (MEDIUM)
  7. [Go Logger] Add structured safe-output schema for logger diffs — reduces per-turn token volume by replacing prose reasoning with compact patch objects (MEDIUM)

Key Metrics

Metric Value
Sampled runs 4
Distinct workflows 4
Median chars 17,140
P95 chars 20,216
Largest sampled request Sergo – 20,216 chars (646 lines, 90 headings, 13 code fences)
Highest effective tokens Go Logger – 26,941,267 (93 turns, 6,583-char prompt)
Per-Run First-Request Metrics
Run Workflow Chars Lines Headings Code Fences Dup Line Ratio Eff Tokens
26930135373 PR Sous Chef 14,315 198 8 0 0.00% 7,762,110
26931276933 Go Logger Enhancement 6,583 201 17 2 0.00% 26,941,267
26931476596 Smoke Copilot 19,965 304 22 4 3.02% 7,693,470
26932367410 Sergo - Serena Go Expert 20,216 646 90 13 0.20% 10,173,346
  • All 4 runs use gh-proxy and cli-proxy — no MCP-to-CLI rewrite needed
  • Request source: workflow .md source (claude runs) and agent process log (copilot runs)
Repeated Ambient Context Signals
  • Smoke Copilot: 3.02% duplicate line ratio — safe-output boilerplate and tool-access rules repeated across sections
  • Sergo: 90 headings create fragmented micro-sections; template placeholders like ### Task [N]: [Short Title] appear multiple times as copy-paste scaffolding
  • PR Sous Chef: ## Token efficiency rules (mandatory) (963 chars) and ## Required skip rules per PR (749 chars) are verbose inline guardrails that could be condensed to a short shared import
  • Go Logger: ## Efficiency First: Check Cache (922 chars) is effective guidance but placed too late — it runs after LLM context is already loaded
Deterministic Analysis Output
  • Script: /tmp/gh-aw/ambient-context/analyze_requests.py (stdlib only)
  • Output: request-analysis.json, request-analysis.md
  • Key findings:
    • Sergo has the highest heading density: 90 / 646 lines = 0.14 headings/line
    • Smoke Copilot ## Test Requirements is the single largest section at 4,805 chars (24% of total prompt)
    • PR Sous Chef ## Required nudges for eligible PRs is 1,908 chars (13% of prompt) with dense bullet lists
    • Go Logger ambient_context effective_tokens=5,239 — prompt is efficient; token cost comes entirely from 93 LLM turns
    • Sergo ambient_context effective_tokens=12,560 — moderate; driven by 90-heading structure and 13 code fences

Recommendations by Category

Workflow Markdown

  1. [Go Logger] Pre-flight cache gate (go-logger.md) — Move the cache check to a steps: entry before any LLM turn. On days with no new Go files, the workflow exits immediately with zero LLM calls. Expected impact: HIGH. Safe immediately: yes.
  2. [Go Logger] Deterministic manifest step (go-logger.md) — Add a bash step that scans Go files and writes a JSON manifest (files needing logger, missing imports, call sites) to /tmp. The LLM prompt then reads this file instead of exploring iteratively. Eliminates ~46 data-gathering turns. Expected impact: HIGH. Safe immediately: yes.
  3. [Sergo] Flatten heading structure (sergo.md) — Target ≤15 headings by merging the ~75 decorative/template sub-headings into numbered prose. Reduces effective token multiplier from heading-anchored context. Expected impact: HIGH. Safe immediately: yes (structural only).
  4. [Sergo] Cap repo-memory load (sergo.md) — Replace unconditional Load Previous Strategies with a conditional load capped to the 3 most recent entries. Prevents unbounded memory growth inflating every future run. Expected impact: MEDIUM. Needs review.
  5. [Smoke Copilot] Split ## Test Requirements (smoke-copilot.md) — At 4,805 chars (24% of prompt), this section is the largest. Move stable sub-requirements to a shared import and keep only the dynamic per-run discriminators inline. Expected impact: MEDIUM. Safe immediately: yes.

Skills

  1. [Sergo] Create sergo-examples skill — Extract the 13 embedded code fences (Go snippets, output format templates) into .github/skills/sergo-examples/SKILL.md. Load conditionally in the workflow only when the agent needs output formatting guidance. Reduces base prompt by ~3–5k chars on every daily run. Expected impact: HIGH. Needs review.
  2. [Go Logger] Structured safe-output patch schema — Define a compact safe-output type for logger diffs (file path, import line, call-site list) to replace multi-turn prose reasoning with a single structured emission. Expected impact: MEDIUM. Needs design review.

Agents

  • No inline agent (## agent:) or skill (## skill:) definitions found in any sampled run. All 4 workflows use gh-proxy and cli-proxy correctly. No agent restructuring recommended at this time.

References

  • §26931276933 — Go Logger Enhancement (26.9M eff tokens, 93 turns)
  • §26932367410 — Sergo - Serena Go Expert (10.2M eff tokens, 90 headings)
  • §26931476596 — Smoke Copilot (7.7M eff tokens, 3.02% dup lines)

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

  • expires on Jun 11, 2026, 5:48 AM UTC

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions