ReMe/reme/steps/proactive/agent/proactive.yaml
jinliyl 524b1b6908
feat(studio): unify the workbench and proactive runtime (#764)
* fix(proactive): simplify round files and restore failed summaries

* fix(proactive): validate document-relative Markdown links

* feat(proactive_agent): implement v2 daily record workflow with single-file decision

- Add ProactiveAgentStepV2 class to support single daily note decision and reminder
- Introduce RoundOutputs for v2 round file tracking, and keep RoundArtifacts for v1 summary backup
- Refactor AgentOutbox to support both v1 standalone reminder files and v2 daily reminder records
- Add proactive_record utilities to parse and validate v2 daily record frontmatter and metadata
- Enhance proactive_agent to prepare, read, and manage artifacts for both v1 and v2 flows
- Add configuration profile proactive_v2 to enable new workflow with backward compatibility
- Update proactive.yaml and reactive proactive_agent_step configuration comment for easy switching
- Provide extensive schema validation for v2 reminders ensuring priority and message consistency
- Document v2 workflow and usage in English and Chinese runtime docs
- Add unit tests for v2 step verifying single file output and proper decision handling

* refactor(agent/runtime): replace ReminderRef with string keys and simplify reminder handling

- Remove ReminderRef model and switch to using workspace-relative string keys for reminders
- Simplify AgentOutbox to read, write, and manage reminders keyed by strings
- Change file locking and version checking to protect concurrent edits on daily record files
- Replace legacy and v2 reminder file handling with unified ReminderFiles storage
- Adjust ChatNotifications to operate with the new key scheme and update pending/read sets
- Refactor RoundOutputs to RoundRecord for safer round record tracking and rollback
- Remove unused ProactiveRunResult and related references from imports and exports
- Update InboxWakeRequest, AgentReminder, and related models for consistent ID and path validation
- Adjust proactive agent runtime and local runtime to check reminder versions before commit
- Correct language and docs to describe reminders as daily records instead of separate files
- Clean up roles of inbox and outbox for reminder ownership, delivery, and acknowledgments

* fix(proactive): serialize round commits and align desktop reminders

* refactor(proactive): unify task triggers in Proactive Runtime

* fix(proactive): bound reminder payloads and simplify receipts

* refactor(studio): share workbench and simplify proactive delivery

* fix(studio): update and centralize build dependencies

* fix(proactive): guard draft repair and verify Studio deployments

* chore(docs): update source-map-js

* feat(release): support publishing selected artifacts from a tag

* chore(studio): remove the public playground

* refactor: simplify reminders and release workflows

* fix: preserve proactive records and align release provenance

* test(proactive): remove brittle prompt and preset assertions

* fix(proactive): register reminders after input acknowledgement

* feat(notebook): list projects across todos and ideas

* feat(studio): connect mobile apps to configurable ReMe services

* fix(proactive): reserve registered reminder paths

* fix(studio): request Android local network access

* fix(proactive): reserve reminder paths referenced by receipts
2026-11-23 17:19:21 +08:00

152 lines
8.4 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

task_query: |
# Background
Workspace directory: {workspace_dir}
Time zone: {app_timezone}
Current time: {now}
- `Records directory`: {daily_dir}
- `Record path for this run`: {record_path}
## Events for this run
{event_batch}
## Task requirements
{task_description}
# Workflow
## 1. Gather information for this run
[is_event] Read the events for this run and any files they mention, including images. If you only got part of a file, try using `offset` to read the rest. Use the task requirements to identify the `key information`.
[is_event] It also counts as `key information` if it is time for a reminder or its condition is met. If there is no `key information`, reply only with "{no_key_information}" and finish the run.
[is_cron] Complete this run's work as required by the task and identify the `key information` in the results. Handle any requirements to remind the user or send results in step 3.
## 2. Search past records
For history, search only the `Records directory` shared by all tasks. Choose keywords or a regular expression based on the `key information`.
- Check what has already been recorded and which reminders have already been written. Start with records from the last {recent_history_hours} hours. Use the rules for records and reminders in step 3 to avoid duplicates.
- When checking past reminders, read `reminder_priority` and `reminder_message` from the original record's YAML.
- Put related records in time order to see how things have developed and how this run's information relates to earlier progress. You can draw inferences from the records. If you write one down, label it as an inference.
Go to step 3 when you have enough information, find no relevant records, or have used the local search tool {max_local_search_calls} times.
## 3. Record and remind
Write the body, the decision about whether to remind the user, and what to say in the file specified by `Record path for this run`.
### Body
Record only new information for the task that is worth keeping, such as progress or a change in timing. Skip repeats and anything the user does not want to keep.
Write the body in Markdown. Keep it brief and clear, include the necessary sources and links, and leave out sensitive information. If there is no new information worth keeping, leave the body empty.
For local file links in the body and reminder, use paths relative to the directory containing this run's record, for example `[xxx](xxx.md)`.
### Reminder
Use the `Task requirements` to decide which items warrant a reminder, then choose the priority. Do this even if the body is empty.
- Skip the reminder if its condition has not been met or the user does not want it.
- If a reminder about the same development has already been written, skip it even if the user has yet to read it.
- For scheduled reminders and reports, check for duplicates by scheduled time and write each occurrence only once. If the task requires sending it every time, send it even if the result is unchanged.
At the top of the file, write only these two YAML fields between two lines containing `---`.
- `reminder_priority`
- If there is nothing to remind the user about, write `skip`.
- For items that warrant a reminder, use the priority specified by the task. If the task gives no priority, choose the first one that applies in the order below.
- `P0`: The agreed reminder time has arrived, an explicit reminder condition is met, or the user clearly needs to decide or act now.
- `P1`: There is important progress on something the task tracks, and you can tell the user later.
- `P2`: This run found useful new information related to the task.
- If several items warrant a reminder, use the highest priority.
- `reminder_message`
- For `P0`, `P1`, or `P2`, write one short sentence in plain language as if speaking directly to the user, covering only what warrants a reminder this run.
- For `skip`, briefly say why you skipped the reminder.
After the round commits, ReMe puts a `P0`, `P1`, or `P2` reminder in the user's inbox. The user may not have seen it yet.
task_query_zh: |
# 背景
工作区目录:{workspace_dir}
时区:{app_timezone}
当前时间:{now}
- `记录目录`:{daily_dir}
- `本轮记录路径`:{record_path}
## 本轮事件
{event_batch}
## 任务要求
{task_description}
# 执行步骤
## 1. 获取本轮信息
[is_event] 阅读本轮事件和事件提到的文件,包括图片。如果文件没读全,可以试着用 `offset` 继续读。按任务要求找出 `关键信息`。
[is_event] 到了提醒时间或满足了提醒条件,也算 `关键信息`。如果没有 `关键信息`,只回复「{no_key_information}」,结束本轮。
[is_cron] 按任务要求完成本轮工作,从结果中找出 `关键信息`。提醒用户或发送结果的要求留到第 3 步处理。
## 2. 查询历史记录
只在所有任务共用的 `记录目录` 里查历史。根据 `关键信息` 选择关键词或正则。
- 看看哪些内容已经记过,哪些提醒已经写过。优先核对最近 {recent_history_hours} 小时内的记录。第 3 步按各自的规则去重。
- 核对已写提醒时,从原记录的 YAML 读取 `reminder_priority` 和 `reminder_message`。
- 把相关记录按时间串起来,看看事情是怎么发展的,以及本轮信息和之前的进展有什么关系。可以根据记录作推断,写下来时注明是推断。
找到足够的信息、找不到相关记录,或已经用了 {max_local_search_calls} 次本地搜索工具,就进入第 3 步。
## 3. 记录与提醒
把正文、是否提醒和要提醒的话,都写到 `本轮记录路径` 指定的文件里。
### 正文
只记录和任务有关、值得保留的新信息,比如事情有了新进展,或者时间有变。跳过重复或用户不想保留的内容。
用 Markdown 简洁写清正文,保留必要的来源和链接,省略敏感信息。没有值得记录的新信息时,正文留空。
正文和提醒中的本地文件链接都使用相对路径,以本轮记录文件所在目录为基准,例如 `[xxx](xxx.md)`。
### 提醒
根据 `任务要求` 判断哪些事项需要提醒,再决定等级。正文留空时也一样。
- 条件还没满足,或者用户不想收到,就跳过。
- 同一进展的提醒写过就跳过,即使用户还没读。
- 定时提醒和汇报按计划时间去重,同一次只写一次。任务要求每次都发送时,即使结果没变,也照常发送。
在文件开头只写下面两个 YAML 字段,用两行 `---` 包起来。
- `reminder_priority`
- 没有需要提醒的事项时,填 `skip`。
- 对需要提醒的事项,使用任务指定的等级。没指定时,按下面的顺序选第一个符合的等级。
- `P0`:到了约定的提醒时间、满足了明确的提醒条件,或用户明显需要马上决定或处理。
- `P1`:任务跟进的事情有重要进展,可以稍后告诉用户。
- `P2`:本轮发现了和任务相关的有用新信息。
- 有多项需要提醒时,用最高的等级。
- `reminder_message`
- 等级是 `P0`、`P1` 或 `P2` 时,像直接跟用户说话一样,用一句简短的大白话,只说本轮需要提醒的事。
- 等级是 `skip` 时,简短写明为什么跳过提醒。
本轮提交后,ReMe 会把 `P0`、`P1` 或 `P2` 提醒放进用户的收件箱。用户可能还没看到。
repair_record_query: |
Read the YAML frontmatter in `{record_path}` and return the corrected reminder priority and message.
Preserve the intended meaning. ReMe will apply the correction to the record.
Use this validation error to locate the problem.
{error}
repair_record_query_zh: |
阅读 `{record_path}` 的 YAML 文件头,返回修正后的提醒等级和正文,保留原意。ReMe 会把修正写回原记录。
根据下面的校验错误定位问题。
{error}
event_input: |
### Event {number}
- Time: {event_ts}
- Source: {source}
- Description: {description}
[has_files] Files:
[has_files] {paths}
[no_files] Files: None
event_input_zh: |
### 事件 {number}
- 时间:{event_ts}
- 来源:{source}
- 描述:{description}
[has_files] 文件:
[has_files] {paths}
[no_files] 文件:无
scheduled_event_input: |
- Scheduled trigger, planned time {event_ts}
scheduled_event_input_zh: |
- 定时触发,计划时间 {event_ts}