run
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRun MTHDS methods
运行MTHDS方法
Execute MTHDS method bundles and interpret their JSON output.
执行MTHDS方法包并解读其JSON输出。
Process
流程
Prerequisite: See CLI Prerequisites
前置条件:查看CLI前置条件
Step 1: Identify the Target
步骤1:确定目标
| Target | Command |
|---|---|
| Pipeline directory (recommended) | |
| Specific pipe in a directory | |
| Bundle file directly | |
| Pipe by code from library | |
Directory mode (recommended): Pass the pipeline directory as target. The CLI auto-detects,bundle.mthds, and setsinputs.jsonautomatically — no need to specify them explicitly. This also avoids namespace collisions with other bundles.-L
| 目标 | 命令 |
|---|---|
| 流水线目录(推荐) | |
| 目录中的特定管道 | |
| 直接指定包文件 | |
| 从库中通过代码指定管道 | |
目录模式(推荐):传入流水线目录作为目标。CLI会自动检测、bundle.mthds,并自动设置inputs.json——无需显式指定。这也避免了与其他包的命名空间冲突。-L
Step 2: Prepare Inputs and Check Readiness
步骤2:准备输入并检查就绪状态
Fast path — inputs just prepared
快速路径——输入已准备完成
If inputs were already prepared during this conversation — via (user-data, synthetic, or mixed strategy), or by manually assembling with real values earlier in this session — skip the schema fetch and readiness check. The inputs are ready. Proceed directly to Step 3 with a normal run.
/inputsinputs.jsonThis applies when you just wrote or saw being written with real content values. It does NOT apply after (which saves a placeholder template) or after with the template strategy.
inputs.json/build/inputs如果在本次对话中已经准备好输入——通过(用户数据、合成数据或混合策略),或者在本次会话早期手动组装了包含真实值的——则跳过获取架构和就绪检查步骤。输入已就绪,直接执行步骤3进行常规运行。
/inputsinputs.json此情况适用于你刚刚编写或看到被写入真实内容值的场景。不适用于(仅保存占位符模板)或使用模板策略执行之后的情况。
inputs.json/build/inputsFull check — cold start
完整检查——冷启动
If is invoked without prior input preparation in this session, perform the full readiness check:
/runGet the input schema for the target:
bash
mthds-agent pipelex inputs bundle.mthdsOutput:
json
{
"success": true,
"pipe_code": "process_document",
"inputs": {
"document": {
"concept": "native.Document",
"content": {"url": "url_value"}
},
"context": {
"concept": "native.Text",
"content": {"text": "text_value"}
}
}
}Fill in the fields with actual values. For complex inputs, use the /inputs skill.
content如果在本次会话中未提前准备输入就调用,则执行完整的就绪检查:
/run获取目标的输入架构:
bash
mthds-agent pipelex inputs bundle.mthds输出:
json
{
"success": true,
"pipe_code": "process_document",
"inputs": {
"document": {
"concept": "native.Document",
"content": {"url": "url_value"}
},
"context": {
"concept": "native.Text",
"content": {"text": "text_value"}
}
}
}在字段中填入实际值。对于复杂输入,使用功能。
content/inputsInput Readiness Check
输入就绪检查
Before running, assess whether inputs are ready. This prevents runtime failures from placeholder values.
No inputs required: If returns an empty object (), inputs are ready — skip to Step 3.
mthds-agent pipelex inputsinputs{}Inputs required: If inputs exist, check for readiness:
inputs.json- Does exist in the bundle directory?
inputs.json - If it exists, scan all values for placeholder signals:
content- Template defaults: ,
"url_value","text_value","number_value","integer_value", or any value matching the pattern"boolean_value"*_value - Angle-bracket placeholders: values containing (e.g.
<...>,<path-to-cv.pdf>)<your-text-here> - Non-existent file paths: fields pointing to local files that don't exist on disk
url
- Template defaults:
Readiness result:
- Ready: exists AND all content values are real (no placeholders, referenced files exist) → proceed to Step 3 with normal run
inputs.json - Not ready: is missing, OR contains any placeholder values → proceed to Step 3 with dry-run fallback
inputs.json
运行前,评估输入是否就绪。这可以避免因占位符值导致运行时失败。
无需输入:如果返回空的对象(),则输入已就绪——直接跳至步骤3。
mthds-agent pipelex inputsinputs{}需要输入:如果存在输入,则检查是否就绪:
inputs.json- 包目录中是否存在?
inputs.json - 如果存在,扫描所有值是否有占位符标识:
content- 模板默认值:、
"url_value"、"text_value"、"number_value"、"integer_value",或任何匹配"boolean_value"模式的值*_value - 尖括号占位符:包含的值(例如
<...>、<path-to-cv.pdf>)<your-text-here> - 不存在的文件路径:字段指向磁盘上不存在的本地文件
url
- 模板默认值:
就绪检查结果:
- 已就绪:存在,且所有内容值均为真实值(无占位符,引用的文件存在)→ 执行步骤3进行常规运行
inputs.json - 未就绪:缺失,或包含任何占位符值→ 执行步骤3并回退至空运行
inputs.json
Step 3: Choose Run Mode
步骤3:选择运行模式
If inputs are not ready
如果输入未就绪
Default to and inform the user:
--dry-run --mock-inputs"The inputs for this pipeline contain placeholder values (not real data). I'll do a dry run with mock inputs to validate the pipeline structure."
After the dry run, offer the user these options:
- Prepare real inputs — use to fill in actual values, then re-run
/inputs - Provide files — if the pipeline expects file inputs (documents, images), ask the user to supply file paths
- Keep dry run — accept the dry-run result as-is
默认使用并告知用户:
--dry-run --mock-inputs"此流水线的输入包含占位符值(非真实数据)。我将使用模拟输入进行空运行,以验证流水线结构。"
空运行后,为用户提供以下选项:
- 准备真实输入——使用填入实际值,然后重新运行
/inputs - 提供文件——如果流水线需要文件输入(文档、图片),请用户提供文件路径
- 保留空运行结果——接受空运行的结果
Run modes reference
运行模式参考
| Mode | Command | Use When |
|---|---|---|
| Dry run + mock inputs | | Quick structural validation, no real data needed, or inputs not ready |
| Dry run with real inputs | | Validate input shapes without making API calls (auto-detects |
| Full run | | Production execution (auto-detects |
| Full run inline | | Quick execution with inline JSON inputs |
| Full run without graph | | Execute without generating graph visualization |
| Full run with memory | | When piping output to another method |
Graph by default: Execution graphs (/live_run.html) are now generated automatically. Usedry_run.htmlto disable.--no-graph
| 模式 | 命令 | 使用场景 |
|---|---|---|
| 空运行+模拟输入 | | 快速结构验证,无需真实数据,或输入未就绪 |
| 使用真实输入的空运行 | | 验证输入格式,无需调用API(自动检测 |
| 完整运行 | | 生产环境执行(自动检测 |
| 内联输入完整运行 | | 使用内联JSON输入快速执行 |
| 不生成图谱的完整运行 | | 执行时不生成图谱可视化 |
| 带内存的完整运行 | | 需要将输出传递给另一个方法时 |
默认生成图谱:现在会自动生成执行图谱(/live_run.html)。使用dry_run.html可禁用此功能。--no-graph
Inline JSON for Inputs
内联JSON输入
The flag accepts both file paths and inline JSON. The CLI auto-detects: if the value starts with , it is parsed as JSON directly. This is the fastest path — no file creation needed for simple inputs.
--inputs{bash
undefined--inputs{bash
undefinedInline JSON
内联JSON
mthds-agent pipelex run pipe <bundle-dir>/ --inputs '{"theme": {"concept": "native.Text", "content": {"text": "nature"}}}'
mthds-agent pipelex run pipe <bundle-dir>/ --inputs '{"theme": {"concept": "native.Text", "content": {"text": "nature"}}}'
File path (auto-detected in directory mode)
文件路径(目录模式下自动检测)
mthds-agent pipelex run pipe <bundle-dir>/
undefinedmthds-agent pipelex run pipe <bundle-dir>/
undefinedStep 4: Present Results
步骤4:展示结果
After a successful run, always show the actual output to the user — never just summarize what fields exist.
运行成功后,务必向用户展示实际输出——绝不要仅总结存在哪些字段。
Output format modes
输出格式模式
The CLI has two output modes:
- Compact (default): stdout is the concept's structured JSON directly — no envelope, no wrapper. This is the primary output of the method's main concept. Parse the JSON directly for field access.
success - With memory (): stdout has
--with-memory(withmain_stuff,json,markdownrenderings) +html(all named stuffs and aliases). Use this when piping output to another method.working_memory
The and are written to disk as side effects (paths appear in logs/stderr), not in compact stdout.
output_filegraph_filesCLI有两种输出模式:
- 紧凑模式(默认):标准输出直接返回概念的结构化JSON——无信封,无包装。这是方法主概念的主要输出。直接解析JSON以访问字段。
success - 带内存模式():标准输出包含
--with-memory(带有main_stuff、json、markdown渲染结果) +html(所有命名内容和别名)。当需要将输出传递给另一个方法时使用此模式。working_memory
output_filegraph_files4a. Determine what to show
4a. 确定展示内容
In compact mode (default), the output is the concept JSON directly. Show the fields to the user:
json
{
"clauses": [...],
"overall_risk": "high"
}In mode, the output structure depends on the pipe architecture:
--with-memoryif main_stuff is non-empty (not {} or null):
→ main_stuff is the primary output (single unified result)
else:
→ working_memory.root holds the primary output (multiple named results)| Pipe Type | | What to show |
|---|---|---|
| PipeLLM, PipeCompose, PipeExtract, PipeImgGen | Always | |
| PipeSequence | Always (last step) | |
| PipeBatch | Always (list) | |
| PipeCondition | Always | |
PipeParallel with | Yes | |
PipeParallel without | No ( | |
紧凑模式(默认)下,输出为概念JSON本身。向用户展示字段:
json
{
"clauses": [...],
"overall_risk": "high"
}--with-memory如果main_stuff非空(不是{}或null):
→ main_stuff是主要输出(单一统一结果)
否则:
→ working_memory.root包含主要输出(多个命名结果)| 管道类型 | 是否存在main_stuff | 展示内容 |
|---|---|---|
| PipeLLM、PipeCompose、PipeExtract、PipeImgGen | 始终存在 | |
| PipeSequence | 始终存在(最后一步) | |
| PipeBatch | 始终存在(列表形式) | |
| PipeCondition | 始终存在 | |
带 | 是 | |
不带 | 否( | |
4b. Show the output content
4b. 展示输出内容
In compact mode: show the JSON fields directly. For structured concepts, format for readability.
In mode when is present (most pipe types):
--with-memorymain_stuff- Show directly — this is the human-readable rendering. Display it as-is so the user sees the full output.
main_stuff.markdown - For structured concepts with fields, also show formatted for readability.
main_stuff.json
In mode when is empty (PipeParallel without ):
--with-memorymain_stuffcombined_output- Iterate and present each named result.
working_memory.root - For each entry, show the field with its key as a label.
content - Example: "french_translation: Bonjour le monde" / "spanish_translation: Hola mundo"
For dry runs: Show the same output but clearly label it as mock/simulated data.
紧凑模式:直接展示JSON字段。对于结构化概念,格式化以提升可读性。
存在的模式(大多数管道类型):
main_stuff--with-memory- 直接展示——这是面向人类的可读渲染结果。原样展示,让用户看到完整输出。
main_stuff.markdown - 对于带字段的结构化概念,同时展示格式化后的以提升可读性。
main_stuff.json
main_stuff--with-memorycombined_output- 遍历并展示每个命名结果。
working_memory.root - 对于每个条目,以其键为标签展示字段。
content - 示例:"french_translation: Bonjour le monde" / "spanish_translation: Hola mundo"
空运行:展示相同的输出,但明确标注为模拟数据。
4c. Output file
4c. 输出文件
- The CLI automatically saves the full JSON output next to the bundle (or
live_run.json).dry_run.json - The output file path appears in runtime logs (stderr), not in compact stdout.
- CLI会自动在包旁边保存完整的JSON输出(或
live_run.json)。dry_run.json - 输出文件路径显示在运行时日志(标准错误)中,不会出现在紧凑模式的标准输出中。
4d. Present graph files
4d. 展示图谱文件
- Graph visualizations are generated by default (/
live_run.html). Usedry_run.htmlto disable.--no-graph - The graph file path appears in runtime logs (stderr), not in compact stdout.
- 默认会生成执行图谱可视化(/
live_run.html)。使用dry_run.html可禁用此功能。--no-graph - 图谱文件路径显示在运行时日志(标准错误)中,不会出现在紧凑模式的标准输出中。使用时,返回的JSON信封中会包含
--with-memory。graph_files
4e. Mention intermediate results
4e. 提及中间结果
- If the pipeline has multiple steps, briefly note key intermediate values from (e.g., "The match analysis intermediate step scored 82/100").
working_memory - Offer: "I can show the full working memory if you want to inspect any intermediate step."
- 如果流水线包含多个步骤,简要提及中的关键中间值(例如:“匹配分析中间步骤的得分为82/100”)。
working_memory - 提供选项:“如果您想检查任何中间步骤,我可以展示完整的工作内存。”
4f. Suggest next steps
4f. 建议后续步骤
- Re-run with different inputs
- Adjust prompts or pipe configurations if output quality needs improvement
- 使用不同的输入重新运行
- 如果输出质量需要提升,调整提示词或管道配置
Step 5: Handle Errors
步骤5:处理错误
When encountering runtime errors, re-run with for additional context:
--log-level debugbash
mthds-agent --log-level debug pipelex run pipe <bundle-dir>/ --inputs data.jsonFor all error types and recovery strategies, see Error Handling Reference.
遇到运行时错误时,使用重新运行以获取更多上下文:
--log-level debugbash
mthds-agent --log-level debug pipelex run pipe <bundle-dir>/ --inputs data.json有关所有错误类型和恢复策略,请查看错误处理参考。
Execution Graphs
执行图谱
Execution graph visualizations are generated by default alongside the run output. Use to disable.
--no-graphbash
mthds-agent pipelex run pipe <bundle-dir>/Graph files ( / ) are written to disk next to the bundle. Their paths appear in runtime logs on stderr, not in compact stdout. When using , is included in the returned JSON envelope.
live_run.htmldry_run.html--with-memorygraph_files默认会在运行输出旁生成执行图谱可视化。使用可禁用此功能。
--no-graphbash
mthds-agent pipelex run pipe <bundle-dir>/图谱文件( / )会写入包旁边的磁盘。其路径显示在标准错误的运行时日志中,不会出现在紧凑模式的标准输出中。使用时,返回的JSON信封中会包含。
live_run.htmldry_run.html--with-memorygraph_filesPiping Methods
方法管道化
The run command accepts piped JSON on stdin when is not provided. This enables chaining methods:
--inputsbash
mthds-agent pipelex run method extract-terms --inputs data.json --with-memory \
| mthds-agent pipelex run method assess-risk --with-memory \
| mthds-agent pipelex run method generate-reportWhen methods are installed as CLI shims, the same chain is:
bash
extract-terms --inputs data.json --with-memory \
| assess-risk --with-memory \
| generate-report- Use on intermediate steps to pass the full working memory envelope.
--with-memory - The final step omits to produce compact output.
--with-memory - always overrides stdin when both are present.
--inputs - Upstream stuff names are matched against downstream input names. Method authors should name their outputs to match the downstream's expected input names.
当未提供时,运行命令会接受标准输入中的管道JSON。这支持方法链式调用:
--inputsbash
mthds-agent pipelex run method extract-terms --inputs data.json --with-memory \
| mthds-agent pipelex run method assess-risk --with-memory \
| mthds-agent pipelex run method generate-report当方法作为CLI垫片安装时,相同的链式调用为:
bash
extract-terms --inputs data.json --with-memory \
| assess-risk --with-memory \
| generate-report- 在中间步骤使用以传递完整的工作内存信封。
--with-memory - 最终步骤省略以生成紧凑输出。
--with-memory - 当同时存在和标准输入时,
--inputs始终优先。--inputs - 上游内容名称会与下游输入名称匹配。方法作者应将输出命名为与下游预期输入名称一致的名称。
Reference
参考
- CLI Prerequisites — read at skill start to check CLI availability
- Error Handling — read when CLI returns an error to determine recovery
- MTHDS Agent Guide — read for CLI command syntax or output format details
- MTHDS Language Reference — read for .mthds syntax documentation
- Native Content Types — read when interpreting pipeline outputs or preparing input JSON, to understand the attributes of each content type
- CLI前置条件——开始使用功能时查看,以检查CLI可用性
- 错误处理——当CLI返回错误时查看,以确定恢复策略
- MTHDS Agent指南——查看CLI命令语法或输出格式详情
- MTHDS语言参考——查看.mthds语法文档
- 原生内容类型——解读流水线输出或准备输入JSON时查看,以了解每种内容类型的属性