Slack Assistant Platform Repo Context Integration
Context
The platform integration provides semantic search over the Brainforge knowledge vault (knowledge/) and engineering standards (standards/). Unlike the GitHub integration (which does literal code search), this uses the Platform’s vector search API for semantic matching — finding conceptually related content even when keywords don’t match. It also supports skill triggering for platform-native capabilities.
Guidance
Dual Feature: Repo Context + Skill Trigger
The integration has two independent functions sharing the same API configuration:
buildRepoContext() — Semantic search over platform knowledge:
POST {apiUrl}/api/brainforge/repo-context
Body: { query: "how do we deploy the slack assistant", max_chunks: 5 }
Response: { chunks: [{ path, snippet, text }] }triggerSkill() — Execute platform skills (platform-native actions):
POST {apiUrl}/api/opencode/skills/execute
Body: { prompt: "summarize this transcript" }
Response: { result: "..." }Intent Gating (Three Patterns)
The integration has three separate intent-detection functions:
shouldUseRepoContext()— Documentation queries: vault, knowledge, standards, docs; “what is/are” + code/file/function; “how do/to/can”shouldTriggerSkill()— Action queries: skill, run + task/action/command, execute, summarize + transcript/meeting/note, create + ticket/pr/branch/issueshouldSearchWeb()inassistant.tsalso gates the overall platform call
Known 500 Error
The Platform API at PLATFORM_API_URL/api/brainforge/repo-context returns HTTP 500 when the platform deployment doesn’t have access to knowledge/ and standards/ directories. This happens when the platform is deployed without those paths configured in the environment.
Root cause: The platform’s repo-context endpoint is designed to serve the Forge (Next.js app), which has knowledge/ and standards/ in its working directory. When the Slack Assistant calls it, it may not have those directories accessible depending on the deployment.
Workaround: Integration tests catch this — run npm run test:integration after deployment to verify.
API Key Fallback
const key = (apiKey || process.env.PLATFORM_API_SECRET || '').trim();The function has a fallback chain: explicit apiKey parameter → PLATFORM_API_SECRET env var → empty string. This allows the platform API to work with either env var naming convention.
Timeout Handling
Repo context calls have a 15-second timeout. Skill execution calls have a 30-second timeout (skills can take longer to run). Both use AbortController.
Why This Matters
This is the only integration that provides semantically relevant results rather than keyword matches. When the GitHub integration returns “no results” for a conceptual query (“how do I add a new integration”), this integration can find relevant documentation using vector similarity. It is also the only integration that can execute actions (via triggerSkill).
When to Apply
- Queries about platform internals, knowledge base, and standards
- Actions like summarizing meetings or creating tickets via platform skills
- Semantic search when keyword search fails
Examples
Repo Context Query
const result = await buildRepoContext({
prompt: "how does the assistant handle user identity",
apiUrl: config.platformApiUrl,
apiKey: config.platformApiKey,
forceSearch: true,
});
// Returns semantically matched chunks from knowledge/ and standards/Verifying the Repo Context API
# Integration test catches the 500
npm run test:integration:railwayRelated
apps/slack-apps/brainforge-assistant/src/platform.tsapps/slack-apps/brainforge-assistant/src/assistant.ts(wiring)apps/slack-apps/brainforge-assistant/src/config.ts(PLATFORM_API_URL, PLATFORM_API_KEY)apps/slack-apps/brainforge-assistant/TESTING.md(known 500 issue)docs/solutions/architecture-patterns/slack-assistant-v2-hybrid-ai-pipeline-2026-04-28.md