This reference documents the built-in gsh SDK object and all its capabilities.
The gsh object is the primary API for configuring and extending gsh, available in both REPL mode and script execution.
| Property/Method | Description | Availability |
|---|---|---|
gsh.version |
Current gsh version | REPL + Script |
gsh.terminal |
Terminal dimensions and TTY info | REPL + Script |
gsh.logging |
Log level and file configuration | REPL + Script |
gsh.models |
Model tier system (lite, workhorse, premium) | REPL + Script |
gsh.tools |
Built-in tools for agents | REPL + Script |
gsh.prompt |
Set the shell prompt | REPL only |
gsh.lastCommand |
Exit code and duration of last command | REPL only |
gsh.use() / gsh.remove() / gsh.removeAll() |
Event/middleware handler registration | REPL + Script |
gsh.ui.styles |
Text styling helpers | REPL + Script |
gsh.ui.spinner |
Loading spinner API | REPL + Script |
The ~/.gsh/repl.gsh file uses the gsh scripting language to configure your environment. This file is optional—gsh uses sensible defaults if it doesn't exist.
# ~/.gsh/repl.gsh
# Configure models
model myModel {
provider: "openai",
apiKey: env.OPENAI_API_KEY,
model: "gpt-5.2",
}
gsh.models.workhorse = myModel
# Set logging level
gsh.logging.level = "info"You can study the default configuration in cmd/gsh/defaults/ as a reference.
- Core Properties - Version, terminal, logging, prompt, lastCommand
- Models - Model tiers and model declaration syntax
- Tools - Built-in tools for agents (exec, grep, view_file, edit_file)
- Agents - Defining and using custom agents
- Events - Unified event/middleware system with gsh.use() and gsh.remove()
- UI - Styling helpers and spinner API
- Tutorial - Guided introduction to gsh
- Script Guide - Full gsh scripting language reference
- Main README - Installation and overview
Enable debug logging to troubleshoot configuration issues:
gsh.logging.level = "debug"Then view the logs:
tail -f ~/.gsh/gsh.log