Browse Source

Merge remote-tracking branch 'origin/main' into feature/oac-package-refactor

# Conflicts:
#	.opencode/skills/task-management/SKILL.md
#	.opencode/skills/task-management/scripts/migrate-schema.ts
#	.opencode/skills/task-management/scripts/task-cli.ts
#	.opencode/skills/task-management/scripts/validators/line-number-validator.ts
darrenhinde 5 months ago
parent
commit
c6b00d7aba
64 changed files with 1237 additions and 2172 deletions
  1. 36 4
      .github/workflows/validate-registry.yml
  2. 10 10
      .opencode/agent/core/openagent.md
  3. 1 1
      .opencode/agent/core/opencoder.md
  4. 8 4
      .opencode/agent/subagents/code/coder-agent.md
  5. 5 4
      .opencode/agent/subagents/core/batch-executor.md
  6. 5 5
      .opencode/agent/subagents/core/externalscout.md
  7. 11 11
      .opencode/agent/subagents/core/task-manager.md
  8. 1 1
      .opencode/agent/subagents/system-builder/command-creator.md
  9. 2 23
      .opencode/command/add-context.md
  10. 1 1
      .opencode/command/openagents/check-context-deps.md
  11. 3 3
      .opencode/context/core/navigation.md
  12. 5 5
      .opencode/context/core/system/context-guide.md
  13. 7 7
      .opencode/context/core/visual-development.md
  14. 6 2
      .opencode/context/core/workflows/delegation.md
  15. 1 1
      .opencode/context/core/workflows/external-context-integration.md
  16. 2 2
      .opencode/context/core/workflows/external-context-management.md
  17. 1 1
      .opencode/context/core/workflows/external-libraries-faq.md
  18. 1 1
      .opencode/context/core/workflows/navigation.md
  19. 1 1
      .opencode/context/core/workflows/task-delegation-specialists.md
  20. 12 0
      .opencode/context/core/workflows/task-delegation.md
  21. 2 2
      .opencode/context/development/frontend/when-to-delegate.md
  22. 8 0
      .opencode/context/index.md
  23. 1 1
      .opencode/context/navigation.md
  24. 1 1
      .opencode/context/openagents-repo/blueprints/context-bundle-template.md
  25. 1 1
      .opencode/context/openagents-repo/examples/context-bundle-example.md
  26. 4 4
      .opencode/context/openagents-repo/guides/adding-skill-basics.md
  27. 5 5
      .opencode/context/openagents-repo/guides/adding-skill-example.md
  28. 6 6
      .opencode/context/openagents-repo/guides/adding-skill-implementation.md
  29. 2 2
      .opencode/context/openagents-repo/guides/building-cli-compact.md
  30. 1 1
      .opencode/context/openagents-repo/lookup/file-locations.md
  31. 1 1
      .opencode/context/openagents-repo/quality/registry-dependencies.md
  32. 3 3
      .opencode/plugin/docs/VALIDATOR_GUIDE.md
  33. 7 7
      .opencode/prompts/core/openagent/gemini.md
  34. 7 7
      .opencode/prompts/core/openagent/gpt.md
  35. 7 7
      .opencode/prompts/core/openagent/grok.md
  36. 7 7
      .opencode/prompts/core/openagent/llama.md
  37. 7 7
      .opencode/prompts/core/openagent/openrouter.md
  38. 0 667
      .opencode/skill/task-management/scripts/migrate-schema.ts
  39. 0 875
      .opencode/skill/task-management/scripts/task-cli.ts
  40. 0 273
      .opencode/skill/task-management/scripts/validators/line-number-validator.ts
  41. 9 9
      .opencode/skills/context-manager/SKILL.md
  42. 9 9
      .opencode/skills/context-manager/router.sh
  43. 3 3
      .opencode/skills/context7/README.md
  44. 0 0
      .opencode/skills/context7/SKILL.md
  45. 0 0
      .opencode/skills/context7/library-registry.md
  46. 5 5
      .opencode/skills/context7/navigation.md
  47. 3 3
      .opencode/skills/smart-router-skill/SKILL.md
  48. 0 0
      .opencode/skills/smart-router-skill/config/personality-config.json
  49. 0 0
      .opencode/skills/smart-router-skill/router.sh
  50. 0 0
      .opencode/skills/smart-router-skill/scripts/sherlock-workflow.sh
  51. 0 0
      .opencode/skills/smart-router-skill/scripts/stark-workflow.sh
  52. 0 0
      .opencode/skills/smart-router-skill/scripts/yoda-workflow.sh
  53. 178 131
      .opencode/skills/task-management/SKILL.md
  54. 1 1
      .opencode/skills/task-management/router.sh
  55. 553 0
      .opencode/skills/task-management/scripts/task-cli.ts
  56. 3 3
      CHANGELOG.md
  57. 12 12
      install.sh
  58. 2 1
      package.json
  59. 3 3
      packages/compatibility-layer/docs/migration-guides/claude-to-oac.md
  60. 22 22
      registry.json
  61. 1 1
      scripts/registry/validate-registry.ts
  62. 5 5
      scripts/tests/test-installer-files.sh
  63. 25 0
      scripts/validation/markdown-link-skip-patterns.txt
  64. 214 0
      scripts/validation/validate-markdown-links.ts

+ 36 - 4
.github/workflows/validate-registry.yml

@@ -195,6 +195,30 @@ jobs:
             echo "See [CONTRIBUTING.md](docs/contributing/CONTRIBUTING.md) for details" >> $GITHUB_STEP_SUMMARY
             exit 1
           fi
+
+      - name: Validate markdown context links
+        if: github.event.inputs.skip_validation != 'true'
+        id: validate_context_links
+        run: |
+          echo "## 🔗 Context Link Validation" >> $GITHUB_STEP_SUMMARY
+          echo "" >> $GITHUB_STEP_SUMMARY
+
+          if bun run scripts/validation/validate-markdown-links.ts > /tmp/context-link-validation.txt 2>&1; then
+            echo "context_links=passed" >> $GITHUB_OUTPUT
+            echo "✅ Context markdown links are valid!" >> $GITHUB_STEP_SUMMARY
+            echo "" >> $GITHUB_STEP_SUMMARY
+            echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+            cat /tmp/context-link-validation.txt >> $GITHUB_STEP_SUMMARY
+            echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+          else
+            echo "context_links=failed" >> $GITHUB_OUTPUT
+            echo "❌ Context markdown link validation failed!" >> $GITHUB_STEP_SUMMARY
+            echo "" >> $GITHUB_STEP_SUMMARY
+            echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+            cat /tmp/context-link-validation.txt >> $GITHUB_STEP_SUMMARY
+            echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
+            exit 1
+          fi
       
       - name: Validate registry
         if: github.event.inputs.skip_validation != 'true'
@@ -308,12 +332,14 @@ jobs:
           echo "" >> $GITHUB_STEP_SUMMARY
           
           PROMPT_VALID="${{ steps.validate_prompts.outputs.prompt_validation }}"
+          CONTEXT_LINKS_VALID="${{ steps.validate_context_links.outputs.context_links }}"
           REGISTRY_VALID="${{ steps.validate.outputs.validation }}"
-          
-          if [ "$PROMPT_VALID" = "passed" ] && [ "$REGISTRY_VALID" = "passed" ]; then
+
+          if [ "$PROMPT_VALID" = "passed" ] && [ "$CONTEXT_LINKS_VALID" = "passed" ] && [ "$REGISTRY_VALID" = "passed" ]; then
             echo "### ✅ All Validations Passed" >> $GITHUB_STEP_SUMMARY
             echo "" >> $GITHUB_STEP_SUMMARY
             echo "- ✅ Prompt library structure is valid" >> $GITHUB_STEP_SUMMARY
+            echo "- ✅ Context markdown links are valid" >> $GITHUB_STEP_SUMMARY
             echo "- ✅ Registry paths are valid" >> $GITHUB_STEP_SUMMARY
             echo "" >> $GITHUB_STEP_SUMMARY
             echo "This PR is ready for review!" >> $GITHUB_STEP_SUMMARY
@@ -326,7 +352,13 @@ jobs:
             else
               echo "- ✅ Prompt library validation passed" >> $GITHUB_STEP_SUMMARY
             fi
-            
+
+            if [ "$CONTEXT_LINKS_VALID" != "passed" ]; then
+              echo "- ❌ Context markdown link validation failed" >> $GITHUB_STEP_SUMMARY
+            else
+              echo "- ✅ Context markdown link validation passed" >> $GITHUB_STEP_SUMMARY
+            fi
+
             if [ "$REGISTRY_VALID" != "passed" ]; then
               echo "- ❌ Registry validation failed" >> $GITHUB_STEP_SUMMARY
             else
@@ -339,7 +371,7 @@ jobs:
       
       - name: Fail if validation failed
         if: |
-          (steps.validate_prompts.outputs.prompt_validation == 'failed' || steps.validate.outputs.validation == 'failed') &&
+          (steps.validate_prompts.outputs.prompt_validation == 'failed' || steps.validate_context_links.outputs.context_links == 'failed' || steps.validate.outputs.validation == 'failed') &&
           github.event.inputs.skip_validation != 'true'
         run: |
           echo "❌ Validation failed - blocking PR merge"

+ 10 - 10
.opencode/agent/core/openagent.md

@@ -42,14 +42,14 @@ WHY THIS MATTERS:
 - Docs without standards/documentation.md → Wrong tone, missing sections, poor structure  
 - Tests without standards/test-coverage.md → Wrong framework, incomplete coverage
 - Review without workflows/code-review.md → Missed quality checks, incomplete analysis
-- Delegation without workflows/task-delegation.md → Wrong context passed to subagents
+- Delegation without workflows/task-delegation-basics.md → Wrong context passed to subagents
 
 Required context files:
 - Code tasks → .opencode/context/core/standards/code-quality.md
 - Docs tasks → .opencode/context/core/standards/documentation.md  
 - Tests tasks → .opencode/context/core/standards/test-coverage.md
 - Review tasks → .opencode/context/core/workflows/code-review.md
-- Delegation → .opencode/context/core/workflows/task-delegation.md
+- Delegation → .opencode/context/core/workflows/task-delegation-basics.md
 
 CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effort + rework
 </critical_context_requirement>
@@ -248,7 +248,7 @@ task(
          - docs (write/edit docs) → Read .opencode/context/core/standards/documentation.md NOW
          - tests (write/edit tests) → Read .opencode/context/core/standards/test-coverage.md NOW
          - review (code review) → Read .opencode/context/core/workflows/code-review.md NOW
-         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation.md NOW
+         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation-basics.md NOW
          - bash-only → No context needed, proceed to 3.2
          
          NOTE: Load all files discovered by ContextScout in Stage 1.5 if not already loaded.
@@ -262,7 +262,7 @@ task(
         IF docs task → .opencode/context/core/standards/documentation.md (MANDATORY)
         IF tests task → .opencode/context/core/standards/test-coverage.md (MANDATORY)
         IF review task → .opencode/context/core/workflows/code-review.md (MANDATORY)
-        IF delegation → .opencode/context/core/workflows/task-delegation.md (MANDATORY)
+        IF delegation → .opencode/context/core/workflows/task-delegation-basics.md (MANDATORY)
         IF bash-only → No context required
         
         WHEN DELEGATING TO SUBAGENTS:
@@ -305,10 +305,10 @@ task(
          1. **Identify Parallel Batches** (use task-cli.ts):
             ```bash
             # Get all parallel-ready tasks
-            bash .opencode/skill/task-management/router.sh parallel {feature}
+            bash .opencode/skills/task-management/router.sh parallel {feature}
             
             # Get next eligible tasks
-            bash .opencode/skill/task-management/router.sh next {feature}
+            bash .opencode/skills/task-management/router.sh next {feature}
             ```
          
          2. **Build Execution Plan**:
@@ -346,7 +346,7 @@ task(
          
          4. **Verify Batch 1 Complete**:
             ```bash
-            bash .opencode/skill/task-management/router.sh status {feature}
+            bash .opencode/skills/task-management/router.sh status {feature}
             ```
             Confirm tasks 01, 02, 03 all show status: "completed"
          
@@ -611,7 +611,7 @@ task(
      </route>
    </specialized_routing>
   
-  <process ref=".opencode/context/core/workflows/task-delegation.md">Full delegation template & process</process>
+  <process ref=".opencode/context/core/workflows/task-delegation-basics.md">Full delegation template & process</process>
 </delegation_rules>
 
 <principles>
@@ -624,14 +624,14 @@ task(
 </principles>
 
 <static_context>
-  Context index: .opencode/context/index.md
+  Context index: .opencode/context/navigation.md
   
   Load index when discovering contexts by keywords. For common tasks:
   - Code tasks → .opencode/context/core/standards/code-quality.md
   - Docs tasks → .opencode/context/core/standards/documentation.md  
   - Tests tasks → .opencode/context/core/standards/test-coverage.md
   - Review tasks → .opencode/context/core/workflows/code-review.md
-  - Delegation → .opencode/context/core/workflows/task-delegation.md
+  - Delegation → .opencode/context/core/workflows/task-delegation-basics.md
   
   Full index includes all contexts with triggers and dependencies.
   Context files loaded per @critical_context_requirement.

+ 1 - 1
.opencode/agent/core/opencoder.md

@@ -329,7 +329,7 @@ Code Standards
               
               3. Validate batch completion:
                  ```bash
-                 bash .opencode/skill/task-management/router.sh status {feature}
+                 bash .opencode/skills/task-management/router.sh status {feature}
                  ```
                  - Check all subtasks in batch have status: "completed"
                  - Verify deliverables exist

+ 8 - 4
.opencode/agent/subagents/code/coder-agent.md

@@ -4,6 +4,10 @@ description: Executes coding subtasks in sequence, ensuring completion as specif
 mode: subagent
 temperature: 0
 permission:
+  bash:
+    "*": "deny"
+    "bash .opencode/skills/task-management/router.sh complete*": "allow"
+    "bash .opencode/skills/task-management/router.sh status*": "allow"
   edit:
     "**/*.env*": "deny"
     "**/*.key": "deny"
@@ -35,7 +39,7 @@ permission:
   <system>Subtask execution engine within the OpenAgents task management pipeline</system>
   <domain>Software implementation — coding, file creation, integration</domain>
   <task>Implement atomic subtasks from JSON definitions, following project standards discovered via ContextScout</task>
-  <constraints>No bash access. Sequential execution. Self-review mandatory before handoff.</constraints>
+  <constraints>Limited bash access for task status updates only. Sequential execution. Self-review mandatory before handoff.</constraints>
   <tier level="1" desc="Critical Operations">
     - @context_first: ContextScout ALWAYS before coding
     - @external_scout_mandatory: ExternalScout for any external package
@@ -193,17 +197,17 @@ Update subtask status and report completion to orchestrator:
 **8.1 Update Subtask Status** (REQUIRED for parallel execution tracking):
 ```bash
 # Mark this subtask as completed using task-cli.ts
-bash .opencode/skill/task-management/router.sh complete {feature} {seq} "{completion_summary}"
+bash .opencode/skills/task-management/router.sh complete {feature} {seq} "{completion_summary}"
 ```
 
 Example:
 ```bash
-bash .opencode/skill/task-management/router.sh complete auth-system 01 "Implemented JWT authentication with refresh tokens"
+bash .opencode/skills/task-management/router.sh complete auth-system 01 "Implemented JWT authentication with refresh tokens"
 ```
 
 **8.2 Verify Status Update**:
 ```bash
-bash .opencode/skill/task-management/router.sh status {feature}
+bash .opencode/skills/task-management/router.sh status {feature}
 ```
 Confirm your subtask now shows: `status: "completed"`
 

+ 5 - 4
.opencode/agent/subagents/core/batch-executor.md

@@ -7,7 +7,7 @@ permission:
   bash:
     "*": "deny"
     "npx ts-node*task-cli*": "allow"
-    "bash .opencode/skill/task-management/router.sh*": "allow"
+    "bash .opencode/skills/task-management/router.sh*": "allow"
   edit:
     "**/*.env*": "deny"
     "**/*.key": "deny"
@@ -19,6 +19,7 @@ permission:
     contextscout: "allow"
     externalscout: "allow"
     coderagent: "allow"
+    OpenFrontendSpecialist: "allow"
 ---
 
 # BatchExecutor
@@ -165,7 +166,7 @@ While waiting, you can optionally:
 
 ```bash
 # Check status of all subtasks in this batch
-bash .opencode/skill/task-management/router.sh status {feature}
+bash .opencode/skills/task-management/router.sh status {feature}
 ```
 
 Expected output:
@@ -235,7 +236,7 @@ Batch 2 depends on: 01, 02, 03 (all now satisfied).
 1. **Detect failure** from CoderAgent return
 2. **Check status** of other tasks in batch:
    ```bash
-   bash .opencode/skill/task-management/router.sh status {feature}
+   bash .opencode/skills/task-management/router.sh status {feature}
    ```
 3. **Report to orchestrator**:
    ```
@@ -261,7 +262,7 @@ If CoderAgent reports completion but status doesn't show completed:
 2. **Check if CoderAgent actually ran task-cli.ts complete**
 3. **Manually mark complete** if needed:
    ```bash
-   bash .opencode/skill/task-management/router.sh complete {feature} {seq} "{summary}"
+   bash .opencode/skills/task-management/router.sh complete {feature} {seq} "{summary}"
    ```
 4. **Report discrepancy** to orchestrator
 

+ 5 - 5
.opencode/agent/subagents/core/externalscout.md

@@ -6,7 +6,7 @@ temperature: 0.1
 permission:
   read:
     "**/*": "deny"
-    ".opencode/skill/context7/**": "allow"
+    ".opencode/skills/context7/**": "allow"
     ".tmp/external-context/**": "allow"
   bash:
     "*": "deny"
@@ -30,14 +30,14 @@ permission:
 <critical_rules priority="absolute" enforcement="strict">
   <rule id="tool_usage">
     ALLOWED: 
-    - read: ONLY .opencode/skill/context7/** and .tmp/external-context/**
+    - read: ONLY .opencode/skills/context7/** and .tmp/external-context/**
     - bash: ONLY curl to context7.com
     - skill: ONLY context7
     - grep: ONLY within .tmp/external-context/
     - webfetch: Any URL
     - write: ONLY to .tmp/external-context/**
     - edit: ONLY .tmp/external-context/**
-    - glob: ONLY .opencode/skill/context7/** and .tmp/external-context/**
+    - glob: ONLY .opencode/skills/context7/** and .tmp/external-context/**
     
     NEVER use: task | todoread | todowrite
     NEVER read: Project files, source code, or any files outside allowed paths
@@ -125,7 +125,7 @@ permission:
   <stage id="1" name="DetectLibrary">
     <action>Identify library/framework from user query AND understand tech stack context</action>
     <process>
-      1. Read `.opencode/skill/context7/library-registry.md`
+      1. Read `.opencode/skills/context7/library-registry.md`
       2. Match query against library names, package names, and aliases
       3. Extract library ID and official docs URL
       4. **Detect tech stack context** from user query:
@@ -244,7 +244,7 @@ permission:
 
 ## Quick Reference
 
-**Library Registry**: `.opencode/skill/context7/library-registry.md` — Supported libraries, IDs, and official docs links
+**Library Registry**: `.opencode/skills/context7/library-registry.md` — Supported libraries, IDs, and official docs links
 
 **Supported Libraries**: Drizzle | Prisma | Better Auth | NextAuth.js | Clerk | Next.js | React | TanStack Query/Router | Cloudflare Workers | AWS Lambda | Vercel | Shadcn/ui | Radix UI | Tailwind CSS | Zustand | Jotai | Zod | React Hook Form | Vitest | Playwright
 

+ 11 - 11
.opencode/agent/subagents/core/task-manager.md

@@ -56,7 +56,7 @@ WHY THIS MATTERS:
       - Expect the calling agent to supply relevant context file paths; request them if absent.
       - Use the task tool ONLY for ContextScout discovery, never to delegate task planning to TaskManager.
       - Do NOT create session bundles or write `.tmp/sessions/**` files.
-      - Do NOT read `.opencode/context/core/workflows/task-delegation.md` or follow delegation workflows.
+      - Do NOT read `.opencode/context/core/workflows/task-delegation-basics.md` or follow delegation workflows.
       - Your output (JSON files) is your primary communication channel.
     </with_meta_agent>
 
@@ -85,7 +85,7 @@ WHY THIS MATTERS:
 
         2. Check current task state:
            ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skill/task-management/scripts/task-cli.ts status
+           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skills/task-management/scripts/task-cli.ts status
            ```
 
         3. If context bundle provided, load and extract:
@@ -272,13 +272,14 @@ WHY THIS MATTERS:
  
               **FRONTEND RULE**: If a task involves UI design, styling, or frontend implementation:
               1. Set `suggested_agent`: "OpenFrontendSpecialist"
-              2. Include `.opencode/context/ui/web/ui-styling-standards.md` and `.opencode/context/core/workflows/design-iteration.md` in `context_files`.
-              3. Ensure `acceptance_criteria` includes "Follows 4-stage design workflow" and "Responsive at all breakpoints".
-              4. **PARALLELIZATION**: Design tasks can run in parallel (`parallel: true`) since design work is isolated and doesn't affect backend/logic implementation. Only mark `parallel: false` if design depends on backend API contracts or data structures.
+              2. Include `.opencode/context/ui/web/ui-styling-standards.md` and `.opencode/context/core/workflows/design-iteration-overview.md` in `context_files`.
+              3. If the design task is stage-specific, also include the relevant stage file(s): `design-iteration-stage-layout.md`, `design-iteration-stage-theme.md`, `design-iteration-stage-animation.md`, `design-iteration-stage-implementation.md`.
+              4. Ensure `acceptance_criteria` includes "Follows 4-stage design workflow" and "Responsive at all breakpoints".
+              5. **PARALLELIZATION**: Design tasks can run in parallel (`parallel: true`) since design work is isolated and doesn't affect backend/logic implementation. Only mark `parallel: false` if design depends on backend API contracts or data structures.
  
          4. Validate with CLI:
            ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skill/task-management/scripts/task-cli.ts validate {feature}
+           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skills/task-management/scripts/task-cli.ts validate {feature}
            ```
 
         5. Report creation:
@@ -307,7 +308,7 @@ WHY THIS MATTERS:
 
         3. If all criteria pass:
            ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skill/task-management/scripts/task-cli.ts complete {feature} {seq} "{summary}"
+           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skills/task-management/scripts/task-cli.ts complete {feature} {seq} "{summary}"
            ```
 
         4. If criteria fail:
@@ -317,7 +318,7 @@ WHY THIS MATTERS:
 
         5. Check for next task:
            ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skill/task-management/scripts/task-cli.ts next {feature}
+           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skills/task-management/scripts/task-cli.ts next {feature}
            ```
       </process>
       <checkpoint>Task verified and status updated</checkpoint>
@@ -329,7 +330,7 @@ WHY THIS MATTERS:
       <process>
         1. Verify all tasks complete:
            ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skill/task-management/scripts/task-cli.ts status {feature}
+           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/skills/task-management/scripts/task-cli.ts status {feature}
            ```
 
         2. If completed_count == subtask_count:
@@ -625,7 +626,7 @@ Use task-cli.ts for all status operations:
 | `complete feature seq "summary"` | After verifying task completion |
 | `validate [feature]` | After creating files |
 
-Script location: `.opencode/skill/task-management/scripts/task-cli.ts`
+Script location: `.opencode/skills/task-management/scripts/task-cli.ts`
 </cli_integration>
 
 <quality_standards>
@@ -663,4 +664,3 @@ Script location: `.opencode/skill/task-management/scripts/task-cli.ts`
     <backward_compatibility>All enhanced fields are optional; existing task files remain valid without changes</backward_compatibility>
     <planning_agent_aware>Check for ArchitectureAnalyzer, StoryMapper, PrioritizationEngine, ContractManager, ADRManager outputs and integrate when available</planning_agent_aware>
   </principles>
-

+ 1 - 1
.opencode/agent/subagents/system-builder/command-creator.md

@@ -144,7 +144,7 @@ temperature: 0.1
       ```
     </template>
     <output>Complete command files</output>
-  </step_5>
+  </step_4>
 
   <step_5>
     <action>Create command usage guide</action>

+ 2 - 23
.opencode/command/add-context.md

@@ -796,28 +796,7 @@ Express: `src/routes/ controllers/ models/ middleware/`
 ✅ Version 1.4 → 1.5
 ```
 
-### Example 4: Extract External Context
-```bash
-/add-context
-
-# Found external context files in .tmp/
-#   📄 .tmp/external-context.md (2.4 KB)
-#   📄 .tmp/api-patterns.md (1.8 KB)
-# 
-# Choose: 1. Extract & use these files
-# 
-# Extracted patterns:
-#   ✓ Tech Stack: Next.js 15 + TypeScript + PostgreSQL + Tailwind
-#   ✓ API Pattern: [from external-context.md]
-#   ✓ Component: [from api-patterns.md]
-#   ✓ Naming: kebab-case files, PascalCase components
-#   ✓ Standards: TypeScript strict, Zod validation
-#   ✓ Security: Input validation, parameterized queries
-#
-# ✅ Created: technical-domain.md (merged with external patterns)
-```
-
-### Example 5: External Context Files Present
+### Example 4: External Context Files Present
 ```bash
 /add-context
 
@@ -843,7 +822,7 @@ Express: `src/routes/ controllers/ models/ middleware/`
 # After harvesting, run /add-context again.
 ```
 
-### Example 6: After Harvesting External Context
+### Example 5: After Harvesting External Context
 ```bash
 # After running: /context harvest
 

+ 1 - 1
.opencode/command/openagents/check-context-deps.md

@@ -282,7 +282,7 @@ task(
     TASK:
     1. Use grep to find all references to context files in:
        - .opencode/agent/**/*.md
-       - .opencode/prompts/**/*.md
+       - .opencode/command/**/*.md
     
     2. Search for these patterns:
        - ".opencode/context/core/" (direct paths)

+ 3 - 3
.opencode/context/core/navigation.md

@@ -25,10 +25,10 @@ core/
 ├── workflows/
 │   ├── navigation.md
 │   ├── code-review.md
-│   ├── task-delegation.md
+│   ├── task-delegation-basics.md
 │   ├── feature-breakdown.md
 │   ├── session-management.md
-│   └── design-iteration.md
+│   └── design-iteration-overview.md
 ├── guides/
 │   ├── navigation.md
@@ -69,7 +69,7 @@ core/
 | **Write docs** | `standards/documentation.md` |
 | **Security patterns** | `standards/security-patterns.md` |
 | **Review code** | `workflows/code-review.md` |
-| **Delegate task** | `workflows/task-delegation.md` |
+| **Delegate task** | `workflows/task-delegation-basics.md` |
 | **Break down feature** | `workflows/feature-breakdown.md` |
 | **Resume session** | `guides/resuming-sessions.md` |
 | **Manage tasks** | `task-management/navigation.md` |

+ 5 - 5
.opencode/context/core/system/context-guide.md

@@ -8,7 +8,7 @@
 
 **Key Principle**: Use context index for discovery, load specific files as needed
 
-**Index Location**: `.opencode/context/index.md` - Quick map of all contexts
+**Index Location**: `.opencode/context/navigation.md` - Quick map of all contexts
 
 **Structure**: standards/ (quality + analysis), workflows/ (process + review), system/ (internals)
 
@@ -22,7 +22,7 @@ Context files provide guidelines and templates for specific tasks. Use the index
 
 ## Context Index System
 
-**Central Index**: `.opencode/context/index.md` - Ultra-compact map of all contexts
+**Central Index**: `.opencode/context/navigation.md` - Ultra-compact map of all contexts
 
 The index provides:
 - Quick map for common tasks (code, docs, tests, review, delegation)
@@ -42,7 +42,7 @@ All files are in `.opencode/context/core/` with organized subfolders:
 - `standards/code-analysis.md` - Analysis framework [high]
 
 ### Workflows (Process Templates + Review)
-- `workflows/task-delegation.md` - Delegation template [high]
+- `workflows/task-delegation-basics.md` - Delegation template [high]
 - `workflows/feature-breakdown.md` - Complex task breakdown [high]
 - `workflows/session-management.md` - Session lifecycle [medium]
 - `workflows/code-review.md` - Code review guidelines [high]
@@ -55,7 +55,7 @@ All files are in `.opencode/context/core/` with organized subfolders:
 - Review task? → Load `workflows/code-review.md`
 
 **Step 2: Load Index** (for keyword matching)
-- Load `.opencode/context/index.md`
+- Load `.opencode/context/navigation.md`
 - Scan triggers to find relevant contexts
 - Load specific context files as needed
 
@@ -97,7 +97,7 @@ All files are in `.opencode/context/core/` with organized subfolders:
 - Investigating bugs
 - Evaluating architecture
 
-### .opencode/context/core/workflows/task-delegation.md
+### .opencode/context/core/workflows/task-delegation-basics.md
 - Delegating to general agent
 - Creating task context
 - Multi-file coordination

+ 7 - 7
.opencode/context/core/visual-development.md

@@ -12,7 +12,7 @@
 | **Generate image/diagram** | This file | Image Specialist | tool:gemini |
 | **Edit existing image** | This file | Image Specialist | tool:gemini |
 | **UI mockup (static)** | This file | Image Specialist | tool:gemini |
-| **Interactive UI design** | `workflows/design-iteration.md` | - | - |
+| **Interactive UI design** | `workflows/design-iteration-overview.md` | - | - |
 | **Design system** | `ui/web/design-systems.md` | - | - |
 | **UI standards** | `ui/web/ui-styling-standards.md` | - | - |
 | **Animation patterns** | `ui/web/animation-patterns.md` | - | - |
@@ -302,7 +302,7 @@ User needs visual content
 Is it interactive/responsive HTML/CSS?
-  YES → Use design-iteration.md workflow
+  YES → Use design-iteration-overview.md workflow
     |    - Create HTML files
     |    - Iterate on designs
     |    - Production-ready code
@@ -322,13 +322,13 @@ Is it interactive/responsive HTML/CSS?
 
 | Need | Use |
 |------|-----|
-| **Interactive dashboard** | design-iteration.md |
+| **Interactive dashboard** | design-iteration-overview.md |
 | **Dashboard mockup (static image)** | Image Specialist |
-| **Responsive landing page** | design-iteration.md |
+| **Responsive landing page** | design-iteration-overview.md |
 | **Landing page hero graphic** | Image Specialist |
-| **Working HTML prototype** | design-iteration.md |
+| **Working HTML prototype** | design-iteration-overview.md |
 | **Architecture diagram** | Image Specialist |
-| **UI component library** | design-iteration.md |
+| **UI component library** | design-iteration-overview.md |
 | **Social media graphic** | Image Specialist |
 
 ---
@@ -447,7 +447,7 @@ After receiving output:
 
 ## Related Context
 
-- **UI Design Workflow**: `.opencode/context/core/workflows/design-iteration.md`
+- **UI Design Workflow**: `.opencode/context/core/workflows/design-iteration-overview.md`
 - **Design Systems**: `.opencode/context/ui/web/design-systems.md`
 - **UI Styling Standards**: `.opencode/context/ui/web/ui-styling-standards.md`
 - **Animation Patterns**: `.opencode/context/ui/web/animation-patterns.md`

+ 6 - 2
.opencode/context/core/workflows/delegation.md

@@ -1,7 +1,7 @@
 <!-- Context: workflows/delegation | Priority: high | Version: 2.0 | Updated: 2025-01-21 -->
 # Delegation Context Template
 
-> **Note**: This is a reference file. The full content is in [`task-delegation.md`](./task-delegation.md).
+> **Note**: This is a reference file. Start with [`task-delegation-basics.md`](./task-delegation-basics.md).
 
 ## Quick Reference
 
@@ -13,4 +13,8 @@
 
 ---
 
-For the complete delegation workflow template, see [task-delegation.md](./task-delegation.md).
+For the full delegation workflow, use:
+
+- [task-delegation-basics.md](./task-delegation-basics.md)
+- [task-delegation-specialists.md](./task-delegation-specialists.md)
+- [task-delegation-caching.md](./task-delegation-caching.md)

+ 1 - 1
.opencode/context/core/workflows/external-context-integration.md

@@ -457,5 +457,5 @@ CoderAgent reads subtask JSON and:
 
 - **ExternalScout**: `.opencode/agent/subagents/core/externalscout.md`
 - **External Context Management**: `.opencode/context/core/workflows/external-context-management.md`
-- **Task Delegation**: `.opencode/context/core/workflows/task-delegation.md`
+- **Task Delegation**: `.opencode/context/core/workflows/task-delegation-basics.md`
 - **Management Script**: `scripts/external-context/manage-external-context.sh`

+ 2 - 2
.opencode/context/core/workflows/external-context-management.md

@@ -401,6 +401,6 @@ After deleting external context files, update `.manifest.json`:
 ## References
 
 - **ExternalScout**: `.opencode/agent/subagents/core/externalscout.md` — Fetches and persists external docs
-- **Task Delegation**: `.opencode/context/core/workflows/task-delegation.md` — How to reference external context in sessions
+- **Task Delegation**: `.opencode/context/core/workflows/task-delegation-basics.md` — How to reference external context in sessions
 - **Session Management**: `.opencode/context/core/workflows/session-management.md` — Session lifecycle
-- **Library Registry**: `.opencode/skill/context7/library-registry.md` — Supported libraries and query patterns
+- **Library Registry**: `.opencode/skills/context7/library-registry.md` — Supported libraries and query patterns

+ 1 - 1
.opencode/context/core/workflows/external-libraries-faq.md

@@ -150,7 +150,7 @@ Before implementing with external libraries:
 
 ## Supported Libraries
 
-**See**: `.opencode/skill/context7/library-registry.md`
+**See**: `.opencode/skills/context7/library-registry.md`
 
 **Categories:** Database/ORM | Auth | Frontend | Infrastructure | UI | State | Validation | Testing
 

+ 1 - 1
.opencode/context/core/workflows/navigation.md

@@ -47,7 +47,7 @@
 
 **For complex features**:
 1. Load `feature-breakdown.md` (high)
-2. Depends on: `task-delegation.md`
+2. Depends on: `task-delegation-basics.md`
 
 **For session management**:
 1. Load `session-management.md` (medium)

+ 1 - 1
.opencode/context/core/workflows/task-delegation-specialists.md

@@ -127,4 +127,4 @@ task(
 
 - `task-delegation-basics.md` - Core delegation workflow
 - `task-delegation-caching.md` - Context caching
-- `design-iteration.md` - OpenFrontendSpecialist workflow
+- `design-iteration-overview.md` - OpenFrontendSpecialist workflow

+ 12 - 0
.opencode/context/core/workflows/task-delegation.md

@@ -0,0 +1,12 @@
+<!-- Compatibility shim. Kept to avoid broken links after workflow split. -->
+# Task Delegation
+
+This workflow was split into focused files.
+
+Use these files instead:
+
+1. `task-delegation-basics.md` - Core delegation flow
+2. `task-delegation-specialists.md` - Specialist selection rules
+3. `task-delegation-caching.md` - Context caching patterns
+
+Start here: [task-delegation-basics.md](./task-delegation-basics.md)

+ 2 - 2
.opencode/context/development/frontend/when-to-delegate.md

@@ -292,7 +292,7 @@ The frontend-specialist will automatically load these via ContextScout:
 - `development/frontend/react/react-patterns.md` - React patterns (if React project)
 
 **Workflows**:
-- `core/workflows/design-iteration.md` - Design iteration workflow
+- `core/workflows/design-iteration-overview.md` - Design iteration workflow
 
 ---
 
@@ -464,5 +464,5 @@ task(
 - **Design Systems** → `../../ui/web/design-systems.md`
 - **UI Styling Standards** → `../../ui/web/ui-styling-standards.md`
 - **Animation Patterns** → `../../ui/web/animation-patterns.md`
-- **Delegation Workflow** → `../../core/workflows/task-delegation.md`
+- **Delegation Workflow** → `../../core/workflows/task-delegation-basics.md`
 - **React Patterns** → `react/react-patterns.md`

+ 8 - 0
.opencode/context/index.md

@@ -0,0 +1,8 @@
+<!-- Compatibility shim. Use navigation.md as canonical index. -->
+# Context Index
+
+The canonical context index is `navigation.md`.
+
+Use:
+
+- [navigation.md](./navigation.md)

+ 1 - 1
.opencode/context/navigation.md

@@ -30,7 +30,7 @@
 | **Write tests** | `core/standards/test-coverage.md` |
 | **Write docs** | `core/standards/documentation.md` |
 | **Review code** | `core/workflows/code-review.md` |
-| **Delegate task** | `core/workflows/task-delegation.md` |
+| **Delegate task** | `core/workflows/task-delegation-basics.md` |
 | **Add agent** | `openagents-repo/guides/adding-agent.md` |
 | **UI development** | `development/ui-navigation.md` |
 | **API development** | `development/backend-navigation.md` |

+ 1 - 1
.opencode/context/openagents-repo/blueprints/context-bundle-template.md

@@ -44,7 +44,7 @@ Status: in_progress
 - `.opencode/context/core/standards/security-patterns.md` → Error handling, security patterns
 
 **Core Workflows**:
-- `.opencode/context/core/workflows/task-delegation.md` → Delegation process
+- `.opencode/context/core/workflows/task-delegation-basics.md` → Delegation process
 - `.opencode/context/core/workflows/feature-breakdown.md` → Task breakdown methodology
 - `.opencode/context/core/workflows/code-review.md` → Code review guidelines
 

+ 1 - 1
.opencode/context/openagents-repo/examples/context-bundle-example.md

@@ -92,7 +92,7 @@ Create a new data analyst agent for the OpenAgents Control repository. This agen
 
 **Modify**:
 - `registry.json` - Add data-analyst agent entry
-- `.opencode/context/index.md` - Add data category context if needed
+- `.opencode/context/navigation.md` - Add data category context if needed
 
 ## Success Criteria
 

+ 4 - 4
.opencode/context/openagents-repo/guides/adding-skill-basics.md

@@ -34,12 +34,12 @@ Adding an OpenCode skill involves:
 ### Create Structure
 
 ```bash
-mkdir -p .opencode/skill/{skill-name}/scripts
+mkdir -p .opencode/skills/{skill-name}/scripts
 ```
 
 **Standard structure**:
 ```
-.opencode/skill/{skill-name}/
+.opencode/skills/{skill-name}/
 ├── SKILL.md              # Required: Main skill documentation
 ├── router.sh             # Optional: CLI router script
 └── scripts/
@@ -73,7 +73,7 @@ description: Brief description of what the skill provides
 ### Basic Commands
 
 ```bash
-npx ts-node .opencode/skill/{skill-name}/scripts/skill-cli.ts command1
+npx ts-node .opencode/skills/{skill-name}/scripts/skill-cli.ts command1
 ```
 
 ### Command Reference
@@ -128,7 +128,7 @@ esac
 ```
 
 ```bash
-chmod +x .opencode/skill/{skill-name}/router.sh
+chmod +x .opencode/skills/{skill-name}/router.sh
 ```
 
 ---

+ 5 - 5
.opencode/context/openagents-repo/guides/adding-skill-example.md

@@ -9,11 +9,11 @@
 ## Directory Structure
 
 ```bash
-mkdir -p .opencode/skill/task-management/scripts
+mkdir -p .opencode/skills/task-management/scripts
 ```
 
 ```
-.opencode/skill/task-management/
+.opencode/skills/task-management/
 ├── SKILL.md
 ├── router.sh
 └── scripts/
@@ -46,13 +46,13 @@ description: Task management CLI for tracking feature subtasks
 
 ```bash
 # Show all task statuses
-npx ts-node .opencode/skill/task-management/scripts/task-cli.ts status
+npx ts-node .opencode/skills/task-management/scripts/task-cli.ts status
 
 # Show next eligible tasks
-npx ts-node .opencode/skill/task-management/scripts/task-cli.ts next
+npx ts-node .opencode/skills/task-management/scripts/task-cli.ts next
 
 # Mark complete
-npx ts-node .opencode/skill/task-management/scripts/task-cli.ts complete <feature> <seq> "summary"
+npx ts-node .opencode/skills/task-management/scripts/task-cli.ts complete <feature> <seq> "summary"
 ```
 ```
 

+ 6 - 6
.opencode/context/openagents-repo/guides/adding-skill-implementation.md

@@ -77,7 +77,7 @@ main().catch(console.error)
       "id": "{skill-name}",
       "name": "Skill Name",
       "type": "skill",
-      "path": ".opencode/skill/{skill-name}/SKILL.md",
+      "path": ".opencode/skills/{skill-name}/SKILL.md",
       "description": "Brief description",
       "tags": ["tag1", "tag2"],
       "dependencies": []
@@ -108,13 +108,13 @@ main().catch(console.error)
 
 ```bash
 # Test help
-bash .opencode/skill/{skill-name}/router.sh help
+bash .opencode/skills/{skill-name}/router.sh help
 
 # Test commands
-bash .opencode/skill/{skill-name}/router.sh command1 --option value
+bash .opencode/skills/{skill-name}/router.sh command1 --option value
 
 # Test with npx
-npx ts-node .opencode/skill/{skill-name}/scripts/skill-cli.ts help
+npx ts-node .opencode/skills/{skill-name}/scripts/skill-cli.ts help
 ```
 
 ### Test OpenCode Integration
@@ -151,8 +151,8 @@ npx ts-node .opencode/skill/{skill-name}/scripts/skill-cli.ts help
 
 ## Checklist
 
-- [ ] `.opencode/skill/{skill-name}/SKILL.md` created
-- [ ] `.opencode/skill/{skill-name}/router.sh` created (if CLI-based)
+- [ ] `.opencode/skills/{skill-name}/SKILL.md` created
+- [ ] `.opencode/skills/{skill-name}/router.sh` created (if CLI-based)
 - [ ] Router script is executable (`chmod +x`)
 - [ ] Registry updated (if needed)
 - [ ] Profile updated (if needed)

+ 2 - 2
.opencode/context/openagents-repo/guides/building-cli-compact.md

@@ -12,10 +12,10 @@
 
 **Don't start from scratch.** Use the standard pattern to build robust CLIs in minutes.
 
-1.  **Create**: `mkdir -p .opencode/skill/{name}/scripts`
+1.  **Create**: `mkdir -p .opencode/skills/{name}/scripts`
 2.  **Implement**: Create `skill-cli.ts` (TypeScript) and `router.sh` (Bash)
 3.  **Register**: Add to `registry.json`
-4.  **Run**: `bash .opencode/skill/{name}/router.sh help`
+4.  **Run**: `bash .opencode/skills/{name}/router.sh help`
 
 ---
 

+ 1 - 1
.opencode/context/openagents-repo/lookup/file-locations.md

@@ -159,7 +159,7 @@ README.md                            # Main documentation
 .opencode/context/core/standards/documentation.md
 .opencode/context/core/standards/test-coverage.md
 .opencode/context/core/standards/security-patterns.md
-.opencode/context/core/workflows/task-delegation.md
+.opencode/context/core/workflows/task-delegation-basics.md
 .opencode/context/core/workflows/code-review.md
 ```
 

+ 1 - 1
.opencode/context/openagents-repo/quality/registry-dependencies.md

@@ -127,7 +127,7 @@ Dependency:    context:core/standards/code
 dependencies:
   - context:core/standards/code           # .opencode/context/core/standards/code-quality.md
   - context:core/standards/docs           # .opencode/context/core/standards/documentation.md
-  - context:core/workflows/delegation     # .opencode/context/core/workflows/task-delegation.md
+  - context:core/workflows/delegation     # .opencode/context/core/workflows/task-delegation-basics.md
   - context:openagents-repo/guides/adding-agent  # Project-specific context
 ```
 

+ 3 - 3
.opencode/plugin/docs/VALIDATOR_GUIDE.md

@@ -201,7 +201,7 @@ analyze_context_reads
 - **code.md** (2 reads)
   `.opencode/context/core/standards/code-quality.md`
 - **delegation.md** (1 read)
-  `.opencode/context/core/workflows/task-delegation.md`
+  `.opencode/context/core/workflows/task-delegation-basics.md`
 
 ### Timeline:
 1. [10:23:45] code.md
@@ -235,7 +235,7 @@ check_context_compliance
 
 ### ✅ Compliant Actions:
 - ✅ Loaded standards/code-quality.md before code writing
-- ✅ Loaded workflows/task-delegation.md before delegation
+- ✅ Loaded workflows/task-delegation-basics.md before delegation
 
 ### Context Loading Rules:
 According to OpenAgent prompt, the agent should:
@@ -251,7 +251,7 @@ According to OpenAgent prompt, the agent should:
 - Writing docs → should read `standards/documentation.md`
 - Writing tests → should read `standards/test-coverage.md`
 - Code review → should read `workflows/code-review.md`
-- Delegating → should read `workflows/task-delegation.md`
+- Delegating → should read `workflows/task-delegation-basics.md`
 
 **When to use:**
 - To verify lazy loading is working

+ 7 - 7
.opencode/prompts/core/openagent/gemini.md

@@ -60,14 +60,14 @@ WHY THIS MATTERS:
 - Docs without standards/documentation.md → Wrong tone, missing sections, poor structure  
 - Tests without standards/test-coverage.md → Wrong framework, incomplete coverage
 - Review without workflows/code-review.md → Missed quality checks, incomplete analysis
-- Delegation without workflows/task-delegation.md → Wrong context passed to subagents
+- Delegation without workflows/task-delegation-basics.md → Wrong context passed to subagents
 
 Required context files:
 - Code tasks → .opencode/context/core/standards/code-quality.md
 - Docs tasks → .opencode/context/core/standards/documentation.md  
 - Tests tasks → .opencode/context/core/standards/test-coverage.md
 - Review tasks → .opencode/context/core/workflows/code-review.md
-- Delegation → .opencode/context/core/workflows/task-delegation.md
+- Delegation → .opencode/context/core/workflows/task-delegation-basics.md
 
 CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effort + rework
 </critical_context_requirement>
@@ -180,7 +180,7 @@ task(
          - docs (write/edit docs) → Read .opencode/context/core/standards/documentation.md NOW
          - tests (write/edit tests) → Read .opencode/context/core/standards/test-coverage.md NOW
          - review (code review) → Read .opencode/context/core/workflows/code-review.md NOW
-         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation.md NOW
+         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation-basics.md NOW
          - bash-only → No context needed, proceed to 3.2
       
       3. Apply context:
@@ -192,7 +192,7 @@ task(
         IF docs task → .opencode/context/core/standards/documentation.md (MANDATORY)
         IF tests task → .opencode/context/core/standards/test-coverage.md (MANDATORY)
         IF review task → .opencode/context/core/workflows/code-review.md (MANDATORY)
-        IF delegation → .opencode/context/core/workflows/task-delegation.md (MANDATORY)
+        IF delegation → .opencode/context/core/workflows/task-delegation-basics.md (MANDATORY)
         IF bash-only → No context required
         
         WHEN DELEGATING TO SUBAGENTS:
@@ -303,7 +303,7 @@ task(
     </route>
   </specialized_routing>
   
-  <process ref=".opencode/context/core/workflows/task-delegation.md">Full delegation template & process</process>
+  <process ref=".opencode/context/core/workflows/task-delegation-basics.md">Full delegation template & process</process>
 </delegation_rules>
 
 <principles>
@@ -316,14 +316,14 @@ task(
 </principles>
 
 <static_context>
-  Context index: .opencode/context/index.md
+  Context index: .opencode/context/navigation.md
   
   Load index when discovering contexts by keywords. For common tasks:
   - Code tasks → .opencode/context/core/standards/code-quality.md
   - Docs tasks → .opencode/context/core/standards/documentation.md  
   - Tests tasks → .opencode/context/core/standards/test-coverage.md
   - Review tasks → .opencode/context/core/workflows/code-review.md
-  - Delegation → .opencode/context/core/workflows/task-delegation.md
+  - Delegation → .opencode/context/core/workflows/task-delegation-basics.md
   
   Full index includes all contexts with triggers and dependencies.
   Context files loaded per @critical_context_requirement.

+ 7 - 7
.opencode/prompts/core/openagent/gpt.md

@@ -60,14 +60,14 @@ WHY THIS MATTERS:
 - Docs without standards/documentation.md → Wrong tone, missing sections, poor structure  
 - Tests without standards/test-coverage.md → Wrong framework, incomplete coverage
 - Review without workflows/code-review.md → Missed quality checks, incomplete analysis
-- Delegation without workflows/task-delegation.md → Wrong context passed to subagents
+- Delegation without workflows/task-delegation-basics.md → Wrong context passed to subagents
 
 Required context files:
 - Code tasks → .opencode/context/core/standards/code-quality.md
 - Docs tasks → .opencode/context/core/standards/documentation.md  
 - Tests tasks → .opencode/context/core/standards/test-coverage.md
 - Review tasks → .opencode/context/core/workflows/code-review.md
-- Delegation → .opencode/context/core/workflows/task-delegation.md
+- Delegation → .opencode/context/core/workflows/task-delegation-basics.md
 
 CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effort + rework
 </critical_context_requirement>
@@ -180,7 +180,7 @@ task(
          - docs (write/edit docs) → Read .opencode/context/core/standards/documentation.md NOW
          - tests (write/edit tests) → Read .opencode/context/core/standards/test-coverage.md NOW
          - review (code review) → Read .opencode/context/core/workflows/code-review.md NOW
-         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation.md NOW
+         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation-basics.md NOW
          - bash-only → No context needed, proceed to 3.2
       
       3. Apply context:
@@ -192,7 +192,7 @@ task(
         IF docs task → .opencode/context/core/standards/documentation.md (MANDATORY)
         IF tests task → .opencode/context/core/standards/test-coverage.md (MANDATORY)
         IF review task → .opencode/context/core/workflows/code-review.md (MANDATORY)
-        IF delegation → .opencode/context/core/workflows/task-delegation.md (MANDATORY)
+        IF delegation → .opencode/context/core/workflows/task-delegation-basics.md (MANDATORY)
         IF bash-only → No context required
         
         WHEN DELEGATING TO SUBAGENTS:
@@ -303,7 +303,7 @@ task(
     </route>
   </specialized_routing>
   
-  <process ref=".opencode/context/core/workflows/task-delegation.md">Full delegation template & process</process>
+  <process ref=".opencode/context/core/workflows/task-delegation-basics.md">Full delegation template & process</process>
 </delegation_rules>
 
 <principles>
@@ -316,14 +316,14 @@ task(
 </principles>
 
 <static_context>
-  Context index: .opencode/context/index.md
+  Context index: .opencode/context/navigation.md
   
   Load index when discovering contexts by keywords. For common tasks:
   - Code tasks → .opencode/context/core/standards/code-quality.md
   - Docs tasks → .opencode/context/core/standards/documentation.md  
   - Tests tasks → .opencode/context/core/standards/test-coverage.md
   - Review tasks → .opencode/context/core/workflows/code-review.md
-  - Delegation → .opencode/context/core/workflows/task-delegation.md
+  - Delegation → .opencode/context/core/workflows/task-delegation-basics.md
   
   Full index includes all contexts with triggers and dependencies.
   Context files loaded per @critical_context_requirement.

+ 7 - 7
.opencode/prompts/core/openagent/grok.md

@@ -63,14 +63,14 @@ WHY THIS MATTERS:
 - Docs without standards/documentation.md → Wrong tone, missing sections, poor structure  
 - Tests without standards/test-coverage.md → Wrong framework, incomplete coverage
 - Review without workflows/code-review.md → Missed quality checks, incomplete analysis
-- Delegation without workflows/task-delegation.md → Wrong context passed to subagents
+- Delegation without workflows/task-delegation-basics.md → Wrong context passed to subagents
 
 Required context files:
 - Code tasks → .opencode/context/core/standards/code-quality.md
 - Docs tasks → .opencode/context/core/standards/documentation.md  
 - Tests tasks → .opencode/context/core/standards/test-coverage.md
 - Review tasks → .opencode/context/core/workflows/code-review.md
-- Delegation → .opencode/context/core/workflows/task-delegation.md
+- Delegation → .opencode/context/core/workflows/task-delegation-basics.md
 
 CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effort + rework
 </critical_context_requirement>
@@ -183,7 +183,7 @@ task(
          - docs (write/edit docs) → Read .opencode/context/core/standards/documentation.md NOW
          - tests (write/edit tests) → Read .opencode/context/core/standards/test-coverage.md NOW
          - review (code review) → Read .opencode/context/core/workflows/code-review.md NOW
-         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation.md NOW
+         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation-basics.md NOW
          - bash-only → No context needed, proceed to 3.2
       
       3. Apply context:
@@ -195,7 +195,7 @@ task(
         IF docs task → .opencode/context/core/standards/documentation.md (MANDATORY)
         IF tests task → .opencode/context/core/standards/test-coverage.md (MANDATORY)
         IF review task → .opencode/context/core/workflows/code-review.md (MANDATORY)
-        IF delegation → .opencode/context/core/workflows/task-delegation.md (MANDATORY)
+        IF delegation → .opencode/context/core/workflows/task-delegation-basics.md (MANDATORY)
         IF bash-only → No context required
         
         WHEN DELEGATING TO SUBAGENTS:
@@ -306,7 +306,7 @@ task(
     </route>
   </specialized_routing>
   
-  <process ref=".opencode/context/core/workflows/task-delegation.md">Full delegation template & process</process>
+  <process ref=".opencode/context/core/workflows/task-delegation-basics.md">Full delegation template & process</process>
 </delegation_rules>
 
 <principles>
@@ -319,14 +319,14 @@ task(
 </principles>
 
 <static_context>
-  Context index: .opencode/context/index.md
+  Context index: .opencode/context/navigation.md
   
   Load index when discovering contexts by keywords. For common tasks:
   - Code tasks → .opencode/context/core/standards/code-quality.md
   - Docs tasks → .opencode/context/core/standards/documentation.md  
   - Tests tasks → .opencode/context/core/standards/test-coverage.md
   - Review tasks → .opencode/context/core/workflows/code-review.md
-  - Delegation → .opencode/context/core/workflows/task-delegation.md
+  - Delegation → .opencode/context/core/workflows/task-delegation-basics.md
   
   Full index includes all contexts with triggers and dependencies.
   Context files loaded per @critical_context_requirement.

+ 7 - 7
.opencode/prompts/core/openagent/llama.md

@@ -60,14 +60,14 @@ WHY THIS MATTERS:
 - Docs without standards/documentation.md → Wrong tone, missing sections, poor structure  
 - Tests without standards/test-coverage.md → Wrong framework, incomplete coverage
 - Review without workflows/code-review.md → Missed quality checks, incomplete analysis
-- Delegation without workflows/task-delegation.md → Wrong context passed to subagents
+- Delegation without workflows/task-delegation-basics.md → Wrong context passed to subagents
 
 Required context files:
 - Code tasks → .opencode/context/core/standards/code-quality.md
 - Docs tasks → .opencode/context/core/standards/documentation.md  
 - Tests tasks → .opencode/context/core/standards/test-coverage.md
 - Review tasks → .opencode/context/core/workflows/code-review.md
-- Delegation → .opencode/context/core/workflows/task-delegation.md
+- Delegation → .opencode/context/core/workflows/task-delegation-basics.md
 
 CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effort + rework
 </critical_context_requirement>
@@ -180,7 +180,7 @@ task(
          - docs (write/edit docs) → Read .opencode/context/core/standards/documentation.md NOW
          - tests (write/edit tests) → Read .opencode/context/core/standards/test-coverage.md NOW
          - review (code review) → Read .opencode/context/core/workflows/code-review.md NOW
-         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation.md NOW
+         - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation-basics.md NOW
          - bash-only → No context needed, proceed to 3.2
       
       3. Apply context:
@@ -192,7 +192,7 @@ task(
         IF docs task → .opencode/context/core/standards/documentation.md (MANDATORY)
         IF tests task → .opencode/context/core/standards/test-coverage.md (MANDATORY)
         IF review task → .opencode/context/core/workflows/code-review.md (MANDATORY)
-        IF delegation → .opencode/context/core/workflows/task-delegation.md (MANDATORY)
+        IF delegation → .opencode/context/core/workflows/task-delegation-basics.md (MANDATORY)
         IF bash-only → No context required
         
         WHEN DELEGATING TO SUBAGENTS:
@@ -303,7 +303,7 @@ task(
     </route>
   </specialized_routing>
   
-  <process ref=".opencode/context/core/workflows/task-delegation.md">Full delegation template & process</process>
+  <process ref=".opencode/context/core/workflows/task-delegation-basics.md">Full delegation template & process</process>
 </delegation_rules>
 
 <principles>
@@ -316,14 +316,14 @@ task(
 </principles>
 
 <static_context>
-  Context index: .opencode/context/index.md
+  Context index: .opencode/context/navigation.md
   
   Load index when discovering contexts by keywords. For common tasks:
   - Code tasks → .opencode/context/core/standards/code-quality.md
   - Docs tasks → .opencode/context/core/standards/documentation.md  
   - Tests tasks → .opencode/context/core/standards/test-coverage.md
   - Review tasks → .opencode/context/core/workflows/code-review.md
-  - Delegation → .opencode/context/core/workflows/task-delegation.md
+  - Delegation → .opencode/context/core/workflows/task-delegation-basics.md
   
   Full index includes all contexts with triggers and dependencies.
   Context files loaded per @critical_context_requirement.

+ 7 - 7
.opencode/prompts/core/openagent/openrouter.md

@@ -61,14 +61,14 @@ WHY THIS MATTERS:
 - Docs without standards/documentation.md → Wrong tone, missing sections, poor structure  
 - Tests without standards/test-coverage.md → Wrong framework, incomplete coverage
 - Review without workflows/code-review.md → Missed quality checks, incomplete analysis
-- Delegation without workflows/task-delegation.md → Wrong context passed to subagents
+- Delegation without workflows/task-delegation-basics.md → Wrong context passed to subagents
 
 Required context files:
 - Code tasks → .opencode/context/core/standards/code-quality.md
 - Docs tasks → .opencode/context/core/standards/documentation.md  
 - Tests tasks → .opencode/context/core/standards/test-coverage.md
 - Review tasks → .opencode/context/core/workflows/code-review.md
-- Delegation → .opencode/context/core/workflows/task-delegation.md
+- Delegation → .opencode/context/core/workflows/task-delegation-basics.md
 
 CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effort + rework
 </critical_context_requirement>
@@ -355,7 +355,7 @@ THEN:
          - Rule 5: Build validation needed?
       4. If ANY rule matches:
          - Prepare subagent invocation
-         - Load delegation context: @.opencode/context/core/workflows/task-delegation.md
+         - Load delegation context: @.opencode/context/core/workflows/task-delegation-basics.md
          - Include in approval plan: "Will delegate to [subagent-name] (Rule X matched)"
       5. If NO rules match:
          - Proceed with direct execution
@@ -412,7 +412,7 @@ THEN:
          - docs (write/edit docs) → Read @.opencode/context/core/standards/documentation.md NOW
          - tests (write/edit tests) → Read @.opencode/context/core/standards/test-coverage.md NOW
          - review (code review) → Read @.opencode/context/core/workflows/code-review.md NOW
-         - delegate (using task tool) → Read @.opencode/context/core/workflows/task-delegation.md NOW
+         - delegate (using task tool) → Read @.opencode/context/core/workflows/task-delegation-basics.md NOW
          - bash-only → No context needed, proceed to 3.2
       
       3. Apply context:
@@ -424,7 +424,7 @@ THEN:
         IF docs task → @.opencode/context/core/standards/documentation.md (MANDATORY)
         IF tests task → @.opencode/context/core/standards/test-coverage.md (MANDATORY)
         IF review task → @.opencode/context/core/workflows/code-review.md (MANDATORY)
-        IF delegation → @.opencode/context/core/workflows/task-delegation.md (MANDATORY)
+        IF delegation → @.opencode/context/core/workflows/task-delegation-basics.md (MANDATORY)
         IF bash-only → No context required
         
         WHEN DELEGATING TO SUBAGENTS:
@@ -491,12 +491,12 @@ THEN:
 <delegation_criteria>
   <route agent="TaskManager" category="features">
     <when>Feature spans 4+ files | effort >60 min | complex dependencies</when>
-    <context_inheritance>Load @.opencode/context/core/workflows/task-delegation.md</context_inheritance>
+    <context_inheritance>Load @.opencode/context/core/workflows/task-delegation-basics.md</context_inheritance>
     <invocation>
       task(
         subagent_type="TaskManager",
         description="Break down [feature]",
-        prompt="Analyze and break down [feature] into atomic subtasks. Load @.opencode/context/core/workflows/task-delegation.md for process."
+        prompt="Analyze and break down [feature] into atomic subtasks. Load @.opencode/context/core/workflows/task-delegation-basics.md for process."
       )
     </invocation>
   </route>

+ 0 - 667
.opencode/skill/task-management/scripts/migrate-schema.ts

@@ -1,667 +0,0 @@
-#!/usr/bin/env npx ts-node
-/**
- * Task Schema Migration Script
- * 
- * Migrates task.json and subtask_NN.json files from base schema to enhanced schema.
- * Supports line-number precision, domain modeling, contracts, ADRs, and prioritization.
- * 
- * Usage:
- *   npx ts-node --compiler-options '{"module":"commonjs"}' migrate-schema.ts --task <feature-name>
- *   npx ts-node --compiler-options '{"module":"commonjs"}' migrate-schema.ts --all
- *   npx ts-node --compiler-options '{"module":"commonjs"}' migrate-schema.ts --task <feature> --dry-run
- *   npx ts-node --compiler-options '{"module":"commonjs"}' migrate-schema.ts --task <feature> --lines-only
- *   npx ts-node --compiler-options '{"module":"commonjs"}' migrate-schema.ts --task <feature> --add-domain --bounded-context auth
- */
-
-const fs = require('fs');
-const path = require('path');
-
-// ============================================================================
-// TYPES
-// ============================================================================
-
-interface ContextFileReference {
-  path: string;
-  lines?: string;
-  reason?: string;
-}
-
-interface Contract {
-  type: 'api' | 'interface' | 'event' | 'schema';
-  name: string;
-  path?: string;
-  status: 'draft' | 'defined' | 'implemented' | 'verified';
-  description?: string;
-}
-
-interface DesignComponent {
-  type: 'figma' | 'wireframe' | 'mockup' | 'prototype' | 'sketch';
-  url?: string;
-  path?: string;
-  description?: string;
-}
-
-interface ADRReference {
-  id: string;
-  path?: string;
-  title?: string;
-  decision?: string;
-}
-
-interface RICEScore {
-  reach: number;
-  impact: number;
-  confidence: number;
-  effort: number;
-  score?: number;
-}
-
-interface WSJFScore {
-  business_value: number;
-  time_criticality: number;
-  risk_reduction: number;
-  job_size: number;
-  score?: number;
-}
-
-interface BaseTask {
-  id: string;
-  name: string;
-  status: string;
-  objective: string;
-  context_files?: (string | ContextFileReference)[];
-  reference_files?: (string | ContextFileReference)[];
-  exit_criteria?: string[];
-  subtask_count?: number;
-  completed_count?: number;
-  created_at: string;
-  completed_at?: string;
-}
-
-interface EnhancedTask extends BaseTask {
-  bounded_context?: string;
-  module?: string;
-  vertical_slice?: string;
-  contracts?: Contract[];
-  design_components?: DesignComponent[];
-  related_adrs?: ADRReference[];
-  rice_score?: RICEScore;
-  wsjf_score?: WSJFScore;
-  release_slice?: string;
-}
-
-interface BaseSubtask {
-  id: string;
-  seq: string;
-  title: string;
-  status: string;
-  depends_on?: string[];
-  parallel?: boolean;
-  context_files?: (string | ContextFileReference)[];
-  reference_files?: (string | ContextFileReference)[];
-  suggested_agent?: string;
-  acceptance_criteria?: string[];
-  deliverables?: string[];
-  agent_id?: string | null;
-  started_at?: string | null;
-  completed_at?: string | null;
-  completion_summary?: string | null;
-}
-
-interface EnhancedSubtask extends BaseSubtask {
-  bounded_context?: string;
-  module?: string;
-  vertical_slice?: string;
-  contracts?: Contract[];
-  design_components?: DesignComponent[];
-  related_adrs?: ADRReference[];
-}
-
-interface MigrationOptions {
-  task?: string;
-  all?: boolean;
-  dryRun?: boolean;
-  linesOnly?: boolean;
-  addDomain?: boolean;
-  boundedContext?: string;
-  module?: string;
-  verticalSlice?: string;
-  releaseSlice?: string;
-}
-
-interface MigrationResult {
-  file: string;
-  status: 'migrated' | 'skipped' | 'error';
-  changes: string[];
-  error?: string;
-}
-
-// ============================================================================
-// CONSTANTS
-// ============================================================================
-
-const TASKS_DIR = path.join(process.cwd(), '.tmp', 'tasks');
-
-// ============================================================================
-// UTILITY FUNCTIONS
-// ============================================================================
-
-/**
- * Check if a file exists
- */
-const fileExists = (filePath: string): boolean => {
-  try {
-    return fs.existsSync(filePath);
-  } catch {
-    return false;
-  }
-};
-
-/**
- * Read JSON file
- */
-const readJSON = <T>(filePath: string): T => {
-  const content = fs.readFileSync(filePath, 'utf-8');
-  return JSON.parse(content) as T;
-};
-
-/**
- * Write JSON file with formatting
- */
-const writeJSON = (filePath: string, data: unknown): void => {
-  const content = JSON.stringify(data, null, 2);
-  fs.writeFileSync(filePath, content, 'utf-8');
-};
-
-/**
- * Get all task directories
- */
-const getTaskDirectories = (): string[] => {
-  if (!fileExists(TASKS_DIR)) {
-    return [];
-  }
-  
-  return fs.readdirSync(TASKS_DIR)
-    .filter(name => {
-      const fullPath = path.join(TASKS_DIR, name);
-      return fs.statSync(fullPath).isDirectory() && name !== 'completed';
-    });
-};
-
-/**
- * Get all subtask files for a task
- */
-const getSubtaskFiles = (taskDir: string): string[] => {
-  return fs.readdirSync(taskDir)
-    .filter(name => name.startsWith('subtask_') && name.endsWith('.json'))
-    .map(name => path.join(taskDir, name));
-};
-
-/**
- * Check if context_files is already in enhanced format
- */
-const isEnhancedFormat = (contextFiles?: (string | ContextFileReference)[]): boolean => {
-  if (!contextFiles || contextFiles.length === 0) {
-    return false;
-  }
-  
-  return contextFiles.some(ref => typeof ref === 'object' && 'path' in ref);
-};
-
-/**
- * Convert string array to enhanced format with line-number precision
- */
-const convertToEnhancedFormat = (
-  files: (string | ContextFileReference)[] | undefined,
-  isContextFile: boolean
-): ContextFileReference[] | undefined => {
-  if (!files || files.length === 0) {
-    return undefined;
-  }
-  
-  return files.map(ref => {
-    if (typeof ref === 'string') {
-      // Convert string to object format
-      const fileSize = getFileSize(ref);
-      const shouldAddLines = fileSize > 100; // Add line ranges for files >100 lines
-      
-      return {
-        path: ref,
-        ...(shouldAddLines && { lines: suggestLineRange(ref) }),
-        reason: isContextFile 
-          ? 'Standards and patterns to follow'
-          : 'Existing code to reference'
-      };
-    }
-    return ref; // Already in enhanced format
-  });
-};
-
-/**
- * Get file size in lines (returns 0 if file doesn't exist)
- */
-const getFileSize = (filePath: string): number => {
-  const fullPath = path.join(process.cwd(), filePath);
-  if (!fileExists(fullPath)) {
-    return 0;
-  }
-  
-  try {
-    const content = fs.readFileSync(fullPath, 'utf-8');
-    return content.split('\n').length;
-  } catch {
-    return 0;
-  }
-};
-
-/**
- * Suggest line range for a file (placeholder - would need smarter logic)
- */
-const suggestLineRange = (filePath: string): string | undefined => {
-  const size = getFileSize(filePath);
-  if (size === 0 || size <= 100) {
-    return undefined;
-  }
-  
-  // For now, suggest reading first half of large files
-  // In production, this would use semantic analysis
-  return `1-${Math.floor(size / 2)}`;
-};
-
-// ============================================================================
-// MIGRATION LOGIC
-// ============================================================================
-
-/**
- * Migrate task.json file
- */
-const migrateTaskFile = (
-  taskPath: string,
-  options: MigrationOptions
-): MigrationResult => {
-  const changes: string[] = [];
-  
-  try {
-    const task = readJSON<BaseTask>(taskPath);
-    const enhanced: EnhancedTask = { ...task };
-    
-    // Convert context_files to enhanced format
-    if (options.linesOnly || !isEnhancedFormat(task.context_files)) {
-      const converted = convertToEnhancedFormat(task.context_files, true);
-      if (converted) {
-        enhanced.context_files = converted;
-        changes.push('Added line-number precision to context_files');
-      }
-    }
-    
-    // Convert reference_files to enhanced format
-    if (options.linesOnly || !isEnhancedFormat(task.reference_files)) {
-      const converted = convertToEnhancedFormat(task.reference_files, false);
-      if (converted) {
-        enhanced.reference_files = converted;
-        changes.push('Added line-number precision to reference_files');
-      }
-    }
-    
-    // Add domain modeling fields
-    if (options.addDomain) {
-      if (options.boundedContext && !enhanced.bounded_context) {
-        enhanced.bounded_context = options.boundedContext;
-        changes.push(`Added bounded_context: ${options.boundedContext}`);
-      }
-      
-      if (options.module && !enhanced.module) {
-        enhanced.module = options.module;
-        changes.push(`Added module: ${options.module}`);
-      }
-      
-      if (options.verticalSlice && !enhanced.vertical_slice) {
-        enhanced.vertical_slice = options.verticalSlice;
-        changes.push(`Added vertical_slice: ${options.verticalSlice}`);
-      }
-    }
-    
-    // Add release slice
-    if (options.releaseSlice && !enhanced.release_slice) {
-      enhanced.release_slice = options.releaseSlice;
-      changes.push(`Added release_slice: ${options.releaseSlice}`);
-    }
-    
-    // Write changes if not dry run
-    if (!options.dryRun && changes.length > 0) {
-      writeJSON(taskPath, enhanced);
-    }
-    
-    return {
-      file: taskPath,
-      status: changes.length > 0 ? 'migrated' : 'skipped',
-      changes
-    };
-  } catch (err) {
-    return {
-      file: taskPath,
-      status: 'error',
-      changes: [],
-      error: err instanceof Error ? err.message : String(err)
-    };
-  }
-};
-
-/**
- * Migrate subtask_NN.json file
- */
-const migrateSubtaskFile = (
-  subtaskPath: string,
-  options: MigrationOptions,
-  taskDomain?: { boundedContext?: string; module?: string; verticalSlice?: string }
-): MigrationResult => {
-  const changes: string[] = [];
-  
-  try {
-    const subtask = readJSON<BaseSubtask>(subtaskPath);
-    const enhanced: EnhancedSubtask = { ...subtask };
-    
-    // Convert context_files to enhanced format
-    if (options.linesOnly || !isEnhancedFormat(subtask.context_files)) {
-      const converted = convertToEnhancedFormat(subtask.context_files, true);
-      if (converted) {
-        enhanced.context_files = converted;
-        changes.push('Added line-number precision to context_files');
-      }
-    }
-    
-    // Convert reference_files to enhanced format
-    if (options.linesOnly || !isEnhancedFormat(subtask.reference_files)) {
-      const converted = convertToEnhancedFormat(subtask.reference_files, false);
-      if (converted) {
-        enhanced.reference_files = converted;
-        changes.push('Added line-number precision to reference_files');
-      }
-    }
-    
-    // Inherit domain fields from task if not already set
-    if (taskDomain) {
-      if (taskDomain.boundedContext && !enhanced.bounded_context) {
-        enhanced.bounded_context = taskDomain.boundedContext;
-        changes.push(`Inherited bounded_context: ${taskDomain.boundedContext}`);
-      }
-      
-      if (taskDomain.module && !enhanced.module) {
-        enhanced.module = taskDomain.module;
-        changes.push(`Inherited module: ${taskDomain.module}`);
-      }
-      
-      if (taskDomain.verticalSlice && !enhanced.vertical_slice) {
-        enhanced.vertical_slice = taskDomain.verticalSlice;
-        changes.push(`Inherited vertical_slice: ${taskDomain.verticalSlice}`);
-      }
-    }
-    
-    // Write changes if not dry run
-    if (!options.dryRun && changes.length > 0) {
-      writeJSON(subtaskPath, enhanced);
-    }
-    
-    return {
-      file: subtaskPath,
-      status: changes.length > 0 ? 'migrated' : 'skipped',
-      changes
-    };
-  } catch (err) {
-    return {
-      file: subtaskPath,
-      status: 'error',
-      changes: [],
-      error: err instanceof Error ? err.message : String(err)
-    };
-  }
-};
-
-/**
- * Migrate a single task (task.json + all subtasks)
- */
-const migrateTask = (taskName: string, options: MigrationOptions): MigrationResult[] => {
-  const results: MigrationResult[] = [];
-  const taskDir = path.join(TASKS_DIR, taskName);
-  
-  if (!fileExists(taskDir)) {
-    return [{
-      file: taskName,
-      status: 'error',
-      changes: [],
-      error: `Task directory not found: ${taskDir}`
-    }];
-  }
-  
-  // Migrate task.json
-  const taskPath = path.join(taskDir, 'task.json');
-  if (fileExists(taskPath)) {
-    const taskResult = migrateTaskFile(taskPath, options);
-    results.push(taskResult);
-    
-    // Get domain fields from migrated task for subtasks
-    const task = readJSON<EnhancedTask>(taskPath);
-    const taskDomain = {
-      boundedContext: task.bounded_context,
-      module: task.module,
-      verticalSlice: task.vertical_slice
-    };
-    
-    // Migrate all subtasks
-    const subtaskFiles = getSubtaskFiles(taskDir);
-    for (const subtaskPath of subtaskFiles) {
-      const subtaskResult = migrateSubtaskFile(subtaskPath, options, taskDomain);
-      results.push(subtaskResult);
-    }
-  } else {
-    results.push({
-      file: taskPath,
-      status: 'error',
-      changes: [],
-      error: 'task.json not found'
-    });
-  }
-  
-  return results;
-};
-
-/**
- * Migrate all tasks
- */
-const migrateAllTasks = (options: MigrationOptions): MigrationResult[] => {
-  const results: MigrationResult[] = [];
-  const taskDirs = getTaskDirectories();
-  
-  for (const taskName of taskDirs) {
-    const taskResults = migrateTask(taskName, options);
-    results.push(...taskResults);
-  }
-  
-  return results;
-};
-
-// ============================================================================
-// REPORTING
-// ============================================================================
-
-/**
- * Print migration results
- */
-const printResults = (results: MigrationResult[], options: MigrationOptions): void => {
-  const prefix = options.dryRun ? '[DRY RUN] ' : '';
-  
-  console.log('\n' + prefix + 'Migration Results:');
-  console.log('='.repeat(60));
-  
-  let migrated = 0;
-  let skipped = 0;
-  let errors = 0;
-  
-  for (const result of results) {
-    const fileName = path.basename(result.file);
-    
-    if (result.status === 'migrated') {
-      migrated++;
-      console.log(`\n✓ ${fileName}`);
-      for (const change of result.changes) {
-        console.log(`  - ${change}`);
-      }
-    } else if (result.status === 'skipped') {
-      skipped++;
-      console.log(`\n- ${fileName} (no changes needed)`);
-    } else {
-      errors++;
-      console.log(`\n✗ ${fileName}`);
-      console.log(`  Error: ${result.error}`);
-    }
-  }
-  
-  console.log('\n' + '='.repeat(60));
-  console.log(`Total: ${results.length} files`);
-  console.log(`Migrated: ${migrated}`);
-  console.log(`Skipped: ${skipped}`);
-  console.log(`Errors: ${errors}`);
-  
-  if (options.dryRun) {
-    console.log('\nThis was a dry run. No files were modified.');
-    console.log('Remove --dry-run to apply changes.');
-  }
-};
-
-// ============================================================================
-// CLI ARGUMENT PARSING
-// ============================================================================
-
-/**
- * Parse command line arguments
- */
-const parseArgs = (): MigrationOptions => {
-  const args = process.argv.slice(2);
-  const options: MigrationOptions = {};
-  
-  for (let i = 0; i < args.length; i++) {
-    const arg = args[i];
-    
-    switch (arg) {
-      case '--task':
-        options.task = args[++i];
-        break;
-      case '--all':
-        options.all = true;
-        break;
-      case '--dry-run':
-        options.dryRun = true;
-        break;
-      case '--lines-only':
-        options.linesOnly = true;
-        break;
-      case '--add-domain':
-        options.addDomain = true;
-        break;
-      case '--bounded-context':
-        options.boundedContext = args[++i];
-        break;
-      case '--module':
-        options.module = args[++i];
-        break;
-      case '--vertical-slice':
-        options.verticalSlice = args[++i];
-        break;
-      case '--release':
-        options.releaseSlice = args[++i];
-        break;
-      case '--help':
-      case '-h':
-        printHelp();
-        process.exit(0);
-        break;
-      default:
-        console.error(`Unknown option: ${arg}`);
-        printHelp();
-        process.exit(1);
-    }
-  }
-  
-  return options;
-};
-
-/**
- * Print help message
- */
-const printHelp = (): void => {
-  console.log(`
-Task Schema Migration Script
-
-Usage:
-  npx ts-node migrate-schema.ts [options]
-
-Options:
-  --task <name>              Migrate specific task
-  --all                      Migrate all 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
-  --help, -h                 Show this help message
-
-Examples:
-  # Migrate single task
-  npx ts-node migrate-schema.ts --task auth-system
-
-  # Dry run to preview changes
-  npx ts-node migrate-schema.ts --task auth-system --dry-run
-
-  # Add line-number precision only
-  npx ts-node migrate-schema.ts --task auth-system --lines-only
-
-  # Add domain modeling
-  npx ts-node migrate-schema.ts --task auth-system --add-domain \\
-    --bounded-context authentication --module @app/auth
-
-  # Migrate all tasks
-  npx ts-node migrate-schema.ts --all
-`);
-};
-
-// ============================================================================
-// MAIN
-// ============================================================================
-
-const main = (): void => {
-  const options = parseArgs();
-  
-  // Validate options
-  if (!options.task && !options.all) {
-    console.error('Error: Must specify --task <name> or --all');
-    printHelp();
-    process.exit(1);
-  }
-  
-  if (options.task && options.all) {
-    console.error('Error: Cannot use both --task and --all');
-    printHelp();
-    process.exit(1);
-  }
-  
-  // Run migration
-  const results = options.all 
-    ? migrateAllTasks(options)
-    : migrateTask(options.task!, options);
-  
-  // Print results
-  printResults(results, options);
-  
-  // Exit with error code if any errors occurred
-  const hasErrors = results.some(r => r.status === 'error');
-  process.exit(hasErrors ? 1 : 0);
-};
-
-// Run if executed directly
-if (require.main === module) {
-  main();
-}
-
-export { migrateTask, migrateAllTasks, type MigrationOptions, type MigrationResult };

+ 0 - 875
.opencode/skill/task-management/scripts/task-cli.ts

@@ -1,875 +0,0 @@
-#!/usr/bin/env npx ts-node
-/**
- * Task Management CLI
- *
- * Usage: npx ts-node task-cli.ts <command> [feature] [args...]
- *
- * Commands:
- *   status [feature]              - Show task status summary
- *   next [feature]                - Show next eligible tasks
- *   parallel [feature]            - Show parallelizable tasks ready to run
- *   deps <feature> <seq>          - Show dependency tree for a task
- *   blocked [feature]             - Show blocked tasks and why
- *   complete <feature> <seq> "summary" - Mark task completed
- *   validate [feature]            - Validate JSON files and dependencies
- *   context [feature]             - Show bounded context breakdown
- *   contracts [feature]           - Show contract dependencies
- *
- * Task files are stored in .tmp/tasks/ at the project root:
- *   .tmp/tasks/{feature-slug}/task.json
- *   .tmp/tasks/{feature-slug}/subtask_01.json
- *   .tmp/tasks/completed/{feature-slug}/
- */
-
-const fs = require('fs');
-const path = require('path');
-
-// Line-number validator (inline for CommonJS compatibility)
-function validateLineNumberFormat(lines: string | undefined): { valid: boolean; errors: string[]; warnings?: string[] } {
-  const errors: string[] = [];
-  const warnings: string[] = [];
-
-  if (!lines || lines.trim() === '') {
-    return { valid: true, errors: [] };
-  }
-
-  const trimmed = lines.trim();
-  const invalidCharsPattern = /[^0-9,\-\s]/;
-  if (invalidCharsPattern.test(trimmed)) {
-    errors.push(`Invalid characters in line range: "${trimmed}". Only digits, commas, and hyphens are allowed.`);
-    return { valid: false, errors, warnings };
-  }
-
-  if (trimmed.startsWith(',') || trimmed.endsWith(',')) {
-    errors.push(`Line range cannot start or end with a comma: "${trimmed}"`);
-  }
-  if (trimmed.startsWith('-') || trimmed.endsWith('-')) {
-    errors.push(`Line range cannot start or end with a hyphen: "${trimmed}"`);
-  }
-  if (trimmed.includes(',,')) {
-    errors.push(`Line range contains consecutive commas: "${trimmed}"`);
-  }
-  if (trimmed.includes('--')) {
-    errors.push(`Line range contains consecutive hyphens: "${trimmed}"`);
-  }
-
-  if (errors.length > 0) {
-    return { valid: false, errors, warnings };
-  }
-
-  const segments = trimmed.split(',');
-  for (const segment of segments) {
-    const segmentTrimmed = segment.trim();
-    if (segmentTrimmed === '') {
-      errors.push(`Empty segment in line range: "${trimmed}"`);
-      continue;
-    }
-
-    if (segmentTrimmed.includes('-')) {
-      const parts = segmentTrimmed.split('-');
-      if (parts.length !== 2) {
-        errors.push(`Invalid range format: "${segmentTrimmed}". Expected format: "start-end"`);
-        continue;
-      }
-
-      const startStr = parts[0].trim();
-      const endStr = parts[1].trim();
-      if (startStr === '' || endStr === '') {
-        errors.push(`Range has empty start or end: "${segmentTrimmed}"`);
-        continue;
-      }
-
-      const start = parseInt(startStr, 10);
-      const end = parseInt(endStr, 10);
-      if (isNaN(start) || isNaN(end)) {
-        errors.push(`Non-numeric values in range: "${segmentTrimmed}"`);
-        continue;
-      }
-      if (start < 1 || end < 1) {
-        errors.push(`Line numbers must be positive: "${segmentTrimmed}"`);
-        continue;
-      }
-      if (start > end) {
-        errors.push(`Invalid range (start > end): "${segmentTrimmed}". Start must be less than or equal to end.`);
-        continue;
-      }
-      if (start === end) {
-        warnings.push(`Range "${segmentTrimmed}" has same start and end. Consider using single line format: "${start}"`);
-      }
-    } else {
-      const lineNum = parseInt(segmentTrimmed, 10);
-      if (isNaN(lineNum)) {
-        errors.push(`Non-numeric line number: "${segmentTrimmed}"`);
-        continue;
-      }
-      if (lineNum < 1) {
-        errors.push(`Line number must be positive: "${segmentTrimmed}"`);
-        continue;
-      }
-    }
-  }
-
-  return {
-    valid: errors.length === 0,
-    errors,
-    warnings: warnings.length > 0 ? warnings : undefined
-  };
-}
-
-// Find project root (look for .git or package.json)
-function findProjectRoot(): string {
-  let dir = process.cwd();
-  while (dir !== path.dirname(dir)) {
-    if (fs.existsSync(path.join(dir, '.git')) || fs.existsSync(path.join(dir, 'package.json'))) {
-      return dir;
-    }
-    dir = path.dirname(dir);
-  }
-  return process.cwd();
-}
-
-const PROJECT_ROOT = findProjectRoot();
-const TASKS_DIR = path.join(PROJECT_ROOT, '.tmp', 'tasks');
-const COMPLETED_DIR = path.join(TASKS_DIR, 'completed');
-
-// Enhanced schema types
-interface ContextFileReference {
-  path: string;
-  lines?: string;
-  reason?: string;
-}
-
-interface Contract {
-  type: 'api' | 'interface' | 'event' | 'schema';
-  name: string;
-  path?: string;
-  status: 'draft' | 'defined' | 'implemented' | 'verified';
-  description?: string;
-}
-
-interface DesignComponent {
-  type: 'figma' | 'wireframe' | 'mockup' | 'prototype' | 'sketch';
-  url?: string;
-  path?: string;
-  description?: string;
-}
-
-interface ADRReference {
-  id: string;
-  path?: string;
-  title?: string;
-  decision?: string;
-}
-
-interface RICEScore {
-  reach: number;
-  impact: number;
-  confidence: number;
-  effort: number;
-  score?: number;
-}
-
-interface WSJFScore {
-  business_value: number;
-  time_criticality: number;
-  risk_reduction: number;
-  job_size: number;
-  score?: number;
-}
-
-interface Task {
-  id: string;
-  name: string;
-  status: 'active' | 'completed' | 'blocked' | 'archived';
-  objective: string;
-  context_files?: (string | ContextFileReference)[];
-  reference_files?: (string | ContextFileReference)[];
-  exit_criteria?: string[];
-  subtask_count?: number;
-  completed_count?: number;
-  created_at: string;
-  completed_at?: string | null;
-  // Enhanced fields
-  bounded_context?: string;
-  module?: string;
-  vertical_slice?: string;
-  contracts?: Contract[];
-  design_components?: DesignComponent[];
-  related_adrs?: ADRReference[];
-  rice_score?: RICEScore;
-  wsjf_score?: WSJFScore;
-  release_slice?: string;
-}
-
-interface Subtask {
-  id: string;
-  seq: string;
-  title: string;
-  status: 'pending' | 'in_progress' | 'completed' | 'blocked';
-  depends_on?: string[];
-  parallel?: boolean;
-  context_files?: (string | ContextFileReference)[];
-  reference_files?: (string | ContextFileReference)[];
-  acceptance_criteria?: string[];
-  deliverables?: string[];
-  agent_id?: string | null;
-  suggested_agent?: string;
-  started_at?: string | null;
-  completed_at?: string | null;
-  completion_summary?: string | null;
-  // Enhanced fields
-  bounded_context?: string;
-  module?: string;
-  vertical_slice?: string;
-  contracts?: Contract[];
-  design_components?: DesignComponent[];
-  related_adrs?: ADRReference[];
-}
-
-// Helpers
-function getFeatureDirs(): string[] {
-  if (!fs.existsSync(TASKS_DIR)) return [];
-  return fs.readdirSync(TASKS_DIR).filter((f: string) => {
-    const fullPath = path.join(TASKS_DIR, f);
-    return fs.statSync(fullPath).isDirectory() && f !== 'completed';
-  });
-}
-
-function loadTask(feature: string): Task | null {
-  const taskPath = path.join(TASKS_DIR, feature, 'task.json');
-  if (!fs.existsSync(taskPath)) return null;
-  return JSON.parse(fs.readFileSync(taskPath, 'utf-8'));
-}
-
-function loadSubtasks(feature: string): Subtask[] {
-  const featureDir = path.join(TASKS_DIR, feature);
-  if (!fs.existsSync(featureDir)) return [];
-
-  const files = fs.readdirSync(featureDir)
-    .filter((f: string) => f.match(/^subtask_\d{2}\.json$/))
-    .sort();
-
-  return files.map((f: string) => JSON.parse(fs.readFileSync(path.join(featureDir, f), 'utf-8')));
-}
-
-function saveSubtask(feature: string, subtask: Subtask): void {
-  const subtaskPath = path.join(TASKS_DIR, feature, `subtask_${subtask.seq}.json`);
-  fs.writeFileSync(subtaskPath, JSON.stringify(subtask, null, 2));
-}
-
-function saveTask(feature: string, task: Task): void {
-  const taskPath = path.join(TASKS_DIR, feature, 'task.json');
-  fs.writeFileSync(taskPath, JSON.stringify(task, null, 2));
-}
-
-// Commands
-function cmdStatus(feature?: string): void {
-  const features = feature ? [feature] : getFeatureDirs();
-
-  if (features.length === 0) {
-    console.log('No active features found.');
-    return;
-  }
-
-  for (const f of features) {
-    const task = loadTask(f);
-    const subtasks = loadSubtasks(f);
-
-    if (!task) {
-      console.log(`\n[${f}] - No task.json found`);
-      continue;
-    }
-
-    const counts = {
-      pending: subtasks.filter(s => s.status === 'pending').length,
-      in_progress: subtasks.filter(s => s.status === 'in_progress').length,
-      completed: subtasks.filter(s => s.status === 'completed').length,
-      blocked: subtasks.filter(s => s.status === 'blocked').length,
-    };
-
-    const progress = subtasks.length > 0
-      ? Math.round((counts.completed / subtasks.length) * 100)
-      : 0;
-
-    console.log(`\n[${f}] ${task.name}`);
-    console.log(`  Status: ${task.status} | Progress: ${progress}% (${counts.completed}/${subtasks.length})`);
-    console.log(`  Pending: ${counts.pending} | In Progress: ${counts.in_progress} | Completed: ${counts.completed} | Blocked: ${counts.blocked}`);
-    
-    // Display enhanced metadata if present
-    if (task.bounded_context) {
-      console.log(`  Bounded Context: ${task.bounded_context}`);
-    }
-    if (task.module) {
-      console.log(`  Module: ${task.module}`);
-    }
-    if (task.vertical_slice) {
-      console.log(`  Vertical Slice: ${task.vertical_slice}`);
-    }
-    if (task.release_slice) {
-      console.log(`  Release: ${task.release_slice}`);
-    }
-    if (task.rice_score) {
-      const score = task.rice_score.score || 
-        ((task.rice_score.reach * task.rice_score.impact * (task.rice_score.confidence / 100)) / task.rice_score.effort);
-      console.log(`  RICE Score: ${score.toFixed(2)} (R:${task.rice_score.reach} I:${task.rice_score.impact} C:${task.rice_score.confidence}% E:${task.rice_score.effort})`);
-    }
-    if (task.wsjf_score) {
-      const score = task.wsjf_score.score || 
-        ((task.wsjf_score.business_value + task.wsjf_score.time_criticality + task.wsjf_score.risk_reduction) / task.wsjf_score.job_size);
-      console.log(`  WSJF Score: ${score.toFixed(2)} (BV:${task.wsjf_score.business_value} TC:${task.wsjf_score.time_criticality} RR:${task.wsjf_score.risk_reduction} JS:${task.wsjf_score.job_size})`);
-    }
-    if (task.contracts && task.contracts.length > 0) {
-      console.log(`  Contracts: ${task.contracts.length} (${task.contracts.filter(c => c.status === 'implemented').length} implemented)`);
-    }
-  }
-}
-
-function cmdNext(feature?: string): void {
-  const features = feature ? [feature] : getFeatureDirs();
-
-  console.log('\n=== Ready Tasks (deps satisfied) ===\n');
-
-  for (const f of features) {
-    const subtasks = loadSubtasks(f);
-    const completedSeqs = new Set(subtasks.filter(s => s.status === 'completed').map(s => s.seq));
-
-    const ready = subtasks.filter(s => {
-      if (s.status !== 'pending') return false;
-      return (s.depends_on || []).every(dep => completedSeqs.has(dep));
-    });
-
-    if (ready.length > 0) {
-      console.log(`[${f}]`);
-      for (const s of ready) {
-        const parallel = s.parallel ? '[parallel]' : '[sequential]';
-        console.log(`  ${s.seq} - ${s.title}  ${parallel}`);
-      }
-      console.log();
-    }
-  }
-}
-
-function cmdParallel(feature?: string): void {
-  const features = feature ? [feature] : getFeatureDirs();
-
-  console.log('\n=== Parallelizable Tasks Ready Now ===\n');
-
-  for (const f of features) {
-    const subtasks = loadSubtasks(f);
-    const completedSeqs = new Set(subtasks.filter(s => s.status === 'completed').map(s => s.seq));
-
-    const parallel = subtasks.filter(s => {
-      if (s.status !== 'pending') return false;
-      if (!s.parallel) return false;
-      return (s.depends_on || []).every(dep => completedSeqs.has(dep));
-    });
-
-    if (parallel.length > 0) {
-      console.log(`[${f}] - ${parallel.length} parallel tasks:`);
-      for (const s of parallel) {
-        console.log(`  ${s.seq} - ${s.title}`);
-      }
-      console.log();
-    }
-  }
-}
-
-function cmdDeps(feature: string, seq: string): void {
-  const subtasks = loadSubtasks(feature);
-  const target = subtasks.find(s => s.seq === seq);
-
-  if (!target) {
-    console.log(`Task ${seq} not found in ${feature}`);
-    return;
-  }
-
-  console.log(`\n=== Dependency Tree: ${feature}/${seq} ===\n`);
-  console.log(`${seq} - ${target.title} [${target.status}]`);
-
-  const depends_on = target.depends_on || [];
-  if (depends_on.length === 0) {
-    console.log('  └── (no dependencies)');
-    return;
-  }
-
-  const printDeps = (seqs: string[], indent: string = '  '): void => {
-    for (let i = 0; i < seqs.length; i++) {
-      const depSeq = seqs[i];
-      const dep = subtasks.find(s => s.seq === depSeq);
-      const isLast = i === seqs.length - 1;
-      const branch = isLast ? '└──' : '├──';
-
-      if (dep) {
-        const statusIcon = dep.status === 'completed' ? '✓' : dep.status === 'in_progress' ? '~' : '○';
-        console.log(`${indent}${branch} ${statusIcon} ${depSeq} - ${dep.title} [${dep.status}]`);
-        const depDeps = dep.depends_on || [];
-        if (depDeps.length > 0) {
-          const newIndent = indent + (isLast ? '    ' : '│   ');
-          printDeps(depDeps, newIndent);
-        }
-      } else {
-        console.log(`${indent}${branch} ? ${depSeq} - NOT FOUND`);
-      }
-    }
-  };
-
-  printDeps(depends_on);
-}
-
-function cmdBlocked(feature?: string): void {
-  const features = feature ? [feature] : getFeatureDirs();
-
-  console.log('\n=== Blocked Tasks ===\n');
-
-  for (const f of features) {
-    const subtasks = loadSubtasks(f);
-    const completedSeqs = new Set(subtasks.filter(s => s.status === 'completed').map(s => s.seq));
-
-    const blocked = subtasks.filter(s => {
-      if (s.status === 'blocked') return true;
-      if (s.status !== 'pending') return false;
-      return !(s.depends_on || []).every(dep => completedSeqs.has(dep));
-    });
-
-    if (blocked.length > 0) {
-      console.log(`[${f}]`);
-      for (const s of blocked) {
-        const waitingFor = (s.depends_on || []).filter(dep => !completedSeqs.has(dep));
-        const reason = s.status === 'blocked'
-          ? 'explicitly blocked'
-          : `waiting: ${waitingFor.join(', ')}`;
-        console.log(`  ${s.seq} - ${s.title} (${reason})`);
-      }
-      console.log();
-    }
-  }
-}
-
-function cmdComplete(feature: string, seq: string, summary: string): void {
-  if (summary.length > 200) {
-    console.log('Error: Summary must be max 200 characters');
-    process.exit(1);
-  }
-
-  const subtasks = loadSubtasks(feature);
-  const subtask = subtasks.find(s => s.seq === seq);
-
-  if (!subtask) {
-    console.log(`Task ${seq} not found in ${feature}`);
-    process.exit(1);
-    return; // TypeScript guard
-  }
-
-  subtask.status = 'completed';
-  subtask.completed_at = new Date().toISOString();
-  subtask.completion_summary = summary;
-
-  saveSubtask(feature, subtask);
-
-  // Update task.json counts
-  const task = loadTask(feature);
-  if (task) {
-    const newSubtasks = loadSubtasks(feature);
-    task.completed_count = newSubtasks.filter(s => s.status === 'completed').length;
-    saveTask(feature, task);
-  }
-
-  console.log(`\n✓ Marked ${feature}/${seq} as completed`);
-  console.log(`  Summary: ${summary}`);
-
-  if (task) {
-    console.log(`  Progress: ${task.completed_count}/${task.subtask_count}`);
-  }
-}
-
-function cmdValidate(feature?: string): void {
-  const features = feature ? [feature] : getFeatureDirs();
-  let hasErrors = false;
-
-  console.log('\n=== Validation Results ===\n');
-
-  for (const f of features) {
-    const errors: string[] = [];
-    const warnings: string[] = [];
-
-    // Check task.json exists
-    const task = loadTask(f);
-    if (!task) {
-      errors.push('Missing task.json');
-    }
-
-    // Load and validate subtasks
-    const subtasks = loadSubtasks(f);
-    const seqs = new Set(subtasks.map(s => s.seq));
-
-    for (const s of subtasks) {
-      // Check ID format
-      if (!s.id.startsWith(f)) {
-        errors.push(`${s.seq}: ID should start with feature name`);
-      }
-
-      // Check for missing dependencies
-      for (const dep of (s.depends_on || [])) {
-        if (!seqs.has(dep)) {
-          errors.push(`${s.seq}: depends on non-existent task ${dep}`);
-        }
-      }
-
-      // Check for circular dependencies
-      const visited = new Set<string>();
-      const checkCircular = (seq: string, path: string[]): boolean => {
-        if (path.includes(seq)) {
-          errors.push(`${s.seq}: circular dependency detected: ${[...path, seq].join(' -> ')}`);
-          return true;
-        }
-        if (visited.has(seq)) return false;
-        visited.add(seq);
-
-        const task = subtasks.find(t => t.seq === seq);
-        if (task) {
-          for (const dep of (task.depends_on || [])) {
-            if (checkCircular(dep, [...path, seq])) return true;
-          }
-        }
-        return false;
-      };
-      checkCircular(s.seq, []);
-
-      // Validate enhanced fields
-      if (s.contracts) {
-        for (const contract of s.contracts) {
-          if (!['api', 'interface', 'event', 'schema'].includes(contract.type)) {
-            errors.push(`${s.seq}: invalid contract type "${contract.type}"`);
-          }
-          if (!['draft', 'defined', 'implemented', 'verified'].includes(contract.status)) {
-            errors.push(`${s.seq}: invalid contract status "${contract.status}"`);
-          }
-        }
-      }
-
-      if (s.design_components) {
-        for (const comp of s.design_components) {
-          if (!['figma', 'wireframe', 'mockup', 'prototype', 'sketch'].includes(comp.type)) {
-            errors.push(`${s.seq}: invalid design component type "${comp.type}"`);
-          }
-        }
-      }
-
-      // Validate line-number format in context_files
-      if (s.context_files) {
-        for (const ref of s.context_files) {
-          if (typeof ref !== 'string' && ref.lines) {
-            const lineValidation = validateLineNumberFormat(ref.lines);
-            if (!lineValidation.valid) {
-              for (const error of lineValidation.errors) {
-                errors.push(`${s.seq}: context_files line format error: ${error}`);
-              }
-            }
-            if (lineValidation.warnings) {
-              for (const warning of lineValidation.warnings) {
-                warnings.push(`${s.seq}: context_files line format warning: ${warning}`);
-              }
-            }
-          }
-        }
-      }
-
-      // Validate line-number format in reference_files
-      if (s.reference_files) {
-        for (const ref of s.reference_files) {
-          if (typeof ref !== 'string' && ref.lines) {
-            const lineValidation = validateLineNumberFormat(ref.lines);
-            if (!lineValidation.valid) {
-              for (const error of lineValidation.errors) {
-                errors.push(`${s.seq}: reference_files line format error: ${error}`);
-              }
-            }
-            if (lineValidation.warnings) {
-              for (const warning of lineValidation.warnings) {
-                warnings.push(`${s.seq}: reference_files line format warning: ${warning}`);
-              }
-            }
-          }
-        }
-      }
-
-      // Warnings
-      if (!(s.acceptance_criteria || []).length) {
-        warnings.push(`${s.seq}: No acceptance criteria defined`);
-      }
-      if (!(s.deliverables || []).length) {
-        warnings.push(`${s.seq}: No deliverables defined`);
-      }
-    }
-
-    // Validate task-level enhanced fields
-    if (task) {
-      // Validate line-number format in task context_files
-      if (task.context_files) {
-        for (const ref of task.context_files) {
-          if (typeof ref !== 'string' && ref.lines) {
-            const lineValidation = validateLineNumberFormat(ref.lines);
-            if (!lineValidation.valid) {
-              for (const error of lineValidation.errors) {
-                errors.push(`task.json: context_files line format error: ${error}`);
-              }
-            }
-            if (lineValidation.warnings) {
-              for (const warning of lineValidation.warnings) {
-                warnings.push(`task.json: context_files line format warning: ${warning}`);
-              }
-            }
-          }
-        }
-      }
-
-      // Validate line-number format in task reference_files
-      if (task.reference_files) {
-        for (const ref of task.reference_files) {
-          if (typeof ref !== 'string' && ref.lines) {
-            const lineValidation = validateLineNumberFormat(ref.lines);
-            if (!lineValidation.valid) {
-              for (const error of lineValidation.errors) {
-                errors.push(`task.json: reference_files line format error: ${error}`);
-              }
-            }
-            if (lineValidation.warnings) {
-              for (const warning of lineValidation.warnings) {
-                warnings.push(`task.json: reference_files line format warning: ${warning}`);
-              }
-            }
-          }
-        }
-      }
-
-      if (task.rice_score) {
-        const r = task.rice_score;
-        if (r.reach <= 0) errors.push('RICE reach must be > 0');
-        if (r.impact < 0.25 || r.impact > 3) errors.push('RICE impact must be 0.25-3');
-        if (r.confidence < 0 || r.confidence > 100) errors.push('RICE confidence must be 0-100');
-        if (r.effort <= 0) errors.push('RICE effort must be > 0');
-      }
-
-      if (task.wsjf_score) {
-        const w = task.wsjf_score;
-        if (w.business_value < 1 || w.business_value > 10) errors.push('WSJF business_value must be 1-10');
-        if (w.time_criticality < 1 || w.time_criticality > 10) errors.push('WSJF time_criticality must be 1-10');
-        if (w.risk_reduction < 1 || w.risk_reduction > 10) errors.push('WSJF risk_reduction must be 1-10');
-        if (w.job_size < 1 || w.job_size > 10) errors.push('WSJF job_size must be 1-10');
-      }
-
-      if (task.contracts) {
-        for (const contract of task.contracts) {
-          if (!['api', 'interface', 'event', 'schema'].includes(contract.type)) {
-            errors.push(`task.json: invalid contract type "${contract.type}"`);
-          }
-          if (!['draft', 'defined', 'implemented', 'verified'].includes(contract.status)) {
-            errors.push(`task.json: invalid contract status "${contract.status}"`);
-          }
-        }
-      }
-
-      // Check counts match
-      if (task.subtask_count !== subtasks.length) {
-        errors.push(`task.json subtask_count (${task.subtask_count}) doesn't match actual count (${subtasks.length})`);
-      }
-    }
-
-    // Print results
-    console.log(`[${f}]`);
-    if (errors.length === 0 && warnings.length === 0) {
-      console.log('  ✓ All checks passed');
-    } else {
-      for (const e of errors) {
-        console.log(`  ✗ ERROR: ${e}`);
-        hasErrors = true;
-      }
-      for (const w of warnings) {
-        console.log(`  ⚠ WARNING: ${w}`);
-      }
-    }
-    console.log();
-  }
-
-  process.exit(hasErrors ? 1 : 0);
-}
-
-function cmdContext(feature?: string): void {
-  const features = feature ? [feature] : getFeatureDirs();
-
-  console.log('\n=== Bounded Context Breakdown ===\n');
-
-  for (const f of features) {
-    const task = loadTask(f);
-    const subtasks = loadSubtasks(f);
-
-    if (!task) continue;
-
-    console.log(`[${f}] ${task.name}`);
-    
-    if (task.bounded_context) {
-      console.log(`  Bounded Context: ${task.bounded_context}`);
-    }
-    if (task.module) {
-      console.log(`  Module: ${task.module}`);
-    }
-    if (task.vertical_slice) {
-      console.log(`  Vertical Slice: ${task.vertical_slice}`);
-    }
-
-    // Group subtasks by bounded context
-    const contextGroups = new Map<string, Subtask[]>();
-    for (const s of subtasks) {
-      const ctx = s.bounded_context || task.bounded_context || 'unspecified';
-      if (!contextGroups.has(ctx)) {
-        contextGroups.set(ctx, []);
-      }
-      contextGroups.get(ctx)!.push(s);
-    }
-
-    if (contextGroups.size > 1 || (contextGroups.size === 1 && !contextGroups.has('unspecified'))) {
-      console.log('\n  Subtasks by Context:');
-      for (const [ctx, tasks] of contextGroups) {
-        console.log(`    ${ctx}: ${tasks.length} tasks`);
-        for (const t of tasks) {
-          const status = t.status === 'completed' ? '✓' : t.status === 'in_progress' ? '~' : '○';
-          console.log(`      ${status} ${t.seq} - ${t.title}`);
-        }
-      }
-    }
-
-    console.log();
-  }
-}
-
-function cmdContracts(feature?: string): void {
-  const features = feature ? [feature] : getFeatureDirs();
-
-  console.log('\n=== Contract Dependencies ===\n');
-
-  for (const f of features) {
-    const task = loadTask(f);
-    const subtasks = loadSubtasks(f);
-
-    if (!task) continue;
-
-    const allContracts: Array<{source: string, contract: Contract}> = [];
-
-    // Collect task-level contracts
-    if (task.contracts) {
-      for (const c of task.contracts) {
-        allContracts.push({ source: 'task', contract: c });
-      }
-    }
-
-    // Collect subtask-level contracts
-    for (const s of subtasks) {
-      if (s.contracts) {
-        for (const c of s.contracts) {
-          allContracts.push({ source: `subtask ${s.seq}`, contract: c });
-        }
-      }
-    }
-
-    if (allContracts.length === 0) {
-      console.log(`[${f}] - No contracts defined`);
-      continue;
-    }
-
-    console.log(`[${f}] ${task.name}`);
-    console.log(`  Total Contracts: ${allContracts.length}\n`);
-
-    // Group by type
-    const byType = new Map<string, Array<{source: string, contract: Contract}>>();
-    for (const item of allContracts) {
-      if (!byType.has(item.contract.type)) {
-        byType.set(item.contract.type, []);
-      }
-      byType.get(item.contract.type)!.push(item);
-    }
-
-    for (const [type, items] of byType) {
-      console.log(`  ${type.toUpperCase()} Contracts (${items.length}):`);
-      for (const { source, contract } of items) {
-        const statusIcon = contract.status === 'verified' ? '✓' : 
-                          contract.status === 'implemented' ? '~' : 
-                          contract.status === 'defined' ? '○' : '◌';
-        console.log(`    ${statusIcon} ${contract.name} [${contract.status}] (${source})`);
-        if (contract.description) {
-          console.log(`       ${contract.description}`);
-        }
-        if (contract.path) {
-          console.log(`       Path: ${contract.path}`);
-        }
-      }
-      console.log();
-    }
-  }
-}
-
-// Main
-const [,, command, ...args] = process.argv;
-
-switch (command) {
-  case 'status':
-    cmdStatus(args[0]);
-    break;
-  case 'next':
-    cmdNext(args[0]);
-    break;
-  case 'parallel':
-    cmdParallel(args[0]);
-    break;
-  case 'deps':
-    if (args.length < 2) {
-      console.log('Usage: deps <feature> <seq>');
-      process.exit(1);
-    }
-    cmdDeps(args[0], args[1]);
-    break;
-  case 'blocked':
-    cmdBlocked(args[0]);
-    break;
-  case 'complete':
-    if (args.length < 3) {
-      console.log('Usage: complete <feature> <seq> "summary"');
-      process.exit(1);
-    }
-    cmdComplete(args[0], args[1], args.slice(2).join(' '));
-    break;
-  case 'validate':
-    cmdValidate(args[0]);
-    break;
-  case 'context':
-    cmdContext(args[0]);
-    break;
-  case 'contracts':
-    cmdContracts(args[0]);
-    break;
-  default:
-    console.log(`
-Task Management CLI
-
-Usage: npx ts-node task-cli.ts <command> [feature] [args...]
-
-Task files are stored in: .tmp/tasks/{feature-slug}/
-
-Commands:
-  status [feature]                  Show task status summary
-  next [feature]                    Show next eligible tasks (deps satisfied)
-  parallel [feature]                Show parallelizable tasks ready to run
-  deps <feature> <seq>              Show dependency tree for a task
-  blocked [feature]                 Show blocked tasks and why
-  complete <feature> <seq> "summary" Mark task completed with summary
-  validate [feature]                Validate JSON files and dependencies
-  context [feature]                 Show bounded context breakdown
-  contracts [feature]               Show contract dependencies
-
-Examples:
-  npx ts-node task-cli.ts status
-  npx ts-node task-cli.ts next my-feature
-  npx ts-node task-cli.ts complete my-feature 02 "Implemented auth module"
-  npx ts-node task-cli.ts context my-feature
-  npx ts-node task-cli.ts contracts my-feature
-`);
-}

+ 0 - 273
.opencode/skill/task-management/scripts/validators/line-number-validator.ts

@@ -1,273 +0,0 @@
-/**
- * Line-Number Precision Format Validator
- * 
- * Validates line-number format for context_files and reference_files in enhanced task schema.
- * 
- * Valid formats:
- * - Single range: "12-18"
- * - Multiple ranges: "12,15-20,25"
- * - Single line: "42"
- * - Complex: "1-10,25,30-50,100-120"
- * 
- * Invalid formats:
- * - Reversed ranges: "50-10"
- * - Invalid separators: "12:18" or "12..18"
- * - Non-numeric: "abc-def"
- * - Negative numbers: "-5-10"
- */
-
-export interface LineNumberValidationResult {
-  valid: boolean;
-  errors: string[];
-  warnings?: string[];
-  parsed?: ParsedLineRange[];
-}
-
-export interface ParsedLineRange {
-  start: number;
-  end: number;
-}
-
-/**
- * Validates line-number format string
- * 
- * @param lines - Line range string (e.g., "12-18" or "1-10,25,30-50")
- * @returns Validation result with errors and parsed ranges
- */
-export function validateLineNumberFormat(lines: string | undefined): LineNumberValidationResult {
-  const errors: string[] = [];
-  const warnings: string[] = [];
-
-  // Empty or undefined is valid (means read entire file)
-  if (!lines || lines.trim() === '') {
-    return { valid: true, errors: [], parsed: [] };
-  }
-
-  // Trim whitespace
-  const trimmed = lines.trim();
-
-  // Check for invalid characters (only digits, commas, hyphens, and spaces allowed)
-  // Spaces will be trimmed from segments later
-  const invalidCharsPattern = /[^0-9,\-\s]/;
-  if (invalidCharsPattern.test(trimmed)) {
-    errors.push(`Invalid characters in line range: "${trimmed}". Only digits, commas, and hyphens are allowed.`);
-    return { valid: false, errors, warnings };
-  }
-
-  // Check for leading/trailing commas or hyphens
-  if (trimmed.startsWith(',') || trimmed.endsWith(',')) {
-    errors.push(`Line range cannot start or end with a comma: "${trimmed}"`);
-  }
-  if (trimmed.startsWith('-') || trimmed.endsWith('-')) {
-    errors.push(`Line range cannot start or end with a hyphen: "${trimmed}"`);
-  }
-
-  // Check for consecutive commas or hyphens
-  if (trimmed.includes(',,')) {
-    errors.push(`Line range contains consecutive commas: "${trimmed}"`);
-  }
-  if (trimmed.includes('--')) {
-    errors.push(`Line range contains consecutive hyphens: "${trimmed}"`);
-  }
-
-  // Return early if basic format errors found
-  if (errors.length > 0) {
-    return { valid: false, errors, warnings };
-  }
-
-  // Parse and validate each range
-  const parsed: ParsedLineRange[] = [];
-  const segments = trimmed.split(',');
-
-  for (const segment of segments) {
-    const segmentTrimmed = segment.trim();
-
-    if (segmentTrimmed === '') {
-      errors.push(`Empty segment in line range: "${trimmed}"`);
-      continue;
-    }
-
-    // Check if it's a range (contains hyphen) or single line
-    if (segmentTrimmed.includes('-')) {
-      const parts = segmentTrimmed.split('-');
-
-      // Should have exactly 2 parts (start and end)
-      if (parts.length !== 2) {
-        errors.push(`Invalid range format: "${segmentTrimmed}". Expected format: "start-end"`);
-        continue;
-      }
-
-      const startStr = parts[0].trim();
-      const endStr = parts[1].trim();
-
-      // Check for empty parts
-      if (startStr === '' || endStr === '') {
-        errors.push(`Range has empty start or end: "${segmentTrimmed}"`);
-        continue;
-      }
-
-      // Parse numbers
-      const start = parseInt(startStr, 10);
-      const end = parseInt(endStr, 10);
-
-      // Validate numbers
-      if (isNaN(start) || isNaN(end)) {
-        errors.push(`Non-numeric values in range: "${segmentTrimmed}"`);
-        continue;
-      }
-
-      // Check for negative numbers
-      if (start < 1 || end < 1) {
-        errors.push(`Line numbers must be positive: "${segmentTrimmed}"`);
-        continue;
-      }
-
-      // Check for reversed range
-      if (start > end) {
-        errors.push(`Invalid range (start > end): "${segmentTrimmed}". Start must be less than or equal to end.`);
-        continue;
-      }
-
-      // Check for same start and end (should use single line format)
-      if (start === end) {
-        warnings.push(`Range "${segmentTrimmed}" has same start and end. Consider using single line format: "${start}"`);
-      }
-
-      parsed.push({ start, end });
-    } else {
-      // Single line number
-      const lineNum = parseInt(segmentTrimmed, 10);
-
-      if (isNaN(lineNum)) {
-        errors.push(`Non-numeric line number: "${segmentTrimmed}"`);
-        continue;
-      }
-
-      if (lineNum < 1) {
-        errors.push(`Line number must be positive: "${segmentTrimmed}"`);
-        continue;
-      }
-
-      parsed.push({ start: lineNum, end: lineNum });
-    }
-  }
-
-  // Check for overlapping ranges (warning only)
-  if (parsed.length > 1) {
-    const sortedRanges = [...parsed].sort((a, b) => a.start - b.start);
-    for (let i = 0; i < sortedRanges.length - 1; i++) {
-      const current = sortedRanges[i];
-      const next = sortedRanges[i + 1];
-
-      if (current.end >= next.start) {
-        warnings.push(
-          `Overlapping ranges detected: "${current.start}-${current.end}" and "${next.start}-${next.end}". ` +
-          `Consider merging into a single range.`
-        );
-      }
-    }
-  }
-
-  return {
-    valid: errors.length === 0,
-    errors,
-    warnings: warnings.length > 0 ? warnings : undefined,
-    parsed: errors.length === 0 ? parsed : undefined
-  };
-}
-
-/**
- * Parses line-number format string into array of ranges
- * 
- * @param lines - Line range string (e.g., "12-18" or "1-10,25,30-50")
- * @returns Array of parsed ranges or null if invalid
- */
-export function parseLineNumberFormat(lines: string | undefined): ParsedLineRange[] | null {
-  const result = validateLineNumberFormat(lines);
-  return result.valid ? (result.parsed || []) : null;
-}
-
-/**
- * Formats parsed ranges back into line-number string
- * 
- * @param ranges - Array of parsed ranges
- * @returns Formatted line-number string
- */
-export function formatLineNumberRanges(ranges: ParsedLineRange[]): string {
-  if (ranges.length === 0) {
-    return '';
-  }
-
-  return ranges
-    .map(range => {
-      if (range.start === range.end) {
-        return `${range.start}`;
-      }
-      return `${range.start}-${range.end}`;
-    })
-    .join(',');
-}
-
-/**
- * Checks if a specific line number is included in the ranges
- * 
- * @param lineNum - Line number to check
- * @param ranges - Array of parsed ranges
- * @returns True if line is included in any range
- */
-export function isLineInRanges(lineNum: number, ranges: ParsedLineRange[]): boolean {
-  return ranges.some(range => lineNum >= range.start && lineNum <= range.end);
-}
-
-/**
- * Extracts specified lines from file content
- * 
- * @param content - Full file content
- * @param lines - Line range string (e.g., "12-18" or "1-10,25,30-50")
- * @returns Extracted lines or null if invalid format
- */
-export function extractLines(content: string, lines: string | undefined): string | null {
-  // If no lines specified, return entire content
-  if (!lines || lines.trim() === '') {
-    return content;
-  }
-
-  // Validate and parse line ranges
-  const result = validateLineNumberFormat(lines);
-  if (!result.valid || !result.parsed) {
-    return null;
-  }
-
-  // Split content into lines
-  const contentLines = content.split('\n');
-  const extractedLines: string[] = [];
-
-  // Extract lines based on ranges
-  for (let i = 0; i < contentLines.length; i++) {
-    const lineNum = i + 1; // Line numbers are 1-based
-    if (isLineInRanges(lineNum, result.parsed)) {
-      extractedLines.push(contentLines[i]);
-    }
-  }
-
-  return extractedLines.join('\n');
-}
-
-/**
- * Validates line-number format and provides clear error messages
- * 
- * @param lines - Line range string to validate
- * @returns Human-readable validation message
- */
-export function getValidationMessage(lines: string | undefined): string {
-  const result = validateLineNumberFormat(lines);
-
-  if (result.valid) {
-    if (result.warnings && result.warnings.length > 0) {
-      return `Valid (with warnings):\n${result.warnings.map(w => `  - ${w}`).join('\n')}`;
-    }
-    return 'Valid';
-  }
-
-  return `Invalid:\n${result.errors.map(e => `  - ${e}`).join('\n')}`;
-}

+ 9 - 9
.opencode/skill/context/SKILL.md → .opencode/skills/context-manager/SKILL.md

@@ -38,49 +38,49 @@ I provide 8 powerful operations for managing context:
 
 ### 1. Discover Context
 ```bash
-bash .opencode/skill/context/router.sh discover authentication
+bash .opencode/skills/context-manager/router.sh discover authentication
 ```
 Finds all context files related to authentication patterns.
 
 ### 2. Fetch External Documentation
 ```bash
-bash .opencode/skill/context/router.sh fetch "Drizzle ORM" "modular schemas"
+bash .opencode/skills/context-manager/router.sh fetch "Drizzle ORM" "modular schemas"
 ```
 Retrieves live documentation from external libraries.
 
 ### 3. Harvest Context
 ```bash
-bash .opencode/skill/context/router.sh harvest ANALYSIS.md
+bash .opencode/skills/context-manager/router.sh harvest ANALYSIS.md
 ```
 Extracts key concepts from summary files into permanent context.
 
 ### 4. Extract Information
 ```bash
-bash .opencode/skill/context/router.sh extract code-quality.md "naming conventions"
+bash .opencode/skills/context-manager/router.sh extract code-quality.md "naming conventions"
 ```
 Pulls specific information from context files.
 
 ### 5. Compress Files
 ```bash
-bash .opencode/skill/context/router.sh compress .opencode/context/ 100KB
+bash .opencode/skills/context-manager/router.sh compress .opencode/context/ 100KB
 ```
 Reduces large context files to save space.
 
 ### 6. Organize Context
 ```bash
-bash .opencode/skill/context/router.sh organize .opencode/context/
+bash .opencode/skills/context-manager/router.sh organize .opencode/context/
 ```
 Restructures context by concern for better organization.
 
 ### 7. Cleanup Stale Files
 ```bash
-bash .opencode/skill/context/router.sh cleanup .tmp/ 7
+bash .opencode/skills/context-manager/router.sh cleanup .tmp/ 7
 ```
 Removes temporary or old files (older than 7 days).
 
 ### 8. Guided Workflow
 ```bash
-bash .opencode/skill/context/router.sh process "organize authentication context" .opencode/context/
+bash .opencode/skills/context-manager/router.sh process "organize authentication context" .opencode/context/
 ```
 Step-by-step guidance for complex context operations.
 
@@ -468,7 +468,7 @@ process [goal] [scope]
 ## File Structure
 
 ```
-.opencode/skill/context/
+.opencode/skills/context-manager/
 ├── SKILL.md                          # This file
 ├── router.sh                         # CLI router (entry point)
 ├── CONTEXT_SKILL_QUICK_START.md      # Quick start guide

+ 9 - 9
.opencode/skill/context/router.sh → .opencode/skills/context-manager/router.sh

@@ -46,7 +46,7 @@ FEATURES:
   ✓ Clean up stale files
   ✓ Guided workflows
 
-For detailed documentation, see: .opencode/skill/context/SKILL.md
+For detailed documentation, see: .opencode/skills/context-manager/SKILL.md
 HELP
 }
 
@@ -87,42 +87,42 @@ case "$OPERATION" in
     discover)
         echo "📍 DISCOVER: Finding context files..."
         echo "Target: $*"
-        echo "See .opencode/skill/context/SKILL.md for full documentation"
+        echo "See .opencode/skills/context-manager/SKILL.md for full documentation"
         ;;
     fetch)
         echo "📥 FETCH: Retrieving external documentation..."
         echo "Libraries: $*"
-        echo "See .opencode/skill/context/SKILL.md for full documentation"
+        echo "See .opencode/skills/context-manager/SKILL.md for full documentation"
         ;;
     harvest)
         echo "🌾 HARVEST: Extracting context from summaries..."
         echo "Source: $*"
-        echo "See .opencode/skill/context/SKILL.md for full documentation"
+        echo "See .opencode/skills/context-manager/SKILL.md for full documentation"
         ;;
     extract)
         echo "🔍 EXTRACT: Pulling key information..."
         echo "Target: $*"
-        echo "See .opencode/skill/context/SKILL.md for full documentation"
+        echo "See .opencode/skills/context-manager/SKILL.md for full documentation"
         ;;
     compress)
         echo "🗜️  COMPRESS: Reducing file sizes..."
         echo "Target: $*"
-        echo "See .opencode/skill/context/SKILL.md for full documentation"
+        echo "See .opencode/skills/context-manager/SKILL.md for full documentation"
         ;;
     organize)
         echo "📂 ORGANIZE: Restructuring context..."
         echo "Target: $*"
-        echo "See .opencode/skill/context/SKILL.md for full documentation"
+        echo "See .opencode/skills/context-manager/SKILL.md for full documentation"
         ;;
     cleanup)
         echo "🧹 CLEANUP: Removing stale files..."
         echo "Target: $*"
-        echo "See .opencode/skill/context/SKILL.md for full documentation"
+        echo "See .opencode/skills/context-manager/SKILL.md for full documentation"
         ;;
     process)
         echo "⚙️  PROCESS: Guided workflow..."
         echo "Goal: $*"
-        echo "See .opencode/skill/context/SKILL.md for full documentation"
+        echo "See .opencode/skills/context-manager/SKILL.md for full documentation"
         ;;
     *)
         echo "❌ Unknown operation: $OPERATION"

+ 3 - 3
.opencode/skill/context7/README.md → .opencode/skills/context7/README.md

@@ -38,7 +38,7 @@ curl -s "https://context7.com/api/v2/libs/search?libraryName=LIBRARY&query=TOPIC
 curl -s "https://context7.com/api/v2/context?libraryId=LIBRARY_ID&query=OPTIMIZED_QUERY&type=txt"
 ```
 
-See `SKILLS.MD` for detailed API documentation.
+See `SKILL.md` for detailed API documentation.
 
 ## Supported Libraries
 
@@ -76,7 +76,7 @@ User receives current, actionable docs
 
 ## Files
 
-- **`SKILLS.MD`** - Context7 API documentation and usage
+- **`SKILL.md`** - Context7 API documentation and usage
 - **`library-registry.md`** - Supported libraries, aliases, and query patterns
 - **`README.md`** - This file (overview and quick start)
 
@@ -98,5 +98,5 @@ To add a new library to the registry:
 
 ## Related
 
-- **ExternalScout**: `.opencode/agent/subagents/core/external-scout.md`
+- **ExternalScout**: `.opencode/agent/subagents/core/externalscout.md`
 - **ContextScout**: `.opencode/agent/subagents/core/contextscout.md`

+ 0 - 0
.opencode/skill/context7/SKILLS.MD → .opencode/skills/context7/SKILL.md


+ 0 - 0
.opencode/skill/context7/library-registry.md → .opencode/skills/context7/library-registry.md


+ 5 - 5
.opencode/skill/context7/navigation.md → .opencode/skills/context7/navigation.md

@@ -10,7 +10,7 @@
 context7/
 ├── navigation.md              # This file
 ├── README.md                  # Quick start and workflow
-├── SKILLS.MD                  # Context7 API documentation
+├── SKILL.md                  # Context7 API documentation
 └── library-registry.md        # Supported libraries and query patterns
 ```
 
@@ -21,7 +21,7 @@ context7/
 | Task | Path |
 |------|------|
 | **Quick start** | `README.md` |
-| **API reference** | `SKILLS.MD` |
+| **API reference** | `SKILL.md` |
 | **Supported libraries** | `library-registry.md` (lines 18-181) |
 | **Query patterns** | `library-registry.md` (lines 199-261) |
 | **Add new library** | `library-registry.md` (lines 264-279) |
@@ -33,7 +33,7 @@ context7/
 
 **Using Context7**:
 - Quick start → `README.md`
-- API details → `SKILLS.MD`
+- API details → `SKILL.md`
 
 **Adding Libraries**:
 - Template → `library-registry.md` (lines 272-279)
@@ -41,11 +41,11 @@ context7/
 
 **Integration**:
 - ContextScout workflow → `README.md` (lines 54-73)
-- ExternalScout subagent → `.opencode/agent/subagents/core/external-scout.md`
+- ExternalScout subagent → `.opencode/agent/subagents/core/externalscout.md`
 
 ---
 
 ## Related
 
-- **ExternalScout**: `.opencode/agent/subagents/core/external-scout.md`
+- **ExternalScout**: `.opencode/agent/subagents/core/externalscout.md`
 - **ContextScout**: `.opencode/agent/subagents/core/contextscout.md`

+ 3 - 3
.opencode/skill/smart-router-skill/SKILL.md → .opencode/skills/smart-router-skill/SKILL.md

@@ -38,7 +38,7 @@ This shows how skills can adapt behavior based on simple configuration changes!
 When you ask to use this skill, I'll present the character options and ask you to choose. Then I'll run:
 
 ```bash
-cd .opencode/skill/smart-router-skill
+cd .opencode/skills/smart-router-skill
 bash router.sh --character <your_choice>
 ```
 
@@ -60,7 +60,7 @@ Me: *runs bash router.sh --character yoda*
 
 Want to see different behavior? Edit the config file!
 
-**File:** `.opencode/skill/smart-router-skill/config/personality-config.json`
+**File:** `.opencode/skills/smart-router-skill/config/personality-config.json`
 
 ```json
 {
@@ -127,7 +127,7 @@ Want to see different behavior? Edit the config file!
 
 A bash script that loads a character personality and runs their themed workflow.
 
-**Location:** `.opencode/skill/smart-router-skill/router.sh`
+**Location:** `.opencode/skills/smart-router-skill/router.sh`
 
 ```bash
 # Basic usage

+ 0 - 0
.opencode/skill/smart-router-skill/config/personality-config.json → .opencode/skills/smart-router-skill/config/personality-config.json


+ 0 - 0
.opencode/skill/smart-router-skill/router.sh → .opencode/skills/smart-router-skill/router.sh


+ 0 - 0
.opencode/skill/smart-router-skill/scripts/sherlock-workflow.sh → .opencode/skills/smart-router-skill/scripts/sherlock-workflow.sh


+ 0 - 0
.opencode/skill/smart-router-skill/scripts/stark-workflow.sh → .opencode/skills/smart-router-skill/scripts/stark-workflow.sh


+ 0 - 0
.opencode/skill/smart-router-skill/scripts/yoda-workflow.sh → .opencode/skills/smart-router-skill/scripts/yoda-workflow.sh


+ 178 - 131
.opencode/skill/task-management/SKILL.md → .opencode/skills/task-management/SKILL.md

@@ -1,7 +1,7 @@
 ---
 name: task-management
-description: CLI for managing tasks, tracking progress, validating dependencies, and migrating schemas
-version: 2.0.0
+description: Task management CLI for tracking and managing feature subtasks with status, dependencies, and validation
+version: 1.0.0
 author: opencode
 type: skill
 category: development
@@ -15,75 +15,129 @@ tags:
 
 # Task Management Skill
 
-> **Purpose**: Track, manage, and validate feature implementations with atomic task breakdowns
+> **Purpose**: Track, manage, and validate feature implementations with atomic task breakdowns, dependency resolution, and progress monitoring.
+
+---
 
 ## What I Do
 
+I provide a command-line interface for managing task breakdowns created by the TaskManager subagent. I help you:
+
 - **Track progress** - See status of all features and their subtasks
 - **Find next tasks** - Show eligible tasks (dependencies satisfied)
 - **Identify blocked tasks** - See what's blocked and why
 - **Manage completion** - Mark subtasks as complete with summaries
 - **Validate integrity** - Check JSON files and dependency trees
-- **Show context** - Display bounded context breakdown
-- **Show contracts** - Display contract dependencies
-- **Migrate schemas** - Upgrade tasks to enhanced schema
 
-## Quick Start
+---
+
+## How to Use Me
+
+### Quick Start
 
 ```bash
 # Show all task statuses
-bash .opencode/skill/task-management/router.sh status
+bash .opencode/skills/task-management/router.sh status
 
 # Show next eligible tasks
-bash .opencode/skill/task-management/router.sh next
+bash .opencode/skills/task-management/router.sh next
+
+# Show blocked tasks
+bash .opencode/skills/task-management/router.sh blocked
 
 # Mark a task complete
-bash .opencode/skill/task-management/router.sh complete <feature> <seq> "summary"
+bash .opencode/skills/task-management/router.sh complete <feature> <seq> "summary"
 
 # Validate all tasks
-bash .opencode/skill/task-management/router.sh validate
-
-# Show bounded context breakdown
-bash .opencode/skill/task-management/router.sh context <feature>
-
-# Show contract dependencies
-bash .opencode/skill/task-management/router.sh contracts <feature>
-
-# Migrate to enhanced schema
-bash .opencode/skill/task-management/router.sh migrate <feature>
+bash .opencode/skills/task-management/router.sh validate
 ```
 
-## Command Reference
+### Command Reference
 
 | Command | Description |
 |---------|-------------|
-| `status [feature]` | Show task status summary |
+| `status [feature]` | Show task status summary for all features or specific one |
 | `next [feature]` | Show next eligible tasks (dependencies satisfied) |
 | `parallel [feature]` | Show parallelizable tasks ready to run |
 | `deps <feature> <seq>` | Show dependency tree for a specific subtask |
 | `blocked [feature]` | Show blocked tasks and why |
 | `complete <feature> <seq> "summary"` | Mark subtask complete with summary |
 | `validate [feature]` | Validate JSON files and dependencies |
-| `context [feature]` | Show bounded context breakdown |
-| `contracts [feature]` | Show contract dependencies |
-| `migrate <feature>` | Migrate to enhanced schema |
-| `migrate <feature> --dry-run` | Preview migration changes |
-| `migrate <feature> --lines-only` | Add only line-number precision |
 | `help` | Show help message |
 
+---
+
+## Examples
+
+### Check Overall Progress
+
+```bash
+$ bash .opencode/skills/task-management/router.sh status
+
+[my-feature] My Feature Implementation
+  Status: active | Progress: 45% (5/11)
+  Pending: 3 | In Progress: 2 | Completed: 5 | Blocked: 1
+```
+
+### Find What's Next
+
+```bash
+$ bash .opencode/skills/task-management/router.sh next
+
+=== Ready Tasks (deps satisfied) ===
+
+[my-feature]
+  06 - Implement API endpoint [sequential]
+  08 - Write unit tests [parallel]
+```
+
+### Mark Complete
+
+```bash
+$ bash .opencode/skills/task-management/router.sh complete my-feature 05 "Implemented authentication module"
+
+✓ Marked my-feature/05 as completed
+  Summary: Implemented authentication module
+  Progress: 6/11
+```
+
+### Check Dependencies
+
+```bash
+$ bash .opencode/skills/task-management/router.sh deps my-feature 07
+
+=== Dependency Tree: my-feature/07 ===
+
+07 - Write integration tests [pending]
+  ├── ✓ 05 - Implement authentication module [completed]
+  └── ○ 06 - Implement API endpoint [in_progress]
+```
+
+### Validate Everything
+
+```bash
+$ bash .opencode/skills/task-management/router.sh validate
+
+=== Validation Results ===
+
+[my-feature]
+  ✓ All checks passed
+```
+
+---
+
 ## Architecture
 
 ```
-.opencode/skill/task-management/
+.opencode/skills/task-management/
 ├── SKILL.md                          # This file
-├── router.sh                         # CLI router
+├── router.sh                         # CLI router (entry point)
 └── scripts/
-    ├── task-cli.ts                   # Task management CLI
-    ├── migrate-schema.ts             # Schema migration tool
-    └── validators/
-        └── line-number-validator.ts  # Line-number validation
+    └── task-cli.ts                   # Task management CLI implementation
 ```
 
+---
+
 ## Task File Structure
 
 Tasks are stored in `.tmp/tasks/` at the project root:
@@ -99,20 +153,66 @@ Tasks are stored in `.tmp/tasks/` at the project root:
     └── {feature-slug}/               # Completed tasks
 ```
 
-## File Locations
+### task.json Schema
+
+```json
+{
+  "id": "my-feature",
+  "name": "My Feature",
+  "status": "active",
+  "objective": "Implement X",
+  "context_files": ["docs/spec.md"],
+  "reference_files": ["src/existing.ts"],
+  "exit_criteria": ["Tests pass", "Code reviewed"],
+  "subtask_count": 5,
+  "completed_count": 2,
+  "created_at": "2026-01-11T10:00:00Z",
+  "completed_at": null
+}
+```
+
+### subtask_##.json Schema
+
+```json
+{
+  "id": "my-feature-05",
+  "seq": "05",
+  "title": "Implement authentication",
+  "status": "pending",
+  "depends_on": ["03", "04"],
+  "parallel": false,
+  "suggested_agent": "coder-agent",
+  "context_files": ["docs/auth.md"],
+  "reference_files": ["src/auth-old.ts"],
+  "acceptance_criteria": ["Login works", "JWT tokens valid"],
+  "deliverables": ["auth.ts", "auth.test.ts"],
+  "started_at": null,
+  "completed_at": null,
+  "completion_summary": null
+}
+```
 
-### Scripts
-- **Task CLI**: `.opencode/skill/task-management/scripts/task-cli.ts`
-- **Schema Migration**: `.opencode/skill/task-management/scripts/migrate-schema.ts`
-- **Line Validator**: `.opencode/skill/task-management/scripts/validators/line-number-validator.ts`
+---
 
-### Runtime Files
-- **Tasks**: `.tmp/tasks/{feature}/`
-- **Completed**: `.tmp/tasks/completed/{feature}/`
+## Integration with TaskManager
 
-### Documentation
-- **Enhanced Schema**: `.opencode/context/core/task-management/standards/enhanced-task-schema.md`
-- **Migration Guide**: `.opencode/docs/guides/task-schema-migration.md`
+The TaskManager subagent creates task files using this format. When you delegate to TaskManager:
+
+```javascript
+task(
+  subagent_type="TaskManager",
+  description="Implement feature X",
+  prompt="Break down this feature into atomic subtasks..."
+)
+```
+
+TaskManager creates:
+1. `.tmp/tasks/{feature}/task.json` - Feature metadata
+2. `.tmp/tasks/{feature}/subtask_XX.json` - Individual subtasks
+
+You can then use this skill to track and manage progress.
+
+---
 
 ## Key Concepts
 
@@ -158,58 +258,14 @@ The `validate` command performs comprehensive checks on task files:
 
 Run `validate` regularly to catch issues early:
 ```bash
-bash .opencode/skill/task-management/router.sh validate my-feature
+bash .opencode/skills/task-management/router.sh validate my-feature
 ```
 
 ### 6. Context and Reference Files
+- **context_files** - Standards, conventions, and guidelines to follow
+- **reference_files** - Existing project files to look at or build upon
 
-**context_files** - Standards, conventions, and guidelines to follow
-**reference_files** - Existing project files to look at or build upon
-
-Both support two formats:
-
-**String format** (legacy, still supported):
-```json
-"context_files": ["docs/standards.md"]
-```
-
-**Object format** (with line-number precision):
-```json
-"context_files": [
-  {
-    "path": "docs/standards.md",
-    "lines": "10-50",
-    "reason": "Pure function patterns"
-  }
-]
-```
-
-The object format reduces cognitive load by pointing to exact sections instead of entire files.
-
-## Integration with TaskManager
-
-The TaskManager subagent creates task files using this format. When you delegate to TaskManager:
-
-```javascript
-task(
-  subagent_type="TaskManager",
-  description="Implement feature X",
-  prompt="Break down this feature into atomic subtasks..."
-)
-```
-
-TaskManager creates:
-1. `.tmp/tasks/{feature}/task.json` - Feature metadata
-2. `.tmp/tasks/{feature}/subtask_XX.json` - Individual subtasks
-
-TaskManager now supports enhanced schema generation with:
-- **Line-number precision** for large context files
-- **Domain modeling** fields (bounded_context, module, vertical_slice)
-- **Contract tracking** for API dependencies
-- **ADR references** for architectural decisions
-- **Prioritization scores** (RICE, WSJF)
-
-You can then use this skill to track and manage progress.
+---
 
 ## Workflow Integration
 
@@ -227,6 +283,8 @@ Working agents (CoderAgent, TestEngineer, etc.) execute subtasks and report comp
 - Check what's blocking progress with `blocked`
 - Validate task definitions with `validate`
 
+---
+
 ## Common Workflows
 
 ### Starting a New Feature
@@ -236,7 +294,7 @@ Working agents (CoderAgent, TestEngineer, etc.) execute subtasks and report comp
 task(subagent_type="TaskManager", description="Implement feature X", ...)
 
 # 2. Check what's ready
-bash .opencode/skill/task-management/router.sh next
+bash .opencode/skills/task-management/router.sh next
 
 # 3. Delegate first task to working agent
 task(subagent_type="CoderAgent", description="Implement subtask 01", ...)
@@ -246,38 +304,40 @@ task(subagent_type="CoderAgent", description="Implement subtask 01", ...)
 
 ```bash
 # Check overall status
-bash .opencode/skill/task-management/router.sh status my-feature
+bash .opencode/skills/task-management/router.sh status my-feature
 
 # See what's next
-bash .opencode/skill/task-management/router.sh next my-feature
+bash .opencode/skills/task-management/router.sh next my-feature
 
 # Check what's blocked
-bash .opencode/skill/task-management/router.sh blocked my-feature
+bash .opencode/skills/task-management/router.sh blocked my-feature
 ```
 
 ### Completing Tasks
 
 ```bash
 # After working agent finishes
-bash .opencode/skill/task-management/router.sh complete my-feature 05 "Implemented auth module with JWT support"
+bash .opencode/skills/task-management/router.sh complete my-feature 05 "Implemented auth module with JWT support"
 
 # Check progress
-bash .opencode/skill/task-management/router.sh status my-feature
+bash .opencode/skills/task-management/router.sh status my-feature
 
 # Find next task
-bash .opencode/skill/task-management/router.sh next my-feature
+bash .opencode/skills/task-management/router.sh next my-feature
 ```
 
 ### Validating Everything
 
 ```bash
 # Validate all tasks
-bash .opencode/skill/task-management/router.sh validate
+bash .opencode/skills/task-management/router.sh validate
 
 # Validate specific feature
-bash .opencode/skill/task-management/router.sh validate my-feature
+bash .opencode/skills/task-management/router.sh validate my-feature
 ```
 
+---
+
 ## Tips & Best Practices
 
 ### 1. Use Meaningful Summaries
@@ -293,44 +353,22 @@ complete my-feature 05 "Done"
 ### 2. Check Dependencies Before Starting
 ```bash
 # See what a task depends on
-bash .opencode/skill/task-management/router.sh deps my-feature 07
+bash .opencode/skills/task-management/router.sh deps my-feature 07
 ```
 
 ### 3. Identify Parallelizable Work
 ```bash
 # Find tasks that can run in parallel
-bash .opencode/skill/task-management/router.sh parallel my-feature
+bash .opencode/skills/task-management/router.sh parallel my-feature
 ```
 
 ### 4. Regular Validation
 ```bash
 # Validate regularly to catch issues early
-bash .opencode/skill/task-management/router.sh validate
+bash .opencode/skills/task-management/router.sh validate
 ```
 
-### 5. Use Line-Number Precision for Large Files
-When creating tasks with large context files, use line-number precision:
-```json
-{
-  "path": ".opencode/context/core/standards/code-quality.md",
-  "lines": "53-95",
-  "reason": "Pure function and immutability patterns"
-}
-```
-
-This helps agents focus on relevant sections instead of reading entire documents.
-
-### 6. Track Contracts for API Dependencies
-Use the `contracts` command to see API/interface dependencies:
-```bash
-bash .opencode/skill/task-management/router.sh contracts my-feature
-```
-
-### 7. View Domain Organization
-Use the `context` command to see bounded context breakdown:
-```bash
-bash .opencode/skill/task-management/router.sh context my-feature
-```
+---
 
 ## Troubleshooting
 
@@ -346,7 +384,16 @@ Check the dependency tree with `deps` to see what's blocking the task.
 ### "Validation failed"
 Run `validate` to see specific issues, then check the JSON files in `.tmp/tasks/`.
 
-## See Also
-- Project Orchestration: `.opencode/skill/project-orchestration/SKILL.md`
-- Planning Agents: `.opencode/docs/agents/planning-agents-guide.md`
-- Task Schema: `.opencode/context/core/task-management/standards/enhanced-task-schema.md`
+---
+
+## File Locations
+
+- **Skill**: `.opencode/skills/task-management/`
+- **Router**: `.opencode/skills/task-management/router.sh`
+- **CLI**: `.opencode/skills/task-management/scripts/task-cli.ts`
+- **Tasks**: `.tmp/tasks/` (created by TaskManager)
+- **Documentation**: `.opencode/skills/task-management/SKILL.md` (this file)
+
+---
+
+**Task Management Skill** - Track, manage, and validate your feature implementations!

+ 1 - 1
.opencode/skill/task-management/router.sh → .opencode/skills/task-management/router.sh

@@ -57,7 +57,7 @@ FEATURES:
   ✓ Show contract dependencies
   ✓ Migrate to enhanced schema
 
-For more info, see: .opencode/skill/task-management/SKILL.md
+For more info, see: .opencode/skills/task-management/SKILL.md
 HELP
 }
 

+ 553 - 0
.opencode/skills/task-management/scripts/task-cli.ts

@@ -0,0 +1,553 @@
+#!/usr/bin/env npx ts-node
+/**
+ * Task Management CLI
+ *
+ * Usage: npx ts-node task-cli.ts <command> [feature] [args...]
+ *
+ * Commands:
+ *   status [feature]              - Show task status summary
+ *   next [feature]                - Show next eligible tasks
+ *   parallel [feature]            - Show parallelizable tasks ready to run
+ *   deps <feature> <seq>          - Show dependency tree for a task
+ *   blocked [feature]             - Show blocked tasks and why
+ *   complete <feature> <seq> "summary" - Mark task completed
+ *   validate [feature]            - Validate JSON files and dependencies
+ *
+ * Task files are stored in .tmp/tasks/ at the project root:
+ *   .tmp/tasks/{feature-slug}/task.json
+ *   .tmp/tasks/{feature-slug}/subtask_01.json
+ *   .tmp/tasks/completed/{feature-slug}/
+ */
+
+const fs = require('fs');
+const path = require('path');
+
+// Find project root (look for .git or package.json)
+function findProjectRoot(): string {
+  let dir = process.cwd();
+  while (dir !== path.dirname(dir)) {
+    if (fs.existsSync(path.join(dir, '.git')) || fs.existsSync(path.join(dir, 'package.json'))) {
+      return dir;
+    }
+    dir = path.dirname(dir);
+  }
+  return process.cwd();
+}
+
+const PROJECT_ROOT = findProjectRoot();
+const TASKS_DIR = path.join(PROJECT_ROOT, '.tmp', 'tasks');
+const COMPLETED_DIR = path.join(TASKS_DIR, 'completed');
+
+interface Task {
+  id: string;
+  name: string;
+  status: 'active' | 'completed' | 'blocked' | 'archived';
+  objective: string;
+  context_files: string[];
+  reference_files?: string[];
+  exit_criteria: string[];
+  subtask_count: number;
+  completed_count: number;
+  created_at: string;
+  completed_at: string | null;
+}
+
+interface Subtask {
+  id: string;
+  seq: string;
+  title: string;
+  status: 'pending' | 'in_progress' | 'completed' | 'blocked';
+  depends_on: string[];
+  parallel: boolean;
+  context_files: string[];
+  reference_files?: string[];
+  acceptance_criteria: string[];
+  deliverables: string[];
+  agent_id: string | null;
+  suggested_agent?: string;
+  started_at: string | null;
+  completed_at: string | null;
+  completion_summary: string | null;
+}
+
+// Helpers
+function getFeatureDirs(): string[] {
+  if (!fs.existsSync(TASKS_DIR)) return [];
+  return fs.readdirSync(TASKS_DIR).filter((f: string) => {
+    const fullPath = path.join(TASKS_DIR, f);
+    return fs.statSync(fullPath).isDirectory() && f !== 'completed';
+  });
+}
+
+function loadTask(feature: string): Task | null {
+  const taskPath = path.join(TASKS_DIR, feature, 'task.json');
+  if (!fs.existsSync(taskPath)) return null;
+  return JSON.parse(fs.readFileSync(taskPath, 'utf-8'));
+}
+
+function loadSubtasks(feature: string): Subtask[] {
+  const featureDir = path.join(TASKS_DIR, feature);
+  if (!fs.existsSync(featureDir)) return [];
+
+  const files = fs.readdirSync(featureDir)
+    .filter((f: string) => f.match(/^subtask_\d{2}\.json$/))
+    .sort();
+
+  return files.map((f: string) => JSON.parse(fs.readFileSync(path.join(featureDir, f), 'utf-8')));
+}
+
+function saveSubtask(feature: string, subtask: Subtask): void {
+  const subtaskPath = path.join(TASKS_DIR, feature, `subtask_${subtask.seq}.json`);
+  fs.writeFileSync(subtaskPath, JSON.stringify(subtask, null, 2));
+}
+
+function saveTask(feature: string, task: Task): void {
+  const taskPath = path.join(TASKS_DIR, feature, 'task.json');
+  fs.writeFileSync(taskPath, JSON.stringify(task, null, 2));
+}
+
+// Commands
+function cmdStatus(feature?: string): void {
+  const features = feature ? [feature] : getFeatureDirs();
+
+  if (features.length === 0) {
+    console.log('No active features found.');
+    return;
+  }
+
+  for (const f of features) {
+    const task = loadTask(f);
+    const subtasks = loadSubtasks(f);
+
+    if (!task) {
+      console.log(`\n[${f}] - No task.json found`);
+      continue;
+    }
+
+    const counts = {
+      pending: subtasks.filter(s => s.status === 'pending').length,
+      in_progress: subtasks.filter(s => s.status === 'in_progress').length,
+      completed: subtasks.filter(s => s.status === 'completed').length,
+      blocked: subtasks.filter(s => s.status === 'blocked').length,
+    };
+
+    const progress = subtasks.length > 0
+      ? Math.round((counts.completed / subtasks.length) * 100)
+      : 0;
+
+    console.log(`\n[${f}] ${task.name}`);
+    console.log(`  Status: ${task.status} | Progress: ${progress}% (${counts.completed}/${subtasks.length})`);
+    console.log(`  Pending: ${counts.pending} | In Progress: ${counts.in_progress} | Completed: ${counts.completed} | Blocked: ${counts.blocked}`);
+  }
+}
+
+function cmdNext(feature?: string): void {
+  const features = feature ? [feature] : getFeatureDirs();
+
+  console.log('\n=== Ready Tasks (deps satisfied) ===\n');
+
+  for (const f of features) {
+    const subtasks = loadSubtasks(f);
+    const completedSeqs = new Set(subtasks.filter(s => s.status === 'completed').map(s => s.seq));
+
+    const ready = subtasks.filter(s => {
+      if (s.status !== 'pending') return false;
+      return s.depends_on.every(dep => completedSeqs.has(dep));
+    });
+
+    if (ready.length > 0) {
+      console.log(`[${f}]`);
+      for (const s of ready) {
+        const parallel = s.parallel ? '[parallel]' : '[sequential]';
+        console.log(`  ${s.seq} - ${s.title}  ${parallel}`);
+      }
+      console.log();
+    }
+  }
+}
+
+function cmdParallel(feature?: string): void {
+  const features = feature ? [feature] : getFeatureDirs();
+
+  console.log('\n=== Parallelizable Tasks Ready Now ===\n');
+
+  for (const f of features) {
+    const subtasks = loadSubtasks(f);
+    const completedSeqs = new Set(subtasks.filter(s => s.status === 'completed').map(s => s.seq));
+
+    const parallel = subtasks.filter(s => {
+      if (s.status !== 'pending') return false;
+      if (!s.parallel) return false;
+      return s.depends_on.every(dep => completedSeqs.has(dep));
+    });
+
+    if (parallel.length > 0) {
+      console.log(`[${f}] - ${parallel.length} parallel tasks:`);
+      for (const s of parallel) {
+        console.log(`  ${s.seq} - ${s.title}`);
+      }
+      console.log();
+    }
+  }
+}
+
+function cmdDeps(feature: string, seq: string): void {
+  const subtasks = loadSubtasks(feature);
+  const target = subtasks.find(s => s.seq === seq);
+
+  if (!target) {
+    console.log(`Task ${seq} not found in ${feature}`);
+    return;
+  }
+
+  console.log(`\n=== Dependency Tree: ${feature}/${seq} ===\n`);
+  console.log(`${seq} - ${target.title} [${target.status}]`);
+
+  if (target.depends_on.length === 0) {
+    console.log('  └── (no dependencies)');
+    return;
+  }
+
+  const printDeps = (seqs: string[], indent: string = '  '): void => {
+    for (let i = 0; i < seqs.length; i++) {
+      const depSeq = seqs[i];
+      const dep = subtasks.find(s => s.seq === depSeq);
+      const isLast = i === seqs.length - 1;
+      const branch = isLast ? '└──' : '├──';
+
+      if (dep) {
+        const statusIcon = dep.status === 'completed' ? '✓' : dep.status === 'in_progress' ? '~' : '○';
+        console.log(`${indent}${branch} ${statusIcon} ${depSeq} - ${dep.title} [${dep.status}]`);
+        if (dep.depends_on.length > 0) {
+          const newIndent = indent + (isLast ? '    ' : '│   ');
+          printDeps(dep.depends_on, newIndent);
+        }
+      } else {
+        console.log(`${indent}${branch} ? ${depSeq} - NOT FOUND`);
+      }
+    }
+  };
+
+  printDeps(target.depends_on);
+}
+
+function cmdBlocked(feature?: string): void {
+  const features = feature ? [feature] : getFeatureDirs();
+
+  console.log('\n=== Blocked Tasks ===\n');
+
+  for (const f of features) {
+    const subtasks = loadSubtasks(f);
+    const completedSeqs = new Set(subtasks.filter(s => s.status === 'completed').map(s => s.seq));
+
+    const blocked = subtasks.filter(s => {
+      if (s.status === 'blocked') return true;
+      if (s.status !== 'pending') return false;
+      return !s.depends_on.every(dep => completedSeqs.has(dep));
+    });
+
+    if (blocked.length > 0) {
+      console.log(`[${f}]`);
+      for (const s of blocked) {
+        const waitingFor = s.depends_on.filter(dep => !completedSeqs.has(dep));
+        const reason = s.status === 'blocked'
+          ? 'explicitly blocked'
+          : `waiting: ${waitingFor.join(', ')}`;
+        console.log(`  ${s.seq} - ${s.title} (${reason})`);
+      }
+      console.log();
+    }
+  }
+}
+
+function cmdComplete(feature: string, seq: string, summary: string): void {
+  if (summary.length > 200) {
+    console.log('Error: Summary must be max 200 characters');
+    process.exit(1);
+  }
+
+  const subtasks = loadSubtasks(feature);
+  const subtask = subtasks.find(s => s.seq === seq);
+
+  if (!subtask) {
+    console.log(`Task ${seq} not found in ${feature}`);
+    process.exit(1);
+  }
+
+  subtask.status = 'completed';
+  subtask.completed_at = new Date().toISOString();
+  subtask.completion_summary = summary;
+
+  saveSubtask(feature, subtask);
+
+  // Update task.json counts
+  const task = loadTask(feature);
+  if (task) {
+    const newSubtasks = loadSubtasks(feature);
+    task.completed_count = newSubtasks.filter(s => s.status === 'completed').length;
+    saveTask(feature, task);
+  }
+
+  console.log(`\n✓ Marked ${feature}/${seq} as completed`);
+  console.log(`  Summary: ${summary}`);
+
+  if (task) {
+    console.log(`  Progress: ${task.completed_count}/${task.subtask_count}`);
+  }
+}
+
+function cmdValidate(feature?: string): void {
+  const features = feature ? [feature] : getFeatureDirs();
+  let hasErrors = false;
+
+  const validTaskStatuses = new Set(['active', 'completed', 'blocked', 'archived']);
+  const validSubtaskStatuses = new Set(['pending', 'in_progress', 'completed', 'blocked']);
+
+  const requiredTaskFields = [
+    'id',
+    'name',
+    'status',
+    'objective',
+    'context_files',
+    'exit_criteria',
+    'subtask_count',
+    'completed_count',
+    'created_at',
+    'completed_at',
+  ];
+
+  const requiredSubtaskFields = [
+    'id',
+    'seq',
+    'title',
+    'status',
+    'depends_on',
+    'parallel',
+    'context_files',
+    'acceptance_criteria',
+    'deliverables',
+    'agent_id',
+    'started_at',
+    'completed_at',
+    'completion_summary',
+  ];
+
+  const hasField = (obj: any, field: string): boolean => Object.prototype.hasOwnProperty.call(obj, field);
+  const isStringArray = (value: any): boolean => Array.isArray(value) && value.every(v => typeof v === 'string');
+
+  console.log('\n=== Validation Results ===\n');
+
+  for (const f of features) {
+    const errors: string[] = [];
+
+    // Check task.json exists
+    const task = loadTask(f);
+    if (!task) {
+      errors.push('Missing task.json');
+    }
+
+    // Load and validate subtasks
+    const subtasks = loadSubtasks(f);
+    const seqCounts = new Map<string, number>();
+    for (const s of subtasks) {
+      const seq = typeof s.seq === 'string' ? s.seq : '';
+      seqCounts.set(seq, (seqCounts.get(seq) || 0) + 1);
+    }
+    const seqs = new Set(subtasks.map(s => s.seq));
+
+    if (task) {
+      // Required fields in task.json
+      for (const field of requiredTaskFields) {
+        if (!hasField(task, field)) {
+          errors.push(`task.json: missing required field '${field}'`);
+        }
+      }
+
+      // Task ID should match feature slug
+      if (task.id !== f) {
+        errors.push(`task.json id ('${task.id}') should match feature slug ('${f}')`);
+      }
+
+      // Task status should be valid
+      if (!validTaskStatuses.has(task.status)) {
+        errors.push(`task.json: invalid status '${task.status}'`);
+      }
+
+      // Basic type checks for key task fields
+      if (!isStringArray(task.context_files)) {
+        errors.push('task.json: context_files must be string[]');
+      }
+      if (hasField(task, 'reference_files') && task.reference_files !== undefined && !isStringArray(task.reference_files)) {
+        errors.push('task.json: reference_files must be string[] when present');
+      }
+      if (!isStringArray(task.exit_criteria)) {
+        errors.push('task.json: exit_criteria must be string[]');
+      }
+      if (typeof task.subtask_count !== 'number') {
+        errors.push('task.json: subtask_count must be number');
+      }
+      if (typeof task.completed_count !== 'number') {
+        errors.push('task.json: completed_count must be number');
+      }
+    }
+
+    for (const s of subtasks) {
+      // Required fields in subtask files
+      for (const field of requiredSubtaskFields) {
+        if (!hasField(s, field)) {
+          errors.push(`${s.seq || '??'}: missing required field '${field}'`);
+        }
+      }
+
+      // Sequence format and uniqueness
+      if (!/^\d{2}$/.test(s.seq)) {
+        errors.push(`${s.seq}: sequence must be 2 digits (e.g., 01, 02)`);
+      }
+      if ((seqCounts.get(s.seq) || 0) > 1) {
+        errors.push(`${s.seq}: duplicate sequence number`);
+      }
+
+      // Check ID format
+      if (!s.id.startsWith(f)) {
+        errors.push(`${s.seq}: ID should start with feature name`);
+      }
+
+      // Status should be valid
+      if (!validSubtaskStatuses.has(s.status)) {
+        errors.push(`${s.seq}: invalid status '${s.status}'`);
+      }
+
+      // Type checks
+      if (!isStringArray(s.depends_on)) {
+        errors.push(`${s.seq}: depends_on must be string[]`);
+      }
+      if (typeof s.parallel !== 'boolean') {
+        errors.push(`${s.seq}: parallel must be boolean`);
+      }
+      if (!isStringArray(s.context_files)) {
+        errors.push(`${s.seq}: context_files must be string[]`);
+      }
+      if (hasField(s, 'reference_files') && s.reference_files !== undefined && !isStringArray(s.reference_files)) {
+        errors.push(`${s.seq}: reference_files must be string[] when present`);
+      }
+      if (!isStringArray(s.acceptance_criteria)) {
+        errors.push(`${s.seq}: acceptance_criteria must be string[]`);
+      } else if (s.acceptance_criteria.length === 0) {
+        errors.push(`${s.seq}: No acceptance criteria defined`);
+      }
+      if (!isStringArray(s.deliverables)) {
+        errors.push(`${s.seq}: deliverables must be string[]`);
+      } else if (s.deliverables.length === 0) {
+        errors.push(`${s.seq}: No deliverables defined`);
+      }
+
+      // Self dependency is invalid
+      if (Array.isArray(s.depends_on) && s.depends_on.includes(s.seq)) {
+        errors.push(`${s.seq}: task cannot depend on itself`);
+      }
+
+      // Check for missing dependencies
+      for (const dep of (Array.isArray(s.depends_on) ? s.depends_on : [])) {
+        if (!seqs.has(dep)) {
+          errors.push(`${s.seq}: depends on non-existent task ${dep}`);
+        }
+      }
+
+      // Check for circular dependencies
+      const visited = new Set<string>();
+      const checkCircular = (seq: string, path: string[]): boolean => {
+        if (path.includes(seq)) {
+          errors.push(`${s.seq}: circular dependency detected: ${[...path, seq].join(' -> ')}`);
+          return true;
+        }
+        if (visited.has(seq)) return false;
+        visited.add(seq);
+
+        const task = subtasks.find(t => t.seq === seq);
+        if (task) {
+          for (const dep of task.depends_on) {
+            if (checkCircular(dep, [...path, seq])) return true;
+          }
+        }
+        return false;
+      };
+      checkCircular(s.seq, []);
+    }
+
+    // Check counts match
+    if (task && task.subtask_count !== subtasks.length) {
+      errors.push(`task.json subtask_count (${task.subtask_count}) doesn't match actual count (${subtasks.length})`);
+    }
+
+    // Print results
+    console.log(`[${f}]`);
+    if (errors.length === 0) {
+      console.log('  ✓ All checks passed');
+    } else {
+      for (const e of errors) {
+        console.log(`  ✗ ERROR: ${e}`);
+        hasErrors = true;
+      }
+    }
+    console.log();
+  }
+
+  process.exit(hasErrors ? 1 : 0);
+}
+
+// Main
+const [,, command, ...args] = process.argv;
+
+switch (command) {
+  case 'status':
+    cmdStatus(args[0]);
+    break;
+  case 'next':
+    cmdNext(args[0]);
+    break;
+  case 'parallel':
+    cmdParallel(args[0]);
+    break;
+  case 'deps':
+    if (args.length < 2) {
+      console.log('Usage: deps <feature> <seq>');
+      process.exit(1);
+    }
+    cmdDeps(args[0], args[1]);
+    break;
+  case 'blocked':
+    cmdBlocked(args[0]);
+    break;
+  case 'complete':
+    if (args.length < 3) {
+      console.log('Usage: complete <feature> <seq> "summary"');
+      process.exit(1);
+    }
+    cmdComplete(args[0], args[1], args.slice(2).join(' '));
+    break;
+  case 'validate':
+    cmdValidate(args[0]);
+    break;
+  default:
+    console.log(`
+Task Management CLI
+
+Usage: npx ts-node task-cli.ts <command> [feature] [args...]
+
+Task files are stored in: .tmp/tasks/{feature-slug}/
+
+Commands:
+  status [feature]                  Show task status summary
+  next [feature]                    Show next eligible tasks (deps satisfied)
+  parallel [feature]                Show parallelizable tasks ready to run
+  deps <feature> <seq>              Show dependency tree for a task
+  blocked [feature]                 Show blocked tasks and why
+  complete <feature> <seq> "summary" Mark task completed with summary
+  validate [feature]                Validate JSON files and dependencies
+
+Examples:
+  npx ts-node task-cli.ts status
+  npx ts-node task-cli.ts next my-feature
+  npx ts-node task-cli.ts complete my-feature 02 "Implemented auth module"
+`);
+}

+ 3 - 3
CHANGELOG.md

@@ -33,9 +33,9 @@ All notable changes to this project will be documented in this file.
   - Added to registry with `skill:context7` dependency
 
 - **Context7 Skill**: Registered in system for external documentation fetching
-  - Path: `.opencode/skill/context7/SKILLS.MD`
-  - Library registry: `.opencode/skill/context7/library-registry.md`
-  - Navigation guide: `.opencode/skill/context7/navigation.md`
+  - Path: `.opencode/skills/context7/SKILL.md`
+  - Library registry: `.opencode/skills/context7/library-registry.md`
+  - Navigation guide: `.opencode/skills/context7/navigation.md`
 
 ### Changed
 - **ContextScout v5.1.0**: Optimized with research-backed prompt engineering patterns

+ 12 - 12
install.sh

@@ -513,10 +513,10 @@ show_install_location_menu() {
     echo "     Examples:"
     case "$PLATFORM" in
         Windows)
-            echo "       ${CYAN}C:/Users/username/my-agents${NC} or ${CYAN}~/my-agents${NC}"
+            echo -e "       ${CYAN}C:/Users/username/my-agents${NC} or ${CYAN}~/my-agents${NC}"
             ;;
         *)
-            echo "       ${CYAN}/home/username/my-agents${NC} or ${CYAN}~/my-agents${NC}"
+            echo -e "       ${CYAN}/home/username/my-agents${NC} or ${CYAN}~/my-agents${NC}"
             ;;
     esac
     echo ""
@@ -952,7 +952,7 @@ show_collision_report() {
             tools+=("$file")
         elif [[ $file == *"/plugin/"* ]]; then
             plugins+=("$file")
-        elif [[ $file == *"/skill/"* ]]; then
+        elif [[ $file == *"/skills/"* ]]; then
             skills+=("$file")
         elif [[ $file == *"/context/"* ]]; then
             contexts+=("$file")
@@ -1235,12 +1235,12 @@ show_post_install() {
     # Check if env.example was installed
     if [ -f "${INSTALL_DIR}/env.example" ] || [ -f "env.example" ]; then
         echo "2. Copy env.example to .env and configure:"
-        echo "   ${CYAN}cp env.example .env${NC}"
+        echo -e "   ${CYAN}cp env.example .env${NC}"
         echo "3. Start using OpenCode agents:"
     else
         echo "2. Start using OpenCode agents:"
     fi
-    echo "   ${CYAN}opencode${NC}"
+    echo -e "   ${CYAN}opencode${NC}"
     echo ""
     
     # Show installation location info
@@ -1396,26 +1396,26 @@ main() {
                 echo ""
                 echo -e "${BOLD}Examples:${NC}"
                 echo ""
-                echo "  ${CYAN}# Interactive mode (choose location and components)${NC}"
+                echo -e "  ${CYAN}# Interactive mode (choose location and components)${NC}"
                 echo "  $0"
                 echo ""
-                echo "  ${CYAN}# Quick install with default location (.opencode/)${NC}"
+                echo -e "  ${CYAN}# Quick install with default location (.opencode/)${NC}"
                 echo "  $0 developer"
                 echo ""
-                echo "  ${CYAN}# Install to global location (Linux/macOS)${NC}"
+                echo -e "  ${CYAN}# Install to global location (Linux/macOS)${NC}"
                 echo "  $0 developer --install-dir ~/.config/opencode"
                 echo ""
-                echo "  ${CYAN}# Install to global location (Windows Git Bash)${NC}"
+                echo -e "  ${CYAN}# Install to global location (Windows Git Bash)${NC}"
                 echo "  $0 developer --install-dir ~/.config/opencode"
                 echo ""
-                echo "  ${CYAN}# Install to custom location${NC}"
+                echo -e "  ${CYAN}# Install to custom location${NC}"
                 echo "  $0 essential --install-dir ~/my-agents"
                 echo ""
-                echo "  ${CYAN}# Using environment variable${NC}"
+                echo -e "  ${CYAN}# Using environment variable${NC}"
                 echo "  export OPENCODE_INSTALL_DIR=~/.config/opencode"
                 echo "  $0 developer"
                 echo ""
-                echo "  ${CYAN}# Install from URL (non-interactive)${NC}"
+                echo -e "  ${CYAN}# Install from URL (non-interactive)${NC}"
                 echo "  curl -fsSL https://raw.githubusercontent.com/darrenhinde/OpenAgentsControl/main/install.sh | bash -s developer"
                 echo ""
                 echo -e "${BOLD}Platform Support:${NC}"

+ 2 - 1
package.json

@@ -16,7 +16,7 @@
     ".opencode/profiles/",
     ".opencode/prompts/",
     ".opencode/scripts/",
-    ".opencode/skill/",
+    ".opencode/skills/",
     ".opencode/tool/",
     ".opencode/config.json",
     ".opencode/opencode.json",
@@ -80,6 +80,7 @@
     "dev:test": "cd evals/framework && npm test",
     "dev:clean": "cd evals/framework && rm -rf dist node_modules && npm install",
     "validate:registry": "bun run scripts/registry/validate-registry.ts",
+    "validate:context-links": "bun run scripts/validation/validate-markdown-links.ts",
     "validate:registry:verbose": "bun run scripts/registry/validate-registry.ts -v",
     "validate:registry:fix": "bun run scripts/registry/validate-registry.ts -f"
   },

+ 3 - 3
packages/compatibility-layer/docs/migration-guides/claude-to-oac.md

@@ -148,7 +148,7 @@ You are a senior developer.
 | **Permissions** | Binary modes only | Granular per-path rules |
 | **Temperature** | Not supported | Full control (0.0-2.0) |
 | **Max steps** | Not supported | Configurable limit |
-| **Skills path** | `.claude/skills/` | `.opencode/skill/` |
+| **Skills path** | `.claude/skills/` | `.opencode/skills/` |
 
 ### 4. Feature Mapping
 
@@ -430,7 +430,7 @@ Features that don't fully translate between formats:
 | Max steps | Not supported | Configurable | Add limit after migration |
 | Granular permissions | Binary modes | Per-path rules | Expand after migration |
 | Permission mode `acceptEdits` | Supported | No direct equivalent | Use `permission: { edit: "allow" }` |
-| Skill directory structure | `.claude/skills/` | `.opencode/skill/` | Move and rename |
+| Skill directory structure | `.claude/skills/` | `.opencode/skills/` | Move and rename |
 | Agent directory | `.claude/agents/` | `.opencode/agent/` | Move and rename |
 
 ### 7. Validation
@@ -587,7 +587,7 @@ Valid events: `PreToolUse`, `PostToolUse`, `PermissionRequest`, `AgentStart`, `A
 .claude/skills/my-skill/SKILL.md
 
 # OAC location
-.opencode/skill/my-skill/SKILL.md
+.opencode/skills/my-skill/SKILL.md
 ```
 
 Update skill references in agent:

+ 22 - 22
registry.json

@@ -705,7 +705,7 @@
         "id": "task-management",
         "name": "Task Management",
         "type": "skill",
-        "path": ".opencode/skill/task-management/SKILL.md",
+        "path": ".opencode/skills/task-management/SKILL.md",
         "description": "Task management CLI for tracking and managing feature subtasks with status, dependencies, and validation",
         "tags": [
           "tasks",
@@ -715,16 +715,16 @@
         "dependencies": [],
         "category": "essential",
         "files": [
-          ".opencode/skill/task-management/SKILL.md",
-          ".opencode/skill/task-management/router.sh",
-          ".opencode/skill/task-management/scripts/task-cli.ts"
+          ".opencode/skills/task-management/SKILL.md",
+          ".opencode/skills/task-management/router.sh",
+          ".opencode/skills/task-management/scripts/task-cli.ts"
         ]
       },
       {
         "id": "smart-router-skill",
         "name": "Smart Router Skill",
         "type": "skill",
-        "path": ".opencode/skill/smart-router-skill/SKILL.md",
+        "path": ".opencode/skills/smart-router-skill/SKILL.md",
         "description": "Movie character personality skill with configurable missions and themed workflows",
         "tags": [
           "routing",
@@ -734,19 +734,19 @@
         "dependencies": [],
         "category": "specialized",
         "files": [
-          ".opencode/skill/smart-router-skill/SKILL.md",
-          ".opencode/skill/smart-router-skill/router.sh",
-          ".opencode/skill/smart-router-skill/config/personality-config.json",
-          ".opencode/skill/smart-router-skill/scripts/sherlock-workflow.sh",
-          ".opencode/skill/smart-router-skill/scripts/stark-workflow.sh",
-          ".opencode/skill/smart-router-skill/scripts/yoda-workflow.sh"
+          ".opencode/skills/smart-router-skill/SKILL.md",
+          ".opencode/skills/smart-router-skill/router.sh",
+          ".opencode/skills/smart-router-skill/config/personality-config.json",
+          ".opencode/skills/smart-router-skill/scripts/sherlock-workflow.sh",
+          ".opencode/skills/smart-router-skill/scripts/stark-workflow.sh",
+          ".opencode/skills/smart-router-skill/scripts/yoda-workflow.sh"
         ]
       },
       {
         "id": "context7",
         "name": "Context7",
         "type": "skill",
-        "path": ".opencode/skill/context7/SKILLS.MD",
+        "path": ".opencode/skills/context7/SKILL.md",
         "description": "Fetch live, version-specific documentation for external libraries and frameworks via Context7 API",
         "tags": [
           "documentation",
@@ -757,17 +757,17 @@
         "dependencies": [],
         "category": "essential",
         "files": [
-          ".opencode/skill/context7/SKILLS.MD",
-          ".opencode/skill/context7/README.md",
-          ".opencode/skill/context7/library-registry.md",
-          ".opencode/skill/context7/navigation.md"
+          ".opencode/skills/context7/SKILL.md",
+          ".opencode/skills/context7/README.md",
+          ".opencode/skills/context7/library-registry.md",
+          ".opencode/skills/context7/navigation.md"
         ]
       },
       {
-        "id": "context",
+        "id": "context-manager",
         "name": "Context Manager",
         "type": "skill",
-        "path": ".opencode/skill/context/SKILL.md",
+        "path": ".opencode/skills/context-manager/SKILL.md",
         "description": "Comprehensive context management with 8 operations: discover, fetch, harvest, extract, compress, organize, cleanup, and process. Integrates with ContextScout and ExternalScout with lazy loading and clear guidance.",
         "tags": [
           "context-management",
@@ -783,8 +783,8 @@
         ],
         "category": "essential",
         "files": [
-          ".opencode/skill/context/SKILL.md",
-          ".opencode/skill/context/router.sh"
+          ".opencode/skills/context-manager/SKILL.md",
+          ".opencode/skills/context-manager/router.sh"
         ]
       }
     ],
@@ -2066,7 +2066,7 @@
         "name": "Delegation Workflow Reference",
         "type": "context",
         "path": ".opencode/context/core/workflows/delegation.md",
-        "description": "Quick reference to delegation workflow (see task-delegation.md for full content)",
+        "description": "Quick reference to delegation workflow (see task-delegation-basics.md and related split files)",
         "tags": [
           "workflows",
           "delegation",
@@ -3365,4 +3365,4 @@
       }
     }
   }
-}
+}

+ 1 - 1
scripts/registry/validate-registry.ts

@@ -364,7 +364,7 @@ function scanDirectory(dir: string, registryPaths: Set<string>): void {
       if (relPath.endsWith('/plugin/agent-validator.ts')) continue;
       
       // Skip skill support files (only SKILL.md needs to be in registry, all other files are copied with the skill)
-      if (relPath.includes('/skill/') && !entry.name.match(/^SKILL\.md$/i)) continue;
+      if (relPath.includes('/skills/') && !entry.name.match(/^SKILL\.md$/i)) continue;
       
       // Check if in registry
       if (!registryPaths.has(relPath)) {

+ 5 - 5
scripts/tests/test-installer-files.sh

@@ -202,12 +202,12 @@ print_summary() {
     echo -e "${BOLD}Test Summary${NC}"
     echo -e "${BOLD}═══════════════════════════════════════════════════════════════${NC}"
     echo ""
-    echo "Total files tested:  ${CYAN}$((SUCCESS_COUNT + FAIL_COUNT))${NC}"
-    echo "Files accessible:    ${GREEN}${SUCCESS_COUNT}${NC}"
-    echo "Files NOT FOUND:     ${RED}${FAIL_COUNT}${NC}"
+    echo -e "Total files tested:  ${CYAN}$((SUCCESS_COUNT + FAIL_COUNT))${NC}"
+    echo -e "Files accessible:    ${GREEN}${SUCCESS_COUNT}${NC}"
+    echo -e "Files NOT FOUND:     ${RED}${FAIL_COUNT}${NC}"
     
     if [ ${#SKIPPED_FILES[@]} -gt 0 ]; then
-        echo "Skipped:             ${YELLOW}${#SKIPPED_FILES[@]}${NC}"
+        echo -e "Skipped:             ${YELLOW}${#SKIPPED_FILES[@]}${NC}"
     fi
     
     echo ""
@@ -223,7 +223,7 @@ print_summary() {
             echo "    URL: ${RAW_URL}/${path}"
         done
         echo ""
-        echo "${YELLOW}These files need to be:${NC}"
+        echo -e "${YELLOW}These files need to be:${NC}"
         echo "  1. Added to the repository, OR"
         echo "  2. Removed from registry.json"
         echo ""

+ 25 - 0
scripts/validation/markdown-link-skip-patterns.txt

@@ -0,0 +1,25 @@
+# Ignore placeholders and template rules.
+\{.*\}
+\*
+
+# Ignore common template path placeholders.
+literal:path/to/
+literal:another/file
+literal:optional/file
+literal:category/
+literal:/your-
+literal:/my-
+literal:/existing-
+literal:.opencode/command/build-context-system.md
+literal:.opencode/command/validate-repo.md
+
+# Ignore external and anchor links (also filtered in code, kept for clarity).
+^https?://
+^mailto:
+^#
+
+# Temporary legacy exclusions (to keep CI green while docs are migrated).
+^\.opencode/context/openagents-repo/.+?\.md$
+^\.opencode/command/prompt-engineering/.+?\.md$
+^\.opencode/agent/meta/.+?\.md$
+^\.opencode/command/openagents/.+?\.md$

+ 214 - 0
scripts/validation/validate-markdown-links.ts

@@ -0,0 +1,214 @@
+#!/usr/bin/env bun
+
+import { existsSync, readdirSync, readFileSync } from 'node:fs'
+import { dirname, join, normalize } from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
+const SKIP_RULES_FILE = join(REPO_ROOT, 'scripts', 'validation', 'markdown-link-skip-patterns.txt')
+const TARGET_DIRS = [
+  '.opencode/agent',
+  '.opencode/skills',
+  '.opencode/command',
+  '.opencode/context'
+]
+
+type MissingRef = {
+  source: string
+  line: number
+  target: string
+  resolved: string
+  kind: 'link' | 'path'
+}
+
+function escapeRegExp(value: string): string {
+  return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+}
+
+function parseRegexRule(rule: string): RegExp {
+  const trimmed = rule.trim()
+
+  if (trimmed.startsWith('/') && trimmed.length > 2) {
+    const lastSlash = trimmed.lastIndexOf('/')
+    if (lastSlash > 0) {
+      const pattern = trimmed.slice(1, lastSlash)
+      const flags = trimmed.slice(lastSlash + 1)
+      return new RegExp(pattern, flags)
+    }
+  }
+
+  return new RegExp(trimmed)
+}
+
+function loadSkipPatterns(): RegExp[] {
+  if (!existsSync(SKIP_RULES_FILE)) {
+    throw new Error(`Skip rules file not found: ${SKIP_RULES_FILE}`)
+  }
+
+  const lines = readFileSync(SKIP_RULES_FILE, 'utf-8').split('\n')
+  const patterns: RegExp[] = []
+
+  for (const line of lines) {
+    const rule = line.trim()
+    if (!rule || rule.startsWith('#')) continue
+
+    // Literal rule: literal:foo/bar
+    if (rule.startsWith('literal:')) {
+      const literal = rule.slice('literal:'.length).trim()
+      if (!literal) continue
+      patterns.push(new RegExp(escapeRegExp(literal)))
+      continue
+    }
+
+    patterns.push(parseRegexRule(rule))
+  }
+
+  return patterns
+}
+
+function shouldSkipFile(filePath: string, skipPatterns: RegExp[]): boolean {
+  const relPath = filePath.replace(`${REPO_ROOT}/`, '')
+  return skipPatterns.some((pattern) => pattern.test(relPath))
+}
+
+function walkMdFiles(dir: string, out: string[], skipPatterns: RegExp[]): void {
+  for (const entry of readdirSync(dir, { withFileTypes: true })) {
+    if (entry.name === '.git' || entry.name === 'node_modules' || entry.name === 'build') continue
+    const full = join(dir, entry.name)
+    if (entry.isDirectory()) {
+      walkMdFiles(full, out, skipPatterns)
+      continue
+    }
+    if (entry.isFile() && entry.name.toLowerCase().endsWith('.md')) {
+      if (!shouldSkipFile(full, skipPatterns)) {
+        out.push(full)
+      }
+    }
+  }
+}
+
+function lineFromIndex(content: string, index: number): number {
+  return content.slice(0, index).split('\n').length
+}
+
+function shouldSkip(rawTarget: string, skipPatterns: RegExp[]): boolean {
+  const value = rawTarget.trim()
+  if (!value) return true
+  if (value.startsWith('http://') || value.startsWith('https://')) return true
+  if (value.startsWith('mailto:') || value.startsWith('#')) return true
+  return skipPatterns.some((pattern) => pattern.test(value))
+}
+
+function cleanupTarget(rawTarget: string): string {
+  let target = rawTarget.trim()
+  if (!target) return target
+
+  if (target.startsWith('<') && target.endsWith('>')) {
+    target = target.slice(1, -1)
+  }
+
+  const firstSpace = target.indexOf(' ')
+  if (firstSpace >= 0) {
+    target = target.slice(0, firstSpace)
+  }
+
+  target = target.replace(/^@/, '')
+  target = target.split('#')[0]
+  target = target.split('?')[0]
+  return target
+}
+
+function resolveTarget(sourceFile: string, rawTarget: string): string {
+  const target = cleanupTarget(rawTarget)
+  if (target.startsWith('.opencode/')) return join(REPO_ROOT, target)
+  if (target.startsWith('/')) return join(REPO_ROOT, target.slice(1))
+  return join(dirname(sourceFile), target)
+}
+
+function collectMissingRefs(file: string, skipPatterns: RegExp[]): MissingRef[] {
+  const content = readFileSync(file, 'utf-8')
+  const rel = file.replace(`${REPO_ROOT}/`, '')
+  const missing: MissingRef[] = []
+
+  const linkRegex = /\[[^\]]*\]\(([^)]+)\)/g
+  for (const match of content.matchAll(linkRegex)) {
+    const rawTarget = match[1]
+    if (!rawTarget) continue
+    if (shouldSkip(rawTarget, skipPatterns)) continue
+
+    const cleaned = cleanupTarget(rawTarget)
+    if (!cleaned) continue
+    if (!cleaned.includes('.md') && !cleaned.startsWith('.opencode/')) continue
+
+    const resolved = normalize(resolveTarget(file, cleaned))
+    if (!existsSync(resolved)) {
+      missing.push({
+        source: rel,
+        line: lineFromIndex(content, match.index ?? 0),
+        target: rawTarget,
+        resolved: resolved.replace(`${REPO_ROOT}/`, ''),
+        kind: 'link',
+      })
+    }
+  }
+
+  const pathRegex = /@?(\.opencode\/[A-Za-z0-9_./-]+\.md)/g
+  for (const match of content.matchAll(pathRegex)) {
+    const rawTarget = match[1]
+    if (!rawTarget) continue
+    if (shouldSkip(rawTarget, skipPatterns)) continue
+
+    const cleaned = cleanupTarget(rawTarget)
+    const resolved = normalize(resolveTarget(file, cleaned))
+    if (!existsSync(resolved)) {
+      missing.push({
+        source: rel,
+        line: lineFromIndex(content, match.index ?? 0),
+        target: rawTarget,
+        resolved: resolved.replace(`${REPO_ROOT}/`, ''),
+        kind: 'path',
+      })
+    }
+  }
+
+  return missing
+}
+
+function dedupe(refs: MissingRef[]): MissingRef[] {
+  const seen = new Set<string>()
+  const out: MissingRef[] = []
+  for (const ref of refs) {
+    const key = `${ref.source}:${ref.line}:${ref.target}:${ref.kind}`
+    if (seen.has(key)) continue
+    seen.add(key)
+    out.push(ref)
+  }
+  return out
+}
+
+const skipPatterns = loadSkipPatterns()
+
+const files: string[] = []
+for (const dir of TARGET_DIRS) {
+  const absolute = join(REPO_ROOT, dir)
+  if (existsSync(absolute)) walkMdFiles(absolute, files, skipPatterns)
+}
+
+let missing: MissingRef[] = []
+for (const file of files) {
+  missing = missing.concat(collectMissingRefs(file, skipPatterns))
+}
+
+missing = dedupe(missing)
+
+if (missing.length === 0) {
+  console.log(`OK: validated ${files.length} markdown files, no broken internal references found.`)
+  process.exit(0)
+}
+
+console.log(`ERROR: found ${missing.length} broken internal markdown references:`)
+for (const ref of missing) {
+  console.log(`- ${ref.source}:${ref.line} [${ref.kind}] ${ref.target} -> ${ref.resolved}`)
+}
+
+process.exit(1)