Fix refrag GLM mode, add GLM support to CTX, ctx based Claude Code hook to enhance user prompts#21
Merged
m1rl0k merged 3 commits intoContext-Engine-AI:testfrom Nov 20, 2025
Conversation
Add support for GLM API as an alternative decoder runtime alongside llama.cpp, including: - New ctx-hook-simple.sh script for Claude Code UserPromptSubmit integration - GLM configuration options in ctx_config.example.json and environment variables - Updated Dockerfiles to use shared requirements.txt for dependency management - Enhanced ctx.py with GLM client support and collection parameter - Modified MCP indexer server to support GLM runtime selection - Added GLM timeout configuration and improved error handling
Add configurable context quality controls and execution modes to improve context retrieval reliability: - Configure default execution mode (unicorn/detail) via ctx_config.json - Add require_context flag to fallback to original query when no relevant context found - Implement relevance gate to filter low-quality search results based on token overlap - Add draft similarity gate for unicorn mode to ensure meaningful query refinement - Extend hook script to export new environment variables and build context command dynamically
- Add fuzzy matching for near-duplicate paragraphs using difflib - Implement deterministic paragraph deduplication function - Cap paragraphs to maximum of 3 for consistency - Update fallback text to be more specific about system details - Resolve collection name filter logic for better parameter handling
m1rl0k
approved these changes
Nov 20, 2025
Contributor
Author
|
@m1rl0k lol I wasn't done yet - I forgot to provide the example Claude hook docs and finish testing |
m1rl0k
added a commit
that referenced
this pull request
Mar 1, 2026
Fix refrag GLM mode, add GLM support to CTX, ctx based Claude Code hook to enhance user prompts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
-- ctx config can set collection and gating/relevance knobs, with example provided)
-- hook can be bypassed with adding "<" to msg, or "noctx:" - planning to add "only enhance IF (a condition is met) - right now it's enhance unless opt-out
Sample CTX prompt rewrite in Claude Code: