Skip to content

Commit 8d5ff07

Browse files
IM.codesclaude
andcommitted
fix: use async import for memory injection — avoid blocking event loop
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8721c02 commit 8d5ff07

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/daemon/command-handler.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ async function handleSend(cmd: Record<string, unknown>, serverLink: ServerLink):
16861686
}
16871687

16881688
// Inject relevant memories from local processed context for process agents
1689-
sendText = prependLocalMemory(sendText, sessionName);
1689+
sendText = await prependLocalMemory(sendText, sessionName);
16901690

16911691
await sendShellAwareCommand(sessionName, sendText, agentType);
16921692
const payload: Record<string, unknown> = { text };
@@ -3948,12 +3948,10 @@ async function handleMemorySearch(cmd: Record<string, unknown>, serverLink: Serv
39483948

39493949
// ── Process agent memory injection (text prepend) ────────────────────────
39503950

3951-
function prependLocalMemory(prompt: string, sessionName: string): string {
3951+
async function prependLocalMemory(prompt: string, sessionName: string): Promise<string> {
39523952
if (prompt.length < 10) return prompt; // skip greetings / confirmations
39533953
try {
3954-
// Lazy import to avoid circular deps at module load
3955-
// eslint-disable-next-line @typescript-eslint/no-require-imports
3956-
const { searchLocalMemory } = require('../context/memory-search.js') as typeof import('../context/memory-search.js');
3954+
const { searchLocalMemory } = await import('../context/memory-search.js');
39573955
const record = getSession(sessionName);
39583956
const result = searchLocalMemory({
39593957
query: prompt.slice(0, 200),

0 commit comments

Comments
 (0)