Builds the Cursor `sessionStart` `additional_context` text.
(
initialized: bool,
staleness_hint: Option<&str>,
tokens_saved: Option<u64>,
)
| 46 | |
| 47 | /// Builds the Cursor `sessionStart` `additional_context` text. |
| 48 | pub fn build_cursor_session_context( |
| 49 | initialized: bool, |
| 50 | staleness_hint: Option<&str>, |
| 51 | tokens_saved: Option<u64>, |
| 52 | ) -> String { |
| 53 | let mut s = index_status_line(initialized, staleness_hint); |
| 54 | if initialized { |
| 55 | append_tracedecay_bootstrap_context(&mut s); |
| 56 | s.push_str("Workflow skills: tracedecay:"); |
| 57 | s.push_str(&CURSOR_PLUGIN_SKILLS.join(", ")); |
| 58 | s.push_str(" — each maps a common workflow stage to the right tracedecay tools.\n"); |
| 59 | if let Some(saved) = tokens_saved.filter(|saved| *saved > 0) { |
| 60 | s.push_str("Tokens saved by tracedecay this session: "); |
| 61 | s.push_str(&saved.to_string()); |
| 62 | s.push_str(".\n"); |
| 63 | } |
| 64 | } |
| 65 | s |
| 66 | } |
| 67 | |
| 68 | /// One-line index freshness signal. |
| 69 | pub(super) fn index_status_line(initialized: bool, staleness_hint: Option<&str>) -> String { |