Train a language model to answer Slack messages as you.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-19 18:39:42 +02:00
src feat(oauth): enable multi-workspace Install-to-Slack flow 2026-08-19 18:30:01 +02:00
.gitignore Initial commit 2023-05-12 14:43:47 +00:00
.pre-commit-config.yaml Make multi-workspace slack apps work again (#24) 2025-03-23 21:01:22 -04:00
LICENSE Initial commit 2023-05-12 14:43:47 +00:00
pyproject.toml Make multi-workspace slack apps work again (#24) 2025-03-23 21:01:22 -04:00
README.md docs(readme): link EntheAI project to github.com/entropy-om/entheai 2026-08-19 18:39:42 +02:00

entheai-doppel

Fork of modal-labs/doppel-bot (MIT). A Slack app that scrapes a target user's messages in a workspace and fine-tunes an LLM (Llama 3.1 8B by default) to respond like them. All scraping, fine-tuning, and inference run serverless on Modal.

Fork tweaks:

  • App/bot renamed to entheai-doppel (Modal App entheai-doppel, ASGI label entheai-doppel, state Dicts entheai-doppel-*).
  • System prompt retuned for the sovereign constellation ("fine touch from within") instead of the startup-CEO persona.
  • The fine-tune base model is the single MODEL_NAME knob in src/common.py (gated meta-llama/Meta-Llama-3.1-8B-Instruct by default; the HF token must exist as the huggingface-secret Modal secret — already wired into the fine-tune image). Swapping the base model requires matching torchtune recipe (src/llama3_1_8B_lora.yaml) and the inference vLLM version (src/inference.py).
  • Intended install: the EntheAI collective's Slack workspace.

How it works

Read the upstream docs. The pipeline: /doppel <user> → scrape the user's public-channel history → LoRA fine-tune Llama 3.1 8B on an H100 → serve the adapter over vLLM and answer when the bot is mentioned. Multi-workspace mode is enabled — the OAuth install flow lets any Slack workspace (e.g. entheai) install the app through the "Add to Slack" button.

Install to Slack (any workspace, e.g. ENTHEAI)

Once the app is deployed, an install button is live at https://<deploy-url>/slack/install — click it, pick the target workspace (ENTHEAI), and Slack OAuth completes the install.

Add to Slack

Replace <deploy-url> with the URL modal deploy src.bot prints (e.g. https://peterlodri-sec--entheai-doppel-bot.modal.run).

One-time app + infra setup (needed for the button to work)

  1. Slack app at https://api.slack.com/apps (workspace entheai.slack.com):
    • OAuth & Permissions → scopes: app_mentions:read, channels:history, channels:join, channels:read, chat:write, chat:write.customize, commands, users.profile:read, users:read.
    • Settings → Manage Distribution → Redirect URLs = https://<deploy-url>/slack/oauth_redirect → Activate Public Distribution.
    • From Basic Information, copy Client ID + Client Secret.
  2. Modal secrets:
    • slack-finetune-secret: SLACK_SIGNING_SECRET, SLACK_BOT_TOKEN, plus SLACK_CLIENT_ID and SLACK_CLIENT_SECRET (from step 1).
    • huggingface-secret: HF_TOKEN (gated Llama base).
  3. Postgres (Neon): create a database; Modal secret neon-secret from the Postgres template; create the table with modal run src.db.
  4. Deploy: modal deploy src.bot, then wire Event Subscriptions (@app_mention) and the /doppel slash command to the deploy URL.

After that, the button above (or the /slack/install route) installs the app into whichever workspace a user chooses.

Usage (single workspace, manual)

If you prefer to skip OAuth and run single-workspace: set MULTI_WORKSPACE_SLACK_APP = False in src/common.py, install the app to the workspace via the Slack UI, and use only SLACK_SIGNING_SECRET + SLACK_BOT_TOKEN (no Neon, no client id/secret).

  1. Create the Slack app at https://api.slack.com/apps (workspace entheai.slack.com). Under OAuth & Permissions, add bot scopes: app_mentions:read, channels:history, channels:join, channels:read, chat:write, chat:write.customize, commands, users.profile:read, users:read. Click Install to Workspace.
  2. Create the Modal Slack secret slack-finetune-secret: SLACK_SIGNING_SECRET (App Credentials) and SLACK_BOT_TOKEN (OAuth & Permissions).
  3. Create the Modal HF secret huggingface-secret with HF_TOKEN (needed to download the gated Llama base).
  4. Deploy: modal deploy src.bot. Note the URL.
  5. Wire the Slack app to the URL:
    • Event Subscriptions → on → Request URL = the deploy URL → verify → add bot event @app_mention.
    • Slash Commands → create /doppel → Request URL = the same URL.
    • Basic Information → Install to Workspace (reinstall).
  6. In any channel run /doppel <user> to train, then @entheai-doppel to summon the fine-tuned bot.

Development

  • Scraper: modal run src.scrape::scrape --user="<user>"
  • Fine-tuning: modal run --detach src.finetune --user="<user>"
  • Inference: modal run src.inference --user="<user>"
  • Optional W&B tracking: create my-wandb-secret and set WANDB_PROJECT in src/common.py.

License

MIT (upstream). Fork maintained by peterlodri-sec.