ai-factory 2.13.0 → 2.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-factory",
3
- "version": "2.13.0",
3
+ "version": "2.13.2",
4
4
  "type": "module",
5
5
  "description": "CLI tool for automating AI agent context setup in projects",
6
6
  "main": "dist/cli/index.js",
@@ -2,9 +2,10 @@
2
2
  name: aif-distillation
3
3
  description: >-
4
4
  Distill books, documents, folders, or URLs into compact, practical Agent Skills.
5
- Use when source material should become a reusable skill package with a concise
6
- SKILL.md plus detailed references and examples.
7
- argument-hint: "<path|url> [path|url...] [--name <skill-name>] [--update]"
5
+ Use when source material should become either one reusable skill package or a
6
+ split set of focused skills, each with a concise SKILL.md plus detailed
7
+ references and examples.
8
+ argument-hint: "<path|url> [path|url...] [--name <skill-name>] [--path <directory>] [--update] [--redact-source-map] [--split|--split-by <strategy>]"
8
9
  allowed-tools: Read Write Edit Glob Grep Bash(mkdir *) Bash(ls *) Bash(find *) Bash(wc *) Bash(python3 *) WebFetch WebSearch AskUserQuestion
9
10
  disable-model-invocation: false
10
11
  metadata:
@@ -31,7 +32,7 @@ If config.yaml doesn't exist, use defaults:
31
32
 
32
33
  **Read `.ai-factory/skill-context/aif-distillation/SKILL.md`** - MANDATORY if the file exists.
33
34
 
34
- Treat skill-context rules as project-level overrides for this skill. They apply to all generated skill files, references, examples, source maps, and final reports.
35
+ Treat skill-context rules as project-level overrides for this skill. They apply to all generated skill files, references, examples, source-map policy, and final reports.
35
36
 
36
37
  ## Inputs
37
38
 
@@ -40,17 +41,32 @@ Accept `$ARGUMENTS` as one or more:
40
41
  - local directories
41
42
  - URLs
42
43
  - optional `--name <skill-name>`
44
+ - optional `--path <directory>` to save generated skill package directories under a custom output root instead of `{{skills_dir}}`
43
45
  - optional `--update` to improve an existing skill instead of creating a duplicate
46
+ - optional `--redact-source-map` to skip generated source-map files and sections entirely, so exact source titles, URLs, local paths, repository paths, and link reference definitions are not written to output
47
+ - optional `--split` to create several focused skills from one material set
48
+ - optional `--split-by <strategy>` to choose the split strategy:
49
+ - `auto` (default): infer skill boundaries from user goals, triggers, workflows, source topics, and use cases
50
+ - `goal`: split by user goals or jobs-to-be-done, regardless of domain
51
+ - `topic`: split by major source topics or chapters
52
+ - `workflow`: split by recurring actions an agent performs
53
+ - `audience`: split by distinct user roles or implementation contexts
44
54
 
45
- If the target skill name is missing, derive a concise, general, lowercase-hyphenated name from the material topic, such as `clean-code-style`, `api-design-rules`, or `ddd-modeling`.
55
+ If the target skill name is missing, derive a concise, general, lowercase-hyphenated name from the material topic or user goal, such as `clean-code-style`, `api-design-rules`, `decision-making`, `writing-feedback`, or `meeting-facilitation`.
46
56
 
47
57
  Before any write, validate the final target skill name:
48
58
  - It must match `^[a-z0-9]+(?:-[a-z0-9]+)*$`.
49
59
  - Reject empty names, overlong names, `.`, `..`, dots, path separators (`/` or `\`), absolute paths, Windows drive paths, and hidden names.
50
60
  - Reject reserved `aif-*` names unless the user explicitly says they are developing AI Factory itself.
51
- - Resolve the final destination path and confirm it is inside `{{skills_dir}}` before creating or updating files.
61
+ - Resolve the output root: `--path <directory>` when present, otherwise `{{skills_dir}}`.
62
+ - Treat relative `--path` values as relative to the current working directory. Create the output root if it does not exist; reject it if it resolves to an existing file.
63
+ - Resolve the final destination path and confirm it is inside the resolved output root before creating or updating files.
52
64
 
53
- Default destination: `{{skills_dir}}/<skill-name>/` for the current agent. Do not save distilled skills into the package `skills/` directory unless the user is explicitly developing AI Factory itself.
65
+ Default destination for single-skill mode: `<output-root>/<skill-name>/`, where `<output-root>` is `{{skills_dir}}` unless `--path` is present.
66
+
67
+ Default destination for split mode: `<output-root>/<prefix>-<child-scope>/` for each generated child skill. Every split child name must share one namespace prefix to prevent collisions with existing skills. Use `--name` as the preferred prefix when present; otherwise derive a concise prefix from the book title or primary material title. If `--redact-source-map` is present and the exact source title should not be exposed, use `--name` as the public namespace or derive a neutral topic prefix.
68
+
69
+ Do not save distilled skills into the package `skills/` directory unless the user is explicitly developing AI Factory itself.
54
70
 
55
71
  ## Workflow
56
72
 
@@ -66,29 +82,47 @@ Default destination: `{{skills_dir}}/<skill-name>/` for the current agent. Do no
66
82
  - Preserve only short source excerpts when essential. Prefer paraphrase and cite sources.
67
83
  - Convert narrative advice into agent-operable instructions and source examples into original, reusable examples.
68
84
 
69
- 3. Design the target skill package.
85
+ 3. Choose single-skill or split-skill design.
86
+ - Default to single-skill mode unless `--split` or `--split-by` is present.
87
+ - In split mode, resolve one shared namespace prefix before writing the boundary map. Use `--name` when present; otherwise use a normalized book/material title. Every proposed child name must start with `<prefix>-`.
88
+ - In split mode, create a skill boundary map before writing: proposed prefixed skill name, user-facing job, trigger description, owned source topics, references/examples needed, and overlap risks.
89
+ - Prefer split mode when the material contains independent goals that should trigger separately, such as reviewing, planning, diagnosing, rewriting, teaching, deciding, testing, facilitating, auditing, or troubleshooting.
90
+ - Name split children by the user goal or job-to-be-done, not by an abstract source theme. Choose the goal taxonomy from the material's domain: for software this may be `refactoring-review`, `test-design`, or `framework-fit-review`; for writing this may be `argument-edit` or `style-review`; for operations this may be `incident-triage` or `runbook-review`; for management this may be `decision-brief` or `stakeholder-analysis`; for learning this may be `concept-coach` or `practice-drill`.
91
+ - Avoid vague lifecycle or chapter names such as `framework-evolution`, `principles`, `philosophy`, `chapter-4`, `mindset`, or `overview` unless that exact name is the user's requested public taxonomy.
92
+ - Do not split into tiny skills that differ only by wording. Merge candidates when their triggers, workflow, and reference needs substantially overlap.
93
+ - Keep every generated child skill independently useful: clear frontmatter, focused workflow, and relevant references/examples. If `--redact-source-map` is absent, include its own source map; if present, do not create `references/SOURCE-MAP.md` or a source-map section.
94
+
95
+ 4. Design the target skill package.
70
96
  - Keep target `SKILL.md` focused on purpose, triggers, and workflow.
97
+ - Make the generated skill self-explanatory from its directory name and frontmatter. The description must start with an action verb and say what the skill reviews, improves, generates, or checks.
98
+ - Near the top of every generated `SKILL.md`, answer in plain language: what this skill does, when to use it, and what output it should produce. A user should not need to inspect the source material to understand why the skill exists.
71
99
  - Put detailed knowledge in `references/`.
72
100
  - Put reusable prompts, cases, and transformed examples in `examples/`.
73
101
  - If the material teaches programming with code examples, create or update an examples file with original before/after snippets or compact code patterns. Do not omit code examples only because verbatim copying is inappropriate.
74
102
  - For book-scale or broad code material, cover every major code-facing topic with an adapted example, or state why a topic does not need one. Split examples into multiple files when one file would become a shallow sampler.
75
103
  - Add scripts only when the workflow needs repeatable processing.
76
- - Save the package under `{{skills_dir}}/<skill-name>/` using the chosen concise name.
104
+ - Resolve `<output-root>` from `--path` or `{{skills_dir}}` before writing. Treat `--path` as a parent directory for generated skill packages, not as the skill package name.
105
+ - In single-skill mode, save the package under `<output-root>/<skill-name>/` using the chosen concise name.
106
+ - In split mode, save each child package directly under `<output-root>/<prefix>-<child-scope>/`. Do not drop the shared prefix even when the child scope is clear on its own.
107
+ - When `--redact-source-map` is present, do not create `references/SOURCE-MAP.md`, do not create a "Source Map" section in any generated file, and remove any empty `SOURCE-MAP.md` accidentally created during drafting. In `--update` mode, leave an existing non-empty `SOURCE-MAP.md` unchanged unless the user explicitly asks to remove or rewrite it.
77
108
  - Use resolved `language.artifacts` for generated skill content unless the source material or user explicitly requires another language.
78
109
 
79
- 4. Check existing content before writing.
110
+ 5. Check existing content before writing.
80
111
  - If the target skill already has matching references or examples, update them in place.
81
112
  - Do not create near-duplicate files with different names.
82
113
  - Preserve useful existing material and add only missing or better distilled content.
114
+ - In split mode, also check existing sibling skills under `<output-root>` for matching triggers. Update a matching skill with `--update` instead of creating a new near-duplicate child.
83
115
 
84
- 5. Validate usefulness.
116
+ 6. Validate usefulness.
85
117
  - The skill must tell an agent what to do, when to do it, what good output looks like, and what mistakes to avoid.
118
+ - The name and description must be invocation-ready. If a user would ask "what does this skill actually do?", rename it or rewrite the trigger before finishing.
86
119
  - References must be dense and navigable.
87
120
  - Examples must demonstrate decisions or transformations, not decorative filler.
88
121
  - If source material contained meaningful code snippets or worked examples, the generated skill must include adapted examples. Missing adapted examples is a failure to fix before finishing.
89
- - Example coverage must match the source map: major code-facing source areas should point to concrete examples, not just prose references.
122
+ - Example coverage must match source coverage: when `--redact-source-map` is absent, record this in the source map; when present, validate coverage internally without writing source-map files or sections.
90
123
  - Generated skills must include an artifact ownership/config policy section when they write or read project artifacts.
91
124
  - Generated quality-gate skills must follow the `aif-gate-result` contract from `/aif-verify` references.
125
+ - In split mode, every child skill must have a distinct activation trigger. If two children would activate for the same request and tell the agent to do the same work, merge them before finishing.
92
126
 
93
127
  ## Required Supporting Guidance
94
128
 
@@ -101,6 +135,6 @@ Use `examples/REQUESTS.md` for invocation patterns.
101
135
 
102
136
  ## Artifact Ownership
103
137
 
104
- - Primary ownership: generated or updated skill packages under `{{skills_dir}}/<skill-name>/`.
138
+ - Primary ownership: generated or updated skill packages under `<output-root>/<skill-name>/`, or multiple direct child skill packages under `<output-root>/<prefix>-<child-scope>/` in split mode. `<output-root>` is `{{skills_dir}}` unless the user passes `--path <directory>`.
105
139
  - Read-only context: `.ai-factory/config.yaml`, existing AI Factory context artifacts, and existing skill files except the selected target skill in update mode.
106
140
  - Config policy: config-aware for `language.ui`, `language.artifacts`, and `language.technical_terms` only. Do not write `config.yaml`.
@@ -29,6 +29,88 @@ Expected behavior:
29
29
  - link the code examples from the target `SKILL.md`
30
30
  - avoid verbatim copying while preserving the programming lesson
31
31
 
32
+ ## Create Several Focused Skills from One Material Set
33
+
34
+ ```text
35
+ /aif-distillation ./books/code-quality.pdf ./examples --split --name code-quality
36
+ ```
37
+
38
+ Expected behavior:
39
+
40
+ - infer focused child skills from distinct practices rather than creating one broad skill
41
+ - use `code-quality` as the required shared namespace prefix
42
+ - prefer clear child names such as `code-quality-readability-refactor`, `code-quality-naming-cleanup`, `code-quality-condition-simplifier`, or `code-quality-testability-pass`
43
+ - write each child directly under `{{skills_dir}}/<prefix>-<child-scope>/`
44
+ - give every child a distinct frontmatter description and activation trigger
45
+ - include source attribution for every child unless `--redact-source-map` is present
46
+ - merge or skip candidates whose triggers overlap too much
47
+
48
+ ## Save to a Custom Output Root
49
+
50
+ ```text
51
+ /aif-distillation ./books/domain-driven-design.pdf --name ddd-practices --path ./distilled-skills
52
+ ```
53
+
54
+ Expected output:
55
+
56
+ - `./distilled-skills/ddd-practices/SKILL.md`
57
+ - `./distilled-skills/ddd-practices/references/SOURCE-MAP.md`
58
+ - no writes to the current agent `{{skills_dir}}`
59
+ - resolved destination stays inside the resolved `--path` output root
60
+
61
+ ## Split into a Custom Output Root
62
+
63
+ ```text
64
+ /aif-distillation ./books/code-quality.pdf --split --name code-quality --path ./distilled-skills
65
+ ```
66
+
67
+ Expected behavior:
68
+
69
+ - create direct child package directories under `./distilled-skills/`
70
+ - name every child with the shared `code-quality-` prefix
71
+ - do not create a parent `code-quality/` wrapper directory unless explicitly requested as an index/router skill
72
+
73
+ ## Split by a Specific Strategy
74
+
75
+ ```text
76
+ /aif-distillation ./docs/review-playbook --split-by workflow --name review
77
+ ```
78
+
79
+ Expected behavior:
80
+
81
+ - split by recurring actions an agent performs, not by arbitrary file count
82
+ - name every child with the shared `review-` prefix, such as `review-triage` or `review-findings`
83
+ - create a boundary map before writing
84
+ - update matching existing child skills when `--update` is also present
85
+ - report created, updated, merged, and skipped candidates
86
+
87
+ ## Split Non-Code Material by User Goals
88
+
89
+ ```text
90
+ /aif-distillation ./books/decision-making.pdf --split-by goal --name decisions
91
+ ```
92
+
93
+ Expected behavior:
94
+
95
+ - split by jobs the user wants help with, not by chapter titles
96
+ - create names such as `decisions-decision-brief`, `decisions-risk-review`, or `decisions-stakeholder-analysis`
97
+ - make every child explain what it does, when to use it, and what output it should produce
98
+ - avoid vague children such as `decisions-principles`, `decisions-mindset`, or `decisions-chapter-2`
99
+
100
+ ## Redact Source Map Paths and Links
101
+
102
+ ```text
103
+ /aif-distillation ./books/internal-review-guide.pdf --name review-guide --redact-source-map
104
+ ```
105
+
106
+ Expected behavior:
107
+
108
+ - generate the skill normally
109
+ - do not create `references/SOURCE-MAP.md`
110
+ - do not create a "Source Map" section in `SKILL.md` or any reference file
111
+ - omit exact book titles, URLs, local paths, repository paths, filenames, and link reference definitions from generated files
112
+ - keep source coverage only in private working notes while still producing useful distilled instructions, references, and examples
113
+
32
114
  ## Create a Skill from a Docs Folder
33
115
 
34
116
  ```text
@@ -58,7 +140,7 @@ Expected behavior:
58
140
  - reject the request before writing files
59
141
  - explain that skill names must match `^[a-z0-9]+(?:-[a-z0-9]+)*$`
60
142
  - reserve `aif-*` names unless the user explicitly says they are developing AI Factory itself
61
- - confirm the resolved target path would stay under `{{skills_dir}}`
143
+ - confirm the resolved target path would stay under the resolved output root (`{{skills_dir}}` by default, or `--path` when present)
62
144
 
63
145
  ## Update an Existing Skill
64
146
 
@@ -83,5 +165,5 @@ Expected behavior:
83
165
 
84
166
  - fetch the pages
85
167
  - follow only critical sub-pages
86
- - source-map all URLs used
168
+ - source-map all URLs used unless `--redact-source-map` is present; with redaction, do not create `SOURCE-MAP.md`
87
169
  - summarize rules and examples without long quoted passages
@@ -16,6 +16,12 @@ Create a source inventory:
16
16
 
17
17
  For folders, group files by topic before reading deeply. For books, read the table of contents first, then sample each major part before deep extraction.
18
18
 
19
+ When the user passes `--redact-source-map`, keep any exact URLs, local paths,
20
+ repository paths, and source titles only in your private working inventory.
21
+ Generated skill files must use neutral source labels such as `Source A`,
22
+ `Book section 1`, or `Internal guide: authentication`, while preserving the
23
+ type, scope, and usage of each source.
24
+
19
25
  ## 2. Extraction
20
26
 
21
27
  Extract only material that can drive agent behavior:
@@ -83,7 +89,74 @@ Before writing, answer:
83
89
 
84
90
  The target `SKILL.md` should fit in one screen when possible. It is the router and operating loop, not the knowledge base.
85
91
 
86
- ## 5. Existing-File Merge
92
+ ## 5. Split-Skill Design
93
+
94
+ Use this section only when the user passes `--split` or `--split-by <strategy>`.
95
+
96
+ Split source material into multiple skills when the material contains separate
97
+ capabilities that should activate on different user requests. A split set should
98
+ feel like a small toolkit of focused passes, not a chopped-up book summary.
99
+ If `--path <directory>` is present, create the split set under that output root
100
+ instead of the current agent `{{skills_dir}}`.
101
+
102
+ Supported strategies:
103
+
104
+ | Strategy | Use when | Boundary signal |
105
+ |----------|----------|-----------------|
106
+ | `auto` | the user wants several skills but did not prescribe boundaries | strongest distinct goals, triggers, workflows, examples, and target users |
107
+ | `goal` | the material supports several different jobs-to-be-done | each child helps the user accomplish a different outcome |
108
+ | `topic` | the source has clean domain or chapter boundaries | each topic produces different decisions or checks |
109
+ | `workflow` | the source teaches multiple actions | each action has a different input, output, or quality gate |
110
+ | `audience` | the source serves different roles or project contexts | each role/context needs different operating instructions |
111
+
112
+ Before writing split skills, create a boundary map:
113
+
114
+ | Child skill | User goal | Trigger | Source topics | References/examples | Merge risk |
115
+ |-------------|-----------|---------|---------------|---------------------|------------|
116
+ | <name> | <outcome it helps achieve> | <when it should activate> | <topics> | <files> | low/medium/high |
117
+
118
+ First resolve a shared split namespace prefix:
119
+
120
+ - use `--name` when the user supplied it
121
+ - otherwise derive the prefix from the book title or primary material title
122
+ - if source-map redaction is requested and the real title should stay private,
123
+ use a neutral topic prefix instead of the exact title
124
+ - validate the prefix with the same skill-name rules as ordinary skills
125
+ - every generated child name must start with `<prefix>-`
126
+
127
+ Merge or drop a child candidate when:
128
+
129
+ - its trigger overlaps another candidate without a meaningful workflow
130
+ difference
131
+ - it would contain only generic advice
132
+ - it depends on another child for basic operation
133
+ - it has no source-derived checks or examples
134
+
135
+ For broad code-quality material, good split candidates are often operation
136
+ passes such as readability refactoring, naming cleanup, condition
137
+ simplification, magic value extraction, exception-flow review, testability, and
138
+ framework-specific review. These names are examples, not required output.
139
+
140
+ For non-code material, use the same goal-first rule. Examples:
141
+
142
+ - writing or communication: `argument-edit`, `style-review`, `message-critique`
143
+ - strategy or management: `decision-brief`, `stakeholder-analysis`, `risk-review`
144
+ - operations or support: `incident-triage`, `runbook-review`, `escalation-plan`
145
+ - learning material: `concept-explainer`, `practice-drill`, `understanding-check`
146
+ - research material: `evidence-synthesis`, `claim-audit`, `literature-map`
147
+
148
+ Avoid source-theme children with unclear invocation intent.
149
+ If a candidate name makes a user ask "what does this do?", rename it around the
150
+ goal and expected output.
151
+
152
+ Every child skill must include its own source attribution unless
153
+ `--redact-source-map` is present. For small non-redacted children,
154
+ `references/SOURCE-MAP.md` may be the only reference; for larger children, add
155
+ focused references and examples. In redaction mode, do not create
156
+ `references/SOURCE-MAP.md`; keep source coverage in the private working
157
+ inventory and ship only the distilled instructions, references, and examples.
158
+
159
+ ## 6. Existing-File Merge
87
160
 
88
161
  Before creating any new reference or example:
89
162
 
@@ -104,9 +177,14 @@ one shallow sampler, for example:
104
177
  - `refactoring-optimization.md` for safe change and measurement examples
105
178
  - `review-examples.md` for review findings and corrections
106
179
 
107
- ## 6. Traceability
180
+ In split mode, perform this merge check across sibling skills too. A proposed
181
+ child should update an existing matching skill when the existing frontmatter
182
+ description and workflow already cover the same capability.
108
183
 
109
- Every distilled skill should include a source map in a reference:
184
+ ## 7. Traceability
185
+
186
+ Every distilled skill should include a source map in a reference unless
187
+ `--redact-source-map` is present:
110
188
 
111
189
  ```markdown
112
190
  ## Source Map
@@ -116,9 +194,18 @@ Every distilled skill should include a source map in a reference:
116
194
  | <path-or-url> | <principles, workflow, examples, checks> |
117
195
  ```
118
196
 
119
- Do not imply that every rule is a direct quote. Distillation is synthesis; source maps explain provenance.
197
+ When `--redact-source-map` is present, do not create `references/SOURCE-MAP.md`
198
+ and do not add a "Source Map" section to any generated file. Do not write link
199
+ reference definitions, raw path fragments, repository paths, filenames that
200
+ reveal the source, exact URLs, or exact book/document titles anywhere as source
201
+ attribution. If a draft creates an empty `SOURCE-MAP.md`, remove it before
202
+ finishing. In `--update` mode, leave an existing non-empty `SOURCE-MAP.md`
203
+ unchanged unless the user explicitly asks to remove or rewrite it.
204
+
205
+ For non-redacted source maps, do not imply that every rule is a direct quote.
206
+ Distillation is synthesis; source maps explain provenance.
120
207
 
121
- ## 7. Quality Gate
208
+ ## 8. Quality Gate
122
209
 
123
210
  Before finishing, check:
124
211
 
@@ -131,5 +218,8 @@ Before finishing, check:
131
218
  - Example coverage maps to the source areas. If references mention many
132
219
  code-facing topics but examples cover only a few, the skill is incomplete.
133
220
  - Existing references/examples were updated instead of duplicated.
221
+ - Split mode only: each child skill has a distinct trigger, direct `<output-root>/<prefix>-<child>/` location, source attribution when not redacted, no `SOURCE-MAP.md` when redacted, and enough references/examples to operate independently.
222
+ - Split mode only: all generated child names share the same prefix derived from `--name`, the book title, or a neutral material namespace.
223
+ - Split mode only: no generated child is a near-duplicate of another generated or existing sibling skill.
134
224
  - Temporary extraction files were removed.
135
225
  - No long copyrighted passages were copied.
@@ -28,6 +28,11 @@ Optional flags:
28
28
 
29
29
  Read `source-index.md` first. Then read only the chunks needed for each section of the target skill.
30
30
 
31
+ When `--redact-source-map` is present, treat `source-index.md` as a private
32
+ working index only. Do not copy its raw URLs, local paths, filenames, or exact
33
+ source titles into generated files. Do not create `references/SOURCE-MAP.md`
34
+ for redacted output.
35
+
31
36
  ## Chunking Strategy
32
37
 
33
38
  Use this order:
@@ -5,10 +5,10 @@ Use this structure for skills created by `aif-distillation`.
5
5
  ## Target Package
6
6
 
7
7
  ```text
8
- {{skills_dir}}/<skill-name>/
8
+ <output-root>/<skill-name>/
9
9
  ├── SKILL.md
10
10
  ├── references/
11
- │ ├── SOURCE-MAP.md
11
+ │ ├── SOURCE-MAP.md # omit when --redact-source-map is present
12
12
  │ ├── CORE-PRINCIPLES.md
13
13
  │ ├── WORKFLOW.md
14
14
  │ └── CHECKLISTS.md
@@ -27,19 +27,86 @@ For broad programming material, use enough example files to cover the major
27
27
  source topics. Do not create a single `code-patterns.md` that only samples a few
28
28
  topics while the references claim broad code coverage.
29
29
 
30
+ ## Split-Skill Target Packages
31
+
32
+ When the user passes `--split` or `--split-by <strategy>`, create multiple
33
+ focused skill packages instead of one broad package:
34
+
35
+ ```text
36
+ <output-root>/
37
+ ├── <prefix>-<child-skill-a>/
38
+ │ ├── SKILL.md
39
+ │ ├── references/
40
+ │ │ ├── SOURCE-MAP.md # omit when --redact-source-map is present
41
+ │ │ └── <focused-reference>.md
42
+ │ └── examples/
43
+ │ └── <focused-examples>.md
44
+ ├── <prefix>-<child-skill-b>/
45
+ │ └── SKILL.md
46
+ └── <optional-index-skill>/
47
+ └── SKILL.md
48
+ ```
49
+
50
+ Do not create a parent directory that contains child skills. Agent runtimes
51
+ discover skills as direct children of the output root when that root is an
52
+ agent skills directory.
53
+
54
+ Create an optional index/router skill only when it is genuinely useful, for
55
+ example when the split set is large or users need a single command-style entry
56
+ point. The index skill should list the child skills and when to use each one; it
57
+ must not duplicate their references.
58
+
59
+ Each child skill should be narrow enough to trigger independently. Good split
60
+ boundaries include:
61
+
62
+ - a distinct code review pass, such as `naming-cleanup` or `testability-pass`
63
+ - a distinct refactoring operation, such as `early-return-simplifier`
64
+ - a distinct framework or runtime practice, such as `laravel-query-boundaries`
65
+ - a distinct writing or analysis workflow, such as `comments-curator`
66
+ - a distinct non-code goal, such as `argument-edit`, `decision-brief`,
67
+ `incident-triage`, `practice-drill`, or `risk-review`
68
+
69
+ Avoid split boundaries based only on source chapter titles when the resulting
70
+ skills would have the same trigger and workflow.
71
+
30
72
  ## Destination
31
73
 
32
- Save the distilled skill in the configured skills directory of the currently active agent:
74
+ Save the distilled skill in the configured skills directory of the currently active agent by default:
33
75
 
34
76
  ```text
35
77
  {{skills_dir}}/<skill-name>/
36
78
  ```
37
79
 
38
80
  `{{skills_dir}}` is resolved by AI Factory for the active agent installation.
81
+ If the user passes `--path <directory>`, use that directory as the output root
82
+ instead:
83
+
84
+ ```text
85
+ <directory>/<skill-name>/
86
+ ```
87
+
88
+ `--path` is a parent output directory for generated skill package directories,
89
+ not the skill package name itself. Resolve relative `--path` values from the
90
+ current working directory. Create the output root if it does not exist; reject
91
+ it if it resolves to an existing file. For a single exact destination, the user
92
+ should pass `--path <parent-dir> --name <directory-name>`.
39
93
 
40
94
  Do not write distilled output into AI Factory's package `skills/` directory unless the task is explicitly to add a built-in AI Factory skill.
41
95
 
42
- Before writing, resolve and canonicalize the final destination path. It must stay inside the resolved `{{skills_dir}}` directory.
96
+ Before writing, resolve and canonicalize the output root and final destination
97
+ path. The final destination must stay inside the resolved output root. When
98
+ `--path` is absent, the output root is `{{skills_dir}}`.
99
+
100
+ For split mode, apply this same validation to every generated child skill path.
101
+ Every generated child name must use one shared namespace prefix:
102
+
103
+ - use `--name <skill-name>` as the prefix when supplied
104
+ - otherwise derive a concise prefix from the book title or primary material title
105
+ - when source-map redaction is requested, avoid exposing a private title and use
106
+ `--name` or a neutral material/topic prefix instead
107
+ - write children as `<output-root>/<prefix>-<child-scope>/`
108
+ - do not create unprefixed split children, even when the child scope reads well
109
+ by itself
43
110
 
44
111
  ## Naming
45
112
 
@@ -57,6 +124,10 @@ Good:
57
124
  - `domain-modeling`
58
125
  - `api-design-rules`
59
126
  - `incident-review`
127
+ - `argument-edit`
128
+ - `decision-brief`
129
+ - `practice-drill`
130
+ - `risk-review`
60
131
 
61
132
  Avoid:
62
133
 
@@ -66,6 +137,18 @@ Avoid:
66
137
  - vague names like `notes`, `reference`, or `book-summary`
67
138
  - reserved or unsafe names like `aif-review`, `../foo`, `.hidden`, `C:\temp\skill`, or `clean/code`
68
139
 
140
+ In split mode, generate a name list before writing and check it as a set:
141
+
142
+ - every name must start with the same resolved namespace prefix plus `-`
143
+ - every name must pass the same validation rules
144
+ - no name may collide with another generated child
145
+ - no generated child may shadow a built-in `aif-*` skill
146
+ - the suffix after the prefix should describe the user goal and expected action, not provenance
147
+ - avoid double-prefixing names when a candidate suffix already contains the prefix
148
+ - avoid abstract source-theme suffixes such as `principles`, `philosophy`,
149
+ `evolution`, `mindset`, or `chapter-3` unless the user explicitly requested
150
+ that taxonomy
151
+
69
152
  ## SKILL.md Rules
70
153
 
71
154
  `SKILL.md` should contain:
@@ -95,7 +178,7 @@ For AI Factory-style skills, also include:
95
178
 
96
179
  | File | Purpose |
97
180
  |------|---------|
98
- | `SOURCE-MAP.md` | Sources, coverage, and attribution |
181
+ | `SOURCE-MAP.md` | Sources, coverage, and attribution; omit entirely when `--redact-source-map` is present |
99
182
  | `CORE-PRINCIPLES.md` | Dense distilled concepts and rules |
100
183
  | `WORKFLOW.md` | Step-by-step operating procedure |
101
184
  | `CHECKLISTS.md` | Review gates and quality criteria |
@@ -104,6 +187,15 @@ For AI Factory-style skills, also include:
104
187
 
105
188
  Prefer stable, obvious filenames over clever names.
106
189
 
190
+ When `--redact-source-map` is present:
191
+
192
+ - do not create `references/SOURCE-MAP.md`
193
+ - do not create a "Source Map" section in `SKILL.md` or any reference file
194
+ - remove any empty `SOURCE-MAP.md` created while drafting
195
+ - in `--update` mode, leave an existing non-empty `SOURCE-MAP.md` unchanged
196
+ unless the user explicitly asks to remove or rewrite it
197
+ - keep source coverage checks in the private working notes only
198
+
107
199
  ## Example File Roles
108
200
 
109
201
  Examples should show how to apply the distilled knowledge:
@@ -139,6 +231,15 @@ When `--update` is present:
139
231
  5. Add new files only for new topics.
140
232
  6. Report what changed and what was intentionally left untouched.
141
233
 
234
+ In split mode with `--update`, treat every proposed child skill independently:
235
+
236
+ 1. Build the child skill boundary map.
237
+ 2. Match each proposed child to existing skills by name, frontmatter
238
+ description, and trigger/workflow overlap.
239
+ 3. Update matched skills in place.
240
+ 4. Create new child skills only for uncovered capabilities.
241
+ 5. Report merged, created, skipped, and renamed candidates.
242
+
142
243
  ## Ownership and Context-Gate Alignment
143
244
 
144
245
  When distilling material into an AI Factory workflow or quality skill: