feat(spec,examples): configure agent context discovery directories - #97
Merged
Merged
Conversation
Agent harnesses discover instructions in global configuration directories or the project root, so a workspace-sibling profile can leave runtime guidance and Kit contributions unread. Let workloads, agent mixins, and sets select an explicit destination, retain the legacy fallback for existing descriptors, and preserve user-authored profile content. Extend agent-context@1 in place with the optional directory field, as requested. Align the schemas, authoring guidance, verified agent examples, and conformance checks, and expose CODEX_HOME to direct ACP launches. Signed-off-by: Christian Dupuis <cd@docker.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new config field must use a new capability version under the repository’s strict compatibility rules.
Review effort: Balanced
Findings: 1
What changed in this PR
Proposes configurable agent-context discovery directories, updating validation, composition, conformance coverage, documentation, and agent examples.
Changes:
- Adds explicit directory/filename profile selection and merge precedence.
- Expands TCK fixtures and mutations for placement, preservation, and conflicts.
- Updates agent Kits and discovery documentation.
| File | Description |
|---|---|
tck/sandbox/testdata/fixtures/context-workload/context-workload.yaml |
Adds explicit-directory workload fixture. |
tck/sandbox/testdata/fixtures/context-profile/context-profile.yaml |
Adds explicit-profile mixin fixture. |
tck/sandbox/testdata/fixtures/context-conflict/context-conflict.yaml |
Adds conflicting-profile fixture. |
tck/sandbox/testdata/fake-adapter |
Simulates profile placement and mutations. |
tck/sandbox/sandbox_test.go |
Registers new mutations. |
tck/sandbox/fixtures_test.go |
Updates fixture count. |
tck/sandbox/coverage_test.go |
Accounts for covered requirements. |
tck/sandbox/checks.go |
Adds directory and conflict checks. |
spec/validate.go |
Validates explicit profile destinations. |
spec/types.go |
Adds AgentContext.Directory. |
spec/schema_test.go |
Tests directory schema constraints. |
spec/merge.go |
Implements explicit-profile precedence. |
spec/agent_context_test.go |
Tests validation and composition. |
skills/migrate-kit-to-v3/FIELD-MAPPING.md |
Updates migration guidance. |
skills/create-kit-v3/SKILL.md |
Updates authoring guidance. |
schema/kit.schema.json |
Documents optional discovery directories. |
schema/capabilities/com.docker.sandbox/agent-context@1.schema.json |
Adds the directory schema. |
examples/shell/shell.yaml |
Clarifies legacy fallback behavior. |
examples/opencode/opencode.yaml |
Declares OpenCode’s profile directory. |
examples/opencode-mixin/opencode-mixin.yaml |
Adds the OpenCode mixin profile. |
examples/gemini/gemini.yaml |
Declares Gemini’s profile directory. |
examples/gemini-mixin/gemini-mixin.yaml |
Adds the Gemini mixin profile. |
examples/docker-agent/docker-agent.yaml |
Declares Docker Agent’s profile directory. |
examples/docker-agent-mixin/docker-agent-mixin.yaml |
Adds the Docker Agent mixin profile. |
examples/cursor/cursor.yaml |
Targets Cursor’s project root. |
examples/cursor-mixin/cursor-mixin.yaml |
Adds the Cursor mixin profile. |
examples/codex/codex.yaml |
Declares Codex’s global profile. |
examples/codex-mixin/codex-mixin.yaml |
Adds the Codex mixin profile. |
examples/codex-mixin/codex-mixin.dockerfile |
Exposes CODEX_HOME to direct launches. |
examples/codex-acp-set/codex-acp-set.yaml |
Selects the Codex ACP profile. |
examples/claude/claude.yaml |
Declares Claude’s user profile. |
examples/claude-mixin/claude-mixin.yaml |
Adds the Claude mixin profile. |
examples/claude-acp-set/claude-acp-set.yaml |
Selects the Claude ACP profile. |
docs/spec/SPEC-v3.md |
Defines profile composition behavior. |
docs/spec/conformance.md |
Documents conformance fixtures. |
docs/spec/capabilities/com.docker.sandbox/agent-context@1.md |
Specifies directory runtime duties. |
docs/agent-context-placement.md |
Records harness discovery locations. |
cmd/frontend/set_e2e_test.go |
Tests set profile precedence. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Agent harnesses can miss the workspace-sibling profile: Codex stops project instruction discovery at the Git root, while other harnesses use global configuration files or project-root files. Add an optional absolute
directorytoagent-context@1so Kits can select a discovery location for the profile containing runtime guidance and the per-Kit index. Existing descriptors retain their workspace-sibling default; staged context bodies retain their published paths.Agent mixins can declare an explicit directory and filename. That destination wins over a generic workload's legacy filename, independently of composition order; identical explicit destinations coalesce and differing ones conflict. The shell-based Claude and Codex ACP sets also declare their agent profile explicitly, so they work with older published component mixins and coalesce with the updated ones. Preserve existing instructions outside runtime-managed sections so Cursor can use a checkout's
AGENTS.md. Move the Codex mixin'sCODEX_HOMEinto image environment so ACP launches receive it without a login shell.Update Go types and validation, JSON Schemas, normative text, authoring/migration skills, and the verified workload/mixin pairs for Codex, Claude Code, Gemini CLI, OpenCode, Docker Agent, and Cursor. The discovery report records effective-environment overrides, loader conditions, and source links. Devin keeps its legacy declaration because an authoritative discovery location could not be verified. Cursor uses the example workdir; another checkout root requires a matching directory. Differing explicit agent profiles remain unsupported in this singleton capability.
The extension stays in
agent-context@1, as requested, without a capability or schema version bump. No existing field is renamed or removed. Existing descriptors remain valid; older strict readers reject declarations using the new directory field. Thesbxruntime handler lives outside this repository and needs to implement these duties before consuming the updated examples. Full livesbxconformance was not run.Normative accounting:
agent-context@1/workload-filename-is-profilenow refers to the effective profile; the existingagent-context@1/body-readablecheck covers legacy behavior.agent-context@1/directory-honoredhas a new runtime check exercising two directories, a workload-owned destination, and an agent mixin overriding a legacy workload in both input orders.agent-context@1/explicit-profile-precedenceandagent-context@1/existing-content-preservedare covered by that directory check; the workload fixture seeds existing instructions.agent-context@1/explicit-profile-conflicthas a new refusal check composing differing explicit profiles.Validation passed:
task validate,task lint,task test(unit and fake-adapter conformance),task test:e2e, andtask kit:dev KIT=codex-mixin. The built Codex mixin's published descriptor and image environment were inspected. Pre-existing artifact-store and scheduling edits are excluded.Release note