@aladac/hu 0.1.0-a1 → 0.1.0-a2

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/SAMPLE.md DELETED
@@ -1,378 +0,0 @@
1
- # honbu Hooks: Feature Ideas
2
-
3
- Potential features enabled by Claude Code hooks + honbu integration.
4
-
5
- ## Core Infrastructure
6
-
7
- ### Session Bus (`~/.claude/bus/`)
8
-
9
- A shared data layer for cross-session and cross-instance communication.
10
-
11
- ```
12
- ~/.claude/bus/
13
- ├── sessions/ # Active session state
14
- │ ├── {session_id}.json
15
- │ └── index.json # All active sessions
16
- ├── messages/ # Inter-session messaging
17
- │ ├── inbox/
18
- │ └── outbox/
19
- ├── knowledge/ # Persistent knowledge store
20
- │ ├── facts.jsonl # Learned facts
21
- │ ├── patterns.jsonl # Code patterns seen
22
- │ └── decisions.jsonl # Decisions made
23
- ├── locks/ # File locking for coordination
24
- └── events/ # Event stream (pub/sub)
25
- ```
26
-
27
- ### Commands
28
-
29
- ```bash
30
- # Session management
31
- honbu bus session register # Register current session
32
- honbu bus session list # List active sessions
33
- honbu bus session get <id> # Get session state
34
- honbu bus session broadcast # Send to all sessions
35
-
36
- # Knowledge store
37
- honbu bus knowledge add # Add fact/pattern
38
- honbu bus knowledge query # Query knowledge
39
- honbu bus knowledge export # Export for context injection
40
-
41
- # Messaging
42
- honbu bus send <session> <msg> # Send to specific session
43
- honbu bus recv # Check for messages
44
- honbu bus subscribe <topic> # Subscribe to topic
45
- ```
46
-
47
- ---
48
-
49
- ## Feature Ideas by Hook
50
-
51
- ### SessionStart
52
-
53
- **Context Loading**
54
- ```bash
55
- honbu hooks session-start startup
56
- ```
57
- - Load recent git commits/changes
58
- - Inject unresolved TODOs from other sessions
59
- - Load relevant knowledge from bus
60
- - Check for messages from other instances
61
- - Restore environment variables
62
-
63
- **Multi-Instance Awareness**
64
- ```bash
65
- # On startup, check what other instances are doing
66
- honbu bus session list --project $(pwd)
67
- # Output: "Instance A is working on auth module, Instance B on tests"
68
- # Inject this as context to avoid conflicts
69
- ```
70
-
71
- **Project State Snapshot**
72
- ```bash
73
- honbu hooks session-start startup
74
- # Returns:
75
- # - Current branch, uncommitted changes
76
- # - Failed tests from last run
77
- # - Open PRs affecting this code
78
- # - Recent errors from logs
79
- ```
80
-
81
- ---
82
-
83
- ### UserPromptSubmit
84
-
85
- **Prompt Enhancement**
86
- ```bash
87
- honbu hooks user-prompt-submit
88
- ```
89
- - Detect keywords and auto-inject relevant docs
90
- - Check knowledge bus for related previous work
91
- - Add "another instance is editing this file" warnings
92
- - Inject project conventions reminder
93
-
94
- **Smart Routing**
95
- ```bash
96
- # If prompt mentions "test", inject test conventions
97
- # If prompt mentions a file, inject its recent history
98
- # If prompt mentions a pattern seen before, inject learned context
99
- ```
100
-
101
- **Deduplication**
102
- ```bash
103
- # Check if another session already solved this
104
- honbu bus knowledge query "error: cannot find module X"
105
- # Returns: "Session abc123 fixed this by running npm install"
106
- ```
107
-
108
- ---
109
-
110
- ### PreToolUse
111
-
112
- **File Coordination**
113
- ```bash
114
- honbu hooks pre-tool-use file-modify
115
- ```
116
- - Check if another instance has this file locked
117
- - Warn about concurrent edits
118
- - Auto-acquire lock if available
119
-
120
- ```json
121
- {
122
- "hookSpecificOutput": {
123
- "hookEventName": "PreToolUse",
124
- "permissionDecision": "deny",
125
- "permissionDecisionReason": "File locked by session abc123 (editing auth module)"
126
- }
127
- }
128
- ```
129
-
130
- **Command Safety**
131
- ```bash
132
- honbu hooks pre-tool-use bash
133
- ```
134
- - Log all commands to knowledge base
135
- - Block dangerous patterns (rm -rf, force push)
136
- - Check command against project policies
137
- - Rate limit expensive operations
138
-
139
- **Smart Caching**
140
- ```bash
141
- honbu hooks pre-tool-use search
142
- ```
143
- - Cache grep/glob results
144
- - Return cached results for repeated queries
145
- - Share search results across sessions
146
-
147
- ---
148
-
149
- ### PostToolUse
150
-
151
- **Learning System**
152
- ```bash
153
- honbu hooks post-tool-use file-modify
154
- ```
155
- - Record file modification patterns
156
- - Learn project structure over time
157
- - Track which files often change together
158
- - Build implicit dependency graph
159
-
160
- **Auto-Actions**
161
- ```bash
162
- honbu hooks post-tool-use bash
163
- ```
164
- - If test failed, record in knowledge bus
165
- - If build succeeded, clear related error knowledge
166
- - If command produced useful output, cache it
167
-
168
- **Notification Routing**
169
- ```bash
170
- honbu hooks post-tool-use subagent
171
- ```
172
- - Notify other sessions about completed work
173
- - Update shared progress tracker
174
- - Publish events for interested subscribers
175
-
176
- ---
177
-
178
- ### Stop / SubagentStop
179
-
180
- **Work Handoff**
181
- ```bash
182
- honbu hooks stop
183
- ```
184
- - Save unfinished work to bus
185
- - Record "I was working on X, got to Y"
186
- - Create resumption context for next session
187
- - Notify other instances work is available
188
-
189
- **Knowledge Extraction**
190
- ```bash
191
- honbu hooks stop
192
- ```
193
- - Extract learned facts from conversation
194
- - Record successful patterns
195
- - Update project knowledge base
196
- - Log time spent on task categories
197
-
198
- ---
199
-
200
- ### PreCompact
201
-
202
- **Memory Preservation**
203
- ```bash
204
- honbu hooks pre-compact auto
205
- ```
206
- - Extract key facts before context compaction
207
- - Save important decisions to knowledge bus
208
- - Create resumption checkpoint
209
- - Preserve cross-session relevant info
210
-
211
- ---
212
-
213
- ### SessionEnd
214
-
215
- **Cleanup & Sync**
216
- ```bash
217
- honbu hooks session-end
218
- ```
219
- - Release all file locks
220
- - Deregister from session bus
221
- - Sync local knowledge to global store
222
- - Generate session summary
223
-
224
- **Analytics**
225
- ```bash
226
- honbu hooks session-end
227
- ```
228
- - Log session duration, tool usage stats
229
- - Record success/failure patterns
230
- - Update productivity metrics
231
-
232
- ---
233
-
234
- ## Advanced Features
235
-
236
- ### Cross-Instance Coordination
237
-
238
- **Scenario**: Multiple Claude Code instances working on same project
239
-
240
- ```
241
- ┌─────────────────────────────────────────────────────┐
242
- │ honbu bus │
243
- ├─────────────────────────────────────────────────────┤
244
- │ Instance A Instance B Instance C │
245
- │ (auth module) (tests) (docs) │
246
- │ │ │ │ │
247
- │ └──────────────────┼──────────────────┘ │
248
- │ │ │
249
- │ Shared Knowledge Store │
250
- │ File Locks / Coordination │
251
- │ Message Passing │
252
- └─────────────────────────────────────────────────────┘
253
- ```
254
-
255
- **File Locking**
256
- ```bash
257
- # PreToolUse: Acquire lock
258
- honbu bus lock acquire src/auth.ts --session $SESSION_ID
259
-
260
- # PostToolUse: Release lock
261
- honbu bus lock release src/auth.ts
262
-
263
- # Check locks
264
- honbu bus lock list
265
- # src/auth.ts - session abc (Instance A)
266
- # src/tests/auth.test.ts - session def (Instance B)
267
- ```
268
-
269
- **Work Broadcasting**
270
- ```bash
271
- # Instance A finishes auth module
272
- honbu bus broadcast "auth module complete, ready for integration tests"
273
-
274
- # Instance B receives on next UserPromptSubmit
275
- honbu bus recv
276
- # "Message from Instance A: auth module complete..."
277
- ```
278
-
279
- ### Knowledge Accumulation
280
-
281
- **Fact Learning**
282
- ```bash
283
- # After successful debugging
284
- honbu bus knowledge add \
285
- --type "error-solution" \
286
- --pattern "ENOENT: no such file" \
287
- --solution "Check file path, run npm install" \
288
- --confidence 0.9
289
-
290
- # Later, on similar error
291
- honbu bus knowledge query "ENOENT"
292
- # Returns previous solutions with confidence scores
293
- ```
294
-
295
- **Pattern Recognition**
296
- ```bash
297
- # Track file co-modification
298
- honbu bus knowledge add \
299
- --type "file-coupling" \
300
- --files "src/api.ts,src/api.test.ts,src/types.ts" \
301
- --frequency 15
302
-
303
- # On editing api.ts, suggest related files
304
- honbu hooks pre-tool-use file-modify
305
- # Injects: "Files often modified together: api.test.ts, types.ts"
306
- ```
307
-
308
- ### Smart Context Injection
309
-
310
- **SessionStart: Project Awareness**
311
- ```bash
312
- honbu hooks session-start startup
313
- ```
314
- Output (injected as context):
315
- ```
316
- ## Project State
317
- - Branch: feature/auth (3 commits ahead of main)
318
- - Uncommitted: src/auth.ts (+45), tests/auth.test.ts (+20)
319
- - Last session: worked on JWT validation, incomplete
320
- - Other instances: none active
321
-
322
- ## Recent Knowledge
323
- - Pattern: This project uses Zod for validation
324
- - Fact: Auth tokens expire in 24h (from .env discussion)
325
- - Warning: Don't modify src/legacy/* (marked deprecated)
326
-
327
- ## Pending Tasks
328
- - [ ] Add refresh token logic (from session xyz)
329
- - [ ] Fix flaky test in auth.test.ts
330
- ```
331
-
332
- ### Event-Driven Workflows
333
-
334
- **Pub/Sub System**
335
- ```bash
336
- # Subscribe to file changes
337
- honbu bus subscribe "file:src/api/*"
338
-
339
- # Publish events
340
- honbu bus publish "file:src/api/auth.ts" "modified"
341
-
342
- # Other sessions receive
343
- honbu bus recv --topic "file:src/api/*"
344
- ```
345
-
346
- **Automated Reactions**
347
- ```bash
348
- # PostToolUse on test failure
349
- honbu bus publish "test:fail" "auth.test.ts:45"
350
-
351
- # SessionStart checks for failures
352
- honbu bus query --topic "test:fail" --since "1h"
353
- # Injects: "Recent test failures: auth.test.ts:45"
354
- ```
355
-
356
- ---
357
-
358
- ## Implementation Priority
359
-
360
- ### Phase 1: Core Bus
361
- - [ ] Session registry
362
- - [ ] File locking
363
- - [ ] Basic messaging
364
-
365
- ### Phase 2: Knowledge Store
366
- - [ ] Fact storage/retrieval
367
- - [ ] Pattern tracking
368
- - [ ] Context generation
369
-
370
- ### Phase 3: Advanced Coordination
371
- - [ ] Pub/sub events
372
- - [ ] Cross-instance sync
373
- - [ ] Conflict resolution
374
-
375
- ### Phase 4: Intelligence
376
- - [ ] Pattern recognition
377
- - [ ] Predictive suggestions
378
- - [ ] Automated learning
package/TODO.md DELETED
@@ -1,25 +0,0 @@
1
- # TODO: honbu data Subcommand
2
-
3
- ## Phase 1: Core Data Access Commands
4
- - [ ] Step 1.1: Create data command module structure
5
- - [ ] Step 1.2: Add data store path utilities
6
- - [ ] Step 1.3: Implement session list command
7
- - [ ] Step 1.4: Implement session read command
8
- - [ ] Step 1.5: Implement stats command
9
- - [ ] Step 1.6: Implement history command
10
-
11
- ## Phase 2: Extended Data Access
12
- - [ ] Step 2.1: Implement todos list command
13
- - [ ] Step 2.2: Implement todos pending command
14
- - [ ] Step 2.3: Implement file-history list command
15
- - [ ] Step 2.4: Implement session current command
16
-
17
- ## Phase 3: Search and Query
18
- - [ ] Step 3.1: Implement session search command
19
- - [ ] Step 3.2: Implement tools usage command
20
- - [ ] Step 3.3: Implement errors command
21
-
22
- ## Phase 4: JSONL Parsing Library
23
- - [ ] Step 4.1: Create JSONL parser module
24
- - [ ] Step 4.2: Create session transcript parser
25
- - [ ] Step 4.3: Refactor data commands to use parsers