xdrs-core 0.9.0 → 0.11.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.
@@ -25,8 +25,15 @@ Provides clear ownership by scope, predictable navigation, and reusable decision
25
25
  - XDRs are the central artifact of the framework and the authoritative policy for their scope, type, and subject. Supporting artifacts may explain, justify, or operationalize the decision, but they do not replace it.
26
26
  - XDRs MAY include a `## Metadata` section, but only when at least one supported metadata field is present. When used, `## Metadata` MUST appear immediately before `## Context and Problem Statement`.
27
27
  - Supported XDR metadata fields are:
28
+ - `Status:` Optional. Defines the lifecycle state of the decision. Allowed values are `Draft`, `Active`, and `Deprecated`. If omitted, the decision is treated as `Active`. Only `Active` decisions may be treated as current policy.
29
+ - `Valid:` Optional. Defines the time window in which an active decision may be treated as current. Use ISO dates only: `from YYYY-MM-DD`, `until YYYY-MM-DD`, or `from YYYY-MM-DD until YYYY-MM-DD`. If `from` is omitted, the decision takes effect immediately. If `until` is omitted, the decision remains valid indefinitely.
28
30
  - `Applied to:` Optional. A short description of the contexts in which the decision is applicable. Keep it under 40 words. If omitted, the decision should be interpreted as applying to all logically applicable elements according to the decision text itself. Examples: `Only frontend code`, `JavaScript projects`, `Performance-sensitive codebases`
29
- - `Validity:` Optional. Defines when the decision is active. Use ISO dates only: `from YYYY-MM-DD`, `until YYYY-MM-DD`, or `from YYYY-MM-DD until YYYY-MM-DD`. If `from` is omitted, the decision takes effect immediately. If `until` is omitted, the decision remains valid indefinitely. `Draft` or `Retired` mean the XDR should be ignored as an active rule or policy.
31
+ - Before using, enforcing, or citing an XDR as a current rule, humans and AI agents MUST decide whether the decision is in force for the current case.
32
+ - Check `Status:` first to determine whether the XDR is eligible to be used now. If `Status:` is omitted, treat it as `Active`. `Draft` and `Deprecated` decisions are background or history, not current policy.
33
+ - Check `Valid:` next to determine whether the current moment falls inside the decision's active date window. Not-yet-active and expired windows are not current policy.
34
+ - Check `Applied to:` next to determine whether the active, currently valid decision fits the current codebase, system, workflow, or audience.
35
+ - Check the decision context and implementation details last to determine any additional boundaries, exceptions, or qualifiers that metadata alone cannot express.
36
+ - If any check fails, the XDR MAY still be read as background, history, or context, but it MUST NOT be treated as a current requirement for that case.
30
37
  - Research documents MAY be added under the same subject to capture the exploration, findings, and proposals that backed a decision. Research is useful during elaboration, discussion, approval, retirement, and updates, but the XDR remains the source of truth.
31
38
  - Make it clear if an instruction is mandatory or advisory
32
39
  - Mandatory language: "must", "always", "never", "required", "mandatory"
@@ -45,7 +52,7 @@ Provides clear ownership by scope, predictable navigation, and reusable decision
45
52
  - Skills use `.xdrs/[scope]/[type]/[subject]/skills/[number]-[skill-name]/assets/`
46
53
  - **Scopes:**
47
54
  - examples: `business-x`, `business-y`, `team-43`, `_core`
48
- - `_local` is a reserved scope for XDRs created locally to a specific project or repository. XDRs in `_local` must not be shared with or propagated to other contexts. This scope must always be placed in the lowest position in `.xdrs/index.md` so that its decisions override or extend any decisions from all higher-positioned scopes.
55
+ - `_local` is a reserved scope for XDRs created locally to a specific project or repository. XDRs in `_local` must not be shared with or propagated to other contexts. This scope must always be placed in the lowest position in `.xdrs/index.md` so that its decisions override or extend any decisions from all higher-positioned scopes. Shared `.xdrs/index.md` files MUST NOT link `_local` canonical type indexes because `_local` stays workspace-local and is not distributed with shared packages. Readers, tools, and agents SHOULD still try to discover existing workspace-local `_local` canonical indexes by default, even when the shared root index does not link them.
49
56
  - **Types:** `adrs`, `bdrs`, `edrs`
50
57
  - there can exist sufixes to the standard scope names (e.g: `business-x-mobileapp`, `business-y-servicedesk`)
51
58
  - **Subjects:** MUST be one of the following depending on the type of the XDR:
@@ -56,7 +63,7 @@ Provides clear ownership by scope, predictable navigation, and reusable decision
56
63
  - Types in IDs: `adr`, `bdr`, `edr`
57
64
  - Define the next number of an XDR by checking what is the highest number present in the type+scope. Don't fill numbering gaps, as they might be old deleted XDRs and we should never reuse numbers of different documents/decisions. Numbering gaps are expected.
58
65
  - Decisions MUST be concise and reference other XDRs to avoid duplication
59
- - The `### Implementation Details` section SHOULD state relevant boundaries or exceptions and what a reader should do or avoid in common cases. Use `## Metadata` for short applicability or lifecycle markers and keep nuanced boundaries in the decision text.
66
+ - The `### Implementation Details` section SHOULD state relevant boundaries or exceptions and what a reader should do or avoid in common cases. Use `## Metadata` as the first-pass filter for whether the decision should be used at all, then keep nuanced boundaries in the decision text.
60
67
  - Use concise rules, examples, or `Do` / `Don't` lists only when they help a reader apply the decision correctly. Keep them short and decision-specific.
61
68
  - When research exists for a decision, the XDR SHOULD mention the related research documents after the `## Considered Options` list.
62
69
  - Never use emojis in contents
@@ -85,9 +92,10 @@ All XDRs MUST follow this template
85
92
 
86
93
  ## Metadata
87
94
 
88
- [Optional section. Omit the entire section when neither `Applied to:` nor `Validity:` is defined.]
95
+ [Optional section. Omit the entire section when none of `Status:`, `Valid:`, or `Applied to:` is defined. Readers decide whether to use the XDR by checking `Status:` first, treating omission as `Active`, then `Valid:`, then `Applied to:`, and finally the decision text itself.]
96
+ Status: [Optional. Use `Draft`, `Active`, or `Deprecated`. Defaults to `Active` when omitted]
97
+ Valid: [Optional. Use `from YYYY-MM-DD`, `until YYYY-MM-DD`, or `from YYYY-MM-DD until YYYY-MM-DD`]
89
98
  Applied to: [Optional short applicability scope, under 40 words]
90
- Validity: [Optional. Use `Draft`, `Retired`, `from YYYY-MM-DD`, `until YYYY-MM-DD`, or `from YYYY-MM-DD until YYYY-MM-DD`]
91
99
 
92
100
  ## Context and Problem Statement
93
101
 
@@ -141,9 +149,10 @@ Question: In the end, state explicitly the question that needs to be answered. E
141
149
  - `.xdrs/business-x/adrs/governance/010-security-and-secrets-management.md`
142
150
  - `.xdrs/_core/adrs/devops/001-multi-repo.md`
143
151
  - Metadata examples:
152
+ - `Status: Draft`
153
+ - `Status: Active`
154
+ - `Valid: from 2026-03-01 until 2026-12-31`
144
155
  - `Applied to: JavaScript projects`
145
- - `Validity: Draft`
146
- - `Validity: from 2026-03-01 until 2026-12-31`
147
156
 
148
157
  ```text
149
158
  subject/
@@ -31,6 +31,7 @@ Skills are procedures, XDRs are guardrails and decisions, Research documents cap
31
31
  Always create links back and forth between skills <-> XDRs when the relationship is direct, and link to related Research or Articles when they provide important context.
32
32
  - Skills are task-based artifacts. They should have a clear starting trigger, an expected end result, and enough detail for a human or agent to verify that the task finished correctly.
33
33
  - A skill is not policy by itself. If following a skill is mandatory, that obligation must come from an XDR or another explicit policy that references the skill.
34
+ - When a skill reads, operationalizes, or enforces XDRs, it MUST evaluate the XDR metadata first. `Status:` determines whether the decision is eligible to be used, and an omitted `Status:` must be treated as `Active`. `Valid:` determines whether that active decision is currently in force by date, `Applied to:` determines whether it fits the current task context, and the decision text itself determines any remaining boundaries. Skills must not treat inactive, out-of-window, or out-of-scope XDRs as current requirements.
34
35
  - Skills and XDRs have a many-to-many relationship: one skill may operationalize multiple XDRs, and one XDR may be executed through multiple skills in different contexts.
35
36
 
36
37
  Place a skill under the XDR type that matches the nature of the activity the skill performs:
@@ -17,6 +17,7 @@ Articles are Markdown documents placed inside a subject folder alongside decisio
17
17
  - Articles are views, not decisions. They summarize and synthesize content from XDRs, Research, and Skills but are NOT the source of truth. When there is a conflict between an article and a Decision Record, the Decision Record takes precedence.
18
18
  - Articles must reference the XDRs, Research documents, and Skills they synthesize. Never duplicate decision content; link back to the authoritative sources.
19
19
  - Articles may serve as indexes, combining related artifacts on a specific topic into a single navigable document.
20
+ - When an article tells readers which decisions to follow, it SHOULD distinguish currently usable XDRs from background-only ones by checking `Status:` first, treating omission as `Active`, `Valid:` second, `Applied to:` third, and the decision text itself last. Articles must not present Draft, Deprecated, inactive-date, out-of-window, or out-of-scope XDRs as current rules for the discussed context.
20
21
  - Articles must remain consistent with the XDRs, Research documents, and Skills they reference. When a referenced artifact changes, the article must be reviewed and updated.
21
22
  - Place an article in the subject folder that best matches its topic. If an article spans more than one subject, place it in `principles`.
22
23
  - For simple structure, flow, layout, or relationship indications, articles SHOULD prefer plain Markdown, tables, or ASCII art instead of external assets.
@@ -47,6 +47,16 @@ The easiest way to distinguish the central elements is by asking what job each o
47
47
  This separation matters because mixing these jobs into one file makes the system harder to search,
48
48
  harder to update, and harder for agents to apply correctly.
49
49
 
50
+ ### How to decide whether an XDR should be used
51
+
52
+ Before treating an XDR as a rule for the current case, check its metadata first.
53
+
54
+ - **Status first**: only `Active` decisions can be current policy, and omitted `Status` should be treated as `Active`. `Draft` and `Deprecated` are background or historical context.
55
+ - **Valid second**: if present, the current moment must fall inside the decision's date window.
56
+ - **Applied to third**: if present, the current codebase, workflow, system, or audience must fit that scope.
57
+ - **Decision text last**: the XDR's own context and implementation details still determine the final boundaries and exceptions.
58
+ - **Then enforce**: only decisions that pass those checks should be used as active requirements. The rest may still be useful background or historical context.
59
+
50
60
  ### How they relate over time
51
61
 
52
62
  The framework is easiest to understand as a lifecycle rather than a static folder tree.
@@ -122,6 +132,7 @@ Follow [_core-adr-001](../001-xdr-standards.md) strictly. Key rules:
122
132
 
123
133
  - Use **mandatory language** (`must`, `never`, `required`) for non-negotiable rules and
124
134
  **advisory language** (`should`, `recommended`) for guidance.
135
+ - Before citing an XDR as a requirement, check `Status` first, treating omission as `Active`, then `Valid`, then `Applied to`, and finally the decision text to confirm the decision is active and in scope for the current case.
125
136
  - Keep XDRs under 100 lines. Move procedural detail to a co-located Skill.
126
137
  - Keep exploratory option analysis in a co-located Research document instead of bloating the XDR.
127
138
  - Always update the scope+type index and the root index after adding or changing an XDR.
@@ -24,12 +24,16 @@ Performs a structured review of code changes or files against the XDRs in the re
24
24
 
25
25
  1. Gather all Decision Records from `.xdrs/index.md` starting from the working directory.
26
26
  - XDR scopes are controlled by nested folders; some are broad, others domain-specific.
27
- - Extract metadata first (validity status and applicability) to filter relevant XDRs before deep analysis. Treat `Validity: Draft` and `Validity: Retired` as inactive policy.
27
+ - Extract metadata first to decide whether each XDR should be used for the current review context.
28
+ - Check `Status:` first. Treat an omitted `Status:` as `Active`, and treat `Draft` and `Deprecated` XDRs as background only, not active policy.
29
+ - Check `Valid:` second. Keep only `Active` XDRs whose date window covers the current review moment.
30
+ - Check `Applied to:` third. Keep only active, in-window XDRs whose stated scope fits the files, systems, or workflows under review.
31
+ - Check the decision text itself last for additional boundaries or exceptions that metadata does not encode.
28
32
  2. Filter relevance based on file types, domains, and architectural patterns in scope.
29
33
 
30
34
  ### Phase 3: XDR Review
31
35
 
32
- 1. Cross-reference each file in scope against applicable XDRs.
36
+ 1. Cross-reference each file in scope against active, applicable XDRs.
33
37
  - **Drop any finding that cannot be traced to a specific rule in an Accepted XDR.** General good-practice observations, personal opinions, or inferred issues without an explicit XDR backing must not be reported.
34
38
  - Classify as ERROR (mandatory) or WARNING (advisory).
35
39
  - Include: location, description, XDR reference (file + line), suggestion.
@@ -50,7 +54,7 @@ Performs a structured review of code changes or files against the XDRs in the re
50
54
  ### Phase 5: Reporting
51
55
 
52
56
  **Report template**
53
- --------
57
+ ```text
54
58
  ### Code Review Against XDRs
55
59
  Scope: [scope identifier]
56
60
 
@@ -68,7 +72,7 @@ Scope: [scope identifier]
68
72
  - Errors: [count]
69
73
  - Warnings: [count]
70
74
  - Outcome: [PASS|FAIL]
71
- --------
75
+ ```
72
76
 
73
77
  ### Constraints
74
78
  - MUST NOT include any text or explanations outside the required output format.
@@ -84,6 +88,6 @@ Scope: [scope identifier]
84
88
 
85
89
  ## References
86
90
 
87
- - [_core-adr-001 - XDR standards](../../../.xdrs/_core/adrs/principles/001-xdr-standards.md)
88
- - [_core-adr-003 - Skill standards](../../../.xdrs/_core/adrs/principles/003-skill-standards.md)
91
+ - [_core-adr-001 - XDR standards](../../001-xdr-standards.md)
92
+ - [_core-adr-003 - Skill standards](../../003-skill-standards.md)
89
93
 
@@ -10,7 +10,7 @@ metadata:
10
10
 
11
11
  ## Overview
12
12
 
13
- Guides the creation of a well-structured XDR by following the standards in `_core-adr-001`, researching existing records for conflicts, checking redundancy across related artifacts, and iterating until the document is concise and decision-focused.
13
+ Guides the creation of a well-structured XDR by following the standards in `_core-adr-001`, consulting `xdr-standards` for every core element definition, researching existing records for conflicts, checking redundancy across related artifacts, and iterating until the document is concise, decision-focused, and clear about when the decision should be used.
14
14
 
15
15
  ## Instructions
16
16
 
@@ -18,10 +18,13 @@ Guides the creation of a well-structured XDR by following the standards in `_cor
18
18
 
19
19
  1. Read `.xdrs/index.md` to discover all active scopes and their canonical indexes.
20
20
  2. Read `.xdrs/_core/adrs/principles/001-xdr-standards.md` in full to internalize structure rules, mandatory language, and the XDR template.
21
- 3. Ask the user (or infer from context) the topic of the decision. Do NOT proceed to Phase 2 without a clear topic.
21
+ 3. Treat `.xdrs/_core/adrs/principles/001-xdr-standards.md` as the canonical source for all core XDR element definitions. Before choosing or writing any core element, consult it for the exact rules for type, scope, subject, ID, numbering, title, placement, and applicable folder structure instead of relying on memory or local convention.
22
+ 4. Ask the user (or infer from context) the topic of the decision. Do NOT proceed to Phase 2 without a clear topic.
22
23
 
23
24
  ### Phase 2: Select Type, Scope, and Subject
24
25
 
26
+ Consult `001-xdr-standards` while making each choice in this phase. The summaries below are orientation only; when any detail matters, the standard decides.
27
+
25
28
  **Type** — choose exactly one based on the nature of the decision:
26
29
  - **BDR**: business process, product policy, strategic rule, operational procedure
27
30
  - **ADR**: system context, integration pattern, overarching architectural choice
@@ -71,8 +74,9 @@ Use the mandatory template from `001-xdr-standards`:
71
74
 
72
75
  ## Metadata
73
76
  [Optional. Include only when at least one metadata field is present]
77
+ Status: [Optional. Use Draft, Active, or Deprecated. Defaults to Active when omitted]
78
+ Valid: [Optional. Use from YYYY-MM-DD, until YYYY-MM-DD, or from YYYY-MM-DD until YYYY-MM-DD]
74
79
  Applied to: [Optional short applicability scope, under 40 words]
75
- Validity: [Optional. Use Draft, Retired, from YYYY-MM-DD, until YYYY-MM-DD, or from YYYY-MM-DD until YYYY-MM-DD]
76
80
 
77
81
  ## Context and Problem Statement
78
82
  [4 lines max: background, who is impacted, and the explicit question being answered]
@@ -93,9 +97,10 @@ Validity: [Optional. Use Draft, Retired, from YYYY-MM-DD, until YYYY-MM-DD, or f
93
97
  ```
94
98
 
95
99
  Mandatory rules to apply while drafting:
96
- - Include `## Metadata` only when `Applied to:` and/or `Validity:` adds value; omit the whole section when neither field is defined.
100
+ - Include `## Metadata` only when `Status:`, `Valid:`, and/or `Applied to:` adds value; omit the whole section when none of those fields is defined.
97
101
  - When present, place `## Metadata` immediately before `## Context and Problem Statement`.
98
- - Keep `Applied to:` under 40 words and use `Validity:` only with ISO dates or the special values `Draft` / `Retired`.
102
+ - Keep `Applied to:` under 40 words, use `Status:` only with `Draft`, `Active`, or `Deprecated`, remember that omitted `Status:` means `Active`, and use `Valid:` only with ISO date ranges.
103
+ - When metadata is present, write it so a reader can decide whether the XDR should be used for the current case without guessing. `Status:` controls lifecycle state, omitted `Status:` means `Active`, `Valid:` controls the active time window, `Applied to:` narrows the contexts where that active decision applies, and the decision text defines any remaining boundaries.
99
104
  - Use mandatory language ("must", "always", "never") only for hard requirements; use advisory language ("should", "recommended") for guidance.
100
105
  - Do not duplicate content already in referenced XDRs — link instead.
101
106
  - Keep the decision itself authoritative in the XDR. Supporting artifacts may elaborate, but they should not restate the full decision when a short reference is enough.
@@ -111,7 +116,7 @@ Mandatory rules to apply while drafting:
111
116
  Check every item before finalizing:
112
117
 
113
118
  1. **Length**: Is it under 100 lines? Trim verbose explanations. Move detailed skills to a separate file and link.
114
- 2. **Metadata**: If metadata exists, is it directly before Context, limited to `Applied to:` / `Validity:`, and omitted entirely when both are absent?
119
+ 2. **Metadata**: If metadata exists, is it directly before Context, limited to `Status:` / `Valid:` / `Applied to:`, omitted entirely when all three are absent, and specific enough for a reader to decide whether the XDR is active, currently valid, and applicable?
115
120
  3. **Originality**: Does every sentence add value that cannot be found in a generic web search? Remove obvious advice. Keep only the project-specific decision.
116
121
  4. **Clarity**: Is the chosen option unambiguous? Is the "why" clear in one reading?
117
122
  5. **Redundancy**: Is the XDR the primary source for the decision itself, with related documents linked instead of duplicated wherever possible?
@@ -131,6 +136,7 @@ If any check fails, revise and re-run this phase before proceeding.
131
136
  ### Constraints
132
137
 
133
138
  - MUST follow the XDR template from `001-xdr-standards` exactly.
139
+ - MUST consult `001-xdr-standards` as the canonical source for every core element definition, especially type, scope, subject, ID, numbering, naming, and placement.
134
140
  - MUST NOT add personal opinions or general best-practice content not tied to a decision.
135
141
  - MUST NOT create an XDR that duplicates a decision already captured in another XDR — extend or reference instead.
136
142
  - MUST prefer links and short references over repeating the same decision content across related documents.
@@ -11,17 +11,20 @@ metadata:
11
11
 
12
12
  ## Overview
13
13
 
14
- Guides the creation of a well-structured skill package by following `_core-adr-003` skill standards, checking existing skills to avoid duplication, and producing a complete SKILL.md ready to activate in VS Code.
14
+ Guides the creation of a well-structured skill package by following `_core-adr-003` skill standards, consulting `xdr-standards` for every core element definition, checking existing skills to avoid duplication, and producing a complete SKILL.md ready to activate in VS Code.
15
15
 
16
16
  ## Instructions
17
17
 
18
18
  ### Phase 1: Understand the Skill Goal
19
19
 
20
20
  1. Read `.xdrs/_core/adrs/principles/003-skill-standards.md` in full to internalize the SKILL.md format, folder layout, and numbering rules.
21
- 2. Identify what the skill must do, the concrete outcome it should produce, and the exact conditions under which an agent should activate it. Do NOT proceed without a clear goal, outcome, and activation trigger.
21
+ 2. Read `.xdrs/_core/adrs/principles/001-xdr-standards.md` in full before defining any core element for the skill package. Treat it as the canonical source for type, scope, subject, numbering expectations, naming constraints, and folder placement rules.
22
+ 3. Identify what the skill must do, the concrete outcome it should produce, and the exact conditions under which an agent should activate it. Do NOT proceed without a clear goal, outcome, and activation trigger.
22
23
 
23
24
  ### Phase 2: Select Type, Scope, Subject, and Number
24
25
 
26
+ Consult `001-xdr-standards` while making each choice in this phase. The summaries below are orientation only; when there is any ambiguity or edge case, the standard decides.
27
+
25
28
  **Type** — choose one based on the skill's activity:
26
29
  - **EDR skill**: engineering workflows, tool usage, coding procedures, implementation how-tos
27
30
  - **ADR skill**: architectural evaluation, pattern compliance, technology selection guidance
@@ -47,7 +50,8 @@ Quick test:
47
50
 
48
51
  1. List `.xdrs/[scope]/[type]/[subject]/skills/` for existing skills. If one already covers the goal, extend or reference it instead of creating a duplicate.
49
52
  2. Read all XDRs relevant to the skill's domain to collect rules and cross-references.
50
- 3. Decide whether the skill is merely guidance or is being referenced by an XDR as a mandatory procedure. Do not encode policy in the skill unless it comes from a referenced XDR.
53
+ 3. Evaluate XDR metadata before operationalizing those rules. `Status:` decides whether a decision is eligible to be used, and omitted `Status:` means `Active`; `Valid:` decides whether that active decision is in force at the current moment, `Applied to:` decides whether it fits the intended task context, and the decision text defines any remaining boundaries. Keep inactive, out-of-window, or out-of-scope XDRs as background only.
54
+ 4. Decide whether the skill is merely guidance or is being referenced by an XDR as a mandatory procedure. Do not encode policy in the skill unless it comes from a referenced XDR.
51
55
 
52
56
  ### Phase 4: Write the SKILL.md
53
57
 
@@ -92,6 +96,7 @@ Rules:
92
96
  - Mention tools or prerequisites when they are required to complete the task reliably.
93
97
  - Do not duplicate content from referenced XDRs — link instead.
94
98
  - Do not present the skill itself as policy; mandatory behavior must come from referenced XDRs or other policy artifacts.
99
+ - When the skill depends on XDRs, make the activation logic and instructions consistent with the XDR metadata so the skill does not operationalize inactive or out-of-scope decisions.
95
100
  - Prefer plain Markdown, tables, or ASCII art for simple structure, flow, layout, or relationship indications.
96
101
  - If `SKILL.md` genuinely needs local images or supporting files, store them in `.xdrs/[scope]/[type]/[subject]/skills/[number]-[skill-name]/assets/` and link with a relative path.
97
102
  - No emojis. Lowercase filenames. Target under 500 lines.
@@ -120,6 +125,7 @@ If any check fails, revise before continuing.
120
125
  ### Constraints
121
126
 
122
127
  - MUST follow the agentskills SKILL.md format from `003-skill-standards` exactly.
128
+ - MUST consult `001-xdr-standards` as the canonical source for every core element definition, especially type, scope, subject, numbering, naming, and placement.
123
129
  - MUST NOT create a skill that duplicates an existing one — extend or reference it instead.
124
130
  - MUST keep scope `_local` unless the user explicitly states otherwise.
125
131
  - MUST include a References section linking to `003-skill-standards`.
@@ -9,9 +9,7 @@ metadata:
9
9
 
10
10
  ## Overview
11
11
 
12
- Guides the creation of a well-structured article by following `_core-adr-004`, researching the XDRs,
13
- Research documents, and Skills to synthesize, and producing a concise document that serves as a navigable view without duplicating
14
- decision content.
12
+ Guides the creation of a well-structured article by following `_core-adr-004`, consulting `xdr-standards` for every core element definition, researching the XDRs, Research documents, and Skills to synthesize, and producing a concise document that serves as a navigable view without duplicating decision content.
15
13
 
16
14
  ## Instructions
17
15
 
@@ -19,15 +17,21 @@ decision content.
19
17
 
20
18
  1. Read `.xdrs/_core/adrs/principles/004-article-standards.md` in full to internalize the template,
21
19
  placement rules, numbering rules, and the constraint that articles are views, not decisions.
22
- 2. Identify the topic and intended audience from user input or context. Do NOT proceed without a clear
20
+ 2. Read `.xdrs/_core/adrs/principles/001-xdr-standards.md` in full before defining the article's core elements. Treat it as the canonical source for how to choose and write type, scope, subject, numbering, naming, and folder placement.
21
+ 3. Identify the topic and intended audience from user input or context. Do NOT proceed without a clear
23
22
  topic.
24
23
 
25
24
  ### Phase 2: Select Scope, Type, and Subject
26
25
 
26
+ Consult `001-xdr-standards` while making each choice in this phase. The summaries below are orientation only; when any detail is unclear, the standard decides.
27
+
27
28
  **Scope** — use `_local` unless the user explicitly names another scope.
28
29
 
29
30
  **Type** — match the type of the XDRs the article primarily synthesizes (`adrs`, `bdrs`, or `edrs`).
30
- If the topic spans multiple types, use `adrs`.
31
+ If the topic spans multiple types, use `adrs`. Use the same rules as `002-write-xdr` Phase 2:
32
+ - **BDR**: business process, product policy, strategic rule, operational procedure
33
+ - **ADR**: system context, integration pattern, overarching architectural choice
34
+ - **EDR**: specific tool/library, coding practice, testing strategy, project structure, pipelines
31
35
 
32
36
  **Subject** — pick the subject that best matches the article's topic (see `004-article-standards`).
33
37
  If the article spans more than one subject, place it in `principles`.
@@ -43,8 +47,9 @@ If the article spans more than one subject, place it in `principles`.
43
47
  ### Phase 4: Research XDRs and Skills to Synthesize
44
48
 
45
49
  1. Read all XDRs, Research documents, and Skills relevant to the article topic across all scopes listed in `.xdrs/index.md`.
46
- 2. Identify the key points a reader needs to understand the topic end-to-end.
47
- 3. Collect XDR IDs and file paths for cross-references. Never copy decision text verbatim; link to it.
50
+ 2. Evaluate XDR metadata before synthesizing guidance. Use `Status:` to determine whether a decision is eligible to be current guidance, treating omitted `Status:` as `Active`; use `Valid:` to determine whether that active decision is in force for the article's time horizon, `Applied to:` to determine whether it fits the audience or context being discussed, and the decision text itself for any remaining applicability boundaries.
51
+ 3. Identify the key points a reader needs to understand the topic end-to-end.
52
+ 4. Collect XDR IDs and file paths for cross-references. Never copy decision text verbatim; link to it.
48
53
 
49
54
  ### Phase 5: Write the Article
50
55
 
@@ -71,6 +76,7 @@ Rules to apply while drafting:
71
76
 
72
77
  - Write for the stated audience; avoid jargon unexplained elsewhere.
73
78
  - Every factual claim must link back to the authoritative XDR or Skill.
79
+ - If the article advises readers what to do, clearly separate active/applicable XDRs from background, historical, or out-of-scope ones.
74
80
  - Never reproduce decision text verbatim; summarize and link.
75
81
  - Prefer plain Markdown, tables, or ASCII art for simple structure, flow, layout, or relationship indications.
76
82
  - If the article genuinely needs local images or supporting files, store them in `.xdrs/[scope]/[type]/[subject]/articles/assets/` and link with a relative path.
@@ -109,8 +115,15 @@ Rules to apply while drafting:
109
115
  - **Conflicting information found** — note the conflict in the article and always defer to the XDR.
110
116
  - **Article would exceed 150 lines** — move detailed content to a new Research, Skill, or XDR and link back.
111
117
 
118
+ ## Constraints
119
+
120
+ - MUST consult `001-xdr-standards` as the canonical source for every core element definition, especially type, scope, subject, numbering, naming, and placement.
121
+ - MUST follow the article template and placement rules from `004-article-standards`.
122
+ - MUST keep scope `_local` unless the user explicitly states otherwise.
123
+ - MUST defer to active and applicable XDRs when article synthesis conflicts with them.
124
+
112
125
  ## References
113
126
 
114
- - [_core-adr-004 - Article standards](../../004-article-standards.md)
115
- - [_core-adr-006 - Research standards](../../006-research-standards.md)
116
- - [_core-adr-001 - XDR standards](../../001-xdr-standards.md)
127
+ - [_core-adr-004 - Article standards](../../../.xdrs/_core/adrs/principles/004-article-standards.md)
128
+ - [_core-adr-006 - Research standards](../../../.xdrs/_core/adrs/principles/006-research-standards.md)
129
+ - [_core-adr-001 - XDR standards](../../../.xdrs/_core/adrs/principles/001-xdr-standards.md)
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const { copilotCmd, testPrompt } = require('xdrs-core');
5
+
6
+ const REPO_ROOT = path.resolve(__dirname, '..', '..', '..', '..', '..', '..');
7
+
8
+ jest.setTimeout(60000);
9
+
10
+ test.skip('check', () => {
11
+ const err = testPrompt(
12
+ {
13
+ workspaceRoot: REPO_ROOT,
14
+ workspaceMode: 'in-place',
15
+ promptCmd: copilotCmd(REPO_ROOT)
16
+ },
17
+ 'Reply with READY and nothing else.',
18
+ 'Verify that the final output is READY and nothing else.',
19
+ true
20
+ );
21
+
22
+ expect(err).toBe('');
23
+ });
24
+
25
+ test('005-write-research creates an IMRAD research document in copy mode', () => {
26
+ const err = testPrompt(
27
+ {
28
+ workspaceRoot: REPO_ROOT,
29
+ workspaceMode: 'copy',
30
+ promptCmd: copilotCmd(REPO_ROOT)
31
+ },
32
+ 'Create a very small research document with the following data: We measured the installation time in our monorepo and pnpm is 3.5x faster than Yarn when installing dependencies. We recommend using PNPM in our monorepo to speed up our productivity as it seems very easy to use and have a better internal hoisting mechanism.',
33
+ 'Verify that a research file was created under .xdrs/_local/edrs/devops/researches/, that it contains the sections Abstract, Introduction, Methods, Results, Discussion, Conclusion, and References, and that the content contains all the provided data in input prompt, and doesn\'t contain more than 20% of additional information.'
34
+ );
35
+
36
+ expect(err).toBe('');
37
+ });
@@ -11,26 +11,32 @@ metadata:
11
11
 
12
12
  ## Overview
13
13
 
14
- Guides the creation of a well-structured research document by following `_core-adr-006`, checking related XDRs and existing research to avoid duplication, and producing an IMRAD-based study that reads as a standalone technical paper. Treat each section goal in the research template as an acceptance criterion, not as optional wording. Do not assume missing direction, evidence, or intended follow-up; ask the user explicitly before proceeding when those points are not already concrete.
14
+ Guides the creation of a well-structured research document by following `_core-adr-006`, consulting `xdr-standards` for every core element definition, checking related XDRs and existing research to avoid duplication, and producing an IMRAD-based study that reads as a standalone technical paper. Treat each section goal in the research template as an acceptance criterion, not as optional wording. Do not assume missing direction, evidence, or intended follow-up; ask the user explicitly before proceeding when those points are not already concrete.
15
15
 
16
16
  ## Instructions
17
17
 
18
18
  ### Phase 1: Understand the Research Goal
19
19
 
20
20
  1. Read `.xdrs/_core/adrs/principles/006-research-standards.md` in full to internalize the folder layout, numbering rules, and mandatory template.
21
- 2. Ask the user to confirm the intended direction of the research before planning the document: what decision, question, or option space the study should support, what boundaries or exclusions apply, and what kind of outcome they expect.
22
- 3. Ask the user what evidence already exists and what evidence-gathering methods are acceptable if the current evidence is incomplete. Do not invent facts, sources, or confidence that the user did not provide.
23
- 4. Ask the user what the proposed next step is after the research, such as writing a new XDR, updating an existing XDR, informing a discussion, or documenting trade-offs for later. Use that answer to shape the framing without turning the research into the final decision.
24
- 5. Identify the problem or question being explored, the relevant system or domain context, the likely technical audience, and why the subject matters in practice.
25
- 6. Internalize the goal of each required section before drafting: `Abstract` gives a quick technical reader the question, method, main result, and takeaway, `Introduction` frames the investigated problem and context, `Methods` makes the important parts reproducible, `Results` records raw findings with minimal interpretation, `Discussion` interprets the findings, `Conclusion` summarizes the practical takeaway and boundaries, and `References` makes sources traceable.
26
- 7. Collect the main constraints, known facts, important experiences, gaps, and assumptions that belong in the introduction.
27
- 8. Do NOT proceed without a clear problem statement, a central question, explicit user direction, an understood next step, and at least one credible source of evidence or a method for generating it. If any of these are ambiguous, stop and ask instead of assuming.
21
+ 2. Read `.xdrs/_core/adrs/principles/001-xdr-standards.md` in full before defining the research document's core elements. Treat it as the canonical source for how to choose and write type, scope, subject, numbering expectations, naming constraints, and folder placement.
22
+ 3. Ask the user to confirm the intended direction of the research before planning the document: what decision, question, or option space the study should support, what boundaries or exclusions apply, and what kind of outcome they expect.
23
+ 4. Ask the user what evidence already exists and what evidence-gathering methods are acceptable if the current evidence is incomplete. Do not invent facts, sources, or confidence that the user did not provide.
24
+ 5. Ask the user what the proposed next step is after the research, such as writing a new XDR, updating an existing XDR, informing a discussion, or documenting trade-offs for later. Use that answer to shape the framing without turning the research into the final decision.
25
+ 6. Identify the problem or question being explored, the relevant system or domain context, the likely technical audience, and why the subject matters in practice.
26
+ 7. Internalize the goal of each required section before drafting: `Abstract` gives a quick technical reader the question, method, main result, and takeaway, `Introduction` frames the investigated problem and context, `Methods` makes the important parts reproducible, `Results` records raw findings with minimal interpretation, `Discussion` interprets the findings, `Conclusion` summarizes the practical takeaway and boundaries, and `References` makes sources traceable.
27
+ 8. Collect the main constraints, known facts, important experiences, gaps, and assumptions that belong in the introduction.
28
+ 9. Do NOT proceed without a clear problem statement, a central question, explicit user direction, an understood next step, and at least one credible source of evidence or a method for generating it. If any of these are ambiguous, stop and ask instead of assuming.
28
29
 
29
30
  ### Phase 2: Select Scope, Type, Subject, and Number
30
31
 
32
+ Consult `001-xdr-standards` while making each choice in this phase. The summaries below are orientation only; when any detail matters, the standard decides.
33
+
31
34
  **Scope** — use `_local` unless the user explicitly names another scope.
32
35
 
33
- **Type** — match the type of decision this research supports (`adrs`, `bdrs`, or `edrs`).
36
+ **Type** — match the type of decision this research supports (`adrs`, `bdrs`, or `edrs`). Use the same rules as `002-write-xdr` Phase 2:
37
+ - **BDR**: business process, product policy, strategic rule, operational procedure
38
+ - **ADR**: system context, integration pattern, overarching architectural choice
39
+ - **EDR**: specific tool/library, coding practice, testing strategy, project structure, pipelines
34
40
 
35
41
  **Subject** — pick the most specific subject that matches the problem domain.
36
42
 
@@ -253,4 +259,11 @@ If any check fails, revise before continuing.
253
259
 
254
260
  - [_core-adr-006 - Research standards](../../006-research-standards.md)
255
261
  - [_core-adr-001 - XDR standards](../../001-xdr-standards.md)
256
- - [002-write-xdr skill](../002-write-xdr/SKILL.md)
262
+ - [002-write-xdr skill](../002-write-xdr/SKILL.md)
263
+
264
+ ## Constraints
265
+
266
+ - MUST consult `001-xdr-standards` as the canonical source for every core element definition, especially type, scope, subject, numbering, naming, and placement.
267
+ - MUST follow the research template and section-goal rules from `006-research-standards`.
268
+ - MUST keep scope `_local` unless the user explicitly states otherwise.
269
+ - MUST keep the document as research rather than turning it into a final decision.
package/.xdrs/index.md CHANGED
@@ -19,6 +19,4 @@ Decisions about how XDRs work
19
19
 
20
20
  ### _local (reserved)
21
21
 
22
- Project-local XDRs that must not be shared with other contexts. Always keep this scope last so its decisions override or extend all scopes listed above. Add specific `_local` ADR/BDR/EDR index links here when present.
23
-
24
-
22
+ Project-local XDRs that must not be shared with other contexts. Always keep this scope last so its decisions override or extend all scopes listed above. Keep `_local` canonical indexes in the workspace tree only; do not link them from this shared index. Readers and tools should still try to discover existing `_local` indexes in the current workspace by default.
package/README.md CHANGED
@@ -14,7 +14,7 @@ This project defines a standard for organizing XDRs that satisfies the following
14
14
 
15
15
  Every XDR package contains four types of documents:
16
16
 
17
- - **Decision Records (XDRs)** — Architectural (ADR), Business (BDR), or Engineering (EDR) records that capture a single decision, its rationale, and the rules that follow from it. They are the source of truth. An XDR may optionally start with a `Metadata` section for short applicability and validity markers.
17
+ - **Decision Records (XDRs)** — Architectural (ADR), Business (BDR), or Engineering (EDR) records that capture a single decision, its rationale, and the rules that follow from it. They are the source of truth. An XDR may optionally start with a `Metadata` section for short status, validity-window, and applicability markers, and readers should use that metadata to decide whether the decision is currently in force for their case. If `Status:` is omitted, treat the decision as `Active` by default.
18
18
  - **Research** — Exploratory documents that capture the problem being investigated, constraints or requirements, findings, and option tradeoffs that back a decision during its lifecycle. One research document may inform multiple downstream decisions, but it is not a replacement for the Decision Record.
19
19
  - **Skills** — Step-by-step procedural guides that can be followed by humans, AI agents, or both. Skills are task-based artifacts with a concrete outcome and should include enough detail to verify the task was completed correctly. A skill may start as a fully manual procedure and evolve toward partial or full AI automation over time. Co-located with the XDRs they implement.
20
20
  - **Articles** — Synthetic explanatory texts that combine information from multiple XDRs, Research documents, and Skills around a specific topic or audience. They never replace XDRs as source of truth.
@@ -57,7 +57,7 @@ The `lint` command reads `./.xdrs/**` from the given workspace path and checks c
57
57
  - research numbering uniqueness per `scope/type/subject/researches`
58
58
  - canonical index presence and link consistency
59
59
  - root index coverage for all discovered canonical indexes
60
- - XDR metadata section placement and `Applied to` / `Validity` field format
60
+ - XDR metadata section placement and `Status` / `Valid` / `Applied to` field format
61
61
  - local image and `assets/` links resolving inside the sibling `assets/` folder for each document
62
62
 
63
63
  Examples:
@@ -68,6 +68,46 @@ npx -y xdrs-core lint ./some-project
68
68
  pnpm exec xdrs-core lint .
69
69
  ```
70
70
 
71
+ ## Library Testing
72
+
73
+ The package also exposes a reusable behavior-test library for Jest or any other JavaScript test runner.
74
+
75
+ Main exports:
76
+
77
+ - `testPrompt(config, inputPrompt, judgePrompt)` runs the task prompt, evaluates the result in a fresh judge session, and returns an empty string on success or a markdown bullet list on failure.
78
+ - `runPromptTest(config, inputPrompt, judgePrompt)` returns the structured result object when you need access to captured output and the agent-reported changed file list.
79
+ - `copilotCmd(workspaceRoot)` returns a ready-to-use `promptCmd` template for the Copilot CLI. The library uses that same command template for both the task and judge phases. If `workspaceRoot` is omitted it defaults to the current git repository root.
80
+ - `config.workspaceRoot`, when set, is the authoritative workspace under test. If omitted, the library uses the current git repository root.
81
+
82
+ Execution model:
83
+
84
+ - phase 1 runs the task prompt and captures final output text plus the files the agent says it changed
85
+ - phase 2 runs an independent judge prompt in a fresh invocation of `promptCmd` against the original task prompt, task output, the agent-reported changed file list, and the current workspace state
86
+ - the judge trusts that reported file list as the authoritative change report and reads file contents from the workspace directly when needed
87
+ - when `workspaceMode: 'copy'` is used, the temporary workspace honors nested `.gitignore` rules and skips git metadata files during the copy
88
+
89
+ `promptCmd` accepts either a string array or a JSON array string and must include a `{PROMPT}` placeholder.
90
+
91
+ Example with Jest:
92
+
93
+ ```js
94
+ const { copilotCmd, testPrompt } = require('xdrs-core');
95
+
96
+ test('creates hello.md', () => {
97
+ const err = testPrompt(
98
+ {
99
+ workspaceRoot: process.cwd(),
100
+ promptCmd: copilotCmd(process.cwd()),
101
+ workspaceMode: 'copy'
102
+ },
103
+ "Create a nice markdown file at hello.md saying 'hello!'",
104
+ 'The resulting file should be created at hello.md and have hello as part of its contents, without too much extra info (should be <100 chars)'
105
+ );
106
+
107
+ expect(err).toBe('');
108
+ });
109
+ ```
110
+
71
111
  ## Requirements
72
112
 
73
113
  ### Multi-scope support
@@ -93,6 +133,7 @@ The folder layout, file naming, and document format are designed so that AI agen
93
133
  - Each XDR is a small, focused Markdown file (target under 100 lines), covering one decision.
94
134
  - The canonical index per scope and type lists all XDRs with short descriptions, enabling agents to identify relevant records without reading every file.
95
135
  - The root index at `.xdrs/index.md` provides a single entry point for discovery.
136
+ - XDR metadata gives agents a first-pass filter: check `Status` first, treating an omitted `Status` as `Active`; then check `Valid`, then `Applied to`, and finally the decision text itself to confirm the decision should be used in the current context.
96
137
  - Decisions cross-reference each other by XDR ID rather than duplicating content, keeping individual files concise.
97
138
  - Subject folders reduce the search space when a query maps to a known domain.
98
139
 
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./testPrompt');