From 26c35e55d8757e98490e760924f05125dce5b2d7 Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Fri, 7 Nov 2025 13:40:10 -0700 Subject: [PATCH] docs: documented how to create custom REPL prompts --- docs/REPL-PROMPT.md | 118 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 docs/REPL-PROMPT.md diff --git a/docs/REPL-PROMPT.md b/docs/REPL-PROMPT.md new file mode 100644 index 0000000..d0ba268 --- /dev/null +++ b/docs/REPL-PROMPT.md @@ -0,0 +1,118 @@ +# Customize REPL Prompt + +[//]: # (TODO link to this doc from the main README) +The prompt you see when you start the Loki REPL can be customized to your liking. This is achieved via the `left_prompt` +and `right_prompt` settings in the global Loki configuration file: + +```yaml +left_prompt: '{color.red}{model}){color.green}{?session {?agent {agent}>}{session}{?role /}}{!session {?agent {agent}>}}{role}{?rag @{rag}}{color.cyan}{?session )}{!session >}{color.reset} ' +right_prompt: '{color.purple}{?session {?consume_tokens {consume_tokens}({consume_percent}%)}{!consume_tokens {consume_tokens}}}{color.reset}' +``` + +The location of the global configuration file differs between systems, so you can use the following command to find your +global configuration file's location: + +```shell +loki --info | grep 'config_file' | awk '{print $2}' +``` + +## Quick Links + +- [Syntax](#syntax) +- [Variables](#variables) + + +## Syntax +The syntax for the prompts consists of plain text and templates contained in `{...}`. The plain text is +printed exactly as given. + +The syntax for the templates `{...}` is as follows: + +* `{variable}` - Replaced with the value of `variable` +* `{?variable