Files
memex/projects/org-skill-memex/org-agent-memex-zettlekasten/install.sh

110 lines
5.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
# Load .env if it exists, otherwise use defaults
if [ -f ".env" ]; then
source .env
else
echo "Creating .env from .env.example..."
cp .env.example .env
source .env
fi
echo "Creating directory structure..."
# Ensure MEMEX_DIR is available, fallback if not set
MEMEX_DIR="${MEMEX_DIR:-memex}"
mkdir -p "$MEMEX_DIR/0_inbox" "$MEMEX_DAILY" "$MEMEX_NOTES" "$MEMEX_DRAFTS" "$MEMEX_PUBLISHED" "$MEMEX_PROJECTS" "$MEMEX_AREAS" "$MEMEX_RESOURCES" "$MEMEX_ARCHIVES" "$MEMEX_SYSTEM/skills" "$MEMEX_ATTACHMENTS"
echo "Generating directory README.org files..."
DATE=$(date +"[%Y-%m-%d %a]")
create_readme() {
local dir=$1
local title=$2
local desc=$3
cat <<EOF > "$dir/README.org"
#+TITLE: $title
#+AUTHOR: User
#+CREATED: $DATE
#+BEGIN_COMMENT
$desc
#+END_COMMENT
* $title
$desc
EOF
}
create_readme "$MEMEX_DIR/0_inbox" "0_inbox: The Capture Point" "Temporary holding area for raw captures, links, and quick thoughts before they are processed into actionable items (GTD) or knowledge (Atomic Notes (Zettelkasten))."
create_readme "$MEMEX_DAILY" "1_daily: The Immutable Log" "Chronological daily logs (YYYY-MM-DD.org) serving as the primary capture location for fleeting notes and daily events. These are immutable records."
create_readme "$MEMEX_NOTES" "2_notes: The Atomic Notes (Zettelkasten)" "Evergreen, atomic notes. Each file represents a single concept, is heavily interlinked, and uses snake_case filenames without dates."
create_readme "$MEMEX_DRAFTS" "3_drafts: Works in Progress" "Long-form writing, essays, or articles actively being synthesized from the atomic notes."
create_readme "$MEMEX_PUBLISHED" "4_published: Final Outputs" "Completed, finalized works and static snapshots of published material."
create_readme "$MEMEX_PROJECTS" "5_projects: Active Projects" "Active, time-bound efforts with a clear definition of done. Each project has its own dedicated folder for specifications and artifacts."
create_readme "$MEMEX_AREAS" "6_areas: Spheres of Responsibility" "Ongoing areas of life and work with a standard to be maintained over time (e.g., Health, Finances, Operations)."
create_readme "$MEMEX_RESOURCES" "7_resources: Reference Material" "Topics of ongoing interest, external reference material, raw literature notes, and useful information."
create_readme "$MEMEX_ARCHIVES" "8_archives: Cold Storage" "Inactive items from other categories, including completed projects, abandoned areas, or deprecated resources."
create_readme "$MEMEX_SYSTEM" "9_system: Memex Administration" "System configuration, AI agent skills, org-mode templates, cron states, and tracking scripts."
echo "Generating root Master Memex README.org..."
cat <<EOF > "$MEMEX_DIR/README.org"
#+TITLE: The Master Memex
#+AUTHOR: User
#+CREATED: $DATE
#+BEGIN_COMMENT
The central hub and map of content for this personal intelligence organization.
#+END_COMMENT
* 🧠 The Master Memex
This is the central hub for our knowledge management system, synthesizing three core methodologies:
- *Atomic Notes (Zettelkasten):* For evergreen, interlinked, atomic knowledge.
- *GTD (Getting Things Done):* For actionable task tracking and project execution.
- *PARA:* For high-level directory organization (Projects, Areas, Resources, Archives).
* The Architecture
Our workspace is strictly divided into these functional zones:
- [[file:0_inbox/README.org][0_inbox]]: The zero-friction capture point for raw thoughts and tasks.
- [[file:1_daily/README.org][1_daily]]: Immutable chronological logs and fleeting notes (YYYY-MM-DD.org).
- [[file:2_notes/README.org][2_notes]]: The Atomic Notes (Zettelkasten). Atomic, concept-based, interlinked notes.
- [[file:3_drafts/README.org][3_drafts]]: Works in progress, essays, and active synthesis.
- [[file:4_published/README.org][4_published]]: Final outputs and static snapshots of completed work.
- [[file:5_projects/README.org][5_projects]]: Active, time-bound efforts with a clear definition of done.
- [[file:6_areas/README.org][6_areas]]: Ongoing spheres of responsibility (e.g., Health, Finances).
- [[file:7_resources/README.org][7_resources]]: External reference material and raw literature notes.
- [[file:8_archives/README.org][8_archives]]: Cold storage for completed projects and inactive items.
- [[file:9_system/README.org][9_system]]: System configuration, AI skills, and automation scripts.
* Core Workflows
** 1. Capture (Anytime)
Everything enters the system via \`0_inbox\` or as a Fleeting Note in \`1_daily\`. Zero friction, no filtering.
** 2. Nightly Distillation (The Scribe)
An automated AI sub-agent reads the daily captures and extracts conceptual thoughts into evergreen, atomic notes in \`2_notes\`, leaving the original daily logs untouched.
** 3. Weekly Maintenance
Review active projects, clarify inbox items into actionable GTD tasks, and explore the Atomic Notes (Zettelkasten) graph to merge concepts and forge new connections.
EOF
# Touch inbox
touch "$MEMEX_INBOX"
# Initialize distillation state if not present
STATE_FILE="$MEMEX_SYSTEM/distillation-state.json"
if [ ! -f "$STATE_FILE" ]; then
echo "Initializing $STATE_FILE..."
# Get current git commit or use a placeholder
HASH=$(git rev-parse HEAD 2>/dev/null || echo "INITIAL_HASH")
echo "{
\"lastProcessedCommit\": \"$HASH\"
}" > "$STATE_FILE"
fi
echo "Installation complete."
echo "1. Add the contents of init-atomic-notes.el to your Emacs config."
echo "2. Add openclaw-scribe-skill.org to your \$MEMEX_SYSTEM/skills/ directory."
echo "3. Ask your OpenClaw agent to schedule the Scribe job."