@wolfx/oh-my-openagent 3.17.15 → 4.1.1

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 (225) hide show
  1. package/README.ja.md +178 -113
  2. package/README.ko.md +221 -149
  3. package/README.md +79 -51
  4. package/README.ru.md +118 -71
  5. package/README.zh-cn.md +139 -73
  6. package/dist/agents/agent-skill-resolution.d.ts +1 -0
  7. package/dist/agents/atlas/agent.d.ts +7 -12
  8. package/dist/agents/atlas/default-prompt-sections.d.ts +5 -5
  9. package/dist/agents/atlas/gemini-prompt-sections.d.ts +4 -4
  10. package/dist/agents/atlas/gpt-prompt-sections.d.ts +5 -5
  11. package/dist/agents/atlas/kimi-prompt-sections.d.ts +6 -0
  12. package/dist/agents/atlas/kimi.d.ts +2 -0
  13. package/dist/agents/atlas/opus-4-7-prompt-sections.d.ts +6 -0
  14. package/dist/agents/atlas/opus-4-7.d.ts +2 -0
  15. package/dist/agents/atlas/shared-prompt.d.ts +1 -1
  16. package/dist/agents/builtin-agents/available-skills.d.ts +1 -1
  17. package/dist/agents/builtin-agents/general-agents.d.ts +1 -0
  18. package/dist/agents/builtin-agents.d.ts +1 -1
  19. package/dist/agents/dynamic-agent-core-sections.d.ts +1 -0
  20. package/dist/agents/dynamic-agent-prompt-builder.d.ts +1 -1
  21. package/dist/agents/hephaestus/gpt-5-5.d.ts +0 -4
  22. package/dist/agents/prometheus/plan-generation.d.ts +1 -1
  23. package/dist/agents/types.d.ts +1 -0
  24. package/dist/config/index.d.ts +1 -1
  25. package/dist/config/schema/agent-names.d.ts +1 -0
  26. package/dist/config/schema/agent-overrides.d.ts +45 -0
  27. package/dist/config/schema/categories.d.ts +7 -1
  28. package/dist/config/schema/commands.d.ts +1 -0
  29. package/dist/config/schema/fallback-models.d.ts +5 -0
  30. package/dist/config/schema/hooks.d.ts +2 -0
  31. package/dist/config/schema/keyword-detector.d.ts +21 -0
  32. package/dist/config/schema/oh-my-opencode-config.d.ts +71 -0
  33. package/dist/config/schema/team-mode.d.ts +16 -0
  34. package/dist/config/schema.d.ts +2 -0
  35. package/dist/create-hooks.d.ts +4 -0
  36. package/dist/create-managers.d.ts +2 -0
  37. package/dist/features/background-agent/manager.d.ts +13 -0
  38. package/dist/features/background-agent/spawner.d.ts +4 -2
  39. package/dist/features/background-agent/task-poller.d.ts +1 -0
  40. package/dist/features/background-agent/types.d.ts +5 -0
  41. package/dist/features/boulder-state/format-duration.d.ts +1 -0
  42. package/dist/features/boulder-state/index.d.ts +1 -0
  43. package/dist/features/boulder-state/storage.d.ts +40 -1
  44. package/dist/features/boulder-state/types.d.ts +43 -0
  45. package/dist/features/builtin-commands/commands.d.ts +1 -0
  46. package/dist/features/builtin-commands/templates/hyperplan.d.ts +1 -0
  47. package/dist/features/builtin-commands/templates/refactor.d.ts +1 -0
  48. package/dist/features/builtin-commands/templates/remove-ai-slops.d.ts +1 -0
  49. package/dist/features/builtin-commands/templates/start-work.d.ts +1 -1
  50. package/dist/features/builtin-commands/types.d.ts +1 -1
  51. package/dist/features/builtin-skills/skills/git-master-sections/commit-workflow.d.ts +1 -1
  52. package/dist/features/builtin-skills/skills/git-master-sections/history-search-workflow.d.ts +1 -1
  53. package/dist/features/builtin-skills/skills/git-master-sections/overview.d.ts +1 -1
  54. package/dist/features/builtin-skills/skills/git-master-sections/quick-reference.d.ts +1 -1
  55. package/dist/features/builtin-skills/skills/git-master-sections/rebase-workflow.d.ts +1 -1
  56. package/dist/features/builtin-skills/skills/index.d.ts +1 -0
  57. package/dist/features/builtin-skills/skills/team-mode.d.ts +2 -0
  58. package/dist/features/builtin-skills/skills.d.ts +1 -0
  59. package/dist/features/claude-code-plugin-loader/discovery.d.ts +1 -0
  60. package/dist/features/hook-message-injector/injector.d.ts +2 -2
  61. package/dist/features/opencode-skill-loader/loader.d.ts +2 -2
  62. package/dist/features/opencode-skill-loader/skill-resolution-options.d.ts +1 -0
  63. package/dist/features/team-mode/deps.d.ts +6 -0
  64. package/dist/features/team-mode/member-guidance.d.ts +2 -0
  65. package/dist/features/team-mode/member-parser.d.ts +16 -0
  66. package/dist/features/team-mode/member-session-resolution.d.ts +6 -0
  67. package/dist/features/team-mode/member-session-routing.d.ts +19 -0
  68. package/dist/features/team-mode/team-layout-tmux/close-team-member-pane.d.ts +4 -0
  69. package/dist/features/team-mode/team-layout-tmux/layout.d.ts +26 -6
  70. package/dist/features/team-mode/team-layout-tmux/rebalance-team-window.d.ts +9 -0
  71. package/dist/features/team-mode/team-layout-tmux/resolve-caller-tmux-session.d.ts +7 -0
  72. package/dist/features/team-mode/team-layout-tmux/sweep-stale-team-sessions.d.ts +8 -0
  73. package/dist/features/team-mode/team-mailbox/ack.d.ts +2 -0
  74. package/dist/features/team-mode/team-mailbox/inbox.d.ts +3 -0
  75. package/dist/features/team-mode/team-mailbox/index.d.ts +7 -0
  76. package/dist/features/team-mode/team-mailbox/poll.d.ts +10 -0
  77. package/dist/features/team-mode/team-mailbox/reservation.d.ts +11 -0
  78. package/dist/features/team-mode/team-mailbox/send.d.ts +27 -0
  79. package/dist/features/team-mode/team-registry/index.d.ts +3 -0
  80. package/dist/features/team-mode/team-registry/loader.d.ts +12 -0
  81. package/dist/features/team-mode/team-registry/paths.d.ts +13 -0
  82. package/dist/features/team-mode/team-registry/team-spec-input-normalizer.d.ts +6 -0
  83. package/dist/features/team-mode/team-registry/validator.d.ts +10 -0
  84. package/dist/features/team-mode/team-runtime/activate-team-layout.d.ts +4 -0
  85. package/dist/features/team-mode/team-runtime/cleanup-team-run-resources.d.ts +17 -0
  86. package/dist/features/team-mode/team-runtime/create.d.ts +25 -0
  87. package/dist/features/team-mode/team-runtime/delete-team.d.ts +16 -0
  88. package/dist/features/team-mode/team-runtime/index.d.ts +2 -0
  89. package/dist/features/team-mode/team-runtime/resolve-member-dependencies.d.ts +3 -0
  90. package/dist/features/team-mode/team-runtime/resolve-member.d.ts +17 -0
  91. package/dist/features/team-mode/team-runtime/session-cleanup.d.ts +21 -0
  92. package/dist/features/team-mode/team-runtime/session-team-run-registry.d.ts +4 -0
  93. package/dist/features/team-mode/team-runtime/shutdown-helpers.d.ts +11 -0
  94. package/dist/features/team-mode/team-runtime/shutdown-test-fixtures.d.ts +46 -0
  95. package/dist/features/team-mode/team-runtime/shutdown.d.ts +5 -0
  96. package/dist/features/team-mode/team-runtime/status.d.ts +36 -0
  97. package/dist/features/team-mode/team-session-registry.d.ts +11 -0
  98. package/dist/features/team-mode/team-state-store/index.d.ts +1 -0
  99. package/dist/features/team-mode/team-state-store/locks.d.ts +12 -0
  100. package/dist/features/team-mode/team-state-store/resume.d.ts +10 -0
  101. package/dist/features/team-mode/team-state-store/store.d.ts +21 -0
  102. package/dist/features/team-mode/team-tasklist/claim.d.ts +10 -0
  103. package/dist/features/team-mode/team-tasklist/dependencies.d.ts +2 -0
  104. package/dist/features/team-mode/team-tasklist/get.d.ts +3 -0
  105. package/dist/features/team-mode/team-tasklist/index.d.ts +6 -0
  106. package/dist/features/team-mode/team-tasklist/list.d.ts +8 -0
  107. package/dist/features/team-mode/team-tasklist/store.d.ts +3 -0
  108. package/dist/features/team-mode/team-tasklist/test-support.d.ts +9 -0
  109. package/dist/features/team-mode/team-tasklist/update.d.ts +9 -0
  110. package/dist/features/team-mode/tools/index.d.ts +1 -0
  111. package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +188 -0
  112. package/dist/features/team-mode/tools/lifecycle.d.ts +37 -0
  113. package/dist/features/team-mode/tools/messaging.d.ts +31 -0
  114. package/dist/features/team-mode/tools/query.d.ts +16 -0
  115. package/dist/features/team-mode/tools/tasks.d.ts +18 -0
  116. package/dist/features/team-mode/types.d.ts +137 -5
  117. package/dist/features/tmux-subagent/action-executor-core.d.ts +1 -0
  118. package/dist/features/tmux-subagent/action-executor.d.ts +1 -0
  119. package/dist/features/tmux-subagent/attachable-session-status.d.ts +4 -0
  120. package/dist/features/tmux-subagent/cleanup.d.ts +10 -0
  121. package/dist/features/tmux-subagent/manager.d.ts +32 -3
  122. package/dist/features/tmux-subagent/pane-state-querier.d.ts +10 -0
  123. package/dist/features/tmux-subagent/polling.d.ts +1 -0
  124. package/dist/features/tmux-subagent/session-created-handler.d.ts +23 -0
  125. package/dist/features/tmux-subagent/session-deleted-handler.d.ts +16 -0
  126. package/dist/hooks/atlas/atlas-hook.d.ts +1 -1
  127. package/dist/hooks/atlas/boulder-continuation-injector.d.ts +3 -4
  128. package/dist/hooks/atlas/recent-model-resolver.d.ts +9 -1
  129. package/dist/hooks/atlas/system-reminder-templates.d.ts +1 -0
  130. package/dist/hooks/atlas/tool-execute-after.d.ts +3 -1
  131. package/dist/hooks/atlas/tool-execute-before.d.ts +2 -0
  132. package/dist/hooks/atlas/types.d.ts +10 -2
  133. package/dist/hooks/compaction-context-injector/recovery.d.ts +1 -1
  134. package/dist/hooks/compaction-context-injector/types.d.ts +1 -0
  135. package/dist/hooks/compaction-todo-preserver/hook.d.ts +11 -0
  136. package/dist/hooks/fsync-skip-warning/index.d.ts +18 -0
  137. package/dist/hooks/index.d.ts +4 -0
  138. package/dist/hooks/keyword-detector/constants.d.ts +6 -0
  139. package/dist/hooks/keyword-detector/detector.d.ts +5 -3
  140. package/dist/hooks/keyword-detector/hook.d.ts +2 -1
  141. package/dist/hooks/keyword-detector/hyperplan/default.d.ts +13 -0
  142. package/dist/hooks/keyword-detector/hyperplan/index.d.ts +1 -0
  143. package/dist/hooks/keyword-detector/team/default.d.ts +13 -0
  144. package/dist/hooks/keyword-detector/team/index.d.ts +1 -0
  145. package/dist/hooks/ralph-loop/continuation-prompt-injector.d.ts +7 -1
  146. package/dist/hooks/ralph-loop/iteration-continuation.d.ts +9 -1
  147. package/dist/hooks/ralph-loop/loop-state-controller.d.ts +1 -0
  148. package/dist/hooks/ralph-loop/pending-verification-handler.d.ts +3 -0
  149. package/dist/hooks/ralph-loop/ralph-loop-event-handler.d.ts +2 -0
  150. package/dist/hooks/ralph-loop/types.d.ts +1 -0
  151. package/dist/hooks/ralph-loop/verification-failure-handler.d.ts +3 -1
  152. package/dist/hooks/session-recovery/recover-tool-result-missing.d.ts +2 -2
  153. package/dist/hooks/shared/session-idle-settle.d.ts +11 -0
  154. package/dist/hooks/team-mailbox-injector/hook.d.ts +31 -0
  155. package/dist/hooks/team-mailbox-injector/index.d.ts +2 -0
  156. package/dist/hooks/team-mode-status-injector/hook.d.ts +28 -0
  157. package/dist/hooks/team-mode-status-injector/index.d.ts +1 -0
  158. package/dist/hooks/team-session-events/team-idle-wake-hint.d.ts +42 -0
  159. package/dist/hooks/team-session-events/team-lead-orphan-handler.d.ts +12 -0
  160. package/dist/hooks/team-session-events/team-member-error-handler.d.ts +10 -0
  161. package/dist/hooks/team-session-events/team-member-status-handler.d.ts +10 -0
  162. package/dist/hooks/team-tool-gating/hook.d.ts +3 -0
  163. package/dist/hooks/team-tool-gating/index.d.ts +1 -0
  164. package/dist/hooks/todo-description-override/description.d.ts +1 -1
  165. package/dist/hooks/unstable-agent-babysitter/unstable-agent-babysitter-hook.d.ts +2 -0
  166. package/dist/hooks/write-existing-file-guard/hook.d.ts +6 -1
  167. package/dist/hooks/write-existing-file-guard/tool-execute-before-handler.d.ts +1 -0
  168. package/dist/index.js +93264 -81453
  169. package/dist/oh-my-opencode.schema.json +199 -47
  170. package/dist/plugin/hooks/create-core-hooks.d.ts +4 -0
  171. package/dist/plugin/hooks/create-tool-guard-hooks.d.ts +3 -1
  172. package/dist/plugin/hooks/create-transform-hooks.d.ts +3 -1
  173. package/dist/plugin/recent-synthetic-idles.d.ts +1 -0
  174. package/dist/plugin/session-compacting.d.ts +31 -0
  175. package/dist/plugin/tool-registry.d.ts +16 -0
  176. package/dist/plugin-dispose.d.ts +13 -0
  177. package/dist/plugin-handlers/agent-priority-order.d.ts +6 -6
  178. package/dist/shared/agent-ordering.d.ts +8 -0
  179. package/dist/shared/agent-sort-shim.d.ts +8 -8
  180. package/dist/shared/agent-tool-restrictions.d.ts +5 -1
  181. package/dist/shared/bun-file-shim.d.ts +8 -0
  182. package/dist/shared/bun-hash-shim.d.ts +1 -0
  183. package/dist/shared/bun-spawn-shim.d.ts +1 -0
  184. package/dist/shared/bun-which-shim.d.ts +1 -0
  185. package/dist/shared/classify-path-environment.d.ts +3 -0
  186. package/dist/shared/event-session-id.d.ts +2 -0
  187. package/dist/shared/extract-semver.d.ts +1 -0
  188. package/dist/shared/fsync-skip-tracker.d.ts +12 -0
  189. package/dist/shared/fsync-skip-warning-formatter.d.ts +2 -0
  190. package/dist/shared/index.d.ts +3 -0
  191. package/dist/shared/internal-initiator-marker.d.ts +8 -0
  192. package/dist/shared/model-capability-heuristics.d.ts +1 -0
  193. package/dist/shared/opencode-version.d.ts +14 -1
  194. package/dist/shared/project-discovery-dirs.d.ts +1 -0
  195. package/dist/shared/session-route.d.ts +18 -0
  196. package/dist/shared/shell-env.d.ts +1 -0
  197. package/dist/shared/tmux/cmux-detect.d.ts +8 -0
  198. package/dist/shared/tmux/constants.d.ts +1 -1
  199. package/dist/shared/tmux/index.d.ts +2 -0
  200. package/dist/shared/tmux/runner.d.ts +13 -0
  201. package/dist/shared/tmux/tmux-utils/pane-replace.d.ts +1 -1
  202. package/dist/shared/tmux/tmux-utils/pane-spawn.d.ts +13 -1
  203. package/dist/shared/tmux/tmux-utils/session-spawn.d.ts +13 -1
  204. package/dist/shared/tmux/tmux-utils/stale-session-sweep.d.ts +9 -2
  205. package/dist/shared/tmux/tmux-utils/window-spawn.d.ts +13 -1
  206. package/dist/shared/tmux/tmux-utils.d.ts +1 -1
  207. package/dist/shared/tolerant-fsync.d.ts +5 -0
  208. package/dist/shared/write-file-atomically.d.ts +4 -1
  209. package/dist/tools/call-omo-agent/agent-resolver.d.ts +5 -12
  210. package/dist/tools/call-omo-agent/constants.d.ts +2 -2
  211. package/dist/tools/delegate-task/model-string-parser.d.ts +9 -0
  212. package/dist/tools/delegate-task/openai-categories.d.ts +1 -0
  213. package/dist/tools/delegate-task/resolve-call-id.d.ts +2 -0
  214. package/dist/tools/delegate-task/skill-resolver.d.ts +1 -0
  215. package/dist/tools/delegate-task/subagent-resolver.d.ts +5 -1
  216. package/dist/tools/delegate-task/sync-prompt-sender.d.ts +1 -0
  217. package/dist/tools/delegate-task/sync-result-fetcher.d.ts +3 -1
  218. package/dist/tools/delegate-task/types.d.ts +1 -0
  219. package/dist/tools/index.d.ts +1 -0
  220. package/dist/tools/interactive-bash/constants.d.ts +1 -0
  221. package/dist/tools/interactive-bash/tmux-path-resolver.d.ts +1 -0
  222. package/dist/tools/look-at/missing-file-error.d.ts +2 -0
  223. package/dist/tools/skill/types.d.ts +2 -0
  224. package/package.json +3 -4
  225. package/dist/hooks/ralph-loop/completion-promise-detector-test-input.d.ts +0 -11
@@ -5,10 +5,17 @@
5
5
  * Named after Sisyphus's boulder - the eternal task that must be rolled.
6
6
  */
7
7
  export interface BoulderState {
8
+ schema_version?: 2;
9
+ active_work_id?: string;
10
+ works?: Record<string, BoulderWorkState>;
8
11
  /** Absolute path to the active plan file */
9
12
  active_plan: string;
10
13
  /** ISO timestamp when work started */
11
14
  started_at: string;
15
+ ended_at?: string;
16
+ elapsed_ms?: number;
17
+ status?: BoulderWorkStatus;
18
+ updated_at?: string;
12
19
  /** Session IDs that have worked on this plan */
13
20
  session_ids: string[];
14
21
  session_origins?: Record<string, "direct" | "appended">;
@@ -21,6 +28,24 @@ export interface BoulderState {
21
28
  /** Preferred reusable subagent sessions keyed by current top-level plan task */
22
29
  task_sessions?: Record<string, TaskSessionState>;
23
30
  }
31
+ export type BoulderSessionOrigin = "direct" | "appended";
32
+ export type BoulderWorkStatus = "active" | "completed" | "paused" | "abandoned";
33
+ export type BoulderTaskStatus = "running" | "completed" | "cancelled";
34
+ export interface BoulderWorkState {
35
+ work_id: string;
36
+ active_plan: string;
37
+ plan_name: string;
38
+ status?: BoulderWorkStatus;
39
+ started_at: string;
40
+ ended_at?: string;
41
+ elapsed_ms?: number;
42
+ updated_at?: string;
43
+ session_ids: string[];
44
+ session_origins?: Record<string, BoulderSessionOrigin>;
45
+ agent?: string;
46
+ worktree_path?: string;
47
+ task_sessions?: Record<string, TaskSessionState>;
48
+ }
24
49
  export interface PlanProgress {
25
50
  /** Total number of checkboxes */
26
51
  total: number;
@@ -42,9 +67,27 @@ export interface TaskSessionState {
42
67
  agent?: string;
43
68
  /** Category associated with the task session, when known */
44
69
  category?: string;
70
+ started_at?: string;
71
+ ended_at?: string;
72
+ elapsed_ms?: number;
73
+ status?: BoulderTaskStatus;
45
74
  /** Last update timestamp */
46
75
  updated_at: string;
47
76
  }
77
+ export interface BoulderWorkResumeOption {
78
+ work_id: string;
79
+ plan_name: string;
80
+ active_plan: string;
81
+ worktree_path?: string;
82
+ status: BoulderWorkStatus;
83
+ started_at: string;
84
+ updated_at: string;
85
+ ended_at?: string;
86
+ elapsed_ms?: number;
87
+ session_count: number;
88
+ progress: PlanProgress;
89
+ is_current_mirror: boolean;
90
+ }
48
91
  export interface TopLevelTaskRef {
49
92
  /** Stable identifier for the current top-level plan task */
50
93
  key: string;
@@ -1,6 +1,7 @@
1
1
  import type { BuiltinCommandName, BuiltinCommands } from "./types";
2
2
  interface LoadBuiltinCommandsOptions {
3
3
  useRegisteredAgents?: boolean;
4
+ teamModeEnabled?: boolean;
4
5
  }
5
6
  export declare function loadBuiltinCommands(disabledCommands?: BuiltinCommandName[], options?: LoadBuiltinCommandsOptions): BuiltinCommands;
6
7
  export {};
@@ -0,0 +1 @@
1
+ export declare const HYPERPLAN_TEMPLATE = "You are running the `/hyperplan` command \u2014 adversarial multi-agent planning via team-mode.\n\nLOAD THE HYPERPLAN SKILL IMMEDIATELY:\n\n```\nskill(name=\"hyperplan\")\n```\n\nAfter loading the skill, follow its 7-phase workflow EXACTLY using this user request.\n\nRoster contract: call `team_create` with category members `unspecified-low`, `unspecified-high`, `ultrabrain`, and `artistry`. Include `deep` only if the category is enabled; if `deep` is disabled or unavailable, retry without only that member and state the degraded roster.\n\n<user-request>\n$ARGUMENTS\n</user-request>\n\nIf team-mode is unavailable (`team_*` tools missing), instruct the user to set `team_mode.enabled: true` in `~/.config/opencode/oh-my-opencode.jsonc` and restart opencode.";
@@ -1 +1,2 @@
1
1
  export declare const REFACTOR_TEMPLATE = "# Intelligent Refactor Command\n\n## Usage\n```\n/refactor <refactoring-target> [--scope=<file|module|project>] [--strategy=<safe|aggressive>]\n\nArguments:\n refactoring-target: What to refactor. Can be:\n - File path: src/auth/handler.ts\n - Symbol name: \"AuthService class\"\n - Pattern: \"all functions using deprecated API\"\n - Description: \"extract validation logic into separate module\"\n\nOptions:\n --scope: Refactoring scope (default: module)\n - file: Single file only\n - module: Module/directory scope\n - project: Entire codebase\n\n --strategy: Risk tolerance (default: safe)\n - safe: Conservative, maximum test coverage required\n - aggressive: Allow broader changes with adequate coverage\n```\n\n## What This Command Does\n\nPerforms intelligent, deterministic refactoring with full codebase awareness. Unlike blind search-and-replace, this command:\n\n1. **Understands your intent** - Analyzes what you actually want to achieve\n2. **Maps the codebase** - Builds a definitive codemap before touching anything\n3. **Assesses risk** - Evaluates test coverage and determines verification strategy\n4. **Plans meticulously** - Creates a detailed plan with Plan agent\n5. **Executes precisely** - Step-by-step refactoring with LSP and AST-grep\n6. **Verifies constantly** - Runs tests after each change to ensure zero regression\n\n---\n\n# PHASE 0: INTENT GATE (MANDATORY FIRST STEP)\n\n**BEFORE ANY ACTION, classify and validate the request.**\n\n## Step 0.1: Parse Request Type\n\n| Signal | Classification | Action |\n|--------|----------------|--------|\n| Specific file/symbol | Explicit | Proceed to codebase analysis |\n| \"Refactor X to Y\" | Clear transformation | Proceed to codebase analysis |\n| \"Improve\", \"Clean up\" | Open-ended | **MUST ask**: \"What specific improvement?\" |\n| Ambiguous scope | Uncertain | **MUST ask**: \"Which modules/files?\" |\n| Missing context | Incomplete | **MUST ask**: \"What's the desired outcome?\" |\n\n## Step 0.2: Validate Understanding\n\nBefore proceeding, confirm:\n- [ ] Target is clearly identified\n- [ ] Desired outcome is understood\n- [ ] Scope is defined (file/module/project)\n- [ ] Success criteria can be articulated\n\n**If ANY of above is unclear, ASK CLARIFYING QUESTION:**\n\n```\nI want to make sure I understand the refactoring goal correctly.\n\n**What I understood**: [interpretation]\n**What I'm unsure about**: [specific ambiguity]\n\nOptions I see:\n1. [Option A] - [implications]\n2. [Option B] - [implications]\n\n**My recommendation**: [suggestion with reasoning]\n\nShould I proceed with [recommendation], or would you prefer differently?\n```\n\n## Step 0.3: Create Initial Todos\n\n**IMMEDIATELY after understanding the request, create todos:**\n\n```\nTodoWrite([\n {\"id\": \"phase-1\", \"content\": \"PHASE 1: Codebase Analysis - launch parallel explore agents\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-2\", \"content\": \"PHASE 2: Build Codemap - map dependencies and impact zones\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-3\", \"content\": \"PHASE 3: Test Assessment - analyze test coverage and verification strategy\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-4\", \"content\": \"PHASE 4: Plan Generation - invoke Plan agent for detailed refactoring plan\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-5\", \"content\": \"PHASE 5: Execute Refactoring - step-by-step with continuous verification\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"phase-6\", \"content\": \"PHASE 6: Final Verification - full test suite and regression check\", \"status\": \"pending\", \"priority\": \"high\"}\n])\n```\n\n---\n\n# PHASE 1: CODEBASE ANALYSIS (PARALLEL EXPLORATION)\n\n**Mark phase-1 as in_progress.**\n\n## 1.1: Launch Parallel Explore Agents (BACKGROUND)\n\nFire ALL of these simultaneously using `call_omo_agent`:\n\n```\n// Agent 1: Find the refactoring target\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find all occurrences and definitions of [TARGET]. \n Report: file paths, line numbers, usage patterns.\"\n)\n\n// Agent 2: Find related code\ncall_omo_agent(\n subagent_type=\"explore\", \n run_in_background=true,\n prompt=\"Find all code that imports, uses, or depends on [TARGET].\n Report: dependency chains, import graphs.\"\n)\n\n// Agent 3: Find similar patterns\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find similar code patterns to [TARGET] in the codebase.\n Report: analogous implementations, established conventions.\"\n)\n\n// Agent 4: Find tests\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find all test files related to [TARGET].\n Report: test file paths, test case names, coverage indicators.\"\n)\n\n// Agent 5: Architecture context\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=true,\n prompt=\"Find architectural patterns and module organization around [TARGET].\n Report: module boundaries, layer structure, design patterns in use.\"\n)\n```\n\n## 1.2: Direct Tool Exploration (WHILE AGENTS RUN)\n\nWhile background agents are running, use direct tools:\n\n### LSP Tools for Precise Analysis:\n\n```typescript\n// Find definition(s)\nLspGotoDefinition(filePath, line, character) // Where is it defined?\n\n// Find ALL usages across workspace\nLspFindReferences(filePath, line, character, includeDeclaration=true)\n\n// Get file structure\nLspDocumentSymbols(filePath) // Hierarchical outline\nLspWorkspaceSymbols(filePath, query=\"[target_symbol]\") // Search by name\n\n// Get current diagnostics\nlsp_diagnostics(filePath) // Errors, warnings before we start\n```\n\n### AST-Grep for Pattern Analysis:\n\n```typescript\n// Find structural patterns\nast_grep_search(\n pattern=\"function $NAME($$$) { $$$ }\", // or relevant pattern\n lang=\"typescript\", // or relevant language\n paths=[\"src/\"]\n)\n\n// Preview refactoring (DRY RUN)\nast_grep_replace(\n pattern=\"[old_pattern]\",\n rewrite=\"[new_pattern]\",\n lang=\"[language]\",\n dryRun=true // ALWAYS preview first\n)\n```\n\n### Grep for Text Patterns:\n\n```\ngrep(pattern=\"[search_term]\", path=\"src/\", include=\"*.ts\")\n```\n\n## 1.3: Collect Background Results\n\n```\nbackground_output(task_id=\"[agent_1_id]\")\nbackground_output(task_id=\"[agent_2_id]\")\n...\n```\n\n**Mark phase-1 as completed after all results collected.**\n\n---\n\n# PHASE 2: BUILD CODEMAP (DEPENDENCY MAPPING)\n\n**Mark phase-2 as in_progress.**\n\n## 2.1: Construct Definitive Codemap\n\nBased on Phase 1 results, build:\n\n```\n## CODEMAP: [TARGET]\n\n### Core Files (Direct Impact)\n- `path/to/file.ts:L10-L50` - Primary definition\n- `path/to/file2.ts:L25` - Key usage\n\n### Dependency Graph\n```\n[TARGET] \n\u251C\u2500\u2500 imports from: \n\u2502 \u251C\u2500\u2500 module-a (types)\n\u2502 \u2514\u2500\u2500 module-b (utils)\n\u251C\u2500\u2500 imported by:\n\u2502 \u251C\u2500\u2500 consumer-1.ts\n\u2502 \u251C\u2500\u2500 consumer-2.ts\n\u2502 \u2514\u2500\u2500 consumer-3.ts\n\u2514\u2500\u2500 used by:\n \u251C\u2500\u2500 handler.ts (direct call)\n \u2514\u2500\u2500 service.ts (dependency injection)\n```\n\n### Impact Zones\n| Zone | Risk Level | Files Affected | Test Coverage |\n|------|------------|----------------|---------------|\n| Core | HIGH | 3 files | 85% covered |\n| Consumers | MEDIUM | 8 files | 70% covered |\n| Edge | LOW | 2 files | 50% covered |\n\n### Established Patterns\n- Pattern A: [description] - used in N places\n- Pattern B: [description] - established convention\n```\n\n## 2.2: Identify Refactoring Constraints\n\nBased on codemap:\n- **MUST follow**: [existing patterns identified]\n- **MUST NOT break**: [critical dependencies]\n- **Safe to change**: [isolated code zones]\n- **Requires migration**: [breaking changes impact]\n\n**Mark phase-2 as completed.**\n\n---\n\n# PHASE 3: TEST ASSESSMENT (VERIFICATION STRATEGY)\n\n**Mark phase-3 as in_progress.**\n\n## 3.1: Detect Test Infrastructure\n\n```bash\n# Check for test commands\ncat package.json | jq '.scripts | keys[] | select(test(\"test\"))'\n\n# Or for Python\nls -la pytest.ini pyproject.toml setup.cfg\n\n# Or for Go\nls -la *_test.go\n```\n\n## 3.2: Analyze Test Coverage\n\n```\n// Find all tests related to target\ncall_omo_agent(\n subagent_type=\"explore\",\n run_in_background=false, // Need this synchronously\n prompt=\"Analyze test coverage for [TARGET]:\n 1. Which test files cover this code?\n 2. What test cases exist?\n 3. Are there integration tests?\n 4. What edge cases are tested?\n 5. Estimated coverage percentage?\"\n)\n```\n\n## 3.3: Determine Verification Strategy\n\nBased on test analysis:\n\n| Coverage Level | Strategy |\n|----------------|----------|\n| HIGH (>80%) | Run existing tests after each step |\n| MEDIUM (50-80%) | Run tests + add safety assertions |\n| LOW (<50%) | **PAUSE**: Propose adding tests first |\n| NONE | **BLOCK**: Refuse aggressive refactoring |\n\n**If coverage is LOW or NONE, ask user:**\n\n```\nTest coverage for [TARGET] is [LEVEL].\n\n**Risk Assessment**: Refactoring without adequate tests is dangerous.\n\nOptions:\n1. Add tests first, then refactor (RECOMMENDED)\n2. Proceed with extra caution, manual verification required\n3. Abort refactoring\n\nWhich approach do you prefer?\n```\n\n## 3.4: Document Verification Plan\n\n```\n## VERIFICATION PLAN\n\n### Test Commands\n- Unit: `bun test` / `npm test` / `pytest` / etc.\n- Integration: [command if exists]\n- Type check: `tsc --noEmit` / `pyright` / etc.\n\n### Verification Checkpoints\nAfter each refactoring step:\n1. lsp_diagnostics \u2192 zero new errors\n2. Run test command \u2192 all pass\n3. Type check \u2192 clean\n\n### Regression Indicators\n- [Specific test that must pass]\n- [Behavior that must be preserved]\n- [API contract that must not change]\n```\n\n**Mark phase-3 as completed.**\n\n---\n\n# PHASE 4: PLAN GENERATION (PLAN AGENT)\n\n**Mark phase-4 as in_progress.**\n\n## 4.1: Invoke Plan Agent\n\n```\nTask(\n subagent_type=\"plan\",\n prompt=\"Create a detailed refactoring plan:\n\n ## Refactoring Goal\n [User's original request]\n\n ## Codemap (from Phase 2)\n [Insert codemap here]\n\n ## Test Coverage (from Phase 3)\n [Insert verification plan here]\n\n ## Constraints\n - MUST follow existing patterns: [list]\n - MUST NOT break: [critical paths]\n - MUST run tests after each step\n\n ## Requirements\n 1. Break down into atomic refactoring steps\n 2. Each step must be independently verifiable\n 3. Order steps by dependency (what must happen first)\n 4. Specify exact files and line ranges for each step\n 5. Include rollback strategy for each step\n 6. Define commit checkpoints\"\n)\n```\n\n## 4.2: Review and Validate Plan\n\nAfter receiving plan from Plan agent:\n\n1. **Verify completeness**: All identified files addressed?\n2. **Verify safety**: Each step reversible?\n3. **Verify order**: Dependencies respected?\n4. **Verify verification**: Test commands specified?\n\n## 4.3: Register Detailed Todos\n\nConvert Plan agent output into granular todos:\n\n```\nTodoWrite([\n // Each step from the plan becomes a todo\n {\"id\": \"refactor-1\", \"content\": \"Step 1: [description]\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"verify-1\", \"content\": \"Verify Step 1: run tests\", \"status\": \"pending\", \"priority\": \"high\"},\n {\"id\": \"refactor-2\", \"content\": \"Step 2: [description]\", \"status\": \"pending\", \"priority\": \"medium\"},\n {\"id\": \"verify-2\", \"content\": \"Verify Step 2: run tests\", \"status\": \"pending\", \"priority\": \"medium\"},\n // ... continue for all steps\n])\n```\n\n**Mark phase-4 as completed.**\n\n---\n\n# PHASE 5: EXECUTE REFACTORING (DETERMINISTIC EXECUTION)\n\n**Mark phase-5 as in_progress.**\n\n## 5.1: Execution Protocol\n\nFor EACH refactoring step:\n\n### Pre-Step\n1. Mark step todo as `in_progress`\n2. Read current file state\n3. Verify lsp_diagnostics is baseline\n\n### Execute Step\nUse appropriate tool:\n\n**For Symbol Renames:**\n```typescript\nlsp_prepare_rename(filePath, line, character) // Validate rename is possible\nlsp_rename(filePath, line, character, newName) // Execute rename\n```\n\n**For Pattern Transformations:**\n```typescript\n// Preview first\nast_grep_replace(pattern, rewrite, lang, dryRun=true)\n\n// If preview looks good, execute\nast_grep_replace(pattern, rewrite, lang, dryRun=false)\n```\n\n**For Structural Changes:**\n```typescript\n// Use Edit tool for precise changes\nedit(filePath, oldString, newString)\n```\n\n### Post-Step Verification (MANDATORY)\n\n```typescript\n// 1. Check diagnostics\nlsp_diagnostics(filePath) // Must be clean or same as baseline\n\n// 2. Run tests\nbash(\"bun test\") // Or appropriate test command\n\n// 3. Type check\nbash(\"tsc --noEmit\") // Or appropriate type check\n```\n\n### Step Completion\n1. If verification passes \u2192 Mark step todo as `completed`\n2. If verification fails \u2192 **STOP AND FIX**\n\n## 5.2: Failure Recovery Protocol\n\nIf ANY verification fails:\n\n1. **STOP** immediately\n2. **REVERT** the failed change\n3. **DIAGNOSE** what went wrong\n4. **OPTIONS**:\n - Fix the issue and retry\n - Skip this step (if optional)\n - Consult oracle agent for help\n - Ask user for guidance\n\n**NEVER proceed to next step with broken tests.**\n\n## 5.3: Commit Checkpoints\n\nAfter each logical group of changes:\n\n```bash\ngit add [changed-files]\ngit commit -m \"refactor(scope): description\n\n[details of what was changed and why]\"\n```\n\n**Mark phase-5 as completed when all refactoring steps done.**\n\n---\n\n# PHASE 6: FINAL VERIFICATION (REGRESSION CHECK)\n\n**Mark phase-6 as in_progress.**\n\n## 6.1: Full Test Suite\n\n```bash\n# Run complete test suite\nbun test # or npm test, pytest, go test, etc.\n```\n\n## 6.2: Type Check\n\n```bash\n# Full type check\ntsc --noEmit # or equivalent\n```\n\n## 6.3: Lint Check\n\n```bash\n# Run linter\neslint . # or equivalent\n```\n\n## 6.4: Build Verification (if applicable)\n\n```bash\n# Ensure build still works\nbun run build # or npm run build, etc.\n```\n\n## 6.5: Final Diagnostics\n\n```typescript\n// Check all changed files\nfor (file of changedFiles) {\n lsp_diagnostics(file) // Must all be clean\n}\n```\n\n## 6.6: Generate Summary\n\n```markdown\n## Refactoring Complete\n\n### What Changed\n- [List of changes made]\n\n### Files Modified\n- `path/to/file.ts` - [what changed]\n- `path/to/file2.ts` - [what changed]\n\n### Verification Results\n- Tests: PASSED (X/Y passing)\n- Type Check: CLEAN\n- Lint: CLEAN\n- Build: SUCCESS\n\n### No Regressions Detected\nAll existing tests pass. No new errors introduced.\n```\n\n**Mark phase-6 as completed.**\n\n---\n\n# CRITICAL RULES\n\n## NEVER DO\n- Skip lsp_diagnostics check after changes\n- Proceed with failing tests\n- Make changes without understanding impact\n- Use `as any`, `@ts-ignore`, `@ts-expect-error`\n- Delete tests to make them pass\n- Commit broken code\n- Refactor without understanding existing patterns\n\n## ALWAYS DO\n- Understand before changing\n- Preview before applying (ast_grep dryRun=true)\n- Verify after every change\n- Follow existing codebase patterns\n- Keep todos updated in real-time\n- Commit at logical checkpoints\n- Report issues immediately\n\n## ABORT CONDITIONS\nIf any of these occur, **STOP and consult user**:\n- Test coverage is zero for target code\n- Changes would break public API\n- Refactoring scope is unclear\n- 3 consecutive verification failures\n- User-defined constraints violated\n\n---\n\n# Tool Usage Philosophy\n\nYou already know these tools. Use them intelligently:\n\n## LSP Tools\nLeverage LSP tools for precision analysis. Key patterns:\n- **Understand before changing**: `LspGotoDefinition` to grasp context\n- **Impact analysis**: `LspFindReferences` to map all usages before modification\n- **Safe refactoring**: `lsp_prepare_rename` \u2192 `lsp_rename` for symbol renames\n- **Continuous verification**: `lsp_diagnostics` after every change\n\n## AST-Grep\nUse `ast_grep_search` and `ast_grep_replace` for structural transformations.\n**Critical**: Always `dryRun=true` first, review, then execute.\n\n## Agents\n- `explore`: Parallel codebase pattern discovery\n- `plan`: Detailed refactoring plan generation\n- `oracle`: Read-only consultation for complex architectural decisions and debugging\n- `librarian`: **Use proactively** when encountering deprecated methods or library migration tasks. Query official docs and OSS examples for modern replacements.\n\n## Deprecated Code & Library Migration\nWhen you encounter deprecated methods/APIs during refactoring:\n1. Fire `librarian` to find the recommended modern alternative\n2. **DO NOT auto-upgrade to latest version** unless user explicitly requests migration\n3. If user requests library migration, use `librarian` to fetch latest API docs before making changes\n\n---\n\n**Remember: Refactoring without tests is reckless. Refactoring without understanding is destructive. This command ensures you do neither.**\n\n<user-request>\n$ARGUMENTS\n</user-request>\n";
2
+ export declare const REFACTOR_TEAM_MODE_ADDENDUM = "\n---\n\n# Team Mode Protocol (active when team_* tools are present)\n\nTeam mode is enabled for this session. The rules below **override Phase 4-6** above. Follow this protocol instead of the in-session step-by-step execution.\n\n## Phase 4 override: Plan agent staffing requirement\n\nWhen invoking the Plan agent in Phase 4.1, append this additional requirement to the prompt:\n\n```\n7. (REQUIRED when team mode is active) Output a Team Staffing Recommendation section with these fields \u2014 missing fields fail Phase 5.0:\n - total_atomic_steps: integer\n - file_independent_steps: integer (parallelizable, no cross-file blocker)\n - cross_file_dependent_steps: integer (has blockers)\n - per_step_assignment: [{step_id, assigned_to: 'quick' | 'unspecified-low', blockedBy: [step_ids], rationale}]\n - dispatch_path_recommendation: 'team' | 'legacy' with reason\n - rationale for the composition\n```\n\n**Classification rules** the plan agent must apply to each step:\n- `quick`: mechanical edits \u2014 LSP rename, extract variable, inline, simple move, signature change without call-site logic.\n- `unspecified-low`: logic-preserving refactors that need reasoning \u2014 extract function, restructure conditional, pattern transformation, cross-file API change.\n- Recommend `team` path when `file_independent_steps >= 3`; recommend `legacy` otherwise.\n\n## Phase 5 override: Dispatch path selection\n\nRead the Team Staffing Recommendation from Phase 4. If any required field is missing, fail here and re-request the plan with the exact missing field names. Do not proceed with a partial plan.\n\nThen choose the path:\n\n- **Team path (5.1-T)**: when the plan recommends `team` AND `file_independent_steps >= 3`. Members execute in parallel, Lead orchestrates, a `deep` verifier lives outside the team.\n- **Legacy path (5.1-L)**: otherwise. Use the original 5.1 / 5.2 / 5.3 flow from above.\n\nRecord the chosen path in the TodoWrite list.\n\n## Phase 5.1-T: `refactor-squad` team execution\n\n**Precondition checks** (fail hard if any step fails):\n\n1. Load the `team-mode` skill via the `skill` tool for lifecycle, message protocol, and limits.\n2. Call `team_list` and verify no active `refactor-squad` run exists; if one does, shutdown + delete the orphan before proceeding.\n3. If `~/.omo/teams/refactor-squad/config.json` is missing, write it using the spec below.\n\n**Team spec** (`~/.omo/teams/refactor-squad/config.json`):\n\n```json\n{\n \"name\": \"refactor-squad\",\n \"lead\": { \"kind\": \"subagent_type\", \"subagent_type\": \"sisyphus\" },\n \"members\": [\n {\n \"kind\": \"category\",\n \"category\": \"quick\",\n \"prompt\": \"You handle mechanical refactoring steps (LSP rename, extract variable, inline, simple move, signature change). Use LSP tools for correctness. Apply the task description's per-step instructions verbatim \u2014 no scope expansion. After edits, run lsp_diagnostics on touched files. Report via team_send_message(teamRunId=<id>, to=\"lead\", summary=<files touched>, body=<lsp status + diff summary>) + team_task_update(status=completed). Never run tests \u2014 the external verifier handles that. Never git add, never --continue.\"\n },\n { \"kind\": \"category\", \"category\": \"quick\", \"prompt\": \"Same contract as peer quick worker.\" },\n {\n \"kind\": \"category\",\n \"category\": \"unspecified-low\",\n \"prompt\": \"You handle logic-preserving refactors that need reasoning (extract function, restructure conditional, pattern transformation, cross-file API change). Read the task description's plan step carefully. Use ast_grep_replace with dryRun=true first, review the preview, then execute. If the step is ambiguous or would require out-of-scope changes, STOP and send team_send_message(teamRunId=<id>, to=\"lead\", summary=\"UNCLEAR\", body=<reason>) + team_task_update(status=pending). Same reporting contract as peer quick workers. Never run tests.\"\n },\n { \"kind\": \"category\", \"category\": \"unspecified-low\", \"prompt\": \"Same contract as peer unspecified-low worker.\" }\n ]\n}\n```\n\nRationale for this composition:\n- **4 workers = team mode's parallel cap.** 5+ just queues.\n- **No verifier team member.** Verification needs `deep` reasoning (or `unspecified-high` fallback). In-team category routing downcasts to sisyphus-junior, which is weaker than required \u2014 the verifier runs OUTSIDE the team as a `task(category=\"deep\")`.\n- **quick \u00D7 2** for mechanical edits, **unspecified-low \u00D7 2** for reasoning edits \u2014 mirrors the plan's split.\n\n**Team lifecycle** (one team, reused until Phase 6 cleanup):\n\n1. `team_create(teamName=\"refactor-squad\")`. Record `teamRunId`.\n2. Broadcast the refactor Intent Card ONCE (keep task descriptions slim):\n ```\n team_send_message(\n teamRunId=<id>, to=\"*\", kind=\"announcement\",\n summary=\"refactor-intent\",\n body=<codemap summary + constraints + established patterns from Phase 2>\n )\n ```\n3. Broadcast the verification spec ONCE:\n ```\n team_send_message(\n teamRunId=<id>, to=\"*\", kind=\"announcement\",\n summary=\"verify-spec\",\n body=<exact test/typecheck/lint commands + expected pass counts + regression indicators from Phase 3.4>\n )\n ```\n4. For each plan step, `team_task_create(teamRunId=<id>, subject=\"refactor step <N>: <short>\", description=<per-step instructions from plan, including target files and line ranges, rollback strategy>, blockedBy=<from plan's per_step_assignment>)`.\n\n**Lead monitoring loop**:\n\nWhile any team task is `pending | claimed | in_progress`:\n\n- Wait for `<system-reminder>` or member messages. Avoid tight polling; a single `team_status` check is acceptable if no notification arrives within roughly 10 seconds of expected completion.\n- On a worker completion report, immediately dispatch an **external verifier** \u2014 verification runs OUTSIDE the team because team-member category routing downcasts to sisyphus-junior:\n ```\n task(\n category=\"deep\",\n load_skills=[],\n run_in_background=true,\n description=\"verify step <N>\",\n prompt=<files touched + verify-spec commands + instruction to return \"PASS\" or \"FAIL:<failing test + specific error + suggested revert hunks>\">\n )\n ```\n If `deep` is unavailable, fall back to `category=\"unspecified-high\"`. Do not create a commit checkpoint until the verifier returns PASS.\n- On a verifier PASS: make the commit checkpoint for that step (see original 5.3). Proceed.\n- On a verifier FAIL: Lead decides:\n - **Retry with fix hint**: `team_task_update(status=pending)` on the original step + `team_send_message(teamRunId=<id>, to=<original member>, summary=\"retry\", body=<specific failure from verifier>)`. Runtime reassigns.\n - **Escalate**: after three FAIL cycles on the same step, STOP and consult the user with full evidence.\n- On a member UNCLEAR message: re-harvest context via a targeted `task()` outside the team, broadcast an updated Intent Card fragment, then reassign.\n\nProceed to Phase 6 only when every team task is `completed` AND every paired verifier task returned PASS.\n\n## Phase 6 override: Team cleanup before summary\n\nIf Phase 5 used the team path, dismantle `refactor-squad` BEFORE producing the 6.6 summary. Every exit path \u2014 success, escalation, abort \u2014 must cleanup; orphan teams poison the next session's precondition check.\n\n1. `team_shutdown_request` for each member, then `team_approve_shutdown` if members do not self-approve within a reasonable window.\n2. `team_delete(teamRunId=<id>)`.\n3. `team_list` to confirm no residual `refactor-squad` run.\n\nThe `~/.omo/teams/refactor-squad/config.json` declaration stays on disk; next session reuses it.\n\nAppend to the 6.6 summary a \"Dispatch path\" line and, when team path was used, team metrics (teamRunId, tasks created, verifier runs, team lifetime).\n\n## MUST NOT (team mode)\n\n- Lead never edits files directly \u2014 orchestrate only.\n- Do not inline the Intent Card or verify-spec into task descriptions \u2014 rely on the broadcasts.\n- Do not recreate the team mid-session.\n- Do not run tests from Lead \u2014 the external verifier owns that lane.\n- Do not put `oracle` / `librarian` / `deep` into the team spec \u2014 oracle/librarian are team-ineligible, and `deep` under category routing downcasts to sisyphus-junior. Use them via `task()` outside the team when needed.\n";
@@ -1 +1,2 @@
1
1
  export declare const REMOVE_AI_SLOPS_TEMPLATE = "# Remove AI Slops Command\n\n## What this command does\nAnalyzes all files changed in the current branch (compared to parent commit), removes AI-generated code smells in parallel, then critically reviews the changes to ensure safety and behavior preservation. Fixes any issues found during review.\n\n## Step 0: Task Planning\n\nUse TodoWrite to create the task list:\n1. Get changed files from branch\n2. Run ai-slop-remover on each file in parallel\n3. Critically review all changes\n4. Fix any issues found\n\n## Role Definition\nYou are a senior code quality engineer specialized in identifying and removing AI-generated code patterns while preserving original functionality. You have deep expertise in code review, refactoring safety, and behavioral preservation.\n\n## Process\n\n### Phase 1: Identify Changed Files\nDetect the repository base branch dynamically, then get all changed files in the current branch:\n```bash\nBASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo \"main\")\ngit diff $(git merge-base \"$BASE_BRANCH\" HEAD)..HEAD --name-only\n```\n\nIf `git symbolic-ref refs/remotes/origin/HEAD` is unavailable, detect the base branch at runtime using the repo's configured remote default branch. Only fall back to `main` as a last resort.\n\n### Phase 2: Parallel AI Slop Removal\nFor each changed file, spawn an agent in parallel using the Task tool with the ai-slop-remover skill:\n\n```\ntask(category=\"quick\", load_skills=[\"ai-slop-remover\"], run_in_background=true, description=\"Remove AI slops from {filename}\", prompt=\"Remove AI slops from: {file_path}\")\n```\n\n**CRITICAL**: Launch ALL agents in a SINGLE message with multiple Task tool calls for maximum parallelism.\n\nBefore running ai-slop-remover on each file, save a file-specific rollback artifact that captures only the delta introduced by the slop-removal pass. Use a safe pattern such as generating a per-file patch and reverse-applying it if review fails.\n\nDo NOT use `git checkout -- {file_path}` or any rollback that discards pre-existing branch changes in the file.\n\n### Phase 3: Critical Review\nAfter all ai-slop-remover agents complete, perform a critical review with the following checklist:\n\n**Safety Verification**:\n- [ ] No functional logic was accidentally removed\n- [ ] All error handling is preserved\n- [ ] Type hints remain correct and complete\n- [ ] Import statements are still valid\n- [ ] No breaking changes to public APIs\n\n**Behavior Preservation**:\n- [ ] Return values unchanged\n- [ ] Side effects unchanged\n- [ ] Exception behavior unchanged\n- [ ] Edge case handling preserved\n\n**Code Quality**:\n- [ ] Removed changes are genuinely AI slop (not intentional patterns)\n- [ ] Remaining code follows project conventions\n- [ ] No orphaned code or dead references\n\n### Phase 4: Fix Issues\nIf any issues are found during critical review:\n1. Identify the specific problem\n2. Explain why it's a problem\n3. Revert only the ai-slop-remover delta using the saved per-file patch or an equivalent reverse-apply workflow\n4. If remaining ai-slops are found after reverting, remove them by editing the file yourself - with parallel tool calls, per-file\n5. Verify the fix doesn't introduce new issues\n\n## Output Format\n\n### Summary Report\n```\n## AI Slop Removal Summary\n\n### Files Processed\n- file1.py: X changes\n- file2.py: Y changes\n\n### Critical Review Results\n- Safety: PASS/FAIL\n- Behavior: PASS/FAIL\n- Quality: PASS/FAIL\n\n### Issues Found & Fixed\n1. [Issue description] -> [Fix applied]\n\n### Final Status\n[CLEAN / ISSUES FIXED / REQUIRES ATTENTION]\n```\n\n## Quality Assurance\n- NEVER remove code that serves a functional purpose\n- ALWAYS verify changes compile/parse correctly\n- ALWAYS preserve test coverage\n- If uncertain about a change, err on the side of keeping the original code";
2
+ export declare const REMOVE_AI_SLOPS_TEAM_MODE_ADDENDUM = "\n---\n\n# Team Mode Protocol (active when team_* tools are present)\n\nTeam mode is enabled for this session. The rules below **override Phase 2-4** of the legacy flow above. Follow this protocol instead of the per-file fire-and-forget `task()` dispatch.\n\n## Phase 2 (team): `slop-squad` setup\n\n**Precondition checks** (fail hard if any step fails):\n\n1. Load the `team-mode` skill via the `skill` tool for lifecycle, message protocol, broadcast rules, 32KB message cap, and 4 parallel worker cap.\n2. Call `team_list` and verify no active run named `slop-squad` exists. If one does, it is an orphan from a crashed prior session \u2014 `team_shutdown_request` + `team_approve_shutdown` + `team_delete` it before proceeding. Do not rename the team or run concurrent sessions under the same name.\n3. If `~/.omo/teams/slop-squad/config.json` is missing, write it using the spec below.\n\n**Team spec** (`~/.omo/teams/slop-squad/config.json`):\n\n```json\n{\n \"name\": \"slop-squad\",\n \"lead\": { \"kind\": \"subagent_type\", \"subagent_type\": \"sisyphus\" },\n \"members\": [\n {\n \"kind\": \"category\",\n \"category\": \"quick\",\n \"prompt\": \"You run ai-slop-remover on ONE file per task. Load ai-slop-remover via the skill tool. Read the task description for the file path. Apply the skill's detection criteria verbatim. After edits: run lsp_diagnostics on the file. Report via team_send_message(teamRunId=<id>, to=\"lead\", summary=<change count>, body=<full ai-slop-remover report>) + team_task_update(status=completed). On ambiguity: send team_send_message(teamRunId=<id>, to=\"lead\", summary=\"UNCLEAR\", body=<reason>) + team_task_update(status=pending). Never git add, never run tests, never touch other files.\"\n },\n { \"kind\": \"category\", \"category\": \"quick\", \"prompt\": \"Same contract as peer quick worker.\" },\n { \"kind\": \"category\", \"category\": \"quick\", \"prompt\": \"Same contract as peer quick worker.\" },\n {\n \"kind\": \"category\",\n \"category\": \"unspecified-low\",\n \"prompt\": \"You are the FIX worker. You claim rework tasks that the lead creates after the external reviewer flags issues. Read the reviewer's per-hunk rollback instructions in the task description, apply the reverse patch, then run ai-slop-remover ONLY on the non-rolled-back remainder. Same reporting contract as quick peers. Handle UNCLEAR escalations the same way.\"\n }\n ]\n}\n```\n\nRationale for this composition:\n- **4 workers = team mode's parallel cap.** A fifth member just queues.\n- **Reviewer is NOT a team member** \u2014 review demands stronger reasoning than category routing provides (team category members are downcast to sisyphus-junior). The reviewer runs OUTSIDE the team as a `deep` task; see Phase 3.\n- **quick \u00D7 3** absorbs the mass of per-file slop removal. **unspecified-low \u00D7 1** is the rework lane for fixes triggered by reviewer findings.\n\n**Team lifecycle** (create once, reuse until Phase 5 cleanup):\n\n1. `team_create(teamName=\"slop-squad\")`. Record `teamRunId` \u2014 every subsequent team call needs it.\n2. Broadcast the detection criteria ONCE so each task description stays minimal:\n ```\n team_send_message(\n teamRunId=<id>, to=\"*\", kind=\"announcement\",\n summary=\"slop-criteria\",\n body=<the 9 slop categories + KEEP rules; reference the ai-slop-remover skill content>\n )\n ```\n3. Before spawning tasks, save a per-file rollback artifact that captures only the delta the slop-removal pass will introduce. Do NOT use `git checkout -- <file>` \u2014 that would discard pre-existing branch changes.\n4. For each changed file, `team_task_create(teamRunId=<id>, subject=\"slop: <file>\", description=<file path + rollback artifact path + reporting format>, blockedBy=[])`.\n\n## Phase 3 (team): Incremental reviewer dispatch\n\nWhile any team task is `pending | claimed | in_progress`:\n\n- Wait for `<system-reminder>` or member messages. Do NOT tight-poll `team_status`; the runtime notifies on state changes. A single `team_status` check is acceptable if no notification arrives within roughly 10 seconds of expected completion.\n- On each worker completion report:\n - Log the report to the pending final summary (no blocking).\n - Immediately dispatch an **external reviewer** \u2014 review runs OUTSIDE the team because team-member category routing downcasts to sisyphus-junior:\n ```\n task(\n category=\"deep\",\n load_skills=[],\n run_in_background=true,\n description=\"slop review: <file>\",\n prompt=<file path + full worker report + Safety/Behavior/Quality checklist + instruction to output \"PASS\" or \"FAIL:<per-hunk rollback instructions>\">\n )\n ```\n If `deep` is unavailable in this session, fall back to `category=\"unspecified-high\"`.\n- On a reviewer task returning FAIL:\n - Create a rework team task: `team_task_create(subject=\"rework: <file>\", description=<reverse-patch hunks from reviewer + \"then run ai-slop-remover on remaining non-rolled-back issues only\">)`. The `unspecified-low` fix member claims it.\n - Create a new reviewer task paired to the rework completion (same incremental pattern).\n- Loop until every file has a PASS from the reviewer AND no team task is outstanding.\n\n## Phase 4 (team): Fix issues\n\nFixes happen incrementally during Phase 3's loop via rework tasks \u2014 this phase is already handled when the loop exits. Any remaining manual fix that neither worker nor fix member could resolve is handled by Lead here, editing files directly.\n\n## Phase 5 (team): Team cleanup\n\nBefore producing the summary report, dismantle the team on EVERY exit path \u2014 success, escalation, abort \u2014 otherwise the next session's Phase 2 precondition check catches the orphan.\n\n1. `team_shutdown_request` for each member, then `team_approve_shutdown` if members do not self-approve within a reasonable window.\n2. `team_delete(teamRunId=<id>)`.\n3. `team_list` to confirm no residual `slop-squad` run.\n\nThe `~/.omo/teams/slop-squad/config.json` declaration file stays on disk; it is reused next session.\n\n## MUST NOT (team mode)\n\n- Lead never edits files directly \u2014 orchestrate only. If editing is needed, it goes into a team task.\n- Do not inline the full slop-criteria into every task description; rely on the Phase 2 broadcast.\n- Do not call `team_create` again mid-session. One team per resolution.\n- Do not put `oracle` / `librarian` into the team spec \u2014 they are team-ineligible; call them via `task()` outside the team when needed.\n";
@@ -1 +1 @@
1
- export declare const START_WORK_TEMPLATE = "You are starting a Sisyphus work session.\n\n## ARGUMENTS\n\n- `/start-work [plan-name] [--worktree <path>]`\n - `plan-name` (optional): name or partial match of the plan to start\n - `--worktree <path>` (optional): absolute path to an existing git worktree to work in\n - If specified and valid: hook pre-sets worktree_path in boulder.json\n - If specified but invalid: you must run `git worktree add <path> <branch>` first\n - If omitted: work directly in the current project directory (no worktree)\n\n## WHAT TO DO\n\n1. **Find available plans**: Search for Prometheus-generated plan files at `.sisyphus/plans/`\n\n2. **Check for active boulder state**: Read `.sisyphus/boulder.json` if it exists\n\n3. **Decision logic**:\n - If `.sisyphus/boulder.json` exists AND plan is NOT complete (has unchecked boxes):\n - **APPEND** current session to session_ids\n - Continue work on existing plan\n - If no active plan OR plan is complete:\n - List available plan files\n - If ONE plan: auto-select it\n - If MULTIPLE plans: show list with timestamps, ask user to select\n\n4. **Worktree Setup** (ONLY when `--worktree` was explicitly specified and `worktree_path` not already set in boulder.json):\n 1. `git worktree list --porcelain` - see available worktrees\n 2. Create: `git worktree add <absolute-path> <branch-or-HEAD>`\n 3. Update boulder.json to add `\"worktree_path\": \"<absolute-path>\"`\n 4. All work happens inside that worktree directory\n\n5. **Create/Update boulder.json**:\n ```json\n {\n \"active_plan\": \"/absolute/path/to/plan.md\",\n \"started_at\": \"ISO_TIMESTAMP\",\n \"session_ids\": [\"session_id_1\", \"session_id_2\"],\n \"plan_name\": \"plan-name\",\n \"worktree_path\": \"/absolute/path/to/git/worktree\"\n }\n ```\n\n6. **Read the plan file** and start executing tasks according to atlas workflow\n\n## OUTPUT FORMAT\n\nWhen listing plans for selection:\n```\nAvailable Work Plans\n\nCurrent Time: {ISO timestamp}\nSession ID: {current session id}\n\n1. [plan-name-1.md] - Modified: {date} - Progress: 3/10 tasks\n2. [plan-name-2.md] - Modified: {date} - Progress: 0/5 tasks\n\nWhich plan would you like to work on? (Enter number or plan name)\n```\n\nWhen resuming existing work:\n```\nResuming Work Session\n\nActive Plan: {plan-name}\nProgress: {completed}/{total} tasks\nSessions: {count} (appending current session)\nWorktree: {worktree_path}\n\nReading plan and continuing from last incomplete task...\n```\n\nWhen auto-selecting single plan:\n```\nStarting Work Session\n\nPlan: {plan-name}\nSession ID: {session_id}\nStarted: {timestamp}\nWorktree: {worktree_path}\n\nReading plan and beginning execution...\n```\n\n## CRITICAL\n\n- The session_id is injected by the hook - use it directly\n- Always update boulder.json BEFORE starting work\n- If worktree_path is set in boulder.json, all work happens inside that worktree directory\n- Read the FULL plan file before delegating any tasks\n- Follow atlas delegation protocols (7-section format)\n\n## TASK BREAKDOWN (MANDATORY)\n\nAfter reading the plan file, you MUST decompose every plan task into granular, implementation-level sub-steps and register ALL of them as task/todo items BEFORE starting any work.\n\n**How to break down**:\n- Each plan checkbox item (e.g., `- [ ] Add user authentication`) must be split into concrete, actionable sub-tasks\n- Sub-tasks should be specific enough that each one touches a clear set of files/functions\n- Include: file to modify, what to change, expected behavior, and how to verify\n- Do NOT leave any task vague - \"implement feature X\" is NOT acceptable; \"add validateToken() to src/auth/middleware.ts that checks JWT expiry and returns 401\" IS acceptable\n\n**Example breakdown**:\nPlan task: `- [ ] Add rate limiting to API`\n\u2192 Todo items:\n 1. Create `src/middleware/rate-limiter.ts` with sliding window algorithm (max 100 req/min per IP)\n 2. Add RateLimiter middleware to `src/app.ts` router chain, before auth middleware\n 3. Add rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining) to response in `rate-limiter.ts`\n 4. Add test: verify 429 response after exceeding limit in `src/middleware/rate-limiter.test.ts`\n 5. Add test: verify headers are present on normal responses\n\nRegister these as task/todo items so progress is tracked and visible throughout the session.\n\n## WORKTREE COMPLETION\n\nWhen working in a worktree (`worktree_path` is set in boulder.json) and ALL plan tasks are complete:\n1. Commit all remaining changes in the worktree\n2. **Sync .sisyphus state back**: Copy `.sisyphus/` from the worktree to the main repo before removal.\n This is CRITICAL when `.sisyphus/` is gitignored - state written during worktree execution would otherwise be lost.\n ```bash\n cp -r <worktree-path>/.sisyphus/* <main-repo>/.sisyphus/ 2>/dev/null || true\n ```\n3. Switch to the main working directory (the original repo, NOT the worktree)\n4. Merge the worktree branch into the current branch: `git merge <worktree-branch>`\n5. If merge succeeds, clean up: `git worktree remove <worktree-path>`\n6. Remove the boulder.json state\n\nThis is the DEFAULT behavior when `--worktree` was used. Skip merge only if the user explicitly instructs otherwise (e.g., asks to create a PR instead).";
1
+ export declare const START_WORK_TEMPLATE = "You are starting a Sisyphus work session.\n\n## ARGUMENTS\n\n- `/start-work [plan-name] [--worktree <path>]`\n - `plan-name` (optional): name or partial match of the plan to start\n - `--worktree <path>` (optional): absolute path to an existing git worktree to work in\n - If specified and valid: hook pre-sets worktree_path in boulder.json\n - If specified but invalid: you must run `git worktree add <path> <branch>` first\n - If omitted: work directly in the current project directory (no worktree)\n\n## WHAT TO DO\n\n1. **Find available plans**: Search for Prometheus-generated plan files at `.sisyphus/plans/`\n\n2. **Check for active boulder state**: Read `.sisyphus/boulder.json` if it exists\n\n3. **Decision logic**:\n - If multiple active works are listed in your context:\n - This means boulder.json has more than one work with status: `active` or `paused`\n - Use the Question tool to ask the user which plan to resume\n - Resume by running `/start-work {plan-name}` for the selected plan\n - If the user says \"start a new plan\", continue with cold-start auto-selection logic\n - If exactly one active work is listed and the user did not name a plan:\n - Auto-resume that single active work\n - If no active plan OR plan is complete:\n - List available plan files\n - If ONE plan: auto-select it\n - If MULTIPLE plans: show list with timestamps, ask user to select\n\n4. **Worktree Setup** (ONLY when `--worktree` was explicitly specified and `worktree_path` not already set in boulder.json):\n 1. `git worktree list --porcelain` - see available worktrees\n 2. Create: `git worktree add <absolute-path> <branch-or-HEAD>`\n 3. Update boulder.json to add `\"worktree_path\": \"<absolute-path>\"`\n 4. All work happens inside that worktree directory\n\n5. **Create/Update boulder.json**:\n ```json\n {\n \"active_plan\": \"/absolute/path/to/plan.md\",\n \"started_at\": \"ISO_TIMESTAMP\",\n \"session_ids\": [\"session_id_1\", \"session_id_2\"],\n \"plan_name\": \"plan-name\",\n \"worktree_path\": \"/absolute/path/to/git/worktree\"\n }\n ```\n\n6. **Read the plan file** and start executing tasks according to atlas workflow\n\n## OUTPUT FORMAT\n\nWhen listing plans for selection:\n```\nAvailable Work Plans\n\nCurrent Time: {ISO timestamp}\nSession ID: {current session id}\n\n1. [plan-name-1.md] - Modified: {date} - Progress: 3/10 tasks\n2. [plan-name-2.md] - Modified: {date} - Progress: 0/5 tasks\n\nWhich plan would you like to work on? (Enter number or plan name)\n```\n\nWhen resuming existing work:\n```\nResuming Work Session\n\nActive Plan: {plan-name}\nProgress: {completed}/{total} tasks\nSessions: {count} (appending current session)\nWorktree: {worktree_path}\n\nReading plan and continuing from last incomplete task...\n```\n\nWhen auto-selecting single plan:\n```\nStarting Work Session\n\nPlan: {plan-name}\nSession ID: {session_id}\nStarted: {timestamp}\nWorktree: {worktree_path}\n\nReading plan and beginning execution...\n```\n\n## CRITICAL\n\n- The session_id is injected by the hook - use it directly\n- Always update boulder.json BEFORE starting work\n- If worktree_path is set in boulder.json, all work happens inside that worktree directory\n- Read the FULL plan file before delegating any tasks\n- Follow atlas delegation protocols (7-section format)\n\n## TASK BREAKDOWN (MANDATORY)\n\nAfter reading the plan file, you MUST decompose every plan task into granular, implementation-level sub-steps and register ALL of them as task/todo items BEFORE starting any work.\n\n**How to break down**:\n- Each plan checkbox item (e.g., `- [ ] Add user authentication`) must be split into concrete, actionable sub-tasks\n- Sub-tasks should be specific enough that each one touches a clear set of files/functions\n- Include: file to modify, what to change, expected behavior, and how to verify\n- Do NOT leave any task vague - \"implement feature X\" is NOT acceptable; \"add validateToken() to src/auth/middleware.ts that checks JWT expiry and returns 401\" IS acceptable\n\n**Example breakdown**:\nPlan task: `- [ ] Add rate limiting to API`\n\u2192 Todo items:\n 1. Create `src/middleware/rate-limiter.ts` with sliding window algorithm (max 100 req/min per IP)\n 2. Add RateLimiter middleware to `src/app.ts` router chain, before auth middleware\n 3. Add rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining) to response in `rate-limiter.ts`\n 4. Add test: verify 429 response after exceeding limit in `src/middleware/rate-limiter.test.ts`\n 5. Add test: verify headers are present on normal responses\n\nRegister these as task/todo items so progress is tracked and visible throughout the session.\n\n## WORKTREE COMPLETION\n\nWhen working in a worktree (`worktree_path` is set in boulder.json) and ALL plan tasks are complete:\n1. Commit all remaining changes in the worktree\n2. **Sync .sisyphus state back**: Copy `.sisyphus/` from the worktree to the main repo before removal.\n This is CRITICAL when `.sisyphus/` is gitignored - state written during worktree execution would otherwise be lost.\n ```bash\n cp -r <worktree-path>/.sisyphus/* <main-repo>/.sisyphus/ 2>/dev/null || true\n ```\n3. Switch to the main working directory (the original repo, NOT the worktree)\n4. Merge the worktree branch into the current branch: `git merge <worktree-branch>`\n5. If merge succeeds, clean up: `git worktree remove <worktree-path>`\n6. Remove the boulder.json state\n\nThis is the DEFAULT behavior when `--worktree` was used. Skip merge only if the user explicitly instructs otherwise (e.g., asks to create a PR instead).";
@@ -1,5 +1,5 @@
1
1
  import type { CommandDefinition } from "../claude-code-command-loader";
2
- export type BuiltinCommandName = "init-deep" | "ralph-loop" | "cancel-ralph" | "ulw-loop" | "refactor" | "start-work" | "stop-continuation" | "handoff" | "remove-ai-slops";
2
+ export type BuiltinCommandName = "init-deep" | "ralph-loop" | "cancel-ralph" | "ulw-loop" | "refactor" | "start-work" | "stop-continuation" | "handoff" | "remove-ai-slops" | "hyperplan";
3
3
  export interface BuiltinCommandConfig {
4
4
  disabled_commands?: BuiltinCommandName[];
5
5
  }
@@ -1 +1 @@
1
- export declare const GIT_MASTER_COMMIT_WORKFLOW_SECTION = "## PHASE 0: Parallel Context Gathering (MANDATORY FIRST STEP)\n\n<parallel_analysis>\n**Execute ALL of the following commands IN PARALLEL to minimize latency:**\n\n```bash\n# Group 1: Current state\ngit status\ngit diff --staged --stat\ngit diff --stat\n\n# Group 2: History context \ngit log -30 --oneline\ngit log -30 --pretty=format:\"%s\"\n\n# Group 3: Branch context\ngit branch --show-current\ngit merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null\ngit rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo \"NO_UPSTREAM\"\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)..HEAD 2>/dev/null\n```\n\n**Capture these data points simultaneously:**\n1. What files changed (staged vs unstaged)\n2. Recent 30 commit messages for style detection\n3. Branch position relative to main/master\n4. Whether branch has upstream tracking\n5. Commits that would go in PR (local only)\n</parallel_analysis>\n\n---\n\n## PHASE 1: Style Detection (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)\n\n<style_detection>\n**THIS PHASE HAS MANDATORY OUTPUT** - You MUST print the analysis result before moving to Phase 2.\n\n### 1.1 Language Detection\n\n```\nCount from git log -30:\n- Korean characters: N commits\n- English only: M commits\n- Mixed: K commits\n\nDECISION:\n- If Korean >= 50% -> KOREAN\n- If English >= 50% -> ENGLISH \n- If Mixed -> Use MAJORITY language\n```\n\n### 1.2 Commit Style Classification\n\n| Style | Pattern | Example | Detection Regex |\n|-------|---------|---------|-----------------|\n| `SEMANTIC` | `type: message` or `type(scope): message` | `feat: add login` | `/^(feat\\|fix\\|chore\\|refactor\\|docs\\|test\\|ci\\|style\\|perf\\|build)(\\(.+\\))?:/` |\n| `PLAIN` | Just description, no prefix | `Add login feature` | No conventional prefix, >3 words |\n| `SENTENCE` | Full sentence style | `Implemented the new login flow` | Complete grammatical sentence |\n| `SHORT` | Minimal keywords | `format`, `lint` | 1-3 words only |\n\n**Detection Algorithm:**\n```\nsemantic_count = commits matching semantic regex\nplain_count = non-semantic commits with >3 words\nshort_count = commits with <=3 words\n\nIF semantic_count >= 15 (50%): STYLE = SEMANTIC\nELSE IF plain_count >= 15: STYLE = PLAIN \nELSE IF short_count >= 10: STYLE = SHORT\nELSE: STYLE = PLAIN (safe default)\n```\n\n### 1.3 MANDATORY OUTPUT (BLOCKING)\n\n**You MUST output this block before proceeding to Phase 2. NO EXCEPTIONS.**\n\n```\nSTYLE DETECTION RESULT\n======================\nAnalyzed: 30 commits from git log\n\nLanguage: [KOREAN | ENGLISH]\n - Korean commits: N (X%)\n - English commits: M (Y%)\n\nStyle: [SEMANTIC | PLAIN | SENTENCE | SHORT]\n - Semantic (feat:, fix:, etc): N (X%)\n - Plain: M (Y%)\n - Short: K (Z%)\n\nReference examples from repo:\n 1. \"actual commit message from log\"\n 2. \"actual commit message from log\"\n 3. \"actual commit message from log\"\n\nAll commits will follow: [LANGUAGE] + [STYLE]\n```\n\n**IF YOU SKIP THIS OUTPUT, YOUR COMMITS WILL BE WRONG. STOP AND REDO.**\n</style_detection>\n\n---\n\n## PHASE 2: Branch Context Analysis\n\n<branch_analysis>\n### 2.1 Determine Branch State\n\n```\nBRANCH_STATE:\n current_branch: <name>\n has_upstream: true | false\n commits_ahead: N # Local-only commits\n merge_base: <hash>\n \nREWRITE_SAFETY:\n - If has_upstream AND commits_ahead > 0 AND already pushed:\n -> WARN before force push\n - If no upstream OR all commits local:\n -> Safe for aggressive rewrite (fixup, reset, rebase)\n - If on main/master:\n -> NEVER rewrite, only new commits\n```\n\n### 2.2 History Rewrite Strategy Decision\n\n```\nIF current_branch == main OR current_branch == master:\n -> STRATEGY = NEW_COMMITS_ONLY\n -> Never fixup, never rebase\n\nELSE IF commits_ahead == 0:\n -> STRATEGY = NEW_COMMITS_ONLY\n -> No history to rewrite\n\nELSE IF all commits are local (not pushed):\n -> STRATEGY = AGGRESSIVE_REWRITE\n -> Fixup freely, reset if needed, rebase to clean\n\nELSE IF pushed but not merged:\n -> STRATEGY = CAREFUL_REWRITE \n -> Fixup OK but warn about force push\n```\n</branch_analysis>\n\n---\n\n## PHASE 3: Atomic Unit Planning (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)\n\n<atomic_planning>\n**THIS PHASE HAS MANDATORY OUTPUT** - You MUST print the commit plan before moving to Phase 4.\n\n### 3.0 Calculate Minimum Commit Count FIRST\n\n```\nFORMULA: min_commits = ceil(file_count / 3)\n\n 3 files -> min 1 commit\n 5 files -> min 2 commits\n 9 files -> min 3 commits\n15 files -> min 5 commits\n```\n\n**If your planned commit count < min_commits -> WRONG. SPLIT MORE.**\n\n### 3.1 Split by Directory/Module FIRST (Primary Split)\n\n**RULE: Different directories = Different commits (almost always)**\n\n```\nExample: 8 changed files\n - app/[locale]/page.tsx\n - app/[locale]/layout.tsx\n - components/demo/browser-frame.tsx\n - components/demo/shopify-full-site.tsx\n - components/pricing/pricing-table.tsx\n - e2e/navbar.spec.ts\n - messages/en.json\n - messages/ko.json\n\nWRONG: 1 commit \"Update landing page\" (LAZY, WRONG)\nWRONG: 2 commits (still too few)\n\nCORRECT: Split by directory/concern:\n - Commit 1: app/[locale]/page.tsx + layout.tsx (app layer)\n - Commit 2: components/demo/* (demo components)\n - Commit 3: components/pricing/* (pricing components)\n - Commit 4: e2e/* (tests)\n - Commit 5: messages/* (i18n)\n = 5 commits from 8 files (CORRECT)\n```\n\n### 3.2 Split by Concern SECOND (Secondary Split)\n\n**Within same directory, split by logical concern:**\n\n```\nExample: components/demo/ has 4 files\n - browser-frame.tsx (UI frame)\n - shopify-full-site.tsx (specific demo)\n - review-dashboard.tsx (NEW - specific demo)\n - tone-settings.tsx (NEW - specific demo)\n\nOption A (acceptable): 1 commit if ALL tightly coupled\nOption B (preferred): 2 commits\n - Commit: \"Update existing demo components\" (browser-frame, shopify)\n - Commit: \"Add new demo components\" (review-dashboard, tone-settings)\n```\n\n### 3.3 NEVER Do This (Anti-Pattern Examples)\n\n```\nWRONG: \"Refactor entire landing page\" - 1 commit with 15 files\nWRONG: \"Update components and tests\" - 1 commit mixing concerns\nWRONG: \"Big update\" - Any commit touching 5+ unrelated files\n\nRIGHT: Multiple focused commits, each 1-4 files max\nRIGHT: Each commit message describes ONE specific change\nRIGHT: A reviewer can understand each commit in 30 seconds\n```\n\n### 3.4 Implementation + Test Pairing (MANDATORY)\n\n```\nRULE: Test files MUST be in same commit as implementation\n\nTest patterns to match:\n- test_*.py <-> *.py\n- *_test.py <-> *.py\n- *.test.ts <-> *.ts\n- *.spec.ts <-> *.ts\n- __tests__/*.ts <-> *.ts\n- tests/*.py <-> src/*.py\n```\n\n### 3.5 MANDATORY JUSTIFICATION (Before Creating Commit Plan)\n\n**NON-NEGOTIABLE: Before finalizing your commit plan, you MUST:**\n\n```\nFOR EACH planned commit with 3+ files:\n 1. List all files in this commit\n 2. Write ONE sentence explaining why they MUST be together\n 3. If you can't write that sentence -> SPLIT\n \nTEMPLATE:\n\"Commit N contains [files] because [specific reason they are inseparable].\"\n\nVALID reasons:\n VALID: \"implementation file + its direct test file\"\n VALID: \"type definition + the only file that uses it\"\n VALID: \"migration + model change (would break without both)\"\n \nINVALID reasons (MUST SPLIT instead):\n INVALID: \"all related to feature X\" (too vague)\n INVALID: \"part of the same PR\" (not a reason)\n INVALID: \"they were changed together\" (not a reason)\n INVALID: \"makes sense to group\" (not a reason)\n```\n\n**OUTPUT THIS JUSTIFICATION in your analysis before executing commits.**\n\n### 3.7 Dependency Ordering\n\n```\nLevel 0: Utilities, constants, type definitions\nLevel 1: Models, schemas, interfaces\nLevel 2: Services, business logic\nLevel 3: API endpoints, controllers\nLevel 4: Configuration, infrastructure\n\nCOMMIT ORDER: Level 0 -> Level 1 -> Level 2 -> Level 3 -> Level 4\n```\n\n### 3.8 Create Commit Groups\n\nFor each logical feature/change:\n```yaml\n- group_id: 1\n feature: \"Add Shopify discount deletion\"\n files:\n - errors/shopify_error.py\n - types/delete_input.py\n - mutations/update_contract.py\n - tests/test_update_contract.py\n dependency_level: 2\n target_commit: null | <existing-hash> # null = new, hash = fixup\n```\n\n### 3.9 MANDATORY OUTPUT (BLOCKING)\n\n**You MUST output this block before proceeding to Phase 4. NO EXCEPTIONS.**\n\n```\nCOMMIT PLAN\n===========\nFiles changed: N\nMinimum commits required: ceil(N/3) = M\nPlanned commits: K\nStatus: K >= M (PASS) | K < M (FAIL - must split more)\n\nCOMMIT 1: [message in detected style]\n - path/to/file1.py\n - path/to/file1_test.py\n Justification: implementation + its test\n\nCOMMIT 2: [message in detected style]\n - path/to/file2.py\n Justification: independent utility function\n\nCOMMIT 3: [message in detected style]\n - config/settings.py\n - config/constants.py\n Justification: tightly coupled config changes\n\nExecution order: Commit 1 -> Commit 2 -> Commit 3\n(follows dependency: Level 0 -> Level 1 -> Level 2 -> ...)\n```\n\n**VALIDATION BEFORE EXECUTION:**\n- Each commit has <=4 files (or justified)\n- Each commit message matches detected STYLE + LANGUAGE\n- Test files paired with implementation\n- Different directories = different commits (or justified)\n- Total commits >= min_commits\n\n**IF ANY CHECK FAILS, DO NOT PROCEED. REPLAN.**\n</atomic_planning>\n\n---\n\n## PHASE 4: Commit Strategy Decision\n\n<strategy_decision>\n### 4.1 For Each Commit Group, Decide:\n\n```\nFIXUP if:\n - Change complements existing commit's intent\n - Same feature, fixing bugs or adding missing parts\n - Review feedback incorporation\n - Target commit exists in local history\n\nNEW COMMIT if:\n - New feature or capability\n - Independent logical unit\n - Different issue/ticket\n - No suitable target commit exists\n```\n\n### 4.2 History Rebuild Decision (Aggressive Option)\n\n```\nCONSIDER RESET & REBUILD when:\n - History is messy (many small fixups already)\n - Commits are not atomic (mixed concerns)\n - Dependency order is wrong\n \nRESET WORKFLOW:\n 1. git reset --soft $(git merge-base HEAD main)\n 2. All changes now staged\n 3. Re-commit in proper atomic units\n 4. Clean history from scratch\n \nONLY IF:\n - All commits are local (not pushed)\n - User explicitly allows OR branch is clearly WIP\n```\n\n### 4.3 Final Plan Summary\n\n```yaml\nEXECUTION_PLAN:\n strategy: FIXUP_THEN_NEW | NEW_ONLY | RESET_REBUILD\n fixup_commits:\n - files: [...]\n target: <hash>\n new_commits:\n - files: [...]\n message: \"...\"\n level: N\n requires_force_push: true | false\n```\n</strategy_decision>\n\n---\n\n## PHASE 5: Commit Execution\n\n<execution>\n### 5.1 Register TODO Items\n\nUse TodoWrite to register each commit as a trackable item:\n```\n- [ ] Fixup: <description> -> <target-hash>\n- [ ] New: <description>\n- [ ] Rebase autosquash\n- [ ] Final verification\n```\n\n### 5.2 Fixup Commits (If Any)\n\n```bash\n# Stage files for each fixup\ngit add <files>\ngit commit --fixup=<target-hash>\n\n# Repeat for all fixups...\n\n# Single autosquash rebase at the end\nMERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)\nGIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $MERGE_BASE\n```\n\n### 5.3 New Commits (After Fixups)\n\nFor each new commit group, in dependency order:\n\n```bash\n# Stage files\ngit add <file1> <file2> ...\n\n# Verify staging\ngit diff --staged --stat\n\n# Commit with detected style\ngit commit -m \"<message-matching-COMMIT_CONFIG>\"\n\n# Verify\ngit log -1 --oneline\n```\n\n### 5.4 Commit Message Generation\n\n**Based on COMMIT_CONFIG from Phase 1:**\n\n```\nIF style == SEMANTIC AND language == KOREAN:\n -> \"feat: \uB85C\uADF8\uC778 \uAE30\uB2A5 \uCD94\uAC00\"\n \nIF style == SEMANTIC AND language == ENGLISH:\n -> \"feat: add login feature\"\n \nIF style == PLAIN AND language == KOREAN:\n -> \"\uB85C\uADF8\uC778 \uAE30\uB2A5 \uCD94\uAC00\"\n \nIF style == PLAIN AND language == ENGLISH:\n -> \"Add login feature\"\n \nIF style == SHORT:\n -> \"format\" / \"type fix\" / \"lint\"\n```\n\n**VALIDATION before each commit:**\n1. Does message match detected style?\n2. Does language match detected language?\n3. Is it similar to examples from git log?\n\nIf ANY check fails -> REWRITE message.\n```\n</execution>\n\n---\n\n## PHASE 6: Verification & Cleanup\n\n<verification>\n### 6.1 Post-Commit Verification\n\n```bash\n# Check working directory clean\ngit status\n\n# Review new history\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)..HEAD\n\n# Verify each commit is atomic\n# (mentally check: can each be reverted independently?)\n```\n\n### 6.2 Force Push Decision\n\n```\nIF fixup was used AND branch has upstream:\n -> Requires: git push --force-with-lease\n -> WARN user about force push implications\n \nIF only new commits:\n -> Regular: git push\n```\n\n### 6.3 Final Report\n\n```\nCOMMIT SUMMARY:\n Strategy: <what was done>\n Commits created: N\n Fixups merged: M\n \nHISTORY:\n <hash1> <message1>\n <hash2> <message2>\n ...\n\nNEXT STEPS:\n - git push [--force-with-lease]\n - Create PR if ready\n```\n</verification>";
1
+ export declare const GIT_MASTER_COMMIT_WORKFLOW_SECTION = "## PHASE 0: Parallel Context Gathering (MANDATORY FIRST STEP)\n\n<parallel_analysis>\n**Execute ALL of the following commands IN PARALLEL to minimize latency:**\n\n```bash\n# Group 1: Current state\ngit status\ngit diff --staged --stat\ngit diff --stat\n\n# Group 2: History context \ngit log -30 --oneline\ngit log -30 --pretty=format:\"%s\"\n\n# Group 3: Branch context\ngit branch --show-current\ngit merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null\ngit rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo \"NO_UPSTREAM\"\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null)..HEAD 2>/dev/null\n```\n\n**Capture these data points simultaneously:**\n1. What files changed (staged vs unstaged)\n2. Recent 30 commit messages for style detection\n3. Branch position relative to main/master\n4. Whether branch has upstream tracking\n5. Commits that would go in PR (local only)\n</parallel_analysis>\n\n---\n\n## PHASE 1: Style Detection (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)\n\n<style_detection>\n**THIS PHASE HAS MANDATORY OUTPUT** - You MUST print the analysis result before moving to Phase 2.\n\n### 1.1 Language Profile Detection\n\n```\nCount from git log -30:\n- Dominant language/script patterns: N commits\n- Secondary language/script patterns: M commits\n- Mixed/ambiguous: K commits\n\nDECISION:\n- Preserve the dominant repository language pattern in commit messages\n- If multiple languages are common, follow the nearest recent examples for the same module\n- Never restrict output to specific languages; support any language used by the repo (e.g., Japanese, Korean, English, etc.)\n```\n\n### 1.2 Commit Style Classification\n\n| Style | Pattern | Example | Detection Regex |\n|-------|---------|---------|-----------------|\n| `SEMANTIC` | `type: message` or `type(scope): message` | `feat: add login` | `/^(feat\\|fix\\|chore\\|refactor\\|docs\\|test\\|ci\\|style\\|perf\\|build)(\\(.+\\))?:/` |\n| `PLAIN` | Just description, no prefix | `Add login feature` | No conventional prefix, >3 words |\n| `SENTENCE` | Full sentence style | `Implemented the new login flow` | Complete grammatical sentence |\n| `SHORT` | Minimal keywords | `format`, `lint` | 1-3 words only |\n\n**Detection Algorithm:**\n```\nsemantic_count = commits matching semantic regex\nplain_count = non-semantic commits with >3 words\nshort_count = commits with <=3 words\n\nIF semantic_count >= 15 (50%): STYLE = SEMANTIC\nELSE IF plain_count >= 15: STYLE = PLAIN \nELSE IF short_count >= 10: STYLE = SHORT\nELSE: STYLE = PLAIN (safe default)\n```\n\n### 1.3 MANDATORY OUTPUT (BLOCKING)\n\n**You MUST output this block before proceeding to Phase 2. NO EXCEPTIONS.**\n\n```\nSTYLE DETECTION RESULT\n======================\nAnalyzed: 30 commits from git log\n\nLanguage profile: [DOMINANT_LANGUAGE_OR_SCRIPT]\n - Dominant pattern: N (X%)\n - Secondary pattern: M (Y%)\n\nStyle: [SEMANTIC | PLAIN | SENTENCE | SHORT]\n - Semantic (feat:, fix:, etc): N (X%)\n - Plain: M (Y%)\n - Short: K (Z%)\n\nReference examples from repo:\n 1. \"actual commit message from log\"\n 2. \"actual commit message from log\"\n 3. \"actual commit message from log\"\n\nAll commits will follow: [DOMINANT_LANGUAGE_OR_SCRIPT] + [STYLE]\n```\n\n**IF YOU SKIP THIS OUTPUT, YOUR COMMITS WILL BE WRONG. STOP AND REDO.**\n</style_detection>\n\n---\n\n## PHASE 2: Branch Context Analysis\n\n<branch_analysis>\n### 2.1 Determine Branch State\n\n```\nBRANCH_STATE:\n current_branch: <name>\n has_upstream: true | false\n commits_ahead: N # Local-only commits\n merge_base: <hash>\n \nREWRITE_SAFETY:\n - If has_upstream AND commits_ahead > 0 AND already pushed:\n -> WARN before force push\n - If no upstream OR all commits local:\n -> Safe for aggressive rewrite (fixup, reset, rebase)\n - If on main/master:\n -> NEVER rewrite, only new commits\n```\n\n### 2.2 History Rewrite Strategy Decision\n\n```\nIF current_branch == main OR current_branch == master:\n -> STRATEGY = NEW_COMMITS_ONLY\n -> Never fixup, never rebase\n\nELSE IF commits_ahead == 0:\n -> STRATEGY = NEW_COMMITS_ONLY\n -> No history to rewrite\n\nELSE IF all commits are local (not pushed):\n -> STRATEGY = AGGRESSIVE_REWRITE\n -> Fixup freely, reset if needed, rebase to clean\n\nELSE IF pushed but not merged:\n -> STRATEGY = CAREFUL_REWRITE \n -> Fixup OK but warn about force push\n```\n</branch_analysis>\n\n---\n\n## PHASE 3: Atomic Unit Planning (BLOCKING - MUST OUTPUT BEFORE PROCEEDING)\n\n<atomic_planning>\n**THIS PHASE HAS MANDATORY OUTPUT** - You MUST print the commit plan before moving to Phase 4.\n\n### 3.0 Calculate Minimum Commit Count FIRST\n\n```\nFORMULA: min_commits = ceil(file_count / 3)\n\n 3 files -> min 1 commit\n 5 files -> min 2 commits\n 9 files -> min 3 commits\n15 files -> min 5 commits\n```\n\n**If your planned commit count < min_commits -> WRONG. SPLIT MORE.**\n\n### 3.1 Split by Directory/Module FIRST (Primary Split)\n\n**RULE: Different directories = Different commits (almost always)**\n\n```\nExample: 8 changed files\n - app/[locale]/page.tsx\n - app/[locale]/layout.tsx\n - components/demo/browser-frame.tsx\n - components/demo/shopify-full-site.tsx\n - components/pricing/pricing-table.tsx\n - e2e/navbar.spec.ts\n - messages/en.json\n - messages/ko.json\n\nWRONG: 1 commit \"Update landing page\" (LAZY, WRONG)\nWRONG: 2 commits (still too few)\n\nCORRECT: Split by directory/concern:\n - Commit 1: app/[locale]/page.tsx + layout.tsx (app layer)\n - Commit 2: components/demo/* (demo components)\n - Commit 3: components/pricing/* (pricing components)\n - Commit 4: e2e/* (tests)\n - Commit 5: messages/* (i18n)\n = 5 commits from 8 files (CORRECT)\n```\n\n### 3.2 Split by Concern SECOND (Secondary Split)\n\n**Within same directory, split by logical concern:**\n\n```\nExample: components/demo/ has 4 files\n - browser-frame.tsx (UI frame)\n - shopify-full-site.tsx (specific demo)\n - review-dashboard.tsx (NEW - specific demo)\n - tone-settings.tsx (NEW - specific demo)\n\nOption A (acceptable): 1 commit if ALL tightly coupled\nOption B (preferred): 2 commits\n - Commit: \"Update existing demo components\" (browser-frame, shopify)\n - Commit: \"Add new demo components\" (review-dashboard, tone-settings)\n```\n\n### 3.3 NEVER Do This (Anti-Pattern Examples)\n\n```\nWRONG: \"Refactor entire landing page\" - 1 commit with 15 files\nWRONG: \"Update components and tests\" - 1 commit mixing concerns\nWRONG: \"Big update\" - Any commit touching 5+ unrelated files\n\nRIGHT: Multiple focused commits, each 1-4 files max\nRIGHT: Each commit message describes ONE specific change\nRIGHT: A reviewer can understand each commit in 30 seconds\n```\n\n### 3.4 Implementation + Test Pairing (MANDATORY)\n\n```\nRULE: Test files MUST be in same commit as implementation\n\nTest patterns to match:\n- test_*.py <-> *.py\n- *_test.py <-> *.py\n- *.test.ts <-> *.ts\n- *.spec.ts <-> *.ts\n- __tests__/*.ts <-> *.ts\n- tests/*.py <-> src/*.py\n```\n\n### 3.5 MANDATORY JUSTIFICATION (Before Creating Commit Plan)\n\n**NON-NEGOTIABLE: Before finalizing your commit plan, you MUST:**\n\n```\nFOR EACH planned commit with 3+ files:\n 1. List all files in this commit\n 2. Write ONE sentence explaining why they MUST be together\n 3. If you can't write that sentence -> SPLIT\n \nTEMPLATE:\n\"Commit N contains [files] because [specific reason they are inseparable].\"\n\nVALID reasons:\n VALID: \"implementation file + its direct test file\"\n VALID: \"type definition + the only file that uses it\"\n VALID: \"migration + model change (would break without both)\"\n \nINVALID reasons (MUST SPLIT instead):\n INVALID: \"all related to feature X\" (too vague)\n INVALID: \"part of the same PR\" (not a reason)\n INVALID: \"they were changed together\" (not a reason)\n INVALID: \"makes sense to group\" (not a reason)\n```\n\n**OUTPUT THIS JUSTIFICATION in your analysis before executing commits.**\n\n### 3.7 Dependency Ordering\n\n```\nLevel 0: Utilities, constants, type definitions\nLevel 1: Models, schemas, interfaces\nLevel 2: Services, business logic\nLevel 3: API endpoints, controllers\nLevel 4: Configuration, infrastructure\n\nCOMMIT ORDER: Level 0 -> Level 1 -> Level 2 -> Level 3 -> Level 4\n```\n\n### 3.8 Create Commit Groups\n\nFor each logical feature/change:\n```yaml\n- group_id: 1\n feature: \"Add Shopify discount deletion\"\n files:\n - errors/shopify_error.py\n - types/delete_input.py\n - mutations/update_contract.py\n - tests/test_update_contract.py\n dependency_level: 2\n target_commit: null | <existing-hash> # null = new, hash = fixup\n```\n\n### 3.9 MANDATORY OUTPUT (BLOCKING)\n\n**You MUST output this block before proceeding to Phase 4. NO EXCEPTIONS.**\n\n```\nCOMMIT PLAN\n===========\nFiles changed: N\nMinimum commits required: ceil(N/3) = M\nPlanned commits: K\nStatus: K >= M (PASS) | K < M (FAIL - must split more)\n\nCOMMIT 1: [message in detected style]\n - path/to/file1.py\n - path/to/file1_test.py\n Justification: implementation + its test\n\nCOMMIT 2: [message in detected style]\n - path/to/file2.py\n Justification: independent utility function\n\nCOMMIT 3: [message in detected style]\n - config/settings.py\n - config/constants.py\n Justification: tightly coupled config changes\n\nExecution order: Commit 1 -> Commit 2 -> Commit 3\n(follows dependency: Level 0 -> Level 1 -> Level 2 -> ...)\n```\n\n**VALIDATION BEFORE EXECUTION:**\n- Each commit has <=4 files (or justified)\n- Each commit message matches detected STYLE + LANGUAGE\n- Test files paired with implementation\n- Different directories = different commits (or justified)\n- Total commits >= min_commits\n\n**IF ANY CHECK FAILS, DO NOT PROCEED. REPLAN.**\n</atomic_planning>\n\n---\n\n## PHASE 4: Commit Strategy Decision\n\n<strategy_decision>\n### 4.1 For Each Commit Group, Decide:\n\n```\nFIXUP if:\n - Change complements existing commit's intent\n - Same feature, fixing bugs or adding missing parts\n - Review feedback incorporation\n - Target commit exists in local history\n\nNEW COMMIT if:\n - New feature or capability\n - Independent logical unit\n - Different issue/ticket\n - No suitable target commit exists\n```\n\n### 4.2 History Rebuild Decision (Aggressive Option)\n\n```\nCONSIDER RESET & REBUILD when:\n - History is messy (many small fixups already)\n - Commits are not atomic (mixed concerns)\n - Dependency order is wrong\n \nRESET WORKFLOW:\n 1. git reset --soft $(git merge-base HEAD main)\n 2. All changes now staged\n 3. Re-commit in proper atomic units\n 4. Clean history from scratch\n \nONLY IF:\n - All commits are local (not pushed)\n - User explicitly allows OR branch is clearly WIP\n```\n\n### 4.3 Final Plan Summary\n\n```yaml\nEXECUTION_PLAN:\n strategy: FIXUP_THEN_NEW | NEW_ONLY | RESET_REBUILD\n fixup_commits:\n - files: [...]\n target: <hash>\n new_commits:\n - files: [...]\n message: \"...\"\n level: N\n requires_force_push: true | false\n```\n</strategy_decision>\n\n---\n\n## PHASE 5: Commit Execution\n\n<execution>\n### 5.1 Register TODO Items\n\nUse TodoWrite to register each commit as a trackable item:\n```\n- [ ] Fixup: <description> -> <target-hash>\n- [ ] New: <description>\n- [ ] Rebase autosquash\n- [ ] Final verification\n```\n\n### 5.2 Fixup Commits (If Any)\n\n```bash\n# Stage files for each fixup\ngit add <files>\ngit commit --fixup=<target-hash>\n\n# Repeat for all fixups...\n\n# Single autosquash rebase at the end\nMERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)\nGIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $MERGE_BASE\n```\n\n### 5.3 New Commits (After Fixups)\n\nFor each new commit group, in dependency order:\n\n```bash\n# Stage files\ngit add <file1> <file2> ...\n\n# Verify staging\ngit diff --staged --stat\n\n# Commit with detected style\ngit commit -m \"<message-matching-COMMIT_CONFIG>\"\n\n# Verify\ngit log -1 --oneline\n```\n\n### 5.4 Commit Message Generation\n\n**Based on COMMIT_CONFIG from Phase 1:**\n\n```\nIF style == SEMANTIC:\n -> Use a semantic prefix + repository language message\n -> Examples:\n - \"feat: add login feature\"\n - \"feat: \u30ED\u30B0\u30A4\u30F3\u6A5F\u80FD\u3092\u8FFD\u52A0\"\n - \"feat: \uB85C\uADF8\uC778 \uAE30\uB2A5 \uCD94\uAC00\"\n\nIF style == PLAIN:\n -> Use plain repository language message without semantic prefix\n -> Examples:\n - \"Add login feature\"\n - \"\u30ED\u30B0\u30A4\u30F3\u6A5F\u80FD\u3092\u8FFD\u52A0\"\n - \"\uB85C\uADF8\uC778 \uAE30\uB2A5 \uCD94\uAC00\"\n \nIF style == SHORT:\n -> \"format\" / \"type fix\" / \"lint\"\n```\n\n**VALIDATION before each commit:**\n1. Does message match detected style?\n2. Does message use the repository's dominant language/script profile (from Phase 1.1)?\n3. Is it similar to examples from git log?\n\nIf ANY check fails -> REWRITE message.\n```\n</execution>\n\n---\n\n## PHASE 6: Verification & Cleanup\n\n<verification>\n### 6.1 Post-Commit Verification\n\n```bash\n# Check working directory clean\ngit status\n\n# Review new history\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)..HEAD\n\n# Verify each commit is atomic\n# (mentally check: can each be reverted independently?)\n```\n\n### 6.2 Force Push Decision\n\n```\nIF fixup was used AND branch has upstream:\n -> Requires: git push --force-with-lease\n -> WARN user about force push implications\n \nIF only new commits:\n -> Regular: git push\n```\n\n### 6.3 Final Report\n\n```\nCOMMIT SUMMARY:\n Strategy: <what was done>\n Commits created: N\n Fixups merged: M\n \nHISTORY:\n <hash1> <message1>\n <hash2> <message2>\n ...\n\nNEXT STEPS:\n - git push [--force-with-lease]\n - Create PR if ready\n```\n</verification>";
@@ -1 +1 @@
1
- export declare const GIT_MASTER_HISTORY_SEARCH_WORKFLOW_SECTION = "## HISTORY SEARCH MODE (Phase H1-H3)\n\n## PHASE H1: Determine Search Type\n\n<history_search_type>\n### H1.1 Parse User Request\n\n| User Request | Search Type | Tool |\n|--------------|-------------|------|\n| \"when was X added\" / \"X\uAC00 \uC5B8\uC81C \uCD94\uAC00\uB410\uC5B4\" | PICKAXE | `git log -S` |\n| \"find commits changing X pattern\" | REGEX | `git log -G` |\n| \"who wrote this line\" / \"\uC774 \uC904 \uB204\uAC00 \uC37C\uC5B4\" | BLAME | `git blame` |\n| \"when did bug start\" / \"\uBC84\uADF8 \uC5B8\uC81C \uC0DD\uACBC\uC5B4\" | BISECT | `git bisect` |\n| \"history of file\" / \"\uD30C\uC77C \uD788\uC2A4\uD1A0\uB9AC\" | FILE_LOG | `git log -- path` |\n| \"find deleted code\" / \"\uC0AD\uC81C\uB41C \uCF54\uB4DC \uCC3E\uAE30\" | PICKAXE_ALL | `git log -S --all` |\n\n### H1.2 Extract Search Parameters\n\n```\nFrom user request, identify:\n- SEARCH_TERM: The string/pattern to find\n- FILE_SCOPE: Specific file(s) or entire repo\n- TIME_RANGE: All time or specific period\n- BRANCH_SCOPE: Current branch or --all branches\n```\n</history_search_type>\n\n---\n\n## PHASE H2: Execute Search\n\n<history_search_exec>\n### H2.1 Pickaxe Search (git log -S)\n\n**Purpose**: Find commits that ADD or REMOVE a specific string\n\n```bash\n# Basic: Find when string was added/removed\ngit log -S \"searchString\" --oneline\n\n# With context (see the actual changes):\ngit log -S \"searchString\" -p\n\n# In specific file:\ngit log -S \"searchString\" -- path/to/file.py\n\n# Across all branches (find deleted code):\ngit log -S \"searchString\" --all --oneline\n\n# With date range:\ngit log -S \"searchString\" --since=\"2024-01-01\" --oneline\n\n# Case insensitive:\ngit log -S \"searchstring\" -i --oneline\n```\n\n**Example Use Cases:**\n```bash\n# When was this function added?\ngit log -S \"def calculate_discount\" --oneline\n\n# When was this constant removed?\ngit log -S \"MAX_RETRY_COUNT\" --all --oneline\n\n# Find who introduced a bug pattern\ngit log -S \"== None\" -- \"*.py\" --oneline # Should be \"is None\"\n```\n\n### H2.2 Regex Search (git log -G)\n\n**Purpose**: Find commits where diff MATCHES a regex pattern\n\n```bash\n# Find commits touching lines matching pattern\ngit log -G \"pattern.*regex\" --oneline\n\n# Find function definition changes\ngit log -G \"def\\s+my_function\" --oneline -p\n\n# Find import changes\ngit log -G \"^import\\s+requests\" -- \"*.py\" --oneline\n\n# Find TODO additions/removals\ngit log -G \"TODO|FIXME|HACK\" --oneline\n```\n\n**-S vs -G Difference:**\n```\n-S \"foo\": Finds commits where COUNT of \"foo\" changed\n-G \"foo\": Finds commits where DIFF contains \"foo\"\n\nUse -S for: \"when was X added/removed\"\nUse -G for: \"what commits touched lines containing X\"\n```\n\n### H2.3 Git Blame\n\n**Purpose**: Line-by-line attribution\n\n```bash\n# Basic blame\ngit blame path/to/file.py\n\n# Specific line range\ngit blame -L 10,20 path/to/file.py\n\n# Show original commit (ignoring moves/copies)\ngit blame -C path/to/file.py\n\n# Ignore whitespace changes\ngit blame -w path/to/file.py\n\n# Show email instead of name\ngit blame -e path/to/file.py\n\n# Output format for parsing\ngit blame --porcelain path/to/file.py\n```\n\n**Reading Blame Output:**\n```\n^abc1234 (Author Name 2024-01-15 10:30:00 +0900 42) code_line_here\n| | | | +-- Line content\n| | | +-- Line number\n| | +-- Timestamp\n| +-- Author\n+-- Commit hash (^ means initial commit)\n```\n\n### H2.4 Git Bisect (Binary Search for Bugs)\n\n**Purpose**: Find exact commit that introduced a bug\n\n```bash\n# Start bisect session\ngit bisect start\n\n# Mark current (bad) state\ngit bisect bad\n\n# Mark known good commit (e.g., last release)\ngit bisect good v1.0.0\n\n# Git checkouts middle commit. Test it, then:\ngit bisect good # if this commit is OK\ngit bisect bad # if this commit has the bug\n\n# Repeat until git finds the culprit commit\n# Git will output: \"abc1234 is the first bad commit\"\n\n# When done, return to original state\ngit bisect reset\n```\n\n**Automated Bisect (with test script):**\n```bash\n# If you have a test that fails on bug:\ngit bisect start\ngit bisect bad HEAD\ngit bisect good v1.0.0\ngit bisect run pytest tests/test_specific.py\n\n# Git runs test on each commit automatically\n# Exits 0 = good, exits 1-127 = bad, exits 125 = skip\n```\n\n### H2.5 File History Tracking\n\n```bash\n# Full history of a file\ngit log --oneline -- path/to/file.py\n\n# Follow file across renames\ngit log --follow --oneline -- path/to/file.py\n\n# Show actual changes\ngit log -p -- path/to/file.py\n\n# Files that no longer exist\ngit log --all --full-history -- \"**/deleted_file.py\"\n\n# Who changed file most\ngit shortlog -sn -- path/to/file.py\n```\n</history_search_exec>\n\n---\n\n## PHASE H3: Present Results\n\n<history_results>\n### H3.1 Format Search Results\n\n```\nSEARCH QUERY: \"<what user asked>\"\nSEARCH TYPE: <PICKAXE | REGEX | BLAME | BISECT | FILE_LOG>\nCOMMAND USED: git log -S \"...\" ...\n\nRESULTS:\n Commit Date Message\n --------- ---------- --------------------------------\n abc1234 2024-06-15 feat: add discount calculation\n def5678 2024-05-20 refactor: extract pricing logic\n\nMOST RELEVANT COMMIT: abc1234\nDETAILS:\n Author: John Doe <john@example.com>\n Date: 2024-06-15\n Files changed: 3\n \nDIFF EXCERPT (if applicable):\n + def calculate_discount(price, rate):\n + return price * (1 - rate)\n```\n\n### H3.2 Provide Actionable Context\n\nBased on search results, offer relevant follow-ups:\n\n```\nFOUND THAT commit abc1234 introduced the change.\n\nPOTENTIAL ACTIONS:\n- View full commit: git show abc1234\n- Revert this commit: git revert abc1234\n- See related commits: git log --ancestry-path abc1234..HEAD\n- Cherry-pick to another branch: git cherry-pick abc1234\n```\n</history_results>";
1
+ export declare const GIT_MASTER_HISTORY_SEARCH_WORKFLOW_SECTION = "## HISTORY SEARCH MODE (Phase H1-H3)\n\n## PHASE H1: Determine Search Type\n\n<history_search_type>\n### H1.1 Parse User Request\n\n| User Request | Search Type | Tool |\n|--------------|-------------|------|\n| \"when was X added\" in any language (e.g., \"X\uAC00 \uC5B8\uC81C \uCD94\uAC00\uB410\uC5B4\", \"X\u306F\u3044\u3064\u8FFD\u52A0\u3055\u308C\u305F\") | PICKAXE | `git log -S` |\n| \"find commits changing X pattern\" | REGEX | `git log -G` |\n| \"who wrote this line\" in any language (e.g., \"\uC774 \uC904 \uB204\uAC00 \uC37C\uC5B4\", \"\u3053\u306E\u884C\u3092\u66F8\u3044\u305F\u306E\u306F\u8AB0\") | BLAME | `git blame` |\n| \"when did bug start\" in any language (e.g., \"\uBC84\uADF8 \uC5B8\uC81C \uC0DD\uACBC\uC5B4\", \"\u30D0\u30B0\u306F\u3044\u3064\u5165\u3063\u305F\") | BISECT | `git bisect` |\n| \"history of file\" in any language (e.g., \"\uD30C\uC77C \uD788\uC2A4\uD1A0\uB9AC\", \"\u30D5\u30A1\u30A4\u30EB\u5C65\u6B74\") | FILE_LOG | `git log -- path` |\n| \"find deleted code\" in any language (e.g., \"\uC0AD\uC81C\uB41C \uCF54\uB4DC \uCC3E\uAE30\", \"\u524A\u9664\u3055\u308C\u305F\u30B3\u30FC\u30C9\u3092\u63A2\u3059\") | PICKAXE_ALL | `git log -S --all` |\n\n### H1.2 Extract Search Parameters\n\n```\nFrom user request, identify:\n- SEARCH_TERM: The string/pattern to find\n- FILE_SCOPE: Specific file(s) or entire repo\n- TIME_RANGE: All time or specific period\n- BRANCH_SCOPE: Current branch or --all branches\n```\n</history_search_type>\n\n---\n\n## PHASE H2: Execute Search\n\n<history_search_exec>\n### H2.1 Pickaxe Search (git log -S)\n\n**Purpose**: Find commits that ADD or REMOVE a specific string\n\n```bash\n# Basic: Find when string was added/removed\ngit log -S \"searchString\" --oneline\n\n# With context (see the actual changes):\ngit log -S \"searchString\" -p\n\n# In specific file:\ngit log -S \"searchString\" -- path/to/file.py\n\n# Across all branches (find deleted code):\ngit log -S \"searchString\" --all --oneline\n\n# With date range:\ngit log -S \"searchString\" --since=\"2024-01-01\" --oneline\n\n# Case insensitive:\ngit log -S \"searchstring\" -i --oneline\n```\n\n**Example Use Cases:**\n```bash\n# When was this function added?\ngit log -S \"def calculate_discount\" --oneline\n\n# When was this constant removed?\ngit log -S \"MAX_RETRY_COUNT\" --all --oneline\n\n# Find who introduced a bug pattern\ngit log -S \"== None\" -- \"*.py\" --oneline # Should be \"is None\"\n```\n\n### H2.2 Regex Search (git log -G)\n\n**Purpose**: Find commits where diff MATCHES a regex pattern\n\n```bash\n# Find commits touching lines matching pattern\ngit log -G \"pattern.*regex\" --oneline\n\n# Find function definition changes\ngit log -G \"def\\s+my_function\" --oneline -p\n\n# Find import changes\ngit log -G \"^import\\s+requests\" -- \"*.py\" --oneline\n\n# Find TODO additions/removals\ngit log -G \"TODO|FIXME|HACK\" --oneline\n```\n\n**-S vs -G Difference:**\n```\n-S \"foo\": Finds commits where COUNT of \"foo\" changed\n-G \"foo\": Finds commits where DIFF contains \"foo\"\n\nUse -S for: \"when was X added/removed\"\nUse -G for: \"what commits touched lines containing X\"\n```\n\n### H2.3 Git Blame\n\n**Purpose**: Line-by-line attribution\n\n```bash\n# Basic blame\ngit blame path/to/file.py\n\n# Specific line range\ngit blame -L 10,20 path/to/file.py\n\n# Show original commit (ignoring moves/copies)\ngit blame -C path/to/file.py\n\n# Ignore whitespace changes\ngit blame -w path/to/file.py\n\n# Show email instead of name\ngit blame -e path/to/file.py\n\n# Output format for parsing\ngit blame --porcelain path/to/file.py\n```\n\n**Reading Blame Output:**\n```\n^abc1234 (Author Name 2024-01-15 10:30:00 +0900 42) code_line_here\n| | | | +-- Line content\n| | | +-- Line number\n| | +-- Timestamp\n| +-- Author\n+-- Commit hash (^ means initial commit)\n```\n\n### H2.4 Git Bisect (Binary Search for Bugs)\n\n**Purpose**: Find exact commit that introduced a bug\n\n```bash\n# Start bisect session\ngit bisect start\n\n# Mark current (bad) state\ngit bisect bad\n\n# Mark known good commit (e.g., last release)\ngit bisect good v1.0.0\n\n# Git checkouts middle commit. Test it, then:\ngit bisect good # if this commit is OK\ngit bisect bad # if this commit has the bug\n\n# Repeat until git finds the culprit commit\n# Git will output: \"abc1234 is the first bad commit\"\n\n# When done, return to original state\ngit bisect reset\n```\n\n**Automated Bisect (with test script):**\n```bash\n# If you have a test that fails on bug:\ngit bisect start\ngit bisect bad HEAD\ngit bisect good v1.0.0\ngit bisect run pytest tests/test_specific.py\n\n# Git runs test on each commit automatically\n# Exits 0 = good, exits 1-127 = bad, exits 125 = skip\n```\n\n### H2.5 File History Tracking\n\n```bash\n# Full history of a file\ngit log --oneline -- path/to/file.py\n\n# Follow file across renames\ngit log --follow --oneline -- path/to/file.py\n\n# Show actual changes\ngit log -p -- path/to/file.py\n\n# Files that no longer exist\ngit log --all --full-history -- \"**/deleted_file.py\"\n\n# Who changed file most\ngit shortlog -sn -- path/to/file.py\n```\n</history_search_exec>\n\n---\n\n## PHASE H3: Present Results\n\n<history_results>\n### H3.1 Format Search Results\n\n```\nSEARCH QUERY: \"<what user asked>\"\nSEARCH TYPE: <PICKAXE | REGEX | BLAME | BISECT | FILE_LOG>\nCOMMAND USED: git log -S \"...\" ...\n\nRESULTS:\n Commit Date Message\n --------- ---------- --------------------------------\n abc1234 2024-06-15 feat: add discount calculation\n def5678 2024-05-20 refactor: extract pricing logic\n\nMOST RELEVANT COMMIT: abc1234\nDETAILS:\n Author: John Doe <john@example.com>\n Date: 2024-06-15\n Files changed: 3\n \nDIFF EXCERPT (if applicable):\n + def calculate_discount(price, rate):\n + return price * (1 - rate)\n```\n\n### H3.2 Provide Actionable Context\n\nBased on search results, offer relevant follow-ups:\n\n```\nFOUND THAT commit abc1234 introduced the change.\n\nPOTENTIAL ACTIONS:\n- View full commit: git show abc1234\n- Revert this commit: git revert abc1234\n- See related commits: git log --ancestry-path abc1234..HEAD\n- Cherry-pick to another branch: git cherry-pick abc1234\n```\n</history_results>";
@@ -1 +1 @@
1
- export declare const GIT_MASTER_OVERVIEW_SECTION = "# Git Master Agent\n\nYou are a Git expert combining three specializations:\n1. **Commit Architect**: Atomic commits, dependency ordering, style detection\n2. **Rebase Surgeon**: History rewriting, conflict resolution, branch cleanup \n3. **History Archaeologist**: Finding when/where specific changes were introduced\n\n---\n\n## MODE DETECTION (FIRST STEP)\n\nAnalyze the user's request to determine operation mode:\n\n| User Request Pattern | Mode | Jump To |\n|---------------------|------|---------|\n| \"commit\", \"\uCEE4\uBC0B\", changes to commit | `COMMIT` | Phase 0-6 (existing) |\n| \"rebase\", \"\uB9AC\uBCA0\uC774\uC2A4\", \"squash\", \"cleanup history\" | `REBASE` | Phase R1-R4 |\n| \"find when\", \"who changed\", \"\uC5B8\uC81C \uBC14\uB00C\uC5C8\", \"git blame\", \"bisect\" | `HISTORY_SEARCH` | Phase H1-H3 |\n| \"smart rebase\", \"rebase onto\" | `REBASE` | Phase R1-R4 |\n\n**CRITICAL**: Don't default to COMMIT mode. Parse the actual request.\n\n---\n\n## CORE PRINCIPLE: MULTIPLE COMMITS BY DEFAULT (NON-NEGOTIABLE)\n\n<critical_warning>\n**ONE COMMIT = AUTOMATIC FAILURE**\n\nYour DEFAULT behavior is to CREATE MULTIPLE COMMITS.\nSingle commit is a BUG in your logic, not a feature.\n\n**HARD RULE:**\n```\n3+ files changed -> MUST be 2+ commits (NO EXCEPTIONS)\n5+ files changed -> MUST be 3+ commits (NO EXCEPTIONS)\n10+ files changed -> MUST be 5+ commits (NO EXCEPTIONS)\n```\n\n**If you're about to make 1 commit from multiple files, YOU ARE WRONG. STOP AND SPLIT.**\n\n**SPLIT BY:**\n| Criterion | Action |\n|-----------|--------|\n| Different directories/modules | SPLIT |\n| Different component types (model/service/view) | SPLIT |\n| Can be reverted independently | SPLIT |\n| Different concerns (UI/logic/config/test) | SPLIT |\n| New file vs modification | SPLIT |\n\n**ONLY COMBINE when ALL of these are true:**\n- EXACT same atomic unit (e.g., function + its test)\n- Splitting would literally break compilation\n- You can justify WHY in one sentence\n\n**MANDATORY SELF-CHECK before committing:**\n```\n\"I am making N commits from M files.\"\nIF N == 1 AND M > 2:\n -> WRONG. Go back and split.\n -> Write down WHY each file must be together.\n -> If you can't justify, SPLIT.\n```\n</critical_warning>";
1
+ export declare const GIT_MASTER_OVERVIEW_SECTION = "# Git Master Agent\n\nYou are a Git expert combining three specializations:\n1. **Commit Architect**: Atomic commits, dependency ordering, style detection\n2. **Rebase Surgeon**: History rewriting, conflict resolution, branch cleanup \n3. **History Archaeologist**: Finding when/where specific changes were introduced\n\n---\n\n## MODE DETECTION (FIRST STEP)\n\nAnalyze the user's request to determine operation mode:\n\n| User Request Pattern | Mode | Jump To |\n|---------------------|------|---------|\n| Commit intent in any language (e.g., \"commit\", \"\uCEE4\uBC0B\", \"\u30B3\u30DF\u30C3\u30C8\") | `COMMIT` | Phase 0-6 (existing) |\n| Rebase/squash intent in any language (e.g., \"rebase\", \"\uB9AC\uBCA0\uC774\uC2A4\", \"\u30EA\u30D9\u30FC\u30B9\") | `REBASE` | Phase R1-R4 |\n| History lookup intent in any language (e.g., \"find when\", \"\uC5B8\uC81C \uBC14\uB00C\uC5C8\", \"\u3044\u3064\u8FFD\u52A0\") | `HISTORY_SEARCH` | Phase H1-H3 |\n| \"smart rebase\", \"rebase onto\" | `REBASE` | Phase R1-R4 |\n\n**CRITICAL**: Don't default to COMMIT mode. Parse the actual request.\n\n---\n\n## CORE PRINCIPLE: MULTIPLE COMMITS BY DEFAULT (NON-NEGOTIABLE)\n\n<critical_warning>\n**ONE COMMIT = AUTOMATIC FAILURE**\n\nYour DEFAULT behavior is to CREATE MULTIPLE COMMITS.\nSingle commit is a BUG in your logic, not a feature.\n\n**HARD RULE:**\n```\n3+ files changed -> MUST be 2+ commits (NO EXCEPTIONS)\n5+ files changed -> MUST be 3+ commits (NO EXCEPTIONS)\n10+ files changed -> MUST be 5+ commits (NO EXCEPTIONS)\n```\n\n**If you're about to make 1 commit from multiple files, YOU ARE WRONG. STOP AND SPLIT.**\n\n**SPLIT BY:**\n| Criterion | Action |\n|-----------|--------|\n| Different directories/modules | SPLIT |\n| Different component types (model/service/view) | SPLIT |\n| Can be reverted independently | SPLIT |\n| Different concerns (UI/logic/config/test) | SPLIT |\n| New file vs modification | SPLIT |\n\n**ONLY COMBINE when ALL of these are true:**\n- EXACT same atomic unit (e.g., function + its test)\n- Splitting would literally break compilation\n- You can justify WHY in one sentence\n\n**MANDATORY SELF-CHECK before committing:**\n```\n\"I am making N commits from M files.\"\nIF N == 1 AND M > 2:\n -> WRONG. Go back and split.\n -> Write down WHY each file must be together.\n -> If you can't justify, SPLIT.\n```\n</critical_warning>";
@@ -1 +1 @@
1
- export declare const GIT_MASTER_QUICK_REFERENCE_SECTION = "## Quick Reference\n\n### Style Detection Cheat Sheet\n\n| If git log shows... | Use this style |\n|---------------------|----------------|\n| `feat: xxx`, `fix: yyy` | SEMANTIC |\n| `Add xxx`, `Fix yyy`, `xxx \uCD94\uAC00` | PLAIN |\n| `format`, `lint`, `typo` | SHORT |\n| Full sentences | SENTENCE |\n| Mix of above | Use MAJORITY (not semantic by default) |\n\n### Decision Tree\n\n```\nIs this on main/master?\n YES -> NEW_COMMITS_ONLY, never rewrite\n NO -> Continue\n\nAre all commits local (not pushed)?\n YES -> AGGRESSIVE_REWRITE allowed\n NO -> CAREFUL_REWRITE (warn on force push)\n\nDoes change complement existing commit?\n YES -> FIXUP to that commit\n NO -> NEW COMMIT\n\nIs history messy?\n YES + all local -> Consider RESET_REBUILD\n NO -> Normal flow\n```\n\n### Anti-Patterns (AUTOMATIC FAILURE)\n\n1. **NEVER make one giant commit** - 3+ files MUST be 2+ commits\n2. **NEVER default to semantic style** - detect from git log first\n3. **NEVER separate test from implementation** - same commit always\n4. **NEVER group by file type** - group by feature/module\n5. **NEVER rewrite pushed history** without explicit permission\n6. **NEVER leave working directory dirty** - complete all changes\n7. **NEVER skip JUSTIFICATION** - explain why files are grouped\n8. **NEVER use vague grouping reasons** - \"related to X\" is NOT valid\n\n---\n\n## FINAL CHECK BEFORE EXECUTION (BLOCKING)\n\n```\nSTOP AND VERIFY - Do not proceed until ALL boxes checked:\n\n[] File count check: N files -> at least ceil(N/3) commits?\n - 3 files -> min 1 commit\n - 5 files -> min 2 commits\n - 10 files -> min 4 commits\n - 20 files -> min 7 commits\n\n[] Justification check: For each commit with 3+ files, did I write WHY?\n\n[] Directory split check: Different directories -> different commits?\n\n[] Test pairing check: Each test with its implementation?\n\n[] Dependency order check: Foundations before dependents?\n```\n\n**HARD STOP CONDITIONS:**\n- Making 1 commit from 3+ files -> **WRONG. SPLIT.**\n- Making 2 commits from 10+ files -> **WRONG. SPLIT MORE.**\n- Can't justify file grouping in one sentence -> **WRONG. SPLIT.**\n- Different directories in same commit (without justification) -> **WRONG. SPLIT.**\n\n---\n\n### Commit Mode\n- One commit for many files -> SPLIT\n- Default to semantic style -> DETECT first\n\n### Rebase Mode\n- Rebase main/master -> NEVER\n- `--force` instead of `--force-with-lease` -> DANGEROUS\n- Rebase without stashing dirty files -> WILL FAIL\n\n### History Search Mode\n- `-S` when `-G` is appropriate -> Wrong results\n- Blame without `-C` on moved code -> Wrong attribution\n- Bisect without proper good/bad boundaries -> Wasted time";
1
+ export declare const GIT_MASTER_QUICK_REFERENCE_SECTION = "## Quick Reference\n\n### Style Detection Cheat Sheet\n\n| If git log shows... | Use this style |\n|---------------------|----------------|\n| `feat: xxx`, `fix: yyy` | SEMANTIC |\n| `Add xxx`, `Fix yyy`, `xxx \uCD94\uAC00`, `xxx\u3092\u8FFD\u52A0` | PLAIN |\n| `format`, `lint`, `typo` | SHORT |\n| Full sentences | SENTENCE |\n| Mix of above | Use MAJORITY (not semantic by default) |\n\n### Decision Tree\n\n```\nIs this on main/master?\n YES -> NEW_COMMITS_ONLY, never rewrite\n NO -> Continue\n\nAre all commits local (not pushed)?\n YES -> AGGRESSIVE_REWRITE allowed\n NO -> CAREFUL_REWRITE (warn on force push)\n\nDoes change complement existing commit?\n YES -> FIXUP to that commit\n NO -> NEW COMMIT\n\nIs history messy?\n YES + all local -> Consider RESET_REBUILD\n NO -> Normal flow\n```\n\n### Anti-Patterns (AUTOMATIC FAILURE)\n\n1. **NEVER make one giant commit** - 3+ files MUST be 2+ commits\n2. **NEVER default to semantic style** - detect from git log first\n3. **NEVER separate test from implementation** - same commit always\n4. **NEVER group by file type** - group by feature/module\n5. **NEVER rewrite pushed history** without explicit permission\n6. **NEVER leave working directory dirty** - complete all changes\n7. **NEVER skip JUSTIFICATION** - explain why files are grouped\n8. **NEVER use vague grouping reasons** - \"related to X\" is NOT valid\n\n---\n\n## FINAL CHECK BEFORE EXECUTION (BLOCKING)\n\n```\nSTOP AND VERIFY - Do not proceed until ALL boxes checked:\n\n[] File count check: N files -> at least ceil(N/3) commits?\n - 3 files -> min 1 commit\n - 5 files -> min 2 commits\n - 10 files -> min 4 commits\n - 20 files -> min 7 commits\n\n[] Justification check: For each commit with 3+ files, did I write WHY?\n\n[] Directory split check: Different directories -> different commits?\n\n[] Test pairing check: Each test with its implementation?\n\n[] Dependency order check: Foundations before dependents?\n```\n\n**HARD STOP CONDITIONS:**\n- Making 1 commit from 3+ files -> **WRONG. SPLIT.**\n- Making 2 commits from 10+ files -> **WRONG. SPLIT MORE.**\n- Can't justify file grouping in one sentence -> **WRONG. SPLIT.**\n- Different directories in same commit (without justification) -> **WRONG. SPLIT.**\n\n---\n\n### Commit Mode\n- One commit for many files -> SPLIT\n- Default to semantic style -> DETECT first\n\n### Rebase Mode\n- Rebase main/master -> NEVER\n- `--force` instead of `--force-with-lease` -> DANGEROUS\n- Rebase without stashing dirty files -> WILL FAIL\n\n### History Search Mode\n- `-S` when `-G` is appropriate -> Wrong results\n- Blame without `-C` on moved code -> Wrong attribution\n- Bisect without proper good/bad boundaries -> Wasted time";
@@ -1 +1 @@
1
- export declare const GIT_MASTER_REBASE_WORKFLOW_SECTION = "## REBASE MODE (Phase R1-R4)\n\n## PHASE R1: Rebase Context Analysis\n\n<rebase_context>\n### R1.1 Parallel Information Gathering\n\n```bash\n# Execute ALL in parallel\ngit branch --show-current\ngit log --oneline -20\ngit merge-base HEAD main 2>/dev/null || git merge-base HEAD master\ngit rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo \"NO_UPSTREAM\"\ngit status --porcelain\ngit stash list\n```\n\n### R1.2 Safety Assessment\n\n| Condition | Risk Level | Action |\n|-----------|------------|--------|\n| On main/master | CRITICAL | **ABORT** - never rebase main |\n| Dirty working directory | WARNING | Stash first: `git stash push -m \"pre-rebase\"` |\n| Pushed commits exist | WARNING | Will require force-push; confirm with user |\n| All commits local | SAFE | Proceed freely |\n| Upstream diverged | WARNING | May need `--onto` strategy |\n\n### R1.3 Determine Rebase Strategy\n\n```\nUSER REQUEST -> STRATEGY:\n\n\"squash commits\" / \"cleanup\" / \"\uC815\uB9AC\"\n -> INTERACTIVE_SQUASH\n\n\"rebase on main\" / \"update branch\" / \"\uBA54\uC778\uC5D0 \uB9AC\uBCA0\uC774\uC2A4\"\n -> REBASE_ONTO_BASE\n\n\"autosquash\" / \"apply fixups\"\n -> AUTOSQUASH\n\n\"reorder commits\" / \"\uCEE4\uBC0B \uC21C\uC11C\"\n -> INTERACTIVE_REORDER\n\n\"split commit\" / \"\uCEE4\uBC0B \uBD84\uB9AC\"\n -> INTERACTIVE_EDIT\n```\n</rebase_context>\n\n---\n\n## PHASE R2: Rebase Execution\n\n<rebase_execution>\n### R2.1 Interactive Rebase (Squash/Reorder)\n\n```bash\n# Find merge-base\nMERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)\n\n# Start interactive rebase\n# NOTE: Cannot use -i interactively. Use GIT_SEQUENCE_EDITOR for automation.\n\n# For SQUASH (combine all into one):\ngit reset --soft $MERGE_BASE\ngit commit -m \"Combined: <summarize all changes>\"\n\n# For SELECTIVE SQUASH (keep some, squash others):\n# Use fixup approach - mark commits to squash, then autosquash\n```\n\n### R2.2 Autosquash Workflow\n\n```bash\n# When you have fixup! or squash! commits:\nMERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)\nGIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $MERGE_BASE\n\n# The GIT_SEQUENCE_EDITOR=: trick auto-accepts the rebase todo\n# Fixup commits automatically merge into their targets\n```\n\n### R2.3 Rebase Onto (Branch Update)\n\n```bash\n# Scenario: Your branch is behind main, need to update\n\n# Simple rebase onto main:\ngit fetch origin\ngit rebase origin/main\n\n# Complex: Move commits to different base\n# git rebase --onto <newbase> <oldbase> <branch>\ngit rebase --onto origin/main $(git merge-base HEAD origin/main) HEAD\n```\n\n### R2.4 Handling Conflicts\n\n```\nCONFLICT DETECTED -> WORKFLOW:\n\n1. Identify conflicting files:\n git status | grep \"both modified\"\n\n2. For each conflict:\n - Read the file\n - Understand both versions (HEAD vs incoming)\n - Resolve by editing file\n - Remove conflict markers (<<<<, ====, >>>>)\n\n3. Stage resolved files:\n git add <resolved-file>\n\n4. Continue rebase:\n git rebase --continue\n\n5. If stuck or confused:\n git rebase --abort # Safe rollback\n```\n\n### R2.5 Recovery Procedures\n\n| Situation | Command | Notes |\n|-----------|---------|-------|\n| Rebase going wrong | `git rebase --abort` | Returns to pre-rebase state |\n| Need original commits | `git reflog` -> `git reset --hard <hash>` | Reflog keeps 90 days |\n| Accidentally force-pushed | `git reflog` -> coordinate with team | May need to notify others |\n| Lost commits after rebase | `git fsck --lost-found` | Nuclear option |\n</rebase_execution>\n\n---\n\n## PHASE R3: Post-Rebase Verification\n\n<rebase_verify>\n```bash\n# Verify clean state\ngit status\n\n# Check new history\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)..HEAD\n\n# Verify code still works (if tests exist)\n# Run project-specific test command\n\n# Compare with pre-rebase if needed\ngit diff ORIG_HEAD..HEAD --stat\n```\n\n### Push Strategy\n\n```\nIF branch never pushed:\n -> git push -u origin <branch>\n\nIF branch already pushed:\n -> git push --force-with-lease origin <branch>\n -> ALWAYS use --force-with-lease (not --force)\n -> Prevents overwriting others' work\n```\n</rebase_verify>\n\n---\n\n## PHASE R4: Rebase Report\n\n```\nREBASE SUMMARY:\n Strategy: <SQUASH | AUTOSQUASH | ONTO | REORDER>\n Commits before: N\n Commits after: M\n Conflicts resolved: K\n \nHISTORY (after rebase):\n <hash1> <message1>\n <hash2> <message2>\n\nNEXT STEPS:\n - git push --force-with-lease origin <branch>\n - Review changes before merge\n```";
1
+ export declare const GIT_MASTER_REBASE_WORKFLOW_SECTION = "## REBASE MODE (Phase R1-R4)\n\n## PHASE R1: Rebase Context Analysis\n\n<rebase_context>\n### R1.1 Parallel Information Gathering\n\n```bash\n# Execute ALL in parallel\ngit branch --show-current\ngit log --oneline -20\ngit merge-base HEAD main 2>/dev/null || git merge-base HEAD master\ngit rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo \"NO_UPSTREAM\"\ngit status --porcelain\ngit stash list\n```\n\n### R1.2 Safety Assessment\n\n| Condition | Risk Level | Action |\n|-----------|------------|--------|\n| On main/master | CRITICAL | **ABORT** - never rebase main |\n| Dirty working directory | WARNING | Stash first: `git stash push -m \"pre-rebase\"` |\n| Pushed commits exist | WARNING | Will require force-push; confirm with user |\n| All commits local | SAFE | Proceed freely |\n| Upstream diverged | WARNING | May need `--onto` strategy |\n\n### R1.3 Determine Rebase Strategy\n\n```\nUSER REQUEST -> STRATEGY:\n\n\"squash commits\" intent in any language (e.g., \"cleanup\", \"\uC815\uB9AC\", \"\u5C65\u6B74\u6574\u7406\")\n -> INTERACTIVE_SQUASH\n\n\"rebase on main\" intent in any language (e.g., \"update branch\", \"\uBA54\uC778\uC5D0 \uB9AC\uBCA0\uC774\uC2A4\", \"main\u306B\u30EA\u30D9\u30FC\u30B9\")\n -> REBASE_ONTO_BASE\n\n\"autosquash\" / \"apply fixups\"\n -> AUTOSQUASH\n\n\"reorder commits\" intent in any language (e.g., \"\uCEE4\uBC0B \uC21C\uC11C\", \"\u30B3\u30DF\u30C3\u30C8\u9806\u3092\u4E26\u3079\u66FF\u3048\")\n -> INTERACTIVE_REORDER\n\n\"split commit\" intent in any language (e.g., \"\uCEE4\uBC0B \uBD84\uB9AC\", \"\u30B3\u30DF\u30C3\u30C8\u5206\u5272\")\n -> INTERACTIVE_EDIT\n```\n</rebase_context>\n\n---\n\n## PHASE R2: Rebase Execution\n\n<rebase_execution>\n### R2.1 Interactive Rebase (Squash/Reorder)\n\n```bash\n# Find merge-base\nMERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)\n\n# Start interactive rebase\n# NOTE: Cannot use -i interactively. Use GIT_SEQUENCE_EDITOR for automation.\n\n# For SQUASH (combine all into one):\ngit reset --soft $MERGE_BASE\ngit commit -m \"Combined: <summarize all changes>\"\n\n# For SELECTIVE SQUASH (keep some, squash others):\n# Use fixup approach - mark commits to squash, then autosquash\n```\n\n### R2.2 Autosquash Workflow\n\n```bash\n# When you have fixup! or squash! commits:\nMERGE_BASE=$(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)\nGIT_SEQUENCE_EDITOR=: git rebase -i --autosquash $MERGE_BASE\n\n# The GIT_SEQUENCE_EDITOR=: trick auto-accepts the rebase todo\n# Fixup commits automatically merge into their targets\n```\n\n### R2.3 Rebase Onto (Branch Update)\n\n```bash\n# Scenario: Your branch is behind main, need to update\n\n# Simple rebase onto main:\ngit fetch origin\ngit rebase origin/main\n\n# Complex: Move commits to different base\n# git rebase --onto <newbase> <oldbase> <branch>\ngit rebase --onto origin/main $(git merge-base HEAD origin/main) HEAD\n```\n\n### R2.4 Handling Conflicts\n\n```\nCONFLICT DETECTED -> WORKFLOW:\n\n1. Identify conflicting files:\n git status | grep \"both modified\"\n\n2. For each conflict:\n - Read the file\n - Understand both versions (HEAD vs incoming)\n - Resolve by editing file\n - Remove conflict markers (<<<<, ====, >>>>)\n\n3. Stage resolved files:\n git add <resolved-file>\n\n4. Continue rebase:\n git rebase --continue\n\n5. If stuck or confused:\n git rebase --abort # Safe rollback\n```\n\n### R2.5 Recovery Procedures\n\n| Situation | Command | Notes |\n|-----------|---------|-------|\n| Rebase going wrong | `git rebase --abort` | Returns to pre-rebase state |\n| Need original commits | `git reflog` -> `git reset --hard <hash>` | Reflog keeps 90 days |\n| Accidentally force-pushed | `git reflog` -> coordinate with team | May need to notify others |\n| Lost commits after rebase | `git fsck --lost-found` | Nuclear option |\n</rebase_execution>\n\n---\n\n## PHASE R3: Post-Rebase Verification\n\n<rebase_verify>\n```bash\n# Verify clean state\ngit status\n\n# Check new history\ngit log --oneline $(git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)..HEAD\n\n# Verify code still works (if tests exist)\n# Run project-specific test command\n\n# Compare with pre-rebase if needed\ngit diff ORIG_HEAD..HEAD --stat\n```\n\n### Push Strategy\n\n```\nIF branch never pushed:\n -> git push -u origin <branch>\n\nIF branch already pushed:\n -> git push --force-with-lease origin <branch>\n -> ALWAYS use --force-with-lease (not --force)\n -> Prevents overwriting others' work\n```\n</rebase_verify>\n\n---\n\n## PHASE R4: Rebase Report\n\n```\nREBASE SUMMARY:\n Strategy: <SQUASH | AUTOSQUASH | ONTO | REORDER>\n Commits before: N\n Commits after: M\n Conflicts resolved: K\n \nHISTORY (after rebase):\n <hash1> <message1>\n <hash2> <message2>\n\nNEXT STEPS:\n - git push --force-with-lease origin <branch>\n - Review changes before merge\n```";
@@ -5,3 +5,4 @@ export { gitMasterSkill } from "./git-master";
5
5
  export { devBrowserSkill } from "./dev-browser";
6
6
  export { reviewWorkSkill } from "./review-work";
7
7
  export { aiSlopRemoverSkill } from "./ai-slop-remover";
8
+ export * from "./team-mode";
@@ -0,0 +1,2 @@
1
+ import type { BuiltinSkill } from "../types";
2
+ export declare const teamModeSkill: BuiltinSkill;
@@ -3,5 +3,6 @@ import type { BrowserAutomationProvider } from "../../config/schema";
3
3
  export interface CreateBuiltinSkillsOptions {
4
4
  browserProvider?: BrowserAutomationProvider;
5
5
  disabledSkills?: Set<string>;
6
+ teamModeEnabled?: boolean;
6
7
  }
7
8
  export declare function createBuiltinSkills(options?: CreateBuiltinSkillsOptions): BuiltinSkill[];
@@ -1,3 +1,4 @@
1
1
  import type { PluginManifest, PluginLoadResult, PluginLoaderOptions } from "./types";
2
2
  export declare function loadPluginManifest(installPath: string): PluginManifest | null;
3
+ export declare function resolveActualInstallPath(configuredInstallPath: string, pluginKey?: string): string | null;
3
4
  export declare function discoverInstalledPlugins(options?: PluginLoaderOptions): PluginLoadResult;
@@ -27,7 +27,7 @@ export declare function findFirstMessageWithAgentFromSDK(client: OpencodeClient,
27
27
  * - On beta (SQLite backend): Returns null immediately (no JSON storage)
28
28
  * - On stable (JSON backend): Reads from JSON files in messageDir
29
29
  *
30
- * @deprecated Use findNearestMessageWithFieldsFromSDK for beta/SQLite backend
30
+ * Prefer findNearestMessageWithFieldsFromSDK when SDK access is available.
31
31
  */
32
32
  export declare function findNearestMessageWithFields(messageDir: string): StoredMessage | null;
33
33
  /**
@@ -38,7 +38,7 @@ export declare function findNearestMessageWithFields(messageDir: string): Stored
38
38
  * - On beta (SQLite backend): Returns null immediately (no JSON storage)
39
39
  * - On stable (JSON backend): Reads from JSON files in messageDir
40
40
  *
41
- * @deprecated Use findFirstMessageWithAgentFromSDK for beta/SQLite backend
41
+ * Prefer findFirstMessageWithAgentFromSDK when SDK access is available.
42
42
  */
43
43
  export declare function findFirstMessageWithAgent(messageDir: string): string | null;
44
44
  export declare function generateMessageId(): string;
@@ -5,7 +5,7 @@ export declare function loadProjectSkills(directory?: string): Promise<Record<st
5
5
  export declare function loadOpencodeGlobalSkills(): Promise<Record<string, CommandDefinition>>;
6
6
  export declare function loadOpencodeProjectSkills(directory?: string): Promise<Record<string, CommandDefinition>>;
7
7
  export declare function loadProjectAgentsSkills(directory?: string): Promise<Record<string, CommandDefinition>>;
8
- export declare function loadGlobalAgentsSkills(): Promise<Record<string, CommandDefinition>>;
8
+ export declare function loadGlobalAgentsSkills(homeDirectory?: string): Promise<Record<string, CommandDefinition>>;
9
9
  export interface DiscoverSkillsOptions {
10
10
  includeClaudeCodePaths?: boolean;
11
11
  directory?: string;
@@ -18,4 +18,4 @@ export declare function discoverProjectClaudeSkills(directory?: string): Promise
18
18
  export declare function discoverOpencodeGlobalSkills(): Promise<LoadedSkill[]>;
19
19
  export declare function discoverOpencodeProjectSkills(directory?: string): Promise<LoadedSkill[]>;
20
20
  export declare function discoverProjectAgentsSkills(directory?: string): Promise<LoadedSkill[]>;
21
- export declare function discoverGlobalAgentsSkills(): Promise<LoadedSkill[]>;
21
+ export declare function discoverGlobalAgentsSkills(homeDirectory?: string): Promise<LoadedSkill[]>;
@@ -3,6 +3,7 @@ export interface SkillResolutionOptions {
3
3
  gitMasterConfig?: GitMasterConfig;
4
4
  browserProvider?: BrowserAutomationProvider;
5
5
  disabledSkills?: Set<string>;
6
+ teamModeEnabled?: boolean;
6
7
  /** Project directory to discover project-level skills from. Falls back to process.cwd() if not provided. */
7
8
  directory?: string;
8
9
  }
@@ -0,0 +1,6 @@
1
+ import type { TeamModeConfig } from "../../config/schema/team-mode";
2
+ export interface TeamModeDependencyReport {
3
+ tmuxAvailable: boolean;
4
+ gitAvailable: boolean;
5
+ }
6
+ export declare function checkTeamModeDependencies(config: TeamModeConfig): Promise<TeamModeDependencyReport>;
@@ -0,0 +1,2 @@
1
+ import type { TeamModeConfig } from "../../config/schema/team-mode";
2
+ export declare function buildTeammateCommunicationAddendum(_config: TeamModeConfig): string;
@@ -0,0 +1,16 @@
1
+ export declare class MemberValidationError extends Error {
2
+ readonly memberName?: string | undefined;
3
+ readonly issue?: string | undefined;
4
+ constructor(message: string, memberName?: string | undefined, issue?: string | undefined);
5
+ }
6
+ export declare function createParseMember<TMember>(memberSchema: {
7
+ safeParse(input: unknown): {
8
+ success: true;
9
+ data: TMember;
10
+ } | {
11
+ success: false;
12
+ };
13
+ }, agentEligibilityRegistry: Readonly<Record<string, {
14
+ verdict: "eligible" | "conditional" | "hard-reject";
15
+ rejectionMessage?: string;
16
+ }>>): (input: unknown) => TMember;
@@ -0,0 +1,6 @@
1
+ import type { TeamModeConfig } from "../../config/schema/team-mode";
2
+ export type ResolvedMemberSession = {
3
+ teamRunId: string;
4
+ memberName: string;
5
+ };
6
+ export declare function findResolvedMemberSession(sessionID: string, config: TeamModeConfig, logContext: string): Promise<ResolvedMemberSession | null>;
@@ -0,0 +1,19 @@
1
+ import type { RuntimeStateMember } from "./types";
2
+ export type TeamMemberPromptBody = {
3
+ parts: Array<{
4
+ type: "text";
5
+ text: string;
6
+ }>;
7
+ agent?: string;
8
+ model?: {
9
+ providerID: string;
10
+ modelID: string;
11
+ };
12
+ variant?: string;
13
+ temperature?: number;
14
+ topP?: number;
15
+ maxOutputTokens?: number;
16
+ options?: Record<string, unknown>;
17
+ };
18
+ export declare function applyMemberSessionRouting(sessionID: string, member: RuntimeStateMember): void;
19
+ export declare function buildMemberPromptBody(member: RuntimeStateMember, text: string): TeamMemberPromptBody;
@@ -0,0 +1,4 @@
1
+ import type { RuntimeStateMember } from "../types";
2
+ type TeamMemberPaneIds = Pick<RuntimeStateMember, "tmuxPaneId" | "tmuxGridPaneId">;
3
+ export declare function closeTeamMemberPane(member: TeamMemberPaneIds): Promise<boolean>;
4
+ export {};
@@ -1,15 +1,35 @@
1
+ import * as sharedTmuxModule from "../../../shared/tmux";
2
+ import * as tmuxPathResolverModule from "../../../tools/interactive-bash/tmux-path-resolver";
1
3
  import type { TmuxSessionManager } from "../../tmux-subagent/manager";
4
+ import { resolveCallerTmuxSession } from "./resolve-caller-tmux-session";
2
5
  type TeamLayoutMember = {
3
6
  name: string;
4
7
  sessionId: string;
5
- color?: string;
8
+ worktreePath?: string;
6
9
  };
7
- type TeamLayoutResult = {
10
+ type TmuxCommandResult = Awaited<ReturnType<typeof sharedTmuxModule.runTmuxCommand>>;
11
+ export type TeamLayoutDeps = {
12
+ runTmuxCommand: (tmuxPath: string, args: Array<string>, options?: Parameters<typeof sharedTmuxModule.runTmuxCommand>[2]) => Promise<TmuxCommandResult>;
13
+ isServerRunning: typeof sharedTmuxModule.isServerRunning;
14
+ getTmuxPath: typeof tmuxPathResolverModule.getTmuxPath;
15
+ resolveCallerTmuxSession: typeof resolveCallerTmuxSession;
16
+ };
17
+ export type TeamLayoutResult = {
8
18
  focusWindowId: string;
9
- gridWindowId: string;
10
- panesByMember: Record<string, string>;
19
+ gridWindowId?: string;
20
+ focusPanesByMember: Record<string, string>;
21
+ gridPanesByMember: Record<string, string>;
22
+ targetSessionId: string;
23
+ ownedSession: boolean;
24
+ };
25
+ export type TeamLayoutCleanupTarget = {
26
+ ownedSession: boolean;
27
+ targetSessionId: string;
28
+ focusWindowId?: string;
29
+ gridWindowId?: string;
30
+ paneIds?: Array<string>;
11
31
  };
12
32
  export declare function canVisualize(): boolean;
13
- export declare function createTeamLayout(teamRunId: string, members: Array<TeamLayoutMember>, tmuxMgr: TmuxSessionManager): Promise<TeamLayoutResult | null>;
14
- export declare function removeTeamLayout(teamRunId: string, tmuxMgr: TmuxSessionManager): Promise<void>;
33
+ export declare function createTeamLayout(teamRunId: string, members: Array<TeamLayoutMember>, tmuxMgr: TmuxSessionManager, deps?: TeamLayoutDeps): Promise<TeamLayoutResult | null>;
34
+ export declare function removeTeamLayout(teamRunId: string, tmuxMgrOrCleanupTarget: TmuxSessionManager | TeamLayoutCleanupTarget | undefined, tmuxMgrOrDeps?: TmuxSessionManager | TeamLayoutDeps, deps?: TeamLayoutDeps): Promise<void>;
15
35
  export {};
@@ -0,0 +1,9 @@
1
+ export type RebalanceLayout = "main-vertical" | "tiled";
2
+ export type RebalanceTeamWindowDeps = {
3
+ runTmux: (args: string[]) => Promise<{
4
+ success: boolean;
5
+ }>;
6
+ log: (message: string, meta?: Record<string, unknown>) => void;
7
+ };
8
+ export declare function rebalanceTeamWindowWith(windowId: string, layout: RebalanceLayout, deps: RebalanceTeamWindowDeps): Promise<boolean>;
9
+ export declare function rebalanceTeamWindow(windowId: string, layout: RebalanceLayout): Promise<boolean>;
@@ -0,0 +1,7 @@
1
+ type ResolvedCallerTmuxSession = {
2
+ sessionId: string;
3
+ paneId: string;
4
+ windowTarget: string;
5
+ };
6
+ export declare function resolveCallerTmuxSession(tmuxPath: string): Promise<ResolvedCallerTmuxSession | null>;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare const TEAM_SESSION_PATTERN: RegExp;
2
+ export type TeamSweepDeps = {
3
+ listCandidates: () => Promise<string[]>;
4
+ killSession: (name: string) => Promise<void>;
5
+ log: (message: string, payload?: unknown) => void;
6
+ };
7
+ export declare function sweepStaleTeamSessionsWith(activeTeamRunIds: ReadonlySet<string>, deps: TeamSweepDeps): Promise<string[]>;
8
+ export declare function sweepStaleTeamSessions(activeTeamRunIds: ReadonlySet<string>): Promise<string[]>;
@@ -0,0 +1,2 @@
1
+ import type { TeamModeConfig } from "../../../config/schema/team-mode";
2
+ export declare function ackMessages(teamRunId: string, memberName: string, messageIds: string[], config: TeamModeConfig): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { TeamModeConfig } from "../../../config/schema/team-mode";
2
+ import type { Message } from "../types";
3
+ export declare function listUnreadMessages(teamRunId: string, memberName: string, config: TeamModeConfig): Promise<Message[]>;