Factory storage
Read this before any factory skill reads or writes project records. Resolve paths from the product checkout, not the installed plugin directory:
FACTORY_COMMON_DIR="$(git rev-parse --path-format=absolute --git-common-dir)" || exit 1
FACTORY_ROOT="$FACTORY_COMMON_DIR/factory"
If Git cannot resolve the shared directory, the folder is not a Git repository: follow the repository requirement instead of creating storage. Pass the resolved absolute root and task/handoff paths to subagents; do not expect shell variables to survive sessions. In instructions, $FACTORY_ROOT means this resolved directory. Store tasks in tasks/ using the shared task record format, handoffs and screenshots in designs/, code delivery's STR evidence in evidence/<full-id>/ (published to the remote's factory-evidence branch for the PR, as deliver describes), the journal in journal.md and the project settings in settings.md under this root. Feedback reports are posted as issues, not stored; journal entries record which issue covered them. A reports/ directory from earlier versions is converted and archived by the 0.5.0 release migration; skills never write to it. Create only the directories needed by an authorized write; read-only commands do not initialize storage. Never stage or commit records, status/log updates, evidence, or ID reservations to product branches.
This is local, unversioned storage, not another Git branch or repository. Ordinary commits, pushes and clones do not back it up or share it. Explain this at first use: agree a backup/export destination outside the product checkout before relying on records, and copy the catalog there at agreed checkpoints while no writer is active. Include task-ids/ and its metadata, even reservations without task files; complete legacy reservation consolidation below before treating an export as self-contained. Do not store secrets. Deleting the main repository also deletes this catalog; export it first. A linked worktree is not an independent backup. For another clone/machine, explicitly transfer the catalog and use one developer-designated coordinator for writes and ID allocation; never merge divergent catalogs or assume Git synchronizes them. Shared human review requires an accessible export/handoff, not merely a local absolute path.
Locks
Linked worktrees share this catalog, so switching branches neither copies nor changes task records. Before editing a task, validate its complete identity and acquire an atomic mkdir "$FACTORY_ROOT/locks/task-<full-id>" lock (create the parent first), for example task-DEV-003 or task-DSGN-003. Never lock by suffix alone or by an old numeric ID. Re-read the record, and release the lock on completion, failure or handoff. Hold it during active delivery, including delegated work; release it while waiting for human input and reacquire/recheck when resuming. Serialize journal writes similarly with the locks/journal lock and re-read before writing. Different tasks can proceed concurrently. The task overview script never acquires or creates locks; the settle script locks each task it checks.
Right after creating a lock directory, write an owner file inside it so another session can judge the lock:
agent: codex
task: DEV-003
acquired: 2026-11-25T10:42:00Z
session: <session or thread ID, or "unknown">
checkout: /absolute/path/to/product/checkout
agent is claude-code or codex; task is the full ID, or journal or settings for those named locks; acquired is UTC. When a run has to stop before finishing because of an error its workflow doesn't handle (for example a worker or tool crashes, or the developer stops it) and the session can still act, log run failed in the task as the task record describes, then release its locks before ending. If a lock is occupied, stop and report its owner contents and age; never remove or take over a possibly live lock without a developer decision. A lock without an owner file, or with fields you don't recognize (locks from earlier versions), gets the same decision and is never rewritten silently. When the developer agrees to take a lock over, overwrite owner with your own session and log the takeover in the task (for a named lock, say so in your result instead), then re-read the locked record (task, journal or settings) and recheck its state as resuming would.
Product-owned knowledge
Keep durable project documentation in versioned docs/factory/ and project-specific reusable agent skills in versioned .agents/skills/<name>/SKILL.md. Read relevant existing docs and skills when defining, building or reviewing a task. Create/update them only as part of the implementation task introducing or changing the documented behavior; these changes belong in its product diff and verification. Do not put task state, journals, design audit evidence or feedback in either directory. Do not relocate or overwrite existing project docs/skills automatically; link to them where appropriate and follow project instructions. The plugin's own skills/ and agents/ directories are not project records.
Why this layout
- A separate records branch/worktree would keep records out of product diffs, but still requires record commits and branch/worktree lifecycle management, and concurrent journal writers can still conflict.
- A separate repository would provide version history and remote backup, but adds repository/authentication setup and synchronization for every project.
- Shared Git-local storage is the smallest branch-independent option and needs neither record commits nor a Figma-only branch. Its deliberate trade-off is no automatic history, remote backup or multi-clone synchronization. If those become requirements, revisit a separate records repository rather than silently committing records back into product branches.
Legacy .factory/ migration
If a checkout or local/remote-tracking branch still contains .factory/ records, or legacy <common-dir>/factory-task-ids/ reservations have not been consolidated, do not silently ignore them or create a second catalog. Read-only skills may inspect and report migration needs without initializing storage. Before new definitions or delivery, select the version-scoped 0.4.0 storage migration through the update guide. Complete earlier release migrations in order, then follow this target's preview, explicit approval, verified backup/copy, reservation consolidation, separate baseline cleanup and recovery requirements. Unknown upgrade progress requires read-only reconstruction; conflicting records require reconciliation, not overwrite.
Verified historical copies listed in catalog migration.md are not new source records; never import them over newer catalog work. Unexpected changes require reconciliation. Use /factory:migrate <target-version> to preview/apply the ordered descriptors, or check <target-version> for a read-only report. Migration coordinates sessions with a shared migration lock and paused writers; before catalog initialization, keep checkpoints with the external backup rather than creating task locks/catalog directories early. Schema conversion and task execution remain separate approved actions.
Original Markdown, including metadata
# Factory storage Read this before any factory skill reads or writes project records. Resolve paths from the product checkout, not the installed plugin directory: ```sh FACTORY_COMMON_DIR="$(git rev-parse --path-format=absolute --git-common-dir)" || exit 1 FACTORY_ROOT="$FACTORY_COMMON_DIR/factory" ``` If Git cannot resolve the shared directory, the folder is not a Git repository: follow the [repository requirement](repository.md) instead of creating storage. Pass the resolved **absolute** root and task/handoff paths to subagents; do not expect shell variables to survive sessions. In instructions, `$FACTORY_ROOT` means this resolved directory. Store tasks in `tasks/` using the shared [task record](task-record.md) format, handoffs and screenshots in `designs/`, code delivery's STR evidence in `evidence/<full-id>/` (published to the remote's `factory-evidence` branch for the PR, as [deliver](deliver/SKILL.md#open-the-pull-request) describes), the journal in `journal.md` and the [project settings](repository.md#project-settings) in `settings.md` under this root. Feedback reports are posted as issues, not stored; journal entries record which issue covered them. A `reports/` directory from earlier versions is converted and archived by the [0.5.0 release migration](../docs/migrations/0.5.0-release.md); skills never write to it. Create only the directories needed by an authorized write; read-only commands do not initialize storage. Never stage or commit records, status/log updates, evidence, or ID reservations to product branches. This is **local, unversioned storage**, not another Git branch or repository. Ordinary commits, pushes and clones do not back it up or share it. Explain this at first use: agree a backup/export destination outside the product checkout before relying on records, and copy the catalog there at agreed checkpoints while no writer is active. Include `task-ids/` and its metadata, even reservations without task files; complete legacy reservation consolidation below before treating an export as self-contained. Do not store secrets. Deleting the main repository also deletes this catalog; export it first. A linked worktree is not an independent backup. For another clone/machine, explicitly transfer the catalog and use one developer-designated coordinator for writes and ID allocation; never merge divergent catalogs or assume Git synchronizes them. Shared human review requires an accessible export/handoff, not merely a local absolute path. ## Locks Linked worktrees share this catalog, so switching branches neither copies nor changes task records. Before editing a task, validate its [complete identity](task-ids.md) and acquire an atomic `mkdir "$FACTORY_ROOT/locks/task-<full-id>"` lock (create the parent first), for example `task-DEV-003` or `task-DSGN-003`. Never lock by suffix alone or by an old numeric ID. Re-read the record, and release the lock on completion, failure or handoff. Hold it during active delivery, including delegated work; release it while waiting for human input and reacquire/recheck when resuming. Serialize journal writes similarly with the `locks/journal` lock and re-read before writing. Different tasks can proceed concurrently. The [task overview](tasks/SKILL.md) script never acquires or creates locks; the [settle](settle/SKILL.md) script locks each task it checks. Right after creating a lock directory, write an `owner` file inside it so another session can judge the lock: ```text agent: codex task: DEV-003 acquired: 2026-11-25T10:42:00Z session: <session or thread ID, or "unknown"> checkout: /absolute/path/to/product/checkout ``` `agent` is `claude-code` or `codex`; `task` is the full ID, or `journal` or `settings` for those named locks; `acquired` is UTC. When a run has to stop before finishing because of an error its workflow doesn't handle (for example a worker or tool crashes, or the developer stops it) and the session can still act, log `run failed` in the task as the [task record](task-record.md#log) describes, then release its locks before ending. If a lock is occupied, stop and report its `owner` contents and age; never remove or take over a possibly live lock without a developer decision. A lock without an `owner` file, or with fields you don't recognize (locks from earlier versions), gets the same decision and is never rewritten silently. When the developer agrees to take a lock over, overwrite `owner` with your own session and log the [takeover](task-record.md#log) in the task (for a named lock, say so in your result instead), then re-read the locked record (task, journal or settings) and recheck its state as resuming would. ## Product-owned knowledge Keep durable project documentation in versioned `docs/factory/` and project-specific reusable agent skills in versioned `.agents/skills/<name>/SKILL.md`. Read relevant existing docs and skills when defining, building or reviewing a task. Create/update them only as part of the implementation task introducing or changing the documented behavior; these changes belong in its product diff and verification. Do not put task state, journals, design audit evidence or feedback in either directory. Do not relocate or overwrite existing project docs/skills automatically; link to them where appropriate and follow project instructions. The plugin's own `skills/` and `agents/` directories are not project records. ## Why this layout - A separate records branch/worktree would keep records out of product diffs, but still requires record commits and branch/worktree lifecycle management, and concurrent journal writers can still conflict. - A separate repository would provide version history and remote backup, but adds repository/authentication setup and synchronization for every project. - Shared Git-local storage is the smallest branch-independent option and needs neither record commits nor a Figma-only branch. Its deliberate trade-off is no automatic history, remote backup or multi-clone synchronization. If those become requirements, revisit a separate records repository rather than silently committing records back into product branches. ## Legacy `.factory/` migration If a checkout or local/remote-tracking branch still contains `.factory/` records, or legacy `<common-dir>/factory-task-ids/` reservations have not been consolidated, do not silently ignore them or create a second catalog. Read-only skills may inspect and report migration needs without initializing storage. Before new definitions or delivery, select the version-scoped [0.4.0 storage migration](../docs/migrations/0.4.0-shared-record-storage.md) through [the update guide](../docs/updating.md). Complete earlier release migrations in order, then follow this target's preview, explicit approval, verified backup/copy, reservation consolidation, separate baseline cleanup and recovery requirements. Unknown upgrade progress requires read-only reconstruction; conflicting records require reconciliation, not overwrite. Verified historical copies listed in catalog `migration.md` are not new source records; never import them over newer catalog work. Unexpected changes require reconciliation. Use `/factory:migrate <target-version>` to preview/apply the ordered descriptors, or `check <target-version>` for a read-only report. Migration coordinates sessions with a shared migration lock and paused writers; before catalog initialization, keep checkpoints with the external backup rather than creating task locks/catalog directories early. Schema conversion and task execution remain separate approved actions.