Factory AI Formatter
| Property | Value |
|---|---|
| Tier | Custom |
| Main output | AGENTS.md |
| Dot directory | .factory/ |
| Skills | Yes (.factory/skills/<name>/SKILL.md) |
| Agents | Yes (.factory/droids/<name>.md) |
| Commands | Yes (.factory/commands/<name>.md) |
| Local files | No |
Output Files
| File | Path | Purpose |
|---|---|---|
| Main instructions | AGENTS.md | Primary rule file |
| Always-on rules | .factory/rules/**/*.md | Split rule files when rulesMode: split |
| Lifecycle hooks | .factory/hooks.json | Project hooks in multifile and full modes |
| Skills | .factory/skills/<name>/SKILL.md | Reusable skill definitions in multifile and full modes |
| Commands | .factory/commands/<name>.md | Slash commands |
| Agents | .factory/droids/<name>.md | Agent configurations |
| MCP servers | .factory/mcp.json | MCP server config in multifile and full modes |
| Plugins | .factory/plugins.json | Plugin config in multifile and full modes |
Supported Features
| Feature | Supported |
|---|---|
| Markdown Output | Yes |
| MDC Format | No |
| Code Blocks | Yes |
| Mermaid Diagrams | Yes |
| Single File Output | Yes |
| Multiple Rule Files | Yes |
| Workflow Files | No |
| Nested Directory Structure | Yes |
| YAML Frontmatter | Yes |
| Description in Frontmatter | Yes |
| Globs in Frontmatter | No |
| Activation Type | No |
| Glob Pattern Targeting | No |
| Always Apply Rules | Yes |
| Manual Activation | No |
| Auto/Model Activation | No |
| Structured Examples | Yes |
| Character Limit Validation | No |
| Content Section Splitting | Yes |
| Guard Dependencies | Yes |
| Context File Inclusion | No |
| @-Mentions | No |
| Tool Integration | No |
| Path-Specific Rules | No |
| Prompt Files | No |
| Slash Commands | Yes |
| Skills | Yes |
| Agent Instructions | Yes |
| Local Memory | No |
| Nested Memory | No |
Limitations & Quirks
- Uses
AGENTS.mdas the main file (extends MarkdownInstructionFormatter) - Skills go to
.factory/skills/<name>/SKILL.md - Agents are called “droids” - output to
.factory/droids/<name>.md - Droid
modelandspecModelvalues become API ids such asclaude-sonnet-4-5-20250929orgpt-5.3-codex;inheritis written as is (see Model Catalog) @hooksuses.factory/hooks.jsonwith PascalCase event names inmultifileandfullmodes. The file is keyed directly by event name ({"PreToolUse": [...]}); onlysettings.jsonwraps the map inhooks. A wrappedhooks.jsonfrom PromptScript 1.27 or earlier is read and rewritten in the bare shapepre-terminal-commandmaps toPreToolUsewith the deterministicExecutematcher unlesstargets.factory.matcheroverrides it- Hook
matchervalues match Factory tool names (for exampleExecute,Read,Edit|Write); other targets use different tool-name vocabularies, so a matcher that works here may match nothing elsewhere .factory/settings.jsonremains a Factory fallback;prs hooks install factorymigrates its unambiguous hooks.hooksFile: settings.jsonwrites@hooksthere instead (see Hooks File)- When
@hooksis removed or no longer emits, the CLI removes a fully PromptScript-owned.factory/hooks.json; directories emptied by cleanup (.factory/rulesand its subdirectories) are pruned as well - Three output modes:
simple,multifile,full - Always-on rules default to the byte-compatible
monolithmode - In
monolithmode,@standardsrender as grouped###subsections (one per topic) underConventions & Patterns, preserving the source topic structure - Free-form text
@standards(triple-quoted string) renders underConventions & Patternsinmonolithmode, or as.factory/rules/standards.mdin 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
multifileorfulloutput 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| Value | Generated file | Notes |
|---|---|---|
hooks.json (default) | .factory/hooks.json | Legacy settings.json hooks are migrated into it |
settings.json | hooks key of .factory/settings.json | No 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: trueSupported 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: splitSplit 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