配置opencode+oh my opencode遇到的一些小问题

756 阅读3分钟

前言:侵删,放上来只因为当前这些问题无法快速搜索定位,更具体的细节请大家活用ai自行查询。

什么是opencode和oh my opencode

zhuanlan.zhihu.com/p/199367766… (以下两张图片来自, 侵删)

image.png

image.png

一些不错的用法

遇到的几个问题:

1. mac安装最新版本记得用 brew install anomalyco/tap/opencode

  • 直接brew install opencode下载的版本偏旧
  • 比如当前旧版本就有问题2

2. opencode Items are not persisted when store is set to false. Try again with store set to true, or remove this item from your input."

3. TODO Continuation Loop, 反复说接下来计划怎么样,但就是不执行,每次计划完就结束生成。

  • 如果用的是自定义中转站,确保provider里的key和目标站名称保持一致,比如openai的中转站provider还是openai,只修改下baseURL配上自己的apiKey即可。
  • 可能还有其他问题,暂时没有讨论出结果。github.com/code-yeongy…

image.png

4. There's a conflict about using TODO tools—git commit instructions forbid TodoWrite。

  • TODO:正在看这个问题,目前主要出现在gpt-5.x这个系列的模型上。

个人自定义配置分享

  • 这里只给了openai的配置方式,同样的道理去配置其他自定义模型即可。实在不行可以扔给ai仿照这个配置来配置自己要的模型,如果报错、假参数之类的再具体问题具体分析,查源码有没有这个参数就好了。

opencode.json

  • 注意我目前使用的是beta版本,如果是安装正常版本请在plugin使用oh-my-opencode。
    • beta版本安装命令 bunx oh-my-opencode@3.0.0-beta.11 install
  • 注意替换baseURL。
  • 配置apiKey以openai为例。
    • 方法1: 运行opencode以后 -> 输入/connect -> 选择OpenAi -> manually enter API key。

    • 方法2: 手动配置openai apiKey
      • ~/.local/share/opencode/auth.json输入按照官方标准输入对应的apiKey(确保你的.local opencode配置在这个位置)
      • { "openai": { "type": "api", "key": "yourApiKey"}}
{
  "plugin": [
    "oh-my-opencode@latest"
  ],
  "model": "openai/gpt-5.2-codex",
  "provider": {
    "openai": {
      "name": "OpenAI",
      "options": {
        "baseURL": "your baseRUL",
        "reasoningEffort": "medium",
        "reasoningSummary": "auto",
        "textVerbosity": "medium",
        "include": [
          "reasoning.encrypted_content"
        ],
        "store": false
      },
      "models": {
        "gpt-5.2": {
          "name": "GPT 5.2 (OAuth)",
          "limit": {
            "context": 272000,
            "output": 128000
          },
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "variants": {
            "none": {
              "reasoningEffort": "none",
              "reasoningSummary": "auto",
              "textVerbosity": "medium"
            },
            "low": {
              "reasoningEffort": "low",
              "reasoningSummary": "auto",
              "textVerbosity": "medium"
            },
            "medium": {
              "reasoningEffort": "medium",
              "reasoningSummary": "auto",
              "textVerbosity": "medium"
            },
            "high": {
              "reasoningEffort": "high",
              "reasoningSummary": "detailed",
              "textVerbosity": "medium"
            },
            "xhigh": {
              "reasoningEffort": "xhigh",
              "reasoningSummary": "detailed",
              "textVerbosity": "medium"
            }
          }
        },
        "gpt-5.2-codex": {
          "name": "GPT 5.2 Codex (OAuth)",
          "limit": {
            "context": 272000,
            "output": 128000
          },
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "variants": {
            "low": {
              "reasoningEffort": "low",
              "reasoningSummary": "auto",
              "textVerbosity": "medium"
            },
            "medium": {
              "reasoningEffort": "medium",
              "reasoningSummary": "auto",
              "textVerbosity": "medium"
            },
            "high": {
              "reasoningEffort": "high",
              "reasoningSummary": "detailed",
              "textVerbosity": "medium"
            },
            "xhigh": {
              "reasoningEffort": "xhigh",
              "reasoningSummary": "detailed",
              "textVerbosity": "medium"
            }
          }
        },
        "gpt-5.1-codex-max": {
          "name": "GPT 5.1 Codex Max (OAuth)",
          "limit": {
            "context": 272000,
            "output": 128000
          },
          "modalities": {
            "input": [
              "text",
              "image"
            ],
            "output": [
              "text"
            ]
          },
          "variants": {
            "low": {
              "reasoningEffort": "low",
              "reasoningSummary": "detailed",
              "textVerbosity": "medium"
            },
            "medium": {
              "reasoningEffort": "medium",
              "reasoningSummary": "detailed",
              "textVerbosity": "medium"
            },
            "high": {
              "reasoningEffort": "high",
              "reasoningSummary": "detailed",
              "textVerbosity": "medium"
            },
            "xhigh": {
              "reasoningEffort": "xhigh",
              "reasoningSummary": "detailed",
              "textVerbosity": "medium"
            }
          }
        }
      }
    }
  },
  "$schema": "https://opencode.ai/config.json"
}

oh-my-opencode.json

  • github.com/code-yeongy…
  • 具体有哪些subAgents可以配置:可查看git README.md 或者 源码搜索对应的实现逻辑/配置参数。
  • 注意下面已改成beta版本的agents,正常版本请参照github.com/code-yeongy… 里的agent名称
  • 目前最新版本已经会根据安装时的选择自动填充
{
  "$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json",
  "agents": {
    "sisyphus": {
      "model": "openai/gpt-5.2",
      "variant": "high"
    },
    "atlas": {
      "model": "openai/gpt-5.2"
    },
    "prometheus": {
      "model": "openai/gpt-5.2",
      "variant": "high"
    },
    "metis": {
      "model": "openai/gpt-5.2",
      "variant": "high"
    },
    "momus": {
      "model": "openai/gpt-5.2",
      "variant": "medium"
    },
    "oracle": {
      "model": "openai/gpt-5.2",
      "variant": "high"
    },
    "librarian": {
      "model": "opencode/big-pickle"
    },
    "explore": {
      "model": "opencode/gpt-5-nano"
    },
    "frontend-ui-ux-engineer": {
      "model": "openai/gpt-5.1-codex-max"
    },
    "document-writer": {
      "model": "openai/gpt-5.2"
    },
    "multimodal-looker": {
      "model": "openai/gpt-5.2"
    }
  },
  "ralph_loop": {
    "enabled": true,
    "default_max_iterations": 50
  },
  "background_task": {
    "defaultConcurrency": 3
  },
  "categories": {
    "visual-engineering": {
      "model": "openai/gpt-5.2",
      "variant": "high"
    },
    "ultrabrain": {
      "model": "openai/gpt-5.2-codex",
      "variant": "xhigh"
    },
    "artistry": {
      "model": "openai/gpt-5.2"
    },
    "quick": {
      "model": "opencode/big-pickle"
    },
    "unspecified-low": {
      "model": "openai/gpt-5.2-codex",
      "variant": "medium"
    },
    "unspecified-high": {
      "model": "openai/gpt-5.2-codex",
      "variant": "medium"
    },
    "writing": {
      "model": "openai/gpt-5.2"
    }
  }
}