Add agent-context projection, path resolve, and ADR-0043 capability contract#85
Merged
Merged
Conversation
Ancienttwo
force-pushed
the
codex/agent-context-provider
branch
from
July 5, 2026 20:57
d3c473e to
2bbec0c
Compare
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.
What / Why
Makes ArchContext the capability-context provider for agentic runtimes. Today repo-harness maintains its own capability filing (
.ai/context/capabilities.jsonplus seven consumers); this slice moves the cross-product contract into ArchContext so every product reads path-ownership and agent-context conventions from one provider instead of reinventing them.ADR-0043 fixes the cross-product contract:
stableIddoubles as the capability ID (capability.<domain>.<name>) whenkindiscapability— no schema change, the existing id pattern already fits.source.includeglobs are the source of truth for path ownership, resolved by a single-point tie-break:source.excludedisqualifies first, then the most-specific (longest literal-prefix) matchingincludewins, and an equal-specificity tie is rejected as ambiguous. A node with nosource(or an emptyinclude) owns nothing.extensions(extensions.lspProfile: string,extensions.verification: string[]), per the additive schema-upgrade rule — noschemaVersionbump.agent-contextprojection semantics: a marker-owned region (BEGIN/END ARCHCONTEXT AGENT CONTEXT, distinct from theARCHCONTEXT:generatedfamily) in each capability's ownCLAUDE.md/AGENTS.md; human-authored content is preserved, only the marker region is replaced.Implementation:
agent-contextProjectionTargettargetType wired across the three hardcoded sites: schema enum (schemas/runtime/projection-target.schema.json), the projection-engine target builder, and the default projection manifest (model-store-yaml).archctx resolve --path <p>CLI: reads the model, applies the ADR-0043 tie-break (implemented exactly once inresolveArchitectureOwnerForPath, which the CLI delegates to), emits a JSON envelope, and sets exit codes 0 = matched, 1 = no-match, 2 = ambiguous. Future adapters call this command rather than re-deriving glob semantics, so the two products cannot drift apart on what "ambiguous" means.parseJsonOrStableYaml(the flat parser could not read nestedsource.include/extensions, which resolve and agent-context rendering both require). Existing renderer behavior is unchanged.Verification
bun run typecheckbun testbun run test:contractsnode scripts/package-boundary-audit.mjsresolvesubprocess spot probeTests cover four groups: schema enum acceptance, agent-context target construction + marker rendering, resolve tie-break behaviors (match / exclude / most-specific-wins / ambiguous / no-match / no-source / empty-include), and CLI end-to-end exit codes.
Follow-ups (out of scope — separate next contracts)
packages/contracts/src/ledger.tsProjectionTargetTypeto include"agent-context"(kept out of this slice'sallowed_paths; the runtime validation source of truth is the JSON Schema, which is updated here — the projection-engine uses a structurally identical locally-scoped type in the meantime).docs/adr/README.md(out ofallowed_paths).agent-contextinto an actual disk-write path (adocs apply-style command through ChangeSet);renderAgentContextProjectionis a pure function today with no CLI-triggered write.