Unhandled error, or --max-turns exceeded in print mode
Data directories
Path
Purpose
~/.jdai/
JD.AI data root
~/.jdai/config.json
Global default provider/model configuration
~/.jdai/sessions.db
SQLite session database
~/.jdai/exports/
Exported session JSON files
~/.jdai/models/
Local GGUF models and registry
~/.jdai/models/registry.json
Local model manifest
~/.jdai/credentials/
Encrypted credential store
~/.jdai/update-check.json
NuGet update check cache (24h TTL)
.jdai/defaults.json
Per-project default provider/model overrides
~/.dotnet/tools/jdai
Tool binary location
Piped input
JD.AI reads from stdin when input is redirected. Combine with --print for scripting:
# Pipe file content as context
cat README.md | jdai --print "Summarize this file"
# Pipe command output
dotnet test 2>&1 | jdai -p "Explain these test failures"
# Combine piped input with a query
echo "SELECT * FROM users" | jdai --print "Optimize this SQL query"
# JSON output for scripting
echo "hello" | jdai --print "translate to French" --output-format json
Piped input is prepended to the query separated by ---.
Examples
# Start interactive session in current directory
jdai
# Start fresh session (no persistence restore)
jdai --new
# Resume a specific session
jdai --resume abc123
# Continue most recent session for this project
jdai --continue
# Select a specific model
jdai --model gpt-4o --provider openai
# Non-interactive print mode
jdai --print "Explain this codebase"
# Print mode with JSON output and turn limit
jdai --print "Refactor auth" --output-format json --max-turns 5
# Custom system prompt
jdai --system-prompt "You are a code reviewer. Be concise."
# Append to default system prompt
jdai --append-system-prompt "Always use British English."
# Add additional working directories
jdai --add-dir ../shared-lib --add-dir ../common
# Restrict available tools
jdai --allowedTools read_file,grep,glob,list_directory
# Start with gateway enabled
jdai --gateway --gateway-port 9090
# Skip all tool confirmations
jdai --dangerously-skip-permissions