xdrs-core 0.44.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/.xdrs/_core/adrs/index.md +3 -0
  2. package/.xdrs/_core/adrs/principles/001-xdrs-standards.md +7 -4
  3. package/.xdrs/_core/adrs/principles/002-policy-standards.md +1 -1
  4. package/.xdrs/_core/adrs/principles/003-skill-standards.md +1 -2
  5. package/.xdrs/_core/adrs/principles/004-article-standards.md +1 -2
  6. package/.xdrs/_core/adrs/principles/006-research-standards.md +6 -5
  7. package/.xdrs/_core/adrs/principles/007-plan-standards.md +1 -1
  8. package/.xdrs/_core/adrs/principles/009-presentation-standards.md +2 -1
  9. package/.xdrs/_core/adrs/principles/010-scope-governance.md +64 -16
  10. package/.xdrs/_core/adrs/principles/019-compiled-scope-type.md +117 -0
  11. package/.xdrs/_core/adrs/principles/020-media-and-asset-standards.md +48 -0
  12. package/.xdrs/_core/adrs/principles/articles/.assets/001-xdrs-overview.svg +258 -0
  13. package/.xdrs/_core/adrs/principles/articles/001-xdrs-overview.md +2 -0
  14. package/.xdrs/_core/adrs/principles/skills/.assets/lint-verification.md +12 -0
  15. package/.xdrs/_core/adrs/principles/skills/.assets/meta-policy-compliance.md +12 -0
  16. package/.xdrs/_core/adrs/principles/skills/.assets/prerequisites-gate.md +19 -0
  17. package/.xdrs/_core/adrs/principles/skills/.assets/scope-placement.md +47 -0
  18. package/.xdrs/_core/adrs/principles/skills/.assets/scope-selection.md +25 -0
  19. package/.xdrs/_core/adrs/principles/skills/001-review/SKILL.md +7 -1
  20. package/.xdrs/_core/adrs/principles/skills/002-write-policy/SKILL.md +8 -24
  21. package/.xdrs/_core/adrs/principles/skills/003-write-skill/SKILL.md +8 -19
  22. package/.xdrs/_core/adrs/principles/skills/004-write-article/SKILL.md +6 -16
  23. package/.xdrs/_core/adrs/principles/skills/005-write-research/SKILL.md +7 -18
  24. package/.xdrs/_core/adrs/principles/skills/006-write-plan/SKILL.md +7 -18
  25. package/.xdrs/_core/adrs/principles/skills/007-write-presentation/SKILL.md +4 -15
  26. package/.xdrs/_core/adrs/principles/skills/008-write-xdrs-doc/SKILL.md +1 -8
  27. package/.xdrs/_core/adrs/principles/skills/009-compile-scope/SKILL.md +121 -0
  28. package/README.md +15 -2
  29. package/lib/lint.js +160 -47
  30. package/lib/lint.test.js +659 -41
  31. package/package.json +1 -1
@@ -15,16 +15,10 @@ Guides the creation of a well-structured skill package by following `_core-adr-p
15
15
 
16
16
  ## Instructions
17
17
 
18
- ### Phase 0: Prerequisites Gate — MUST complete before writing
18
+ ### Phase 0: Scope Placement and Prerequisites Gate — MUST complete before writing
19
19
 
20
- Identify the target scope from the user's request; use `_local` if none is specified. Read the scope's `index.md` frontmatter and perform ALL of the following checks. If ANY check fails, output a FAIL result immediately and do not proceed:
21
-
22
- - **Follows scopes:** If the scope declares `follows:` entries (e.g., `follows: myarea-core, shared-standards`), verify that each listed scope directory exists in the workspace AND contains an accessible `index.md` (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing or unreadable, output: `FAIL — Cannot proceed: scope \`[scope-name]\` is listed in \`follows\` but its policies are not present in the workspace. Install it before authoring documents in this scope, as the governance constraints cannot be verified.`
23
- - **Local meta-policies:** Scan the target scope's `[type]/principles/` directories for all files whose filename title starts with `core` (i.e., `NNN-core.md` or `NNN-core-{qualifier}.md`), excluding scope-type definition files. If any are found but cannot be read, output: `FAIL — Cannot proceed: local meta-policy \`[filename]\` exists in scope \`[scope-name]\` but could not be read. Without it, the document cannot be authored in full compliance with the scope's governance.` Zero matches is valid.
24
- - **Scope-type:** Read the scope's `scope-type` from its `index.md`. Normalise the value to a list: split on commas and trim whitespace (`scope-type: typeA, typeB` becomes `[typeA, typeB]`). For **each** type in the list, search the `[type]/principles/` directories of all `core`-type scopes in the workspace for a file whose name ends with `{scope-type}-scope-type.md`. If the scope declares any `scope-type` elements but no matching file is found for ANY of them, output: `FAIL — Cannot proceed: scope \`[scope-name]\` declares \`scope-type: [scope-type]\` but no \`[scope-type]-scope-type.md\` policy exists in any \`core\`-type scope in the workspace. The scope is READ-ONLY; install the scope-type governance before authoring documents in this scope.`
25
- - **Rationale:** Authoring a document without all mandatory governance layers loaded risks producing content that silently violates scope policies. Every governance layer MUST be present before writing begins.
26
-
27
- Once all prerequisites pass, load ALL scope-type governance (see `_core-adr-policy-010` rule 22): for each declared type, resolve its full ancestor chain (primary, companions alphabetically, parent chain). Deduplicate keeping first occurrence. Then run conflict detection using the shared module at `.xdrs/_core/adrs/principles/skills/.assets/conflict-detection.md` across all loaded governance layers. Halt if undeclared structural conflicts are found (see `_core-adr-policy-010` rules 24 and 26).
20
+ 1. Run the scope placement analysis from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/scope-placement.md` to determine and confirm the target scope.
21
+ 2. Once the scope is confirmed, run the prerequisites gate from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/prerequisites-gate.md`. Substitute `[DOCUMENT TYPE]` with `skill`.
28
22
 
29
23
  ### Phase 1: Understand the Skill Goal
30
24
 
@@ -46,10 +40,9 @@ Quick test:
46
40
  - "How to evaluate or decide on architecture?" → ADR
47
41
  - "How to execute a business process or policy?" → BDR
48
42
 
49
- **Scope** — use `_local` unless the user explicitly names another scope.
50
- - If the user names a scope other than `_local`, check the workspace root `.filedist.lock` file. If any file under `.xdrs/[scope]/` appears in `.filedist.lock`, the scope is external and new documents MUST NOT be created there. Inform the user and ask them to choose a non-external scope.
43
+ **Scope** — confirmed in Phase 0. Follow the external-scope validation in `.xdrs/_core/adrs/principles/skills/.assets/scope-selection.md`.
51
44
 
52
- **Subject** — MUST read `_core-adr-policy-016` ([016-policy-subjects.md](../../016-policy-subjects.md)) in full before choosing. That document defines all allowed subjects per type with full descriptions, examples, and disambiguation tiebreakers. Do not rely on summaries or prior knowledge of the subject list — always read the policy and select the most specific subject that matches the skill's activity domain.
45
+ **Subject** — follow the subject selection guidance in `.xdrs/_core/adrs/principles/skills/.assets/scope-selection.md`.
53
46
 
54
47
  **Skill number** — scan `.xdrs/[scope]/[type]/[subject]/skills/` for the highest existing number and increment by 1. Never reuse numbers from deleted skills.
55
48
 
@@ -106,7 +99,7 @@ Rules:
106
99
  - Do not duplicate content from referenced Policies — link instead.
107
100
  - Do not present the skill itself as policy; mandatory behavior must come from referenced Policies or other policy artifacts.
108
101
  - When the skill depends on Policies, make the activation logic and instructions consistent with the Policy metadata so the skill does not operationalize inactive or out-of-scope decisions.
109
- - Prefer plain Markdown, tables, Mermaid.js (sequence, state, activity, entity diagrams), or ASCII art for simple structure, flow, layout, or relationship indications.
102
+ - For diagrams and non-Markdown assets, follow `_core-adr-policy-020`: prefer plain Markdown tables/lists first, then ASCII art for very simple cases, then Mermaid.js (sequence, state, activity, entity diagrams) for complex ones, then draw.io when Mermaid is insufficient — save as Editable Vector (File → Save As → Editable Vector) and store as `.svg` in the sibling `.assets/` folder.
110
103
  - If `SKILL.md` genuinely needs local images or supporting files, store them in `.xdrs/[scope]/[type]/[subject]/skills/[number]-[skill-name]/.assets/` and link them using a same-folder relative path (e.g., `.assets/image.png`).
111
104
  - Use relative paths for all links; never use absolute paths starting with `/`.
112
105
  - No emojis. Lowercase filenames. Target under 6500 words.
@@ -120,7 +113,7 @@ Before writing files, verify:
120
113
  3. **Length**: Under 6500 words? Trim verbose explanations.
121
114
  4. **Duplication**: Does this overlap an existing skill? If yes, revise.
122
115
  5. **References**: Are all related XDRs and skills linked, including the cases where the skill operationalizes multiple XDRs?
123
- 6. **Meta-policy compliance**: Check the target scope's `index.md` for a `follows` frontmatter field. `_core` Policies always apply to all scopes. If `follows` lists additional core scope names, verify that each listed scope directory exists in the workspace (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing, STOP immediately and tell the user: "Scope `[scope-name]` is listed in `follows` but not found in the workspace. Install it before proceeding." Once all `follows` scopes are confirmed present, verify the skill's activation criteria, phase structure, and content satisfy any requirements from those Policies. Last-listed scope in `follows` takes precedence.
116
+ 6. **Meta-policy compliance**: Run the shared module at `.xdrs/_core/adrs/principles/skills/.assets/meta-policy-compliance.md`. Substitute `[DOCUMENT]` with `skill`.
124
117
 
125
118
  If any check fails, revise before continuing.
126
119
 
@@ -136,11 +129,7 @@ If any check fails, revise before continuing.
136
129
 
137
130
  ### Phase 7: Verify with Lint
138
131
 
139
- 1. Run the CLI lint utility from the repository root:
140
- ```
141
- npx -y xdrs-core@latest lint
142
- ```
143
- 2. Fix all reported errors before considering the task complete.
132
+ Follow the lint verification steps in `.xdrs/_core/adrs/principles/skills/.assets/lint-verification.md`.
144
133
 
145
134
  ### Constraints
146
135
 
@@ -26,14 +26,9 @@ Optional questions (ask only when genuinely unclear):
26
26
  - **Type**: Should the article primarily synthesize ADRs, BDRs, or EDRs? Ask only when the topic spans multiple types.
27
27
  - **Existing XDRS elements**: Are there specific Policies or Skills you want the article to reference or synthesize?
28
28
 
29
- **Prerequisites gate** — once the scope is confirmed from the answers above, perform ALL of the following checks before proceeding. If ANY check fails, output a FAIL result immediately and do not continue:
29
+ **Scope placement** — once the scope is known from the answers above, run the scope placement analysis from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/scope-placement.md` to confirm it is the right placement for this content.
30
30
 
31
- - **Follows scopes:** If the scope declares `follows:` entries (e.g., `follows: myarea-core, shared-standards`), verify that each listed scope directory exists in the workspace AND contains an accessible `index.md` (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing or unreadable, output: `FAIL — Cannot proceed: scope \`[scope-name]\` is listed in \`follows\` but its policies are not present in the workspace. Install it before authoring documents in this scope, as the governance constraints cannot be verified.`
32
- - **Local meta-policies:** Scan the target scope's `[type]/principles/` directories for all files whose filename title starts with `core` (i.e., `NNN-core.md` or `NNN-core-{qualifier}.md`), excluding scope-type definition files. If any are found but cannot be read, output: `FAIL — Cannot proceed: local meta-policy \`[filename]\` exists in scope \`[scope-name]\` but could not be read. Without it, the document cannot be authored in full compliance with the scope's governance.` Zero matches is valid.
33
- - **Scope-type:** Read the scope's `scope-type` from its `index.md`. Normalise the value to a list: split on commas and trim whitespace (`scope-type: typeA, typeB` becomes `[typeA, typeB]`). For **each** type in the list, search the `[type]/principles/` directories of all `core`-type scopes in the workspace for a file whose name ends with `{scope-type}-scope-type.md`. If the scope declares any `scope-type` elements but no matching file is found for ANY of them, output: `FAIL — Cannot proceed: scope \`[scope-name]\` declares \`scope-type: [scope-type]\` but no \`[scope-type]-scope-type.md\` policy exists in any \`core\`-type scope in the workspace. The scope is READ-ONLY; install the scope-type governance before authoring documents in this scope.`
34
- - **Rationale:** Authoring a document without all mandatory governance layers loaded risks producing content that silently violates scope policies. Every governance layer MUST be present before writing begins.
35
-
36
- Once all prerequisites pass, load ALL scope-type governance (see `_core-adr-policy-010` rule 22): for each declared type, resolve its full ancestor chain (primary, companions alphabetically, parent chain). Deduplicate keeping first occurrence. Then run conflict detection using the shared module at `.xdrs/_core/adrs/principles/skills/.assets/conflict-detection.md` across all loaded governance layers. Halt if undeclared structural conflicts are found (see `_core-adr-policy-010` rules 24 and 26).
31
+ **Prerequisites gate** — once scope is confirmed, run the prerequisites gate from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/prerequisites-gate.md`. Substitute `[DOCUMENT TYPE]` with `article`.
37
32
 
38
33
  Do NOT proceed to Phase 1 until you have at minimum a clear **topic** and **audience**.
39
34
 
@@ -49,8 +44,7 @@ Do NOT proceed to Phase 1 until you have at minimum a clear **topic** and **audi
49
44
 
50
45
  Consult `001-xdrs-standards` while making each choice in this phase. The summaries below are orientation only; when any detail is unclear, the standard decides.
51
46
 
52
- **Scope** — use `_local` unless the user explicitly names another scope.
53
- - If the user names a scope other than `_local`, check the workspace root `.filedist.lock` file. If any file under `.xdrs/[scope]/` appears in `.filedist.lock`, the scope is external and new documents MUST NOT be created there. Inform the user and ask them to choose a non-external scope.
47
+ **Scope** — confirmed in Phase 0. Follow the external-scope validation in `.xdrs/_core/adrs/principles/skills/.assets/scope-selection.md`.
54
48
 
55
49
  **Type** — match the type of the XDRS elements the article primarily synthesizes (`adrs`, `bdrs`, or `edrs`).
56
50
  If the topic spans multiple types, use `adrs`. Use the same rules as `002-write-policy` Phase 2:
@@ -104,7 +98,7 @@ Rules to apply while drafting:
104
98
  - Every factual claim must link back to the authoritative Policy or Skill.
105
99
  - If the article advises readers what to do, clearly separate active/applicable Policies from background, historical, or out-of-scope ones.
106
100
  - Never reproduce decision text verbatim; summarize and link.
107
- - Prefer plain Markdown, tables, Mermaid.js (sequence, state, activity, entity diagrams), or ASCII art for simple structure, flow, layout, or relationship indications.
101
+ - For diagrams and non-Markdown assets, follow `_core-adr-policy-020`: prefer plain Markdown tables/lists first, then ASCII art for very simple cases, then Mermaid.js (sequence, state, activity, entity diagrams) for complex ones, then draw.io when Mermaid is insufficient — save as Editable Vector (File → Save As → Editable Vector) and store as `.svg` in the sibling `.assets/` folder.
108
102
  - If the article genuinely needs local images or supporting files, store them in `.xdrs/[scope]/[type]/[subject]/articles/.assets/` and link them using a same-folder relative path (e.g., `.assets/image.png`).
109
103
  - Use relative paths for all links; never use absolute paths starting with `/`.
110
104
  - Target under 1950 words for best reader engagement (SHOULD). If content grows beyond that, break it into separate chapter articles rather than expanding a single file. The hard limit is 8000 words.
@@ -118,15 +112,11 @@ Rules to apply while drafting:
118
112
  3. Add back-references in the Policies, Research documents, and Skills that the article synthesizes, under their `## References`
119
113
  section.
120
114
  4. Evaluate whether the scope index at `.xdrs/[scope]/index.md` should be updated to reflect the new article. If the scope index does not exist, create it following article standards and the scope index rules in `_core-adr-policy-001`.
121
- 5. **Meta-policy compliance**: Check the target scope's `index.md` for a `follows` frontmatter field. `_core` Policies always apply to all scopes. If `follows` lists additional core scope names, verify that each listed scope directory exists in the workspace (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing, STOP immediately and tell the user: "Scope `[scope-name]` is listed in `follows` but not found in the workspace. Install it before proceeding." Once all `follows` scopes are confirmed present, verify the article satisfies any content or structural requirements from those Policies. Last-listed scope in `follows` takes precedence.
115
+ 5. **Meta-policy compliance**: Run the shared module at `.xdrs/_core/adrs/principles/skills/.assets/meta-policy-compliance.md`. Substitute `[DOCUMENT]` with `article`.
122
116
 
123
117
  ### Phase 7: Verify with Lint
124
118
 
125
- 1. Run the CLI lint utility from the repository root:
126
- ```
127
- npx -y xdrs-core@latest lint
128
- ```
129
- 2. Fix all reported errors before considering the task complete.
119
+ Follow the lint verification steps in `.xdrs/_core/adrs/principles/skills/.assets/lint-verification.md`.
130
120
 
131
121
  ## Examples
132
122
 
@@ -17,16 +17,10 @@ This skill is interactive by design. Ask clarifying questions to the user at eac
17
17
 
18
18
  ## Instructions
19
19
 
20
- ### Phase 0: Prerequisites Gate — MUST complete before writing
20
+ ### Phase 0: Scope Placement and Prerequisites Gate — MUST complete before writing
21
21
 
22
- Identify the target scope from the user's request; use `_local` if none is specified. Read the scope's `index.md` frontmatter and perform ALL of the following checks. If ANY check fails, output a FAIL result immediately and do not proceed:
23
-
24
- - **Follows scopes:** If the scope declares `follows:` entries (e.g., `follows: myarea-core, shared-standards`), verify that each listed scope directory exists in the workspace AND contains an accessible `index.md` (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing or unreadable, output: `FAIL — Cannot proceed: scope \`[scope-name]\` is listed in \`follows\` but its policies are not present in the workspace. Install it before authoring documents in this scope, as the governance constraints cannot be verified.`
25
- - **Local meta-policies:** Scan the target scope's `[type]/principles/` directories for all files whose filename title starts with `core` (i.e., `NNN-core.md` or `NNN-core-{qualifier}.md`), excluding scope-type definition files. If any are found but cannot be read, output: `FAIL — Cannot proceed: local meta-policy \`[filename]\` exists in scope \`[scope-name]\` but could not be read. Without it, the document cannot be authored in full compliance with the scope's governance.` Zero matches is valid.
26
- - **Scope-type:** Read the scope's `scope-type` from its `index.md`. Normalise the value to a list: split on commas and trim whitespace (`scope-type: typeA, typeB` becomes `[typeA, typeB]`). For **each** type in the list, search the `[type]/principles/` directories of all `core`-type scopes in the workspace for a file whose name ends with `{scope-type}-scope-type.md`. If the scope declares any `scope-type` elements but no matching file is found for ANY of them, output: `FAIL — Cannot proceed: scope \`[scope-name]\` declares \`scope-type: [scope-type]\` but no \`[scope-type]-scope-type.md\` policy exists in any \`core\`-type scope in the workspace. The scope is READ-ONLY; install the scope-type governance before authoring documents in this scope.`
27
- - **Rationale:** Authoring a document without all mandatory governance layers loaded risks producing content that silently violates scope policies. Every governance layer MUST be present before writing begins.
28
-
29
- Once all prerequisites pass, load ALL scope-type governance (see `_core-adr-policy-010` rule 22): for each declared type, resolve its full ancestor chain (primary, companions alphabetically, parent chain). Deduplicate keeping first occurrence. Then run conflict detection using the shared module at `.xdrs/_core/adrs/principles/skills/.assets/conflict-detection.md` across all loaded governance layers. Halt if undeclared structural conflicts are found (see `_core-adr-policy-010` rules 24 and 26).
22
+ 1. Run the scope placement analysis from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/scope-placement.md` to determine and confirm the target scope.
23
+ 2. Once the scope is confirmed, run the prerequisites gate from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/prerequisites-gate.md`. Substitute `[DOCUMENT TYPE]` with `research`.
30
24
 
31
25
  ### Phase 1: Understand the Research Goal
32
26
 
@@ -46,8 +40,7 @@ If the answers from Phase 1 leave scope, type, or subject ambiguous, use `vscode
46
40
 
47
41
  Consult `001-xdrs-standards` while making each choice in this phase. The summaries below are orientation only; when any detail matters, the standard decides.
48
42
 
49
- **Scope** — use `_local` unless the user explicitly names another scope.
50
- - If the user names a scope other than `_local`, check the workspace root `.filedist.lock` file. If any file under `.xdrs/[scope]/` appears in `.filedist.lock`, the scope is external and new documents MUST NOT be created there. Inform the user and ask them to choose a non-external scope.
43
+ **Scope** — confirmed in Phase 0. Follow the external-scope validation in `.xdrs/_core/adrs/principles/skills/.assets/scope-selection.md`.
51
44
 
52
45
  **Type** — match the type of decision this research supports (`adrs`, `bdrs`, or `edrs`). Use the same rules as `002-write-policy` Phase 2:
53
46
  - **BDR**: business process, product policy, strategic rule, operational procedure
@@ -146,7 +139,7 @@ Rules:
146
139
  - Keep traceability to related Policies, skills, articles, discussions, and external sources primarily in `## References`.
147
140
  - Use good-enough evidence. Experienced professional judgment is allowed, but the conclusions still need support that other colleagues can inspect and learn from.
148
141
  - Ensure the methods and test conditions are reproducible enough for an experienced professional to rerun or evolve the critical parts later.
149
- - Prefer plain Markdown, tables, Mermaid.js (sequence, state, activity, entity diagrams), bullet points, or ASCII art for simple explanations and comparisons, especially in the introduction and results.
142
+ - For diagrams and non-Markdown assets, follow `_core-adr-policy-020`: prefer plain Markdown tables/lists and bullet points first, then ASCII art for very simple cases, then Mermaid.js (sequence, state, activity, entity diagrams) for complex ones, then draw.io when Mermaid is insufficient — save as Editable Vector (File → Save As → Editable Vector) and store as `.svg` in the sibling `.assets/` folder.
150
143
  - If the research genuinely needs local images or supporting files, store them in `.xdrs/[scope]/[type]/[subject]/researches/.assets/` and link them using a same-folder relative path (e.g., `.assets/image.png`).
151
144
  - Use relative paths for all links; never use absolute paths starting with `/`.
152
145
  - Keep section word limits within the standard and keep the document under 5000 words total unless the introduction explicitly states that a very detailed analysis is required.
@@ -248,7 +241,7 @@ Before writing files, verify:
248
241
  5. **Standalone focus**: Does the text read as a technical paper rather than commentary about future ADRs, repository process, or artifact management?
249
242
  6. **Ratio fit**: Does the document stay within section word limits and pass the Python ratio check, or does the introduction explicitly justify the deviation?
250
243
  7. **References**: Are all related Policies, research docs, skills, articles, and external sources linked when relevant?
251
- 8. **Meta-policy compliance**: Check the target scope's `index.md` for a `follows` frontmatter field. `_core` Policies always apply to all scopes. If `follows` lists additional core scope names, verify that each listed scope directory exists in the workspace (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing, STOP immediately and tell the user: "Scope `[scope-name]` is listed in `follows` but not found in the workspace. Install it before proceeding." Once all `follows` scopes are confirmed present, verify the research satisfies any structural or content requirements from those Policies. Last-listed scope in `follows` takes precedence.
244
+ 8. **Meta-policy compliance**: Run the shared module at `.xdrs/_core/adrs/principles/skills/.assets/meta-policy-compliance.md`. Substitute `[DOCUMENT]` with `research`.
252
245
 
253
246
  If any check fails, revise before continuing.
254
247
 
@@ -261,11 +254,7 @@ If any check fails, revise before continuing.
261
254
 
262
255
  ### Phase 12: Verify with Lint
263
256
 
264
- 1. Run the CLI lint utility from the repository root:
265
- ```
266
- npx -y xdrs-core@latest lint
267
- ```
268
- 2. Fix all reported errors before considering the task complete.
257
+ Follow the lint verification steps in `.xdrs/_core/adrs/principles/skills/.assets/lint-verification.md`.
269
258
 
270
259
  ## Examples
271
260
 
@@ -15,16 +15,10 @@ Guides the creation of a well-structured plan document by following `_core-adr-p
15
15
 
16
16
  ## Instructions
17
17
 
18
- ### Phase 0: Prerequisites Gate — MUST complete before writing
18
+ ### Phase 0: Scope Placement and Prerequisites Gate — MUST complete before writing
19
19
 
20
- Identify the target scope from the user's request; use `_local` if none is specified. Read the scope's `index.md` frontmatter and perform ALL of the following checks. If ANY check fails, output a FAIL result immediately and do not proceed:
21
-
22
- - **Follows scopes:** If the scope declares `follows:` entries (e.g., `follows: myarea-core, shared-standards`), verify that each listed scope directory exists in the workspace AND contains an accessible `index.md` (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing or unreadable, output: `FAIL — Cannot proceed: scope \`[scope-name]\` is listed in \`follows\` but its policies are not present in the workspace. Install it before authoring documents in this scope, as the governance constraints cannot be verified.`
23
- - **Local meta-policies:** Scan the target scope's `[type]/principles/` directories for all files whose filename title starts with `core` (i.e., `NNN-core.md` or `NNN-core-{qualifier}.md`), excluding scope-type definition files. If any are found but cannot be read, output: `FAIL — Cannot proceed: local meta-policy \`[filename]\` exists in scope \`[scope-name]\` but could not be read. Without it, the document cannot be authored in full compliance with the scope's governance.` Zero matches is valid.
24
- - **Scope-type:** Read the scope's `scope-type` from its `index.md`. Normalise the value to a list: split on commas and trim whitespace (`scope-type: typeA, typeB` becomes `[typeA, typeB]`). For **each** type in the list, search the `[type]/principles/` directories of all `core`-type scopes in the workspace for a file whose name ends with `{scope-type}-scope-type.md`. If the scope declares any `scope-type` elements but no matching file is found for ANY of them, output: `FAIL — Cannot proceed: scope \`[scope-name]\` declares \`scope-type: [scope-type]\` but no \`[scope-type]-scope-type.md\` policy exists in any \`core\`-type scope in the workspace. The scope is READ-ONLY; install the scope-type governance before authoring documents in this scope.`
25
- - **Rationale:** Authoring a document without all mandatory governance layers loaded risks producing content that silently violates scope policies. Every governance layer MUST be present before writing begins.
26
-
27
- Once all prerequisites pass, load ALL scope-type governance (see `_core-adr-policy-010` rule 22): for each declared type, resolve its full ancestor chain (primary, companions alphabetically, parent chain). Deduplicate keeping first occurrence. Then run conflict detection using the shared module at `.xdrs/_core/adrs/principles/skills/.assets/conflict-detection.md` across all loaded governance layers. Halt if undeclared structural conflicts are found (see `_core-adr-policy-010` rules 24 and 26).
20
+ 1. Run the scope placement analysis from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/scope-placement.md` to determine and confirm the target scope.
21
+ 2. Once the scope is confirmed, run the prerequisites gate from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/prerequisites-gate.md`. Substitute `[DOCUMENT TYPE]` with `plan`.
28
22
 
29
23
  ### Phase 1: Understand the Plan Goal
30
24
 
@@ -43,8 +37,7 @@ Once all prerequisites pass, load ALL scope-type governance (see `_core-adr-poli
43
37
 
44
38
  Consult `001-xdrs-standards` while making each choice in this phase. The summaries below are orientation only; when any detail is unclear, the standard decides.
45
39
 
46
- **Scope** — use `_local` unless the user explicitly names another scope.
47
- - If the user names a scope other than `_local`, check the workspace root `.filedist.lock` file. If any file under `.xdrs/[scope]/` appears in `.filedist.lock`, the scope is external and new documents MUST NOT be created there. Inform the user and ask them to choose a non-external scope.
40
+ **Scope** — confirmed in Phase 0. Follow the external-scope validation in `.xdrs/_core/adrs/principles/skills/.assets/scope-selection.md`.
48
41
 
49
42
  **Type** — match the type of the Policies the plan primarily implements or relates to (`adrs`, `bdrs`, or `edrs`).
50
43
  - **BDR**: business process, product policy, strategic rule, operational procedure
@@ -125,7 +118,7 @@ Rules to apply while drafting:
125
118
  - The Expected end date must be in ISO format (YYYY-MM-DD), placed inside the `## Proposed Solution` section, and should not be more than 2 years from the plan creation date.
126
119
  - If the plan scope is too large for 2 years, break it into multiple plans.
127
120
  - Remember that this plan must be deleted after full implementation. Write it with that ephemeral nature in mind.
128
- - Prefer plain Markdown, tables, or ASCII art for structure and flow.
121
+ - For diagrams and non-Markdown assets, follow `_core-adr-policy-020`: prefer plain Markdown tables/lists first, then ASCII art for very simple cases, then Mermaid.js for complex diagrams, then draw.io when Mermaid is insufficient — save as Editable Vector (File → Save As → Editable Vector) and store as `.svg` in the sibling `.assets/` folder.
129
122
  - If the plan genuinely needs local images or supporting files, store them in `.xdrs/[scope]/[type]/[subject]/plans/.assets/` and link them using a same-folder relative path (e.g., `.assets/image.png`).
130
123
  - Use relative paths for all links; never use absolute paths starting with `/`.
131
124
  - Use lowercase file names. Never use emojis.
@@ -136,15 +129,11 @@ Rules to apply while drafting:
136
129
  2. Add a link to the plan in the canonical index for that scope+type (`.xdrs/[scope]/[type]/index.md`).
137
130
  3. Add back-references in the Policies, Research documents, and Skills that the plan relates to, under their `## References` section.
138
131
  4. Evaluate whether the scope index at `.xdrs/[scope]/index.md` should be updated to reflect the new plan. If the scope index does not exist, create it following article standards and the scope index rules in `_core-adr-policy-001`.
139
- 5. **Meta-policy compliance**: Check the target scope's `index.md` for a `follows` frontmatter field. `_core` Policies always apply to all scopes. If `follows` lists additional core scope names, verify that each listed scope directory exists in the workspace (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing, STOP immediately and tell the user: "Scope `[scope-name]` is listed in `follows` but not found in the workspace. Install it before proceeding." Once all `follows` scopes are confirmed present, verify the plan satisfies any structural or content requirements from those Policies. Last-listed scope in `follows` takes precedence.
132
+ 5. **Meta-policy compliance**: Run the shared module at `.xdrs/_core/adrs/principles/skills/.assets/meta-policy-compliance.md`. Substitute `[DOCUMENT]` with `plan`.
140
133
 
141
134
  ### Phase 7: Verify with Lint
142
135
 
143
- 1. Run the CLI lint utility from the repository root:
144
- ```
145
- npx -y xdrs-core@latest lint
146
- ```
147
- 2. Fix all reported errors before considering the task complete.
136
+ Follow the lint verification steps in `.xdrs/_core/adrs/principles/skills/.assets/lint-verification.md`.
148
137
 
149
138
  ## Examples
150
139
 
@@ -16,14 +16,7 @@ Guides the creation of a Marp Markdown slide presentation that supports an exist
16
16
 
17
17
  ### Phase 0: Prerequisites Gate — MUST complete before writing
18
18
 
19
- Identify the target scope from the parent document's path or the user's request; use `_local` if none is specified. Read the scope's `index.md` frontmatter and perform ALL of the following checks. If ANY check fails, output a FAIL result immediately and do not proceed:
20
-
21
- - **Follows scopes:** If the scope declares `follows:` entries (e.g., `follows: myarea-core, shared-standards`), verify that each listed scope directory exists in the workspace AND contains an accessible `index.md` (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing or unreadable, output: `FAIL — Cannot proceed: scope \`[scope-name]\` is listed in \`follows\` but its policies are not present in the workspace. Install it before authoring documents in this scope, as the governance constraints cannot be verified.`
22
- - **Local meta-policies:** Scan the target scope's `[type]/principles/` directories for all files whose filename title starts with `core` (i.e., `NNN-core.md` or `NNN-core-{qualifier}.md`), excluding scope-type definition files. If any are found but cannot be read, output: `FAIL — Cannot proceed: local meta-policy \`[filename]\` exists in scope \`[scope-name]\` but could not be read. Without it, the document cannot be authored in full compliance with the scope's governance.` Zero matches is valid.
23
- - **Scope-type:** Read the scope's `scope-type` from its `index.md`. Normalise the value to a list: split on commas and trim whitespace (`scope-type: typeA, typeB` becomes `[typeA, typeB]`). For **each** type in the list, search the `[type]/principles/` directories of all `core`-type scopes in the workspace for a file whose name ends with `{scope-type}-scope-type.md`. If the scope declares any `scope-type` elements but no matching file is found for ANY of them, output: `FAIL — Cannot proceed: scope \`[scope-name]\` declares \`scope-type: [scope-type]\` but no \`[scope-type]-scope-type.md\` policy exists in any \`core\`-type scope in the workspace. The scope is READ-ONLY; install the scope-type governance before authoring documents in this scope.`
24
- - **Rationale:** Authoring a document without all mandatory governance layers loaded risks producing content that silently violates scope policies. Every governance layer MUST be present before writing begins.
25
-
26
- Once all prerequisites pass, load ALL scope-type governance (see `_core-adr-policy-010` rule 22): for each declared type, resolve its full ancestor chain (primary, companions alphabetically, parent chain). Deduplicate keeping first occurrence. Then run conflict detection using the shared module at `.xdrs/_core/adrs/principles/skills/.assets/conflict-detection.md` across all loaded governance layers. Halt if undeclared structural conflicts are found (see `_core-adr-policy-010` rules 24 and 26).
19
+ Identify the target scope from the parent document's path or the user's request; use `_local` if none is specified. Then run the prerequisites gate from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/prerequisites-gate.md`. Substitute `[DOCUMENT TYPE]` with `presentation`.
27
20
 
28
21
  ### Phase 1: Identify the Parent Document
29
22
 
@@ -52,10 +45,10 @@ Once all prerequisites pass, load ALL scope-type governance (see `_core-adr-poli
52
45
  - **Solution/Decision**: what was decided and why
53
46
  - **Actions/Next Steps**: what happens now, who is responsible
54
47
  3. For each slide, identify the best format:
55
- - Mermaid diagrams for flows, relationships, architecture
48
+ - Mermaid diagrams for flows, relationships, architecture; draw.io `.svg` files saved as Editable Vector (File → Save As → Editable Vector, stored in `.assets/`) when Mermaid is not sufficient
49
+ - ASCII art for very simple spatial layouts where Markdown is insufficient (see `_core-adr-policy-020`)
56
50
  - Short bullet points for key decisions and trade-offs
57
51
  - Tables for comparisons, options, criteria
58
- - ASCII art for simple layouts or structures
59
52
  - Key short statements for emphasis
60
53
  - Longer text only when exact wording must be evaluated (policies, controls)
61
54
  4. Keep the total under 30 slides. If more content is needed, plan separate slide sets.
@@ -135,11 +128,7 @@ Rules:
135
128
 
136
129
  ### Phase 8: Verify with Lint
137
130
 
138
- 1. Run the CLI lint utility from the repository root:
139
- ```
140
- npx -y xdrs-core@latest lint
141
- ```
142
- 2. Fix all reported errors before considering the task complete.
131
+ Follow the lint verification steps in `.xdrs/_core/adrs/principles/skills/.assets/lint-verification.md`.
143
132
 
144
133
  ### Constraints
145
134
 
@@ -28,14 +28,7 @@ Routes the request to the appropriate XDRS authoring skill based on the type of
28
28
 
29
29
  ### Phase 1.5: Prerequisites Gate — MUST complete before writing
30
30
 
31
- For the target scope where the document will be created, read its `index.md` frontmatter and perform ALL of the following checks. If ANY check fails, output a FAIL result immediately and do not proceed:
32
-
33
- - **Follows scopes:** If the scope declares `follows:` entries (e.g., `follows: myarea-core, shared-standards`), verify that each listed scope directory exists in the workspace AND contains an accessible `index.md` (e.g., `.xdrs/[scope-name]/index.md`). If any listed scope is missing or unreadable, output: `FAIL — Cannot proceed: scope \`[scope-name]\` is listed in \`follows\` but its policies are not present in the workspace. Install it before authoring documents in this scope, as the governance constraints cannot be verified.`
34
- - **Local meta-policies:** Scan the target scope's `[type]/principles/` directories for all files whose filename title starts with `core` (i.e., `NNN-core.md` or `NNN-core-{qualifier}.md`), excluding scope-type definition files. If any are found but cannot be read, output: `FAIL — Cannot proceed: local meta-policy \`[filename]\` exists in scope \`[scope-name]\` but could not be read. Without it, the document cannot be authored in full compliance with the scope's governance.` Zero matches is valid. When routing to the policy skill, apply all found local meta-policies as mandatory conventions.
35
- - **Scope-type:** Read the scope's `scope-type` from its `index.md`. Normalise the value to a list: split on commas and trim whitespace (`scope-type: typeA, typeB` becomes `[typeA, typeB]`). For **each** type in the list, search the `[type]/principles/` directories of all `core`-type scopes in the workspace for a file whose name ends with `{scope-type}-scope-type.md`. If the scope declares any `scope-type` elements but no matching file is found for ANY of them, output: `FAIL — Cannot proceed: scope \`[scope-name]\` declares \`scope-type: [scope-type]\` but no \`[scope-type]-scope-type.md\` policy exists in any \`core\`-type scope in the workspace. The scope is READ-ONLY; install the scope-type governance before authoring documents in this scope.`
36
- - **Rationale:** Authoring a document without all mandatory governance layers loaded risks producing content that silently violates scope policies. Every governance layer MUST be present before writing begins.
37
-
38
- Once all prerequisites pass, load ALL scope-type governance (see `_core-adr-policy-010` rule 22): for each declared type, resolve its full ancestor chain (primary, companions alphabetically, parent chain). Deduplicate keeping first occurrence. Then run conflict detection using the shared module at `.xdrs/_core/adrs/principles/skills/.assets/conflict-detection.md` across all loaded governance layers. Halt if undeclared structural conflicts are found (see `_core-adr-policy-010` rules 24 and 26).
31
+ For the target scope where the document will be created, run the prerequisites gate from the shared module at `.xdrs/_core/adrs/principles/skills/.assets/prerequisites-gate.md`. Substitute `[DOCUMENT TYPE]` with `document`. When routing to the policy skill, apply all local meta-policies found during the gate as mandatory conventions.
39
32
 
40
33
  ### Phase 2: Load and Follow Target Skill
41
34
 
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: 009-compile-scope
3
+ description: >
4
+ Compiles or updates any scope declaring `scope-type: compiled` from its configured external sources. Reads compilation meta-policies to discover sources, fetches content (git clone, local copy, or web scrape), plans policy changes, migrates policies one at a time with structured format, `## Source` sections, and `**compilation-note:**` markers, then runs lint and review. Documents source inconsistencies without inventing fixes. Activate when the user asks to compile, update, sync, refresh, or recompile a compiled scope.
5
+ metadata:
6
+ author: flaviostutz
7
+ version: "1.0"
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ Performs a full compilation cycle for any scope declaring `scope-type: compiled`: discovers compilation meta-policies across all type folders, fetches sources into a temporary directory, plans which policies to create, update, or remove, migrates them one at a time with full source traceability, runs lint and review, and documents any inconsistencies found in the source. Works for both initial compilation and re-compilation (updates). Requires `_core-adr-policy-019-compiled-scope-type` to be present in the workspace.
13
+
14
+ ## Instructions
15
+
16
+ ### Phase 0: Prerequisites Gate
17
+
18
+ 1. Identify the target scope. Verify its `index.md` declares `scope-type: compiled` (alone or combined with other types). If not, output: `FAIL — [scope-name] does not declare scope-type: compiled. This skill only applies to compiled scopes.`
19
+ 2. Scan ALL type folders (`adrs/`, `bdrs/`, `edrs/`) inside the target scope for local meta-policy files whose filename matches `NNN-core.md` in `[type]/principles/`. Collect every match.
20
+ 3. If no meta-policy is found in any type folder, output: `FAIL — Compilation cannot proceed: no local meta-policy NNN-core.md found in any [type]/principles/ folder of [scope-name]. Create it first with ## Sources and ## Selectors sections per _core-adr-policy-019 rule 07.`
21
+ 4. Read every found meta-policy fully. For each, extract:
22
+ - **Sources**: parse all `- [web] ...`, `- [git] ...`, `- [local] ...` bullet entries from the `## Sources` section.
23
+ - **Selectors**: read the `## Selectors` section content (used in Phase 2).
24
+ - **Fetch Procedures**: read the `## Fetch Procedures` section if present (used in Phase 1).
25
+ - **Compilation Notes**: read if present (used in Phase 2–3).
26
+ - **Review Notes**: read if present (used in Phase 6).
27
+
28
+ ### Phase 1: Fetch Sources
29
+
30
+ 1. Create a temporary directory `.tmp/compilation-[YYYYMMDDHHMMSS]/` in the workspace root.
31
+ 2. For each source discovered in Phase 0, fetch in the following preference order (first available wins; if all equivalent URLs are listed, try each in order):
32
+ - **Git URL** (`- [git] ...`): run `git clone --depth=1 [url] .tmp/compilation-[ts]/source-N/`. If `git` is not available or the clone fails, fall back to the next option.
33
+ - **Local folder** (`- [local] ...`): copy the folder contents to `.tmp/compilation-[ts]/source-N/`.
34
+ - **Web URL** (`- [web] ...`): before scraping, search the workspace for a skill specialized in fetching content from this URL or website domain (e.g., a skill whose description or name references the domain, the product, or the content type). Some websites require special handling — SSO, client certificates, shadow DOM, iframes, CAPTCHAs, or other quirks. If a specialized fetch skill is found, follow it to retrieve the content. If no specialized skill exists, fall back to `npx --package=@playwright/cli@latest playwright-cli`; run with `--help` to confirm available commands and save output as `.html` file(s) in `.tmp/compilation-[ts]/source-N/`.
35
+ 3. If any source cannot be fetched via any listed option, report the failure and continue with remaining sources. Do not abort the entire compilation for a single failed source.
36
+ 4. Convert non-markdown documents found in the fetched source directories. Use only the format converters actually needed:
37
+ - PDF files: `uvx markitdown[pdf] <file> -o <output>.md`
38
+ - XLSX files: `uvx markitdown[xlsx] <file> -o <output>.md`
39
+ - DOCX files: `uvx markitdown[docx] <file> -o <output>.md`
40
+ - PPTX files: `uvx markitdown[pptx] <file> -o <output>.md`
41
+ - HTML files saved from web scraping: `uvx markitdown <file.html> -o <output>.md`
42
+
43
+ ### Phase 2: Plan Policies
44
+
45
+ 1. For each type folder governed by a meta-policy (from Phase 0), apply the `## Selectors` rules to the fetched content to determine which portions to include.
46
+ 2. List all existing policies in the scope under each governed type folder.
47
+ 3. Analyse the selected content and produce a TODO list showing for each expected policy:
48
+ - **CREATE** — new policy to be compiled from source (does not yet exist in scope)
49
+ - **UPDATE** — existing policy whose source content has changed
50
+ - **REMOVE** — existing policy whose source content no longer exists or is excluded by selectors
51
+ - **KEEP** — existing policy that is up to date; no action needed
52
+ 4. Present the TODO list to the user and wait for confirmation before proceeding to Phase 3.
53
+
54
+ ### Phase 3: Migrate Policies (one at a time)
55
+
56
+ For each TODO item marked CREATE or UPDATE, in sequence:
57
+
58
+ 1. **Write the policy file** following `_core-adr-policy-019` and `_core-adr-policy-008`:
59
+ - Use standard policy frontmatter: `name`, `description`, `apply-to`, `valid-from`. Generate these from the source text; they are exempt from the no-invented-content rule per policy-019 rule 05.
60
+ - Use structured numbered rule blocks for all claims (per `_core-adr-policy-008`).
61
+ - Transcribe source content faithfully. Do NOT invent, infer beyond what the source states, or fill gaps. Preserve ambiguities as-is.
62
+
63
+ 2. **Add a `**compilation-note:**` marker** inside a rule body only when the mapping from source to rule is not obvious — for example: indirect references, conclusions drawn by connecting multiple source sections, interpretations that required judgment, or cases where the same source passage could be read differently. Do NOT add a marker when the rule is a direct, literal transcription of a single source statement. Place the marker as a new sentence at the end of the rule body. Example:
64
+ ```
65
+ All API keys MUST be rotated every 90 days. **compilation-note:** derived from [source-1/security/api-guidelines.md section 4.2] — "Keys should be invalidated and replaced quarterly"; frequency inferred as 90 days from the term "quarterly".
66
+ ```
67
+
68
+ 3. **Add a `## Source` section** as the LAST section of the policy (after `## References` if present, otherwise after `## Decision Outcome`). List the relative file path(s) of the source document(s) as plain text — NOT as markdown links. Paths are relative to the temporary source directory (e.g., `source-1/docs/chapter-3.md`).
69
+ ```
70
+ ## Source
71
+
72
+ - source-1/standards/section-4/api-security.md
73
+ ```
74
+
75
+ 4. For REMOVE items: delete the policy file and remove its entry from the type's `index.md`.
76
+
77
+ 5. Note any content in the source that is inconsistent, contradictory, or cannot be faithfully expressed as a valid XDRS policy. Record these for Phase 7.
78
+
79
+ ### Phase 4: Verify Each Policy
80
+
81
+ After writing each policy:
82
+
83
+ 1. Confirm the `## Source` section is present with at least one path entry.
84
+ 2. Confirm the policy uses structured numbered rule blocks (`_core-adr-policy-008`).
85
+ 3. Confirm `**compilation-note:**` markers are present for every rule whose mapping from source is non-obvious (indirect references, multi-source conclusions, interpretations requiring judgment). Direct literal transcriptions do not require a marker.
86
+ 4. Confirm no normative statements are present that cannot be traced to the listed source file.
87
+ 5. Add any new inconsistencies found to the list for Phase 7.
88
+
89
+ ### Phase 5: Lint
90
+
91
+ 1. Run `npx xdrs-core lint` from the workspace root (or `make lint` if a `Makefile` is present with a `lint` target).
92
+ 2. Review all reported errors and warnings.
93
+ 3. Fix only mechanical and structural errors (missing required frontmatter fields, naming violations, index link mismatches). Do NOT invent content to satisfy content-level findings.
94
+ 4. Re-run lint after fixes until it passes or only unfixable findings remain.
95
+
96
+ ### Phase 6: Review
97
+
98
+ 1. Read and follow `.xdrs/_core/adrs/principles/skills/001-review/SKILL.md` fully, scoped to the compiled scope.
99
+ 2. Apply any review notes from the meta-policy's `## Review Notes` section as additional mandatory conventions during this review.
100
+ 3. Fix only mechanical and structural findings from the review. Do NOT invent content to resolve content-level findings.
101
+ 4. Any review findings that require inventing or guessing content MUST be recorded as inconsistencies in Phase 7.
102
+
103
+ ### Phase 7: Document Inconsistencies
104
+
105
+ 1. Collect all inconsistencies noted during Phases 3, 4, and 6.
106
+ 2. If any inconsistencies exist:
107
+ - Determine the next available policy number in the `001–100` principles block for the relevant type folder.
108
+ - Create or update `[type]/principles/NNN-inconsistencies-from-source.md` in the scope.
109
+ - The policy `name` field MUST be `[scope]-[type]-policy-NNN-inconsistencies-from-source`.
110
+ - List each inconsistency with: source file path, affected compiled policy, and a description of the inconsistency.
111
+ - Do NOT propose or include fixes.
112
+ 3. If no inconsistencies exist, report that the compilation is clean.
113
+
114
+ ### Phase 8: Cleanup
115
+
116
+ 1. Remove the temporary directory `.tmp/compilation-[ts]/` created in Phase 1.
117
+ 2. Report a compilation summary:
118
+ - Policies created, updated, removed.
119
+ - Inconsistencies documented (with file path).
120
+ - Any sources that could not be fetched.
121
+ - Lint and review pass/fail status.
package/README.md CHANGED
@@ -62,13 +62,14 @@ Different teams at different organizational levels make decisions that apply to
62
62
 
63
63
  ### Scope types and `follows`
64
64
 
65
- Every scope declares a `scope-type` in its `index.md` frontmatter. The five built-in types are `core`, `reference`, `platform`, `standard`, and `_local`, each with different governance rules. Custom types (e.g. `business-area`) can be introduced by adding a `{type}-scope-type` policy to any `core`-type scope.
65
+ Every scope declares a `scope-type` in its `index.md` frontmatter. The six built-in types are `core`, `reference`, `platform`, `compiled`, `standard`, and `_local`, each with different governance rules. Custom types (e.g. `business-area`) can be introduced by adding a `{type}-scope-type` policy to any `core`-type scope.
66
66
 
67
67
  | Type | Purpose | Naming pattern | Root index order |
68
68
  |---|---|---|---|
69
69
  | `core` | Meta-governance: authoring standards, scope-type definitions, process guidance. No consumable policies. | `{name}-core` (e.g. `myorg-core`) | 1st |
70
70
  | `reference` | Standards, regulations, or reference models to be adopted or adapted (e.g. PCI-DSS, ISO 27001, reference architectures). Not a live service. | `{domain}-ref-{name}` (e.g. `security-ref-baseline`) | 2nd |
71
71
  | `platform` | Existing live services or infrastructure teams can consume directly (e.g. cloud platform, shared data service). | `{domain}-plat-{name}` (e.g. `cloud-plat-infra`) | 3rd |
72
+ | `compiled` | Policies compiled directly from external sources (web pages, git repos, local folders). All content must trace to source; no invented content. Combinable with other types. | Free-form (no naming requirement) | any, before `_local` |
72
73
  | `standard` | Business areas, products, teams, or any general-purpose scope. Default type when nothing else fits. | Any valid scope name (e.g. `checkout`, `mobile-app`) | 4th |
73
74
  | `_local` | Workspace-local overrides. Reserved exclusively for the `_local` scope. Never distributed. | `_local` (reserved) | last |
74
75
 
@@ -78,6 +79,18 @@ Every scope declares a `scope-type` in its `index.md` frontmatter. The five buil
78
79
 
79
80
  **`platform` scopes** document what already exists and is ready to use. A scope is of type `platform` when its content describes a live operational capability — what is available, how to access it, and what constraints apply.
80
81
 
82
+ **`compiled` scopes** hold policies compiled directly from external authoritative sources. All content must trace back to the source; no invented content is allowed. A `compiled` scope requires a local meta-policy with source URLs and compilation configuration, and uses the `009-compile-scope` skill to fetch, compile, and keep content up to date. The `compiled` type may be combined with another type (e.g. `scope-type: compiled, reference`) when the combined type's governance also applies.
83
+
84
+ ```yaml
85
+ # .xdrs/owasp-top10/adrs/principles/001-core.md (compilation meta-policy)
86
+ ## Sources
87
+ - [web] https://owasp.org/Top10/
88
+ - [git] https://github.com/OWASP/Top10.git
89
+
90
+ ## Selectors
91
+ Include A01–A10 risk entries only.
92
+ ```
93
+
81
94
  **`standard` scopes** are the default. Use them for team, product, or business-area scopes that do not fit the other types.
82
95
 
83
96
  **`_local` scopes** hold workspace-specific content such as local tooling decisions, transition overrides, or temporary decisions. This content is never packaged or distributed.
@@ -94,7 +107,7 @@ description: Checkout team decisions
94
107
  ---
95
108
  ```
96
109
 
97
- The recommended ordering in `.xdrs/index.md` is: `core → reference → platform → standard → _local`. Scopes listed later override earlier ones on the same topic.
110
+ The recommended ordering in `.xdrs/index.md` is: `core → reference → platform → compiled/standard → _local`. Scopes listed later override earlier ones on the same topic.
98
111
 
99
112
  Custom scope types can be introduced by adding a `{type}-scope-type` policy to any `core`-type scope. The `checkout` scope in [examples/typed-scope](examples/typed-scope) uses a custom `business-area` type defined in `ecomm-core`.
100
113