ai-factory 2.4.0 → 2.6.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
@@ -84,15 +84,13 @@ npx ai-factory init
84
84
  ### Upgrading from v1 to v2
85
85
 
86
86
  ```bash
87
- # 1) Update the CLI package
88
- npm install -g ai-factory@latest
89
-
90
- # 2) Migrate existing skills to v2 naming
91
87
  ai-factory upgrade
92
88
  ```
93
89
 
94
90
  `ai-factory upgrade` removes old bare-named skills (`commit`, `feature`, etc.) and installs new `aif-*` prefixed versions. Custom skills are preserved.
95
91
 
92
+ > **Note:** `ai-factory update` automatically checks npm for a newer CLI version and offers to install it before updating skills. You no longer need to run `npm install -g ai-factory@latest` manually.
93
+
96
94
  ### Example Workflow
97
95
 
98
96
  ```bash
@@ -131,7 +129,7 @@ AI Factory can generate and maintain your project docs with a single command:
131
129
 
132
130
  - **Generates docs from scratch** — analyzes your codebase and creates a lean README + detailed `docs/` pages by topic
133
131
  - **Cleans up scattered files** — finds loose CONTRIBUTING.md, ARCHITECTURE.md, SETUP.md in your root and consolidates them into a structured `docs/` directory
134
- - **Keeps docs in sync** — integrates with `/aif-implement` so documentation is updated automatically after each feature
132
+ - **Keeps docs in sync** — integrates with `/aif-implement` docs policy (`Docs: yes` = mandatory docs checkpoint routed to `/aif-docs`, `Docs: no` = visible `WARN [docs]`)
135
133
  - **Builds a docs website** — `--web` generates a static HTML site with navigation and dark mode, ready to host
136
134
 
137
135
  ---
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAYA,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA0JnD"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAoHA,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA6JnD"}
@@ -1,10 +1,116 @@
1
1
  import chalk from 'chalk';
2
2
  import path from 'path';
3
+ import { realpathSync } from 'fs';
4
+ import { execSync } from 'child_process';
5
+ import inquirer from 'inquirer';
3
6
  import { getCurrentVersion, loadConfig, saveConfig } from '../../core/config.js';
4
7
  import { getAvailableSkills, partitionSkills, updateSkills } from '../../core/installer.js';
5
8
  import { applyExtensionInjections } from '../../core/injections.js';
6
9
  import { getExtensionsDir, loadExtensionManifest } from '../../core/extensions.js';
7
10
  import { installExtensionSkillsForAllAgents, installSkillsForAllAgents, collectReplacedSkills, } from '../../core/extension-ops.js';
11
+ function parseVersion(v) {
12
+ const [core, ...rest] = v.split('-');
13
+ return {
14
+ parts: core.split('.').map(Number),
15
+ prerelease: rest.length > 0 ? rest.join('-') : null,
16
+ };
17
+ }
18
+ function isNewerVersion(latest, current) {
19
+ const l = parseVersion(latest);
20
+ const c = parseVersion(current);
21
+ for (let i = 0; i < 3; i++) {
22
+ if ((l.parts[i] ?? 0) > (c.parts[i] ?? 0))
23
+ return true;
24
+ if ((l.parts[i] ?? 0) < (c.parts[i] ?? 0))
25
+ return false;
26
+ }
27
+ // Equal major.minor.patch: prerelease is older than stable (semver §11)
28
+ if (c.prerelease && !l.prerelease)
29
+ return true;
30
+ if (!c.prerelease && l.prerelease)
31
+ return false;
32
+ return false;
33
+ }
34
+ async function getLatestVersion() {
35
+ try {
36
+ const response = await fetch('https://registry.npmjs.org/ai-factory/latest', {
37
+ signal: AbortSignal.timeout(5000),
38
+ });
39
+ if (!response.ok)
40
+ return null;
41
+ const data = await response.json();
42
+ if (!/^\d+\.\d+\.\d+(-[\w.]+)?$/.test(data.version))
43
+ return null;
44
+ return data.version;
45
+ }
46
+ catch {
47
+ return null;
48
+ }
49
+ }
50
+ function getInstallCommand(version) {
51
+ try {
52
+ const whichCmd = process.platform === 'win32' ? 'where' : 'which';
53
+ const binPath = execSync(`${whichCmd} ai-factory`, {
54
+ encoding: 'utf-8',
55
+ timeout: 5000,
56
+ stdio: ['pipe', 'pipe', 'pipe'],
57
+ }).split('\n')[0].trim();
58
+ const realPath = realpathSync(binPath).replaceAll('\\', '/');
59
+ if (realPath.includes('.bun/'))
60
+ return `bun add -g ai-factory@${version}`;
61
+ if (realPath.includes('/mise/'))
62
+ return `mise use -g npm:ai-factory@${version}`;
63
+ if (realPath.includes('/volta/'))
64
+ return `volta install ai-factory@${version}`;
65
+ if (realPath.includes('/pnpm/'))
66
+ return `pnpm add -g ai-factory@${version}`;
67
+ if (realPath.includes('/yarn/'))
68
+ return `yarn global add ai-factory@${version}`;
69
+ }
70
+ catch {
71
+ // Binary not found or symlink resolution failed, default to npm
72
+ }
73
+ return `npm install -g ai-factory@${version}`;
74
+ }
75
+ async function selfUpdate(currentVersion) {
76
+ const latestVersion = await getLatestVersion();
77
+ if (!latestVersion) {
78
+ console.log(chalk.dim('Could not check for new versions\n'));
79
+ return false;
80
+ }
81
+ if (!isNewerVersion(latestVersion, currentVersion)) {
82
+ console.log(chalk.dim('ai-factory is up to date\n'));
83
+ return false;
84
+ }
85
+ console.log(chalk.cyan(`📦 New version available: ${currentVersion} → ${latestVersion}`));
86
+ if (!process.stdin.isTTY) {
87
+ console.log(chalk.dim('Non-interactive mode — skipping self-update\n'));
88
+ return false;
89
+ }
90
+ const { shouldUpdate } = await inquirer.prompt([{
91
+ type: 'confirm',
92
+ name: 'shouldUpdate',
93
+ message: `Update ai-factory to ${latestVersion}?`,
94
+ default: true,
95
+ }]);
96
+ if (!shouldUpdate) {
97
+ console.log(chalk.dim('Skipping package update\n'));
98
+ return false;
99
+ }
100
+ try {
101
+ const installCmd = getInstallCommand(latestVersion);
102
+ console.log(chalk.dim(`\n$ ${installCmd}`));
103
+ execSync(installCmd, { stdio: 'inherit' });
104
+ console.log(chalk.green(`\n✓ Updated to ${latestVersion}`));
105
+ console.log(chalk.cyan('Please re-run `ai-factory update` to update skills with the new version.\n'));
106
+ process.exitCode = 75; // EX_TEMPFAIL — signals caller to re-run
107
+ return true;
108
+ }
109
+ catch (error) {
110
+ console.log(chalk.yellow(`⚠ Self-update failed: ${error.message}`));
111
+ return false;
112
+ }
113
+ }
8
114
  export async function updateCommand() {
9
115
  const projectDir = process.cwd();
10
116
  console.log(chalk.bold.blue('\n🏭 AI Factory - Update Skills\n'));
@@ -17,6 +123,9 @@ export async function updateCommand() {
17
123
  const currentVersion = getCurrentVersion();
18
124
  console.log(chalk.dim(`Config version: ${config.version}`));
19
125
  console.log(chalk.dim(`Package version: ${currentVersion}\n`));
126
+ const selfUpdated = await selfUpdate(currentVersion);
127
+ if (selfUpdated)
128
+ return;
20
129
  console.log(chalk.dim('Updating skills...\n'));
21
130
  try {
22
131
  const availableSkills = await getAvailableSkills();
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/cli/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAC,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAC,wBAAwB,EAAC,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAC,gBAAgB,EAAE,qBAAqB,EAAC,MAAM,0BAA0B,CAAC;AACjF,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEjC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAElE,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,CAAC;IAE5C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ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AAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAoHpD"}
1
+ {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/upgrade.ts"],"names":[],"mappings":"AAuGA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAwIpD"}
@@ -98,9 +98,13 @@ export async function upgradeCommand() {
98
98
  process.exit(1);
99
99
  }
100
100
  // Step 1: Migrate legacy plan directories to .ai-factory/plans/
101
+ // Also ensure newer v2 working directories exist.
102
+ const aiFactoryDir = path.join(projectDir, '.ai-factory');
101
103
  const featuresDir = path.join(projectDir, '.ai-factory', 'features');
102
104
  const changesDir = path.join(projectDir, '.ai-factory', 'changes');
103
105
  const plansDir = path.join(projectDir, '.ai-factory', 'plans');
106
+ const evolutionsDir = path.join(aiFactoryDir, 'evolutions');
107
+ const skillContextDir = path.join(aiFactoryDir, 'skill-context');
104
108
  if (await fileExists(changesDir) && !(await fileExists(plansDir))) {
105
109
  await fs.move(changesDir, plansDir);
106
110
  console.log(chalk.green('✓ Renamed .ai-factory/changes/ → .ai-factory/plans/\n'));
@@ -109,6 +113,21 @@ export async function upgradeCommand() {
109
113
  await fs.move(featuresDir, plansDir);
110
114
  console.log(chalk.green('✓ Renamed .ai-factory/features/ → .ai-factory/plans/\n'));
111
115
  }
116
+ // Newer v2 structure used by /aif-evolve for incremental patch processing.
117
+ await fs.ensureDir(evolutionsDir);
118
+ await fs.ensureDir(skillContextDir);
119
+ const legacyCursorPath = path.join(aiFactoryDir, 'patch-cursor.json');
120
+ const cursorPath = path.join(evolutionsDir, 'patch-cursor.json');
121
+ if (await fileExists(legacyCursorPath)) {
122
+ if (!(await fileExists(cursorPath))) {
123
+ await fs.move(legacyCursorPath, cursorPath);
124
+ console.log(chalk.green('✓ Moved .ai-factory/patch-cursor.json → .ai-factory/evolutions/patch-cursor.json\n'));
125
+ }
126
+ else {
127
+ await removeFile(legacyCursorPath);
128
+ console.log(chalk.yellow(' WARN: Both cursor files existed; removed .ai-factory/patch-cursor.json and kept .ai-factory/evolutions/patch-cursor.json as source of truth\n'));
129
+ }
130
+ }
112
131
  const availableSkills = await getAvailableSkills();
113
132
  for (const agent of config.agents) {
114
133
  const agentConfig = getAgentConfig(agent.id);
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../src/cli/commands/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE5E,gEAAgE;AAChE,MAAM,eAAe,GAAG;IACtB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,IAAI;IACJ,QAAQ;IACR,WAAW;IACX,MAAM;IACN,QAAQ;IACR,SAAS;IACT,KAAK;IACL,WAAW;IACX,SAAS;IACT,QAAQ;IACR,oBAAoB;IACpB,iBAAiB;IACjB,MAAM;IACN,QAAQ;CACT,CAAC;AAEF,sDAAsD;AACtD,MAAM,0BAA0B,GAAG;IACjC,YAAY;IACZ,yBAAyB;IACzB,2BAA2B;IAC3B,6BAA6B;IAC7B,eAAe;IACf,mBAAmB;IACnB,sBAAsB;IACtB,iBAAiB;IACjB,mBAAmB;IACnB,gBAAgB;IAChB,sBAAsB;IACtB,oBAAoB;IACpB,iBAAiB;IACjB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,+BAA+B;IAC/B,4BAA4B;IAC5B,mBAAmB;IACnB,+CAA+C;I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,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC;QAC3D,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,8BAA8B,CAAC,CAAC,CAAC;YACpE,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-factory",
3
- "version": "2.4.0",
3
+ "version": "2.6.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",
@@ -2,7 +2,7 @@
2
2
  name: aif
3
3
  description: Set up agent context for a project. Analyzes tech stack, installs relevant skills from skills.sh, generates custom skills, and configures MCP servers. Use when starting new project, setting up AI context, or asking "set up project", "configure AI", "what skills do I need".
4
4
  argument-hint: "[project description]"
5
- allowed-tools: Read Glob Grep Write Bash(mkdir *) Bash(npx skills *) Bash(python *security-scan*) Bash(rm -rf *) Skill WebFetch AskUserQuestion Questions
5
+ allowed-tools: Read Glob Grep Write Bash(mkdir *) Bash(npx skills *) Bash(python *security-scan*) Bash(rm -rf *) Skill WebFetch Questions
6
6
  ---
7
7
 
8
8
  # AI Factory - Project Setup
@@ -2,7 +2,7 @@
2
2
  name: aif-architecture
3
3
  description: Generate architecture guidelines for the project. Analyzes tech stack from DESCRIPTION.md, recommends an architecture pattern, and creates .ai-factory/ARCHITECTURE.md. Use when setting up project architecture, asking "which architecture", or after /aif setup.
4
4
  argument-hint: "[clean|ddd|microservices|monolith|layers]"
5
- allowed-tools: Read Write Glob Grep Bash(mkdir *) AskUserQuestion Questions
5
+ allowed-tools: Read Write Glob Grep Bash(mkdir *) Questions
6
6
  disable-model-invocation: false
7
7
  ---
8
8
 
@@ -5,7 +5,7 @@ description: >-
5
5
  If a build file already exists, improves it by adding missing targets and best practices.
6
6
  Use when user says "generate makefile", "create taskfile", "add justfile", "setup mage", or "build automation".
7
7
  argument-hint: "[makefile|taskfile|justfile|mage]"
8
- allowed-tools: Read Edit Glob Grep Write Bash(git *) AskUserQuestion Questions
8
+ allowed-tools: Read Edit Glob Grep Write Bash(git *) Questions
9
9
  disable-model-invocation: false
10
10
  metadata:
11
11
  author: AI Factory
@@ -2,7 +2,7 @@
2
2
  name: aif-ci
3
3
  description: Generate CI/CD pipeline (GitHub Actions / GitLab CI) with linting, static analysis, tests, security. Use when user says "ci", "setup ci", "github actions", "gitlab ci", "pipeline".
4
4
  argument-hint: "[github|gitlab] [--enhance]"
5
- allowed-tools: Read Edit Glob Grep Write Bash(git *) AskUserQuestion Questions
5
+ allowed-tools: Read Edit Glob Grep Write Bash(git *) Questions
6
6
  disable-model-invocation: true
7
7
  metadata:
8
8
  author: AI Factory
@@ -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: Read Bash(git *) AskUserQuestion Questions
5
+ allowed-tools: Read Bash(git *) Questions
6
6
  disable-model-invocation: false
7
7
  ---
8
8
 
@@ -6,7 +6,7 @@ description: >-
6
6
  Includes production security audit. Use when user says "dockerize", "add docker", "docker compose",
7
7
  "containerize", or "setup docker".
8
8
  argument-hint: "[--audit]"
9
- allowed-tools: Read Edit Glob Grep Write Bash(git *) Bash(docker *) AskUserQuestion Questions WebSearch WebFetch
9
+ allowed-tools: Read Edit Glob Grep Write Bash(git *) Bash(docker *) Questions WebSearch WebFetch
10
10
  disable-model-invocation: false
11
11
  metadata:
12
12
  author: AI Factory
@@ -2,7 +2,7 @@
2
2
  name: aif-docs
3
3
  description: Generate and maintain project documentation. Creates a lean README as a landing page with detailed docs/ directory split by topic. Use when user says "create docs", "write documentation", "update docs", "generate readme", or "document project".
4
4
  argument-hint: "[--web]"
5
- allowed-tools: Read Write Edit Glob Grep Bash(mkdir, npx, python) AskUserQuestion Questions WebFetch WebSearch
5
+ allowed-tools: Read Write Edit Glob Grep Bash(mkdir, npx, python) Questions WebFetch WebSearch
6
6
  disable-model-invocation: false
7
7
  metadata:
8
8
  author: AI Factory
@@ -2,7 +2,7 @@
2
2
  name: aif-evolve
3
3
  description: Self-improve AI Factory skills based on project context, accumulated patches, and codebase patterns. Analyzes what went wrong, what works, and enhances skills to prevent future issues. Use when you want to make AI smarter for your project.
4
4
  argument-hint: '[skill-name or "all"]'
5
- allowed-tools: Read Write Edit Glob Grep Bash(git *) AskUserQuestion Questions
5
+ allowed-tools: Read Write Edit Glob Grep Bash(git *) Questions
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -20,6 +20,18 @@ analyze recurring problems, tech-specific pitfalls, project conventions
20
20
  enhance skills with project-specific rules, guards, and patterns
21
21
  ```
22
22
 
23
+ ## Patch Consumption Policy
24
+
25
+ Use a two-layer learning model:
26
+
27
+ 1. **Raw patches** (`.ai-factory/patches/*.md`) are the source material.
28
+ 2. **Skill-context rules** (`.ai-factory/skill-context/*`) are the compact, reusable output.
29
+
30
+ Policy across workflow skills:
31
+ - `/aif-evolve` is the primary raw-patch analyzer. It processes patches **incrementally** using a cursor.
32
+ - `/aif-implement`, `/aif-fix`, and `/aif-improve` should prefer skill-context first; raw patches are fallback context only.
33
+ - Force full re-analysis only when needed (e.g., reset cursor and rerun evolve).
34
+
23
35
  ## Critical: Never Edit Built-in Skills Directly
24
36
 
25
37
  **NEVER modify any files inside built-in `aif-*` skill directories** (`skills/aif-*/`).
@@ -97,12 +109,49 @@ If any rule is violated — fix the output before presenting it to the user.
97
109
 
98
110
  ### Step 1: Collect Intelligence
99
111
 
100
- **1.1: Read all patches**
112
+ **1.1: Read patches incrementally (cursor-based)**
101
113
 
102
114
  ```
103
115
  Glob: .ai-factory/patches/*.md
104
116
  ```
105
117
 
118
+ Cursor file:
119
+
120
+ ```
121
+ .ai-factory/evolutions/patch-cursor.json
122
+ ```
123
+
124
+ Recommended shape:
125
+
126
+ ```json
127
+ {
128
+ "last_processed_patch": "YYYY-MM-DD-HH.mm.md",
129
+ "updated_at": "YYYY-MM-DD HH:mm"
130
+ }
131
+ ```
132
+
133
+ Processing rules:
134
+
135
+ 1. Glob patch files and sort by filename ascending (timestamp format is lexical-friendly).
136
+ 2. If no cursor file exists → first run: read all patches.
137
+ 3. If cursor file exists and referenced patch is present → read only patches with filename `>` `last_processed_patch`.
138
+ 4. If cursor file exists but referenced patch is missing (deleted/renamed) → emit `WARN [evolve]` and do a full rescan.
139
+ 5. Historical edits/deletes for patches older than cursor are not reliably detectable without a saved baseline (snapshot/hash manifest). Do NOT emit this warning by default.
140
+ 6. Emit `WARN [evolve]` for historical drift only when a reliable baseline exists and drift is actually detected.
141
+ 7. Full rescan procedure: delete `.ai-factory/evolutions/patch-cursor.json`, then run `/aif-evolve` again.
142
+ 8. **Do not advance cursor in Step 1.1.** Cursor is updated only after successful apply/log write in Step 7.3.
143
+
144
+ **Overlap window (anti-miss guard):**
145
+
146
+ LLMs may miss prevention points on a single pass. To reduce the chance of "permanently skipping" a patch when running incrementally:
147
+
148
+ 9. When running in incremental mode (cursor exists and referenced patch is present), ALSO read the newest 5 patches by filename (tail-5 of the sorted patch list), then de-duplicate by filename.
149
+ 10. Track these separately in your own notes:
150
+ - "New patches" = patches with filename `>` `last_processed_patch`
151
+ - "Overlap patches" = tail-5 patches
152
+ - "Processed patches" = union(New, Overlap)
153
+ 11. Cursor updates in Step 7.3 MUST be based on "New patches" only (never advance cursor when only overlap patches were processed).
154
+
106
155
  Read every patch. For each one, extract:
107
156
  - **Problem categories** (null-check, async, validation, types, API, DB, etc.)
108
157
  - **Root cause patterns** (what classes of mistake were made)
@@ -112,7 +161,7 @@ Read every patch. For each one, extract:
112
161
  - **Tags**
113
162
 
114
163
  **Build a Prevention Point Registry** — a flat list of ALL extracted prevention points across
115
- all patches. This registry is the primary input for Step 5 gap analysis.
164
+ the processed patch set in this run. This registry is the primary input for Step 5 gap analysis.
116
165
 
117
166
  ```
118
167
  | # | Patch | Prevention Point (specific action) | Target Skill(s) |
@@ -126,6 +175,8 @@ all patches. This registry is the primary input for Step 5 gap analysis.
126
175
  If a prevention point targets 2 skills, it appears once but with both skills listed —
127
176
  and EACH skill must be checked independently in Step 5.
128
177
 
178
+ When the run is incremental, this registry reflects the processed patch set for this run (new + overlap). Use full rescan when you need full historical backfill.
179
+
129
180
  **1.2: Aggregate patterns**
130
181
 
131
182
  Group patches by tags and categories. Identify:
@@ -291,6 +342,8 @@ of the existing rule against each prevention point individually.
291
342
  **Verification:** After completing the registry scan, count: total prevention points,
292
343
  covered, uncovered. If uncovered > 0 — these are gaps for Step 6.
293
344
 
345
+ Note: in incremental mode, counts represent this run's processed patch set. For full historical recount, run a full rescan.
346
+
294
347
  **5.2: Tech-stack gaps**
295
348
 
296
349
  Compare project tech stack against skill instructions:
@@ -376,7 +429,10 @@ Based on:
376
429
 
377
430
  **After presenting the full report, use `AskUserQuestion` to collect decisions:**
378
431
 
379
- For improvements — ask: Yes apply all / Let me pick / No just save report
432
+ For improvements — ask:
433
+ - Yes, apply all improvements
434
+ - Let me pick
435
+ - No, just save report (no changes applied)
380
436
 
381
437
  **If user chooses "Let me pick":** present improvements in batches of up to 4
382
438
  per `AskUserQuestion` call (same approach as Step 4 stale rules). For each
@@ -440,6 +496,27 @@ Create `.ai-factory/evolutions/YYYY-MM-DD-HH.mm.md`:
440
496
  mkdir -p .ai-factory/evolutions
441
497
  ```
442
498
 
499
+ After saving the evolution log, update cursor state:
500
+
501
+ Definitions:
502
+ - "New patches processed" = patches with filename `>` `last_processed_patch`.
503
+ - If no cursor exists (first run): "New patches" is the full patch list.
504
+ - Overlap patches do NOT count as "New patches".
505
+ - "Improvements applied" = at least one approved improvement was written to disk
506
+ (skill-context updated and/or custom skill SKILL.md edited).
507
+
508
+ Cursor update rules:
509
+
510
+ 1. If no new patches were processed, keep cursor unchanged.
511
+ 2. If new patches were processed:
512
+ - If improvements were applied: advance the cursor to the newest "New patch" filename.
513
+ - If no improvements were applied (e.g., user chose "No, just save report" or skipped all):
514
+ - Do NOT advance cursor by default.
515
+ - Ask the user whether to advance cursor anyway.
516
+ - Recommended: keep cursor unchanged to allow reruns (LLMs may miss prevention points).
517
+ - If the user explicitly chooses to advance anyway, write the cursor as usual.
518
+ 3. If execution fails before changes are finalized, do not advance cursor.
519
+
443
520
  ```markdown
444
521
  # Evolution: YYYY-MM-DD HH:mm
445
522
 
@@ -481,7 +558,7 @@ Improvements applied: Y
481
558
 
482
559
  ### Context Cleanup
483
560
 
484
- After completing evolution, suggest `/clear` or `/compact` — context is heavy after reading all patches and skills.
561
+ After completing evolution, suggest `/clear` or `/compact` — context is heavy after patch analysis and skill processing.
485
562
 
486
563
  ## Rules
487
564
 
@@ -499,7 +576,7 @@ After completing evolution, suggest `/clear` or `/compact` — context is heavy
499
576
  Merges in Step 7 (combining narrow rules into a broader one) are allowed as long
500
577
  as all prevention points are preserved in the merged rule.
501
578
  12. **Installed only** — do not evolve skills not installed in the project
502
- 13. **Ownership boundary** — this command owns `.ai-factory/evolutions/*.md` and `.ai-factory/skill-context/*`; treat roadmap/rules/research/plan artifacts as read-only context unless explicitly asked
579
+ 13. **Ownership boundary** — this command owns `.ai-factory/evolutions/*.md`, `.ai-factory/evolutions/patch-cursor.json`, and `.ai-factory/skill-context/*`; treat roadmap/rules/research/plan artifacts as read-only context unless explicitly asked
503
580
 
504
581
  ## Example
505
582
 
@@ -2,7 +2,7 @@
2
2
  name: aif-explore
3
3
  description: Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.
4
4
  argument-hint: "[topic or plan name]"
5
- allowed-tools: Read Glob Grep Write Edit Bash AskUserQuestion Questions
5
+ allowed-tools: Read Glob Grep Write Edit Bash Questions
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  name: aif-fix
3
3
  description: Fix a specific bug or problem in the codebase. Supports two modes - immediate fix or plan-first. Without arguments executes existing FIX_PLAN.md. Always suggests test coverage and adds logging. Use when user says "fix bug", "debug this", "something is broken", or pastes an error message.
4
4
  argument-hint: <bug description or error message>
5
- allowed-tools: Read Write Edit Glob Grep Bash AskUserQuestion Questions Task
5
+ allowed-tools: Read Write Edit Glob Grep Bash Questions Task
6
6
  disable-model-invocation: false
7
7
  ---
8
8
 
@@ -19,7 +19,8 @@ Fix a specific bug or problem in the codebase. Supports two modes: immediate fix
19
19
  **If the file EXISTS:**
20
20
  - Read `.ai-factory/FIX_PLAN.md`
21
21
  - Inform the user: "Found existing fix plan. Executing fix based on the plan."
22
- - **Skip Steps 0.1 through 1** go directly to **Step 2: Investigate the Codebase**, using the plan as your guide
22
+ - Skip **Step 1** (problem intake/mode choice), but still run **Step 0.1** to load context
23
+ - Then continue to **Step 2: Investigate the Codebase**, using the plan as your guide
23
24
  - Follow each step of the plan sequentially
24
25
  - After the fix is fully applied and verified, **delete** `.ai-factory/FIX_PLAN.md`:
25
26
  ```bash
@@ -41,13 +42,6 @@ Fix a specific bug or problem in the codebase. Supports two modes: immediate fix
41
42
  - Project architecture
42
43
  - Coding conventions
43
44
 
44
- **Read all patches from `.ai-factory/patches/`** if the directory exists:
45
- - Use `Glob` to find all `*.md` files in `.ai-factory/patches/`
46
- - Read each patch file to learn from past fixes
47
- - Pay attention to recurring patterns, root causes, and solutions
48
- - If the current problem resembles a past patch — apply the same approach or avoid the same mistakes
49
- - This is your accumulated experience. Use it.
50
-
51
45
  **Read `.ai-factory/skill-context/aif-fix/SKILL.md`** — MANDATORY if the file exists.
52
46
 
53
47
  This file contains project-specific rules accumulated by `/aif-evolve` from patches,
@@ -68,6 +62,16 @@ codebase conventions, and tech-stack analysis. These rules are tailored to the c
68
62
  **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
69
63
  If any rule is violated — fix the output before presenting it to the user.
70
64
 
65
+ **Patch fallback (limited, only when skill-context is missing):**
66
+
67
+ - If `.ai-factory/skill-context/aif-fix/SKILL.md` does not exist and `.ai-factory/patches/` exists:
68
+ - Use `Glob` to find `*.md` files in `.ai-factory/patches/`
69
+ - Sort patch filenames ascending (lexical), then select the last **10** (or fewer if less exist)
70
+ - Read those selected patch files only
71
+ - Prioritize recurring **Root Cause** and **Prevention** patterns
72
+ - If skill-context exists, do **not** read all patches by default.
73
+ - Optionally inspect a small, targeted subset of recent patches when tags/files clearly match the current bug.
74
+
71
75
  ### Step 1: Understand the Problem & Choose Mode
72
76
 
73
77
  From `$ARGUMENTS`, identify:
@@ -2,7 +2,7 @@
2
2
  name: aif-grounded
3
3
  description: Reliability gate for answers. Forces evidence-based reasoning, explicit uncertainty, and “insufficient information” instead of guesses. Use when user says “be 100% sure”, “no hallucinations”, “only if verified”, “grounded answer”, or when stakes are high.
4
4
  argument-hint: "[question or task]"
5
- allowed-tools: Read Write Edit Glob Grep Bash AskUserQuestion Questions
5
+ allowed-tools: Read Write Edit Glob Grep Bash Questions
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: aif-implement
3
3
  description: Execute implementation tasks from the current plan. Works through tasks sequentially, marks completion, and preserves progress for continuation across sessions. Use when user says "implement", "start coding", "execute plan", or "continue implementation".
4
- argument-hint: '[task-id or "status"]'
5
- allowed-tools: Read Write Edit Glob Grep Bash TaskList TaskGet TaskUpdate AskUserQuestion Questions
4
+ argument-hint: '[--list] [@plan-file] [task-id or "status"]'
5
+ allowed-tools: Read Write Edit Glob Grep Bash TaskList TaskGet TaskUpdate Questions
6
6
  disable-model-invocation: false
7
7
  ---
8
8
 
@@ -17,11 +17,39 @@ Execute tasks from the plan, track progress, and enable session continuation.
17
17
  **FIRST:** Determine what state we're in:
18
18
 
19
19
  ```
20
- 1. Check for uncommitted changes (git status)
21
- 2. Check for plan files (.ai-factory/PLAN.md or branch-named)
20
+ 1. Parse arguments:
21
+ - --list list available plans only (no implementation; STOP)
22
+ - @<path> → explicit plan file override (highest priority)
23
+ - <number> → start from specific task
24
+ - status → status-only mode
25
+ 2. Check for uncommitted changes (git status)
22
26
  3. Check current branch
23
27
  ```
24
28
 
29
+ ### Step 0.list: List Available Plans (`--list`)
30
+
31
+ If `$ARGUMENTS` contains `--list`, run read-only plan discovery and stop.
32
+
33
+ ```
34
+ 1. Get current branch:
35
+ git branch --show-current
36
+ 2. Convert branch to filename: replace "/" with "-", add ".md"
37
+ 3. Check existence of:
38
+ - .ai-factory/plans/<branch-name>.md
39
+ - .ai-factory/PLAN.md
40
+ - .ai-factory/FIX_PLAN.md
41
+ 4. Print plan availability summary and usage hints
42
+ 5. STOP.
43
+ ```
44
+
45
+ **Important:** In `--list` mode:
46
+ - Do not execute tasks
47
+ - Do not modify files
48
+ - Do not update TaskList statuses
49
+
50
+ For detailed output format and examples, see:
51
+ - `skills/aif-implement/references/IMPLEMENTATION-GUIDE.md` → "List Available Plans (`--list`)"
52
+
25
53
  ### Step 0.0: Resume / Recovery (after a break or after /clear)
26
54
 
27
55
  If the user is resuming **the next day**, says the session was **abandoned**, or you suspect context was lost (e.g. after `/clear`), rebuild local context from the repo **before** continuing tasks:
@@ -35,7 +63,7 @@ If the user is resuming **the next day**, says the session was **abandoned**, or
35
63
  ```
36
64
 
37
65
  Then reconcile plan/task state:
38
- - Ensure the current plan file matches the current branch (PLAN.md takes priority; otherwise branch-named plan).
66
+ - Ensure the current plan file matches the current branch (`@plan-file` override wins; otherwise branch-named plan takes priority over `PLAN.md`).
39
67
  - Compare `TaskList` statuses vs plan checkboxes.
40
68
  - If code changes for a task appear already implemented but the task is not marked completed, verify quickly and then `TaskUpdate(..., status: "completed")` and update the plan checkbox.
41
69
  - If a task is marked completed but the corresponding code is missing (rebase/reset happened), mark it back to pending and discuss with the user.
@@ -103,18 +131,6 @@ Based on choice:
103
131
  - **ALWAYS follow these rules** when implementing — they override general patterns
104
132
  - Rules are short, actionable — treat each as a hard requirement
105
133
 
106
- **Read all patches from `.ai-factory/patches/`** if the directory exists:
107
- - Use `Glob` to find all `*.md` files in `.ai-factory/patches/`
108
- - Read each patch to learn from past fixes and mistakes
109
- - Apply lessons learned: avoid patterns that caused bugs, use patterns that prevented them
110
- - Pay attention to **Root Cause** and **Prevention** sections — they tell you what NOT to do
111
-
112
- **Use this context when implementing:**
113
- - Follow the specified tech stack
114
- - Use correct import patterns and conventions
115
- - Apply proper error handling and logging as specified
116
- - **Avoid pitfalls documented in patches** — don't repeat past mistakes
117
-
118
134
  **Read `.ai-factory/skill-context/aif-implement/SKILL.md`** — MANDATORY if the file exists.
119
135
 
120
136
  This file contains project-specific rules accumulated by `/aif-evolve` from patches,
@@ -135,28 +151,69 @@ codebase conventions, and tech-stack analysis. These rules are tailored to the c
135
151
  **Enforcement:** After generating any output artifact, verify it against all skill-context rules.
136
152
  If any rule is violated — fix the output before presenting it to the user.
137
153
 
154
+ **Patch fallback (limited, only when skill-context is missing):**
155
+
156
+ - If `.ai-factory/skill-context/aif-implement/SKILL.md` does not exist and `.ai-factory/patches/` exists:
157
+ - Use `Glob` to find `*.md` files in `.ai-factory/patches/`
158
+ - Sort patch filenames ascending (lexical), then select the last **10** (or fewer if less exist)
159
+ - Read those selected patch files only
160
+ - Prioritize **Root Cause** and **Prevention** sections
161
+ - If skill-context exists, do **not** read all patches by default.
162
+ - Optionally read a few targeted recent patches only when a task clearly matches a known failure pattern.
163
+
164
+ **Use this context when implementing:**
165
+ - Follow the specified tech stack
166
+ - Use correct import patterns and conventions
167
+ - Apply proper error handling and logging as specified
168
+ - Avoid pitfalls documented in skill-context rules and relevant fallback patches
169
+
138
170
  ### Step 0.1: Find Plan File
139
171
 
172
+ **If `$ARGUMENTS` contains `@<path>`:**
173
+
174
+ Use this explicit plan file and skip automatic plan discovery.
175
+
176
+ ```
177
+ 1. Extract path after "@"
178
+ 2. Resolve relative to project root (absolute paths are also valid)
179
+ 3. If file does not exist:
180
+ "Plan file not found: <path>
181
+ Provide an existing markdown plan file, for example:
182
+ - /aif-implement @.ai-factory/PLAN.md
183
+ - /aif-implement @.ai-factory/plans/feature-user-auth.md"
184
+ → STOP
185
+ 4. If file is .ai-factory/FIX_PLAN.md:
186
+ → invoke /aif-fix (ownership + cleanup workflow) and STOP
187
+ 5. Otherwise use this file as the active plan
188
+ ```
189
+
190
+ Then continue with normal execution using the selected plan file.
191
+
192
+ **If no `@<path>` override is provided, check plan files in this order:**
193
+
140
194
  **Check for plan files in this order:**
141
195
 
142
196
  ```
143
- 1. .ai-factory/PLAN.md exists? Use it (from /aif-plan fast)
144
- 2. No .ai-factory/PLAN.md → Check current git branch:
197
+ 1. Check current git branch:
145
198
  git branch --show-current
146
- Look for .ai-factory/plans/<branch-name>.md (e.g., .ai-factory/plans/feature-user-auth.md)
147
- 3. No plan files at allCheck .ai-factory/FIX_PLAN.md
199
+ Convert branch name to filename: replace "/" with "-", add ".md"
200
+ Look for .ai-factory/plans/<branch-name>.md (e.g., feature/user-auth → .ai-factory/plans/feature-user-auth.md)
201
+ 2. No branch-based plan → Check .ai-factory/PLAN.md
202
+ 3. No branch-based plan and no .ai-factory/PLAN.md → Check .ai-factory/FIX_PLAN.md
148
203
  → If exists: invoke /aif-fix (handles its own workflow with patches) and STOP
149
204
  ```
150
205
 
151
206
  **Priority:**
152
- 1. `.ai-factory/PLAN.md` - always takes priority (from `/aif-plan fast`)
153
- 2. Branch-named file - if no .ai-factory/PLAN.md (from `/aif-plan full`)
154
- 3. `.ai-factory/FIX_PLAN.md` - redirect to `/aif-fix` (from `/aif-fix` plan mode)
207
+ 1. `@<path>` argument - explicit user-selected plan file
208
+ 2. Branch-named file (from `/aif-plan full`) - if it matches current branch
209
+ 3. `.ai-factory/PLAN.md` (from `/aif-plan fast`) - fallback when no branch-based plan exists
210
+ 4. `.ai-factory/FIX_PLAN.md` - redirect to `/aif-fix` (from `/aif-fix` plan mode)
155
211
 
156
212
  **Read the plan file** to understand:
157
213
  - Context and settings (testing, logging preferences)
158
214
  - Commit checkpoints (when to commit)
159
215
  - Task dependencies
216
+ - Task checklist format (`- [ ]` / `- [x]`) to keep progress synced
160
217
 
161
218
  ### Step 1: Load Current State
162
219
 
@@ -311,6 +368,7 @@ Files modified:
311
368
  - src/services/search.ts (created)
312
369
  - src/api/products/search.ts (created)
313
370
  - src/types/search.ts (created)
371
+ Documentation: updated existing docs | created docs/<feature-slug>.md | skipped by user | warn-only (Docs: no/unset)
314
372
 
315
373
  What's next?
316
374
 
@@ -386,17 +444,35 @@ Options:
386
444
  If user chooses "Verify first" → suggest invoking `/aif-verify`.
387
445
  If user chooses "Skip to commit" → suggest invoking `/aif-commit`.
388
446
 
389
- **Check if documentation needs updating:**
447
+ **Documentation policy checkpoint (after completion, before plan cleanup):**
390
448
 
391
- Read the plan file settings. If documentation preference is set to "yes" (from `/aif-plan full` questions), run `/aif-docs` to update documentation.
449
+ Read the plan file setting `Docs: yes/no`.
392
450
 
393
- If documentation preference is "no" or not set — skip this step silently.
394
-
395
- If documentation preference is "yes":
451
+ If plan setting is `Docs: yes`:
396
452
  ```
397
- 📝 Updating project documentation...
453
+ AskUserQuestion: Documentation checkpoint — how should we document this feature?
454
+
455
+ Options:
456
+ 1. Update existing docs (recommended) — invoke /aif-docs
457
+ 2. Create a new feature doc page — invoke /aif-docs with feature-page context
458
+ 3. Skip documentation
398
459
  ```
399
- → Invoke `/aif-docs` to analyze changes and update docs.
460
+
461
+ Handling:
462
+ - Option 1 → invoke `/aif-docs` to update README/docs based on completed work
463
+ - Option 2 → invoke `/aif-docs` with context to create `docs/<feature-slug>.md`, include sections (Summary, Usage/user-facing behavior, Configuration, API/CLI changes, Examples, Troubleshooting, See Also), and add a README docs-table link
464
+ - Option 3 → do not invoke `/aif-docs`; emit `WARN [docs] Documentation skipped by user`
465
+
466
+ If plan setting is `Docs: no` or setting is unset:
467
+ - Do **not** show a mandatory docs checkpoint prompt
468
+ - Do **not** invoke `/aif-docs` automatically
469
+ - Emit `WARN [docs] Docs policy is no/unset; skipping documentation checkpoint`
470
+
471
+ **Always include documentation outcome in the final completion output:**
472
+ - `Documentation: updated existing docs`
473
+ - `Documentation: created docs/<feature-slug>.md`
474
+ - `Documentation: skipped by user`
475
+ - `Documentation: warn-only (Docs: no/unset)`
400
476
 
401
477
  **Handle plan file after completion:**
402
478
 
@@ -498,6 +574,19 @@ To merge and clean up later:
498
574
  ```
499
575
  Continues from next incomplete task.
500
576
 
577
+ ### List Available Plans
578
+ ```
579
+ /aif-implement --list
580
+ ```
581
+ Lists `.ai-factory/PLAN.md`, `.ai-factory/FIX_PLAN.md`, and current-branch `.ai-factory/plans/<branch>.md` (if present), then exits without implementation.
582
+
583
+ ### Use Explicit Plan File
584
+ ```
585
+ /aif-implement @my-custom-plan.md
586
+ /aif-implement @.ai-factory/plans/feature-user-auth.md status
587
+ ```
588
+ Uses the provided plan file instead of auto-detecting by branch/default files.
589
+
501
590
  ### Start from Specific Task
502
591
  ```
503
592
  /aif-implement 5
@@ -38,6 +38,56 @@ What would you like to do?
38
38
 
39
39
  Tasks are persisted in the conversation/project state.
40
40
 
41
+ ## List Available Plans (`--list`)
42
+
43
+ When the user runs:
44
+
45
+ ```
46
+ /aif-implement --list
47
+ ```
48
+
49
+ Use read-only discovery and stop without executing any tasks.
50
+
51
+ ### Discovery steps
52
+
53
+ ```
54
+ git branch --show-current
55
+ ```
56
+
57
+ Then derive:
58
+ - `branchPlan = .ai-factory/plans/<branch-with-slashes-replaced-by-hyphens>.md`
59
+ - `fastPlan = .ai-factory/PLAN.md`
60
+ - `fixPlan = .ai-factory/FIX_PLAN.md`
61
+
62
+ Check which files exist and print:
63
+
64
+ ```
65
+ ## Available Plans
66
+ Current branch: <branch>
67
+ - [x| ] <branchPlan> (current-branch plan)
68
+ - [x| ] <fastPlan> (fast plan)
69
+ - [x| ] <fixPlan> (fix plan)
70
+
71
+ Use:
72
+ - /aif-implement @<path> to execute a specific plan
73
+ - /aif-implement to use automatic priority
74
+ ```
75
+
76
+ If no plans exist, print:
77
+
78
+ ```
79
+ No plan files found. Create one with:
80
+ - /aif-plan full <description>
81
+ - /aif-plan fast <description>
82
+ - /aif-fix <bug description>
83
+ ```
84
+
85
+ ### Constraints
86
+
87
+ - Do not execute implementation tasks
88
+ - Do not modify files
89
+ - Do not call `TaskUpdate`
90
+
41
91
  ### Recovery after a break or after /clear
42
92
 
43
93
  If the user is resuming later and you don't have prior conversational context, rebuild context from git + the plan file before continuing:
@@ -50,7 +100,7 @@ git diff --stat
50
100
  ```
51
101
 
52
102
  Then:
53
- - Re-open the active plan file and confirm it matches the current branch.
103
+ - Re-open the active plan file (`@plan-file` override if provided; otherwise branch plan first, then `PLAN.md`, then `FIX_PLAN.md` redirect to `/aif-fix`).
54
104
  - Use `TaskList` to find `in_progress` first, otherwise the next pending task.
55
105
  - If `TaskList` and plan checkboxes disagree, reconcile (verify code, then update `TaskUpdate` + plan checkbox).
56
106
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: aif-improve
3
- description: Refine and enhance an existing implementation plan with a second iteration. Re-analyzes the codebase, checks for gaps, missing tasks, wrong dependencies, and improves the plan quality. Use after /aif-plan to polish the plan before implementation.
4
- argument-hint: "[improvement prompt or empty for auto-review]"
5
- allowed-tools: Read Write Edit Glob Grep Bash(git *) TaskCreate TaskUpdate TaskList TaskGet AskUserQuestion Questions
3
+ description: Refine and enhance an existing implementation plan with a second iteration. Re-analyzes the codebase, checks for gaps, missing tasks, wrong dependencies, and improves the plan quality. Use after /aif-plan to polish the plan before implementation, or to improve an existing /aif-fix plan.
4
+ argument-hint: "[--list] [@plan-file] [improvement prompt or empty for auto-review]"
5
+ allowed-tools: Read Write Edit Glob Grep Bash(git *) TaskCreate TaskUpdate TaskList TaskGet Questions
6
6
  disable-model-invocation: false
7
7
  ---
8
8
 
@@ -24,18 +24,57 @@ enhanced plan with better tasks, correct dependencies, more detail
24
24
 
25
25
  ### Step 0: Find the Plan
26
26
 
27
+ **First parse arguments:**
28
+
29
+ ```
30
+ - --list → list available plans only (read-only, then STOP)
31
+ - @<path> → explicit plan file override (highest priority)
32
+ - remaining argument text → optional improvement prompt
33
+ ```
34
+
35
+ When both are present, `--list` wins and no refinement is executed.
36
+
37
+ ### Step 0.list: List Available Plans (`--list`)
38
+
39
+ If `$ARGUMENTS` contains `--list`, run read-only discovery and stop.
40
+
41
+ ```
42
+ 1. Get current branch:
43
+ git branch --show-current
44
+ 2. Convert branch to filename: replace "/" with "-", add ".md"
45
+ 3. Check existence of:
46
+ - .ai-factory/plans/<branch-name>.md
47
+ - .ai-factory/PLAN.md
48
+ - .ai-factory/FIX_PLAN.md
49
+ 4. Print availability summary and usage hints:
50
+ - /aif-improve @<path> <optional prompt>
51
+ - /aif-improve <optional prompt> # automatic priority
52
+ 5. If none found, suggest creating a plan via /aif-plan or /aif-fix
53
+ 6. STOP.
54
+ ```
55
+
56
+ **Important:** In `--list` mode:
57
+ - Do not execute refinement
58
+ - Do not modify files
59
+ - Do not update TaskList/plan content
60
+
27
61
  **Locate the active plan file using this priority:**
28
62
 
29
63
  ```
30
- 1. .ai-factory/PLAN.md exists? Use it (from /aif-plan fast)
31
- 2. No .ai-factory/PLAN.md Check current git branch:
64
+ 1. If `$ARGUMENTS` contains `@<path>`:
65
+ - Resolve the path (relative to project root; absolute paths allowed)
66
+ - If file exists → use it
67
+ - If missing → show "Plan file not found: <path>" and STOP
68
+ 2. No explicit `@<path>` override → Check current git branch:
32
69
  git branch --show-current
33
70
  → Convert branch name to filename: replace "/" with "-", add ".md"
34
- → Look for .ai-factory/plans/<branch-name>.md
71
+ → Look for .ai-factory/plans/<branch-name>.md (from /aif-plan full)
35
72
  Example: feature/user-auth → .ai-factory/plans/feature-user-auth.md
73
+ 3. No branch-based plan → Check .ai-factory/PLAN.md (from /aif-plan fast)
74
+ 4. No branch-based plan and no .ai-factory/PLAN.md → Check .ai-factory/FIX_PLAN.md (from /aif-fix plan mode)
36
75
  ```
37
76
 
38
- **If NO plan file found at either location:**
77
+ **If NO plan file found at any location:**
39
78
 
40
79
  ```
41
80
  No active plan found.
@@ -43,6 +82,7 @@ No active plan found.
43
82
  To create a plan first, use:
44
83
  - /aif-plan full <description> — for a new feature (creates branch + plan)
45
84
  - /aif-plan fast <description> — for a quick task plan
85
+ - /aif-fix <bug description> — for a bugfix plan (.ai-factory/FIX_PLAN.md)
46
86
  ```
47
87
 
48
88
  → **STOP here.** Do not proceed without a plan file.
@@ -68,16 +108,17 @@ Read `.ai-factory/DESCRIPTION.md` if it exists:
68
108
  - Conventions
69
109
  - Non-functional requirements
70
110
 
71
- **1.3: Read patches (past mistakes)**
111
+ **1.3: Read patches (limited fallback)**
72
112
 
73
- ```
74
- Glob: .ai-factory/patches/*.md
75
- ```
113
+ Use patches as fallback context, not the default source:
76
114
 
77
- If patches exist, read them to understand:
78
- - What mistakes were made before
79
- - What patterns to avoid
80
- - What the plan should account for
115
+ - If `.ai-factory/skill-context/aif-improve/SKILL.md` does not exist and `.ai-factory/patches/` exists:
116
+ - `Glob: .ai-factory/patches/*.md`
117
+ - Sort patch filenames ascending (lexical), then select the last **10** (or fewer if less exist)
118
+ - Read those selected patch files only
119
+ - Focus on reusable Prevention/Root Cause patterns that affect planning quality
120
+ - If skill-context exists, do **not** read all patches by default.
121
+ - Optionally inspect a small targeted subset when refining around a known recurring issue.
81
122
 
82
123
  **Read `.ai-factory/skill-context/aif-improve/SKILL.md`** — MANDATORY if the file exists.
83
124
 
@@ -175,7 +216,7 @@ Compare the plan against what you found. Categorize issues:
175
216
 
176
217
  **3.6: User-prompted improvements (if $ARGUMENTS provided)**
177
218
 
178
- If the user provided specific improvement instructions in `$ARGUMENTS`:
219
+ If the user provided specific improvement instructions in `$ARGUMENTS` (excluding `--list` and `@<path>` tokens):
179
220
  - Apply the user's feedback to the plan
180
221
  - Look for tasks that need modification based on the prompt
181
222
  - Add new tasks if the user's prompt requires them
@@ -377,16 +418,47 @@ Apply? → Yes → Changes applied
377
418
  ```
378
419
  User: /aif-improve
379
420
 
421
+ → Branch: main
422
+ → No .ai-factory/plans/main.md found
380
423
  → No .ai-factory/PLAN.md found
381
- Branch: main (no feature branch)
424
+ No .ai-factory/FIX_PLAN.md found
382
425
  → No plan file found
383
426
 
384
427
  "No active plan found. Create one first:
385
428
  - /aif-plan full <description>
386
- - /aif-plan fast <description>"
429
+ - /aif-plan fast <description>
430
+ - /aif-fix <bug description>"
431
+ ```
432
+
433
+ ### Example 4: Explicit plan file
434
+
435
+ ```
436
+ User: /aif-improve @my-custom-plan.md add rollback and edge-case handling
437
+
438
+ → Explicit plan override: my-custom-plan.md
439
+ → Found plan: my-custom-plan.md
440
+ → User wants: rollback + edge-case handling
441
+ → Deep codebase analysis...
442
+ → Report prepared
443
+ ```
444
+
445
+ ### Example 5: List mode
446
+
447
+ ```
448
+ User: /aif-improve --list
449
+
450
+ ## Available Plans
451
+ Current branch: feature/user-auth
452
+ - [x] .ai-factory/plans/feature-user-auth.md
453
+ - [ ] .ai-factory/PLAN.md
454
+ - [x] .ai-factory/FIX_PLAN.md
455
+
456
+ Use:
457
+ - /aif-improve @.ai-factory/plans/feature-user-auth.md
458
+ - /aif-improve add validation and retries
387
459
  ```
388
460
 
389
- ### Example 4: Plan already looks good
461
+ ### Example 6: Plan already looks good
390
462
 
391
463
  ```
392
464
  User: /aif-improve
@@ -2,7 +2,7 @@
2
2
  name: aif-loop
3
3
  description: Run a strict multi-iteration Reflex Loop with phases (PLAN, PRODUCE||PREPARE, EVALUATE, CRITIQUE, REFINE) to improve an artifact until quality gates pass or iteration limits are reached. Use when user asks for iterative refinement, quality-gated generation, or "generate -> critique -> refine" loops.
4
4
  argument-hint: "[new|resume|status|stop|list|history|clean] [task or alias]"
5
- allowed-tools: Read Write Edit Glob Grep Bash Task AskUserQuestion Questions
5
+ allowed-tools: Read Write Edit Glob Grep Bash Task Questions
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  name: aif-plan
3
3
  description: Plan implementation for a feature or task. Two modes — fast (no branch) or full (git branch + plan). Use when user says "plan", "new feature", "start feature", "create tasks".
4
4
  argument-hint: "[fast | full] [--parallel | --list | --cleanup <branch>] <description>"
5
- allowed-tools: Read Write Glob Grep Bash(git *) Bash(cd *) Bash(cp *) Bash(mkdir *) Bash(basename *) TaskCreate TaskUpdate TaskList AskUserQuestion Questions Task
5
+ allowed-tools: Read Write Glob Grep Bash(git *) Bash(cd *) Bash(cp *) Bash(mkdir *) Bash(basename *) TaskCreate TaskUpdate TaskList Questions Task
6
6
  disable-model-invocation: false
7
7
  ---
8
8
 
@@ -174,9 +174,9 @@ AskUserQuestion: Before we start, a few questions:
174
174
  - [ ] Standard - INFO level, key events only
175
175
  - [ ] Minimal - only WARN/ERROR
176
176
 
177
- 3. Update documentation after implementation?
178
- - [ ] Yes, update docs (/aif-docs)
179
- - [ ] No, skip docs
177
+ 3. Documentation policy after implementation?
178
+ - [ ] Yes mandatory docs checkpoint at completion (recommended)
179
+ - [ ] No — warn-only (`WARN [docs]`), no mandatory checkpoint
180
180
 
181
181
  4. Roadmap milestone linkage (only if `.ai-factory/ROADMAP.md` exists):
182
182
  - [ ] Link this plan to a milestone
@@ -192,6 +192,10 @@ AskUserQuestion: Before we start, a few questions:
192
192
 
193
193
  Store all preferences — they will be used in the plan file and passed to `/aif-implement`.
194
194
 
195
+ Docs policy semantics:
196
+ - `Docs: yes` → `/aif-implement` MUST show a mandatory documentation checkpoint and route docs changes through `/aif-docs`
197
+ - `Docs: no` (or unset) → `/aif-implement` emits `WARN [docs]` and continues without a mandatory docs checkpoint
198
+
195
199
  **If `.ai-factory/ROADMAP.md` exists and the user chose milestone linkage:**
196
200
  - Read `.ai-factory/ROADMAP.md` and list candidate milestones (prefer unchecked items)
197
201
  - Ask the user to pick one milestone (or type a custom one)
@@ -223,13 +227,29 @@ Copy context files so the worktree has full AI context:
223
227
  ```bash
224
228
  WORKTREE="../${DIRNAME}-<branch-name-with-hyphens>"
225
229
 
230
+ # Ensure AI Factory directories exist before copy operations
231
+ mkdir -p "${WORKTREE}/.ai-factory"
232
+ mkdir -p "${WORKTREE}/.ai-factory/plans"
233
+ mkdir -p "${WORKTREE}/.ai-factory/patches"
234
+ mkdir -p "${WORKTREE}/.ai-factory/evolutions"
235
+
226
236
  # Project context
227
237
  cp .ai-factory/DESCRIPTION.md "${WORKTREE}/.ai-factory/DESCRIPTION.md" 2>/dev/null
228
238
  cp .ai-factory/ARCHITECTURE.md "${WORKTREE}/.ai-factory/ARCHITECTURE.md" 2>/dev/null
229
239
  cp .ai-factory/RESEARCH.md "${WORKTREE}/.ai-factory/RESEARCH.md" 2>/dev/null
230
240
 
231
- # Past lessons / patches
232
- cp -r .ai-factory/patches/ "${WORKTREE}/.ai-factory/patches/" 2>/dev/null
241
+ # Skill-context (primary learning context)
242
+ cp -r .ai-factory/skill-context/ "${WORKTREE}/.ai-factory/skill-context/" 2>/dev/null
243
+
244
+ # Note: do not copy patch-cursor.json into a truncated patch set.
245
+ # The parallel worktree copies only a limited number of patches for fallback context.
246
+ # Copying the evolve cursor without the full patch history can cause /aif-evolve to skip patches
247
+ # or trigger a partial rescan.
248
+
249
+ # Limited patch fallback: copy only recent patches (latest 10 by filename)
250
+ for patch in $(ls -1 .ai-factory/patches/*.md 2>/dev/null | sort | tail -n 10); do
251
+ cp "${patch}" "${WORKTREE}/.ai-factory/patches/"
252
+ done
233
253
 
234
254
  # Agent skills + settings
235
255
  cp -r .claude/ "${WORKTREE}/.claude/" 2>/dev/null
@@ -243,7 +263,6 @@ fi
243
263
  Create changes directory and switch:
244
264
 
245
265
  ```bash
246
- mkdir -p "${WORKTREE}/.ai-factory/plans"
247
266
  cd "${WORKTREE}"
248
267
  ```
249
268
 
@@ -414,7 +433,7 @@ CONTEXT FROM /aif-plan:
414
433
  - Plan file: .ai-factory/plans/<branch-name>.md
415
434
  - Testing: yes/no
416
435
  - Logging: verbose/standard/minimal
417
- - Docs: yes/no
436
+ - Docs: yes/no # yes => mandatory docs checkpoint, no => warn-only
418
437
  ```
419
438
 
420
439
  **Full mode normal:** STOP after planning. The user reviews the plan and decides when to implement.
@@ -11,7 +11,7 @@ Created: [date]
11
11
  ## Settings
12
12
  - Testing: yes/no
13
13
  - Logging: verbose/standard/minimal
14
- - Docs: yes/no
14
+ - Docs: yes/no # yes => mandatory docs checkpoint in /aif-implement, no/unset => WARN [docs] only
15
15
 
16
16
  ## Roadmap Linkage (optional)
17
17
  <!-- Only when .ai-factory/ROADMAP.md exists -->
@@ -2,7 +2,7 @@
2
2
  name: aif-roadmap
3
3
  description: Create or update a project roadmap with major milestones. Generates .ai-factory/ROADMAP.md — a strategic checklist of high-level goals. Use when user says "roadmap", "project plan", "milestones", or "what to build next".
4
4
  argument-hint: "[check | project vision or requirements]"
5
- allowed-tools: Read Write Edit Glob Grep Bash(git *) AskUserQuestion Questions
5
+ allowed-tools: Read Write Edit Glob Grep Bash(git *) Questions
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  name: aif-rules
3
3
  description: Add project-specific rules and conventions to .ai-factory/RULES.md. Each invocation appends new rules. These rules are automatically loaded by /aif-implement before execution. Use when user says "add rule", "remember this", "convention", or "always do X".
4
4
  argument-hint: "[rule text or topic]"
5
- allowed-tools: Read Write Edit Glob Grep AskUserQuestion Questions
5
+ allowed-tools: Read Write Edit Glob Grep Questions
6
6
  disable-model-invocation: true
7
7
  ---
8
8
 
@@ -5,7 +5,7 @@ description: >-
5
5
  nothing was forgotten, code compiles, tests pass, and quality standards are met.
6
6
  Use after "/aif-implement" completes, or when user says "verify", "check work", "did we miss anything".
7
7
  argument-hint: "[--strict]"
8
- allowed-tools: Read Edit Glob Grep Bash(git *) Bash(npm *) Bash(npx *) Bash(yarn *) Bash(pnpm *) Bash(bun *) Bash(go *) Bash(python *) Bash(php *) Bash(composer *) Bash(cargo *) Bash(make *) Bash(task *) Bash(just *) Bash(mage *) TaskList TaskGet AskUserQuestion Questions
8
+ allowed-tools: Read Edit Glob Grep Bash(git *) Bash(npm *) Bash(npx *) Bash(yarn *) Bash(pnpm *) Bash(bun *) Bash(go *) Bash(python *) Bash(php *) Bash(composer *) Bash(cargo *) Bash(make *) Bash(task *) Bash(just *) Bash(mage *) TaskList TaskGet Questions
9
9
  disable-model-invocation: false
10
10
  metadata:
11
11
  author: AI Factory
@@ -7,21 +7,21 @@ Canonical contract for AI Factory workflow commands. This file defines:
7
7
 
8
8
  ## Command-to-Artifact Matrix
9
9
 
10
- | Command | Primary write ownership | Read-only context | Approved exceptions |
11
- |--------------------|------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
12
- | `aif` | `.ai-factory/DESCRIPTION.md`, `AGENTS.md` (setup map), skill installation and MCP config | Existing project files and context artifacts | May invoke `aif-architecture` to create/update `.ai-factory/ARCHITECTURE.md` during setup |
13
- | `aif-architecture` | `.ai-factory/ARCHITECTURE.md` | `.ai-factory/DESCRIPTION.md` | May update `DESCRIPTION.md` architecture pointer and `AGENTS.md` context table |
14
- | `aif-roadmap` | `.ai-factory/ROADMAP.md` | `.ai-factory/DESCRIPTION.md`, `.ai-factory/ARCHITECTURE.md` | `aif-implement` may mark completed milestones after implementation |
15
- | `aif-rules` | `.ai-factory/RULES.md` | Existing project context | None |
16
- | `aif-plan` | `.ai-factory/PLAN.md`, `.ai-factory/plans/<branch>.md` | `.ai-factory/DESCRIPTION.md`, `.ai-factory/ARCHITECTURE.md`, `.ai-factory/RESEARCH.md` | `aif-improve` may refine existing plan files |
17
- | `aif-implement` | Plan progress updates (checkboxes/task status) | `.ai-factory/RULES.md`, `.ai-factory/ARCHITECTURE.md`, `.ai-factory/DESCRIPTION.md`, patches | May update `.ai-factory/DESCRIPTION.md` and `.ai-factory/ARCHITECTURE.md` only when stack/structure changed; may update `.ai-factory/ROADMAP.md` milestone completion |
18
- | `aif-fix` | `.ai-factory/FIX_PLAN.md` (plan mode), `.ai-factory/patches/*.md` | `.ai-factory/DESCRIPTION.md`, existing patches | None (context artifacts remain read-only by default) |
19
- | `aif-evolve` | `.ai-factory/evolutions/*.md`, `.ai-factory/skill-context/*` | `.ai-factory/DESCRIPTION.md`, `.ai-factory/patches/*.md` | None |
20
- | `aif-docs` | `README.md`, `docs/*`, `AGENTS.md` documentation section | Project/context files for factual docs | None |
21
- | `aif-explore` | `.ai-factory/RESEARCH.md` only | All context and codebase files for analysis | None |
22
- | `aif-commit` | Git commit object/message only | Context artifacts are read-only gates | No context artifact writes by default |
23
- | `aif-review` | Review output/comments only | Context artifacts are read-only gates | No context artifact writes by default unless user explicitly asks |
24
- | `aif-verify` | Verification report output | Context artifacts are read-only gates | May move to fix flow after user confirmation; no default context artifact writes |
10
+ | Command | Primary write ownership | Read-only context | Approved exceptions |
11
+ |--------------------|----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
12
+ | `aif` | `.ai-factory/DESCRIPTION.md`, `AGENTS.md` (setup map), skill installation and MCP config | Existing project files and context artifacts | May invoke `aif-architecture` to create/update `.ai-factory/ARCHITECTURE.md` during setup |
13
+ | `aif-architecture` | `.ai-factory/ARCHITECTURE.md` | `.ai-factory/DESCRIPTION.md` | May update `DESCRIPTION.md` architecture pointer and `AGENTS.md` context table |
14
+ | `aif-roadmap` | `.ai-factory/ROADMAP.md` | `.ai-factory/DESCRIPTION.md`, `.ai-factory/ARCHITECTURE.md` | `aif-implement` may mark completed milestones after implementation |
15
+ | `aif-rules` | `.ai-factory/RULES.md` | Existing project context | None |
16
+ | `aif-plan` | `.ai-factory/PLAN.md`, `.ai-factory/plans/<branch>.md` | `.ai-factory/DESCRIPTION.md`, `.ai-factory/ARCHITECTURE.md`, `.ai-factory/RESEARCH.md` | `aif-improve` may refine existing plan files |
17
+ | `aif-implement` | Plan progress updates (checkboxes/task status) | `.ai-factory/RULES.md`, `.ai-factory/ARCHITECTURE.md`, `.ai-factory/DESCRIPTION.md`, `.ai-factory/skill-context/*`, limited recent patches (fallback) | May update `.ai-factory/DESCRIPTION.md` and `.ai-factory/ARCHITECTURE.md` only when stack/structure changed; may update `.ai-factory/ROADMAP.md` milestone completion |
18
+ | `aif-fix` | `.ai-factory/FIX_PLAN.md` (plan mode), `.ai-factory/patches/*.md` | `.ai-factory/DESCRIPTION.md`, `.ai-factory/skill-context/*`, limited recent patches (fallback) | None (context artifacts remain read-only by default) |
19
+ | `aif-evolve` | `.ai-factory/evolutions/*.md`, `.ai-factory/evolutions/patch-cursor.json`, `.ai-factory/skill-context/*` | `.ai-factory/DESCRIPTION.md`, `.ai-factory/patches/*.md` (processed incrementally) | None |
20
+ | `aif-docs` | `README.md`, `docs/*`, `AGENTS.md` documentation section | Project/context files for factual docs | None |
21
+ | `aif-explore` | `.ai-factory/RESEARCH.md` only | All context and codebase files for analysis | None |
22
+ | `aif-commit` | Git commit object/message only | Context artifacts are read-only gates | No context artifact writes by default |
23
+ | `aif-review` | Review output/comments only | Context artifacts are read-only gates | No context artifact writes by default unless user explicitly asks |
24
+ | `aif-verify` | Verification report output | Context artifacts are read-only gates | May move to fix flow after user confirmation; no default context artifact writes |
25
25
 
26
26
  ## Artifact Update Policy (Recommended)
27
27