使用说明
SWMF AI
SWMF AI将小型本地CLI与SWMF工作的特定任务技能相结合 swmf CLI仅返回证据。技能决定了首先使用哪个命令,什么证据很重要,以及如何回答。一切都在本地运行——没有服务器进程。
系统
flowchart TD
CLIENT["AI agent / skills"] --> CLI["swmf CLI (one-shot, local)"]
CLI --> T1["get-context"]
CLI --> T2["get-evidence"]
CLI --> T3["inspect"]
CLI --> T4["compare"]
T1 --> BACKEND["SWMF source tree, PARAM/XML metadata, examples, logs, run dirs"]
T2 --> BACKEND
T3 --> BACKEND
T4 --> BACKEND
CLI命令
swmf get-context用于广泛的方向、架构和跨组件问题。swmf get-evidence用于源、文档、模式、查找和工作流证据。swmf inspect用于直接检查日志、PARAM文件、XML和运行目录。swmf compare用于两个伪影之间的确定性差异。swmf index build|refresh|status管理地方知识指数。
每个命令都会将JSON结果打印到stdout,并在出现硬错误时退出非零。跑 swmf <command> --help 全套旗帜。
技能
技能生活 src/agent_assets/skills 并且是
代理人决定如何工作的主要方式。
入门技能:
swmf-explain对于“这是如何工作的?”问题。swmf-configure用于设置和参数化。swmf-build用于构建工作流。swmf-run用于运行工作流。swmf-debug用于故障分析。swmf-analyze用于输出解释和后处理。swmf-compare关于变化和差异的问题。
支持技能:
swmf-architectureswmf-exact-lookupswmf-implementationswmf-mflampa--SP/MFRAMPA SEP模型专家(模块,make test_mflampa,MFLAMPA参数)swmf-paramsswmf-postproc
共享的学科来源是
src/agent_assets/SWMF_CORE_DISCIPLINE.md.
AI辅助安装
如果您已经在AI编码代理(Claude Code、GitHub Copilot、Codex CLI)中,请复制下面的提示,填写两个占位符,并将其粘贴到代理中。代理将处理路径发现,并为您运行正确的安装命令。
| 占位符 | 放什么 |
|---|---|
<AGENT> |
claude, copilot-vscode, copilot-cli,或 codex |
<TARGET_DIR> |
应安装SWMF AI的项目目录的绝对路径 |
I want to install SWMF AI into <TARGET_DIR> for use with the <AGENT> agent.
The SWMF AI repository is at: <absolute path to this swmf-mcp-prototype directory>
Please complete the following steps in order:
1. Run `make` inside the swmf-mcp-prototype repository to bootstrap the Python
runtime and build the knowledge index. Wait for it to succeed before continuing.
2. Find the SWMF source root. Check in order:
a. The environment variable $SWMF_ROOT if set.
b. A directory named "SWMF" that is a sibling of the swmf-mcp-prototype directory.
c. Any other existing path named "SWMF" visible from the current machine.
Report the resolved absolute path, or ask me if none is found.
3. Find SWMFSOLAR if it exists. Check in order:
a. A directory named "SWMFSOLAR" that is a sibling of the SWMF root found above.
b. A directory named "SWMFSOLAR" that is a sibling of the swmf-mcp-prototype directory.
Report the resolved absolute path, or skip if none exists.
4. Run `which idl` to find the IDL executable. Report the path, or skip if not found.
5. Run the install command, substituting the paths discovered above:
make install \
AGENT=<AGENT> \
TARGET_DIR=<TARGET_DIR> \
SWMF_ROOT=<path from step 2> \
[SWMF_IDL_EXEC=<path from step 4>] \
[SWMFSOLAR_ROOT=<path from step 3>]
Omit SWMF_IDL_EXEC and SWMFSOLAR_ROOT if those paths were not found.
安装和使用
要求:
- Python 3.11+
make- 网络访问-首次解决依赖关系时使用
uv
引导本地运行时并构建本地知识索引:
make
make 安装 uv 如果需要,重用有效的 .venv 在可能的情况下,根据需要创建或同步环境,并构建由 swmf CLI。
安装一个代理包:
make install AGENT=claude
make install AGENT=copilot-vscode SWMF_ROOT=/data/SWMF
make install AGENT=copilot-cli SWMF_ROOT=/data/SWMF SWMFSOLAR_ROOT=/data/SWMFSOLAR
make install AGENT=codex SWMF_ROOT=/data/SWMF SWMF_IDL_EXEC=/path/to/idl
make install AGENT=claude TARGET_DIR=/path/to/workspace SWMF_ROOT=/data/SWMF
AGENT 是必需的 make install 并且必须是以下之一 claude, copilot-vscode, copilot-cli,或 codex.
SWMF_ROOT 默认为 ./SWMF 相对于此存储库。 SWMF_IDL_EXEC 是可选的,仅在通过时才写入。 SWMFSOLAR_ROOT 是可选的;当省略时 make install,安装程序会自动检测到它,并仅写入来自以下位置的第一个现有匹配项:
- 被选中者的兄弟姐妹
SWMF_ROOT ./SWMFSOLAR在此存储库中TARGET_DIR/SWMFSOLAR
TARGET_DIR 默认为此存储库。当 TARGET_DIR 其他地方的点, make install 还创建 TARGET_DIR/.swmf_mcp_server 作为返回此仓库的符号链接,以便生成的启动器可以访问项目venv。
不像 make, make install 如果需要,启动Python运行时,但不重建知识索引。
make install 编写一个自包含的 swmf 发射器 TARGET_DIR/.swmf_ai/swmf (与 SWMF_ROOT 以及任何内置的IDL/SWMFSOLAR路径),生成代理指令文件(一个命名启动器路径的标头,后面是共享的SWMF规程),并将代理技能树符号链接到 src/agent_assets/skills.
当代理在项目目录中启动时,它会自动加载技能并运行 swmf CLI通过生成的启动器。
用户提示示例:
- “解释通用汽车在这种设置中是如何与IE结合的。”
- “寻找证据
DoCoupleGMIE被定义和使用。" - “配置通用汽车的入口点是什么?”
- “检查此参数并总结可能的问题。”
- “比较这两个运行目录并总结有意义的更改。”