Skip to content
/ Documentation
AI FactoryDocumentation

Getting Started

Selecting aif also installs aif-skill-generator: the setup skill requires its security scanner and blocked-skill cleanup helpers. You can still select the generator independently. Existing installations missing this dependency are repaired by ai-factory update.

If automatic installation finds an untracked or modified generator at the target path, it preserves the files and reports a conflict. Move or back up that target before retrying, including when using update --force.

What is AI Factory?

AI Factory is a stack-agnostic CLI tool and skill system that works with any language, framework, or platform:

  1. Analyzes your project — understands your codebase structure and conventions
  2. Installs relevant skills — downloads from skills.sh or generates custom ones
  3. Configures MCP servers — GitHub, Postgres, Filesystem, Playwright based on your needs
  4. Provides spec-driven workflow — structured feature development with plans, tasks, and commits

Supported Agents

AI Factory works with any AI coding agent. During ai-factory init, you choose one or more target agents and skills are installed to each agent's correct directory with paths adapted automatically:

Agent Config Directory Skills Directory
Claude Code .claude/ .claude/skills/
Cursor .cursor/ .cursor/skills/
Windsurf .windsurf/ .windsurf/skills/
Roo Code .roo/ .roo/skills/
Kilo Code .kilocode/ .kilocode/skills/, .kilocode/workflows/
Antigravity .agents/ .agents/skills/
OpenCode .opencode/ .opencode/skills/
Warp .warp/ .warp/skills/
Zencoder .zencoder/ .zencoder/skills/
Codex CLI .codex/ .agents/skills/ when .agents/ already exists; otherwise .codex/skills/
Codex app .agents/ .agents/skills/
GitHub Copilot .github/ .github/skills/
Gemini CLI .gemini/ .gemini/skills/
Junie .junie/ .junie/skills/
Qwen Code .qwen/ .qwen/skills/
Universal / Other .agents/ .agents/skills/

When Claude Code is selected, AI Factory installs bundled Claude agent files into .claude/agents/ and tracks them in .ai-factory.json with the universal agentsDir, installedAgentFiles, and managedAgentFiles fields. When Codex CLI is selected, AI Factory also installs bundled Codex native agent TOML files into .codex/agents/ plus a managed .codex/config.toml.

When Antigravity is selected, AI Factory installs bundled Antigravity agent files into .agents/agents/, triggered rules into .agents/rules/, and configures MCP in .agents/mcp_config.json.

Extensions can additionally provide agent files for Codex or extension-defined runtimes through the same generic agent-files mechanism, but the bundled Claude/Codex/Antigravity package inventory is documented separately in Subagents.

Codex CLI and Codex app receive Codex-style skill content and use $aif-* invocations. They can share .agents/skills/ with Universal / Other: shared skills use the Codex $aif-* format, while all selected agents remain separate entries with their own MCP settings.

Universal selected alone and other slash-command runtimes keep /aif-* examples. See Codex skill directories and migration for first-init defaults, saved overrides, and conflict recovery.

MCP server configuration is supported for Claude Code, Cursor, GitHub Copilot, Roo Code, Kilo Code, OpenCode, Qwen Code, Codex app, Antigravity, and Universal / Other. Antigravity writes standard MCP settings to .agents/mcp_config.json. Universal writes standard MCP settings to .mcp.json. Other agents get skills installed with correct paths but without MCP auto-configuration.

Your First Project

# 1. Install AI Factory
npm install -g ai-factory

# 2. Go to your project
cd my-project

# 3. Initialize — pick agents, install skills, configure MCP
ai-factory init
# Or non-interactively: ai-factory init --agents claude --mcp github,playwright

# 4. Open your AI agent (Claude Code, Cursor, etc.) and run:
/aif
# Codex CLI and Codex app use: $aif

# 5. Optional discovery before planning
/aif-explore Add user authentication with OAuth

# 6. Start building
/aif-plan Add user authentication with OAuth

If scope is unclear, start with /aif-explore (optionally save results to paths.research, default: .ai-factory/RESEARCH.md). Use /aif-explore ultra <topic> when the investigation needs a durable system-analysis bundle with adaptive C4/ADR/dependency views.

If the task is clear but the answer must be strictly verified, use /aif-grounded; if the direction is already clear, jump straight to /aif-plan. From there, AI Factory builds a plan, optionally creates a branch/worktree when git settings allow it, and you run /aif-implement to execute it step by step.

CLI Commands

# Initialize project (interactive wizard)
ai-factory init

# Initialize non-interactively with flags
ai-factory init --agents claude,codex --mcp playwright,github
ai-factory init --agents cursor --skills commit,plan
ai-factory init --agents claude --no-skills --mcp github

# Update skills to latest version (also checks for CLI updates)
ai-factory update

# Force clean reinstall of currently installed base skills
ai-factory update --force

# Migrate existing skills from v1 naming to v2 naming
ai-factory upgrade

# Audit artifact metadata links (frontmatter id/depends_on/affects/etc.)
ai-factory audit-artifacts

# Discover declared project commands without executing them
ai-factory commands
ai-factory commands . packages/api packages/web --json

# Record an explicitly registered skill invocation and verify its instruction bytes
ai-factory instructions start --spec composition.json
ai-factory instructions verify RUN

# Install an extension (local path, git URL, or npm package)
ai-factory extension add ./my-extension

# List installed extensions
ai-factory extension list

# Update extensions from their sources
ai-factory extension update

# Update a specific extension (use --force to refresh unchanged versions)
ai-factory extension update my-extension --force

# Remove extension
ai-factory extension remove my-extension

See Plan Files for the artifact frontmatter schema, default scan paths, --json output, --strict exit behavior, and path boundary rules.

See Instruction Manifests for preparing composition.json, snapshot capture policy, load evidence, and restoration. Recording is opt-in; ordinary skill invocations remain unchanged.

ai-factory init Flags

  • --agents - Comma-separated target agents (for example claude,codex)
  • --skills - Comma-separated skill set to install instead of full defaults
  • --no-skills - Select no base skills (useful when only MCP setup is needed); on reruns, removes unchanged base skills with verified ownership
  • --mcp - Comma-separated MCP servers to configure (github, postgres, filesystem, chrome-devtools, playwright)

Rerunning init removes deselected base skills only when their saved raw ownership receipt proves that the installed contents are unchanged. This also applies to flat workflow files.

Modified skills, extra user files inside a tracked skill directory, and installations without a verifiable receipt are preserved with a warning; the deselected skill is removed from CLI tracking. Cleanup also preserves custom skills, untracked files, and extension replacements.

Bundled loop-* agent files require aif-loop to be selected; init and update remove previously tracked bundled loop agents when that skill is absent. Other bundled agent files are installed independently of the base skill selection.

Upgrade from v1 to v2

Run ai-factory upgrade to migrate old bare-named skills (commit, feature, etc.) to aif-* names. Custom skills are preserved.

ai-factory update now:

  • Checks whether a newer ai-factory package is available and prints the exact global install command when package-level CLI features require an npm package update
  • Checks for extension updates from their sources (npm, GitHub, etc.) before updating base skills
  • Prints per-agent status buckets for base skills (changed, unchanged, skipped, removed)
  • For runtimes with managed agent files, refreshes bundled package-managed agent files and prints a separate Agent files status block
  • For Codex CLI, prepares any required skill-directory migration before extension or native-file updates; unresolved migration conflicts stop the update, including with --force
  • For Codex CLI, also refreshes managed .codex/config.toml and prints a separate Config files status block; local modifications and untracked pre-existing config files are preserved
  • Skills newly available in the package but not previously installed are shown as skipped (not auto-installed)

The project command catalog reads supported declarations and optional existing JSON mappings. It never executes commands, imports project extensions, installs tooling, or rewrites configuration.

Documentation Commands

/aif-docs
/aif-docs --web

/aif-docs refreshes README + docs/ from the current project context. --web additionally emits a static documentation site (docs-html/).

Next Steps