261006_01_ENH: 에이전트 참조 문서 합성 및 검증 기능 추가
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## Purpose
|
||||
|
||||
The composer builds deterministic, self-contained repository instructions from centrally maintained rules and repository-owned metadata. Repository agents read the generated `AGENTS.md`; Claude Code reads the paired `CLAUDE.md`, which imports that generated file.
|
||||
The composer builds deterministic repository instructions, workflow skills, and shared-contract reference copies from centrally maintained rules and repository-owned metadata. Repository agents read the generated `AGENTS.md`; Claude Code reads the paired `CLAUDE.md`, which imports that generated file. Codex and Claude Code discover their managed skills from their repository-scoped skill directories.
|
||||
|
||||
## Runtime
|
||||
|
||||
@@ -33,6 +33,9 @@ The composer reads these inputs as strict UTF-8 text:
|
||||
6. Shared contract consumer files resolved through `catalog/contracts.yml` and the merged workspace registry
|
||||
7. The target repository's `.agent/project.md`
|
||||
8. The target repository's `.agent/consumer.md` when the profile provides at least one shared contract
|
||||
9. Each canonical `skills/<skill-name>/SKILL.md`
|
||||
10. Repository-authored `.agent/references/**/*.md` routed from `.agent/project.md`
|
||||
11. Provider-authored `.agent/consumer-references/**/*.md` routed from `.agent/consumer.md`
|
||||
|
||||
The target repository profile is `.agent/profile.yml` and must conform to `schemas/profile.schema.json`. Machine paths never belong in the profile.
|
||||
|
||||
@@ -71,6 +74,8 @@ Render the header as an HTML comment so it does not become an instruction headin
|
||||
- Resolve each contract ID in `catalog/contracts.yml`.
|
||||
- Resolve its `provider_project_id` to a repository path through the merged workspace registry.
|
||||
- Read the catalog's `consumer_file` from that provider repository at composition time.
|
||||
- Read `consumer_references_dir`, require at least one strict UTF-8 Markdown reference, and require `consumer_file` to route every source reference to `.agent-harness/references/<contract-id>/...`.
|
||||
- Copy those references into each provider and consumer repository as managed, repository-local files. Refuse to overwrite a target without the harness marker.
|
||||
- A new composition therefore picks up the latest local consumer contract immediately; committed generated files remain stable until recomposed and committed again.
|
||||
- `--contract <contract-id>` selects the registered provider first, followed by only profiles that explicitly consume that contract, ordered by project ID. It does not select unrelated registered projects.
|
||||
- Contract selection fails for an unknown contract, an unregistered provider, or a provider profile that does not declare the catalog contract under `shared_contracts.provides`.
|
||||
@@ -90,7 +95,10 @@ Fail composition when any of these conditions is true:
|
||||
- A required non-legacy shared contract is missing.
|
||||
- A provider project is not registered or its consumer file is missing or empty.
|
||||
- `.agent/project.md` is missing or empty.
|
||||
- `.agent/project.md` does not contain `## Required Project References`.
|
||||
- A routed `.agent/references` path is missing, escapes the reference root, is invalid UTF-8, or an authored Markdown reference is not routed by `.agent/project.md`.
|
||||
- A providing repository's `.agent/consumer.md` is missing or empty.
|
||||
- A shared consumer reference directory is missing or empty, or `consumer.md` does not route every shared reference.
|
||||
- A migration target containing `nextjs` does not also contain `react`.
|
||||
- Any Markdown, JSON, or YAML input is not strict UTF-8 without BOM.
|
||||
|
||||
@@ -116,24 +124,47 @@ Write exactly:
|
||||
|
||||
Use UTF-8 without BOM, LF line endings, and exactly one trailing newline. Refuse to overwrite other existing content.
|
||||
|
||||
### Managed Skills
|
||||
|
||||
For each canonical skill, write identical generated copies to:
|
||||
|
||||
- `.agents/skills/<skill-name>/SKILL.md` for Codex
|
||||
- `.claude/skills/<skill-name>/SKILL.md` for Claude Code
|
||||
|
||||
The generated marker follows the YAML front matter so skill discovery remains valid. Managed skills use UTF-8 without BOM, LF line endings, and exactly one trailing newline. Missing and stale managed files may be written; an existing file without the generated marker is unmanaged and must not be overwritten.
|
||||
|
||||
The default managed skills are `attention-aware-communication` for response presentation, `karpathy-guidelines` for implementation discipline, `project-reference-loader` for task-scoped context loading, and `verification-before-completion` for evidence-gated completion claims.
|
||||
|
||||
### Managed Shared References
|
||||
|
||||
For every provided or consumed contract, copy each provider source from its cataloged `consumer_references_dir` to:
|
||||
|
||||
```text
|
||||
.agent-harness/references/<contract-id>/<relative-source-path>
|
||||
```
|
||||
|
||||
Generated references use UTF-8 without BOM, LF line endings, a harness marker, and one trailing newline. They are shared by Codex and Claude Code. Edit the provider source and recompose; never edit a generated consumer copy directly.
|
||||
|
||||
## Size Budget
|
||||
|
||||
Codex uses a 32 KiB default combined project-instruction limit. To leave room for possible nested guidance:
|
||||
|
||||
- Warn when generated `AGENTS.md` exceeds 26 KiB (26,624 bytes).
|
||||
- Fail when it exceeds 32,000 bytes, leaving 768 bytes below Codex's default 32 KiB combined limit.
|
||||
- Warn when `.agent/project.md` exceeds 4,096 bytes; keep it near 2-3 KiB and route conditional detail to `.agent/references`.
|
||||
- Warn when one project reference exceeds 16,384 bytes so it can be split by task scope.
|
||||
- Never solve an overflow by truncating content. Shorten or split the source rules deliberately.
|
||||
|
||||
## Commands
|
||||
|
||||
- `list`: list shared and local registrations without modifying files.
|
||||
- `plan`: resolve, validate, compose in memory, and report fragments, size, warnings, and output state.
|
||||
- `verify`: compare expected and stored output byte for byte without modifying files; return a failure exit code for drift.
|
||||
- `compose`: atomically replace only managed or missing `AGENTS.md` and `CLAUDE.md` files, then verify them again.
|
||||
- `verify`: compare expected and stored instructions, skills, and shared references byte for byte while validating authored project references; return a failure exit code for drift.
|
||||
- `compose`: atomically replace only managed or missing instructions, skills, and shared references, then verify them again.
|
||||
- `register`: validate a relative project path and matching profile, then atomically update `workspace.local.yml` by default or `workspace.yml` when `--shared` is explicit.
|
||||
|
||||
For `plan`, `verify`, and `compose`, select exactly one scope with `--project <id>`, `--contract <contract-id>`, or `--all`. Contract scope processes the provider first and consumers in project-ID order. No command performs Git, database, deployment, paid API, or network operations. `--all` must be explicit; a single project is the normal scope.
|
||||
|
||||
## Verification
|
||||
|
||||
Tests use isolated temporary workspaces. They cover deterministic order, byte-for-byte verification, semantic validation, contract-target selection and isolation, unmanaged-file refusal, safe registration paths, and hard size-limit enforcement.
|
||||
Tests use isolated temporary workspaces. They cover deterministic order, byte-for-byte verification, project-reference routing, shared-reference distribution, semantic validation, contract-target selection and isolation, unmanaged-file refusal, safe registration paths, and hard size-limit enforcement.
|
||||
|
||||
Reference in New Issue
Block a user