2026-02-01 22:42:28 +09:00
|
|
|
# CLAUDE TASKS FEATURE KNOWLEDGE BASE
|
|
|
|
|
|
|
|
|
|
## OVERVIEW
|
|
|
|
|
|
|
|
|
|
Claude Code compatible task schema and storage. Provides core task management utilities used by task-related tools and features.
|
|
|
|
|
|
|
|
|
|
## STRUCTURE
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
claude-tasks/
|
|
|
|
|
├── types.ts # Task schema (Zod)
|
|
|
|
|
├── types.test.ts # Schema validation tests (8 tests)
|
|
|
|
|
├── storage.ts # File operations
|
|
|
|
|
├── storage.test.ts # Storage tests (14 tests)
|
2026-02-06 18:59:58 +09:00
|
|
|
├── todo-sync.ts # Task → Todo synchronization
|
2026-02-01 22:42:28 +09:00
|
|
|
└── index.ts # Barrel exports
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## TASK SCHEMA
|
|
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
|
type TaskStatus = "pending" | "in_progress" | "completed" | "deleted"
|
|
|
|
|
|
|
|
|
|
interface Task {
|
|
|
|
|
id: string
|
2026-02-02 12:01:43 +09:00
|
|
|
subject: string // Imperative: "Run tests" (was: title)
|
2026-02-01 22:42:28 +09:00
|
|
|
description: string
|
|
|
|
|
status: TaskStatus
|
|
|
|
|
activeForm?: string // Present continuous: "Running tests"
|
|
|
|
|
blocks: string[] // Task IDs this task blocks
|
2026-02-02 12:01:43 +09:00
|
|
|
blockedBy: string[] // Task IDs blocking this task (was: dependsOn)
|
2026-02-01 22:42:28 +09:00
|
|
|
owner?: string // Agent name
|
|
|
|
|
metadata?: Record<string, unknown>
|
2026-02-02 12:01:43 +09:00
|
|
|
repoURL?: string // oh-my-opencode specific
|
|
|
|
|
parentID?: string // oh-my-opencode specific
|
|
|
|
|
threadID: string // oh-my-opencode specific
|
2026-02-01 22:42:28 +09:00
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Key Differences from Legacy**:
|
|
|
|
|
- `subject` (was `title`)
|
|
|
|
|
- `blockedBy` (was `dependsOn`)
|
2026-02-02 12:01:43 +09:00
|
|
|
- `blocks` (new field)
|
|
|
|
|
- `activeForm` (new field)
|
|
|
|
|
|
|
|
|
|
## TODO SYNC
|
|
|
|
|
|
2026-02-06 18:59:58 +09:00
|
|
|
Task system includes sync layer (`todo-sync.ts`) that automatically mirrors task state to the project's Todo system.
|
2026-02-02 12:01:43 +09:00
|
|
|
|
2026-02-06 18:59:58 +09:00
|
|
|
- **Creation**: `task_create` adds corresponding Todo item
|
|
|
|
|
- **Updates**: `task_update` reflects in Todo list
|
|
|
|
|
- **Completion**: `completed` status marks Todo item done
|
2026-02-01 22:42:28 +09:00
|
|
|
|
|
|
|
|
## STORAGE UTILITIES
|
|
|
|
|
|
2026-02-06 18:59:58 +09:00
|
|
|
| Function | Purpose |
|
|
|
|
|
|----------|---------|
|
|
|
|
|
| `getTaskDir(config)` | Returns task storage directory path |
|
|
|
|
|
| `resolveTaskListId(config)` | Resolves task list ID (env → config → cwd basename) |
|
|
|
|
|
| `readJsonSafe(path, schema)` | Parse + validate, returns null on failure |
|
|
|
|
|
| `writeJsonAtomic(path, data)` | Atomic write via temp file + rename |
|
|
|
|
|
| `acquireLock(dirPath)` | File-based lock with 30s stale threshold |
|
2026-02-01 22:42:28 +09:00
|
|
|
|
|
|
|
|
## ANTI-PATTERNS
|
|
|
|
|
|
|
|
|
|
- Direct fs operations (use storage utilities)
|
|
|
|
|
- Skipping lock acquisition for writes
|
|
|
|
|
- Ignoring null returns from readJsonSafe
|
|
|
|
|
- Using old schema field names (title, dependsOn)
|