Skip to content

feat(promptfoo): add crab pf serve Slack polling daemon - #37

Merged
MrFlounder merged 1 commit into
mainfrom
feat/pf-serve-slack-daemon
Feb 22, 2026
Merged

MrFlounder merged 1 commit into
mainfrom
feat/pf-serve-slack-daemon

Conversation

@MrFlounder

Copy link
Copy Markdown
Contributor

Why

Team members — including non-technical people — need a way to run the promptfoo target discovery agent without setting up a local dev environment. A Slack-based interface lets anyone DM the Crab bot with a target specification and get back a ready-to-use promptfooconfig.yaml.

What

Adds crab pf serve, a local Slack polling daemon that:

  • Polls for DMs to the Crab bot, filtering by a pf: trigger prefix
  • Runs the discovery agent locally using the operator's own API keys
  • Posts results (generated config files) back to the Slack thread
  • Handles file attachments — users can attach API specs, curl commands, etc.

Files changed

File Change
plugins/promptfoo/src/slack.ts New — Slack Web API helpers using native fetch(), zero new dependencies. Token resolution, user lookup, DM channel management, message posting, reactions, file download/upload (3-step flow).
plugins/promptfoo/src/serve.ts New — Daemon loop with --setup flow (prompts for Slack username and provider preferences), poll loop, job directory management. Defaults to openai:gpt-5 with reasoning: low.
plugins/promptfoo/src/cli.ts Modified — Routes serve subcommand, adds --reasoning flag support, updates help text.
plugins/promptfoo/src/agent/providers.ts Modified — Adds reasoningEffort support for GPT-5/o-series models (max_completion_tokens instead of max_tokens, skips temperature for reasoning models).
plugins/promptfoo/package-lock.json Modified — Minor peer dependency annotation changes.

How to Test

  1. Set CRAB_SLACK_BOT_TOKEN env var (or add slack.bot_token to ~/.crabcode/config.yaml)
  2. Set OPENAI_API_KEY env var
  3. Run crab pf serve --setup and follow prompts to configure your Slack username
  4. Run crab pf serve -v to start the daemon in verbose mode
  5. DM the Crab bot in Slack with pf: My API is at http://localhost:8080/chat
  6. Verify the bot acknowledges with a reaction, runs the agent, and posts back a promptfooconfig.yaml

🤖 Generated with Claude Code

Adds a local daemon that polls for Slack DMs and runs the promptfoo
target discovery agent on behalf of team members. Non-technical users
can DM the Crab bot with "pf: <target spec>" and receive generated
promptfooconfig.yaml files back in-thread.

- New slack.ts: Slack Web API helpers using native fetch (zero deps)
- New serve.ts: daemon loop with setup flow, DM polling, and job mgmt
- Updated cli.ts: routes `serve` subcommand, adds --reasoning flag
- Updated providers.ts: reasoningEffort support for GPT-5/o-series

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MrFlounder
MrFlounder force-pushed the feat/pf-serve-slack-daemon branch from a9feb29 to 61c1703 Compare February 22, 2026 07:25
@MrFlounder
MrFlounder merged commit 1ee6707 into main Feb 22, 2026
3 checks passed
@MrFlounder
MrFlounder deleted the feat/pf-serve-slack-daemon branch February 22, 2026 07:26
This was referenced Mar 18, 2026
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