فهرست منبع

Revert "chore: update agent workflows and task management (#86)"

This reverts commit 42161cdef4fbe10e69b9f5603c3a9315b1f3b87e.
darrenhinde 6 ماه پیش
والد
کامیت
56df73bf0e
64فایلهای تغییر یافته به همراه582 افزوده شده و 4476 حذف شده
  1. 74 19
      .opencode/agent/core/openagent.md
  2. 46 25
      .opencode/agent/core/opencoder.md
  3. 2 25
      .opencode/agent/development/codebase-agent.md
  4. 123 108
      .opencode/agent/meta/repo-manager.md
  5. 0 12
      .opencode/agent/meta/system-builder.md
  6. 0 61
      .opencode/agent/subagents/code/coder-agent.md
  7. 235 253
      .opencode/agent/subagents/core/task-manager.md
  8. 0 15
      .opencode/context/core/context-system.md
  9. 1 1
      .opencode/context/core/context-system/guides/creation.md
  10. 0 13
      .opencode/context/core/navigation.md
  11. 0 127
      .opencode/context/core/task-management/guides/managing-tasks.md
  12. 0 113
      .opencode/context/core/task-management/guides/splitting-tasks.md
  13. 0 168
      .opencode/context/core/task-management/lookup/task-commands.md
  14. 0 54
      .opencode/context/core/task-management/navigation.md
  15. 0 98
      .opencode/context/core/task-management/standards/task-schema.md
  16. 0 43
      .opencode/context/development/ai/mastra-ai/README.md
  17. 0 39
      .opencode/context/development/ai/mastra-ai/concepts/agents-tools.md
  18. 0 35
      .opencode/context/development/ai/mastra-ai/concepts/core.md
  19. 0 39
      .opencode/context/development/ai/mastra-ai/concepts/evaluations.md
  20. 0 36
      .opencode/context/development/ai/mastra-ai/concepts/storage.md
  21. 0 33
      .opencode/context/development/ai/mastra-ai/concepts/workflows.md
  22. 0 31
      .opencode/context/development/ai/mastra-ai/errors/mastra-errors.md
  23. 0 40
      .opencode/context/development/ai/mastra-ai/examples/workflow-example.md
  24. 0 35
      .opencode/context/development/ai/mastra-ai/guides/modular-building.md
  25. 0 33
      .opencode/context/development/ai/mastra-ai/guides/testing.md
  26. 0 38
      .opencode/context/development/ai/mastra-ai/guides/workflow-step-structure.md
  27. 0 39
      .opencode/context/development/ai/mastra-ai/lookup/mastra-config.md
  28. 0 33
      .opencode/context/development/ai/mastra-ai/navigation.md
  29. 0 29
      .opencode/context/development/ai/navigation.md
  30. 0 29
      .opencode/context/development/frameworks/navigation.md
  31. 0 33
      .opencode/context/development/frameworks/tanstack-start/navigation.md
  32. 0 10
      .opencode/context/development/navigation.md
  33. 0 1086
      .opencode/plugin/agent-validator.ts.disabled
  34. 10 10
      .opencode/plugin/docs/VALIDATOR_GUIDE.md
  35. 1 1
      .opencode/plugin/telegram-notify.ts
  36. 0 489
      .opencode/scripts/task-cli.ts
  37. 0 21
      LICENSE
  38. 4 6
      README.md
  39. 0 12
      dev/dashboard-project/main.js
  40. 0 7
      dev/dashboard-project/package.json
  41. 0 23
      dev/dashboard-project/period/core.js
  42. 0 11
      dev/dashboard-project/period/index.js
  43. 0 0
      dev/dashboard-project/period/tests/period.test.js
  44. 0 0
      dev/dashboard-project/shared/index.js
  45. 0 25
      dev/dashboard-project/shared/utils.js
  46. 0 19
      dev/dashboard-project/star-sign/core.js
  47. 0 11
      dev/dashboard-project/star-sign/index.js
  48. 0 0
      dev/dashboard-project/star-sign/tests/star-sign.test.js
  49. 0 18
      dev/dashboard-project/time/core.js
  50. 0 11
      dev/dashboard-project/time/index.js
  51. 0 0
      dev/dashboard-project/time/tests/time.test.js
  52. 0 26
      dev/dashboard-project/ui/core.js
  53. 0 23
      dev/dashboard-project/ui/index.js
  54. 0 0
      dev/dashboard-project/ui/tests/ui.test.js
  55. 0 757
      docs/features/abilities-system/PLAN.md
  56. 0 34
      evals/agents/core/openagent/tests/08-delegation/task-manager-delegation.yaml
  57. 1 1
      evals/agents/subagents/core/task-manager/config/config.yaml
  58. 18 32
      evals/agents/subagents/core/task-manager/tests/02-context-loading.yaml
  59. 17 28
      evals/agents/subagents/core/task-manager/tests/03-task-breakdown.yaml
  60. 12 31
      evals/agents/subagents/core/task-manager/tests/04-dependency-tracking.yaml
  61. 16 26
      evals/agents/subagents/core/task-manager/tests/05-file-creation.yaml
  62. 0 49
      evals/agents/subagents/core/task-manager/tests/06-missing-info.yaml
  63. 4 23
      evals/agents/subagents/core/task-manager/tests/smoke-test.yaml
  64. 18 29
      evals/results/latest.json

+ 74 - 19
.opencode/agent/core/openagent.md

@@ -13,6 +13,7 @@ temperature: 0.2
 # Dependencies
 dependencies:
   # Subagents for delegation
+  - subagent:task-manager
   - subagent:documentation
   - subagent:contextscout
   
@@ -45,6 +46,16 @@ permissions:
     "node_modules/**": "deny"
     ".git/**": "deny"
 
+# Prompt Metadata
+model_family: "claude"
+recommended_models:
+  - "anthropic/claude-sonnet-4-5"      # Primary recommendation
+  - "anthropic/claude-3-5-sonnet-20241022"  # Alternative
+tested_with: "anthropic/claude-sonnet-4-5"
+last_tested: "2025-12-01"
+maintainer: "darrenhinde"
+status: "stable"
+
 # Tags
 tags:
   - universal
@@ -118,6 +129,7 @@ CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effo
 
 **Core Subagents**:
 - `ContextScout` - Discover context files BEFORE executing (saves time, avoids rework!)
+- `TaskManager` - Break down complex features (4+ files, >60min)
 - `DocWriter` - Generate comprehensive documentation
 
 **Invocation syntax**:
@@ -181,20 +193,8 @@ task(
     <criteria>Needs bash/write/edit/task? → Task path | Purely info/read-only? → Conversational path</criteria>
   </stage>
 
-  <stage id="1.5" name="Discover" when="task_path" required="true">
-    Use ContextScout to discover relevant context files, patterns, and standards BEFORE planning.
-    
-    task(
-      subagent_type="ContextScout",
-      description="Find context for {task-type}",
-      prompt="Search for context files related to: {task description}..."
-    )
-    
-    <checkpoint>Context discovered</checkpoint>
-  </stage>
-
   <stage id="2" name="Approve" when="task_path" required="true" enforce="@approval_gate">
-    Present plan BASED ON discovered context→Request approval→Wait confirm
+    Present plan→Request approval→Wait confirm
     <format>## Proposed Plan\n[steps]\n\n**Approval needed before proceeding.**</format>
     <skip_only_if>Pure info question w/ zero exec</skip_only_if>
   </stage>
@@ -202,7 +202,42 @@ task(
   <stage id="3" name="Execute" when="approved">
     <prerequisites>User approval received (Stage 2 complete)</prerequisites>
     
-    <step id="3.0" name="LoadContext" required="true" enforce="@critical_context_requirement">
+    <step id="3.0" name="DiscoverContext" optional="true">
+      OPTIONAL: Use ContextScout to discover relevant context files intelligently
+      
+      When to use ContextScout:
+      - Unfamiliar with project structure or domain
+      - Need to find domain-specific patterns or standards
+      - Looking for examples, guides, or error solutions
+      - Want to ensure you have all relevant context before proceeding
+      
+      <delegation>
+        task(
+          subagent_type="ContextScout",
+          description="Find context for {task-type}",
+          prompt="Search for context files related to: {task description}
+                  
+                  Task type: {code/docs/tests/review/other}
+                  Domain: {if applicable}
+                  
+                  Return:
+                  - Exact file paths with line ranges
+                  - Priority order (critical, high, medium)
+                  - Key findings from each file
+                  - Loading strategy
+                  
+                  Focus on:
+                  - Standards (code/docs/tests)
+                  - Domain-specific patterns
+                  - Examples and guides
+                  - Common errors to avoid"
+        )
+      </delegation>
+      
+      <checkpoint>Context files discovered OR proceeding with known context</checkpoint>
+    </step>
+    
+    <step id="3.1" name="LoadContext" required="true" enforce="@critical_context_requirement">
       ⛔ STOP. Before executing, check task type:
       
       1. Classify task: docs|code|tests|delegate|review|patterns|bash-only
@@ -214,7 +249,7 @@ task(
          - delegate (using task tool) → Read .opencode/context/core/workflows/task-delegation.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.
+         NOTE: If ContextScout was used in step 3.0, also load discovered files in priority order
       
       3. Apply context:
          IF delegating: Tell subagent "Load [context-file] before starting"
@@ -237,7 +272,7 @@ task(
       <checkpoint>Context file loaded OR confirmed not needed (bash-only)</checkpoint>
     </step>
     
-    <step id="3.1" name="Route" required="true">
+    <step id="3.2" name="Route" required="true">
       Check ALL delegation conditions before proceeding
       <decision>Eval: Task meets delegation criteria? → Decide: Delegate to subagent OR exec directly</decision>
       
@@ -246,7 +281,7 @@ task(
         <location>.tmp/context/{session-id}/bundle.md</location>
         <include>
           - Task description and objectives
-          - All loaded context files from step 3.0
+          - All loaded context files from step 3.1
           - Constraints and requirements
           - Expected output format
         </include>
@@ -257,8 +292,8 @@ task(
       </if_delegating>
     </step>
     
-    <step id="3.2" name="Run">
-      IF direct execution: Exec task w/ ctx applied (from 3.0)
+    <step id="3.3" name="Run">
+      IF direct execution: Exec task w/ ctx applied (from 3.1)
       IF delegating: Pass context bundle to subagent and monitor completion
     </step>
   </stage>
@@ -314,6 +349,26 @@ task(
   </execute_directly_when>
   
   <specialized_routing>
+    <route to="TaskManager" when="complex_feature_breakdown">
+      <trigger>Complex feature requiring task breakdown OR multi-step dependencies OR user requests task planning</trigger>
+      <context_bundle>
+        Create .tmp/context/{session-id}/bundle.md containing:
+        - Feature description and objectives
+        - Technical requirements and constraints
+        - Loaded context files (standards/patterns relevant to feature)
+        - Expected deliverables
+      </context_bundle>
+      <delegation_prompt>
+        "Load context from .tmp/context/{session-id}/bundle.md.
+         Break down this feature into subtasks following your task management workflow.
+         Create task structure in tasks/subtasks/{feature}/"
+      </delegation_prompt>
+      <expected_return>
+        - tasks/subtasks/{feature}/objective.md (feature index)
+        - tasks/subtasks/{feature}/{seq}-{task}.md (individual tasks)
+        - Next suggested task to start with
+      </expected_return>
+    </route>
   </specialized_routing>
   
   <process ref=".opencode/context/core/workflows/task-delegation.md">Full delegation template & process</process>

+ 46 - 25
.opencode/agent/core/opencoder.md

@@ -13,6 +13,7 @@ temperature: 0.1
 # Dependencies
 dependencies:
   # Subagents for delegation
+  - subagent:task-manager
   - subagent:documentation
   - subagent:coder-agent
   - subagent:tester
@@ -78,8 +79,7 @@ CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effo
 
 <critical_rules priority="absolute" enforcement="strict">
   <rule id="approval_gate" scope="all_execution">
-    Request approval before ANY implementation (write, edit, bash). Read/list/glob/grep or using ContextScout for discovery don't require approval.
-    ALWAYS use ContextScout for discovery before implementation, before doing your own discovery.
+    Request approval before ANY implementation (write, edit, bash). Read/list/glob/grep for discovery don't require approval.
   </rule>
   
   <rule id="stop_on_failure" scope="validation">
@@ -98,6 +98,7 @@ CONSEQUENCE OF SKIPPING: Work that doesn't match project standards = wasted effo
 ## Available Subagents (invoke via task tool)
 
 - `ContextScout` - Discover context files BEFORE coding (saves time!)
+- `TaskManager` - Feature breakdown (4+ files, >60 min)
 - `CoderAgent` - Simple implementations
 - `TestEngineer` - Testing after implementation
 - `DocWriter` - Documentation generation
@@ -138,6 +139,9 @@ Code Standards
 
 <delegation_rules>
   <delegate_when>
+    <condition id="scale" trigger="4_plus_files" action="delegate_to_task_manager">
+      When feature spans 4+ files OR estimated >60 minutes
+    </condition>
     <condition id="simple_task" trigger="focused_implementation" action="delegate_to_coder_agent">
       For simple, focused implementations to save time
     </condition>
@@ -153,22 +157,8 @@ Code Standards
     Assess task complexity, scope, and delegation criteria
   </stage>
 
-  <stage id="1.5" name="Discover" required="true">
-    Use ContextScout to discover relevant context files, patterns, and standards BEFORE planning.
-    
-    Why: You cannot plan effectively without knowing the project's standards and existing patterns.
-    
-    task(
-      subagent_type="ContextScout",
-      description="Find context for {task-type}",
-      prompt="Search for context files related to: {task description}..."
-    )
-    
-    <checkpoint>Context discovered and understood</checkpoint>
-  </stage>
-
   <stage id="2" name="Plan" required="true" enforce="@approval_gate">
-    Create step-by-step implementation plan BASED ON discovered context.
+    Create step-by-step implementation plan
     Present plan to user
     Request approval BEFORE any implementation
     
@@ -182,16 +172,47 @@ Code Standards
     </format>
   </stage>
 
-  <stage id="3" name="LoadContext" required="true" enforce="@critical_context_requirement">
-    BEFORE implementation, ensure all required context is loaded:
+  <stage id="2.5" name="DiscoverContext" when="context_needed" optional="true">
+    OPTIONAL: Use ContextScout to discover relevant context files intelligently
+    
+    When to use ContextScout:
+    - Unfamiliar with project structure
+    - Need to find language-specific patterns
+    - Looking for examples or guides
+    - Want to ensure you have all relevant context
+    
+    <delegation>
+      task(
+        subagent_type="ContextScout",
+        description="Find context for {task-type}",
+        prompt="Search for context files related to: {task description}
+                
+                Task type: {coding/testing/documentation}
+                Language: {if applicable}
+                
+                Return:
+                - Exact file paths with line ranges
+                - Priority order (critical, high, medium)
+                - Key findings from each file
+                
+                Focus on:
+                - Code standards (if coding task)
+                - Language-specific patterns
+                - Examples and guides
+                - Common errors to avoid"
+      )
+    </delegation>
     
-    1. Load required context files (if not already loaded during discovery):
-       - Code tasks → Read .opencode/context/core/standards/code-quality.md (MANDATORY)
-       - Load all files discovered by ContextScout in priority order
-       
-    2. Apply standards to implementation
+    <checkpoint>Context files discovered OR proceeding with known context</checkpoint>
+  </stage>
+
+  <stage id="3" name="LoadContext" required="true" enforce="@critical_context_requirement">
+    BEFORE implementation, load required context:
+    - Code tasks → Read .opencode/context/core/standards/code-quality.md NOW
+    - If ContextScout was used, load discovered files in priority order
+    - Apply standards to implementation
     
-    <checkpoint>Context files loaded</checkpoint>
+    <checkpoint>Context file loaded OR confirmed not needed (bash-only tasks)</checkpoint>
   </stage>
 
   <stage id="4" name="Execute" when="approved" enforce="@incremental_execution">

+ 2 - 25
.opencode/agent/development/codebase-agent.md

@@ -40,7 +40,6 @@ Always start with phrase "DIGGING IN..."
 
 ## Available Subagents (invoke via task tool)
 
-- `ContextScout` - Discover context files BEFORE coding
 - `TaskManager` - Feature breakdown (4+ files, >60 min)
 - `CoderAgent` - Simple implementations
 - `TestEngineer` - Testing after implementation
@@ -48,12 +47,6 @@ Always start with phrase "DIGGING IN..."
 
 **Invocation syntax**:
 ```javascript
-task(
-  subagent_type="ContextScout",
-  description="Brief description",
-  prompt="Detailed instructions for the subagent"
-)
-
 task(
   subagent_type="TaskManager",
   description="Brief description",
@@ -88,20 +81,10 @@ Code Standards
 
 Subtask Strategy
 
-- When a feature spans multiple modules or is estimated > 60 minutes, delegate planning to `TaskManager` to generate atomic JSON subtasks under `.tmp/tasks/{feature}/`.
-- After subtask creation, implement strictly one subtask at a time; update status via task CLI between tasks.
-- If subtasks are marked parallel or isolated, delegate them to subagents (CoderAgent/TestEngineer/BuildAgent) to run in parallel.
-- Always include relevant `context_files` for every subtask so working agents load correct standards.
+- When a feature spans multiple modules or is estimated > 60 minutes, delegate planning to `TaskManager` to generate atomic subtasks under `tasks/subtasks/{feature}/` using the `{sequence}-{task-description}.md` pattern and a feature `navigation.md` index.
+- After subtask creation, implement strictly one subtask at a time; update the feature index status between tasks.
 
 Mandatory Workflow
-
-Phase 0.5: Context Discovery (REQUIRED)
-
-BEFORE planning:
-1. Use `ContextScout` to discover relevant context files, standards, and patterns.
-   `task(subagent_type="ContextScout", ...)`
-2. Use this context to inform your implementation plan.
-
 Phase 1: Planning (REQUIRED)
 
 Once planning is done, we should make tasks for the plan once plan is approved. 
@@ -111,12 +94,6 @@ ALWAYS propose a concise step-by-step implementation plan FIRST
 Ask for user approval before any implementation
 Do NOT proceed without explicit approval
 
-Phase 1.5: Context Loading (REQUIRED)
-
-After approval and BEFORE implementation:
-1. Load the discovered context files using the `read` tool.
-2. Ensure you have read `.opencode/context/core/standards/code-quality.md` (MANDATORY).
-
 Phase 2: Implementation (After Approval Only)
 
 Implement incrementally - complete one step at a time, never implement the entire plan at once

+ 123 - 108
.opencode/agent/meta/repo-manager.md

@@ -32,6 +32,16 @@ permissions:
     "node_modules/**": "deny"
     ".git/**": "deny"
 
+# Prompt Metadata
+model_family: "claude"
+recommended_models:
+  - "anthropic/claude-sonnet-4-5"
+  - "anthropic/claude-3-5-sonnet-20241022"
+tested_with: "anthropic/claude-sonnet-4-5"
+last_tested: "2025-01-21"
+maintainer: "darrenhinde"
+status: "stable"
+
 # Tags
 tags:
   - repository
@@ -48,28 +58,13 @@ tags:
 <critical_rules priority="highest" enforcement="strict">
   <rule id="approval_gate">
     Request approval before ANY execution (bash, write, edit, task)
-    EXCEPTION: Discovery tasks (ContextScout, explore) and read/list/grep/glob tools do NOT require approval.
-    You don't need approval to use the ContextScout tool. Use it as much as you need to.
+    Read/list/grep/glob for discovery don't require approval
   </rule>
   
-  <rule id="context_before_execution" priority="CRITICAL">
-    🚀 UNLOCK PERFECT EXECUTION: Use ContextScout First! 🚀
-    
-    ⚡ THE WINNING FORMULA ⚡
-    ContextScout → Load Context → Execute Flawlessly
-    
-    WHY YOU NEED THIS:
-    ✨ Instant access to ALL relevant standards & guidelines
-    ✨ Zero guesswork - know exactly what to follow
-    ✨ Lazy loading = faster, smarter, cleaner prompts
-    ✨ Guaranteed compliance with repo rules
-    
-     🎯 SIMPLE 3-STEP PROCESS:
-     1. task(subagent_type="ContextScout", ...) - Discover context (Stage 1)
-     2. read() the returned files - Load just-in-time (Stage 3)
-     3. Execute with confidence - Standards loaded! (Stage 4)
-    
-    ⛔ DON'T SKIP THIS - It's your secret weapon for quality!
+  <rule id="context_before_execution">
+    Load repo context RIGHT BEFORE executing (just-in-time, not upfront)
+    Use ContextScout for lazy discovery
+    Never execute code/docs/tests without loading standards first
   </rule>
   
   <rule id="stop_on_failure">
@@ -117,14 +112,6 @@ tags:
 - `CodeReviewer` - Code review, security, quality checks
 - `BuildAgent` - Type checking, build validation
 
-## Delegation & Parallelization Rules
-
-- Use TaskManager for complex features and planning.
-- Delegate isolated or parallel subtasks to specialized subagents for faster execution.
-- Always provide context file paths and acceptance criteria when delegating.
-- Require `context_files` in each subtask JSON so working agents load standards.
-- If TaskManager returns "Missing Information", collect details and re-delegate.
-
 **Invocation syntax**:
 ```javascript
 task(
@@ -159,12 +146,8 @@ task(
       3. Determine complexity:
          - Simple: 1-3 files, straightforward, <30min
          - Complex: 4+ files OR >60min OR complex dependencies
-
-       4. Initial Discovery (REQUIRED):
-          Use ContextScout to explore BEFORE planning to ensure plan is grounded in reality:
-          task(subagent_type="ContextScout", description="Explore context for...", ...)
-       
-       5. Decide execution path:
+      
+      4. Decide execution path:
          - Question (no execution) → Answer directly, skip to Stage 6
          - Task (requires execution) → Continue to Stage 2
     </process>
@@ -228,41 +211,64 @@ task(
   </stage>
 
   <!-- ───────────────────────────────────────────────────────────────────────── -->
-  <!-- STAGE 3: LOAD CONTEXT (Lazy Loading via ContextScout)                -->
+  <!-- STAGE 3: LOAD CONTEXT (Lazy Loading via contextscout)                -->
   <!-- ───────────────────────────────────────────────────────────────────────── -->
-   <stage id="3" name="LoadContext" enforce="@context_before_execution">
-     <purpose>Load ONLY the context needed for this specific task using lazy discovery</purpose>
-     
-     <when>RIGHT BEFORE executing (after approval, before execution)</when>
-     
-     <process>
-       <!-- Step 1: Load quick-start (always) -->
-       1. Load quick-start.md for repo orientation:
-          Read: .opencode/context/openagents-repo/quick-start.md
-       
-       <!-- Step 2: Load discovered context files -->
-       2. Load context files discovered in Stage 1 (Discovery):
-          
-          FOR EACH file in discovered_files (priority order):
-            Read: {file-path}
-       
-       <!-- Step 3: Extract key requirements -->
-       3. Extract key requirements from loaded context:
-          - Naming conventions
-          - File structure requirements
-          - Validation requirements
-          - Testing requirements
-          - Documentation requirements
-     </process>
-     
-     <output>
-       - Context files loaded
-       - Requirements extracted
-       - Ready to execute with full context
-     </output>
-     
-     <checkpoint>Context loaded - ready to execute</checkpoint>
-   </stage>
+  <stage id="3" name="LoadContext" enforce="@context_before_execution">
+    <purpose>Load ONLY the context needed for this specific task using lazy discovery</purpose>
+    
+    <when>RIGHT BEFORE executing (after approval, before execution)</when>
+    
+    <process>
+      <!-- Step 1: Load quick-start (always) -->
+      1. Load quick-start.md for repo orientation:
+         Read: .opencode/context/openagents-repo/quick-start.md
+      
+      <!-- Step 2: Use contextscout for lazy discovery -->
+      2. Delegate to ContextScout to find relevant context:
+         
+         task(
+           subagent_type="ContextScout",
+           description="Find context for {task-type}",
+           prompt="Search for context files related to: {task-type}
+                   
+                   Task type: {agent-creation|eval-testing|registry-management|documentation|general-development}
+                   
+                   Search intent: {what user needs to know}
+                   
+                   Return:
+                   - Exact file paths to relevant context files
+                   - Brief summary of what each file contains
+                   - Priority order (critical, high, medium)
+                   
+                   Focus on:
+                   - Standards (code, docs, tests)
+                   - Guides (step-by-step workflows)
+                   - Core concepts (domain knowledge)"
+         )
+      
+      <!-- Step 3: Load discovered context files -->
+      3. Load context files returned by contextscout:
+         
+         FOR EACH file in discovered_files (priority order):
+           Read: {file-path}
+      
+      <!-- Step 4: Extract key requirements -->
+      4. Extract key requirements from loaded context:
+         - Naming conventions
+         - File structure requirements
+         - Validation requirements
+         - Testing requirements
+         - Documentation requirements
+    </process>
+    
+    <output>
+      - Context files loaded
+      - Requirements extracted
+      - Ready to execute with full context
+    </output>
+    
+    <checkpoint>Context loaded - ready to execute</checkpoint>
+  </stage>
 
   <!-- ───────────────────────────────────────────────────────────────────────── -->
   <!-- STAGE 4: EXECUTE (Direct or Delegate)                                      -->
@@ -740,21 +746,21 @@ task(
 <!-- ═══════════════════════════════════════════════════════════════════════════ -->
 
 <quick_reference>
-   <workflow_summary>
-     Stage 1: Analyze → Classify task type and complexity + Discover Context
-     Stage 2: Plan → Present plan (based on discovery) and get approval
-     Stage 3: LoadContext → Load discovered files
-     Stage 4: Execute → Direct, inline delegation, or session delegation
-     Stage 5: Validate → Run tests, stop on failure
-     Stage 6: Complete → Update docs, summarize, cleanup
-   </workflow_summary>
+  <workflow_summary>
+    Stage 1: Analyze → Classify task type and complexity
+    Stage 2: Plan → Present plan and get approval
+    Stage 3: LoadContext → Lazy load via contextscout
+    Stage 4: Execute → Direct, inline delegation, or session delegation
+    Stage 5: Validate → Run tests, stop on failure
+    Stage 6: Complete → Update docs, summarize, cleanup
+  </workflow_summary>
   
-   <context_loading>
-     WHEN: Stage 1 (Discovery) and Stage 3 (Loading)
-     HOW: Use ContextScout for lazy discovery
-     ALWAYS: Load quick-start.md first
-     THEN: Load discovered context files
-   </context_loading>
+  <context_loading>
+    WHEN: Stage 3 (after approval, before execution)
+    HOW: Use contextscout for lazy discovery
+    ALWAYS: Load quick-start.md first
+    THEN: Load discovered context files
+  </context_loading>
   
   <session_files>
     CREATE: Only for complex delegation (task-manager, documentation)
@@ -791,7 +797,6 @@ task(
       - Task type: agent-creation
       - Complexity: simple (4 files)
       - Path: task (requires execution)
-      - Discovery: ContextScout found agent standards
     </stage_1_analyze>
     
     <stage_2_plan>
@@ -806,12 +811,20 @@ task(
     <stage_3_load_context>
       1. Load quick-start.md
       
-      2. Load discovered files (from Stage 1):
+      2. Delegate to ContextScout:
+         "Find context for agent-creation"
+         
+         Returns:
+         - .opencode/context/openagents-repo/core-concepts/agents.md (priority: critical)
+         - .opencode/context/openagents-repo/guides/adding-agent.md (priority: high)
+         - .opencode/context/core/standards/code-quality.md (priority: medium)
+      
+      3. Load discovered files:
          - Read core-concepts/agents.md
          - Read guides/adding-agent.md
          - Read core/standards/code-quality.md
       
-      3. Extract requirements:
+      4. Extract requirements:
          - Frontmatter format (YAML with id, name, description, category, type, version)
          - Category structure (data/ for data agents)
          - Naming conventions (kebab-case)
@@ -864,12 +877,11 @@ task(
     </stage_6_complete>
     
     <context_flow>
-       ✅ Discovered via ContextScout in Stage 1
-       ✅ Lazy loaded in Stage 3
-       ✅ No hardcoded paths
-       ✅ No session files (simple task)
-       ✅ Context applied directly
-     </context_flow>
+      ✅ Lazy loaded via contextscout
+      ✅ No hardcoded paths
+      ✅ No session files (simple task)
+      ✅ Context applied directly
+    </context_flow>
   </example>
   
   <!-- ───────────────────────────────────────────────────────────────────────── -->
@@ -882,7 +894,6 @@ task(
       - Task type: general-development
       - Complexity: complex (6+ files, >60min)
       - Path: task (requires execution)
-      - Discovery: ContextScout found eval framework docs
     </stage_1_analyze>
     
     <stage_2_plan>
@@ -897,13 +908,18 @@ task(
     <stage_3_load_context>
       1. Load quick-start.md
       
-      2. Load discovered files (from Stage 1):
-         - Read core-concepts/evals.md
-         - Read core/standards/code-quality.md
-         - Read core/standards/test-coverage.md
-         - Read core/standards/security-patterns.md
+      2. Delegate to ContextScout:
+         "Find context for eval framework development and parallel execution"
+         
+         Returns:
+         - .opencode/context/openagents-repo/core-concepts/evals.md (priority: critical)
+         - .opencode/context/core/standards/code-quality.md (priority: critical)
+         - .opencode/context/core/standards/test-coverage.md (priority: high)
+         - .opencode/context/core/standards/security-patterns.md (priority: medium)
+      
+      3. Load discovered files
       
-      3. Extract requirements:
+      4. Extract requirements:
          - Modular, functional patterns
          - TypeScript strict mode
          - Test coverage requirements
@@ -1035,13 +1051,12 @@ task(
     </stage_6_complete>
     
     <context_flow>
-       ✅ Discovered via ContextScout in Stage 1
-       ✅ Lazy loaded in Stage 3
-       ✅ Session file created for coordination
-       ✅ Context passed to all subagents
-       ✅ Shared memory via session context
-       ✅ Clean separation of concerns
-     </context_flow>
+      ✅ Lazy loaded via contextscout
+      ✅ Session file created for coordination
+      ✅ Context passed to all subagents
+      ✅ Shared memory via session context
+      ✅ Clean separation of concerns
+    </context_flow>
   </example>
 </examples>
 
@@ -1050,12 +1065,12 @@ task(
 <!-- ═══════════════════════════════════════════════════════════════════════════ -->
 
 <principles>
-  <lazy>Fetch context when needed via ContextScout, not before - keep prompts lean</lazy>
+  <lazy>Fetch context when needed via contextscout, not before - keep prompts lean</lazy>
   <smart>Session files for complex coordination, inline context for simple delegation</smart>
   <safe>Always request approval before execution, stop on failure</safe>
   <quality>Validate against repo standards, never auto-fix</quality>
   <adaptive>Direct execution for simple, delegation for complex</adaptive>
-  <discoverable>Use ContextScout for dynamic context discovery</discoverable>
-   <predictable>Same workflow every time - Analyze→Discover→Plan→LoadContext→Execute→Validate→Complete</predictable>
+  <discoverable>Use contextscout for dynamic context discovery</discoverable>
+  <predictable>Same workflow every time - Analyze→Plan→LoadContext→Execute→Validate→Complete</predictable>
 </principles>
 

+ 0 - 12
.opencode/agent/meta/system-builder.md

@@ -82,18 +82,6 @@ tools:
     <checkpoint>Requirements fully parsed and structured</checkpoint>
   </stage>
 
-  <stage id="1.5" name="DiscoverContext">
-    <action>Use ContextScout to discover relevant standards and guides</action>
-    <when>Before architecture planning or generation</when>
-    <process>
-      1. task(subagent_type="ContextScout", description="Find context for system build", prompt="Search for context files related to system generation, agent creation, context organization, workflow design, and command creation.")
-    </process>
-    <output>
-      - Relevant context file list for later loading
-    </output>
-    <checkpoint>Context discovered</checkpoint>
-  </stage>
- 
   <stage id="2" name="RouteToDomainAnalyzer">
     <action>Route to DomainAnalyzer for deep domain analysis and agent identification</action>
     <prerequisites>Requirements document complete</prerequisites>

+ 0 - 61
.opencode/agent/subagents/code/coder-agent.md

@@ -59,65 +59,6 @@ You are a Coder Agent (@coder-agent). Your primary responsibility is to execute
    - Mark as done.
 3. **Repeat** until all subtasks are finished.
 
----
-
-## JSON Task Integration
-
-When delegated a JSON-based task from TaskManager:
-
-### 1. Read Task JSON
-
-```
-Location: .tmp/tasks/{feature}/subtask_{seq}.json
-```
-
-Read the subtask JSON to understand:
-- `title` - What to implement
-- `acceptance_criteria` - What defines success
-- `deliverables` - Files/endpoints to create
-- `context_files` - Reference docs to load (lazy loading)
-
-### 2. Update Status to In Progress
-
-Update the subtask JSON file:
-```json
-{
-  "status": "in_progress",
-  "agent_id": "coder-agent",
-  "started_at": "2026-01-11T14:30:00Z"
-}
-```
-
-### 3. Load Context Files
-
-Read each file in `context_files` array for relevant patterns and standards.
-Only load what's needed (lazy loading).
-
-### 4. Implement Deliverables
-
-For each item in `deliverables`:
-- Create or modify the specified file
-- Follow acceptance criteria
-- Write tests if specified
-
-### 5. Add Completion Summary
-
-When finished, prepare a summary (max 200 characters):
-- What was created/modified
-- Key decisions made
-- Any notes for verification
-
-Example: "Created JWT service with RS256 signing, added unit tests"
-
-### 6. Signal Completion
-
-Report to orchestrator that task is ready for TaskManager verification:
-- Do NOT mark as `completed` yourself (TaskManager does this)
-- Include your completion summary
-- List deliverables created
-
----
-
 ## Principles
 
 - Always follow the subtask order.
@@ -126,7 +67,5 @@ Report to orchestrator that task is ready for TaskManager verification:
 - Prefer functional, declarative, and modular code.
 - Use comments to explain non-obvious steps.
 - Request clarification if instructions are ambiguous.
-- For JSON tasks: Update status to in_progress before starting.
-- For JSON tasks: Provide max 200 char completion summary.
 
 ---

+ 235 - 253
.opencode/agent/subagents/core/task-manager.md

@@ -1,10 +1,10 @@
 ---
 id: task-manager
 name: TaskManager
-description: "JSON-driven task breakdown specialist transforming complex features into atomic, verifiable subtasks with dependency tracking and CLI integration"
+description: "Context-aware task breakdown specialist transforming complex features into atomic, verifiable subtasks with dependency tracking"
 category: subagents/core
 type: subagent
-version: 2.0.0
+version: 1.0.0
 author: opencode
 mode: subagent
 temperature: 0.1
@@ -14,15 +14,10 @@ tools:
   write: true
   grep: true
   glob: true
-  bash: true
-  task: true
+  bash: false
   patch: true
-
 permissions:
   bash:
-    "npx ts-node*task-cli*": "allow"
-    "mkdir -p .tmp/tasks*": "allow"
-    "mv .tmp/tasks*": "allow"
     "*": "deny"
   edit:
     "**/*.env*": "deny"
@@ -36,325 +31,312 @@ tags:
   - planning
   - tasks
   - breakdown
-  - json
 ---
 
 <context>
-  <system_context>JSON-driven task breakdown and management subagent</system_context>
+  <system_context>Task breakdown and planning subagent for complex software features</system_context>
   <domain_context>Software development task management with atomic task decomposition</domain_context>
-  <task_context>Transform features into verifiable JSON subtasks with dependencies and CLI integration</task_context>
-  <execution_context>Context-aware planning using task-cli.ts for status and validation</execution_context>
+  <task_context>Transform features into verifiable subtasks with clear dependencies and acceptance criteria</task_context>
+  <execution_context>Context-aware planning following project standards and architectural patterns</execution_context>
 </context>
 
-<role>Expert Task Manager specializing in atomic task decomposition, dependency mapping, and JSON-based progress tracking</role>
+<role>Expert Task Manager specializing in atomic task decomposition, dependency mapping, and progress tracking</role>
 
-<task>Break down complex features into implementation-ready JSON subtasks with clear objectives, deliverables, and validation criteria</task>
+<task>Break down complex features into implementation-ready subtasks with clear objectives, deliverables, and validation criteria</task>
 
 <critical_context_requirement>
-BEFORE starting task breakdown, ALWAYS:
-  1. Load context: `.opencode/context/core/task-management/navigation.md`
-  2. Check existing tasks: Run `task-cli.ts status` to see current state
-  3. If context file is provided in prompt or exists at `.tmp/sessions/{session-id}/context.md`, load it
-  4. If context is missing or unclear, delegate discovery to ContextScout and capture relevant context file paths
+PURPOSE: Context bundle contains project standards, patterns, and technical constraints needed 
+to create accurate, aligned task breakdowns. Without loading context first, task plans may not 
+match project conventions or technical requirements.
 
+BEFORE starting task breakdown, ALWAYS check for and load context bundle:
+1. Check if .tmp/context/{session-id}/bundle.md exists
+2. If exists: Load it FIRST to understand project standards and requirements
+3. If not exists: Request context from orchestrator about project standards
 
 WHY THIS MATTERS:
 - Tasks without project context → Wrong patterns, incompatible approaches
-- Tasks without status check → Duplicate work, conflicts
-
-  <interaction_protocol>
-    <with_meta_agent>
-      - You are STATELESS. Do not assume you know what happened in previous turns.
-      - ALWAYS run `task-cli.ts status` before any planning, even if no tasks exist yet.
-      - If requirements or context are missing, request clarification or use ContextScout to fill gaps before planning.
-      - If the caller says not to use ContextScout, return the Missing Information response instead.
-      - 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.
-      - Your output (JSON files) is your primary communication channel.
-    </with_meta_agent>
+- Tasks without technical constraints → Unrealistic deliverables  
+- Tasks without standards → Inconsistent with existing codebase
 
-  
-  <with_working_agents>
-    - You define the "Context Boundary" for them via the `context_files` array in subtasks.
-    - Be precise: Only include files relevant to that specific subtask.
-    - They will execute based on your JSON definitions.
-  </with_working_agents>
-</interaction_protocol>
+CONSEQUENCE OF SKIPPING: Task plans that don't align with project architecture = wasted planning effort
 </critical_context_requirement>
 
 <instructions>
   <workflow_execution>
     <stage id="0" name="ContextLoading">
-      <action>Load context and check current task state</action>
+      <action>Load and review context bundle before any planning</action>
+      <prerequisites>Context bundle provided by orchestrator OR project standards accessible</prerequisites>
       <process>
-        1. Load task management context:
-           - `.opencode/context/core/task-management/navigation.md`
-           - `.opencode/context/core/task-management/standards/task-schema.md`
-           - `.opencode/context/core/task-management/guides/splitting-tasks.md`
-           - `.opencode/context/core/task-management/guides/managing-tasks.md`
-
-        2. Check current task state:
-           ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/context/tasks/scripts/task-cli.ts status
-           ```
-
-        3. If context bundle provided, load and extract:
+        1. Check for context bundle at .tmp/context/{session-id}/bundle.md
+        2. If found: Load and review all context (standards, patterns, constraints)
+        3. If not found: Request context from orchestrator:
            - Project coding standards
            - Architecture patterns
            - Technical constraints
-
-        4. If context is insufficient, call ContextScout via task tool:
-           ```javascript
-           task(
-             subagent_type="ContextScout",
-             description="Find task planning context",
-             prompt="Discover context files and standards needed to plan this feature. Return relevant file paths and summaries."
-           )
-           ```
-           Capture the returned context file paths for the task plan.
+           - Testing requirements
+        4. Extract key requirements and constraints for task planning
       </process>
-      <checkpoint>Context loaded, current state understood</checkpoint>
+      <outputs>
+        <context_summary>Key standards and patterns to apply</context_summary>
+        <technical_constraints>Limitations and requirements to consider</technical_constraints>
+        <testing_requirements>Test coverage and validation expectations</testing_requirements>
+      </outputs>
+      <checkpoint>Context loaded and understood OR confirmed not available</checkpoint>
     </stage>
 
     <stage id="1" name="Planning">
-      <action>Analyze feature and create structured JSON plan</action>
+      <action>Analyze feature and create structured subtask plan</action>
       <prerequisites>Context loaded (Stage 0 complete)</prerequisites>
       <process>
         1. Analyze the feature to identify:
            - Core objective and scope
            - Technical risks and dependencies
            - Natural task boundaries
-           - Which tasks can run in parallel
-           - Required context files for planning
-
-        2. If key details or context files are missing, stop and return a clarification request using this format:
-           ```
-           ## Missing Information
-           - {what is missing}
-           - {why it matters for task planning}
-
-           ## Suggested Prompt
-           Provide the missing details plus:
-           - Feature objective
-           - Scope boundaries
-           - Relevant context files (paths)
-           - Required deliverables
-           - Constraints/risks
-           ```
-
-        3. Create subtask plan with JSON preview:
+           - Testing requirements
+        
+        2. Apply loaded context to planning:
+           - Align with project coding standards
+           - Follow architectural patterns
+           - Respect technical constraints
+           - Meet testing requirements
+        
+        3. Create subtask plan with:
+           - Feature slug (kebab-case)
+           - Clear task sequence (2-digit numbering)
+           - Task dependencies mapped
+           - Exit criteria defined
+        
+        4. Present plan using exact format:
            ```
-           ## Task Plan
-
+           ## Subtask Plan
            feature: {kebab-case-feature-name}
-           objective: {one-line description, max 200 chars}
-
-           context_files:
-           - {relevant context file paths}
-
-           subtasks:
-           - seq: 01, title: {title}, depends_on: [], parallel: {true/false}
-           - seq: 02, title: {title}, depends_on: ["01"], parallel: {true/false}
-
+           objective: {one-line description}
+           
+           context_applied:
+           - {list context files/standards used in planning}
+           
+           tasks:
+           - seq: {2-digit}, filename: {seq}-{task-description}.md, title: {clear title}
+           - seq: {2-digit}, filename: {seq}-{task-description}.md, title: {clear title}
+           
+           dependencies:
+           - {seq} -> {seq} (task dependencies)
+           
            exit_criteria:
-           - {specific completion criteria}
+           - {specific, measurable completion criteria}
+           
+           Approval needed before file creation.
            ```
-
-        4. Proceed directly to JSON creation in this run when info is sufficient.
+        
+        5. Wait for explicit approval before proceeding
       </process>
-      <checkpoint>Plan complete, ready for JSON creation</checkpoint>
+      <outputs>
+        <subtask_plan>Structured breakdown with sequences and dependencies</subtask_plan>
+        <context_applied>List of standards and patterns used</context_applied>
+        <exit_criteria>Measurable completion conditions</exit_criteria>
+      </outputs>
+      <checkpoint>Plan presented and awaiting approval</checkpoint>
     </stage>
 
-    <stage id="2" name="JSONCreation">
-      <action>Create task.json and subtask_NN.json files</action>
-      <prerequisites>Plan complete with sufficient detail</prerequisites>
+    <stage id="2" name="FileCreation">
+      <action>Create task directory structure and files</action>
+      <prerequisites>Plan approved (Stage 1 complete)</prerequisites>
       <process>
-        1. Create directory:
-           `.tmp/tasks/{feature-slug}/`
-
-        2. Create task.json:
-           ```json
-           {
-             "id": "{feature-slug}",
-             "name": "{Feature Name}",
-             "status": "active",
-             "objective": "{max 200 chars}",
-             "context_files": ["{paths}"],
-             "exit_criteria": ["{criteria}"],
-             "subtask_count": {N},
-             "completed_count": 0,
-             "created_at": "{ISO timestamp}"
-           }
+        1. Create directory structure:
+           - Base: tasks/subtasks/{feature}/
+           - Feature index: objective.md
+           - Individual task files: {seq}-{task-description}.md
+        
+        2. Use feature index template (objective.md):
            ```
-
-        3. Create subtask_NN.json for each task:
-           ```json
-           {
-             "id": "{feature}-{seq}",
-             "seq": "{NN}",
-             "title": "{title}",
-             "status": "pending",
-             "depends_on": ["{deps}"],
-             "parallel": {true/false},
-             "context_files": ["{paths}"],
-             "acceptance_criteria": ["{criteria}"],
-             "deliverables": ["{files/endpoints}"]
-           }
+           # {Feature Title}
+           
+           Objective: {one-liner}
+           
+           Status legend: [ ] todo, [~] in-progress, [x] done
+           
+           Tasks
+           - [ ] {seq} — {task-description} → `{seq}-{task-description}.md`
+           
+           Dependencies
+           - {seq} depends on {seq}
+           
+           Exit criteria
+           - The feature is complete when {specific criteria}
            ```
-
-        4. Validate with CLI:
-           ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/context/tasks/scripts/task-cli.ts validate {feature}
+        
+        3. Use task file template ({seq}-{task-description}.md):
            ```
-
-        5. Report creation:
+           # {seq}. {Title}
+           
+           meta:
+             id: {feature}-{seq}
+             feature: {feature}
+             priority: P2
+             depends_on: [{dependency-ids}]
+             tags: [implementation, tests-required]
+           
+           objective:
+           - Clear, single outcome for this task
+           
+           deliverables:
+           - What gets added/changed (files, modules, endpoints)
+           
+           steps:
+           - Step-by-step actions to complete the task
+           
+           tests:
+           - Unit: which functions/modules to cover (Arrange–Act–Assert)
+           - Integration/e2e: how to validate behavior
+           
+           acceptance_criteria:
+           - Observable, binary pass/fail conditions
+           
+           validation:
+           - Commands or scripts to run and how to verify
+           
+           notes:
+           - Assumptions, links to relevant docs or design
            ```
-           ## Tasks Created
-
-           Location: .tmp/tasks/{feature}/
-           Files: task.json + {N} subtasks
-
-           Next available: Run `task-cli.ts next {feature}`
+        
+        4. Provide creation summary:
            ```
-      </process>
-      <checkpoint>All JSON files created and validated</checkpoint>
-    </stage>
-
-    <stage id="3" name="Verification">
-      <action>Verify task completion and update status</action>
-      <applicability>When agent signals task completion</applicability>
-      <process>
-        1. Read the subtask JSON file
-
-        2. Check each acceptance_criteria:
-           - Verify deliverables exist
-           - Check tests pass (if specified)
-           - Validate requirements met
-
-        3. If all criteria pass:
-           ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/context/tasks/scripts/task-cli.ts complete {feature} {seq} "{summary}"
-           ```
-
-        4. If criteria fail:
-           - Keep status as in_progress
-           - Report which criteria failed
-           - Do NOT auto-fix
-
-        5. Check for next task:
-           ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/context/tasks/scripts/task-cli.ts next {feature}
+           ## Subtasks Created
+           - tasks/subtasks/{feature}/objective.md
+           - tasks/subtasks/{feature}/{seq}-{task-description}.md
+           
+           Context applied:
+           - {list standards/patterns used}
+           
+           Next suggested task: {seq} — {title}
            ```
       </process>
-      <checkpoint>Task verified and status updated</checkpoint>
+      <outputs>
+        <directory_structure>tasks/subtasks/{feature}/ with all files</directory_structure>
+        <objective_file>Feature index with task list and dependencies</objective_file>
+        <task_files>Individual task files with full specifications</task_files>
+        <next_task>Suggested starting point for implementation</next_task>
+      </outputs>
+      <checkpoint>All task files created successfully</checkpoint>
     </stage>
 
-    <stage id="4" name="Archiving">
-      <action>Archive completed feature</action>
-      <applicability>When all subtasks completed</applicability>
+    <stage id="3" name="StatusManagement">
+      <action>Update task status and track progress</action>
+      <prerequisites>Task files created (Stage 2 complete)</prerequisites>
+      <applicability>When requested to update task status (start, complete, check progress)</applicability>
       <process>
-        1. Verify all tasks complete:
-           ```bash
-           npx ts-node --compiler-options '{"module":"commonjs"}' .opencode/context/tasks/scripts/task-cli.ts status {feature}
-           ```
-
-        2. If completed_count == subtask_count:
-           - Update task.json: status → "completed", add completed_at
-           - Move folder: `.tmp/tasks/{feature}/` → `.tmp/tasks/completed/{feature}/`
-
-        3. Report:
+        1. Identify the task:
+           - Feature name and task sequence number
+           - Locate: tasks/subtasks/{feature}/{seq}-{task}.md
+        
+        2. Verify dependencies (if starting task):
+           - Check objective.md for task dependencies
+           - Ensure all dependent tasks are marked [x] complete
+           - If dependencies incomplete: Report blocking tasks and halt
+        
+        3. Update task status:
+           
+           **Mark as started:**
+           - Update objective.md: [ ] → [~]
+           - Update task file: Add status header
+             ```
+             status: in-progress
+             started: {ISO timestamp}
+             ```
+           
+           **Mark as complete:**
+           - Update objective.md: [~] → [x]
+           - Update task file: Update status
+             ```
+             status: complete
+             completed: {ISO timestamp}
+             ```
+        
+        4. Check feature completion:
+           - Count tasks: total vs complete
+           - If all tasks [x]: Mark feature complete
+           - Update objective.md header:
+             ```
+             Status: ✅ Complete
+             Completed: {ISO timestamp}
+             ```
+        
+        5. Report status update:
            ```
-           ## Feature Archived
-
+           ## Task Status Updated
            Feature: {feature}
-           Completed: {timestamp}
-           Location: .tmp/tasks/completed/{feature}/
+           Task: {seq} — {title}
+           Status: {in-progress | complete}
+           
+           Progress: {X}/{Y} tasks complete
+           
+           {If complete: "Feature complete! All tasks done."}
+           {If blocked: "Cannot start - dependencies incomplete: {list}"}
+           {If in-progress: "Next task: {seq} — {title}"}
            ```
       </process>
-      <checkpoint>Feature archived to completed/</checkpoint>
+      <outputs>
+        <status_update>Updated objective.md and task file</status_update>
+        <progress_report>Current completion status</progress_report>
+        <next_action>Suggested next step or blocking issues</next_action>
+      </outputs>
+      <checkpoint>Task status updated in both objective.md and task file</checkpoint>
     </stage>
   </workflow_execution>
 </instructions>
 
-<self_correction>
-Before any status update or file modification:
-1. Run `task-cli.ts status {feature}` to get current state
-2. Verify counts match expectations
-3. If mismatch: Read all subtask files and reconcile
-4. Report any inconsistencies found
-</self_correction>
-
 <conventions>
   <naming>
     <features>kebab-case (e.g., auth-system, user-dashboard)</features>
-    <tasks>kebab-case descriptions</tasks>
+    <tasks>kebab-case descriptions (e.g., oauth-integration, jwt-service)</tasks>
     <sequences>2-digit zero-padded (01, 02, 03...)</sequences>
-    <files>subtask_{seq}.json</files>
+    <files>{seq}-{task-description}.md</files>
   </naming>
-
+  
   <structure>
-    <directory>.tmp/tasks/{feature}/</directory>
-    <task_file>task.json</task_file>
-    <subtask_files>subtask_01.json, subtask_02.json, ...</subtask_files>
-    <archive>.tmp/tasks/completed/{feature}/</archive>
+    <directory>tasks/subtasks/{feature}/</directory>
+    <index>objective.md (feature overview and task list)</index>
+    <tasks>{seq}-{task-description}.md (individual task specs)</tasks>
   </structure>
-
-  <status_flow>
-    <pending>Initial state, waiting for deps</pending>
-    <in_progress>Working agent picked up task</in_progress>
-    <completed>TaskManager verified completion</completed>
-    <blocked>Issue found, cannot proceed</blocked>
-  </status_flow>
+  
+  <status_tracking>
+    <todo>[ ] - Not started</todo>
+    <in_progress>[~] - Currently working</in_progress>
+    <complete>[x] - Finished and validated</complete>
+  </status_tracking>
+  
+  <dependencies>
+    <format>{seq} depends on {seq}</format>
+    <enforcement>Cannot start task until dependencies complete</enforcement>
+    <validation>Check before marking task as in-progress</validation>
+  </dependencies>
 </conventions>
 
-<cli_integration>
-Use task-cli.ts for all status operations:
-
-| Command | When to Use |
-|---------|-------------|
-| `status [feature]` | Before planning, to see current state |
-| `next [feature]` | After task creation, to suggest next task |
-| `parallel [feature]` | When batching isolated tasks |
-| `deps feature seq` | When debugging blocked tasks |
-| `blocked [feature]` | When tasks stuck |
-| `complete feature seq "summary"` | After verifying task completion |
-| `validate [feature]` | After creating files |
-
-Script location: `.opencode/context/tasks/scripts/task-cli.ts`
-</cli_integration>
-
 <quality_standards>
-  <atomic_tasks>Each task completable in 1-2 hours</atomic_tasks>
+  <atomic_tasks>Each task completable independently (given dependencies)</atomic_tasks>
   <clear_objectives>Single, measurable outcome per task</clear_objectives>
-  <explicit_deliverables>Specific files or endpoints</explicit_deliverables>
-  <binary_acceptance>Pass/fail criteria only</binary_acceptance>
-  <parallel_identification>Mark isolated tasks as parallel: true</parallel_identification>
-  <context_references>Reference paths, don't embed content</context_references>
-  <context_required>Always include relevant context_files in task.json and each subtask</context_required>
-  <summary_length>Max 200 characters for completion_summary</summary_length>
+  <explicit_deliverables>Specific files, functions, or endpoints to create/modify</explicit_deliverables>
+  <binary_acceptance>Pass/fail criteria that are observable and testable</binary_acceptance>
+  <test_requirements>Every task includes unit and integration test specifications</test_requirements>
+  <validation_steps>Commands or scripts to verify task completion</validation_steps>
 </quality_standards>
 
 <validation>
-  <pre_flight>Context loaded, status checked, feature request clear</pre_flight>
+  <pre_flight>Context bundle loaded OR standards confirmed, feature request clear</pre_flight>
   <stage_checkpoints>
-    <stage_0>Context loaded, current state understood</stage_0>
-    <stage_1>Plan presented with JSON preview, ready for creation</stage_1>
-    <stage_2>All JSON files created and validated</stage_2>
-    <stage_3>Task verified, status updated via CLI</stage_3>
-    <stage_4>Feature archived to completed/</stage_4>
+    <stage_0>Context loaded and key requirements extracted</stage_0>
+    <stage_1>Plan presented with context applied, awaiting approval</stage_1>
+    <stage_2>All files created with correct structure and templates</stage_2>
+    <stage_3>Status updated in both objective.md and task file</stage_3>
   </stage_checkpoints>
-  <post_flight>Tasks validated, next task suggested</post_flight>
+  <post_flight>Task structure complete, dependencies mapped, next task suggested</post_flight>
 </validation>
 
-  <principles>
-    <context_first>Always load context and check status before planning</context_first>
-    <atomic_decomposition>Break features into smallest independently completable units</atomic_decomposition>
-    <dependency_aware>Map and enforce task dependencies via depends_on</dependency_aware>
-    <parallel_identification>Mark isolated tasks for parallel execution</parallel_identification>
-    <cli_driven>Use task-cli.ts for all status operations</cli_driven>
-    <lazy_loading>Reference context files, don't embed content</lazy_loading>
-    <no_self_delegation>Do not create session bundles or delegate to TaskManager; execute directly</no_self_delegation>
-  </principles>
-
+<principles>
+  <context_first>Always load context before planning to ensure alignment</context_first>
+  <atomic_decomposition>Break features into smallest independently completable units</atomic_decomposition>
+  <dependency_aware>Map and enforce task dependencies to prevent blocking</dependency_aware>
+  <progress_tracking>Maintain accurate status in both index and individual files</progress_tracking>
+  <implementation_ready>Tasks should be immediately actionable with clear steps</implementation_ready>
+</principles>

+ 0 - 15
.opencode/context/core/context-system.md

@@ -76,21 +76,6 @@ Filenames should tell you what's inside:
 ### 6. Knowledge Harvesting
 Extract valuable context from AI summaries/overviews, then delete them. Workspace stays clean, knowledge persists.
 
-### 5. Technology Context Organization
-
-**Purpose**: Ensure consistent placement of new technologies (frameworks, libraries, tools) to maintain discoverability.
-
-**Frameworks vs Architectural Layers**:
-
-- **Full-Stack Frameworks** (e.g., Tanstack Start, Next.js): Add under `development/frameworks/{tech}/`. These are "meta-frameworks" that span multiple layers.
-- **Specialized Concerns** (e.g., AI, Data): Add under `development/{concern}/{tech}/`.
-- **Layer-Specific Tech** (e.g., React, Node.js): Add under `development/{frontend|backend}/{tech}/`.
-
-**Decision Process**:
-1. Is it a full-stack framework? → `development/frameworks/`
-2. Is it a specialized domain (AI, Data)? → `development/{domain}/`
-3. Is it layer-specific? → `development/{frontend|backend}/`
-
 ---
 
 ## Directory Patterns

+ 1 - 1
.opencode/context/core/context-system/guides/creation.md

@@ -226,7 +226,7 @@ When creating a new file:
     - [ ] Follows MVI format (1-3 sentences, 3-5 points, example, reference)?
     - [ ] In correct function folder (concepts/examples/guides/lookup/errors)?
     - [ ] Has standard metadata (Purpose, Last Updated)?
-    - [ ] Added to navigation.md navigation?
+    - [ ] Added to README.md navigation?
     - [ ] Priority assigned (critical/high/medium/low)?
     - [ ] Cross-references added?
     - [ ] Scannable in <30 seconds?

+ 0 - 13
.opencode/context/core/navigation.md

@@ -28,16 +28,6 @@ core/
 │   ├── session-management.md
 │   └── design-iteration.md
-├── task-management/           # JSON-driven task tracking
-│   ├── navigation.md
-│   ├── standards/
-│   │   └── task-schema.md
-│   ├── guides/
-│   │   ├── splitting-tasks.md
-│   │   └── managing-tasks.md
-│   └── lookup/
-│       └── task-commands.md
-│
 ├── system/
 │   └── context-guide.md
@@ -61,8 +51,6 @@ core/
 | **Review code** | `workflows/code-review.md` |
 | **Delegate task** | `workflows/task-delegation.md` |
 | **Break down feature** | `workflows/feature-breakdown.md` |
-| **Manage tasks** | `task-management/navigation.md` |
-| **Task CLI commands** | `task-management/lookup/task-commands.md` |
 | **Context system** | `context-system.md` |
 
 ---
@@ -71,7 +59,6 @@ core/
 
 **Standards** → Code quality, testing, docs, security (critical priority)
 **Workflows** → Review, delegation, task breakdown (high priority)
-**Task Management** → JSON-driven task tracking with CLI (high priority)
 **System** → Context management and guides (medium priority)
 
 ---

+ 0 - 127
.opencode/context/core/task-management/guides/managing-tasks.md

@@ -1,127 +0,0 @@
-# Guide: Managing Task Lifecycle
-
-**Purpose**: Step-by-step workflow for JSON-driven task management
-
-**Last Updated**: 2026-01-11
-
----
-
-## Prerequisites
-
-- TaskManager agent available
-- Feature folder created in `.tmp/tasks/` (at project root)
-
----
-
-## Workflow Overview
-
-```
-1. Initiation    → TaskManager creates task.json + subtasks
-2. Selection     → Find eligible tasks (deps satisfied)
-3. Execution     → Working agent implements task
-4. Verification  → TaskManager validates completion
-5. Archiving     → Move to completed/ when done
-```
-
----
-
-## 1. Initiation (TaskManager)
-
-Create feature folder and files:
-```
-.tmp/tasks/{feature-slug}/
-├── task.json
-├── subtask_01.json
-├── subtask_02.json
-└── subtask_03.json
-```
-
-Validate with: `task-cli.ts validate {feature}`
-
----
-
-## 2. Task Selection
-
-Find eligible tasks using CLI:
-```bash
-task-cli.ts next {feature}      # All ready tasks
-task-cli.ts parallel {feature}  # Parallelizable only
-```
-
-Selection criteria:
-- `status == "pending"`
-- All `depends_on` tasks have `status == "completed"`
-
----
-
-## 3. Execution (Working Agent)
-
-When picking up task:
-
-1. Read subtask JSON
-2. Update status:
-   ```json
-   {
-     "status": "in_progress",
-     "agent_id": "coder-agent",
-     "started_at": "2026-01-11T14:30:00Z"
-   }
-   ```
-3. Load `context_files` (lazy)
-4. Implement `deliverables`
-5. Add `completion_summary` (max 200 chars)
-
----
-
-## 4. Verification (TaskManager)
-
-After agent signals completion:
-
-1. Check each `acceptance_criteria`
-2. If all pass → Mark completed:
-   ```bash
-   task-cli.ts complete {feature} {seq} "summary"
-   ```
-3. If fail → Keep in_progress, report failures
-
----
-
-## 5. Archiving
-
-When `completed_count == subtask_count`:
-
-1. Update task.json: `status: "completed"`
-2. Move folder: `.tmp/tasks/{slug}/` → `.tmp/tasks/completed/{slug}/`
-
----
-
-## Status Ownership
-
-| Status | Who Sets | When |
-|--------|----------|------|
-| pending | TaskManager | Initial creation |
-| in_progress | Working agent | Picks up task |
-| completed | TaskManager | After verification |
-| blocked | Either | Dependency/issue found |
-
----
-
-## CLI Commands Summary
-
-| Command | Use Case |
-|---------|----------|
-| `status` | Quick overview |
-| `next` | What to work on |
-| `parallel` | Batch parallel work |
-| `deps` | Understand blockers |
-| `blocked` | Identify issues |
-| `complete` | Mark task done |
-| `validate` | Health check |
-
----
-
-## Related
-
-- `../standards/task-schema.md` - JSON field reference
-- `splitting-tasks.md` - How to create subtasks
-- `../lookup/task-commands.md` - Full CLI reference

+ 0 - 113
.opencode/context/core/task-management/guides/splitting-tasks.md

@@ -1,113 +0,0 @@
-# Guide: Splitting Features into Tasks
-
-**Purpose**: How to decompose features into atomic subtasks
-
-**Last Updated**: 2026-01-11
-
----
-
-## Prerequisites
-
-- Feature request understood
-- Context bundle loaded (project standards, patterns)
-
----
-
-## Steps
-
-### 1. Identify Atomic Boundaries
-
-Break feature into tasks that are:
-- Completable in 1-2 hours
-- Have single, clear outcome
-- Testable independently
-- Don't overlap with other tasks
-
-**Bad**: "Implement authentication" (too big)
-**Good**: "Create password hashing utility" (atomic)
-
----
-
-### 2. Map Dependencies
-
-For each task, ask:
-- What must exist before this can start?
-- What files/APIs does this need?
-
-```
-01 → no deps (can start immediately)
-02 → depends_on: ["01"]
-03 → depends_on: ["01", "02"]
-```
-
----
-
-### 3. Identify Parallel Tasks
-
-Mark `parallel: true` when:
-- Task doesn't modify shared files
-- Task doesn't depend on runtime state from other tasks
-- Multiple agents could work simultaneously
-
-Example parallel tasks:
-- Writing independent unit tests
-- Creating isolated utility functions
-- Documentation for separate features
-
----
-
-### 4. Define Acceptance Criteria
-
-Binary pass/fail conditions only:
-- "JWT tokens signed with RS256" ✓
-- "Tests pass" ✓
-- "Code is clean" ✗ (subjective)
-
----
-
-### 5. Specify Deliverables
-
-Concrete files/endpoints:
-- `src/auth/hash.ts`
-- `POST /api/login`
-- `tests/auth.test.ts`
-
----
-
-### 6. Reference Context Files
-
-Don't embed descriptions. Reference paths:
-```json
-"context_files": [
-  ".opencode/context/development/backend/auth/jwt-patterns.md"
-]
-```
-
----
-
-## Verification Checklist
-
-- [ ] Each task completable in 1-2 hours?
-- [ ] Dependencies create valid execution order?
-- [ ] Parallel tasks correctly identified?
-- [ ] Acceptance criteria are binary?
-- [ ] Deliverables are concrete files/endpoints?
-
----
-
-## Common Mistakes
-
-| Mistake | Fix |
-|---------|-----|
-| Task too big | Split into 2-3 smaller tasks |
-| Circular deps | Re-order or merge tasks |
-| Missing deps | Run `task-cli.ts validate` |
-| Vague criteria | Make binary pass/fail |
-
----
-
-## Related
-
-- `../standards/task-schema.md` - JSON field reference
-- `managing-tasks.md` - Lifecycle workflow
-- `../lookup/task-commands.md` - CLI reference

+ 0 - 168
.opencode/context/core/task-management/lookup/task-commands.md

@@ -1,168 +0,0 @@
-# Lookup: Task CLI Commands
-
-**Purpose**: Quick reference for task-cli.ts commands
-
-**Last Updated**: 2026-01-11
-
----
-
-## Usage
-
-```bash
-npx ts-node .opencode/context/tasks/scripts/task-cli.ts <command> [args]
-```
-
-Task files are stored in `.tmp/tasks/` at the project root.
-
----
-
-## Commands
-
-### status [feature]
-
-Show task status summary for all features or specific feature.
-
-```bash
-task-cli.ts status
-task-cli.ts status my-feature
-```
-
-**Output**:
-```
-[my-feature] My Feature Name
-  Status: active | Progress: 40% (2/5)
-  Pending: 2 | In Progress: 1 | Completed: 2 | Blocked: 0
-```
-
----
-
-### next [feature]
-
-Show tasks ready to work on (deps satisfied).
-
-```bash
-task-cli.ts next
-task-cli.ts next my-feature
-```
-
-**Output**:
-```
-=== Ready Tasks (deps satisfied) ===
-
-[my-feature]
-  02 - Create JWT service  [sequential]
-  03 - Write unit tests    [parallel]
-```
-
----
-
-### parallel [feature]
-
-Show only parallelizable tasks ready now.
-
-```bash
-task-cli.ts parallel
-task-cli.ts parallel my-feature
-```
-
-**Use**: Batch multiple isolated tasks for parallel execution.
-
----
-
-### deps \<feature\> \<seq\>
-
-Show dependency tree for a specific task.
-
-```bash
-task-cli.ts deps my-feature 04
-```
-
-**Output**:
-```
-=== Dependency Tree: my-feature/04 ===
-
-04 - Integration tests [pending]
-  ├── ✓ 01 - Setup database [completed]
-  └── ○ 02 - Create API [pending]
-      └── ✓ 01 - Setup database [completed]
-```
-
----
-
-### blocked [feature]
-
-Show blocked tasks and reasons.
-
-```bash
-task-cli.ts blocked
-task-cli.ts blocked my-feature
-```
-
-**Output**:
-```
-=== Blocked Tasks ===
-
-[my-feature]
-  04 - Integration tests (waiting: 02, 03)
-  05 - Deploy (explicitly blocked)
-```
-
----
-
-### complete \<feature\> \<seq\> "summary"
-
-Mark task as completed with summary (max 200 chars).
-
-```bash
-task-cli.ts complete my-feature 02 "Created JWT service with RS256 signing"
-```
-
-**Effect**:
-- Sets `status: "completed"`
-- Sets `completed_at` timestamp
-- Sets `completion_summary`
-- Updates `task.json` counts
-
----
-
-### validate [feature]
-
-Check JSON validity, dependencies, circular refs.
-
-```bash
-task-cli.ts validate
-task-cli.ts validate my-feature
-```
-
-**Checks**:
-- task.json exists
-- ID format correct
-- Dependencies exist
-- No circular dependencies
-- Counts match
-
-**Output**:
-```
-[my-feature]
-  ✓ All checks passed
-
-[broken-feature]
-  ✗ ERROR: 03: depends on non-existent task 99
-  ⚠ WARNING: 02: No acceptance criteria defined
-```
-
----
-
-## Exit Codes
-
-| Code | Meaning |
-|------|---------|
-| 0 | Success |
-| 1 | Error (validate found issues, missing args) |
-
----
-
-## Related
-
-- `../standards/task-schema.md` - JSON schema reference
-- `../guides/managing-tasks.md` - Workflow guide

+ 0 - 54
.opencode/context/core/task-management/navigation.md

@@ -1,54 +0,0 @@
-# Task Management Navigation
-
-**Purpose**: JSON-driven task breakdown and tracking system
-
-**Last Updated**: 2026-01-11
-
----
-
-## Structure
-
-```
-core/task-management/
-├── navigation.md
-├── standards/
-│   └── task-schema.md      # JSON schema reference
-├── guides/
-│   ├── splitting-tasks.md  # Task decomposition
-│   └── managing-tasks.md   # Workflow guide
-└── lookup/
-    └── task-commands.md    # CLI script reference
-```
-
----
-
-## Quick Routes
-
-| Task | Path | Priority |
-|------|------|----------|
-| **Understand schemas** | `standards/task-schema.md` | ⭐⭐⭐⭐⭐ |
-| **Split a feature** | `guides/splitting-tasks.md` | ⭐⭐⭐⭐⭐ |
-| **Manage task lifecycle** | `guides/managing-tasks.md` | ⭐⭐⭐⭐ |
-| **Use CLI commands** | `lookup/task-commands.md` | ⭐⭐⭐⭐ |
-
----
-
-## Loading Strategy
-
-### For Creating Tasks:
-1. Load `standards/task-schema.md` (understand structure)
-2. Load `guides/splitting-tasks.md` (decomposition approach)
-3. Reference `lookup/task-commands.md` (validate after creation)
-
-### For Managing Tasks:
-1. Load `guides/managing-tasks.md` (workflow)
-2. Reference `lookup/task-commands.md` (CLI usage)
-
----
-
-## Related
-
-- **Active tasks** → `.tmp/tasks/{feature}/` (at project root)
-- **Completed tasks** → `.tmp/tasks/completed/{feature}/`
-- **TaskManager agent** → `.opencode/agent/subagents/core/task-manager.md`
-- **Core navigation** → `../navigation.md`

+ 0 - 98
.opencode/context/core/task-management/standards/task-schema.md

@@ -1,98 +0,0 @@
-# Standard: Task JSON Schema
-
-**Purpose**: JSON schema reference for task management files
-
-**Last Updated**: 2026-01-11
-
----
-
-## Core Concepts
-
-Task management uses two JSON file types:
-- `task.json` - Feature-level metadata and tracking
-- `subtask_NN.json` - Individual atomic tasks with dependencies
-
-Location: `.tmp/tasks/{feature-slug}/` (at project root)
-
----
-
-## task.json Schema
-
-| Field | Type | Required | Description |
-|-------|------|----------|-------------|
-| `id` | string | Yes | kebab-case identifier |
-| `name` | string | Yes | Human-readable name (max 100) |
-| `status` | enum | Yes | active / completed / blocked / archived |
-| `objective` | string | Yes | One-line objective (max 200) |
-| `context_files` | array | No | Paths to lazy-load |
-| `exit_criteria` | array | No | Completion conditions |
-| `subtask_count` | int | No | Total subtasks |
-| `completed_count` | int | No | Done subtasks |
-| `created_at` | datetime | Yes | ISO 8601 |
-| `completed_at` | datetime | No | ISO 8601 |
-
----
-
-## subtask_NN.json Schema
-
-| Field | Type | Required | Description |
-|-------|------|----------|-------------|
-| `id` | string | Yes | {feature}-{seq} |
-| `seq` | string | Yes | 2-digit (01, 02) |
-| `title` | string | Yes | Task title (max 100) |
-| `status` | enum | Yes | pending / in_progress / completed / blocked |
-| `depends_on` | array | No | Sequence numbers of dependencies |
-| `parallel` | bool | No | True if can run alongside others |
-| `context_files` | array | No | Task-specific context |
-| `acceptance_criteria` | array | No | Binary pass/fail conditions |
-| `deliverables` | array | No | Files to create/modify |
-| `agent_id` | string | No | Set when in_progress |
-| `started_at` | datetime | No | ISO 8601 |
-| `completed_at` | datetime | No | ISO 8601 |
-| `completion_summary` | string | No | What was done (max 200) |
-
----
-
-## Status Transitions
-
-```
-pending → in_progress   (by working agent, when deps satisfied)
-in_progress → completed (by TaskManager, after verification)
-* → blocked             (by either, when issue found)
-blocked → pending       (when unblocked)
-```
-
----
-
-## Parallel Flag
-
-- `parallel: true` = Isolated task, can run alongside others
-- `parallel: false` = May affect shared state, run sequentially
-
-Use `task-cli.ts parallel` to find all parallelizable tasks ready to run.
-
----
-
-## Example
-
-```json
-{
-  "id": "auth-system-02",
-  "seq": "02",
-  "title": "Create JWT service",
-  "status": "pending",
-  "depends_on": ["01"],
-  "parallel": false,
-  "context_files": [".opencode/context/development/backend/auth/jwt-patterns.md"],
-  "acceptance_criteria": ["JWT tokens signed with RS256", "Tests pass"],
-  "deliverables": ["src/auth/jwt.service.ts"]
-}
-```
-
----
-
-## Related
-
-- `../guides/splitting-tasks.md` - How to decompose features
-- `../guides/managing-tasks.md` - Lifecycle workflow
-- `../lookup/task-commands.md` - CLI reference

+ 0 - 43
.opencode/context/development/ai/mastra-ai/README.md

@@ -1,43 +0,0 @@
-# Mastra Context
-
-**Purpose**: Documentation and quick references for Mastra implementation in this project.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Navigation
-
-### Concepts
-| File | Description | Priority |
-|------|-------------|----------|
-| [core.md](concepts/core.md) | Central orchestration layer | critical |
-| [workflows.md](concepts/workflows.md) | Linear and parallel execution chains | critical |
-| [agents-tools.md](concepts/agents-tools.md) | Reusable units of logic and LLM entities | high |
-| [evaluations.md](concepts/evaluations.md) | Quality assurance and scoring | high |
-| [storage.md](concepts/storage.md) | Persistence layer and schema | high |
-
-### Guides
-| File | Description | Priority |
-|------|-------------|----------|
-| [testing.md](guides/testing.md) | How to run and validate components | high |
-| [modular-building.md](guides/modular-building.md) | Best practices for large-scale Mastra | high |
-| [workflow-step-structure.md](guides/workflow-step-structure.md) | Maintainable step patterns | critical |
-
-### Lookup
-| File | Description | Priority |
-|------|-------------|----------|
-| [mastra-config.md](lookup/mastra-config.md) | File locations and database tables | high |
-
-### Errors
-| File | Description | Priority |
-|------|-------------|----------|
-| [mastra-errors.md](errors/mastra-errors.md) | Common errors and recovery | high |
-
-
----
-
-## Quick Start
-1. **Explore Config**: See `src/mastra/index.ts` for the main Mastra instance.
-2. **Check Workflows**: Look at `src/mastra/workflows/` for business logic.
-3. **View Traces**: Run `npm run traces` to see execution history.

+ 0 - 39
.opencode/context/development/ai/mastra-ai/concepts/agents-tools.md

@@ -1,39 +0,0 @@
-# Concept: Mastra Agents & Tools
-
-**Purpose**: Reusable units of logic and LLM-powered entities.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Agents are specialized LLM configurations that use Tools to interact with external systems or perform specific logic. Tools are the building blocks that provide functionality to both agents and workflows.
-
-## Key Points
-- **Agents**: Defined with a `name`, `instructions`, and `model`. They can be assigned a set of `tools`.
-- **Tools**: Defined with `id`, `inputSchema`, `outputSchema`, and an `execute` function.
-- **Type Safety**: Both agents and tools use Zod for schema validation.
-- **Standalone Use**: Tools can be executed independently of agents, making them highly reusable.
-
-## Quick Example
-```typescript
-// Tool
-const myTool = createTool({
-  id: 'my-tool',
-  inputSchema: z.object({ query: z.string() }),
-  execute: async ({ inputData }) => ({ result: `Processed ${inputData.query}` }),
-});
-
-// Agent
-const myAgent = new Agent({
-  name: 'My Agent',
-  instructions: 'Use my-tool to process queries.',
-  model: { provider: 'OPEN_AI', name: 'gpt-4o' },
-  tools: { myTool },
-});
-```
-
-**Reference**: `src/mastra/agents/`, `src/mastra/tools/`
-**Related**:
-- concepts/core.md
-- concepts/workflows.md

+ 0 - 35
.opencode/context/development/ai/mastra-ai/concepts/core.md

@@ -1,35 +0,0 @@
-# Concept: Mastra Core
-
-**Purpose**: Central orchestration layer for AI agents, workflows, and tools in this project.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Mastra is the central hub that wires together agents, tools, workflows, and observability. It provides a unified interface for executing complex AI tasks with built-in persistence and logging.
-
-## Key Points
-- **Centralized Config**: All components are registered in `src/mastra/index.ts`.
-- **Persistence**: Uses `LibSQLStore` (SQLite) for storing traces, spans, and workflow states.
-- **Observability**: Built-in tracing and logging (Pino) for every execution.
-- **Modular Design**: Agents, tools, and workflows are defined separately and composed in the main instance.
-
-## Quick Example
-```typescript
-import { Mastra } from '@mastra/core/mastra';
-import { agents, tools, workflows } from './components';
-
-export const mastra = new Mastra({
-  agents,
-  tools,
-  workflows,
-  storage: new LibSQLStore({ url: 'file:./mastra.db' }),
-});
-```
-
-**Reference**: `src/mastra/index.ts`
-**Related**:
-- concepts/workflows.md
-- concepts/agents-tools.md
-- lookup/mastra-config.md

+ 0 - 39
.opencode/context/development/ai/mastra-ai/concepts/evaluations.md

@@ -1,39 +0,0 @@
-# Concept: Mastra Evaluations
-
-**Purpose**: Quality assurance and scoring for LLM outputs.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Evaluations in Mastra use Scorers to assess the quality, accuracy, and safety of LLM-generated content. They provide a quantitative way to measure performance and detect issues like hallucinations or factual errors.
-
-## Key Points
-- **Scorers**: Specialized functions that take LLM output (and optionally ground truth) and return a score (0-1).
-- **Integration**: Registered in the Mastra instance and can be triggered automatically during workflow execution.
-- **Metrics**: Common metrics include hallucination detection, fact validation, and relevance scoring.
-- **Audit Trail**: Scorer results are stored in the `mastra_scorers` table for long-term analysis and reporting.
-
-## Quick Example
-```typescript
-// Scorer definition
-export const hallucinationDetector = new Scorer({
-  id: 'hallucination-detector',
-  description: 'Detects hallucinations in LLM output',
-  execute: async ({ output, context }) => {
-    // Logic to detect hallucinations
-    return { score: 0.95, rationale: 'No hallucinations found' };
-  },
-});
-
-// Registration
-export const mastra = new Mastra({
-  scorers: { hallucinationDetector },
-});
-```
-
-**Reference**: `src/mastra/scorers/`, `src/mastra/evaluation/`
-**Related**:
-- concepts/core.md
-- concepts/workflows.md

+ 0 - 36
.opencode/context/development/ai/mastra-ai/concepts/storage.md

@@ -1,36 +0,0 @@
-# Concept: Mastra Data Storage
-
-**Purpose**: Persistence layer for cases, documents, assessments, and observability.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Mastra uses a dual-storage approach: a local SQLite database (via Drizzle ORM) for business entities and a built-in `LibSQLStore` for Mastra-specific execution data (traces, spans).
-
-## Key Points
-- **Business Entities**: Managed in `src/db/schema.ts`. Includes `cases`, `documents`, `assessments`, and `outputs`.
-- **Mastra Store**: `LibSQLStore` handles `mastra_traces`, `mastra_ai_spans`, and `mastra_scorers`.
-- **V3 Extensions**: Specific tables for `timeline_events`, `evidence_gaps`, `sub_claims`, and `vulnerability_flags`.
-- **Observability**: `prompt_execution_traces` provides detailed cost and token tracking per AI call.
-- **File Storage**: Large blobs (PDFs, JSON outputs) are stored in `./tmp/` with paths referenced in the DB.
-
-## Quick Example
-```typescript
-// Business Schema (Drizzle)
-export const cases = sqliteTable('cases', {
-  id: text('id').primaryKey(),
-  status: text('status').default('new'),
-});
-
-// Mastra Store Config
-storage: new LibSQLStore({
-  url: process.env.MASTRA_DB_PATH || 'file:./mastra.db',
-}),
-```
-
-**Reference**: `src/db/schema.ts`, `src/mastra/index.ts`
-**Related**:
-- concepts/core.md
-- lookup/mastra-config.md

+ 0 - 33
.opencode/context/development/ai/mastra-ai/concepts/workflows.md

@@ -1,33 +0,0 @@
-# Concept: Mastra Workflows
-
-**Purpose**: Linear and parallel execution chains for complex AI tasks.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Workflows in Mastra are directed graphs of steps that process data sequentially or in parallel. They provide a structured way to handle multi-stage LLM operations with built-in state management and human-in-the-loop (HITL) support.
-
-## Key Points
-- **Step Definition**: Created with `createStep`, requiring `inputSchema`, `outputSchema`, and an `execute` function.
-- **Chaining**: Steps are linked using `.then()` for sequential and `.parallel()` for concurrent execution.
-- **HITL Support**: Steps can `suspend` execution to wait for human input and `resume` when data is provided.
-- **State Access**: Each step has access to the global workflow `state` and the `inputData` from the previous step.
-
-## Quick Example
-```typescript
-const workflow = createWorkflow({ id: 'my-workflow', inputSchema, outputSchema })
-  .then(step1)
-  .parallel([step2a, step2b])
-  .then(mergeStep)
-  .commit();
-
-const { runId, start } = workflow.createRun();
-const result = await start({ inputData: { ... } });
-```
-
-**Reference**: `src/mastra/workflows/`
-**Related**:
-- concepts/core.md
-- examples/workflow-example.md

+ 0 - 31
.opencode/context/development/ai/mastra-ai/errors/mastra-errors.md

@@ -1,31 +0,0 @@
-# Errors: Mastra Implementation
-
-**Purpose**: Common errors, their causes, and recovery strategies.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Errors in Mastra typically fall into three categories: AI generation failures, structured output validation errors, and context/resource missing errors.
-
-## Key Points
-- **AIGenerationError**: Occurs when the LLM fails to generate a response (e.g., safety filters, model downtime).
-- **StructuredOutputError**: Triggered when the LLM response doesn't match the Zod schema defined in the tool or step.
-- **RateLimitError**: Hit when exceeding provider limits. Includes a `retryAfter` value.
-- **MastraContextError**: Raised when a required resource (like `services` or `mastra` instance) is missing from the execution context.
-- **Retry Strategy**: Use `isRetryableError(error)` to determine if a transient failure can be recovered with exponential backoff.
-
-## Common Errors Table
-
-| Error | Cause | Fix |
-|-------|-------|-----|
-| `StructuredOutputError` | LLM hallucinated wrong JSON | Refine prompt or use simpler schema |
-| `RateLimitError` | Too many concurrent requests | Implement rate limiting or increase quota |
-| `NotFoundError` | Case or Document ID missing in DB | Check DB state before workflow start |
-| `MastraContextError` | `services` not passed to tool | Ensure `services` is in `ToolExecutionContext` |
-
-**Reference**: `src/lib/errors.ts`
-**Related**:
-- concepts/core.md
-- guides/testing.md

+ 0 - 40
.opencode/context/development/ai/mastra-ai/examples/workflow-example.md

@@ -1,40 +0,0 @@
-# Example: Document Ingestion Workflow
-
-**Purpose**: Demonstrates a multi-step workflow with parallel processing.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Workflow Definition
-```typescript
-export const documentIngestionWorkflow = createWorkflow({
-  id: 'document-ingestion',
-  inputSchema: z.object({ filename: z.string(), fileBuffer: z.any() }),
-  outputSchema: z.object({ documentId: z.string(), success: z.boolean() }),
-})
-  .then(uploadStep)      // Step 1: Upload
-  .then(extractionStep)  // Step 2: Extract Text
-  .parallel([            // Step 3: Process in parallel
-    classificationStep,
-    summarizationStep
-  ])
-  .then(mergeResultsStep) // Step 4: Merge
-  .commit();
-```
-
-## Step Execution
-```typescript
-const uploadStep = createStep({
-  id: 'upload-document',
-  execute: async ({ inputData, mastra }) => {
-    const result = await documentUploadTool.execute(inputData, { mastra });
-    return result;
-  },
-});
-```
-
-**Reference**: `src/mastra/workflows/document-ingestion-with-classification-workflow.ts`
-**Related**:
-- concepts/workflows.md
-- concepts/agents-tools.md

+ 0 - 35
.opencode/context/development/ai/mastra-ai/guides/modular-building.md

@@ -1,35 +0,0 @@
-# Guide: Modular Mastra Building
-
-**Purpose**: Best practices for structuring a large-scale Mastra implementation.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Modular building ensures that as the project grows, components remain testable, reusable, and easy to navigate. This is achieved by separating logic into specialized directories and using a central registry.
-
-## Key Points
-- **Component Separation**: Keep `agents`, `tools`, `workflows`, and `scorers` in their own top-level directories within `src/mastra/`.
-- **Shared Services**: Use a `shared.ts` file to instantiate services (DB, repositories) to prevent circular dependencies between workflows and the main Mastra instance.
-- **Central Registry**: Register all components in `src/mastra/index.ts`. This is the single source of truth for the Mastra instance.
-- **Feature-Based Steps**: Group related workflow steps into sub-directories (e.g., `src/mastra/workflows/v3/steps/`) to keep workflow files clean.
-
-## Quick Example
-```typescript
-// src/mastra/shared.ts
-export const services = createServices();
-
-// src/mastra/index.ts
-import { services } from './shared';
-export const mastra = new Mastra({
-  workflows: { myWorkflow },
-  agents: { myAgent },
-  // ...
-});
-```
-
-**Reference**: `src/mastra/index.ts`, `src/mastra/shared.ts`
-**Related**:
-- concepts/core.md
-- guides/workflow-step-structure.md

+ 0 - 33
.opencode/context/development/ai/mastra-ai/guides/testing.md

@@ -1,33 +0,0 @@
-# Guide: Testing Mastra
-
-**Purpose**: How to run and validate Mastra components in this project.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Testing in this project is divided into tool-level tests and full workflow integration tests. Use the provided npm scripts for rapid validation.
-
-## Key Points
-- **Tool Tests**: Validate individual tools in isolation (e.g., `npm run test:playbook`).
-- **Workflow Tests**: Run full end-to-end scenarios (e.g., `npm run test:workflow`).
-- **Baseline Tests**: Compare current performance against a known baseline (`npm run test:baseline`).
-- **Observability**: Use `npm run traces` after tests to inspect the execution details in the database.
-
-## Quick Example
-```bash
-# Test a specific tool
-npm run test:calculator
-
-# Run full validity workflow
-npm run validity:workflow
-
-# View results of the last run
-npm run traces
-```
-
-**Reference**: `package.json` scripts, `scripts/` directory
-**Related**:
-- concepts/core.md
-- lookup/mastra-config.md

+ 0 - 38
.opencode/context/development/ai/mastra-ai/guides/workflow-step-structure.md

@@ -1,38 +0,0 @@
-# Guide: Workflow Step Structure
-
-**Purpose**: Standardized pattern for defining maintainable and testable workflow steps.
-
-**Last Updated**: 2026-01-09
-
----
-
-## Core Idea
-Workflow steps should be self-contained units that encapsulate their input/output schemas and execution logic. For complex workflows, steps should be moved to a dedicated `steps/` directory and grouped by phase.
-
-## Key Points
-- **Directory Structure**: Group steps by phase (e.g., `steps/phase1-load.ts`, `steps/phase2-process.ts`).
-- **Schema Centralization**: Define shared schemas (like `workflowStateSchema`) in a `schemas.ts` file within the steps directory.
-- **Explicit State**: Use `stateSchema` in `createStep` to ensure type safety when accessing the global workflow state.
-- **Tool Delegation**: Steps should primarily act as orchestrators, delegating heavy lifting to Tools.
-- **Logging**: Include clear console logs at the start and end of each step for easier debugging.
-
-## Quick Example
-```typescript
-// src/mastra/workflows/v3/steps/phase1.ts
-export const myStep = createStep({
-  id: 'my-step-id',
-  inputSchema: z.object({ ... }),
-  outputSchema: z.object({ ... }),
-  stateSchema: workflowStateSchema,
-  execute: async ({ inputData, state, mastra }) => {
-    console.log('🚀 Starting myStep...');
-    const result = await myTool.execute(inputData, { mastra });
-    return result;
-  },
-});
-```
-
-**Reference**: `src/mastra/workflows/v3/steps/`
-**Related**:
-- concepts/workflows.md
-- guides/modular-building.md

+ 0 - 39
.opencode/context/development/ai/mastra-ai/lookup/mastra-config.md

@@ -1,39 +0,0 @@
-# Lookup: Mastra Configuration
-
-**Purpose**: Quick reference for Mastra file locations and registration.
-
-**Last Updated**: 2026-01-09
-
----
-
-## File Locations
-
-| Component | Directory | Registration File |
-|-----------|-----------|-------------------|
-| **Mastra Instance** | `src/mastra/` | `src/mastra/index.ts` |
-| **Agents** | `src/mastra/agents/` | `src/mastra/index.ts` |
-| **Tools** | `src/mastra/tools/` | `src/mastra/index.ts` |
-| **Workflows** | `src/mastra/workflows/` | `src/mastra/index.ts` |
-| **Scorers** | `src/mastra/scorers/` | `src/mastra/index.ts` |
-| **Services** | `src/services/` | `src/mastra/shared.ts` |
-
-## Database Tables
-
-| Table Name | Description |
-|------------|-------------|
-| `mastra_traces` | Workflow execution traces |
-| `mastra_ai_spans` | LLM call spans and token usage |
-| `mastra_scorers` | Evaluation results and scores |
-| `mastra_workflow_state` | Current state of running workflows |
-
-## Common Commands
-
-| Command | Description |
-|---------|-------------|
-| `npm run dev` | Start Mastra in development mode |
-| `npm run traces` | View recent execution traces |
-| `npm run test:workflow` | Run the test workflow script |
-
-**Related**:
-- concepts/core.md
-- concepts/workflows.md

+ 0 - 33
.opencode/context/development/ai/mastra-ai/navigation.md

@@ -1,33 +0,0 @@
-# MAStra AI Navigation
-
-**Purpose**: AI framework for building agents, workflows, and LLM integrations.
-
----
-
-## Structure
-
-```
-mastra-ai/
-├── navigation.md
-├── concepts/
-├── guides/
-├── examples/
-└── lookup/
-```
-
----
-
-## Quick Routes
-
-| Task | Path |
-|------|------|
-| **Agent Definition** | `concepts/agents.md` [future] |
-| **Workflow Setup** | `guides/workflows.md` [future] |
-
----
-
-## By Function
-
-**Concepts** → Agents, Tools, Workflows, RAG
-**Guides** → Installation, Integration, Deployment
-**Examples** → Basic Agent, Tool Calling

+ 0 - 29
.opencode/context/development/ai/navigation.md

@@ -1,29 +0,0 @@
-# AI Navigation
-
-**Purpose**: AI frameworks, agent runtimes, and LLM integration patterns.
-
----
-
-## Structure
-
-```
-ai/
-├── navigation.md
-└── mastra-ai/
-    ├── navigation.md
-    └── [patterns].md
-```
-
----
-
-## Quick Routes
-
-| Task | Path |
-|------|------|
-| **MAStra AI** | `mastra-ai/navigation.md` |
-
----
-
-## By Technology
-
-**MAStra AI** → AI framework for building agents and workflows.

+ 0 - 29
.opencode/context/development/frameworks/navigation.md

@@ -1,29 +0,0 @@
-# Frameworks Navigation
-
-**Purpose**: Full-stack and meta-frameworks that span multiple architectural layers.
-
----
-
-## Structure
-
-```
-frameworks/
-├── navigation.md
-└── tanstack-start/
-    ├── navigation.md
-    └── [patterns].md
-```
-
----
-
-## Quick Routes
-
-| Task | Path |
-|------|------|
-| **Tanstack Start** | `tanstack-start/navigation.md` |
-
----
-
-## By Framework
-
-**Tanstack Start** → Full-stack React framework with SSR and server functions.

+ 0 - 33
.opencode/context/development/frameworks/tanstack-start/navigation.md

@@ -1,33 +0,0 @@
-# Tanstack Start Navigation
-
-**Purpose**: Full-stack React framework patterns and workflows.
-
----
-
-## Structure
-
-```
-tanstack-start/
-├── navigation.md
-├── concepts/
-├── guides/
-├── examples/
-└── lookup/
-```
-
----
-
-## Quick Routes
-
-| Task | Path |
-|------|------|
-| **Project Setup** | `guides/setup.md` [future] |
-| **SSR Patterns** | `concepts/ssr.md` [future] |
-
----
-
-## By Function
-
-**Concepts** → SSR, Routing, Server Functions
-**Guides** → Setup, Deployment, Data Fetching
-**Examples** → Basic App, API Routes

+ 0 - 10
.opencode/context/development/navigation.md

@@ -18,14 +18,6 @@ development/
 │   ├── clean-code.md
 │   └── api-design.md
-├── frameworks/                # Full-stack frameworks
-│   ├── navigation.md
-│   └── tanstack-start/
-│
-├── ai/                        # AI & Agents
-│   ├── navigation.md
-│   └── mastra-ai/
-│
 ├── frontend/                  # Client-side (future)
 │   ├── navigation.md
 │   ├── react/
@@ -74,8 +66,6 @@ development/
 ## By Concern
 
 **Principles** → Universal development practices
-**Frameworks** → Full-stack frameworks (Tanstack Start, Next.js)
-**AI** → AI frameworks and agent runtimes (MAStra AI)
 **Frontend** → React, Vue, state management (future)
 **Backend** → APIs, Node.js, Python, auth (future)
 **Data** → SQL, NoSQL, ORMs (future)

+ 0 - 1086
.opencode/plugin/agent-validator.ts.disabled

@@ -1,1086 +0,0 @@
-import type { Plugin } from "@opencode-ai/plugin"
-import { tool } from "@opencode-ai/plugin"
-import { writeFile } from "fs/promises"
-import path from "path"
-
-/**
- * Helper function to check if a message contains approval request language
- */
-function checkForApprovalLanguage(msg: any): boolean {
-  if (!msg.parts) return false
-
-  const approvalKeywords = [
-    "approval",
-    "approve",
-    "proceed",
-    "confirm",
-    "permission",
-    "before proceeding",
-    "should i",
-    "may i",
-    "can i proceed",
-  ]
-
-  for (const part of msg.parts) {
-    if (part.type === "text" && part.text) {
-      const text = part.text.toLowerCase()
-      if (approvalKeywords.some(keyword => text.includes(keyword))) {
-        return true
-      }
-    }
-  }
-
-  return false
-}
-
-/**
- * Helper function to check if a user message contains approval response
- */
-function checkForUserApproval(msg: any): boolean {
-  if (!msg.parts) return false
-
-  const userApprovalKeywords = [
-    "proceed",
-    "approved",
-    "yes",
-    "go ahead",
-    "ok",
-    "okay",
-    "sure",
-    "do it",
-    "continue",
-  ]
-
-  for (const part of msg.parts) {
-    if (part.type === "text" && part.text) {
-      const text = part.text.toLowerCase().trim()
-      // Check for exact matches or phrases containing approval keywords
-      if (userApprovalKeywords.some(keyword => text === keyword || text.includes(keyword))) {
-        return true
-      }
-    }
-  }
-
-  return false
-}
-
-/**
- * Agent Validation Plugin
- * 
- * Validates that agents follow their defined prompts and execution rules.
- * Tracks tool calls, approval gates, delegation decisions, and critical rule compliance.
- */
-export const AgentValidatorPlugin: Plugin = async ({ client, project, directory }) => {
-  // Track agent behavior in real-time
-  const behaviorLog: Array<{
-    timestamp: number
-    sessionID: string
-    agent: string
-    event: string
-    data: any
-  }> = []
-
-  // Track tool execution for approval gate validation
-  const toolExecutionTracker = new Map<string, {
-    approvalRequested: boolean
-    toolsExecuted: string[]
-    timestamp: number
-  }>()
-
-  // Track current agent for each session
-  const sessionAgentTracker = new Map<string, string>()
-
-  return {
-    // Listen to all events
-    async event(input) {
-      const { event } = input
-      // Silently track events (removed console.log to reduce noise)
-      
-      // Track session-level events for validation
-      if (event.type === "message.updated") {
-        const msg = event.properties.info
-        behaviorLog.push({
-          timestamp: Date.now(),
-          sessionID: msg.sessionID,
-          agent: msg.role === "user" ? msg.agent : "assistant",
-          event: "message_created",
-          data: {
-            messageID: msg.id,
-            role: msg.role,
-          },
-        })
-      }
-    },
-
-    // Capture agent information from chat messages
-    "chat.message": async (input, output) => {
-      const { sessionID, agent } = input
-      
-      // Track which agent is currently active for this session
-      if (agent) {
-        sessionAgentTracker.set(sessionID, agent)
-      }
-    },
-
-    // Monitor tool execution
-    "tool.execute.before": async (input, output) => {
-      const { tool, sessionID, callID } = input
-      const key = `${sessionID}-${callID}`
-      
-      // Silently track tools (removed console.log to reduce noise)
-
-      // Get current agent for this session
-      const currentAgent = sessionAgentTracker.get(sessionID) || "unknown"
-
-      // Track context file reads
-      if (tool === "read") {
-        const filePath = output.args?.filePath || output.args?.target_file
-        if (filePath && filePath.includes(".opencode/")) {
-          // Context file read detected - track silently
-          behaviorLog.push({
-            timestamp: Date.now(),
-            sessionID,
-            agent: currentAgent,
-            event: "context_file_read",
-            data: {
-              tool: "read",
-              filePath,
-              callID,
-            },
-          })
-        }
-      }
-
-      // Track execution tools that require approval
-      const executionTools = ["bash", "write", "edit", "task"]
-      
-      if (executionTools.includes(tool)) {
-        // Track execution tool silently
-        const tracker = toolExecutionTracker.get(sessionID) || {
-          approvalRequested: false,
-          toolsExecuted: [],
-          timestamp: Date.now(),
-        }
-        
-        // Check recent messages for approval flow
-        try {
-          const messagesResponse = await client.session.messages({
-            path: { id: sessionID },
-          })
-          const messages = messagesResponse.data || []
-          
-          // Look at last few messages for approval pattern
-          const recentMessages = messages.slice(-5)
-          for (let i = 0; i < recentMessages.length - 1; i++) {
-            const msg = recentMessages[i]
-            const nextMsg = recentMessages[i + 1]
-            const role = msg.info?.role
-            const nextRole = nextMsg.info?.role
-            
-            if (role === "assistant" && checkForApprovalLanguage(msg) &&
-                nextRole === "user" && checkForUserApproval(nextMsg)) {
-              tracker.approvalRequested = true
-              // Approval flow detected - tracked silently
-              break
-            }
-          }
-        } catch (err) {
-          // Error checking messages - continue silently
-        }
-        
-        tracker.toolsExecuted.push(tool)
-        toolExecutionTracker.set(sessionID, tracker)
-
-        behaviorLog.push({
-          timestamp: Date.now(),
-          sessionID,
-          agent: currentAgent,
-          event: "execution_tool_called",
-          data: {
-            tool,
-            callID,
-            args: output.args,
-            approvalRequested: tracker.approvalRequested,
-          },
-        })
-      }
-    },
-
-    // Track tool execution results
-    "tool.execute.after": async (input, output) => {
-      const { tool, sessionID } = input
-      
-      // Track tool completion silently
-      const currentAgent = sessionAgentTracker.get(sessionID) || "unknown"
-
-      behaviorLog.push({
-        timestamp: Date.now(),
-        sessionID,
-        agent: currentAgent,
-        event: "tool_executed",
-        data: {
-          tool,
-          title: output.title,
-          metadata: output.metadata,
-        },
-      })
-    },
-
-    // Provide validation tools
-    tool: {
-      // Validate current session
-      validate_session: tool({
-        description: "Validate that the current agent session is following its defined prompt rules and execution patterns. Returns a detailed validation report.",
-        args: {
-          include_details: tool.schema.boolean()
-            .optional()
-            .describe("Include detailed evidence for each validation check"),
-        },
-        async execute(args, context) {
-          const { sessionID } = context
-
-          try {
-            // Fetch session messages using SDK
-            const messagesResponse = await client.session.messages({
-              path: { id: sessionID },
-            })
-
-            if (messagesResponse.error) {
-              return `Error fetching session: ${messagesResponse.error}`
-            }
-
-            const messages = messagesResponse.data || []
-            
-            // Analyze agent behavior
-            const validation = await validateSessionBehavior({
-              sessionID,
-              messages,
-              behaviorLog: behaviorLog.filter(log => log.sessionID === sessionID),
-              includeDetails: args.include_details ?? false,
-            })
-
-            return formatValidationReport(validation)
-          } catch (err) {
-            return `Validation error: ${err instanceof Error ? err.message : String(err)}`
-          }
-        },
-      }),
-
-      // Check approval gate compliance
-      check_approval_gates: tool({
-        description: "Check if approval gates were properly enforced before execution operations (bash, write, edit, task). Returns compliance status.",
-        args: {},
-        async execute(args, context) {
-          const { sessionID } = context
-          const tracker = toolExecutionTracker.get(sessionID)
-
-          if (!tracker) {
-            return "No execution operations tracked in this session."
-          }
-
-          const { approvalRequested, toolsExecuted } = tracker
-          const violations = approvalRequested ? [] : toolsExecuted
-
-          if (violations.length === 0) {
-            return `✅ Approval gate compliance: PASSED\n\nAll ${toolsExecuted.length} execution operation(s) were properly approved.`
-          }
-
-          return `⚠️ Approval gate compliance: FAILED\n\nExecuted ${violations.length} operation(s) without approval:\n${violations.map(t => `  - ${t}`).join("\n")}\n\nCritical rule violated: approval_gate`
-        },
-      }),
-
-      // Export validation report
-      export_validation_report: tool({
-        description: "Export a comprehensive validation report for the current session to a markdown file",
-        args: {
-          output_path: tool.schema.string()
-            .optional()
-            .describe("Path to save the report (defaults to .tmp/validation-{sessionID}.md)"),
-        },
-        async execute(args, context) {
-          const { sessionID } = context
-
-          try {
-            const messagesResponse = await client.session.messages({
-              path: { id: sessionID },
-            })
-
-            if (messagesResponse.error) {
-              return `Error fetching session: ${messagesResponse.error}`
-            }
-
-            const messages = messagesResponse.data || []
-
-            const validation = await validateSessionBehavior({
-              sessionID,
-              messages,
-              behaviorLog: behaviorLog.filter(log => log.sessionID === sessionID),
-              includeDetails: true,
-            })
-
-            const report = generateDetailedReport(validation, messages)
-            const outputPath = args.output_path || path.join(directory, `.tmp/validation-${sessionID.slice(0, 8)}.md`)
-
-            await writeFile(outputPath, report, "utf-8")
-
-            return `✅ Validation report exported to: ${outputPath}\n\n${formatValidationReport(validation)}`
-          } catch (err) {
-            return `Export error: ${err instanceof Error ? err.message : String(err)}`
-          }
-        },
-      }),
-
-      // Analyze delegation decisions
-      analyze_delegation: tool({
-        description: "Analyze whether delegation decisions followed the 4+ file rule and complexity criteria",
-        args: {},
-        async execute(args, context) {
-          const { sessionID } = context
-
-          const messagesResponse = await client.session.messages({
-            path: { id: sessionID },
-          })
-
-          if (messagesResponse.error) {
-            return `Error: ${messagesResponse.error}`
-          }
-
-          const messages = messagesResponse.data || []
-          const analysis = analyzeDelegationDecisions(messages)
-
-          return formatDelegationAnalysis(analysis)
-        },
-      }),
-
-      // Analyze context file reads
-      analyze_context_reads: tool({
-        description: "Show all context files that were read during the session (e.g., .opencode/agent/openagent.md)",
-        args: {},
-        async execute(args, context) {
-          const { sessionID } = context
-
-          // Filter behavior log for context file reads
-          const contextReads = behaviorLog.filter(
-            log => log.sessionID === sessionID && log.event === "context_file_read"
-          )
-
-          if (contextReads.length === 0) {
-            return "📚 No context files read in this session yet.\n\nContext files are in `.opencode/` directories (agent definitions, workflows, standards, etc.)"
-          }
-
-          const lines: string[] = [
-            `## Context Files Read`,
-            ``,
-            `**Total reads:** ${contextReads.length}`,
-            ``,
-          ]
-
-          // Group by file path
-          const fileReadCounts = new Map<string, number>()
-          contextReads.forEach(log => {
-            const filePath = log.data.filePath
-            fileReadCounts.set(filePath, (fileReadCounts.get(filePath) || 0) + 1)
-          })
-
-          // Sort by read count (most read first)
-          const sorted = Array.from(fileReadCounts.entries()).sort((a, b) => b[1] - a[1])
-
-          lines.push(`### Files Read:`)
-          sorted.forEach(([filePath, count]) => {
-            const fileName = filePath.split('/').pop()
-            const readText = count === 1 ? "read" : "reads"
-            lines.push(`- **${fileName}** (${count} ${readText})`)
-            lines.push(`  \`${filePath}\``)
-          })
-
-          lines.push(``)
-          lines.push(`### Timeline:`)
-          contextReads.forEach((log, idx) => {
-            const time = new Date(log.timestamp).toLocaleTimeString()
-            const fileName = log.data.filePath.split('/').pop()
-            lines.push(`${idx + 1}. [${time}] ${fileName}`)
-          })
-
-          return lines.join("\n")
-        },
-      }),
-
-      // Check context loading compliance
-      check_context_compliance: tool({
-        description: "Check if required context files were read BEFORE executing tasks (e.g., read docs.md before writing documentation)",
-        args: {},
-        async execute(args, context) {
-          const { sessionID } = context
-
-          const messagesResponse = await client.session.messages({
-            path: { id: sessionID },
-          })
-
-          if (messagesResponse.error) {
-            return `Error: ${messagesResponse.error}`
-          }
-
-          const messages = messagesResponse.data || []
-          const sessionBehaviorLog = behaviorLog.filter(log => log.sessionID === sessionID)
-          
-          const checks = analyzeContextLoadingCompliance(messages, sessionBehaviorLog)
-
-          if (checks.length === 0) {
-            return "📋 No tasks detected that require specific context files.\n\nContext loading rules apply when:\n- Writing documentation → should read standards/docs.md\n- Writing code → should read standards/code.md\n- Reviewing code → should read workflows/review.md\n- Delegating tasks → should read workflows/delegation.md\n- Writing tests → should read standards/tests.md"
-          }
-
-          const passed = checks.filter(c => c.passed).length
-          const failed = checks.filter(c => !c.passed).length
-          const score = Math.round((passed / checks.length) * 100)
-
-          const lines: string[] = [
-            `## Context Loading Compliance`,
-            ``,
-            `**Score:** ${score}%`,
-            `- ✅ Compliant: ${passed}`,
-            `- ⚠️  Non-compliant: ${failed}`,
-            ``,
-          ]
-
-          if (failed > 0) {
-            lines.push(`### ⚠️  Issues Found:`)
-            checks.filter(c => !c.passed).forEach(check => {
-              lines.push(`- ${check.details}`)
-            })
-            lines.push(``)
-          }
-
-          if (passed > 0) {
-            lines.push(`### ✅ Compliant Actions:`)
-            checks.filter(c => c.passed).forEach(check => {
-              lines.push(`- ${check.details}`)
-            })
-            lines.push(``)
-          }
-
-          lines.push(`### Context Loading Rules:`)
-          lines.push(`According to OpenAgent prompt, the agent should:`)
-          lines.push(`1. Detect task type from user request`)
-          lines.push(`2. Read required context file FIRST`)
-          lines.push(`3. Then execute task following those standards`)
-          lines.push(``)
-          lines.push(`**Pattern:** "Fetch context BEFORE starting work, not during or after"`)
-
-          return lines.join("\n")
-        },
-      }),
-
-      // Analyze which agents were used
-      analyze_agent_usage: tool({
-        description: "Show which agents were active during the session and what tools they used",
-        args: {},
-        async execute(args, context) {
-          const { sessionID } = context
-
-          const sessionBehaviorLog = behaviorLog.filter(log => log.sessionID === sessionID)
-
-          if (sessionBehaviorLog.length === 0) {
-            return "📊 No agent activity tracked yet in this session."
-          }
-
-          // Group by agent
-          const agentStats = new Map<string, {
-            toolCalls: Map<string, number>
-            events: string[]
-            firstSeen: number
-            lastSeen: number
-          }>()
-
-          sessionBehaviorLog.forEach(log => {
-            const agent = log.agent || "unknown"
-            
-            if (!agentStats.has(agent)) {
-              agentStats.set(agent, {
-                toolCalls: new Map(),
-                events: [],
-                firstSeen: log.timestamp,
-                lastSeen: log.timestamp
-              })
-            }
-
-            const stats = agentStats.get(agent)!
-            stats.lastSeen = log.timestamp
-            stats.events.push(log.event)
-
-            // Track tool usage
-            if (log.event === "execution_tool_called" || log.event === "tool_executed") {
-              const tool = log.data.tool
-              stats.toolCalls.set(tool, (stats.toolCalls.get(tool) || 0) + 1)
-            }
-          })
-
-          const lines: string[] = [
-            `## Agent Usage Report`,
-            ``,
-            `**Agents detected:** ${agentStats.size}`,
-            `**Total events:** ${sessionBehaviorLog.length}`,
-            ``,
-          ]
-
-          // Sort agents by first seen
-          const sortedAgents = Array.from(agentStats.entries()).sort((a, b) => a[1].firstSeen - b[1].firstSeen)
-
-          sortedAgents.forEach(([agent, stats]) => {
-            const duration = stats.lastSeen - stats.firstSeen
-            const durationStr = duration > 0 ? `${Math.round(duration / 1000)}s` : "instant"
-            
-            lines.push(`### ${agent === "unknown" ? "Unknown Agent" : agent}`)
-            lines.push(``)
-            lines.push(`**Active duration:** ${durationStr}`)
-            lines.push(`**Events:** ${stats.events.length}`)
-            
-            if (stats.toolCalls.size > 0) {
-              lines.push(``)
-              lines.push(`**Tools used:**`)
-              const sortedTools = Array.from(stats.toolCalls.entries()).sort((a, b) => b[1] - a[1])
-              sortedTools.forEach(([tool, count]) => {
-                lines.push(`- ${tool}: ${count}x`)
-              })
-            }
-            
-            lines.push(``)
-          })
-
-          return lines.join("\n")
-        },
-      }),
-
-      // Debug tool to inspect tracking
-      debug_validator: tool({
-        description: "Debug tool to inspect what the validator is tracking (behavior log, messages, etc.)",
-        args: {},
-        async execute(args, context) {
-          const { sessionID } = context
-          
-          // Debug tool - gather information silently
-
-          // Get messages from SDK
-          const messagesResponse = await client.session.messages({
-            path: { id: sessionID },
-          })
-
-          const messages = messagesResponse.data || []
-          const sessionBehaviorLog = behaviorLog.filter(log => log.sessionID === sessionID)
-          const tracker = toolExecutionTracker.get(sessionID)
-
-          const debug = {
-            sessionID,
-            behaviorLogEntries: sessionBehaviorLog.length,
-            behaviorLogSampleFirst: sessionBehaviorLog.slice(0, 3),
-            behaviorLogSampleLast: sessionBehaviorLog.slice(-3),
-            messagesCount: messages.length,
-            messagesSample: messages.slice(0, 2).map(m => ({
-              role: m.info?.role,
-              partsCount: m.parts?.length,
-              partTypes: m.parts?.map((p: any) => p.type),
-            })),
-            toolTracker: tracker ? {
-              approvalRequested: tracker.approvalRequested,
-              toolsExecuted: tracker.toolsExecuted,
-            } : null,
-            allBehaviorLogs: behaviorLog.length,
-          }
-
-          return `## Debug Information\n\n\`\`\`json\n${JSON.stringify(debug, null, 2)}\n\`\`\`\n\n**Analysis:**\n- Behavior log entries for this session: ${sessionBehaviorLog.length}\n- Total behavior log entries: ${behaviorLog.length}\n- Messages in session: ${messages.length}\n- Tool execution tracker: ${tracker ? 'Active' : 'None'}`
-        },
-      }),
-    },
-  }
-}
-
-// Validation logic
-interface ValidationCheck {
-  rule: string
-  passed: boolean
-  severity: "info" | "warning" | "error"
-  details: string
-  evidence?: any
-}
-
-interface ValidationResult {
-  sessionID: string
-  checks: ValidationCheck[]
-  summary: {
-    passed: number
-    failed: number
-    warnings: number
-    score: number
-  }
-}
-
-async function validateSessionBehavior(input: {
-  sessionID: string
-  messages: any[]
-  behaviorLog: any[]
-  includeDetails: boolean
-}): Promise<ValidationResult> {
-  const checks: ValidationCheck[] = []
-
-  // Check 1: Tool usage patterns
-  const toolUsage = analyzeToolUsage(input.messages)
-  checks.push(...toolUsage)
-
-  // Check 2: Approval gate enforcement
-  const approvalChecks = analyzeApprovalGates(input.messages, input.behaviorLog)
-  checks.push(...approvalChecks)
-
-  // Check 3: Lazy context loading
-  const contextChecks = analyzeContextLoading(input.messages)
-  checks.push(...contextChecks)
-
-  // Check 4: Delegation appropriateness
-  const delegationChecks = analyzeDelegation(input.messages)
-  checks.push(...delegationChecks)
-
-  // Check 5: Critical rule compliance
-  const criticalChecks = analyzeCriticalRules(input.messages)
-  checks.push(...criticalChecks)
-
-  // Check 6: Context loading compliance (read required files BEFORE execution)
-  const contextComplianceChecks = analyzeContextLoadingCompliance(input.messages, input.behaviorLog)
-  checks.push(...contextComplianceChecks)
-
-  // Calculate summary
-  const passed = checks.filter(c => c.passed).length
-  const failed = checks.filter(c => !c.passed && c.severity === "error").length
-  const warnings = checks.filter(c => !c.passed && c.severity === "warning").length
-  const score = checks.length > 0 ? Math.round((passed / checks.length) * 100) : 0
-
-  return {
-    sessionID: input.sessionID,
-    checks,
-    summary: { passed, failed, warnings, score },
-  }
-}
-
-function analyzeToolUsage(messages: any[]): ValidationCheck[] {
-  const checks: ValidationCheck[] = []
-  
-  for (const msg of messages) {
-    // Messages have structure: { info: Message, parts: Part[] }
-    const role = msg.info?.role || msg.role
-    if (role !== "assistant") continue
-    
-    const tools = extractToolsFromMessage(msg)
-    
-    if (tools.length > 0) {
-      checks.push({
-        rule: "tool_usage",
-        passed: true,
-        severity: "info",
-        details: `Used ${tools.length} tool(s): ${tools.join(", ")}`,
-      })
-    }
-  }
-
-  return checks
-}
-
-function analyzeApprovalGates(messages: any[], behaviorLog: any[]): ValidationCheck[] {
-  const checks: ValidationCheck[] = []
-  const executionTools = ["bash", "write", "edit", "task"]
-
-  for (let i = 0; i < messages.length; i++) {
-    const msg = messages[i]
-    const role = msg.info?.role || msg.role
-    if (role !== "assistant") continue
-
-    const tools = extractToolsFromMessage(msg)
-    const executionOps = tools.filter(t => executionTools.includes(t))
-
-    if (executionOps.length > 0) {
-      // Check if approval language is present in this message OR in recent previous messages
-      let hasApprovalRequest = checkForApprovalLanguage(msg)
-      
-      // Look back up to 3 messages to find approval request
-      if (!hasApprovalRequest) {
-        for (let j = Math.max(0, i - 3); j < i; j++) {
-          const prevMsg = messages[j]
-          const prevRole = prevMsg.info?.role || prevMsg.role
-          if (prevRole === "assistant" && checkForApprovalLanguage(prevMsg)) {
-            // Check if there's a user approval response after the request
-            if (j + 1 < messages.length) {
-              const userResponse = messages[j + 1]
-              const userRole = userResponse.info?.role || userResponse.role
-              if (userRole === "user" && checkForUserApproval(userResponse)) {
-                hasApprovalRequest = true
-                break
-              }
-            }
-          }
-        }
-      }
-
-      checks.push({
-        rule: "approval_gate_enforcement",
-        passed: hasApprovalRequest,
-        severity: hasApprovalRequest ? "info" : "warning",
-        details: hasApprovalRequest
-          ? `Properly requested approval before ${executionOps.length} execution op(s)`
-          : `⚠️ Executed ${executionOps.length} operation(s) without explicit approval request`,
-        evidence: { executionOps, hasApprovalRequest },
-      })
-    }
-  }
-
-  return checks
-}
-
-function analyzeContextLoading(messages: any[]): ValidationCheck[] {
-  const checks: ValidationCheck[] = []
-
-  for (const msg of messages) {
-    const role = msg.info?.role || msg.role
-    if (role !== "assistant") continue
-
-    // Look for read operations on .opencode/context/ files
-    const contextReads = extractContextReads(msg)
-
-    if (contextReads.length > 0) {
-      checks.push({
-        rule: "lazy_context_loading",
-        passed: true,
-        severity: "info",
-        details: `Lazy-loaded ${contextReads.length} context file(s): ${contextReads.join(", ")}`,
-      })
-    }
-  }
-
-  return checks
-}
-
-function analyzeDelegation(messages: any[]): ValidationCheck[] {
-  const checks: ValidationCheck[] = []
-
-  for (const msg of messages) {
-    const role = msg.info?.role || msg.role
-    if (role !== "assistant") continue
-
-    const tools = extractToolsFromMessage(msg)
-    const hasDelegation = tools.includes("task")
-    const writeEditCount = tools.filter(t => t === "write" || t === "edit").length
-
-    if (hasDelegation) {
-      const shouldDelegate = writeEditCount >= 4
-
-      checks.push({
-        rule: "delegation_appropriateness",
-        passed: shouldDelegate,
-        severity: shouldDelegate ? "info" : "warning",
-        details: shouldDelegate
-          ? `Appropriately delegated (${writeEditCount} files)`
-          : `Delegated but only ${writeEditCount} files (< 4 threshold)`,
-      })
-    } else if (writeEditCount >= 4) {
-      checks.push({
-        rule: "delegation_appropriateness",
-        passed: false,
-        severity: "warning",
-        details: `Should have delegated (${writeEditCount} files >= 4 threshold)`,
-      })
-    }
-  }
-
-  return checks
-}
-
-function analyzeCriticalRules(messages: any[]): ValidationCheck[] {
-  const checks: ValidationCheck[] = []
-
-  // Look for auto-fix attempts after errors
-  for (let i = 0; i < messages.length - 1; i++) {
-    const msg = messages[i]
-    const nextMsg = messages[i + 1]
-
-    const role = msg.info?.role || msg.role
-    const metadata = msg.info?.metadata || msg.metadata
-
-    if (role === "assistant" && metadata?.error) {
-      const nextTools = extractToolsFromMessage(nextMsg)
-      const hasAutoFix = nextTools.some(t => ["write", "edit", "bash"].includes(t))
-
-      if (hasAutoFix) {
-        checks.push({
-          rule: "stop_on_failure",
-          passed: false,
-          severity: "error",
-          details: "⛔ Auto-fix attempted after error - violates stop_on_failure rule",
-          evidence: { error: metadata.error, autoFixTools: nextTools },
-        })
-      }
-    }
-  }
-
-  return checks
-}
-
-function analyzeContextLoadingCompliance(messages: any[], behaviorLog: any[]): ValidationCheck[] {
-  const checks: ValidationCheck[] = []
-  
-  // Define required context files for different task types
-  const contextRules = [
-    {
-      taskKeywords: ["write doc", "create doc", "documentation", "write readme", "document"],
-      requiredFile: "standards/docs.md",
-      taskType: "documentation"
-    },
-    {
-      taskKeywords: ["write code", "create function", "implement", "add feature", "build"],
-      requiredFile: "standards/code.md",
-      taskType: "code writing"
-    },
-    {
-      taskKeywords: ["review code", "check code", "analyze code", "code review"],
-      requiredFile: "workflows/review.md",
-      taskType: "code review"
-    },
-    {
-      taskKeywords: ["delegate", "create task", "subagent"],
-      requiredFile: "workflows/delegation.md",
-      taskType: "delegation"
-    },
-    {
-      taskKeywords: ["write test", "create test", "test coverage", "unit test"],
-      requiredFile: "standards/tests.md",
-      taskType: "testing"
-    }
-  ]
-
-  // Get all context file reads from behavior log
-  const contextReads = behaviorLog
-    .filter(log => log.event === "context_file_read")
-    .map(log => ({
-      timestamp: log.timestamp,
-      filePath: log.data.filePath
-    }))
-
-  // Analyze each message for task execution
-  for (let i = 0; i < messages.length; i++) {
-    const msg = messages[i]
-    const role = msg.info?.role || msg.role
-    
-    if (role !== "assistant") continue
-
-    const tools = extractToolsFromMessage(msg)
-    const executionTools = tools.filter(t => ["write", "edit", "bash", "task"].includes(t))
-    
-    if (executionTools.length === 0) continue
-
-    // Get message text to detect task type
-    const messageText = extractMessageText(msg).toLowerCase()
-    
-    // Check if this message matches any context loading rules
-    for (const rule of contextRules) {
-      const matchesTask = rule.taskKeywords.some(keyword => messageText.includes(keyword))
-      
-      if (matchesTask) {
-        // Check if required context file was read BEFORE this message
-        const msgTimestamp = msg.info?.timestamp || Date.now()
-        const contextReadBefore = contextReads.some(read => 
-          read.filePath.includes(rule.requiredFile) && read.timestamp < msgTimestamp
-        )
-
-        checks.push({
-          rule: "context_loading_compliance",
-          passed: contextReadBefore,
-          severity: contextReadBefore ? "info" : "warning",
-          details: contextReadBefore
-            ? `✅ Loaded ${rule.requiredFile} before ${rule.taskType}`
-            : `⚠️ Did not load ${rule.requiredFile} before ${rule.taskType} task`,
-          evidence: {
-            taskType: rule.taskType,
-            requiredFile: rule.requiredFile,
-            contextReadBefore,
-            executionTools
-          }
-        })
-      }
-    }
-  }
-
-  return checks
-}
-
-function analyzeDelegationDecisions(messages: any[]): {
-  delegations: number
-  appropriate: number
-  inappropriate: number
-  fileCountStats: number[]
-} {
-  const stats = {
-    delegations: 0,
-    appropriate: 0,
-    inappropriate: 0,
-    fileCountStats: [] as number[],
-  }
-
-  for (const msg of messages) {
-    const role = msg.info?.role || msg.role
-    if (role !== "assistant") continue
-
-    const tools = extractToolsFromMessage(msg)
-    const hasDelegation = tools.includes("task")
-    const writeEditCount = tools.filter(t => t === "write" || t === "edit").length
-
-    if (hasDelegation) {
-      stats.delegations++
-      stats.fileCountStats.push(writeEditCount)
-      
-      if (writeEditCount >= 4) {
-        stats.appropriate++
-      } else {
-        stats.inappropriate++
-      }
-    }
-  }
-
-  return stats
-}
-
-// Helper functions
-function extractToolsFromMessage(msg: any): string[] {
-  const tools: string[] = []
-  
-  // Messages from SDK have structure: { info: Message, parts: Part[] }
-  const parts = msg.parts || []
-
-  for (const part of parts) {
-    // Check for tool type (from SDK: part.type === "tool")
-    if (part.type === "tool" && part.tool) {
-      tools.push(part.tool)
-    }
-    // Also check for tool-invocation format (legacy)
-    if (part.type === "tool-invocation" && part.toolInvocation) {
-      tools.push(part.toolInvocation.toolName)
-    }
-  }
-
-  return tools
-}
-
-function extractMessageText(msg: any): string {
-  if (!msg.parts) return ""
-  
-  let text = ""
-  for (const part of msg.parts) {
-    if (part.type === "text" && part.text) {
-      text += part.text + " "
-    }
-  }
-  
-  return text.trim()
-}
-
-function extractContextReads(msg: any): string[] {
-  const contextFiles: string[] = []
-  
-  if (!msg.parts) return contextFiles
-
-  for (const part of msg.parts) {
-    if (part.type === "tool-invocation" && 
-        part.toolInvocation?.toolName === "read" &&
-        part.toolInvocation?.args?.target_file?.includes(".opencode/context/")) {
-      contextFiles.push(part.toolInvocation.args.target_file)
-    }
-  }
-
-  return contextFiles
-}
-
-// Formatting functions
-function formatValidationReport(validation: ValidationResult): string {
-  const { summary, checks } = validation
-  
-  const lines: string[] = [
-    `## Validation Report`,
-    ``,
-    `**Score:** ${summary.score}%`,
-    `- ✅ Passed: ${summary.passed}`,
-    `- ⚠️  Warnings: ${summary.warnings}`,
-    `- ❌ Failed: ${summary.failed}`,
-    ``,
-  ]
-
-  // Group by severity
-  const errors = checks.filter(c => !c.passed && c.severity === "error")
-  const warnings = checks.filter(c => !c.passed && c.severity === "warning")
-
-  if (errors.length > 0) {
-    lines.push(`### ❌ Errors`)
-    errors.forEach(check => {
-      lines.push(`- **${check.rule}**: ${check.details}`)
-    })
-    lines.push(``)
-  }
-
-  if (warnings.length > 0) {
-    lines.push(`### ⚠️  Warnings`)
-    warnings.forEach(check => {
-      lines.push(`- **${check.rule}**: ${check.details}`)
-    })
-    lines.push(``)
-  }
-
-  return lines.join("\n")
-}
-
-function formatDelegationAnalysis(analysis: any): string {
-  const lines: string[] = [
-    `## Delegation Analysis`,
-    ``,
-    `**Total delegations:** ${analysis.delegations}`,
-    `- ✅ Appropriate: ${analysis.appropriate}`,
-    `- ⚠️  Questionable: ${analysis.inappropriate}`,
-    ``,
-  ]
-
-  if (analysis.fileCountStats.length > 0) {
-    const avg = analysis.fileCountStats.reduce((a: number, b: number) => a + b, 0) / analysis.fileCountStats.length
-    lines.push(`**File count per delegation:**`)
-    lines.push(`- Average: ${avg.toFixed(1)} files`)
-    lines.push(`- Range: ${Math.min(...analysis.fileCountStats)} - ${Math.max(...analysis.fileCountStats)} files`)
-    lines.push(`- Threshold: 4+ files`)
-  }
-
-  return lines.join("\n")
-}
-
-function generateDetailedReport(validation: ValidationResult, messages: any[]): string {
-  const lines: string[] = [
-    `# Agent Validation Report`,
-    ``,
-    `**Session:** ${validation.sessionID}`,
-    `**Generated:** ${new Date().toISOString()}`,
-    `**Messages analyzed:** ${messages.length}`,
-    ``,
-    formatValidationReport(validation),
-    ``,
-    `## Detailed Checks`,
-    ``,
-  ]
-
-  validation.checks.forEach(check => {
-    const icon = check.passed ? "✅" : check.severity === "error" ? "❌" : "⚠️"
-    lines.push(`### ${icon} ${check.rule}`)
-    lines.push(``)
-    lines.push(check.details)
-    lines.push(``)
-    
-    if (check.evidence) {
-      lines.push(`**Evidence:**`)
-      lines.push(`\`\`\`json`)
-      lines.push(JSON.stringify(check.evidence, null, 2))
-      lines.push(`\`\`\``)
-      lines.push(``)
-    }
-  })
-
-  return lines.join("\n")
-}
-
-export default AgentValidatorPlugin

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

@@ -199,9 +199,9 @@ analyze_context_reads
 
 ### Files Read:
 - **code.md** (2 reads)
-  `.opencode/context/core/standards/code-quality.md`
+  `.opencode/context/core/standards/code.md`
 - **delegation.md** (1 read)
-  `.opencode/context/core/workflows/task-delegation.md`
+  `.opencode/context/core/workflows/delegation.md`
 
 ### Timeline:
 1. [10:23:45] code.md
@@ -234,8 +234,8 @@ check_context_compliance
 - ⚠️  Non-compliant: 0
 
 ### ✅ Compliant Actions:
-- ✅ Loaded standards/code-quality.md before code writing
-- ✅ Loaded workflows/task-delegation.md before delegation
+- ✅ Loaded standards/code.md before code writing
+- ✅ Loaded workflows/delegation.md before delegation
 
 ### Context Loading Rules:
 According to OpenAgent prompt, the agent should:
@@ -247,11 +247,11 @@ According to OpenAgent prompt, the agent should:
 ```
 
 **Context loading rules:**
-- Writing code → should read `standards/code-quality.md`
-- 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`
+- Writing code → should read `standards/code.md`
+- Writing docs → should read `standards/docs.md`
+- Writing tests → should read `standards/tests.md`
+- Code review → should read `workflows/review.md`
+- Delegating → should read `workflows/delegation.md`
 
 **When to use:**
 - To verify lazy loading is working
@@ -467,7 +467,7 @@ opencode --agent openagent
 # 3. Verify compliance
 > "check_context_compliance"
 
-# Expected: Should show standards/code-quality.md was read BEFORE writing
+# Expected: Should show standards/code.md was read BEFORE writing
 ```
 
 ---

+ 1 - 1
.opencode/plugin/telegram-notify.ts

@@ -1,5 +1,5 @@
 import type { Plugin } from "@opencode-ai/plugin"
-import { SimpleTelegramBot } from "../_lib/telegram-bot"
+import { SimpleTelegramBot } from "./lib/telegram-bot"
 
 // 🔧 CONFIGURATION: Set to true to enable this plugin
 const ENABLED = false

+ 0 - 489
.opencode/scripts/task-cli.ts

@@ -1,489 +0,0 @@
-#!/usr/bin/env node
-/**
- * Task Management CLI
- *
- * Usage: npx ts-node .opencode/scripts/task-cli.ts <command> [args...]
- *
- * Tasks are stored in: .tmp/tasks/active/{feature}/ and .tmp/tasks/completed/{feature}/
- *
- * 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
- *   init                          - Create .tmp/tasks/ directory structure
- */
-
-import * as fs from 'node:fs';
-import * as path from 'node:path';
-
-// Tasks stored in project root .tmp/tasks/
-const PROJECT_ROOT = process.cwd();
-const TASKS_ROOT = path.join(PROJECT_ROOT, '.tmp', 'tasks');
-const ACTIVE_DIR = path.join(TASKS_ROOT, 'active');
-const COMPLETED_DIR = path.join(TASKS_ROOT, 'completed');
-
-interface Task {
-  id: string;
-  name: string;
-  status: 'active' | 'completed' | 'blocked' | 'archived';
-  objective: string;
-  context_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[];
-  acceptance_criteria: string[];
-  deliverables: string[];
-  agent_id: string | null;
-  started_at: string | null;
-  completed_at: string | null;
-  completion_summary: string | null;
-}
-
-// Helpers
-function ensureDir(dir: string): void {
-  if (!fs.existsSync(dir)) {
-    fs.mkdirSync(dir, { recursive: true });
-  }
-}
-
-function getFeatureDirs(): string[] {
-  if (!fs.existsSync(ACTIVE_DIR)) return [];
-  return fs.readdirSync(ACTIVE_DIR).filter((f: string) =>
-    fs.statSync(path.join(ACTIVE_DIR, f)).isDirectory()
-  );
-}
-
-function loadTask(feature: string): Task | null {
-  const taskPath = path.join(ACTIVE_DIR, feature, 'task.json');
-  if (!fs.existsSync(taskPath)) return null;
-  return JSON.parse(fs.readFileSync(taskPath, 'utf-8')) as Task;
-}
-
-function loadSubtasks(feature: string): Subtask[] {
-  const featureDir = path.join(ACTIVE_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')) as Subtask
-  );
-}
-
-function saveSubtask(feature: string, subtask: Subtask): void {
-  const subtaskPath = path.join(ACTIVE_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(ACTIVE_DIR, feature, 'task.json');
-  fs.writeFileSync(taskPath, JSON.stringify(task, null, 2));
-}
-
-// Commands
-function cmdInit(): void {
-  ensureDir(ACTIVE_DIR);
-  ensureDir(COMPLETED_DIR);
-  console.log(`\n✓ Created task directories:`);
-  console.log(`  ${ACTIVE_DIR}`);
-  console.log(`  ${COMPLETED_DIR}`);
-}
-
-function cmdStatus(feature?: string): void {
-  const features = feature ? [feature] : getFeatureDirs();
-
-  if (features.length === 0) {
-    console.log('No active features found in .tmp/tasks/active/');
-    console.log('Run `task-cli.ts init` to create directories.');
-    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: Subtask) => s.status === 'pending').length,
-      in_progress: subtasks.filter((s: Subtask) => s.status === 'in_progress').length,
-      completed: subtasks.filter((s: Subtask) => s.status === 'completed').length,
-      blocked: subtasks.filter((s: Subtask) => 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: Subtask) => s.status === 'completed').map((s: Subtask) => s.seq)
-    );
-
-    const ready = subtasks.filter((s: Subtask) => {
-      if (s.status !== 'pending') return false;
-      return s.depends_on.every((dep: string) => 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=== Parallel Tasks Ready Now ===\n');
-
-  for (const f of features) {
-    const subtasks = loadSubtasks(f);
-    const completedSeqs = new Set(
-      subtasks.filter((s: Subtask) => s.status === 'completed').map((s: Subtask) => s.seq)
-    );
-
-    const parallel = subtasks.filter((s: Subtask) => {
-      if (s.status !== 'pending') return false;
-      if (!s.parallel) return false;
-      return s.depends_on.every((dep: string) => 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: Subtask) => 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: Subtask) => 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: Subtask) => s.status === 'completed').map((s: Subtask) => s.seq)
-    );
-
-    const blocked = subtasks.filter((s: Subtask) => {
-      if (s.status === 'blocked') return true;
-      if (s.status !== 'pending') return false;
-      return !s.depends_on.every((dep: string) => completedSeqs.has(dep));
-    });
-
-    if (blocked.length > 0) {
-      console.log(`[${f}]`);
-      for (const s of blocked) {
-        const waitingFor = s.depends_on.filter((dep: string) => !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: Subtask) => 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: Subtask) => 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: Subtask) => 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 = (currentSeq: string, pathArr: string[]): boolean => {
-        if (pathArr.includes(currentSeq)) {
-          errors.push(`${s.seq}: circular dependency detected: ${[...pathArr, currentSeq].join(' -> ')}`);
-          return true;
-        }
-        if (visited.has(currentSeq)) return false;
-        visited.add(currentSeq);
-
-        const currentTask = subtasks.find((t: Subtask) => t.seq === currentSeq);
-        if (currentTask) {
-          for (const dep of currentTask.depends_on) {
-            if (checkCircular(dep, [...pathArr, currentSeq])) return true;
-          }
-        }
-        return false;
-      };
-      checkCircular(s.seq, []);
-
-      // Warnings
-      if (s.acceptance_criteria.length === 0) {
-        warnings.push(`${s.seq}: No acceptance criteria defined`);
-      }
-      if (s.deliverables.length === 0) {
-        warnings.push(`${s.seq}: No deliverables defined`);
-      }
-    }
-
-    // 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 && 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 cmdArchive(feature: string): void {
-  const task = loadTask(feature);
-  if (!task) {
-    console.log(`Feature ${feature} not found`);
-    process.exit(1);
-  }
-
-  const subtasks = loadSubtasks(feature);
-  const completedCount = subtasks.filter((s: Subtask) => s.status === 'completed').length;
-
-  if (completedCount !== subtasks.length) {
-    console.log(`Cannot archive: ${completedCount}/${subtasks.length} tasks completed`);
-    process.exit(1);
-  }
-
-  // Update task status
-  task.status = 'completed';
-  task.completed_at = new Date().toISOString();
-  saveTask(feature, task);
-
-  // Move to completed
-  const srcDir = path.join(ACTIVE_DIR, feature);
-  const destDir = path.join(COMPLETED_DIR, feature);
-  ensureDir(COMPLETED_DIR);
-  fs.renameSync(srcDir, destDir);
-
-  console.log(`\n✓ Archived ${feature} to .tmp/tasks/completed/`);
-}
-
-// Main
-const [,, command, ...args] = process.argv;
-
-switch (command) {
-  case 'init':
-    cmdInit();
-    break;
-  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 'archive':
-    if (!args[0]) {
-      console.log('Usage: archive <feature>');
-      process.exit(1);
-    }
-    cmdArchive(args[0]);
-    break;
-  default:
-    console.log(`
-Task Management CLI
-
-Location: .tmp/tasks/active/{feature}/ and .tmp/tasks/completed/{feature}/
-
-Usage: npx ts-node .opencode/scripts/task-cli.ts <command> [args...]
-
-Commands:
-  init                              Create .tmp/tasks/ directory structure
-  status [feature]                  Show task status summary
-  next [feature]                    Show next eligible tasks (deps satisfied)
-  parallel [feature]                Show parallel 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
-  archive <feature>                 Move completed feature to completed/
-
-Examples:
-  npx ts-node .opencode/scripts/task-cli.ts init
-  npx ts-node .opencode/scripts/task-cli.ts status
-  npx ts-node .opencode/scripts/task-cli.ts next my-feature
-  npx ts-node .opencode/scripts/task-cli.ts complete my-feature 02 "Implemented auth module"
-`);
-}

+ 0 - 21
LICENSE

@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2025 Darren Hinde
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.

+ 4 - 6
README.md

@@ -5,7 +5,6 @@
 ### AI agent framework for plan-first development workflows with approval-based execution
 
 [![GitHub stars](https://img.shields.io/github/stars/darrenhinde/OpenAgents?style=social)](https://github.com/darrenhinde/OpenAgents/stargazers)
-[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/DarrenBuildsAI?style=social)](https://x.com/DarrenBuildsAI)
 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
 [![GitHub last commit](https://img.shields.io/github/last-commit/darrenhinde/OpenAgents)](https://github.com/darrenhinde/OpenAgents/commits/main)
 [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](docs/contributing/CONTRIBUTING.md)
@@ -251,7 +250,7 @@ User Request
 - **/test** - Testing workflows
 - **/clean** - Cleanup operations
 - **/context** - Context management
-- **/prompt-enhancer** - Improve your prompts
+- **/prompt-enchancer** - Improve your prompts
 - **/worktrees** - Git worktree management
 - **/validate-repo** - Validate repository consistency
 
@@ -590,12 +589,11 @@ opencode --agent opencoder
 - [OpenCoder Guide](docs/agents/opencoder.md) - Specialized development work
 
 ---
-## Support & Connect
+## Support This Work
 
-If this helped you out, I'd love to hear about it!
+If this helped you out and you're feeling generous, consider funding my coffee habit ☕
 
-- **Follow on X**: [@DarrenBuildsAI](https://x.com/DarrenBuildsAI) - I post updates on AI agents and OpenCode workflows.
-- **Support the Work**: [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow?style=for-the-badge&logo=buy-me-a-coffee)](https://buymeacoffee.com/darrenhinde)
+[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-Support-yellow?style=for-the-badge&logo=buy-me-a-coffee)](https://buymeacoffee.com/darrenhinde)
 
 Totally optional, but appreciated.
 

+ 0 - 12
dev/dashboard-project/main.js

@@ -1,12 +0,0 @@
-import { dashboardController } from './ui/index.js';
-
-/**
- * Main entry point for the Dashboard project.
- */
-const main = () => {
-  console.log('Initializing Dashboard...');
-  const output = dashboardController();
-  console.log(output);
-};
-
-main();

+ 0 - 7
dev/dashboard-project/package.json

@@ -1,7 +0,0 @@
-{
-  "name": "dashboard-project",
-  "version": "1.0.0",
-  "type": "module",
-  "description": "A modular dashboard project with Time, Period, and Star Sign APIs.",
-  "main": "main.js"
-}

+ 0 - 23
dev/dashboard-project/period/core.js

@@ -1,23 +0,0 @@
-/**
- * Core logic for the Period component.
- */
-
-export const PERIODS = {
-  DAY: 'day',
-  WEEK: 'week',
-  MONTH: 'month',
-  YEAR: 'year'
-};
-
-/**
- * Returns all available periods.
- * @returns {string[]}
- */
-export const getAvailablePeriods = () => Object.values(PERIODS);
-
-/**
- * Validates if a period is supported.
- * @param {string} period 
- * @returns {boolean}
- */
-export const isValidPeriod = (period) => getAvailablePeriods().includes(period);

+ 0 - 11
dev/dashboard-project/period/index.js

@@ -1,11 +0,0 @@
-import { getAvailablePeriods } from './core.js';
-import { success } from '../shared/utils.js';
-
-/**
- * Period API Handler.
- * @returns {Object}
- */
-export const getPeriodsHandler = () => {
-  const periods = getAvailablePeriods();
-  return success({ periods });
-};

+ 0 - 0
dev/dashboard-project/period/tests/period.test.js


+ 0 - 0
dev/dashboard-project/shared/index.js


+ 0 - 25
dev/dashboard-project/shared/utils.js

@@ -1,25 +0,0 @@
-/**
- * Shared utility functions for the Dashboard project.
- */
-
-/**
- * Wraps a value in a success object.
- * @param {*} data 
- * @returns {Object}
- */
-export const success = (data) => ({ success: true, data });
-
-/**
- * Wraps an error message in a failure object.
- * @param {string} error 
- * @returns {Object}
- */
-export const failure = (error) => ({ success: false, error });
-
-/**
- * Generates a random integer between min and max (inclusive).
- * @param {number} min 
- * @param {number} max 
- * @returns {number}
- */
-export const getRandomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;

+ 0 - 19
dev/dashboard-project/star-sign/core.js

@@ -1,19 +0,0 @@
-/**
- * Core logic for the Star Sign component.
- */
-
-export const STAR_SIGNS = [
-  'Aries', 'Taurus', 'Gemini', 'Cancer',
-  'Leo', 'Virgo', 'Libra', 'Scorpio',
-  'Sagittarius', 'Capricorn', 'Aquarius', 'Pisces'
-];
-
-/**
- * Returns a random star sign from the list.
- * @param {Function} getRandomInt - Dependency injection for randomness.
- * @returns {string}
- */
-export const getRandomStarSign = (getRandomInt) => {
-  const index = getRandomInt(0, STAR_SIGNS.length - 1);
-  return STAR_SIGNS[index];
-};

+ 0 - 11
dev/dashboard-project/star-sign/index.js

@@ -1,11 +0,0 @@
-import { getRandomStarSign } from './core.js';
-import { success, getRandomInt } from '../shared/utils.js';
-
-/**
- * Star Sign API Handler.
- * @returns {Object}
- */
-export const getStarSignHandler = () => {
-  const starSign = getRandomStarSign(getRandomInt);
-  return success({ starSign });
-};

+ 0 - 0
dev/dashboard-project/star-sign/tests/star-sign.test.js


+ 0 - 18
dev/dashboard-project/time/core.js

@@ -1,18 +0,0 @@
-/**
- * Core logic for the Time component.
- * Pure functions only.
- */
-
-/**
- * Returns the current time in ISO format.
- * @param {Date} [date=new Date()] - Optional date for testing.
- * @returns {string}
- */
-export const getCurrentTimeISO = (date = new Date()) => date.toISOString();
-
-/**
- * Formats a date to a human-readable string.
- * @param {Date} date 
- * @returns {string}
- */
-export const formatHumanReadable = (date) => date.toLocaleString();

+ 0 - 11
dev/dashboard-project/time/index.js

@@ -1,11 +0,0 @@
-import { getCurrentTimeISO } from './core.js';
-import { success } from '../shared/utils.js';
-
-/**
- * Time API Handler.
- * @returns {Object}
- */
-export const getTimeHandler = () => {
-  const time = getCurrentTimeISO();
-  return success({ time });
-};

+ 0 - 0
dev/dashboard-project/time/tests/time.test.js


+ 0 - 26
dev/dashboard-project/ui/core.js

@@ -1,26 +0,0 @@
-/**
- * Core logic for the Dashboard UI.
- * Pure functions for rendering/formatting.
- */
-
-/**
- * Renders the dashboard state into a string (simulating a UI component).
- * @param {Object} state 
- * @returns {string}
- */
-export const renderDashboard = (state) => {
-  const { time, periods, starSign } = state;
-  
-  return `
-=========================================
-          DASHBOARD OVERVIEW
-=========================================
-Current Time: ${time || 'Loading...'}
------------------------------------------
-Available Periods:
-${periods ? periods.map(p => `- ${p}`).join('\n') : 'Loading...'}
------------------------------------------
-Visitor Star Sign: ${starSign || 'Loading...'}
-=========================================
-  `;
-};

+ 0 - 23
dev/dashboard-project/ui/index.js

@@ -1,23 +0,0 @@
-import { renderDashboard } from './core.js';
-import { getTimeHandler } from '../time/index.js';
-import { getPeriodsHandler } from '../period/index.js';
-import { getStarSignHandler } from '../star-sign/index.js';
-
-/**
- * Dashboard UI Controller.
- * Orchestrates data fetching and rendering.
- * @returns {string}
- */
-export const dashboardController = () => {
-  const timeData = getTimeHandler();
-  const periodData = getPeriodsHandler();
-  const starSignData = getStarSignHandler();
-
-  const state = {
-    time: timeData.success ? timeData.data.time : 'Error',
-    periods: periodData.success ? periodData.data.periods : [],
-    starSign: starSignData.success ? starSignData.data.starSign : 'Error'
-  };
-
-  return renderDashboard(state);
-};

+ 0 - 0
dev/dashboard-project/ui/tests/ui.test.js


+ 0 - 757
docs/features/abilities-system/PLAN.md

@@ -1,757 +0,0 @@
-# Abilities System - Implementation Plan
-
-> **Status:** Planning Complete - Ready for Implementation  
-> **Issue:** [#33](https://github.com/darrenhinde/OpenAgents/issues/33)  
-> **Date:** December 31, 2025
-
----
-
-## Vision
-
-**Enforced, validated workflows that work with any agent and guarantee execution.**
-
-Abilities solve the fundamental problem with Skills: **LLMs ignore them**. With Abilities:
-- Steps **must** run (enforced via hooks)
-- Scripts run **deterministically** (no AI variance)
-- Validation **guarantees** each step completed
-- Multi-agent coordination **just works**
-
----
-
-## Problem Statement
-
-### Current State (Skills)
-
-| Issue | Impact |
-|-------|--------|
-| LLM ignores skill instructions | Critical steps skipped |
-| No enforcement mechanism | Can't guarantee execution |
-| No validation | Don't know if steps completed |
-| Pure AI (unpredictable) | Results vary each run |
-| Single agent only | No coordination |
-
-### Desired State (Abilities)
-
-| Feature | Benefit |
-|---------|---------|
-| Hook enforcement | AI **cannot** skip steps |
-| Script steps | Deterministic execution |
-| Validation rules | Guaranteed completion |
-| Multi-agent support | Coordinate any OpenAgents agent |
-| Approval gates | Human-in-the-loop where needed |
-
----
-
-## Architecture Overview
-
-```
-┌─────────────────────────────────────────────────────────────┐
-│                     USER / AGENT                            │
-│           "Deploy v1.2.3 to production"                     │
-└─────────────────────────────────────────────────────────────┘
-                              │
-                              ▼
-┌─────────────────────────────────────────────────────────────┐
-│                  TRIGGER DETECTION                          │
-│         Keywords / Patterns / Explicit Command              │
-└─────────────────────────────────────────────────────────────┘
-                              │
-                              ▼
-┌─────────────────────────────────────────────────────────────┐
-│                  INPUT VALIDATION                           │
-│              Zod Schema / Type Checking                     │
-└─────────────────────────────────────────────────────────────┘
-                              │
-                              ▼
-┌─────────────────────────────────────────────────────────────┐
-│                   PLAN APPROVAL                             │
-│            Show Steps → Get User Approval                   │
-└─────────────────────────────────────────────────────────────┘
-                              │
-                              ▼
-┌─────────────────────────────────────────────────────────────┐
-│                 ENFORCED EXECUTION                          │
-│                                                             │
-│   ┌─────────┐   ┌─────────┐   ┌─────────┐   ┌─────────┐   │
-│   │ Script  │ → │  Agent  │ → │Approval │ → │ Script  │   │
-│   │  Step   │   │  Step   │   │  Step   │   │  Step   │   │
-│   └─────────┘   └─────────┘   └─────────┘   └─────────┘   │
-│                                                             │
-│   Hooks block tools outside current step                    │
-└─────────────────────────────────────────────────────────────┘
-                              │
-                              ▼
-┌─────────────────────────────────────────────────────────────┐
-│                    COMPLETION                               │
-│           Report Results / Run After Hooks                  │
-└─────────────────────────────────────────────────────────────┘
-```
-
----
-
-## File Structure
-
-### Directory Layout
-
-```
-.opencode/
-├── abilities/                    # Root abilities folder
-│   ├── deploy/                   # Grouped by domain
-│   │   ├── ability.yaml          # Main ability definition
-│   │   ├── scripts/              # Associated scripts
-│   │   │   ├── test.sh
-│   │   │   ├── build.sh
-│   │   │   └── deploy.sh
-│   │   └── hooks/                # Optional hooks
-│   │       ├── before/
-│   │       │   └── validate.md
-│   │       └── after/
-│   │           └── notify.sh
-│   │
-│   ├── development/              # Another domain
-│   │   ├── build-feature/
-│   │   │   └── ability.yaml
-│   │   ├── refactor/
-│   │   │   └── ability.yaml
-│   │   └── test-suite/
-│   │       └── ability.yaml
-│   │
-│   └── simple-ability.yaml       # Can also be flat files
-│
-└── agents/
-    └── my-agent.md               # Agent with abilities attached
-```
-
-### Discovery Rules
-
-```
-Priority order:
-1. .opencode/abilities/**/*.yaml     (project - nested)
-2. .opencode/abilities/*.yaml        (project - flat)
-3. ~/.config/opencode/abilities/     (global)
-```
-
-### Naming Convention
-
-```yaml
-# File: .opencode/abilities/deploy/production/ability.yaml
-# Auto-generated name: deploy/production
-
-# Or explicit override:
-name: deploy-to-prod  # Custom name
-```
-
----
-
-## YAML Format Specification
-
-### Complete Example
-
-```yaml
-# ability.yaml
-name: safe-deploy                    # Unique identifier
-description: Deploy with safety checks
-version: 1.0.0                       # Optional versioning
-
-# ─────────────────────────────────────────────
-# TRIGGERS - When this ability activates
-# ─────────────────────────────────────────────
-triggers:
-  keywords:                          # Keyword matching
-    - "deploy"
-    - "ship it"
-    - "release to production"
-  patterns:                          # Regex patterns (optional)
-    - "deploy.*to.*prod"
-
-# ─────────────────────────────────────────────
-# INPUTS - Validated before execution
-# ─────────────────────────────────────────────
-inputs:
-  version:
-    type: string
-    required: true
-    pattern: '^v\d+\.\d+\.\d+$'      # Semver validation
-    description: "Version to deploy (e.g., v1.2.3)"
-  
-  environment:
-    type: string
-    required: true
-    enum: [staging, production]
-    default: staging
-
-# ─────────────────────────────────────────────
-# STEPS - Executed in order (enforced)
-# ─────────────────────────────────────────────
-steps:
-  - id: test
-    type: script
-    description: Run test suite
-    run: npm test
-    validation:
-      exit_code: 0
-    on_failure: stop
-    
-  - id: build
-    type: script
-    description: Build for target environment
-    run: npm run build -- --env={{inputs.environment}}
-    needs: [test]
-    timeout: 5m
-    
-  - id: review
-    type: agent
-    description: Security review
-    agent: reviewer
-    prompt: |
-      Review the build output for security issues.
-      Environment: {{inputs.environment}}
-    needs: [build]
-    
-  - id: approve
-    type: approval
-    description: Production approval
-    when: inputs.environment == "production"
-    prompt: |
-      Ready to deploy {{inputs.version}} to {{inputs.environment}}.
-      Proceed?
-    needs: [review]
-    
-  - id: deploy
-    type: script
-    description: Deploy to environment
-    run: ./scripts/deploy.sh {{inputs.environment}} {{inputs.version}}
-    needs: [approve]
-    validation:
-      exit_code: 0
-
-# ─────────────────────────────────────────────
-# SETTINGS - Ability-level configuration
-# ─────────────────────────────────────────────
-settings:
-  timeout: 30m                       # Total timeout
-  parallel: false                    # Sequential by default
-  enforcement: strict                # strict | normal | loose
-  on_failure: stop                   # Default failure behavior
-```
-
-### Step Types
-
-#### Script Step
-```yaml
-- id: test
-  type: script
-  run: npm test                      # Command to run
-  cwd: ./packages/api                # Working directory (optional)
-  env:                               # Environment variables
-    NODE_ENV: test
-  validation:
-    exit_code: 0                     # Required exit code
-    stdout_contains: "passed"        # Optional
-    file_exists: ./coverage/         # Optional
-  timeout: 10m
-  on_failure: stop | continue | retry
-  max_retries: 2
-```
-
-#### Agent Step
-```yaml
-- id: review
-  type: agent
-  agent: reviewer                    # Agent name (from OpenAgents)
-  prompt: "Review this code..."      # Task for agent
-  context:                           # Additional context (optional)
-    - ./src/
-    - {{steps.build.output}}
-  timeout: 5m
-  on_failure: stop
-```
-
-#### Skill Step
-```yaml
-- id: docs
-  type: skill
-  skill: generate-docs               # Skill name
-  inputs:                            # Skill inputs (optional)
-    format: markdown
-```
-
-#### Approval Step
-```yaml
-- id: approve
-  type: approval
-  prompt: "Deploy to production?"
-  options:                           # Custom options (optional)
-    - label: Approve
-      value: approved
-    - label: Reject
-      value: rejected
-  timeout: 1h                        # Auto-reject after timeout
-  when: inputs.environment == "production"
-```
-
-#### Workflow Step (Nested)
-```yaml
-- id: setup
-  type: workflow
-  workflow: setup-environment        # Call another ability
-  inputs:
-    env: {{inputs.environment}}
-```
-
-### Step Properties Reference
-
-| Property | Required | Default | Description |
-|----------|----------|---------|-------------|
-| `id` | Yes | - | Unique step identifier |
-| `type` | Yes | - | script, agent, skill, approval, workflow |
-| `description` | No | - | Human-readable description |
-| `needs` | No | `[]` | Dependencies (steps that must complete first) |
-| `when` | No | `true` | Conditional execution |
-| `timeout` | No | `5m` | Max duration |
-| `on_failure` | No | `stop` | stop, continue, retry, ask |
-| `max_retries` | No | `1` | Retry attempts (if retry) |
-
----
-
-## Attaching Abilities to Agents
-
-### Option A: Agent Frontmatter
-
-```markdown
----
-name: deploy-agent
-description: Handles deployments
-model: anthropic/claude-sonnet-4
-
-abilities:
-  - deploy/production
-  - deploy/staging
-  - rollback
----
-
-You are a deployment specialist...
-```
-
-### Option B: Global Config
-
-```json
-{
-  "agents": {
-    "deploy-agent": {
-      "abilities": ["deploy/production", "deploy/staging"]
-    }
-  }
-}
-```
-
-### Option C: Ability Specifies Agents
-
-```yaml
-# In ability.yaml
-compatible_agents:
-  - deploy-agent
-  - default
-```
-
----
-
-## Enforcement Mechanism
-
-### Hook-Based Enforcement
-
-```typescript
-// tool.execute.before - Block tools outside current step
-async "tool.execute.before"(ctx, tool) {
-  const ability = ctx.state.activeAbility
-  if (!ability) return
-  
-  const currentStep = ability.currentStep
-  
-  // Script steps block ALL tools
-  if (currentStep.type === 'script') {
-    throw new Error(`Step '${currentStep.id}' is running. Wait for completion.`)
-  }
-  
-  // Agent steps allow only that agent's tools
-  if (currentStep.type === 'agent') {
-    const allowed = getAgentTools(currentStep.agent)
-    if (!allowed.includes(tool.name)) {
-      throw new Error(`Tool '${tool.name}' not allowed in step '${currentStep.id}'`)
-    }
-  }
-}
-
-// chat.message - Inject ability context
-async "chat.message"(ctx, message) {
-  const ability = ctx.state.activeAbility
-  if (!ability) return
-  
-  message.parts.unshift({
-    type: "text",
-    synthetic: true,
-    text: `## Active Ability: ${ability.name}
-Current Step: ${ability.currentStep.id}
-Progress: ${ability.completedSteps.length}/${ability.steps.length}
-
-You MUST complete this step before proceeding.`
-  })
-}
-
-// session.idle - Prevent exit without completion
-async "session.idle"(ctx) {
-  const ability = ctx.state.activeAbility
-  if (ability?.status === 'running') {
-    return {
-      inject: `Ability '${ability.name}' is still running. Complete it first.`
-    }
-  }
-}
-```
-
-### Enforcement Levels
-
-| Level | Behavior |
-|-------|----------|
-| `strict` | Block ALL tools outside current step, cannot exit |
-| `normal` | Block destructive tools, can exit with warning |
-| `loose` | Advisory only, can skip with confirmation |
-
----
-
-## Context Passing
-
-### Automatic (Default)
-
-Steps with `needs` automatically receive prior step outputs:
-
-```yaml
-steps:
-  - id: research
-    agent: librarian
-    prompt: "Research: {{input}}"
-
-  - id: plan
-    agent: oracle
-    needs: [research]  # Gets research output automatically
-    prompt: "Create plan based on the research"
-```
-
-When `plan` runs, executor injects:
-
-```markdown
-## Context from prior steps
-
-### Step: research (librarian)
-[Full output from research step]
-
----
-
-## Your task
-Create plan based on the research
-```
-
-### Auto-Truncation
-
-Large outputs (>10k tokens) are automatically summarized before passing.
-
-### Manual Summary
-
-```yaml
-- id: research
-  agent: librarian
-  prompt: "Research: {{input}}"
-  summarize: true  # Condense output
-  # OR
-  summarize: "Extract only the key patterns"  # Custom prompt
-```
-
----
-
-## Validation System
-
-### Schema Validation (Zod)
-
-```typescript
-const AbilitySchema = z.object({
-  name: z.string().regex(/^[a-z0-9-/]+$/),
-  description: z.string(),
-  version: z.string().optional(),
-  triggers: TriggersSchema.optional(),
-  inputs: z.record(InputSchema).optional(),
-  steps: z.array(StepSchema).min(1),
-  settings: SettingsSchema.optional(),
-})
-```
-
-### Dependency Validation
-
-- Check all `needs` references exist
-- Detect circular dependencies
-- Verify agents exist
-
-### CLI Commands
-
-```bash
-/ability validate deploy/production    # Validate single
-/ability validate --all                # Validate all
-```
-
----
-
-## SDK Integration
-
-### Using from Subagents
-
-```typescript
-import { OpenCodeSDK } from '@opencode/sdk'
-
-const sdk = new OpenCodeSDK()
-
-// List abilities
-const abilities = await sdk.abilities.list()
-
-// Execute
-const result = await sdk.abilities.execute({
-  name: 'deploy/production',
-  inputs: { version: 'v1.2.3', environment: 'staging' }
-})
-
-// Check status
-const status = await sdk.abilities.status(result.executionId)
-
-// Wait for completion
-const final = await sdk.abilities.waitFor(result.executionId)
-```
-
----
-
-## Implementation Phases
-
-### Phase 1: Foundation (Week 1) ✅ COMPLETED
-
-- [x] File structure & discovery
-  - [x] Load from .opencode/abilities/ (nested + flat)
-  - [x] Load from global config
-  - [x] Name resolution from path
-
-- [x] YAML parser & validator
-  - [x] Zod schema for ability format
-  - [x] Dependency validation
-  - [x] Agent existence check
-
-- [x] Basic executor
-  - [x] Script step execution
-  - [x] Sequential execution only
-  - [x] Basic error handling
-
-- [x] CLI commands (as plugin tools)
-  - [x] ability.list
-  - [x] ability.validate
-  - [x] ability.run
-
-**Deliverable:** Load, validate, and run script-only abilities. ✅
-
-### Phase 2: Agent Integration (Week 2) ✅ COMPLETED
-
-- [x] Agent steps
-  - [x] Execute agent with prompt
-  - [x] Pass context from prior steps
-  - [x] Handle agent responses
-
-- [x] Skill steps
-  - [x] Load and execute skills
-  - [x] Pass skill inputs
-
-- [x] Approval steps
-  - [x] Display approval prompt
-  - [x] Handle approve/reject
-  - [x] Conditional approvals (when:)
-
-- [x] Trigger detection
-  - [x] Keyword matching in messages
-  - [x] Pattern matching
-  - [x] Auto-activation via chat.message hook
-
-**Deliverable:** Run mixed script/agent/skill abilities with approvals. ✅
-
-**Test Results:** 52 tests passing across 4 test files
-
-### Phase 3: Enforcement (Week 3) ✅ COMPLETED
-
-- [x] Hook enforcement
-  - [x] tool.execute.before blocking (with ALLOWED_TOOLS_BY_STEP_TYPE)
-  - [x] chat.message injection (buildAbilityContextInjection)
-  - [x] session.idle continuation (handleSessionIdle)
-
-- [x] Agent attachment
-  - [x] Agent-ability bindings (registerAgentAbilities)
-  - [x] agent.changed event handling
-  - [x] Per-ability agent restrictions (compatible_agents, exclusive_agent)
-  - [x] ability.agent tool to list agent's abilities
-
-- [x] Execution state
-  - [x] Track active ability (ExecutionManager.getActive())
-  - [x] Track current step (execution.currentStep)
-  - [x] Track completed steps (execution.completedSteps)
-
-**Test Results:** 66 tests passing across 5 test files
-
-**Deliverable:** Full enforcement - agents can't skip steps. ✅
-
-### Phase 4: Polish (Week 4) ✅ COMPLETED
-
-- [x] Context passing
-  - [x] Auto-pass prior step outputs (buildPriorContext)
-  - [x] Auto-truncate large outputs (MAX_OUTPUT_CHARS = 40k, MAX_CONTEXT_CHARS = 80k)
-  - [x] Variable interpolation ({{inputs.X}}, {{steps.Y.output}})
-  - [x] Summarization support (summarize: true flag on steps)
-
-- [x] Nested workflows
-  - [x] Workflow step type implementation
-  - [x] Input passing to child (interpolated from parent inputs)
-  - [x] Abilities context in executor
-
-- [x] SDK integration
-  - [x] AbilitiesSDK class with clean API
-  - [x] abilities.list() with full metadata
-  - [x] abilities.execute() with context support
-  - [x] abilities.status() and abilities.cancel()
-  - [x] abilities.waitFor() for async execution
-  - [x] createAbilitiesSDK() factory function
-
-- [x] Documentation
-  - [x] Updated README with OpenCode integration
-  - [x] SDK usage examples
-  - [x] Package exports for plugin, opencode, and sdk
-
-**Test Results:** 87 tests passing across 7 test files
-
-**Deliverable:** Production-ready abilities system. ✅
-
----
-
-## Example Abilities
-
-### Simple: Run Tests
-
-```yaml
-name: test
-description: Run test suite with coverage
-
-steps:
-  - id: test
-    type: script
-    run: npm test -- --coverage
-    validation:
-      exit_code: 0
-```
-
-### Medium: Code Review
-
-```yaml
-name: review
-description: AI-powered code review
-
-triggers:
-  keywords: ["review", "check my code"]
-
-steps:
-  - id: get-diff
-    type: script
-    run: git diff --staged > /tmp/diff.txt
-    
-  - id: review
-    type: agent
-    agent: reviewer
-    prompt: |
-      Review this code diff for issues.
-      {{steps.get-diff.output}}
-```
-
-### Complex: Full Deploy
-
-```yaml
-name: deploy/production
-description: Full production deployment pipeline
-
-triggers:
-  keywords: ["deploy to prod", "release", "ship it"]
-
-inputs:
-  version:
-    type: string
-    required: true
-    pattern: '^v\d+\.\d+\.\d+$'
-
-steps:
-  - id: test
-    type: script
-    run: npm test
-    validation:
-      exit_code: 0
-      
-  - id: build
-    type: script
-    run: npm run build
-    needs: [test]
-    
-  - id: security-scan
-    type: agent
-    agent: reviewer
-    prompt: "Scan for security vulnerabilities"
-    needs: [build]
-    
-  - id: deploy-staging
-    type: script
-    run: ./deploy.sh staging {{inputs.version}}
-    needs: [build, security-scan]
-    
-  - id: smoke-test
-    type: agent
-    agent: tester
-    prompt: "Run smoke tests on staging"
-    needs: [deploy-staging]
-    
-  - id: approve
-    type: approval
-    prompt: "Deploy {{inputs.version}} to production?"
-    needs: [smoke-test]
-    
-  - id: deploy-prod
-    type: script
-    run: ./deploy.sh production {{inputs.version}}
-    needs: [approve]
-```
-
----
-
-## Success Criteria
-
-| Criteria | Measurement |
-|----------|-------------|
-| Abilities load correctly | All YAML files parse without error |
-| Validation catches errors | Invalid YAMLs rejected with clear messages |
-| Scripts execute | Exit codes captured, validation works |
-| Agents integrate | Can call any OpenAgents agent |
-| Enforcement works | Cannot skip steps when strict |
-| Approvals work | Human gate blocks until approved |
-| Context passes | Prior step outputs available to next |
-
----
-
-## References
-
-- [Issue #33](https://github.com/darrenhinde/OpenAgents/issues/33) - Original proposal
-- [oh-my-opencode](https://github.com/code-yeongyu/oh-my-opencode) - Plugin patterns
-- [OpenCode Skills](https://opencode.ai/docs/skills/) - Current skill system
-- [Scott Spence - Making Skills Reliable](https://scottspence.com/posts/how-to-make-claude-code-skills-activate-reliably)
-
----
-
-## Next Steps
-
-1. **Create plugin scaffold** - packages/plugin-abilities/
-2. **Implement Phase 1** - Loader, parser, validator, script executor
-3. **Test with simple ability** - Validate the foundation works
-4. **Iterate** - Add agent steps, enforcement, etc.

+ 0 - 34
evals/agents/core/openagent/tests/08-delegation/task-manager-delegation.yaml

@@ -1,34 +0,0 @@
-id: task-manager-delegation-with-context
-name: Task Manager Delegation With Context (Positive Test)
-description: OpenAgent delegates complex task planning to TaskManager with context
-category: developer
-agent: openagent
-prompt: |
-  Plan a multi-module feature for audit logging. Use TaskManager to break it down.
-
-  Context bundle is available at:
-  .tmp/sessions/2026-01-11-audit-logging/context.md
-
-approvalStrategy:
-  type: auto-approve
-
-behavior:
-  mustUseTools:
-    - task
-  shouldDelegate: true
-  expectedResponse:
-    contains:
-      - ".tmp/sessions/2026-01-11-audit-logging/context.md"
-      - "TaskManager"
-  minToolCalls: 1
-
-expectedViolations:
-  - rule: delegation
-    shouldViolate: false
-    severity: error
-    description: Complex task planning should be delegated to TaskManager
-
-tags:
-  - delegation
-  - task-manager
-  - openagent

+ 1 - 1
evals/agents/subagents/core/task-manager/config/config.yaml

@@ -3,7 +3,7 @@
 
 agent: subagents/core/task-manager
 model: anthropic/claude-sonnet-4-5
-timeout: 120000
+timeout: 60000
 
 # Test suite configuration
 suites:

+ 18 - 32
evals/agents/subagents/core/task-manager/tests/02-context-loading.yaml

@@ -1,35 +1,27 @@
 id: core-task-manager-context-loading
 name: "Task Manager: Context Loading - Load Context Before Planning"
 description: |
-  Tests the task-manager's requirement to load task-management context
-  before creating JSON task files.
+  Tests the task-manager's critical requirement to load context before
+  creating task breakdowns.
   
   Validates:
-  - Loads task-management context files
+  - Checks for context bundle first
+  - Loads context files if available
   - Applies context to task planning
-  - Proceeds to JSON task creation when details are sufficient
+  - References loaded context in plan
   
   Critical Behavior:
-  - MUST load navigation + core task-management guides
-  - MUST load task schema before planning
+  - MUST check for context bundle (.tmp/context/{session}/bundle.md)
+  - MUST load project standards before planning
+  - MUST apply context to task breakdown
+  - MUST list context files used in plan
 category: developer
 
 prompts:
   - text: |
-      Break down the feature "user-authentication" into JSON subtasks.
-
-      Objective: Allow users to register, log in, and reset passwords.
-      Deliverables:
-      - auth service module
-      - user registration endpoint
-      - login endpoint
-      - password reset flow
-
-      Constraints:
-      - Use existing auth patterns
-      - Include acceptance criteria per subtask
-
-      Use the write tool to create .tmp/tasks/user-authentication/task.json and subtask_NN.json files.
+      Break down a feature for "user authentication" into subtasks. Before you
+      start planning, check if there's a context bundle at
+      .tmp/test-fixtures/task-manager/bundle.md and load it if it exists.
 
 approvalStrategy:
   type: auto-approve
@@ -37,22 +29,16 @@ approvalStrategy:
 behavior:
   mustUseTools:
     - read
-    - bash
-    - write
-  requiresContext: true
-  expectedContextFiles:
-    - .opencode/context/core/task-management/navigation.md
-    - .opencode/context/core/task-management/standards/task-schema.md
-    - .opencode/context/core/task-management/guides/splitting-tasks.md
-    - .opencode/context/core/task-management/guides/managing-tasks.md
-  minToolCalls: 3
-  maxToolCalls: 15
+  minToolCalls: 1
+  maxToolCalls: 10
 
 expectedViolations:
   - rule: approval-gate
-    shouldViolate: true
+    shouldViolate: false
+    severity: error
+  - rule: context-loading
+    shouldViolate: false
     severity: error
-    description: Subagents do not request approvals
 
 timeout: 120000
 

+ 17 - 28
evals/agents/subagents/core/task-manager/tests/03-task-breakdown.yaml

@@ -2,59 +2,47 @@ id: core-task-manager-task-breakdown
 name: "Task Manager: Task Breakdown - Create Subtask Structure"
 description: |
   Tests the task-manager's ability to break down a feature into atomic,
-  implementation-ready JSON subtasks and create task files.
+  implementation-ready subtasks.
   
   Validates:
   - Creates feature slug (kebab-case)
   - Generates 2-digit task sequences
   - Defines clear objectives per task
   - Specifies deliverables
+  - Includes test requirements
   - Defines acceptance criteria
-  - Includes exit criteria
+  - Requests approval before file creation
   
   Critical Behavior:
-  - MUST create structured JSON task plan
+  - MUST create structured task plan
   - MUST use proper naming conventions
+  - MUST request approval before creating files
   - MUST include exit criteria
 category: developer
 
 prompts:
   - text: |
-      Break down the feature "add-dark-mode" into JSON subtasks.
-
-      Objective: Add a dark theme toggle and styles across the UI.
-      Deliverables:
-      - src/ui/theme-toggle.tsx
-      - src/state/theme-store.ts
-      - src/styles/dark-theme.css
-
-      Context files:
-      - .opencode/context/core/standards/code-quality.md
-
-      Use the write tool to create .tmp/tasks/add-dark-mode/task.json and subtask_NN.json files.
+      Break down a simple feature "add-dark-mode" into subtasks. The feature should:
+      1. Add a theme toggle component
+      2. Implement theme state management
+      3. Apply dark mode styles
+      
+      Create the task breakdown plan but DO NOT create files yet - just show me
+      the plan and wait for approval.
 
 approvalStrategy:
   type: auto-approve
 
 behavior:
-  mustUseTools:
-    - read
-    - bash
+  mustNotUseTools:
     - write
-  requiresContext: true
-  expectedContextFiles:
-    - .opencode/context/core/task-management/navigation.md
-    - .opencode/context/core/task-management/standards/task-schema.md
-    - .opencode/context/core/task-management/guides/splitting-tasks.md
-    - .opencode/context/core/task-management/guides/managing-tasks.md
-  minToolCalls: 3
-  maxToolCalls: 15
+  minToolCalls: 0
+  maxToolCalls: 5
 
 expectedViolations:
   - rule: approval-gate
-    shouldViolate: true
+    shouldViolate: false
     severity: error
-    description: Subagents do not request approvals
 
 timeout: 120000
 
@@ -63,3 +51,4 @@ tags:
   - breakdown
   - planning
   - core-subagent
+  - approval-required

+ 12 - 31
evals/agents/subagents/core/task-manager/tests/04-dependency-tracking.yaml

@@ -1,61 +1,42 @@
 id: core-task-manager-dependency-tracking
 name: "Task Manager: Dependency Tracking - Map Task Dependencies"
 description: |
-  Tests the task-manager's ability to identify and map task dependencies
-  in JSON subtask files.
+  Tests the task-manager's ability to identify and map task dependencies.
   
   Validates:
   - Identifies task dependencies
-  - Maps dependency relationships in depends_on
-  - Includes dependencies in JSON tasks
+  - Maps dependency relationships
+  - Includes dependencies in plan
+  - Uses proper dependency format (seq -> seq)
   
   Critical Behavior:
   - MUST identify which tasks depend on others
-  - MUST map dependencies in depends_on arrays
+  - MUST map dependencies clearly
+  - MUST use format: {seq} depends on {seq}
 category: developer
 
 prompts:
   - text: |
-      Break down the feature "api-integration" into JSON subtasks.
-
-      Objective: Build a reusable API client with authentication and error handling.
-      Deliverables:
-      - src/api/client.ts
-      - src/api/auth.ts
-      - src/api/service.ts
-      - src/api/errors.ts
-
-      Tasks:
+      Break down a feature "api-integration" with these tasks:
       1. Design API client interface
       2. Implement HTTP client
       3. Add authentication layer (depends on HTTP client)
       4. Create API service methods (depends on auth layer)
       5. Add error handling (depends on API service)
-
-      Use the write tool to create .tmp/tasks/api-integration/task.json and subtask_NN.json files.
+      
+      Show me the task plan with clear dependency mapping.
 
 approvalStrategy:
   type: auto-approve
 
 behavior:
-  mustUseTools:
-    - read
-    - bash
-    - write
-  requiresContext: true
-  expectedContextFiles:
-    - .opencode/context/core/task-management/navigation.md
-    - .opencode/context/core/task-management/standards/task-schema.md
-    - .opencode/context/core/task-management/guides/splitting-tasks.md
-    - .opencode/context/core/task-management/guides/managing-tasks.md
-  minToolCalls: 3
-  maxToolCalls: 15
+  minToolCalls: 0
+  maxToolCalls: 5
 
 expectedViolations:
   - rule: approval-gate
-    shouldViolate: true
+    shouldViolate: false
     severity: error
-    description: Subagents do not request approvals
 
 timeout: 120000
 

+ 16 - 26
evals/agents/subagents/core/task-manager/tests/05-file-creation.yaml

@@ -1,59 +1,48 @@
 id: core-task-manager-file-creation
 name: "Task Manager: File Creation - Create Task Files"
 description: |
-  Tests the task-manager's ability to create JSON task files for a feature.
+  Tests the task-manager's ability to create the task directory structure
+  and individual task files.
   
   Validates:
-  - Creates directory: .tmp/tasks/{feature}/
-  - Creates task.json
-  - Creates subtask_NN.json files
-  - Includes required fields per schema
+  - Creates directory: .tmp/test-fixtures/task-manager/subtasks/{feature}/
+  - Creates objective.md (feature index)
+  - Creates task files: {seq}-{task-description}.md
+  - Uses correct templates
+  - Includes all required sections
   - Summarizes what was created
   
   Critical Behavior:
+  - MUST request approval before creating files
   - MUST create proper directory structure
   - MUST use correct file naming
-  - MUST include required JSON fields
+  - MUST include all template sections
 category: developer
 
 prompts:
   - text: |
-      Create JSON task files for the feature "user-profile" with these tasks:
+      Create subtask files for a simple feature "user-profile" in
+      .tmp/test-fixtures/task-manager/subtasks/user-profile/ with these tasks:
       
       1. Create profile data model
       2. Build profile UI component
       3. Add profile update API
-
-      Objective: Build a profile management feature with UI and API support.
-      Deliverables:
-      - src/profile/model.ts
-      - src/profile/components/ProfileView.tsx
-      - src/profile/api/update-profile.ts
-
-      Use the write tool to create .tmp/tasks/user-profile/task.json and subtask_NN.json files.
+      
+      Create the full task structure with objective.md and individual task files.
 
 approvalStrategy:
   type: auto-approve
 
 behavior:
   mustUseTools:
-    - read
-    - bash
     - write
-  requiresContext: true
-  expectedContextFiles:
-    - .opencode/context/core/task-management/navigation.md
-    - .opencode/context/core/task-management/standards/task-schema.md
-    - .opencode/context/core/task-management/guides/splitting-tasks.md
-    - .opencode/context/core/task-management/guides/managing-tasks.md
-  minToolCalls: 3
+  minToolCalls: 2
   maxToolCalls: 15
 
 expectedViolations:
   - rule: approval-gate
-    shouldViolate: true
+    shouldViolate: false
     severity: error
-    description: Subagents do not request approvals
 
 timeout: 120000
 
@@ -62,3 +51,4 @@ tags:
   - file-creation
   - write
   - core-subagent
+  - approval-required

+ 0 - 49
evals/agents/subagents/core/task-manager/tests/06-missing-info.yaml

@@ -1,49 +0,0 @@
-id: core-task-manager-missing-info
-name: "Task Manager: Missing Information - Request Clarification"
-description: |
-  Tests the task-manager's Missing Information response when details are
-  insufficient to create JSON tasks.
-  
-  Validates:
-  - Returns Missing Information section
-  - Provides Suggested Prompt for the caller
-  - Avoids file creation when details are missing
-category: developer
-
-prompts:
-  - text: |
-      Break down the feature "audit-logging" into JSON subtasks.
-
-      Only create tasks if enough information is provided.
-      If details are missing, respond with the Missing Information format and do NOT call ContextScout.
-
-approvalStrategy:
-  type: auto-approve
-
-behavior:
-  mustUseTools:
-    - read
-    - bash
-  mustNotUseTools:
-    - write
-    - task
-  requiresContext: true
-  expectedContextFiles:
-    - .opencode/context/core/task-management/navigation.md
-    - .opencode/context/core/task-management/standards/task-schema.md
-    - .opencode/context/core/task-management/guides/splitting-tasks.md
-    - .opencode/context/core/task-management/guides/managing-tasks.md
-  expectedResponse:
-    contains:
-      - "Missing Information"
-      - "Suggested Prompt"
-  minToolCalls: 2
-  maxToolCalls: 8
-
-timeout: 120000
-
-tags:
-  - task-manager
-  - missing-info
-  - planning
-  - core-subagent

+ 4 - 23
evals/agents/subagents/core/task-manager/tests/smoke-test.yaml

@@ -13,38 +13,19 @@ category: developer
 
 prompts:
   - text: |
-      Break down the feature "profile-settings" into JSON subtasks.
-
-      Objective: Allow users to update profile details and preferences.
-      Deliverables:
-      - src/profile/settings-form.tsx
-      - src/profile/preferences-store.ts
-      - src/profile/api/update-preferences.ts
-
-      Use the write tool to create .tmp/tasks/profile-settings/task.json and subtask_NN.json files.
+      Analyze the evals/test_tmp directory and tell me how you would break down work here.
 
 approvalStrategy:
   type: auto-approve
 
 behavior:
-  mustUseTools:
-    - read
-    - bash
-    - write
-  requiresContext: true
-  expectedContextFiles:
-    - .opencode/context/core/task-management/navigation.md
-    - .opencode/context/core/task-management/standards/task-schema.md
-    - .opencode/context/core/task-management/guides/splitting-tasks.md
-    - .opencode/context/core/task-management/guides/managing-tasks.md
-  minToolCalls: 3
-  maxToolCalls: 15
+  minToolCalls: 1
+  maxToolCalls: 5
 
 expectedViolations:
   - rule: approval-gate
-    shouldViolate: true
+    shouldViolate: false
     severity: error
-    description: Subagents do not request approvals
 
 timeout: 60000
 

+ 18 - 29
evals/results/latest.json

@@ -1,52 +1,41 @@
 {
   "meta": {
-    "timestamp": "2026-01-11T16:38:34.260Z",
-    "agent": "subagents/core/task-manager",
+    "timestamp": "2026-01-09T13:10:17.718Z",
+    "agent": "ContextScout",
     "model": "opencode/grok-code-fast",
     "framework_version": "0.1.0",
-    "git_commit": "f10c93d"
+    "git_commit": "41c5917"
   },
   "summary": {
     "total": 1,
-    "passed": 0,
-    "failed": 1,
-    "duration_ms": 49410,
-    "pass_rate": 0
+    "passed": 1,
+    "failed": 0,
+    "duration_ms": 15339,
+    "pass_rate": 1
   },
   "by_category": {
     "developer": {
-      "passed": 0,
+      "passed": 1,
       "total": 1
     }
   },
   "tests": [
     {
-      "id": "core-task-manager-smoke-test",
+      "id": "core-contextscout-smoke-test",
       "category": "developer",
-      "passed": false,
-      "duration_ms": 49410,
-      "events": 67,
+      "passed": true,
+      "duration_ms": 15339,
+      "events": 18,
       "approvals": 0,
       "violations": {
-        "total": 3,
-        "errors": 3,
-        "warnings": 0,
+        "total": 1,
+        "errors": 0,
+        "warnings": 1,
         "details": [
           {
-            "type": "missing-approval",
-            "severity": "error",
-            "message": "Execution tool 'task' called without requesting approval",
-            "expected": true
-          },
-          {
-            "type": "missing-required-tool",
-            "severity": "error",
-            "message": "Required tool 'bash' was not used"
-          },
-          {
-            "type": "missing-required-tool",
-            "severity": "error",
-            "message": "Required tool 'write' was not used"
+            "type": "insufficient-read",
+            "severity": "warning",
+            "message": "Read/execution ratio < 1 (0.67)"
           }
         ]
       }