mode-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mode Creator

模式创建器

Create a useful note-taking system, not merely a valid JSON file. Interview the user, propose a small taxonomy, obtain approval, install it durably, configure optional alerts, restart the worker, and prove the active mode appears in startup context.
创建实用的笔记系统,而非仅仅生成有效的JSON文件。与用户沟通,提出小型分类体系,获得认可后进行持久化安装,配置可选提醒,重启worker,并验证激活的模式是否出现在启动上下文中。

Ground rules

基本规则

  • Use the available interactive question tool (
    AskUserQuestion
    ,
    request_user_input
    , or equivalent) for the interview. Ask in small batches and wait for each response.
  • Explain observation types as mutually exclusive kinds of notes and concepts as reusable tags. Avoid jargon unless the user uses it first.
  • Inspect existing bundled and user modes before inventing a new one. Reuse or remix a close match when that serves the user better.
  • Do not edit a plugin cache or bundled mode. Install custom files under the resolved claude-mem data directory's
    modes/
    folder.
  • Do not expose a Telegram token in chat, command arguments, logs, or tool output. Treat it like a password.
  • Preserve unrelated settings and existing Telegram triggers. The helpers make timestamped backups and merge requested triggers.
  • Custom modes are supported by the local worker runtime. If
    CLAUDE_MEM_RUNTIME
    is
    server
    , explain that this workflow cannot safely install a per-user mode into the shared server and stop before mutation.
  • Existing observations keep their original types. The new mode applies to future observation generation.
  • 使用可用的交互式提问工具(
    AskUserQuestion
    request_user_input
    或同类工具)进行沟通。分批次提出少量问题,等待用户回复后再继续。
  • 将观察类型解释为互斥的笔记类别,概念则是可复用的标签。除非用户先使用行话,否则避免使用专业术语。
  • 在创建新模式前,先检查现有的内置模式和用户自定义模式。如果有相近的匹配项,复用或调整该模式能更好地满足用户需求。
  • 不要编辑插件缓存或内置模式。将自定义文件安装在已解析的claude-mem数据目录下的
    modes/
    文件夹中。
  • 不要在聊天、命令参数、日志或工具输出中暴露Telegram令牌,应将其视为密码处理。
  • 保留无关设置和现有Telegram触发器。辅助工具会创建带时间戳的备份,并合并所需的触发器。
  • 自定义模式由本地worker运行时支持。如果
    CLAUDE_MEM_RUNTIME
    server
    ,则说明此工作流无法安全地将用户专属模式安装到共享服务器中,并停止后续修改操作。
  • 现有观察记录将保留其原始类型。新模式仅适用于未来生成的观察记录。

1. Open with the purpose

1. 开篇说明目的

Begin with this message inside the first interactive question:
Custom modes let you take notes for whatever you're working on. If you're a law student, you may want to write down every time a case establishes a rule, a professor flags an exam trap, or doctrines conflict. If you're an architect, you may want to capture every design decision, code constraint, client preference, or site discovery. What are you working on?
Do not start by asking for a mode name or JSON fields. Learn the work first.
If the answer is code-related, say:
Code mode already works well for software work. A custom variant may work better if it also tracks [2–4 specific kinds of notes inferred from their work] and tags [2–4 useful cross-cutting themes]. Would you like to keep standard code mode or customize it?
Use concrete suggestions. For an ML platform engineer, for example, suggest experiment outcomes, data-contract changes, production incidents, model decisions, cost findings, and reproducibility risks—not generic “custom notes.” If the user chooses standard code mode, do not create a redundant file; continue to the optional notification and verification steps.
在第一个交互式问题中使用以下内容开场:
自定义模式可让你为当前正在处理的事务记录笔记。如果你是法律专业学生,你可能想要记录每次案例确立的规则、教授指出的考试陷阱,或是学说冲突的情况。如果你是建筑师,你可能想要捕捉每一个设计决策、代码约束、客户偏好或场地发现。你目前正在处理什么事务?
不要一开始就询问模式名称或JSON字段。先了解用户的工作内容。
如果用户的回答与代码相关,请说:
代码模式已经能很好地适配软件开发工作。如果还能跟踪[从用户工作中推断出的2-4种特定笔记类型]并标记[2-4个有用的跨领域主题],自定义变体可能会更适用。你想要保留标准代码模式还是进行自定义?
使用具体的建议。例如,对于机器学习平台工程师,建议跟踪实验结果、数据合约变更、生产事故、模型决策、成本发现和可复现性风险——而非笼统的“自定义笔记”。如果用户选择标准代码模式,不要创建冗余文件;直接进入可选通知和验证步骤。

2. Discover what is worth remembering

2. 确定值得记录的内容

Use follow-up questions to obtain:
  1. Three examples of moments or findings they would want available next week.
  2. Routine activity that should be skipped.
  3. The nouns and decisions they search for later: people, cases, materials, clients, constraints, experiments, incidents, and so on.
  4. Anything sensitive that should never be recorded or sent to Telegram.
  5. Whether notes should be selective or detailed.
Infer answers already present in the conversation instead of asking twice. When the user gives a broad answer, propose examples and let them select or edit them.
通过后续问题获取以下信息:
  1. 三个他们希望下周仍能查阅的重要时刻或发现示例。
  2. 应跳过的常规活动。
  3. 他们后续会搜索的名词和决策:人物、案例、材料、客户、约束条件、实验、事故等。
  4. 任何绝不应被记录或发送至Telegram的敏感内容。
  5. 笔记应精简还是详细。
从对话中推断已有的答案,避免重复提问。当用户给出宽泛的回答时,提出示例并让他们选择或编辑。

3. Propose the mode

3. 提出模式方案

Read references/mode-authoring.md before drafting.
Propose:
  • A clear mode name and lowercase ID.
  • Usually 4–8 observation types. Each observed item gets exactly one type.
  • Usually 4–8 concept tags. An item may get several concepts.
  • One-sentence recording and skipping policies.
  • Two realistic notes the mode would record and two it would skip.
Present the proposal in plain language and use the interactive question tool for approval. Let the user rename, add, remove, or reword categories. Do not write or install until they approve the taxonomy and privacy boundary.
Prefer an inherited ID such as
code--architecture-practice
so the mode reuses claude-mem's stable output protocol while replacing the domain taxonomy and behavioral prompts. The
code
parent is an implementation base; the override must remove code-specific semantics from the prompts. Use a standalone mode only when inheritance is genuinely unsuitable.
在起草前阅读references/mode-authoring.md
提出以下内容:
  • 清晰的模式名称和小写ID。
  • 通常设置4-8种观察类型。每个观察项仅对应一种类型。
  • 通常设置4-8个概念标签。一个观察项可对应多个概念。
  • 一句话概括记录和跳过规则。
  • 两个该模式会记录的真实笔记示例,以及两个会跳过的示例。
用通俗易懂的语言呈现方案,并使用交互式提问工具获取用户认可。允许用户重命名、添加、删除或改写分类。在用户认可分类体系和隐私边界前,不要编写或安装模式。
优先使用继承式ID,例如
code--architecture-practice
,这样模式可复用claude-mem的稳定输出协议,同时替换领域分类和行为提示。
code
父级是实现基础;覆盖时必须从提示中移除代码特定语义。只有当继承确实不合适时,才使用独立模式。

4. Ask about Telegram alerts

4. 询问Telegram提醒事宜

After the taxonomy is approved, ask:
Would you like Telegram notifications when claude-mem records any particular types or tags? Alerts include the observation type, title, subtitle, project, and observation ID, so avoid selecting categories that may expose sensitive material.
If yes:
  • Let the user select exact observation types and/or concept tags from the approved mode.
  • Explain that matching is OR: any selected type or any selected concept sends an alert.
  • Ask whether they already have a Telegram bot connected to claude-mem.
  • Read references/telegram.md, then guide new users through BotFather and the secure setup helper.
If no, leave every Telegram setting unchanged.
分类体系获得认可后,询问:
当claude-mem记录特定类型或标签的内容时,你是否需要Telegram通知?提醒内容包括观察类型、标题、副标题、项目和观察ID,因此请避免选择可能暴露敏感内容的分类。
如果用户同意:
  • 让用户从已认可的模式中选择具体的观察类型和/或概念标签。
  • 说明匹配逻辑为“或”:任何选中的类型或概念都会触发提醒。
  • 询问用户是否已将Telegram机器人与claude-mem关联。
  • 阅读references/telegram.md,然后引导新用户完成BotFather和安全设置辅助工具的操作。
如果用户不同意,保持所有Telegram设置不变。

5. Draft, validate, and install

5. 起草、验证并安装

Resolve the absolute directory containing this
SKILL.md
; all helper paths are relative to that directory.
Write the approved mode to a temporary JSON file. Use the exact inherited override shape in the authoring reference. Then validate without mutating anything:
bash
node <skill-directory>/scripts/install-mode.mjs \
  --mode <temporary-mode.json> \
  --mode-id <parent--custom-id> \
  --dry-run
Fix every validation error before installation. Then install and activate it:
bash
node <skill-directory>/scripts/install-mode.mjs \
  --mode <temporary-mode.json> \
  --mode-id <parent--custom-id> \
  --telegram-types <comma-separated-approved-types> \
  --telegram-concepts <comma-separated-approved-concepts>
Omit both Telegram flags when alerts were declined. The installer:
  • Merges the override with its parent and validates the complete mode.
  • Installs the source override under
    <data-dir>/modes/
    .
  • Sets
    CLAUDE_MEM_MODE
    in
    settings.json
    .
  • Merges approved alert triggers without deleting existing triggers.
  • Writes atomically and reports any backup paths.
Review its JSON result. Do not claim success if
ok
is not
true
.
解析包含此
SKILL.md
的绝对目录;所有辅助工具路径均相对于该目录。
将已认可的模式写入临时JSON文件。使用创作参考中指定的精确继承覆盖格式。然后进行验证,不进行任何修改:
bash
node <skill-directory>/scripts/install-mode.mjs \
  --mode <temporary-mode.json> \
  --mode-id <parent--custom-id> \
  --dry-run
在安装前修复所有验证错误。然后安装并激活模式:
bash
node <skill-directory>/scripts/install-mode.mjs \
  --mode <temporary-mode.json> \
  --mode-id <parent--custom-id> \
  --telegram-types <comma-separated-approved-types> \
  --telegram-concepts <comma-separated-approved-concepts>
如果用户拒绝提醒,则省略两个Telegram参数。安装程序会:
  • 将覆盖内容与父级合并,并验证完整模式。
  • 将源覆盖内容安装到
    <data-dir>/modes/
    目录下。
  • settings.json
    中设置
    CLAUDE_MEM_MODE
  • 合并已认可的提醒触发器,不删除现有触发器。
  • 以原子方式写入文件,并报告所有备份路径。
检查其JSON结果。如果
ok
不为
true
,不要声称操作成功。

6. Connect Telegram when needed

6. 按需连接Telegram

If alerts were requested and both bot token and chat ID are already present, ask permission to reuse them and send a test. If credentials are missing, explain the BotFather steps from the Telegram reference.
Run the credential helper only after explicit consent:
bash
node <skill-directory>/scripts/configure-telegram.mjs \
  --types <comma-separated-approved-types> \
  --concepts <comma-separated-approved-concepts>
The helper accepts the token through hidden terminal input, validates it with
getMe
, discovers or asks for the chat ID, sends a test message, and stores the settings with owner-only permissions. Never pass the token as an argument.
If the agent environment cannot give the user control of an interactive terminal, show the exact helper command and pause for the user to run it locally. This is the only acceptable manual boundary; do not ask them to paste the token into chat as a workaround. After they confirm, inspect only whether the credential fields are present—never print their values.
如果用户要求提醒且已存在机器人令牌和聊天ID,询问是否可以复用这些信息并发送测试消息。如果缺少凭据,说明Telegram参考文档中的BotFather步骤。
仅在获得明确同意后运行凭据辅助工具:
bash
node <skill-directory>/scripts/configure-telegram.mjs \
  --types <comma-separated-approved-types> \
  --concepts <comma-separated-approved-concepts>
辅助工具通过隐藏的终端输入接收令牌,使用
getMe
验证令牌,发现或询问聊天ID,发送测试消息,并以仅所有者可见的权限存储设置。切勿将令牌作为参数传递。
如果代理环境无法让用户控制交互式终端,显示精确的辅助工具命令并暂停,等待用户在本地运行。这是唯一可接受的手动操作边界;不要让用户将令牌粘贴到聊天中作为替代方案。用户确认后,仅检查凭据字段是否存在——切勿打印其值。

7. Restart and prove the result

7. 重启并验证结果

Read the configured runtime before restarting. For a worker runtime, use the verified CLI restart path:
bash
npx claude-mem restart
npx claude-mem status
If the CLI shim is unavailable, run the installed plugin's
scripts/worker-service.cjs restart
with Bun. Do not use a bare restart HTTP request when the verified CLI path is available.
Verify all of the following:
  1. Restart reports a new healthy worker and exits successfully.
  2. The installed file exists under the resolved data directory.
  3. settings.json
    names the intended
    CLAUDE_MEM_MODE
    without displaying secrets.
  4. Request full startup context with the
    session_start_context
    MCP tool when available. Otherwise call
    /api/context/inject?project=mode-creator-verification&full=true
    on the configured local worker.
  5. Startup context contains
    Mode: <mode name> (<mode id>)
    .
  6. If Telegram was configured, the test message arrived.
If the worker falls back to
code
, inspect the worker log for a mode validation or lookup error, repair the mode, and repeat the restart. Do not describe a fallback as successful activation.
重启前读取已配置的运行时。对于worker运行时,使用已验证的CLI重启路径:
bash
npx claude-mem restart
npx claude-mem status
如果CLI垫片不可用,使用Bun运行已安装插件的
scripts/worker-service.cjs restart
。当已验证的CLI路径可用时,不要使用裸重启HTTP请求。
验证以下所有内容:
  1. 重启报告新的健康worker并成功退出。
  2. 安装的文件存在于已解析的数据目录下。
  3. settings.json
    中指定了预期的
    CLAUDE_MEM_MODE
    ,且未显示机密信息。
  4. 若可用,使用
    session_start_context
    MCP工具请求完整启动上下文。否则,在已配置的本地worker上调用
    /api/context/inject?project=mode-creator-verification&full=true
  5. 启动上下文中包含
    Mode: <mode name> (<mode id>)
  6. 如果配置了Telegram,测试消息已送达。
如果worker回退到
code
模式,检查worker日志中的模式验证或查找错误,修复模式后重复重启步骤。不要将回退描述为成功激活。

8. Hand off clearly

8. 清晰交接

Conclude with:
  • Active mode name and ID.
  • Installed path.
  • Observation types and concepts.
  • Telegram trigger types/concepts, or “unchanged.”
  • Restart and startup-context verification result.
  • Backup paths for rollback.
  • One short example of what the new mode will now remember.
Never include the Telegram bot token in the handoff.
结尾说明:
  • 激活的模式名称和ID。
  • 安装路径。
  • 观察类型和概念。
  • Telegram触发类型/概念,或“未更改”。
  • 重启和启动上下文验证结果。
  • 回退用的备份路径。
  • 新模式现在会记录的一个简短示例。
切勿在交接内容中包含Telegram机器人令牌。