Docs > Factory
Factory
# Factory **Factory** is Dex's Git-backed configuration repository for your organization. Every durable definition—agents, shared agents, automations, skills, knowledge files, ontology documents, saved views, and source descriptors—lives as readable Markdown or YAML files in one versioned repository, then projects into live runtime state on publish. Factory owns **definitions and version history**, never runtime credentials or execution state. OAuth tokens, Access Scopes, run transcripts, coordinator assignments, admin member pauses, and Pending Action cards always stay in Postgres. ## How Commit and Apply work Factory uses a single canonical `main` branch per organization backed by Code Storage, with optimistic concurrency and a two-phase publish pipeline: ```mermaid flowchart LR Edit["Edit files<br/>(Web editor, Chat agent,<br/>or dex factory CLI)"] --> Preview["dex factory preview<br/>(schema, ACL & ontology<br/>impact diagnostics)"] Preview --> Commit["Phase 1: Commit<br/>(atomic Git commit on main<br/>with assigned resourceIds)"] Commit --> Apply["Phase 2: Apply<br/>(project into Postgres:<br/>agents, skills, automations,<br/>views, ontology)"] Apply --> Live["Live runtime state<br/>(schedules, Nexus views,<br/>agent runs)"] ``` 1. **Preview (`dex factory preview`)** — Validates schemas, permissions, and file moves without publishing. For ontology or view edits, preview also lists changed Object types, affected Views, and connected source output bindings (counting inaccessible views/outputs without leaking their names). 2. **Commit (`dex factory push`)** — Verifies the caller's write permissions, assigns stable `res_<uuid>` identities to new resources, records publish metadata trailers, and writes an atomic commit to `main` under a per-workspace mutation lock. 3. **Apply** — Projects the committed Git tree into runtime tables (`factory_resources`, `agents`, `agent_members`, `skills`, `skill_members`, `automations`, views, and ontology revisions). Commit success and Apply success are distinct: if Apply fails, Dex surfaces the apply error and lets you retry Apply without losing your commit. ## What lives in Factory vs. runtime state | Stored in Factory (Git) | Stored in Postgres (runtime only) | | --- | --- | | `AGENT.md`, `TEAM.md`, `team/` notes | `agents.coordinator_user_id` & `coordinator_scope_id` | | `automations/*.md` triggers & tasks | `automation_runs`, leases, transcripts, and `shared_result` | | `SKILL.md` bundles & supporting files | Per-user OAuth tokens, MCP tokens, and **Access Scopes** | | Member link files (`shared-agents/`, `shared-skills/`) | `agent_members.access_scope_id` and Admin pause (`status: inactive`) | | `workspace/ontology/objects/*.yaml` & `views/*.md` | Live Object records, cell edits, observations, and `pending_actions` | | `knowledge/` & `users/<you>/memory/` | `approval_slack_channel` and self-improvement `agent_issues` | Repository limits are **50 MiB** total per organization Factory and **5 MiB** per file. ## Where you interact with Factory - **Web app (`/nexus/settings/factory`)** — Workspace admins can browse the full tree, inspect diffs, edit files, view commit history, and manage path-level sharing. (In user-facing settings, this view is labeled **Workspace files**.) - **Chat & sandboxed agents** — Sandboxed sessions mount your readable subset of Factory as a real Git checkout at `/workspace/factory`. - **Local CLI (`dex factory`)** — Pull, diff, commit, preview, push, and manage sharing from your terminal (`dex factory pull`, `preview`, `push`, `tree`, `access`, `share`). ## Related pages - [Factory definition as code](/factory/workspace-structure/) - Complete v3 directory layout, schemas, and `dex factory` workflow - [Permissions, spaces, and sharing](/factory/sharing-and-installation/) - `read`/`write`/`admin` roles, Spaces, and link adoption - [Runs, dry runs, and self-improvement](/factory/measure-and-improve/) - Inspect runs, transcripts, dry runs, and Agent Issues - [Shared agents](/agents/shared-agents/) - How `workspace/agents/<id>/` and member links work together - [Ontology](/context/ontology/) - Editing `workspace/ontology/objects/*.yaml` safely with impact previewManage Dex agents, shared agents, skills, automations, ontology documents, views, and knowledge as versioned files in a Git-backed workspace repository.
Factory is Dex’s Git-backed configuration repository for your organization. Every durable definition—agents, shared agents, automations, skills, knowledge files, ontology documents, saved views, and source descriptors—lives as readable Markdown or YAML files in one versioned repository, then projects into live runtime state on publish.
Factory owns definitions and version history, never runtime credentials or execution state. OAuth tokens, Access Scopes, run transcripts, coordinator assignments, admin member pauses, and Pending Action cards always stay in Postgres.
How Commit and Apply work
Section titled “How Commit and Apply work”Factory uses a single canonical main branch per organization backed by Code Storage, with optimistic concurrency and a two-phase publish pipeline:
flowchart LR Edit["Edit files<br/>(Web editor, Chat agent,<br/>or dex factory CLI)"] --> Preview["dex factory preview<br/>(schema, ACL & ontology<br/>impact diagnostics)"] Preview --> Commit["Phase 1: Commit<br/>(atomic Git commit on main<br/>with assigned resourceIds)"] Commit --> Apply["Phase 2: Apply<br/>(project into Postgres:<br/>agents, skills, automations,<br/>views, ontology)"] Apply --> Live["Live runtime state<br/>(schedules, Nexus views,<br/>agent runs)"]
- Preview (
dex factory preview) — Validates schemas, permissions, and file moves without publishing. For ontology or view edits, preview also lists changed Object types, affected Views, and connected source output bindings (counting inaccessible views/outputs without leaking their names). - Commit (
dex factory push) — Verifies the caller’s write permissions, assigns stableres_<uuid>identities to new resources, records publish metadata trailers, and writes an atomic commit tomainunder a per-workspace mutation lock. - Apply — Projects the committed Git tree into runtime tables (
factory_resources,agents,agent_members,skills,skill_members,automations, views, and ontology revisions). Commit success and Apply success are distinct: if Apply fails, Dex surfaces the apply error and lets you retry Apply without losing your commit.
What lives in Factory vs. runtime state
Section titled “What lives in Factory vs. runtime state”| Stored in Factory (Git) | Stored in Postgres (runtime only) |
|---|---|
AGENT.md, TEAM.md, team/ notes | agents.coordinator_user_id & coordinator_scope_id |
automations/*.md triggers & tasks | automation_runs, leases, transcripts, and shared_result |
SKILL.md bundles & supporting files | Per-user OAuth tokens, MCP tokens, and Access Scopes |
Member link files (shared-agents/, shared-skills/) | agent_members.access_scope_id and Admin pause (status: inactive) |
workspace/ontology/objects/*.yaml & views/*.md | Live Object records, cell edits, observations, and pending_actions |
knowledge/ & users/<you>/memory/ | approval_slack_channel and self-improvement agent_issues |
Repository limits are 50 MiB total per organization Factory and 5 MiB per file.
Where you interact with Factory
Section titled “Where you interact with Factory”- Web app (
/nexus/settings/factory) — Workspace admins can browse the full tree, inspect diffs, edit files, view commit history, and manage path-level sharing. (In user-facing settings, this view is labeled Workspace files.) - Chat & sandboxed agents — Sandboxed sessions mount your readable subset of Factory as a real Git checkout at
/workspace/factory. - Local CLI (
dex factory) — Pull, diff, commit, preview, push, and manage sharing from your terminal (dex factory pull,preview,push,tree,access,share).
Related pages
Section titled “Related pages”- Factory definition as code - Complete v3 directory layout, schemas, and
dex factoryworkflow - Permissions, spaces, and sharing -
read/write/adminroles, Spaces, and link adoption - Runs, dry runs, and self-improvement - Inspect runs, transcripts, dry runs, and Agent Issues
- Shared agents - How
workspace/agents/<id>/and member links work together - Ontology - Editing
workspace/ontology/objects/*.yamlsafely with impact preview