From 0dc131e9f32e37f83e20dbff03faa10df0ab349e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 24 Jan 2026 01:52:22 +0000 Subject: [PATCH] feat: add contacts search plugin --- CHANGELOG.md | 33 +-- docs/cli/contacts.md | 45 ++++ docs/cli/index.md | 4 + docs/cli/search.md | 36 +++ docs/contact.md | 100 +++++++++ docs/docs.json | 4 + docs/plugin.md | 1 + docs/plugins/contacts-search.md | 70 ++++++ docs/tools/slash-commands.md | 2 +- .../contacts-search/clawdbot.plugin.json | 10 + extensions/contacts-search/index.ts | 71 ++++++ extensions/contacts-search/package.json | 9 + .../contacts-search/src}/cli/contacts-cli.ts | 164 +++++++------- .../contacts-search/src/cli/formatting.ts | 96 ++++++++ .../contacts-search/src}/cli/search-cli.ts | 55 ++--- .../src/commands/search-args.ts | 105 +++++++++ .../src/commands/search-command.test.ts | 27 +++ .../src/commands/search-command.ts | 103 +++++++++ .../src}/contacts/importer.test.ts | 23 ++ .../contacts-search/src}/contacts/importer.ts | 12 +- .../contacts-search/src}/contacts/index.ts | 2 +- .../src}/contacts/linker.test.ts | 98 +++++++++ .../contacts-search/src}/contacts/linker.ts | 10 + .../contacts-search/src}/contacts/schema.ts | 0 .../src}/contacts/store.test.ts | 29 +++ .../contacts-search/src}/contacts/store.ts | 101 +++++++-- .../contacts-search/src}/contacts/types.ts | 12 +- .../src/hooks/message-indexer.ts | 91 ++++++++ extensions/contacts-search/src/sqlite.ts | 22 ++ src/auto-reply/commands-registry.data.ts | 30 +-- src/auto-reply/commands-registry.test.ts | 20 ++ src/auto-reply/reply/commands-plugin.ts | 55 ++--- src/auto-reply/reply/commands-search.ts | 208 ------------------ src/auto-reply/reply/dispatch-from-config.ts | 51 +++++ src/auto-reply/templating.ts | 1 + src/cli/program/register.subclis.ts | 16 -- src/gateway/server/__tests__/test-utils.ts | 1 + src/gateway/test-helpers.mocks.ts | 1 + src/plugin-sdk/index.ts | 4 + src/plugins/loader.ts | 1 + src/plugins/registry.ts | 38 ++++ src/plugins/runtime.ts | 1 + src/plugins/types.ts | 16 ++ src/test-utils/channel-plugins.ts | 1 + 44 files changed, 1331 insertions(+), 448 deletions(-) create mode 100644 docs/cli/contacts.md create mode 100644 docs/cli/search.md create mode 100644 docs/contact.md create mode 100644 docs/plugins/contacts-search.md create mode 100644 extensions/contacts-search/clawdbot.plugin.json create mode 100644 extensions/contacts-search/index.ts create mode 100644 extensions/contacts-search/package.json rename {src => extensions/contacts-search/src}/cli/contacts-cli.ts (78%) create mode 100644 extensions/contacts-search/src/cli/formatting.ts rename {src => extensions/contacts-search/src}/cli/search-cli.ts (75%) create mode 100644 extensions/contacts-search/src/commands/search-args.ts create mode 100644 extensions/contacts-search/src/commands/search-command.test.ts create mode 100644 extensions/contacts-search/src/commands/search-command.ts rename {src => extensions/contacts-search/src}/contacts/importer.test.ts (94%) rename {src => extensions/contacts-search/src}/contacts/importer.ts (96%) rename {src => extensions/contacts-search/src}/contacts/index.ts (92%) rename {src => extensions/contacts-search/src}/contacts/linker.test.ts (83%) rename {src => extensions/contacts-search/src}/contacts/linker.ts (97%) rename {src => extensions/contacts-search/src}/contacts/schema.ts (100%) rename {src => extensions/contacts-search/src}/contacts/store.test.ts (94%) rename {src => extensions/contacts-search/src}/contacts/store.ts (87%) rename {src => extensions/contacts-search/src}/contacts/types.ts (96%) create mode 100644 extensions/contacts-search/src/hooks/message-indexer.ts create mode 100644 extensions/contacts-search/src/sqlite.ts delete mode 100644 src/auto-reply/reply/commands-search.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 27c6e82b13..725459d89e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Docs: https://docs.clawd.bot - Agents: remove redundant bash tool alias from tool registration/display. (#1571) Thanks @Takhoffman. - Browser: add node-host proxy auto-routing for remote gateways (configurable per gateway/node). - Plugins: add optional llm-task JSON-only tool for workflows. (#1498) Thanks @vignesh07. +- Contacts/Search: add the contacts-search plugin for unified contacts + cross-platform message search (CLI + /search). (#1438) Thanks @bluzername. https://docs.clawd.bot/plugins/contacts-search https://docs.clawd.bot/contact https://docs.clawd.bot/cli/contacts https://docs.clawd.bot/cli/search - CLI: restart the gateway by default after `clawdbot update`; add `--no-restart` to skip it. - CLI: add live auth probes to `clawdbot models status` for per-profile verification. - CLI: add `clawdbot system` for system events + heartbeat controls; remove standalone `wake`. @@ -111,22 +112,22 @@ Docs: https://docs.clawd.bot ## 2026.1.21 ### Changes -- Highlight: Lobster optional plugin tool for typed workflows + approval gates. https://docs.clawd.bot/tools/lobster -- Lobster: allow workflow file args via `argsJson` in the plugin tool. https://docs.clawd.bot/tools/lobster -- Heartbeat: allow running heartbeats in an explicit session key. (#1256) Thanks @zknicker. -- CLI: default exec approvals to the local host, add gateway/node targeting flags, and show target details in allowlist output. -- CLI: exec approvals mutations render tables instead of raw JSON. -- Exec approvals: support wildcard agent allowlists (`*`) across all agents. -- Exec approvals: allowlist matches resolved binary paths only, add safe stdin-only bins, and tighten allowlist shell parsing. -- Nodes: expose node PATH in status/describe and bootstrap PATH for node-host execution. -- CLI: flatten node service commands under `clawdbot node` and remove `service node` docs. -- CLI: move gateway service commands under `clawdbot gateway` and add `gateway probe` for reachability. -- Sessions: add per-channel reset overrides via `session.resetByChannel`. (#1353) Thanks @cash-echo-bot. -- Agents: add identity avatar config support and Control UI avatar rendering. (#1329, #1424) Thanks @dlauer. -- UI: show per-session assistant identity in the Control UI. (#1420) Thanks @robbyczgw-cla. -- CLI: add `clawdbot update wizard` for interactive channel selection and restart prompts. https://docs.clawd.bot/cli/update -- Signal: add typing indicators and DM read receipts via signal-cli. -- MSTeams: add file uploads, adaptive cards, and attachment handling improvements. (#1410) Thanks @Evizero. +- Highlight: Lobster optional plugin tool for typed workflows + approval gates. https://docs.clawd.bot/tools/lobster (#1152) Thanks @vignesh07. +- Agents/UI: add identity avatar config support and Control UI avatar rendering. (#1329, #1424) Thanks @dlauer. https://docs.clawd.bot/gateway/configuration https://docs.clawd.bot/cli/agents +- Control UI: add custom assistant identity support and per-session identity display. (#1420) Thanks @robbyczgw-cla. https://docs.clawd.bot/web/control-ui +- CLI: add `clawdbot update wizard` with interactive channel selection + restart prompts, plus preflight checks before rebasing. https://docs.clawd.bot/cli/update +- Models/Commands: add `/models`, improve `/model` listing UX, and expand `clawdbot models` paging. (#1398) Thanks @vignesh07. https://docs.clawd.bot/cli/models +- CLI: move gateway service commands under `clawdbot gateway`, flatten node service commands under `clawdbot node`, and add `gateway probe` for reachability. https://docs.clawd.bot/cli/gateway https://docs.clawd.bot/cli/node +- Exec: add elevated ask/full modes, tighten allowlist gating, and render approvals tables on write. https://docs.clawd.bot/tools/elevated https://docs.clawd.bot/tools/exec-approvals +- Exec approvals: default to local host, add gateway/node targeting + target details, support wildcard agent allowlists, and tighten allowlist parsing/safe bins. https://docs.clawd.bot/cli/approvals https://docs.clawd.bot/tools/exec-approvals +- Heartbeat: allow explicit session keys and active hours. (#1256) Thanks @zknicker. https://docs.clawd.bot/gateway/heartbeat +- Sessions: add per-channel idle durations via `sessions.channelIdleMinutes`. (#1353) Thanks @cash-echo-bot. +- Nodes: run exec-style, expose PATH in status/describe, and bootstrap PATH for node-host execution. https://docs.clawd.bot/cli/node +- Cache: add `cache.ttlPrune` mode and auth-aware defaults for cache TTL behavior. +- Queue: add per-channel debounce overrides for auto-reply. https://docs.clawd.bot/concepts/queue +- Discord: add wildcard channel config support. (#1334) Thanks @pvoo. https://docs.clawd.bot/channels/discord +- Signal: add typing indicators and DM read receipts via signal-cli. https://docs.clawd.bot/channels/signal +- MSTeams: add file uploads, adaptive cards, and attachment handling improvements. (#1410) Thanks @Evizero. https://docs.clawd.bot/channels/msteams - Onboarding: remove the run setup-token auth option (paste setup-token or reuse CLI creds instead). - Docs: add troubleshooting entry for gateway.mode blocking gateway start. https://docs.clawd.bot/gateway/troubleshooting - Docs: add /model allowlist troubleshooting note. (#1405) diff --git a/docs/cli/contacts.md b/docs/cli/contacts.md new file mode 100644 index 0000000000..6972bd3868 --- /dev/null +++ b/docs/cli/contacts.md @@ -0,0 +1,45 @@ +--- +summary: "CLI reference for `clawdbot contacts` (unified contact graph)" +read_when: + - You want to list or link contacts across channels + - You are using the contacts-search plugin +--- + +# `clawdbot contacts` + +Unified contact graph and identity linking. +Provided by the [Contacts + Search plugin](/plugins/contacts-search). +Concept overview: [Contact graph](/contact). + +## Examples + +```bash +clawdbot contacts list +clawdbot contacts list --query "sarah" --platform slack +clawdbot contacts show +clawdbot contacts search "alice" +clawdbot contacts link +clawdbot contacts unlink slack U12345678 +clawdbot contacts suggestions +clawdbot contacts auto-link --dry-run +clawdbot contacts stats +clawdbot contacts alias "Alias Name" +clawdbot contacts alias "Old Alias" --remove +``` + +## Commands + +- `list`: list contacts (supports `--query`, `--platform`, `--limit`, `--json`). +- `show `: show a contact + identities (accepts a canonical id or a search query). +- `search `: search contacts by name/alias/username. +- `link `: merge two contacts. +- `unlink `: detach an identity into a new contact. +- `suggestions`: show link suggestions. +- `auto-link`: link high-confidence matches (use `--dry-run` to preview). +- `stats`: store statistics by platform. +- `alias `: add or remove aliases (`--remove`). + +## Notes + +- `--platform` expects a channel id (e.g. `slack`, `discord`, `whatsapp`). +- `unlink` uses the platform id stored on the identity (not the contact id). diff --git a/docs/cli/index.md b/docs/cli/index.md index ce1c619d5a..06242afb14 100644 --- a/docs/cli/index.md +++ b/docs/cli/index.md @@ -32,6 +32,8 @@ This page describes the current CLI behavior. If commands change, update this do - [`system`](/cli/system) - [`models`](/cli/models) - [`memory`](/cli/memory) +- [`contacts`](/cli/contacts) (plugin; if enabled) +- [`search`](/cli/search) (plugin; if enabled) - [`nodes`](/cli/nodes) - [`devices`](/cli/devices) - [`node`](/cli/node) @@ -122,6 +124,8 @@ clawdbot [--dev] [--profile ] status index search + contacts + search message agent agents diff --git a/docs/cli/search.md b/docs/cli/search.md new file mode 100644 index 0000000000..d7edc4a162 --- /dev/null +++ b/docs/cli/search.md @@ -0,0 +1,36 @@ +--- +summary: "CLI reference for `clawdbot search` (cross-platform message search)" +read_when: + - You want to search indexed messages across channels + - You are using the contacts-search plugin +--- + +# `clawdbot search` + +Search indexed messages across channels. +Provided by the [Contacts + Search plugin](/plugins/contacts-search). + +## Examples + +```bash +clawdbot search "meeting tomorrow" +clawdbot search "deadline" --from alice +clawdbot search "project" --platform slack --since 1w +clawdbot search "invoice" --since 2025-12-01 --until 2025-12-31 +clawdbot search "handoff" --limit 50 --json +``` + +## Options + +- `--from `: filter by sender name/alias/username or contact id. +- `--platform `: filter by channel id (e.g. `slack`, `discord`, `whatsapp`). +- `--since