Skip to content

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")
ParameterTypeDefaultDescription
namestringrequiredFunction or class name
questionstringOptional focus question; omits for a general overview
  1. Check MemOS cache for a prior digest of this symbol
  2. If found: return instantly (no LLM call, minimal tokens)
  3. If not found: run code_context + LLM digest, save to cache
ApproachTokens (first call)Tokens (repeat call)
code_context("AuthService")~1,500~1,500 (no cache)
code_smart_context("AuthService")~150~20 (cached)
  • 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=true in the MCP server configuration
  • Cache is stored in MemOS and persists across sessions
  • The cache is per-project and per-symbol name