Platform-agnostic AI agent: monitors chat platforms, responds using Claude Code subprocess.
- TypeScript (strict, ESM), Node.js 22+
- Claude Code CLI (
npx @anthropic-ai/claude-code) as subprocess dotenvfor environment variables- Build:
tsc→ JS. Dev:tsx
npm run dev # Run with tsx (dev)
npm run build # Compile TypeScript
npm start # Run compiled JS
npm run test:e2e # E2E test (see below)E2E tests require a running agentloop instance connected to Slack:
# Terminal 1: Start the agent
npm run dev
# Terminal 2: Run tests
npm run test:e2eThe tests post messages to the configured Slack channel and verify the agent responds with ✅ reactions.
src/
cli.ts # CLI entry point (agentloop serve)
agent.ts # Wraps ClaudeCodeExecutor with system prompt
claude-code-executor.ts # Spawns Claude Code subprocess
config.ts # Config loader with env var substitution
platforms/
slack.ts # Slack adapter: polling, reactions, thread replies
- ESM imports (no CommonJS)
- Strict TypeScript, explicit types on public APIs
- Minimal dependencies — prefer stdlib
- Error handling: catch per-message, never crash the loop
- Config: JSON with
${ENV_VAR}substitution
- Claude Code runs as subprocess with
cwdset to workspace directory - Workspace cwd enables: CLAUDE.md loading, filesystem access, git awareness
- MCP servers passed via
--mcp-configflag to Claude Code - State via Slack reactions (✅) — no database needed
- Platform-agnostic design: add adapters in
src/platforms/
- Docker multi-stage build
- Use
tofunotterraformfor IaC
- Bump version in
package.json - Commit:
git commit -m "chore: bump version to X.Y.Z" - Tag:
git tag -a vX.Y.Z -m "Release vX.Y.Z" - Push:
git push origin main && git push origin vX.Y.Z - Create GitHub release:
gh release create vX.Y.Z --title "vX.Y.Z" --notes "..."- CI publishes npm package (OIDC provenance) and Docker image to
ghcr.io/fullstackhouse/agentloop
- CI publishes npm package (OIDC provenance) and Docker image to