@tekmidian/pai 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: Consolidate
3
+ description: "Consolidate and clean up session notes — merge duplicates, fix titles, renumber sequentially. USE WHEN user says 'consolidate notes', 'clean up notes', 'merge duplicate notes', 'fix session notes', 'deduplicate notes', '/consolidate', OR notes directory has duplicates or bad titles."
4
+ ---
5
+
6
+ ## Consolidate Skill
7
+
8
+ USE WHEN user says 'consolidate notes', 'clean up notes', 'merge duplicate notes', 'fix session notes', 'deduplicate notes', '/consolidate', OR notes directory has duplicates or bad titles.
9
+
10
+ ### What This Skill Does
11
+
12
+ Cleans up a project's session notes directory by:
13
+ 1. Finding duplicate/superseded notes (same topic, different compaction snapshots)
14
+ 2. Keeping the most complete version of each topic
15
+ 3. Fixing garbage titles (renaming files and H1 headings)
16
+ 4. Renumbering sequentially (0001, 0002, 0003...)
17
+ 5. Optionally committing the cleanup
18
+
19
+ ### Arguments
20
+
21
+ - No args: consolidate current project
22
+ - `--project <slug>`: consolidate a specific project
23
+ - `--dry-run`: show what would change without modifying files
24
+
25
+ ### Workflow
26
+
27
+ **Step 1: Find the notes directory**
28
+ Use `pai project detect` to find the current project, then locate `Notes/YYYY/MM/` for the current month.
29
+
30
+ **Step 2: Inventory all notes**
31
+ List all .md files in the month directory. For each note, read:
32
+ - Filename (number, date, title)
33
+ - H1 heading inside the file
34
+ - Line count (proxy for completeness)
35
+ - First 20 lines (to understand the topic)
36
+
37
+ **Step 3: Group by topic**
38
+ Group notes that cover the same topic. Two notes are "same topic" if:
39
+ - Their filenames are identical (except the number)
40
+ - OR their H1 titles share >50% word overlap (Jaccard similarity)
41
+ - OR one is a strict subset of the other (shorter note's content is contained in the longer one)
42
+
43
+ **Step 4: For each group, keep the best**
44
+ - Keep the note with the most lines (most complete)
45
+ - Delete the others
46
+ - If the kept note has a bad title (garbage from user messages, too long, generic), rename it based on the H1 or the Focus/Work Done section
47
+
48
+ **Step 5: Renumber sequentially**
49
+ After deduplication, renumber all remaining notes: 0001, 0002, 0003...
50
+ Preserve the date and title in the filename.
51
+
52
+ **Step 6: Fix H1 headings**
53
+ Ensure each note's H1 matches its filename title and number.
54
+
55
+ **Step 7: Report and optionally commit**
56
+ Show what was done:
57
+ - Notes deleted (with reason)
58
+ - Notes renamed (old → new)
59
+ - Notes renumbered
60
+ Then ask if the user wants to commit: `git add Notes/ && git commit -m "docs: consolidate session notes"`
61
+
62
+ ### Title Quality Rules
63
+
64
+ A title is "garbage" if it:
65
+ - Quotes a user message verbatim (conversational tone, starts with lowercase)
66
+ - Contains `[object Object]`, hex hashes, `task-notification`
67
+ - Is longer than 80 characters
68
+ - Is generic: "New Session", "Continued Session", "Session N"
69
+
70
+ Fix by reading the note's ## Work Done or **Focus:** line and deriving a descriptive title.
71
+
72
+ ### Safety
73
+
74
+ - NEVER delete a note that is the ONLY one for its topic
75
+ - NEVER delete notes from previous months (only consolidate current month)
76
+ - Show the plan before executing (unless --force)
77
+ - Always preserve the most complete version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekmidian/pai",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "PAI Knowledge OS — Personal AI Infrastructure with federated memory and project management",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",