Skip to content

ambient-context: reduce copilot-agent-analysis first-request size by ~28%#43619

Merged
pelikhan merged 2 commits into
mainfrom
copilot/ambient-context-daily-optimizer
Jul 5, 2026
Merged

ambient-context: reduce copilot-agent-analysis first-request size by ~28%#43619
pelikhan merged 2 commits into
mainfrom
copilot/ambient-context-daily-optimizer

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

copilot-agent-analysis was the largest sampled request at 27,299 chars (AIC 116.9), driven by always-inlined content that is rarely or never needed at runtime.

copilot-agent-analysis.md (16,546 → 11,876 chars, −28%)

  • Gate cold-start rebuild behind optional import{{#runtime-import? shared/copilot-agent-analysis-history.md}} replaces ~1,470 chars of rebuild instructions that are only needed when the history cache is empty. Extracted to new shared/copilot-agent-analysis-history.md.
  • Remove §4.2.1 duplicate — the rebuild block appeared twice (inline + a second copy under §4.2.1); the inline copy is now the shared file, §4.2.1 removed.
  • Trim structured A/B variant template — removed verbose "Agent Task Texts Table Instructions" and "Important Brevity Guidelines" prose (~1,800 chars). The table structure and column list in the template body are self-documenting.
  • Drop duplicate jq examples — 3 inline copilot-prs.json queries already present in shared/copilot-pr-analysis-base.md.

shared/copilot-pr-analysis-base.md

  • Drop jqschema/SKILL.md import (~992 chars at runtime) — jqschema is for unknown API shapes; pre-fetched PR data ships with a *-schema.json companion file.

daily-code-metrics.md

  • Remove redundant chart setup literalsDPI 300, ax.grid(True, alpha=0.3) stripped from the Python script preamble; already specified by the python-dataviz.md import pulled in via shared/trends.md.

…metrics

- copilot-agent-analysis.md: remove duplicate body-level jq examples
  (already covered by shared/copilot-pr-analysis-base.md)
- copilot-agent-analysis.md: gate cold-start historical rebuild behind
  optional runtime-import (shared/copilot-agent-analysis-history.md)
- copilot-agent-analysis.md: remove duplicated §4.2.1 rebuild section
  (now lives in the new shared file)
- copilot-agent-analysis.md: trim verbose A/B structured-variant template
  (remove verbose Agent Task Texts instructions and brevity guidelines)
- shared/copilot-pr-analysis-base.md: remove jqschema/SKILL.md import
  (~992 chars; data is at a known path with a schema file)
- daily-code-metrics.md: remove redundant DPI/grid settings already
  covered by python-dataviz.md import
- New: shared/copilot-agent-analysis-history.md for optional cold-start import

Total character savings: ~4,670 chars in copilot-agent-analysis.md (28%)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update daily ambient context optimizer ambient-context: reduce copilot-agent-analysis first-request size by ~28% Jul 5, 2026
Copilot AI requested a review from pelikhan July 5, 2026 20:53
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Hey @Copilot 👋 — great work on trimming the copilot-agent-analysis ambient context! The -28% reduction and the extraction of the cold-start rebuild block into shared/copilot-agent-analysis-history.md are clean, purposeful changes.

One small gap to address before this is ready:

  • No test coverage — the diff touches only .md prompt files and .lock.yml files, so traditional unit tests do not apply here. However, if the project has snapshot tests, prompt regression tests, or any workflow-level validation for the changed prompt files, those should be included or confirmed not to be needed.

If you would like a hand verifying or adding coverage:

Check whether the repository has any snapshot or regression tests for workflow prompt files in .github/workflows/. Specifically look for test fixtures or test files that reference copilot-agent-analysis.md, copilot-pr-analysis-base.md, or daily-code-metrics.md. If tests exist, update them to reflect the changes in PR #43619. If no tests exist for prompt files, confirm that explicitly in the PR description.

Generated by ✅ Contribution Check · 266.4 AIC · ⌖ 29.1 AIC · ⊞ 6.2K ·

@pelikhan
pelikhan marked this pull request as ready for review July 5, 2026 22:11
Copilot AI review requested due to automatic review settings July 5, 2026 22:11
@pelikhan
pelikhan merged commit 927a689 into main Jul 5, 2026
@pelikhan
pelikhan deleted the copilot/ambient-context-daily-optimizer branch July 5, 2026 22:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reduces the default “ambient context” included in Copilot/agent analysis workflow prompts by removing rarely-needed inline guidance and unnecessary imports, while keeping the same operational behavior via optional runtime imports and regenerated lock workflows.

Changes:

  • Extracted historical-data cold-start rebuild guidance into an optional runtime import to shrink the default copilot-agent-analysis prompt.
  • Removed the jqschema skill import from the shared Copilot PR analysis base and propagated the change through dependent compiled .lock.yml workflows.
  • Trimmed redundant chart setup text in daily-code-metrics (relying on existing shared visualization imports) and recompiled the workflow lock.
Show a summary per file
File Description
.github/workflows/shared/copilot-pr-analysis-base.md Removes jqschema skill import to reduce runtime prompt size.
.github/workflows/shared/copilot-agent-analysis-history.md New shared fragment containing cold-start history rebuild instructions (optional import).
.github/workflows/daily-code-metrics.md Simplifies Python chart setup instructions to avoid redundancy with shared imports.
.github/workflows/daily-code-metrics.lock.yml Regenerated compiled workflow reflecting updated markdown content.
.github/workflows/copilot-pr-prompt-analysis.lock.yml Regenerated compiled workflow to drop jqschema runtime import.
.github/workflows/copilot-pr-nlp-analysis.lock.yml Regenerated compiled workflow to drop jqschema runtime import.
.github/workflows/copilot-pr-merged-report.lock.yml Regenerated compiled workflow to drop jqschema runtime import.
.github/workflows/copilot-agent-analysis.md Removes duplicated/verbose inline guidance and uses optional runtime import for cold-start rebuild steps.
.github/workflows/copilot-agent-analysis.lock.yml Regenerated compiled workflow reflecting updated markdown content and imports.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 9/9 changed files
  • Comments generated: 0
  • Review effort level: Low

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.3

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-07-05

3 participants