Skip to content

Make Rules Library plaintext instead of LMDB #34154

Description

@notpeter

Summary

Rules need to be importable on a global/system-wide level. Importing rules should be configurable/automatic. The above can be achieved by initializing the Prompt Store LMDB instance from a set of local files, similar to how prompt_overrides currently works.

Details

Currently these are stored in: ~/.config/zed/prompts/prompts-library-db.0.mdb as a binary LMDB. Ideally they would be in a plaintext format so they can be version controlled. This feature is intentionally narrowly scoped to not include dynamic application of rules (e.g. use these rules for Lua, and these rules for Rust) -- and is just getting them into a human readable/backupable/mergable format.

Simplest possible implementation would be a directory of markdown files.

Enables

  • Users can share Rules across multiple devices (e.g. by linking zed's config directory to a shared filesystem)
  • Users can version control Rules (e.g. linking zed's config directory to a git repo)
more details

Motivation / Details

The old Prompt Library was quite nice for customizing slash commands in the Assistant Context Editor. One use case of these that was under-appreciated was the ability to copy the system prompts from e.g. Claude.ai or ChatGPT to recreate their personalities in the Zed Assistant.

This Prompt Library had some fundamental limitations:

  1. No shared state - if I'm using Zed on multiple devices, there's no way to share these prompts across those devices.
  2. No importable state - similar to the above, there's no way to import prompts in the Prompt Library from files, so syncing prompts across devices had to be done completely manually through the UI. But this leads to other issues, like prompts not being version-controllable.
  3. Default message: No way to customize the default conversation in the Assistant Context Editor (now called New Text Thread). IMO this is what "default prompt" always misunderstood -- the editor exposes a beautiful ChatML editor, but only allows you to configure the default ChatML conversation very strictly, i.e. forces you to stuff default prompts into the first user message. For the system prompt use case mentioned above, I find myself having to key in cmd-r cmd-r backspace backspace shift-enter cmd-r to get to my desired state. This should easily be configurable according to a ChatML-like Handlebars template that can be overriden by prompt_overrides.

Now Prompt Library has become Rules Library, but Rules have inherited all of the above limitations!

Discussed in #31458 by @jvmncs

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:aiRelated to Agent Panel, Edit Prediction, Copilot, or other AI featuresarea:settingsFeedback for preferences, configuration, etc

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions