@zigai/pi-mention-anything

Define arbitrary mention sources and triggers for Pi.

Packages

Package details

extension

Install @zigai/pi-mention-anything from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@zigai/pi-mention-anything
Package
@zigai/pi-mention-anything
Version
0.2.0
Published
Oct 11, 2026
Downloads
1,686/mo · 398/wk
Author
zigai
License
MIT
Types
extension
Size
207.1 KB
Dependencies
2 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

Pi Mention Anything

Custom mention pickers for Pi, from simple lists to chained selections. Available through settings and a TypeScript API.

Install

pi install npm:@zigai/pi-mention-anything

Selections become mentions in the editor and expand into context for the model. Chained selections open successive pickers.

Configuration

Global settings are stored in ~/.pi/agent/extension-settings/pi-mention-anything.json.

Option Type Default Description
mentions MentionDefinition[] [] Mention sources enabled in Pi.

Defaults

{
  "$schema": "./schemas/pi-mention-anything.schema.json",
  "mentions": []
}

Advanced example

{
  "$schema": "./schemas/pi-mention-anything.schema.json",
  "mentions": [
    {
      "id": "environments",
      "trigger": "%",
      "completionSuffix": " ",
      "source": {
        "type": "static",
        "items": [
          {
            "name": "staging",
            "description": "Staging environment"
          },
          {
            "name": "production",
            "description": "Production environment"
          }
        ]
      },
      "initialSuggestions": {
        "strategy": "frecency",
        "pinned": []
      }
    },
    {
      "id": "tickets",
      "trigger": "ticket:",
      "completionSuffix": " ",
      "source": {
        "type": "command",
        "mode": "array",
        "command": "list-my-tickets",
        "args": [
          "--json"
        ],
        "cache": true,
        "refreshOnStartup": true,
        "cacheTtlMs": 300000
      },
      "initialSuggestions": {
        "strategy": "frecency",
        "pinned": []
      }
    }
  ]
}

TypeScript API

registerMention connects a provider to Pi’s pickers and context expansion:

import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
import { createListProvider, registerMention } from "@zigai/pi-mention-anything/api";

export default function (pi: ExtensionAPI): void {
  registerMention(pi, {
    id: "environments",
    configuration: () => ({ trigger: "%" }),
    provider: () => createListProvider(async () => [
      { id: "staging", label: "Staging", segment: "staging", selectable: true, navigable: false, replacement: "environment:staging" },
      { id: "production", label: "Production", segment: "production", selectable: true, navigable: false, replacement: "environment:production" },
    ]),
  });
}

Documentation

License

MIT