Skip to content

feat: reduce ambient context token usage across 4 workflows#46684

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

feat: reduce ambient context token usage across 4 workflows#46684
pelikhan merged 3 commits into
mainfrom
copilot/ambient-context-daily-optimizer

Conversation

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Daily Ambient Context Optimizer flagged high structural fragmentation and missing proxy config across four workflows, with median first-request size of 22K chars and P95 at 24K.

Changes

  • daily-cache-strategy-analyzer.md

    • Add gh-proxy + cli-proxy to tools: — both were absent, leaving GitHub API and CLI calls on the slower unauthenticated path
    • Merge Phase 2 sub-sections 2.1/2.2/2.3 into a single ## Phase 2: Detect Cache Issues block; removes duplicate bash loop and table template (~854 chars saved)
  • changeset.md

    • Add github: { mode: gh-proxy }cli-proxy: true was set but GitHub API calls were unoptimized
  • pr-sous-chef.md

    • Drop rules 10–11 from ## Token efficiency rules — both restate the system-level safe-output terminal guarantee already injected at runtime
    • Collapse ## Required nudges shell examples: consolidate the two add_comment examples into one block, remove the standalone update_pull_request/resolve_pull_request_review_thread/dismiss_pull_request_review examples (format is established in the remaining block); all constraints preserved (~3,031 chars saved)
  • agent-persona-explorer.md

    • Extract shared assessment criteria and storage schema out of the {{#if batch}} / {{else}} branches — both branches were repeating the identical 5-question checklist and quality-score structure (~905 chars saved)

Total reduction: ~4,790 chars across 4 workflows. All 258 workflows recompile cleanly (0 errors).

…kflows

- daily-cache-strategy-analyzer.md: add gh-proxy + cli-proxy tools, consolidate Phase 2 sub-sections 2.1/2.2/2.3 into single detection block (~854 char reduction)
- changeset.md: add github.mode: gh-proxy to complete proxy coverage
- pr-sous-chef.md: remove redundant rules 10-11 from token efficiency rules, trim Required nudges section by removing duplicate shell examples (~3031 char reduction)
- agent-persona-explorer.md: deduplicate Phase 3 batch/per-scenario assessment templates (~905 char reduction)
- Recompile all 258 workflows (0 errors)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize daily ambient context workflows feat: reduce ambient context token usage across 4 workflows Jul 19, 2026
Copilot AI requested a review from pelikhan July 19, 2026 22:44
@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category chore
Risk 🟡 Medium
Score 45/100 (impact:20 urgency:10 quality:15)
Action defer

Workflow token optimization (removes redundant instructions, adds proxy config). Draft. Low urgency; can be batched with similar workflow-chore PRs.

Generated by 🔧 PR Triage Agent · 36.5 AIC · ⌖ 6.68 AIC · ⊞ 5.6K ·

@pelikhan
pelikhan marked this pull request as ready for review July 20, 2026 04:14
Copilot AI review requested due to automatic review settings July 20, 2026 04:14
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

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 ambient prompt context across four agentic workflows while adding proxy declarations for GitHub access.

Changes:

  • Consolidates repeated workflow instructions and examples.
  • Adds gh-proxy configuration.
  • Regenerates workflow lock files.
Show a summary per file
File Description
.github/workflows/pr-sous-chef.md Condenses nudge and safe-output guidance.
.github/workflows/pr-sous-chef.lock.yml Updates generated body metadata.
.github/workflows/daily-cache-strategy-analyzer.md Consolidates cache detection and declares proxies.
.github/workflows/daily-cache-strategy-analyzer.lock.yml Updates generated metadata hashes.
.github/workflows/changeset.md Declares GitHub proxy mode.
.github/workflows/changeset.lock.yml Regenerates CLI-proxy runtime configuration.
.github/workflows/agent-persona-explorer.md Deduplicates assessment criteria.
.github/workflows/agent-persona-explorer.lock.yml Updates generated body metadata.

Review details

Tip

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

  • Files reviewed: 8/8 changed files
  • Comments generated: 4
  • Review effort level: Medium

safeoutputs update_pull_request --pull_request_number 12345 --update_branch true --body "<!-- pr-sous-chef branch update -->" --operation append
```
- If `mergeStateStatus` is `CONFLICTING`, **skip this step entirely**.
- Otherwise, attempt `update_pull_request` with `update_branch: true` and a minimal append body marker including `pr-sous-chef` and the run URL.
- Uses a volatile cache key with `${{ github.run_id }}` **and no restore-key fallbacks** (guaranteed cold start every run)
> **Note — "last one wins" pattern**: `<prefix>-${{ github.run_id }}` + restore key `<prefix>-` is valid. Only flag `run_id` keys as misconfigured when there are **no restore-key fallbacks**.
- Never writes to `/tmp/gh-aw/cache-memory/` (tool does nothing useful)
- Reads stale data without checking timestamps
Comment on lines +45 to +47
cli-proxy: true
github:
mode: gh-proxy
Comment on lines +46 to +47
github:
mode: gh-proxy
…xt-daily-optimizer

# Conflicts:
#	.github/workflows/agent-persona-explorer.lock.yml
#	.github/workflows/changeset.lock.yml
#	.github/workflows/daily-cache-strategy-analyzer.lock.yml
#	.github/workflows/pr-sous-chef.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts on this branch.

Resolved in d2111ee. All four conflicts were in auto-generated .lock.yml files. I merged origin/main (which included the AWF firewall v0.27.37 bump), then ran make recompile to regenerate all 258 lock files with the updated compiler, producing a clean merge commit with no errors.

Copilot AI requested a review from pelikhan July 20, 2026 04:25
@pelikhan
pelikhan merged commit 00b5069 into main Jul 20, 2026
@pelikhan
pelikhan deleted the copilot/ambient-context-daily-optimizer branch July 20, 2026 04:26
Copilot AI added a commit that referenced this pull request Jul 20, 2026
…ontext optimization (#46684)

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.14

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-19

3 participants