Skip to content
ThirdLayer

Docs > Factory

Factory definition as code

Complete reference for the Factory v3 directory layout, YAML and Markdown schemas for agents, skills, automations, views, ontology, and sources, and the dex factory sync workflow.

Every organization’s Factory repository uses layout v3: one root factory.yaml manifest separating shared resources under workspace/ from private user resources under users/<user-slug>--<user-uuid>/.

Paths carry ownership and authorization. Personal directories under users/ are strictly private to that user and cannot be shared; shared resources under workspace/ use path-prefix access grants (factory_shares).

factories/<factory-slug>--<fac_id>/
factory.yaml # Root manifest
workspace/ # Org-shared scope (ACL-controlled)
ontology/
objects/<uid>.yaml # Declarative Zeta ontology documents
knowledge/<path> # Shared reference files (no descriptor)
views/res_<uuid>.md # Shared Views (named by resource ID)
sources/<res_id>/SOURCE.md # Shared source descriptors (admin writes)
skills/<res_id>/ # Shared Skills (folder named by resource ID)
SKILL.md
references/...
scripts/...
agents/<res_id>/ # Shared Agents (folder named by resource ID)
AGENT.md
TEAM.md # Optional setup + coordinator body
team/ # Live shared notes read/written at HEAD
automations/<res_id>.md # Scheduled/manual automation triggers
skills/<kebab-slug>/SKILL.md # Agent-scoped skills
users/<user-slug>--<user-uuid>/ # Personal private scope (owner only)
knowledge/<path> # Personal reference files
memory/<path> # Personal memory (MEMORY.md, etc.)
views/<kebab-slug>.md # Personal Views
sources/<res_id>/SOURCE.md # Personal source descriptors
skills/<kebab-slug>/SKILL.md # Personal Skills (+ supporting files)
agents/<kebab-slug>/ # Personal Agents
AGENT.md
automations/<kebab-slug>.md
skills/<kebab-slug>/SKILL.md
shared-agents/<agent_res_id>/ # Member link to a workspace shared agent
AGENT.md # mode: linked, enabled, source
notes.md # Optional personal working notes
automations/<kebab-slug>.md # Optional personal automation of shared agent
shared-skills/<skill_res_id>/ # Member link to a workspace shared skill
SKILL.md # mode: linked, enabled, source (no extra files)

Shared workspace folders under workspace/agents/, workspace/skills/, workspace/sources/, and workspace/views/ are named by their canonical resource ID (res_<uuid>). Never invent resource IDs on existing resources; preserve server-assigned resourceId and source fields when editing.

The root manifest names the logical factory. It is a manifest, not a permission grant.

factory.yaml
schemaVersion: v3
name: acme-workspace

AGENT.md defines who runs. Its Markdown body is appended to the system prompt of every run of the agent.

workspace/agents/res_01.../AGENT.md
---
schemaVersion: 1
title: Account renewal tracker
mode: shared
harness: dex
model: inherit
requireWriteApproval: true
pendingActionVisibility: admins
autoMode: >-
Only post internal reminders in Slack channel C04ABC123. Card all external
emails and CRM updates.
requires:
- slack
- gmail
- attio:
- update_record
---
Track active customer renewals closing within 60 days. Ground every risk flag
in a specific email thread or Slack message permalink.
FieldRequiredDefaultDescription
schemaVersionYes—1
titleNoFolder slugDisplay name (1–200 chars)
modeNoOmittedSet shared for workspace shared agents
harnessNodexdex, claude, or codex
modelNoinheritModel ID, or inherit for harness default
requireWriteApprovalNotrueRoutes external writes to Pending Action cards
autoModeNoOmittedtrue (default reviewer) or plain-language policy (max 8,000 chars). Requires requireWriteApproval: true
pendingActionVisibilityNoadminsShared agents only: admins or self
requiresNoOmittedList of app names or { <app>: [<tool>, ...] } entries (max 200)

Created automatically when a teammate joins a shared agent (dex agents join <id>). The link body must stay empty; personal working notes belong in sibling files beside AGENT.md.

users/sam--.../shared-agents/res_01.../AGENT.md
---
schemaVersion: 1
mode: linked
enabled: true
resourceId: res_...
source:
resourceId: res_01...
revision: <commit-sha>
---

Optional file beside a shared agent’s AGENT.md. setup guides Dex when onboarding a new teammate; a non-empty Markdown body enables coordinator mode.

workspace/agents/res_01.../TEAM.md
---
schemaVersion: 1
setup: |
Ask which customer accounts the teammate owns and add their mapping to
team/accounts.md after checking for overlap.
---
Run each active member via a Dex workflow calling `agent(prompt, { agent, user })`
and publish one deduplicated weekly renewal brief.

Defines when its parent agent runs and the per-run task in the Markdown body. Never restate agent-owned fields (title, harness, model, requireWriteApproval, autoMode) or instructions in frontmatter.

users/sam--.../agents/renewal-tracker/automations/monday-brief.md
---
schemaVersion: 4
enabled: true
trigger:
type: cron
schedule: "0 9 * * 1"
timezone: America/New_York
condition: Only run if at least one active renewal has new email or Slack activity in the last 7 days.
---
Review open renewals closing in the next 60 days and draft status updates for
any deal missing a confirmed next step.
Trigger typeRequired fieldsOptional fieldsAllowed on shared agents?
cronschedule (cron expr), timezone (IANA)—Yes
datetimeat (future ISO datetime)timezone (IANA)Yes
eventintegrationtriggerId, delayMinutes (0–43,200)No (personal agents only)
manual——Yes

Defines a progressive-disclosure skill. Supporting scripts/, references/, and templates live in the same folder.

users/sam--.../skills/escalation-brief/SKILL.md
---
schemaVersion: 1
name: escalation-brief
description: >-
Use when summarizing a customer escalation from Slack and Gmail into an
executive status update.
compatibility: Requires read access to Slack and Gmail.
disable-model-invocation: false
user-invocable: true
metadata:
author: support-ops
argument-hint: "<customer name>"
---
Write an escalation brief for $ARGUMENTS using `references/template.md`.

When published, the server normalizes schemaVersion to 2 and adds resourceId. A teammate’s link under users/<you>/shared-skills/<res-id>/SKILL.md uses schemaVersion: 2, mode: linked, enabled: true, resourceId, source, and an empty body (no supporting files).

Defines a saved table or board over one Zeta Object type. Shared Views use workspace/views/res_<uuid>.md (generate a fresh lowercase UUID for new shared Views); personal Views use users/<you>/views/<kebab-slug>.md.

workspace/views/res_550e8400-e29b-41d4-a716-446655440000.md
---
schemaVersion: 1
name: Open Q4 commitments
description: Unresolved customer commitments due this quarter, sorted by due date.
context:
synonyms:
- open action items
- customer follow-ups
examples:
- question: Which customer commitments are overdue?
sourceSpec:
version: 1
kind: object
targetScopeId: "<scope-uuid>"
objectTypeUid: commitment
columns:
- fieldId: title
- fieldId: status
- fieldId: due_date
- path: [owner, name]
label: Owner
filters:
- fieldId: status
operator: neq
value: Done
sorts:
- fieldId: due_date
direction: asc
layout:
type: table
---
## Meaning
One row per tracked commitment linked to an active customer record.
## Usage
Use for weekly pipeline and account reviews instead of querying raw messages.
## Caveats
Formula sorts cap at 10,000 matching rows; keep filters narrow on large tables.

Columns support fieldId, path: [refFieldId, targetFieldId], inverse: { source, fieldId, show }, and read-time formula: { key, expression } (with optional display: { numberFormat: plain | percent | currency, unit }). Filters support eq, neq, gt, gte, lt, lte, contains, is_empty, is_not_empty, plus calendar-day operators on, on_or_after, on_or_before (YYYY-MM-DD, with timezone required on datetime fields).

  • workspace/ontology/objects/<uid>.yaml (schemaVersion: 2) — Stores one Object type’s schemas (length 1), mappings, and pinned sourceContracts. Obtain exact sourceContract blocks from dex zeta datasets get --dataset <id> and validate with dex factory preview before pushing. See Ontology.
  • sources/<res_id>/SOURCE.md (schemaVersion: 3, admin-only writes under workspace/) — Describes a connector (connector, optional endpoint required for mcp, defaultAccount, collection: { enabled, config }, context.synonyms) with two required Markdown sections: ## Overview (system-maintained summary) and ## Instructions (team-authored guidance).

dex factory provides a Git-like workflow over your readable subset of Factory (defaulting to /workspace/factory in sandboxes):

Terminal window
# 1. Fetch latest server state
dex factory pull
# 2. Edit files, inspect status/diff, and stage ONLY the paths you changed
dex factory status
dex factory diff
dex factory add factories/*/workspace/agents/<id>/AGENT.md
dex factory commit -m "Tighten renewal tracker autoMode policy"
# 3. Validate schemas, permissions, and ontology/view impact without publishing
dex factory preview
# 4. Publish and verify Apply succeeded
dex factory push