Draft knowledge-artifact document set for a DOMAIN Knowledge Type deliverable. Produces KA-* files per the variable artifact schema. DOMAIN pipeline only.
Draft and iteratively enrich a schema-driven, variable document set for one DOMAIN Knowledge Type folder. This skill is the DOMAIN replacement for the four-documents skill (PROJECT/SOFTWARE), which generates a fixed four-document kit. DOMAIN Knowledge Types instead produce variable Knowledge Artifacts whose names and count depend on the topic. The skill derives those artifacts from decomposition Knowledge Subjects and grounds them in authoritative source material.
Invariant: each decomposition Knowledge Subject maps to exactly one Knowledge Artifact file.
Two-layer model:
SUB-*) = the decomposition-layer topic identity inside the Knowledge TypeKA-*) = the document-layer file materialized from exactly one Knowledge SubjectScoping.md = the Knowledge-Type-level entrypoint that records the SubjectID -> ArtifactID -> Filename mapping; it is not itself a Knowledge SubjectDOMAIN pipeline only. This skill is NOT called by PROJECT or SOFTWARE variants. The DOMAIN pipeline chain is PREPARATION → TASK+domain-documents → WORKING_ITEMS (no semantic-matrix-build, no lens-register, no four-documents). The quality gate is source fidelity (does the extraction faithfully represent the authoritative source?), not semantic enrichment.
TASK (generic shell mode, no profile)Typical dispatcher: ORCHESTRATOR Phase 2.2 (DOMAIN variant) dispatches TASK with TaskSkill: domain-documents.
KTY_PATH — absolute path to one Knowledge Type folderDECOMPOSITION_REF — path to DOMAIN decomposition folder or doc(s)DECOMP_VARIANT — must be DOMAIN (this skill is DOMAIN-only); default DOMAINRUN_PASSES — FULL | P1_P2 | P3_ONLY; default FULLALLOW_OVERWRITE_STATES — which _STATUS.md states permit overwrite; default OPEN, INITIALIZEDUNIT_SCOPE — EXAMPLES_ONLY | ALL_MAPPED; default EXAMPLES_ONLYARTIFACT_NAMING — PREFIXED_TYPED_SLUG | TYPED_SLUG | PREFIXED_SLUG; default PREFIXED_TYPED_SLUGMAX_ARTIFACTS — hard cap on artifact files; default 25SOURCES_ROOT — path to shared source/reference files| Key | Meaning | Default | Allowed values |
|---|---|---|---|
KTY_PATH | Path to one Knowledge Type folder | Required | Absolute directory path |
DECOMPOSITION_REF | Path to DOMAIN decomposition folder or doc(s) | Required | Absolute path |
DECOMP_VARIANT | Variant this skill supports | DOMAIN | DOMAIN only |
RUN_PASSES | Which enrichment passes to run | FULL | FULL, P1_P2, P3_ONLY |
ALLOW_OVERWRITE_STATES | Safe-update gate | OPEN, INITIALIZED | Comma-separated state list |
UNIT_SCOPE | Which handbook units to use as evidence | EXAMPLES_ONLY | EXAMPLES_ONLY, ALL_MAPPED |
ARTIFACT_NAMING | How to name artifact files | PREFIXED_TYPED_SLUG | PREFIXED_TYPED_SLUG, TYPED_SLUG, PREFIXED_SLUG |
MAX_ARTIFACTS | Hard cap on artifact count | 25 | Positive integer |
UNIT_SCOPE values | EXAMPLES_ONLY → use KnowledgeTypes.csv.ExampleUnitIDs; ALL_MAPPED → use all units mapped to this KTY in DomainLedger.csv (best-effort) | — | — |
ARTIFACT_NAMING values | PREFIXED_TYPED_SLUG → KA-01_{Type}__{Slug}.md; TYPED_SLUG → {Type}__{Slug}.md; PREFIXED_SLUG → KA-01_{Slug}.md | — | — |
tools/scaffolding/write_status.sh — update _STATUS.md under safe-update rules only.allowed-tools frontmatter field is intentionally omitted.Disallowed behavior:
_CONTEXT.md, _REFERENCES.md, _MEMORY.md/MEMORY.md, _SEMANTIC.md.Current State is outside ALLOW_OVERWRITE_STATES.Scoping.md in {KTY_PATH} — stable entrypoint with identity, canonical schema, evidence table, artifact plan table, conflict table, source-fidelity logKA-*.md Knowledge Artifact files in {KTY_PATH} (one per Knowledge Subject)_STATUS.md updated (OPEN → INITIALIZED only when Pass 1/2 ran)When drafting or revising Knowledge Artifact content, consult sources in this order of authority:
SourceSpan in the decomposition and/or listed in _REFERENCES.md, located under {SOURCES_ROOT} or local _Sources/_REFERENCES.md (additional cited sources relevant to this Knowledge Type)KnowledgeTypes.csv, HandbookUnits.csv, DomainLedger.csv (scope, structure, evidence pointers)Scoping.md (context only, not authority)When source material and decomposition data disagree, source material is authoritative. Decomposition scopes and routes; source determines what the artifact must say. Record discrepancies in the Conflict Table. Do not treat decomposition summaries, atomic statements, or prior draft wording as if they were the source.
Source slice: the smallest local source region that preserves meaning for a cited claim. Includes the cited heading or section, its opening prose, embedded tables or lists, and the immediate parent heading when it frames scope. Adjacent exception or exclusion material should be included when it qualifies the claim.
{KTY_PATH}/_STATUS.md (if present) to determine Current State.Current State is not in ALLOW_OVERWRITE_STATES:
RUN_STATUS=SKIPPED_PROTECT_HUMAN_WORK + the observed state.RUN_PASSES:
FULL → run Steps 1–7 as written.P1_P2 → run Steps 1–5 and then Step 7 (status update).P3_ONLY → run Step 1 (full reads including source files), Step 6 (source-fidelity verification), and Step 7; do not re-run Pass 1 drafting.DECOMP_VARIANT is not DOMAIN: return RUN_STATUS=UNSUPPORTED_VARIANT. This skill is DOMAIN-only; PROJECT/SOFTWARE use the four-documents skill.Additional preconditions for P3_ONLY:
.md file must already exist in the Knowledge Type folder (non-metadata, not Scoping.md)._REFERENCES.md and/or SourceSpan fields in the decomposition data must be accessible.RUN_STATUS=FAILED_INPUTS (do not modify files).{KTY_PATH}/_CONTEXT.md (best-effort). Extract: KnowledgeType ID, name, parent category, description, decomposition pointer.KnowledgeTypes.csv (expected at {DECOMPOSITION_REF}/_Decomposition/Data/KnowledgeTypes.csv or nearby)HandbookUnits.csv (expected at {DECOMPOSITION_REF}/_Decomposition/Data/HandbookUnits.csv or nearby)DomainLedger.csv (expected at {DECOMPOSITION_REF}/_Decomposition/Data/DomainLedger.csv or nearby)KnowledgeTypeID from _CONTEXT.md._CONTEXT.md is missing/ambiguous, infer KnowledgeTypeID from folder name token KTY-*.RUN_STATUS=FAILED_INPUTS (ambiguous identity) with evidence.CanonicalSchemaKnowledgeSubjects (ordered set driving the artifact plan)ExampleUnitIDsDescription, IntendedUsers, WhenUsedParentCategoryID, ParentCategoryName{KTY_PATH}/_REFERENCES.md (best-effort) to identify accessible reference materials. Do not dereference URLs. If listed references cannot be accessed, record as missing and treat content as TBD.SourceSpan from the KTY row in KnowledgeTypes.csv (format: {filename}:{startLine}-{startLine} -> {filename}:{endLine}-{endLine}).{SOURCES_ROOT} or the path specified in _REFERENCES.md.SourceSpan. If the source file cannot be accessed, return RUN_STATUS=FAILED_INPUTS (no pass should proceed without source access).KnowledgeSubjects for this KTY into an ordered subject list:
Overview (TBD).ExampleUnitIDs into a unit list (accept JSON list, Python list string, or semicolon-delimited; best-effort).UNIT_SCOPE:
EXAMPLES_ONLY → use ExampleUnitIDsALL_MAPPED → use all UnitID values from DomainLedger.csv where KnowledgeTypeID(s) includes this KTY (best-effort)HandbookUnits.csv:
AtomicStatementSourceRefTBD placeholders.CanonicalSchema from the KTY row.checklist → add CHECKLIST_BLOCKtemplate or log or form → add TEMPLATE_BLOCKprocedure or steps → add PROCEDURE_BLOCKglossary or terms → add REFERENCE_BLOCKScoping.md and the Decision_Log section inside Scoping.md.ARTIFACT_NAMING policy:
Slug = filesystem-safe slug from the Knowledge Subject name (letters/numbers/hyphen; collapse whitespace).Type = base archetype (Reference|Guidance|Checklist|Procedure) from CanonicalSchema.TBD.PREFIXED_*.Output: A deterministic artifact plan: ordered list of {ArtifactID, SubjectID, SubjectName, BaseType, AddOns, Filename} plus evidence unit table.
SubjectID is the decomposition-layer identifier.ArtifactID / Filename are the document-layer identifiers derived from that subject.Default schema sections (keep stable):
Base Type (CanonicalSchema) | Default Schema Sections |
|---|---|
| Reference | Identification, Scope, Definitions, Reference Content, Exceptions/Addenda, References |
| Guidance | Purpose, Applicability, Guidance Statements, Rationale, Examples, References |
| Checklist | Purpose, Applicability, Checklist, Evidence/Records, Notes, References |
| Procedure | Purpose, Prerequisites, Steps, Verification, Records, References |
Sections may be added if the artifact spec requires it, but defaults must not be removed.
Artifact-specific add-on blocks (structural only):
CHECKLIST_BLOCK → add a checklist table sectionTEMPLATE_BLOCK → add a template/form fields sectionPROCEDURE_BLOCK → add a step table sectionREFERENCE_BLOCK → add a term/definition table sectionAdd-ons are additive and do not change the base type.
Using the draft plan + evidence set, generate documents in {KTY_PATH}.
Source-grounding rule: When the authoritative source file is accessible, artifact prose MUST be grounded in the relevant source slices — not only in decomposition summaries, atomic statements, or prior draft wording. Decomposition scopes and structures; the source determines what the artifact must say.
Scoping.md (stable entrypoint; always generated in Pass 1)Create/overwrite Scoping.md with:
_CONTEXT.mdCanonicalSchemaSubjectID) and the document layer (ArtifactID, Filename).TBD listConflict Table schema (keep stable):
## Conflict Table (for human ruling)
Columns:
KA-*.md as planned)For each planned artifact, create/overwrite the target file with:
# {ArtifactSpec}KA-## (document layer){Reference|Guidance|Checklist|Procedure}Description, IntendedUsers, WhenUsed)HandbookUnits.csv.AtomicStatement (and SourceRef pointers)_REFERENCES.md (best-effort)TBD when information is missing; do not invent values.Scoping.md Conflict Table with evidence pointers,Source excerpt rule (optional, best-effort):
SourceRef is accessible under the workspace's sources root, a short excerpt may be included.SourceRef) and never fabricate excerpt text if the source cannot be accessed.Purpose: Verify that the generated Scoping.md and Knowledge Artifact files form a coherent, internally consistent document set. This pass reads all generated content; it does not compare against the authoritative source (that is Pass 3).
{KTY_PATH} (Scoping.md + all KA-*.md files).Scoping.md artifact plan table exists as a .md file.TBD over guessing,Scoping.md with pointers to both artifacts.Purpose: Verify and enrich the generated Knowledge Artifacts against the authoritative source document. For DOMAIN Knowledge Types, the source document (e.g., the DBM) is the ground truth — not a semantic lensing register.
Design note: The
four-documentsskill (PROJECT/SOFTWARE) uses semantic enrichment (semantic-matrix-build→lens-register→ Pass 3 lensing).domain-documentsdoes not. Domain Knowledge Types are extracted from a specific authoritative source, so the quality gate is source fidelity: does the extraction faithfully and completely represent the source?
.md file must exist.RUN_STATUS=FAILED_INPUTS.SourceSpan for this KTY.SourceSpan (from the Knowledge Subject Register) or by locating the subject anchor within the KTY source span.For each substantive statement, requirement, design value, or parameter in the source section:
## Source-Fidelity Log section.For each non-TBD, non-ASSUMPTION claim in the generated artifacts:
UNVERIFIED or downgrade to ASSUMPTION.## Source-Fidelity Log with:
After source-fidelity corrections, re-run the Step 5 structural completeness checks (items 1–3) to ensure no artifacts were broken by corrections.
_STATUS.md and identify the current state.RUN_PASSES includes Pass 1 or Pass 2 (i.e., FULL or P1_P2):
OPEN, update: tools/scaffolding/write_status.sh {kty_folder} INITIALIZED TASK+domain-documentsOPEN, do not modify _STATUS.md (no state regression). Report that the status update was skipped.Output: Knowledge Type folder contains Scoping.md and the planned Knowledge Artifact documents updated per pass directive, and _STATUS.md updated only when safe/applicable.
DECOMP_VARIANT != DOMAIN, halt with UNSUPPORTED_VARIANT. PROJECT/SOFTWARE variants use the four-documents skill.KTY_PATH). No cross-Knowledge-Type scanning._STATUS.md state must be within ALLOW_OVERWRITE_STATES (default: OPEN, INITIALIZED) before overwriting any Knowledge Artifact file. Otherwise halt with SKIPPED_PROTECT_HUMAN_WORK._CONTEXT.md, _REFERENCES.md, _MEMORY.md/MEMORY.md, or _SEMANTIC.md.KnowledgeSubjects.KA-* naming convention. Default is KA-01_{Type}__{Slug}.md; configurable via ARTIFACT_NAMING. Stable ordinal prefix when policy includes PREFIXED_*.TBD, inferences are labeled ASSUMPTION. Do not fabricate source excerpts when the source is inaccessible.SourceSpan cannot be accessed, halt with FAILED_INPUTS before drafting._STATUS.md transitions OPEN → INITIALIZED only when Pass 1/2 ran. Never regress state.OPEN → INITIALIZED → IN_PROGRESS; SEMANTIC_READY is not a valid state for DOMAIN Knowledge Types.See QA_CHECKS.md for the full invariant set. Summary:
Scoping.md present with identity, canonical schema, evidence table, artifact plan table, conflict table..md file; every KA-*.md file appears in the plan table.TBD; inferences labeled ASSUMPTION; conflicts recorded in Conflict Table.Source-Fidelity Log with source reread evidence._STATUS.md updated only under safe-update rules.agents/AGENT_ORCHESTRATOR.md — dispatches this skill via TASK during Phase 2.2 (DOMAIN variant)agents/AGENT_DOMAIN_DECOMP.md — DOMAIN decomposition (upstream; produces KnowledgeSubjects)agents/AGENT_PREPARATION.md — creates Knowledge Type folders this skill populatesskills/four-documents/ — PROJECT/SOFTWARE counterpart (fixed 4-doc kit)tools/EXTERNAL_TOOLS.md — DOMAIN pipeline overview.Archive/SEMANTIC_PIPELINE_ARCHITECTURE.md — pipeline architecture context