Skip to content

REPL

Not part of the hosted product

G6 is hosted: you reach it over MCP by pointing Claude Code (or any MCP client) at the server. There is no desktop app to install and no self-hosted deployment. This page documents a surface that exists in the repository but is not part of the hosted product today — it is kept as engineering reference, not as instructions for customers.

The REPL is an interactive prompt-toolkit shell with agentic LLM chat. It is the default mode when you run g6 with no subcommand.


Overview

# Launch REPL (default)
g6

# Force REPL mode
G6_CLI_MODE=click g6

The REPL combines two interaction modes:

  1. CLI commands — type any CLI command directly (e.g. invoke core health, registry list)
  2. Natural language — queries that don't match a command are routed to an LLM for agentic chat with tool-calling

Workspaces

Each REPL session runs inside a workspace — a directory under ~/.g6/g6_workspaces/<name>/ that persists:

  • Chat history (chat_history.jsonl)
  • Session state
  • Run artifacts
  • Git-backed versioning via WorkspaceManagerBlock

On startup, the REPL offers to resume the last workspace or create a new one.


LLM agentic chat

Natural language queries are handled by an LLM agent with access to 10 tools. The agent can chain up to 8 tool calls per query to research and answer your question.

Backends

Backend Provider Model Selection
Ollama Local gemma3:12b (configurable) Default — no API key needed
OpenRouter Cloud google/gemini-2.5-flash Requires OPENROUTER_API_KEY
Claude Code Local subprocess Inherited from host Set G6_REPL_BACKEND=claude

The REPL auto-selects Ollama if available, falling back to OpenRouter if an API key is set.

Tool-calling

When the LLM backend supports function calling, the agent has access to these tools:

Tool Description
read_file Read a file from the workspace (max 8,000 chars)
list_dir List files and directories
fetch_url HTTP GET with HTML stripping (max 12,000 chars)
list_components List all G6 components with op counts
nav_search Search components by keyword
guide_ask Ask the G6 guide a question
invoke_component Invoke a component operation
decompose_goal Break a goal into subtasks
run_pipeline Run a component pipeline
calculator Evaluate mathematical expressions

The agent executes up to 8 tool-calling steps per query. A terminal spinner shows progress during LLM calls.


Cross-session memory

The REPL maintains two memory layers for context across sessions:

Layer Technology Purpose
Working memory ACE (TF-IDF) Fast recall of recent interactions
Long-term memory Cognee (knowledge graph) Entity and relationship extraction

Memory is per-workspace and loaded/saved automatically on workspace open/close.


Built-in commands

Command Description
help Show available commands
clear Clear conversation history
workspace Show current workspace info
tui Launch the TUI dashboard
quit / exit Exit the REPL

All CLI commands are also available directly in the REPL (e.g. registry list, hitl list, session status).


Configuration

Variable Default Description
G6_CLI_MODE both both / tui / click — controls default launch mode
G6_REPL_BACKEND (auto) Force backend: claude, openrouter, ollama
G6_ASCII_MODE (unset) Set to 1 for ASCII-only rendering (no Unicode)
SOLVER__DEFAULT_LLM_BACKEND ollama Default LLM backend for all G6 operations
SOLVER__DEFAULT_OLLAMA_MODEL gemma3:12b Ollama model to use
OPENROUTER_API_KEY (unset) Required for OpenRouter backend

Source files

File Purpose
bases/mvp/cli/g6_cli.py REPL loop, workspace management, LLM dispatch
bases/mvp/cli/repl_tools.py 10 tool schemas and executors
bases/mvp/cli/repl_skin.py Prompt styling and colour themes
bases/mvp/cli/memory_manager.py ACE + Cognee memory integration
bases/mvp/cli/mcp_client.py MCP client for tool-calling

See also

  • CLI Commands — full command reference (all commands work in the REPL)
  • CLI (TUI) — the 11-tab Textual terminal interface
  • Desktop — desktop launcher