All source listed below is under MIT license if no LICENSE file stating different is available.

// retoor retoor@molodetz.nl

R

Author: retoor retoor@molodetz.nl

R is a high-performance command-line AI assistant written in C that provides a fully autonomous agent with unrestricted system access. It implements an advanced ReAct (Reasoning + Acting) loop, allowing it to perform complex, multi-turn tasks by executing tools, observing results, and refining its plan until the goal is achieved.

Features

🚀 Autonomous Orchestration

  • Lead Orchestrator: Implements a strict Plan-Execute-Verify-Conclude lifecycle.
  • Checklist Protocol: Mandates visible progress tracking for complex projects.
  • Smart Scale Handling: Automatically enforces proper directory structures for "huge" or multi-page projects.
  • Hierarchical Agents: Spawns specialized sub-agents (researcher, developer, security) with managed orchestration budgets.

⚙️ Asynchronous Process Management

  • Universal Control: Unified interface for backgrounding both Shell and Python tasks.
  • Real-Time Visibility: Streams process output live to the terminal, automatically indented and prefixed with [PID].
  • Granular Monitoring: Capture exit statuses, poll logs, and terminate tasks using stable PID tracking.
  • Automatic Backgrounding: Synchronous tasks that exceed timeouts are safely backgrounded without losing output.

🎨 Beautiful Terminal UI

  • Syntax Highlighting: Professional Python source code previews with line numbers and ANSI coloring.
  • Markdown Rendering: Full support for headers, lists, code blocks, and styling in agent responses.
  • PID Traceability: Every line of process output is clearly labeled for easy debugging of concurrent tasks.

🛠️ Advanced Tool System

All tools are fully compliant with OpenAI Strict Mode and exposed via robust JSON schemas.

Tool Description
linux_terminal_execute Execute shell commands with real-time output and PID tracking.
python_execute Professional Python execution with syntax-highlighted previews.
process_get_status [Universal] Monitor ANY background task, capture logs and exit codes.
process_terminate [Universal] Safely shut down background processes and clean up logs.
process_monitor System-wide process inspection with filtering and CPU sorting.
write_file / read_file Atomic file I/O with automatic directory management.
index_source_directory Deep indexing of codebases for architectural analysis.
spawn_agent Orchestrate specialized workers for research, coding, or audits.
web_search / http_fetch Integrated research and data gathering via Rexa API.
db_query / db_set Persistent state and versioning via local SQLite database.

🔒 Safety & Reliability

  • Sequence Integrity: Context manager protects the "holy sequence" of messages during shrinking.
  • Atomic Verification: Agent is forbidden from "lying" about actions; every file write is verified via tool output.
  • Crash Resilience: Benchmark suite includes real-time persistent logging for deep debugging.

Installation

Dependencies

libcurl json-c readline ncurses sqlite3 gnutls gmp openssl

Build & Install

make build
sudo make install

The binary is output to bin/r. Configuration is handled via environment variables (R_KEY, R_MODEL, R_BASE_URL) or local .rcontext.txt files.

License

MIT

include
src
test_results
testit
.gitignore
agent_benchmark.py
AI_Trends_2026_Summary.csv
benchmark_results.log
cloud_comparison.md
cmd.sh
CODE_DOCS.md
data_export.csv
db_migration.sql
Dockerfile
dummy_log.txt
eth_price.txt
exit_code_status.txt
GEMINI.md
git_summary.md
local.db
log_analysis.json
Makefile
mixed_async.txt
mock_verify.py
network_report.txt
parallel_results.txt
quicksort_implementation.csv
README.md
refactor_report.md
result.txt
security_recommendations.txt
security_report_2026.txt
security_scan.txt
sorting_algo.py
stats_summary.txt
system_monitor.py
termination_verify.txt
test_data.csv
timeout_bg_test.txt
usage.log
verification_status_report.txt
verify_components.py