agentleFS
srinidhis05srinidhis05/agentura/gateway/CLAUDE.md

agentura / gateway

CLAUDE.md9 starsChanged 9 months agoApache-2.0View on GitHub

The gateway has TWO Slack message handlers that MUST stay in sync: Both files contain their own copies of dispatchAndFormat, dispatchSkill, dispatchAuto, and related functions. Any change to dispatch logic in one file MUST be mirrored in the other. Both paths end at the same executor endpoint. The user_id field in the JSON body controls OAuth token resolution. If user_id is empty, MCP bindings fall back to env-var URLs without authentication.

The file

Files
CLAUDE.md

Gateway — Architecture Notes for AI Agents

Critical: Dual Slack Handlers (GR-031)

The gateway has TWO Slack message handlers that MUST stay in sync:

FileModeUsed by
slack_webhook.goHTTP Events API webhooksLegacy/fallback
slack_socket.goSocket Mode (WebSocket)GE, PM, Growth, ECM bots

Both files contain their own copies of dispatchAndFormat, dispatchSkill, dispatchAuto, and related functions. Any change to dispatch logic in one file MUST be mirrored in the other.

Why this matters

Socket mode is the primary path for all Slack bots. If you fix a bug in the webhook handler but miss the socket handler (or vice versa), the fix won't apply to production Slack bots.

Detection

# List dispatch functions in both files — any function in both is a sync risk
diff <(grep 'func.*dispatch\|func.*Format' internal/handler/slack_webhook.go) \
     <(grep 'func.*dispatch\|func.*Format' internal/handler/slack_socket.go)

Common pitfalls

  • cmd = *aliasCmd overwrites ALL fields including UserID — always save and restore UserID
  • cmd = slackCommand{...} in thread continuity — must include UserID: cmd.UserID
  • New fields added to slackCommand struct must be preserved in all cmd = assignments

Request Flow

Slack Event → Socket Mode → handleSocketMessage → dispatchAndFormat → dispatchSkill
                                                                    → m.executor.Execute()
                                                                    → POST executor:8000/api/v1/skills/{d}/{s}/execute

API Request → HTTP Handler → ExecuteSkill → h.dispatcher.Dispatch() → ProxyDispatcher
                                          → d.client.Execute()
                                          → POST executor:8000/api/v1/skills/{d}/{s}/execute

Both paths end at the same executor endpoint. The user_id field in the JSON body controls OAuth token resolution. If user_id is empty, MCP bindings fall back to env-var URLs without authentication.

Key Files

  • internal/handler/slack_socket.go — Socket mode event handling (PRIMARY for Slack bots)
  • internal/handler/slack_webhook.go — HTTP webhook event handling
  • internal/handler/skill.go — REST API skill execution
  • internal/adapter/executor/dispatcher.go — ExecutionDispatcher interface
  • internal/adapter/executor/proxy_dispatcher.go — HTTP proxy to executor
  • internal/adapter/executor/http_client.go — Executor HTTP client (Client.Execute())
  • config/config.yaml — Slack app configs, command aliases, cron jobs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.