ReMe/docs/zh/quick_start.md
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

248 lines
6.8 KiB
Markdown
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.

---
title: 快速开始
description: 安装并启动 ReMe,完成文件写入、检索和自动记忆的第一个闭环。
---
# 快速开始
本页用于完成第一次可运行闭环。需要完整配置字段时查看[基础配置](./configuration.md);接入 HTTP 或 MCP 时查看[服务与部署](./services.md)。
## 安装
ReMe 要求 Python 3.11+。
从 pip 安装:
```bash
pip install "reme-ai[core]"
```
从源码安装:
```bash
git clone https://github.com/agentscope-ai/ReMe.git
cd ReMe
pip install -e reme_studio/web/python -e ".[core]"
cd reme_studio
npm ci
npm run build:static
cd ..
```
静态构建步骤需要 Node.js 22.13 或更高版本,用于在从源码运行 ReMe 时提供 Studio。
`core` extra 建议安装:当前代码会导入 AgentScope wrapper,自进化记忆也依赖它。
如果要使用 `auto_memory`、`auto_resource`、`auto_dream` 和 proactive refresh 这类 Agent 流程,再配置 LLM:
```bash
cat > .env <<'EOF'
LLM_BACKEND=openai
LLM_MODEL_NAME=qwen3.7-plus
LLM_API_KEY=your_api_key
LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
EOF
```
只跑基础文件读写和 BM25 检索,可以先不配。
---
## 启动
在一个终端启动 ReMe,并保持运行:
```bash
reme start
```
默认服务地址是 `127.0.0.1:2333`。如果端口被占用:
```bash
reme start service.port=8181
```
在另一个终端调用正在运行的服务:
```bash
reme version
reme health_check
reme help
```
`reme help` 会列出服务端 action。普通命令会通过 HTTP 调用服务端 Job。
使用 ReMe Studio 时,安装 `reme-ai[core]`,运行 `reme start config=proactive`,然后打开
<http://127.0.0.1:2333/>。安装和开发说明见 [Studio 指南](https://github.com/agentscope-ai/ReMe/blob/main/reme_studio/README_ZH.md)。
---
## Workspace 目录
默认 workspace 是当前目录下的 `.reme/`,启动时会自动创建:
```text
.reme/
├── metadata/ # 索引、图谱、catalog 等持久状态
├── session/ # 对话来源记录
├── mem_session/ # Agent wrapper 生成的 session/配置
├── resource/ # 外部资料
├── daily/ # daily note
└── digest/ # 长期记忆
```
目录分层、Markdown frontmatter 和 wikilink 语义见 [Memory as File](./memory_as_file.md)。
也可以启动时指定:
```bash
reme start workspace_dir=/tmp/reme-demo service.port=8181
```
---
## 写入、索引、检索
```bash
reme write \
path=digest/wiki/quick-start-demo \
name="Quick Start Demo" \
description="快速开始示例记忆" \
content="# Quick Start Demo
默认实时 watcher 会索引 daily 和 digest 目录中的 Markdown。
相关链接:[[digest/wiki/search-demo.md]]"
```
`path` 是 workspace 内路径;没有后缀时会自动补 `.md`;Markdown 文件会写入 `name` 和 `description` front matter。
后台 watcher 会自动摄取 workspace 文件。也可以基于它已经摄取的 chunks,手动重建派生的 BM25 和 Embedding 索引:
```bash
reme reindex
```
该命令不会扫描 workspace 文件、重新分块或重建 wikilink 图谱。
搜索:
```bash
reme search query="快速开始 示例 记忆" limit=5
```
读取:
```bash
reme read path=digest/wiki/quick-start-demo start_line=1 end_line=20
```
默认配置下,检索主要是 BM25 + wikilink 图谱扩展;向量检索能力在代码中支持,但默认未启用 embedding store。完整检索流程见
[Memory Search](./memory_search.md)。
---
## 文件与 Daily Note
```bash
reme stat path=digest/wiki/quick-start-demo
reme edit path=digest/wiki/quick-start-demo old="会索引" new="会持续索引"
reme frontmatter_read path=digest/wiki/quick-start-demo
reme frontmatter_update path=digest/wiki/quick-start-demo metadata='{"tags":["demo"]}'
```
文件列表 Job 可以直接通过 CLI 调用:
```bash
reme list path=digest recursive=true limit=50
```
等价的 HTTP 调用是:
```bash
curl -s http://127.0.0.1:2333/list \
-H 'Content-Type: application/json' \
-d '{"path":"digest","recursive":true,"limit":50}'
```
Daily note:
```bash
reme write path=daily/2026-06-20/demo-session.md name=demo-session description="Demo session" content="记录内容"
reme daily_list date=2026-06-20
reme daily_list start_date=2026-06-01 end_date=2026-06-20 page=1 page_size=20
reme daily_reindex date=2026-06-20
```
`write` 可直接创建 daily note;需要刷新当天索引时运行 `daily_reindex`。
`daily_list` 只读。未传新参数时,仍列出 `date`(默认今天)的全部笔记,返回 `{date, count, notes}`。
日期范围必须同时提供起止日期,包含两端,且不能与非空的 `date` 混用;按日期降序、同日路径升序排列。
日期范围或显式的 `page` / `page_size` 会启用分页:页码默认 1,每页默认 100 条、最多 1000 条,
metadata 增加 `page`、`page_size`、`total_notes`、`total_pages`。空范围页数为 0,越界页返回空列表;
总数只统计可读取、有效且有权限访问的笔记。分页限制返回量,不限制扫描量;每次查询读取当前文件,不提供跨页快照。
---
## 自动记忆
```bash
reme auto_memory \
session_id=chat-demo \
messages='[{"role":"user","content":"我偏好把项目经验沉淀成 Markdown。"},{"role":"assistant","content":"已记录。"}]' \
memory_hint="记录用户偏好"
```
外部资料放入 `resource/YYYY-MM-DD/` 或直接放在 `resource/` 下后,默认后台会监听文本资源
(`md/txt/json/jsonl/csv/yaml/html`) 和图像资源 (`png/jpg/jpeg/webp/gif/bmp/tiff/heic`)。
也可以手动触发:
```bash
reme auto_resource changes='[{"path":"resource/2026-06-20/report.md","change":"added"}]'
```
把 daily 整理到长期 digest:
```bash
reme auto_dream date=2026-06-20
reme proactive_read date=2026-06-20
```
这些流程需要可用 LLM;未配置 LLM 时请先使用 `write/read/search` 这类基础能力。
更多细节见 [Auto Memory](./auto_memory.md)、[Auto Resource](./auto_resource.md)、[Auto Dream](./auto_dream.md) 和
[Proactive](./proactive.md)。
---
## HTTP 与配置
每个可服务 Job 都暴露为 `POST /<job>`:
```bash
curl -s http://127.0.0.1:2333/version \
-H 'Content-Type: application/json' \
-d '{}'
curl -s http://127.0.0.1:2333/search \
-H 'Content-Type: application/json' \
-d '{"query":"快速开始","limit":5}'
```
默认配置来自 `reme/config/default.yaml`。启动时可以用 dot notation 覆盖:
```bash
reme start \
workspace_dir=/tmp/reme-demo \
service.host=127.0.0.1 \
service.port=8181 \
enable_logo=false
```
也可以指定 YAML/JSON 配置文件:
```bash
reme start config=/path/to/custom.yaml
```
下一步可以查看 [CLI 参考](./reference/cli.md)、[Job API 参考](./reference/jobs.md)和[诊断、备份与恢复](./operations.md)。