-
-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
Common questions about MAINFRAME.
MAINFRAME is the AI-Native Bash Runtime - a library of 2,000+ pure bash functions designed to make AI agents safer, more accurate, and more efficient when controlling computer systems through bash.
- AI Agent Developers building autonomous systems
- AI Coding Assistants like Claude Code, Cursor, Aider
- DevOps Engineers who want reliable bash scripts
- Anyone who writes bash and wants better tooling
The name reflects our mission: providing a solid, reliable foundation (like a mainframe) for AI agents operating in bash environments.
No. MAINFRAME is pure bash with zero external dependencies. No jq, sed, awk, python, or other tools required.
The only requirement is Bash 4.0+ (5.0+ recommended).
- Minimum: Bash 4.0
- Recommended: Bash 5.0+
Check your version:
bash --versionYes, but macOS ships with Bash 3.x. Install a modern version:
brew install bashYes. Use the bash:5.2 base image:
FROM bash:5.2
RUN git clone https://github.com/gtwatts/mainframe.git /opt/mainframe
ENV MAINFRAME_ROOT=/opt/mainframeYes. Load only what you need:
export MAINFRAME_ROOT="$HOME/.mainframe"
source "$MAINFRAME_ROOT/lib/json.sh"
source "$MAINFRAME_ROOT/lib/validation.sh"cd "$MAINFRAME_ROOT"
git pull origin main- CHEATSHEET.md - Complete reference: CHEATSHEET.md
- Wiki Library Reference - Library Reference
-
Search in code:
grep -r "function_name" "$MAINFRAME_ROOT/lib/"
MAINFRAME prioritizes zero dependencies. json_object creates valid JSON using pure bash, ensuring scripts work everywhere without external tools.
mkdir |
ensure_dir |
|---|---|
| Fails if exists | Succeeds if exists |
| Not idempotent | Idempotent |
| Returns error | Returns status |
ensure_dir is safe to run multiple times, making it ideal for AI agents that may retry operations.
Universal Structured Output Protocol - MAINFRAME's standard for JSON output that AI agents can reliably parse.
export MAINFRAME_OUTPUT=json
output_success "done"
# {"ok":true,"data":"done"}- Structured Output - JSON that agents can parse reliably
- Safe Execution - Guardrails prevent destructive mistakes
- Idempotency - Operations safe to retry
- Validation - Input checking prevents errors
- Token Efficiency - 71% fewer tokens per task
Any AI that can execute bash:
- Claude Code
- Cursor
- Aider
- OpenCode
- Continue
- Custom LLM agents
- Add documentation to CLAUDE.md or system prompt
- Reference CHEATSHEET.md for function lookup
- Enable JSON output:
export MAINFRAME_OUTPUT=json
See AI Coding Assistant Setup for detailed guides.
Yes. Once installed, MAINFRAME has no network dependencies. All functions work offline.
Yes, with proper configuration:
- Enable
AGENT_STRICT_MODEfor whitelisting - Set
AGENT_AUDIT_LOGfor audit trail - Validate all paths with
validate_path_safe - Use
agent_safe_execinstead ofeval
It passes arguments as an array, not a string:
# Vulnerable
eval "cat $user_input" # user_input="file; rm -rf /"
# Safe
agent_safe_exec "cat" "$user_input" # Tries to cat literal filenamePatterns like:
rm -rf /dd if=mkfschmod 777curl | bash
DO NOT open public issues. Use:
Yes. Pure bash operations are 20-72x faster than external tools:
| Operation | External | MAINFRAME | Speedup |
|---|---|---|---|
| Trim string | 2379ms | 33ms | 72x |
| Lowercase | 778ms | 16ms | 49x |
| JSON create | 1200ms | 25ms | 48x |
By default, all libraries load at source time. For faster startup:
export MAINFRAME_LAZY=1 # Load on first useOr load only needed libraries.
# Time a function
time json_object "key=value"
# Run benchmarks
bash "$MAINFRAME_ROOT/benchmarks/superpower_benchmarks.sh"- Fork the repository
- Create a feature branch
- Write tests (BATS)
- Follow the style guide
- Submit a PR
See CONTRIBUTING.md
- Pure bash (no external dependencies)
- Functions use
snake_case - Export functions with
export -f - Document with comments
- Add BATS tests
cd "$MAINFRAME_ROOT"
git submodule update --init
./tests/bats/bin/bats tests/- Wiki - Documentation
- Discussions - Q&A
- Issues - Bug reports
- Troubleshooting - Common solutions
Currently, MAINFRAME is community-supported. For enterprise needs, open a Discussion.
MAINFRAME · The AI-Native Bash Runtime
MAINFRAME · The AI-Native Bash Runtime
2,000+ Functions · Zero Dependencies · Safe by Default
GitHub · Discussions · Issues
"Knowing Your Shell is half the battle."