skills/task-ids.md

Task identity and shared allocation

First read storage and resolve $FACTORY_ROOT. New code tasks use DEV-NNN; new design tasks use DSGN-NNN. Each track has an independent counter, shared across all linked worktrees. The complete ID is the identity: DEV-003 and DSGN-003 are different tasks, not aliases. Suffixes are positive decimal integers, padded to exactly three digits below 1000, then allowed to grow (DEV-999, DEV-1000); extra leading zeros and zero are invalid.

Resolve an existing task

Match the complete frontmatter id and the filename's ID prefix in $FACTORY_ROOT/tasks/. Require a unique match and agreement between filename, ID and kind (DEV = code, DSGN = design). Unknown kinds, malformed IDs, conflicting filename/metadata or duplicate identities require a developer decision before selecting or changing that task.

The 0.5.0 release migration renumbered earlier numeric IDs to the prefixed form with the same suffix (003 became DEV-003 or DSGN-003 by kind) and recorded the old value as legacy_id. Logs, journal entries, approval evidence, design handoff files and delivery branches written before then keep the old ID; they are history, not stale references. When a developer gives an old numeric ID, resolve it only through an exact unique legacy_id match and name the current ID before acting. Never match by suffix alone or guess the track.

A record or reservation that still has a numeric id has not been migrated. Read-only skills report it; every write (definition, delivery, priority edits, allocation) stops and points to /factory:migrate 0.5.0. Do not renumber it outside the migration.

Allocate a new task

  1. Inventory all task files in $FACTORY_ROOT/tasks/ and reservations in $FACTORY_ROOT/task-ids/, including both tracks, every status and abandoned reservations. Validate identities and reservation metadata; conflicting/malformed entries stop allocation rather than being ignored. A reservation renamed by the 0.5.0 migration keeps its old metadata and has a legacy-id file; metadata naming that old ID is valid for it. Unmigrated numeric tasks or reservations stop allocation until the 0.5.0 release migration has run. Before allocating or exporting after an upgrade, complete the storage contract's consolidation of former <common-dir>/factory-task-ids/ reservations, including abandoned IDs. Retained legacy copies must match the recorded inventory; changed copies require reconciliation. A retained factory-task-ids/NNN copy counts as consolidated when a catalog reservation has a matching legacy-id.
  2. Choose DEV for code or DSGN for design. Select one above the highest numeric suffix among tasks and reservations with that exact prefix, starting at 001. The other track's counter does not advance this counter. Create the parent $FACTORY_ROOT/task-ids/ if absent.
  3. Reserve the complete ID with one atomic mkdir "$FACTORY_ROOT/task-ids/DEV-NNN" or mkdir "$FACTORY_ROOT/task-ids/DSGN-NNN", substituting the selected suffix. Do not use mkdir -p for the reservation itself. Only an already-existing directory means contention: advance that track's counter and retry; on any other error, stop. Record full ID, task kind, slug and checkout path inside the reservation directory, then create $FACTORY_ROOT/tasks/<full-id>-short-slug.md without overwriting any existing file. Keep reservations even if definition is abandoned; gaps are harmless. A partially written reservation still consumes its ID; missing metadata requires reconciliation, never deletion or reuse.

Reservations cover linked worktrees, not independent clones. Before allocating, establish whether other clones/contributors may define tasks. If so, use a developer-designated single allocation checkout/coordinator: it performs this same reservation and supplies an ID for each new task. Do not allocate independently or assume fetching makes allocation atomic across clones. If the coordinator or concurrency scope is unknown, ask before writing a task.

Do not commit reservations or task records. Neither reservations nor storage migration grant workflow approval.

Original Markdown, including metadata
# Task identity and shared allocation

First read [storage](storage.md) and resolve `$FACTORY_ROOT`. New code tasks use `DEV-NNN`; new design tasks use `DSGN-NNN`. Each track has an independent counter, shared across all linked worktrees. The complete ID is the identity: `DEV-003` and `DSGN-003` are different tasks, not aliases. Suffixes are positive decimal integers, padded to exactly three digits below 1000, then allowed to grow (`DEV-999`, `DEV-1000`); extra leading zeros and zero are invalid.

## Resolve an existing task

Match the complete frontmatter `id` and the filename's ID prefix in `$FACTORY_ROOT/tasks/`. Require a unique match and agreement between filename, ID and kind (`DEV` = `code`, `DSGN` = `design`). Unknown kinds, malformed IDs, conflicting filename/metadata or duplicate identities require a developer decision before selecting or changing that task.

The [0.5.0 release migration](../docs/migrations/0.5.0-release.md) renumbered earlier numeric IDs to the prefixed form with the same suffix (`003` became `DEV-003` or `DSGN-003` by kind) and recorded the old value as `legacy_id`. Logs, journal entries, approval evidence, design handoff files and delivery branches written before then keep the old ID; they are history, not stale references. When a developer gives an old numeric ID, resolve it only through an exact unique `legacy_id` match and name the current ID before acting. Never match by suffix alone or guess the track.

A record or reservation that still has a numeric `id` has not been migrated. Read-only skills report it; every write (definition, delivery, priority edits, allocation) stops and points to `/factory:migrate 0.5.0`. Do not renumber it outside the migration.

## Allocate a new task

1. Inventory all task files in `$FACTORY_ROOT/tasks/` and reservations in `$FACTORY_ROOT/task-ids/`, including both tracks, every status and abandoned reservations. Validate identities and reservation metadata; conflicting/malformed entries stop allocation rather than being ignored. A reservation renamed by the 0.5.0 migration keeps its old metadata and has a `legacy-id` file; metadata naming that old ID is valid for it. Unmigrated numeric tasks or reservations stop allocation until the 0.5.0 release migration has run. Before allocating or exporting after an upgrade, complete the storage contract's consolidation of former `<common-dir>/factory-task-ids/` reservations, including abandoned IDs. Retained legacy copies must match the recorded inventory; changed copies require reconciliation. A retained `factory-task-ids/NNN` copy counts as consolidated when a catalog reservation has a matching `legacy-id`.
2. Choose `DEV` for code or `DSGN` for design. Select one above the highest numeric suffix among tasks and reservations with that exact prefix, starting at `001`. The other track's counter does not advance this counter. Create the parent `$FACTORY_ROOT/task-ids/` if absent.
3. Reserve the complete ID with one atomic `mkdir "$FACTORY_ROOT/task-ids/DEV-NNN"` or `mkdir "$FACTORY_ROOT/task-ids/DSGN-NNN"`, substituting the selected suffix. Do not use `mkdir -p` for the reservation itself. Only an already-existing directory means contention: advance that track's counter and retry; on any other error, stop. Record full ID, task kind, slug and checkout path inside the reservation directory, then create `$FACTORY_ROOT/tasks/<full-id>-short-slug.md` without overwriting any existing file. Keep reservations even if definition is abandoned; gaps are harmless. A partially written reservation still consumes its ID; missing metadata requires reconciliation, never deletion or reuse.

Reservations cover linked worktrees, not independent clones. Before allocating, establish whether other clones/contributors may define tasks. If so, use a developer-designated single allocation checkout/coordinator: it performs this same reservation and supplies an ID for each new task. Do not allocate independently or assume fetching makes allocation atomic across clones. If the coordinator or concurrency scope is unknown, ask before writing a task.

Do not commit reservations or task records. Neither reservations nor storage migration grant workflow approval.