๐Ÿ’ก Inspiration

In modern digital workspaces, valuable organizational knowledge is highly fragmented. Critical decisions, operational guidelines, and system insights are often buried in thousands of ephemeral Slack threads, while long-term documentation in wikis remains outdated because manual scaffolding is tedious.

We set out to build a "unified workspace brain" that bridges the gap between instant messaging and persistent knowledge management. Our inspiration was to create an intelligent agentโ€”Slack Chiebukuro Agent (็Ÿฅๆต่ข‹, meaning "wisdom bag")โ€”that can trace contextual relationships between users, conversations, and decisions, dynamic-scaffold wiki files, and query graph databases, all directly from the Slack interface under strict privacy guardrails.

๐Ÿ” What it does

Slack Chiebukuro Agent is an autonomous, context-aware AI assistant running in Socket Mode that orchestrates Slack history search, Neo4j ContextGraphs, and a Karpathy-style LLM Wiki:

  1. Context-Aware Dynamic Search: When asked a natural language question (e.g., "Where is the discussion about the Q3 report with Jason?"), it dynamically retrieves thread history using Slack's Real-Time Search (RTS) API (assistant.search.context) via secure action tokens.
  2. Privacy-First Zero-Data Copy: To guarantee enterprise-grade privacy, chat data pulled from the RTS API resides strictly in volatile short-term memory (cached in-memory for session orchestration) and is auto-evicted after 5 minutes.
  3. Graph Path Tracing (MCP Integration): The agent spawns the chiebukuro stdio MCP server to query Neo4j, walking entity paths (e.g., User โž” Conversations โž” Decision โž” Owner) and displaying a visual "Graph Thinking Path" alert inside Slack.
  4. Human-in-the-Loop (HITL) Persistent Storage: The agent features active Block Kit buttons. Clicking [Save to Wiki] distills context into Markdown files using the karpathy-llm-wiki-cli, while [Ingest to Graph] writes relationship nodes to Neo4j.
  5. Rich Block Kit UX: Avoids wall-of-text responses by dynamically generating Block Kit Carousels of cards, structured Data Tables, and Alert blocks.

๐Ÿ› ๏ธ How we built it

We developed the Slack Chiebukuro Agent from scratch using a modern TypeScript/Node.js architecture:

  • Slack Bolt SDK (@slack/bolt & @slack/web-api): Configured in Socket Mode to handle mentions, Direct Messages (DMs), and interactive block actions.
  • Model Context Protocol (MCP): Built a custom stdio JSON-RPC 2.0 client that spawns and communicates with the chiebukuro Neo4j MCP server child process.
  • LLM Wiki CLI Orchestrator: Integrated a subprocess runner that interfaces with the local karpathy-llm-wiki compiler binary to create distilled markdown pages in wiki/sources/ and wiki/concepts/.
  • Reliability Engineering: Integrated a global middleware to handle Slack's 429 rate-limiting with exponential backoff, and a secure session validator that restricts button actions to the search initiator.

๐Ÿšง Challenges we ran into

  • Enforcing Zero-Data Copy Safely: We had to balance displaying rich, interactive search results with keeping the data private. Storing conversation context persistently was against the rules. We resolved this by building a volatile server-side memory map mapped to Slack's thread timestamps. The state is only kept alive for a 5-minute window via an active background janitor.
  • Stable Stdio JSON-RPC Communication: Interfacing with the external MCP server over standard input/output required robust line-by-line readline streams and process monitors. We designed it to handle malformed JSON-RPC payloads gracefully without causing the main Slack client process to hang or crash.
  • Slack Block Kit Constraints: Slack limits the length of button payload values to 2000 characters. Since we needed to serialize the RTS context (URLs, file paths, and text) to the buttons, we implemented a custom binary-search truncation algorithm that safely trims strings while preserving valid JSON structures.

๐ŸŽ‰ Accomplishments that we're proud of

  • Volatile In-Memory Session Design: Successfully achieved a privacy-first architecture that handles data dynamically without persistent databases.
  • Visual Graph Tracing: Enabled real-time visualization of Neo4j graph relationships inside Slack's Block Kit alert blocks.
  • E2E Test Quality: Engineered an E2E test harness verifying 60+ test cases (covering boundary limits, guest access, rate limiting, and process crashes) to ensure production-grade reliability.

๐Ÿง  What we learned

  • %MCP Standards: We learned that the Model Context Protocol is an incredibly powerful standard for connecting LLMs to external graph databases and custom software tools.
  • Human-in-the-Loop (HITL) Security: Designing interactive AI agents taught us that keeping the user in control (explicit approvals for DB writes) is crucial for trust in enterprise software.

๐Ÿ”ฎ What's next for Slack Chiebukuro Agent

  • Multi-workspace Federated Search: Supporting cross-workspace graph mapping and search scoping.
  • Automatic Background Scaffolding: Allowing administrators to configure periodic background syncs to auto-ingest designated public Slack channels into the Neo4j ContextGraph.
  • Enterprise ACL Mapping: Syncing Slack's access control scopes directly into the Neo4j Graph permissions model.

Built With

  • cli
  • e2e
  • graph-database
  • human-in-the-loop
  • json-rpc
  • llm-wiki
  • markdown
  • model-context-protocol-(mcp)
  • neo4j
  • node.js
  • rts-api
  • slack-bolt-sdk
  • slack-web-api
  • socket-mode
  • typescript
  • zero-data-copy
Share this project:

Updates