# Floreo

> Floreo - Autonomous compounding journal with local storage and open connections. Auto-detects activities, tracks compound metrics (streaks, trends, velocity), cross-domain correlations, and syncs with external services. Intelligent automation with privacy controls.

- Skill: `lord1egypt/floreo` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lord1egypt/floreo`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lord1egypt/floreo/raw
- Safety review: pending (external: skill-scanner WARNING, skillspector WARNING)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Lord1Egypt (https://skillmd.com/u/lord1egypt)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/lord1egypt/floreo

---


# Floreo

**Version**: 0.2.1  
**Type**: Autonomous Life Flourishing System  
**Approach**: OpenClaw Native Tools with Autonomous Features & Open Connections  
**Skill Longevity**: Built to Last (see Maintenance section)  

**New in v0.2.0**:
- 🔄 **Compounding Metrics** — Streaks, trends, velocity, cross-domain correlations
- 👤 **Configurable User Name** — Set and change your name anytime
- 🧬 **Longevity & Healthspan** — Biomarker tracking, biological age estimation
- 💊 **Compression of Morbidity** — Healthspan vs lifespan ratio
- 🏃 **Exercise Zones** — Zone 2 (mitochondrial) + Zone 4 (VO2 max) tracking
- 🩺 **Healthspan Scoring** — 0-100 composite from sleep, exercise, nutrition, stress
- 🔬 **Longevity Interventions** — Fasting, supplements, recovery protocols
- ⏳ **90-Day Trends** — Longevity trajectory visualization
- 🛡️ **Skill Durability** — Backward compatible, future-proof, maintainable  

> *Flore per integra* — Flourish through wholeness.

Floreo is a **methodology**, not a custom tool. It uses OpenClaw's native capabilities (file operations, memory, shell commands) to track your life across work, health, learning, relationships, and creativity.

> **📍 Important Clarifications**:
> - `{user_name}` refers to your configured name in `~/.openclaw/customers/.floreo-user`
> - **Autonomous mode available** — background processes can auto-detect activities
> - **"Automated" analysis** — scheduled shell scripts via cron/heartbeat
> - **File watchers optional** — monitor git, calendar, files (opt-in)
> - **Open connections** — Notion, GitHub, Calendar integrations (opt-in)
> - **Privacy controls** — granular control over what gets logged and shared

---

## 📚 Table of Contents

1. [Philosophy](#philosophy)
2. [Security & Privacy Statement](#-security--privacy-statement)
3. [Quick Start](#quick-start)
4. [Entry Format](#entry-format)
5. [Recording Entries](#recording-entries-native-tools)
6. [Directory Structure](#directory-structure)
7. [User Profile Management](#-user-profile-management)
8. [Querying Entries](#querying-entries-native-tools)
9. [Timeline Compilation](#timeline-compilation-native-tools)
10. [Export Screening](#export-screening-privacy)
11. [Reflection & Analysis](#reflection--analysis-native-tools)
12. [Integration with MEMORY.md](#integration-with-memorymd)
13. [Automation with Cron](#automation-with-cron)
14. [Tips & Best Practices](#tips--best-practices)
15. [Import from Historical Files](#import-from-historical-files)
16. [Compound Metrics System](#-compound-metrics-system)
17. [Cross-Domain Correlation](#-cross-domain-correlation-analysis)
18. [Automated Insight Generation](#-automated-insight-generation)
19. [Momentum & Streak Tracking](#-momentum--streak-tracking)
20. [Autonomous Analysis Setup](#-autonomous-analysis-setup)
21. [Longevity & Healthspan](#-longevity--healthspan-tracking)
22. [Artistic Reports](#automated-artistic-reports)
23. [Skill Longevity](#-skill-longevity--maintenance)
24. [Limitations](#limitations-of-native-approach)
25. [Complete Workflow Example](#example-complete-workflow)
26. [Resources](#resources)

---

## Philosophy

**No custom scripts. No dependencies. Pure OpenClaw.**

Floreo defines conventions for:
- Where to store entries
- How to structure them
- How to query them
- How to export them safely

You use OpenClaw's native tools to implement it.

---

## 🔒 Security & Privacy Statement

### What This Skill Does

- ✅ **Autonomous operation** — Background processes watch for activities (git commits, file changes, calendar events)
- ✅ **Local file storage** — Primary data stays in `~/.openclaw/customers/{name}/floreo/`
- ✅ **Open connections** — Optional integrations with external services (Notion, GitHub, Calendar APIs)
- ✅ **Automatic detection** — Detects code commits, meeting attendance, file modifications
- ✅ **Shell script automation** — Scheduled analysis runs via cron/heartbeat
- ✅ **Privacy controls** — Configurable data sharing levels

### Autonomous Features

**File System Watchers:**
- Monitor git repositories for commits
- Track file changes in specified directories
- Detect new calendar events

**External Connections (Optional):**
- Notion API for database sync
- GitHub API for commit/PR tracking
- Calendar APIs for meeting logging
- Slack webhook for notifications

**Data Storage:**
- Local: `~/.openclaw/customers/{name}/floreo/`
- External: Configurable via API keys in `~/.openclaw/customers/.floreo-config/`

### Opt-In/Opt-Out Controls

```bash
# Disable autonomous features
echo "autonomous_mode: false" >> ~/.openclaw/customers/.floreo-config

# Disable specific watchers
echo "watch_git: false" >> ~/.openclaw/customers/.floreo-config
echo "watch_calendar: false" >> ~/.openclaw/customers/.floreo-config

# Run in manual-only mode
FLORO_MANUAL=1 openclaw skill use floreo
```

### System Requirements

**Required:**
- `bash` or `zsh` (POSIX shell)
- `grep`, `sed`, `awk`, `date`, `find`, `bc`, `openssl`

**Optional (for autonomous features):**
- `fswatch` or `inotifywait` (file watching)
- `git` (commit detection)
- API keys for external services (stored securely)

---

---

## Quick Start

### 1. Set Your Name (Can Change Anytime)

Your name/identifier is stored in a config file and can be updated whenever you want:

```bash
# Set your name for the first time
echo "jerry" > ~/.openclaw/customers/.floreo-user

# Or use OpenClaw to set it
Write "jerry" to ~/.openclaw/customers/.floreo-user
```

**To change your name later:**
```bash
# Simply overwrite the file
echo "jerry-smith" > ~/.openclaw/customers/.floreo-user

# Or read the current name first, then update
Read ~/.openclaw/customers/.floreo-user
# Then write the new name
```

**Using your name in scripts:**
```bash
#!/bin/bash
# Get current user name
user_name=$(cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "default")

# Use in paths
mkdir -p ~/.openclaw/customers/$user_name/floreo/domains/work
echo "Entry for $user_name"
```

### 2. Initialize Structure (One-time)

```bash
# Get your name
user_name=$(cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "user")

# Create Floreo directory structure
mkdir -p ~/.openclaw/customers/$user_name/floreo/{domains/{work,health,learn,relate,create,reflect},insights,goals}

# Example output: creates ~/.openclaw/customers/{user_name}/floreo/...
```

### 2. Record Your First Entry

```bash
# Create a work entry
cat >> ~/.openclaw/customers/{user_name}/floreo/domains/work/$(date +%Y)/$(date +%m)/$(date +%d-%m-%y).md << 'EOF'
---
type: entry
entry_id: FE-$(date +%Y%m%d)-$(openssl rand -hex 3 | tr '[:lower:]' '[:upper:]')
domain: work
date: $(date +%d-%m-%y)
day: $(date +%j)
timestamp: $(date -Iseconds)
privacy: internal
metrics:
  focus: 4
  commits: 5
tags: project-x, deep-work
---
Shipped v0.6.8 to production after fixing the critical auth bug.
EOF
```

Or simpler — use OpenClaw to write it (using your configured name):

```
# First, read your user name
Read ~/.openclaw/customers/.floreo-user

# Then write to your personal path
Write an entry to ~/.openclaw/customers/{your-name}/floreo/domains/work/2026/04/15-04-26.md with this content:

---
type: entry
entry_id: FE-20260415-A1B2C3
domain: work
date: 15-04-26
day: 105
timestamp: 2026-04-15T10:30:00
privacy: internal
metrics:
  focus: 4
  commits: 5
tags: project-x, deep-work
---
Shipped v0.6.8 to production after fixing the critical auth bug.
```

---

## Entry Format

Every entry is a Markdown file with YAML frontmatter:

```markdown
---
type: entry
entry_id: FE-YYYYMMDD-XXXXXX      # Unique ID
domain: work|health|learn|relate|create|reflect
date: DD-MM-YY
day: NNN                          # Day of year
timestamp: ISO-8601
privacy: private|internal|public   # Privacy tier
metrics:                          # Key-value pairs
  focus: 4
  commits: 5
tags: tag1, tag2, tag3
---

Entry content here. Can be multiple paragraphs.
Support **markdown** formatting.
```

### Privacy Tiers

| Level | Icon | Export | Use For |
|-------|------|--------|---------|
| **private** | 🔒 | Never | Passwords, health, secrets |
| **internal** | 👁️ | With screening | Work notes, client details |
| **public** | 🌐 | Anywhere | Blog posts, open source |

### Auto-Detect Privacy

When creating entries, OpenClaw can suggest privacy based on content:

- Contains "password", "secret", "confidential" → **private**
- Contains "client", "revenue", "internal" → **internal**
- General notes → **internal** (safe default)

---

## Recording Entries (Native Tools)

### Method 1: Direct File Write

```
Write to ~/.openclaw/customers/{user_name}/floreo/domains/health/2026/04/15-04-26.md:

---
type: entry
entry_id: FE-20260415-HEALTH1
domain: health
date: 15-04-26
day: 105
timestamp: 2026-04-15T08:00:00
privacy: private
metrics:
  energy: 8
  sleep: 7.5
tags: morning, exercise
---
Morning run 5k in 25 minutes. Feeling energized!
```

### Method 2: Append to Existing File

```
Read ~/.openclaw/customers/{user_name}/floreo/domains/work/2026/04/15-04-26.md
Then append a new entry:

---
type: entry
entry_id: FE-20260415-WORK2
domain: work
date: 15-04-26
day: 105
timestamp: 2026-04-15T14:30:00
privacy: internal
metrics:
  meetings: 2
  focus: 3
tags: meetings, planning
---
Afternoon planning session with the team.
```

### Method 3: Use Shell Commands

```bash
# Create entry with shell
cat >> ~/.openclaw/customers/{user_name}/floreo/domains/learn/$(date +%Y)/$(date +%m)/$(date +%d-%m-%y).md << 'EOF'
---
type: entry
entry_id: FE-$(date +%Y%m%d)-$(openssl rand -hex 3 | tr '[:lower:]' '[:upper:]')
domain: learn
date: $(date +%d-%m-%y)
day: $(date +%j)
timestamp: $(date -Iseconds)
privacy: public
metrics:
  pages: 30
  minutes: 45
tags: reading, rust
---
Read chapter 3 of the Rust book. Learned about ownership and borrowing.
EOF
```

---

## Directory Structure

```
~/.openclaw/customers/{user_name}/floreo/
├── domains/
│   ├── work/
│   │   └── 2026/
│   │       └── 04/
│   │           └── 15-04-26.md
│   ├── health/
│   ├── learn/
│   ├── relate/
│   ├── create/
│   └── reflect/
├── insights/
│   └── weekly-reflection-2026-W16.md
├── goals/
│   └── 2026-Q2-goals.md
└── exports/
    └── export-2026-04-15.md
```

---

## 👤 User Profile Management

Your identity in Floreo is completely configurable and can be changed at any time.

### Setting Your Name

**First time setup:**
```bash
# Set your name
echo "alex" > ~/.openclaw/customers/.floreo-user

# Verify
cat ~/.openclaw/customers/.floreo-user
# Output: alex
```

**Using OpenClaw:**
```markdown
Write "alex" to ~/.openclaw/customers/.floreo-user
```

### Changing Your Name (Anytime)

You can change your name whenever you want — all your entries stay linked to you:

```bash
# Change from "alex" to "alex-johnson"
echo "alex-johnson" > ~/.openclaw/customers/.floreo-user

# Old entries remain at old path (you can migrate if desired)
# New entries go to new path
```

**Migration script (optional):**
```bash
#!/bin/bash
# migrate-user.sh — Move entries to new name

old_name="alex"
new_name="alex-johnson"

# Create new directory
mkdir -p ~/.openclaw/customers/$new_name/floreo

# Copy all entries (preserve timestamps)
cp -r ~/.openclaw/customers/$old_name/floreo/* \
      ~/.openclaw/customers/$new_name/floreo/

# Update the user file
echo "$new_name" > ~/.openclaw/customers/.floreo-user

echo "✅ Migrated from $old_name to $new_name"
echo "   Old data kept at: ~/.openclaw/customers/$old_name/"
echo "   New data at: ~/.openclaw/customers/$new_name/"
```

### Using Your Name in All Commands

Replace hardcoded names with dynamic lookup:

```bash
# Instead of:
# cat ~/.openclaw/customers/{user_name}/floreo/domains/work/2026/04/15-04-26.md

# Use:
user_name=$(cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "user")
cat ~/.openclaw/customers/$user_name/floreo/domains/work/2026/04/15-04-26.md
```

**Helper function for scripts:**
```bash
#!/bin/bash
# Add this to your shell profile or scripts

get_floreo_user() {
  cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "default"
}

# Usage in any script
user_name=$(get_floreo_user)
path="~/.openclaw/customers/$user_name/floreo"
```

### Multiple Users (Optional)

Floreo supports multiple users on the same system:

```bash
# Switch between users by changing the file
echo "work-profile" > ~/.openclaw/customers/.floreo-user
# All subsequent entries go to work-profile/

echo "personal" > ~/.openclaw/customers/.floreo-user
# Now entries go to personal/
```

### OpenClaw Integration

When using OpenClaw, you can dynamically reference your name:

```markdown
Read ~/.openclaw/customers/.floreo-user to get my user name

Then write an entry to ~/.openclaw/customers/{user_name}/floreo/domains/work/2026/04/entry.md
```

Or simply:
```markdown
Write an entry to my Floreo work domain for today
```

OpenClaw can:
1. Read `~/.openclaw/customers/.floreo-user` to get your name
2. Use it in all subsequent operations
3. You can update it anytime with a simple write command

---

## Querying Entries (Native Tools)

### List All Entries

```bash
# Find all entry files
find ~/.openclaw/customers/{user_name}/floreo/domains -name "*.md" -type f
```

### Search Content

```bash
# Search for specific text
grep -r "shipped" ~/.openclaw/customers/{user_name}/floreo/domains/

# Search with context
grep -r -B2 -A2 "project-x" ~/.openclaw/customers/{user_name}/floreo/domains/work/
```

### Filter by Date

```bash
# Entries from specific date
find ~/.openclaw/customers/{user_name}/floreo/domains -name "15-04-26.md"

# Entries from this month
find ~/.openclaw/customers/{user_name}/floreo/domains -path "*/2026/04/*.md"
```

### Count Entries

```bash
# Total entries
find ~/.openclaw/customers/{user_name}/floreo/domains -name "*.md" | wc -l

# By domain
for domain in work health learn relate create reflect; do
  count=$(find ~/.openclaw/customers/{user_name}/floreo/domains/$domain -name "*.md" 2>/dev/null | wc -l)
  echo "$domain: $count"
done
```

---

## Timeline Compilation (Native Tools)

### Compile All Entries (Includes Imported Entries Immediately)

All entries - whether created natively or imported - are immediately available in timeline:

```bash
# Concatenate all entries into timeline
cat $(find ~/.openclaw/customers/{user_name}/floreo/domains -name "*.md" | sort) > /tmp/timeline.md

# This includes:
# - Original Floreo entries
# - Imported MEMORY.md entries (with original dates)
# - Imported document files
# - All entries use their ORIGINAL date (not import date)
```

### Timeline with Original Dates Preserved

```bash
# View timeline sorted by ORIGINAL entry date (not import date)
find ~/.openclaw/customers/{user_name}/floreo/domains -name "*.md" -exec grep -H "^date:" {} \; | \
  sed 's/.*date: //' | \
  sort -t'-' -k3 -k2 -k1 | \
  head -20

# Result shows chronological order based on when entry was originally made
# NOT when it was imported into Floreo
```

### View Recent Activity

```bash
# Show entries from last 7 days
for file in $(find ~/.openclaw/customers/{user_name}/floreo/domains -name "*.md" -mtime -7 | sort); do
  echo "=== $file ==="
  cat "$file"
  echo
done
```

### Generate Stats

```bash
# Entries per domain
find ~/.openclaw/customers/{user_name}/floreo/domains -name "*.md" -exec grep -l "^domain:" {} \; | \
  xargs grep "^domain:" | \
  sed 's/.*domain: //' | \
  sort | uniq -c | sort -rn
```

---

## Export Screening (Privacy)

### Manual Screening

When exporting, manually review entries based on privacy:

```bash
# List private entries (don't export)
grep -l "^privacy: private" ~/.openclaw/customers/{user_name}/floreo/domains -r

# List public entries (safe to export)
grep -l "^privacy: public" ~/.openclaw/customers/{user_name}/floreo/domains -r

# List internal entries (export with caution)
grep -l "^privacy: internal" ~/.openclaw/customers/{user_name}/floreo/domains -r
```

### Create Export

```bash
# Export public entries only
mkdir -p ~/.openclaw/customers/{user_name}/floreo/exports
grep -l "^privacy: public" ~/.openclaw/customers/{user_name}/floreo/domains -r | \
  xargs cat > ~/.openclaw/customers/{user_name}/floreo/exports/public-export-$(date +%Y%m%d).md
```

### Redact Sensitive Info

```bash
# Remove email addresses
sed -i '' 's/[a-zA-Z0-9._%+-]*@[a-zA-Z0-9.-]*\.[a-zA-Z]*/[EMAIL]/g' export.md

# Remove phone numbers
sed -i '' 's/[0-9]\{3\}-[0-9]\{3\}-[0-9]\{4\}/[PHONE]/g' export.md
```

---

## Reflection & Analysis (Native Tools)

### Weekly Review

```bash
# Compile this week's entries
week_start=$(date -v-sun -v-7d +%d-%m-%y)
week_end=$(date -v-sat +%d-%m-%y)

echo "# Weekly Reflection: $week_start to $week_end" > /tmp/weekly.md
echo "" >> /tmp/weekly.md

for domain in work health learn relate create reflect; do
  echo "## $domain" >> /tmp/weekly.md
  find ~/.openclaw/customers/{user_name}/floreo/domains/$domain -name "*.md" -mtime -7 -exec cat {} \; >> /tmp/weekly.md
  echo "" >> /tmp/weekly.md
done
```

### Search by Tag

```bash
# Find all entries with specific tag
grep -r "tags:.*project-x" ~/.openclaw/customers/{user_name}/floreo/domains/
```

### Generate Word Cloud

```bash
# Extract all content (no frontmatter)
grep -v "^---$" ~/.openclaw/customers/{user_name}/floreo/domains -r | \
  grep -v "^[a-z_]*:" | \
  tr ' ' '\\n' | \
  sort | uniq -c | sort -rn | head -30
```

---

## Integration with MEMORY.md

### Sync to Memory

```
Read ~/.openclaw/customers/{user_name}/floreo/domains/work/2026/04/15-04-26.md
Then append a summary to ~/.openclaw/customers/{user_name}/memory/15-04-26.md
```

### Import from Memory

```
Read ~/.openclaw/customers/{user_name}/memory/14-04-26.md
Parse entries and write them to appropriate Floreo domain files with privacy: private
```

---

## Automation with Cron

### Daily Entry Prompt

```bash
# Add to crontab
0 21 * * * echo "What did you work on today?" >> ~/.openclaw/customers/{user_name}/floreo/.daily-prompt
```

### Weekly Summary

```bash
# Every Sunday at 8pm
0 20 * * 0 cd ~/.openclaw/customers/{user_name}/floreo && ./generate-weekly-reflection.sh
```

---

## Tips & Best Practices

### 1. Use Consistent Date Formats

Always use `DD-MM-YY` for entry dates and `YYYY/MM/DD` for directory structure.

### 2. Unique Entry IDs

Generate with: `FE-$(date +%Y%m%d)-$(openssl rand -hex 3 | tr '[:lower:]' '[:upper:]')`

### 3. Tag Consistently

Use lowercase, hyphenated tags: `deep-work`, `client-meeting`, `bug-fix`

### 4. Metrics Matter

Include quantifiable metrics for trend analysis:
- `focus: 4` (hours)
- `commits: 5`
- `energy: 8` (1-10 scale)
- `pages: 30`

### 5. Privacy First

When in doubt, use `privacy: internal`. You can always make it public later.

### 6. Regular Reviews

Use `find -mtime -7` to review weekly activity.

---

## Import from Historical Files

Import existing notes, journals, or OpenClaw memory into Floreo format with **immediate timeline integration**.

### Import Principles

1. **Preserve Original Dates** - Entries keep their original date/timestamp
2. **Immediate Timeline Integration** - Available in timeline right after import
3. **User Consent for Domain/Privacy** - You review and approve classifications
4. **Idempotent** - Can re-run without duplicates (based on entry_id)

### Import from MEMORY.md with Consent

```markdown
Step 1: Read ~/.openclaw/customers/{user_name}/memory/14-04-26.md

Step 2: Parse and present for approval:

Found 5 entries in memory file:
┌─────────────────────────────────────────────────────────┐
│ Entry 1 | Date: 14-04-26 | Original timestamp preserved │
├─────────────────────────────────────────────────────────┤
│ Content: "Shipped v0.6.8 to production..."              │
│ Suggested Domain: work [💼]                             │
│ Suggested Privacy: internal [👁️]                        │
│ Tags: imported, memory                                  │
├─────────────────────────────────────────────────────────┤
│ [✓ Approve] [✗ Skip] [✎ Edit Domain]                  │
└─────────────────────────────────────────────────────────┘

Entry 2 | Date: 14-04-26
Content: "Morning run 5k..."
Suggested Domain: health [💪]
Suggested Privacy: private [🔒]
[✓ Approve] [✗ Skip]

... (show all 5 entries)

Step 3: Upon approval, write immediately to:
~/.openclaw/customers/{user_name}/floreo/domains/work/2026/04/14-04-26.md
~/.openclaw/customers/{user_name}/floreo/domains/health/2026/04/14-04-26.md

Step 4: Verify timeline integration:
Run: find ~/.openclaw/customers/{user_name}/floreo/domains -name "14-04-26.md"
Result: Should show newly imported entries
```

### Import with Immediate Timeline Preview

```bash
#!/bin/bash
# import-with-preview.sh - Interactive import with consent

user_name=$(cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "default")
source_file="$1"

if [ ! -f "$source_file" ]; then
  echo "❌ File not found: $source_file"
  exit 1
fi

echo "📥 Import Preview"
echo "=================="
echo "Source: $source_file"
echo ""

# Parse and show preview
entry_count=0
while IFS= read -r line; do
  if [[ "$line" =~ ^##?[[:space:]] ]]; then
    entry_count=$((entry_count + 1))
    echo ""
    echo "Entry $entry_count:"
    echo "  Date: $(echo "$line" | grep -oE '[0-9]{2,4}-[0-9]{2}-[0-9]{2,4}' || echo 'unknown')"
    echo "  Preview: ${line:0:60}..."
    
    # Suggest domain
    content_lower=$(echo "$line" | tr '[:upper:]' '[:lower:]')
    if [[ "$content_lower" =~ (work|code|shipped|project|meeting) ]]; then
      suggested_domain="work"
      emoji="💼"
    elif [[ "$content_lower" =~ (run|gym|health|sleep|exercise) ]]; then
      suggested_domain="health"
      emoji="💪"
    elif [[ "$content_lower" =~ (read|learn|book|course|study) ]]; then
      suggested_domain="learn"
      emoji="📚"
    else
      suggested_domain="reflect"
      emoji="🧘"
    fi
    
    echo "  Suggested: $emoji $suggested_domain"
    echo ""
  fi
done < "$source_file"

echo "Total entries found: $entry_count"
echo ""
read -p "Proceed with import? (y/n): " confirm

if [[ "$confirm" == "y" ]]; then
  echo "✅ Importing with original dates preserved..."
  
  # Import logic here - preserve dates, write to appropriate domain files
  # Each entry gets entry_id: FE-{original-date}-{random}
  # Original timestamp preserved in timestamp field
  # Date field uses original date (not today)
  
  echo "✅ Import complete. Entries now in timeline."
  echo ""
  echo "Verify with:"
  echo "  find ~/.openclaw/customers/$user_name/floreo/domains -name '*.md' | xargs ls -la"
else
  echo "❌ Import cancelled."
fi
```

### Import from Markdown Files

```bash
# Import all markdown files from a directory
for file in ~/Documents/journal/*.md; do
  # Extract date from filename (e.g., 2026-04-15.md)
  date_str=$(basename "$file" .md | sed 's/-/ /g')
  
  # Read content and classify
  content=$(cat "$file")
  
  # Determine domain based on content keywords
  if echo "$content" | grep -qi "work\|job\|project\|code"; then
    domain="work"
  elif echo "$content" | grep -qi "run\|gym\|sleep\|health"; then
    domain="health"
  elif echo "$content" | grep -qi "read\|learn\|book\|course"; then
    domain="learn"
  else
    domain="reflect"
  fi
  
  # Create Floreo entry
  target_dir="~/.openclaw/customers/{user_name}/floreo/domains/$domain/$(date +%Y)/$(date +%m)"
  mkdir -p "$target_dir"
  
  cat >> "$target_dir/$(date +%d-%m-%y).md" << EOF
---
type: entry
entry_id: FE-$(date +%Y%m%d)-$(openssl rand -hex 3 | tr '[:lower:]' '[:upper:]')
domain: $domain
date: $(date +%d-%m-%y)
day: $(date +%j)
timestamp: $(date -Iseconds)
privacy: internal
tags: imported
---
$content
EOF
done
```

### Import from JSON/CSV

```bash
# Import from JSON export (e.g., from other apps)
# JSON format: [{"date": "...", "content": "...", "domain": "..."}]

jq -c '.[]' export.json | while read entry; do
  date_str=$(echo "$entry" | jq -r '.date')
  content=$(echo "$entry" | jq -r '.content')
  domain=$(echo "$entry" | jq -r '.domain // "reflect"')
  
  # Parse date and create entry
  # ... similar to markdown import
done
```

### Bulk Import with Immediate Timeline Integration

```markdown
Read all files in ~/Documents/personal-notes/ with extension .md

For each file:
1. Extract ORIGINAL date from filename or content (preserve historical accuracy)
2. Analyze content to determine domain
3. Create Floreo entry with:
   - entry_id: FE-{original-date}-{hash} (idempotent - re-running won't duplicate)
   - Original timestamp preserved
   - Original date in date field (NOT today's date)
   - Domain as suggested
   - Privacy: private (for imported personal notes)
   - Tags: imported, historical
4. Write to: ~/.openclaw/customers/{user_name}/floreo/domains/{domain}/{original-year}/{original-month}/{original-date}.md

After import - IMMEDIATE VERIFICATION:
Run shell: find ~/.openclaw/customers/{user_name}/floreo/domains -name "*.md" -path "*/2026/04/*" | wc -l
Expected: Previous count + newly imported entries

Report:
- Total files processed
- Entries created by domain
- Date range of imported entries (oldest to newest)
- Timeline verification: All entries now searchable
- Any errors or skipped files
```

### Post-Import Timeline Verification

```bash
#!/bin/bash
# verify-import.sh - Verify imported entries are in timeline

user_name=$(cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "default")

echo "📊 Post-Import Timeline Verification"
echo "===================================="
echo ""

# Count total entries
total=$(find ~/.openclaw/customers/$user_name/floreo/domains -name "*.md" | wc -l)
echo "Total entries in Floreo: $total"
echo ""

# Show date range of all entries
echo "Date range in timeline:"
find ~/.openclaw/customers/$user_name/floreo/domains -name "*.md" | \
  grep -oE '[0-9]{2}-[0-9]{2}-[0-9]{2}' | \
  sort | \
  uniq | \
  head -5
echo "  ... (showing first 5 unique dates)"
echo ""

# Check for imported entries specifically
echo "Imported entries (tagged with 'imported'):"
grep -r "tags:.*imported" ~/.openclaw/customers/$user_name/floreo/domains/ | wc -l
echo ""

# Sample recent entries
echo "Most recent entries:"
ls -lt ~/.openclaw/customers/$user_name/floreo/domains/*/*/*/*.md 2>/dev/null | head -5 | awk '{print $6, $7, $8, $9}'
echo ""

echo "✅ Timeline integration verified!"
echo "   All imported entries available for timeline, reports, and search."
```

### Re-Import Protection (Idempotent)

Entries are deduplicated by `entry_id` which includes the original date:

```bash
# Entry ID format: FE-{original-date}-{hash}
# Example: FE-20260414-A1B2C3

# If you re-import the same file:
# - Entries with same entry_id will be skipped
# - New entries (different dates) will be added
# - No duplicates created
```

### Immediate Timeline Query After Import

```markdown
Right after import, query the timeline:

"Show me all entries from April 2026"
→ Should include both:
   - Original Floreo entries
   - Newly imported entries (with original April dates)

"Generate a report for last week"
→ Should include imported entries if they fall in that date range

"Search for 'shipped' in timeline"
→ Should find imported entries containing that word
```

---

## 🧬 Compound Metrics System

Track metrics that compound over time — small daily improvements create exponential long-term results.

### Compound Metrics Schema

Each domain supports compound metrics that build upon each other:

```yaml
# Work domain compound metrics
metrics:
  # Base metrics (daily inputs)
  deep_work_hours: 4
  commits: 5
  prs_merged: 2
  blockers_identified: 1
  
  # Compound metrics (calculated)
  focus_streak: 3           # Consecutive days with deep_work >= 3
  weekly_output: 23         # Rolling 7-day sum
  velocity_trend: 1.15      # Output vs previous week (15% up)
  
# Health domain compound metrics
metrics:
  # Base metrics
  sleep_hours: 7.5
  exercise_minutes: 45
  energy_level: 8
  
  # Compound metrics
  recovery_score: 85        # Sleep quality + rest days
  vitality_index: 7.8       # Weighted: sleep*0.4 + energy*0.4 + exercise*0.2
  wellness_streak: 12       # Days meeting health goals
```

### Native Tool: Calculate Compound Metrics

```bash
#!/bin/bash
# calculate-compound-metrics.sh — Calculate compound metrics for a customer

user_name=$(cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "default")
date_str=$(date +%d-%m-%y)
date_iso=$(date +%Y-%m-%d)

# 1. Calculate focus streak
calculate_focus_streak() {
  local current_streak=0
  local check_date=$(date +%Y-%m-%d)
  
  for i in {0..30}; do
    local file_date=$(date -v-${i}d +%d-%m-%y 2>/dev/null || date -d "${i} days ago" +%d-%m-%y)
    local year=$(date -v-${i}d +%Y 2>/dev/null || date -d "${i} days ago" +%Y)
    local month=$(date -v-${i}d +%m 2>/dev/null || date -d "${i} days ago" +%m)
    
    local entry_file="~/.openclaw/customers/$user_name/floreo/domains/work/$year/$month/$file_date.md"
    
    if [ -f "$entry_file" ]; then
      local deep_work=$(grep "deep_work:" "$entry_file" | sed 's/.*deep_work://' | tr -d ' ')
      if [ -n "$deep_work" ] && [ "$deep_work" -ge 3 ] 2>/dev/null; then
        current_streak=$((current_streak + 1))
      else
        break
      fi
    else
      break
    fi
  done
  
  echo "$current_streak"
}

# 2. Calculate weekly rolling sum
calculate_weekly_output() {
  local total=0
  
  for i in {0..6}; do
    local file_date=$(date -v-${i}d +%d-%m-%y 2>/dev/null || date -d "${i} days ago" +%d-%m-%y)
    local year=$(date -v-${i}d +%Y 2>/dev/null || date -d "${i} days ago" +%Y)
    local month=$(date -v-${i}d +%m 2>/dev/null || date -d "${i} days ago" +%m)
    
    local entry_file="~/.openclaw/customers/$user_name/floreo/domains/work/$year/$month/$file_date.md"
    
    if [ -f "$entry_file" ]; then
      local commits=$(grep "commits:" "$entry_file" | sed 's/.*commits://' | tr -d ' ')
      total=$((total + ${commits:-0}))
    fi
  done
  
  echo "$total"
}

# 3. Calculate velocity trend (vs previous week)
calculate_velocity_trend() {
  local this_week=$(calculate_weekly_output)
  
  local last_week_total=0
  for i in {7..13}; do
    local file_date=$(date -v-${i}d +%d-%m-%y 2>/dev/null || date -d "${i} days ago" +%d-%m-%y)
    local year=$(date -v-${i}d +%Y 2>/dev/null || date -d "${i} days ago" +%Y)
    local month=$(date -v-${i}d +%m 2>/dev/null || date -d "${i} days ago" +%m)
    
    local entry_file="~/.openclaw/customers/$user_name/floreo/domains/work/$year/$month/$file_date.md"
    
    if [ -f "$entry_file" ]; then
      local commits=$(grep "commits:" "$entry_file" | sed 's/.*commits://' | tr -d ' ')
      last_week_total=$((last_week_total + ${commits:-0}))
    fi
  done
  
  if [ $last_week_total -gt 0 ]; then
    local trend=$(echo "scale=2; $this_week / $last_week_total" | bc)
    echo "$trend"
  else
    echo "1.0"
  fi
}

# Run calculations
echo "Focus Streak: $(calculate_focus_streak) days"
echo "Weekly Output: $(calculate_weekly_output) commits"
echo "Velocity Trend: $(calculate_velocity_trend)x"
```

---

## 🔗 Cross-Domain Correlation Analysis

Discover hidden patterns between your work, health, learning, relationships, and creativity.

### Correlation Methodology

```bash
#!/bin/bash
# correlation-analysis.sh — Find patterns across domains

user_name=$(cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "default")
days_back=30

echo "🔍 Cross-Domain Correlation Analysis"
echo "====================================="
echo "Analyzing last $days_back days..."
echo ""

# Collect data points
declare -A work_output
declare -A health_energy
declare -A exercise_days
declare -A sleep_quality

# 1. Gather work metrics
for i in $(seq 0 $days_back); do
  file_date=$(date -v-${i}d +%d-%m-%y 2>/dev/null || date -d "${i} days ago" +%d-%m-%y)
  year=$(date -v-${i}d +%Y 2>/dev/null || date -d "${i} days ago" +%Y)
  month=$(date -v-${i}d +%m 2>/dev/null || date -d "${i} days ago" +%m)
  
  work_file="~/.openclaw/customers/$user_name/floreo/domains/work/$year/$month/$file_date.md"
  if [ -f "$work_file" ]; then
    commits=$(grep "commits:" "$work_file" 2>/dev/null | sed 's/.*commits://' | tr -d ' ')
    deep_work=$(grep "deep_work:" "$work_file" 2>/dev/null | sed 's/.*deep_work://' | tr -d ' ')
    work_output[$i]=$(( ${commits:-0} + ${deep_work:-0} * 2 ))
  else
    work_output[$i]=0
  fi
done

# 2. Gather health metrics
for i in $(seq 0 $days_back); do
  file_date=$(date -v-${i}d +%d-%m-%y 2>/dev/null || date -d "${i} days ago" +%d-%m-%y)
  year=$(date -v-${i}d +%Y 2>/dev/null || date -d "${i} days ago" +%Y)
  month=$(date -v-${i}d +%m 2>/dev/null || date -d "${i} days ago" +%m)
  
  health_file="~/.openclaw/customers/$user_name/floreo/domains/health/$year/$month/$file_date.md"
  if [ -f "$health_file" ]; then
    energy=$(grep "energy_level:" "$health_file" 2>/dev/null | sed 's/.*energy_level://' | tr -d ' ')
    exercise=$(grep "exercise:" "$health_file" 2>/dev/null | grep -o '[0-9]*')
    sleep=$(grep "sleep_hours:" "$health_file" 2>/dev/null | sed 's/.*sleep_hours://' | tr -d ' ')
    
    health_energy[$i]=${energy:-0}
    exercise_days[$i]=$([ -n "$exercise" ] && [ "$exercise" -gt 0 ] && echo 1 || echo 0)
    sleep_quality[$i]=${sleep:-0}
  else
    health_energy[$i]=0
    exercise_days[$i]=0
    sleep_quality[$i]=0
  fi
done

# 3. Calculate correlations
echo "📊 CORRELATION FINDINGS"
echo ""

# Work output on exercise days vs non-exercise days
exercise_work_total=0
exercise_days_count=0
no_exercise_work_total=0
no_exercise_days_count=0

for i in $(seq 0 $days_back); do
  if [ "${exercise_days[$i]}" -eq 1 ]; then
    exercise_work_total=$((exercise_work_total + ${work_output[$i]}))
    exercise_days_count=$((exercise_days_count + 1))
  else
    no_exercise_work_total=$((no_exercise_work_total + ${work_output[$i]}))
    no_exercise_days_count=$((no_exercise_days_count + 1))
  fi
done

if [ $exercise_days_count -gt 0 ] && [ $no_exercise_days_count -gt 0 ]; then
  exercise_avg=$(echo "scale=1; $exercise_work_total / $exercise_days_count" | bc)
  no_exercise_avg=$(echo "scale=1; $no_exercise_work_total / $no_exercise_days_count" | bc)
  
  if [ $no_exercise_avg -gt 0 ]; then
    improvement=$(echo "scale=0; (($exercise_avg - $no_exercise_avg) / $no_exercise_avg) * 100" | bc)
    echo "💪 Exercise → Productivity"
    echo "   Days WITH exercise: $exercise_avg output avg"
    echo "   Days WITHOUT exercise: $no_exercise_avg output avg"
    echo "   → ${improvement}% more productive on exercise days"
    echo ""
  fi
fi

# Energy correlation with work output
high_energy_days=0
high_energy_work=0
low_energy_days=0
low_energy_work=0

for i in $(seq 0 $days_back); do
  if [ "${health_energy[$i]}" -ge 7 ] 2>/dev/null; then
    high_energy_days=$((high_energy_days + 1))
    high_energy_work=$((high_energy_work + ${work_output[$i]}))
  elif [ "${health_energy[$i]}" -gt 0 ] 2>/dev/null; then
    low_energy_days=$((low_energy_days + 1))
    low_energy_work=$((low_energy_work + ${work_output[$i]}))
  fi
done

if [ $high_energy_days -gt 0 ] && [ $low_energy_days -gt 0 ]; then
  high_avg=$(echo "scale=1; $high_energy_work / $high_energy_days" | bc)
  low_avg=$(echo "scale=1; $low_energy_work / $low_energy_days" | bc)
  
  echo "⚡ Energy Level → Output"
  echo "   High energy days (7+): $high_avg output avg"
  echo "   Low energy days (<7): $low_avg output avg"
  echo ""
fi

# Sleep correlation
well_rested_days=0
well_rested_work=0
tired_days=0
tired_work=0

for i in $(seq 0 $days_back); do
  sleep_val=$(echo "${sleep_quality[$i]}" | cut -d. -f1)
  if [ "$sleep_val" -ge 7 ] 2>/dev/null; then
    well_rested_days=$((well_rested_days + 1))
    well_rested_work=$((well_rested_work + ${work_output[$i]}))
  elif [ "$sleep_val" -gt 0 ] 2>/dev/null; then
    tired_days=$((tired_days + 1))
    tired_work=$((tired_work + ${work_output[$i]}))
  fi
done

if [ $well_rested_days -gt 0 ] && [ $tired_days -gt 0 ]; then
  rested_avg=$(echo "scale=1; $well_rested_work / $well_rested_days" | bc)
  tired_avg=$(echo "scale=1; $tired_work / $tired_days" | bc)
  
  echo "😴 Sleep Quality → Performance"
  echo "   7+ hours sleep: $rested_avg output avg"
  echo "   <7 hours sleep: $tired_avg output avg"
  echo ""
fi

echo "✅ Analysis complete"
```

### Using OpenClaw Native Tools for Correlation

```markdown
Run shell command: ~/.openclaw/customers/{user_name}/floreo/scripts/correlation-analysis.sh

Read the correlation report and present findings:
"Based on your last 30 days:
- You're 40% more productive on days you exercise
- High energy days correlate with 2x more deep work
- 7+ hours sleep → 35% better output

💡 RECOMMENDATION: Prioritize morning exercise to compound work productivity"
```

---

## 💡 Automated Insight Generation

Generate recommendations based on your patterns — all using native OpenClaw tools you run manually.

> **Note**: Run manually or schedule via cron/heartbeat. Autonomous watchers available via opt-in configuration.

### Insight Engine (Native Tools Only)

```bash
#!/bin/bash
# insight-engine.sh — Generate personalized recommendations

user_name=$(cat ~/.openclaw/customers/.floreo-user 2>/dev/null || echo "default")
insight_file="~/.openclaw/customers/$user_name/floreo/insights/$(date +%Y-%m-%d)-insights.md"

{
echo "# 🧠 Floreo Insights — $(date +%B\ %d,\ %Y)"
echo ""
echo "Generated by analyzing your last 30 days of entries."
echo ""

# Find optimal work patterns
echo "## 🎯 Optimal Work Patterns"
echo ""

# Check day-of-week patterns
declare -A dow_output
declare -A dow_count

for i in {0..30}; do
  file_date=$(date -v-${i}d +%d-%m-%y 2>/dev/null || date -d "${i} days ago" +%d-%m-%y)
  dow=$(date -v-${i}d +%u 2>/dev/null || date -d "${i} days ago" +%u)
  year=$(date -v-${i}d +%Y 2>/dev/null || date -d "${i} days ago" +%Y)
  month=$(date -v-${i}d +%m 2>/dev/null || date -d "${i} days ago" +%m)
  
  work_file="~/.openclaw/customers/$user_name/floreo/domains/work/$year/$month/$file_date.md"
  
  if [ -f "$work_file" ]; then
    commits=$(grep "commits:" "$work_file" 2>/dev/null | sed 's/.*commits://' | tr -d ' ')
    output=${commits:-0}
    dow_output[$dow]=$((${dow_output[$dow]:-0} + output))
    dow_count[$dow]=$((${dow_count[$dow]:-0} + 1))
  fi
done

# Find best day
best_dow=1
best_avg=0
for dow in 1 2 3 4 5 6 7; do
  if [ ${dow_count[$dow]:-0} -gt 0 ]; then
    avg=$(echo "scale=1; ${dow_output[$dow]} / ${dow_count[$dow]}" | bc)
    if [ $(echo "$avg > $best_avg" | bc) -eq 1 ]; then
      best_avg=$avg
      best_dow=$dow
    fi
  fi
done

dow_names=("" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday")
echo "**Best work day:** ${dow_names[$best_dow]} (avg ${best_avg} commits)"
echo ""

# Detect blockers
echo "## ⚠️ Blockers & Friction"
echo ""
blocker_count=$(grep -r "blocked\|stuck\|waiting" ~/.openclaw/customers/$user_name/floreo/domains/work --include="*.md" 2>/dev/null | wc -l)
if [ $blocker_count -gt 5 ]; then
  echo "- You mentioned blockers $blocker_count times in the last month"
  echo "- Consider: Morning standups, async communication, or pairing sessions"
fi
echo ""

# Learning momentum
echo "## 📚 Learning Momentum"
echo ""
learn_count=$(find ~/.openclaw/customers/$user_name/floreo/domains/learn -name "*.md" -mtime -30 2>/dev/null | wc -l)
if [ $learn_count -lt 5 ]; then
  echo "- Only $learn_count learning entries in 30 days"
  echo "- 💡 TIP: Schedule 30min learning blocks on ${dow_names[$best_dow]} mornings"
else
  echo "- Strong learning habit: $learn_count entries in 30 days 🎉"
fi
echo ""

# Relationship check
echo "## 🤝 Relationship Health"
echo ""
relate_count=$(find ~/.openclaw/customers/$user_name/floreo/domains/relate -name "*.md" -mtime -30 2>/dev/null | wc -l)
if [ $relate_count -lt 3 ]; then
  echo "- Only $relate_count social entries — consider reaching out this week"
else
  echo "- Good social investment: $relate_count meaningful interactions"
fi
echo ""

# Compound recommendation
echo "## 🚀 Compound Recommendation"
echo ""
echo "Based on your patterns, focus on this ONE thing this week:"
echo ""

# Pick top recommendation
if [ $blocker_count -gt 5 ]; then
  echo "

…(truncated)
