LLM Task ID System Design Specification
Version: 1.0.0 FINAL Status: IMMUTABLE Effective: v0.17.0+ (reconciled from original v0.15.0 target) Supersedes: All prior ID discussions, RFC-001, ad-hoc conventionsPreamble: Why This Document Exists
This specification establishes the permanent, immutable design for task identification in cleo. Every decision has been validated through:- Round-robin adversarial analysis - Devil’s advocate challenges
- Industry pattern research - Linear, Jira, Git, file systems
- Database architecture review - Normalization, integrity, queries
- LLM agent usability testing - Hallucination resistance, error recovery
- Migration risk assessment - Backward compatibility, rollback safety
Part 1: The Immutable ID Contract
1.1 ID Format
T001, T042, T999, T1234
Regex Pattern: ^T\d{3,}$
1.2 The Six Guarantees
| # | Guarantee | Rationale |
|---|---|---|
| 1 | UNIQUE | No two tasks ever share an ID |
| 2 | IMMUTABLE | ID never changes after creation |
| 3 | STABLE | ID remains valid regardless of hierarchy changes |
| 4 | SEQUENTIAL | IDs increment monotonically (no gaps required) |
| 5 | REFERENCEABLE | Safe to use in git commits, docs, external systems |
| 6 | RECOVERABLE | Archive lookup always resolves historical IDs |
1.3 What IDs Are NOT
| Anti-Pattern | Why Rejected |
|---|---|
| NOT hierarchical | T001.1.2 violates stability guarantee |
| NOT semantic | AUTH-001 couples identity to categorization |
| NOT random | UUIDs are LLM-hostile (hallucination risk) |
| NOT reusable | Deleted IDs are retired permanently |
| NOT zero-padded variably | Always minimum 3 digits, expand as needed |
Part 2: The Decisive Rejection of Hierarchical IDs
2.1 The Temptation
Hierarchical IDs (T001.1.2) appear beneficial:
- Instant visual hierarchy
- Self-documenting references
- O(1) ancestry lookup via string parsing
2.2 Why We Reject Them
Finding 1: Violates Stability Guarantee- Multiple facts in single field (parent chain + position)
- Update anomalies cascade
- Data duplication (path repeated in every descendant)
2.3 The Linear Precedent
Linear defeated Jira with flat IDs (PROJ-123).
Linear’s success validates: IDs identify, relationships describe.
Part 3: Hierarchy Via parentId Field
3.1 The Design
3.2 Schema Definition
3.3 Hierarchy Operations
| Operation | Flat ID + parentId | Hierarchical ID |
|---|---|---|
| Get parent | task.parentId | id.split('.').slice(0,-1).join('.') |
| Move task | update parentId | Rename ID + all descendants |
| Delete parent | Orphan detection | ID invalidation cascade |
| Reference stability | 100% | 0% on restructure |
| Migration | Optional field add | Breaking change |
3.4 Display Hierarchy (CLI Sugar)
Part 4: Schema v2.3.0 Changes
4.1 New Task Fields
4.2 Hierarchy Validation Rules
4.3 Full Schema Diff (v2.2.0 → v2.3.0)
Part 5: Anti-Hallucination Design
5.1 Bounded ID Space
5.2 Existence Validation
5.3 Error Messages (Agent-Optimized)
5.4 Reference Validation in Commits
Part 6: Multi-Agent Coordination
6.1 The Problem
Multiple LLM agents working on same project:- Agent A creates task → T043
- Agent B creates task → T043 (CONFLICT!)
6.2 Solution: Centralized Counter
6.3 Conflict Resolution
If collision detected (checksum mismatch):6.4 Future: Agent Namespacing (Deferred to v1.0.0)
Part 7: Migration Simplicity
7.1 Migration Path: v2.2.0 → v2.3.0
7.2 Zero Breaking Changes
| What | Before | After |
|---|---|---|
| Task T042 | {"id": "T042", ...} | {"id": "T042", "type": "task", "parentId": null, ...} |
| Git refs | "Fixes T042" | Still valid |
| Scripts | grep T042 | Still works |
| External links | project.dev/T042 | Still resolves |
7.3 Rollback Capability
7.4 Contrast: Hierarchical ID Migration
Part 8: Reference Stability
8.1 The Eternal Reference Promise
8.2 ID Lifecycle
8.3 Archive Resolution
8.4 External System Integration
| System | Reference Pattern | Stability |
|---|---|---|
| Git commits | "Fixes T042" | Eternal |
| Documentation | See [T042] | Eternal |
| URLs | /tasks/T042 | Eternal |
| Jira links | EXT-123 → T042 | Eternal |
| Slack/Discord | working on T042 | Eternal |
Part 9: Task Type Taxonomy
9.1 Three Types Only
| Type | Definition | Can Have Children | Can Have Parent |
|---|---|---|---|
| epic | Strategic initiative requiring decomposition | Yes (7 max) | No |
| task | Primary work unit | Yes (7 max) | Yes |
| subtask | Atomic operation | No | Yes |
9.2 Type Selection Algorithm
9.3 Why NOT Feature/Story
| Rejected | Rationale |
|---|---|
| Feature | SAFe/enterprise artifact; semantic overlap with Epic |
| Story | Scrum ceremony; implies user personas; agents don’t need personas |
| Initiative | Portfolio-level; outside project scope |
Part 10: Size Model (LLM-Centric)
10.1 PROHIBITED
10.2 Size Dimensions
| Size | File Scope | Complexity | Context Risk |
|---|---|---|---|
| small | 1-2 files | Straightforward | Minimal |
| medium | 3-7 files | Moderate decisions | Contained |
| large | 8+ files | Architectural | High → MUST DECOMPOSE |
10.3 Large Triggers Decomposition
Part 11: Constraints and Limits
11.1 Hard Limits
| Constraint | Value | Rationale |
|---|---|---|
| Max depth | 3 | Organizational; deeper = navigation overhead |
| Max siblings | 0 (unlimited) | LLM agents don’t need cognitive limits |
| Min ID digits | 3 | T001 not T1 |
| ID pattern | ^T\d{3,}$ | Simple, bounded, unmistakable |
11.2 Soft Limits (Warnings)
| Constraint | Threshold | Action |
|---|---|---|
| Tasks in epic | >7 | Warning: “Consider splitting epic” |
| Pending tasks | >50 | Warning: “Review and archive stale tasks” |
| Active tasks | >1 | Error: “Only ONE active task allowed” |
Part 12: Error Codes
Cross-reference: LLM-AGENT-FIRST-SPEC.md Part 3.1 contains the full lib/exit-codes.sh implementation including general error codes (1-9).
Exit Codes (Numeric)
Error Codes (String - for JSON output)
All JSON error responses useE_ prefix convention:
| Exit Code | String Code | Description |
|---|---|---|
| 4 | E_TASK_NOT_FOUND | Task ID does not exist |
| 10 | E_PARENT_NOT_FOUND | Parent task does not exist |
| 11 | E_DEPTH_EXCEEDED | Would exceed max depth (3) |
| 12 | E_SIBLING_LIMIT | Parent has max children (7) |
| 13 | E_INVALID_PARENT_TYPE | Subtask cannot have children |
| 14 | E_CIRCULAR_REFERENCE | Would create ancestry loop |
| 15 | E_ORPHAN_DETECTED | parentId points to missing task |
| 20 | E_CHECKSUM_MISMATCH | Stale data detected |
| 21 | E_CONCURRENT_MODIFICATION | Multi-agent conflict |
| 22 | E_ID_COLLISION | ID already exists |
Part 13: CLI Reference
13.1 ID-Related Flags
13.2 JSON Output (Agent-Friendly)
Part 14: Implementation Reference
Implementation tracking is maintained separately from this specification. See LLM-TASK-ID-SYSTEM-DESIGN-IMPLEMENTATION-REPORT.md for current status, phase tracking, and completion metrics.This specification defines WHAT MUST be implemented. The Implementation Report tracks progress toward compliance.
Part 15: Appendices
A. Adversarial Analysis Summary
| Perspective | Finding | Impact on Design |
|---|---|---|
| Devil’s Advocate | Hierarchical IDs provide instant visual context | Mitigated by --tree display |
| Linear Advocate | IDs should identify, not encode | Confirmed: flat IDs |
| Database Architect | Hierarchical violates 1NF, creates anomalies | Confirmed: flat + parentId |
| LLM Expert | Bounded ID space reduces hallucination | Confirmed: T\d{3,} pattern |
| Migration Specialist | Hierarchical = breaking change | Confirmed: additive fields only |
B. Industry Precedents
| System | ID Pattern | Hierarchy Method | Success |
|---|---|---|---|
| Linear | PROJ-123 | Parent field | Beat Jira |
| GitHub | #123 | Flat | Industry standard |
| Git | SHA (40 char) | Parent commits | Universal |
| Jira | PROJ-123 | Complex hierarchy | Declining |
C. Rejected Alternatives
| Alternative | Why Rejected |
|---|---|
| UUIDs | LLM-hostile, high hallucination risk |
| Hash IDs | Unpredictable, requires lookup |
| Hierarchical IDs | Violates stability, complex migration |
| Semantic IDs | Couples identity to categorization |
| Zero-padded variable | Inconsistent pattern |
D. Version History
| Version | Date | Author | Change |
|---|---|---|---|
| 1.0.0 FINAL | 2025-01-17 | LLM Research Panel | Initial immutable spec |
Conclusion
This specification establishes the permanent ID system for cleo:- Flat sequential IDs (
T001,T002,T003) - Hierarchy via
parentIdfield, not encoded in ID - Six guarantees: Unique, Immutable, Stable, Sequential, Referenceable, Recoverable
- Three types: Epic → Task → Subtask (max depth 3)
- Scope-based sizing: Small/Medium/Large (NEVER time)
- Anti-hallucination: Bounded pattern, existence validation
- Multi-agent safe: Centralized counter, checksum verification
- Migration simple: Additive fields, zero breaking changes
- Reference stability: IDs eternal, archive-recoverable
Related Specifications
| Document | Relationship |
|---|---|
| SPEC-BIBLE-GUIDELINES.md | AUTHORITATIVE for specification standards |
| TASK-HIERARCHY-SPEC.md | Hierarchy features; defers to this spec for ID design |
| LLM-AGENT-FIRST-SPEC.md | CLI output formats, JSON envelopes, exit codes implementation |
| LLM-TASK-ID-SYSTEM-DESIGN-IMPLEMENTATION-REPORT.md | Tracks implementation status against this spec |
End of Specification
