Skip to content

[WIP] Extract embedded issue template to shared partial - #36743

Closed
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/daily-ambient-context-optimizer
Closed

[WIP] Extract embedded issue template to shared partial#36743
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/daily-ambient-context-optimizer

Conversation

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[ambient-context] Daily Ambient Context Optimizer - 2026-06-03</issue_title>
<issue_description>### Executive Summary

  • 4 runs sampled across 4 distinct workflows from the last 24 hours
  • Workflows: Daily Regulatory Report Generator, Agentic Workflow Audit Agent, Daily Safe Output Tool Optimizer, Contribution Check
  • Median first-request size: 25,899 chars | P95: 30,932 chars
  • All 4 prompts share identical system-injected blocks (mcp-clis ~3,700 chars + safe-outputs ~2,505 chars = ~6,200 chars constant overhead). The largest single-run driver is an embedded issue template (~150–200 lines of boilerplate) in the Safe Output Tool Optimizer workflow. Three of four workflows lack gh-proxy, causing their task content to stay MCP-tool oriented.

Highest-Leverage Changes

  1. Extract embedded issue template to a shared partialdaily-safe-output-optimizer.md embeds ~150–200 lines of issue-body boilerplate; move to shared/safe-output-issue-template.md and import only at Phase 6 (high impact)
  2. Deduplicate daily-regulatory.md against shared/daily-audit-base.md — sections like ## Agentic Workflow Audit Guide and ### Previous Reports Cache already exist in the shared base; removing restated content can cut several hundred chars (high impact)
  3. Trim/replace mcp-clis examples block for reporting workflows — the full mcp-clis example corpus (~3,700 chars) appears in every run; a compact 3-line stub + pointer to --help suffices for workflows that don't do MCP discovery (high impact, affects all runs)
  4. Defer jqschema SKILL.md import in daily-regulatory.md — jqschema is imported statically but only needed ad hoc; replace with a one-line inline note (medium impact)
  5. Enable gh-proxy for audit-workflows, daily-regulatory, and daily-safe-output-optimizer — contribution-check already uses mode: gh-proxy; the other three use toolsets: default without gh-proxy, keeping task wording MCP-oriented and preventing caching benefits (medium impact)
  6. Collapse Phases 1–2 sub-headings in daily-safe-output-optimizer — four sub-headings under error collection/parsing can become one terse instruction block, removing duplicate safe-outputs usage lines (medium impact)
  7. Trim agentic-workflows-guide block for non-audit workflows — the audit tool reference section (~1,628 chars) is injected into runs that rarely call audit; gate it only to workflows that explicitly need it (low impact)

Key Metrics

Metric Value
Sampled runs 4
Distinct workflows 4
Median chars 25,899
P95 chars 30,932
Largest sampled request 30,932 chars (Daily Safe Output Tool Optimizer)
Per-Run First-Request Metrics
run_id workflow chars lines headings dup_line_ratio effective_tokens turns
26914926229 Daily Safe Output Tool Optimizer 30,932 743 77 0.098 9,969,566 32
26916018014 Daily Regulatory Report Generator 26,981 631 72 0.063 13,632,016 26
26915876423 Agentic Workflow Audit Agent 24,818 514 52 0.097 12,610,898 31
26914897476 Contribution Check 16,603 265 15 0.109 9,303,370 36

dup_line_ratio = fraction of non-empty lines that are duplicates (6–11% across all runs).

Repeated Ambient Context Signals
  • mcp-clis examples block (~3,700 chars) present in all 4 prompts verbatim: code-comment headings # Call a tool — pass arguments as --name value pairs and # Works with any tool — just match the parameter names appear as top-repeated large sections in every run
  • safe-outputs instructions (~2,505 chars) injected identically in all 4 runs
  • #### \audit` — Inspect a specific run` section appears in 2 of 4 runs (Agentic Workflow Audit Agent: 6,719 chars; Daily Safe Output Tool Optimizer: 4,420 chars) as the single largest section
  • System overhead is 34–54% of total first-request chars across sampled runs; the task-specific content is only 45–66% of the total
  • The Contribution Check run (which has gh-proxy) has the smallest prompt (16,603 chars) and the fewest headings (15 vs 52–77), suggesting proxy-enabled workflows have leaner prompts
Deterministic Analysis Output

Python script at /tmp/gh-aw/ambient-context/analyze_requests.py (stdlib only) produced:

  • request-analysis.json and request-analysis.md

Key findings:

  • Heading density: 77 headings in the Safe Output Optimizer (743 lines) = 1 heading per 9.6 lines — extremely fragmented structure that signals over-specified inline instructions
  • Duplicate line ratios: 6.3–10.9% across all runs; all non-trivial considering the majority are system-injected fixed blocks
  • Lines mentioning agent: 6–18 per prompt (task portion only has 0 inline agents, so these are instruction references)
  • Lines mentioning safe-outputs: 22–52 per prompt — the Safe Output Optimizer references safe-output-related terms 52 times, suggesting the safe-outputs instruction blocks are being restated in the task body as well as injected via system blocks
  • SKILL.md refs: 0–1 per prompt (only 2 of 4 workflows import skills); skill overhead is low

Recommendations by Category

Workflow Markdown

  1. [high] Extract issue template from daily-safe-output-optimizer.md — ~150–200 lines of issue body boilerplate (Summary, Error Analysis, Error Pattern 1/2, Root Cause Analysis, Recommended Improvements, etc.) embedded inline. Move to shared/safe-output-issue-template.md; import with a uses: reference only when an issue is actually being written (Phase 6). Likely safe immediately. Affects: daily-safe-output-optimizer.md.

  2. [high] Deduplicate daily-regulatory.md vs shared/daily-audit-base.md — sections ## Agentic Workflow Audit Guide and ### Previous Reports Cache already exist in shared/daily-audit-base.md. Remove or stub-reference any section in daily-regulatory.md that restates shared-base content. Target: remove at least 3–4 redundant top-level sections. Needs manual review to confirm shared-base coverage. Affects: daily-regulatory.md.

  3. [medium] Collapse Phases 1–2 in daily-safe-output-optimizer.md — four sub-headings (2.1 Error Types, 2.2 Where to Find, 2.3 Extract Context) plus duplicate safe-outputs usage lines can be merged into one terse instruction block. Likely safe immediately. Affects: daily-safe-output-optimizer.md.

  4. [medium] Enable gh-proxy and rewrite MCP-oriented problem statementsaudit-workflows.md, daily-safe-output-optimizer.md, and daily-regulatory.md have cli-proxy: true but no github: mode: gh-proxy. Add mode: gh-proxy under tools.github: for each, then rewrite any task instructions that say "use MCP tool X" to use gh CLI form instead. Contribution Check already shows this pattern with the smallest prompt. Needs manual review of each workflow's GitHub tool usage. Affects: 3 workflows.

Skills

  1. [medium] Defer jqschema SKILL.md import in daily-regulatory.mdskills/jqschema/SKILL.md is imported statically even though schema inference is not the primary goal. Replace with an inline note: "Use the jqschema skill if schema inference is needed." Likely safe immediately. Affects: daily-regulatory.md.

Agents

  1. [high] Create slim mcp-clis system-block variant for reporting workflows — the mcp-clis examples block (~3,700 chars in every prompt) is the largest constant overhead. For reporting workflows (daily-regulatory, daily-safe-output-optimizer, audit-workflows) that don't need MCP tool discovery, replace the full examples corpus with a 3-line stub pointing to --help. This is a platform-level change; needs coordination with the runtime configuration. Affects: all 3 reporting workflows, and potentially all future workflows.

  2. [low] Gate agentic-workflows-guide injection to audit-specific workflows — the audit tool reference section (~1,628 chars) is injected into all workflows with agentic-workflows in their tools block, even those that only use logs. Consider a scoped variant that omits the detailed audit parameter docs for non-audit workflows. Needs platform review. Affects: daily-safe-output-optimizer.md, others.

References

  • §26914926229 — Daily Safe Output Tool Optimizer (largest first request: 30,932 chars)
  • §26916018014 — Daily Regulatory Report Generator (highest effective tokens: 13.6M)
  • §26915876423 — Agentic Workflow Audit Agent (2nd highest effective tokens: 12.6M)

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

  • expires on Jun 10, 2026, 10:41 PM UTC

Comments on the Issue (you are @copilot in this section)

Copilot AI linked an issue Jun 3, 2026 that may be closed by this pull request
@pelikhan pelikhan closed this Jun 3, 2026
Copilot stopped work on behalf of pelikhan due to an error June 3, 2026 22:44
Copilot AI requested a review from pelikhan June 3, 2026 22:44
@github-actions
github-actions Bot deleted the copilot/daily-ambient-context-optimizer branch June 11, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ambient-context] Daily Ambient Context Optimizer - 2026-06-03

2 participants