ai-factory 2.13.0 → 2.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-factory",
3
- "version": "2.13.0",
3
+ "version": "2.13.1",
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>] [--update] [--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:
@@ -41,6 +42,12 @@ Accept `$ARGUMENTS` as one or more:
41
42
  - URLs
42
43
  - optional `--name <skill-name>`
43
44
  - optional `--update` to improve an existing skill instead of creating a duplicate
45
+ - optional `--split` to create several focused skills from one material set
46
+ - optional `--split-by <strategy>` to choose the split strategy:
47
+ - `auto` (default): infer skill boundaries from source topics and use cases
48
+ - `topic`: split by major source topics or chapters
49
+ - `workflow`: split by recurring actions an agent performs
50
+ - `audience`: split by distinct user roles or implementation contexts
44
51
 
45
52
  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`.
46
53
 
@@ -50,7 +57,11 @@ Before any write, validate the final target skill name:
50
57
  - Reject reserved `aif-*` names unless the user explicitly says they are developing AI Factory itself.
51
58
  - Resolve the final destination path and confirm it is inside `{{skills_dir}}` before creating or updating files.
52
59
 
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.
60
+ Default destination for single-skill mode: `{{skills_dir}}/<skill-name>/` for the current agent.
61
+
62
+ Default destination for split mode: `{{skills_dir}}/<generated-skill-name>/` for each generated child skill. `--name` becomes a naming seed or namespace prefix, not one enclosing package directory, unless the user explicitly asks for an index-only parent skill.
63
+
64
+ Do not save distilled skills into the package `skills/` directory unless the user is explicitly developing AI Factory itself.
54
65
 
55
66
  ## Workflow
56
67
 
@@ -66,22 +77,31 @@ Default destination: `{{skills_dir}}/<skill-name>/` for the current agent. Do no
66
77
  - Preserve only short source excerpts when essential. Prefer paraphrase and cite sources.
67
78
  - Convert narrative advice into agent-operable instructions and source examples into original, reusable examples.
68
79
 
69
- 3. Design the target skill package.
80
+ 3. Choose single-skill or split-skill design.
81
+ - Default to single-skill mode unless `--split` or `--split-by` is present.
82
+ - In split mode, create a skill boundary map before writing: proposed skill name, trigger description, owned source topics, references/examples needed, and overlap risks.
83
+ - Prefer split mode when the material contains independent practices that should trigger separately, such as readability refactoring, naming cleanup, testability checks, exception-flow review, or framework-specific passes.
84
+ - Do not split into tiny skills that differ only by wording. Merge candidates when their triggers, workflow, and reference needs substantially overlap.
85
+ - Keep every generated child skill independently useful: clear frontmatter, focused workflow, relevant references/examples, and its own source map or source-map section.
86
+
87
+ 4. Design the target skill package.
70
88
  - Keep target `SKILL.md` focused on purpose, triggers, and workflow.
71
89
  - Put detailed knowledge in `references/`.
72
90
  - Put reusable prompts, cases, and transformed examples in `examples/`.
73
91
  - 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
92
  - 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
93
  - Add scripts only when the workflow needs repeatable processing.
76
- - Save the package under `{{skills_dir}}/<skill-name>/` using the chosen concise name.
94
+ - In single-skill mode, save the package under `{{skills_dir}}/<skill-name>/` using the chosen concise name.
95
+ - In split mode, save each child package directly under `{{skills_dir}}/<child-skill-name>/`. If `--name` is present, use it as a concise prefix only when it improves discoverability and does not make names bulky.
77
96
  - Use resolved `language.artifacts` for generated skill content unless the source material or user explicitly requires another language.
78
97
 
79
- 4. Check existing content before writing.
98
+ 5. Check existing content before writing.
80
99
  - If the target skill already has matching references or examples, update them in place.
81
100
  - Do not create near-duplicate files with different names.
82
101
  - Preserve useful existing material and add only missing or better distilled content.
102
+ - In split mode, also check existing sibling skills under `{{skills_dir}}` for matching triggers. Update a matching skill with `--update` instead of creating a new near-duplicate child.
83
103
 
84
- 5. Validate usefulness.
104
+ 6. Validate usefulness.
85
105
  - The skill must tell an agent what to do, when to do it, what good output looks like, and what mistakes to avoid.
86
106
  - References must be dense and navigable.
87
107
  - Examples must demonstrate decisions or transformations, not decorative filler.
@@ -89,6 +109,7 @@ Default destination: `{{skills_dir}}/<skill-name>/` for the current agent. Do no
89
109
  - Example coverage must match the source map: major code-facing source areas should point to concrete examples, not just prose references.
90
110
  - Generated skills must include an artifact ownership/config policy section when they write or read project artifacts.
91
111
  - Generated quality-gate skills must follow the `aif-gate-result` contract from `/aif-verify` references.
112
+ - 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
113
 
93
114
  ## Required Supporting Guidance
94
115
 
@@ -101,6 +122,6 @@ Use `examples/REQUESTS.md` for invocation patterns.
101
122
 
102
123
  ## Artifact Ownership
103
124
 
104
- - Primary ownership: generated or updated skill packages under `{{skills_dir}}/<skill-name>/`.
125
+ - Primary ownership: generated or updated skill packages under `{{skills_dir}}/<skill-name>/`, or multiple direct child skill packages under `{{skills_dir}}/<child-skill-name>/` in split mode.
105
126
  - 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
127
  - Config policy: config-aware for `language.ui`, `language.artifacts`, and `language.technical_terms` only. Do not write `config.yaml`.
@@ -29,6 +29,34 @@ 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` only as a naming seed when it helps; prefer clear child names such as `readability-refactor`, `naming-cleanup`, `condition-simplifier`, or `testability-pass`
42
+ - write each child directly under `{{skills_dir}}/<child-skill-name>/`
43
+ - give every child a distinct frontmatter description and activation trigger
44
+ - include source attribution for every child
45
+ - merge or skip candidates whose triggers overlap too much
46
+
47
+ ## Split by a Specific Strategy
48
+
49
+ ```text
50
+ /aif-distillation ./docs/review-playbook --split-by workflow --name review
51
+ ```
52
+
53
+ Expected behavior:
54
+
55
+ - split by recurring actions an agent performs, not by arbitrary file count
56
+ - create a boundary map before writing
57
+ - update matching existing child skills when `--update` is also present
58
+ - report created, updated, merged, and skipped candidates
59
+
32
60
  ## Create a Skill from a Docs Folder
33
61
 
34
62
  ```text
@@ -83,7 +83,47 @@ Before writing, answer:
83
83
 
84
84
  The target `SKILL.md` should fit in one screen when possible. It is the router and operating loop, not the knowledge base.
85
85
 
86
- ## 5. Existing-File Merge
86
+ ## 5. Split-Skill Design
87
+
88
+ Use this section only when the user passes `--split` or `--split-by <strategy>`.
89
+
90
+ Split source material into multiple skills when the material contains separate
91
+ capabilities that should activate on different user requests. A split set should
92
+ feel like a small toolkit of focused passes, not a chopped-up book summary.
93
+
94
+ Supported strategies:
95
+
96
+ | Strategy | Use when | Boundary signal |
97
+ |----------|----------|-----------------|
98
+ | `auto` | the user wants several skills but did not prescribe boundaries | strongest distinct triggers from topics, workflows, examples, and target users |
99
+ | `topic` | the source has clean domain or chapter boundaries | each topic produces different decisions or checks |
100
+ | `workflow` | the source teaches multiple actions | each action has a different input, output, or quality gate |
101
+ | `audience` | the source serves different roles or project contexts | each role/context needs different operating instructions |
102
+
103
+ Before writing split skills, create a boundary map:
104
+
105
+ | Child skill | Trigger | Source topics | References/examples | Merge risk |
106
+ |-------------|---------|---------------|---------------------|------------|
107
+ | <name> | <when it should activate> | <topics> | <files> | low/medium/high |
108
+
109
+ Merge or drop a child candidate when:
110
+
111
+ - its trigger overlaps another candidate without a meaningful workflow
112
+ difference
113
+ - it would contain only generic advice
114
+ - it depends on another child for basic operation
115
+ - it has no source-derived checks or examples
116
+
117
+ For broad code-quality material, good split candidates are often operation
118
+ passes such as readability refactoring, naming cleanup, condition
119
+ simplification, magic value extraction, exception-flow review, testability, and
120
+ framework-specific review. These names are examples, not required output.
121
+
122
+ Every child skill must include its own source attribution. For small children,
123
+ `references/SOURCE-MAP.md` may be the only reference; for larger children, add
124
+ focused references and examples.
125
+
126
+ ## 6. Existing-File Merge
87
127
 
88
128
  Before creating any new reference or example:
89
129
 
@@ -104,7 +144,11 @@ one shallow sampler, for example:
104
144
  - `refactoring-optimization.md` for safe change and measurement examples
105
145
  - `review-examples.md` for review findings and corrections
106
146
 
107
- ## 6. Traceability
147
+ In split mode, perform this merge check across sibling skills too. A proposed
148
+ child should update an existing matching skill when the existing frontmatter
149
+ description and workflow already cover the same capability.
150
+
151
+ ## 7. Traceability
108
152
 
109
153
  Every distilled skill should include a source map in a reference:
110
154
 
@@ -118,7 +162,7 @@ Every distilled skill should include a source map in a reference:
118
162
 
119
163
  Do not imply that every rule is a direct quote. Distillation is synthesis; source maps explain provenance.
120
164
 
121
- ## 7. Quality Gate
165
+ ## 8. Quality Gate
122
166
 
123
167
  Before finishing, check:
124
168
 
@@ -131,5 +175,7 @@ Before finishing, check:
131
175
  - Example coverage maps to the source areas. If references mention many
132
176
  code-facing topics but examples cover only a few, the skill is incomplete.
133
177
  - Existing references/examples were updated instead of duplicated.
178
+ - Split mode only: each child skill has a distinct trigger, direct `{{skills_dir}}/<child>/` location, source attribution, and enough references/examples to operate independently.
179
+ - Split mode only: no generated child is a near-duplicate of another generated or existing sibling skill.
134
180
  - Temporary extraction files were removed.
135
181
  - No long copyrighted passages were copied.
@@ -27,6 +27,45 @@ 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
+ {{skills_dir}}/
37
+ ├── <child-skill-a>/
38
+ │ ├── SKILL.md
39
+ │ ├── references/
40
+ │ │ ├── SOURCE-MAP.md
41
+ │ │ └── <focused-reference>.md
42
+ │ └── examples/
43
+ │ └── <focused-examples>.md
44
+ ├── <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 `{{skills_dir}}`.
52
+
53
+ Create an optional index/router skill only when it is genuinely useful, for
54
+ example when the split set is large or users need a single command-style entry
55
+ point. The index skill should list the child skills and when to use each one; it
56
+ must not duplicate their references.
57
+
58
+ Each child skill should be narrow enough to trigger independently. Good split
59
+ boundaries include:
60
+
61
+ - a distinct code review pass, such as `naming-cleanup` or `testability-pass`
62
+ - a distinct refactoring operation, such as `early-return-simplifier`
63
+ - a distinct framework or runtime practice, such as `laravel-query-boundaries`
64
+ - a distinct writing or analysis workflow, such as `comments-curator`
65
+
66
+ Avoid split boundaries based only on source chapter titles when the resulting
67
+ skills would have the same trigger and workflow.
68
+
30
69
  ## Destination
31
70
 
32
71
  Save the distilled skill in the configured skills directory of the currently active agent:
@@ -41,6 +80,11 @@ Do not write distilled output into AI Factory's package `skills/` directory unle
41
80
 
42
81
  Before writing, resolve and canonicalize the final destination path. It must stay inside the resolved `{{skills_dir}}` directory.
43
82
 
83
+ For split mode, apply this same validation to every generated child skill path.
84
+ If `--name <seed>` is supplied, use it as a naming seed or short prefix only
85
+ when it improves discoverability. Prefer clear standalone names over repetitive
86
+ prefixes.
87
+
44
88
  ## Naming
45
89
 
46
90
  Choose a concise, general name that matches the distilled practice, not just the exact source title.
@@ -66,6 +110,14 @@ Avoid:
66
110
  - vague names like `notes`, `reference`, or `book-summary`
67
111
  - reserved or unsafe names like `aif-review`, `../foo`, `.hidden`, `C:\temp\skill`, or `clean/code`
68
112
 
113
+ In split mode, generate a name list before writing and check it as a set:
114
+
115
+ - every name must pass the same validation rules
116
+ - no name may collide with another generated child
117
+ - no generated child may shadow a built-in `aif-*` skill
118
+ - names should describe activation scope, not provenance
119
+ - when multiple child names share a long prefix, remove the prefix unless it is needed to prevent ambiguity
120
+
69
121
  ## SKILL.md Rules
70
122
 
71
123
  `SKILL.md` should contain:
@@ -139,6 +191,15 @@ When `--update` is present:
139
191
  5. Add new files only for new topics.
140
192
  6. Report what changed and what was intentionally left untouched.
141
193
 
194
+ In split mode with `--update`, treat every proposed child skill independently:
195
+
196
+ 1. Build the child skill boundary map.
197
+ 2. Match each proposed child to existing skills by name, frontmatter
198
+ description, and trigger/workflow overlap.
199
+ 3. Update matched skills in place.
200
+ 4. Create new child skills only for uncovered capabilities.
201
+ 5. Report merged, created, skipped, and renamed candidates.
202
+
142
203
  ## Ownership and Context-Gate Alignment
143
204
 
144
205
  When distilling material into an AI Factory workflow or quality skill: