code_smart_context
code_smart_context retrieves a comprehensive understanding of a symbol. It checks the MemOS cache first — if the symbol has been analyzed before, it returns the cached digest instantly. Only if there is no cached result does it call the LLM to generate one.
Requires GL_SMART_READ=true in the MCP server environment.
code_smart_context(name="McpServer", question="how does routing work?")code_smart_context(name="AuthService")Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | required | Function or class name |
question | string | — | Optional focus question; omits for a general overview |
How it works
Section titled “How it works”- Check MemOS cache for a prior digest of this symbol
- If found: return instantly (no LLM call, minimal tokens)
- If not found: run
code_context+ LLM digest, save to cache
Token comparison
Section titled “Token comparison”| Approach | Tokens (first call) | Tokens (repeat call) |
|---|---|---|
code_context("AuthService") | ~1,500 | ~1,500 (no cache) |
code_smart_context("AuthService") | ~150 | ~20 (cached) |
When to use
Section titled “When to use”- Functions you query repeatedly across sessions
- Large classes or services where the full context is expensive
- When you want a general understanding without loading all connected code
- Requires
GL_SMART_READ=truein the MCP server configuration - Cache is stored in MemOS and persists across sessions
- The cache is per-project and per-symbol name