@guiho/xdocs 0.3.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/DOCS.md +60 -27
  3. package/README.md +49 -18
  4. package/docs/2026-07-05-xdocs-document-model.md +77 -0
  5. package/docs/docs.xdocs.md +22 -0
  6. package/jsr.json +1 -1
  7. package/library/agents.d.ts +1 -1
  8. package/library/agents.d.ts.map +1 -1
  9. package/library/agents.js +10 -6
  10. package/library/commands/generate.d.ts.map +1 -1
  11. package/library/commands/generate.js +23 -1
  12. package/library/commands/list.d.ts.map +1 -1
  13. package/library/commands/list.js +14 -4
  14. package/library/commands/merge.d.ts.map +1 -1
  15. package/library/commands/merge.js +12 -1
  16. package/library/commands/scan.d.ts.map +1 -1
  17. package/library/commands/scan.js +13 -2
  18. package/library/config.d.ts.map +1 -1
  19. package/library/config.js +7 -3
  20. package/library/discovery.d.ts +8 -4
  21. package/library/discovery.d.ts.map +1 -1
  22. package/library/discovery.js +107 -17
  23. package/library/flags.d.ts +1 -1
  24. package/library/flags.js +1 -1
  25. package/library/guiho-xdocs.d.ts +2 -2
  26. package/library/guiho-xdocs.d.ts.map +1 -1
  27. package/library/guiho-xdocs.js +1 -1
  28. package/library/help.js +16 -15
  29. package/library/metadata.d.ts +1 -1
  30. package/library/metadata.d.ts.map +1 -1
  31. package/library/metadata.js +23 -3
  32. package/library/tree.d.ts +1 -1
  33. package/library/tree.d.ts.map +1 -1
  34. package/library/tree.js +2 -2
  35. package/library/types.d.ts +14 -2
  36. package/library/types.d.ts.map +1 -1
  37. package/package.json +4 -1
  38. package/prompts/agents.md +9 -2
  39. package/prompts/generate.md +10 -2
  40. package/prompts/prompts.xdocs.md +27 -0
  41. package/prompts/update.md +19 -7
  42. package/prompts/write.md +18 -5
  43. package/scripts/scripts.xdocs.md +5 -0
  44. package/skills/guiho-s-xdocs/SKILL.md +133 -32
  45. package/skills/guiho-s-xdocs/guiho-s-xdocs.xdocs.md +26 -0
  46. package/skills/skills.xdocs.md +9 -4
package/library/tree.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
3
  */
4
4
  import type { XDocsFile, XDocsTreeNode, XDocsTreeValidation } from './types.js';
5
- /** Build a hierarchy tree from a list of xdocs files. */
5
+ /** Build a hierarchy tree from a list of xdocs descriptors. */
6
6
  export declare const buildTree: (files: XDocsFile[]) => XDocsTreeNode;
7
7
  /** Validate tree integrity. */
8
8
  export declare const validateTree: (files: XDocsFile[]) => XDocsTreeValidation;
@@ -1 +1 @@
1
- {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../source/tree.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAE/E,yDAAyD;AACzD,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,EAAE,KAAG,aA8D9C,CAAA;AAED,+BAA+B;AAC/B,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,EAAE,KAAG,mBAmCjD,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,UAAU,GAAI,MAAM,aAAa,EAAE,eAAU,KAAG,MAe5D,CAAA;AAED,iCAAiC;AACjC,eAAO,MAAM,kBAAkB,GAAI,MAAM,aAAa,EAAE,eAAU,KAAG,MAWpE,CAAA"}
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../source/tree.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAE/E,+DAA+D;AAC/D,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,EAAE,KAAG,aA8D9C,CAAA;AAED,+BAA+B;AAC/B,eAAO,MAAM,YAAY,GAAI,OAAO,SAAS,EAAE,KAAG,mBAmCjD,CAAA;AAED,gDAAgD;AAChD,eAAO,MAAM,UAAU,GAAI,MAAM,aAAa,EAAE,eAAU,KAAG,MAe5D,CAAA;AAED,iCAAiC;AACjC,eAAO,MAAM,kBAAkB,GAAI,MAAM,aAAa,EAAE,eAAU,KAAG,MAWpE,CAAA"}
package/library/tree.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @copyright Copyright (c) 2026 GUIHO Technologies as represented by Cristóvão GUIHO. All Rights Reserved.
3
3
  */
4
- /** Build a hierarchy tree from a list of xdocs files. */
4
+ /** Build a hierarchy tree from a list of xdocs descriptors. */
5
5
  export const buildTree = (files) => {
6
6
  const nodeMap = new Map();
7
7
  // Create nodes for every file with valid metadata
@@ -47,7 +47,7 @@ export const buildTree = (files) => {
47
47
  if (!root) {
48
48
  root = {
49
49
  subject: '(root)',
50
- description: 'No root xdocs file found.',
50
+ description: 'No root xdocs descriptor found.',
51
51
  path: null,
52
52
  children: [...nodeMap.values()].filter((node) => !files.some((f) => f.metadata && f.metadata.children.includes(node.subject))),
53
53
  };
@@ -61,23 +61,33 @@ export type XDocsAgentSettings = {
61
61
  autoSkillInstall: boolean;
62
62
  skillTool: XDocsAgentTool;
63
63
  };
64
- /** YAML frontmatter metadata from an xdocs file. */
64
+ /** YAML frontmatter metadata from an xdocs descriptor. */
65
65
  export type XDocsMetadata = {
66
66
  subject: string;
67
67
  description: string;
68
68
  parent: string | null;
69
69
  children: string[];
70
70
  files: Record<string, string>;
71
+ documents: Record<string, string>;
71
72
  tags: string[];
73
+ keywords: string[];
72
74
  flags: string[];
73
75
  status?: string;
74
76
  };
75
- /** A discovered xdocs file with its path and parsed metadata. */
77
+ /** A sibling Markdown document listed by a module descriptor. */
78
+ export type XDocsMarkdownDocument = {
79
+ path: string;
80
+ relativePath: string;
81
+ directory: string;
82
+ name: string;
83
+ };
84
+ /** A discovered xdocs descriptor with its path and parsed metadata. */
76
85
  export type XDocsFile = {
77
86
  path: string;
78
87
  relativePath: string;
79
88
  directory: string;
80
89
  metadata: XDocsMetadata | null;
90
+ documents: XDocsMarkdownDocument[];
81
91
  body: string;
82
92
  valid: boolean;
83
93
  errors: string[];
@@ -112,9 +122,11 @@ export type XDocsCliOptions = {
112
122
  export type XDocsScanResult = {
113
123
  totalFiles: number;
114
124
  totalDirectories: number;
125
+ totalMarkdownDocuments: number;
115
126
  coveredDirectories: number;
116
127
  uncoveredDirectories: number;
117
128
  xdocsFiles: XDocsFile[];
129
+ markdownDocuments: XDocsMarkdownDocument[];
118
130
  uncoveredPaths: string[];
119
131
  };
120
132
  /** Available prompt names for xdocs prompt --name. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../source/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,iDAAiD;AACjD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAA;AAEtD,kDAAkD;AAClD,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE3C,2CAA2C;AAC3C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEzG;;;;iCAIiC;AACjC,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEhD,4CAA4C;AAC5C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEhD,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,OAAO,CAAC;QAClB,SAAS,EAAE,MAAM,EAAE,CAAA;KACpB,CAAC,CAAA;IACF,EAAE,EAAE,OAAO,CAAC;QACV,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;IACF,IAAI,EAAE,OAAO,CAAC;QAC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AED,uEAAuE;AACvE,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,cAAc,CAAA;IACpB,KAAK,EAAE,eAAe,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,gEAAgE;AAChE,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,gFAAgF;AAChF,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,QAAQ,CAAC,EAAE,6BAA6B,CAAA;IACxC,WAAW,CAAC,EAAE,uBAAuB,CAAA;CACtC,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@guiho/xdocs",
3
3
  "description": "Structured documentation system for codebases. Helps AI make sense of projects.",
4
- "version": "0.3.1",
4
+ "version": "0.4.2",
5
5
  "type": "module",
6
6
  "main": "./library/guiho-xdocs.js",
7
7
  "types": "./library/guiho-xdocs.d.ts",
@@ -40,6 +40,9 @@
40
40
  "url": "https://guiho.co/cg"
41
41
  },
42
42
  "sideEffects": false,
43
+ "trustedDependencies": [
44
+ "@guiho/mirror"
45
+ ],
43
46
  "publishConfig": {
44
47
  "access": "public"
45
48
  },
package/prompts/agents.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: agents
3
3
  description: Update AGENTS.md with xdocs instructions for AI agents.
4
+ keywords:
5
+ - AGENTS.md
6
+ - agent instructions
7
+ - xdocs skill
4
8
  ---
5
9
 
6
10
  # xdocs: Update AGENTS.md
@@ -14,8 +18,11 @@ You are an AI assistant tasked with updating the AGENTS.md file to include xdocs
14
18
  3. If the section exists, update it with the current xdocs configuration.
15
19
  4. If the section does not exist, add it at the end of the file.
16
20
  5. The xdocs section should instruct AI agents to:
17
- - Read XDOCS.md and xdocs files when entering the project
21
+ - Read XDOCS.md and named `*.xdocs.md` descriptor files when entering the project
18
22
  - Respect the configured AI behavior mode (prompt or auto)
19
23
  - Use the xdocs CLI for documentation operations
20
- - Maintain xdocs files when modifying code
24
+ - Maintain xdocs descriptors and companion-document metadata when modifying code
25
+ - Use only named `*.xdocs.md` descriptors, never nameless `.xdocs.md` files
26
+ - List every same-directory plain `*.md` companion document in the descriptor's `documents` metadata map
27
+ - Maintain `keywords` in both descriptor and companion Markdown frontmatter
21
28
  - Follow the metadata schema for frontmatter
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: generate
3
3
  description: Generate comprehensive documentation for a domain or entire project.
4
+ keywords:
5
+ - generate documentation
6
+ - comprehensive docs
7
+ - project summary
4
8
  ---
5
9
 
6
10
  # xdocs: Generate Comprehensive Documentation
@@ -9,18 +13,22 @@ You are an AI assistant tasked with generating comprehensive documentation for a
9
13
 
10
14
  ## Instructions
11
15
 
12
- 1. Scan all xdocs files in the target scope (directory or project).
13
- 2. Read every source file in the scope.
16
+ 1. Scan all xdocs descriptors in the target scope (directory or project).
17
+ 2. Read every named `*.xdocs.md` descriptor's YAML frontmatter first, then read
18
+ source files and same-directory plain `*.md` documents only when needed.
14
19
  3. Build a complete understanding of:
15
20
  - The module hierarchy
16
21
  - The purpose of each module
17
22
  - How modules relate to each other
18
23
  - What each file does
24
+ - Which companion Markdown documents belong to each module
25
+ - Which keywords identify each module and companion document
19
26
  4. Generate a single comprehensive Markdown document that includes:
20
27
  - Project or domain overview
21
28
  - Complete hierarchy tree
22
29
  - Detailed description of each module
23
30
  - File listings with descriptions
31
+ - Companion document listings with descriptions
24
32
  - Cross-references between related modules
25
33
  5. The output should be a self-contained document that fully describes the scope.
26
34
  6. Use clear headings, consistent formatting, and concise language.
@@ -0,0 +1,27 @@
1
+ ---
2
+ subject: xdocs-prompts
3
+ description: Runtime prompt templates used by xdocs prompt commands and embedded into native binaries.
4
+ parent: xdocs-package
5
+ children: []
6
+ files: {}
7
+ documents:
8
+ agents.md: Prompt for updating AGENTS.md with xdocs instructions.
9
+ generate.md: Prompt for generating comprehensive documentation from xdocs metadata.
10
+ update.md: Prompt for updating existing xdocs descriptors after code or document changes.
11
+ write.md: Prompt for writing a named xdocs descriptor for a module.
12
+ tags:
13
+ - prompts
14
+ - ai
15
+ - documentation
16
+ keywords:
17
+ - prompts
18
+ - AI instructions
19
+ - documentation generation
20
+ flags: []
21
+ status: stable
22
+ ---
23
+
24
+ The `prompts/` directory contains Markdown prompt templates loaded by
25
+ `source/prompts.ts` at runtime and embedded by `source/embedded-resources.ts` for
26
+ native binaries. They are plain companion documents, so this descriptor lists
27
+ each prompt under `documents`.
package/prompts/update.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: update
3
- description: Update existing xdocs files after code changes.
3
+ description: Update existing xdocs descriptors after code or document changes.
4
+ keywords:
5
+ - update descriptor
6
+ - synchronize metadata
7
+ - documentation maintenance
4
8
  ---
5
9
 
6
10
  # xdocs: Update Documentation
@@ -10,22 +14,30 @@ You are an AI assistant tasked with updating existing xdocs documentation after
10
14
  ## Instructions
11
15
 
12
16
  1. Identify which files have changed in the recent modifications.
13
- 2. Find the xdocs files that document the directories containing those changes.
14
- 3. For each affected xdocs file:
17
+ 2. Find the named `*.xdocs.md` descriptor files that document the directories
18
+ containing those changes. There must be exactly one descriptor per directory,
19
+ and it must not be named only `.xdocs.md`.
20
+ 3. For each affected xdocs descriptor:
15
21
  a. Re-read the files listed in the metadata to check if descriptions are still accurate.
16
22
  b. Check if new files were added that need to be listed.
17
23
  c. Check if files were removed that should be unlisted.
18
- d. Update the description if the module's purpose has changed.
19
- e. Update children if subdirectories were added or removed.
20
- f. Update the body content if significant changes occurred.
21
- 4. Preserve the existing structure and style of the xdocs file.
24
+ d. Check if sibling plain `*.md` documents were added or removed, and keep
25
+ the `documents` metadata map exact.
26
+ e. Update the description if the module's purpose has changed.
27
+ f. Update `keywords` if the module's searchable concepts changed.
28
+ g. Update children if subdirectories were added or removed.
29
+ h. Update the body content if significant changes occurred.
30
+ 4. Preserve the existing structure and style of the xdocs descriptor.
22
31
  5. Do not remove information that is still accurate.
23
32
 
24
33
  ## Checklist
25
34
 
26
35
  - [ ] All new files are listed in the files metadata
27
36
  - [ ] Removed files are no longer listed
37
+ - [ ] All sibling plain Markdown documents are listed in the documents metadata
38
+ - [ ] Removed Markdown documents are no longer listed
28
39
  - [ ] File descriptions are accurate
29
40
  - [ ] Module description reflects current state
41
+ - [ ] Keywords reflect current searchable concepts
30
42
  - [ ] Children list matches actual subdirectories
31
43
  - [ ] Parent reference is still correct
package/prompts/write.md CHANGED
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: write
3
- description: Scan a directory and write a new xdocs documentation file for it.
3
+ description: Scan a directory and write a new named xdocs descriptor for it.
4
+ keywords:
5
+ - write descriptor
6
+ - xdocs metadata
7
+ - module documentation
4
8
  ---
5
9
 
6
10
  # xdocs: Write Documentation
@@ -12,19 +16,25 @@ You are an AI assistant tasked with writing xdocs documentation for a directory/
12
16
  1. Scan the target directory and all its subdirectories.
13
17
  2. Read every source file to understand what it does.
14
18
  3. Identify the purpose of this module/directory.
15
- 4. Create an xdocs file with YAML frontmatter containing:
19
+ 4. Create a named xdocs descriptor with YAML frontmatter containing:
16
20
  - subject: A short identifier for this module
17
21
  - description: A concise description of what this module does
18
22
  - parent: The parent module's subject (or null if this is a root module)
19
23
  - children: List of child module subjects
20
24
  - files: Map of filename to short description for each file
25
+ - documents: Map of same-directory plain Markdown filename to short description
21
26
  - tags: Relevant tags (empty array if none)
27
+ - keywords: Search terms and concepts that should help agents match requests
22
28
  - flags: Relevant flags (empty array if none)
23
29
  5. Write a Markdown body below the frontmatter with:
24
30
  - An overview section explaining the module in more detail
25
31
  - Usage examples if relevant
26
32
  - Any important notes or caveats
27
- 6. Name the file as `<module-name>.xdocs.md` in the target directory.
33
+ 6. Name the file as `<module-name>.xdocs.md` in the target directory. Never name
34
+ a file only `.xdocs.md`; `.xdocs.md` is the extension, not the full filename.
35
+ 7. Use only `.xdocs.md` for xdocs descriptors. Do not create `.docs.md` files.
36
+ 8. If the directory contains sibling plain `*.md` files, list each one under
37
+ `documents` in this descriptor.
28
38
 
29
39
  ## Frontmatter Template
30
40
 
@@ -37,9 +47,12 @@ children:
37
47
  - child-a
38
48
  - child-b
39
49
  files:
40
- - file-a.ts: What file-a does.
41
- - file-b.ts: What file-b does.
50
+ file-a.ts: What file-a does.
51
+ file-b.ts: What file-b does.
52
+ documents:
53
+ implementation-notes.md: What this companion document explains.
42
54
  tags: []
55
+ keywords: []
43
56
  flags: []
44
57
  ---
45
58
  ```
@@ -6,10 +6,15 @@ children: []
6
6
  files:
7
7
  xdocs-bin.ts: Shipped Bun launcher used as the package bin; installs the native binary on first run when needed and delegates to it.
8
8
  install-package.ts: Package-manager install helper that downloads or copies the matching GitHub Release native binary into vendor/xdocs or vendor/xdocs.exe.
9
+ documents: {}
9
10
  tags:
10
11
  - install
11
12
  - native-binary
12
13
  - package-manager
14
+ keywords:
15
+ - package launcher
16
+ - native binary
17
+ - vendor install
13
18
  flags: []
14
19
  status: stable
15
20
  ---
@@ -1,15 +1,30 @@
1
1
  ---
2
2
  name: guiho-s-xdocs
3
- version: 0.3.0
4
- description: Use this skill whenever the user works with xdocs (`@guiho/xdocs`) structured documentation, AND proactively whenever you create a new module or subdirectory or add/change/remove files in a directory of an xdocs project, so you create or update that directory's `.xdocs.md` as part of the change. This includes creating, updating, or regenerating `.docs.md` / `.xdocs.md` files, the root `XDOCS.md`, the project tree, scanning documentation coverage, merging docs, or maintaining xdocs metadata and AGENTS.md guidance, even when the user only says "document this module", "update the docs", or "what does this folder do" without naming xdocs.
3
+ version: 0.4.0
4
+ purpose: Teach AI agents how to maintain xdocs descriptor files, companion Markdown documents, metadata, and tree integrity.
5
+ description: Use this skill whenever the user works with xdocs (`@guiho/xdocs`) structured documentation, AND proactively whenever you create a new module or subdirectory or add/change/remove files in a directory of an xdocs project, so you create or update that directory's named `*.xdocs.md` descriptor as part of the change. This includes creating, updating, or regenerating `*.xdocs.md` descriptor files, companion Markdown documents, the root `XDOCS.md`, the project tree, scanning documentation coverage, merging docs, or maintaining xdocs metadata and AGENTS.md guidance, even when the user only says "document this module", "update the docs", or "what does this folder do" without naming xdocs.
6
+ created: 2026-07-06
7
+ flags:
8
+ - automatic-documentation-maintenance
9
+ - companion-document-metadata
10
+ tags:
11
+ - xdocs
12
+ - documentation
13
+ - agents
14
+ keywords:
15
+ - xdocs
16
+ - structured documentation
17
+ - companion documents
18
+ - agent workflow
19
+ owner: xdocs-guiho-s-xdocs-skill
5
20
  ---
6
21
 
7
22
  # GUIHO XDocs
8
23
 
9
- GUIHO XDocs is a deterministic CLI and TypeScript library for **structured documentation of codebases**. It lets an AI agent understand a project without reading every source file: each directory carries a small Markdown file with YAML frontmatter that describes its subject, purpose, files, and place in a parent-child hierarchy.
24
+ GUIHO XDocs is a deterministic CLI and TypeScript library for **structured documentation of codebases**. It lets an AI agent understand a project without reading every source file: each documented directory carries one named `*.xdocs.md` descriptor with YAML frontmatter that describes its subject, purpose, files, companion Markdown documents, and place in a parent-child hierarchy.
10
25
 
11
26
  ```text
12
- source tree -> xdocs files (.docs.md / .xdocs.md) -> tree + metadata -> AI-readable map
27
+ source tree -> named *.xdocs.md descriptors + companion *.md documents -> tree + metadata -> AI-readable map
13
28
  ```
14
29
 
15
30
  Use xdocs for documentation work instead of ad hoc README sprawl or re-reading the whole codebase. The value of xdocs is that the structure (subjects, descriptions, files, parent/child links) is machine-readable and stays close to the code it describes.
@@ -28,15 +43,16 @@ xdocs is a Bun/TypeScript ESM tool. Bun is the recommended runtime. The CLI neve
28
43
 
29
44
  ## Core Concepts
30
45
 
31
- - **xdocs file**: a Markdown file with YAML frontmatter that documents one directory/module. Default extensions are `.docs.md` and `.xdocs.md`. Extensions are configurable in `xdocs.config.toml`.
46
+ - **xdocs descriptor**: a named Markdown file ending in `.xdocs.md` with YAML frontmatter that documents one directory/module. There is exactly one descriptor per documented directory. The file must have a name such as `authentication.xdocs.md`; a file named only `.xdocs.md` is invalid.
47
+ - **Companion document**: a same-directory plain Markdown file ending in `.md` but not `.xdocs.md` and not `XDOCS.md`. Every companion document must be listed in the descriptor's `documents` metadata map, and ordinary companion documents should carry their own YAML frontmatter with `name`, `purpose`, `description`, `created`, `flags`, `tags`, `keywords`, and `owner`.
32
48
  - **Repository root index**: there is exactly one `XDOCS.md` per repository, at the repo root. It has **no frontmatter** — it is a plain index that lists the repository's packages and applications, and it is not itself a tree node.
33
49
  - **Package/application root**: each package or application has its own root `.xdocs.md` file (with frontmatter and `parent: null`) that is the top of that package's documentation tree. `XDOCS.md` lists these package roots.
34
- - **Tree**: a parent-child **containment** hierarchy (not a dependency graph), assembled from each `.xdocs.md` / `.docs.md` file's `subject` / `parent` / `children` fields. A module's `parent` is the `subject` of the module that contains it; a package/application root uses `parent: null`.
50
+ - **Tree**: a parent-child **containment** hierarchy (not a dependency graph), assembled from each `.xdocs.md` descriptor's `subject` / `parent` / `children` fields. A module's `parent` is the `subject` of the module that contains it; a package/application root uses `parent: null`.
35
51
  - **AI mode**: `xdocs.config.toml` `[ai].mode` is either `"prompt"` (announce the documentation updates, then write them) or `"auto"` (write immediately). It governs *how* you write docs, not *whether* — documenting a changed module is always required (see Automatic Documentation Maintenance).
36
52
 
37
53
  ### Metadata schema (YAML frontmatter)
38
54
 
39
- Every `.xdocs.md` / `.docs.md` file carries frontmatter with these fields. The repository's single `XDOCS.md` is the exception: it has no frontmatter and is just an index.
55
+ Every `*.xdocs.md` descriptor carries frontmatter with these fields. The repository's single `XDOCS.md` is the exception: it has no frontmatter and is just an index.
40
56
 
41
57
  | Field | Type | Meaning |
42
58
  | ------------- | --------------------- | ------------------------------------------------------------ |
@@ -45,29 +61,74 @@ Every `.xdocs.md` / `.docs.md` file carries frontmatter with these fields. The r
45
61
  | `parent` | string \| null | `subject` of the containing module; `null` for a package/application root. |
46
62
  | `children` | string[] | `subject`s of directly contained modules. |
47
63
  | `files` | map<string,string> | Filename -> short description of each significant file. |
64
+ | `documents` | map<string,string> | Same-directory plain Markdown filename -> short description. |
48
65
  | `tags` | string[] | Free-form classification labels. |
66
+ | `keywords` | string[] | Search terms and concepts agents can use to match requests. |
49
67
  | `flags` | string[] | Behavioral markers for tools/agents. |
50
68
  | `status` | string (optional) | Lifecycle marker (e.g. `stable`, `draft`, `deprecated`). |
51
69
 
52
- Keep `subject` values unique across the project, keep `parent`/`children` consistent in both directions, and keep `files` in sync with what is actually on disk.
70
+ Keep `subject` values unique across the project, keep `parent`/`children` consistent in both directions, keep `files` in sync with implementation files, and keep `documents` in sync with same-directory plain Markdown files.
71
+
72
+ ### Companion document metadata (YAML frontmatter)
73
+
74
+ Ordinary same-directory companion Markdown documents also use YAML frontmatter.
75
+ This metadata makes the document useful before an agent reads the whole body.
76
+ The `owner` field must be the `subject` of the same-directory xdocs descriptor
77
+ that owns the document.
78
+
79
+ ```yaml
80
+ ---
81
+ name: authentication-implementation
82
+ purpose: Explain the implementation details and decisions behind authentication.
83
+ description: Detailed notes for login, password verification, and session behavior.
84
+ created: 2026-07-06
85
+ flags: []
86
+ tags:
87
+ - security
88
+ keywords:
89
+ - login
90
+ - password verification
91
+ - sessions
92
+ owner: auth
93
+ ---
94
+ ```
95
+
96
+ Companion document fields:
97
+
98
+ | Field | Type | Meaning |
99
+ | ------------- | ---------- | -------------------------------------------------------------- |
100
+ | `name` | string | Stable document name or title. |
101
+ | `purpose` | string | Why this document exists and what question it answers. |
102
+ | `description` | string | One-line summary of the document's contents. |
103
+ | `created` | string | Creation date in `YYYY-MM-DD` format. |
104
+ | `flags` | string[] | Behavioral markers for tools/agents. |
105
+ | `tags` | string[] | Free-form classification labels. |
106
+ | `keywords` | string[] | Search terms and concepts agents can use to match requests. |
107
+ | `owner` | string | Owning xdocs descriptor `subject` in the same directory. |
108
+
109
+ Special-purpose Markdown files that already have a required host schema, such
110
+ as prompt templates or `SKILL.md`, must preserve their required host fields.
111
+ When compatible, add the companion metadata fields as well.
53
112
 
54
113
  ## Automatic Documentation Maintenance (core responsibility)
55
114
 
56
- Maintaining xdocs files is an **automatic, built-in responsibility — not a task the user has to request.** Treat it as part of the definition of done for every code change in an xdocs project. The user should never have to ask you to document a module; you do it as a reflex whenever you touch one.
115
+ Maintaining xdocs descriptors is an **automatic, built-in responsibility — not a task the user has to request.** Treat it as part of the definition of done for every code change in an xdocs project. The user should never have to ask you to document a module; you do it as a reflex whenever you touch one.
57
116
 
58
- **Trigger.** Whenever you, as the agent, do any of the following, you must create or update the affected directory's xdocs file in the *same unit of work*, before you consider the task finished:
117
+ **Trigger.** Whenever you, as the agent, do any of the following, you must create or update the affected directory's named xdocs descriptor in the *same unit of work*, before you consider the task finished:
59
118
 
60
119
  - Create a new directory, module, or subpackage.
61
120
  - Add, rename, move, or delete significant files in a directory.
121
+ - Add, rename, move, or delete sibling plain Markdown documents in a directory.
62
122
  - Change what a module does, what it exposes, or how it relates to its parent or children.
63
123
 
64
124
  **Action.**
65
125
 
66
- - If the directory has **no** xdocs file, create one (for example `<name>.xdocs.md`) in that directory.
67
- - If it **already** has one, update it so it matches the new reality.
126
+ - If the directory has **no** xdocs descriptor, create one named `<name>.xdocs.md` in that directory.
127
+ - If it **already** has one, update it so it matches the new reality. If there is more than one descriptor, consolidate to one.
128
+ - Never create or keep a descriptor named only `.xdocs.md`. `.xdocs.md` is the extension, not the whole filename.
68
129
  - Then fix the parent/child links and verify with `<xdocs> tree`.
69
130
 
70
- **What every module's xdocs file must capture:**
131
+ **What every module's xdocs descriptor must capture:**
71
132
 
72
133
  - `subject` — the module's unique name in the tree.
73
134
  - `description` — the module's **purpose**: what it is for and what it does.
@@ -75,12 +136,16 @@ Maintaining xdocs files is an **automatic, built-in responsibility — not a tas
75
136
  - `parent` — the `subject` of the containing module (and add this module to that parent's `children`).
76
137
  - `children` — the `subject`s of the modules contained inside this one.
77
138
 
78
- **Do not wait to be asked.** After you finish creating or modifying a module or directory, create or update its xdocs file as part of the same change. A code change that adds or alters a module is **not complete** until its xdocs file and the affected parent/child links are updated.
139
+ Every descriptor also includes `documents`, a map from each same-directory plain Markdown filename to the purpose of that companion document.
140
+ Each ordinary companion document listed there should include its own frontmatter
141
+ with `owner` equal to this descriptor's `subject`.
142
+
143
+ **Do not wait to be asked.** After you finish creating or modifying a module or directory, create or update its xdocs descriptor as part of the same change. A code change that adds or alters a module is **not complete** until its xdocs descriptor, companion-document list, and affected parent/child links are updated.
79
144
 
80
145
  **How `[ai].mode` applies.** The mode controls only *how* you write the docs, never *whether* you write them and never whether the user must ask first:
81
146
 
82
- - `auto` — create/update the xdocs files immediately as part of the change, then report what changed.
83
- - `prompt` — state exactly which xdocs files you are creating or updating, then write them (honoring any pending confirmation). Announcing is for transparency; it does not make documentation optional and the user never has to request it.
147
+ - `auto` — create/update the xdocs descriptors immediately as part of the change, then report what changed.
148
+ - `prompt` — state exactly which xdocs descriptors you are creating or updating, then write them (honoring any pending confirmation). Announcing is for transparency; it does not make documentation optional and the user never has to request it.
84
149
 
85
150
  ### Example: documenting a new module
86
151
 
@@ -95,8 +160,14 @@ children: []
95
160
  files:
96
161
  login.ts: Email/password login flow; exports `login()` and `verifyPassword()`.
97
162
  session.ts: Session lifecycle; exports `createSession()` and `validateSession()`.
163
+ documents:
164
+ authentication-implementation.md: Companion notes that explain implementation details and decisions.
98
165
  tags:
99
166
  - security
167
+ keywords:
168
+ - authentication
169
+ - login
170
+ - sessions
100
171
  flags: []
101
172
  status: stable
102
173
  ---
@@ -105,7 +176,31 @@ Auth validates credentials and issues sessions. `login()` delegates password
105
176
  checks to `verifyPassword()`; sessions are created and validated in `session.ts`.
106
177
  ```
107
178
 
108
- Then add `auth` to the `children` list of the `src` module's xdocs file so the tree stays consistent.
179
+ Then create or update `src/auth/authentication-implementation.md` with
180
+ companion-document frontmatter:
181
+
182
+ ```markdown
183
+ ---
184
+ name: authentication-implementation
185
+ purpose: Explain authentication implementation details and decisions.
186
+ description: Detailed notes for login, password verification, and session behavior.
187
+ created: 2026-07-06
188
+ flags: []
189
+ tags:
190
+ - security
191
+ keywords:
192
+ - authentication
193
+ - password verification
194
+ - session lifecycle
195
+ owner: auth
196
+ ---
197
+
198
+ # Authentication Implementation
199
+
200
+ Describe the implementation details that are too long for `auth.xdocs.md`.
201
+ ```
202
+
203
+ Then add `auth` to the `children` list of the `src` module's xdocs descriptor so the tree stays consistent.
109
204
 
110
205
  If the directory you are documenting is the **root of a package or application** (not a sub-module), set `parent: null` instead, and list that package's root `.xdocs.md` in the repository's single `XDOCS.md` index rather than in a parent module's `children`.
111
206
 
@@ -115,23 +210,26 @@ When you start working in a project that uses xdocs:
115
210
 
116
211
  1. Read the root `XDOCS.md` to learn the project's top-level subject and structure.
117
212
  2. Run `<xdocs> tree` to see the module hierarchy.
118
- 3. Run `<xdocs> scan` to see documentation coverage and which directories are missing xdocs files.
119
- 4. Read `xdocs.config.toml` and note `[ai].mode`, the supported `[extensions]`, and `[scan].exclude`.
120
- 5. When you navigate into a module, read that module's xdocs file (frontmatter first, body only if you need more) instead of reading every source file.
213
+ 3. Run `<xdocs> scan` to see documentation coverage, invalid descriptors, and companion-document coverage.
214
+ 4. Read `xdocs.config.toml` and note `[ai].mode` and `[scan].exclude`; xdocs descriptors always use the `.xdocs.md` suffix.
215
+ 5. When you navigate into a module, read that module's named `*.xdocs.md` descriptor frontmatter first. Read listed companion documents only when their descriptions show they are relevant.
121
216
 
122
217
  ## Documentation Workflow (writing and updating)
123
218
 
124
219
  Follow this whenever the automatic trigger above fires, or when the user asks to document a directory:
125
220
 
126
- 1. Determine the target directory and whether it already has an xdocs file (`<xdocs> scan` or `<xdocs> list <path>`).
221
+ 1. Determine the target directory and whether it already has exactly one named `*.xdocs.md` descriptor (`<xdocs> scan` or `<xdocs> list <path>`).
127
222
  2. Read the directory's actual files so the documentation reflects reality. Never invent files, modules, or behavior that is not present.
128
223
  3. Respect `[ai].mode` (it controls how you write, not whether you write):
129
- - **prompt mode**: state exactly which xdocs files you are creating or updating, then write them (honor a pending confirmation, but never skip the documentation).
130
- - **auto mode**: create or update the xdocs files immediately, then report what changed.
131
- 4. Write or update the xdocs file with correct frontmatter:
132
- - Set `subject` (unique), `description` (the module's purpose), and `files` (each real file -> short purpose, including key functions/exports).
224
+ - **prompt mode**: state exactly which xdocs descriptors you are creating or updating, then write them (honor a pending confirmation, but never skip the documentation).
225
+ - **auto mode**: create or update the xdocs descriptors immediately, then report what changed.
226
+ 4. Write or update the xdocs descriptor with correct frontmatter:
227
+ - Set `subject` (unique), `description` (the module's purpose), and `files` (each real implementation/configuration file -> short purpose, including key functions/exports).
228
+ - Set `documents` to every same-directory plain Markdown file -> short purpose. Use `{}` when there are no companion documents.
229
+ - Set `keywords` to search terms and concepts that should help agents match user requests to the module.
230
+ - For each ordinary companion document, add or update frontmatter with `name`, `purpose`, `description`, `created`, `flags`, `tags`, `keywords`, and `owner`; set `owner` to the descriptor's `subject`.
133
231
  - Set `parent` to the containing module's `subject`, and add this `subject` to that parent's `children`.
134
- - Use `tags`/`flags`/`status` where useful.
232
+ - Use `tags`/`keywords`/`flags`/`status` where useful.
135
233
  5. Keep the tree consistent: if you add a module, update its parent's `children`; if you remove one, update both sides.
136
234
  6. Validate with `<xdocs> tree` (it reports duplicate subjects, orphans, and missing children) and fix any reported issues.
137
235
 
@@ -150,7 +248,8 @@ When generating from scratch, prefer `<xdocs> generate <path>` (one directory) o
150
248
 
151
249
  ## Safety Rules
152
250
 
153
- - Never leave a new or changed module undocumented. Creating or updating its xdocs file is part of finishing the work, not a separate request the user must make.
251
+ - Never leave a new or changed module undocumented. Creating or updating its xdocs descriptor is part of finishing the work, not a separate request the user must make.
252
+ - Never leave an ordinary companion Markdown document without useful frontmatter; it should identify its `owner`, purpose, tags, keywords, and flags.
154
253
  - Never fabricate files, modules, descriptions, or relationships. Documentation must match the repository.
155
254
  - Never edit generated or build outputs (`library/`, `bundle/`, `bin/`, `*.tgz`). They are ignored and regenerated.
156
255
  - In prompt mode, announce the xdocs changes you will make and honor a pending confirmation — but still treat documenting the change as required, never optional.
@@ -166,7 +265,7 @@ xdocs searches for configuration via `--config <path>`, `./xdocs.config.toml`, o
166
265
  schema = 1
167
266
 
168
267
  [extensions]
169
- supported = [".docs.md", ".xdocs.md"]
268
+ supported = [".xdocs.md"]
170
269
 
171
270
  [ai]
172
271
  mode = "prompt" # "prompt" (announce and wait) or "auto" (update immediately)
@@ -185,15 +284,17 @@ skill_tool = "agents" # default tool for auto-install: agents (standard) or
185
284
 
186
285
  Agent automation options default to true. A bare `xdocs` invocation and normal data commands always bootstrap the standard global skill when no config is present; with config, set `auto_agents_md = false` to stop xdocs from touching AGENTS.md, and `auto_skill_install = false` to stop xdocs from installing or refreshing `guiho-s-xdocs` globally.
187
286
 
287
+ The `[extensions]` section is retained for config compatibility, but the only supported descriptor suffix is `.xdocs.md`.
288
+
188
289
  ## CLI Reference
189
290
 
190
291
  ```bash
191
292
  xdocs init # create XDOCS.md + xdocs.config.toml, update AGENTS.md, install the skill
192
- xdocs scan # report xdocs coverage across the project
293
+ xdocs scan # report descriptor and companion-document coverage
193
294
  xdocs tree # print the module hierarchy
194
- xdocs list <path> # list files in a scope with descriptions
295
+ xdocs list <path> # list files and companion documents with descriptions
195
296
  xdocs generate [path] # draft documentation for a directory or the whole project
196
- xdocs merge [path] # merge a directory's xdocs files into one document
297
+ xdocs merge [path] # merge a directory's xdocs descriptors into one document
197
298
  xdocs prompt --name=<name> # print a ready-made AI prompt (write|update|agents|generate)
198
299
  xdocs agents install local # install guiho-s-xdocs into this project (.agents/skills/...)
199
300
  xdocs agents install global # install guiho-s-xdocs into the user home skills directory
@@ -252,7 +353,7 @@ await ensureAgentsInstructions(process.cwd(), true)
252
353
  When reporting an xdocs result, include:
253
354
 
254
355
  - The command that ran and the target path.
255
- - Which xdocs files were created or changed, if any.
356
+ - Which xdocs descriptors and companion documents were created or changed, if any.
256
357
  - Tree/coverage status (subjects added, orphans or duplicates resolved).
257
358
  - The configured AI mode, and — in prompt mode — exactly what you are waiting to write.
258
359