convez.ai
MCP ServerAutomaçãoAvançado
scoutqa-dot-ai

Thor - Inteligência Ambiental para Engenheiros de Produto

scoutqa-dot-ai/thor

Agente IA event-driven que monitora Slack e executa tarefas de engenharia

Ver no GitHub
InicialPluginScore · de 0 a 100

Um servidor MCP que funciona como membro de time IA orientado a eventos, monitorando Slack e jobs agendados para automatizar fluxos de engenharia. Integra OpenCode, CLI remoto e múltiplos sistemas externos (GitHub, Metabase, Atlassian, Grafana, PostHog) através de uma arquitetura distribuída com gateway, runner e proxy ChatGPT.

Instalação

$npx convez-ai scoutqa-dot-ai/thor

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
9
Forks
6
Acompanhando
1
Saúde
25%
Último commit
há 2 dias
Versão
—
Issues abertas
19
Contribuidores
6

Casos de uso

  • Automatizar workflows de engenharia baseados em eventos do Slack
  • Executar tarefas agendadas com aprovação e rastreamento de progresso
  • Integrar múltiplos sistemas (GitHub, CI/CD, Metabase, Atlassian) em pipelines IA

Veredito

Thor é um sistema robusto e modular para engenheiros que querem automação IA profunda em infraestrutura existente. Exige setup complexo (Docker Compose, múltiplos serviços, integração OAuth) e conhecimento de arquitetura distribuída, mas oferece controle fino e escalabilidade para equipes de produto maduras.

README

A tradução para o português deste README ainda está na fila.

Thor

An event-driven AI team member that watches Slack and scheduled jobs, resumes OpenCode sessions through the runner, and reaches external systems through remote-cli.

Architecture

ingress -> gateway -> runner -> opencode -> codex-lb -> ChatGPT
                           \
                            -> remote-cli -> MCP upstreams / CLI integrations
  • gateway accepts Slack, GitHub webhook, and cron events, batches them, and forwards them to the runner.
  • runner manages OpenCode session continuity and Slack progress updates.
  • remote-cli exposes POST /exec/* endpoints for git, gh, sandbox, scoutqa, metabase, MCP tool calls (Atlassian, Grafana, PostHog, Langfuse), direct Slack approval-card posting, and approval status/resolution.
  • codex-lb is an OpenAI-compatible proxy that fronts ChatGPT for opencode, pooling one or more ChatGPT account credentials so no paid OpenAI API key is needed. Its account/quota dashboard sits behind the same SSO + admin-email gate as /admin/.

Services

ServicePortPackageRole
codex-lb2455Docker imageChatGPT-backed OpenAI-compatible proxy
cron-docker/cronScheduled prompts
mitmproxy3080docker/mitmproxyExplicit outbound HTTP(S) proxy
gateway3002@thor/gatewaySlack/GitHub webhook ingestion and batching
remote-cli3004@thor/remote-cliCLI + MCP policy gateway
admin3005@thor/adminAdmin dashboard and workspace configuration
ingress8080docker/ingressReverse proxy + Vouch integration
opencode4096Docker imageHeadless agent runtime
runner3000@thor/runnerSession lifecycle + Slack progress updates
vouch9090Docker imageOAuth/SSO proxy

Quick Start

  1. Copy .env.example to .env and fill in the required secrets. Per-integration env vars are documented in each integration's doc (see Integrations below).
  2. Initialize the mitmproxy CA on the host:
./scripts/mitmproxy-ca-init.sh

All outbound HTTP(S) from OpenCode is routed through mitmproxy; see docs/feat/security-model.md Layer 1a for the routing path, built-in defaults, and custom rule format.

  1. Create /workspace/config/thor.json (on the host: docker-volumes/workspace/config/thor.json) from docs/examples/thor.json.

  2. Clone repos into the shared workspace:

docker compose run --rm remote-cli \
  git clone https://github.com/your-org/your-repo.git

If the stack is already running, use docker compose exec remote-cli ... instead.

  1. Start the stack:
mkdir -p docker-volumes/codex-lb && chmod 777 docker-volumes/codex-lb
docker compose up --build -d
curl http://localhost:8080/global/health

codex-lb runs as a non-root user and writes a SQLite store to /var/lib/codex-lb; pre-creating the host directory world-writable avoids a root-owned auto-mount.

  1. Link a ChatGPT account so opencode has an upstream model:

    Visit http://localhost:8080/dashboard (admin-gated by Vouch + THOR_ADMIN_EMAILS), sign in with Google, and add a ChatGPT account from the codex-lb dashboard. Once linked, opencode picks the model from its UI (the provider whitelist surfaces gpt-5.4, gpt-5.4-mini, gpt-5.5).

Integrations

Thor is an internal AI teammate for engineering and product work; it is not meant to mirror production infrastructure exactly. Each integration owns its own env vars, app/manifest setup, required permissions, and troubleshooting reasons.

  • Slack — docs/slack.md. Events API intake, signing-secret verification, per-channel repo override, app manifest.
  • GitHub App — docs/github.md. Webhook intake, App permissions and event subscriptions, installation IDs, bot commit identity, CI wake gate.
  • Daytona sandboxes — docs/daytona.md. On-demand cloud sandboxes for project builds/tests/lints. Custom snapshot publishing.
  • Outbound HTTP(S) (mitmproxy) — docs/feat/security-model.md Layer 1a. Routing path, built-in defaults (Atlassian/Slack/OpenAI), custom credential rules.

Runtime integration paths:

IntegrationPathAuthNotes
Git / GitHub CLIremote-cli /exec/git, /exec/ghGitHub App tokenRepo-scoped worktree edits
Atlassian MCPremote-cli /exec/mcpAuth headerRead + approved writes
PostHog MCPremote-cli /exec/mcpAPI keyRead + approved writes
Grafana MCPremote-cli /exec/mcpService account tokenLogs and observability
Langfuse MCPremote-cli /exec/mcpAPI key pairRead-only LLM observability queries
Slack Web APIgateway + remote-cli + OpenCode over mitmproxyBot tokenMentions, progress, approval cards, thread reads/writes
LaunchDarklyremote-cli /exec/ldcliAccess tokenRead-only feature flag inspection
Metabaseremote-cli /exec/metabaseAPI keyRead-only warehouse access

Common usage patterns:

  • PR merged, errors spike — a scheduled prompt checks telemetry, inspects recent merges through GitHub tools, prepares a fix in a worktree, and requests approval for the final write action.
  • Jira issue triage — a webhook or Slack prompt asks Thor to investigate an issue; Thor reads Jira, checks recent commits, and reports likely owners and suspects.
  • Daily delivery digest — a cron job asks Thor to summarize stale PRs, blocked issues, or failing tests and post the result to Slack.

Deployment Configuration

Integration-specific env vars live in each integration's doc. MCP integration credentials (Atlassian, PostHog, Grafana, Langfuse) support _<PROFILE_NAME> profile-suffixed overrides; multi-value integrations (Atlassian, Grafana, Langfuse) resolve all-or-nothing per scope — see docs/feat/profile.md. Metabase uses the unsuffixed global METABASE_* values. Cross-cutting vars:

VariableRequiredServicePurpose
CRON_SECRETYesgateway, cronShared secret for cron endpoint auth
THOR_ADMIN_EMAILSYesingressComma-separated authenticated Google emails allowed for OpenCode-backed and /admin/ ingress routes
THOR_INTERNAL_SECRETYesremote-cli, gatewaySecret-gates gateway↔remote-cli internal APIs
THOR_E2E_TEST_HELPERSNorunnerEnables secret-gated deterministic runner e2e helpers
RUNNER_BASE_URLYesremote-cliPublic base URL for Thor trigger viewer links in PR/Jira content
INGRESS_PORTNoingressHost port for the reverse proxy
ATLASSIAN_AUTHNoremote-cli, mitmproxyAtlassian MCP auth header and mitmproxy default injection; required (with cloud ID) to enable Atlassian
ATLASSIAN_CLOUD_IDNoremote-cliAtlassian cloud ID; required (with auth) to enable Atlassian; injected server-side into outbound MCP calls, hidden from model-facing tool schemas
POSTHOG_API_KEYNoremote-cliPostHog MCP auth
GRAFANA_URLNoremote-cliGrafana instance URL; required (with token + org ID) to enable Grafana
GRAFANA_SERVICE_ACCOUNT_TOKENNoremote-cliGrafana service account token; required (with URL + org ID) to enable Grafana
GRAFANA_ORG_IDNoremote-cliGrafana org ID; required (with URL + token) to enable Grafana
LANGFUSE_BASE_URLNoremote-cliLangfuse MCP base URL; all three LANGFUSE_* vars required to enable Langfuse
LANGFUSE_PUBLIC_KEYNoremote-cliLangfuse MCP public key; required (with secret key + host) to enable Langfuse
LANGFUSE_SECRET_KEYNoremote-cliLangfuse MCP secret key; required (with public key + host) to enable Langfuse
METABASE_URLNoremote-cliMetabase instance URL
METABASE_API_KEYNoremote-cliMetabase API key
METABASE_DATABASE_IDNoremote-cliMetabase database ID
METABASE_ALLOWED_SCHEMASNoremote-cliComma-separated schema allowlist
VOUCH_GOOGLE_CLIENT_IDYesvouchGoogle OAuth client ID
VOUCH_GOOGLE_CLIENT_SECRETYesvouchGoogle OAuth client secret
VOUCH_JWT_SECRETYesvouchSession JWT signing secret
VOUCH_ALLOWED_EMAIL_DOMAINSNocompose -> vouchRendered into Vouch's VOUCH_DOMAINS; comma-separated email domains, default scoutqa.cc
VOUCH_CALLBACK_URLNovouchOAuth callback URL
VOUCH_COOKIE_DOMAINNovouchCookie domain

Workspace config (thor.json)

Lives at /workspace/config/thor.json inside containers, docker-volumes/workspace/config/thor.json on the host. Hot-reloaded — no restart needed after edits. Use docs/examples/thor.json as a starting point and packages/common/src/proxies.ts as the reference for the built-in upstream catalog.

The file carries operator-maintained registries:

  • owners.<owner>.github_app_installation_id — GitHub App installation IDs. See docs/github.md §2.
  • profiles.<name>.channels[] / profiles.<name>.repos[] — integration credential routing profiles. channels[] also admits gated Slack surfaces; repos[] never admits Slack by itself. Profile shapes, repo fallback, conflict handling, and profile-suffixed environment variables are documented in docs/feat/profile.md. Slack admission details are in docs/slack.md §5.
  • mitmproxy[] / mitmproxy_passthrough[] — outbound credential rules and passthrough hosts. See docs/feat/security-model.md Layer 1a.
  • users[] — human attribution (see below).

Profile edits hot-reload — no service restart needed after thor.json changes. Profile selection is entirely harness-side; there is no agent-facing profile argument.

Human attribution (users[])

email must be the Jira account email; Thor may write the name/email into Co-authored-by: commit trailers and use the email to resolve Jira assignees.

{
  "users": [
    { "email": "alice@example.com", "name": "Alice", "slack": "UABCDEF1", "github": "alice" },
    { "email": "bob@example.com", "name": "Bob" }
  ]
}

To verify your entry, trigger Thor from Slack and look for attribution_applied with outcome: "applied" and your Slack id; skipped_no_user_record means the configured Slack id did not match the trigger.

The registry is maintained by operators from team Slack and GitHub membership records, with Jira account emails verified manually when needed. Keep source exports out of git if they contain personal data — commit only sanitized reconciliation decisions.

Operations Notes

  • Tell Thor about durable cross-task context through the memory tiers in docs/feat/memory.md: global, Slack channel, and person memory are runner-injected; repo context belongs in repo-local AGENTS.md, CLAUDE.md, and docs.
  • Clone source repos from the remote-cli container so git credentials and filesystem ownership stay consistent.
  • Repos under /workspace/repos are mounted read-only into OpenCode. Thor creates edits in /workspace/worktrees.
  • OpenCode and remote-cli share the same /tmp volume so temporary artifacts referenced by absolute path, such as slack-post-message --blocks-file /tmp/..., are readable by the posting service.
  • Scheduled prompts live in docker-volumes/workspace/cron/crontab.

Security Model

Thor contains untrusted input — agent, OpenCode wrappers, external webhooks — through layered controls. In short:

  • Vouch SSO + mitmproxy bound the network; remote-cli binds to 127.0.0.1 only.
  • Inbound webhooks are HMAC-verified (Slack signing secret, GitHub X-Hub-Signature-256); internal gateway↔remote-cli routes are gated with x-thor-internal-secret.
  • Channel/mention/self-loop gates filter authenticated traffic before it wakes the agent.
  • remote-cli is the only place tool policy is enforced: MCP allow/approve/hidden tiers, command allowlists, GitHub App installation tokens. OpenCode never holds direct upstream credentials.
  • Repos mount read-only into OpenCode; edits happen in /workspace/worktrees. Tool calls are audit-logged under /workspace/worklog.

See docs/feat/security-model.md for the full layered breakdown.

Testing

pnpm test
REMOTE_CLI_GIT_REPO_URL=https://github.com/owner/repo \
REMOTE_CLI_GITHUB_REPO=owner/repo \
  pnpm test:e2e
pnpm test:create-jira-approval-e2e # live Slack/OpenCode approval-card e2e for Atlassian approval-required tools
pnpm test:opencode-e2e # separate explicit OpenCode/LLM smoke path
pnpm typecheck
Ver o original no GitHub

Bom para

Relacionados