claude-session-skill 1.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ITeachYouAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # claude-session-skill
2
+
3
+ A [Claude Code](https://docs.anthropic.com/en/docs/claude-code) skill for searching, browsing, and naming past sessions. Indexes all session history and generates AI summaries so you can find any session by keyword, project, or name.
4
+
5
+ ## Requirements
6
+
7
+ - [Bun](https://bun.sh) runtime
8
+ - Claude Code CLI
9
+ - `ANTHROPIC_API_KEY` environment variable
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ git clone https://github.com/ITeachYouAI/claude-session-skill.git ~/.claude/skills/session
15
+ bun run ~/.claude/skills/session/session.ts rebuild
16
+ ```
17
+
18
+ Claude Code discovers the skill automatically via `SKILL.md` triggers. Open any session and type `/session list`.
19
+
20
+ ## Usage
21
+
22
+ ```
23
+ /session list # Show 20 most recent sessions
24
+ /session list --all # Show all sessions
25
+ /session show <id> # Show full session details (partial IDs work)
26
+ /session name <name> # Name the most recent session
27
+ /session name <id> <name> # Name a specific session by ID
28
+ /session unname [<id>] # Clear a session's name
29
+ /session search <query> # Search by keyword
30
+ /session <query> # Shorthand for search
31
+ /session rebuild # Rebuild the index
32
+ /session stats # Stats by project
33
+ ```
34
+
35
+ ## Naming sessions
36
+
37
+ Session naming is handled via natural language — you never type or see session IDs directly. Claude resolves which session you mean.
38
+
39
+ | Input | Behavior |
40
+ |---|---|
41
+ | "Name this session `<name>`" | Names the most recent session |
42
+ | "Name the session where I did `<thing>`" | Claude searches, finds it, names it |
43
+ | After `/session list`: "name the second one `<name>`" | Claude uses the ID from the list output |
44
+ | "Unname the `<name>` session" | Claude searches, finds it, clears the name |
45
+
46
+ Names are 1–50 characters. Named sessions rank highest in search results. Clearing a name with `unname` preserves the AI summary.
47
+
48
+ ## How it works
49
+
50
+ ### Index build
51
+
52
+ 1. Parse `~/.claude/history.jsonl` for session IDs, timestamps, and project paths
53
+ 2. Scan `~/.claude/projects/*/` session files for conversation content, working directory, and git branch
54
+ 3. Generate summaries via Claude Haiku (5 bullet points per session, 10 concurrent requests)
55
+
56
+ ### Caching
57
+
58
+ - Index cache invalidates when `history.jsonl` changes or any session file is modified
59
+ - Summary cache persists across rebuilds — each session is summarized once
60
+ - Cached lookups: ~30ms
61
+
62
+ ### Search scoring
63
+
64
+ | Signal | Weight |
65
+ |---|---|
66
+ | Name match | 15 |
67
+ | Summary match | 12 |
68
+ | First message match | 10 |
69
+ | Last message match | 5 |
70
+ | Project/path match | 3 |
71
+ | All messages match | 2 |
72
+ | Quoted phrase | 2× multiplier |
73
+ | Within 24 hours | 1.5× recency boost |
74
+ | Within 7 days | 1.2× recency boost |
75
+
76
+ ## MCP Server
77
+
78
+ `claude-session-skill` ships a Model Context Protocol (MCP) server so any MCP-compatible client (Claude Desktop, Cursor, etc.) can search sessions without using the CLI skill.
79
+
80
+ ### Install (via npm)
81
+
82
+ ```bash
83
+ npm install -g claude-session-skill
84
+ # or run without installing:
85
+ bunx claude-session-mcp
86
+ ```
87
+
88
+ ### Claude Desktop config
89
+
90
+ ```json
91
+ {
92
+ "mcpServers": {
93
+ "claude-session": {
94
+ "command": "bunx",
95
+ "args": ["claude-session-mcp"],
96
+ "env": {
97
+ "ANTHROPIC_API_KEY": "<your-key>"
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ Or with the global install:
105
+
106
+ ```json
107
+ {
108
+ "mcpServers": {
109
+ "claude-session": {
110
+ "command": "claude-session-mcp"
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### Available tools
117
+
118
+ | Tool | Parameters | Description |
119
+ |------|-----------|-------------|
120
+ | `list_sessions` | `limit?: number` | List recent sessions with AI summaries |
121
+ | `search_sessions` | `query: string` | Search by keyword or quoted phrase |
122
+ | `show_session` | `id: string` | Detailed view of a specific session |
123
+ | `name_session` | `id?: string, name: string` | Assign a memorable name to a session |
124
+ | `unname_session` | `id?: string` | Remove a session's name |
125
+ | `session_stats` | — | Statistics broken down by project |
126
+
127
+ ### Verify with MCP Inspector
128
+
129
+ ```bash
130
+ bunx @modelcontextprotocol/inspector bun mcp-server.ts
131
+ ```
132
+
133
+ ## File structure
134
+
135
+ ```
136
+ session.ts # CLI entry point
137
+ mcp-server.ts # MCP server entry point (6 tools)
138
+ lib/
139
+ indexer.ts # Index builder, summarizer, name persistence
140
+ search.ts # Weighted keyword search
141
+ format.ts # Terminal output formatting
142
+ __tests__/ # Unit tests (bun:test)
143
+ dist/ # Built Node-compatible bundles (gitignored)
144
+ SKILL.md # Skill manifest and Claude instructions
145
+ data/ # Auto-generated, gitignored
146
+ index.json # Cached session index
147
+ summaries.json # Persistent AI summaries
148
+ names.json # User-assigned session names
149
+ ```
150
+
151
+ ## Configuration
152
+
153
+ | Variable | Default | Description |
154
+ |---|---|---|
155
+ | `ANTHROPIC_API_KEY` | required | Used for session summarization |
156
+ | `SESSION_SUMMARY_MODEL` | `claude-haiku-4-5-20251001` | Model used for summarization |
157
+ | `SESSION_DEBUG` | unset | Enable debug logging to stderr |
158
+
159
+ ## Development
160
+
161
+ ```bash
162
+ git clone https://github.com/ITeachYouAI/claude-session-skill.git
163
+ cd claude-session-skill
164
+ bun install
165
+ bun test
166
+ bun x tsc --noEmit
167
+ ```
168
+
169
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
170
+
171
+ ## License
172
+
173
+ MIT
package/SKILL.md ADDED
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: session
3
+ description: Search and browse past Claude Code sessions. Indexes all session history already stored by Claude Code and makes it searchable by keyword, project, or date. Can also name sessions for easy recall.
4
+ triggers:
5
+ - session
6
+ - find session
7
+ - session search
8
+ - search sessions
9
+ - past session
10
+ - name session
11
+ - session name
12
+ - name this session
13
+ - call this session
14
+ - unname session
15
+ - clear session name
16
+ ---
17
+
18
+ # Session Tracker Skill
19
+
20
+ ## Usage
21
+
22
+ ```
23
+ /session <query> # Search sessions by keyword
24
+ /session list # Show 20 most recent sessions
25
+ /session list --all # Show all sessions
26
+ /session show <id> # Full details (supports partial IDs)
27
+ /session name <name> # Name the most recent session (by last activity)
28
+ /session name <id> <name> # Name a specific session by ID
29
+ /session unname [<id>] # Clear a session's name
30
+ /session rebuild # Force rebuild the index
31
+ /session stats # Index statistics by project
32
+ ```
33
+
34
+ ## How It Works
35
+
36
+ Claude Code already saves every user message to `~/.claude/history.jsonl` with session IDs, timestamps, and project paths. Session transcripts live as individual JSONL files under `~/.claude/projects/*/`. This skill indexes all of that and makes it searchable.
37
+
38
+ ### Implementation
39
+
40
+ Entry point: `bun run ~/.claude/skills/session/session.ts <command> [args]`
41
+
42
+ **CRITICAL OUTPUT RULES — read before running anything:**
43
+ 1. **Print the FULL command output verbatim.** Do NOT summarize, paraphrase, truncate, or reformat it. The skill handles all formatting. Your job is to relay what it prints, nothing more.
44
+ 2. **Do NOT add commentary** after the output. No "What do you need?", no "Here are your sessions:", no interpretation. Just the raw output.
45
+ 3. **Do NOT ask follow-up questions** after `list` or `search`. The output is self-contained.
46
+ 4. **If the user references an already-shown list** (e.g., "the most recent", "the third one", "that one") — use the IDs already printed in the previous output. Do NOT re-run `list` or `show` unnecessarily.
47
+
48
+ ### Naming Sessions
49
+
50
+ Users name sessions in natural language. They will NEVER type IDs. Your job is to resolve which session they mean.
51
+
52
+ **How to handle naming requests:**
53
+
54
+ 1. **"Name this session X"** / **"Call this session X"** — Name the most recent session (by last activity). Run: `session.ts name "<name>"`
55
+ 2. **"Name the session where I worked on the clinic bot"** — First search (`session.ts search "clinic bot"`), identify the right session from results, then name it by ID (`session.ts name <id> "<name>"`). The user never sees or types the ID — you resolve it.
56
+ 3. **"Name my last session X"** — Run: `session.ts name "<name>"` (defaults to most recent by last activity)
57
+ 4. **After `/session list`**, user says **"name the third one X"** — You already have the list output with IDs. Use the ID from the third entry.
58
+ 5. **"Clear the name from X"** / **"Unname the clinic bot session"** — Search to find it, then run: `session.ts unname <id>`. Or `session.ts unname` to clear the most recent.
59
+
60
+ **Key rules:**
61
+ - The user NEVER types or sees session IDs. You handle all ID resolution behind the scenes.
62
+ - Names are 1-50 characters. If the user gives something longer, ask them to shorten it.
63
+ - Named sessions show as `Name — summary` in list view and `Name: X` in detail view.
64
+ - Names are searchable — `/session search "Vault Reorg"` finds named sessions with highest relevance.
65
+ - Names can be cleared with `unname` — this removes the name but preserves the AI summary.