mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-30 01:52:29 +00:00
Reframe digest as the abstract memory layer (details stay in the daily/
resource material; digest holds principles, patterns, precedents reachable
via derived_from provenance edges). Replaces the old digester with a
2-phase ReAct workflow + a daily-tick wrapper:
- Phase 1 (Dreamer extract): clusters material into orthogonal memory
sub-units; each sub-unit maps 1:1 to a digest node (no inner atom
enumeration). Biases toward fewer / richer sub-units.
- Phase 2 (Dreamer integrate per sub-unit): cross-bucket recall +
exactly one write decision (CREATE / UPDATE / SKIP); UPDATE shapes
surfaced explicitly (corroborate / refine / correct).
- CronDreamer: scans <daily_dir>/<today>.md + <daily_dir>/<today>/**
+ <resource_dir>/<today>/** and runs dream_one per file.
Write tools are proper subclasses of the canonical file_io WriteStep /
EditStep with only path-shape + bucket + E-1 edge-conservation rules
layered on top:
- DigestWriteStep(WriteStep): path = <digest_dir>/<bucket>/<slug>.md,
must-not-exist, schema mirrors `write` (path / name / description /
content) so frontmatter lands automatically.
- DigestEditStep(EditStep): body-only find-and-replace + must-exist +
E-1 conservation preflight (refuses if any outbound wikilink would
be dropped).
Configuration:
- Bucket vocabulary structured in code (tuple[{name, description}]);
prompt renders the heuristic block at runtime via {buckets}.
- digest_dir / daily_dir / resource_dir come from app config (not tool
params); prompts use {digest_dir} placeholder.
- BaseStep walks class MRO when loading prompts, so subclasses inherit
parent yaml without duplication.
Tooling: agentscope register_tool_function schemas now wrap in the
proper {"type":"function","function":{...}} envelope. OpenAIAsLLM
routes base_url through client_kwargs so non-default endpoints work.
Smoke: tests4/smoke/{_dreamer_fixture.py,test_dreamer_inproc.py,
test_dreamer_cli.sh} drive the end-to-end pipeline.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
68 lines
2 KiB
Bash
Executable file
68 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# dreamer CLI smoke test (option B).
|
|
#
|
|
# Seeds a rich workspace via _dreamer_fixture.py, starts `reme start`
|
|
# bound to that vault, reindexes so Phase 2 recall can hit the pre-
|
|
# seeded digest nodes, then calls `reme dream`.
|
|
#
|
|
# Usage (from anywhere):
|
|
# VAULT_PATH=/tmp/reme-dreamer-test bash tests4/smoke/test_dreamer_cli.sh
|
|
# VAULT_PATH=/tmp/reme-dreamer-test bash tests4/smoke/test_dreamer_cli.sh daily/2026-05-28/auth-refactor/notes.md
|
|
#
|
|
# Defaults:
|
|
# VAULT_PATH unset → /tmp/reme-dreamer-test
|
|
# Workspace seeded on first run (idempotent).
|
|
#
|
|
# Required env (from .env or shell):
|
|
# LLM_API_KEY, LLM_BASE_URL, LLM_MODEL_NAME
|
|
set -euo pipefail
|
|
|
|
VAULT="${VAULT_PATH:-/tmp/reme-dreamer-test}"
|
|
SMOKE_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO="$(cd "$SMOKE_DIR/../.." && pwd)"
|
|
LOG="/tmp/test_dreamer_cli_server.log"
|
|
|
|
# Resolve input from arg, else default to fixture's input path.
|
|
DEFAULT_INPUT="$(python -c "import sys; sys.path.insert(0, '$SMOKE_DIR'); from _dreamer_fixture import INPUT_PATH; print(INPUT_PATH)")"
|
|
INPUT="${1:-$DEFAULT_INPUT}"
|
|
|
|
mkdir -p "$VAULT"
|
|
echo "--- seeding fixture under $VAULT"
|
|
python "$SMOKE_DIR/_dreamer_fixture.py" "$VAULT"
|
|
|
|
cd "$REPO"
|
|
|
|
echo ""
|
|
echo "--- starting reme server (log: $LOG)"
|
|
reme start "vault_dir=$VAULT" >"$LOG" 2>&1 &
|
|
SERVER_PID=$!
|
|
trap 'echo "--- stopping reme server (pid $SERVER_PID)"; kill "$SERVER_PID" 2>/dev/null || true; wait "$SERVER_PID" 2>/dev/null || true' EXIT
|
|
|
|
echo "--- waiting for server"
|
|
for _ in $(seq 1 30); do
|
|
if curl -s -o /dev/null http://localhost:8000/docs 2>/dev/null; then
|
|
echo "--- server up"
|
|
break
|
|
fi
|
|
sleep 0.5
|
|
done
|
|
|
|
echo ""
|
|
echo "--- reindexing vault so Phase 2 recall has something to hit"
|
|
reme reindex
|
|
|
|
echo ""
|
|
echo "=== reme dream path=$INPUT ==="
|
|
reme dream "path=$INPUT"
|
|
echo ""
|
|
|
|
echo "=== digest/ tree after dream ==="
|
|
if [ -d "$VAULT/digest" ]; then
|
|
find "$VAULT/digest" -name "*.md" | sort | while read -r f; do
|
|
echo ""
|
|
echo "--- ${f#$VAULT/} ---"
|
|
cat "$f"
|
|
done
|
|
else
|
|
echo " (no digest/ created)"
|
|
fi
|