Purpose: Step-by-step guide for migrating from base task schema to enhanced task schema
Version: 1.0
Last Updated: 2026-02-14
This guide helps you migrate existing task.json and subtask_NN.json files from the base schema to the enhanced schema with line-number precision, domain modeling, and prioritization features.
Key Points:
No migration required if:
Consider migrating if:
Recommended approach: Start small, expand gradually
| Base Field | Enhanced Field | Change | Notes |
|---|---|---|---|
context_files |
context_files |
Format change | String → Object with line ranges |
reference_files |
reference_files |
Format change | String → Object with line ranges |
| - | bounded_context |
New (optional) | DDD bounded context |
| - | module |
New (optional) | Module/package name |
| - | vertical_slice |
New (optional) | Feature slice identifier |
| - | contracts |
New (optional) | API/interface contracts |
| - | design_components |
New (optional) | Figma/wireframe links |
| - | related_adrs |
New (optional) | Architecture Decision Records |
| - | rice_score |
New (optional) | RICE prioritization |
| - | wsjf_score |
New (optional) | WSJF prioritization |
| - | release_slice |
New (optional) | Release identifier |
All other fields remain unchanged.
Before (base schema):
{
"id": "auth-system-02",
"seq": "02",
"title": "Create JWT service",
"status": "pending",
"depends_on": ["01"],
"parallel": false,
"context_files": [
".opencode/context/core/standards/code-quality.md",
".opencode/context/core/standards/security-patterns.md"
],
"reference_files": [
"src/auth/token-utils.ts"
],
"acceptance_criteria": [
"JWT tokens signed with RS256",
"Tests pass"
],
"deliverables": [
"src/auth/jwt.service.ts"
]
}
After (enhanced schema with line-number precision):
{
"id": "auth-system-02",
"seq": "02",
"title": "Create JWT service",
"status": "pending",
"depends_on": ["01"],
"parallel": false,
"context_files": [
{
"path": ".opencode/context/core/standards/code-quality.md",
"lines": "53-72",
"reason": "Pure function patterns for service layer"
},
{
"path": ".opencode/context/core/standards/security-patterns.md",
"lines": "120-145",
"reason": "JWT signing and validation rules"
}
],
"reference_files": [
{
"path": "src/auth/token-utils.ts",
"lines": "1-50",
"reason": "Existing token utility functions to extend"
}
],
"acceptance_criteria": [
"JWT tokens signed with RS256",
"Tests pass"
],
"deliverables": [
"src/auth/jwt.service.ts"
]
}
Benefits:
Before (base schema):
{
"id": "user-authentication",
"name": "User Authentication System",
"status": "active",
"objective": "Implement JWT-based authentication",
"context_files": [
".opencode/context/core/standards/code-quality.md"
],
"exit_criteria": [
"All tests passing"
],
"subtask_count": 5,
"completed_count": 0,
"created_at": "2026-02-14T10:00:00Z"
}
After (enhanced schema with domain modeling):
{
"id": "user-authentication",
"name": "User Authentication System",
"status": "active",
"objective": "Implement JWT-based authentication",
"context_files": [
{
"path": ".opencode/context/core/standards/code-quality.md",
"lines": "53-95",
"reason": "Pure function patterns"
}
],
"exit_criteria": [
"All tests passing"
],
"subtask_count": 5,
"completed_count": 0,
"created_at": "2026-02-14T10:00:00Z",
"bounded_context": "authentication",
"module": "@app/auth",
"vertical_slice": "user-login"
}
Benefits:
Before (base schema):
{
"id": "auth-system-03",
"seq": "03",
"title": "Implement auth API endpoints",
"status": "pending",
"depends_on": ["02"],
"acceptance_criteria": [
"POST /auth/login works",
"POST /auth/refresh works"
],
"deliverables": [
"src/api/auth.controller.ts"
]
}
After (enhanced schema with contracts and ADRs):
{
"id": "auth-system-03",
"seq": "03",
"title": "Implement auth API endpoints",
"status": "pending",
"depends_on": ["02"],
"acceptance_criteria": [
"POST /auth/login works",
"POST /auth/refresh works"
],
"deliverables": [
"src/api/auth.controller.ts"
],
"contracts": [
{
"type": "api",
"name": "AuthAPI",
"path": "src/api/auth.contract.ts",
"status": "defined",
"description": "REST endpoints for login, logout, refresh"
}
],
"related_adrs": [
{
"id": "ADR-003",
"path": "docs/adr/003-jwt-authentication.md",
"title": "Use JWT for stateless authentication",
"decision": "JWT with RS256, 15-min access tokens"
}
]
}
Benefits:
Before (base schema):
{
"id": "user-dashboard",
"name": "User Dashboard",
"status": "active",
"objective": "Build user dashboard with analytics",
"subtask_count": 8,
"completed_count": 0,
"created_at": "2026-02-14T10:00:00Z"
}
After (enhanced schema with prioritization):
{
"id": "user-dashboard",
"name": "User Dashboard",
"status": "active",
"objective": "Build user dashboard with analytics",
"subtask_count": 8,
"completed_count": 0,
"created_at": "2026-02-14T10:00:00Z",
"rice_score": {
"reach": 5000,
"impact": 2,
"confidence": 80,
"effort": 3,
"score": 2666.67
},
"wsjf_score": {
"business_value": 8,
"time_criticality": 6,
"risk_reduction": 5,
"job_size": 3,
"score": 6.33
},
"release_slice": "v1.2.0"
}
Benefits:
lines field)Use when:
Example:
{
"path": ".opencode/context/core/standards/code-quality.md",
"lines": "53-95",
"reason": "Pure function patterns"
}
Don't use when:
Use bounded_context when:
Use module when:
Use vertical_slice when:
Example:
{
"bounded_context": "authentication",
"module": "@app/auth",
"vertical_slice": "user-login"
}
Use when:
Example:
{
"contracts": [
{
"type": "api",
"name": "UserAPI",
"path": "src/api/user.contract.ts",
"status": "defined",
"description": "REST API for user CRUD"
}
]
}
Use when:
Example:
{
"design_components": [
{
"type": "figma",
"url": "https://figma.com/file/abc123/Login-Flow",
"description": "Login page mockups"
}
]
}
Use when:
Example:
{
"related_adrs": [
{
"id": "ADR-003",
"path": "docs/adr/003-jwt-authentication.md",
"title": "Use JWT for stateless authentication"
}
]
}
Use RICE when:
Use WSJF when:
Use release_slice when:
Use the provided migration script to automatically upgrade task files:
# Migrate a single task
npx ts-node .opencode/skill/task-management/scripts/migrate-schema.ts \
--task multi-stage-orchestration-workflow
# Migrate all tasks
npx ts-node .opencode/skill/task-management/scripts/migrate-schema.ts --all
# Dry run (preview changes without writing)
npx ts-node .opencode/skill/task-management/scripts/migrate-schema.ts \
--task auth-system --dry-run
# Add line-number precision only
npx ts-node .opencode/skill/task-management/scripts/migrate-schema.ts \
--task auth-system --lines-only
# Add domain modeling fields
npx ts-node .opencode/skill/task-management/scripts/migrate-schema.ts \
--task auth-system --add-domain \
--bounded-context authentication \
--module @app/auth
| Option | Description |
|---|---|
--task <name> |
Migrate specific task |
--all |
Migrate all tasks in .tmp/tasks/ |
--dry-run |
Preview changes without writing |
--lines-only |
Add line-number precision only |
--add-domain |
Add domain modeling fields |
--bounded-context <name> |
Set bounded_context |
--module <name> |
Set module |
--vertical-slice <name> |
Set vertical_slice |
--release <name> |
Set release_slice |
Guarantee: All existing task.json and subtask_NN.json files work without modification.
Example:
// This still works perfectly
"context_files": [
".opencode/context/core/standards/code-quality.md"
]
Guarantee: You can mix old and new formats in the same file.
Example:
"context_files": [
".opencode/context/core/standards/code-quality.md",
{
"path": ".opencode/context/core/standards/security-patterns.md",
"lines": "120-145",
"reason": "JWT validation"
}
]
Guarantee: No new fields are required. Add them only when needed.
Guarantee: All agents handle both old and new formats automatically.
Implementation:
function loadContextFile(ref: string | ContextFileReference): string {
if (typeof ref === 'string') {
// Old format: read entire file
return readFile(ref);
} else {
// New format: read specified lines
const content = readFile(ref.path);
if (ref.lines) {
return extractLines(content, ref.lines);
}
return content;
}
}
Wrong ❌:
"context_files": [
{
".opencode/context/core/standards/code-quality.md"
}
]
Right ✅:
"context_files": [
{
"path": ".opencode/context/core/standards/code-quality.md",
"lines": "53-95",
"reason": "Pure function patterns"
}
]
Fix: Use path field, not bare string in object.
Wrong ❌:
{
"lines": "10-5" // End before start
}
Wrong ❌:
{
"lines": "abc-def" // Non-numeric
}
Right ✅:
{
"lines": "10-50" // Valid range
}
Right ✅:
{
"lines": "1-20,45-60" // Multiple ranges
}
Fix: Use format "start-end" or "start1-end1,start2-end2" with valid numbers.
Wrong ❌:
"context_files": [
".opencode/context/core/standards/code-quality.md",
"src/auth/service.ts" // Source file in context_files!
]
Right ✅:
"context_files": [
".opencode/context/core/standards/code-quality.md"
],
"reference_files": [
"src/auth/service.ts"
]
Fix: Standards go in context_files, source code goes in reference_files.
path FieldWrong ❌:
{
"lines": "10-50",
"reason": "Pure functions"
// Missing path!
}
Right ✅:
{
"path": ".opencode/context/core/standards/code-quality.md",
"lines": "10-50",
"reason": "Pure functions"
}
Fix: Always include path field in object format.
Wrong ❌:
{
"id": "simple-task-01",
"title": "Fix typo in README",
"context_files": [
{
"path": ".opencode/context/core/standards/code-quality.md",
"lines": "1-165",
"reason": "All standards"
}
],
"bounded_context": "documentation",
"module": "@app/docs",
"rice_score": { "reach": 1, "impact": 0.25, "confidence": 100, "effort": 0.1 }
}
Right ✅:
{
"id": "simple-task-01",
"title": "Fix typo in README",
"deliverables": ["README.md"]
}
Fix: Don't add enhanced fields to simple tasks. Use them only when they add value.
No changes required. TaskManager can create tasks in either format.
Recommendation: Use enhanced format for new tasks, especially:
No changes required. CoderAgent handles both formats automatically.
Behavior:
No changes required. All CLI commands work with both formats.
Commands:
# Works with both old and new formats
npx ts-node .opencode/skill/task-management/scripts/task-cli.ts status
npx ts-node .opencode/skill/task-management/scripts/task-cli.ts next auth-system
npx ts-node .opencode/skill/task-management/scripts/task-cli.ts validate auth-system
No changes required. Orchestrator reads both formats.
Benefit: Enhanced fields (contracts, ADRs) provide better context for orchestration decisions.
lines and reason fieldsbounded_context field to task.json filesmodule field if using modular architecturevertical_slice field if using vertical slicescontracts field to relevant tasksrelated_adrs field with ADR referencesrice_score to task.json fileswsjf_score to task.json filesrelease_slice--dry-runtask-cli.ts validate on migrated tasksA: No. You can migrate incrementally. Old and new formats work together.
A: No. All old tasks continue to work without modification.
A: Yes. You can have some context_files as strings and others as objects.
A: Use the old string format first. Refine to line ranges later when you know which sections matter.
A: No. Add only the fields that provide value for your use case.
A:
grep -n to find relevant sections--dry-run mode to previewA: Update line ranges when you update the referenced files. Consider using section headers instead of line numbers for more stable references (future enhancement).
A: Yes. Start with enhanced schema from day one if you know you'll need the features.
A: Yes. Agents load less content, reducing token usage and processing time.
A: Use task-cli.ts validate <feature> to check JSON structure and dependencies.
.opencode/context/core/task-management/standards/task-schema.md.opencode/context/core/task-management/standards/enhanced-task-schema.md.opencode/context/core/task-management/guides/splitting-tasks.md.opencode/context/core/task-management/guides/managing-tasks.md.opencode/context/core/task-management/lookup/task-commands.mdFor issues or questions:
--dry-run to preview changes