Allocate shared project item numbers atomically #80
Description
Work
Implement the #73 reference registry and transactional sequence from the approved contract. Integrate task/subtask creation, memory creation and bulk writes. Enforce uniqueness in the database, keep internal typed IDs, preserve retry/idempotency behavior and retain allocated numbers permanently.
Acceptance
- Concurrent memory/task/batch creates in one project cannot collide.
- Different projects each have their own sequence.
- Transaction failure and batch replay do not create duplicate items or recycle a visible number.
- Verify SQL Server behavior and the SQLite test path; a process-local lock is insufficient.
Dependencies
The contract/migration specification under #73.