1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! System prompt assembly for the Talos agent.
//!
//! This module provides [`SystemPromptBuilder`] for constructing system prompts
//! from multiple components: identity, tool descriptions, skill index, context
//! files, and user preferences. The prompt is structured for optimal caching
//! by LLM providers, with stable sections placed first.
//!
//! # Prompt Ordering
//!
//! Components are assembled in this order for optimal cache hits:
//! 1. **Identity** — stable, cacheable
//! 2. **Tools** — stable, cacheable
//! 3. **Skill index** — stable, cacheable
//! 4. **Context files** — semi-stable
//! 5. **User preferences** — semi-stable
//! 6. **Custom prompt** — replaces identity if provided
//! 7. **Append prompt** — added at end if provided
//!
//! # Cache Markers
//!
//! [`SystemPromptBuilder::build_with_cache_markers`] returns cache control
//! markers indicating which byte ranges are stable and suitable for provider
//! caching (e.g., Anthropic's `cache_control: { type: "ephemeral" }`).
//!
//! # Example
//!
//! ```
//! use talos_agent::prompt::{SystemPromptBuilder, ToolDescription, ContextFile};
//! use talos_skill::SkillIndex;
//!
//! let prompt = SystemPromptBuilder::new()
//! .with_tools(vec![ToolDescription {
//! name: "read".into(),
//! description: "Read a file".into(),
//! ..Default::default()
//! }])
//! .with_skill_index(vec![SkillIndex {
//! name: "git-skill".into(),
//! description: "Git operations".into(),
//! triggers: vec!["git".into()],
//! estimated_tokens: 0,
//! source: talos_skill::SkillSource::Project,
//! }])
//! .with_context_files(vec![ContextFile {
//! path: "AGENTS.md".into(),
//! content: "# Project Rules\nBe helpful.".into(),
//! }])
//! .build();
//!
//! assert!(prompt.contains("# Identity"));
//! assert!(prompt.contains("# Tools"));
//! assert!(prompt.contains("# Skills"));
//! ```
pub use ;
pub use SystemPromptBuilder;
pub use ;