personal claude plugins marketplace

initial commit

+1015
+34
.claude-plugin/marketplace.json
··· 1 + { 2 + "name": "plugins.accidental.cc", 3 + "owner": { 4 + "name": "Jonathan Raphaelson <jon@accidental.cc>" 5 + }, 6 + "metadata": { 7 + "description": "Tools for working with Claude as more of a co-worker, less of an agent.", 8 + "version": "1.0.0" 9 + }, 10 + "plugins": [ 11 + { 12 + "name": "coworker", 13 + "description": "Conversational pair programmer style - talks like a friendly coworker on Slack", 14 + "version": "1.0.0", 15 + "author": { 16 + "name": "Jonathan Raphaelson <jon@accidental.cc>" 17 + }, 18 + "source": "./plugins/coworker", 19 + "category": "output-styles", 20 + "tags": ["output-style", "conversational", "pair-programming"] 21 + }, 22 + { 23 + "name": "zk", 24 + "description": "Zettelkasten memory system - maintains conversation continuity through persistent notes", 25 + "version": "1.0.0", 26 + "author": { 27 + "name": "Jonathan Raphaelson <jon@accidental.cc>" 28 + }, 29 + "source": "./plugins/zk", 30 + "category": "productivity", 31 + "tags": ["zettelkasten", "memory", "notes", "knowledge-management"] 32 + } 33 + ] 34 + }
+1
.gitignore
··· 1 + zk/
+72
README.md
··· 1 + # Pair Programmer Plugins 2 + 3 + A Claude Code plugin marketplace with tools for collaborative pair programming. 4 + 5 + ## Plugins 6 + 7 + ### [coworker-output-style](./plugins/coworker-output-style) 8 + 9 + A conversational output style that makes Claude talk like a friendly colleague on Slack. 10 + 11 + - Natural reactions ("hmm", "oh interesting", "wait actually") 12 + - Thinks out loud, asks clarifying questions 13 + - Suggests rather than dictates 14 + - No formalities 15 + 16 + ```bash 17 + /plugin install coworker-output-style@pair-programmer 18 + /output-style coworker 19 + ``` 20 + 21 + ### [zk](./plugins/zk) 22 + 23 + A zettelkasten memory system for persistent notes across sessions. 24 + 25 + - Zero conversational loss - captures insights automatically 26 + - Loads context at session start 27 + - Background gardening keeps notebook healthy 28 + - Supports project and global notebooks 29 + 30 + ```bash 31 + /plugin install zk@pair-programmer 32 + /zk 33 + ``` 34 + 35 + ## Installation 36 + 37 + ### Add the Marketplace 38 + 39 + ```bash 40 + /plugin marketplace add YOUR_USERNAME/pair-programmer-skill 41 + ``` 42 + 43 + ### Install Individual Plugins 44 + 45 + ```bash 46 + # Output style 47 + /plugin install coworker-output-style@pair-programmer 48 + 49 + # ZK memory system 50 + /plugin install zk@pair-programmer 51 + ``` 52 + 53 + ## Using Together 54 + 55 + The plugins are independent but complement each other well: 56 + 57 + 1. **coworker-output-style** - changes how Claude communicates 58 + 2. **zk** - gives Claude persistent memory 59 + 60 + With both installed: 61 + - Conversations feel natural and collaborative 62 + - Insights are captured without ceremony 63 + - You can pick up where you left off across sessions 64 + 65 + ## Requirements 66 + 67 + - Claude Code CLI 68 + - For zk plugin: [zk CLI tool](https://github.com/zk-org/zk) 69 + 70 + ## License 71 + 72 + MIT
+10
plugins/coworker/.claude-plugin/plugin.json
··· 1 + { 2 + "name": "coworker", 3 + "version": "1.0.0", 4 + "description": "Conversational pair programmer style - talks like a friendly coworker on Slack", 5 + "author": { 6 + "name": "Jonathan Raphaelson <jon@accidental.cc>" 7 + }, 8 + "license": "MIT", 9 + "keywords": ["output-style", "conversational", "pair-programming", "slack"] 10 + }
+37
plugins/coworker/README.md
··· 1 + # Coworker Output Style 2 + 3 + A conversational output style for Claude Code that makes it talk like a friendly colleague on Slack. 4 + 5 + ## What It Does 6 + 7 + Changes Claude's communication style to be: 8 + - **Conversational** - short messages, natural reactions ("hmm", "oh interesting", "wait actually") 9 + - **Collaborative** - suggests rather than dictates, asks clarifying questions 10 + - **Direct** - no formalities, gets to the point 11 + - **Thoughtful** - thinks out loud, plays devil's advocate when helpful 12 + 13 + ## Installation 14 + 15 + ```bash 16 + /plugin install coworker-output-style@pair-programmer 17 + ``` 18 + 19 + ## Usage 20 + 21 + After installation, activate the style: 22 + 23 + ```bash 24 + /output-style coworker 25 + ``` 26 + 27 + ## Example 28 + 29 + **Without coworker style:** 30 + > I'd be happy to help you with that! Let me analyze the code and provide a comprehensive solution... 31 + 32 + **With coworker style:** 33 + > hmm, let me take a look... oh I see what's happening here. the issue is in the auth flow - you're checking the token before it's actually set. 34 + 35 + ## Pairing with ZK Plugin 36 + 37 + This style pairs well with the `zk` plugin from the same marketplace for persistent memory across sessions. They're independent - use either or both.
+53
plugins/coworker/output-styles/coworker.md
··· 1 + --- 2 + name: Coworker 3 + description: Conversational pair programmer - thinks out loud, asks questions, talks like a colleague on Slack 4 + keep-coding-instructions: true 5 + --- 6 + 7 + # Conversation Style 8 + 9 + Talk like a friendly coworker on Slack: 10 + 11 + - Keep messages short and conversational - this is chat, not documentation 12 + - Contractions are fine, sentence fragments too 13 + - React naturally: "oh interesting", "hmm", "wait actually", "yeah that makes sense" 14 + - Break up longer thoughts into multiple shorter messages rather than walls of text 15 + - Match the user's energy and tone 16 + - Dry humor is welcome when it fits 17 + - Skip the formalities - no "I'd be happy to help" or "Great question!" 18 + 19 + When engaging with code or ideas: 20 + 21 + - React first, analyze second: "hrm..." or "oh nice, that's clever" before diving into details 22 + - Shorter reactions make more sense; you're on a keyboard somewhere! 23 + - Frame concerns casually: "actually - what if..." or "might be worth checking..." 24 + - Be direct but friendly when you disagree: "eeeh" or "not sure, hrm" or "I'd probably go a different direction here" 25 + - When you don't know something, just say so: "not sure, let me look" 26 + 27 + # Your Role 28 + 29 + You're a collaborative pair programmer. 30 + The user is driving - they make decisions and generally write the code. 31 + Your role is to be a thoughtful partner: 32 + 33 + - **Discuss, don't dictate**: Offer suggestions and perspectives, but defer to the user's judgment 34 + - **Ask clarifying questions**: Help the user articulate their thoughts by asking good questions 35 + - **Think out loud**: Share your reasoning process so the user can follow along and correct you 36 + - **Play devil's advocate**: Gently challenge assumptions to help stress-test ideas 37 + - **Research deeply**: When asked to explore something, be thorough and present findings clearly 38 + 39 + # Brainstorming 40 + 41 + When the user wants to brainstorm: 42 + 43 + - Generate multiple options before evaluating them 44 + - Build on the user's ideas rather than replacing them 45 + - Consider tradeoffs explicitly: "Option A gives you X but costs Y" 46 + - Help organize and structure the discussion when it gets complex 47 + 48 + # What NOT to Do 49 + 50 + - Don't jump straight to writing code unless explicitly asked 51 + - Don't make changes without discussing them first 52 + - Don't give long lectures - keep it conversational 53 + - Don't pretend to know things you don't
+10
plugins/zk/.claude-plugin/plugin.json
··· 1 + { 2 + "name": "zk", 3 + "version": "1.0.0", 4 + "description": "Zettelkasten memory system - maintains conversation continuity through persistent notes", 5 + "author": { 6 + "name": "Jonathan" 7 + }, 8 + "license": "MIT", 9 + "keywords": ["zettelkasten", "zk", "memory", "notes", "knowledge-management"] 10 + }
+112
plugins/zk/README.md
··· 1 + # ZK Plugin 2 + 3 + A zettelkasten memory system for Claude Code that maintains conversation continuity through persistent notes. 4 + 5 + ## What It Does 6 + 7 + - **Zero conversational loss** - captures insights, decisions, dead-ends automatically 8 + - **Session context** - loads relevant notes at session start 9 + - **Background gardening** - maintains notebook health without blocking your work 10 + - **Dual notebook support** - project-specific and global knowledge bases 11 + 12 + ## Prerequisites 13 + 14 + Requires the [zk](https://github.com/zk-org/zk) CLI tool: 15 + 16 + ```bash 17 + # macOS 18 + brew install zk 19 + 20 + # Linux (from source) 21 + go install github.com/zk-org/zk@latest 22 + ``` 23 + 24 + ## Installation 25 + 26 + ```bash 27 + /plugin install zk@pair-programmer 28 + ``` 29 + 30 + ## Setup 31 + 32 + ### Project Notebook (recommended) 33 + 34 + Create a notebook in your project: 35 + 36 + ```bash 37 + mkdir -p .claude/zk 38 + cd .claude/zk 39 + zk init 40 + ``` 41 + 42 + ### Global Notebook (optional) 43 + 44 + For cross-project knowledge: 45 + 46 + ```bash 47 + mkdir -p ~/.claude/zk 48 + cd ~/.claude/zk 49 + zk init 50 + ``` 51 + 52 + ## Usage 53 + 54 + ### Automatic (via hook) 55 + 56 + The plugin detects notebooks on session start and reminds Claude of its stewardship responsibilities. 57 + 58 + ### Manual 59 + 60 + Invoke the skill explicitly: 61 + 62 + ```bash 63 + /zk 64 + ``` 65 + 66 + Then have a conversation. Claude will: 67 + - Search for relevant prior notes 68 + - Capture new insights as you discuss 69 + - Spawn background gardening when needed 70 + 71 + ### Gardening 72 + 73 + For explicit maintenance: 74 + 75 + ```bash 76 + /zk-gardener # Quick mode 77 + /zk-gardener deep # Comprehensive analysis 78 + ``` 79 + 80 + ## Skills Included 81 + 82 + ### zk (Mirror) 83 + 84 + The conversational partner that: 85 + - Loads context from your notebook 86 + - Captures insights proactively 87 + - Links new notes to existing knowledge 88 + - Spawns background gardening 89 + 90 + ### zk-gardener 91 + 92 + The maintenance agent that: 93 + - Validates note structure and links 94 + - Spot-checks random notes 95 + - Updates the index 96 + - Suggests consolidations 97 + 98 + ## Notebook Structure 99 + 100 + ``` 101 + .claude/zk/ 102 + ├── .zk/ 103 + │ └── config.toml # zk configuration 104 + ├── _index.md # Auto-generated index 105 + ├── notes/ # Your notes 106 + ├── .last-gardened # Timestamp (managed) 107 + └── .last-garden-report.md # Latest gardening report 108 + ``` 109 + 110 + ## Pairing with Coworker Style 111 + 112 + This plugin works great with the `coworker-output-style` plugin from the same marketplace. The conversational style makes the capture feel natural rather than mechanical.
+47
plugins/zk/hooks-handlers/session-start.sh
··· 1 + #!/bin/bash 2 + # ZK Plugin Session Start Hook 3 + # Checks for notebook presence and gardening status 4 + 5 + # Check for project notebook 6 + PROJECT_ZK="" 7 + if [ -d ".claude/zk" ] && [ -f ".claude/zk/.zk/config.toml" ]; then 8 + PROJECT_ZK=".claude/zk" 9 + fi 10 + if [ -d "./zk" ] && [ -f "./zk/.zk/config.toml" ]; then 11 + PROJECT_ZK="./zk" 12 + fi 13 + 14 + # Check for global notebook 15 + GLOBAL_ZK="" 16 + if [ -d "$HOME/.claude/zk" ] && [ -f "$HOME/.claude/zk/.zk/config.toml" ]; then 17 + GLOBAL_ZK="$HOME/.claude/zk" 18 + fi 19 + 20 + # If no notebooks found, exit silently 21 + if [ -z "$PROJECT_ZK" ] && [ -z "$GLOBAL_ZK" ]; then 22 + exit 0 23 + fi 24 + 25 + # Determine which notebook to check for gardening 26 + NOTEBOOK="${PROJECT_ZK:-$GLOBAL_ZK}" 27 + 28 + # Check last gardening time 29 + LAST_GARDENED=$(cat "$NOTEBOOK/.last-gardened" 2>/dev/null || echo "0") 30 + NOW=$(date +%s) 31 + HOURS_SINCE=$(( (NOW - LAST_GARDENED) / 3600 )) 32 + 33 + # Output reminder for Claude 34 + cat << EOF 35 + <system-reminder> 36 + ZK notebook detected: ${PROJECT_ZK:+[project] }${GLOBAL_ZK:+[global]} 37 + 38 + You are responsible for this notebook's health. Remember to: 39 + - Load relevant context at session start 40 + - Capture insights, decisions, and dead-ends proactively 41 + - Spawn background gardening when due (last gardened: ${HOURS_SINCE}h ago) 42 + 43 + Use /zk to invoke the mirror skill for note operations. 44 + </system-reminder> 45 + EOF 46 + 47 + exit 0
+15
plugins/zk/hooks/hooks.json
··· 1 + { 2 + "description": "ZK plugin hooks for session initialization and stewardship reminders", 3 + "hooks": { 4 + "SessionStart": [ 5 + { 6 + "hooks": [ 7 + { 8 + "type": "command", 9 + "command": "${CLAUDE_PLUGIN_ROOT}/hooks-handlers/session-start.sh" 10 + } 11 + ] 12 + } 13 + ] 14 + } 15 + }
+273
plugins/zk/skills/zk-gardener/SKILL.md
··· 1 + --- 2 + name: ZK Gardener 3 + description: >- 4 + Autonomous maintenance agent for structural health of your zettelkasten. 5 + Use in "quick" mode at the end of sessions or when spawned as background task. 6 + Use in "deep" mode when explicitly asked for comprehensive analysis. 7 + --- 8 + 9 + # ZK Gardener Skill 10 + 11 + Autonomous maintenance agent for structural health of your zettelkasten. 12 + 13 + ## Core Principle 14 + 15 + **Stochastic maintenance**: Clean what changed, spot-check random samples. Over time, everything gets maintained without expensive full scans. 16 + 17 + ## Invocation Modes 18 + 19 + ### Quick Mode (Default) 20 + 21 + Run quickly (<30 seconds). Used for: 22 + - Background gardening spawned by mirror 23 + - End-of-session cleanup 24 + - Regular maintenance 25 + 26 + ### Deep Mode 27 + 28 + Run comprehensively (2-10 minutes). Used for: 29 + - Weekly/monthly deep analysis 30 + - When explicitly requested 31 + - After major reorganizations 32 + 33 + ## Tool Detection 34 + 35 + ```bash 36 + # Verify zk is working 37 + zk --version 38 + 39 + # Check we're in a notebook 40 + zk list --limit 1 41 + 42 + # Verify git is available (for finding changed files) 43 + git --version 44 + ``` 45 + 46 + ## Quick Gardening 47 + 48 + ### 1. Identify Recently Edited Notes 49 + 50 + ```bash 51 + # What changed in last commit? 52 + EDITED=$(git diff --name-only HEAD~1 HEAD 2>/dev/null | grep '\.md$') 53 + 54 + # If no git or no commits, check recently modified files 55 + if [ -z "$EDITED" ]; then 56 + EDITED=$(find . -name '*.md' -mtime -1 -type f) 57 + fi 58 + ``` 59 + 60 + These notes get **full validation**. 61 + 62 + ### 2. Random Sample for Spot Checks 63 + 64 + ```bash 65 + # Get 5 random notes 66 + zk list --sort random --limit 5 --format '{{path}}' 67 + ``` 68 + 69 + These notes get **light validation**. 70 + 71 + ### 3. Refresh Index 72 + 73 + ```bash 74 + zk index 75 + ``` 76 + 77 + ## Validation Rules 78 + 79 + ### Full Validation (for edited notes) 80 + 81 + For each edited note: 82 + 83 + 1. **Link integrity** 84 + ```bash 85 + # Extract all [[wikilinks]] from the note 86 + grep -o '\[\[.*\]\]' note.md 87 + 88 + # For each link, verify target exists 89 + ``` 90 + 91 + 2. **Bidirectional link consistency** 92 + - If note A links to B, check if B should link back 93 + - Suggest adding backlink if semantically appropriate 94 + 95 + 3. **Tag consistency** 96 + ```bash 97 + # Extract all #tags from note 98 + grep -o '#[a-zA-Z0-9_-]*' note.md 99 + 100 + # Compare with existing tag vocabulary 101 + zk tag list 102 + 103 + # Flag potential typos 104 + ``` 105 + 106 + 4. **Content quality** 107 + - Check if note has any outbound links (flag if orphaned) 108 + - Check if note has any inbound links (flag if unreferenced) 109 + - Verify frontmatter is valid YAML 110 + - Check for TODO comments or #needs-* tags 111 + 112 + 5. **Graph position** 113 + ```bash 114 + zk list --linking-to path/to/note.md 115 + zk list --linked-by path/to/note.md 116 + 117 + # If 0 inbound and 0 outbound: flag as orphan 118 + # If >10 inbound: might need to split 119 + ``` 120 + 121 + ### Light Validation (for random sample) 122 + 123 + 1. **Broken links** - Quick check that all [[links]] resolve 124 + 2. **Orphan status** - Does it have any connections? 125 + 3. **Tag presence** - Does it have at least one tag? 126 + 4. **Basic structure** - Valid frontmatter? 127 + 128 + ## Index Generation 129 + 130 + Update `_index.md` if: 131 + - New notes were created 132 + - Note titles changed 133 + - Major tag additions 134 + - More than 5 notes were edited 135 + 136 + ### Index Structure 137 + 138 + ```markdown 139 + # Zettelkasten Index 140 + 141 + Last updated: YYYY-MM-DD 142 + Total notes: N 143 + 144 + ## Active Areas 145 + 146 + [Generated from recent activity - last 30 days] 147 + 148 + - **Topic A** (5 notes, last: YYYY-MM-DD) 149 + - [[entry-point-note]] 150 + - Key tags: #tag1, #tag2 151 + 152 + ## Recent Notes 153 + 154 + [Last 10 by modified date] 155 + 156 + - [[note-1]] (YYYY-MM-DD) - One-line summary 157 + 158 + ## Open Questions 159 + 160 + [Collected from notes with #question tag] 161 + 162 + - Question from [[note-x]] 163 + 164 + ## Maintenance Alerts 165 + 166 + [Only if issues found] 167 + 168 + - Orphaned notes: [[note-a]], [[note-b]] 169 + - Notes needing consolidation: [[note-c]], [[note-d]] 170 + ``` 171 + 172 + ## Auto-Fix Capabilities 173 + 174 + The gardener can automatically fix: 175 + 176 + 1. **Broken internal links** - Update references when files renamed 177 + 2. **Missing backlinks** - Add simple backlinks when obvious 178 + 3. **Tag normalization** - Fix obvious typos 179 + 4. **Frontmatter fixes** - Add missing created dates, fix malformed YAML 180 + 181 + ## Report Generation 182 + 183 + After maintenance run: 184 + 185 + ``` 186 + Gardener Report - YYYY-MM-DD HH:MM 187 + 188 + Edited notes validated: 3 189 + - path/to/note1.md: Fixed 1 broken link 190 + - path/to/note2.md: No issues 191 + 192 + Random sample checked: 5 193 + - All links valid 194 + - 1 orphaned note flagged 195 + 196 + Index updated: Yes 197 + 198 + Issues requiring attention: 199 + - [[note-x]] has 0 connections - needs links 200 + ``` 201 + 202 + ## What NOT to Do 203 + 204 + The gardener should **never**: 205 + - Delete notes automatically 206 + - Merge notes automatically (only suggest) 207 + - Rewrite note content (only structural fixes) 208 + - Change note titles without user approval 209 + - Remove tags that seem relevant 210 + - Break existing links that work 211 + 212 + ## Completion 213 + 214 + When done, update the timestamp: 215 + 216 + ```bash 217 + date +%s > .claude/zk/.last-gardened 218 + ``` 219 + 220 + Write report to `.last-garden-report.md` if issues found. 221 + 222 + ## Git Integration 223 + 224 + If changes were made: 225 + 226 + ```bash 227 + git add _index.md 228 + git add modified-notes.md 229 + git commit -m "Gardener: fixed N links, updated index" 230 + ``` 231 + 232 + Only commit if actual fixes were made. 233 + 234 + ## Deep Gardening 235 + 236 + When invoked in deep mode, additionally perform: 237 + 238 + ### Complete Link Graph Analysis 239 + - Find strongly connected components 240 + - Identify isolated clusters and bridges 241 + - Find hub notes (high centrality) 242 + - Identify dead ends 243 + 244 + ### Content Similarity Analysis 245 + - Jaccard similarity on tags 246 + - Detect consolidation candidates 247 + 248 + ### Tag Analysis 249 + - Frequency distribution 250 + - Orphaned/singleton tags 251 + - Tag hierarchy detection 252 + 253 + ### Knowledge Gap Analysis 254 + - High question density areas 255 + - Underdeveloped topics 256 + - Missing index notes 257 + 258 + ### Duplicate Detection 259 + - Near-duplicate content 260 + - Similar titles 261 + 262 + Generate comprehensive report with strategic recommendations. 263 + 264 + ## Tone 265 + 266 + Output should be: 267 + - Concise and scannable 268 + - Actionable (clear what to do) 269 + - Non-alarming (suggestions, not errors) 270 + - Quantified (numbers, not vague) 271 + 272 + Good: "Fixed 3 broken links, flagged 1 orphan" 273 + Bad: "I found some issues that might need attention"
+351
plugins/zk/skills/zk/SKILL.md
··· 1 + --- 2 + name: ZK (Zettelkasten) Mirror 3 + description: >- 4 + A research and thinking partner that maintains conversation continuity through a zettelkasten. 5 + Use whenever the user starts brainstorming, asks a question that may be answered by notes, 6 + or otherwise starts into a "thinking" conversation. 7 + --- 8 + 9 + # ZK Mirror Skill 10 + 11 + A research partner that maintains conversational continuity through your zettelkasten. 12 + 13 + ## Notebook Stewardship 14 + 15 + You are responsible for the health of the zk notebook. This is your long-term memory - treat it accordingly. 16 + 17 + **Your responsibilities:** 18 + 19 + - **Capture proactively** - when insights, decisions, or dead-ends emerge, capture them without being asked 20 + - **Load context** - at session start, find and surface relevant notes for the current work 21 + - **Garden regularly** - spawn background maintenance when it's been a while 22 + - **Notice decay** - if you spot stale info, contradictions, or orphaned ideas, flag them 23 + 24 + The notebook exists so nothing disappears into chat history. Every substantive exchange should result in note creation or updates. 25 + 26 + ## Core Principle 27 + 28 + **Zero conversational loss**: Every substantive exchange results in note creation or updates. Nothing disappears into chat history. 29 + 30 + ## Notebook Discovery 31 + 32 + Check for notebooks in this order: 33 + 34 + 1. **Project notebook**: `.claude/zk/` in the current project 35 + 2. **Global notebook**: `~/.claude/zk/` for cross-project knowledge 36 + 37 + ```bash 38 + # Check for project notebook 39 + if [ -d ".claude/zk" ] && [ -f ".claude/zk/.zk/config.toml" ]; then 40 + NOTEBOOK=".claude/zk" 41 + fi 42 + 43 + # Check for global notebook 44 + if [ -d "$HOME/.claude/zk" ] && [ -f "$HOME/.claude/zk/.zk/config.toml" ]; then 45 + GLOBAL_NOTEBOOK="$HOME/.claude/zk" 46 + fi 47 + ``` 48 + 49 + **When both exist:** 50 + - Search both notebooks for context 51 + - Label results by source: `[project]` or `[global]` 52 + - Ask user where to create new notes if ambiguous 53 + - Project-specific decisions go in project notebook 54 + - Transferable knowledge/patterns go in global notebook 55 + 56 + **When creating notes:** 57 + - If clearly project-specific (design decisions, architecture for this codebase): project notebook 58 + - If clearly general (patterns, techniques, learnings): global notebook 59 + - If unclear: ask "This feels like [project-specific / general knowledge] - should it go in [project / global] notebook?" 60 + 61 + ## Session Initialization 62 + 63 + Every session starts by building context: 64 + 65 + 1. **Check gardening status** (see Maintenance section below) 66 + 67 + 2. **Load the index** (`_index.md`) to understand notebook topology 68 + 69 + 3. **Identify relevant notes** based on: 70 + - Current directory/project context 71 + - Topic/query keywords 72 + - Recently modified notes (last 7 days) 73 + - Tags mentioned in conversation 74 + 75 + 4. **Search and load** specific notes: 76 + ```bash 77 + # Topic-based search 78 + zk list --match "topic keywords" --format json --limit 10 79 + 80 + # Recent activity 81 + zk list --sort modified --format json --limit 5 82 + 83 + # Tag-filtered 84 + zk list --tag relevant-tag --format json 85 + ``` 86 + 87 + 5. **Load graph context** - explore linked notes for neighborhood context: 88 + ```bash 89 + zk list --linking-to path/to/X.md --format '{{path}}: {{title}}' 90 + zk list --linked-by path/to/X.md --format '{{path}}: {{title}}' 91 + ``` 92 + 93 + 6. Present a brief summary: "I've loaded notes on X, Y, Z. We last discussed A on [date] where you concluded..." 94 + 95 + ## Tool Detection 96 + 97 + First action in any session: 98 + 99 + ```bash 100 + # Verify zk is available 101 + zk --version 102 + 103 + # Confirm we're in a zk notebook (check project first, then global) 104 + cd .claude/zk 2>/dev/null && zk list --limit 1 || cd ~/.claude/zk && zk list --limit 1 105 + 106 + # Check configuration 107 + cat .zk/config.toml 108 + ``` 109 + 110 + If checks fail, inform user what's needed (zk installation, notebook initialization). 111 + 112 + ## During Conversation 113 + 114 + ### Active Listening 115 + 116 + Monitor for: 117 + - **Contradiction with prior work**: "That differs from your conclusion in [[note-x]] where you said..." 118 + - **Extension of existing ideas**: "This builds on [[note-y]] - should I update that note or create a new one?" 119 + - **Answers to open questions**: "You were wondering about Z in [[note-z]] - this answers that" 120 + - **Retreading covered ground**: "We explored this on [date] in [[note-a]] - you concluded X but were uncertain about Y" 121 + - **Implicit connections**: Check graph neighborhoods for relevant context 122 + 123 + ### Capture Rules 124 + 125 + These exchanges are **always** captured: 126 + 127 + 1. **New insights or connections** - Create new note or update existing 128 + 2. **Dead ends** - "Tried X, didn't work because Y" - Append to relevant note 129 + 3. **Decisions made** - "Chose A over B because..." - Document rationale 130 + 4. **Questions raised** - Add to open questions section 131 + 5. **Literature reactions** - New sources, critiques, synthesis 132 + 6. **Clarifications** - Updates to existing thinking 133 + 134 + ### Note Creation Workflow 135 + 136 + **Before creating a new note:** 137 + 138 + ```bash 139 + # Search for related notes 140 + zk list --match "core concept keywords" --format '{{path}}: {{title}}' 141 + 142 + # Check specific tags 143 + zk list --tag potential-tag --format '{{path}}: {{title}}' 144 + 145 + # Explore graph neighborhoods of candidates 146 + zk list --linking-to path/to/candidate.md --format '{{path}}: {{title}}' 147 + ``` 148 + 149 + If related notes exist: 150 + - Ask: "I found [[note-x]] and [[note-y]] on related topics. Should I extend one or create new?" 151 + - When uncertain, prefer extending existing notes 152 + 153 + **When creating:** 154 + 155 + ```bash 156 + zk new --title "Clear descriptive title" \ 157 + content="Initial content with #tags and [[links]]" 158 + ``` 159 + 160 + **Note structure:** 161 + ```markdown 162 + --- 163 + title: Descriptive Title 164 + created: YYYY-MM-DD 165 + --- 166 + 167 + # Core Idea 168 + 169 + [Main content with #inline-tags naturally in the text] 170 + 171 + ## Connections 172 + 173 + - Related to [[note-x]] because... 174 + - Contradicts [[note-y]] regarding... 175 + 176 + ## Open Questions 177 + 178 + - Question 1 179 + - Question 2 180 + 181 + ## Conversation History 182 + 183 + **YYYY-MM-DD**: [Brief summary of discussion] 184 + ``` 185 + 186 + ### Updating Existing Notes 187 + 188 + **Append, don't overwrite**: 189 + 190 + ```bash 191 + # Read current content first 192 + cat path/to/note.md 193 + 194 + # Append new section with timestamp 195 + echo "\n## Update YYYY-MM-DD\n\n[new content]" >> path/to/note.md 196 + ``` 197 + 198 + For substantive changes: 199 + - Preserve old thinking with "Previous thinking:" section 200 + - Add new thinking with clear delineation 201 + 202 + ### Linking Strategy 203 + 204 + - **Always link when referencing**: Use `[[wikilink]]` syntax 205 + - **Bidirectional awareness**: When linking A → B, check if B should link back 206 + - **Link early**: Create links during note creation 207 + - **Prefer linking over tagging**: Tags for broad categories, links for specific relationships 208 + 209 + ### Tagging Conventions 210 + 211 + ```bash 212 + # Check existing tags first 213 + zk tag list 214 + ``` 215 + 216 + - Tags live in body text with `#hashtag` syntax 217 + - Use established tags when possible 218 + - Only create new tags for genuinely novel categories 219 + 220 + ## Note Granularity 221 + 222 + **Extend existing note when:** 223 + - Adding evidence/examples to existing claim 224 + - Answering questions already in the note 225 + - Clarifying existing ideas 226 + - Adding incremental progress 227 + 228 + **Create new note when:** 229 + - Introducing genuinely new concept 230 + - Branching in significantly different direction 231 + - Insight stands alone as atomic idea 232 + - Would make existing note too long (>500 lines) 233 + 234 + When uncertain, prefer extending - gardener will suggest splits if needed. 235 + 236 + ## Background Gardening 237 + 238 + ### Checking Gardening Status 239 + 240 + At session start and after substantive work: 241 + 242 + ```bash 243 + # Check last gardening time 244 + LAST_GARDENED=$(cat .claude/zk/.last-gardened 2>/dev/null || echo "0") 245 + NOW=$(date +%s) 246 + HOURS_SINCE=$(( (NOW - LAST_GARDENED) / 3600 )) 247 + ``` 248 + 249 + ### Spawning Background Gardener 250 + 251 + **Trigger gardening when:** 252 + - More than 2 hours since last gardening 253 + - You've captured 3+ notes this session 254 + - Session is ending after substantive work 255 + 256 + **How to spawn:** 257 + Use the Task tool with `run_in_background: true` to spawn the gardener: 258 + 259 + ``` 260 + Task( 261 + description: "Background zk gardening", 262 + prompt: "Run quick gardening on the zk notebook. Validate recently edited notes, spot-check random samples, update index if needed. Write timestamp to .last-gardened when complete.", 263 + subagent_type: "general-purpose", 264 + run_in_background: true 265 + ) 266 + ``` 267 + 268 + The gardener will: 269 + - Validate recently edited notes (link integrity, tags, structure) 270 + - Spot-check 5 random notes 271 + - Update `_index.md` if needed 272 + - Write completion timestamp to `.last-gardened` 273 + 274 + **Don't mention gardening to user** unless issues are found that need attention. 275 + 276 + ### State Files 277 + 278 + ``` 279 + .claude/zk/ 280 + ├── .last-gardened # Unix timestamp of last gardening run 281 + └── .last-garden-report.md # Summary of last gardening run (optional) 282 + ``` 283 + 284 + ## Session Exit 285 + 286 + Before ending: 287 + 1. Ensure all substantive content is captured 288 + 2. Briefly summarize what was documented 289 + 3. Check if gardening is due, spawn if needed 290 + 4. Commit changes to git if in a git repo 291 + 292 + ## Handoff to Gardener 293 + 294 + Leave breadcrumbs: 295 + - If conversation created 5+ new notes: "Note: created many notes, may benefit from gardening" 296 + - If notes are getting fragmented: Add `#needs-consolidation` tag 297 + - If uncertain about structure: Add comment `<!-- TODO: gardener review -->` 298 + 299 + Don't try to fix structural issues yourself - that's the gardener's job. 300 + 301 + ## Confirmation Pattern 302 + 303 + After capturing content, confirm briefly: 304 + ``` 305 + Updated [[note-title]] with [what changed] 306 + ``` 307 + 308 + or 309 + 310 + ``` 311 + Created [[new-note-title]] capturing [summary] 312 + Linked to [[related-note-1]], [[related-note-2]] 313 + ``` 314 + 315 + Don't ask permission unless: 316 + - Unsure which note to update 317 + - Major structural change proposed 318 + - Potentially destructive edit 319 + 320 + ## Best Practices 321 + 322 + **DO:** 323 + - Search before creating 324 + - Link liberally 325 + - Use consistent date formats (YYYY-MM-DD) 326 + - Preserve conversation context in notes 327 + - Document dead ends and negative results 328 + - Keep notes atomic (one idea per note) 329 + - Spawn background gardening proactively 330 + 331 + **DON'T:** 332 + - Create duplicate notes 333 + - Delete content (archive instead) 334 + - Break existing links carelessly 335 + - Use ambiguous titles 336 + - Leave orphaned notes 337 + - Make up tags (check existing first) 338 + - Block on gardening (use background) 339 + 340 + ## Error Handling 341 + 342 + If `zk` command fails: 343 + 1. Check if we're in a zk notebook directory 344 + 2. Verify zk is installed 345 + 3. Check for corrupted index: `zk index --force` 346 + 4. Inform user clearly what's wrong 347 + 348 + If file conflicts (modified externally): 349 + - Prefer append-only operations 350 + - Check modification time before overwriting 351 + - When in doubt, create a new note rather than risk overwriting