edit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Edit MTHDS bundles

编辑MTHDS包

Modify existing MTHDS method bundles.
修改现有的MTHDS方法包。

Mode Selection

模式选择

See Mode Selection for general mode behavior.
Default: Automatic for clear, specific changes. Interactive for ambiguous or multi-step modifications.
Detection heuristics:
  • "Rename X to Y" → automatic
  • "Update the prompt in pipe Z" with new text provided → automatic
  • "Add a step to do X" (open-ended) → interactive
  • "Refactor this pipeline" (subjective) → interactive
  • Multiple changes requested at once → interactive (confirm the plan)

有关通用模式行为,请参阅模式选择
默认设置:针对明确、具体的变更使用自动模式;针对模糊或多步骤修改使用交互模式。
检测规则
  • “将X重命名为Y” → 自动模式
  • “更新pipe Z中的提示词”并提供新文本 → 自动模式
  • “添加步骤以完成X”(开放式需求)→ 交互模式
  • “重构这条流水线”(主观性需求)→ 交互模式
  • 同时请求多项变更 → 交互模式(确认修改计划)

Process

操作流程

Prerequisite: See CLI Prerequisites
  1. Read the existing .mthds file — Understand current structure before making changes
  2. Understand requested changes:
    • What pipes need to be added, removed, or modified?
    • What concepts need to change?
    • Does the method structure need refactoring?
    Interactive checkpoint: Present a summary of planned changes. Ask "Does this plan look right?" before proceeding to step 3.
    Automatic: Proceed directly to step 3. State planned changes in one line.
  3. Apply changes:
    • Maintain proper pipe ordering (controllers before sub-pipes)
    • Keep TOML formatting consistent
    • Preserve cross-references between pipes
    • Keep inputs on a single line
    • Maintain POSIX standard (empty line at end, no trailing whitespace)
  4. Validate after editing:
    bash
    mthds-agent pipelex validate <file>.mthds -L <bundle-dir>/
    If errors, see Error Handling Reference for recovery strategies by error domain. Use /fix skill for automatic error resolution.
  5. Regenerate inputs if needed:
    • If inputs changed, run
      mthds-agent pipelex inputs <file>.mthds -L <bundle-dir>/
    • Update existing inputs.json if present
  6. Present completion:
    • If inputs were regenerated (step 5 triggered), show the path to the updated file.
    • Provide a concrete CLI example. If
      inputs.json
      contains placeholder values, suggest the safe dry-run command first:
      To try the updated method now, use /run or from the terminal:
      mthds run <bundle-dir>/ --dry-run --mock-inputs
      To run with real data, use /inputs to prepare your inputs (provide your own files, or generate synthetic test data), then:
      mthds run <bundle-dir>/
前提条件:请参阅CLI前提条件
  1. 读取现有.mthds文件 — 在进行修改前先理解当前结构
  2. 明确需求变更
    • 需要添加、移除或修改哪些pipe?
    • 哪些概念需要调整?
    • 方法结构是否需要重构?
    交互检查点:展示计划修改的摘要。在进入步骤3前询问“这个修改计划是否正确?”
    自动模式:直接进入步骤3。用一句话说明计划的修改内容。
  3. 应用修改
    • 保持pipe的正确顺序(控制器在子pipe之前)
    • 保持TOML格式一致
    • 保留pipe之间的交叉引用
    • 将输入内容保持在单行
    • 遵循POSIX标准(文件末尾留空行,无尾随空格)
  4. 编辑后验证
    bash
    mthds-agent pipelex validate <file>.mthds -L <bundle-dir>/
    如果出现错误,请参阅错误处理参考获取按错误领域分类的恢复策略。使用/fix技能进行自动错误修复。
  5. 必要时重新生成输入
    • 如果输入内容有变更,运行
      mthds-agent pipelex inputs <file>.mthds -L <bundle-dir>/
    • 更新现有的inputs.json(如果存在)
  6. 完成操作展示
    • 如果触发了步骤5(重新生成输入),展示更新后文件的路径。
    • 提供具体的CLI示例。如果
      inputs.json
      包含占位符值,建议先使用安全的试运行命令:
      如需立即试用更新后的方法,可使用/run技能或在终端中执行:
      mthds run <bundle-dir>/ --dry-run --mock-inputs
      如需使用真实数据运行,请使用/inputs技能准备输入内容(提供自有文件,或生成合成测试数据),然后执行:
      mthds run <bundle-dir>/

Common Edit Operations

常见编辑操作

  • Add a pipe: Define concept if needed, add pipe in correct order
  • Modify a prompt: Update prompt text, check variable references
  • Change inputs/outputs: Update type, regenerate inputs
  • Add batch processing: Add
    batch_over
    (plural list name) and
    batch_as
    (singular item name) to step — they must be different
  • Refactor to sequence: Wrap multiple pipes in PipeSequence
  • 添加pipe:必要时定义概念,按正确顺序添加pipe
  • 修改提示词:更新提示词文本,检查变量引用
  • 变更输入/输出:更新类型,重新生成输入
  • 添加批量处理:为步骤添加
    batch_over
    (复数列表名称)和
    batch_as
    (单数项目名称)——二者必须不同
  • 重构为序列:将多个pipe包装在PipeSequence中

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 when writing or modifying .mthds TOML syntax
  • Native Content Types — read when using
    $var.field
    in prompts or
    from
    in construct blocks, to know which attributes each native concept exposes
  • Talents & Presets — read when setting or changing the
    model
    field in a pipe, to find the correct preset name
  • CLI前提条件 — 在技能启动时阅读,检查CLI是否可用
  • 错误处理 — 当CLI返回错误时阅读,确定恢复方案
  • MTHDS Agent指南 — 阅读以了解CLI命令语法或输出格式细节
  • MTHDS语言参考 — 编写或修改.mthds TOML语法时阅读
  • 原生内容类型 — 在提示词中使用
    $var.field
    或在构造块中使用
    from
    时阅读,了解每个原生概念暴露的属性
  • Talents与预设 — 在设置或修改pipe中的
    model
    字段时阅读,查找正确的预设名称