| Crates.io | llm-coding-tools-rig |
| lib.rs | llm-coding-tools-rig |
| version | 0.1.0 |
| created_at | 2026-01-20 19:47:48.791078+00 |
| updated_at | 2026-01-20 19:47:48.791078+00 |
| description | Lightweight, high-performance Rig framework Tool implementations for coding tools |
| homepage | |
| repository | https://github.com/Sewer56/llm-coding-tools |
| max_upload_size | |
| id | 2057377 |
| size | 135,070 |
Lightweight, high-performance Rig framework Tool implementations for coding tools.
absolute::* - Unrestricted filesystem accessallowed::* - Sandboxed to configured directoriesAdd to your Cargo.toml:
[dependencies]
llm-coding-tools-rig = "0.1"
Minimal runnable agent (requires OPENAI_API_KEY):
use llm_coding_tools_rig::absolute::{GlobTool, GrepTool, ReadTool};
use llm_coding_tools_rig::{BashTool, SystemPromptBuilder, TodoTools};
use rig::providers::openai;
use rig::client::{ProviderClient, CompletionClient};
use rig::completion::Prompt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let todos = TodoTools::new();
let mut pb = SystemPromptBuilder::new();
// Build agent with system prompt tracking
let client = openai::Client::from_env();
let agent = client
.agent("gpt-4o")
.tool(pb.track(ReadTool::<true>::new()))
.tool(pb.track(GlobTool::new()))
.tool(pb.track(GrepTool::<true>::new()))
.tool(pb.track(BashTool::new()))
.tool(pb.track(todos.read))
.tool(pb.track(todos.write))
.preamble(&pb.build()) // Build system prompt after tracking tools
.build();
let response = agent
.prompt("Search for TODO comments in src/")
.await?;
println!("{response}");
Ok(())
}
Example preamble output (truncated):
# Environment
Working directory: /home/user/project
# Tool Usage Guidelines
## `Read` Tool
Reads files from disk.
## `Bash` Tool
Executes shell commands.
File tools come in absolute::* (unrestricted) and allowed::* (sandboxed) variants:
use llm_coding_tools_rig::absolute::{ReadTool, WriteTool};
use llm_coding_tools_rig::allowed::{ReadTool as AllowedReadTool, WriteTool as AllowedWriteTool};
use llm_coding_tools_rig::AllowedPathResolver;
use std::path::PathBuf;
let read = ReadTool::<true>::new();
let resolver = AllowedPathResolver::new([PathBuf::from("/home/user/project")]).unwrap();
let sandboxed_read: AllowedReadTool<true> = AllowedReadTool::new(resolver.clone());
let sandboxed_write = AllowedWriteTool::new(resolver);
Other tools: BashTool, WebFetchTool, TodoTools.
Use SystemPromptBuilder to register tools and pass pb.build() to .preamble(). Set working_directory() so the environment section is populated.
Context strings are re-exported in llm_coding_tools_rig::context (e.g., BASH, READ_ABSOLUTE).
# Basic toolset setup with SystemPromptBuilder
cargo run --example basic -p llm-coding-tools-rig
# Sandboxed file access with allowed::* tools
cargo run --example sandboxed -p llm-coding-tools-rig
Apache 2.0