Skip to content

Slash-command skills and Apollo-owned history for the global assistant - #5236

Draft
hanna-paasivirta wants to merge 3 commits into
mainfrom
pass-through-apollo-history
Draft

hanna-paasivirta wants to merge 3 commits into
mainfrom
pass-through-apollo-history

Conversation

@hanna-paasivirta

Copy link
Copy Markdown
Contributor

Description

This PR adds slash-command skills (/design, /diagnose, /qa) to the global assistant and stores Apollo's conversation history so it can be sent back unchanged. It is the Lightning side of OpenFn/apollo#711.

Decisions

  • Apollo owns the history. Lightning stores what Apollo returns and sends it back unchanged, instead of rebuilding it from messages. This is what lets a skill like /design keep working over several turns: its instructions stay in the history, and there is no skill mode that ends, which is also how Claude Code handles skills.
  • Lightning recognises the slash command and names it in skill, only on the turn that starts with /name. Apollo strips the command and keeps the skill in its history.
  • Lightning keeps its own list of skills for the slash menu for now. It needs a way to sync with Apollo's list, which we'll add once this work is validated, to avoid complexity we may not need and get this out for testing sooner.

Changes

  • New nullable apollo_history column on ai_chat_sessions. After each successful response, the history from the final complete event is saved as received, for job, workflow and global chat. The next request sends it back as history. Sessions from before this fall back to rebuilding history from messages.
  • Global chat messages that start with a known /name send skill: {name} to Apollo.
  • A slash-command menu in the assistant's chat input, listing the skills from the backend (ai_skills in the session context). The chosen skill shows as a pill, on the input and on sent messages.
  • Adds tests for storing and sending back history, detecting skills, and the slash menu.

Validation steps

  1. Run Apollo from the slash-command-preset branch (Add skills as slash commands apollo#711) and point Lightning at it.
  2. Open the global assistant, type / and check design, diagnose and qa are listed.
  3. Run /design and answer its questions over a few turns. It should keep asking design questions rather than building straight away.
  4. Check the session's apollo_history column holds the full history, including the skill instructions and [pg:...] page prefixes.

Additional notes for the reviewer

  1. Typing /design ... on the "Where would you like to start today?" screen already works, but that screen has its own input, so it doesn't show the slash menu yet. Adding it there means sharing the menu logic with ChatInput; that's left for a follow-up.
  2. If two tabs send in the same session at once, the last response to finish overwrites the stored history. This is rare, so it's left as is.

AI Usage

Please disclose whether you've used AI anywhere in this PR (it's cool, we just
want to know!):

  • I have used Claude Code
  • I have used another model
  • I have not used AI

You can read more details in our
Responsible AI Policy

Pre-submission checklist

  • I have performed an AI review of my code (we recommend using /review
    with Claude Code)
  • I have implemented and tested all related authorization policies.
    (e.g., :owner, :admin, :editor, :viewer)
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New Issues

Development

Successfully merging this pull request may close these issues.

1 participant