xdrs-core 0.7.1 → 0.9.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.
@@ -0,0 +1,69 @@
1
+ # _core-research-001: Research and decision lifecycle
2
+
3
+ ## Overview
4
+
5
+ This research evaluates how Research should fit into the XDR model so maintainers can evolve it as a supporting artifact without weakening XDRs as the source of truth. It provides the context behind the decision captured in [_core-adr-006](../006-research-standards.md).
6
+
7
+ Question: How should a Research artifact fit into the XDR model so it supports the decision lifecycle without diluting the role of XDRs as the source of truth?
8
+
9
+ ## Constraints
10
+
11
+ - XDRs must stay concise and decision-focused.
12
+ - Supporting analysis must be easy to discover from the same subject folder.
13
+ - The new artifact must help during elaboration, discussion, approval, retirement, and updates.
14
+ - The structure must remain simple enough for humans and AI agents to navigate.
15
+
16
+ ## Findings
17
+
18
+ - Long-form option analysis does not fit well inside XDRs because it mixes evidence gathering with the adopted decision.
19
+ - Articles are useful for synthesis, but they are optimized for understanding and navigation rather than preserving the full option tradeoff study.
20
+ - Skills are procedures, not evidence. They explain how to do something, not why an option was evaluated or rejected.
21
+ - Subject-level co-location is the strongest predictor of discoverability in the current XDR model.
22
+
23
+ ## Proposals
24
+
25
+ ### Option 1: Keep research inside XDRs
26
+
27
+ Use larger XDRs and keep all exploratory analysis in the same file as the final decision.
28
+
29
+ **Pros**
30
+ - One file per decision thread.
31
+ - No new folder type to teach.
32
+
33
+ **Cons**
34
+ - Bloats XDRs and makes the adopted rule set harder to scan.
35
+ - Weakens the under-100-line guidance for decision records.
36
+
37
+ ### Option 2: Create a top-level shared research area
38
+
39
+ Store all research under a global `researches/` tree detached from subjects.
40
+
41
+ **Pros**
42
+ - Centralized catalog of studies.
43
+ - Easy to browse all research at once.
44
+
45
+ **Cons**
46
+ - Loses proximity to the decisions it informed.
47
+ - Makes subject-scoped discovery and maintenance harder.
48
+
49
+ ### Option 3: Add `researches/` beside `skills/` and `articles/`
50
+
51
+ Keep research documents under the same subject as the XDR they support.
52
+
53
+ **Pros**
54
+ - Preserves context and keeps evidence close to the decision.
55
+ - Lets XDRs stay concise while retaining detailed tradeoff history.
56
+
57
+ **Cons**
58
+ - Adds one more artifact type to explain and maintain.
59
+ - Requires linting and indexes to recognize another optional folder.
60
+
61
+ ## Recommendation
62
+
63
+ Option 3 is the best fit because it preserves the existing navigation model while separating evidence gathering from the adopted decision text.
64
+
65
+ ## References
66
+
67
+ - [_core-adr-006](../006-research-standards.md) - Decision that adopts research as a first-class artifact
68
+ - [_core-adr-001](../001-xdr-standards.md) - Base XDR structure and references
69
+ - [_core-adr-004](../004-article-standards.md) - Distinction between research and synthesis
@@ -24,7 +24,7 @@ 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 (status, impact, scope, applicability) to filter relevant XDRs before deep analysis.
27
+ - Extract metadata first (validity status and applicability) to filter relevant XDRs before deep analysis. Treat `Validity: Draft` and `Validity: Retired` as inactive policy.
28
28
  2. Filter relevance based on file types, domains, and architectural patterns in scope.
29
29
 
30
30
  ### Phase 3: XDR Review
@@ -84,6 +84,6 @@ Scope: [scope identifier]
84
84
 
85
85
  ## References
86
86
 
87
- - [_core-adr-001 - XDR standards](../../001-xdr-standards.md)
88
- - [_core-adr-003 - Skill standards](../../003-skill-standards.md)
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)
89
89
 
@@ -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, 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`, researching existing records for conflicts, checking redundancy across related artifacts, and iterating until the document is concise and decision-focused.
14
14
 
15
15
  ## Instructions
16
16
 
@@ -50,15 +50,30 @@ Choose a title that clearly states the question this XDR answers, not the answer
50
50
  1. Read all existing XDRs relevant to the topic across all scopes listed in `.xdrs/index.md`.
51
51
  2. Identify decisions that already address the topic (full or partial overlap).
52
52
  3. Note decisions that might conflict with the intended outcome.
53
- 4. Collect XDR IDs and file paths for cross-references.
53
+ 4. Read related `researches/` documents when they exist, especially if they contain constraints, findings, or option tradeoffs that should influence the decision.
54
+ 5. Collect XDR IDs and file paths for cross-references.
54
55
 
55
- ### Phase 5: Write the First Draft
56
+ ### Phase 5: Check Redundancy Across Related Artifacts
57
+
58
+ 1. Review the related XDRs, research documents, skills, articles, and guides connected to the same decision thread.
59
+ 2. Identify content that is repeated across those files, especially decision statements, applicability boundaries, mandatory rules, and rationale.
60
+ 3. Prioritize the final decision, core boundaries, and short key instructions in the XDR itself.
61
+ 4. When another document already explains details well, link to it instead of re-explaining the same content in full.
62
+ 5. Copy only short instructions or key excerpts when they materially help a reader apply the decision without leaving the XDR.
63
+ 6. Avoid repeating the same decision text across multiple related documents whenever a link or short reference is enough.
64
+
65
+ ### Phase 6: Write the First Draft
56
66
 
57
67
  Use the mandatory template from `001-xdr-standards`:
58
68
 
59
69
  ```
60
70
  # [scope]-[type]-[number]: [Short Title]
61
71
 
72
+ ## Metadata
73
+ [Optional. Include only when at least one metadata field is present]
74
+ 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
+
62
77
  ## Context and Problem Statement
63
78
  [4 lines max: background, who is impacted, and the explicit question being answered]
64
79
 
@@ -68,7 +83,7 @@ Use the mandatory template from `001-xdr-standards`:
68
83
  [One sentence: what is the decision]
69
84
 
70
85
  ### Implementation Details
71
- [Rules, specifics, examples — under 100 lines]
86
+ [Rules, applicability boundaries, concise examples, and optional do/don't guidance — under 100 lines]
72
87
 
73
88
  ## Considered Options (if meaningful options exist)
74
89
 
@@ -78,32 +93,45 @@ Use the mandatory template from `001-xdr-standards`:
78
93
  ```
79
94
 
80
95
  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.
97
+ - 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`.
81
99
  - Use mandatory language ("must", "always", "never") only for hard requirements; use advisory language ("should", "recommended") for guidance.
82
100
  - Do not duplicate content already in referenced XDRs — link instead.
101
+ - 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.
102
+ - Make clear when the decision applies and any important exception boundaries.
103
+ - Keep exploratory option analysis in a related Research document when it would distract from the final decision text.
104
+ - Prefer plain Markdown, tables, or ASCII art for simple structure, flow, layout, or relationship indications.
105
+ - If the XDR genuinely needs local images or supporting files, store them in `.xdrs/[scope]/[type]/[subject]/assets/` and link with a relative path.
83
106
  - No emojis. Lowercase filenames.
84
107
  - Target under 100 lines total; 200 lines max for complex decisions.
85
108
 
86
- ### Phase 6: Review the Draft
109
+ ### Phase 7: Review the Draft
87
110
 
88
111
  Check every item before finalizing:
89
112
 
90
113
  1. **Length**: Is it under 100 lines? Trim verbose explanations. Move detailed skills to a separate file and link.
91
- 2. **Originality**: Does every sentence add value that cannot be found in a generic web search? Remove obvious advice. Keep only the project-specific decision.
92
- 3. **Clarity**: Is the chosen option unambiguous? Is the "why" clear in one reading?
93
- 4. **Conflicts section**: Is it present and filled if Phase 3 found any conflicts?
94
- 5. **Index entries**: Will the new XDR be added to `[scope]/[type]/index.md` and `.xdrs/index.md`?
114
+ 2. **Metadata**: If metadata exists, is it directly before Context, limited to `Applied to:` / `Validity:`, and omitted entirely when both are absent?
115
+ 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
+ 4. **Clarity**: Is the chosen option unambiguous? Is the "why" clear in one reading?
117
+ 5. **Redundancy**: Is the XDR the primary source for the decision itself, with related documents linked instead of duplicated wherever possible?
118
+ 6. **Conflicts section**: Is it present and filled if Phase 3 found any conflicts?
119
+ 7. **Index entries**: Will the new XDR be added to `[scope]/[type]/index.md` and `.xdrs/index.md`?
95
120
 
96
121
  If any check fails, revise and re-run this phase before proceeding.
97
122
 
98
- ### Phase 7: Write Files
123
+ ### Phase 8: Write Files
99
124
 
100
125
  1. Create the XDR file at `.xdrs/[scope]/[type]/[subject]/[number]-[short-title].md`.
101
126
  2. Add an entry to `.xdrs/[scope]/[type]/index.md` (create the file if it does not exist).
102
127
  3. Add or verify the scope entry in `.xdrs/index.md`.
128
+ 4. If significant research was produced or already exists, link it from the XDR `## Considered Options` section.
129
+ 5. If concise rules, examples, or do/don't bullets help readers apply the decision correctly, add them inside `### Implementation Details` without turning the XDR into a long procedure.
103
130
 
104
131
  ### Constraints
105
132
 
106
133
  - MUST follow the XDR template from `001-xdr-standards` exactly.
107
134
  - MUST NOT add personal opinions or general best-practice content not tied to a decision.
108
135
  - MUST NOT create an XDR that duplicates a decision already captured in another XDR — extend or reference instead.
136
+ - MUST prefer links and short references over repeating the same decision content across related documents.
109
137
  - MUST keep scope `_local` unless the user explicitly states otherwise.
@@ -18,7 +18,7 @@ Guides the creation of a well-structured skill package by following `_core-adr-0
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 and the exact conditions under which an agent should activate it. Do NOT proceed without a clear goal and activation trigger.
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.
22
22
 
23
23
  ### Phase 2: Select Type, Scope, Subject, and Number
24
24
 
@@ -47,6 +47,7 @@ Quick test:
47
47
 
48
48
  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
49
  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.
50
51
 
51
52
  ### Phase 4: Write the SKILL.md
52
53
 
@@ -64,12 +65,12 @@ metadata:
64
65
 
65
66
  ## Overview
66
67
 
67
- [1–3 sentence goal statement.]
68
+ [1–3 sentence goal statement with the task objective, expected outcome, and relevant prerequisites or tools when they matter.]
68
69
 
69
70
  ## Instructions
70
71
 
71
72
  ### Phase 1: …
72
- [Step-by-step agent instructions organized into named phases. Use imperative language.]
73
+ [Step-by-step agent instructions organized into named phases. Use imperative language and include verification or acceptance criteria at the end of the task or major phases.]
73
74
 
74
75
  ## Examples
75
76
 
@@ -87,7 +88,12 @@ metadata:
87
88
  Rules:
88
89
  - Use imperative language ("Read …", "Ask …", "Create …").
89
90
  - The `description` field must state both *what* the skill does and *when* to activate it.
91
+ - Keep the skill task-oriented. It should have a clear starting trigger and a concrete ending result.
92
+ - Mention tools or prerequisites when they are required to complete the task reliably.
90
93
  - Do not duplicate content from referenced XDRs — link instead.
94
+ - Do not present the skill itself as policy; mandatory behavior must come from referenced XDRs or other policy artifacts.
95
+ - Prefer plain Markdown, tables, or ASCII art for simple structure, flow, layout, or relationship indications.
96
+ - 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.
91
97
  - No emojis. Lowercase filenames. Target under 500 lines.
92
98
 
93
99
  ### Phase 5: Review the Draft
@@ -98,7 +104,7 @@ Before writing files, verify:
98
104
  2. **Completeness**: Does every phase have actionable steps?
99
105
  3. **Length**: Under 500 lines? Trim verbose explanations.
100
106
  4. **Duplication**: Does this overlap an existing skill? If yes, revise.
101
- 5. **References**: Are all related XDRs and skills linked?
107
+ 5. **References**: Are all related XDRs and skills linked, including the cases where the skill operationalizes multiple XDRs?
102
108
 
103
109
  If any check fails, revise before continuing.
104
110
 
@@ -1,10 +1,7 @@
1
1
  ---
2
2
  name: 004-write-article
3
3
  description: >
4
- Creates a new article document following XDR article standards: selects scope, type, subject, and number;
5
- then writes a focused synthetic text that combines and links multiple XDRs and Skills around a topic.
6
- Activate this skill when the user asks to create, add, or write a new article, guide, or overview document
7
- within an XDR project.
4
+ Creates a new article document following XDR article standards: selects scope, type, subject, and number; then writes a focused synthetic text that combines and links multiple XDRs, Research documents, and Skills around a topic. Activate this skill when the user asks to create, add, or write a new article, guide, or overview document within an XDR project.
8
5
  metadata:
9
6
  author: flaviostutz
10
7
  version: "1.0"
@@ -12,8 +9,8 @@ metadata:
12
9
 
13
10
  ## Overview
14
11
 
15
- Guides the creation of a well-structured article by following `_core-adr-004`, researching the XDRs and
16
- Skills to synthesize, and producing a concise document that serves as a navigable view without duplicating
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
17
14
  decision content.
18
15
 
19
16
  ## Instructions
@@ -45,7 +42,7 @@ If the article spans more than one subject, place it in `principles`.
45
42
 
46
43
  ### Phase 4: Research XDRs and Skills to Synthesize
47
44
 
48
- 1. Read all XDRs and Skills relevant to the article topic across all scopes listed in `.xdrs/index.md`.
45
+ 1. Read all XDRs, Research documents, and Skills relevant to the article topic across all scopes listed in `.xdrs/index.md`.
49
46
  2. Identify the key points a reader needs to understand the topic end-to-end.
50
47
  3. Collect XDR IDs and file paths for cross-references. Never copy decision text verbatim; link to it.
51
48
 
@@ -62,7 +59,7 @@ Use the mandatory template from `004-article-standards`:
62
59
 
63
60
  ## Content
64
61
 
65
- [Synthetic text combining and explaining the topic. Use links to Decision Records and Skills
62
+ [Synthetic text combining and explaining the topic. Use links to Decision Records, Research documents, and Skills
66
63
  when referencing information from those documents. Keep under 150 lines total.]
67
64
 
68
65
  ## References
@@ -75,6 +72,8 @@ Rules to apply while drafting:
75
72
  - Write for the stated audience; avoid jargon unexplained elsewhere.
76
73
  - Every factual claim must link back to the authoritative XDR or Skill.
77
74
  - Never reproduce decision text verbatim; summarize and link.
75
+ - Prefer plain Markdown, tables, or ASCII art for simple structure, flow, layout, or relationship indications.
76
+ - 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.
78
77
  - Keep the article under 150 lines; move detailed content to XDRs or Skills.
79
78
  - Use lowercase file names. Never use emojis.
80
79
  - If a conflict exists between the article and a Decision Record, note it and defer to the XDR.
@@ -83,7 +82,7 @@ Rules to apply while drafting:
83
82
 
84
83
  1. Save the file at `.xdrs/[scope]/[type]/[subject]/articles/[number]-[short-title].md`.
85
84
  2. Add a link to the article in the canonical index for that scope+type (`.xdrs/[scope]/[type]/index.md`).
86
- 3. Add back-references in the XDRs and Skills that the article synthesizes, under their `## References`
85
+ 3. Add back-references in the XDRs, Research documents, and Skills that the article synthesizes, under their `## References`
87
86
  section.
88
87
 
89
88
  ## Examples
@@ -95,7 +94,7 @@ Rules to apply while drafting:
95
94
  2. Topic: how skills work. Audience: developers new to the project.
96
95
  3. Scope: `_local`, type: `adrs`, subject: `principles`.
97
96
  4. Scan `.xdrs/_local/adrs/principles/articles/` — no articles exist → number is `001`.
98
- 5. Research `_core-adr-003` and all existing skill SKILL.md files.
97
+ 5. Research `_core-adr-003`, `_core-adr-006`, and the existing skill SKILL.md files.
99
98
  6. Write `.xdrs/_local/adrs/principles/articles/001-skills-overview.md` following the template, linking
100
99
  to `_core-adr-003` and the individual skill files.
101
100
  7. Update `.xdrs/_local/adrs/index.md` with a link to the new article.
@@ -108,4 +107,10 @@ Rules to apply while drafting:
108
107
  - **Cross-subject topic** — place the article in `principles`, not in any single subject folder.
109
108
  - **No existing articles folder** — create it; it is optional in the folder layout.
110
109
  - **Conflicting information found** — note the conflict in the article and always defer to the XDR.
111
- - **Article would exceed 150 lines** — move detailed content to a new Skills or XDR and link back.
110
+ - **Article would exceed 150 lines** — move detailed content to a new Research, Skill, or XDR and link back.
111
+
112
+ ## References
113
+
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)
@@ -0,0 +1,256 @@
1
+ ---
2
+ name: 005-write-research
3
+ description: >
4
+ Creates a new research document following XDR research standards: selects scope, type, subject, and number;
5
+ then writes an IMRAD-based study with enough evidence and method detail to stand on its own as a technical paper.
6
+ Activate this skill when the user asks to create, add, or write a research document that backs a decision.
7
+ metadata:
8
+ author: flaviostutz
9
+ version: "1.3"
10
+ ---
11
+
12
+ ## Overview
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.
15
+
16
+ ## Instructions
17
+
18
+ ### Phase 1: Understand the Research Goal
19
+
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.
28
+
29
+ ### Phase 2: Select Scope, Type, Subject, and Number
30
+
31
+ **Scope** — use `_local` unless the user explicitly names another scope.
32
+
33
+ **Type** — match the type of decision this research supports (`adrs`, `bdrs`, or `edrs`).
34
+
35
+ **Subject** — pick the most specific subject that matches the problem domain.
36
+
37
+ **Research number** — scan `.xdrs/[scope]/[type]/[subject]/researches/` for the highest existing number and increment by 1. Never reuse numbers from deleted research documents.
38
+
39
+ ### Phase 3: Research Existing Artifacts
40
+
41
+ 1. Read relevant XDRs across all scopes listed in `.xdrs/index.md`.
42
+ 2. Read existing research documents in the same or overlapping subjects to avoid duplicating the same study.
43
+ 3. Read related skills or articles if they contain context, implementation limits, or terminology that must be reflected.
44
+ 4. Collect links that should appear in the final `## References` section.
45
+
46
+ ### Phase 4: Create the Skeleton and Frame the Study
47
+
48
+ 1. Create the final section skeleton in the research file before running the study: `Abstract`, `Introduction`, `Methods`, `Results`, `Discussion`, `Conclusion`, `References`.
49
+ 2. Write a one-line note under each section heading capturing that section's goal before filling in the content so the draft stays disciplined.
50
+ 3. Draft `## Introduction` early so the problem, scope, constraints, assumptions, and central question are fixed before evidence collection expands.
51
+ 4. Draft `## Methods` before or while executing the study so tools, data sources, and conditions are captured while they are still precise.
52
+ 5. Treat `## Abstract` as a late-stage summary. Do not try to finalize it yet.
53
+ 6. Keep process framing out of the body. If related ADRs or repository context matter, push that traceability to `## References` unless it is essential to the technical question itself.
54
+
55
+ ### Phase 5: Capture Evidence as the Study Runs
56
+
57
+ 1. As experiments, comparisons, code spikes, interviews, benchmarks, or document reviews happen, append the concrete findings to `## Results` continuously.
58
+ 2. Prefer capturing tables, bullet points, numbers, code outputs, and option comparisons while the evidence is fresh.
59
+ 3. If multiple options solve the same problem, add a comparison table and explicit pros and cons for each option in `## Results` so the trade-offs are directly inspectable.
60
+ 4. Update `## Methods` whenever the actual study design changes so the final document remains reproducible.
61
+ 5. Keep interpretation out of `## Results`; record observations first and save meaning-making for `## Discussion`.
62
+
63
+ ### Phase 6: Synthesize After Results Stabilize
64
+
65
+ 1. Write `## Discussion` only after the important findings are visible in `## Results`.
66
+ 2. Use `## Discussion` to interpret significance, trade-offs, limitations, implications, and performance considerations for technical readers.
67
+ 3. Write `## Conclusion` after the discussion so it reflects the actual findings, practical takeaway, applicability boundaries, and open questions.
68
+ 4. Write `## Abstract` last so it accurately summarizes the final goal, methods, results, and conclusion for quick technical readers.
69
+
70
+ ### Phase 7: Write the Research Document
71
+
72
+ Use the mandatory template from `006-research-standards`:
73
+
74
+ ```markdown
75
+ # [scope]-research-[number]: [Short Title]
76
+
77
+ ## Abstract
78
+
79
+ [Single paragraph summarizing the goal, methods, results, and conclusion. Goal: let a quick technical reader understand the question, method, main result, and takeaway. Under 200 words.]
80
+
81
+ ## Introduction
82
+
83
+ [Describe the problem, context, constraints, known facts, experiences, gaps, assumptions, and objectives.
84
+ Use visuals, bullets, graphs, or diagrams when helpful. Goal: explain the investigated problem, operating context, constraints, and why the subject matters. Under 700 words.]
85
+
86
+ Question: [Central question of the research]?
87
+
88
+ ## Methods
89
+
90
+ [Explain how the study was conducted, including design, tools, data sources, and test conditions.
91
+ Include enough detail for an experienced professional to reproduce the relevant parts. Goal: make the important parts of the study reproducible. Under 1200 words.]
92
+
93
+ ## Results
94
+
95
+ [Report findings, data, trends, quantitative results, code artifacts, and option comparisons.
96
+ Use figures, tables, or bullets when useful. If multiple options solve the same problem, add comparison tables and explicit pros and cons for each option. Focus on raw findings, not interpretation. Goal: present the raw findings with minimal interpretation. Under 1800 words.]
97
+
98
+ ## Discussion
99
+
100
+ [Interpret the results, explain significance, trade-offs, performance considerations, limitations, and implications. Goal: interpret the findings for technical readers. Keep this section technically engaged and under 1000 words.]
101
+
102
+ ## Conclusion
103
+
104
+ [Summarize the main findings, practical takeaway, applicability boundaries, and important open questions. Goal: summarize the main findings and what they mean in practice. Under 400 words.]
105
+
106
+ ## References
107
+
108
+ [A list of all cited literature, websites, tutorials, documentation, discussions, and related artifacts. Goal: make all cited sources and supporting artifacts traceable.]
109
+
110
+ - [Related XDR or artifact](relative/path.md) - Why it matters
111
+ - [Another related XDR if this research informed multiple decisions](relative/path.md) - Why it matters
112
+ ```
113
+
114
+ Rules:
115
+ - Treat the goal sentence of each section as a hard check on what belongs in that section.
116
+ - Focus on exploring and evidencing the problem space; do not turn the document into the final decision.
117
+ - Write as a standalone technical paper for readers who do not know the XDR process.
118
+ - Keep mentions of future ADRs, decision lifecycle, repository process, or artifact management out of the body unless they are materially necessary to understand the research question.
119
+ - Keep traceability to related XDRs, skills, articles, discussions, and external sources primarily in `## References`.
120
+ - Use good-enough evidence. Experienced professional judgment is allowed, but the conclusions still need support that other colleagues can inspect and learn from.
121
+ - Ensure the methods and test conditions are reproducible enough for an experienced professional to rerun or evolve the critical parts later.
122
+ - Prefer plain Markdown, bullet points, tables, or ASCII art for simple explanations and comparisons, especially in the introduction and results.
123
+ - If the research genuinely needs local images or supporting files, store them in `.xdrs/[scope]/[type]/[subject]/researches/assets/` and link with a relative path.
124
+ - Keep section word limits within the standard and keep the document under 5000 words total unless the introduction explicitly states that a very detailed analysis is required.
125
+
126
+ ### Phase 8: Check Section Goals
127
+
128
+ Before the final review, verify each section against its specific goal:
129
+
130
+ 1. **Abstract goal**: Does it let a quick technical reader understand the question, method, main result, and takeaway, in one paragraph and under 200 words?
131
+ 2. **Introduction goal**: Does it explain the investigated problem and context, stay within scope, and end with `Question: ...?`?
132
+ 3. **Methods goal**: Could an experienced professional reproduce the important parts that materially affect the conclusion?
133
+ 4. **Results goal**: Are the findings concrete and minimally interpreted, with comparisons and pros/cons when multiple options exist?
134
+ 5. **Discussion goal**: Does it interpret the findings rather than repeat the results?
135
+ 6. **Conclusion goal**: Does it summarize the main findings, practical takeaway, applicability boundaries, and open questions without introducing new evidence?
136
+ 7. **References goal**: Are cited sources and related artifacts traceable, including related XDRs, skills, articles, and research where relevant?
137
+
138
+ If any section fails its goal, revise that section before continuing.
139
+
140
+ ### Phase 9: Check Word Counts and Ratios
141
+
142
+ Before the final review, run a word-count pass over the draft and verify that the main body roughly follows the standard proportion `Introduction : Methods : Results : Discussion ≈ 3 : 5 : 6 : 4`.
143
+
144
+ 1. Count words by top-level `##` section after stripping Markdown syntax so lists, tables, and links count as prose rather than punctuation.
145
+ 2. Compare only `Introduction`, `Methods`, `Results`, and `Discussion` for the ratio check.
146
+ 3. Use these target shares of the main body: `Introduction = 16.7%`, `Methods = 27.8%`, `Results = 33.3%`, `Discussion = 22.2%`.
147
+ 4. Treat any section as out of ratio when its share differs by more than 25% from its target share, unless the `## Introduction` explicitly justifies a very detailed or intentionally unbalanced analysis.
148
+ 5. If the ratio check fails, rebalance the draft before final review instead of accepting the imbalance silently.
149
+ 6. Use this Python script when you need a fast deterministic check:
150
+
151
+ ```python
152
+ from pathlib import Path
153
+ import re
154
+
155
+ path = Path(".xdrs/[scope]/[type]/[subject]/researches/[number]-[short-title].md")
156
+ text = path.read_text(encoding="utf-8")
157
+
158
+ sections = {}
159
+ current = None
160
+ for line in text.splitlines():
161
+ if line.startswith("## "):
162
+ current = line[3:].strip()
163
+ sections[current] = []
164
+ continue
165
+ if line.startswith("# "):
166
+ continue
167
+ if current is not None:
168
+ sections[current].append(line)
169
+
170
+
171
+ def count_words(markdown: str) -> int:
172
+ cleaned = markdown
173
+ cleaned = re.sub(r"^\|(?:\s*[-:]+\s*\|)+\s*$", " ", cleaned, flags=re.M)
174
+ cleaned = re.sub(r"```[\s\S]*?```", " ", cleaned)
175
+ cleaned = re.sub(r"`([^`]*)`", r"\1", cleaned)
176
+ cleaned = re.sub(r"!\[([^\]]*)\]\([^)]*\)", r"\1", cleaned)
177
+ cleaned = re.sub(r"\[([^\]]+)\]\([^)]*\)", r"\1", cleaned)
178
+ cleaned = re.sub(r"^#+\s+", "", cleaned, flags=re.M)
179
+ cleaned = re.sub(r"[|*_>#-]", " ", cleaned)
180
+ cleaned = re.sub(r"[^\w'’]+", " ", cleaned, flags=re.UNICODE)
181
+ words = cleaned.strip().split()
182
+ return len(words)
183
+
184
+
185
+ targets = {
186
+ "Introduction": 3,
187
+ "Methods": 5,
188
+ "Results": 6,
189
+ "Discussion": 4,
190
+ }
191
+
192
+ counts = {name: count_words("\n".join(lines)) for name, lines in sections.items()}
193
+ total_words = sum(counts.values())
194
+ body_total = sum(counts.get(name, 0) for name in targets)
195
+ target_weight_total = sum(targets.values())
196
+
197
+ print(f"TOTAL\t{total_words}")
198
+ for name, count in counts.items():
199
+ print(f"{name}\t{count}")
200
+
201
+ print("\nRATIO CHECK")
202
+ for name, weight in targets.items():
203
+ actual_share = counts.get(name, 0) / body_total if body_total else 0
204
+ target_share = weight / target_weight_total
205
+ delta = ((actual_share - target_share) / target_share) if target_share else 0
206
+ status = "OK" if abs(delta) <= 0.25 else "REVISE"
207
+ print(
208
+ f"{name}: actual={actual_share:.1%} target={target_share:.1%} delta={delta:+.1%} {status}"
209
+ )
210
+ ```
211
+
212
+ ### Phase 10: Review the Draft
213
+
214
+ Before writing files, verify:
215
+
216
+ 1. **Problem clarity**: Is the research question explicit?
217
+ 2. **Section discipline**: Does each section contain the right kind of content with minimal duplication?
218
+ 3. **Method quality**: Could an experienced professional reproduce or extend the important parts of the study from the methods section?
219
+ 4. **Evidence quality**: Are the results concrete enough to support the discussion and conclusion?
220
+ 5. **Standalone focus**: Does the text read as a technical paper rather than commentary about future ADRs, repository process, or artifact management?
221
+ 6. **Ratio fit**: Does the document stay within section word limits and pass the Python ratio check, or does the introduction explicitly justify the deviation?
222
+ 7. **References**: Are all related XDRs, research docs, skills, articles, and external sources linked when relevant?
223
+
224
+ If any check fails, revise before continuing.
225
+
226
+ ### Phase 11: Write Files
227
+
228
+ 1. Create the research file at `.xdrs/[scope]/[type]/[subject]/researches/[number]-[short-title].md`.
229
+ 2. Add an entry to `.xdrs/[scope]/[type]/index.md`.
230
+ 3. Add back-references from the related XDR, article, or skill when the relationship is important for discovery.
231
+
232
+ ## Examples
233
+
234
+ **Input**: "Create research comparing package distribution options for our XDR scopes"
235
+
236
+ **Expected actions:**
237
+ 1. Read `006-research-standards.md`.
238
+ 2. Choose type `adrs` and subject `principles`.
239
+ 3. Scan `.xdrs/_local/adrs/principles/researches/` for the next number.
240
+ 4. Read related XDRs about packaging and versioning.
241
+ 5. Write an IMRAD-based research document comparing options such as npm package, git submodule, and copy-paste distribution, with the comparison grounded in methods and results.
242
+ 6. Add references to the resulting XDR if a decision is later created.
243
+
244
+ ## Edge Cases
245
+
246
+ - If the user is really asking for a final decision, write an XDR instead of research.
247
+ - If only one viable option exists, still explain what was evaluated, what was ruled out, or what constraints removed the alternatives.
248
+ - If the document grows too large, split independent problem threads into separate research files unless the introduction explicitly justifies a longer study.
249
+ - If the supported decision does not exist yet, reference the decision topic or planned XDR title in the introduction and conclusion.
250
+ - If the user's direction, evidence base, or intended next step is vague, ask follow-up questions and wait for clarification instead of choosing a path yourself.
251
+
252
+ ## References
253
+
254
+ - [_core-adr-006 - Research standards](../../006-research-standards.md)
255
+ - [_core-adr-001 - XDR standards](../../001-xdr-standards.md)
256
+ - [002-write-xdr skill](../002-write-xdr/SKILL.md)
package/AGENTS.md CHANGED
@@ -19,6 +19,4 @@
19
19
  5. **Do not perform git operations unless explicitelly asked**
20
20
  - The developer should be in control of possible destructive operations on the workspace
21
21
 
22
- Check for additional instructions on [AGENTS.local.md](AGENTS.local.md).
23
-
24
22
  **This AGENTS.md file was created with xdrs-core and shouldn't be changed**