{"slug": "building-a-slack-llm-secretary-with-tool-chaining", "title": "Building a Slack LLM Secretary with Tool Chaining", "summary": "A developer built a Slack-based AI assistant using Open Claw, an AI agent framework, to execute natural language commands through tool chaining. The system integrates session memory and persistent message cursors to avoid reprocessing messages after restarts. The project demonstrates that combining algorithmic programming with LLMs improves accuracy for personal assistant tasks.", "body_md": "This will be my second project.\n\nAS I know there are three main types of representative AI agents: Claude Code, Open Claw, and Hermes. This time, I attempted to build a small AI assistant utilizing 'Open Claw'.\n\nI believe the most powerful aspect of Open Claw is its ability to \"bring together and utilize various tools.\"\n\nAlthough it is not a large project, I intend to leverage this feature to issue commands in natural language and demonstrate that it can \"act like a personal assistant.\"\n\nThe details are as follows: If you issue a command via the Slack chat window, the AI agent receives the response and executes the command.\n\nThere are four main types of commands.\n\nLet me introduce just three key technologies for implementing this.\n\n```\nSELECT_TOOLS_SCHEMA = {\n    \"type\": \"function\",\n    \"function\": {\n        \"name\": \"select_tools\",\n        ...\n        \"tools\": {\n            \"type\": \"array\",\n            \"items\": { \"enum\": [...] },\n        },\n    },\n}\npython\ndef describe_chain_semantics(tools):\n    if tools == [\"TEXT_SUMMARY\", \"PDF_CONVERT\"]:\n        return \"요약 내용을 PDF로 생성합니다.\"\n    if tools == [\"PDF_CONVERT\", \"TEXT_SUMMARY\"]:\n        return \"원본 문서를 PDF로 변환하고, 내용을 요약합니다.\"\n\n# ...\nif previous_tool == \"TEXT_SUMMARY\" and last_summary:\n    create_summary_docx(last_summary, ...)  # 요약본 → PDF\nelse:\n    convert_docx_to_pdf(input_path, ...)    # 원본 → PDF\n```\n\n3.It has a session memory feature. It can remember past chats.\n\nHowever, that is how the system stores the state. LLM only reads it.\n\nI wanted to prevent the project from becoming too large.\n\n``` python\ndef make_session_key(channel_id, user_id, thread_ts=None):\n    if thread_ts:\n        return f\"{channel_id}:{thread_ts}\"\n    return f\"{channel_id}:user:{user_id}\"\n```\n\nThis involved attempting to retrieve its tools immediately by reading the last conversation within Slack right after stopping and restarting the agent.\n\nThe cause was that, initially, `last_seen_ts`\n\nwas stored only in memory (dict).\n\nWhen the bot is turned off and on again, this value is initialized to {}, and `last_seen = 0`\n\n.\n\nThen, the 10 most recent messages in the channel plus thread replies all satisfy the condition `ts > 0`\n\n, so they are processed all at once.\n\nThe key is to persist the cursor (watermark) based on the message ID (ts).\n\n``` python\n# polling_state.py\nclass LastSeenStore:\n    def mark(self, channel_id, ts):\n        if float(ts) > self.get(channel_id):\n            self._state[channel_id] = float(ts)\n            self._save()  # saving disk!\nlast_seen_store = LastSeenStore()  # last_seen.json 로드\nchannel_last_ts = last_seen_store.get(channel_id)\npending = collect_pending_messages(channel_id, channel_last_ts)\npython\ndef seed_channel(...):\n    latest = max(Channel Message + replys' ts)\n    self._state[channel_id] = latest  # read cheack\n```\n\nSo, here is the answer: Save processed Slack message ts to a file by channel and process only subsequent messages.\n\nWe were able to prove that it is possible to create a decent AI assistant by combining ideas from Slack and OpenClaw! I am pleased with the results, as they were much better than expected. The important point is that processing tasks with the help of algorithmic programming, rather than relying too heavily on LLM, helps improve accuracy.\n\nThanks you for reading!", "url": "https://wpnews.pro/news/building-a-slack-llm-secretary-with-tool-chaining", "canonical_source": "https://dev.to/nodabnodab/building-a-slack-llm-secretary-with-tool-chaining-3ol9", "published_at": "2026-07-09 07:19:51+00:00", "updated_at": "2026-07-09 07:41:44.724363+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "natural-language-processing", "large-language-models"], "entities": ["Slack", "Open Claw", "Claude Code", "Hermes"], "alternates": {"html": "https://wpnews.pro/news/building-a-slack-llm-secretary-with-tool-chaining", "markdown": "https://wpnews.pro/news/building-a-slack-llm-secretary-with-tool-chaining.md", "text": "https://wpnews.pro/news/building-a-slack-llm-secretary-with-tool-chaining.txt", "jsonld": "https://wpnews.pro/news/building-a-slack-llm-secretary-with-tool-chaining.jsonld"}}