Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The system prompt

Your config can change the instructions that the model gets with every message you send.

Adding project notes

Adds NOTES.md from the working directory to the system prompt on every turn.

uji.context.add("notes", function()
  local file = io.open(uji.session.info().directory .. "/NOTES.md")
  if not file then
    return nil
  end
  local notes = file:read("a")
  file:close()
  return "Project notes from NOTES.md:\n\n" .. notes
end)

A reminder at the end of the turn

Text returned with at = "turn" goes after the conversation instead of into the system prompt.

uji.context.add("reminder", function()
  return { text = "Run the tests before you say you are done.", at = "turn" }
end)

Rewriting the whole prompt

A before_turn hook returns a new system prompt.

uji.on("before_turn", function(turn)
  return turn.system .. "\n\nWrite commit messages in the imperative mood."
end)

To replace the prompt entirely, override the built-in uji.prompt module, as Rebuilding uji shows.