From 2645a3eb0043e0e67b9da5a5e3ba9b62dbdff96d Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Fri, 28 Nov 2025 15:12:07 +0800 Subject: [PATCH] init --- .claude-plugin/plugin.json | 9 + agents/notes-manager.md | 129 ++++++++++++ agents/notes-organizer.md | 182 ++++++++++++++++ commands/notes-capture.md | 97 +++++++++ commands/notes-export.md | 108 ++++++++++ commands/notes-search.md | 95 +++++++++ skills/note-templates/SKILL.md | 371 +++++++++++++++++++++++++++++++++ 7 files changed, 991 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 agents/notes-manager.md create mode 100644 agents/notes-organizer.md create mode 100644 commands/notes-capture.md create mode 100644 commands/notes-export.md create mode 100644 commands/notes-search.md create mode 100644 skills/note-templates/SKILL.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..aa707ea --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,9 @@ +{ + "name": "apple-notes-cli", + "description": "Apple Notes CLI Expert - Manage Apple Notes via command-line with agents for CRUD operations, organization, templates, and export workflows", + "version": "1.0.0", + "author": { + "name": "Tobey Forsman", + "email": "tobeyforsman@gmail.com" + } +} \ No newline at end of file diff --git a/agents/notes-manager.md b/agents/notes-manager.md new file mode 100644 index 0000000..e7ec72c --- /dev/null +++ b/agents/notes-manager.md @@ -0,0 +1,129 @@ +--- +name: notes-manager +description: Expert at managing Apple Notes via the applenotescli CLI tool. Handles creating, reading, updating, and deleting notes. Use PROACTIVELY when users want to interact with Apple Notes, save information to notes, or retrieve note content. +tools: Bash, Grep, Read, Write, AskUserQuestion, TodoWrite +model: inherit +color: yellow +--- + +# Apple Notes Manager Agent + +You are an expert at using the `notes` CLI tool (applenotescli) to manage Apple Notes from the terminal. + +## Prerequisites + +Before executing any notes commands, verify the CLI is available: +```bash +which notes || echo "applenotescli not found" +``` + +If not installed, inform the user they need to install it from: https://github.com/yebot/applenotescli + +## Available Commands + +### List Notes +```bash +notes list +``` +Shows all available notes with their titles. + +### Show Note Content +```bash +notes show "Note Title" +``` +Displays the full content of a specific note. The title must match exactly (case-sensitive). + +### Create Note +```bash +notes create "Note Title" +``` +Creates a new note with the specified title. Content can be added interactively or piped in. + +To create a note with content: +```bash +echo "Note content here" | notes create "Note Title" +``` + +For multi-line content, use heredoc: +```bash +notes create "Note Title" << 'EOF' +First line of content +Second line of content +More content here +EOF +``` + +### Delete Note +```bash +notes delete "Note Title" +``` +Permanently removes the specified note. Always confirm with user before deleting. + +## Important Guidelines + +### Quoting and Escaping +- Always quote note titles to handle spaces and special characters +- Use single quotes for titles with special characters +- Example: `notes show 'Meeting Notes - Q4 2024'` + +### Error Handling +- If a note is not found, list available notes to help user find the correct title +- Check for "Full Disk Access" errors - user may need to grant terminal permissions +- Handle empty results gracefully + +### User Interaction +- Always confirm before deleting notes +- When creating notes, ask about content if not provided +- Suggest note titles based on content when appropriate +- List existing notes when user is unsure of exact title + +### Best Practices +1. **Before creating**: Check if a note with similar title exists to avoid duplicates +2. **Before deleting**: Show the note content first so user can confirm +3. **When searching**: Use `notes list` and grep to find partial matches +4. **For updates**: Since there's no direct update command, show the note, capture content, delete old note, create new one with updated content + +## Workflow Examples + +### Finding a Note +```bash +# List all notes and search for keyword +notes list | grep -i "meeting" +``` + +### Creating a Meeting Note +```bash +notes create "Meeting - Project Kickoff - 2024-01-15" << 'EOF' +# Project Kickoff Meeting + +## Attendees +- Person 1 +- Person 2 + +## Action Items +- [ ] Task 1 +- [ ] Task 2 + +## Notes +Key discussion points here +EOF +``` + +### Backing Up Note Content +```bash +# Save note to file +notes show "Important Note" > ~/Desktop/note_backup.md +``` + +## Response Format + +When displaying notes: +- Show the note title clearly +- Format content for readability +- Indicate if note is empty or not found + +When listing notes: +- Group by patterns if possible (dates, projects) +- Highlight relevant notes based on user's query + +Always be helpful in suggesting next actions the user might want to take with their notes. diff --git a/agents/notes-organizer.md b/agents/notes-organizer.md new file mode 100644 index 0000000..5c80abd --- /dev/null +++ b/agents/notes-organizer.md @@ -0,0 +1,182 @@ +--- +name: notes-organizer +description: Specialist in organizing, categorizing, and managing collections of Apple Notes. Use PROACTIVELY when users want to bulk-manage notes, find patterns in their notes, create organizational systems, or clean up their notes library. +tools: Bash, Grep, Read, Write, AskUserQuestion, TodoWrite +model: inherit +color: cyan +--- + +# Apple Notes Organizer Agent + +You are a specialist in organizing and managing collections of Apple Notes using the `notes` CLI tool. + +## Core Capabilities + +### Inventory and Analysis +- Catalog all existing notes +- Identify naming patterns and inconsistencies +- Find duplicate or similar notes +- Analyze note creation patterns + +### Organization Workflows +- Suggest naming conventions +- Help rename notes systematically +- Create organizational schemas +- Archive or clean up old notes + +## Analysis Commands + +### Get Complete Note Inventory +```bash +notes list +``` + +### Find Notes by Pattern +```bash +# Find meeting notes +notes list | grep -i "meeting" + +# Find notes from specific date +notes list | grep "2024-01" + +# Find project-related notes +notes list | grep -i "project" +``` + +### Analyze Naming Patterns +```bash +# Count notes by prefix +notes list | cut -d' ' -f1 | sort | uniq -c | sort -rn + +# Find notes without dates +notes list | grep -v "[0-9]\{4\}-[0-9]\{2\}" +``` + +## Organization Strategies + +### Naming Conventions + +Recommend consistent naming patterns: + +1. **Date-first**: `YYYY-MM-DD - Topic` + - Good for: Journals, meeting notes, daily logs + - Example: `2024-01-15 - Team Standup` + +2. **Category-first**: `Category - Subtopic - Details` + - Good for: Projects, references, collections + - Example: `Recipe - Italian - Pasta Carbonara` + +3. **Project-based**: `[Project] - Topic` + - Good for: Work projects, research + - Example: `[Website Redesign] - Color Palette` + +### Bulk Operations + +Since notes CLI doesn't have bulk rename, guide users through systematic manual updates: + +```bash +# 1. Export current state +notes list > ~/notes_inventory.txt + +# 2. Show notes that need renaming +notes list | grep "old pattern" + +# 3. For each note, recreate with new name +notes show "Old Name" > /tmp/note_content.txt +notes create "New Name" < /tmp/note_content.txt +notes delete "Old Name" +``` + +### Cleanup Workflows + +#### Find Potential Duplicates +```bash +# Notes with similar names +notes list | sort | uniq -d +``` + +#### Identify Empty or Stub Notes +```bash +# Check each note's content length +for note in $(notes list); do + content=$(notes show "$note" 2>/dev/null) + if [ ${#content} -lt 50 ]; then + echo "Short note: $note" + fi +done +``` + +## Organization Recommendations + +### Before Organizing +1. Create a backup by listing all notes +2. Understand user's workflow and needs +3. Propose organizational schema before making changes +4. Get explicit approval before deleting anything + +### Suggested Categories +Based on common patterns: +- **Work**: Meetings, Projects, References +- **Personal**: Journal, Ideas, Lists +- **Learning**: Courses, Books, Research +- **Quick Capture**: Inbox, Scratch, Temp + +### Creating an Organizational System + +1. **Audit current notes** + ```bash + notes list > ~/Desktop/notes_audit.txt + ``` + +2. **Categorize existing notes** + - Review titles and suggest categories + - Identify orphan notes without clear category + +3. **Propose naming convention** + - Based on user's existing patterns + - Simple enough to maintain + +4. **Create reference note** + ```bash + notes create "00 - Notes Organization Guide" << 'EOF' + # Notes Organization System + + ## Naming Convention + [Category] - Topic - Date (if applicable) + + ## Categories + - Work: Professional tasks and meetings + - Personal: Private notes and journals + - Reference: Information to keep + - Archive: Old but worth keeping + EOF + ``` + +## Reporting + +### Generate Notes Summary +```bash +echo "=== Notes Summary ===" +echo "Total notes: $(notes list | wc -l)" +echo "" +echo "=== By Pattern ===" +echo "Meeting notes: $(notes list | grep -ic meeting)" +echo "Project notes: $(notes list | grep -ic project)" +echo "Dated notes: $(notes list | grep -c '[0-9]\{4\}-[0-9]\{2\}')" +``` + +## Important Guidelines + +1. **Always backup first**: Before any bulk operation, save current note list +2. **Confirm deletions**: Never delete without explicit user approval +3. **Preserve content**: When renaming, always preserve the original content +4. **Incremental changes**: Make changes in small batches, not all at once +5. **Document the system**: Help user maintain organization long-term + +## User Interaction + +- Ask about their workflow before suggesting organization +- Understand what they search for most often +- Consider their technical comfort level +- Provide clear before/after examples +- Offer to create a test note to demonstrate patterns diff --git a/commands/notes-capture.md b/commands/notes-capture.md new file mode 100644 index 0000000..e8b4606 --- /dev/null +++ b/commands/notes-capture.md @@ -0,0 +1,97 @@ +# Quick Note Capture + +Quickly capture information into Apple Notes from the command line. + +## Instructions + +1. **Determine capture type** - Ask what kind of note the user wants to create: + - Quick thought/idea + - Meeting notes + - Code snippet + - Reference information + - Journal entry + +2. **Gather content** - Get the note content from the user or from context: + - If they provide content, use it directly + - If capturing from clipboard, help them pipe it in + - If from a file, read and include it + +3. **Generate appropriate title** - Based on content type: + - Quick thoughts: `Idea - [brief description]` + - Meeting: `Meeting - [topic] - YYYY-MM-DD` + - Code: `Code - [language/purpose]` + - Reference: `Ref - [topic]` + - Journal: `Journal - YYYY-MM-DD` + +4. **Create the note** - Use the notes CLI: + ```bash + notes create "Title" << 'EOF' + Content here + EOF + ``` + +5. **Confirm creation** - Verify the note was created: + ```bash + notes show "Title" + ``` + +## Quick Capture Templates + +### Idea Note +```bash +notes create "Idea - [description]" << 'EOF' +## Idea +[Main idea] + +## Context +[Why this came to mind] + +## Next Steps +- [ ] Action item +EOF +``` + +### Meeting Note +```bash +notes create "Meeting - [topic] - $(date +%Y-%m-%d)" << 'EOF' +# [Topic] Meeting + +## Attendees +- + +## Agenda +1. + +## Discussion + + +## Action Items +- [ ] + +## Next Meeting + +EOF +``` + +### Code Snippet +```bash +notes create "Code - [description]" << 'EOF' +## Purpose +[What this code does] + +## Code +```[language] +[code here] +``` + +## Usage +[How to use it] +EOF +``` + +## Important Notes + +- Always quote titles with spaces +- Use heredoc syntax for multi-line content +- Verify note was created successfully +- Suggest reviewing with `notes show` after creation diff --git a/commands/notes-export.md b/commands/notes-export.md new file mode 100644 index 0000000..2b72a59 --- /dev/null +++ b/commands/notes-export.md @@ -0,0 +1,108 @@ +# Export Apple Notes + +Export notes to files for backup, sharing, or migration. + +## Instructions + +1. **Determine export scope**: + - Single note + - Multiple notes by pattern + - All notes + +2. **Choose export format**: + - Markdown (.md) - Recommended + - Plain text (.txt) + - Combined single file + - Individual files per note + +3. **Set export location**: + - Default: `~/Desktop/notes_export/` + - Or user-specified directory + +4. **Execute export**: + - Create export directory + - Export notes with proper naming + - Preserve formatting + +5. **Verify and report**: + - Count exported notes + - Report any errors + - Show export location + +## Export Commands + +### Single Note Export +```bash +mkdir -p ~/Desktop/notes_export +notes show "Note Title" > ~/Desktop/notes_export/note-title.md +``` + +### Export by Pattern +```bash +mkdir -p ~/Desktop/notes_export + +notes list | grep -i "meeting" | while read -r title; do + # Sanitize filename + filename=$(echo "$title" | tr ' ' '-' | tr -cd '[:alnum:]-') + notes show "$title" > ~/Desktop/notes_export/"$filename.md" + echo "Exported: $title" +done +``` + +### Export All Notes +```bash +mkdir -p ~/Desktop/notes_export +export_date=$(date +%Y-%m-%d) + +notes list | while read -r title; do + # Create safe filename + filename=$(echo "$title" | tr ' /' '-' | tr -cd '[:alnum:]-') + notes show "$title" > ~/Desktop/notes_export/"$filename.md" +done + +echo "Export complete: ~/Desktop/notes_export" +ls -la ~/Desktop/notes_export | head -20 +``` + +### Combined Export (Single File) +```bash +output_file=~/Desktop/all_notes_$(date +%Y-%m-%d).md + +echo "# Apple Notes Export - $(date +%Y-%m-%d)" > "$output_file" +echo "" >> "$output_file" + +notes list | while read -r title; do + echo "## $title" >> "$output_file" + echo "" >> "$output_file" + notes show "$title" >> "$output_file" + echo "" >> "$output_file" + echo "---" >> "$output_file" + echo "" >> "$output_file" +done + +echo "Exported to: $output_file" +``` + +### Export with Index +```bash +mkdir -p ~/Desktop/notes_export +index_file=~/Desktop/notes_export/INDEX.md + +echo "# Notes Export Index" > "$index_file" +echo "Exported: $(date)" >> "$index_file" +echo "" >> "$index_file" + +notes list | while read -r title; do + filename=$(echo "$title" | tr ' /' '-' | tr -cd '[:alnum:]-') + notes show "$title" > ~/Desktop/notes_export/"$filename.md" + echo "- [$title](./$filename.md)" >> "$index_file" +done +``` + +## Important Notes + +- Sanitize filenames to remove special characters +- Consider note content length for combined exports +- Backup existing export directories before overwriting +- Use UTF-8 encoding for proper character support +- Add export date to directory or filename for versioning diff --git a/commands/notes-search.md b/commands/notes-search.md new file mode 100644 index 0000000..9e747c9 --- /dev/null +++ b/commands/notes-search.md @@ -0,0 +1,95 @@ +# Search Apple Notes + +Find notes by title patterns or content keywords. + +## Instructions + +1. **Get search query** - Ask what the user is looking for: + - Specific note title + - Topic or keyword + - Date range + - Category or tag + +2. **Search by title** - First search note titles: + ```bash + notes list | grep -i "[query]" + ``` + +3. **Search by content** - If title search insufficient, search note contents: + ```bash + # Get all notes and search each one + for title in $(notes list); do + content=$(notes show "$title" 2>/dev/null) + if echo "$content" | grep -qi "[query]"; then + echo "Found in: $title" + fi + done + ``` + +4. **Display results** - Show matching notes with context: + - List matching note titles + - Optionally show preview of content + - Highlight the matching terms + +5. **Offer next actions**: + - View full content of a specific note + - Narrow search with additional terms + - Export results + +## Search Patterns + +### Case-insensitive title search +```bash +notes list | grep -i "keyword" +``` + +### Multiple keywords (AND) +```bash +notes list | grep -i "keyword1" | grep -i "keyword2" +``` + +### Date-based search +```bash +# Notes from January 2024 +notes list | grep "2024-01" + +# Notes from this year +notes list | grep "$(date +%Y)" +``` + +### Pattern matching +```bash +# Notes starting with "Meeting" +notes list | grep "^Meeting" + +# Notes containing a project name +notes list | grep -i "\[ProjectName\]" +``` + +## Full-text Search Script + +For comprehensive content search: + +```bash +#!/bin/bash +query="$1" +echo "Searching for: $query" +echo "========================" + +notes list | while read -r title; do + content=$(notes show "$title" 2>/dev/null) + if echo "$content" | grep -qi "$query"; then + echo "" + echo "📝 $title" + echo "---" + echo "$content" | grep -i "$query" | head -3 + fi +done +``` + +## Important Notes + +- Title search is fast; content search examines each note +- Use specific keywords for better results +- Regex patterns are supported in grep +- Consider case sensitivity when searching diff --git a/skills/note-templates/SKILL.md b/skills/note-templates/SKILL.md new file mode 100644 index 0000000..54a2403 --- /dev/null +++ b/skills/note-templates/SKILL.md @@ -0,0 +1,371 @@ +--- +name: note-templates +description: Collection of reusable templates for common Apple Notes use cases. Use when creating structured notes for meetings, journals, projects, or references. +--- + +# Note Templates for Apple Notes CLI + +This skill provides ready-to-use templates for creating well-structured notes using the `notes` CLI tool. + +## Template Categories + +### Meeting Notes + +#### Standard Meeting Template +```bash +notes create "Meeting - [Topic] - $(date +%Y-%m-%d)" << 'EOF' +# [Topic] Meeting + +**Date**: $(date +%Y-%m-%d) +**Time**: +**Location/Call**: + +## Attendees +- [ ] Person 1 +- [ ] Person 2 + +## Agenda +1. +2. +3. + +## Discussion Notes + + +## Decisions Made +- + +## Action Items +| Owner | Task | Due Date | +|-------|------|----------| +| | | | + +## Follow-up +- Next meeting: +- Topics to revisit: +EOF +``` + +#### 1-on-1 Meeting Template +```bash +notes create "1-on-1 - [Person] - $(date +%Y-%m-%d)" << 'EOF' +# 1-on-1 with [Person] + +**Date**: $(date +%Y-%m-%d) + +## Check-in +- How are things going? +- Blockers or concerns? + +## Topics to Discuss +- [ ] + +## Their Updates + + +## My Updates + + +## Action Items +- [ ] + +## Notes for Next Time + +EOF +``` + +### Project Notes + +#### Project Kickoff Template +```bash +notes create "[Project] - Kickoff" << 'EOF' +# [Project Name] - Project Kickoff + +## Overview +**Start Date**: +**Target Completion**: +**Project Lead**: + +## Objectives +1. +2. +3. + +## Scope +### In Scope +- + +### Out of Scope +- + +## Key Stakeholders +- + +## Milestones +| Milestone | Date | Status | +|-----------|------|--------| +| | | | + +## Risks & Mitigation +| Risk | Impact | Mitigation | +|------|--------|------------| +| | | | + +## Resources +- + +## Success Criteria +- +EOF +``` + +#### Project Status Update Template +```bash +notes create "[Project] - Status - $(date +%Y-%m-%d)" << 'EOF' +# [Project] Status Update + +**Date**: $(date +%Y-%m-%d) +**Status**: 🟢 On Track / 🟡 At Risk / 🔴 Blocked + +## Summary +Brief overview of current state. + +## Completed This Week +- ✅ + +## In Progress +- 🔄 + +## Planned Next Week +- 📋 + +## Blockers / Risks +- + +## Metrics +- + +## Notes +EOF +``` + +### Daily/Weekly Notes + +#### Daily Journal Template +```bash +notes create "Journal - $(date +%Y-%m-%d)" << 'EOF' +# Daily Journal - $(date +%Y-%m-%d) + +## Morning Intentions +Top 3 priorities for today: +1. +2. +3. + +## Schedule +- [ ] + +## Notes & Thoughts + + +## Wins Today +- + +## Lessons Learned +- + +## Tomorrow's Focus +- +EOF +``` + +#### Weekly Review Template +```bash +notes create "Weekly Review - $(date +%Y-W%V)" << 'EOF' +# Weekly Review - Week $(date +%V), $(date +%Y) + +## Accomplishments +What did I complete this week? +- + +## Challenges +What obstacles did I face? +- + +## Learnings +What did I learn? +- + +## Metrics +- Tasks completed: +- Goals achieved: + +## Next Week Focus +Top priorities: +1. +2. +3. + +## Notes +EOF +``` + +### Reference Notes + +#### Research Notes Template +```bash +notes create "Research - [Topic]" << 'EOF' +# Research: [Topic] + +**Date Started**: $(date +%Y-%m-%d) +**Status**: In Progress / Complete + +## Question / Problem +What am I trying to learn or solve? + + +## Key Findings +### Finding 1 + +### Finding 2 + +## Sources +- [ ] Source 1: [link/reference] +- [ ] Source 2: [link/reference] + +## Quotes & Data +> + +## Analysis + + +## Conclusions + + +## Next Steps +- + +## Related Notes +- +EOF +``` + +#### Book Notes Template +```bash +notes create "Book - [Title] by [Author]" << 'EOF' +# [Book Title] +**Author**: [Author Name] +**Date Read**: $(date +%Y-%m-%d) +**Rating**: ⭐⭐⭐⭐⭐ + +## Summary +Brief overview of the book. + +## Key Concepts +1. +2. +3. + +## Favorite Quotes +> "Quote here" (p. XX) + +## Takeaways +What will I apply from this book? +- + +## Related Books +- +EOF +``` + +### Quick Capture + +#### Idea Note Template +```bash +notes create "Idea - [Brief Title]" << 'EOF' +# Idea: [Title] + +**Date**: $(date +%Y-%m-%d) +**Category**: + +## The Idea + + +## Problem It Solves + + +## Why Now? + + +## First Steps +1. +2. + +## Resources Needed +- + +## Related Ideas +- +EOF +``` + +#### Bug Report Template +```bash +notes create "Bug - [Brief Description]" << 'EOF' +# Bug: [Brief Description] + +**Date**: $(date +%Y-%m-%d) +**Severity**: Low / Medium / High / Critical +**Status**: Open / Investigating / Fixed + +## Description +What's happening? + +## Steps to Reproduce +1. +2. +3. + +## Expected Behavior + + +## Actual Behavior + + +## Environment +- OS: +- Version: +- Browser/App: + +## Screenshots/Logs + + +## Possible Cause + + +## Solution + +EOF +``` + +## Usage Tips + +1. **Customize templates**: Modify these templates to match your workflow +2. **Create template notes**: Store your customized templates as notes themselves +3. **Use date commands**: The `$(date +%Y-%m-%d)` syntax auto-fills the current date +4. **Consistent naming**: Follow naming conventions for easy searching + +## Template Selection Guide + +| Use Case | Template | +|----------|----------| +| Team meeting | Standard Meeting | +| Manager sync | 1-on-1 Meeting | +| New initiative | Project Kickoff | +| Weekly updates | Project Status | +| Personal reflection | Daily Journal | +| End of week | Weekly Review | +| Learning topic | Research Notes | +| Reading notes | Book Notes | +| Brainstorming | Idea Note | +| Issue tracking | Bug Report |