ai-factory 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -144,6 +144,7 @@ AI Factory can generate and maintain your project docs with a single command:
144
144
  | [Development Workflow](docs/workflow.md) | Workflow diagram, when to use what, spec-driven approach |
145
145
  | [Reflex Loop](docs/loop.md) | Iterative generate → evaluate → critique → refine workflow |
146
146
  | [Core Skills](docs/skills.md) | All slash commands — explore, plan, fix, implement, evolve, docs, and more |
147
+ | [Skill Evolution](docs/evolve.md) | How /aif-fix patches feed into /aif-evolve to generate smarter skill rules |
147
148
  | [Plan Files](docs/plan-files.md) | Plan files, self-improvement patches, skill acquisition |
148
149
  | [Security](docs/security.md) | Two-level security scanning for external skills |
149
150
  | [Extensions](docs/extensions.md) | Writing and installing extensions — commands, injections, MCP, agents |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-factory",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "type": "module",
5
5
  "description": "CLI tool for automating AI agent context setup in projects",
6
6
  "main": "dist/cli/index.js",
@@ -56,6 +56,29 @@ Read the SKILL.md and all supporting files. Ask: "Does every instruction serve t
56
56
 
57
57
  ---
58
58
 
59
+ ### Project Context
60
+
61
+ **Read `.ai-factory/skill-context/aif/SKILL.md`** — MANDATORY if the file exists.
62
+
63
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
64
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
65
+
66
+ **How to apply skill-context rules:**
67
+ - Treat them as **project-level overrides** for this skill's general instructions
68
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
69
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
70
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
71
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
72
+ they exist because the project's experience proved the default insufficient
73
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including DESCRIPTION.md,
74
+ AGENTS.md, and MCP configuration. The templates in this SKILL.md are **base structures**. If a
75
+ skill-context rule says "DESCRIPTION.md MUST include X" or "AGENTS.md MUST have section Y" —
76
+ you MUST augment the templates accordingly. Generating artifacts that violate skill-context rules
77
+ is a bug.
78
+
79
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
80
+ If any rule is violated — fix the output before presenting it to the user.
81
+
59
82
  ## Skill Acquisition Strategy
60
83
 
61
84
  **Always search skills.sh before generating. Always scan before trusting.**
@@ -395,6 +418,12 @@ Install skills, configure MCP, generate `AGENTS.md`, and generate architecture d
395
418
  4. **MCP in .mcp.json** — Project-level (agent reads MCP from `.mcp.json`, not `settings.local.json`)
396
419
  5. **Remind about env vars** — For MCP that need credentials
397
420
 
421
+ ## Artifact Ownership
422
+
423
+ - Primary ownership in this command: `.ai-factory/DESCRIPTION.md`, setup-time `AGENTS.md`, installed skills, and MCP configuration.
424
+ - Delegated ownership: invoke `/aif-architecture` to create/update `.ai-factory/ARCHITECTURE.md`.
425
+ - Read-only context in this command by default: `.ai-factory/ROADMAP.md`, `.ai-factory/RULES.md`, `.ai-factory/RESEARCH.md`, and plan files.
426
+
398
427
  ## CRITICAL: Do NOT Implement
399
428
 
400
429
  **This skill ONLY sets up context (skills + MCP). It does NOT implement the project.**
@@ -33,6 +33,26 @@ Run /aif first to set up project context, or describe your project manually:
33
33
 
34
34
  Allow standalone usage — if user provides manual input, use that instead.
35
35
 
36
+ **Read `.ai-factory/skill-context/aif-architecture/SKILL.md`** — MANDATORY if the file exists.
37
+
38
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
39
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
40
+
41
+ **How to apply skill-context rules:**
42
+ - Treat them as **project-level overrides** for this skill's general instructions
43
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
44
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
45
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
46
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
47
+ they exist because the project's experience proved the default insufficient
48
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the
49
+ ARCHITECTURE.md template. The template in this SKILL.md is a **base structure**. If a skill-context
50
+ rule says "architecture doc MUST include X" or "MUST cover section Y" — you MUST augment the
51
+ template accordingly. Generating ARCHITECTURE.md that violates skill-context rules is a bug.
52
+
53
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
54
+ If any rule is violated — fix the output before presenting it to the user.
55
+
36
56
  ### Step 1: Analyze & Recommend
37
57
 
38
58
  Based on project context, evaluate against the decision matrix and recommend an architecture:
@@ -165,6 +185,12 @@ Key rules:
165
185
  All workflow skills (/aif-plan, /aif-implement) will now follow these architecture guidelines.
166
186
  ```
167
187
 
188
+ ## Artifact Ownership
189
+
190
+ - Primary ownership: `.ai-factory/ARCHITECTURE.md`.
191
+ - Allowed companion updates: architecture pointer in `.ai-factory/DESCRIPTION.md`, architecture row in `AGENTS.md` context table.
192
+ - Read-only context: roadmap, rules, research, and plan artifacts unless user explicitly requests otherwise.
193
+
168
194
  ---
169
195
 
170
196
  ## Knowledge Base
@@ -12,6 +12,26 @@ Universal code quality guidelines applicable to any language or framework.
12
12
 
13
13
  **Context:** If `.ai-factory/ARCHITECTURE.md` exists, follow its folder structure, dependency rules, and module boundaries alongside these guidelines.
14
14
 
15
+ **Read `.ai-factory/skill-context/aif-best-practices/SKILL.md`** — MANDATORY if the file exists.
16
+
17
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
18
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
19
+
20
+ **How to apply skill-context rules:**
21
+ - Treat them as **project-level overrides** for this skill's general instructions
22
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
23
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
24
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
25
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
26
+ they exist because the project's experience proved the default insufficient
27
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the
28
+ recommendations, examples, and checklists you present. If a skill-context rule says "best practices
29
+ MUST prioritize X" or "examples MUST follow convention Y" — you MUST comply. Presenting guidance
30
+ that contradicts skill-context rules is a bug.
31
+
32
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
33
+ If any rule is violated — fix the output before presenting it to the user.
34
+
15
35
  ## Quick Reference
16
36
 
17
37
  - `/aif-best-practices` — Full overview
@@ -33,6 +33,26 @@ Read .ai-factory/DESCRIPTION.md
33
33
 
34
34
  Store the project context (tech stack, framework, architecture) for use in later steps. If the file doesn't exist, that's fine — we'll detect everything in Step 2.
35
35
 
36
+ **Read `.ai-factory/skill-context/aif-build-automation/SKILL.md`** — MANDATORY if the file exists.
37
+
38
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
39
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
40
+
41
+ **How to apply skill-context rules:**
42
+ - Treat them as **project-level overrides** for this skill's general instructions
43
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
44
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
45
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
46
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
47
+ they exist because the project's experience proved the default insufficient
48
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the generated
49
+ build files (Makefile, Taskfile, justfile, magefile). Templates in this skill are **base structures**.
50
+ If a skill-context rule says "build file MUST include target X" or "MUST follow convention Y" —
51
+ you MUST comply. Generating build automation that violates skill-context rules is a bug.
52
+
53
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
54
+ If any rule is violated — fix the output before presenting it to the user.
55
+
36
56
  ---
37
57
 
38
58
  ## Step 1: Detect Existing Build Files & Determine Mode
@@ -34,6 +34,26 @@ Read .ai-factory/DESCRIPTION.md
34
34
 
35
35
  Store project context for later steps. If absent, Step 2 detects everything.
36
36
 
37
+ **Read `.ai-factory/skill-context/aif-ci/SKILL.md`** — MANDATORY if the file exists.
38
+
39
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
40
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
41
+
42
+ **How to apply skill-context rules:**
43
+ - Treat them as **project-level overrides** for this skill's general instructions
44
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
45
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
46
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
47
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
48
+ they exist because the project's experience proved the default insufficient
49
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including generated
50
+ CI workflow files and audit reports. Templates in this skill are **base structures**. If a
51
+ skill-context rule says "CI MUST include step X" or "workflow MUST have job Y" — you MUST augment
52
+ the templates accordingly. Generating CI config that violates skill-context rules is a bug.
53
+
54
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
55
+ If any rule is violated — fix the output before presenting it to the user.
56
+
37
57
  ---
38
58
 
39
59
  ## Step 1: Detect Existing CI & Determine Mode
@@ -2,7 +2,7 @@
2
2
  name: aif-commit
3
3
  description: Create conventional commit messages by analyzing staged changes. Generates semantic commit messages following the Conventional Commits specification. Use when user says "commit", "save changes", or "create commit".
4
4
  argument-hint: "[scope or context]"
5
- allowed-tools: Bash(git *)
5
+ allowed-tools: Read Bash(git *) AskUserQuestion Questions
6
6
  disable-model-invocation: false
7
7
  ---
8
8
 
@@ -12,12 +12,38 @@ Generate commit messages following the [Conventional Commits](https://www.conven
12
12
 
13
13
  ## Workflow
14
14
 
15
+ **Read `.ai-factory/skill-context/aif-commit/SKILL.md`** — MANDATORY if the file exists.
16
+
17
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
18
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
19
+
20
+ **How to apply skill-context rules:**
21
+ - Treat them as **project-level overrides** for this skill's general instructions
22
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
23
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
24
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
25
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
26
+ they exist because the project's experience proved the default insufficient
27
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including the commit
28
+ message format and conventions. If a skill-context rule says "commits MUST follow format X"
29
+ or "message MUST include Y" — you MUST comply. Generating a commit message that violates
30
+ skill-context rules is a bug.
31
+
32
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
33
+ If any rule is violated — fix the output before presenting it to the user.
34
+
15
35
  1. **Analyze Changes**
16
36
  - Run `git status` to see staged files
17
37
  - Run `git diff --cached` to see staged changes
18
38
  - If nothing staged, show warning and suggest staging
19
39
 
20
- 2. **Determine Commit Type**
40
+ 2. **Run Context Gates (Read-Only)**
41
+ - Check `.ai-factory/ARCHITECTURE.md` and `.ai-factory/DESCRIPTION.md` (if present) to catch obvious scope/boundary drift
42
+ - Check `.ai-factory/RULES.md` and `.ai-factory/ROADMAP.md` (if present) to catch rule and milestone alignment issues
43
+ - Missing optional files (`ROADMAP.md`, `RULES.md`) are `WARN`, not blockers
44
+ - Never modify context artifacts from this command
45
+
46
+ 3. **Determine Commit Type**
21
47
  - `feat`: New feature
22
48
  - `fix`: Bug fix
23
49
  - `docs`: Documentation only
@@ -29,12 +55,12 @@ Generate commit messages following the [Conventional Commits](https://www.conven
29
55
  - `ci`: CI configuration
30
56
  - `chore`: Maintenance tasks
31
57
 
32
- 3. **Identify Scope**
58
+ 4. **Identify Scope**
33
59
  - From file paths (e.g., `src/auth/` → `auth`)
34
60
  - From argument if provided
35
61
  - Optional - omit if changes span multiple areas
36
62
 
37
- 4. **Generate Message**
63
+ 5. **Generate Message**
38
64
  - Keep subject line under 72 characters
39
65
  - Use imperative mood ("add" not "added")
40
66
  - Don't capitalize first letter after type
@@ -80,16 +106,18 @@ When invoked:
80
106
 
81
107
  1. Check for staged changes
82
108
  2. Analyze the diff content
83
- 3. Propose a commit message
84
- 4. Ask for confirmation or modifications
85
- 5. Execute `git commit` with the message
86
- 6. After a successful commit, offer to push:
109
+ 3. Run read-only context gates and summarize findings as `WARN`/`ERROR`
110
+ 4. If commit type is `feat`/`fix`/`perf` and roadmap exists, check milestone linkage; if missing, warn and suggest adding linkage in commit body/footer
111
+ 5. Propose a commit message
112
+ 6. Ask for confirmation or modifications
113
+ 7. Execute `git commit` with the message
114
+ 8. After a successful commit, offer to push:
87
115
  - Show branch/ahead status: `git status -sb`
88
116
  - If the branch has no upstream, use: `git push -u origin <branch>`
89
117
  - Otherwise: `git push`
90
118
  - User choice:
91
- - [ ] Push now
92
- - [ ] Skip push
119
+ - [ ] Push now
120
+ - [ ] Skip push
93
121
 
94
122
  If argument provided (e.g., `/aif-commit auth`):
95
123
  - Use it as the scope
@@ -99,6 +127,8 @@ If argument provided (e.g., `/aif-commit auth`):
99
127
 
100
128
  - Never commit secrets or credentials
101
129
  - Review large diffs carefully before committing
130
+ - `/aif-commit` has no implicit strict mode — context gates are warning-first unless user explicitly requests blocking behavior
131
+ - Treat `.ai-factory/ARCHITECTURE.md`, `.ai-factory/ROADMAP.md`, `.ai-factory/RULES.md`, and `.ai-factory/DESCRIPTION.md` as read-only context in this command
102
132
  - If staged changes contain unrelated work (e.g., a feature + a bugfix, or changes to independent modules), suggest splitting into separate commits:
103
133
  1. Show which files/hunks belong to which commit
104
134
  2. Ask for confirmation
@@ -38,6 +38,27 @@ Read .ai-factory/DESCRIPTION.md
38
38
 
39
39
  Store project context for later steps. If absent, Step 2 detects everything.
40
40
 
41
+ **Read `.ai-factory/skill-context/aif-dockerize/SKILL.md`** — MANDATORY if the file exists.
42
+
43
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
44
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
45
+
46
+ **How to apply skill-context rules:**
47
+ - Treat them as **project-level overrides** for this skill's general instructions
48
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
49
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
50
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
51
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
52
+ they exist because the project's experience proved the default insufficient
53
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including Dockerfile,
54
+ compose files, .dockerignore, and deploy scripts. Templates in this skill are **base structures**.
55
+ If a skill-context rule says "Dockerfile MUST include X" or "compose MUST have service Y" —
56
+ you MUST augment the templates accordingly. Generating Docker config that violates skill-context
57
+ rules is a bug.
58
+
59
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
60
+ If any rule is violated — fix the output before presenting it to the user.
61
+
41
62
  ---
42
63
 
43
64
  ## Step 1: Detect Existing Docker Files & Determine Mode
@@ -38,6 +38,27 @@ Generate, maintain, and improve project documentation following a landing-page R
38
38
  - Look for existing docs, comments, API endpoints, CLI commands
39
39
  - Check for existing README.md and docs/ directory
40
40
 
41
+ **Read `.ai-factory/skill-context/aif-docs/SKILL.md`** — MANDATORY if the file exists.
42
+
43
+ This file contains project-specific rules accumulated by `/aif-evolve` from patches,
44
+ codebase conventions, and tech-stack analysis. These rules are tailored to the current project.
45
+
46
+ **How to apply skill-context rules:**
47
+ - Treat them as **project-level overrides** for this skill's general instructions
48
+ - When a skill-context rule conflicts with a general rule written in this SKILL.md,
49
+ **the skill-context rule wins** (more specific context takes priority — same principle as nested CLAUDE.md files)
50
+ - When there is no conflict, apply both: general rules from SKILL.md + project rules from skill-context
51
+ - Do NOT ignore skill-context rules even if they seem to contradict this skill's defaults —
52
+ they exist because the project's experience proved the default insufficient
53
+ - **CRITICAL:** skill-context rules apply to ALL outputs of this skill — including README.md,
54
+ documentation pages, and their templates. The templates in this SKILL.md are **base structures**.
55
+ If a skill-context rule says "docs MUST include X" or "README MUST have section Y" — you MUST
56
+ augment the templates accordingly. Generating documentation that violates skill-context rules
57
+ is a bug.
58
+
59
+ **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
60
+ If any rule is violated — fix the output before presenting it to the user.
61
+
41
62
  **Scan for scattered markdown files in project root:**
42
63
 
43
64
  Use `Glob` to find all `*.md` files in the project root (exclude `node_modules/`, `.ai-factory/`, agent dirs):
@@ -496,3 +517,4 @@ Options:
496
517
  4. **Use the project's language** — if project README is in Russian, write docs in Russian
497
518
  5. **Preserve existing badges/logos** — don't remove them during restructuring
498
519
  6. **Add to .gitignore** if generating HTML: add `docs-html/` to .gitignore
520
+ 7. **Ownership boundary** — this command owns documentation artifacts (`README.md`, `docs/*`, and the Documentation section in `AGENTS.md`), not `.ai-factory/ROADMAP.md`, `.ai-factory/RULES.md`, or `.ai-factory/RESEARCH.md`