---
name: cr-doctor
description: 检查尽调的运行环境：本机有没有上游 Company Research Agent 服务、有没有 Python，决定走轨 A 还是轨 B。开始一次尽调前，或用户问环境、配置、模型时读这份。
title: cr-doctor
canonical_url: https://skilld.dev/gh/modelflare-ai/anymodelbot/cr-doctor
last_updated: 2026-11-12T05:31:01.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install modelflare-ai/anymodelbot/cr-doctor`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/cr-doctor`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/modelflare-ai/anymodelbot/cr-doctor) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/cr-doctor`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/cr-doctor --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/cr-doctor --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# 检查环境

## 配置

`app/config.json` 可能不存在，不存在时按默认值：

```json
{ "mode": "auto", "apiBase": "http://127.0.0.1:8000" }
```

`mode` 是 `auto`（默认）、`a`（只用本机服务）或 `b`（只用兼容模式）。用户说“以后都用兼容模式”或者告诉你服务的地址时，改这个文件。`apiBase` 只能是本机地址。

## 检查

1. 看有没有 Python：依次试 `python3 --version`、`python --version`、`py -3 --version`，记下能用的那个。都不行就是没有 Python。
2. 有 Python 时探测上游服务：

   ```bash
   python3 "$HOME/skills/cr-research/scripts/upstream.py" probe --api <apiBase>
   ```

   没有 Python 时不用探测：轨 A 的脚本要用 Python，只能走轨 B。

3. 决定走哪条路：

| `mode` | 服务可达且有 Python | 否则 |
| --- | --- | --- |
| `auto` | 轨 A | 轨 B |
| `a` | 轨 A | 任务 `failed`，告诉用户下面的启动说明 |
| `b` | 轨 B | 轨 B |

4. 把结果写进 `app/state.json` 的 `runtime`：`mode`、`track`、`python`、`apiReachable`、`checkedAt`。探测到服务时再写 `openrouter`、`openai`、`defaultModel`。

## 只报告查得到的

上游的 `/config` 只告诉我们 OpenRouter 和 OpenAI 有没有配置，以及默认模型。Tavily 和 Gemini 的情况查不到，不要猜，也不要去读 .env 文件。上游缺 Key 时任务会失败，把它返回的错误告诉用户。

轨 B 不需要任何 Key：搜索用 `web_search` 和 `web_fetch`。用户想用 Tavily，就到 App 的设置里选搜索接口，选好后 `web_search` 会自动走它。

## 用户问有哪些模型

- 轨 A 且配了 OpenRouter：`curl -s --max-time 10 <apiBase>/models`，Windows 上用 `curl.exe`，列出前几个。
- 其他情况：模型在 App 的机器人设置里选。

## 启动本机服务的说明

用户想用轨 A 时给出这些步骤。你不要代为安装，也不要代为配置 Key：

1. 克隆 `https://github.com/guy-hartstein/company-research-agent`。
2. 在目录里安装依赖：`pip install -r requirements.txt`。
3. 按项目的 README 配好 Tavily 和模型的 Key。
4. 启动：`uvicorn application:app --host 127.0.0.1 --port 8000`。

没有启动也不影响使用，这个 Bot 会用兼容模式跑同样的流程。
