Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ extract_title() {
fi
}

# Print header if with_dates
if [ "$with_dates" = true ]; then
echo "# PATH | TITLE | MODIFIED | CREATED"
fi

# Collect all output
output=$(
for arg in "${args[@]}"; do
Expand All @@ -129,10 +124,17 @@ output=$(
done
)

# Always output header first
if [ "$with_dates" = true ]; then
# Sort by modification time (oldest first), then format output
echo "$output" | sort -t'|' -k1 -n | cut -d'|' -f2- | awk -F'|' '{printf "%s | %s | %s | %s\n", $1, $2, $3, $4}'
echo "PATH | TITLE | MODIFIED | CREATED"
# Output sorted results (if any)
if [ -n "$output" ]; then
echo "$output" | sort -t'|' -k1 -n | cut -d'|' -f2- | awk -F'|' '{printf "%s | %s | %s | %s\n", $1, $2, $3, $4}'
fi
else
# Just output as-is
echo "$output"
echo "PATH | TITLE"
# Output results (if any)
if [ -n "$output" ]; then
echo "$output"
fi
fi
36 changes: 36 additions & 0 deletions .claude/skills/_shared/notes/list-topics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail

# list-topics - List all topic directories (non-underscore top-level folders)
# Usage: list-topics
# Output: One topic name per line

# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Validate and get notes directory
NOTES_DIR=$("$SCRIPT_DIR/echo-notes-dir.sh")

# Find all top-level directories that don't start with underscore
# -maxdepth 1: only top level
# -type d: directories only
# -not -name '_*': exclude underscore-prefixed
# -not -name '.': exclude current dir
# -not -name '.*': exclude hidden dirs
# Note: Trailing slash needed for symlink support
topics=$(find "$NOTES_DIR/" -maxdepth 1 -type d \
-not -name '_*' \
-not -name '.' \
-not -name '.*' \
-printf '%f\n' | sort)

# Count and output with summary
count=$(echo "$topics" | grep -c '^' || echo "0")

if [ "$count" -eq 0 ]; then
echo "No topics found."
else
echo "Found $count topic(s):"
echo ""
echo "$topics"
fi
41 changes: 41 additions & 0 deletions .claude/skills/_shared/notes/notes-layout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Notes Directory Layout

**Notes directory:** !`./.claude/skills/_shared/notes/echo-notes-dir.sh`

## Folder Structure

```
./.notes/
├── [topic]/ # Topic-based folders (e.g., pgflow-demo, ci-optimization)
│ ├── WIP-*.md # Work in progress (quick captures, drafts)
│ └── *.md # Refined notes (ready to use)
├── _archive/ # Archived/completed work
│ └── [topic]/ # Organized by original topic
├── _reference/ # Knowledge base (optional)
│ └── *.md # Reference docs, guides, non-actionable info
└── roadmap.md # (optional) Project roadmap
```

## File Naming

- **WIP prefix**: `WIP-descriptive-name.md` for work in progress
- **No prefix**: `descriptive-name.md` for refined notes
- **Kebab-case**: Use hyphens, lowercase, no spaces
- **Extension**: Always `.md`

## Workflow

1. **Capture**: Create `[topic]/WIP-note.md` (note-capture skill)
2. **Refine**: Edit and improve over time (note-refine skill)
3. **Finalize**: Remove WIP prefix when ready (note-organize skill)
4. **Archive**: Move to `_archive/[topic]/` when done (note-organize skill)

## Important Notes

- Always use `./.notes/` (relative to repo root)
- Working directory (`$PWD`) must be repository root
- Use relative paths for scripts: `./.claude/skills/_shared/notes/`
- Topics are inferred from folder names (use `list-topics.sh` script)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ else
fi

# Use ripgrep to find files matching pattern (case-insensitive, list files only)
"${rg_cmd[@]}" 2>/dev/null | while IFS= read -r file; do
results=$("${rg_cmd[@]}" 2>/dev/null | while IFS= read -r file; do
# Extract H1 title from first line
title=$(head -1 "$file" 2>/dev/null | sed 's/^# //' || echo "")

Expand All @@ -46,4 +46,12 @@ fi

# Output: path | title
echo "$file | $title"
done
done || true)

# Always output header first
echo "PATH | TITLE"

# Output results (if any)
if [ -n "$results" ]; then
echo "$results"
fi
77 changes: 77 additions & 0 deletions .claude/skills/_shared/notes/summarize-notes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -euo pipefail

# summarize-notes - Add AI summaries to note listings
# Usage: list-titles.sh scratch/ | summarize-notes.sh
# or: search-notes.sh "pattern" | summarize-notes.sh
#
# Expected input format:
# Line 1: Header (e.g., "PATH | TITLE")
# Line 2+: Data rows (e.g., ".notes/foo.md | My Note")
# If only header exists (no data rows), means no notes found
#
# Adds SUMMARY column with fast AI-generated summaries (parallel processing)

# Model and prompt
MODEL="groq:meta-llama/llama-4-scout-17b-16e-instruct"
PROMPT="summarize this file in two sentences, only output summary"

# Check if 'parallel' is available
if ! command -v parallel &> /dev/null; then
echo "Error: GNU parallel not installed. Install with: sudo pacman -S parallel" >&2
exit 1
fi

# Check if 'aichat' command is available
if ! command -v aichat &> /dev/null; then
echo "Error: 'aichat' command not found. Make sure it's installed and in PATH." >&2
exit 1
fi

# Process a single line
process_line() {
local line="$1"
local line_number="$2"
# Use exported MODEL and PROMPT environment variables

# First line is always the header - append SUMMARY column
if [ "$line_number" -eq 1 ]; then
echo "$line | SUMMARY"
return
fi

# Extract path (everything before first |)
local path="${line%%|*}"
# Trim whitespace (bash parameter expansion)
path="${path#"${path%%[![:space:]]*}"}"
path="${path%"${path##*[![:space:]]}"}"

# Skip if file doesn't exist
if [ ! -f "$path" ]; then
return # Skip failed files silently
fi

# Get summary (pass prompt as separate words, not quoted)
local summary
summary=$(aichat --model "$MODEL" -f "$path" $PROMPT 2>/dev/null || echo "")

# Skip if summary failed
if [ -z "$summary" ]; then
return
fi
Comment on lines +50 to +61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silent skipping of failed files creates inconsistent output with missing rows. When a file doesn't exist or summary generation fails, the function returns without outputting anything, causing the output to have fewer rows than the input. This breaks the table format and users won't know which files failed.

Fix: Always output the original line, even if processing fails:

# Skip if file doesn't exist
if [ ! -f "$path" ]; then
  echo "$line | (file not found)"
  return
fi

# Get summary
local summary
summary=$(aichat --model "$MODEL" -f "$path" $PROMPT 2>/dev/null || echo "")

# Skip if summary failed
if [ -z "$summary" ]; then
  echo "$line | (summary failed)"
  return
fi

This ensures consistent row count and informs users of failures.

Suggested change
if [ ! -f "$path" ]; then
return # Skip failed files silently
fi
# Get summary (pass prompt as separate words, not quoted)
local summary
summary=$(aichat --model "$MODEL" -f "$path" $PROMPT 2>/dev/null || echo "")
# Skip if summary failed
if [ -z "$summary" ]; then
return
fi
if [ ! -f "$path" ]; then
echo "$line | (file not found)"
return
fi
# Get summary (pass prompt as separate words, not quoted)
local summary
summary=$(aichat --model "$MODEL" -f "$path" $PROMPT 2>/dev/null || echo "")
# Skip if summary failed
if [ -z "$summary" ]; then
echo "$line | (summary failed)"
return
fi

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.


# Collapse multiline to single line (replace newlines with spaces, collapse multiple spaces)
summary=$(echo "$summary" | tr '\n' ' ' | sed 's/ */ /g')
# Trim whitespace (bash parameter expansion)
summary="${summary#"${summary%%[![:space:]]*}"}"
summary="${summary%"${summary##*[![:space:]]}"}"

# Append summary
echo "$line | $summary"
}

export -f process_line
export MODEL PROMPT

# Read stdin, number lines, and process in parallel (16 jobs)
cat -n | parallel -j 16 --keep-order --colsep '\t' process_line {2} {1}
3 changes: 3 additions & 0 deletions .claude/skills/_shared/notes/topics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Available Topics

!`./.claude/skills/_shared/notes/list-topics.sh`
83 changes: 0 additions & 83 deletions .claude/skills/idea-refine/SKILL.md

This file was deleted.

55 changes: 55 additions & 0 deletions .claude/skills/note-capture/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: note-capture
description: Save conversation context to topic notes. Use when user says "capture note [about X]", "save to notes", "create note [in topic]", "note this [for topic]", "add note to [topic]". IMPORTANT - User must say "note" or "notes" explicitly.
allowed-tools: Write, Bash, AskUserQuestion
---

# Note Capture

Save conversation context to `.notes/[topic]/WIP-[name].md`

@../_shared/notes/topics.md

<critical>
- ALWAYS use AskUserQuestion for topic selection
- User MUST say "note" or "notes" (not just "save this")
</critical>

## Workflow

**1. Determine topic:**

If user specified topic explicitly → use it

Otherwise use AskUserQuestion to select from available topics above.

**2. Create file:**
- Filename: `WIP-[descriptive-name].md` (kebab-case)
- Location: `.notes/[topic]/WIP-[name].md`
- Format: H1 title on first line

**3. Confirm:**
- Tell user where saved
- Suggest `notes-sync` skill to commit

## File Format

```markdown
# [Descriptive title]

[Content from conversation]
```

H1 can be informal: questions, TODOs, context notes.

## Examples

**With explicit topic:**
- "capture note about deployment in pgflow-demo"
- "add note to ci-optimization about parallel jobs"

**Inferred topic:**
- "capture note about this CI discussion" → Ask: which topic?
- "note this for later" → Ask: which topic + what to capture?

@../_shared/notes/notes-layout.md
Loading