-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·65 lines (56 loc) · 2.13 KB
/
setup.sh
File metadata and controls
executable file
·65 lines (56 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# layered-memory setup script
# Initializes the memory file structure for OpenClaw agents
set -e
OPENCLAW_DIR="${OPENCLAW_DIR:-$HOME/openclaw}"
MEMORY_DIR="$OPENCLAW_DIR/memory"
SKILL_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "🧠 layered-memory setup"
echo "========================"
echo "Target directory: $OPENCLAW_DIR"
echo ""
# Create directory structure
mkdir -p "$MEMORY_DIR/lessons"
mkdir -p "$MEMORY_DIR/archive"
mkdir -p "$MEMORY_DIR/tasks"
echo "✅ Created directory structure"
# Copy MEMORY.md template (only if not exists)
if [ ! -f "$OPENCLAW_DIR/MEMORY.md" ]; then
cp "$SKILL_DIR/templates/MEMORY.md" "$OPENCLAW_DIR/MEMORY.md"
echo "✅ Created MEMORY.md from template"
else
echo "⏭️ MEMORY.md already exists — skipped"
fi
# Create today's daily log (if not exists)
TODAY=$(date +%Y-%m-%d)
DAILY_LOG="$MEMORY_DIR/$TODAY.md"
if [ ! -f "$DAILY_LOG" ]; then
sed "s/{{DATE}}/$TODAY/g" "$SKILL_DIR/templates/daily.md" > "$DAILY_LOG"
echo "✅ Created today's daily log: memory/$TODAY.md"
else
echo "⏭️ Today's log already exists — skipped"
fi
# Create current-task.md placeholder (if not exists)
if [ ! -f "$OPENCLAW_DIR/current-task.md" ]; then
cp "$SKILL_DIR/templates/task.md" "$OPENCLAW_DIR/current-task.md"
echo "✅ Created current-task.md template"
else
echo "⏭️ current-task.md already exists — skipped"
fi
echo ""
echo "🎉 Setup complete!"
echo ""
echo "Next steps:"
echo " 1. Edit $OPENCLAW_DIR/MEMORY.md — add your agent's core facts & preferences"
echo " 2. Add SKILL.md to your OpenClaw skills directory or reference it in your agent config"
echo " 3. Start a session — the agent will now use layered memory automatically"
echo ""
echo "Directory structure created:"
echo " $OPENCLAW_DIR/"
echo " ├── MEMORY.md ← always in context"
echo " ├── current-task.md ← task re-entrancy"
echo " └── memory/"
echo " ├── $TODAY.md ← today's log"
echo " ├── lessons/ ← categorized learnings"
echo " ├── tasks/ ← task files"
echo " └── archive/ ← retired entries"