Skip to content

[ambient-context] Daily Ambient Context Optimizer - 2026-07-30 #49203

Description

@github-actions

Warning

threat detection engine error
The threat detection engine encountered an error and could not complete analysis. This is a tooling failure, not a security finding.

Details

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Executive Summary

  • Sampled 4 completed runs (1 failure) across 4 distinct workflows: AI Moderator, PR Sous Chef, Linter Miner (failed), Daily Cache Strategy Analyzer.
  • Median first-request size: 21,716 chars; P95: 25,442 chars. Largest sampled request: PR Sous Chef (25,477 chars).
  • Highest observed AIC among enriched (audited) runs: PR Sous Chef at 7.455 vs AI Moderator at 2.764 — PR Sous Chef's larger, more duplicated prompt correlates with a ~2.7x higher ambient-context cost.
  • Conclusion: the shared immutable-security-policy/temp-file/markdown-generation preamble appears verbatim in every sampled request (4/4 runs), and PR Sous Chef carries the largest workflow-specific bloat (nudge/skip-rule tables). ai-moderator.md uses github.mode: local instead of gh-proxy, missing a proxy-mode win available to peers.

Highest-Leverage Changes

  1. Enable tools.github.mode: gh-proxy in ai-moderator.md (currently local) to match pr-sous-chef.md/linter-miner.md/daily-cache-strategy-analyzer.md, reducing redundant inline GitHub tool-call scaffolding.
  2. Trim/condense the "Required nudges for prioritized eligible PRs" and "Required skip rules per PR" sections in pr-sous-chef.md (4,117 + 2,126 chars combined) into a compact reference table or externalized skill doc.
  3. Move the repeated cache-miss-signal scanning instructions in daily-cache-strategy-analyzer.md (Phase 2/3, ~2,500 chars) toward deterministic pre-agent-steps where feasible, keeping only decision logic in the prompt.
  4. Audit and shrink the "Token efficiency rules (mandatory)" and "Guidelines" boilerplate sections repeated near-identically across workflows to a single shared import instead of duplicating inline.
  5. For linter-miner.md (failed run, 46,600 total tokens), review whether its pre-agent-steps preload logic can absorb more of the up-front context gathering currently done via agent turns.

CI-Validation Checklist for Implementing Agents

Any agent implementing workflow-file recommendations must complete every item below before opening a PR:

  • Run make recompile for every modified .github/workflows/*.md file — zero compilation errors required
  • Confirm no target workflow file is reduced by more than 40% of its current character count
  • Run make agent-report-progress before the final commit and confirm it passes
  • Check the blocked_files list in /tmp/gh-aw/ambient-context/closed-pr-targets.json (written by Step 4) — do not re-attempt changes to any file that appears in a closed ambient-context optimization PR from the last 14 days
  • Include a smoke-test result or dry-run output in the PR description for every changed workflow spec
  • Document all generated .lock.yml changes in the PR body
  • Do not submit as a draft PR

Key Metrics

MetricValue
Sampled runs4
Distinct workflows4
Median chars21,716
P95 chars25,442
Largest sampled requestPR Sous Chef — 25,477 chars
Merged optimizer PRs (7d)1
Closed optimizer PRs (7d)1
Optimizer PR close-rate (7d)n/a (< 3 settled, insufficient data)
Per-Run First-Request Metrics
RunWorkflowStatusCharsLinesHeadingsCode fencesDetailsDup line ratioDup para ratioAIC
30567327397AI Moderatorsuccess17,056253lowlow2.764
30572496291PR Sous Chefsuccess25,442378moderatemoderate7.455
30567931948Linter Minerfailure14,751207lowlown/a
30572224690Daily Cache Strategy Analyzersuccess21,716474lowlown/a

Source: aw-prompts/prompt.txt fallback artifact (no canonical firewall event-logs.jsonl or session-state events.jsonl was present in the local MCP log cache for these runs; treated per skill rules as a compilation-debug cross-check but used here as best-available evidence since the canonical source was unavailable).

Repeated Ambient Context Signals
  • The full immutable-security-policy preamble (sandbox/firewall/injection guardrails, temp-file instruction, markdown-generation rule, environment-limitations block) recurs verbatim in 4/4 sampled requests — expected/necessary baseline, not a workflow-specific fix target, but confirms a large fixed floor (~1.5–2KB) per request regardless of task.
  • pr-sous-chef.md carries the single largest workflow-specific block: "Required nudges for prioritized eligible PRs" (~4.1KB) plus "Required skip rules per PR" (~2.1KB) — together over 6KB of largely tabular/enumerable content that is a strong externalization candidate.
  • daily-cache-strategy-analyzer.md phases (0–6) are individually modest but cumulative — Phase 3 "Cross-Reference with Historical Data" alone is ~1.1KB.
  • ai-moderator.md is the only sampled workflow still on github.mode: local; its peers already use gh-proxy.
Deterministic Analysis Output
  • Script: /tmp/gh-aw/ambient-context/analyze_requests.py (stdlib-only) processed all 4 run-*.txt/run-*.json pairs and wrote request-analysis.json / request-analysis.md.
  • Median request 21,716 chars; P95 25,442 chars; top workflow by size: PR Sous Chef.
  • Top repeated fragments across sample are all part of the shared immutable security/environment preamble (4x each) — no workflow-specific duplicate fragments recurred across different workflows, indicating cross-workflow duplication is limited to the fixed system preamble rather than shared workflow content.
  • Largest aggregate sections by heading: "Required nudges for prioritized eligible PRs" (~4.1KB, PR Sous Chef) and "Required skip rules per PR" (~2.1KB, PR Sous Chef), confirming PR Sous Chef as the top optimization target among sampled workflows.

Recommendations by Category

Workflow Markdown

  • ai-moderator.md: change tools.github.mode from local to gh-proxy to align with sibling workflows and reduce inline GitHub tool boilerplate. Evidence: line 43 (mode: local) vs. pr-sous-chef.md/linter-miner.md/daily-cache-strategy-analyzer.md all use gh-proxy. Impact: medium. Safety: likely safe immediately, but verify GitHub read patterns still function after make recompile.
  • pr-sous-chef.md: condense "Required nudges for prioritized eligible PRs" and "Required skip rules per PR" (>6KB combined, largest single-workflow blocks in the sample) into a compact table or externalized reference doc loaded only when needed. Evidence: heading-size analysis (4,117 + 2,126 chars) and highest sampled AIC (7.455). Impact: high. Safety: needs manual review (business logic sensitive).
  • daily-cache-strategy-analyzer.md: keep Phase 1 log-fetching via MCP logs tool (already correct) but consider moving more of Phase 2/3 signal-detection logic to pre-agent-steps deterministic shell, keeping the prompt focused on prioritization/decision-making. Impact: medium. Safety: needs manual review.

Skills

  • No oversized/duplicated skill-fusion pattern was observed in this sample (skill counts were low across all 4 runs); no skill-specific recommendation this cycle.

Agents

  • pr-sous-chef.md defines an inline ## agent: pr-processor; review whether its scope could be reduced or its guidance moved to a shared import to cut duplication with the main prompt's nudge/skip-rule tables. Impact: low-medium. Safety: needs manual review.

References

Generated by 🌫️ Daily Ambient Context Optimizer · auto · 61.3 AIC · ⊞ 12.3K ·

  • expires on Aug 6, 2026, 12:24 PM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions