Skip to content

fix(anchors): resolve workspace agents from session cwd - #384

Merged
Brian Krabach (bkrabach) merged 2 commits into
mainfrom
fix/anchors-cwd-agents-context
Sep 8, 2026
Merged

Brian Krabach (bkrabach) merged 2 commits into
mainfrom
fix/anchors-cwd-agents-context

Conversation

@bkrabach

@bkrabach Brian Krabach (bkrabach) commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add the optional trailing @AGENTS.md reference to the anchors system context.
  • Keep the production change limited to that reference; the generic resolver is unchanged.
  • Add regression coverage using the actual anchors context for nested self-reference de-duplication, session-cwd resolution, process-cwd and bundle decoy exclusion, and a missing optional file.
  • Add explicit prompt-budget accounting for the required cwd rule: +12 characters, a 1,154-character pinned budget, and a current 588-character saving.
  • This PR replaces fix(anchors): load workspace AGENTS.md only #383 with a narrower production diff and cwd-specific regression tests.

The Foundation bundle's cwd-only behavior is deliberately separate from the CLI's global/project .amplifier reference policy. The related CLI PR is microsoft/amplifier-app-cli#332, but it is not a dependency of this change.

Why

@AGENTS.md must resolve relative to the session working directory used to build the prompt, not the process working directory or the anchors bundle directory. The tests pin those boundaries while preserving self-reference de-duplication and optional-file behavior. The budget update records the required rule's measured cost rather than compressing unrelated prompt text.

Verification

  • Targeted guard: uv run pytest tests/test_lean_head_guardrail.py -q --tb=short -rA — 15 passed.
  • Focused anchors/regression suite: 65 passed.
  • CI-shaped dependency setup: uv sync --extra grpc-adapter — passed.
  • Full suite: uv run pytest tests/ -q --tb=short -rA — 1,928 passed, 4 skipped.
  • git diff --check — passed.
  • Added-lines leak scan — passed; no local host paths, credentials, or private identifiers in the new lines.

Prior combined DTU evidence, not rerun for this narrower PR: 23/23 provider-bound assertions using a deterministic provider and real CLI fresh/run --resume flows, covering minimal context/orchestrator, lifecycle hook, and partial-bundle behavior. No live vendor was tested; this evidence is not presented as live-provider validation.

Scope

  • Production: bundles/anchors/context/system.md — trailing @AGENTS.md mention only.
  • Regression: tests/test_instruction_mentions_lead_context.py — cwd-specific coverage.
  • Census accounting: tests/test_lean_head_guardrail.py and docs/lanes/zc6t-lean-head-ship/DONE-NOTE.md — required +12-character budget update and 588-character current saving.
  • No generic resolver, CLI .amplifier policy, dependency, lockfile, or unrelated prompt prose changes.
  • Historical experiment results in the DONE-NOTE are preserved; vendor cache metrics were not rerun.

Breaking changes

None intended.

Observations

None arose.

Ensure the anchors bundle loads the optional workspace AGENTS.md relative to the session cwd, with regression coverage for nested self-references and missing files.

Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Raise the pinned system prompt budget by 12 characters for the required cwd AGENTS rule and update the census saving from 600 to 588 characters.

Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@bkrabach
Brian Krabach (bkrabach) merged commit b279559 into main Sep 8, 2026
7 checks passed
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.

2 participants