Init: Second Brain vault with dream-sync system
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Dream Sync Configuration
|
||||
|
||||
# Checkpoint file for tracking last dream run
|
||||
CHECKPOINT="/home/intense/clawd/.checkpoint-dream-sync.json"
|
||||
|
||||
# Vault location
|
||||
VAULT_PATH="/workspace/second-brain"
|
||||
|
||||
# Memory file to update
|
||||
MEMORY_PATH="/home/intense/clawd/MEMORY.md"
|
||||
|
||||
# Thresholds
|
||||
IDLE_THRESHOLD_MINUTES=15
|
||||
MIN_HOURS_BETWEEN_DREAMS=4
|
||||
NIGHTLY_DREAM_HOUR=23
|
||||
|
||||
# Tags for dream-synthesized content
|
||||
DREAM_TAG="[[dream-synthesized]]"
|
||||
SYNTHESIS_TAG="[[synthesized-insight]]"
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# Obsidian
|
||||
.obsidian/
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Sensitive data
|
||||
.env
|
||||
.env.local
|
||||
secrets.md
|
||||
|
||||
# Build artifacts
|
||||
node_modules/
|
||||
dist/
|
||||
build/
|
||||
@@ -0,0 +1,15 @@
|
||||
# Inbox 📬
|
||||
|
||||
Capture zone for quick ideas, links, and raw thoughts.
|
||||
These get sorted and moved to appropriate folders during dream synthesis or manual review.
|
||||
|
||||
## Unsorted Captures
|
||||
|
||||
- 2026-04-26: Second brain vault created — will integrate with extended thinking passes
|
||||
- 2026-04-26: Dream-sync system setup — nightly or on-idle synthesis of vault insights
|
||||
- 2026-04-26: Memory architecture: MEMORY.md as indexed layer over full vault
|
||||
|
||||
---
|
||||
|
||||
*Last updated by: Dream Sync*
|
||||
*Next review: Nightly or when idle*
|
||||
@@ -0,0 +1,37 @@
|
||||
# ADR: [DECISION TITLE]
|
||||
|
||||
**Date:** YYYY-MM-DD
|
||||
**Status:** Proposed | Accepted | Deprecated | Superseded
|
||||
**Affects:** [Project/Component]
|
||||
|
||||
## Context
|
||||
|
||||
What is the issue that we're seeing that motivates this decision or change?
|
||||
|
||||
## Decision
|
||||
|
||||
What is the change that we're proposing and/or doing?
|
||||
|
||||
## Rationale
|
||||
|
||||
Why is this decision the right one?
|
||||
|
||||
### Alternatives Considered
|
||||
- Alternative 1: [Why not this?]
|
||||
- Alternative 2: [Why not this?]
|
||||
|
||||
## Trade-offs
|
||||
|
||||
What are we gaining and what are we losing?
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
How will this be implemented? What needs to change?
|
||||
|
||||
## Links
|
||||
|
||||
- Related decisions:
|
||||
- References:
|
||||
|
||||
---
|
||||
Tags: #architecture #adr
|
||||
@@ -0,0 +1,28 @@
|
||||
# Daily Note - YYYY-MM-DD
|
||||
|
||||
## 📍 Today's Focus
|
||||
- [ ] Priority 1
|
||||
- [ ] Priority 2
|
||||
- [ ] Priority 3
|
||||
|
||||
## 🎯 What I'm Working On
|
||||
- Project/task
|
||||
- Project/task
|
||||
|
||||
## 💡 Ideas & Captures
|
||||
(Ideas from today go here, later moved to appropriate folder)
|
||||
|
||||
## 📚 Learnings
|
||||
(New insights, patterns, realizations)
|
||||
|
||||
## 🔗 Connections
|
||||
(How today connects to other projects or learnings)
|
||||
|
||||
## 📝 Reflection
|
||||
(End-of-day thoughts, what went well, what to improve)
|
||||
|
||||
## 📌 Next Actions
|
||||
(Tomorrow or later)
|
||||
|
||||
---
|
||||
Tags: #daily #reflection
|
||||
@@ -0,0 +1,39 @@
|
||||
# Second Brain Vault 🧠
|
||||
|
||||
A personal knowledge base and system for capturing, organizing, and synthesizing knowledge.
|
||||
|
||||
**Synced with:** Extended thinking passes (on-idle or nightly)
|
||||
**Backed by:** Git for version control and history
|
||||
**Indexed in:** MEMORY.md for fast access
|
||||
|
||||
## Structure
|
||||
|
||||
- **00-inbox/** — Raw captures, ideas, quick notes
|
||||
- **01-daily/** — Daily reflections and work logs
|
||||
- **02-projects/** — Project-specific knowledge (gravl, job-portal, finedine)
|
||||
- **03-learnings/** — Books, lessons, insights, skills
|
||||
- **04-architecture/** — System design decisions (ADRs)
|
||||
- **05-code-snippets/** — Reusable code, commands, patterns
|
||||
- **06-references/** — Links, resources, standards
|
||||
- **07-templates/** — Note templates for consistency
|
||||
- **08-connections/** — Relationship maps, team info
|
||||
- **_files/** — Images, PDFs, diagrams
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Capture:** Ideas go into 00-inbox/
|
||||
2. **Organize:** Distributed into 02-projects/, 03-learnings/, etc.
|
||||
3. **Synthesize:** Extended thinking pass (`/dream`)
|
||||
4. **Index:** Important insights → MEMORY.md
|
||||
5. **Access:** Fast lookup via indexed memory
|
||||
|
||||
## Dream Sync
|
||||
|
||||
**When:** On-idle or nightly
|
||||
**What:** Extended thinking pass over vault
|
||||
**Output:** Updated MEMORY.md + daily memory file
|
||||
**Goal:** Extract patterns, connections, actionable insights
|
||||
|
||||
---
|
||||
|
||||
Created 2026-04-26
|
||||
Executable
+160
@@ -0,0 +1,160 @@
|
||||
#!/bin/bash
|
||||
# Dream Sync: Extended thinking pass over vault
|
||||
# Reads second-brain vault, synthesizes insights, updates MEMORY.md
|
||||
# Can run: nightly, on-idle, or on-demand
|
||||
|
||||
set -e
|
||||
|
||||
# Load config
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "${SCRIPT_DIR}/.dreamrc"
|
||||
|
||||
# Create checkpoint directory if needed
|
||||
mkdir -p "$(dirname "$CHECKPOINT")"
|
||||
|
||||
# Color codes
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
log_info() {
|
||||
echo -e "${GREEN}[dream-sync]${NC} $1"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "${YELLOW}[dream-sync]${NC} $1"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "${RED}[dream-sync]${NC} $1"
|
||||
}
|
||||
|
||||
# Check if we should run
|
||||
check_should_run() {
|
||||
if [ ! -f "$CHECKPOINT" ]; then
|
||||
log_info "First run, proceeding..."
|
||||
return 0
|
||||
fi
|
||||
|
||||
local last_run=$(jq -r '.lastRun' "$CHECKPOINT" 2>/dev/null || echo "")
|
||||
if [ -z "$last_run" ]; then
|
||||
log_info "No last run recorded, proceeding..."
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Calculate time since last run (in minutes)
|
||||
local last_timestamp=$(date -d "$last_run" +%s 2>/dev/null || echo 0)
|
||||
local now=$(date +%s)
|
||||
local minutes_since=$((($now - $last_timestamp) / 60))
|
||||
|
||||
if [ $minutes_since -lt $MIN_HOURS_BETWEEN_DREAMS ]; then
|
||||
minutes_since=$((MIN_HOURS_BETWEEN_DREAMS * 60 - $minutes_since))
|
||||
log_warn "Last dream was recent, next eligible in ${minutes_since}m. Use --force to override."
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Main dream-sync process
|
||||
run_dream_sync() {
|
||||
log_info "Starting dream synthesis..."
|
||||
log_info "Reading vault from: $VAULT_PATH"
|
||||
|
||||
# Count files in vault
|
||||
local file_count=$(find "$VAULT_PATH" -type f -name "*.md" | wc -l)
|
||||
log_info "Found $file_count markdown files in vault"
|
||||
|
||||
# Create temporary synthesis file
|
||||
local synthesis_file="/tmp/dream-synthesis-$(date +%s).md"
|
||||
|
||||
cat > "$synthesis_file" << 'EOF'
|
||||
# Dream Synthesis Session
|
||||
|
||||
**Generated:** $(date -Iseconds)
|
||||
**Vault Files Scanned:** [file_count]
|
||||
|
||||
## Key Patterns Identified
|
||||
|
||||
This is where the extended thinking pass would analyze:
|
||||
- Recurring themes across projects
|
||||
- Connections between learnings
|
||||
- Architecture patterns
|
||||
- Team dynamics and lessons
|
||||
- Actionable insights from vault
|
||||
|
||||
## Vault Summary
|
||||
|
||||
### Projects Status
|
||||
(Summary of 02-projects/* status)
|
||||
|
||||
### Recent Learnings
|
||||
(Top insights from 03-learnings/*)
|
||||
|
||||
### Architecture Decisions
|
||||
(Summary of 04-architecture/*)
|
||||
|
||||
### Action Items
|
||||
(Extracted from daily notes and projects)
|
||||
|
||||
---
|
||||
|
||||
[[dream-synthesized]]
|
||||
EOF
|
||||
|
||||
log_info "Synthesis prepared: $synthesis_file"
|
||||
|
||||
# In a real implementation, we would:
|
||||
# 1. Read all vault files
|
||||
# 2. Generate extended thinking prompt
|
||||
# 3. Call Claude with /dream mode
|
||||
# 4. Parse results
|
||||
# 5. Update MEMORY.md with key insights
|
||||
|
||||
# For now, log the path
|
||||
log_info "Synthesis would be processed and indexed into MEMORY.md"
|
||||
echo "$synthesis_file"
|
||||
}
|
||||
|
||||
# Update checkpoint
|
||||
update_checkpoint() {
|
||||
local status=$1
|
||||
local result=$2
|
||||
|
||||
cat > "$CHECKPOINT" << EOF
|
||||
{
|
||||
"lastRun": "$(date -Iseconds)",
|
||||
"status": "$status",
|
||||
"result": "$result",
|
||||
"nextCheck": "$(date -Iseconds -d '+4 hours')",
|
||||
"fileCount": $(find "$VAULT_PATH" -type f -name "*.md" | wc -l)
|
||||
}
|
||||
EOF
|
||||
|
||||
log_info "Checkpoint updated: $status"
|
||||
}
|
||||
|
||||
# Main
|
||||
main() {
|
||||
local force=0
|
||||
if [ "$1" = "--force" ]; then
|
||||
force=1
|
||||
log_info "Force mode: ignoring time threshold"
|
||||
fi
|
||||
|
||||
if [ $force -eq 0 ] && ! check_should_run; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if run_dream_sync; then
|
||||
update_checkpoint "completed" "Dream synthesis completed successfully"
|
||||
log_info "Dream synthesis complete ✨"
|
||||
else
|
||||
update_checkpoint "error" "Dream synthesis failed"
|
||||
log_error "Dream synthesis failed"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user