A command-line interface for interacting with an AI agent that has access to all Clojure MCP tools.
- A running nREPL server (default port 7888, configurable)
- Configured API keys for the chosen model (Anthropic, OpenAI, etc.)
Start your nREPL server:
clojure -M:nreplIn another terminal, run the CLI:
clojure -M:prompt-cli -p "Your prompt here"-p, --prompt PROMPT- The prompt to send to the agent (required)-r, --resume- Resume the most recent session with its conversation history-m, --model MODEL- Override the default model (e.g.,:openai/gpt-4,:anthropic/claude-3-5-sonnet)-c, --config CONFIG- Path to a custom agent configuration file (optional)-d, --dir DIRECTORY- Working directory (defaults to REPL's working directory)-P, --port PORT- nREPL server port (default: 7888)-h, --help- Show help message
Basic usage with default model:
clojure -M:prompt-cli -p "What namespaces are available?"Use a specific model:
clojure -M:prompt-cli -p "Evaluate (+ 1 2)" -m :openai/gpt-4Create code:
clojure -M:prompt-cli -p "Create a fibonacci function"Use a custom agent configuration:
clojure -M:prompt-cli -p "Analyze this project" -c my-custom-agent.ednConnect to a different nREPL port:
clojure -M:prompt-cli -p "Run tests" -P 8888Specify a working directory:
clojure -M:prompt-cli -p "List files" -d /path/to/projectResume the most recent session:
clojure -M:prompt-cli --resume -p "Continue with the next step"Resume with a different model:
clojure -M:prompt-cli --resume -p "Now refactor the code" -m :openai/gpt-4Sessions are automatically saved after each prompt execution:
- Sessions are stored in
.clojure-mcp/prompt-cli-sessions/within your working directory - Each session file is timestamped (e.g.,
2025-11-06T14-30-45.json) - Sessions contain the full conversation history and model information
- Use
--resumeto continue from the most recent session - When resuming, the conversation history is displayed before processing your new prompt
- You can resume with a different model using
-mto override the original session's model
The CLI properly initializes the nREPL connection with:
- Automatic detection of the working directory from the REPL
- Loading of
.clojure-mcp/config.ednfrom the working directory - Environment detection and initialization (Clojure, ClojureScript, etc.)
- Loading of REPL helper functions
By default, the CLI uses the parent-agent-config which includes:
- The Clojure REPL system prompt
- Access to all available tools
- Project context (code index and summary)
- Stateless memory (each invocation is independent)
You can create a custom agent configuration file in EDN format:
{:id :my-agent
:name "my_agent"
:description "My custom agent"
:system-message "Your system prompt here..."
:context true ; Include project context
:enable-tools [:read_file :clojure_eval :grep] ; Specific tools or [:all]
:memory-size 100 ; Or false for stateless
:model :anthropic/claude-3-5-sonnet-20241022}Set DEBUG=1 to see stack traces on errors:
DEBUG=1 clojure -M:prompt-cli -p "Your prompt"Models can be configured in .clojure-mcp/config.edn:
{:models {:openai/my-gpt4 {:model-name "gpt-4"
:temperature 0.3
:api-key [:env "OPENAI_API_KEY"]}}}Then use with:
clojure -M:prompt-cli -p "Your prompt" -m :openai/my-gpt4The agent has access to all tools by default, which are filtered based on the project's .clojure-mcp/config.edn settings:
enable-toolsanddisable-toolssettings are respected- Tool-specific configurations from
tools-configare applied