oh-my-opencode 2.8.3 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.ja.md CHANGED
@@ -660,6 +660,10 @@ Oh My OpenCode は以下の場所からフックを読み込んで実行しま
660
660
  - **Empty Message Sanitizer**: 空のチャットメッセージによるAPIエラーを防止します。送信前にメッセージ内容を自動的にサニタイズします。
661
661
  - **Grep Output Truncator**: grep は山のようなテキストを返すことがあります。残りのコンテキストウィンドウに応じて動的に出力を切り詰めます—50% の余裕を維持し、最大 50k トークンに制限します。
662
662
  - **Tool Output Truncator**: 同じ考え方をより広範囲に適用します。Grep、Glob、LSP ツール、AST-grep の出力を切り詰めます。一度の冗長な検索がコンテキスト全体を食いつぶすのを防ぎます。
663
+ - **Preemptive Compaction**: トークン制限に達する前にセッションを事前にコンパクションします。コンテキストウィンドウ使用率85%で実行されます。**デフォルトで有効。** `disabled_hooks: ["preemptive-compaction"]`で無効化できます。
664
+ - **Compaction Context Injector**: セッションコンパクション中に重要なコンテキスト(AGENTS.md、現在のディレクトリ情報)を保持し、重要な状態を失わないようにします。
665
+ - **Thinking Block Validator**: thinking ブロックを検証し、適切なフォーマットを確保し、不正な thinking コンテンツによる API エラーを防ぎます。
666
+ - **Claude Code Hooks**: Claude Code の settings.json からフックを実行します - これは PreToolUse/PostToolUse/UserPromptSubmit/Stop フックを実行する互換性レイヤーです。
663
667
 
664
668
  ## 設定
665
669
 
@@ -874,7 +878,7 @@ Oh My OpenCode は以下の場所からフックを読み込んで実行しま
874
878
  }
875
879
  ```
876
880
 
877
- 利用可能なフック:`todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `empty-message-sanitizer`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`
881
+ 利用可能なフック:`todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `empty-message-sanitizer`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`, `preemptive-compaction`
878
882
 
879
883
  **`auto-update-checker`と`startup-toast`について**: `startup-toast` フックは `auto-update-checker` のサブ機能です。アップデートチェックは有効なまま起動トースト通知のみを無効化するには、`disabled_hooks` に `"startup-toast"` を追加してください。すべてのアップデートチェック機能(トーストを含む)を無効化するには、`"auto-update-checker"` を追加してください。
880
884
 
@@ -926,7 +930,7 @@ OpenCode でサポートされるすべての LSP 構成およびカスタム設
926
930
  ```json
927
931
  {
928
932
  "experimental": {
929
- "preemptive_compaction": true,
933
+ "preemptive_compaction_threshold": 0.85,
930
934
  "truncate_all_tool_outputs": true,
931
935
  "aggressive_truncation": true,
932
936
  "auto_resume": true
@@ -936,8 +940,7 @@ OpenCode でサポートされるすべての LSP 構成およびカスタム設
936
940
 
937
941
  | オプション | デフォルト | 説明 |
938
942
  | --------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
939
- | `preemptive_compaction` | `false` | トークン制限に達する前にセッションを事前にコンパクションします。デフォルトでコンテキストウィンドウ使用率80%で実行されます。 |
940
- | `preemptive_compaction_threshold` | `0.80` | プリエンプティブコンパクションをトリガーする閾値(0.5-0.95)。`preemptive_compaction`が有効な場合のみ適用されます。 |
943
+ | `preemptive_compaction_threshold` | `0.85` | プリエンプティブコンパクションをトリガーする閾値(0.5-0.95)。`preemptive-compaction` フックはデフォルトで有効です。このオプションで閾値をカスタマイズできます。 |
941
944
  | `truncate_all_tool_outputs` | `false` | ホワイトリストのツール(Grep、Glob、LSP、AST-grep)だけでなく、すべてのツール出力を切り詰めます。Tool output truncator はデフォルトで有効です - `disabled_hooks`で無効化できます。 |
942
945
  | `aggressive_truncation` | `false` | トークン制限を超えた場合、ツール出力を積極的に切り詰めて制限内に収めます。デフォルトの切り詰めより積極的です。不十分な場合は要約/復元にフォールバックします。 |
943
946
  | `auto_resume` | `false` | thinking block エラーや thinking disabled violation からの回復成功後、自動的にセッションを再開します。最後のユーザーメッセージを抽出して続行します。 |
package/README.ko.md CHANGED
@@ -653,7 +653,7 @@ Oh My OpenCode는 다음 위치의 훅을 읽고 실행합니다:
653
653
  - **Empty Message Sanitizer**: 빈 채팅 메시지로 인한 API 오류를 방지합니다. 전송 전 메시지 내용을 자동으로 정리합니다.
654
654
  - **Grep Output Truncator**: grep은 산더미 같은 텍스트를 반환할 수 있습니다. 남은 컨텍스트 윈도우에 따라 동적으로 출력을 축소합니다—50% 여유 공간 유지, 최대 50k 토큰.
655
655
  - **Tool Output Truncator**: 같은 아이디어, 더 넓은 범위. Grep, Glob, LSP 도구, AST-grep의 출력을 축소합니다. 한 번의 장황한 검색이 전체 컨텍스트를 잡아먹는 것을 방지합니다.
656
- - **선제적 압축 (Preemptive Compaction)**: 세션 토큰 한계에 도달하기 전에 선제적으로 세션을 압축합니다. 문제가 발생하기 전에 미리 실행됩니다.
656
+ - **선제적 압축 (Preemptive Compaction)**: 세션 토큰 한계에 도달하기 전에 선제적으로 세션을 압축합니다. 컨텍스트 윈도우 사용량 85%에서 실행됩니다. **기본적으로 활성화됨.** `disabled_hooks: ["preemptive-compaction"]`으로 비활성화 가능.
657
657
  - **압축 컨텍스트 주입기 (Compaction Context Injector)**: 세션 압축 중에 중요한 컨텍스트(AGENTS.md, 현재 디렉토리 정보 등)를 유지하여 중요한 상태를 잃지 않도록 합니다.
658
658
  - **사고 블록 검증기 (Thinking Block Validator)**: 사고(thinking) 블록의 형식이 올바른지 검증하여 잘못된 형식으로 인한 API 오류를 방지합니다.
659
659
  - **Claude Code 훅 (Claude Code Hooks)**: Claude Code의 settings.json에 설정된 훅을 실행합니다. PreToolUse/PostToolUse/UserPromptSubmit/Stop 이벤트를 지원하는 호환성 레이어입니다.
@@ -871,7 +871,7 @@ Schema 자동 완성이 지원됩니다:
871
871
  }
872
872
  ```
873
873
 
874
- 사용 가능한 훅: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `empty-message-sanitizer`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`
874
+ 사용 가능한 훅: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `empty-message-sanitizer`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`, `preemptive-compaction`
875
875
 
876
876
  **`auto-update-checker`와 `startup-toast`에 대한 참고사항**: `startup-toast` 훅은 `auto-update-checker`의 하위 기능입니다. 업데이트 확인은 유지하면서 시작 토스트 알림만 비활성화하려면 `disabled_hooks`에 `"startup-toast"`를 추가하세요. 모든 업데이트 확인 기능(토스트 포함)을 비활성화하려면 `"auto-update-checker"`를 추가하세요.
877
877
 
@@ -923,7 +923,7 @@ OpenCode 에서 지원하는 모든 LSP 구성 및 커스텀 설정 (opencode.js
923
923
  ```json
924
924
  {
925
925
  "experimental": {
926
- "preemptive_compaction": true,
926
+ "preemptive_compaction_threshold": 0.85,
927
927
  "truncate_all_tool_outputs": true,
928
928
  "aggressive_truncation": true,
929
929
  "auto_resume": true
@@ -933,8 +933,7 @@ OpenCode 에서 지원하는 모든 LSP 구성 및 커스텀 설정 (opencode.js
933
933
 
934
934
  | 옵션 | 기본값 | 설명 |
935
935
  | --------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
936
- | `preemptive_compaction` | `false` | 토큰 제한에 도달하기 전에 세션을 미리 컴팩션합니다. 기본적으로 컨텍스트 윈도우 사용량이 80%일 실행됩니다. |
937
- | `preemptive_compaction_threshold` | `0.80` | 선제적 컴팩션을 트리거할 임계값 비율(0.5-0.95). `preemptive_compaction`이 활성화된 경우에만 적용됩니다. |
936
+ | `preemptive_compaction_threshold` | `0.85` | 선제적 컴팩션을 트리거할 임계값 비율(0.5-0.95). `preemptive-compaction` 훅은 기본적으로 활성화되어 있으며, 옵션으로 임계값을 커스터마이즈할 수 있습니다. |
938
937
  | `truncate_all_tool_outputs` | `false` | 화이트리스트 도구(Grep, Glob, LSP, AST-grep)만이 아닌 모든 도구 출력을 잘라냅니다. Tool output truncator는 기본적으로 활성화됩니다 - `disabled_hooks`로 비활성화 가능합니다. |
939
938
  | `aggressive_truncation` | `false` | 토큰 제한을 초과하면 도구 출력을 공격적으로 잘라내어 제한 내에 맞춥니다. 기본 truncation보다 더 공격적입니다. 부족하면 요약/복구로 fallback합니다. |
940
939
  | `auto_resume` | `false` | thinking block 에러나 thinking disabled violation으로부터 성공적으로 복구한 후 자동으로 세션을 재개합니다. 마지막 사용자 메시지를 추출하여 계속합니다. |
package/README.md CHANGED
@@ -692,7 +692,7 @@ When agents thrive, you thrive. But I want to help you directly too.
692
692
  - **Empty Message Sanitizer**: Prevents API errors from empty chat messages by automatically sanitizing message content before sending.
693
693
  - **Grep Output Truncator**: Grep can return mountains of text. This dynamically truncates output based on your remaining context window—keeps 50% headroom, caps at 50k tokens.
694
694
  - **Tool Output Truncator**: Same idea, broader scope. Truncates output from Grep, Glob, LSP tools, and AST-grep. Prevents one verbose search from eating your entire context.
695
- - **Preemptive Compaction**: Compacts session proactively before hitting hard token limits. Runs before you get into trouble.
695
+ - **Preemptive Compaction**: Compacts session proactively before hitting hard token limits. Runs at 85% context window usage. **Enabled by default.** Disable via `disabled_hooks: ["preemptive-compaction"]`.
696
696
  - **Compaction Context Injector**: Preserves critical context (AGENTS.md, current directory info) during session compaction so you don't lose important state.
697
697
  - **Thinking Block Validator**: Validates thinking blocks to ensure proper formatting and prevent API errors from malformed thinking content.
698
698
  - **Claude Code Hooks**: Executes hooks from Claude Code's settings.json - this is the compatibility layer that runs PreToolUse/PostToolUse/UserPromptSubmit/Stop hooks.
@@ -910,7 +910,7 @@ Disable specific built-in hooks via `disabled_hooks` in `~/.config/opencode/oh-m
910
910
  }
911
911
  ```
912
912
 
913
- Available hooks: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `empty-message-sanitizer`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`
913
+ Available hooks: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `empty-message-sanitizer`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`, `preemptive-compaction`
914
914
 
915
915
  **Note on `auto-update-checker` and `startup-toast`**: The `startup-toast` hook is a sub-feature of `auto-update-checker`. To disable only the startup toast notification while keeping update checking enabled, add `"startup-toast"` to `disabled_hooks`. To disable all update checking features (including the toast), add `"auto-update-checker"` to `disabled_hooks`.
916
916
 
@@ -962,7 +962,7 @@ Opt-in experimental features that may change or be removed in future versions. U
962
962
  ```json
963
963
  {
964
964
  "experimental": {
965
- "preemptive_compaction": true,
965
+ "preemptive_compaction_threshold": 0.85,
966
966
  "truncate_all_tool_outputs": true,
967
967
  "aggressive_truncation": true,
968
968
  "auto_resume": true
@@ -972,8 +972,7 @@ Opt-in experimental features that may change or be removed in future versions. U
972
972
 
973
973
  | Option | Default | Description |
974
974
  | --------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
975
- | `preemptive_compaction` | `false` | Compacts session proactively before hitting hard token limits. Runs at 80% context window usage by default. |
976
- | `preemptive_compaction_threshold` | `0.80` | Threshold percentage (0.5-0.95) to trigger preemptive compaction. Only applies when `preemptive_compaction` is enabled. |
975
+ | `preemptive_compaction_threshold` | `0.85` | Threshold percentage (0.5-0.95) to trigger preemptive compaction. The `preemptive-compaction` hook is enabled by default; this option customizes the threshold. |
977
976
  | `truncate_all_tool_outputs` | `false` | Truncates ALL tool outputs instead of just whitelisted tools (Grep, Glob, LSP, AST-grep). Tool output truncator is enabled by default - disable via `disabled_hooks`. |
978
977
  | `aggressive_truncation` | `false` | When token limit is exceeded, aggressively truncates tool outputs to fit within limits. More aggressive than the default truncation behavior. Falls back to summarize/revert if insufficient. |
979
978
  | `auto_resume` | `false` | Automatically resumes session after successful recovery from thinking block errors or thinking disabled violations. Extracts the last user message and continues. |
package/README.zh-cn.md CHANGED
@@ -664,6 +664,10 @@ Agent 爽了,你自然也爽。但我还想直接让你爽。
664
664
  - **空消息清理器**:防止发空消息导致 API 报错。发出去之前自动打扫干净。
665
665
  - **Grep 输出截断器**:grep 结果太多?根据剩余窗口动态截断——留 50% 空间,顶天 50k token。
666
666
  - **工具输出截断器**:Grep、Glob、LSP、AST-grep 统统管上。防止一次无脑搜索把上下文撑爆。
667
+ - **预防性压缩 (Preemptive Compaction)**:在达到 token 限制之前主动压缩会话。在上下文窗口使用率 85% 时运行。**默认启用。** 通过 `disabled_hooks: ["preemptive-compaction"]` 禁用。
668
+ - **压缩上下文注入器**:会话压缩时保留关键上下文(AGENTS.md、当前目录信息),防止丢失重要状态。
669
+ - **思考块验证器**:验证 thinking block 以确保格式正确,防止因格式错误的 thinking 内容而导致 API 错误。
670
+ - **Claude Code Hooks**:执行 Claude Code settings.json 中的 hooks - 这是运行 PreToolUse/PostToolUse/UserPromptSubmit/Stop hooks 的兼容层。
667
671
 
668
672
  ## 配置
669
673
 
@@ -878,7 +882,7 @@ Sisyphus Agent 也能自定义:
878
882
  }
879
883
  ```
880
884
 
881
- 可关的 hook:`todo-continuation-enforcer`、`context-window-monitor`、`session-recovery`、`session-notification`、`comment-checker`、`grep-output-truncator`、`tool-output-truncator`、`directory-agents-injector`、`directory-readme-injector`、`empty-task-response-detector`、`think-mode`、`anthropic-context-window-limit-recovery`、`rules-injector`、`background-notification`、`auto-update-checker`、`startup-toast`、`keyword-detector`、`agent-usage-reminder`、`non-interactive-env`、`interactive-bash-session`、`empty-message-sanitizer`、`compaction-context-injector`、`thinking-block-validator`、`claude-code-hooks`、`ralph-loop`
885
+ 可关的 hook:`todo-continuation-enforcer`、`context-window-monitor`、`session-recovery`、`session-notification`、`comment-checker`、`grep-output-truncator`、`tool-output-truncator`、`directory-agents-injector`、`directory-readme-injector`、`empty-task-response-detector`、`think-mode`、`anthropic-context-window-limit-recovery`、`rules-injector`、`background-notification`、`auto-update-checker`、`startup-toast`、`keyword-detector`、`agent-usage-reminder`、`non-interactive-env`、`interactive-bash-session`、`empty-message-sanitizer`、`compaction-context-injector`、`thinking-block-validator`、`claude-code-hooks`、`ralph-loop`、`preemptive-compaction`
882
886
 
883
887
  **关于 `auto-update-checker` 和 `startup-toast`**: `startup-toast` hook 是 `auto-update-checker` 的子功能。若想保持更新检查但只禁用启动提示通知,在 `disabled_hooks` 中添加 `"startup-toast"`。若要禁用所有更新检查功能(包括提示),添加 `"auto-update-checker"`。
884
888
 
@@ -930,7 +934,7 @@ Oh My OpenCode 送你重构工具(重命名、代码操作)。
930
934
  ```json
931
935
  {
932
936
  "experimental": {
933
- "preemptive_compaction": true,
937
+ "preemptive_compaction_threshold": 0.85,
934
938
  "truncate_all_tool_outputs": true,
935
939
  "aggressive_truncation": true,
936
940
  "auto_resume": true
@@ -940,8 +944,7 @@ Oh My OpenCode 送你重构工具(重命名、代码操作)。
940
944
 
941
945
  | 选项 | 默认值 | 说明 |
942
946
  | --------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
943
- | `preemptive_compaction` | `false` | 在达到 token 限制之前主动压缩会话。默认在上下文窗口使用率达到 80% 时运行。 |
944
- | `preemptive_compaction_threshold` | `0.80` | 触发预先压缩的阈值比例(0.5-0.95)。仅在 `preemptive_compaction` 启用时生效。 |
947
+ | `preemptive_compaction_threshold` | `0.85` | 触发预防性压缩的阈值比例(0.5-0.95)。`preemptive-compaction` 钩子默认启用;此选项用于自定义阈值。 |
945
948
  | `truncate_all_tool_outputs` | `false` | 截断所有工具输出,而不仅仅是白名单工具(Grep、Glob、LSP、AST-grep)。Tool output truncator 默认启用 - 使用 `disabled_hooks` 禁用。 |
946
949
  | `aggressive_truncation` | `false` | 超出 token 限制时,激进地截断工具输出以适应限制。比默认截断更激进。不够的话会回退到摘要/恢复。 |
947
950
  | `auto_resume` | `false` | 从 thinking block 错误或 thinking disabled violation 成功恢复后,自动恢复会话。提取最后一条用户消息继续执行。 |
@@ -1,3 +1,5 @@
1
1
  import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { AgentPromptMetadata } from "./types";
3
+ export declare const DOCUMENT_WRITER_PROMPT_METADATA: AgentPromptMetadata;
2
4
  export declare function createDocumentWriterAgent(model?: string): AgentConfig;
3
5
  export declare const documentWriterAgent: AgentConfig;
@@ -1,3 +1,5 @@
1
1
  import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { AgentPromptMetadata } from "./types";
3
+ export declare const EXPLORE_PROMPT_METADATA: AgentPromptMetadata;
2
4
  export declare function createExploreAgent(model?: string): AgentConfig;
3
5
  export declare const exploreAgent: AgentConfig;
@@ -1,3 +1,5 @@
1
1
  import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { AgentPromptMetadata } from "./types";
3
+ export declare const FRONTEND_PROMPT_METADATA: AgentPromptMetadata;
2
4
  export declare function createFrontendUiUxEngineerAgent(model?: string): AgentConfig;
3
5
  export declare const frontendUiUxEngineerAgent: AgentConfig;
@@ -2,3 +2,4 @@ import type { AgentConfig } from "@opencode-ai/sdk";
2
2
  export declare const builtinAgents: Record<string, AgentConfig>;
3
3
  export * from "./types";
4
4
  export { createBuiltinAgents } from "./utils";
5
+ export type { AvailableAgent } from "./sisyphus-prompt-builder";
@@ -1,3 +1,5 @@
1
1
  import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { AgentPromptMetadata } from "./types";
3
+ export declare const LIBRARIAN_PROMPT_METADATA: AgentPromptMetadata;
2
4
  export declare function createLibrarianAgent(model?: string): AgentConfig;
3
5
  export declare const librarianAgent: AgentConfig;
@@ -1,3 +1,5 @@
1
1
  import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { AgentPromptMetadata } from "./types";
3
+ export declare const MULTIMODAL_LOOKER_PROMPT_METADATA: AgentPromptMetadata;
2
4
  export declare function createMultimodalLookerAgent(model?: string): AgentConfig;
3
5
  export declare const multimodalLookerAgent: AgentConfig;
@@ -1,3 +1,5 @@
1
1
  import type { AgentConfig } from "@opencode-ai/sdk";
2
+ import type { AgentPromptMetadata } from "./types";
3
+ export declare const ORACLE_PROMPT_METADATA: AgentPromptMetadata;
2
4
  export declare function createOracleAgent(model?: string): AgentConfig;
3
5
  export declare const oracleAgent: AgentConfig;
@@ -0,0 +1,20 @@
1
+ import type { AgentPromptMetadata, BuiltinAgentName } from "./types";
2
+ export interface AvailableAgent {
3
+ name: BuiltinAgentName;
4
+ description: string;
5
+ metadata: AgentPromptMetadata;
6
+ }
7
+ export interface AvailableTool {
8
+ name: string;
9
+ category: "lsp" | "ast" | "search" | "session" | "command" | "other";
10
+ }
11
+ export declare function categorizeTools(toolNames: string[]): AvailableTool[];
12
+ export declare function buildKeyTriggersSection(agents: AvailableAgent[]): string;
13
+ export declare function buildToolSelectionTable(agents: AvailableAgent[], tools?: AvailableTool[]): string;
14
+ export declare function buildExploreSection(agents: AvailableAgent[]): string;
15
+ export declare function buildLibrarianSection(agents: AvailableAgent[]): string;
16
+ export declare function buildDelegationTable(agents: AvailableAgent[]): string;
17
+ export declare function buildFrontendSection(agents: AvailableAgent[]): string;
18
+ export declare function buildOracleSection(agents: AvailableAgent[]): string;
19
+ export declare function buildHardBlocksSection(agents: AvailableAgent[]): string;
20
+ export declare function buildAntiPatternsSection(agents: AvailableAgent[]): string;
@@ -1,3 +1,4 @@
1
1
  import type { AgentConfig } from "@opencode-ai/sdk";
2
- export declare function createSisyphusAgent(model?: string): AgentConfig;
2
+ import type { AvailableAgent } from "./sisyphus-prompt-builder";
3
+ export declare function createSisyphusAgent(model?: string, availableAgents?: AvailableAgent[], availableToolNames?: string[]): AgentConfig;
3
4
  export declare const sisyphusAgent: AgentConfig;
@@ -1,5 +1,44 @@
1
1
  import type { AgentConfig } from "@opencode-ai/sdk";
2
2
  export type AgentFactory = (model?: string) => AgentConfig;
3
+ /**
4
+ * Agent category for grouping in Sisyphus prompt sections
5
+ */
6
+ export type AgentCategory = "exploration" | "specialist" | "advisor" | "utility";
7
+ /**
8
+ * Cost classification for Tool Selection table
9
+ */
10
+ export type AgentCost = "FREE" | "CHEAP" | "EXPENSIVE";
11
+ /**
12
+ * Delegation trigger for Sisyphus prompt's Delegation Table
13
+ */
14
+ export interface DelegationTrigger {
15
+ /** Domain of work (e.g., "Frontend UI/UX") */
16
+ domain: string;
17
+ /** When to delegate (e.g., "Visual changes only...") */
18
+ trigger: string;
19
+ }
20
+ /**
21
+ * Metadata for generating Sisyphus prompt sections dynamically
22
+ * This allows adding/removing agents without manually updating the Sisyphus prompt
23
+ */
24
+ export interface AgentPromptMetadata {
25
+ /** Category for grouping in prompt sections */
26
+ category: AgentCategory;
27
+ /** Cost classification for Tool Selection table */
28
+ cost: AgentCost;
29
+ /** Domain triggers for Delegation Table */
30
+ triggers: DelegationTrigger[];
31
+ /** When to use this agent (for detailed sections) */
32
+ useWhen?: string[];
33
+ /** When NOT to use this agent */
34
+ avoidWhen?: string[];
35
+ /** Optional dedicated prompt section (markdown) - for agents like Oracle that have special sections */
36
+ dedicatedSection?: string;
37
+ /** Nickname/alias used in prompt (e.g., "Oracle" instead of "oracle") */
38
+ promptAlias?: string;
39
+ /** Key triggers that should appear in Phase 0 (e.g., "External library mentioned → fire librarian") */
40
+ keyTrigger?: string;
41
+ }
3
42
  export declare function isGptModel(model: string): boolean;
4
43
  export type BuiltinAgentName = "Sisyphus" | "oracle" | "librarian" | "explore" | "frontend-ui-ux-engineer" | "document-writer" | "multimodal-looker";
5
44
  export type OverridableAgentName = "build" | BuiltinAgentName;
package/dist/cli/index.js CHANGED
@@ -2657,7 +2657,7 @@ var require_napi = __commonJS((exports, module) => {
2657
2657
  var require_package = __commonJS((exports, module) => {
2658
2658
  module.exports = {
2659
2659
  name: "oh-my-opencode",
2660
- version: "2.8.2",
2660
+ version: "2.8.3",
2661
2661
  description: "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
2662
2662
  main: "dist/index.js",
2663
2663
  types: "dist/index.d.ts",
@@ -19875,7 +19875,10 @@ var HookNameSchema = exports_external.enum([
19875
19875
  "interactive-bash-session",
19876
19876
  "empty-message-sanitizer",
19877
19877
  "thinking-block-validator",
19878
- "ralph-loop"
19878
+ "ralph-loop",
19879
+ "preemptive-compaction",
19880
+ "compaction-context-injector",
19881
+ "claude-code-hooks"
19879
19882
  ]);
19880
19883
  var BuiltinCommandNameSchema = exports_external.enum([
19881
19884
  "init-deep"
@@ -20536,63 +20539,6 @@ function getMcpCheckDefinitions() {
20536
20539
  }
20537
20540
 
20538
20541
  // src/cli/doctor/checks/version.ts
20539
- import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
20540
- import { homedir as homedir7 } from "os";
20541
- import { join as join9 } from "path";
20542
- var OPENCODE_CONFIG_DIR4 = join9(homedir7(), ".config", "opencode");
20543
- var OPENCODE_PACKAGE_JSON2 = join9(OPENCODE_CONFIG_DIR4, "package.json");
20544
- var OPENCODE_JSON4 = join9(OPENCODE_CONFIG_DIR4, "opencode.json");
20545
- var OPENCODE_JSONC4 = join9(OPENCODE_CONFIG_DIR4, "opencode.jsonc");
20546
- async function fetchLatestVersion2() {
20547
- try {
20548
- const res = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME2}/latest`, {
20549
- signal: AbortSignal.timeout(5000)
20550
- });
20551
- if (!res.ok)
20552
- return null;
20553
- const data = await res.json();
20554
- return data.version;
20555
- } catch {
20556
- return null;
20557
- }
20558
- }
20559
- function getCurrentVersion() {
20560
- const configPath = existsSync8(OPENCODE_JSONC4) ? OPENCODE_JSONC4 : OPENCODE_JSON4;
20561
- if (!existsSync8(configPath)) {
20562
- return { version: null, isLocalDev: false, isPinned: false, pinnedVersion: null };
20563
- }
20564
- try {
20565
- const content = readFileSync8(configPath, "utf-8");
20566
- const config2 = parseJsonc(content);
20567
- const plugins = config2.plugin ?? [];
20568
- for (const plugin of plugins) {
20569
- if (plugin.startsWith("file:") && plugin.includes(PACKAGE_NAME2)) {
20570
- return { version: "local-dev", isLocalDev: true, isPinned: false, pinnedVersion: null };
20571
- }
20572
- if (plugin.startsWith(`${PACKAGE_NAME2}@`)) {
20573
- const pinnedVersion = plugin.split("@")[1];
20574
- return { version: pinnedVersion, isLocalDev: false, isPinned: true, pinnedVersion };
20575
- }
20576
- if (plugin === PACKAGE_NAME2) {
20577
- if (existsSync8(OPENCODE_PACKAGE_JSON2)) {
20578
- try {
20579
- const pkgContent = readFileSync8(OPENCODE_PACKAGE_JSON2, "utf-8");
20580
- const pkg = JSON.parse(pkgContent);
20581
- const depVersion = pkg.dependencies?.[PACKAGE_NAME2];
20582
- if (depVersion) {
20583
- const cleanVersion = depVersion.replace(/^[\^~]/, "");
20584
- return { version: cleanVersion, isLocalDev: false, isPinned: false, pinnedVersion: null };
20585
- }
20586
- } catch {}
20587
- }
20588
- return { version: null, isLocalDev: false, isPinned: false, pinnedVersion: null };
20589
- }
20590
- }
20591
- return { version: null, isLocalDev: false, isPinned: false, pinnedVersion: null };
20592
- } catch {
20593
- return { version: null, isLocalDev: false, isPinned: false, pinnedVersion: null };
20594
- }
20595
- }
20596
20542
  function compareVersions2(current, latest) {
20597
20543
  const parseVersion = (v) => {
20598
20544
  const cleaned = v.replace(/^v/, "").split("-")[0];
@@ -20611,15 +20557,35 @@ function compareVersions2(current, latest) {
20611
20557
  return true;
20612
20558
  }
20613
20559
  async function getVersionInfo() {
20614
- const current = getCurrentVersion();
20615
- const latestVersion = await fetchLatestVersion2();
20616
- const isUpToDate = current.isLocalDev || current.isPinned || !current.version || !latestVersion || compareVersions2(current.version, latestVersion);
20560
+ const cwd = process.cwd();
20561
+ if (isLocalDevMode(cwd)) {
20562
+ return {
20563
+ currentVersion: "local-dev",
20564
+ latestVersion: null,
20565
+ isUpToDate: true,
20566
+ isLocalDev: true,
20567
+ isPinned: false
20568
+ };
20569
+ }
20570
+ const pluginInfo = findPluginEntry(cwd);
20571
+ if (pluginInfo?.isPinned) {
20572
+ return {
20573
+ currentVersion: pluginInfo.pinnedVersion,
20574
+ latestVersion: null,
20575
+ isUpToDate: true,
20576
+ isLocalDev: false,
20577
+ isPinned: true
20578
+ };
20579
+ }
20580
+ const currentVersion = getCachedVersion();
20581
+ const latestVersion = await getLatestVersion();
20582
+ const isUpToDate = !currentVersion || !latestVersion || compareVersions2(currentVersion, latestVersion);
20617
20583
  return {
20618
- currentVersion: current.version,
20584
+ currentVersion,
20619
20585
  latestVersion,
20620
20586
  isUpToDate,
20621
- isLocalDev: current.isLocalDev,
20622
- isPinned: current.isPinned
20587
+ isLocalDev: false,
20588
+ isPinned: false
20623
20589
  };
20624
20590
  }
20625
20591
  async function checkVersionStatus() {
@@ -18,8 +18,8 @@ export declare const OverridableAgentNameSchema: z.ZodEnum<{
18
18
  "multimodal-looker": "multimodal-looker";
19
19
  build: "build";
20
20
  plan: "plan";
21
- "OpenCode-Builder": "OpenCode-Builder";
22
21
  "Planner-Sisyphus": "Planner-Sisyphus";
22
+ "OpenCode-Builder": "OpenCode-Builder";
23
23
  }>;
24
24
  export declare const AgentNameSchema: z.ZodEnum<{
25
25
  Sisyphus: "Sisyphus";
@@ -31,6 +31,7 @@ export declare const AgentNameSchema: z.ZodEnum<{
31
31
  "multimodal-looker": "multimodal-looker";
32
32
  }>;
33
33
  export declare const HookNameSchema: z.ZodEnum<{
34
+ "anthropic-context-window-limit-recovery": "anthropic-context-window-limit-recovery";
34
35
  "todo-continuation-enforcer": "todo-continuation-enforcer";
35
36
  "context-window-monitor": "context-window-monitor";
36
37
  "session-recovery": "session-recovery";
@@ -42,7 +43,6 @@ export declare const HookNameSchema: z.ZodEnum<{
42
43
  "directory-readme-injector": "directory-readme-injector";
43
44
  "empty-task-response-detector": "empty-task-response-detector";
44
45
  "think-mode": "think-mode";
45
- "anthropic-context-window-limit-recovery": "anthropic-context-window-limit-recovery";
46
46
  "rules-injector": "rules-injector";
47
47
  "background-notification": "background-notification";
48
48
  "auto-update-checker": "auto-update-checker";
@@ -54,6 +54,9 @@ export declare const HookNameSchema: z.ZodEnum<{
54
54
  "empty-message-sanitizer": "empty-message-sanitizer";
55
55
  "thinking-block-validator": "thinking-block-validator";
56
56
  "ralph-loop": "ralph-loop";
57
+ "preemptive-compaction": "preemptive-compaction";
58
+ "compaction-context-injector": "compaction-context-injector";
59
+ "claude-code-hooks": "claude-code-hooks";
57
60
  }>;
58
61
  export declare const BuiltinCommandNameSchema: z.ZodEnum<{
59
62
  "init-deep": "init-deep";
@@ -779,6 +782,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
779
782
  "multimodal-looker": "multimodal-looker";
780
783
  }>>>;
781
784
  disabled_hooks: z.ZodOptional<z.ZodArray<z.ZodEnum<{
785
+ "anthropic-context-window-limit-recovery": "anthropic-context-window-limit-recovery";
782
786
  "todo-continuation-enforcer": "todo-continuation-enforcer";
783
787
  "context-window-monitor": "context-window-monitor";
784
788
  "session-recovery": "session-recovery";
@@ -790,7 +794,6 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
790
794
  "directory-readme-injector": "directory-readme-injector";
791
795
  "empty-task-response-detector": "empty-task-response-detector";
792
796
  "think-mode": "think-mode";
793
- "anthropic-context-window-limit-recovery": "anthropic-context-window-limit-recovery";
794
797
  "rules-injector": "rules-injector";
795
798
  "background-notification": "background-notification";
796
799
  "auto-update-checker": "auto-update-checker";
@@ -802,6 +805,9 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
802
805
  "empty-message-sanitizer": "empty-message-sanitizer";
803
806
  "thinking-block-validator": "thinking-block-validator";
804
807
  "ralph-loop": "ralph-loop";
808
+ "preemptive-compaction": "preemptive-compaction";
809
+ "compaction-context-injector": "compaction-context-injector";
810
+ "claude-code-hooks": "claude-code-hooks";
805
811
  }>>>;
806
812
  disabled_commands: z.ZodOptional<z.ZodArray<z.ZodEnum<{
807
813
  "init-deep": "init-deep";
@@ -1 +1 @@
1
- export declare const INIT_DEEP_TEMPLATE = "# Initialize Deep Knowledge Base\n\nGenerate comprehensive AGENTS.md files across project hierarchy. Combines root-level project knowledge (gen-knowledge) with complexity-based subdirectory documentation (gen-knowledge-deep).\n\n## Usage\n\n```\n/init-deep # Analyze and generate hierarchical AGENTS.md\n/init-deep --create-new # Force create from scratch (ignore existing)\n/init-deep --max-depth=2 # Limit to N directory levels (default: 3)\n```\n\n---\n\n## Core Principles\n\n- **Telegraphic Style**: Sacrifice grammar for concision (\"Project uses React\" \u2192 \"React 18\")\n- **Predict-then-Compare**: Predict standard \u2192 find actual \u2192 document ONLY deviations\n- **Hierarchy Aware**: Parent covers general, children cover specific\n- **No Redundancy**: Child AGENTS.md NEVER repeats parent content\n- **LSP-First**: Use LSP tools for accurate code intelligence when available (semantic > text search)\n\n---\n\n## Process\n\n<critical>\n**MANDATORY: TodoWrite for ALL phases. Mark in_progress \u2192 completed in real-time.**\n</critical>\n\n### Phase 0: Initialize\n\n```\nTodoWrite([\n { id: \"p1-analysis\", content: \"Parallel project structure & complexity analysis\", status: \"pending\", priority: \"high\" },\n { id: \"p2-scoring\", content: \"Score directories, determine AGENTS.md locations\", status: \"pending\", priority: \"high\" },\n { id: \"p3-root\", content: \"Generate root AGENTS.md with Predict-then-Compare\", status: \"pending\", priority: \"high\" },\n { id: \"p4-subdirs\", content: \"Generate subdirectory AGENTS.md files in parallel\", status: \"pending\", priority: \"high\" },\n { id: \"p5-review\", content: \"Review, deduplicate, validate all files\", status: \"pending\", priority: \"medium\" }\n])\n```\n\n---\n\n## Phase 1: Parallel Project Analysis\n\n**Mark \"p1-analysis\" as in_progress.**\n\nLaunch **ALL tasks simultaneously**:\n\n<parallel-tasks>\n\n### Structural Analysis (bash - run in parallel)\n```bash\n# Task A: Directory depth analysis\nfind . -type d -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/__pycache__/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Task B: File count per directory \nfind . -type f -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/__pycache__/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Task C: Code concentration\nfind . -type f \\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.jsx\" -o -name \"*.go\" -o -name \"*.rs\" -o -name \"*.java\" \\) -not -path '*/node_modules/*' -not -path '*/venv/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Task D: Existing knowledge files\nfind . -type f \\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\) -not -path '*/node_modules/*' 2>/dev/null\n```\n\n### Context Gathering (Explore agents - background_task in parallel)\n\n```\nbackground_task(agent=\"explore\", prompt=\"Project structure: PREDICT standard {lang} patterns \u2192 FIND package.json/pyproject.toml/go.mod \u2192 REPORT deviations only\")\n\nbackground_task(agent=\"explore\", prompt=\"Entry points: PREDICT typical (main.py, index.ts) \u2192 FIND actual \u2192 REPORT non-standard organization\")\n\nbackground_task(agent=\"explore\", prompt=\"Conventions: FIND .cursor/rules, .cursorrules, eslintrc, pyproject.toml \u2192 REPORT project-specific rules DIFFERENT from defaults\")\n\nbackground_task(agent=\"explore\", prompt=\"Anti-patterns: FIND comments with 'DO NOT', 'NEVER', 'ALWAYS', 'LEGACY', 'DEPRECATED' \u2192 REPORT forbidden patterns\")\n\nbackground_task(agent=\"explore\", prompt=\"Build/CI: FIND .github/workflows, Makefile, justfile \u2192 REPORT non-standard build/deploy patterns\")\n\nbackground_task(agent=\"explore\", prompt=\"Test patterns: FIND pytest.ini, jest.config, test structure \u2192 REPORT unique testing conventions\")\n```\n\n### Code Intelligence Analysis (LSP tools - run in parallel)\n\nLSP provides semantic understanding beyond text search. Use for accurate code mapping.\n\n```\n# Step 1: Check LSP availability\nlsp_servers() # Verify language server is available\n\n# Step 2: Analyze entry point files (run in parallel)\n# Find entry points first, then analyze each with lsp_document_symbols\nlsp_document_symbols(filePath=\"src/index.ts\") # Main entry\nlsp_document_symbols(filePath=\"src/main.py\") # Python entry\nlsp_document_symbols(filePath=\"cmd/main.go\") # Go entry\n\n# Step 3: Discover key symbols across workspace (run in parallel)\nlsp_workspace_symbols(filePath=\".\", query=\"class\") # All classes\nlsp_workspace_symbols(filePath=\".\", query=\"interface\") # All interfaces\nlsp_workspace_symbols(filePath=\".\", query=\"function\") # Top-level functions\nlsp_workspace_symbols(filePath=\".\", query=\"type\") # Type definitions\n\n# Step 4: Analyze symbol centrality (for top 5-10 key symbols)\n# High reference count = central/important concept\nlsp_find_references(filePath=\"src/index.ts\", line=X, character=Y) # Main export\n```\n\n#### LSP Analysis Output Format\n\n```\nCODE_INTELLIGENCE = {\n entry_points: [\n { file: \"src/index.ts\", exports: [\"Plugin\", \"createHook\"], symbol_count: 12 }\n ],\n key_symbols: [\n { name: \"Plugin\", type: \"class\", file: \"src/index.ts\", refs: 45, role: \"Central orchestrator\" },\n { name: \"createHook\", type: \"function\", file: \"src/utils.ts\", refs: 23, role: \"Hook factory\" }\n ],\n module_boundaries: [\n { dir: \"src/hooks\", exports: 21, imports_from: [\"shared/\"] },\n { dir: \"src/tools\", exports: 15, imports_from: [\"shared/\", \"hooks/\"] }\n ]\n}\n```\n\n<critical>\n**LSP Fallback**: If LSP unavailable (no server installed), skip this section and rely on explore agents + AST-grep patterns.\n</critical>\n\n</parallel-tasks>\n\n**Collect all results. Mark \"p1-analysis\" as completed.**\n\n---\n\n## Phase 2: Complexity Scoring & Location Decision\n\n**Mark \"p2-scoring\" as in_progress.**\n\n### Scoring Matrix\n\n| Factor | Weight | Threshold | Source |\n|--------|--------|-----------|--------|\n| File count | 3x | >20 files = high | bash |\n| Subdirectory count | 2x | >5 subdirs = high | bash |\n| Code file ratio | 2x | >70% code = high | bash |\n| Unique patterns | 1x | Has own config | explore |\n| Module boundary | 2x | Has __init__.py/index.ts | bash |\n| **Symbol density** | 2x | >30 symbols = high | LSP |\n| **Export count** | 2x | >10 exports = high | LSP |\n| **Reference centrality** | 3x | Symbols with >20 refs | LSP |\n\n<lsp-scoring>\n**LSP-Enhanced Scoring** (if available):\n\n```\nFor each directory in candidates:\n symbols = lsp_document_symbols(dir/index.ts or dir/__init__.py)\n \n symbol_score = len(symbols) > 30 ? 6 : len(symbols) > 15 ? 3 : 0\n export_score = count(exported symbols) > 10 ? 4 : 0\n \n # Check if this module is central (many things depend on it)\n for each exported symbol:\n refs = lsp_find_references(symbol)\n if refs > 20: centrality_score += 3\n \n total_score += symbol_score + export_score + centrality_score\n```\n</lsp-scoring>\n\n### Decision Rules\n\n| Score | Action |\n|-------|--------|\n| **Root (.)** | ALWAYS create AGENTS.md |\n| **High (>15)** | Create dedicated AGENTS.md |\n| **Medium (8-15)** | Create if distinct domain |\n| **Low (<8)** | Skip, parent sufficient |\n\n### Output Format\n\n```\nAGENTS_LOCATIONS = [\n { path: \".\", type: \"root\" },\n { path: \"src/api\", score: 18, reason: \"high complexity, 45 files\" },\n { path: \"src/hooks\", score: 12, reason: \"distinct domain, unique patterns\" },\n]\n```\n\n**Mark \"p2-scoring\" as completed.**\n\n---\n\n## Phase 3: Generate Root AGENTS.md\n\n**Mark \"p3-root\" as in_progress.**\n\nRoot AGENTS.md gets **full treatment** with Predict-then-Compare synthesis.\n\n### Required Sections\n\n```markdown\n# PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n\n{1-2 sentences: what project does, core tech stack}\n\n## STRUCTURE\n\n\\`\\`\\`\n{project-root}/\n\u251C\u2500\u2500 {dir}/ # {non-obvious purpose only}\n\u2514\u2500\u2500 {entry} # entry point\n\\`\\`\\`\n\n## WHERE TO LOOK\n\n| Task | Location | Notes |\n|------|----------|-------|\n| Add feature X | \\`src/x/\\` | {pattern hint} |\n\n## CODE MAP\n\n{Generated from LSP analysis - shows key symbols and their relationships}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n| {MainClass} | Class | \\`src/index.ts\\` | {N} | {Central orchestrator} |\n| {createX} | Function | \\`src/utils.ts\\` | {N} | {Factory pattern} |\n| {Config} | Interface | \\`src/types.ts\\` | {N} | {Configuration contract} |\n\n### Module Dependencies\n\n\\`\\`\\`\n{entry} \u2500\u2500imports\u2500\u2500> {core/}\n \u2502 \u2502\n \u2514\u2500\u2500imports\u2500\u2500> {utils/} <\u2500\u2500imports\u2500\u2500 {features/}\n\\`\\`\\`\n\n<code-map-note>\n**Skip CODE MAP if**: LSP unavailable OR project too small (<10 files) OR no clear module boundaries.\n</code-map-note>\n\n## CONVENTIONS\n\n{ONLY deviations from standard - skip generic advice}\n\n- **{rule}**: {specific detail}\n\n## ANTI-PATTERNS (THIS PROJECT)\n\n{Things explicitly forbidden HERE}\n\n- **{pattern}**: {why} \u2192 {alternative}\n\n## UNIQUE STYLES\n\n{Project-specific coding styles}\n\n- **{style}**: {how different}\n\n## COMMANDS\n\n\\`\\`\\`bash\n{dev-command}\n{test-command}\n{build-command}\n\\`\\`\\`\n\n## NOTES\n\n{Gotchas, non-obvious info}\n```\n\n### Quality Gates\n\n- [ ] Size: 50-150 lines\n- [ ] No generic advice (\"write clean code\")\n- [ ] No obvious info (\"tests/ has tests\")\n- [ ] Every item is project-specific\n\n**Mark \"p3-root\" as completed.**\n\n---\n\n## Phase 4: Generate Subdirectory AGENTS.md\n\n**Mark \"p4-subdirs\" as in_progress.**\n\nFor each location in AGENTS_LOCATIONS (except root), launch **parallel document-writer agents**:\n\n```typescript\nfor (const loc of AGENTS_LOCATIONS.filter(l => l.path !== \".\")) {\n background_task({\n agent: \"document-writer\",\n prompt: \\`\n Generate AGENTS.md for: ${loc.path}\n \n CONTEXT:\n - Complexity reason: ${loc.reason}\n - Parent AGENTS.md: ./AGENTS.md (already covers project overview)\n \n CRITICAL RULES:\n 1. Focus ONLY on this directory's specific context\n 2. NEVER repeat parent AGENTS.md content\n 3. Shorter is better - 30-80 lines max\n 4. Telegraphic style - sacrifice grammar\n \n REQUIRED SECTIONS:\n - OVERVIEW (1 line: what this directory does)\n - STRUCTURE (only if >5 subdirs)\n - WHERE TO LOOK (directory-specific tasks)\n - CONVENTIONS (only if DIFFERENT from root)\n - ANTI-PATTERNS (directory-specific only)\n \n OUTPUT: Write to ${loc.path}/AGENTS.md\n \\`\n })\n}\n```\n\n**Wait for all agents. Mark \"p4-subdirs\" as completed.**\n\n---\n\n## Phase 5: Review & Deduplicate\n\n**Mark \"p5-review\" as in_progress.**\n\n### Validation Checklist\n\nFor EACH generated AGENTS.md:\n\n| Check | Action if Fail |\n|-------|----------------|\n| Contains generic advice | REMOVE the line |\n| Repeats parent content | REMOVE the line |\n| Missing required section | ADD it |\n| Over 150 lines (root) / 80 lines (subdir) | TRIM |\n| Verbose explanations | REWRITE telegraphic |\n\n### Cross-Reference Validation\n\n```\nFor each child AGENTS.md:\n For each line in child:\n If similar line exists in parent:\n REMOVE from child (parent already covers)\n```\n\n**Mark \"p5-review\" as completed.**\n\n---\n\n## Final Report\n\n```\n=== init-deep Complete ===\n\nFiles Generated:\n \u2713 ./AGENTS.md (root, {N} lines)\n \u2713 ./src/hooks/AGENTS.md ({N} lines)\n \u2713 ./src/tools/AGENTS.md ({N} lines)\n\nDirectories Analyzed: {N}\nAGENTS.md Created: {N}\nTotal Lines: {N}\n\nHierarchy:\n ./AGENTS.md\n \u251C\u2500\u2500 src/hooks/AGENTS.md\n \u2514\u2500\u2500 src/tools/AGENTS.md\n```\n\n---\n\n## Anti-Patterns for THIS Command\n\n- **Over-documenting**: Not every directory needs AGENTS.md\n- **Redundancy**: Child must NOT repeat parent\n- **Generic content**: Remove anything that applies to ALL projects\n- **Sequential execution**: MUST use parallel agents\n- **Deep nesting**: Rarely need AGENTS.md at depth 4+\n- **Verbose style**: \"This directory contains...\" \u2192 just list it\n- **Ignoring LSP**: If LSP available, USE IT - semantic analysis > text grep\n- **LSP without fallback**: Always have explore agent backup if LSP unavailable\n- **Over-referencing**: Don't trace refs for EVERY symbol - focus on exports only";
1
+ export declare const INIT_DEEP_TEMPLATE = "# /init-deep\n\nGenerate hierarchical AGENTS.md files. Root + complexity-scored subdirectories.\n\n## Usage\n\n```\n/init-deep # Update mode: modify existing + create new where warranted\n/init-deep --create-new # Read existing \u2192 remove all \u2192 regenerate from scratch\n/init-deep --max-depth=2 # Limit directory depth (default: 3)\n```\n\n---\n\n## Workflow (High-Level)\n\n1. **Discovery + Analysis** (concurrent)\n - Fire background explore agents immediately\n - Main session: bash structure + LSP codemap + read existing AGENTS.md\n2. **Score & Decide** - Determine AGENTS.md locations from merged findings\n3. **Generate** - Root first, then subdirs in parallel\n4. **Review** - Deduplicate, trim, validate\n\n<critical>\n**TodoWrite ALL phases. Mark in_progress \u2192 completed in real-time.**\n```\nTodoWrite([\n { id: \"discovery\", content: \"Fire explore agents + LSP codemap + read existing\", status: \"pending\", priority: \"high\" },\n { id: \"scoring\", content: \"Score directories, determine locations\", status: \"pending\", priority: \"high\" },\n { id: \"generate\", content: \"Generate AGENTS.md files (root + subdirs)\", status: \"pending\", priority: \"high\" },\n { id: \"review\", content: \"Deduplicate, validate, trim\", status: \"pending\", priority: \"medium\" }\n])\n```\n</critical>\n\n---\n\n## Phase 1: Discovery + Analysis (Concurrent)\n\n**Mark \"discovery\" as in_progress.**\n\n### Fire Background Explore Agents IMMEDIATELY\n\nDon't wait\u2014these run async while main session works.\n\n```\n// Fire all at once, collect results later\nbackground_task(agent=\"explore\", prompt=\"Project structure: PREDICT standard patterns for detected language \u2192 REPORT deviations only\")\nbackground_task(agent=\"explore\", prompt=\"Entry points: FIND main files \u2192 REPORT non-standard organization\")\nbackground_task(agent=\"explore\", prompt=\"Conventions: FIND config files (.eslintrc, pyproject.toml, .editorconfig) \u2192 REPORT project-specific rules\")\nbackground_task(agent=\"explore\", prompt=\"Anti-patterns: FIND 'DO NOT', 'NEVER', 'ALWAYS', 'DEPRECATED' comments \u2192 LIST forbidden patterns\")\nbackground_task(agent=\"explore\", prompt=\"Build/CI: FIND .github/workflows, Makefile \u2192 REPORT non-standard patterns\")\nbackground_task(agent=\"explore\", prompt=\"Test patterns: FIND test configs, test structure \u2192 REPORT unique conventions\")\n```\n\n<dynamic-agents>\n**DYNAMIC AGENT SPAWNING**: After bash analysis, spawn ADDITIONAL explore agents based on project scale:\n\n| Factor | Threshold | Additional Agents |\n|--------|-----------|-------------------|\n| **Total files** | >100 | +1 per 100 files |\n| **Total lines** | >10k | +1 per 10k lines |\n| **Directory depth** | \u22654 | +2 for deep exploration |\n| **Large files (>500 lines)** | >10 files | +1 for complexity hotspots |\n| **Monorepo** | detected | +1 per package/workspace |\n| **Multiple languages** | >1 | +1 per language |\n\n```bash\n# Measure project scale first\ntotal_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)\ntotal_lines=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" -o -name \"*.go\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')\nlarge_files=$(find . -type f \\( -name \"*.ts\" -o -name \"*.py\" \\) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {count++} END {print count+0}')\nmax_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)\n```\n\nExample spawning:\n```\n// 500 files, 50k lines, depth 6, 15 large files \u2192 spawn 5+5+2+1 = 13 additional agents\nbackground_task(agent=\"explore\", prompt=\"Large file analysis: FIND files >500 lines, REPORT complexity hotspots\")\nbackground_task(agent=\"explore\", prompt=\"Deep modules at depth 4+: FIND hidden patterns, internal conventions\")\nbackground_task(agent=\"explore\", prompt=\"Cross-cutting concerns: FIND shared utilities across directories\")\n// ... more based on calculation\n```\n</dynamic-agents>\n\n### Main Session: Concurrent Analysis\n\n**While background agents run**, main session does:\n\n#### 1. Bash Structural Analysis\n```bash\n# Directory depth + file counts\nfind . -type d -not -path '*/\\.*' -not -path '*/node_modules/*' -not -path '*/venv/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c\n\n# Files per directory (top 30)\nfind . -type f -not -path '*/\\.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30\n\n# Code concentration by extension\nfind . -type f \\( -name \"*.py\" -o -name \"*.ts\" -o -name \"*.tsx\" -o -name \"*.js\" -o -name \"*.go\" -o -name \"*.rs\" \\) -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20\n\n# Existing AGENTS.md / CLAUDE.md\nfind . -type f \\( -name \"AGENTS.md\" -o -name \"CLAUDE.md\" \\) -not -path '*/node_modules/*' 2>/dev/null\n```\n\n#### 2. Read Existing AGENTS.md\n```\nFor each existing file found:\n Read(filePath=file)\n Extract: key insights, conventions, anti-patterns\n Store in EXISTING_AGENTS map\n```\n\nIf `--create-new`: Read all existing first (preserve context) \u2192 then delete all \u2192 regenerate.\n\n#### 3. LSP Codemap (if available)\n```\nlsp_servers() # Check availability\n\n# Entry points (parallel)\nlsp_document_symbols(filePath=\"src/index.ts\")\nlsp_document_symbols(filePath=\"main.py\")\n\n# Key symbols (parallel)\nlsp_workspace_symbols(filePath=\".\", query=\"class\")\nlsp_workspace_symbols(filePath=\".\", query=\"interface\")\nlsp_workspace_symbols(filePath=\".\", query=\"function\")\n\n# Centrality for top exports\nlsp_find_references(filePath=\"...\", line=X, character=Y)\n```\n\n**LSP Fallback**: If unavailable, rely on explore agents + AST-grep.\n\n### Collect Background Results\n\n```\n// After main session analysis done, collect all task results\nfor each task_id: background_output(task_id=\"...\")\n```\n\n**Merge: bash + LSP + existing + explore findings. Mark \"discovery\" as completed.**\n\n---\n\n## Phase 2: Scoring & Location Decision\n\n**Mark \"scoring\" as in_progress.**\n\n### Scoring Matrix\n\n| Factor | Weight | High Threshold | Source |\n|--------|--------|----------------|--------|\n| File count | 3x | >20 | bash |\n| Subdir count | 2x | >5 | bash |\n| Code ratio | 2x | >70% | bash |\n| Unique patterns | 1x | Has own config | explore |\n| Module boundary | 2x | Has index.ts/__init__.py | bash |\n| Symbol density | 2x | >30 symbols | LSP |\n| Export count | 2x | >10 exports | LSP |\n| Reference centrality | 3x | >20 refs | LSP |\n\n### Decision Rules\n\n| Score | Action |\n|-------|--------|\n| **Root (.)** | ALWAYS create |\n| **>15** | Create AGENTS.md |\n| **8-15** | Create if distinct domain |\n| **<8** | Skip (parent covers) |\n\n### Output\n```\nAGENTS_LOCATIONS = [\n { path: \".\", type: \"root\" },\n { path: \"src/hooks\", score: 18, reason: \"high complexity\" },\n { path: \"src/api\", score: 12, reason: \"distinct domain\" }\n]\n```\n\n**Mark \"scoring\" as completed.**\n\n---\n\n## Phase 3: Generate AGENTS.md\n\n**Mark \"generate\" as in_progress.**\n\n### Root AGENTS.md (Full Treatment)\n\n```markdown\n# PROJECT KNOWLEDGE BASE\n\n**Generated:** {TIMESTAMP}\n**Commit:** {SHORT_SHA}\n**Branch:** {BRANCH}\n\n## OVERVIEW\n{1-2 sentences: what + core stack}\n\n## STRUCTURE\n\\`\\`\\`\n{root}/\n\u251C\u2500\u2500 {dir}/ # {non-obvious purpose only}\n\u2514\u2500\u2500 {entry}\n\\`\\`\\`\n\n## WHERE TO LOOK\n| Task | Location | Notes |\n|------|----------|-------|\n\n## CODE MAP\n{From LSP - skip if unavailable or project <10 files}\n\n| Symbol | Type | Location | Refs | Role |\n|--------|------|----------|------|------|\n\n## CONVENTIONS\n{ONLY deviations from standard}\n\n## ANTI-PATTERNS (THIS PROJECT)\n{Explicitly forbidden here}\n\n## UNIQUE STYLES\n{Project-specific}\n\n## COMMANDS\n\\`\\`\\`bash\n{dev/test/build}\n\\`\\`\\`\n\n## NOTES\n{Gotchas}\n```\n\n**Quality gates**: 50-150 lines, no generic advice, no obvious info.\n\n### Subdirectory AGENTS.md (Parallel)\n\nLaunch document-writer agents for each location:\n\n```\nfor loc in AGENTS_LOCATIONS (except root):\n background_task(agent=\"document-writer\", prompt=\\`\n Generate AGENTS.md for: ${loc.path}\n - Reason: ${loc.reason}\n - 30-80 lines max\n - NEVER repeat parent content\n - Sections: OVERVIEW (1 line), STRUCTURE (if >5 subdirs), WHERE TO LOOK, CONVENTIONS (if different), ANTI-PATTERNS\n \\`)\n```\n\n**Wait for all. Mark \"generate\" as completed.**\n\n---\n\n## Phase 4: Review & Deduplicate\n\n**Mark \"review\" as in_progress.**\n\nFor each generated file:\n- Remove generic advice\n- Remove parent duplicates\n- Trim to size limits\n- Verify telegraphic style\n\n**Mark \"review\" as completed.**\n\n---\n\n## Final Report\n\n```\n=== init-deep Complete ===\n\nMode: {update | create-new}\n\nFiles:\n \u2713 ./AGENTS.md (root, {N} lines)\n \u2713 ./src/hooks/AGENTS.md ({N} lines)\n\nDirs Analyzed: {N}\nAGENTS.md Created: {N}\nAGENTS.md Updated: {N}\n\nHierarchy:\n ./AGENTS.md\n \u2514\u2500\u2500 src/hooks/AGENTS.md\n```\n\n---\n\n## Anti-Patterns\n\n- **Static agent count**: MUST vary agents based on project size/depth\n- **Sequential execution**: MUST parallel (explore + LSP concurrent)\n- **Ignoring existing**: ALWAYS read existing first, even with --create-new\n- **Over-documenting**: Not every dir needs AGENTS.md\n- **Redundancy**: Child never repeats parent\n- **Generic content**: Remove anything that applies to ALL projects\n- **Verbose style**: Telegraphic or die";
@@ -12,6 +12,6 @@ export declare function createAnthropicContextWindowLimitRecoveryHook(ctx: Plugi
12
12
  };
13
13
  }) => Promise<void>;
14
14
  };
15
- export type { AutoCompactState, DcpState, FallbackState, ParsedTokenLimitError, TruncateState } from "./types";
15
+ export type { AutoCompactState, DcpState, ParsedTokenLimitError, TruncateState } from "./types";
16
16
  export { parseAnthropicTokenLimitError } from "./parser";
17
17
  export { executeCompact, getLastAssistant } from "./executor";
@@ -11,10 +11,6 @@ export interface RetryState {
11
11
  attempt: number;
12
12
  lastAttemptTime: number;
13
13
  }
14
- export interface FallbackState {
15
- revertAttempt: number;
16
- lastRevertedMessageID?: string;
17
- }
18
14
  export interface TruncateState {
19
15
  truncateAttempt: number;
20
16
  lastTruncatedPartId?: string;
@@ -27,7 +23,6 @@ export interface AutoCompactState {
27
23
  pendingCompact: Set<string>;
28
24
  errorDataBySession: Map<string, ParsedTokenLimitError>;
29
25
  retryStateBySession: Map<string, RetryState>;
30
- fallbackStateBySession: Map<string, FallbackState>;
31
26
  truncateStateBySession: Map<string, TruncateState>;
32
27
  dcpStateBySession: Map<string, DcpState>;
33
28
  emptyContentAttemptBySession: Map<string, number>;
@@ -39,10 +34,6 @@ export declare const RETRY_CONFIG: {
39
34
  readonly backoffFactor: 2;
40
35
  readonly maxDelayMs: 30000;
41
36
  };
42
- export declare const FALLBACK_CONFIG: {
43
- readonly maxRevertAttempts: 3;
44
- readonly minMessagesRequired: 2;
45
- };
46
37
  export declare const TRUNCATE_CONFIG: {
47
38
  readonly maxTruncateAttempts: 20;
48
39
  readonly minOutputSizeToTruncate: 500;