Skip to content

fix: platform-aware session hooks and auto-memory for Qwen Code#370

Open
btxbtxbtx wants to merge 1 commit intomksglu:nextfrom
btxbtxbtx:fix-qwen-code-platform-support
Open

fix: platform-aware session hooks and auto-memory for Qwen Code#370
btxbtxbtx wants to merge 1 commit intomksglu:nextfrom
btxbtxbtx:fix-qwen-code-platform-support

Conversation

@btxbtxbtx
Copy link
Copy Markdown
Contributor

Summary

v1.0.100 introduced session continuity (compact/resume) and auto-memory search, but these features were hardcoded to Claude Code conventions — Qwen Code users got no benefit. This PR makes the hook layer and auto-memory platform-aware.

Changes

1. hooks/session-helpers.mjs — Add QWEN_OPTS + detectPlatform()

  • Added QWEN_OPTS with .qwen config dir, QWEN_PROJECT_DIR, QWEN_SESSION_ID
  • Added detectPlatform() function that auto-detects the running platform from env vars

2. hooks/sessionstart.mjs — Platform-aware startup

  • Uses detectPlatform() to get correct env vars and config paths
  • Scans QWEN.md instead of CLAUDE.md when running under Qwen Code
  • Uses QWEN_PROJECT_DIR / QWEN_PLUGIN_ROOT instead of hardcoded CLAUDE_*

3. hooks/precompact.mjs — Platform-aware config dir

  • Uses detectPlatform() for correct resolveConfigDir() and getSessionDBPath()

4. hooks/posttooluse.mjs — Platform-aware session DB

  • Uses detectPlatform() for correct getSessionDBPath() and getInputProjectDir()

5. src/search/auto-memory.ts — Scan both CLAUDE.md and QWEN.md

  • Added memoryFileNames parameter (default: ["CLAUDE.md", "QWEN.md"])
  • Scans both file types in project dir and config dir

6. src/server.ts — Adapter-aware configDir

  • Uses _detectedAdapter.getSettingsPath() to derive config dir when adapter is available
  • Falls back to CLAUDE_CONFIG_DIR / ~/.claude for unknown platforms

Test results

  • qwen-code adapter: 22/22 pass
  • search tests: 153/153 pass
  • store tests: 110/110 pass
  • No regressions

@mksglu
Copy link
Copy Markdown
Owner

mksglu commented Apr 28, 2026

Hi @btxbtxbtx Let's sure 14 Adaptors is works now not just Qwen Code. Thanks.

# Conflicts:
#	cli.bundle.mjs
#	server.bundle.mjs
@btxbtxbtx btxbtxbtx force-pushed the fix-qwen-code-platform-support branch from 22f4859 to cc7e342 Compare April 29, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants