@tekmidian/pai 0.5.7 → 0.6.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.
Files changed (137) hide show
  1. package/ARCHITECTURE.md +72 -1
  2. package/README.md +87 -1
  3. package/dist/{auto-route-BG6I_4B1.mjs → auto-route-C-DrW6BL.mjs} +3 -3
  4. package/dist/{auto-route-BG6I_4B1.mjs.map → auto-route-C-DrW6BL.mjs.map} +1 -1
  5. package/dist/cli/index.mjs +1482 -1628
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/clusters-JIDQW65f.mjs +201 -0
  8. package/dist/clusters-JIDQW65f.mjs.map +1 -0
  9. package/dist/{config-Cf92lGX_.mjs → config-BuhHWyOK.mjs} +21 -6
  10. package/dist/config-BuhHWyOK.mjs.map +1 -0
  11. package/dist/daemon/index.mjs +11 -8
  12. package/dist/daemon/index.mjs.map +1 -1
  13. package/dist/{daemon-2ND5WO2j.mjs → daemon-D3hYb5_C.mjs} +669 -218
  14. package/dist/daemon-D3hYb5_C.mjs.map +1 -0
  15. package/dist/daemon-mcp/index.mjs +4597 -4
  16. package/dist/daemon-mcp/index.mjs.map +1 -1
  17. package/dist/db-DdUperSl.mjs +110 -0
  18. package/dist/db-DdUperSl.mjs.map +1 -0
  19. package/dist/{detect-BU3Nx_2L.mjs → detect-CdaA48EI.mjs} +1 -1
  20. package/dist/{detect-BU3Nx_2L.mjs.map → detect-CdaA48EI.mjs.map} +1 -1
  21. package/dist/{detector-Bp-2SM3x.mjs → detector-jGBuYQJM.mjs} +2 -2
  22. package/dist/{detector-Bp-2SM3x.mjs.map → detector-jGBuYQJM.mjs.map} +1 -1
  23. package/dist/{factory-Bzcy70G9.mjs → factory-Ygqe_bVZ.mjs} +7 -5
  24. package/dist/{factory-Bzcy70G9.mjs.map → factory-Ygqe_bVZ.mjs.map} +1 -1
  25. package/dist/helpers-BEST-4Gx.mjs +420 -0
  26. package/dist/helpers-BEST-4Gx.mjs.map +1 -0
  27. package/dist/hooks/capture-all-events.mjs +2 -2
  28. package/dist/hooks/capture-all-events.mjs.map +3 -3
  29. package/dist/hooks/capture-session-summary.mjs +38 -0
  30. package/dist/hooks/capture-session-summary.mjs.map +3 -3
  31. package/dist/hooks/cleanup-session-files.mjs +6 -12
  32. package/dist/hooks/cleanup-session-files.mjs.map +4 -4
  33. package/dist/hooks/context-compression-hook.mjs +93 -104
  34. package/dist/hooks/context-compression-hook.mjs.map +4 -4
  35. package/dist/hooks/initialize-session.mjs +14 -11
  36. package/dist/hooks/initialize-session.mjs.map +4 -4
  37. package/dist/hooks/inject-observations.mjs +220 -0
  38. package/dist/hooks/inject-observations.mjs.map +7 -0
  39. package/dist/hooks/load-core-context.mjs +2 -2
  40. package/dist/hooks/load-core-context.mjs.map +3 -3
  41. package/dist/hooks/load-project-context.mjs +90 -91
  42. package/dist/hooks/load-project-context.mjs.map +4 -4
  43. package/dist/hooks/observe.mjs +354 -0
  44. package/dist/hooks/observe.mjs.map +7 -0
  45. package/dist/hooks/stop-hook.mjs +94 -107
  46. package/dist/hooks/stop-hook.mjs.map +4 -4
  47. package/dist/hooks/sync-todo-to-md.mjs +31 -33
  48. package/dist/hooks/sync-todo-to-md.mjs.map +4 -4
  49. package/dist/index.d.mts +30 -7
  50. package/dist/index.d.mts.map +1 -1
  51. package/dist/index.mjs +5 -8
  52. package/dist/indexer-D53l5d1U.mjs +1 -0
  53. package/dist/{indexer-backend-CIMXedqk.mjs → indexer-backend-jcJFsmB4.mjs} +37 -127
  54. package/dist/indexer-backend-jcJFsmB4.mjs.map +1 -0
  55. package/dist/{ipc-client-Bjg_a1dc.mjs → ipc-client-CoyUHPod.mjs} +2 -7
  56. package/dist/{ipc-client-Bjg_a1dc.mjs.map → ipc-client-CoyUHPod.mjs.map} +1 -1
  57. package/dist/latent-ideas-bTJo6Omd.mjs +191 -0
  58. package/dist/latent-ideas-bTJo6Omd.mjs.map +1 -0
  59. package/dist/neighborhood-BYYbEkUJ.mjs +135 -0
  60. package/dist/neighborhood-BYYbEkUJ.mjs.map +1 -0
  61. package/dist/note-context-BK24bX8Y.mjs +126 -0
  62. package/dist/note-context-BK24bX8Y.mjs.map +1 -0
  63. package/dist/postgres-CKf-EDtS.mjs +846 -0
  64. package/dist/postgres-CKf-EDtS.mjs.map +1 -0
  65. package/dist/{reranker-D7bRAHi6.mjs → reranker-CMNZcfVx.mjs} +1 -1
  66. package/dist/{reranker-D7bRAHi6.mjs.map → reranker-CMNZcfVx.mjs.map} +1 -1
  67. package/dist/{search-_oHfguA5.mjs → search-DC1qhkKn.mjs} +2 -58
  68. package/dist/search-DC1qhkKn.mjs.map +1 -0
  69. package/dist/{sqlite-WWBq7_2C.mjs → sqlite-l-s9xPjY.mjs} +160 -3
  70. package/dist/sqlite-l-s9xPjY.mjs.map +1 -0
  71. package/dist/state-C6_vqz7w.mjs +102 -0
  72. package/dist/state-C6_vqz7w.mjs.map +1 -0
  73. package/dist/stop-words-BaMEGVeY.mjs +326 -0
  74. package/dist/stop-words-BaMEGVeY.mjs.map +1 -0
  75. package/dist/{indexer-CMPOiY1r.mjs → sync-BOsnEj2-.mjs} +14 -216
  76. package/dist/sync-BOsnEj2-.mjs.map +1 -0
  77. package/dist/themes-BvYF0W8T.mjs +148 -0
  78. package/dist/themes-BvYF0W8T.mjs.map +1 -0
  79. package/dist/{tools-DV_lsiCc.mjs → tools-DcaJlYDN.mjs} +162 -273
  80. package/dist/tools-DcaJlYDN.mjs.map +1 -0
  81. package/dist/trace-CRx9lPuc.mjs +137 -0
  82. package/dist/trace-CRx9lPuc.mjs.map +1 -0
  83. package/dist/{vault-indexer-k-kUlaZ-.mjs → vault-indexer-Bi2cRmn7.mjs} +134 -132
  84. package/dist/vault-indexer-Bi2cRmn7.mjs.map +1 -0
  85. package/dist/zettelkasten-cdajbnPr.mjs +708 -0
  86. package/dist/zettelkasten-cdajbnPr.mjs.map +1 -0
  87. package/package.json +1 -2
  88. package/src/hooks/ts/lib/project-utils/index.ts +50 -0
  89. package/src/hooks/ts/lib/project-utils/notify.ts +75 -0
  90. package/src/hooks/ts/lib/project-utils/paths.ts +218 -0
  91. package/src/hooks/ts/lib/project-utils/session-notes.ts +363 -0
  92. package/src/hooks/ts/lib/project-utils/todo.ts +178 -0
  93. package/src/hooks/ts/lib/project-utils/tokens.ts +39 -0
  94. package/src/hooks/ts/lib/project-utils.ts +40 -1018
  95. package/src/hooks/ts/post-tool-use/observe.ts +327 -0
  96. package/src/hooks/ts/session-end/capture-session-summary.ts +41 -0
  97. package/src/hooks/ts/session-start/inject-observations.ts +254 -0
  98. package/dist/chunker-CbnBe0s0.mjs +0 -191
  99. package/dist/chunker-CbnBe0s0.mjs.map +0 -1
  100. package/dist/config-Cf92lGX_.mjs.map +0 -1
  101. package/dist/daemon-2ND5WO2j.mjs.map +0 -1
  102. package/dist/db-Dp8VXIMR.mjs +0 -212
  103. package/dist/db-Dp8VXIMR.mjs.map +0 -1
  104. package/dist/indexer-CMPOiY1r.mjs.map +0 -1
  105. package/dist/indexer-backend-CIMXedqk.mjs.map +0 -1
  106. package/dist/mcp/index.d.mts +0 -1
  107. package/dist/mcp/index.mjs +0 -500
  108. package/dist/mcp/index.mjs.map +0 -1
  109. package/dist/postgres-FXrHDPcE.mjs +0 -358
  110. package/dist/postgres-FXrHDPcE.mjs.map +0 -1
  111. package/dist/schemas-BFIgGntb.mjs +0 -3405
  112. package/dist/schemas-BFIgGntb.mjs.map +0 -1
  113. package/dist/search-_oHfguA5.mjs.map +0 -1
  114. package/dist/sqlite-WWBq7_2C.mjs.map +0 -1
  115. package/dist/tools-DV_lsiCc.mjs.map +0 -1
  116. package/dist/vault-indexer-k-kUlaZ-.mjs.map +0 -1
  117. package/dist/zettelkasten-e-a4rW_6.mjs +0 -901
  118. package/dist/zettelkasten-e-a4rW_6.mjs.map +0 -1
  119. package/templates/README.md +0 -181
  120. package/templates/skills/CORE/Aesthetic.md +0 -333
  121. package/templates/skills/CORE/CONSTITUTION.md +0 -1502
  122. package/templates/skills/CORE/HistorySystem.md +0 -427
  123. package/templates/skills/CORE/HookSystem.md +0 -1082
  124. package/templates/skills/CORE/Prompting.md +0 -509
  125. package/templates/skills/CORE/ProsodyAgentTemplate.md +0 -53
  126. package/templates/skills/CORE/ProsodyGuide.md +0 -416
  127. package/templates/skills/CORE/SKILL.md +0 -741
  128. package/templates/skills/CORE/SkillSystem.md +0 -213
  129. package/templates/skills/CORE/TerminalTabs.md +0 -119
  130. package/templates/skills/CORE/VOICE.md +0 -106
  131. package/templates/skills/createskill-skill.template.md +0 -78
  132. package/templates/skills/history-system.template.md +0 -371
  133. package/templates/skills/hook-system.template.md +0 -913
  134. package/templates/skills/sessions-skill.template.md +0 -102
  135. package/templates/skills/skill-system.template.md +0 -214
  136. package/templates/skills/terminal-tabs.template.md +0 -120
  137. package/templates/templates.md +0 -20
@@ -1,102 +0,0 @@
1
- <!-- Generated by PAI Setup -->
2
- ---
3
- name: Sessions
4
- description: Navigate and manage PAI sessions across all projects. USE WHEN user says "list sessions", "where was I working", "show my sessions", "find session", "continue work from", "switch to project", "open project", "name project", "group projects", "consolidate", "organize projects", "clean up sessions", "work on X", "start working on X", "show me what we did on X", "bring notes together", OR asks about past sessions, previous work, or project navigation.
5
- ---
6
-
7
- ## How Session Notes Work
8
-
9
- Session notes track what was done in each Claude session. They live in a `Notes/` directory.
10
-
11
- **The key concept: notes route to a project.** When the user says "work on PAI" or "start working on myproject", you set the routing so all session notes go to that project's Notes directory. The routing is stored in `~/.claude/session-routing.json`.
12
-
13
- **Where notes actually live:**
14
- - Each project has a Notes directory (usually in an Obsidian vault or local Notes folder)
15
- - Code repos can symlink their `Notes/` to a vault path
16
- - Claude also keeps internal copies in `~/.claude/projects/*/Notes/` (for search/history)
17
- - The `pai` CLI manages everything
18
-
19
- **Project paths** are stored in `~/.claude/session-routing.json` under `project_paths`. Add your own projects by editing that file.
20
-
21
- ---
22
-
23
- ## What the User Might Say → What You Do
24
-
25
- **"Work on PAI" / "Start working on myproject" / "Let's do PAI stuff"**
26
- → Run `pai route <project-name>`. Tell user: "Notes now routing to [path]."
27
-
28
- **"Show me the sessions where we worked on PAI" / "What did we do on myproject?"**
29
- → Run `pai search <project-name>`. Show the matching sessions with dates and summaries.
30
-
31
- **"Bring the PAI notes together" / "Consolidate PAI sessions"**
32
- → Search for all sessions matching the project name across all projects. Read the session notes. Combine them into a coherent summary. Write a consolidated note if asked.
33
-
34
- **"List sessions" / "Show recent sessions" / "/sessions"**
35
- → ALWAYS run `pai session active` FIRST to show currently open Claude Code tabs.
36
- → Then run `pai project list` and `pai session list` for the full overview.
37
- → Present active sessions PROMINENTLY at the top of your response.
38
-
39
- **"Where are my notes going?" / "What's the current routing?"**
40
- → Run `pai route` (no args) to show current status.
41
-
42
- **"Stop routing" / "Clear routing" / "Back to default"**
43
- → Run `pai route clear`.
44
-
45
- **"Open the myproject project"**
46
- → Run `pai open <project-name> --claude` to open in a new terminal tab.
47
-
48
- **"Continue work from the myproject project"**
49
- → Search for relevant sessions, read the notes and TODO.md, present context summary, continue working here.
50
-
51
- ---
52
-
53
- ## Commands Reference
54
-
55
- | Command | What it does |
56
- |---------|-------------|
57
- | `pai session active` | **Show currently open Claude Code sessions** (checks JSONL timestamps) |
58
- | `pai session active --minutes 120` | Widen the detection window (default: 60 min) |
59
- | `pai session active --json` | JSON output for programmatic use |
60
- | `pai` | Show all projects with session counts |
61
- | `pai session list` | Detailed session list |
62
- | `pai search "keyword"` | Find sessions by keyword |
63
- | `pai route <project>` | Route notes to a project |
64
- | `pai route` | Show current routing status |
65
- | `pai route clear` | Stop routing, use defaults |
66
- | `pai open <project> --claude` | Open project in new tab |
67
- | `pai name "Name"` | Name the current project |
68
- | `pai info <number>` | Deep dive into a project |
69
-
70
- ---
71
-
72
- ## Examples
73
-
74
- **Example 1: "Show me what we did on PAI"**
75
- ```
76
- → Run: pai search pai
77
- → Show matching sessions with dates
78
- → Offer to read specific session notes for details
79
- ```
80
-
81
- **Example 2: "Let's work on myproject"**
82
- ```
83
- → Run: pai route myproject
84
- → Output: "Notes now routing to .../myproject/Notes"
85
- → Read myproject's TODO.md to see pending work
86
- → Continue from where we left off
87
- ```
88
-
89
- **Example 3: "Bring all the PAI sessions together"**
90
- ```
91
- → Run: pai search pai (find all PAI-related sessions)
92
- → Read each session note
93
- → Create a consolidated summary
94
- → Optionally write it to PAI's Notes directory
95
- ```
96
-
97
- **Example 4: "Where was I working on the appstore?"**
98
- ```
99
- → Run: pai search appstore
100
- → Show matching projects with session counts
101
- → Offer to open or read details
102
- ```
@@ -1,214 +0,0 @@
1
- <!-- Generated by PAI Setup -->
2
- # Custom Skill System
3
-
4
- **The MANDATORY configuration system for ALL PAI skills.**
5
-
6
- ---
7
-
8
- ## THIS IS THE AUTHORITATIVE SOURCE
9
-
10
- This document defines the **required structure** for every skill in the PAI system.
11
-
12
- **ALL skill creation MUST follow this structure.**
13
-
14
- **"Canonicalize a skill"** = Restructure it to match this exact format, including TitleCase naming.
15
-
16
- ---
17
-
18
- ## TitleCase Naming Convention (MANDATORY)
19
-
20
- **All naming in the skill system MUST use TitleCase (PascalCase).**
21
-
22
- | Component | Wrong | Correct |
23
- |-----------|-------|---------|
24
- | Skill directory | `createskill`, `create-skill` | `Createskill` |
25
- | Workflow files | `create.md`, `update-info.md` | `Create.md`, `UpdateInfo.md` |
26
- | Reference docs | `prosody-guide.md` | `ProsodyGuide.md` |
27
- | Tool files | `manage-server.ts` | `ManageServer.ts` |
28
- | YAML name | `name: create-skill` | `name: Createskill` |
29
-
30
- **Exception:** `SKILL.md` is always uppercase (convention for the main skill file).
31
-
32
- ---
33
-
34
- ## The Required Structure
35
-
36
- Every SKILL.md has two parts:
37
-
38
- ### 1. YAML Frontmatter (Single-Line Description)
39
-
40
- ```yaml
41
- ---
42
- name: SkillName
43
- description: [What it does]. USE WHEN [intent triggers using OR]. [Additional capabilities].
44
- ---
45
- ```
46
-
47
- **Rules:**
48
- - `name` uses **TitleCase**
49
- - `description` is a **single line** (not multi-line with `|`)
50
- - `USE WHEN` keyword is **MANDATORY** (Claude Code parses this for skill activation)
51
- - Use intent-based triggers with `OR` for multiple conditions
52
- - Max 1024 characters (Anthropic hard limit)
53
-
54
- ### 2. Markdown Body
55
-
56
- ```markdown
57
- # SkillName
58
-
59
- [Brief description]
60
-
61
- ## Workflow Routing
62
-
63
- **When executing a workflow, do BOTH of these:**
64
-
65
- 1. **Call the notification script** (for observability tracking):
66
- ```bash
67
- ~/.claude/Tools/SkillWorkflowNotification WORKFLOWNAME SKILLNAME
68
- ```
69
-
70
- 2. **Output the text notification** (for user visibility):
71
- ```
72
- Running the **WorkflowName** workflow from the **SKILLNAME** skill...
73
- ```
74
-
75
- This ensures workflows appear in the observability dashboard AND the user sees the announcement.
76
-
77
- | Workflow | Trigger | File |
78
- |----------|---------|------|
79
- | **WorkflowOne** | "trigger phrase" | `workflows/WorkflowOne.md` |
80
- | **WorkflowTwo** | "another trigger" | `workflows/WorkflowTwo.md` |
81
-
82
- ## Examples
83
-
84
- **Example 1: [Common use case]**
85
- ```
86
- User: "[Typical user request]"
87
- → Invokes WorkflowOne workflow
88
- → [What skill does]
89
- → [What user gets back]
90
- ```
91
-
92
- ## [Additional Sections]
93
- ```
94
-
95
- ---
96
-
97
- ## Examples Section (REQUIRED)
98
-
99
- **Every skill MUST have an `## Examples` section** showing 2-3 concrete usage patterns.
100
-
101
- **Why Examples Matter:**
102
- - Anthropic research shows examples improve tool selection accuracy from 72% to 90%
103
- - Descriptions tell Claude WHEN to activate; examples show HOW the skill works
104
-
105
- **Example Format:**
106
- ```markdown
107
- ## Examples
108
-
109
- **Example 1: [Use case name]**
110
- ```
111
- User: "[Actual user request]"
112
- → Invokes WorkflowName workflow
113
- → [What the skill does]
114
- → [What user receives back]
115
- ```
116
- ```
117
-
118
- ---
119
-
120
- ## Intent Matching, Not String Matching
121
-
122
- We use **intent matching**, not exact phrase matching.
123
-
124
- **Example description:**
125
- ```yaml
126
- description: Complete blog workflow. USE WHEN user mentions doing anything with their blog, website, site, including things like update, proofread, write, edit, publish, preview, blog posts, or website pages.
127
- ```
128
-
129
- **Key Principles:**
130
- - Use intent language: "user mentions", "user wants to", "including things like"
131
- - Don't list exact phrases in quotes
132
- - Cover the domain conceptually
133
- - Use `OR` to combine multiple trigger conditions
134
-
135
- ---
136
-
137
- ## Directory Structure
138
-
139
- Every skill follows this structure:
140
-
141
- ```
142
- SkillName/ # TitleCase directory name
143
- ├── SKILL.md # Main skill file (always uppercase)
144
- ├── ReferenceDoc.md # Optional: Reference docs (TitleCase)
145
- ├── tools/ # CLI tools (ALWAYS present, even if empty)
146
- │ ├── ToolName.ts # TypeScript CLI tool (TitleCase)
147
- │ └── ToolName.help.md # Tool documentation (TitleCase)
148
- └── workflows/
149
- ├── Create.md # Work execution workflow (TitleCase)
150
- └── Update.md # Work execution workflow (TitleCase)
151
- ```
152
-
153
- ---
154
-
155
- ## Workflows vs Reference Documentation
156
-
157
- **CRITICAL DISTINCTION:**
158
-
159
- ### Workflows (`workflows/` directory)
160
- - Operational procedures (create, update, delete, deploy)
161
- - Step-by-step execution instructions
162
- - Actions that change state or produce output
163
- - Things you "run" or "execute"
164
-
165
- ### Reference Documentation (skill root)
166
- - Guides and how-to documentation
167
- - Specifications and schemas
168
- - Information you "read" or "reference"
169
-
170
- ---
171
-
172
- ## Complete Checklist
173
-
174
- Before a skill is complete:
175
-
176
- ### Naming (TitleCase)
177
- - [ ] Skill directory uses TitleCase
178
- - [ ] All workflow files use TitleCase
179
- - [ ] All reference docs use TitleCase
180
- - [ ] YAML `name:` uses TitleCase
181
-
182
- ### YAML Frontmatter
183
- - [ ] Single-line description with embedded `USE WHEN` clause
184
- - [ ] No separate `triggers:` or `workflows:` arrays
185
- - [ ] Description under 1024 characters
186
-
187
- ### Markdown Body
188
- - [ ] `## Workflow Routing` section with table format
189
- - [ ] `## Examples` section with 2-3 concrete patterns
190
- - [ ] All workflows have routing entries
191
-
192
- ### Structure
193
- - [ ] `tools/` directory exists (even if empty)
194
- - [ ] No `backups/` directory inside skill
195
- - [ ] Workflows contain ONLY execution procedures
196
- - [ ] Reference docs live at skill root
197
-
198
- ---
199
-
200
- ## Summary
201
-
202
- | Component | Purpose | Naming |
203
- |-----------|---------|--------|
204
- | **Skill directory** | Contains all skill files | TitleCase (e.g., `Blogging`) |
205
- | **SKILL.md** | Main skill file | Always uppercase |
206
- | **Workflow files** | Execution procedures | TitleCase (e.g., `Create.md`) |
207
- | **Reference docs** | Information to read | TitleCase (e.g., `ApiReference.md`) |
208
- | **Tool files** | CLI automation | TitleCase (e.g., `ManageServer.ts`) |
209
-
210
- This system ensures:
211
- 1. Skills invoke properly based on intent (USE WHEN in description)
212
- 2. Specific functionality executes accurately (Workflow Routing in body)
213
- 3. All skills have consistent, predictable structure
214
- 4. **All naming follows TitleCase convention**
@@ -1,120 +0,0 @@
1
- <!-- Generated by PAI Setup -->
2
- # Terminal Tab Title System
3
-
4
- ## Overview
5
-
6
- The PAI system automatically updates your terminal tab title with a 4-word summary of what was done after each task completion. This provides instant visual feedback in your terminal tabs, making it easy to see what each Claude session accomplished.
7
-
8
- ## How It Works
9
-
10
- The `stop-hook.ts` hook runs after every task completion and:
11
-
12
- 1. **Extracts the task summary** from the COMPLETED line in responses
13
- 2. **Generates a 4-word title** that summarizes what was accomplished
14
- 3. **Updates your terminal tab** using ANSI escape sequences
15
-
16
- ## Features
17
-
18
- ### 4-Word Summary Format
19
-
20
- The system creates meaningful 4-word summaries by:
21
- - Using past-tense action verbs (Created, Updated, Fixed, etc.)
22
- - Extracting key nouns from the task
23
- - Prioritizing words from the COMPLETED line when available
24
- - Falling back to the user's original query if needed
25
-
26
- ### Examples
27
-
28
- | User Query | Tab Title |
29
- |------------|-----------|
30
- | "Update the README documentation" | Updated Readme Documentation Done |
31
- | "Fix the stop-hook" | Fixed Stop Hook Successfully |
32
- | "Research AI trends" | Researched AI Trends Complete |
33
- | "Implement new feature" | Implemented New Feature Done |
34
-
35
- ## Terminal Compatibility
36
-
37
- The tab title system works with terminals that support OSC (Operating System Command) sequences:
38
-
39
- - **Kitty** - Full support
40
- - **iTerm2** - Full support
41
- - **Terminal.app** - Full support
42
- - **Alacritty** - Full support
43
- - **VS Code Terminal** - Full support
44
-
45
- ## Implementation Details
46
-
47
- ### Escape Sequences Used
48
-
49
- ```bash
50
- # OSC 0 - Sets icon and window title
51
- printf '\033]0;Title Here\007'
52
-
53
- # OSC 2 - Sets window title
54
- printf '\033]2;Title Here\007'
55
-
56
- # OSC 30 - Kitty-specific tab title
57
- printf '\033]30;Title Here\007'
58
- ```
59
-
60
- ### Hook Location
61
-
62
- The terminal tab functionality is implemented in:
63
- ```
64
- ${PAI_DIR}/Hooks/stop-hook.ts
65
- ```
66
-
67
- ### Key Functions
68
-
69
- 1. **generateTabTitle(prompt, completedLine)** - Creates the 4-word summary
70
- 2. **setTabTitle(title)** - Sends escape sequences to update the tab
71
- 3. **Hook execution** - Runs automatically after every task
72
-
73
- ## Debugging
74
-
75
- If tab titles aren't updating:
76
-
77
- 1. **Check hook is executable:**
78
- ```bash
79
- ls -la ${PAI_DIR}/Hooks/stop-hook.ts
80
- # Should show: -rwxr-xr-x
81
- ```
82
-
83
- 2. **Verify Claude Code settings:**
84
- - Ensure stop-hook is configured in your Claude Code settings
85
- - Path should be: `${PAI_DIR}/Hooks/stop-hook.ts`
86
-
87
- 3. **Test manually:**
88
- ```bash
89
- printf '\033]0;Test Title\007' >&2
90
- ```
91
-
92
- 4. **Check stderr output:**
93
- The hook logs to stderr with:
94
- - Tab title changes
95
- - User queries processed
96
- - Completed text extracted
97
-
98
- ## Customization
99
-
100
- To modify the tab title behavior, edit `${PAI_DIR}/Hooks/stop-hook.ts`:
101
-
102
- - Change word count (currently 4 words)
103
- - Modify verb tense (currently past tense)
104
- - Add custom prefixes or suffixes
105
- - Filter different stop words
106
-
107
- ## Benefits
108
-
109
- - **Visual Task Tracking** - See what each tab accomplished at a glance
110
- - **Multi-Session Management** - Easily identify different Claude sessions
111
- - **Task History** - Tab titles persist as a record of completed work
112
- - **No Manual Updates** - Fully automatic, runs on every task completion
113
-
114
- ## Integration with Voice System
115
-
116
- The terminal tab system works alongside the voice notification system:
117
- - Both extract information from the COMPLETED line
118
- - Tab gets a 4-word visual summary
119
- - Voice speaks the completion message
120
- - Both provide immediate feedback through different channels
@@ -1,20 +0,0 @@
1
- ---
2
- related:
3
- - '[[Ideaverse/AI/PAI/templates/README|README]]'
4
- - '[[Ideaverse/AI/PAI/templates/agent-prefs.example|agent-prefs.example]]'
5
- - '[[Ideaverse/AI/PAI/templates/claude-md.template|claude-md.template]]'
6
- - '[[Ideaverse/AI/PAI/templates/pai-project.template|pai-project.template]]'
7
- links:
8
- - '[[Ideaverse/AI/PAI/PAI|PAI]]'
9
- ---
10
- emplates
11
-
12
- - [README](./README.md)
13
- - [agent-prefs.example](./agent-prefs.example.md)
14
- - [claude-md.template](./claude-md.template.md)
15
- - [pai-project.template](./pai-project.template.md)
16
-
17
- [← PAI](../)
18
-
19
- ---
20
- *Links:* [[Ideaverse/AI/PAI/templates/README|README]] · [[Ideaverse/AI/PAI/templates/agent-prefs.example|agent-prefs.example]] · [[Ideaverse/AI/PAI/templates/claude-md.template|claude-md.template]] · [[Ideaverse/AI/PAI/templates/pai-project.template|pai-project.template]] · [[Ideaverse/AI/PAI/PAI|PAI]]