Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>MemFlow — AI Context & Token AnalyzerNew to Visual Studio Code? Get it now.
MemFlow — AI Context & Token Analyzer

MemFlow — AI Context & Token Analyzer

Chusak Buakaew

|
1 install
| (0) | Free
AI Context & Token Analyzer by LamoonAGI — analyze context waste and token costs before you pay for them
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

MemFlow — AI Context & Token Analyzer (VS Code extension)

AI Context & Token Analyzer by LamoonAGI. Analyze context waste and token costs before you pay for them. MemFlow analyzes the current file or selection and shows estimated token savings. Usage is attributed to your LamoonAGI workspace and appears on your dashboard.

  • Product page: https://www.lamoonagi.com/en/memflow/
  • MemFlow Relay (OpenAI-compatible proxy): https://www.lamoonagi.com/en/memflow/relay/
  • Docs: https://www.lamoonagi.com/en/memflow/docs/

Quickstart

  1. Sign in at https://www.lamoonagi.com/en/context-vmm/login/.
  2. Go to Settings → API keys and click Create API Key. Copy the lago_live_… key; it is shown only once.
  3. In VS Code, open the Command Palette and run MemFlow: Set API Key, then paste the key.
    • The extension verifies the key against POST /v1/lamoonagi/connect before saving it. Your workspace is then marked as "VS Code connected".
    • The key is stored only in VS Code SecretStorage (the OS keychain), never in settings.json.
  4. Open a file (or select some text) and run MemFlow: Analyze Selection/File, or click MemFlow in the status bar. Results appear in the MemFlow output channel.

To remove the key, run MemFlow: Clear API Key. To revoke it for good, use the API keys page on the website.

Using MEMFLOW_API_KEY (CI / headless)

If no key is in SecretStorage, the extension reads MEMFLOW_API_KEY from the VS Code process environment. Only a valid lago_live_… / lago_test_… key is accepted; any other value is ignored. A SecretStorage key always takes precedence. This is the same variable MemFlow Relay uses.

Commands

Command ID Legacy alias
MemFlow: Set API Key memflow.setApiKey lamoonagi.setApiKey
MemFlow: Clear API Key memflow.clearApiKey lamoonagi.clearApiKey
MemFlow: Analyze Selection/File memflow.analyze lamoonagi.analyze

The legacy lamoonagi.* IDs still work, so existing keybindings and scripts keep running. A key saved by the earlier "LamoonAGI Context VMM" build is moved to the new SecretStorage entry the first time you run an analysis.

Settings

Setting Default Notes
memflow.apiBaseUrl https://api.lamoonagi.com Must be https://. Plain http:// is accepted only for localhost (local gateway on port 8100).
lamoonagi.apiBaseUrl https://api.lamoonagi.com Deprecated. Read only when memflow.apiBaseUrl is not set.

There are no other settings, and no secret is ever stored in settings.

What is sent

  • POST {apiBaseUrl}/v1/chat/completions with Authorization: Bearer lago_…. The body contains the selected text or the whole file, plus its relative file name and language ID. Content is capped at 400,000 characters.
  • The gateway runs the Context VMM optimizer and returns x_cvmm metadata (tokens before and after, estimated savings). It uses the server-side model key; your key is never forwarded upstream.
  • Savings shown in VS Code are estimates. Verified savings and USD values are shown separately on the dashboard.

Develop

pnpm --filter memflow install
pnpm --filter memflow test        # vitest (pure client)
pnpm --filter memflow build       # tsc → out/
pnpm --filter memflow package     # vsce package → memflow-0.1.0.vsix
code --install-extension memflow-0.1.0.vsix

The Marketplace ID is lamoonagi.memflow. It matches the web dashboard's default "Install Extension" link (CONTEXT_VMM_EXTENSION_URL overrides it).

Design note: future OIDC Authorization Code + PKCE (not implemented)

Phase 1 uses pasted API keys to avoid delaying the launch (spec §19–20). The planned migration:

  1. Register a public authentik OIDC client, lamoonagi-vscode, with no client secret. Use PKCE S256 (already supported by our authentik instance) and the redirect URI vscode://lamoonagi.memflow/auth-callback, plus a loopback http://127.0.0.1:<port>/callback as a fallback.
  2. Implement vscode.AuthenticationProvider (id lamoonagi):
    • generate code_verifier, state and nonce;
    • open the authorize URL with vscode.env.openExternal;
    • receive the code with window.registerUriHandler;
    • exchange it at the token endpoint.
  3. account-api gets an endpoint that exchanges a validated access token (issuer, signature via JWKS, audience lamoonagi-vscode, expiry) for a short-lived, workspace-scoped lago_ token or verifies it directly. That keeps the gateway's single lago_ verification path unchanged.
  4. Store the refresh token in SecretStorage. Revoke it on sign-out.
  5. Keep Set API Key for CI and headless use. Nothing in the business tables changes: identity is still auth_provider + auth_subject.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft