opencode-orchestrator 0.8.21 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +32 -33
  2. package/dist/agents/commander.d.ts +2 -1
  3. package/dist/agents/prompts/commander/index.d.ts +2 -0
  4. package/dist/agents/prompts/commander/loop-continuation.d.ts +6 -0
  5. package/dist/agents/prompts/commander/sync-handling.d.ts +6 -0
  6. package/dist/agents/prompts/common/shared-workspace.d.ts +1 -1
  7. package/dist/agents/prompts/planner/file-planning.d.ts +6 -0
  8. package/dist/agents/prompts/planner/index.d.ts +2 -0
  9. package/dist/agents/prompts/planner/todo-sync.d.ts +6 -0
  10. package/dist/agents/prompts/reviewer/async-monitoring.d.ts +6 -0
  11. package/dist/agents/prompts/reviewer/index.d.ts +3 -0
  12. package/dist/agents/prompts/reviewer/integration-testing.d.ts +7 -0
  13. package/dist/agents/prompts/reviewer/sync-verification.d.ts +6 -0
  14. package/dist/agents/prompts/worker/file-assignment.d.ts +6 -0
  15. package/dist/agents/prompts/worker/index.d.ts +3 -0
  16. package/dist/agents/prompts/worker/isolation-testing.d.ts +6 -0
  17. package/dist/agents/prompts/worker/tdd-workflow.d.ts +7 -0
  18. package/dist/agents/subagents/planner.d.ts +2 -1
  19. package/dist/agents/subagents/reviewer.d.ts +1 -1
  20. package/dist/agents/subagents/worker.d.ts +3 -2
  21. package/dist/index.js +888 -19
  22. package/dist/shared/core/constants/id-prefix.d.ts +7 -1
  23. package/dist/shared/core/constants/paths.d.ts +4 -0
  24. package/dist/shared/index.d.ts +2 -0
  25. package/dist/shared/prompt/constants/index.d.ts +5 -0
  26. package/dist/shared/prompt/constants/status.d.ts +34 -0
  27. package/dist/shared/prompt/constants/tags.d.ts +147 -0
  28. package/dist/shared/prompt/index.d.ts +4 -0
  29. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -56,7 +56,10 @@ var TIME = {
56
56
  var ID_PREFIX = {
57
57
  TASK: "task_",
58
58
  JOB: "job_",
59
- SESSION: "session_"
59
+ SESSION: "ses_",
60
+ SYNC_ISSUE: "SYNC-",
61
+ UNIT_TEST: "UT-",
62
+ WORKER: "wrk_"
60
63
  };
61
64
 
62
65
  // src/shared/core/constants/paths.ts
@@ -69,7 +72,12 @@ var PATHS = {
69
72
  TODO: ".opencode/todo.md",
70
73
  CONTEXT: ".opencode/context.md",
71
74
  SUMMARY: ".opencode/summary.md",
72
- DOC_METADATA: ".opencode/docs/_metadata.json"
75
+ DOC_METADATA: ".opencode/docs/_metadata.json",
76
+ // TDD & Parallel Work State
77
+ WORK_LOG: ".opencode/work-log.md",
78
+ UNIT_TESTS: ".opencode/unit-tests",
79
+ SYNC_ISSUES: ".opencode/sync-issues.md",
80
+ INTEGRATION_STATUS: ".opencode/integration-status.md"
73
81
  };
74
82
 
75
83
  // src/shared/core/constants/memory-limits.ts
@@ -344,6 +352,85 @@ function detectErrorType(error45) {
344
352
  return null;
345
353
  }
346
354
 
355
+ // src/shared/prompt/constants/tags.ts
356
+ var PROMPT_TAGS = {
357
+ // === Common ===
358
+ ROLE: { open: "<role>", close: "</role>" },
359
+ IDENTITY: { open: "<identity>", close: "</identity>" },
360
+ FORBIDDEN_ACTIONS: { open: "<forbidden_actions>", close: "</forbidden_actions>" },
361
+ REQUIRED_ACTIONS: { open: "<required_actions>", close: "</required_actions>" },
362
+ VERIFICATION: { open: "<verification>", close: "</verification>" },
363
+ ENVIRONMENT_DISCOVERY: { open: "<environment_discovery>", close: "</environment_discovery>" },
364
+ ANTI_HALLUCINATION: { open: "<anti_hallucination>", close: "</anti_hallucination>" },
365
+ TODO_RULES: { open: "<todo_rules>", close: "</todo_rules>" },
366
+ MISSION_SEAL: { open: "<mission_seal>", close: "</mission_seal>" },
367
+ SHARED_WORKSPACE: { open: "<shared_workspace>", close: "</shared_workspace>" },
368
+ // === Commander ===
369
+ TOOLS: { open: "<tools>", close: "</tools>" },
370
+ AGENTS: { open: "<agents>", close: "</agents>" },
371
+ EXECUTION_STRATEGY: { open: "<execution_strategy>", close: "</execution_strategy>" },
372
+ PARALLEL_EXECUTION: { open: "<parallel_execution>", close: "</parallel_execution>" },
373
+ TODO_FORMAT: { open: "<todo_format>", close: "</todo_format>" },
374
+ SYNC_ISSUE_HANDLING: { open: "<sync_issue_handling>", close: "</sync_issue_handling>" },
375
+ LOOP_CONTINUATION: { open: "<loop_continuation>", close: "</loop_continuation>" },
376
+ // === Planner ===
377
+ FILE_LEVEL_PLANNING: { open: "<file_level_planning>", close: "</file_level_planning>" },
378
+ TODO_SYNC: { open: "<todo_sync>", close: "</todo_sync>" },
379
+ PLANNING_FORMAT: { open: "<planning_format>", close: "</planning_format>" },
380
+ RESEARCH_WORKFLOW: { open: "<research_workflow>", close: "</research_workflow>" },
381
+ // === Worker ===
382
+ FILE_ASSIGNMENT: { open: "<file_assignment>", close: "</file_assignment>" },
383
+ TDD_WORKFLOW: { open: "<tdd_workflow>", close: "</tdd_workflow>" },
384
+ ISOLATION_TESTING: { open: "<isolation_testing>", close: "</isolation_testing>" },
385
+ WORKFLOW: { open: "<workflow>", close: "</workflow>" },
386
+ QUALITY_CHECKLIST: { open: "<quality_checklist>", close: "</quality_checklist>" },
387
+ // === Reviewer ===
388
+ SYNC_VERIFICATION: { open: "<sync_verification>", close: "</sync_verification>" },
389
+ ASYNC_MONITORING: { open: "<async_monitoring>", close: "</async_monitoring>" },
390
+ INTEGRATION_TESTING: { open: "<integration_testing>", close: "</integration_testing>" },
391
+ VERIFICATION_PROCESS: { open: "<verification_process>", close: "</verification_process>" },
392
+ TODO_MANAGEMENT: { open: "<todo_management>", close: "</todo_management>" },
393
+ OUTPUT_FORMAT: { open: "<output_format>", close: "</output_format>" },
394
+ // === Mission Loop ===
395
+ MISSION_LOOP: { open: "<mission_loop>", close: "</mission_loop>" }
396
+ };
397
+
398
+ // src/shared/prompt/constants/status.ts
399
+ var WORK_STATUS = {
400
+ // File action types
401
+ ACTION: {
402
+ CREATE: "CREATE",
403
+ MODIFY: "MODIFY",
404
+ DELETE: "DELETE",
405
+ FIX: "FIX"
406
+ },
407
+ // Task/file status
408
+ STATUS: {
409
+ PENDING: "PENDING",
410
+ IN_PROGRESS: "IN_PROGRESS",
411
+ DONE: "DONE",
412
+ FAILED: "FAILED"
413
+ },
414
+ // Test result
415
+ TEST_RESULT: {
416
+ PASS: "PASS",
417
+ FAIL: "FAIL",
418
+ SKIP: "SKIP"
419
+ },
420
+ // Issue severity
421
+ SEVERITY: {
422
+ HIGH: "HIGH",
423
+ MEDIUM: "MEDIUM",
424
+ LOW: "LOW"
425
+ },
426
+ // Session state
427
+ SESSION: {
428
+ STARTED: "STARTED",
429
+ COMPLETED: "COMPLETED",
430
+ CANCELLED: "CANCELLED"
431
+ }
432
+ };
433
+
347
434
  // src/core/agents/consts/task-status.const.ts
348
435
  var TASK_STATUS = {
349
436
  PENDING: "pending",
@@ -12917,25 +13004,64 @@ FORBIDDEN:
12917
13004
  </todo_rules>`;
12918
13005
 
12919
13006
  // src/agents/prompts/common/shared-workspace.ts
12920
- var SHARED_WORKSPACE = `<shared_workspace>
12921
- .opencode/ - Shared Context Directory
13007
+ var SHARED_WORKSPACE = `${PROMPT_TAGS.SHARED_WORKSPACE.open}
13008
+ .opencode/ - Shared Context Directory (Real-time State)
12922
13009
 
12923
13010
  \`\`\`
12924
13011
  .opencode/
12925
- \u251C\u2500\u2500 todo.md - Master task list
12926
- \u251C\u2500\u2500 context.md - Project context summary
12927
- \u251C\u2500\u2500 docs/ - Cached documentation
12928
- \u2502 \u251C\u2500\u2500 [topic].md
12929
- \u2502 \u2514\u2500\u2500 ...
12930
- \u2514\u2500\u2500 archive/ - Old context
13012
+ \u251C\u2500\u2500 todo.md - Master task list (single source of truth)
13013
+ \u251C\u2500\u2500 context.md - Project context summary (<150 lines)
13014
+ \u251C\u2500\u2500 work-log.md - \u{1F504} REAL-TIME work status (ALL agents read/write)
13015
+ \u2502 # - Active sessions & assigned files
13016
+ \u2502 # - Unit test completion records
13017
+ \u2502 # - Pending integration items
13018
+ \u251C\u2500\u2500 unit-tests/ - \u{1F4DD} Unit test records (preserved after deletion)
13019
+ \u2502 \u2514\u2500\u2500 [timestamp]-[file].md # Test content, results, deleted test code
13020
+ \u251C\u2500\u2500 sync-issues.md - \u26A0\uFE0F File sync issues (Reviewer writes)
13021
+ \u251C\u2500\u2500 integration-status.md - \u2705 Integration test results & sync status
13022
+ \u251C\u2500\u2500 docs/ - Cached documentation
13023
+ \u2514\u2500\u2500 archive/ - Old context
12931
13024
  \`\`\`
12932
13025
 
13026
+ ## ID Formats (no digit limit):
13027
+ - Session: ${ID_PREFIX.SESSION}N (e.g., ${ID_PREFIX.SESSION}1, ${ID_PREFIX.SESSION}42)
13028
+ - Sync Issue: ${ID_PREFIX.SYNC_ISSUE}N (e.g., ${ID_PREFIX.SYNC_ISSUE}1, ${ID_PREFIX.SYNC_ISSUE}100)
13029
+ - Unit Test: ${ID_PREFIX.UNIT_TEST}N (e.g., ${ID_PREFIX.UNIT_TEST}1, ${ID_PREFIX.UNIT_TEST}50)
13030
+
13031
+ ## Status Values:
13032
+ - Action: ${WORK_STATUS.ACTION.CREATE} | ${WORK_STATUS.ACTION.MODIFY} | ${WORK_STATUS.ACTION.DELETE} | ${WORK_STATUS.ACTION.FIX}
13033
+ - Status: ${WORK_STATUS.STATUS.PENDING} | ${WORK_STATUS.STATUS.IN_PROGRESS} | ${WORK_STATUS.STATUS.DONE}
13034
+ - Test: ${WORK_STATUS.TEST_RESULT.PASS} | ${WORK_STATUS.TEST_RESULT.FAIL}
13035
+
13036
+ ## work-log.md FORMAT:
13037
+ \`\`\`markdown
13038
+ # Work Log
13039
+
13040
+ ## Active Sessions
13041
+ - [ ] ${ID_PREFIX.SESSION}1 (Worker): \`src/auth/login.ts\` - ${WORK_STATUS.STATUS.IN_PROGRESS}
13042
+ - [x] ${ID_PREFIX.SESSION}2 (Worker): \`src/utils/hash.ts\` - ${WORK_STATUS.SESSION.COMPLETED}
13043
+
13044
+ ## Completed Units (Ready for Integration)
13045
+ | File | Session | Unit Test | Timestamp |
13046
+ |------|---------|-----------|-----------|
13047
+ | src/utils/hash.ts | ${ID_PREFIX.SESSION}2 | ${WORK_STATUS.TEST_RESULT.PASS} | 2026-01-18T09:00:00 |
13048
+
13049
+ ## Pending Integration
13050
+ - src/utils/hash.ts
13051
+ \`\`\`
13052
+
13053
+ ## PATH NOTES:
13054
+ - File paths use forward slash '/' in examples
13055
+ - On Windows, paths may use backslash '\\\\'
13056
+ - Use path.normalize() or similar when comparing paths programmatically
13057
+
12933
13058
  RULES:
12934
- - ALL agents share this workspace
12935
- - context.md < 150 lines (compress if larger)
12936
- - docs/ = official documentation ONLY
12937
- - todo.md = single source of truth for tasks
12938
- </shared_workspace>`;
13059
+ - ALL agents MUST read work-log.md before starting
13060
+ - Worker updates work-log.md when starting/completing file work
13061
+ - Reviewer monitors work-log.md for completed units
13062
+ - Commander reads work-log.md in each loop iteration
13063
+ - sync-issues.md = Reviewer writes issues for next iteration
13064
+ ${PROMPT_TAGS.SHARED_WORKSPACE.close}`;
12939
13065
 
12940
13066
  // src/agents/prompts/common/mission-seal.ts
12941
13067
  var MISSION_SEAL_RULES = `<mission_seal>
@@ -13156,6 +13282,165 @@ Create all items with [ ] - NEVER with [x]!
13156
13282
  Only ${AGENT_NAMES.REVIEWER} marks [x] after verification!
13157
13283
  </todo_format>`;
13158
13284
 
13285
+ // src/agents/prompts/commander/loop-continuation.ts
13286
+ var COMMANDER_LOOP_CONTINUATION = `${PROMPT_TAGS.LOOP_CONTINUATION.open}
13287
+ ## LOOP CONTINUATION PROTOCOL
13288
+
13289
+ At the START of each loop iteration, Commander MUST read shared state:
13290
+
13291
+ ### Step 1: Read Work Status
13292
+ \`\`\`bash
13293
+ # Check current work status
13294
+ cat ${PATHS.WORK_LOG}
13295
+ \`\`\`
13296
+
13297
+ ### Step 2: Check for Sync Issues
13298
+ \`\`\`bash
13299
+ # Check if Reviewer reported sync issues
13300
+ cat ${PATHS.SYNC_ISSUES} 2>/dev/null || echo "No sync issues"
13301
+ \`\`\`
13302
+
13303
+ ### Step 3: Check Integration Status
13304
+ \`\`\`bash
13305
+ # Check integration test results
13306
+ cat ${PATHS.INTEGRATION_STATUS} 2>/dev/null || echo "No integration yet"
13307
+ \`\`\`
13308
+
13309
+ ### Step 4: Decision Matrix
13310
+
13311
+ | work-log.md | sync-issues.md | Action |
13312
+ |-------------|----------------|--------|
13313
+ | Active workers | Any | Wait, monitor progress |
13314
+ | All [x] | Empty | Proceed to SEAL check |
13315
+ | All [x] | Has issues | Dispatch ${AGENT_NAMES.WORKER} to fix |
13316
+ | Has unchecked | Any | Continue execution |
13317
+
13318
+ ### Step 5: File-Level Task Assignment
13319
+ When dispatching work, assign at FILE LEVEL:
13320
+ \`\`\`markdown
13321
+ ## TODO Format for Parallel Workers:
13322
+ - [ ] S1.1: Implement \`src/auth/login.ts\` | agent:${AGENT_NAMES.WORKER} | file:src/auth/login.ts
13323
+ - [ ] S1.2: Implement \`src/auth/logout.ts\` | agent:${AGENT_NAMES.WORKER} | file:src/auth/logout.ts
13324
+ \`\`\`
13325
+
13326
+ Each ${AGENT_NAMES.WORKER} gets ONE file:
13327
+ - Isolation guaranteed
13328
+ - TDD happens per file
13329
+ - Unit test created & deleted per file
13330
+
13331
+ ### Step 6: Parallel Dispatch
13332
+ \`\`\`
13333
+ delegate_task(S1.1, ${AGENT_NAMES.WORKER}, background: true)
13334
+ delegate_task(S1.2, ${AGENT_NAMES.WORKER}, background: true)
13335
+ delegate_task(S1.3, ${AGENT_NAMES.WORKER}, background: true)
13336
+ // All run in PARALLEL
13337
+ \`\`\`
13338
+
13339
+ ### Step 7: After Workers Complete
13340
+ \`\`\`
13341
+ delegate_task(VERIFY_ALL, ${AGENT_NAMES.REVIEWER}, background: false)
13342
+ // Reviewer checks all completed units
13343
+ // Reviewer runs integration test
13344
+ // Reviewer updates TODO or reports sync issues
13345
+ \`\`\`
13346
+
13347
+ ### CRITICAL LOOP RULES:
13348
+ - ALWAYS read ${PATHS.WORK_LOG} at loop start
13349
+ - NEVER seal with active workers
13350
+ - NEVER seal with unresolved sync issues
13351
+ - File-level assignment = proper isolation
13352
+ ${PROMPT_TAGS.LOOP_CONTINUATION.close}`;
13353
+
13354
+ // src/agents/prompts/commander/sync-handling.ts
13355
+ var COMMANDER_SYNC_HANDLING = `${PROMPT_TAGS.SYNC_ISSUE_HANDLING.open}
13356
+ ## SYNC ISSUE HANDLING
13357
+
13358
+ When ${AGENT_NAMES.REVIEWER} reports sync issues, YOU must direct fixes.
13359
+
13360
+ ### Step 1: Read Sync Issues
13361
+ \`\`\`bash
13362
+ cat ${PATHS.SYNC_ISSUES}
13363
+ \`\`\`
13364
+
13365
+ ### Step 2: Analyze Each Issue
13366
+ For each ${ID_PREFIX.SYNC_ISSUE}N issue:
13367
+ - Which files are involved?
13368
+ - What's the root cause?
13369
+ - What's the fix?
13370
+
13371
+ ### Step 3: Instruct Planner
13372
+ Delegate to ${AGENT_NAMES.PLANNER} with SPECIFIC instructions:
13373
+
13374
+ \`\`\`
13375
+ delegate_task(
13376
+ task: "Update TODO for sync fix ${ID_PREFIX.SYNC_ISSUE}1",
13377
+ agent: ${AGENT_NAMES.PLANNER},
13378
+ instructions: "
13379
+ Read ${PATHS.SYNC_ISSUES} for ${ID_PREFIX.SYNC_ISSUE}1.
13380
+ Add FIX tasks for: src/auth/login.ts, src/api/users.ts.
13381
+ Issue: Import mismatch - login.ts exports 'login' but users.ts imports 'authenticate'.
13382
+ Fix: Update users.ts to import 'login' instead of 'authenticate'.
13383
+ Update ${PATHS.WORK_LOG} file status.
13384
+ "
13385
+ )
13386
+ \`\`\`
13387
+
13388
+ ### Step 4: Instruct Workers
13389
+ After Planner updates TODO, delegate fixes:
13390
+
13391
+ \`\`\`
13392
+ delegate_task(
13393
+ task: "Fix ${ID_PREFIX.SYNC_ISSUE}1 in src/api/users.ts",
13394
+ agent: ${AGENT_NAMES.WORKER},
13395
+ file: "src/api/users.ts",
13396
+ instructions: "
13397
+ Read ${PATHS.SYNC_ISSUES} ${ID_PREFIX.SYNC_ISSUE}1.
13398
+ Read ${PATHS.WORK_LOG} for context.
13399
+ Fix: Change 'import { authenticate }' to 'import { login }'.
13400
+ Run isolated test.
13401
+ Update ${PATHS.WORK_LOG}.
13402
+ ",
13403
+ background: true
13404
+ )
13405
+ \`\`\`
13406
+
13407
+ ### Step 5: Invoke Reviewer Again
13408
+ After all fix workers complete:
13409
+ \`\`\`
13410
+ delegate_task(
13411
+ task: "Re-verify after ${ID_PREFIX.SYNC_ISSUE}1 fixes",
13412
+ agent: ${AGENT_NAMES.REVIEWER},
13413
+ instructions: "
13414
+ Verify ${ID_PREFIX.SYNC_ISSUE}1 is resolved.
13415
+ Run integration tests.
13416
+ Clear resolved issues from ${PATHS.SYNC_ISSUES}.
13417
+ Update ${PATHS.INTEGRATION_STATUS}.
13418
+ "
13419
+ )
13420
+ \`\`\`
13421
+
13422
+ ### Communication Flow
13423
+ \`\`\`
13424
+ Commander: "Planner, sync issue found. Update TODO"
13425
+ \u2193
13426
+ Planner: (Add FIX task to TODO, update work-log)
13427
+ \u2193
13428
+ Commander: "Worker, fix this file like this" (Multiple Workers in parallel)
13429
+ \u2193
13430
+ Workers: (Fix each file + unit test + update work-log)
13431
+ \u2193
13432
+ Commander: "Reviewer, verify again"
13433
+ \u2193
13434
+ Reviewer: (Integration test + sync check + clear sync-issues)
13435
+ \`\`\`
13436
+
13437
+ ### CRITICAL:
13438
+ - ALWAYS read ${PATHS.SYNC_ISSUES} at loop start
13439
+ - NEVER skip Planner when fixing - TODO must be updated
13440
+ - ALWAYS include specific instructions in delegate_task
13441
+ - Workers need: file path + issue ID + exact fix instructions
13442
+ ${PROMPT_TAGS.SYNC_ISSUE_HANDLING.close}`;
13443
+
13159
13444
  // src/agents/prompts/planner/role.ts
13160
13445
  var PLANNER_ROLE = `<role>
13161
13446
  You are ${AGENT_NAMES.PLANNER}. Strategic planner and researcher.
@@ -13254,6 +13539,123 @@ Version: [version]
13254
13539
  \`\`\`
13255
13540
  </research_workflow>`;
13256
13541
 
13542
+ // src/agents/prompts/planner/file-planning.ts
13543
+ var PLANNER_FILE_PLANNING = `${PROMPT_TAGS.FILE_LEVEL_PLANNING.open}
13544
+ ## FILE-LEVEL PLANNING (MANDATORY)
13545
+
13546
+ Before any work begins, you MUST identify ALL files:
13547
+
13548
+ ### Step 1: Analyze Requirements
13549
+ - What needs to be built/changed?
13550
+ - What existing files are affected?
13551
+
13552
+ ### Step 2: Create File Manifest
13553
+ Write to ${PATHS.TODO}:
13554
+
13555
+ \`\`\`markdown
13556
+ # Mission: [goal]
13557
+
13558
+ ## File Manifest
13559
+ | Action | File Path | Description | Dependencies |
13560
+ |--------|-----------|-------------|--------------|
13561
+ | ${WORK_STATUS.ACTION.CREATE} | src/auth/login.ts | Login function | - |
13562
+ | ${WORK_STATUS.ACTION.CREATE} | src/auth/logout.ts | Logout function | login.ts |
13563
+ | ${WORK_STATUS.ACTION.MODIFY} | src/index.ts | Export auth module | login.ts, logout.ts |
13564
+ | ${WORK_STATUS.ACTION.CREATE} | src/types/auth.ts | Auth types | - |
13565
+ | ${WORK_STATUS.ACTION.DELETE} | src/old-auth.ts | Remove deprecated | - |
13566
+
13567
+ ## Work Assignments (File-Level)
13568
+ Each ${AGENT_NAMES.WORKER} gets ONE file:
13569
+
13570
+ ### T1: Auth Module | parallel-group:1
13571
+ - [ ] S1.1: ${WORK_STATUS.ACTION.CREATE} \`src/types/auth.ts\` | agent:${AGENT_NAMES.WORKER} | file:src/types/auth.ts
13572
+ - [ ] S1.2: ${WORK_STATUS.ACTION.CREATE} \`src/auth/login.ts\` | agent:${AGENT_NAMES.WORKER} | file:src/auth/login.ts
13573
+ - [ ] S1.3: ${WORK_STATUS.ACTION.CREATE} \`src/auth/logout.ts\` | agent:${AGENT_NAMES.WORKER} | file:src/auth/logout.ts
13574
+
13575
+ ### T2: Integration | parallel-group:2 | depends:T1
13576
+ - [ ] S2.1: ${WORK_STATUS.ACTION.MODIFY} \`src/index.ts\` | agent:${AGENT_NAMES.WORKER} | file:src/index.ts
13577
+ \`\`\`
13578
+
13579
+ ### Step 3: Initialize Work Log
13580
+ Create ${PATHS.WORK_LOG}:
13581
+
13582
+ \`\`\`markdown
13583
+ # Work Log
13584
+
13585
+ ## File Status
13586
+ | File | Action | Status | Worker | Unit Test | Timestamp |
13587
+ |------|--------|--------|--------|-----------|-----------|
13588
+ | src/types/auth.ts | ${WORK_STATUS.ACTION.CREATE} | ${WORK_STATUS.STATUS.PENDING} | - | - | - |
13589
+ | src/auth/login.ts | ${WORK_STATUS.ACTION.CREATE} | ${WORK_STATUS.STATUS.PENDING} | - | - | - |
13590
+ | src/auth/logout.ts | ${WORK_STATUS.ACTION.CREATE} | ${WORK_STATUS.STATUS.PENDING} | - | - | - |
13591
+ | src/index.ts | ${WORK_STATUS.ACTION.MODIFY} | ${WORK_STATUS.STATUS.PENDING} | - | - | - |
13592
+
13593
+ ## Active Sessions
13594
+ (none yet)
13595
+
13596
+ ## Completed Units
13597
+ (none yet)
13598
+
13599
+ ## Sync Issues
13600
+ (none yet)
13601
+ \`\`\`
13602
+
13603
+ ### PATH NOTES:
13604
+ - File paths use forward slash '/' in examples
13605
+ - On Windows, paths may use backslash '\\\\'
13606
+
13607
+ ### CRITICAL RULES:
13608
+ - Every subtask = exactly ONE file
13609
+ - Include \`file:[path]\` tag for each subtask
13610
+ - Action must be ${WORK_STATUS.ACTION.CREATE}, ${WORK_STATUS.ACTION.MODIFY}, ${WORK_STATUS.ACTION.DELETE}, or ${WORK_STATUS.ACTION.FIX}
13611
+ - List dependencies between files
13612
+ ${PROMPT_TAGS.FILE_LEVEL_PLANNING.close}`;
13613
+
13614
+ // src/agents/prompts/planner/todo-sync.ts
13615
+ var PLANNER_TODO_SYNC = `${PROMPT_TAGS.TODO_SYNC.open}
13616
+ ## TODO SYNC (After Sync Issues)
13617
+
13618
+ When ${AGENT_NAMES.COMMANDER} detects sync issues, you update the TODO.
13619
+
13620
+ ### Step 1: Read Current State
13621
+ \`\`\`bash
13622
+ cat ${PATHS.SYNC_ISSUES}
13623
+ cat ${PATHS.WORK_LOG}
13624
+ cat ${PATHS.TODO}
13625
+ \`\`\`
13626
+
13627
+ ### Step 2: Understand Commander's Instructions
13628
+ Commander will tell you:
13629
+ - Which files need rework
13630
+ - What sync issues to fix
13631
+ - New dependencies discovered
13632
+
13633
+ ### Step 3: Update TODO
13634
+ Add NEW subtasks for sync fixes:
13635
+
13636
+ \`\`\`markdown
13637
+ ### T3: Sync Fixes | parallel-group:3 | depends:T2
13638
+ - [ ] S3.1: ${WORK_STATUS.ACTION.FIX} \`src/auth/login.ts\` | agent:${AGENT_NAMES.WORKER} | file:src/auth/login.ts | issue:${ID_PREFIX.SYNC_ISSUE}1
13639
+ - [ ] S3.2: ${WORK_STATUS.ACTION.FIX} \`src/api/users.ts\` | agent:${AGENT_NAMES.WORKER} | file:src/api/users.ts | issue:${ID_PREFIX.SYNC_ISSUE}1
13640
+ \`\`\`
13641
+
13642
+ ### Step 4: Update Work Log File Status
13643
+ \`\`\`markdown
13644
+ | src/auth/login.ts | ${WORK_STATUS.ACTION.FIX} | ${WORK_STATUS.STATUS.PENDING} | - | - | - | ${ID_PREFIX.SYNC_ISSUE}1 |
13645
+ \`\`\`
13646
+
13647
+ ### Sync Issue Reference Format
13648
+ Always reference the sync issue ID:
13649
+ - \`issue:${ID_PREFIX.SYNC_ISSUE}N\` in TODO subtask (e.g., ${ID_PREFIX.SYNC_ISSUE}1, ${ID_PREFIX.SYNC_ISSUE}42)
13650
+ - Links back to ${PATHS.SYNC_ISSUES} for context
13651
+
13652
+ ### CRITICAL:
13653
+ - DO NOT remove completed tasks (keep for history)
13654
+ - ADD new fix tasks, don't overwrite
13655
+ - Keep file manifest updated
13656
+ - Commander reads your updates in next loop
13657
+ ${PROMPT_TAGS.TODO_SYNC.close}`;
13658
+
13257
13659
  // src/agents/prompts/worker/role.ts
13258
13660
  var WORKER_ROLE = `<role>
13259
13661
  You are ${AGENT_NAMES.WORKER}. Implementation specialist.
@@ -13319,6 +13721,240 @@ DOCS_USED: .opencode/docs/[file]
13319
13721
  Ready for ${AGENT_NAMES.REVIEWER} verification
13320
13722
  </quality_checklist>`;
13321
13723
 
13724
+ // src/agents/prompts/worker/tdd-workflow.ts
13725
+ var WORKER_TDD_WORKFLOW = `${PROMPT_TAGS.TDD_WORKFLOW.open}
13726
+ ## TDD (Test-Driven Development) MANDATORY WORKFLOW
13727
+
13728
+ You work on ONE FILE at a time in ISOLATION. Follow this EXACT cycle:
13729
+
13730
+ ### Phase 1: SETUP
13731
+ 1. Read ${PATHS.WORK_LOG} - Check assigned file
13732
+ 2. Read ${PATHS.TODO} - Understand requirements
13733
+ 3. Update ${PATHS.WORK_LOG}:
13734
+ \`\`\`markdown
13735
+ - [ ] ${ID_PREFIX.SESSION}N (Worker): \`[target-file]\` - ${WORK_STATUS.SESSION.STARTED}
13736
+ \`\`\`
13737
+
13738
+ ### Phase 2: TEST FIRST (Red)
13739
+ 1. Create ISOLATED test file for target file
13740
+ - Naming: \`[filename].isolated.test.[ext]\` (language-appropriate)
13741
+ 2. Write tests that ONLY test the target file
13742
+ 3. Mock/Dummy ALL external dependencies:
13743
+ - Database \u2192 Return fake data
13744
+ - External API \u2192 Mock response
13745
+ - Filesystem \u2192 Memory or temp
13746
+ - Other modules \u2192 Mock exports
13747
+ 4. Run test - MUST FAIL (Red phase)
13748
+
13749
+ ### Phase 3: IMPLEMENT (Green)
13750
+ 1. Write minimal code to pass tests
13751
+ 2. Run test - MUST PASS (Green phase)
13752
+ 3. Iterate until all tests pass
13753
+
13754
+ ### Phase 4: CLEANUP & RECORD
13755
+ 1. Record test in ${PATHS.UNIT_TESTS}/:
13756
+ \`\`\`markdown
13757
+ # Unit Test Record: [filename]
13758
+
13759
+ ## Target File
13760
+ \`[full-path]\`
13761
+
13762
+ ## Test File (DELETED)
13763
+ \`[test-file-path]\`
13764
+
13765
+ ## Test Code (Preserved)
13766
+ \\\`\\\`\\\`[language]
13767
+ [full test code here]
13768
+ \\\`\\\`\\\`
13769
+
13770
+ ## Test Result
13771
+ - Status: ${WORK_STATUS.TEST_RESULT.PASS}
13772
+ - Session: ${ID_PREFIX.SESSION}N
13773
+ - Timestamp: [ISO timestamp]
13774
+ \`\`\`
13775
+
13776
+ 2. DELETE the isolated test file (code preserved above)
13777
+ 3. Update ${PATHS.WORK_LOG} with ${WORK_STATUS.STATUS.DONE} + ${WORK_STATUS.TEST_RESULT.PASS}
13778
+
13779
+ ---
13780
+
13781
+ ## Isolation Requirements (Language-Agnostic)
13782
+ 1. **Import ONLY target file** - Only the file being worked on
13783
+ 2. **Mock ALL external dependencies**:
13784
+ - Communication/interaction needed \u2192 Assume dummy response
13785
+ - Real I/O strictly forbidden
13786
+ 3. **Delete after pass** - Remove isolated test file
13787
+ 4. **Record in .opencode** - Preserve test code and results
13788
+
13789
+ ### CRITICAL RULES:
13790
+ - NEVER skip the test file deletion step
13791
+ - ALWAYS preserve test code in ${PATHS.UNIT_TESTS}/
13792
+ - NEVER mark [x] in todo.md - Reviewer's job!
13793
+ - ONE file per session - complete isolation
13794
+ ${PROMPT_TAGS.TDD_WORKFLOW.close}`;
13795
+
13796
+ // src/agents/prompts/worker/isolation-testing.ts
13797
+ var WORKER_ISOLATION_TESTING = `${PROMPT_TAGS.ISOLATION_TESTING.open}
13798
+ ## ISOLATED UNIT TEST RULES
13799
+
13800
+ ### File Naming Convention
13801
+ \`[original-dir]/__tests__/[filename].isolated.test.ts\`
13802
+
13803
+ Example:
13804
+ - Target: \`src/auth/login.ts\`
13805
+ - Test: \`src/auth/__tests__/login.isolated.test.ts\`
13806
+
13807
+ ### Isolation Requirements
13808
+ 1. **Import ONLY the target file**
13809
+ \`\`\`typescript
13810
+ import { functionToTest } from '../login.js';
13811
+ \`\`\`
13812
+
13813
+ 2. **Mock ALL external dependencies**
13814
+ \`\`\`typescript
13815
+ vi.mock('../database.js', () => ({
13816
+ db: { query: vi.fn() }
13817
+ }));
13818
+ vi.mock('../config.js', () => ({
13819
+ config: { secret: 'test-secret' }
13820
+ }));
13821
+ \`\`\`
13822
+
13823
+ 3. **Test ONLY public exports of target file**
13824
+ - No testing of internal functions
13825
+ - No accessing private state
13826
+
13827
+ 4. **No side effects outside test scope**
13828
+ - No file system writes (mock them)
13829
+ - No network requests (mock them)
13830
+ - No database operations (mock them)
13831
+
13832
+ ### Test Structure Template
13833
+ \`\`\`typescript
13834
+ /**
13835
+ * ISOLATED Unit Test for [filename]
13836
+ * Target: [full-path]
13837
+ * Session: [session_id]
13838
+ *
13839
+ * \u26A0\uFE0F THIS FILE WILL BE DELETED AFTER TEST PASSES
13840
+ * Test code preserved in: .opencode/unit-tests/
13841
+ */
13842
+
13843
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
13844
+
13845
+ // Mock all external dependencies BEFORE importing target
13846
+ vi.mock('../external-dep.js', () => ({}));
13847
+
13848
+ // Import target file
13849
+ import { targetFunction } from '../target.js';
13850
+
13851
+ describe('[filename] - Isolated Tests', () => {
13852
+ beforeEach(() => {
13853
+ vi.clearAllMocks();
13854
+ });
13855
+
13856
+ it('should [expected behavior]', () => {
13857
+ // Arrange
13858
+ // Act
13859
+ // Assert
13860
+ });
13861
+ });
13862
+ \`\`\`
13863
+
13864
+ ### Test Execution
13865
+ \`\`\`bash
13866
+ # Run ONLY this isolated test
13867
+ npm test -- src/auth/__tests__/login.isolated.test.ts --run
13868
+
13869
+ # Verify isolation - should not affect other tests
13870
+ npm test -- --run
13871
+ \`\`\`
13872
+
13873
+ ### FORBIDDEN:
13874
+ - Importing multiple source files to test together
13875
+ - Running full test suite for validation
13876
+ - Leaving isolated test files after completion
13877
+ - Modifying existing test files in the project
13878
+ ${PROMPT_TAGS.ISOLATION_TESTING.close}`;
13879
+
13880
+ // src/agents/prompts/worker/file-assignment.ts
13881
+ var WORKER_FILE_ASSIGNMENT = `${PROMPT_TAGS.FILE_ASSIGNMENT.open}
13882
+ ## FILE ASSIGNMENT PROTOCOL
13883
+
13884
+ You are assigned ONE FILE per session. Follow this protocol:
13885
+
13886
+ ### Step 1: Read Shared State
13887
+ \`\`\`bash
13888
+ # ALWAYS read these first
13889
+ cat ${PATHS.WORK_LOG}
13890
+ cat ${PATHS.TODO}
13891
+ cat ${PATHS.SYNC_ISSUES} 2>/dev/null || echo "No sync issues"
13892
+ \`\`\`
13893
+
13894
+ ### Step 2: Identify Your Assignment
13895
+ Commander gives you:
13896
+ - \`file: src/path/to/file.ts\` - Your target file
13897
+ - \`action: ${WORK_STATUS.ACTION.CREATE} | ${WORK_STATUS.ACTION.MODIFY} | ${WORK_STATUS.ACTION.FIX}\` - What to do
13898
+ - \`issue: ${ID_PREFIX.SYNC_ISSUE}N\` (optional) - If fixing a sync issue
13899
+
13900
+ ### Step 3: Update Work Log (Start)
13901
+ \`\`\`markdown
13902
+ ## Active Sessions
13903
+ - [ ] ${ID_PREFIX.SESSION}N (Worker): \`[file]\` - [action] ${WORK_STATUS.SESSION.STARTED}
13904
+ \`\`\`
13905
+
13906
+ ### Step 4: Read Context
13907
+ - If ${WORK_STATUS.ACTION.FIX}: Read ${PATHS.SYNC_ISSUES} for issue details
13908
+ - If ${WORK_STATUS.ACTION.CREATE}/${WORK_STATUS.ACTION.MODIFY}: Read TODO for requirements
13909
+ - Read other completed files in ${PATHS.WORK_LOG} for context
13910
+
13911
+ ### Step 5: TDD Cycle (See tdd-workflow)
13912
+ 1. Create isolated test
13913
+ 2. Implement
13914
+ 3. Pass test
13915
+ 4. Delete test (record in unit-tests/)
13916
+
13917
+ ### Step 6: Update Work Log (Complete)
13918
+ \`\`\`markdown
13919
+ ## Active Sessions
13920
+ - [x] ${ID_PREFIX.SESSION}N (Worker): \`[file]\` - [action] ${WORK_STATUS.SESSION.COMPLETED}
13921
+
13922
+ ## File Status (update row)
13923
+ | [file] | [action] | ${WORK_STATUS.STATUS.DONE} | ${ID_PREFIX.SESSION}N | ${WORK_STATUS.TEST_RESULT.PASS} | [timestamp] |
13924
+ \`\`\`
13925
+
13926
+ ### Step 7: Report
13927
+ Report to Commander via tool result:
13928
+ \`\`\`
13929
+ \u2705 File: [path]
13930
+ Action: [${WORK_STATUS.ACTION.CREATE}/${WORK_STATUS.ACTION.MODIFY}/${WORK_STATUS.ACTION.FIX}]
13931
+ Unit Test: ${WORK_STATUS.TEST_RESULT.PASS}
13932
+ Isolated test deleted, recorded in ${PATHS.UNIT_TESTS}/
13933
+ Ready for integration.
13934
+ \`\`\`
13935
+
13936
+ ### For SYNC FIX Assignments:
13937
+ 1. Read ${ID_PREFIX.SYNC_ISSUE}N from ${PATHS.SYNC_ISSUES}
13938
+ 2. Understand what's wrong
13939
+ 3. Apply ${AGENT_NAMES.COMMANDER}'s suggested fix
13940
+ 4. Test the fix in isolation
13941
+ 5. Update work-log with issue reference
13942
+
13943
+ \`\`\`markdown
13944
+ | src/file.ts | ${WORK_STATUS.ACTION.FIX} | ${WORK_STATUS.STATUS.DONE} | ${ID_PREFIX.SESSION}1 | ${WORK_STATUS.TEST_RESULT.PASS} | 2026-01-18T10:00:00 | ${ID_PREFIX.SYNC_ISSUE}1 |
13945
+ \`\`\`
13946
+
13947
+ ### PATH NOTES:
13948
+ - File paths use forward slash '/' in examples
13949
+ - On Windows, paths may use backslash '\\\\'
13950
+
13951
+ ### CRITICAL:
13952
+ - ONE file only - never touch other files
13953
+ - ALWAYS update ${PATHS.WORK_LOG} at start and end
13954
+ - READ ${PATHS.SYNC_ISSUES} if issue: tag is present
13955
+ - Follow Commander's specific instructions
13956
+ ${PROMPT_TAGS.FILE_ASSIGNMENT.close}`;
13957
+
13322
13958
  // src/agents/prompts/reviewer/role.ts
13323
13959
  var REVIEWER_ROLE = `<role>
13324
13960
  You are ${AGENT_NAMES.REVIEWER}. Verification specialist.
@@ -13448,6 +14084,223 @@ TODO STATUS:
13448
14084
  - [ ] T[N]: [task] | needs fix
13449
14085
  </output_format>`;
13450
14086
 
14087
+ // src/agents/prompts/reviewer/async-monitoring.ts
14088
+ var REVIEWER_ASYNC_MONITORING = `${PROMPT_TAGS.ASYNC_MONITORING.open}
14089
+ ## ASYNC PARALLEL WORK MONITORING
14090
+
14091
+ You monitor ${AGENT_NAMES.WORKER} sessions running in PARALLEL.
14092
+ Do NOT block - check status asynchronously and wait for completion.
14093
+
14094
+ ### Monitoring Loop
14095
+ 1. Read ${PATHS.WORK_LOG} to check active sessions:
14096
+ \`\`\`bash
14097
+ cat ${PATHS.WORK_LOG}
14098
+ \`\`\`
14099
+
14100
+ 2. Identify completed units (marked [x] in Active Sessions)
14101
+
14102
+ 3. For each completed unit:
14103
+ - Verify unit test record exists in ${PATHS.UNIT_TESTS}/
14104
+ - Check isolated test file was deleted
14105
+ - Verify implementation quality
14106
+
14107
+ 4. Wait for ALL parallel workers to complete before integration test
14108
+
14109
+ ### Status Check Pattern
14110
+ \`\`\`markdown
14111
+ ## Current Status Check
14112
+ - Total active workers: [N]
14113
+ - Completed units: [list]
14114
+ - Still running: [list]
14115
+ - Ready for integration: [YES/NO]
14116
+ \`\`\`
14117
+
14118
+ ### Non-Blocking Wait Strategy
14119
+ 1. If workers still running:
14120
+ - Report current status
14121
+ - DO NOT block or wait indefinitely
14122
+ - Schedule next check (Commander will re-invoke)
14123
+
14124
+ 2. If all workers complete:
14125
+ - Proceed to integration testing
14126
+ - Update ${PATHS.INTEGRATION_STATUS}
14127
+
14128
+ ### work-log.md Interpretation
14129
+ \`\`\`markdown
14130
+ # Reading work-log.md:
14131
+ - [ ] = Still in progress, DO NOT verify yet
14132
+ - [x] = Unit complete, READY for verification
14133
+ \`\`\`
14134
+
14135
+ ### CRITICAL:
14136
+ - NEVER verify a file before worker marks [x]
14137
+ - NEVER block waiting for workers
14138
+ - Always update ${PATHS.WORK_LOG} with your monitoring status
14139
+ ${PROMPT_TAGS.ASYNC_MONITORING.close}`;
14140
+
14141
+ // src/agents/prompts/reviewer/integration-testing.ts
14142
+ var REVIEWER_INTEGRATION_TESTING = `${PROMPT_TAGS.INTEGRATION_TESTING.open}
14143
+ ## E2E INTEGRATION TESTING
14144
+
14145
+ ### \u26A0\uFE0F E2E Test Timing (CRITICAL)
14146
+ E2E tests should only run when:
14147
+ 1. **TODO is almost complete** - Most tasks checked [x]
14148
+ 2. **All Workers done** - No active sessions in work-log.md
14149
+ 3. **Or final verification** - Right before SEALED
14150
+
14151
+ ### Pre-Integration Checklist
14152
+ - [ ] Check ${PATHS.TODO} for incomplete tasks
14153
+ - [ ] Check ${PATHS.WORK_LOG} for all workers [x] complete
14154
+ - [ ] Check ${PATHS.UNIT_TESTS}/ for unit test records
14155
+ - [ ] All isolated test files deleted
14156
+
14157
+ ### Integration Workflow
14158
+
14159
+ #### Step 1: Check TODO Status
14160
+ \`\`\`bash
14161
+ cat ${PATHS.TODO}
14162
+ # If incomplete items exist, wait for E2E
14163
+ \`\`\`
14164
+
14165
+ #### Step 2: Run Build (language-appropriate)
14166
+ \`\`\`bash
14167
+ # Run project build command
14168
+ # If failed, record in sync-issues.md
14169
+ \`\`\`
14170
+
14171
+ #### Step 3: Run Full Tests
14172
+ \`\`\`bash
14173
+ # Run project test command
14174
+ # Check for regressions
14175
+ \`\`\`
14176
+
14177
+ #### Step 4: Write E2E Integration Test (if needed)
14178
+ \`\`\`
14179
+ # Write integration test in appropriate format
14180
+ # Verify multiple files work together
14181
+ # Unlike isolated tests, DO NOT delete
14182
+ \`\`\`
14183
+
14184
+ #### Step 5: Record Results
14185
+ Write to ${PATHS.INTEGRATION_STATUS}:
14186
+ \`\`\`markdown
14187
+ # Integration Status
14188
+
14189
+ ## Last Integration
14190
+ - Timestamp: [ISO timestamp]
14191
+
14192
+ ## Result
14193
+ - Build: ${WORK_STATUS.TEST_RESULT.PASS}/${WORK_STATUS.TEST_RESULT.FAIL}
14194
+ - E2E Test: ${WORK_STATUS.TEST_RESULT.PASS}/${WORK_STATUS.TEST_RESULT.FAIL}
14195
+
14196
+ ## Sync Issues Found
14197
+ - (omit if none)
14198
+ \`\`\`
14199
+
14200
+ ---
14201
+
14202
+ ## Loop Condition Check (Reviewer verifies)
14203
+
14204
+ ### SEALED Conditions (all must be true)
14205
+ - [ ] ${PATHS.TODO} all items [x]
14206
+ - [ ] ${PATHS.SYNC_ISSUES} is empty
14207
+ - [ ] Build passes
14208
+ - [ ] E2E test passes
14209
+
14210
+ ### LOOP BACK Conditions
14211
+ - ${PATHS.TODO} has incomplete items \u2192 \u267B\uFE0F LOOP
14212
+ - ${PATHS.SYNC_ISSUES} has unresolved issues \u2192 \u267B\uFE0F LOOP
14213
+ - Build/test fails \u2192 record in sync-issues.md \u2192 \u267B\uFE0F LOOP
14214
+
14215
+ ### CRITICAL:
14216
+ - E2E only at TODO completion time!
14217
+ - Record build/test failures minimally in sync-issues.md
14218
+ - Delete resolved issues, keep only unresolved
14219
+ - All TODO [x] + no issues = SEALED!
14220
+ ${PROMPT_TAGS.INTEGRATION_TESTING.close}`;
14221
+
14222
+ // src/agents/prompts/reviewer/sync-verification.ts
14223
+ var REVIEWER_SYNC_VERIFICATION = `${PROMPT_TAGS.SYNC_VERIFICATION.open}
14224
+ ## FILE SYNC VERIFICATION
14225
+
14226
+ After integration, verify all files are properly synchronized.
14227
+
14228
+ ### Sync Check Areas
14229
+
14230
+ #### 1. Import/Export Consistency
14231
+ \`\`\`bash
14232
+ # Check for broken imports
14233
+ npm run build 2>&1 | grep -i "cannot find"
14234
+ npm run build 2>&1 | grep -i "not exported"
14235
+ \`\`\`
14236
+
14237
+ #### 2. Type Consistency
14238
+ \`\`\`bash
14239
+ # Check for type mismatches
14240
+ npx tsc --noEmit 2>&1 | grep -i "type"
14241
+ \`\`\`
14242
+
14243
+ #### 3. Interface Implementation
14244
+ - Check implemented interfaces match declarations
14245
+ - Verify function signatures match calls
14246
+
14247
+ #### 4. Shared State Consistency
14248
+ - Check constants used across files
14249
+ - Verify shared types are consistent
14250
+
14251
+ ---
14252
+
14253
+ ## ISSUE MANAGEMENT RULES \u26A0\uFE0F
14254
+
14255
+ ### sync-issues.md Contains UNRESOLVED ONLY
14256
+ - **Delete resolved issues immediately** (keep file clean)
14257
+ - **Keep only unresolved** (only what Commander needs to read)
14258
+ - **Summarize if too long** (archive old issues)
14259
+
14260
+ ### Issue Format (Minimal)
14261
+ \`\`\`markdown
14262
+ # Sync Issues (Unresolved Only)
14263
+
14264
+ ## ${ID_PREFIX.SYNC_ISSUE}N
14265
+ - Severity: ${WORK_STATUS.SEVERITY.HIGH}
14266
+ - Files: src/file1.ts \u2194 src/file2.ts
14267
+ - Problem: [concise description]
14268
+ - Fix: [specific solution]
14269
+ - Status: ${WORK_STATUS.STATUS.PENDING}
14270
+ \`\`\`
14271
+
14272
+ ### After Fix Verification
14273
+ When re-verifying after fixes:
14274
+ 1. Check if issue is resolved
14275
+ 2. If resolved: **DELETE the issue from sync-issues.md**
14276
+ 3. If not resolved: Update issue status, add notes
14277
+ 4. Keep file minimal
14278
+
14279
+ ---
14280
+
14281
+ ### Loop Continuation (NOT SEALED)
14282
+ If sync issues exist:
14283
+ 1. Write ONLY unresolved issues to ${PATHS.SYNC_ISSUES}
14284
+ 2. Delete resolved issues from file
14285
+ 3. Update ${PATHS.WORK_LOG} with required rework
14286
+ 4. DO NOT output SEALED
14287
+ 5. ${AGENT_NAMES.COMMANDER} will read and dispatch new work
14288
+
14289
+ ### Seal Condition
14290
+ Output SEALED only when:
14291
+ - [ ] All TODO items [x]
14292
+ - [ ] Build passes
14293
+ - [ ] All tests pass (${WORK_STATUS.TEST_RESULT.PASS})
14294
+ - [ ] ${PATHS.SYNC_ISSUES} is EMPTY (no unresolved issues)
14295
+ - [ ] ${PATHS.INTEGRATION_STATUS} shows ${WORK_STATUS.TEST_RESULT.PASS}
14296
+
14297
+ ### CRITICAL:
14298
+ - Always check sync AFTER integration tests
14299
+ - DELETE resolved issues immediately
14300
+ - Keep sync-issues.md as short as possible
14301
+ - Ensure ${AGENT_NAMES.COMMANDER} only sees what needs fixing
14302
+ ${PROMPT_TAGS.SYNC_VERIFICATION.close}`;
14303
+
13451
14304
  // src/agents/commander.ts
13452
14305
  var systemPrompt = [
13453
14306
  COMMANDER_ROLE,
@@ -13461,12 +14314,16 @@ var systemPrompt = [
13461
14314
  COMMANDER_AGENTS,
13462
14315
  TODO_RULES,
13463
14316
  COMMANDER_TODO_FORMAT,
14317
+ // Loop, shared state, sync handling
14318
+ COMMANDER_LOOP_CONTINUATION,
14319
+ COMMANDER_SYNC_HANDLING,
14320
+ SHARED_WORKSPACE,
13464
14321
  ANTI_HALLUCINATION_CORE,
13465
14322
  MISSION_SEAL_RULES
13466
14323
  ].join("\n\n");
13467
14324
  var commander = {
13468
14325
  id: AGENT_NAMES.COMMANDER,
13469
- description: "Commander - autonomous orchestrator with parallel execution",
14326
+ description: "Commander - orchestrator with parallel execution, loop state, and sync issue handling",
13470
14327
  systemPrompt,
13471
14328
  canWrite: true,
13472
14329
  canBash: true
@@ -13481,12 +14338,15 @@ var systemPrompt2 = [
13481
14338
  ANTI_HALLUCINATION_CORE,
13482
14339
  TODO_RULES,
13483
14340
  PLANNER_TODO_FORMAT,
14341
+ // File-level planning
14342
+ PLANNER_FILE_PLANNING,
14343
+ PLANNER_TODO_SYNC,
13484
14344
  PLANNER_RESEARCH,
13485
14345
  SHARED_WORKSPACE
13486
14346
  ].join("\n\n");
13487
14347
  var planner = {
13488
14348
  id: AGENT_NAMES.PLANNER,
13489
- description: "Planner - strategic planning and research",
14349
+ description: "Planner - file-level planning, TODO creation and sync",
13490
14350
  systemPrompt: systemPrompt2,
13491
14351
  canWrite: true,
13492
14352
  canBash: true
@@ -13500,12 +14360,17 @@ var systemPrompt3 = [
13500
14360
  ANTI_HALLUCINATION_CORE,
13501
14361
  WORKER_WORKFLOW,
13502
14362
  WORKER_QUALITY,
14363
+ // File assignment from Commander
14364
+ WORKER_FILE_ASSIGNMENT,
14365
+ // TDD-based isolated work
14366
+ WORKER_TDD_WORKFLOW,
14367
+ WORKER_ISOLATION_TESTING,
13503
14368
  VERIFICATION_REQUIREMENTS,
13504
14369
  SHARED_WORKSPACE
13505
14370
  ].join("\n\n");
13506
14371
  var worker = {
13507
14372
  id: AGENT_NAMES.WORKER,
13508
- description: "Worker - implementation and documentation",
14373
+ description: "Worker - TDD file-level implementation, reads .opencode, follows Commander",
13509
14374
  systemPrompt: systemPrompt3,
13510
14375
  canWrite: true,
13511
14376
  canBash: true
@@ -13519,12 +14384,16 @@ var systemPrompt4 = [
13519
14384
  REVIEWER_VERIFICATION,
13520
14385
  REVIEWER_TODO_UPDATE,
13521
14386
  VERIFICATION_REQUIREMENTS,
14387
+ // Async parallel work handling
14388
+ REVIEWER_ASYNC_MONITORING,
14389
+ REVIEWER_INTEGRATION_TESTING,
14390
+ REVIEWER_SYNC_VERIFICATION,
13522
14391
  REVIEWER_OUTPUT,
13523
14392
  SHARED_WORKSPACE
13524
14393
  ].join("\n\n");
13525
14394
  var reviewer = {
13526
14395
  id: AGENT_NAMES.REVIEWER,
13527
- description: "Reviewer - verification and context management",
14396
+ description: "Reviewer - async verification, integration testing, sync validation",
13528
14397
  systemPrompt: systemPrompt4,
13529
14398
  canWrite: true,
13530
14399
  canBash: true