Query specialized knowledgebases with AI-powered RAG
1. Install (one command):
curl -fsSL https://yatti.id/v1/install | bash2. Configure your API key:
yatti-api configure3. Query a knowledgebase:
yatti-api query seculardharma "What is mindfulness?"Need more? See Available Knowledgebases | Example Queries | All Options
Run yatti-api kb list for the complete list, or kb list --long for full descriptions. Popular domains:
| Knowledgebase | Description |
|---|---|
| seculardharma | Buddhist philosophy and mindfulness |
| jakartapost | Indonesian news archive (use --timeout 300) |
| peraturan.go.id | Indonesian laws and regulations |
| appliedanthropology | Anthropology research and practice |
| prosocial.world | Social evolution and cooperation |
| okusiassociates | Indonesian business operations |
- Example Queries - Practical query examples
- Large Query Input - File and stdin support
- Features - Full feature list
- Installation - Linux, macOS, Windows
- Usage Reference - Commands and options
- Configuration - API key, environment
- Troubleshooting - Common issues
- Quick Reference - Use cases and tips
- Development - Testing, contributing
- Release Notes - Version history
# Current Indonesian news and analysis
yatti-api query jakartapost "Outline the economic conditions in Indonesian in 1997."
# Indonesian laws and regulations
yatti-api query peraturan.go.id "What are the current requirements for foreign direct investment?"# Applied anthropology methods
yatti-api query appliedanthropology "How is ethnography used in UX research?"
# Social evolution and cooperation
yatti-api query prosocial.world "What is multilevel selection theory?"# Buddhist philosophy and practice
yatti-api query seculardharma "What is dharma?"
yatti-api query seculardharma "What is the difference between concentration and mindfulness?"Control the AI response:
# Use more context sources
yatti-api query jakartapost "Soeharto's legacy" --top-k 50 --timeout 300
# Scholarly writing style with extended response
yatti-api query appliedanthropology "participant observation" -p scholarly -M 2000
# Get source context only (no AI summary)
yatti-api query peraturan.go.id "company formation" --context-onlyNote: jakartapost is a very large knowledgebase - use longer timeouts for complex queries.
The yatti-api client supports unlimited query sizes through file and stdin input methods. Command-line arguments are limited to ~128 KB, but these alternatives remove all size restrictions.
| Method | Size Limit | Use Case |
|---|---|---|
| Command-line arg | ~128 KB | Short queries (default) |
File input (-Q) |
Unlimited | Large, reusable queries |
Stdin (-q -) |
Unlimited | Piped or scripted queries |
| Auto-detect stdin | Unlimited | Simple piping |
Best for: Reusable queries, documentation, version control
# Create a query file
cat > research_query.txt <<'EOF'
Analyze the anthropological perspectives on gift economies
in traditional Indonesian societies, particularly focusing on:
1. Reciprocity patterns in Balinese village systems
2. The role of social obligation in Javanese communities
3. Comparative analysis with Western economic models
4. Impact of modernization on traditional exchange systems
Please provide scholarly references and cite specific examples
from ethnographic research conducted in the archipelago.
EOF
# Execute the query
yatti-api query -K appliedanthropology -Q research_query.txt
# With additional options
yatti-api query -K appliedanthropology -Q research_query.txt \
--prompt-template scholarly \
--max-tokens 3000 \
--top-k 15Best for: Heredocs, dynamic content, scripts
# Simple heredoc
yatti-api query seculardharma -q - <<'EOF'
What is the relationship between mindfulness
and metacognition in Buddhist psychology?
EOF
# Multi-paragraph with context
yatti-api query jakartapost -q - <<'EOF'
I'm researching Indonesian economic history for an academic paper.
Please provide a comprehensive analysis of:
- Economic conditions during the 1997-1998 Asian Financial Crisis
- Government policy responses under Soeharto and Habibie
- Social impacts on different economic classes
- Comparison with similar crises in other ASEAN nations
Focus on factual reporting from contemporary news sources.
EOF
# From another command's output
grep -h "^## Question" ./notes/*.md | yatti-api query seculardharma -q -
# From file via cat
cat complex_query.txt | yatti-api query peraturan.go.id -q -Best for: Quick piping without flags
# Direct pipe from file
cat my_question.txt | yatti-api query -K seculardharma
# From echo
echo "Explain the concept of dependent origination" | yatti-api query -K seculardharma
# From command output
./generate_query.sh | yatti-api query -K jakartapostBest for: Short queries, interactive use
# Positional arguments (easiest)
yatti-api query seculardharma "What is mindfulness?"
# Flag-based (explicit)
yatti-api query -K jakartapost -q "Indonesian economic development"
# With options
yatti-api query -K appliedanthropology -q "ethnographic methods" \
--temperature 0.2 --top-k 10Example 1: Processing Multiple Queries from a File
# Create multiple queries
cat > queries.txt <<'EOF'
What is the historical context of the Majapahit Empire?
---
Explain the Dutch colonial period in Indonesia.
---
Describe Indonesian independence movement.
EOF
# Process each query
while IFS= read -r query; do
if [[ "$query" != "---" ]] && [[ -n "$query" ]]; then
echo "Query: $query"
echo "$query" | yatti-api query jakartapost -q -
echo "---"
fi
done < queries.txtExample 2: Combining with Text Processing
# Extract questions from markdown and query them
grep "^Q:" research_notes.md | sed 's/^Q: //' | \
yatti-api query -K appliedanthropology -q -Example 3: Large Document Analysis
# Create a comprehensive query with document context
cat > analysis_query.txt <<'EOF'
Based on the following excerpt from a field research document,
analyze the social dynamics and provide anthropological insights:
[Long document text here - multiple pages...]
Please focus on:
1. Power structures
2. Cultural symbolism
3. Economic relationships
EOF
yatti-api query appliedanthropology -Q analysis_query.txt \
--prompt-template analytical \
--max-tokens 4000 \
--timeout 120The tool provides automatic feedback for large queries:
| Query Size | Feedback |
|---|---|
| < 10 KB | Silent (standard processing) |
| 10-100 KB | Info: "Processing large query (X characters)..." |
| > 100 KB | Warning: "Very large query (X characters). Consider using --timeout for longer processing." |
Note: Very large queries (>100 KB) may require longer processing times. Use --timeout to prevent premature timeout:
# For very large queries
yatti-api query jakartapost -Q large_query.txt --timeout 300| Feature | Capability |
|---|---|
| Maximum query size | Unlimited (with file/stdin input) |
| Command-line limit | ~128 KB (backward compatible) |
| Input methods | 4 (command-line, file, stdin, auto-detect) |
| Size feedback | Automatic for queries >10 KB |
| Backward compatibility | 100% - all existing commands work |
Key Benefits:
- ◉ No more "argument too long" errors
- ◉ Submit entire documents for analysis
- ◉ Process queries from version-controlled files
- ◉ Integrate seamlessly with shell scripts and pipelines
- ◉ Maintain existing workflow - all old commands still work
- Multiple LLM models - OpenAI GPT, Anthropic Claude, Google Gemini
- Context control - Adjust how much source material informs answers
- Source citation - See exactly what informed the AI's response
- Caching - Fast repeated queries with configurable TTL
- Command-line - Quick queries up to ~128 KB
- File input - Unlimited size queries from files (
-Q) - Stdin support - Pipe queries from any source (
-q -) - Auto-detection - Automatic stdin handling for scripts
- Size feedback - Automatic warnings and suggestions for large queries
- Temperature control (0.0-2.0) - Balance creativity vs. precision
- Prompt templates - scholarly, technical, conversational, concise, analytical
- Token limits - Control response length
- Context-only mode - Retrieve sources without AI interpretation
- Timeout control - Adjust processing time limits (60-600 seconds)
- List available knowledgebases with
--longfor full descriptions - View metadata and statistics
- Sync updates from filesystem (admin)
- JSON output - Machine-readable responses
- Query history - Review past queries
- Self-updating - Automatic version management
- Bash completion - Tab-complete commands and KB names
- Environment variables - Scriptable configuration
- Pipe-friendly - Stdin/stdout support for Unix workflows
- Script integration - File-based queries for automation
Option 1: One-liner install (recommended)
curl -fsSL https://raw.githubusercontent.com/Open-Technology-Foundation/yatti-api/main/install.sh | bashOption 2: Manual install
sudo curl -o /usr/local/bin/yatti-api https://yatti.id/v1/client/download
sudo chmod +x /usr/local/bin/yatti-api
yatti-api configure
yatti-api version # Verify installationRequirements:
- Bash 5.2+
- curl
- jq (for JSON parsing)
Installing dependencies:
# macOS
brew install curl jq
# Ubuntu/Debian
sudo apt-get install curl jq
# CentOS/RHEL
sudo yum install curl jqWindows users should use WSL (Windows Subsystem for Linux) to run yatti-api. WSL provides a complete Linux environment on Windows.
Open PowerShell as Administrator:
wsl --installRestart your computer when prompted.
- Open "Ubuntu" from the Start menu
- Create a username and password when prompted
- Wait for installation to complete
In the WSL terminal (Ubuntu):
sudo apt-get update && sudo apt-get install -y curl jqUse the one-liner install:
curl -fsSL https://raw.githubusercontent.com/Open-Technology-Foundation/yatti-api/main/install.sh | bashOr manual install:
sudo curl -o /usr/local/bin/yatti-api https://yatti.id/v1/client/download
sudo chmod +x /usr/local/bin/yatti-api
yatti-api configureyatti-api versionWSL not available:
- Requires Windows 10 version 2004+ or Windows 11
- Enable WSL in Windows Features if
wsl --installfails
Ubuntu won't start:
- Check Windows Features: Virtual Machine Platform and WSL are enabled
- Run
wsl --updatein PowerShell as Administrator
Always use the WSL terminal (Ubuntu) to run yatti-api commands.
yatti-api help # Show help
yatti-api status # Check API status
yatti-api kb list # List knowledgebases
yatti-api kb list --long # List with full descriptions
yatti-api query KB "question" # Query a knowledgebase
yatti-api history # View query history
yatti-api configure # Configure API key
yatti-api update --check # Check for updates
yatti-api docs # View documentation
man yatti-api # View man page (if installed)The query command is the primary interface for interacting with knowledgebases. It supports multiple input methods for queries of any size.
Basic Syntax:
# Positional arguments (quick & easy)
yatti-api query <knowledgebase> "<query text>"
# Flag-based (explicit)
yatti-api query -K <knowledgebase> -q "<query text>" [OPTIONS]
# File input (unlimited size)
yatti-api query -K <knowledgebase> -Q <query-file> [OPTIONS]
# Stdin input (unlimited size)
yatti-api query -K <knowledgebase> -q - [OPTIONS]Query Input Options:
-K, --knowledgebase NAME- Knowledgebase to query (required)-q, --query TEXT- Query text (required, use"-"for stdin)-Q, --query-file FILE- Read query from file (unlimited size)
Query Processing Options:
-k, --top-k NUM- Number of context sources (default: 5)-t, --temperature NUM- LLM temperature 0.0-2.0 (default: 0.0)-m, --model NAME- LLM model (default: gpt-5.2)-s, --context-scope NUM- Context segments per result (default: 3)-c, --context-only- Return only context without AI response-M, --max-tokens NUM- Maximum response tokens-p, --prompt-template NAME- Prompt style (default,instructive,scholarly,concise,analytical,conversational,technical)-f, --force-refresh- Skip cache, force new query--cache-ttl SECONDS- Cache TTL in seconds (default: 86400)--timeout SECONDS- Query timeout in seconds (default: 60, max: 600)
Available Models:
- OpenAI: gpt-5.2 (default), and other GPT models
- Anthropic: claude-haiku-4-5, claude-opus-4-1, claude-sonnet-4-5
- Google: gemini-pro, gemini-ultra
yatti-api kb list # List all knowledgebases
yatti-api kb list --long # List with full descriptions
yatti-api kb get seculardharma # Get KB info and stats
yatti-api kb sync # Sync from filesystem (admin)yatti-api history # Last 20 queries
yatti-api history 50 # Last 50 queries
yatti-api history 20 jakartapost # Last 20 from specific KB
yatti-api get-query q_abc123 # Get specific query by IDyatti-api docs # User guide (JSON)
yatti-api docs user raw # User guide (markdown)
yatti-api docs user html # Open in browser
yatti-api docs api # API documentation
yatti-api docs technical # Developer docsyatti-api update --check # Check for updates
yatti-api update # Install update
yatti-api update --force # Force reinstallInteractive setup:
yatti-api configureEnvironment variable:
export YATTI_API_KEY="your_api_key_here"File location:
- Linux/macOS:
~/.config/yatti-api/api_key - Windows (WSL):
/home/<username>/.config/yatti-api/api_key
# API key (alternative to config file)
export YATTI_API_KEY="your_key"
# API base URL (default: https://yatti.id/v1)
export YATTI_API_BASE="https://custom.yatti.id/v1"
# Retry configuration
export YATTI_MAX_RETRIES=3 # Max retry attempts (default: 3, set to 1 to disable)
export YATTI_TIMEOUT=60 # Request timeout in seconds (default: 60)
export YATTI_CONNECT_TIMEOUT=10 # Connection timeout in seconds (default: 10)
# Verbose output
export VERBOSE=1
# Output format (pretty or json)
export OUTPUT_FORMAT=jsonEnable tab completion for commands, options, and knowledgebase names:
# Source the completion file
source yatti-api.bash_completion
# Or install system-wide:
sudo cp yatti-api.bash_completion /etc/bash_completion.d/yatti-apiPermission denied:
sudo chmod +x /usr/local/bin/yatti-apicurl or jq not found:
# macOS
brew install curl jq
# Ubuntu/Debian
sudo apt-get install curl jq
# CentOS/RHEL
sudo yum install curl jqAPI key not found:
yatti-api configureTimeouts on large knowledgebases:
# Use longer timeout for jakartapost
yatti-api query jakartapost "your query" --timeout 300Rate limiting or server errors (429, 5xx):
The client automatically retries transient failures with exponential backoff. To disable retries:
export YATTI_MAX_RETRIES=1Query too long (command-line limit exceeded):
# Use file input for queries >128 KB
yatti-api query -K seculardharma -Q long_query.txt
# Or use stdin
cat long_query.txt | yatti-api query seculardharma -q -yatti-api # Main bash script (~1100 lines)
yatti-api.1 # Man page documentation
yatti-api.bash_completion # Bash completion
CHANGELOG.md # Version history
install.sh # One-line installer
scripts/ # Development scripts
├── install-hooks.sh # Install git hooks
└── hooks/ # Git hook templates
└── pre-commit # Shellcheck on commit
tests/ # Test suite (274 tests)
├── unit/ # Unit tests (102 tests)
│ ├── test_utils.bats # Utility functions (16 tests)
│ ├── test_version_compare.bats # Version comparison (17 tests)
│ ├── test_validation.bats # URL/path validation (18 tests)
│ ├── test_gpg_verification.bats # GPG signature verification (6 tests)
│ ├── test_api_key.bats # API key loading (4 tests)
│ ├── test_large_payloads.bats # Large query handling (8 tests)
│ ├── test_unicode_handling.bats # Unicode/i18n support (15 tests)
│ └── test_error_resilience.bats # Error handling (14 tests)
├── integration/ # Integration tests (172 tests)
│ ├── test_cmd_configure.bats # Configure command (17 tests)
│ ├── test_cmd_query.bats # Query command (22 tests)
│ ├── test_cmd_users.bats # Users command (16 tests)
│ ├── test_cmd_docs.bats # Documentation command (12 tests)
│ ├── test_cmd_knowledgebases.bats # KB command (10 tests)
│ ├── test_cmd_update.bats # Update command (10 tests)
│ ├── test_api_request.bats # API request handling (10 tests)
│ ├── test_cmd_history.bats # History command (7 tests)
│ ├── test_cmd_help.bats # Help command (6 tests)
│ ├── test_cmd_status.bats # Status command (6 tests)
│ ├── test_cmd_get_query.bats # Get query command (6 tests)
│ ├── test_cmd_version.bats # Version command (5 tests)
│ ├── test_retry_logic.bats # Retry mechanism (15 tests)
│ └── test_stdin_autodetect.bats # Stdin auto-detection (23 tests)
├── helpers/ # Test utilities
│ ├── test_helpers.bash # Common functions
│ ├── mocks.bash # Mock functions
│ └── curl # Mock curl executable
├── fixtures/ # Mock data
│ └── api_responses.json # API response fixtures
└── run_tests.sh # Test runner
# Install git hooks (runs shellcheck on commit)
./scripts/install-hooks.sh
# Install shellcheck (required for pre-commit hook)
sudo apt-get install shellcheck # Ubuntu/Debian
brew install shellcheck # macOS# Run all tests
./tests/run_tests.sh
# Run specific suite
./tests/run_tests.sh unit
./tests/run_tests.sh integration
# Run with options
./tests/run_tests.sh -f pretty -pSee tests/README.md for complete testing documentation.
- ✓ ShellCheck: 0 warnings
- ✓ BCS (Bash Coding Standard): 100% compliant
- ✓ Test Coverage: 95%+ (274 tests)
- ✓ Security Audit: Passed (URL validation, GPG verification, path traversal prevention)
- Bash 5.2+
- curl
- jq (for JSON parsing)
Contributions welcome! We especially appreciate:
- Bug reports and fixes
- Documentation improvements
- New features
- Testing and feedback
Repository: https://github.com/Open-Technology-Foundation/yatti-api
Issues: https://github.com/Open-Technology-Foundation/yatti-api/issues
Research & Academic Work:
# Scholarly analysis with extended output
yatti-api query appliedanthropology -Q research_question.txt \
--prompt-template scholarly --max-tokens 3000
# Multiple sources with deep context
yatti-api query jakartapost -q "Indonesian history" \
--top-k 20 --context-scope 5 --timeout 300Development & Documentation:
# Get raw context for documentation
yatti-api query technical_kb "API design" --context-only
# JSON output for processing
OUTPUT_FORMAT=json yatti-api query kb "query" | jq '.data.response'Batch Processing:
# Process multiple queries
for file in queries/*.txt; do
yatti-api query kb -Q "$file" >> results.txt
done
# Extract and query from documents
grep "^Question:" notes.md | sed 's/Question: //' | \
while read -r q; do
echo "$q" | yatti-api query kb -q -
doneLarge Document Analysis:
# Analyze entire documents
cat research_paper.txt | yatti-api query appliedanthropology -q - \
--prompt-template analytical --max-tokens 4000 --timeout 180- Use
--timeout 300for large knowledgebases (jakartapost) - Use
--top-k 15-20for comprehensive research - Use
--context-onlyto get just the sources - Use
--cache-ttl 0to force fresh results - Set
VERBOSE=1to see detailed processing info
Git Commit Hook:
#!/bin/bash
# .git/hooks/pre-commit
git diff --staged | yatti-api query code-review -q - --context-onlyDocumentation Generator:
#!/bin/bash
for module in src/*.py; do
grep -h "^def " "$module" | \
yatti-api query python-docs -q - >> docs/api.md
doneResearch Assistant:
#!/bin/bash
# research.sh - Interactive research assistant
while true; do
read -rp "Research question: " question
[[ -z "$question" ]] && break
echo "$question" | yatti-api query appliedanthropology -q - \
--prompt-template scholarly --top-k 15
donekb list --longflag to display full knowledgebase descriptionskb getnow includeslong_descriptionfield in JSON output- API-based descriptions -
kb --longfetches from API (works on all servers)
- Retry logic with exponential backoff for transient failures (429, 5xx)
- Man page documentation (
man yatti-api) - Security: JSON input validation, GPG key pinning, read timeouts
- XDG compliance for config directory
- Unlimited query size via file input (
-Q) and stdin (-q -) - Security: URL validation, GPG signature verification, path traversal prevention
- Masked API keys in version output
See CHANGELOG.md for full version history.
- Documentation:
yatti-api helporman yatti-api - API Docs: https://yatti.id/admin/
- Issues: https://github.com/Open-Technology-Foundation/yatti-api/issues
- Website: https://yatti.id
Current version: 1.4.2
yatti-api update --check # Check for updatesGPL-3.0. See LICENSE.
Visit https://yatti.id for more information.