xdrs-core 0.10.0 → 0.11.1

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.
@@ -21,29 +21,23 @@ Provides clear ownership by scope, predictable navigation, and reusable decision
21
21
 
22
22
  ### Implementation Details
23
23
 
24
- - XDRs MUST contain a clear decision about a certain problem or situation. Avoid being too verbose and focus on explaining clearly the context and the decision. Avoid adding contents that are not original. If you have other references that are important to understand the document, add links and references.
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
- - 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
- - 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.
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`
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.
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.
38
- - Make it clear if an instruction is mandatory or advisory
39
- - Mandatory language: "must", "always", "never", "required", "mandatory"
40
- - Advisory language: "should", "recommended", "advised", "preferably", "possibly", "optionally"
41
- - Always the following folder structure:
24
+ The standards below are split into framework-wide standards and XDR document standards.
25
+
26
+ #### General framework standards
27
+
28
+ - Make it clear if an instruction is mandatory or advisory.
29
+ - Mandatory language: "must", "always", "never", "required", "mandatory"
30
+ - Advisory language: "should", "recommended", "advised", "preferably", "possibly", "optionally"
31
+ - Always use the following folder structure for XDR documents:
42
32
  `.xdrs/[scope]/[type]/[subject]/[number]-[short-title].md`
43
33
  - Optional supporting artifacts under the same subject:
44
34
  - `.xdrs/[scope]/[type]/[subject]/researches/[number]-[short-title].md`
45
35
  - `.xdrs/[scope]/[type]/[subject]/skills/[number]-[skill-name]/SKILL.md`
46
36
  - `.xdrs/[scope]/[type]/[subject]/articles/[number]-[short-title].md`
37
+ - Research, skills, and articles are part of the framework, but each has its own concept-specific standards in dedicated XDRs. This XDR defines the shared framework baseline and the decision-record standard.
38
+ - `_core-adr-003` defines skill standards
39
+ - `_core-adr-004` defines article standards
40
+ - `_core-adr-006` defines research standards
47
41
  - For simple structure, flow, layout, or relationship indications, documents SHOULD prefer plain Markdown, tables, or ASCII art instead of external assets.
48
42
  - Images and other supporting files SHOULD be used only when they are materially necessary to preserve clarity, fidelity, or evidence. When used, they SHOULD live in a sibling `assets/` folder next to the document.
49
43
  - XDRs in the subject root use `.xdrs/[scope]/[type]/[subject]/assets/`
@@ -51,34 +45,98 @@ Provides clear ownership by scope, predictable navigation, and reusable decision
51
45
  - Research uses `.xdrs/[scope]/[type]/[subject]/researches/assets/`
52
46
  - Skills use `.xdrs/[scope]/[type]/[subject]/skills/[number]-[skill-name]/assets/`
53
47
  - **Scopes:**
48
+ - Short name that defines a group or a package of xdrs
54
49
  - examples: `business-x`, `business-y`, `team-43`, `_core`
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.
50
+ - `_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.
56
51
  - **Types:** `adrs`, `bdrs`, `edrs`
57
52
  - there can exist sufixes to the standard scope names (e.g: `business-x-mobileapp`, `business-y-servicedesk`)
58
- - **Subjects:** MUST be one of the following depending on the type of the XDR:
59
- - **ADR:** `principles`, `application`, `data`, `integration`, `platform`, `controls`, `operations`
60
- - **BDR:** `principles`, `marketing`, `product`, `controls`, `operations`, `organization`, `finance`, `sustainability`
61
- - **EDR:** `principles`, `application`, `infra`, `ai`, `observability`, `devops`, `governance`
53
+ - **Subjects:** MUST be one of the following depending on the type of the XDR. Use the subject to indicate the main concern of the decision.
54
+ - **ADR subjects**
55
+ - `principles`: Cross-cutting architecture and policy foundations.
56
+ - Examples: architecture style, interoperability rules, long-term technology direction.
57
+ - `application`: System and service design decisions at application level.
58
+ - Examples: modularization strategy, service decomposition, app-level security flows.
59
+ - `data`: Data architecture and information modeling choices.
60
+ - Examples: canonical schemas, data ownership boundaries, retention strategies.
61
+ - `integration`: Decisions about communication between internal/external systems.
62
+ - Examples: sync vs async patterns, contract strategy, partner integration approach.
63
+ - `platform`: Platform-level runtime and enabling capabilities.
64
+ - Examples: cloud/runtime baseline, foundational services, platform tenancy approach.
65
+ - `controls`: Architecture controls for risk, security, and compliance at a high level.
66
+ - Examples: encryption baseline, auditability requirements, policy enforcement points.
67
+ - `operations`: Operational architecture decisions.
68
+ - Examples: incident model, resilience objectives, operational ownership boundaries.
69
+ - **BDR subjects**
70
+ - `principles`: Business principles and decision criteria that guide all business areas.
71
+ - Examples: customer fairness rules, policy precedence, strategic guardrails.
72
+ - `marketing`: Go-to-market, communication, and campaign policy decisions.
73
+ - Examples: campaign approval rules, channel usage standards, positioning constraints.
74
+ - `product`: Product behavior, lifecycle, and offering decisions.
75
+ - Examples: feature rollout policy, packaging/tiers, product requirement governance.
76
+ - `controls`: Business control framework decisions.
77
+ - Examples: approval segregation, mandatory checks, exception handling policy.
78
+ - `operations`: Day-to-day business process and procedure decisions.
79
+ - Examples: support workflows, onboarding/offboarding procedures, SLA operations.
80
+ - `organization`: Structure, roles, and responsibility model decisions.
81
+ - Examples: decision rights, team topology, accountability boundaries.
82
+ - `finance`: Financial and cost-control business decisions.
83
+ - Examples: budgeting process, pricing governance, investment approval rules.
84
+ - `sustainability`: Environmental and social responsibility policy decisions.
85
+ - Examples: sustainability KPIs, reporting cadence, procurement sustainability criteria.
86
+ - **EDR subjects**
87
+ - `principles`: Engineering principles and non-functional quality defaults.
88
+ - Examples: coding standards baseline, testing philosophy, secure-by-default engineering rules.
89
+ - `application`: Code-level implementation patterns and application conventions.
90
+ - Examples: framework patterns, layer organization, API implementation conventions.
91
+ - `infra`: Infrastructure implementation and runtime operations details.
92
+ - Examples: IaC patterns, environment provisioning, network/runtime hardening details.
93
+ - `observability`: Telemetry, monitoring, alerting, and diagnostics implementation.
94
+ - Examples: log/metric/tracing standards, alert routing policy, SLO measurement approach.
95
+ - `devops`: Delivery pipeline, release automation, and developer workflow decisions.
96
+ - Examples: CI/CD stages, branch strategy, release promotion gates.
97
+ - `governance`: Engineering governance, risk controls, and compliance mechanics.
98
+ - Examples: dependency governance, approval policies, mandatory quality checks.
99
+ - If there is a README.md file in the root of the xdrs folder, always keep it up to date. Never use emojis.
100
+ - **Indexes**
101
+ - Keep a canonical index with all XDRs of a certain type+scope in `.xdrs/[scope]/[type]/index.md`
102
+ - Canonical index requirements:
103
+ - Organize XDRs by subject for easier navigation
104
+ - Add a short description of what this scope is about (responsibilities, general worries, teams involved, link to discussion process, etc)
105
+ - Add a list of other scope indexes that this scope might be related to (only add scopes that might be overridden). E.g: "business-x-mobileapp" scope could refer to "business-x" and "sensitive-data" scopes in its index list. XDRs in scopes listed last override XDRs in scopes listed first when addressing the same topic.
106
+ - Each XDR element entry in the index MUST include a short description of its content in imperative format and with fewer than 10 words. Example: "understand customer communication tone"
107
+ - Outside the scopes, keep an index pointing to all canonical indexes in `.xdrs/index.md`. Add the text "XDRs in scopes listed last override the ones listed first"
108
+ - Always verify if indexes are up to date after making changes
109
+
110
+ #### XDR document standards (decision record source of truth)
111
+
112
+ - XDRs MUST contain a clear decision about a certain problem or situation. Avoid being too verbose and focus on explaining clearly the context and the decision. Avoid adding contents that are not original. If you have other references that are important to understand the document, add links and references.
113
+ - 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.
114
+ - 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`.
115
+ - Supported XDR metadata fields are:
116
+ - `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.
117
+ - `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.
118
+ - `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`
119
+ - Before using, enforcing, or citing an XDR as a current rule, humans and AI agents MUST decide whether the decision is appliable for the current case.
120
+ - 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.
121
+ - 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.
122
+ - Check `Applied to:` next to determine whether the active, currently valid decision fits the current codebase, system, workflow, or audience.
123
+ - Check the decision context and implementation details last to determine any additional boundaries, exceptions, or qualifiers that metadata alone cannot express.
124
+ - 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.
125
+ - 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 of xdrs, but the XDR document remains the source of truth.
62
126
  - **XDR Id:** [scope]-[type]-[xdr number unique in scope] (the xdr id must be unique among all XDRs of the same type in the different scopes and always use lowercase)
63
127
  - Types in IDs: `adr`, `bdr`, `edr`
64
128
  - 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.
65
- - Decisions MUST be concise and reference other XDRs to avoid duplication
129
+ - Decisions MUST be concise and reference other XDRs to avoid duplication.
66
130
  - 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.
67
131
  - 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.
132
+ - Conflict handling applies to XDR documents:
133
+ - For cross-scope overrides, document the decision conflict in the XDR `## Conflicts` section of the XDR that overrides another scope.
134
+ - **Within-scope conflicts:** XDRs within the same type+scope must not conflict. If two XDRs appear to conflict, one should be updated, deprecated, or the conflict resolved through a new XDR.
68
135
  - When research exists for a decision, the XDR SHOULD mention the related research documents after the `## Considered Options` list.
69
- - Never use emojis in contents
70
- - Always use file names with lowercase
136
+ - Never use emojis in contents.
137
+ - Always use file names with lowercase.
71
138
  - Avoid using lengthy instructions on the XDR. If there are long and detailed instructions related to the XDR, or instructions that are outside the decision, create another file with a guide. If the guide is small, keep it in the XDR itself.
72
- - If there is a README.md file in the root of the xdrs folder, always keep it up to date. Never use emojis
73
- - Keep a canonical index with all XDRs of a certain type+scope in `.xdrs/[scope]/[type]/index.md`
74
- - Organize XDRs by subject for easier navigation
75
- - Add a list of other scope indexes that this scope might be related to (only add scopes that might be overridden). E.g: "business-x-mobileapp" scope could refer to "business-x" and "sensitive-data" scopes in its index list. XDRs in scopes listed last override XDRs in scopes listed first when addressing the same topic.
76
- - Document decision conflicts in "Conflicts" section for the XDR that is overriding another XDR in other scopes
77
- - **Within-scope conflicts:** XDRs within the same type+scope must not conflict. If two XDRs appear to conflict, one should be updated, deprecated, or the conflict resolved through a new XDR.
78
- - In the index add a short description of what is this scope about (responsibilities, general worries, teams involved, link to discussion process etc)
79
- - Outside the scopes, keep an index pointing to all canonical indexes in `.xdrs/index.md`. Add the text "XDRs in scopes listed last override the ones listed first"
80
- - Always verify if the index is up to date after making changes
81
- - XDRs should be less than 100 lines long as a rule of thumb
139
+ - XDRs should be less than 100 lines long as a rule of thumb.
82
140
  - This is important to make them focused on a clear decision
83
141
  - Exceptions can reach 200 lines (templates, more elaborate decision implementations etc)
84
142
  - ALWAYS use `_local` scope if the user doesn't explicitelly indicate a specific scope while creating an xdr or skill.
@@ -58,7 +58,7 @@ Research documents are Markdown files placed inside a subject folder alongside d
58
58
  Examples:
59
59
  - `.xdrs/_core/adrs/principles/researches/001-research-and-decision-lifecycle.md`
60
60
  - `.xdrs/business-x/adrs/platform/researches/003-api-gateway-options.md`
61
- - `.xdrs/_local/edrs/ai/researches/002-model-serving-constraints.md`
61
+ - `.xdrs/_local/edrs/application/researches/002-model-serving-constraints.md`
62
62
 
63
63
  **Research numbering**
64
64
 
@@ -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, decision-focused, and clear about when the decision should be used.
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
@@ -32,7 +35,7 @@ Guides the creation of a well-structured XDR by following the standards in `_cor
32
35
  **Subject** — pick one from the allowed list for the chosen type (from `001-xdr-standards`):
33
36
  - ADR: `principles`, `application`, `data`, `integration`, `platform`, `controls`, `operations`
34
37
  - BDR: `principles`, `marketing`, `product`, `controls`, `operations`, `organization`, `finance`, `sustainability`
35
- - EDR: `principles`, `application`, `infra`, `ai`, `observability`, `devops`, `governance`
38
+ - EDR: `principles`, `application`, `infra`, `observability`, `devops`, `governance`
36
39
 
37
40
  **XDR ID** — format: `[scope]-[type]-[next available number]`
38
41
  - Scan `.xdrs/[scope]/[type]/` for the highest existing number in that scope+type and increment by 1.
@@ -133,6 +136,7 @@ If any check fails, revise and re-run this phase before proceeding.
133
136
  ### Constraints
134
137
 
135
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.
136
140
  - MUST NOT add personal opinions or general best-practice content not tied to a decision.
137
141
  - MUST NOT create an XDR that duplicates a decision already captured in another XDR — extend or reference instead.
138
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
@@ -37,7 +40,7 @@ Quick test:
37
40
  **Subject** — pick the most specific match for the chosen type (see `003-skill-standards`):
38
41
  - ADR subjects: `principles`, `application`, `data`, `integration`, `platform`, `controls`, `operations`
39
42
  - BDR subjects: `principles`, `marketing`, `product`, `controls`, `operations`, `organization`, `finance`, `sustainability`
40
- - EDR subjects: `principles`, `application`, `infra`, `ai`, `observability`, `devops`, `governance`
43
+ - EDR subjects: `principles`, `application`, `infra`, `observability`, `devops`, `governance`
41
44
 
42
45
  **Skill number** — scan `.xdrs/[scope]/[type]/[subject]/skills/` for the highest existing number and increment by 1. Never reuse numbers from deleted skills.
43
46
 
@@ -122,6 +125,7 @@ If any check fails, revise before continuing.
122
125
  ### Constraints
123
126
 
124
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.
125
129
  - MUST NOT create a skill that duplicates an existing one — extend or reference it instead.
126
130
  - MUST keep scope `_local` unless the user explicitly states otherwise.
127
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`.
@@ -111,6 +115,13 @@ Rules to apply while drafting:
111
115
  - **Conflicting information found** — note the conflict in the article and always defer to the XDR.
112
116
  - **Article would exceed 150 lines** — move detailed content to a new Research, Skill, or XDR and link back.
113
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
+
114
125
  ## References
115
126
 
116
127
  - [_core-adr-004 - Article standards](../../../.xdrs/_core/adrs/principles/004-article-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
@@ -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 in headless mode (`--autopilot`, full tool/url permissions, and `--no-ask-user`). 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
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./testPrompt');
package/lib/lint.js CHANGED
@@ -13,7 +13,7 @@ const TYPE_TO_ID = {
13
13
  const ALLOWED_SUBJECTS = {
14
14
  adrs: new Set(['principles', 'application', 'data', 'integration', 'platform', 'controls', 'operations']),
15
15
  bdrs: new Set(['principles', 'marketing', 'product', 'controls', 'operations', 'organization', 'finance', 'sustainability']),
16
- edrs: new Set(['principles', 'application', 'infra', 'ai', 'observability', 'devops', 'governance'])
16
+ edrs: new Set(['principles', 'application', 'infra', 'observability', 'devops', 'governance'])
17
17
  };
18
18
 
19
19
  const TYPE_NAMES = new Set(Object.keys(TYPE_TO_ID));
@@ -96,32 +96,30 @@ function lintRootIndex(rootIndexPath, xdrsRoot, actualTypeIndexes, errors) {
96
96
  errors.push(`Root index is missing required override text: ${toDisplayPath(rootIndexPath)}`);
97
97
  }
98
98
 
99
- const localLinks = parseLocalLinks(content, path.dirname(rootIndexPath));
100
- for (const linkPath of localLinks) {
99
+ const links = parseLocalLinks(content, path.dirname(rootIndexPath));
100
+ for (const linkPath of links) {
101
101
  if (!fs.existsSync(linkPath)) {
102
102
  errors.push(`Broken link in root index: ${displayPath(rootIndexPath, linkPath)}`);
103
103
  }
104
104
  }
105
105
 
106
- const linkedTypeIndexes = localLinks.filter((linkPath) => isCanonicalTypeIndex(linkPath, xdrsRoot));
106
+ const linkedTypeIndexes = links.filter((linkPath) => isCanonicalTypeIndex(linkPath, xdrsRoot));
107
107
  const linkedSet = new Set(linkedTypeIndexes.map(normalizePath));
108
108
 
109
- for (const indexPath of actualTypeIndexes) {
110
- if (!linkedSet.has(normalizePath(indexPath))) {
111
- errors.push(`Root index is missing canonical index link: ${toDisplayPath(indexPath)}`);
109
+ for (const indexPath of linkedTypeIndexes) {
110
+ const scopeName = path.basename(path.dirname(path.dirname(indexPath)));
111
+ if (scopeName === '_local') {
112
+ errors.push(`Root index must not link _local canonical index: ${displayPath(rootIndexPath, indexPath)}`);
112
113
  }
113
114
  }
114
115
 
115
- let seenLocal = false;
116
- for (const indexPath of linkedTypeIndexes) {
116
+ for (const indexPath of actualTypeIndexes) {
117
117
  const scopeName = path.basename(path.dirname(path.dirname(indexPath)));
118
118
  if (scopeName === '_local') {
119
- seenLocal = true;
120
119
  continue;
121
120
  }
122
- if (seenLocal) {
123
- errors.push('Root index must keep all _local scope links after every non-_local scope link');
124
- break;
121
+ if (!linkedSet.has(normalizePath(indexPath))) {
122
+ errors.push(`Root index is missing canonical index link: ${toDisplayPath(indexPath)}`);
125
123
  }
126
124
  }
127
125
  }