Skip to content

Factory AI Formatter

PropertyValue
TierCustom
Main outputAGENTS.md
Dot directory.factory/
SkillsYes (.factory/skills/<name>/SKILL.md)
AgentsYes (.factory/droids/<name>.md)
CommandsYes (.factory/commands/<name>.md)
Local filesNo

Output Files

FilePathPurpose
Main instructionsAGENTS.mdPrimary rule file
Always-on rules.factory/rules/**/*.mdSplit rule files when rulesMode: split
Lifecycle hooks.factory/hooks.jsonProject hooks in multifile and full modes
Skills.factory/skills/<name>/SKILL.mdReusable skill definitions in multifile and full modes
Commands.factory/commands/<name>.mdSlash commands
Agents.factory/droids/<name>.mdAgent configurations
MCP servers.factory/mcp.jsonMCP server config in multifile and full modes
Plugins.factory/plugins.jsonPlugin config in multifile and full modes

Supported Features

FeatureSupported
Markdown OutputYes
MDC FormatNo
Code BlocksYes
Mermaid DiagramsYes
Single File OutputYes
Multiple Rule FilesYes
Workflow FilesNo
Nested Directory StructureYes
YAML FrontmatterYes
Description in FrontmatterYes
Globs in FrontmatterNo
Activation TypeNo
Glob Pattern TargetingNo
Always Apply RulesYes
Manual ActivationNo
Auto/Model ActivationNo
Structured ExamplesYes
Character Limit ValidationNo
Content Section SplittingYes
Guard DependenciesYes
Context File InclusionNo
@-MentionsNo
Tool IntegrationNo
Path-Specific RulesNo
Prompt FilesNo
Slash CommandsYes
SkillsYes
Agent InstructionsYes
Local MemoryNo
Nested MemoryNo

Limitations & Quirks

  • Uses AGENTS.md as the main file (extends MarkdownInstructionFormatter)
  • Skills go to .factory/skills/<name>/SKILL.md
  • Agents are called “droids” - output to .factory/droids/<name>.md
  • Droid model and specModel values become API ids such as claude-sonnet-4-5-20250929 or gpt-5.3-codex; inherit is written as is (see Model Catalog)
  • @hooks uses .factory/hooks.json with PascalCase event names in multifile and full modes. The file is keyed directly by event name ({"PreToolUse": [...]}); only settings.json wraps the map in hooks. A wrapped hooks.json from PromptScript 1.27 or earlier is read and rewritten in the bare shape
  • pre-terminal-command maps to PreToolUse with the deterministic Execute matcher unless targets.factory.matcher overrides it
  • Hook matcher values match Factory tool names (for example Execute, Read, Edit|Write); other targets use different tool-name vocabularies, so a matcher that works here may match nothing elsewhere
  • .factory/settings.json remains a Factory fallback; prs hooks install factory migrates its unambiguous hooks. hooksFile: settings.json writes @hooks there instead (see Hooks File)
  • When @hooks is removed or no longer emits, the CLI removes a fully PromptScript-owned .factory/hooks.json; directories emptied by cleanup (.factory/rules and its subdirectories) are pruned as well
  • Three output modes: simple, multifile, full
  • Always-on rules default to the byte-compatible monolith mode
  • In monolith mode, @standards render as grouped ### subsections (one per topic) under Conventions & Patterns, preserving the source topic structure
  • Free-form text @standards (triple-quoted string) renders under Conventions & Patterns in monolith mode, or as .factory/rules/standards.md in split rules mode; embedded headings are adjusted to nest under the surrounding section (h2 downgraded to h3 in monolith, relative shift in split)
  • Split rules require the multifile or full output version

PromptScript versions before 1.16 could place language-level hooks in .factory/settings.json. When .factory/hooks.json is absent, prs compile moves unambiguous legacy entries into the canonical file, preserves unrelated settings, and refuses partial migrations when event names, handlers, or ownership are ambiguous. --dry-run previews the migration, while --no-migrate-factory-hooks leaves the fallback unchanged and reports PS4002. prs hooks install factory remains available for explicit migration and hook installation.

A legacy handler is written only once. When @hooks already generates the same command for the same event and matcher, the migration drops the hand-written copy instead of moving it next to the generated one, so Factory does not run the hook twice. Running the migration again gives the same result.

Hooks File

Factory reads project hooks from .factory/hooks.json. Only when that file is absent does it read the hooks key of .factory/settings.json. Factory does not merge the two files. See the Factory hooks reference.

hooksFile picks where PromptScript writes @hooks:

targets:
- factory:
version: multifile
hooksFile: settings.json # default: hooks.json
ValueGenerated fileNotes
hooks.json (default).factory/hooks.jsonLegacy settings.json hooks are migrated into it
settings.jsonhooks key of .factory/settings.jsonNo legacy migration; other settings keys and user hooks are kept

With settings.json, a PromptScript-owned .factory/hooks.json is removed by cleanup. If a .factory/hooks.json with your own hooks is still there, prs compile reports PS4002, because Factory would ignore the hooks in settings.json.

Settings

settings writes Factory project settings to .factory/settings.json in multifile and full modes:

targets:
- factory:
version: multifile
settings:
model: claude-sonnet-4-5
enabledPlugins:
code-standards@acme-plugins: true

Supported keys are model and enabledPlugins. Other settings keys (permissions, env) are Claude only; Factory reports PS4002 and skips them. PromptScript merges the keys into an existing .factory/settings.json: keys it does not generate stay, and for enabledPlugins only the listed plugins are set. A key removed from the config is not removed from the file.

Split Rules

Use rulesMode: split to keep AGENTS.md focused on operational context while moving the always-on standards into rule files under .factory/rules/. AGENTS.md links to each rule file so an agent can open the relevant one before editing related code.

targets:
- factory:
version: multifile
rulesMode: split

Split mode emits one file for each non-empty @standards topic, plus semantic files for git workflows, configuration, documentation, diagrams, remaining knowledge, restrictions, and examples when those sections exist. AGENTS.md contains a readable index of only the emitted files.

When @standards contains free-form text instead of topics, split mode emits a single .factory/rules/standards.md file with the text normalized (common indentation stripped, headings shifted relative to the shallowest one so it becomes h2 below the # Standards title, capped at h6).

When a custom outputPath is configured for the target, the rule files still live in .factory/rules/ at the project root and the index links are rewritten relative to the custom AGENTS.md location.

When rules are removed or the target returns to rulesMode: monolith, the CLI removes obsolete files only when they carry a PromptScript generated marker. Unmarked files and symlinks are never removed.

Example Output

project-root/
├── AGENTS.md # Main instructions
└── .factory/
├── rules/
│ ├── standards/
│ │ ├── security.md
│ │ └── typescript.md
│ ├── git-workflows.md
│ └── restrictions.md
├── skills/
│ └── my-skill/
│ └── SKILL.md
└── droids/
└── reviewer.md

Official Documentation