contextd pack-validate verifies both the runtime API of a pack and its
versioned authoring-quality contract.
- Legacy manifests without
manifest_version(or with version1) remain loadable and receive an informational migration notice. manifest_version: 2retains the seven-file compatibility contract.manifest_version: 3is required for newly scaffolded packs and enables one canonical knowledge file plus manifest-owned retrieval.- Unknown manifest versions are errors. This prevents a newer contract from being silently interpreted as an older one.
The v2/v3 authoring schema is
templates/pack.schema.json. Runtime
validation remains implemented in scripts/lib/pack_validation.py so the CLI
does not require a JSON Schema dependency.
pack.yamlexists, parses, and itsnamematchespack-{slug}directory.- Version/description/components exist; components are unique.
keywordsonly reference declared components.- Declared file paths are relative, traversal-safe, and present.
conflicts_withreferences known packs.- Retrieval rows only use declared components.
- Retrieval paths cannot be absolute, traverse parents, cross workspaces, or read another pack.
- A documented validator catalog requires a declared executable rule script.
- Component slugs and exact routing keywords are unique across the pack catalog; collisions fail fast instead of making context selection order-dependent.
- Semver version; valid status/category; ISO review date.
- At least one supported audience and task type.
- Non-empty include/exclude scope boundaries without overlap.
- Component slugs are normalized.
- Every component has at least three unique routing signals.
- The same keyword cannot own multiple components in one pack, which would make routing ambiguous and add unnecessary context.
- All seven standard pack files are declared.
- README documents activation, exclusion boundary, retrieval behavior, and verification.
- Constraints expose stable
pack-{name}-...group IDs. - Common pitfalls contain at least five numbered entries.
- Every documented Layer-1 rule ID is implemented and every implemented ID is documented.
- Every component has a non-empty canonical
pack.yaml#retrievalrow. files.knowledgeandfiles.validator_scriptare declared and readable.knowledge.mdcontains## Global Principles.- Every component has one exact
## Component: {slug}section with### Mental Model,### Standards,### Failure Signals, and### Evidence And Stop Conditions. - Standards expose stable
pack-{name}-...IDs and every implemented validator ID is documented there. - If a legacy
agents/pipeline/retrieval-map.mdadapter remains, it must exactly match canonical manifest retrieval. Drift is an error. - A legacy
agents/**/*.mdadapter may not define a stable pack rule ID absent from canonical knowledge.
These checks deliberately do not claim that a technology recommendation is current. Provider/framework packs must also carry an official baseline link, review date, and workspace-pinned compatibility contract.
context_profile: decision-first is accepted only for v3. Each component also
needs explicit nonempty Strategy and Judgment sections. Optional Foundation and
Procedure blocks use unique slug IDs and cannot own a stable rule definition or
uppercase mandatory instruction. The parser ignores fenced examples and rejects
ambiguous headings/unclosed fences. Existing rule parity checks still apply.
See decision-first contract; validation is not proof of
correct semantic classification or agent expertise.
contextd pack-validate --all --format json
contextd pack-validate --pack pack-product --format text0: no errors or warnings (informational migration notices are allowed).1: one or more errors.2: warnings only.
contextd doctor includes validation for the effective packs of the current
codebase. CI should validate all first-party packs:
contextd pack-validate --all --format textA zero-issue report proves the pack contract is internally consistent. It does not prove good retrieval or domain correctness. Before release, also test:
- Representative positive tasks select the intended component/docs.
- Neighboring negative tasks do not select the pack.
contextd explainshows no irrelevant high-cost candidates.- The budget report includes static pack guidance and remains below the target total for representative multi-pack tasks.
- Layer-1 fixtures fire every documented executable rule and include safe non-trigger cases.
- Layer-2 guidance cites current official sources where behavior can change.
contextd context "{positive task}" --preview --format json
contextd explain "{positive task}" --format text
contextd context "{negative neighboring task}" --preview --format json
python scripts/validate.py --file <fixture> --workspace <workspace-with-pack>Keep retrieval entries relative to the active workspace unless they
intentionally start with packs/{active-pack}/ or templates/. Missing
workspace knowledge should become an explicit context gap, never an implicit
guess or a cross-workspace lookup.