ReMe/reme/steps/evolve/dream/extract.yaml
imrewce 354837f9af
feat(proactive): separate proactive refresh from auto dream (#488)
* refractor(proactive): upgrade proactive feature with disentangled job and steps

* refactor(proactive): apply audit fixes

- rename read-side job 'proactive' -> 'proactive_read' (less confusing vs the refresh pipeline)
- drop dedicated agent_wrapper.proactive; extraction reuses the default wrapper
- simplify schema: remove unused ProactiveExtractOutput/TopicUpdate, drop resource_paths
- extract no longer scans resource/ directly (daily notes already carry resource content)
- update tests and docs accordingly

* feat(proactive): strict extract-output gate and prompt total budget

- parse_extract_reply now requires a contract section (follow_ups/extends/updates
  as a list); non-empty replies with misspelled section names trigger the
  existing one-shot retry instead of silently checkpointing changed files
- pack_paths gains max_total_chars; extract packs newest daily material first,
  keeps the first file on overflow, and records omitted files in a trailer
  (default budget 300000 chars, configurable via max_total_chars)
- tests: schema gate unit, schema-error retry e2e, budget unit + e2e

* feat(proactive): add scenario-card plan step and generative agenda step

* feat(proactive): digest-personal profile personalization and leaner LLM contract

- extract/plan/agenda now draw a user profile block from <digest_dir>/personal/*.md
  (frontmatter description + body excerpt, per-file budget, profile.md fallback)
- all daily access honours the configured daily_dir (prompt paths parameterized,
  config-driven fallbacks) so workspaces using e.g. memory/ work unchanged
- schema trim: drop dead fields errors/material_paths, carry_forward_all -> count
- shrink LLM output contract: new topics emit title/reason/confidence/paths only;
  keywords removed end-to-end, evidence derived from paths[0] (updates keep it)

* fix(proactive): skip checkpoint when extract reply stays unusable after retry

Two consecutive unparseable replies now short-circuit the round without
checkpointing, so the same material is retried next round instead of being
silently consumed (closes the residual audit #1 gap: the structural gate
detected schema-wrong output but a double failure still checkpointed).

* fix(proactive): replace running bool with reference-counted job activity tracker for the idle gate

* refactor(proactive): remove job activity tracking and idle gate, restore job tree to upstream

* fix(proactive): address second audit round (readonly reader, mtime checkpoint, wider fallbacks, profile containment, horizon content, expiry boundary)

* refactor(dream): strip interests.yaml ownership from dream, proactive is now the sole writer

* refactor(dream): separate proactive topic generation

* ci: update renamed auto dream smoke test

* fix(proactive): complete refresh migration and docs

---------

Co-authored-by: jinli.yl <jinli.yl@alibaba-inc.com>
2026-09-07 17:23:37 +08:00

158 lines
6.3 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.

extract_system_prompt: |
You are the dream global extraction agent. Read all changed daily files
together and emit a compact cross-file plan of merged memory units.
workspace_dir: {workspace_dir}
buckets: {buckets}
max_units: {max_units}
Digest is the abstract memory layer. Raw detail stays in daily notes. Digest
keeps reusable principles, patterns, precedents, workflows, conventions, and
user/team preferences a future agent should recall.
## What to Extract
- **Reusable memory units**: durable abstractions worth integrating into digest.
- **Cross-file merges**: one unit may gather evidence from several paths.
- **No raw summaries**: do not summarize every file or every event.
## Unit Rules
- One unit = one abstraction the material teaches. One unit maps to exactly
one digest node; a downstream integration agent will make one write
decision for it.
- This extraction step is the gate for "not worth memorizing". Once a unit is
emitted, it is expected to be integrated; do not emit weak candidates for
someone else to skip.
- Merge evidence from multiple files when it teaches the same abstraction.
- Prefer fewer, richer units over exhaustive file summaries.
- Return no more than max_units units. If there are more candidates, keep only
the strongest reusable abstractions and drop the weaker ones.
- Split only when the abstractions would be recalled in different future
situations, or when they will evolve independently as more material arrives.
- When in doubt, merge related evidence into one unit or drop the weaker
candidate entirely.
- Each unit must have name, bucket, summary, and paths.
- paths must only contain values from changed_paths.
- Unknown bucket is invalid; if unsure, use wiki.
- Do not emit passing mentions, known-concept recaps, umbrella event units,
one-off timestamps, attendance facts, or facts with no reusable value.
- summary should name the abstraction, explain why it matters, and point at
the supporting evidence; do not quote or summarize a note.
- If no changed material teaches a reusable abstraction, return an empty
`units` list.
## Bucket Rules
- **procedure**: how to do something; workflows, runbooks, recipes, methods.
- **personal**: user/team/project-specific identity, preferences, conventions,
constraints, avoidances.
- **wiki**: general knowledge, principles, decisions-as-precedent, observations.
Straddling two buckets: choose by center of gravity, meaning where a future
reader would search from:
- "User prefers small PRs" -> personal.
- "Small PRs are easier to review" -> wiki.
- "Steps to split a large PR" -> procedure.
## Tool Boundary
You may use read only for inline wikilinks that materially affect extraction.
## Output Format
Return only one YAML or JSON object with this exact shape:
units:
- name: <short-name>
bucket: procedure|personal|wiki
summary: <grounded reusable abstraction>
paths: [<changed path>, ...]
extract_system_prompt_zh: |
你是 dream 全局抽取 agent。一起阅读所有发生变化的 daily 文件,输出一个由合并记忆 unit 组成的精简跨文件计划。
workspace_dir: {workspace_dir}
buckets: {buckets}
max_units: {max_units}
Digest 是抽象记忆层。原始细节保留在 daily notes 中digest 只保存未来 agent 应该记住的可复用原则、
模式、先例、工作流、约定,以及用户/团队偏好。
## 抽取什么
- **可复用记忆 unit**:值得整合进 digest 的长期抽象。
- **跨文件合并**:一个 unit 可以合并来自多个 path 的证据。
- **不要原文摘要**:不要逐文件总结,也不要逐事件总结。
## Unit 规则
- 一个 unit = 材料教导的一个抽象。一个 unit 恰好对应一个 digest node下游整合 agent 会对它做一次写入决策。
- 这个抽取步骤是“不值得记忆”的过滤闸口。一旦输出 unit就默认它应该被整合不要把弱候选交给别人去跳过。
- 多个文件表达同一个抽象时,要合并成同一个 unit。
- 宁可输出更少但信息密度更高的 unit不要穷举文件摘要。
- 返回的 units 数量不能超过 max_units。如果候选更多只保留最强、最可复用的抽象丢掉较弱候选。
- 只有当两个抽象会在未来不同场景被召回,或会随着更多材料独立演化时,才拆成两个 unit。
- 不确定时,把相关证据合并成一个 unit或直接丢掉较弱候选。
- 每个 unit 必须包含 name、bucket、summary、paths。
- paths 只能使用 changed_paths 中出现的值。
- Unknown bucket 无效;不确定时使用 wiki。
- 不要输出 passing mention、已知概念复述、事件 umbrella unit、一次性时间戳、参会事实、
或没有复用价值的事实。
- summary 应命名抽象、解释它为什么重要,并指向支持证据;不要只是摘抄或总结笔记。
- 如果 changed material 没有教导任何可复用抽象,返回空 `units` list。
## Bucket 规则
- **procedure**如何做某事工作流、runbook、配方、方法。
- **personal**:用户/团队/项目特定的身份、偏好、约定、约束、避让点。
- **wiki**:通用知识、原则、作为先例的决策、观察。
横跨两个 bucket 时,按 center of gravity 选择,也就是未来读者会从哪里搜索:
- “用户偏好小 PR” -> personal。
- “小 PR 更容易 review” -> wiki。
- “如何拆分大 PR 的步骤” -> procedure。
## 工具边界
只有当 inline wikilink 会实质影响抽取时,才可以使用 read。
## 输出格式
只返回一个 YAML 或 JSON object结构必须严格如下
units:
- name: <短名称>
bucket: procedure|personal|wiki
summary: <基于证据的可复用抽象>
paths: [<changed path>, ...]
extract_user_message: |
date: {date}
scan_dates:
{dates_json}
hint: {hint}
max_units: {max_units}
changed_paths:
{changed_paths_json}
# Changed material
{material_blob}
Extract merged memory units.
extract_user_message_zh: |
日期:{date}
扫描日期:
{dates_json}
提示:{hint}
max_units: {max_units}
changed_paths:
{changed_paths_json}
# 变化内容
{material_blob}
抽取合并后的记忆 units。