Skip to content

LLM support in KeY UI - #3687

Draft
wadoon wants to merge 8 commits into
mainfrom
weigl/llm
Draft

wadoon wants to merge 8 commits into
mainfrom
weigl/llm

Conversation

@wadoon

@wadoon wadoon commented Nov 19, 2025 •

Copy link
Copy Markdown
Member

Synopsis

PR brings LLM prompt integration into KeY. Using the API of the KIT service (openai-compat).

Intended Change & Plan

  • MVP
    • Minimal working prompt

      image
    • Adding files from the Java model
      UI w/o functionality
      image

    • Adding current sequent

    • DnD support for formulas.

  • Second level
    • Get list of models
    • DnD from source view?
    • Generation of computation trace from Schwörers thesis?
    • Prompts
    • Background knowledge
  • Third level
    • Integration into dialogs (invariant, contract)

Type of pull request

  • New feature (non-breaking change which adds functionality)
  • There are changes to the (Java) code

Ensuring quality

  • User documentation: https://keyproject.github.io/key-docs/user/LLM/
  • I made sure that introduced/changed code is well documented (javadoc and inline comments).
  • I made sure that new/changed end-user features are well documented (https://github.com/KeYProject/key-docs).
  • I added new test case(s) for new functionality.
  • I have tested the feature as follows: ...
  • I have checked that runtime performance has not deteriorated.
  • For new Gradle modules: I added the Gradle module to the test matrix in
    .github/workflows/tests.yml

The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.

…ontext and tests

Rework the keyext.llm chat into a full KeY-Agent:
- ExtendedPrompt assembles the request (system prompt, proof context,
  attachments, capped history, resolved user message) instead of the panel.
- AgentLoop drives one turn as a bounded tool-calling loop with ask_user
  and run_command approval pauses, cancel, and per-turn activity.
- PromptResolver resolves $, @, /skill:, /prompt:, /skills and /prompts.
- Built-in tools: get_proof_context, list_files, read_file, file_info
  (read-only, jail-checked, bounded), run_command (blocklist + approval),
  ask_user (interactive), and use_skill (gated by agentCanUseSkills).
- BuiltInMCPClient reads the approval/disabled sets live from settings and
  no longer mutates them in getTools.
- File-backed prompt/skill libraries, autocomplete, rewritten settings UI
  and thin chat panel; demo scaffolding removed (LlmClient*, DemoMcpTool)
  and token-leaking loggers stripped from logback.xml.
- Fix LlmSettings static-initializer order, the Question wire mapping
  (SerializedName), McpClientStdio schema conversion, make McpToolProvider
  public for service loading.
- Add keyext.llm to the CI test matrix and a 42-test unit suite
  (AgentLoop, ShellSafetyPolicy, PromptResolver, LlmContext, tool schema
  serialization, BuiltInMCPClient, ExtendedPrompt).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant