diff --git a/.agents/skills/context-and-decisions/LICENSE b/.agents/skills/context-and-decisions/LICENSE new file mode 100644 index 000000000..f1dd2c091 --- /dev/null +++ b/.agents/skills/context-and-decisions/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Matt Pocock + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.agents/skills/context-and-decisions/SKILL.md b/.agents/skills/context-and-decisions/SKILL.md index 23d5cad60..552845e81 100644 --- a/.agents/skills/context-and-decisions/SKILL.md +++ b/.agents/skills/context-and-decisions/SKILL.md @@ -10,7 +10,7 @@ Govern “what these business terms mean” separately from “why this option w ## Domain Context Artifact: Domain Language Only -When terms require repeated explanation, one term has multiple meanings, or unclear language causes module-boundary errors, first reuse the repository's existing glossary/domain-model document or the `context` role in `.governance/docs-map.json`. Only when no equivalent exists should you lazily create the default `CONTEXT.md` from `templates/context.example.md`. +When terms require repeated explanation, one term has multiple meanings, or unclear language causes module-boundary errors, first reuse the repository's existing glossary/domain-model document or the `context` role in `.governance/docs-map.json`. If an existing context map identifies separate business contexts, follow its links to the relevant glossary; ask when the topic's owner is unclear. Different contexts may legitimately use the same word differently. Do not create a glossary for every directory or impose one meaning across unrelated contexts. Only when no equivalent exists and a term has been resolved should you propose the default `CONTEXT.md` from `templates/context.example.md`. Obtain the user's explicit approval to create that new artifact before writing it, and stay within the authorized documentation scope. General permission to update documentation does not itself approve a new artifact; editing an existing mapped glossary within the authorized scope does not require a new-artifact approval. Record only: @@ -21,11 +21,23 @@ Record only: Do not include implementation details, current state, task schedules, full requirements, decision rationale, or history. Keep those in code/MAP, STATUS/Issue Tracker, Spec, ADR, and LOG respectively. Terms must be traceable to code, contracts, or business evidence. Mark unconfirmed items as `needs confirmation`; do not guess. +## Refine Language During the Conversation + +This is an active modeling workflow, not a requirement to rewrite the glossary whenever another skill reads it. + +- **Challenge contradictions.** Compare the user's wording with the glossary. If “cancellation” already means cancelling an entire order but the request permits cancelling one line, explain that distinction and ask which meaning is intended; do not silently redefine the term. +- **Separate overloaded concepts.** For “account,” establish whether the speaker means the customer organization, a person's login, or a billing relationship. Propose a precise term for each distinct concept. Record rejected synonyms only where they really denote the same concept in this context. +- **Probe relationships with concrete scenarios.** Ask, for example, whether one customer can have multiple logins, or what happens to an invoice when only part of an order is cancelled. Scenarios expose boundaries; they are questions, not invented business rules. +- **Check claims against evidence.** Inspect relevant code, tests, contracts, and existing records. If the implementation cancels only whole orders, surface the mismatch with the proposed partial-cancellation rule. Code demonstrates current behavior, not the business owner's desired behavior; do not decide which is correct by yourself. +- **Capture confirmed terms as they settle.** Within an authorized documentation edit, update the existing glossary at that point instead of deferring all definitions until closeout. Keep definitions to one or two sentences, with a source and context-specific avoided synonyms where useful. Do not rewrite code, contracts, or accepted decisions merely to match a proposed term. In discussion-only or read-only work, present the proposed wording without writing files. + +Use the project's existing glossary format. For a new document, the [context template](templates/context.example.md) provides a compact starting point; omit sections without real content. Include business-specific concepts, not generic programming vocabulary such as timeouts or utility functions. + ## ADR Handoff: Reuse the Existing Capability This skill does not define a second ADR directory, numbering scheme, lifecycle, or template. When a decision is hard to reverse, would confuse a future reader without context, and involves a real tradeoff: -1. Read and execute `architecture-decision-records`, preserving the repository's existing ADR location and format. +1. Read and execute `architecture-decision-records`, preserving the repository's existing ADR location, format, and explicit approval gates for initialization and writing. 2. If no convention exists, let that skill choose the minimum viable location; do not create a separate system here. 3. Link to the ADR from `CONTEXT.md`, the project map, or the relevant Spec/Issue instead of copying the decision body. 4. When a decision is accepted, superseded, or deprecated, append an event to project history according to the living-document rules. @@ -38,14 +50,16 @@ Routine implementation details, easily reversible changes, and short-lived exper - The project needs a stable domain-language entry point but has no equivalent document. - Context work uncovers a durable decision that should be handed to `architecture-decision-records`. +Merely consuming established vocabulary during an ordinary bug fix does not require a modeling session or new documentation. + ## When to Use Use this skill when stable domain language needs one evidence-backed home, or when context work reveals a hard-to-reverse decision that belongs in the repository's existing ADR system. ## How It Works -1. Reuse the mapped context or glossary artifact when one exists; create `CONTEXT.md` only when no equivalent source of truth is available. -2. Record precise domain definitions, relationships, confirmed interpretations, and explicitly unconfirmed ambiguities without mixing in implementation or task state. +1. Reuse the mapped context or glossary artifact when one exists; create `CONTEXT.md` only when no equivalent source of truth is available and the user has explicitly approved creating that new artifact. +2. Challenge conflicting language, probe concrete edge cases, and cross-check claims against code and contracts before recording confirmed definitions and relationships. Keep unresolved interpretations explicit without mixing in implementation or task state. 3. Route durable tradeoffs to `architecture-decision-records` and link the resulting ADR instead of copying its rationale into context documents. 4. Keep schedules, blockers, and execution status in the existing issue tracker. @@ -60,6 +74,8 @@ Use this skill when stable domain language needs one evidence-backed home, or wh - Copying current tasks, schedules, full requirements, or implementation details into `CONTEXT.md`. - Creating empty context files or a second ADR system for completeness. - Treating unconfirmed domain interpretations as facts, or copying ADR bodies into maps and logs. +- Renaming distinct business concepts as synonyms, or forcing separate contexts into one universal glossary. +- Treating a glossary update as permission to change implementation, or treating code as proof of the intended business rule. ## Related Skills @@ -70,3 +86,7 @@ Use this skill when stable domain language needs one evidence-backed home, or wh ## Scheduling and Task Boundary Keep tasks, status, blockers, and schedules in the project's existing tracker, such as GitHub Issues or Linear, as the single source of truth. Use local `.scratch/` only when no external tracker exists and the project explicitly adopts it. Do not put schedules in `CONTEXT.md`, ADRs, PROJECT_STATUS, or the history index database. + +## Attribution + +The active terminology-refinement workflow adapts Matt Pocock's MIT-licensed `domain-modeling` skill. See [source and adaptation boundaries](references/source.md). ECC's existing ADR workflow remains the sole decision-record owner. diff --git a/.agents/skills/context-and-decisions/references/source.md b/.agents/skills/context-and-decisions/references/source.md new file mode 100644 index 000000000..70f18267c --- /dev/null +++ b/.agents/skills/context-and-decisions/references/source.md @@ -0,0 +1,5 @@ +# Source and adaptation + +The active terminology-refinement workflow and compact glossary guidance are adapted from [Matt Pocock's domain-modeling skill](https://github.com/mattpocock/skills/tree/c55ee46073ed923f86ce59a5eb3b6d895095d1b7/skills/engineering/domain-modeling), pinned at `c55ee46073ed923f86ce59a5eb3b6d895095d1b7`, under the [MIT license](../LICENSE). + +This is an in-place ECC adaptation, not another skill or an external runtime dependency. It preserves ECC's mapped glossary selection, evidence and authorization boundaries, and handoff to `architecture-decision-records`. It does not import a second ADR template, directory, numbering scheme, or lifecycle. The existing ECC context template is extended rather than replaced with a second glossary format. diff --git a/.agents/skills/context-and-decisions/templates/context.example.md b/.agents/skills/context-and-decisions/templates/context.example.md index 99e268674..df22552b8 100644 --- a/.agents/skills/context-and-decisions/templates/context.example.md +++ b/.agents/skills/context-and-decisions/templates/context.example.md @@ -1,12 +1,14 @@ # CONTEXT.md — Domain Language -> Create only when needed. Do not include implementation, status, scheduling, or decisions. +> Create only after the first term is resolved, no equivalent glossary exists, and the user has explicitly approved creating this new artifact within the authorized documentation scope. General documentation-update permission alone is not creation approval. Reuse an existing glossary and its format instead of creating a duplicate; authorized edits to that existing glossary do not need a new-artifact approval. Omit sections without content. Do not include implementation, status, scheduling, or decision rationale. + +{One or two sentences identifying the business context this vocabulary describes.} ## Core Terms -| Term | Precise definition | Evidence/source | -|---|---|---| -| `{term}` | `{what it means and how it differs from adjacent terms}` | `{business rule, contract, or code location}` | +| Term | Precise definition | Avoid in this context | Evidence/source | +|---|---|---|---| +| `{canonical term}` | `{one or two sentences defining the concept and distinguishing adjacent concepts}` | `{confirmed synonyms to avoid; not names for distinct concepts}` | `{confirmed business source, contract, or code location}` | ## Concept Relationships diff --git a/.agents/skills/docs-governance/SKILL.md b/.agents/skills/docs-governance/SKILL.md index ae00cf8b3..384764872 100644 --- a/.agents/skills/docs-governance/SKILL.md +++ b/.agents/skills/docs-governance/SKILL.md @@ -51,7 +51,30 @@ verification step. Resolve the selected skill directory first, then invoke: python3 /scripts/audit-docs.py --root --scope full ``` -Available scopes are `spine`, `context`, `adr`, `artifacts`, and `full`. +Available scopes are `spine`, `context`, `adr`, `artifacts`, `modules`, and `full`. +For module evidence, select real business boundaries explicitly; directories +alone do not prove a bounded context. Repeat `--module` for several boundaries: + +```bash +python3 /scripts/audit-docs.py --root --scope modules --module src/inventory --module src/billing +``` + +`modules` requires a selected directory. `full` also accepts `--module`; other +scopes reject it rather than silently skipping the requested checks. The module +check finds local `AGENTS.md` and `CONTEXT.md`, or reports the nearest ancestor +and mapped project sources as shared candidates. Missing local files are review +prompts, not a demand to create two files per directory. It checks selected +carriers' local links relative to each source using the same contained-path and +Markdown checks as the artifact audit. It never infers harness loading from +file presence. + +After mechanical checks, inspect the actual module code, callers, contracts and +tests: compare responsibilities and import/call boundaries with documented +rules, and terminology with the canonical context source. Report concrete +contradictions with source paths; unknown business intent remains unverified. +Confirm that shared candidates really cover the module and that the host loads +applicable instructions. Reuse existing contract and ADR owners rather than +copying them into `AGENTS.md`. Passing links is not passing this semantic review. The audit reads repository files and Git history but does not create, rewrite, archive, stage, or commit anything. It reports: diff --git a/.agents/skills/docs-governance/references/artifact-role-contract.md b/.agents/skills/docs-governance/references/artifact-role-contract.md index eafbe98a8..907e25f93 100644 --- a/.agents/skills/docs-governance/references/artifact-role-contract.md +++ b/.agents/skills/docs-governance/references/artifact-role-contract.md @@ -66,6 +66,14 @@ The audit does not determine whether prose is true, whether a requirement is satisfied, whether a task is complete, or whether a change should be merged. Warnings explicitly require semantic review. +Module auditing is opt-in through explicit `--module` directories with scope +`modules` or `full`. Local `AGENTS.md` and `CONTEXT.md` are conventional evidence +locations, not mandatory per-directory artifacts. Ancestor and mapped sources +are shared candidates whose applicability must be confirmed manually; the audit +does not equate a file's existence with instruction loading or business coverage. +Module responsibilities, code/contract boundaries and vocabulary require source +and test evidence after the contained-path and source-relative link checks. + For link checks, any `scheme://` destination is external. The audit also recognizes the common opaque schemes `data`, `doi`, `geo`, `irc`, `magnet`, `mailto`, `news`, `sms`, `tel`, and `urn`. Other colon-shaped destinations are diff --git a/.agents/skills/docs-governance/scripts/audit-docs.py b/.agents/skills/docs-governance/scripts/audit-docs.py index 7d58e52c3..2caec25e7 100644 --- a/.agents/skills/docs-governance/scripts/audit-docs.py +++ b/.agents/skills/docs-governance/scripts/audit-docs.py @@ -16,6 +16,7 @@ from markdown_links import ( normalize_link_target, without_fenced_code, ) +from module_audit import check_modules DEFAULT_ROLES = { "constitution": "CLAUDE.md", @@ -242,10 +243,12 @@ def resolve_target(root: Path, source: Path, target: str) -> Path | None: return resolve_within_root(root, source.parent, target) -def check_markdown_links(root: Path, files: list[Path], report: Report) -> None: +def check_markdown_links( + root: Path, files: list[Path], report: Report, *, skip_templates: bool = True +) -> None: broken: list[str] = [] for source in files: - if "templates" in source.relative_to(root).parts: + if skip_templates and "templates" in source.relative_to(root).parts: continue text = source.read_text(encoding="utf-8") for raw in markdown_link_targets(text): @@ -716,11 +719,19 @@ def main() -> int: parser.add_argument("--root", type=Path, default=Path.cwd()) parser.add_argument( "--scope", - choices=("spine", "context", "adr", "artifacts", "full"), + choices=("spine", "context", "adr", "artifacts", "modules", "full"), default="full", ) + parser.add_argument( + "--module", action="append", default=[], + help="Repository-relative module directory; repeat for several modules", + ) parser.add_argument("--log-threshold", type=int, default=200) args = parser.parse_args() + if args.scope == "modules" and not args.module: + parser.error("--scope modules requires at least one --module directory") + if args.module and args.scope not in ("modules", "full"): + parser.error("--module is supported only with --scope modules or full") root = args.root.resolve() if not root.is_dir(): @@ -728,6 +739,11 @@ def main() -> int: return 2 report = Report() roles = load_roles(root, report) + if args.module: + check_modules( + root, roles, args.module, report, + resolved_within_root, read_utf8, check_markdown_links, + ) if args.scope in ("spine", "full"): check_spine(root, roles, report, args.log_threshold) if args.scope in ("context", "full"): diff --git a/.agents/skills/docs-governance/scripts/markdown_links.py b/.agents/skills/docs-governance/scripts/markdown_links.py index bb4612469..6725c065f 100644 --- a/.agents/skills/docs-governance/scripts/markdown_links.py +++ b/.agents/skills/docs-governance/scripts/markdown_links.py @@ -18,6 +18,9 @@ REFERENCE_DEFINITION_RE = re.compile( REFERENCE_USAGE_RE = re.compile( r"(?[^\]\n]+)\](?:\[(?P