SWMF AI
SWMF AI将小型MCP工具表面与SWMF工作的特定任务技能相结合。MCP工具仅返回证据。技能决定了首先使用哪种工具,什么证据很重要,以及如何回答。详细的协议存在于 docs/skill_mcp_protocol.md.
系统
flowchart TD
CLIENT["AI client / skill protocol"] --> MCP["SWMF MCP server"]
MCP --> T1["get_context"]
MCP --> T2["get_evidence"]
MCP --> T3["inspect_artifact"]
MCP --> T4["compare_artifacts"]
T1 --> BACKEND["SWMF source tree, PARAM/XML metadata, examples, logs, run dirs"]
T2 --> BACKEND
T3 --> BACKEND
T4 --> BACKENDMCP工具
get_context用于广泛的方向、架构和跨组件问题。get_evidence用于源、文档、模式、查找和工作流证据。inspect_artifact用于直接检查日志、PARAM文件、XML和运行目录。compare_artifacts用于两个伪影之间的确定性差异。
技能
技能生活 src/agent_assets/skills 并且是 代理人决定如何工作的主要方式。
入门技能:
swmf-explain对于“这是如何工作的?”问题。swmf-configure用于设置和参数化。swmf-build用于构建工作流。swmf-run用于运行工作流。swmf-debug用于故障分析。swmf-analyze用于输出解释和后处理。swmf-compare关于变化和差异的问题。
支持技能:
swmf-architectureswmf-exact-lookupswmf-implementationswmf-paramsswmf-postproc
共享的学科来源是 src/agent_assets/SWMF_CORE_DISCIPLINE.md.
AI辅助安装
如果您已经在AI编码代理(Claude Code、GitHub Copilot、Codex CLI)中,请复制下面的提示,填写两个占位符,并将其粘贴到代理中。代理将处理路径发现,并为您运行正确的安装命令。
| 占位符 | 放什么 |
|---|---|
| `` | claude, copilot-vscode, copilot-cli,或 codex |
| `` | 应安装SWMF AI的项目目录的绝对路径 |
I want to install SWMF AI into for use with the agent.
The SWMF AI repository is at:
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= \
TARGET_DIR= \
SWMF_ROOT=
\
[SWMF_IDL_EXEC=
] \
[SWMFSOLAR_ROOT=
]
Omit SWMF_IDL_EXEC and SWMFSOLAR_ROOT if those paths were not found.安装和使用
要求:
- Python 3.11+
make- 网络访问-首次解决依赖关系时使用
uv
引导本地运行时并构建本地知识索引:
makemake 安装 uv 如果需要,重用有效的 .venv 在可能的情况下,根据需要创建或同步环境,加热嵌入缓存,并构建MCP服务器使用的知识索引。
安装一个代理包:
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/SWMFAGENT 是必需的 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 作为返回此仓库的符号链接,因此生成的代理配置仍然可以引用服务器。
不像 make, make install 如果需要,启动Python运行时,但不加热嵌入缓存或重建知识索引。
make install 只写入一个特定于代理的配置表面,将匹配的指令文件符号链接到共享规程源,并将代理技能树符号链接到 src/agent_assets/skills.
当代理在项目目录中启动时,它应该能够自动加载MCP工具和技能。
用户提示示例:
- “解释通用汽车在这种设置中是如何与IE结合的。”
- “寻找证据
DoCoupleGMIE被定义和使用。" - “配置通用汽车的入口点是什么?”
- “检查此参数并总结可能的问题。”
- “比较这两个运行目录并总结有意义的更改。”
