Skip to content
/ Documentation
AI FactoryDocumentation

Configuration

Project Command Catalog

ai-factory commands
ai-factory commands . packages/api packages/web --json
ai-factory commands --mapping tools/project.json --json

This is a read-only catalog, not a runner. It works without an AI Factory installation/configuration in the project. It reads only package.json and composer.json scripts in explicitly selected directories (default: project root), plus local package-manager evidence and an optional explicitly selected JSON mapping.

Present Make/Task/just source files are hashed without parsing or executing recipes. No recursive workspace glob expansion, Make/Task/just execution, project imports, plugins, lifecycle hooks or --help probes take place.

The CLI skips extension command imports on this route, including its own help. Existing workflows stay intact.

For Node scripts, an explicit packageManager or one unambiguous local lock-file family selects npm/pnpm/yarn/bun. Unknown managers, conflicting lock families, unreadable evidence, unsupported script values and duplicate JSON keys remain unresolved. An explicit manager conflicting with a lock family also stays unresolved. Composer string/array declarations are cataloged without expanding references, callbacks, hooks or external code. No executable/tool availability check is implied.

Both output views contain the same versioned data:

Field Meaning
schema_version Currently 1
revision_sha256 Binds all read/missing/unresolved source records, including runner evidence and supported recipe-file fingerprints
commands[].id / name / kind Exact declaration identity, script label and package/composer/mapping source kind
cwd Project-relative working directory (. for root), normalized to forward slashes
source.path / sha256 / pointer Original source location, exact byte revision and JSON pointer; unsupported names use an unresolved ordinal identity
argv Structured invocation tokens, or null when unresolved/withheld; never a shell-escaped command string
inputs Explicit mapping input names, or null when unknown; no input values are collected
output_mode Declared human / json from a mapping, otherwise unknown
status / reason declared or unresolved, with a bounded reason code
verification / effects Always not_run / unknown; declarations cannot claim observed success
sources Read/missing/unresolved source records, including recipe files left unparsed
ambiguities Same-name command IDs with selection_required: true; no default is chosen

Choose an exact ID and CWD, rather than a bare name such as test. Use project context or ask the user when several definitions apply. Refresh after a source hash changes, including catalog revision_sha256; previous selection/verification cannot silently carry over to new bytes.

These are declaration/evidence fingerprints, not a complete dependency graph: scripts, imports and external tools invoked by a command still require independent inspection and execution evidence.

Execution requires its own existing authorization and observed evidence. The catalog does not grant shell, network, production, commit or publishing access.

Explicit Project Mappings

Point --mapping at an existing project-owned JSON object containing commands. It can be an existing metadata file with other top-level fields; there is no default mapping path, mandatory new config file, schema key, generated registry or config rewrite. Example declarations for commands whose Make/Task/just/custom CLI discovery is incomplete:

{
  "commands": [
    { "name": "verify", "cwd": ".", "argv": ["make", "verify"], "inputs": ["TEST_FILTER"], "output_mode": "human" },
    { "name": "diagnostics", "cwd": "packages/api", "argv": ["node", "tools/project.mjs", "diagnose", "--json"], "output_mode": "json" }
  ]
}

Entries accept only name, cwd, argv, inputs and output_mode; they cannot declare themselves verified or override an automatically discovered command. Their identity includes the mapping path and array index. Existing project owners retain ownership of their files; AI Factory only reads them when explicitly selected.

Raw npm/Composer script bodies and unrelated manifest fields are omitted, so embedded credentials in those bodies never enter either view. Mapping invocations containing credential/authentication markers, URLs, shell substitutions or inline evaluation are conservatively withheld as a whole (argv: null), rather than partly redacted. Command labels containing explicit credential-assignment markers are also withheld.

This is not a general secret detector: arbitrary unlabeled literals cannot be classified. Keep literal secrets out of mappings; use runtime environment/secret management and inspect any withheld invocation privately before authorized use.

Discovery accepts up to 32 explicit project-relative directories, 2,000 commands, 1 MiB per read source and 8 MiB total; limit/access/parse failures stay visible in source records. It rejects traversal, absolute/drive paths, symbolic links/junctions, non-regular sources and malformed/duplicate-key JSON.

Windows separators in relative paths are normalized; invocation tokens are not rewritten for another OS. Workspace directories and inherited package managers are not guessed: list directories and provide local evidence or an explicit mapping. Unknown effects remain unknown.

.ai-factory.json

{
  "version": "2.8.0",
  "agents": [
    {
      "id": "claude",
      "skillsDir": ".claude/skills",
      "agentsDir": ".claude/agents",
      "installedSkills": ["aif", "aif-plan", "aif-improve", "aif-implement", "aif-commit", "aif-build-automation"],
      "installedAgentFiles": [
        "best-practices-sidecar.md",
        "commit-preparer.md",
        "docs-auditor.md",
        "implement-coordinator.md",
        "implement-worker.md",
        "loop-critic.md",
        "loop-evaluator.md",
        "loop-invariant-prep.md",
        "loop-orchestrator.md",
        "loop-perf-prep.md",
        "loop-planner.md",
        "loop-producer.md",
        "loop-refiner.md",
        "loop-test-prep.md",
        "plan-coordinator.md",
        "plan-polisher.md",
        "review-sidecar.md",
        "review-validator.md",
        "rules-sidecar.md",
        "security-sidecar.md"
      ],
      "mcp": {
        "github": true,
        "postgres": false,
        "filesystem": false,
        "chromeDevtools": false,
        "playwright": false
      }
    },
    {
      "id": "codex",
      "skillsDir": ".codex/skills",
      "agentsDir": ".codex/agents",
      "configFiles": ["config.toml"],
      "installedSkills": ["aif", "aif-plan", "aif-implement"],
      "installedAgentFiles": [
        "best-practices-sidecar.toml",
        "commit-preparer.toml",
        "docs-auditor.toml",
        "implement-coordinator.toml",
        "implement-worker.toml",
        "plan-coordinator.toml",
        "plan-polisher.toml",
        "review-sidecar.toml",
        "review-validator.toml",
        "security-sidecar.toml"
      ],
      "installedConfigFiles": ["config.toml"],
      "mcp": {
        "github": false,
        "postgres": false,
        "filesystem": false,
        "chromeDevtools": false,
        "playwright": false
      }
    },
    {
      "id": "codex-app",
      "skillsDir": ".agents/skills",
      "installedSkills": ["aif", "aif-plan"],
      "mcp": {
        "github": true,
        "postgres": false,
        "filesystem": true,
        "chromeDevtools": false,
        "playwright": true
      }
    },
    {
      "id": "antigravity",
      "skillsDir": ".agents/skills",
      "agentsDir": ".agents/agents",
      "installedSkills": ["aif", "aif-plan", "aif-implement", "aif-commit"],
      "installedAgentFiles": [
        "best-practices-sidecar.md",
        "commit-preparer.md",
        "docs-auditor.md",
        "implement-coordinator.md",
        "implement-worker.md",
        "plan-coordinator.md",
        "plan-polisher.md",
        "review-sidecar.md",
        "rules-sidecar.md",
        "security-sidecar.md"
      ],
      "mcp": {
        "github": true,
        "postgres": false,
        "filesystem": true,
        "chromeDevtools": false,
        "playwright": false
      }
    }
  ],
  "extensions": [
    {
      "name": "aif-ext-example",
      "source": "https://github.com/user/aif-ext-example.git",
      "version": "1.0.0"
    }
  ]
}

The agents array can include any built-in agent IDs plus runtime IDs provided by installed extensions. Each agent keeps its own skillsDir, installed skills list, and MCP preferences. Runtimes that support custom agent files also persist agentsDir and installedAgentFiles, so ai-factory update can refresh package-managed agent files alongside skills.

Codex additionally persists configFiles / installedConfigFiles for managed files such as .codex/config.toml. Updates refresh files that still match the saved installation baseline; local modifications and untracked pre-existing config files are preserved. Codex app installs Codex-style skills into .agents/skills and can write MCP config to .codex/config.toml, but it does not define a runtime-global agentsDir.

AI Factory also stores internal managedSkills, managedAgentFiles, managedConfigFiles, and agentFileSources maps, omitted above for brevity. Managed entries keep source/install hashes. Skill entries may additionally carry renderContextHash, which detects changed template paths or shared-runtime profiles even when package source bytes are unchanged, and rawInstalledHash, which includes injection content, extension tool-request metadata, and exact file bytes. These fields do not change native agent/config ownership.

Kilo Code follows the same ownership checks when a runtime is deselected: only tracked workflow files matching their saved raw installation receipt are removed. Untracked or modified workflows are preserved. Installing a skill does not delete legacy directories under .kilocode/skills/; their names alone do not prove AI Factory ownership or authorize migration.

Removing a runtime deletes its unneeded skills only when they match the saved raw baseline as well as the normalized install hash. Modified skills and legacy entries without a raw baseline are preserved with a warning. Init, update, and upgrade issue a raw baseline only when the complete installed skill matches the rendered package source, verified registered injections, and the declared native tool requests. Unknown files, links, injection markers, or unavailable injection sources prevent a new deletion baseline, including after a skill was reinstalled.

Extensions may declare skill/runtime-scoped toolPermissions in their manifest. Claude Code skill fields carry aif-ext-tools ownership comments; no global permission settings or new .ai-factory.json permission map is created.

Updates preserve the unowned field while its source owner and extension-native declaration stay unchanged. Replacement removal or changed replacement defaults use the current source field and recompose remaining requests, without retaining the previous source's grants. Other runtimes are reported as unsupported. See Skill Tool Permissions for syntax, native policy behavior, and the package-default reconciliation limit.

agentFileSources records bundled or extension ownership. loadConfig() still reads legacy Claude-only subagentsDir, installedSubagents, and managedSubagents keys; new saves use the universal names and backfill sources when bundled inventory or installed extension manifests provide evidence.

Extension-provided agent files can target non-Claude runtimes such as Codex. Those files are often bounded helper workers (for example, one-shot reviewers or plan polishers), not automatic equivalents of the bundled Claude coordinator agents. Documentation and prompts should describe those support boundaries explicitly instead of implying full parity across runtimes.

AI Factory copies those runtime-specific agent files verbatim; runtime-local keys such as model, model_reasoning_effort, sandbox_mode, and developer_instructions belong in the agent file itself rather than in .ai-factory.json or workflow prompts. For bounded Codex helpers, prefer read-only advisory workers unless the runtime-native agent truly owns writes to a specific artifact.

Agent-file lifecycle is now consistent across the CLI:

  • Bundled loop-* files require aif-loop in the runtime's installedSkills. init and update (including --force) skip them when absent and remove previously tracked bundled loop files from disk and the installedAgentFiles, agentFileSources, and managedAgentFiles fields. This applies to Claude and Codex bundles; extension-owned and untracked user files are preserved. See Subagents.
  • extension add installs the file, records installedAgentFiles, records agentFileSources, and writes fresh managedAgentFiles hashes immediately.
  • ai-factory update preserves tracked extension-owned agent files even when an extension manifest is temporarily missing, warns, and skips only the source-driven drift healing that cannot be resolved safely.
  • extension remove deletes the runtime-local file and prunes installedAgentFiles, agentFileSources, and managedAgentFiles together.

The optional extensions array tracks installed extensions by name, original source, and version. ai-factory update now refreshes these extensions from their saved sources before base-skill updates, and ai-factory extension update [name] --force refreshes them without running the full base-skill update flow.

Extension refresh uses the saved source field:

  • npm sources are checked against the npm registry and skipped when the published version is unchanged
  • GitHub sources fetch extension.json through the GitHub API before cloning
  • local paths and non-GitHub git sources require --force for refresh

When GitHub-backed extension refreshes are frequent, set GITHUB_TOKEN to raise the GitHub API rate limit used by these checks.

Codex Skill Directories and Migration

For Codex CLI, AI Factory selects the skill directory from the project state before the command creates any directories. Codex app keeps its .agents/skills default.

Saved Codex CLI target Project state at command start Effective target
Unset or .codex/skills .agents/ exists as a directory, including an empty one .agents/skills
Unset or .codex/skills .agents/ is absent or is an ordinary file .codex/skills
.agents/skills Directory exists or needs recreation .agents/skills
Another project-relative path With or without .agents/ Saved path

The presence of .codex/ does not override an existing .agents/ directory. An empty project initialized with both CLI and app retains their separate defaults for that first command, regardless of selection order. A later update sees the app's .agents/ directory and prepares the CLI migration. Re-init preserves saved shared or custom targets.

Shared Content and Native Files

CLI and app can use one physical skill directory. AI Factory installs their combined required skill set once, while retaining each runtime's selections and results. Shared content uses $aif-*, the effective skill path, .codex configuration paths, and a common Codex rendering profile. A singleton keeps its own runtime metadata; sharing does not change either runtime's MCP capabilities.

Custom project paths affect project-local helper references. Home-scope references keep the runtime's normal home skill directory; a project override is not treated as a home override. CLI and app sharing a custom target use the common Codex home profile (~/.codex/skills); a singleton app keeps ~/.agents/skills.

Universal can share a physical skill directory with Codex CLI or Codex app using the common Codex rendering profile and $aif-* examples. Universal in its own directory keeps its default profile.

Other incompatible renderers cannot share a physical directory. Nested targets, paths outside the project, unsafe links, and overlaps with native files or migration state are rejected before installed-file changes.

Only skills move. .codex/agents/, .codex/config.toml, custom native files, and their ownership records stay in place during migration. Later native updates run separately. Removing one runtime preserves skills required by the survivor and preserves .codex/config.toml while another runtime still uses it. Moving skills does not guarantee that Codex context-budget warnings disappear.

Conflicts and Recovery

init, update, upgrade, and mutating extension commands prepare targets before ordinary installation or removal. Preflight compares actual files, including injections, with known bundled or installed extension sources and saved ownership evidence. Compatible copies can be consolidated. Unknown files, local edits, changed injection content, missing baselines, or unresolved extension sources stop the migration; --force does not bypass this check.

If a conflict names two directories, keep both copies and compare the reported skill files with their bundled or installed extension source. Back up local work before resolving it. Restore the proven source revision or reconcile the changes manually, then rerun the command. AI Factory does not merge local edits or invent missing ownership hashes. Unknown entries outside managed skill directories, including empty directories, are retained. Do not delete the whole .codex directory.

Migration writes and verifies destination files, atomically saves the new skill target, then removes only proven source files. A project lock prevents concurrent AI Factory mutations. The journal and raw recovery copies live under .ai-factory/skill-migrations/; completed operations retain their copies for inspection.

On POSIX systems, migration and rollback preserve file permission bits, including executable scripts and private config files. Conflicting permissions or concurrent permission changes stop migration. Recovery journals and backup files use 0600; operation directories use 0700. Ownership, ACLs, and extended attributes are outside this permission guarantee. Legacy journals without permission history cannot recreate prior files safely on POSIX: recovery retains the material and reports the missing metadata instead of guessing permissions.

After an interruption, rerun the command. Recovery rolls back destination writes if the old config is still current, or finishes cleanup if the new config was committed. If files or .ai-factory.json changed concurrently, recovery stops and retains its material. Preserve that directory, reconcile the reported file/config revision with the saved copies, and retry. A later extension or native-update error does not roll back an already committed skill migration.

Set LOG_LEVEL=debug for target decisions, rendering profiles, and migration diagnostics. Normal output reports conflicts and recovery locations without requiring debug logging. See Extensions for replacement and injection behavior.

Antigravity Directory Layout and Migration

Antigravity 2.0 uses the .agents/ directory structure for all agent context, skills, autonomous workers, rules, and MCP configurations.

Directory Structure

your-project/
└── .agents/
    ├── skills/           # Modular Agent Skills in standard multi-file format (SKILL.md)
    │   ├── aif/
    │   │   └── SKILL.md
    │   └── aif-plan/
    │       └── SKILL.md
    ├── agents/           # Native autonomous workers and quality sidecars (subagent: true)
    │   ├── implement-coordinator.md
    │   ├── implement-worker.md
    │   ├── plan-coordinator.md
    │   ├── plan-polisher.md
    │   ├── review-sidecar.md
    │   ├── security-sidecar.md
    │   ├── best-practices-sidecar.md
    │   ├── rules-sidecar.md
    │   ├── commit-preparer.md
    │   └── docs-auditor.md
    ├── rules/            # Project rules with YAML frontmatter triggers
    │   ├── aif-guardrails.md    (trigger: always_on)
    │   └── aif-conventions.md   (trigger: model_decision)
    └── mcp_config.json   # Model Context Protocol configuration

Migration from Antigravity 1.0 (.agent/) and Subagents Layout

When running ai-factory upgrade:

  • Flat Workflow Staging: Real Antigravity 1.0 installations that have only .agent/workflows/<name>.md (no .agent/skills/ directories) are detected automatically. Unmodified flat workflows are staged into .agent/skills/<name>/ with managed state before the skill target migration runs, ensuring a smooth upgrade path.
  • Workflow Cleanup: AI Factory removes legacy flat workflow files from .agent/workflows/ only when they match exact historical generator output variants (full package template, simplified frontmatter, or headless). Workflows with user-modified YAML metadata (changed description:, added custom fields) or body edits are preserved.
  • Cross-Agent Skill Protection: Legacy skill directory removal verifies all files against package templates file-by-file with CRLF normalization. Skill directories belonging to other agents (e.g., .claude/skills/qa/) or containing user modifications or untracked files are never deleted.
  • Rules Cleanup: Legacy rules in .agent/rules/ are compared against known rule templates before removal. User-modified rules are preserved with a warning.
  • Empty Directory Cleanup: .agent/workflows/references/, .agent/workflows/, .agent/rules/, and .agent/ are removed bottom-up only when completely empty. If user files exist, the directory structure is preserved.
  • Subagents Migration: Any legacy .agents/subagents/ directory on disk is migrated to .agents/agents/ file-by-file.
    • If the destination does not exist, the file is copied and the source is removed.
    • If the destination exists with identical content, the source copy is removed.
    • Collision Safety: If a file in .agents/subagents/ collides with a destination file in .agents/agents/ with differing content, the destination is never overwritten, the source file is preserved in .agents/subagents/, and a warning is logged.
    • .agents/subagents/ is removed only if all files were cleanly migrated and the directory is empty.

Native Agent File and Custom Rule Protection

  • Init and Update: ai-factory init and ai-factory update detect pre-existing untracked files in .agents/agents/ and .agents/rules/. Untracked user files and locally modified files are preserved with a warning and never overwritten.
  • Artifact Language Compliance: Guardrail rules installed in .agents/rules/aif-guardrails.md defer generated artifact language to language.artifacts in .ai-factory/config.yaml (defaulting to English if unspecified), while maintaining code, identifiers, and technical syntax in English, and deferring user communication to language.ui.

.ai-factory/config.yaml — User Preferences

User-editable configuration file for language, paths, workflow settings, and rules hierarchy. Created by /aif during project setup.

For the complete key-by-key schema plus the built-in skill read/write matrix, see Config Reference.

Two-file architecture:

  • .ai-factory.json — CLI state (agents, installed skills, MCP config) — managed by ai-factory package
  • config.yaml — User preferences (language, paths, workflow) — edited by developers

/aif creates the initial config.yaml from skills/aif/references/config-template.yaml, so the commented template structure is preserved instead of being rewritten as a minimal YAML blob.

On setup reruns, /aif updates only the managed key subset it owns (language.*, paths.*, workflow.*, selected git.*, and rules.base). Existing comments, manual customizations outside the targeted keys, unknown sections, and rules.<area> registrations are preserved.

Those comments are intentional: they are part of the human-editable experience for config.yaml, not disposable formatting noise.

# AI Factory Configuration
# All sections are optional — defaults are used when not specified.

# Language Settings
language:
  # Language for AI-agent communication (prompts, questions, explanations)
  # Options: en, ru, de, fr, es, zh, ja, ko, pt, it
  ui: en

  # Language for generated artifacts (plans, specs, documentation)
  artifacts: en

  # How to handle technical terms: keep | translate | mixed
  technical_terms: keep

# Path Configuration (all relative to project root)
paths:
  description: .ai-factory/DESCRIPTION.md
  architecture: .ai-factory/ARCHITECTURE.md
  docs: docs/
  roadmap: .ai-factory/ROADMAP.md
  research: .ai-factory/RESEARCH.md
  rules_file: .ai-factory/RULES.md
  plan: .ai-factory/PLAN.md
  plans: .ai-factory/plans/
  fix_plan: .ai-factory/FIX_PLAN.md
  security: .ai-factory/SECURITY.md
  references: .ai-factory/references/
  patches: .ai-factory/patches/
  evolutions: .ai-factory/evolutions/
  evolution: .ai-factory/evolution/
  specs: .ai-factory/specs/
  rules: .ai-factory/rules/
  qa: .ai-factory/qa/
  archive: .ai-factory/archive/

# Optional extra context for /aif-warmup
warmup:
  paths: []
  # Example:
  # paths:
  #   - docs/domain/
  #   - infrastructure/decisions.md

# Workflow Settings
workflow:
  explore_mode: regular            # regular | ultra; explicit mode wins
  plan_mode: ask                   # ask | fast | full | ultra; explicit mode wins
  improve_check: false             # true enables +check; --no-check overrides once
  # roadmap_next_mode: full        # optional; otherwise concrete plan_mode or ultra
  # roadmap_next_capacity:         # optional user-owned positive integer estimates
  #   fast: 1
  #   full: 2
  #   ultra: 3
  auto_create_dirs: true           # Create .ai-factory/ directories when missing
  plan_id_format: slug             # full filename / ultra directory ID: slug | sequential
  analyze_updates_architecture: true
  architecture_updates_roadmap: true
  verify_mode: normal              # strict | normal | lenient

# Git Settings
git:
  enabled: true                    # Set false for non-git repositories
  base_branch: main                # Diff / review / merge target when git is enabled
  create_branches: true            # Full/ultra plans may create branches
  branch_prefix: feature/          # Prefix for auto-created plan branches
  skip_push_after_commit: false    # If true, /aif-commit skips push prompt after commit

# Rules Configuration
rules:
  base: .ai-factory/rules/base.md  # Base rules file
  # api: .ai-factory/rules/api.md
  # frontend: .ai-factory/rules/frontend.md
  # backend: .ai-factory/rules/backend.md
  # database: .ai-factory/rules/database.md

For repeated command options, set workflow.explore_mode: ultra, workflow.plan_mode: full, or workflow.improve_check: true. Explicit command arguments override these defaults; absent settings preserve existing behavior. See Command defaults for precedence and one-invocation overrides.

/aif-plan-overview is a read-only consumer of plan/archive paths and language. /aif-roadmap-next also reads roadmap/context paths and optional workflow.roadmap_next_mode / workflow.roadmap_next_capacity. Their commented examples are user-owned and preserved on setup reruns; neither advisor writes config. See Roadmap-next defaults.

/aif-skills-audit is a read-only config consumer for context paths, scoped rules and language. It works without config, introduces no keys, and reports in chat unless --output names a new report file. See installed-library auditing.

Current config-aware skills read config.yaml at Step 0. This currently includes:

  • Read-only planning advisors: /aif-plan-overview, /aif-roadmap-next
  • Core workflow and quality commands: /aif, /aif-plan, /aif-implement, /aif-verify, /aif-commit, /aif-review, /aif-rules-check, /aif-roadmap, /aif-explore, /aif-loop, /aif-rules, /aif-warmup
  • Additional utility commands: /aif-architecture, /aif-docs, /aif-fix, /aif-improve, /aif-evolve, /aif-skills-audit, /aif-transfer, /aif-reference, /aif-distillation, /aif-security-checklist, /aif-qa, /aif-qa-check, /aif-archive

Other skills are config-agnostic for now and rely on repository context, explicit arguments, or fixed non-configurable paths such as skill-context.

Current config-agnostic built-ins include /aif-best-practices, /aif-build-automation, /aif-ci, /aif-dockerize, /aif-grounded, and /aif-skill-generator.

Language semantics:

  • language.ui controls prompts, questions, progress updates, summaries, and next-step guidance.
  • language.artifacts controls generated or persisted artifacts, including plans, fix plans, patches, rules, references, security ignore state, documentation, QA outputs, and /aif-explore research snapshots in paths.research.
  • Explicit /aif-explore ultra uses the same language policy and derives named bundles at <parent(paths.research)>/research/<english-topic-slug>/; no additional path key is needed.
  • language.technical_terms controls whether human-readable terminology is kept, translated, or mixed while commands, paths, identifiers, branch names, config keys, package names, API names, machine-readable metadata keys and enum values, and raw errors stay unchanged where required.

Optional technical writing: /aif-docs can apply writing.profile: simple-technical to exact Markdown paths listed in writing.targets, including runbooks under paths.docs. The default is none with an empty list. Resolve the artifact language first; a Russian conversation does not translate an English document or issue. writing.dictionary optionally points to a read-only project terminology file. Meaning preservation takes priority over style; code, commands, identifiers, and quoted errors stay exact. This is an editorial aid, not a requirement-correctness gate or a standards certification. /aif preserves these user-owned settings on reruns. See Writing settings for configuration, language precedence, and skip behavior.

Git workflow semantics:

  • git.enabled: false disables branch/worktree assumptions entirely. /aif-plan full still writes paths.plans/<slug>.md; /aif-plan ultra writes paths.plans/<slug>/index.md plus phase files.
  • git.base_branch is the branch used for diff, review, verify, rules-check, and merge guidance. Skills must not hardcode main.
  • git.create_branches: false keeps git awareness enabled but disables automatic branch creation for both full and ultra plans.
  • git.skip_push_after_commit: true makes /aif-commit stop after local commit without showing push prompt.
  • Ultra is strictly opt-in through /aif-plan ultra; no new config key is required, and existing fast/full prompts and artifact shapes remain unchanged.
  • paths.plan remains the default fast-plan file. If you prefer fast plans inside paths.plans/, change paths.plan manually in config.yaml.
  • paths.docs controls where /aif-docs writes the detailed documentation pages. README.md remains the landing page in the project root.
  • warmup.paths is an ordered list of extra files or directories for /aif-warmup. Entries resolve from and must stay inside project root; directories are scanned recursively for readable text files. Missing config is equivalent to an empty list.
  • paths.qa controls where /aif-qa and /aif-qa-check store QA artifacts. A derived branch slug is appended automatically: <paths.qa>/<branch-slug>/change-summary.md, test-plan.md, test-cases.md, qa-check.md, and browser replay scripts under browser-replay/. Agent-mode /aif-qa-check also uses root-level <paths.qa>/agent-context.md and <paths.qa>/agent-history.md to reuse non-sensitive cross-QA setup facts and recurring learnings, including stable browser routes/selectors and safe command/test-filter patterns. Run-specific details such as branch names, QA target paths, summary counts, assertion totals, and one-off command transcripts stay in <paths.qa>/<branch-slug>/qa-check.md. The slug is a deterministic, filesystem-safe, stable derived value with mandatory 40-character safe-slug truncation and a short hash suffix for collision resistance — see skills/aif-qa/SKILL.md for the full algorithm. /aif-qa-check binds results to the tested commit plus working tree digest, or to a manual build identifier when git is unavailable, plus deterministic test-case, target, and proven replay-script digests. Replaced replay files are preserved under browser-replay/history/.

Current schema limits: config.yaml still leaves .ai-factory/skill-context/ fixed by command contract. README.md and docs-html/ remain fixed by current documentation workflow.

Rules Hierarchy

AI Factory supports a three-level rules hierarchy:

  1. paths.rules_file — Axioms (universal project rules)

    • Short, flat list of hard requirements
    • Managed by /aif-rules
  2. rules/base.md — Project-specific base conventions

    • Naming conventions, module boundaries, error handling
    • Created by /aif from codebase analysis
  3. rules.<area> — Area-specific rule file paths in config.yaml

    • Examples: api, frontend, backend, database
    • Created by /aif-rules area:<name>

Each area is a named config key whose value is the rule file path. Example: rules.api: .ai-factory/rules/api.md.

Priority: More specific rules win. rules.api > rules/base.md > paths.rules_file

MCP Configuration

AI Factory can configure these MCP servers:

MCP Server Use Case Env Variable
GitHub PRs, issues, repo operations GITHUB_TOKEN
Postgres Database queries DATABASE_URL
Filesystem Advanced file operations -
Chrome Devtools Browser inspection, debugging, performance -
Playwright Browser automation, web testing -

Configuration saved to agent's settings file (e.g. .mcp.json for Claude Code and Universal / Other, .cursor/mcp.json for Cursor, .vscode/mcp.json for GitHub Copilot, .roo/mcp.json for Roo Code, .kilocode/mcp.json for Kilo Code, opencode.json for OpenCode, .codex/config.toml for Codex app, .agents/mcp_config.json for Antigravity).

Runtime Format Contract

Source of truth for runtime MCP shapes and wrapper examples: skills/aif/references/SETUP-MCP.md

Quick key mapping:

  • Standard MCP runtimes (including Antigravity in .agents/mcp_config.json) use mcpServers.<server>
  • OpenCode uses mcp.<server>
  • GitHub Copilot uses servers.<server>
  • Codex app uses TOML tables under mcp_servers.<server>

Environment Variables

MCP configs use ${VAR} placeholders for credentials. OpenCode stores credentials under environment, GitHub Copilot receives ${env:VAR} in .vscode/mcp.json, and Codex app receives credential names in env_vars inside .codex/config.toml. Set them before launching the agent:

export GITHUB_TOKEN="ghp_your_token"
export DATABASE_URL="postgresql://user:pass@localhost:5432/db"

Runtime-specific wrapper examples are intentionally centralized in the linked /aif MCP reference to avoid docs drift. The setup skill reads it only when configuring selected MCP servers.

Project Structure

After initialization (example for Claude Code — other agents use their own directory). Paths shown below are the default locations; many AI Factory artifacts can be relocated via config.yaml.

your-project/
├── .claude/                   # Agent config dir (varies: .cursor/, .codex/, .ai/, etc.)
│   ├── agents/
│   │   ├── best-practices-sidecar.md
│   │   ├── commit-preparer.md
│   │   ├── docs-auditor.md
│   │   ├── implement-coordinator.md
│   │   ├── implement-worker.md
│   │   ├── loop-critic.md
│   │   ├── loop-evaluator.md
│   │   ├── loop-invariant-prep.md
│   │   ├── loop-orchestrator.md
│   │   ├── loop-perf-prep.md
│   │   ├── loop-planner.md
│   │   ├── loop-producer.md
│   │   ├── loop-refiner.md
│   │   ├── loop-test-prep.md
│   │   ├── plan-coordinator.md
│   │   ├── plan-polisher.md
│   │   ├── review-sidecar.md
│   │   ├── review-validator.md
│   │   ├── rules-sidecar.md
│   │   └── security-sidecar.md
│   ├── skills/
│   │   ├── aif/
│   │   ├── aif-plan/
│   │   ├── aif-improve/
│   │   ├── aif-implement/
│   │   ├── aif-commit/
│   │   ├── aif-dockerize/
│   │   ├── aif-build-automation/
│   │   ├── aif-verify/
│   │   ├── aif-docs/
│   │   ├── aif-reference/
│   │   ├── aif-review/
│   │   └── aif-skill-generator/
│   └── settings.local.json    # Permissions config (gitignored)
├── .ai-factory/               # AI Factory working directory
│   ├── DESCRIPTION.md         # Project specification
│   ├── ARCHITECTURE.md        # Architecture decisions and guidelines
│   ├── ROADMAP.md             # Strategic milestones
│   ├── RULES.md               # Project-wide conventions
│   ├── RESEARCH.md            # Regular /aif-explore snapshot
│   ├── research/              # Explicit ultra research bundles
│   │   └── <english-topic-slug>/
│   │       ├── INDEX.md       # Manifest and adaptive artifact index
│   │       ├── RESEARCH.md    # Plan-compatible Active Summary + Sessions
│   │       └── ...            # Only justified C4, ADR, or dependency files
│   ├── PLAN.md                # Current plan (from /aif-plan fast)
│   ├── SECURITY.md            # Ignored security items (from /aif-security-checklist ignore)
│   ├── rules/                 # Base and named area rules
│   ├── archive/               # Archived plans and roadmap snapshots
│   ├── extensions/            # Installed extensions (from ai-factory extension add)
│   │   └── <extension-name>/
│   │       └── extension.json
│   ├── references/            # Knowledge references from external sources (from /aif-reference)
│   │   └── <topic>.md
│   ├── plans/                 # Full .md plans and ultra plan directories
│   │   ├── <branch-name>.md
│   │   └── <ultra-id>/
│   │       ├── index.md
│   │       └── phase-01-<slug>.md
│   ├── skill-context/         # Optional global/build files + individual skill directories; see docs/evolve.md
│   │   ├── aif-fix/
│   │   │   └── SKILL.md
│   │   └── aif-review/
│   │       └── SKILL.md
│   ├── patches/               # Self-improvement patches (from /aif-fix)
│   │   └── 2026-02-07-14.30.md
│   ├── evolutions/            # Evolution logs (from /aif-evolve, directly or via /aif-transfer)
│   │   ├── 2026-02-08-10.00.md
│   │   └── patch-cursor.json  # Incremental evolve cursor (latest processed patch)
│   ├── evolution/             # Active reflex loop state (from /aif-loop)
│   │   ├── current.json
│   │   └── <task-alias>/
│   │       ├── run.json
│   │       ├── history.jsonl
│   │       └── artifact.md
│   └── qa/                    # QA artifacts (from /aif-qa and /aif-qa-check)
│       ├── agent-context.md   # Reusable non-sensitive automated QA setup facts
│       ├── agent-history.md   # Append-only reusable cross-QA learnings
│       └── <branch-slug>/
│           ├── change-summary.md
│           ├── test-plan.md
│           ├── test-cases.md
│           ├── browser-replay/
│           │   ├── TC-NNN.js
│           │   └── history/
│           │       └── TC-NNN-<script-digest>.js
│           └── qa-check.md
├── .mcp.json                  # MCP servers config (Claude Code project scope)
├── .codex/config.toml         # Codex app MCP config when Codex app is selected
└── .ai-factory.json           # AI Factory config

Reflex Loop Files

/aif-loop keeps state lean and resumable between sessions. Defaults are shown below; the base loop directory can be relocated via paths.evolution.

  • .ai-factory/evolution/current.json — active loop pointer (to current run)
  • .ai-factory/evolution/<task-alias>/run.json — current run snapshot (loop execution state)
  • .ai-factory/evolution/<task-alias>/history.jsonl — append-only event history
  • .ai-factory/evolution/<task-alias>/artifact.md — latest artifact output

For full phase contracts and stop conditions, see Reflex Loop.

Evolution Cursor File

/aif-evolve uses a lightweight cursor to process patches incrementally. Defaults are shown below; patch and evolution-log directories can be relocated via paths.patches and paths.evolutions.

  • .ai-factory/evolutions/patch-cursor.json — last processed patch marker
  • First run (no cursor): evolve reads all patches
  • Subsequent runs: evolve reads patches newer than the cursor (plus a small overlap window to catch missed points)
  • To force a full rescan: delete patch-cursor.json and run /aif-evolve again

/aif-transfer reuses the current project's paths.evolutions for an approved delegated evolve log, but it does not copy source patches into paths.patches and never reads or advances the current patch cursor for transferred evidence.

Best Practices

Artifact Ownership and Context Gates

  • Keep context artifact ownership command-scoped (roadmap by /aif-roadmap, rules by /aif-rules, architecture by /aif-architecture, research by /aif-explore).
  • Treat /aif-rules-check, /aif-commit, /aif-review, and /aif-verify as read-only consumers of context artifacts by default.
  • Use WARN for non-blocking gate findings (missing optional files, ambiguous mapping) and ERROR for blocking violations.
  • Parseable quality gates append a final aif-gate-result JSON block with lowercase pass / warn / fail status values; see Quality Gates.

Logging

All implementations include verbose, configurable logging:

  • Use log levels (DEBUG, INFO, WARN, ERROR)
  • Control via LOG_LEVEL environment variable
  • Implement rotation for file-based logs

Commits

  • Commit checkpoints every 3-5 tasks for large features
  • Follow conventional commits format
  • Meaningful messages, not just "update code"

Testing

  • Always asked before creating plan
  • If "no tests" - no test tasks created
  • Never sneaks in test code

See Also