ReMe/docs/zh/quick_start.md
jinliyl ffb4d08c4f
Some checks are pending
Pre-commit / run (ubuntu-latest) (push) Waiting to run
Tests ReMe / Unit Tests - py3.11 (push) Waiting to run
Tests ReMe / Unit Tests - py3.12 (push) Waiting to run
Tests ReMe / Unit Tests - py3.13 (push) Waiting to run
feat(mem): Enhance daily note system with metadata handling and write functionality (#295)
* feat(file_io): add daily_write step for creating daily notes with conversation metadata

- Add DailyWriteStep class that delegates to write job for creating daily notes
- Register daily_write job in default configuration with proper parameters
- Include validation for name and session_id path components
- Add test coverage for daily_write functionality including metadata handling
- Preserve existing job execution method in application.py after repositioning
- Update base_step.py to use positional-only parameter syntax for job methods
- Import and expose DailyWriteStep in file_io module initialization
- Override reserved metadata keys (name, description, session_id, source_conversation) with fixed values
- Refresh daily index after successful write operation
- Generate proper source conversation links in markdown format

* feat(daily): refactor daily note system with enhanced metadata handling

- Introduce validate_filename_component function and export it
- Add _INDEX_HIDDEN_METADATA_KEYS to hide conversation metadata from index
- Update scan_notes to exclude hidden metadata keys from index rendering
- Modify auto_memory to use daily_write tool and manage session frontmatter
- Implement session note lookup and renaming based on frontmatter name
- Update daily_list to return flattened note metadata including session info
- Change daily_write to dispatch write step instead of running job
- Add test cases for updated daily note functionality and metadata handling
- Update version from 0.4.0.2 to 0.4.0.3

* fix(evolve): correct metadata update in auto memory response

- Fixed trailing comma issue in metadata dictionary update
- Ensured proper formatting of response metadata structure
- Maintained existing functionality while fixing syntax error

* refactor(auto_resource): replace daily_create with dynamic note management

- Remove DailyCreateStep and related exports from file_io module
- Replace static daily note creation with dynamic resource-linked card system
- Implement LLM-suggested naming with frontmatter-driven file management
- Add source_resource linking for tracking original files
- Introduce collision handling with hash-based suffixes
- Update documentation to reflect new resource card workflow
- Modify auto_resource prompts to use write/edit tools instead of daily_create
- Adjust test fixture comments to match new agent behavior
- Update framework diagrams and quick start examples accordingly

* feat(app): add version info to app initialization and update auto-memory logic

- Include version number in application startup logging
- Remove tool result truncation logic from auto-memory step
- Update auto-memory to exclude tool_result blocks from saved history
- Add test case to verify tool results are filtered out from message saving
- Update YAML prompts to clarify filename naming rules without dates
- Modify configuration to support new dispatch steps format with persistence control

* feat(auto_memory): add note modification tracking and optimize frontmatter updates

- Add _note_bytes and _note_modified methods to track actual file changes
- Optimize frontmatter updates by checking existing metadata before update
- Add modified flag to response metadata indicating actual note changes
- Update logging to include modified status in various operations
- Add comprehensive tests for modified/unmodified detection scenarios
- Enhance result hook logic to skip when no actual changes occur
- Refactor metadata handling to properly track creation vs modification status
2026-06-25 21:54:56 +08:00

4.6 KiB
Raw Blame History

快速开始

安装

ReMe 要求 Python 3.11+。

从 pip 安装:

pip install "reme-ai[core]"

从源码安装:

git clone https://github.com/agentscope-ai/ReMe.git
cd ReMe
pip install -e ".[core]"

core extra 建议安装:当前代码会导入 AgentScope wrapper自进化记忆也依赖它。

如果要使用 auto_memoryauto_resourceauto_dream 这类 Agent 流程,再配置 LLM

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 start

默认服务地址是 127.0.0.1:2333。如果端口被占用:

reme start service.port=8181
reme version
reme health_check
reme list

reme list 会列出服务端 action。普通命令会通过 HTTP 调用服务端 Job。


Workspace 目录

默认 workspace 是当前目录下的 .reme/,启动时会自动创建:

.reme/
├── metadata/   # 索引、图谱、catalog 等持久状态
├── session/    # Agent session 与原始对话
├── resource/        # 外部资料
├── daily/           # daily note
└── digest/          # 长期记忆

目录分层、Markdown frontmatter 和 wikilink 语义见 Memory as File

也可以启动时指定:

reme start workspace_dir=/tmp/reme-demo service.port=8181

写入、索引、检索

reme write \
  path=digest/wiki/quick-start-demo \
  name="Quick Start Demo" \
  description="快速开始示例记忆" \
  content="# Quick Start Demo

ReMe 会索引 daily、digest 和 resource 目录中的 Markdown。

相关链接:[[digest/wiki/search-demo.md]]"

path 是 workspace 内路径;没有后缀时会自动补 .mdMarkdown 文件会写入 namedescription front matter。

后台 watcher 会自动建索引;也可以手动重建:

reme reindex

搜索:

reme search query="快速开始 示例 记忆" limit=5

读取:

reme read path=digest/wiki/quick-start-demo start_line=1 end_line=20

默认配置下,检索主要是 BM25 + wikilink 图谱扩展;向量检索能力在代码中支持,但默认未启用 embedding store。完整检索流程见 Memory Search


文件与 Daily Note

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"]}'

list 这个名字在 CLI 中用于 action 列表,所以文件列表 Job 需要用 HTTP 调:

curl -s http://127.0.0.1:2333/list \
  -H 'Content-Type: application/json' \
  -d '{"path":"digest","recursive":true,"limit":50}'

Daily note

reme write path=daily/2026-06-20/demo-session.md name=demo-session description="Demo session" content="记录内容"
reme daily_list
reme daily_reindex

write 可直接创建 daily note需要刷新当天索引时运行 daily_reindex


自动记忆

reme auto_memory \
  session_id=chat-demo \
  messages='[{"role":"user","content":"我偏好把项目经验沉淀成 Markdown。"},{"role":"assistant","content":"已记录。"}]' \
  memory_hint="记录用户偏好"

外部资料放入 resource/YYYY-MM-DD/ 后,默认后台会监听 md/txt/json/jsonl/csv/yaml/html。也可以手动触发:

reme auto_resource changes='[{"path":"resource/2026-06-20/report.md","change":"added"}]'

把 daily 整理到长期 digest

reme auto_dream date=2026-06-20
reme proactive date=2026-06-20

这些流程需要可用 LLM未配置 LLM 时请先使用 write/read/search 这类基础能力。

更多细节见 Auto MemoryAuto ResourceAuto DreamProactive


HTTP 与配置

每个可服务 Job 都暴露为 POST /<job>

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 覆盖:

reme start \
  workspace_dir=/tmp/reme-demo \
  service.host=127.0.0.1 \
  service.port=8181 \
  enable_logo=false

也可以指定 YAML/JSON 配置文件:

reme start config=/path/to/custom.yaml