Skip to content

FEAT: Plugin API - persistent storage #510

@andrinoff

Description

@andrinoff

Is your feature request related to a problem?

Plugins have no way to persist data between sessions. Plugins like the AI rewrite plugin can't save API keys, user preferences, or cached data without relying on external HTTP calls. Each session starts with a blank slate.

Describe the solution you'd like

Add a key-value storage API scoped per plugin:

local matcha = require("matcha")

-- Store a value
matcha.store_set("api_key", "sk-...")

-- Retrieve a value
local key = matcha.store_get("api_key")

Backend: a JSON file per plugin at ~/.config/matcha/plugins/<name>/data.json. Values should be strings (plugins can JSON-encode complex data themselves).

Describe alternatives you've considered

  • Letting plugins use io library for file access — but this breaks the sandbox security model
  • Environment variables — not persistent and pollutes the shell environment
  • Using matcha.http() to store data externally — requires network and an external service

Additional context

This is the most-requested missing API for plugin authors. It would unblock use cases like: saving API keys, caching results, storing per-user preferences, tracking plugin state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    In review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions