Skip to main content

Implementation Plan: Taxonomy System

Feature ID: taxonomy-system Spec: ./spec.md Status: Done (Retrospective) Last updated: 2026-05-01


1. Architecture

2. Tech Choices

ConcernChoiceRationale
StorageYAML files in the data repoPrinciple III
Slug generationslugifyText() shared utilConsistent across categories/tags/collections
Uniqueness checkCase-insensitive in-memory matchCheap; data fits in memory
Role enforcementWorkOwnershipService.ensure*Single source of truth
Mutation atomicityOne git commit per CRUD operationSimple recovery model

3. Data Model

No DB schema. Storage:

<slug>-data/
categories.yml
tags.yml
collections.yml
data/<item-slug>/item.yml # references by id

4. API Surface

MethodEndpointDescription
GET/api/works/:id/categories-tagsList all three
POST/api/works/:id/categoriesCreate category
PUT/api/works/:id/categories/:categoryIdUpdate category
DELETE/api/works/:id/categories/:categoryIdDelete category
POST/api/works/:id/tagsCreate tag
PUT/api/works/:id/tags/:tagIdUpdate tag
DELETE/api/works/:id/tags/:tagIdDelete tag
POST/api/works/:id/collectionsCreate collection
PUT/api/works/:id/collections/:collectionIdUpdate collection
DELETE/api/works/:id/collections/:collectionIdDelete collection

5. Plugin / Web / CLI

  • Plugins: AI generation in the Standard Pipeline goes through the taxonomy service.
  • Web: dedicated tabs under Items → Categories / Tags / Collections.
  • CLI: not directly exposed.

6. Background Jobs

None — taxonomy mutations are inline.

7. Security & Permissions

  • Read: viewer role.
  • Write: editor role.
  • Both via WorkOwnershipService.

8. Observability

  • category_change, tag_change, collection_change entries in the Work Changelog.

9. Risks & Mitigations

RiskMitigation
Items left dangling after category deleteDocumented behaviour; UI can surface a cleanup hint
Two concurrent creates race for the same slugRead-modify-write within one git session resolves to one
Renamed entity loses referencesSlug id is immutable on update

10. Constitution Reconciliation

See spec.md §9.

11. References

  • Spec: ./spec.md
  • Implementation:
    • packages/agent/src/services/work-taxonomy.service.ts
    • packages/agent/src/services/work-ownership.service.ts
  • Related: collections/spec.md