Module context

Module context 

Source
Expand description

Tool context strings for LLM agents.

These provide usage guidance, best practices, and behavioral instructions for LLM agents when using coding tools. Context strings are sourced from OpenCode’s tool documentation.

§Path-based Tools

Tools operating on file paths have two variants:

  • *_ABSOLUTE: For unrestricted filesystem access (absolute paths required)
  • *_ALLOWED: For sandboxed access (paths relative to allowed directories)

§Example

use llm_coding_tools_core::context::{BASH, READ_ABSOLUTE, READ_ALLOWED};

// Use BASH context for bash tool
println!("Bash guidance: {}", BASH);

// Use appropriate read context based on path resolver
let sandboxed = true;
let read_context = if sandboxed { READ_ALLOWED } else { READ_ABSOLUTE };

Constants§

BASH
Bash tool context - shell command execution guidance.
EDIT_ABSOLUTE
Edit tool context for absolute path mode.
EDIT_ALLOWED
Edit tool context for allowed/sandboxed path mode.
GITHUB_CLI
GitHub CLI context - gh command usage guidance.
GIT_WORKFLOW
Git workflow context - commit creation guidance.
GLOB_ABSOLUTE
Glob tool context for absolute path mode.
GLOB_ALLOWED
Glob tool context for allowed/sandboxed path mode.
GREP_ABSOLUTE
Grep tool context for absolute path mode.
GREP_ALLOWED
Grep tool context for allowed/sandboxed path mode.
READ_ABSOLUTE
Read tool context for absolute path mode.
READ_ALLOWED
Read tool context for allowed/sandboxed path mode.
TODO_READ
Todo read tool context - reading task lists.
TODO_WRITE
Todo write tool context - managing task lists.
WEBFETCH
Webfetch tool context - URL content retrieval.
WRITE_ABSOLUTE
Write tool context for absolute path mode.
WRITE_ALLOWED
Write tool context for allowed/sandboxed path mode.

Traits§

ToolContext
Trait for tools that provide usage context for LLM system prompts.