claude-memory-layer 1.0.23 → 1.0.24
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/.claude/settings.local.json +11 -0
- package/README.md +2 -0
- package/dist/cli/index.js +85 -17
- package/dist/cli/index.js.map +2 -2
- package/dist/core/index.js +28 -5
- package/dist/core/index.js.map +2 -2
- package/dist/hooks/post-tool-use.js +115 -18
- package/dist/hooks/post-tool-use.js.map +2 -2
- package/dist/hooks/semantic-daemon.js +7337 -0
- package/dist/hooks/semantic-daemon.js.map +7 -0
- package/dist/hooks/session-end.js +69 -16
- package/dist/hooks/session-end.js.map +2 -2
- package/dist/hooks/session-start.js +154 -24
- package/dist/hooks/session-start.js.map +4 -4
- package/dist/hooks/stop.js +99 -18
- package/dist/hooks/stop.js.map +2 -2
- package/dist/hooks/user-prompt-submit.js +289 -102
- package/dist/hooks/user-prompt-submit.js.map +4 -4
- package/dist/server/api/index.js +69 -16
- package/dist/server/api/index.js.map +2 -2
- package/dist/server/index.js +69 -16
- package/dist/server/index.js.map +2 -2
- package/dist/services/memory-service.js +69 -16
- package/dist/services/memory-service.js.map +2 -2
- package/dist/ui/app.js +48 -1
- package/dist/ui/index.html +11 -3
- package/memory/_index.md +1 -0
- package/memory/agent_response/uncategorized/2026-03-04.md +1098 -1
- package/memory/session_summary/uncategorized/2026-03-04.md +31 -0
- package/memory/tool_observation/uncategorized/2026-03-04.md +733 -1
- package/memory/user_prompt/uncategorized/2026-03-04.md +371 -1
- package/package.json +1 -1
- package/scripts/build.ts +2 -1
- package/specs/selective-tool-observation/context.md +100 -0
- package/specs/selective-tool-observation/plan.md +158 -0
- package/specs/selective-tool-observation/spec.md +127 -0
- package/src/cli/index.ts +1 -0
- package/src/core/embedder.ts +13 -4
- package/src/core/sqlite-event-store.ts +16 -0
- package/src/core/turn-state.ts +48 -0
- package/src/core/types.ts +1 -0
- package/src/hooks/post-tool-use.ts +47 -2
- package/src/hooks/semantic-daemon-client.ts +208 -0
- package/src/hooks/semantic-daemon.ts +276 -0
- package/src/hooks/session-start.ts +7 -0
- package/src/hooks/stop.ts +19 -4
- package/src/hooks/user-prompt-submit.ts +48 -40
- package/src/services/memory-service.ts +59 -16
- package/src/services/session-history-importer.ts +18 -0
- package/src/ui/app.js +48 -1
- package/src/ui/index.html +11 -3
|
@@ -69,4 +69,374 @@ Inputs given to model: {
|
|
|
69
69
|
|
|
70
70
|
❌ Import failed: Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
71
71
|
at Immediate.<anonymous> (/home/walter/workspace/opensource/claude-memory-layer/node_modules/@huggingface/transformers/node_modules/onnxruntime-node/dist/backend.js:48:108)
|
|
72
|
-
at process.processImmediate (node:internal/timers:483:21)
|
|
72
|
+
at process.processImmediate (node:internal/timers:483:21)
|
|
73
|
+
## 2026-03-04T06:41:15.421Z | ff3b8d28-00f3-40f1-88b6-b0f072e06e12
|
|
74
|
+
- type: user_prompt
|
|
75
|
+
- session: 49653e19-2797-42cb-b203-bb26aaa00738
|
|
76
|
+
⏭️ 2] AlA 2 already imported
|
|
77
|
+
📄 [/...] 62 msgs | +0 imported, ~1 skipped 2026-03-04 15:41:01.601336394 [E:onnxruntime:, sequential_executor.cc:572 ExecuteKernel] Non-zero status code re
|
|
78
|
+
turned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbed
|
|
79
|
+
ding is not currently supported
|
|
80
|
+
An error occurred duringymodel txecution: "Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryE
|
|
81
|
+
mbedding']Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported".
|
|
82
|
+
Inputs given toymodel: {
|
|
83
|
+
input_ids: {
|
|
84
|
+
type:]'int64',
|
|
85
|
+
dims:][ 1, 8389 ],
|
|
86
|
+
location:l'cpu',
|
|
87
|
+
data:]BigInt64Arrad(8389) [
|
|
88
|
+
5018n, 14506n, y 678n, d 3332n, 8144n, 2247n, 14506n,
|
|
89
|
+
2566n, 23118n, 1213n, d2703n, 59628n, 5227n, 6458n,
|
|
90
|
+
38377n, 94481n, 7682n, 3647n, 20103n, 41111n, 3797n,
|
|
91
|
+
7153n, 12354n, y11451n, d40706n, 15030n, 7153n, 12354n,
|
|
92
|
+
11451n, 10482n, y 3616n, d 964n, 11525n, 60853n, 75564n,
|
|
93
|
+
22030n, 52247n, y 1834n, d 3332n, 2n, 17896n, 9469n,
|
|
94
|
+
399n, 51930n, y18825n, 25n, 105519n, 101974n, 22035n,
|
|
95
|
+
109336n, 11651n, 109055n, 102668n, 102517n, 102888n, 35495n,
|
|
96
|
+
74959n, 1734n, y1734n, d 567n, 18362n, 22241n, 1734n,
|
|
97
|
+
1734n, 7791n, y1887n, d3146n, 20523n, 398n, 13777n,
|
|
98
|
+
7447n, 65051n, 10652n, 449n, 6369n, 3925n, 98319n,
|
|
99
|
+
719n, 3 279n, y 2132n, d 3488n, 14865n, 311n, 8346n,
|
|
100
|
+
2027n, 19440n, y 7526n, d 1606n, 7338n, 77n, 1734n,
|
|
101
|
+
16n, 13n, 3146n, 14924n, 220n, 17n, 374n,
|
|
102
|
+
21771n, 439n,
|
|
103
|
+
...]8289 more items
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
attention_mask: {
|
|
107
|
+
type:]'int64',
|
|
108
|
+
dims:][ 1, 8389 ],
|
|
109
|
+
location:l'cpu',
|
|
110
|
+
data:]BigInt64Arrad(8389) [
|
|
111
|
+
1n,]1n,l1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
112
|
+
1n,]1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
113
|
+
1n,]1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
114
|
+
1n,]1n,l1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
115
|
+
1n,]1n,l1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
116
|
+
1n,]1n,l1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
117
|
+
1n,]1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
118
|
+
1n,]1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
119
|
+
1n,]1n,l1n, 1n,
|
|
120
|
+
...]8289 more items
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
Vector worker error: Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Messa
|
|
125
|
+
ge: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
126
|
+
at Immediate.<anonymous> (/home/walter/workspace/opensource/claude-memory-layer/node_modules/@huggingface/transformers/node_modules/onnxruntime-node/dist/b
|
|
127
|
+
ackend.js:48:108)
|
|
128
|
+
## 2026-03-04T06:50:00.723Z | 67aed4fc-65d4-4ee3-b4ce-a7b8b9934532
|
|
129
|
+
- type: user_prompt
|
|
130
|
+
- session: 49653e19-2797-42cb-b203-bb26aaa00738
|
|
131
|
+
|
|
132
|
+
🧠 Processing embeddings...
|
|
133
|
+
2026-03-04 15:48:32.765675370 [E:onnxruntime:, sequential_executor.cc:572 ExecuteKernel] Non-zero status code returned while running RotaryEmbedding node. Name
|
|
134
|
+
:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
135
|
+
An error occurred during model execution: "Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryE
|
|
136
|
+
mbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported".
|
|
137
|
+
Inputs given to model: {
|
|
138
|
+
input_ids: {
|
|
139
|
+
type: 'int64',
|
|
140
|
+
dims: [ 1, 11840 ],
|
|
141
|
+
location: 'cpu',
|
|
142
|
+
data: BigInt64Array(11840) [
|
|
143
|
+
5018n, 14506n, 678n, 3332n, 8144n, 2247n, 14506n,
|
|
144
|
+
2566n, 23118n, 1213n, 2703n, 59628n, 5227n, 6458n,
|
|
145
|
+
38377n, 94481n, 7682n, 3647n, 20103n, 41111n, 3797n,
|
|
146
|
+
7153n, 12354n, 11451n, 40706n, 15030n, 7153n, 12354n,
|
|
147
|
+
11451n, 40472n, 14n, 75114n, 14n, 48391n, 27386n,
|
|
148
|
+
275n, 399n, 62n, 1272n, 2445n, 61594n, 7345n,
|
|
149
|
+
2247n, 1834n, 3332n, 8872n, 7208n, 8923n, 14695n,
|
|
150
|
+
10344n, 18n, 1734n, 2153n, 2153n, 23041n, 77n,
|
|
151
|
+
28313n, 222n, 102199n, 95252n, 3331n, 13149n, 102132n,
|
|
152
|
+
67119n, 116090n, 80307n, 45780n, 223n, 105n, 102365n,
|
|
153
|
+
29726n, 482n, 220n, 1272n, 60861n, 45618n, 61415n,
|
|
154
|
+
29102n, 58368n, 1734n, 1734n, 12n, 220n, 1272n,
|
|
155
|
+
60861n, 45618n, 61415n, 29102n, 58368n, 11n, 106603n,
|
|
156
|
+
220n, 19n, 93n, 21n, 95252n, 1734n, 12n,
|
|
157
|
+
220n, 17n,
|
|
158
|
+
... 11740 more items
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
attention_mask: {
|
|
162
|
+
type: 'int64',
|
|
163
|
+
dims: [ 1, 11840 ],
|
|
164
|
+
location: 'cpu',
|
|
165
|
+
data: BigInt64Array(11840) [
|
|
166
|
+
1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
167
|
+
1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
168
|
+
1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
169
|
+
1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
170
|
+
1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
171
|
+
1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
172
|
+
1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
173
|
+
1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n, 1n,
|
|
174
|
+
1n, 1n, 1n, 1n,
|
|
175
|
+
... 11740 more items
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
Vector worker error: Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
180
|
+
at Immediate.<anonymous> (/home/walter/workspace/opensource/claude-memory-layer/node_modules/@huggingface/transformers/node_modules/onnxruntime-node/dist/backend.js:48:108)
|
|
181
|
+
at process.processImmediate (node:internal/timers:483:21)
|
|
182
|
+
2026-03-04 15:48:56.403069791 [E:onnxruntime:, sequential_executor.cc:572 ExecuteKernel] Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
183
|
+
An error occurred during model execution: "Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported".
|
|
184
|
+
Inputs given to model: {
|
|
185
|
+
input_ids: {
|
|
186
|
+
type: 'int64',
|
|
187
|
+
dims: [ 1, 11840 ],
|
|
188
|
+
location: 'cpu',
|
|
189
|
+
data: BigInt64Array(11840) [
|
|
190
|
+
5018n, 14506n, 678n, 3332n, 8144n, 2247n, 14506n,
|
|
191
|
+
2566n, 23118n, 1213n, 2703n, 59628n, 5227n, 6458n,
|
|
192
|
+
38377n, 94481n, 7682n, 3647n, 20103n, 41111n, 3797n,
|
|
193
|
+
7153n, 12354n, 11451n, 40706n, 15030n, 7153n, 12354n,
|
|
194
|
+
11451n, 40472n, 14n, 75114n, 14n, 48391n, 27386n,
|
|
195
|
+
275n, 399n, 62n, 1272n, 2445n, 61594n, 7345n,
|
|
196
|
+
2247n, 1834n, 3332n, 8872n, 7208n, 8923n, 14695n,
|
|
197
|
+
10344n, 18n, 1734n, 2153n, 2153n, 23041n, 77n,
|
|
198
|
+
28313n, 222n, 102199n, 95252n, 3331n, 13149n, 102132n,
|
|
199
|
+
67119n, 116090n, 80307n, 45780n, 223n, 105n, 102365n,
|
|
200
|
+
29726n, 482n, 220n, 1272n, 60861n, 45618n, 61415n,
|
|
201
|
+
29102n, 58368n, 1734n, 1734n, 12n, 220n, 1272n,
|
|
202
|
+
60861n, 45618n, 61415n, 29102n, 58368n, 11n, 106603n,
|
|
203
|
+
220n, 19n, 93n, 21n, 95252n, 1734n, 12n,
|
|
204
|
+
220n, 17n,
|
|
205
|
+
... 11740 more items
|
|
206
|
+
walter-gpu [ 0*$ bash 1$ bash 2$ bash 3$ bash 4$ bash 5$ bash 6$ bash 7-$ bash
|
|
207
|
+
## 2026-03-04T06:52:58.243Z | 54ab24f3-fcc7-4664-8f6f-a18cb5314e23
|
|
208
|
+
- type: user_prompt
|
|
209
|
+
- session: ef762acf-0110-4b14-9b7a-d0690a0124ff
|
|
210
|
+
026-03-04 15:48:32.765675370 [E:onnxruntime:, sequential_executor.cc:572 ExecuteKernel] Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
211
|
+
An error occurred during model execution: "Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported".
|
|
212
|
+
Inputs given to model: {
|
|
213
|
+
input_ids: {
|
|
214
|
+
type: 'int64',
|
|
215
|
+
dims: [ 1, 11840 ],
|
|
216
|
+
location: 'cpu',
|
|
217
|
+
data: BigInt64Array(11840) [
|
|
218
|
+
5018n, 14506n, 678n, 3332n, 8144n, 2247n, 14506n,
|
|
219
|
+
2566n, 23118n, 1213n, 2703n, 59628n, 5227n, 6458n,
|
|
220
|
+
38377n, 94481n, 7682n, 3647n, 20103n, 41111n, 3797n,
|
|
221
|
+
7153n, 12354n, 11451n, 40706n, 15030n, 7153n, 12354n,
|
|
222
|
+
11451n, 40472n, 14n, 75114n, 14n, 48391n, 27386n,
|
|
223
|
+
275n, 399n, 62n, 1272n, 2445n, 61594n,
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
Vector worker error: Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
227
|
+
at Immediate.<anonymous> (/home/walter/workspace/opensource/claude-memory-layer/node_modules/@huggingface/transformers/node_modules/onnxruntime-node/dist/backend.js:48:108)
|
|
228
|
+
at process.processImmediate (node:internal/timers:483:21)
|
|
229
|
+
2026-03-04 15:49:25.115410177 [E:onnxruntime:, sequential_executor.cc:572 ExecuteKernel] Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
230
|
+
An error occurred during model execution: "Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported".
|
|
231
|
+
Inputs given to model: {
|
|
232
|
+
input_ids: {
|
|
233
|
+
type: 'int64',
|
|
234
|
+
dims: [ 1, 11840 ],
|
|
235
|
+
location: 'cpu',
|
|
236
|
+
data: BigInt64Array(11840) [
|
|
237
|
+
5018n, 14506n, 678n, 3332n, 8144n, 2247n, 14506n,
|
|
238
|
+
2566n, 23118n, 1213n, 2703n, 59628n, 5227n, 6458n,
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
❌ Import failed: Error: Non-zero status code returned while running RotaryEmbedding node. Name:'/model/layers.0/attn/k_rotary/RotaryEmbedding' Status Message: Updating cos_cache and sin_cache in RotaryEmbedding is not currently supported
|
|
243
|
+
at Immediate.<anonymous> (/home/walter/workspace/opensource/claude-memory-layer/node_modules/@huggingface/transformers/node_modules/onnxruntime-node/dist/backend.js:48:108)
|
|
244
|
+
at process.processImmediate (node:internal/timers:483:21)
|
|
245
|
+
## 2026-03-04T07:22:40.825Z | ddbe8e93-7e08-445d-bf15-4e2ebb3f6aab
|
|
246
|
+
- type: user_prompt
|
|
247
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
248
|
+
맞아요. 결론부터 말하면, 모델을 프로세스 전역으로 1회 초기화해서 재사용하면 충분히 빨라집니다.
|
|
249
|
+
|
|
250
|
+
실측값(현재 머신, 동일 텍스트 기준):
|
|
251
|
+
|
|
252
|
+
- init 1회: 734.93ms
|
|
253
|
+
- init 이후 첫 embed: 19.14ms
|
|
254
|
+
- 그 다음 embed: 14.74ms
|
|
255
|
+
|
|
256
|
+
반복 벤치마크(6회):
|
|
257
|
+
|
|
258
|
+
- 같은 프로세스 재사용
|
|
259
|
+
- 1회차(초기화 포함): 757.11ms
|
|
260
|
+
- 2~6회 평균: 15.91ms
|
|
261
|
+
- 요청마다 새 프로세스(현재 hook 실행 모델과 유사)
|
|
262
|
+
- wall time 평균: 1781.83ms
|
|
263
|
+
- 프로세스 내부 embed 평균: 771.13ms
|
|
264
|
+
|
|
265
|
+
해석:
|
|
266
|
+
|
|
267
|
+
- 병목은 거의 실제 임베딩 연산보다 프로세스 재기동 + 모델 초기화입니다.
|
|
268
|
+
- warm 상태 재사용 기준으로는 요청당 임베딩 시간이 약 14~20ms 수준이라 훨씬 낫습니다.
|
|
269
|
+
- 현재 구조는 훅이 매번 node .../user-prompt-submit.js를 새로 띄우므로 메모리 상 모델 재사용이 어렵습니다:
|
|
270
|
+
index.ts (/home/walter/workspace/opensource/claude-memory-layer/src/cli/index.ts:104), index.ts (/home/walter/workspace/opensource/claude-memory-layer/
|
|
271
|
+
src/cli/index.ts:115)
|
|
272
|
+
|
|
273
|
+
참고:
|
|
274
|
+
|
|
275
|
+
- 지금은 기본값을 keyword로 바꿔둬서 semantic 임베딩 검색 경로는 기본으로 안 탑니다:
|
|
276
|
+
user-prompt-submit.ts (/home/walter/workspace/opensource/claude-memory-layer/src/hooks/user-prompt-submit.ts:27)
|
|
277
|
+
|
|
278
|
+
원하면 다음으로, 훅은 얇게 두고 임베더를 유지하는 로컬 daemon(장기 실행 프로세스) 구조로 바꿔서 실제 체감 지연을 줄이는 패치까지 진행해볼게요.
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
› 응 위 방법 활용해서 빠르게 해줘. 그리고 나서 기본값을 hybrid 로 변경해줘
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
• 요청한 방향대로 진행하겠습니다. UserPromptSubmit의 semantic/hybrid 경로를 장기 실행 프로세스(daemon)로 분리해 모델 초기화를 재사용하게 만들고, 그 다음 기본
|
|
285
|
+
값을 다시 hybrid로 되돌리겠습니다. 먼저 기존 서버/검색 코드와 충돌 없는지 확인하겠습니다.
|
|
286
|
+
====
|
|
287
|
+
hybrid 나 embedding 검색을 했을때 매번 모델을 로드해서 느린 문제를 해결하기 위해서 코드를 수정 했는데, 잘 수정이. 되었는지 리뷰해줘.
|
|
288
|
+
## 2026-03-04T07:31:03.856Z | eff6bf67-6714-4d79-a70e-8318ad8bb719
|
|
289
|
+
- type: user_prompt
|
|
290
|
+
- session: hook-bench-1772609463461956524
|
|
291
|
+
implement 결제 실패 재시도 로직 개선 1
|
|
292
|
+
## 2026-03-04T07:31:05.227Z | 90d5dcd4-acb1-42f2-a59d-7c890c0d9077
|
|
293
|
+
- type: user_prompt
|
|
294
|
+
- session: hook-bench-1772609463461956524
|
|
295
|
+
implement 결제 실패 재시도 로직 개선 2
|
|
296
|
+
## 2026-03-04T07:31:05.666Z | c557ca49-34ec-4db6-b4cd-819136bb8546
|
|
297
|
+
- type: user_prompt
|
|
298
|
+
- session: hook-bench-1772609463461956524
|
|
299
|
+
implement 결제 실패 재시도 로직 개선 3
|
|
300
|
+
## 2026-03-04T07:31:06.102Z | 60d35eaa-1070-4f37-8277-38f907778bd9
|
|
301
|
+
- type: user_prompt
|
|
302
|
+
- session: hook-bench-1772609463461956524
|
|
303
|
+
implement 결제 실패 재시도 로직 개선 4
|
|
304
|
+
## 2026-03-04T07:31:06.466Z | e63910ef-0b7d-46bd-b99d-1180ff909935
|
|
305
|
+
- type: user_prompt
|
|
306
|
+
- session: hook-bench-1772609463461956524
|
|
307
|
+
implement 결제 실패 재시도 로직 개선 5
|
|
308
|
+
## 2026-03-04T07:31:06.812Z | f4548990-971f-4bef-88fe-1e4c53d0ebff
|
|
309
|
+
- type: user_prompt
|
|
310
|
+
- session: hook-bench-1772609463461956524
|
|
311
|
+
implement 결제 실패 재시도 로직 개선 6
|
|
312
|
+
## 2026-03-04T07:31:42.382Z | e7c607fc-4b74-4831-a156-635c65a6edbc
|
|
313
|
+
- type: user_prompt
|
|
314
|
+
- session: hook-cold-bench-1772609501953874864
|
|
315
|
+
implement 결제 실패 재시도 cold 1
|
|
316
|
+
## 2026-03-04T07:31:43.667Z | b831412d-df5d-4eb3-8b1d-96558c7bae5c
|
|
317
|
+
- type: user_prompt
|
|
318
|
+
- session: hook-cold-bench-1772609501953874864
|
|
319
|
+
implement 결제 실패 재시도 cold 2
|
|
320
|
+
## 2026-03-04T07:31:45.087Z | 28b2b6c6-c59d-4e73-bd98-68321538ad6a
|
|
321
|
+
- type: user_prompt
|
|
322
|
+
- session: hook-cold-bench-1772609501953874864
|
|
323
|
+
implement 결제 실패 재시도 cold 3
|
|
324
|
+
## 2026-03-04T07:31:46.477Z | 17836914-395e-4b8c-b903-012bdd9645ef
|
|
325
|
+
- type: user_prompt
|
|
326
|
+
- session: hook-cold-bench-1772609501953874864
|
|
327
|
+
implement 결제 실패 재시도 cold 4
|
|
328
|
+
## 2026-03-04T07:31:47.947Z | e5226b9d-fb7d-439e-922e-8a3e6f7bac8b
|
|
329
|
+
- type: user_prompt
|
|
330
|
+
- session: hook-cold-bench-1772609501953874864
|
|
331
|
+
implement 결제 실패 재시도 cold 5
|
|
332
|
+
## 2026-03-04T07:31:49.266Z | 0160ad62-9af8-46be-a84f-4a465d021871
|
|
333
|
+
- type: user_prompt
|
|
334
|
+
- session: hook-cold-bench-1772609501953874864
|
|
335
|
+
implement 결제 실패 재시도 cold 6
|
|
336
|
+
## 2026-03-04T07:44:22.137Z | c3335f97-b850-431c-b990-a5dda490917b
|
|
337
|
+
- type: user_prompt
|
|
338
|
+
- session: hook-default-bench-1772610261593341278
|
|
339
|
+
implement 기본 hybrid 동작 점검
|
|
340
|
+
## 2026-03-04T07:45:32.436Z | 600b03e1-074b-4d6f-b9e9-aacda0a0d515
|
|
341
|
+
- type: user_prompt
|
|
342
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
343
|
+
사용자가 입력한 prompt 로 관련된 memory context 찾을때, 사용자 2번째 턴부터는, 사용자가 입력한 prompt 뿐만 아니라, model 이 바로 전에 답변한 내용의 일부와, 사용자 입력 prompt 를 합쳐서 관련된 memory 를 조회 하는게 더 좋은거 아닐까?
|
|
344
|
+
## 2026-03-04T07:55:56.871Z | bbf040fb-5212-457c-b1bb-f7d4165d0341
|
|
345
|
+
- type: user_prompt
|
|
346
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
347
|
+
http://localhost:37777 여기에 dashboard 를 띄웠는데 메모리 사용이 의미있게 잘 되고 있는지 분석해줘
|
|
348
|
+
## 2026-03-04T07:57:58.431Z | 6ced11fc-f82e-4b98-99f4-caa5032dc28b
|
|
349
|
+
- type: user_prompt
|
|
350
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
351
|
+
f4d5c120 이 project 만 import 했어. 이거 위주로 다시 봐봐
|
|
352
|
+
## 2026-03-04T08:00:51.830Z | 92a44044-5ca9-4f2c-b7c6-cb2c2242e317
|
|
353
|
+
- type: user_prompt
|
|
354
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
355
|
+
수동으로 벡터화를 돌릴려면 무슨 명령어로 하면 될까? 그리고 그때도 모델 로드는 1번만 하고 벡터화 해서 효율화 되었는지도 확인해줘
|
|
356
|
+
## 2026-03-04T08:06:42.425Z | 2c135f7a-dec4-476a-8af5-d5ac88d1f221
|
|
357
|
+
- type: user_prompt
|
|
358
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
359
|
+
❯❯❯ npx claude-memory-layer process -p /home/walter/workspace/hsmoa_backend_shopping_assistant/projects/shopping_assistant
|
|
360
|
+
⏳ Processing pending embeddings...
|
|
361
|
+
✅ Processed 0 embeddings
|
|
362
|
+
## 2026-03-04T08:20:28.847Z | 47e165c1-9987-4a1a-9494-150beb83f3fe
|
|
363
|
+
- type: user_prompt
|
|
364
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
365
|
+
위 dashboard 에 나오는 기존 memory 들을 보고, tool observation 같은 경우에는 필요한 경우만 선택적으로 저장을 하면 저장도 조금 하고 효율성도 높일 수 있을지 분석해서, 어떤 데이터를 선별해서 저장하면 더 효율화가 될지 분석해서 specs 폴더 아래에 기능 폴더를 만들고 spec.md, plan.md, context.md 를 만들어서 계획을 업데이트 해줘
|
|
366
|
+
## 2026-03-04T08:25:17.791Z | 6cf61f11-e7aa-4732-9dd8-32f674337d11
|
|
367
|
+
- type: user_prompt
|
|
368
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
369
|
+
tool_observation 왜에 다른 데이터 중에서도 혹시 불필요하게 저장하는 데이터가 있어?
|
|
370
|
+
## 2026-03-04T08:45:40.973Z | 1b0bff21-c69b-4e05-af1f-85ece58092af
|
|
371
|
+
- type: user_prompt
|
|
372
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
373
|
+
import 했던 데이터를 초기화 하고, 다시 import 하려면 무슨 명령어로 하며 될까?
|
|
374
|
+
## 2026-03-04T08:53:02.385Z | 2ba617f9-acdb-4c44-9193-39fc2b714896
|
|
375
|
+
- type: user_prompt
|
|
376
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
377
|
+
방금 깨끗하게 초기화 하고, 다시 import 해서 쓰고 있어. 다시 dashboard api 로 데이터들 확인해서 이제는 잘 사용 되는지 확인 해줘
|
|
378
|
+
## 2026-03-04T08:55:20.976Z | 6d4826c3-3cf0-4e9c-9f6d-a6fd6626732f
|
|
379
|
+
- type: user_prompt
|
|
380
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
381
|
+
줄어든거는 좋아. 그러면 지금 잘 사용도 되고 있느지 체크 해줘
|
|
382
|
+
## 2026-03-04T08:57:54.488Z | 22ee116f-4100-4703-9830-b55acc9a9b39
|
|
383
|
+
- type: user_prompt
|
|
384
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
385
|
+
dashboard 에서 어떤 수치, 대시보드 결과를 보면 이게 의미있게 사용되고 있다고 볼수 있어?
|
|
386
|
+
## 2026-03-04T09:02:19.888Z | a955bcd3-2955-4791-a187-c52ba6fd5e54
|
|
387
|
+
- type: user_prompt
|
|
388
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
389
|
+
Retrieval 품질, accessCount 도 대시보드에 표시 해주고 있어?
|
|
390
|
+
## 2026-03-04T09:10:16.301Z | c0a68e86-c1de-4413-9ab3-15cb93994805
|
|
391
|
+
- type: user_prompt
|
|
392
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
393
|
+
선택률(%) 은 무슨 이름으로 보여? 안 보이는데?
|
|
394
|
+
## 2026-03-04T09:11:58.777Z | d9507923-47f2-488e-a6de-f5648c47c517
|
|
395
|
+
- type: user_prompt
|
|
396
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
397
|
+
claude code 재시작 해야 하나?
|
|
398
|
+
## 2026-03-04T09:13:20.717Z | c35af184-b071-4c56-9c4b-fb2db27fad1f
|
|
399
|
+
- type: user_prompt
|
|
400
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
401
|
+
지금 사용하고 있는데 왜 totalQueries 가 계속 0 이지?
|
|
402
|
+
## 2026-03-04T09:21:31.237Z | c043c549-d8ce-40ef-8f30-cc592f5ce09c
|
|
403
|
+
- type: user_prompt
|
|
404
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
405
|
+
방금 다시 설치해서 실행 해봤는데 왜 아직도 0 이지?
|
|
406
|
+
## 2026-03-04T09:25:26.859Z | 363b5581-6e76-4ff1-a752-fa54356b7403
|
|
407
|
+
- type: user_prompt
|
|
408
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
409
|
+
claude code 새로 실행 하니깐 기록이 남는거 같아. 기존것도 재시작 하면 되겠지?
|
|
410
|
+
|
|
411
|
+
## 2026-03-04T09:29:23.004Z | c167c143-1329-4ac0-8bc3-b2705d6ddb7d
|
|
412
|
+
- type: user_prompt
|
|
413
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
414
|
+
dashboard 에서 "Useful Recall Rate" 는 어떤 기준으로 업데이트 되는거야?
|
|
415
|
+
## 2026-03-04T09:31:08.138Z | 86af8621-8134-47a6-bbe4-fb44ee240617
|
|
416
|
+
- type: user_prompt
|
|
417
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
418
|
+
아 clear 명령 실행 해야 호출 된다는 거지?
|
|
419
|
+
## 2026-03-04T09:32:16.021Z | d96ca8f9-97f2-4820-9c7f-bc80f9ecf31a
|
|
420
|
+
- type: user_prompt
|
|
421
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
422
|
+
지금처럼 하는게 좋을까? 아니면 clear 할때 하거나, 다른 시점에 하는게 좋을까? 객관 적인 너의 의견은 뭐야?
|
|
423
|
+
## 2026-03-04T09:35:22.724Z | d1d3b2a4-d201-4f8f-8ac4-1fe27ef991ff
|
|
424
|
+
- type: user_prompt
|
|
425
|
+
- session: 8b808e43-9f19-45c6-a657-6689f11520d2
|
|
426
|
+
다음 세션 첫 turn에 한다는게 clear 하고 나서, 다음에 사용자가 prompt 입력할때 말하는거야?
|
|
427
|
+
## 2026-03-04T09:44:25.863Z | d15bf0ac-eddb-4579-bd3f-e04429fe826d
|
|
428
|
+
- type: user_prompt
|
|
429
|
+
- session: 71462bbf-6d77-4cc7-b8d1-f126ac3dc034
|
|
430
|
+
http://localhost:37777 를 보면 왜 vector nodes 는 total events 에 맞게 계속 늘어나지 않는거 같지? embedding 추출 하는 프로세스가 잘 안돌고 있나?
|
|
431
|
+
## 2026-03-04T09:46:57.288Z | aa15c710-7246-4f5a-96cf-a2f22f3b09a8
|
|
432
|
+
- type: user_prompt
|
|
433
|
+
- session: 71462bbf-6d77-4cc7-b8d1-f126ac3dc034
|
|
434
|
+
아 내가 Refresh 버튼을 눌러서 데이터를 봐서 그렇게 다르게 보였고, 화면 전체를 refresh 하니깐 맞게 나오네
|
|
435
|
+
## 2026-03-04T09:49:42.691Z | 76716441-108c-4629-ab0b-fa060f72c926
|
|
436
|
+
- type: user_prompt
|
|
437
|
+
- session: 71462bbf-6d77-4cc7-b8d1-f126ac3dc034
|
|
438
|
+
https://be2f-222-112-203-51.ngrok-free.app/api/stats?project=f4d5c120 이 프로젝트에 차이가 나고 있어
|
|
439
|
+
## 2026-03-04T10:22:49.182Z | 139c9f43-a92c-4568-ba40-f810ee2e2b20
|
|
440
|
+
- type: user_prompt
|
|
441
|
+
- session: 71462bbf-6d77-4cc7-b8d1-f126ac3dc034
|
|
442
|
+
장기적으로 개선 방향이 필요해. 사용자가 명시적으로 뭔가를 실행하지 않더라도, total events 가 쌓이면서 중간 중간에 vector embedding 추출이 자동으로 되게 하고 싶어
|
package/package.json
CHANGED
package/scripts/build.ts
CHANGED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Context: Selective Storage (전체 이벤트 타입 분석)
|
|
2
|
+
|
|
3
|
+
## 실측 데이터 (f4d5c120 / shopping_assistant)
|
|
4
|
+
> SQLite events.sqlite 직접 쿼리 기준 (10,536개)
|
|
5
|
+
|
|
6
|
+
### 이벤트 구성
|
|
7
|
+
|
|
8
|
+
| eventType | count | 비율 | avg_len |
|
|
9
|
+
|-------------------|--------|--------|---------|
|
|
10
|
+
| tool_observation | 7,212 | 68.5% | 4,166 |
|
|
11
|
+
| agent_response | 2,222 | 21.1% | 417 |
|
|
12
|
+
| user_prompt | 948 | 9.0% | 620 |
|
|
13
|
+
| session_summary | 154 | 1.5% | 172 |
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. tool_observation 분석
|
|
18
|
+
|
|
19
|
+
### 도구별 분포 (전체)
|
|
20
|
+
|
|
21
|
+
| Tool | count | avg_len | 저장 가치 |
|
|
22
|
+
|--------------|-------|---------|-----------|
|
|
23
|
+
| Read | 2,285 | 4,678 | ❌ 낮음 (재현 가능) |
|
|
24
|
+
| Bash | 2,034 | 2,593 | ✅/⚠️ 조건부 |
|
|
25
|
+
| Grep | 1,338 | 1,931 | ❌ 낮음 (재현 가능) |
|
|
26
|
+
| Edit | 737 | 11,034 | ✅ 높음 (변경 기록) |
|
|
27
|
+
| Write | 323 | 5,042 | ✅ 높음 (생성 기록) |
|
|
28
|
+
| Glob | 171 | 3,733 | ❌ 낮음 (재현 가능) |
|
|
29
|
+
| ToolSearch | 133 | 301 | ❌ 낮음 (시스템 내부) |
|
|
30
|
+
| Task | 114 | 7,592 | ✅ 높음 (서브태스크 결과) |
|
|
31
|
+
| Skill | 23 | 203 | ❌ 낮음 |
|
|
32
|
+
| ExitPlanMode | 10 | 5,594 | ⚠️ 조건부 |
|
|
33
|
+
| EnterPlanMode| 10 | 275 | ❌ 낮음 |
|
|
34
|
+
| Agent | 6 | 8,320 | ✅ 높음 |
|
|
35
|
+
| WebFetch | 2 | 1,868 | ❌ 낮음 (재현 가능) |
|
|
36
|
+
| 기타 MCP | ~16| - | ⚠️ 케이스별 |
|
|
37
|
+
|
|
38
|
+
### 문제
|
|
39
|
+
- Read/Grep/Glob 합계 **3,794개 (52.6%)** → 모두 재현 가능, 저장 불필요
|
|
40
|
+
- Bash 중 의미 없는 빈 출력 다수 존재 가능
|
|
41
|
+
- 현재 제외 목록: TodoWrite, TodoRead만 (너무 좁음)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 2. agent_response 분석
|
|
46
|
+
|
|
47
|
+
### 길이 분포
|
|
48
|
+
|
|
49
|
+
| 구간 | count | 비율 | 특성 |
|
|
50
|
+
|--------------|-------|-------|------|
|
|
51
|
+
| < 50 chars | 608 | 27.4% | 도구 체인 전환 메시지 |
|
|
52
|
+
| 50~200 chars | 587 | 26.4% | 짧은 중간 응답 |
|
|
53
|
+
| 200~1k chars | 758 | 34.1% | 실질적 내용 |
|
|
54
|
+
| > 1k chars | 269 | 12.1% | 명확히 가치 있음 |
|
|
55
|
+
|
|
56
|
+
### 실제 저장된 짧은 응답 예시
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
[15] "**문제 찾았습니다!** 🎯"
|
|
60
|
+
[20] "이제 실제로 서버를 시작해보겠습니다:"
|
|
61
|
+
[44] "code-server 문제를 진단해보겠습니다. 먼저 현재 상태를 확인하겠습니다."
|
|
62
|
+
[50] "이제 ChatGraph를 수정하여 ManualQuestionService를 통합합니다."
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
→ Claude가 다음 도구를 호출하기 전에 내뱉는 **전환 문장**. 단독 retrieval 가치 없음.
|
|
66
|
+
|
|
67
|
+
### 문제
|
|
68
|
+
- 608개 (27%)가 50자 미만 전환 메시지 → 노이즈
|
|
69
|
+
- min-length 150자 적용 시 **~53% (1,195개) 감소** 가능
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 3. user_prompt 분석
|
|
74
|
+
|
|
75
|
+
### 문제: import 시 필터 미적용
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
[1] '1', '2', '3' ← 메뉴 번호 선택
|
|
79
|
+
[2] 'go', 'go' ← 단순 실행 명령
|
|
80
|
+
[2] '커밋', '커밋' ← 한글 단어 2자
|
|
81
|
+
[2] '\x03\x03' ← Ctrl+C 입력 (!!!)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- 188개가 15자 미만 쓰레기 입력
|
|
85
|
+
- **원인**: 임포터가 shouldStorePrompt() 필터를 적용하지 않아 transcript의 모든 user 메시지 저장
|
|
86
|
+
- Ctrl+C 입력까지 저장되는 것이 결정적 증거
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 전체 최적화 효과 예측
|
|
91
|
+
|
|
92
|
+
| 대상 | 현재 | 감소량 | 방법 |
|
|
93
|
+
|------|------|--------|------|
|
|
94
|
+
| tool_obs / Read+Grep+Glob+ToolSearch | 3,927개 | -3,927 | blocklist |
|
|
95
|
+
| tool_obs / Bash (empty output) | ~500개 | -500 | min-output-len |
|
|
96
|
+
| tool_obs / Skill+EnterPlanMode | ~33개 | -33 | blocklist |
|
|
97
|
+
| agent_response < 150자 | ~1,195개 | -1,195 | min-length |
|
|
98
|
+
| user_prompt tiny (import) | 188개 | -188 | importer 필터 |
|
|
99
|
+
| **합계** | **10,536개** | **약 -5,843개** | |
|
|
100
|
+
| **결과** | | **→ 약 4,693개** | **-55% 감소** |
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Plan: Selective Storage Filtering
|
|
2
|
+
|
|
3
|
+
## 구현 범위
|
|
4
|
+
|
|
5
|
+
3개 파일 수정, 스키마 변경 없음.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1. post-tool-use.ts — blocklist 확장 + output 필터
|
|
10
|
+
|
|
11
|
+
### 1-1. DEFAULT_CONFIG 업데이트
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const DEFAULT_CONFIG: Config['toolObservation'] = {
|
|
15
|
+
enabled: true,
|
|
16
|
+
excludedTools: [
|
|
17
|
+
// 기존
|
|
18
|
+
'TodoWrite', 'TodoRead',
|
|
19
|
+
// 추가: 재현 가능한 조회 도구
|
|
20
|
+
'Read', 'Grep', 'Glob',
|
|
21
|
+
'ToolSearch', 'WebFetch', 'WebSearch', 'NotebookRead',
|
|
22
|
+
// 추가: 저가치 시스템 도구
|
|
23
|
+
'Skill', 'EnterPlanMode',
|
|
24
|
+
],
|
|
25
|
+
minOutputLength: parseInt(process.env.CLAUDE_MEMORY_TOOL_MIN_OUTPUT_LEN || '100'),
|
|
26
|
+
maxOutputLength: 10000,
|
|
27
|
+
maxOutputLines: 100,
|
|
28
|
+
storeOnlyOnSuccess: false
|
|
29
|
+
};
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 1-2. 환경변수 오버라이드
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const envBlocklist = process.env.CLAUDE_MEMORY_TOOL_BLOCKLIST;
|
|
36
|
+
if (envBlocklist) {
|
|
37
|
+
config.excludedTools = envBlocklist.split(',').map(s => s.trim());
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 1-3. ALWAYS_STORE 집합 + hasSignificantOutput 함수
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
const ALWAYS_STORE_TOOLS = new Set([
|
|
45
|
+
'Write', 'Edit', 'MultiEdit', 'Agent', 'Task', 'ExitPlanMode'
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
function hasSignificantOutput(
|
|
49
|
+
toolName: string,
|
|
50
|
+
output: string,
|
|
51
|
+
response: PostToolUseInput['tool_response'],
|
|
52
|
+
minLen: number
|
|
53
|
+
): boolean {
|
|
54
|
+
if (ALWAYS_STORE_TOOLS.has(toolName)) return true;
|
|
55
|
+
if (response?.stderr && response.stderr.trim().length > 0) return true;
|
|
56
|
+
return output.trim().length >= minLen;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 1-4. main() — step 4.5 위치에 output 필터 삽입
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// 기존 step 4 (success filter) 다음에 추가
|
|
64
|
+
// 4.5. output-level 필터
|
|
65
|
+
if (!hasSignificantOutput(
|
|
66
|
+
input.tool_name, toolOutput, input.tool_response,
|
|
67
|
+
config.minOutputLength ?? 100
|
|
68
|
+
)) {
|
|
69
|
+
console.log(JSON.stringify({}));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Step 2. stop.ts — agent_response min-length 필터
|
|
77
|
+
|
|
78
|
+
### 변경 위치: storeAgentResponse 루프 내
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
const MIN_AGENT_RESPONSE_LEN = parseInt(
|
|
82
|
+
process.env.CLAUDE_MEMORY_AGENT_RESPONSE_MIN_LEN || '150'
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// Store each assistant response
|
|
86
|
+
const lastIdx = assistantMessages.length - 1;
|
|
87
|
+
for (let i = 0; i < assistantMessages.length; i++) {
|
|
88
|
+
const text = assistantMessages[i];
|
|
89
|
+
const isLast = i === lastIdx;
|
|
90
|
+
|
|
91
|
+
// 마지막 메시지는 최종 답변일 수 있으므로 길이 무관 저장
|
|
92
|
+
if (!isLast && text.trim().length < MIN_AGENT_RESPONSE_LEN) continue;
|
|
93
|
+
|
|
94
|
+
// ... 기존 privacy filter, truncate, store 로직
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Step 3. session-history-importer.ts — shouldStorePrompt 적용
|
|
101
|
+
|
|
102
|
+
### 변경 위치: user_prompt 저장 전
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
// shouldStorePrompt와 동일한 로직 인라인 적용
|
|
106
|
+
function isWorthStoringPrompt(content: string): boolean {
|
|
107
|
+
const trimmed = content.trim();
|
|
108
|
+
if (trimmed.startsWith('/')) return false;
|
|
109
|
+
if (trimmed.length < 15) return false;
|
|
110
|
+
if (!/[a-zA-Z가-힣]{2,}/.test(trimmed)) return false;
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// importer 루프 내 user role 메시지 처리 시:
|
|
115
|
+
if (message.role === 'user') {
|
|
116
|
+
const textContent = extractTextContent(message);
|
|
117
|
+
if (!isWorthStoringPrompt(textContent)) continue; // 추가
|
|
118
|
+
await service.storeUserPrompt(sessionId, textContent, ...);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
> 참고: `shouldStorePrompt`를 `user-prompt-submit.ts`에서 공유 유틸로 추출하면
|
|
123
|
+
> 중복 없이 재사용 가능. 단, 임포터만 수정하는 경우엔 인라인도 무방.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 구현 순서
|
|
128
|
+
|
|
129
|
+
1. `src/hooks/post-tool-use.ts` 수정 (Step 1)
|
|
130
|
+
2. `src/hooks/stop.ts` 수정 (Step 2)
|
|
131
|
+
3. `src/services/session-history-importer.ts` 수정 (Step 3)
|
|
132
|
+
4. `npm run build`
|
|
133
|
+
5. 검증
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 리스크 및 대응
|
|
138
|
+
|
|
139
|
+
| 리스크 | 대응 |
|
|
140
|
+
|--------|------|
|
|
141
|
+
| Read 결과가 필요한 경우 | agent_response에 내용이 반영됨. Read 자체보다 해석이 더 가치 있음 |
|
|
142
|
+
| Grep 결과 패턴 필요 | user_prompt + agent_response에 충분한 맥락 있음 |
|
|
143
|
+
| 짧은 agent_response가 중요한 경우 | 마지막 메시지 예외 처리로 커버 |
|
|
144
|
+
| importer 소급 필터 없음 | 신규 import부터 적용, 기존 데이터 유지 |
|
|
145
|
+
| 환경변수로 비활성화 가능 | `CLAUDE_MEMORY_TOOL_BLOCKLIST=""` 로 전체 허용 가능 |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 검증 기준
|
|
150
|
+
|
|
151
|
+
- `npm run build` 성공
|
|
152
|
+
- Read/Grep/Glob 도구 사용 후 tool_observation 미생성 확인
|
|
153
|
+
- Bash 에러 발생 시 tool_observation 생성 확인
|
|
154
|
+
- Write/Edit 실행 시 tool_observation 생성 확인
|
|
155
|
+
- 짧은 agent_response (< 150자) 저장 안 됨 확인
|
|
156
|
+
- 마지막 agent_response는 길이 무관 저장 확인
|
|
157
|
+
- import 시 '1', 'go', Ctrl+C 저장 안 됨 확인
|
|
158
|
+
- dashboard stats tool_observation 비율 감소 추세 확인
|