1 unstable release
| 0.1.0 | Jan 20, 2026 |
|---|
#1957 in Text processing
95 downloads per month
Used in 2 crates
145KB
3K
SLoC
llm-coding-tools-core
Lightweight, high-performance core types and utilities for coding tools - framework agnostic.
Overview
This crate provides the foundational building blocks for coding tool implementations:
ToolError- Unified error type for all tool operationsToolResult<T>- Result type alias using ToolErrorToolOutput- Wrapper for tool responses with truncation metadata- Utility functions for text processing and formatting
contextmodule - LLM guidance strings for tool usage
Features
tokio(default): Async mode with tokio runtime. Enables async function signatures.blocking: Sync/blocking mode. Mutually exclusive withtokio/async.async: Base async signatures (internal). Requires a runtime; usetokioinstead.
The async and blocking features are mutually exclusive - enabling both causes a compile error.
Future runtimes (smol, async-std) can be added following the same pattern as tokio.
Usage
use llm_coding_tools_core::{ToolError, ToolResult, ToolOutput};
use llm_coding_tools_core::util::{truncate_text, format_numbered_line};
Context Module
The context module provides embedded strings containing usage guidance for LLM agents.
These can be appended to tool descriptions or system prompts.
Path-based tools have two variants:
*_ABSOLUTE: For unrestricted filesystem access (absolute paths required)*_ALLOWED: For sandboxed access (paths relative to allowed directories)
use llm_coding_tools_core::context::{BASH, READ_ABSOLUTE, READ_ALLOWED};
// Non-path tools have a single variant
println!("{}", BASH);
// Path-based tools have absolute and allowed variants
println!("{}", READ_ABSOLUTE);
println!("{}", READ_ALLOWED);
Available context strings:
BASH,TASK,TODO_READ,TODO_WRITE,WEBFETCH- standalone toolsREAD_ABSOLUTE,READ_ALLOWED- file readingWRITE_ABSOLUTE,WRITE_ALLOWED- file writingEDIT_ABSOLUTE,EDIT_ALLOWED- file editingGLOB_ABSOLUTE,GLOB_ALLOWED- pattern matchingGREP_ABSOLUTE,GREP_ALLOWED- content search
Design Principles
- No framework-specific dependencies, plug and play into any LLM framework/library
- See llm-coding-tools-rig for an integration example with rig
- Minimal dependency footprint
- Performance-oriented (optimized) with zero-cost abstractions
Dependencies
~14–51MB
~786K SLoC