Skip to content

Commit 247feb1

Browse files
committed
Rename: PreambleBuilder to SystemPromptBuilder
This commit renames the builder throughout the codebase to better reflect its purpose. The PreambleBuilder was effectively building system prompts for LLM agents, and this new name makes the intent clearer to developers familiar with LLM terminology. Changes: - Core: Renamed preamble.rs module to system_prompt.rs - Core: Renamed PreambleBuilder struct to SystemPromptBuilder - Core: Updated all documentation and examples to use system_prompt terminology - Core: Renamed preamble_preview.rs example to system_prompt_preview.rs - Rig: Updated re-exports and documentation - Rig: Updated examples to use SystemPromptBuilder - SerdesAI: Updated re-exports and documentation - SerdesAI: Updated examples to use SystemPromptBuilder Git history preserved via git mv for preamble.rs -> system_prompt.rs rename. All unit tests pass (119 passed) All doctests pass (13 passed)
1 parent 70ca5c1 commit 247feb1

12 files changed

Lines changed: 141 additions & 140 deletions

File tree

src/llm-coding-tools-core/examples/preamble_preview.rs renamed to src/llm-coding-tools-core/examples/system_prompt_preview.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
//! Preamble preview - demonstrates full preamble generation.
1+
//! System Prompt preview - demonstrates full system prompt generation.
22
//!
3-
//! Shows how PreambleBuilder combines:
3+
//! Shows how SystemPromptBuilder combines:
44
//! - Custom system prompts
55
//! - Environment section (working directory, allowed paths)
66
//! - Tool usage guidelines (from tracked tools)
77
//! - Supplemental context (git workflow, GitHub CLI)
88
//!
9-
//! Run: cargo run --example preamble_preview -p llm-coding-tools-core
9+
//! Run: cargo run --example system_prompt_preview -p llm-coding-tools-core
1010
1111
use llm_coding_tools_core::context::ToolContext;
12-
use llm_coding_tools_core::{context, AllowedPathResolver, PreambleBuilder};
12+
use llm_coding_tools_core::{context, AllowedPathResolver, SystemPromptBuilder};
1313

1414
fn main() {
1515
// Use from_canonical to avoid filesystem requirements for the example.
1616
// In real usage, AllowedPathResolver::new() canonicalizes and validates paths.
1717
let resolver = AllowedPathResolver::from_canonical(["/home/user/project", "/tmp"]);
1818

19-
// Build preamble with all features demonstrated
20-
let mut pb = PreambleBuilder::new()
19+
// Build system prompt with all features demonstrated
20+
let mut pb = SystemPromptBuilder::new()
2121
.system_prompt(
2222
"# System Instructions\n\n\
2323
You are a helpful coding assistant. Follow best practices and \

‎src/llm-coding-tools-core/src/context/mod.rs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ pub const BASH: &str = include_str!("bash.txt");
2929
/// Git workflow context - commit creation guidance.
3030
///
3131
/// Supplemental context for agents using git via the Bash tool.
32-
/// Include via [`PreambleBuilder::add_context`](crate::PreambleBuilder::add_context).
32+
/// Include via [`SystemPromptBuilder::add_context`](crate::SystemPromptBuilder::add_context).
3333
pub const GIT_WORKFLOW: &str = include_str!("git_workflow.txt");
3434

3535
/// GitHub CLI context - gh command usage guidance.
3636
///
3737
/// Supplemental context for agents using the GitHub CLI via the Bash tool.
38-
/// Include via [`PreambleBuilder::add_context`](crate::PreambleBuilder::add_context).
38+
/// Include via [`SystemPromptBuilder::add_context`](crate::SystemPromptBuilder::add_context).
3939
pub const GITHUB_CLI: &str = include_str!("github_cli.txt");
4040

4141
/// Todo read tool context - reading task lists.
@@ -77,10 +77,10 @@ pub const GREP_ABSOLUTE: &str = include_str!("grep_absolute.txt");
7777
/// Grep tool context for allowed/sandboxed path mode.
7878
pub const GREP_ALLOWED: &str = include_str!("grep_allowed.txt");
7979

80-
/// Trait for tools that provide usage context for LLM preambles.
80+
/// Trait for tools that provide usage context for LLM system prompts.
8181
///
82-
/// Implement this trait on tool types (for frameworks like rig) to enable automatic preamble
83-
/// generation via [`PreambleBuilder`](crate::PreambleBuilder).
82+
/// Implement this trait on tool types (for frameworks like rig) to enable automatic system prompt
83+
/// generation via [`SystemPromptBuilder`](crate::SystemPromptBuilder).
8484
///
8585
/// # Example
8686
///
@@ -98,13 +98,13 @@ pub const GREP_ALLOWED: &str = include_str!("grep_allowed.txt");
9898
/// }
9999
/// ```
100100
pub trait ToolContext {
101-
/// Tool name used for section headers in generated preamble.
101+
/// Tool name used for section headers in generated system prompt.
102102
///
103103
/// Should be lowercase (e.g., "read", "bash", "glob").
104-
/// PreambleBuilder capitalizes this for display.
104+
/// SystemPromptBuilder capitalizes this for display.
105105
const NAME: &'static str;
106106

107-
/// Returns the tool's context string for preamble generation.
107+
/// Returns the tool's context string for system prompt generation.
108108
///
109109
/// This should return one of the context constants from this module.
110110
fn context(&self) -> &'static str;

‎src/llm-coding-tools-core/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ pub mod fs;
1414
pub mod operations;
1515
pub mod output;
1616
pub mod path;
17-
pub mod preamble;
17+
pub mod system_prompt;
1818
pub mod tool_names;
1919
pub mod util;
2020

2121
pub use context::ToolContext;
2222
pub use error::{ToolError, ToolResult};
2323
pub use output::ToolOutput;
2424
pub use path::{AbsolutePathResolver, AllowedPathResolver, PathResolver};
25-
pub use preamble::{PreambleBuilder, Substitute};
25+
pub use system_prompt::{Substitute, SystemPromptBuilder};
2626

2727
// Re-export operations (always available, sync or async based on runtime feature)
2828
pub use operations::{

0 commit comments

Comments
 (0)