Allen is a TypeScript monorepo that coordinates AI agents across software engineering workflows. The system combines a React UI, an Express API, a workflow engine, MongoDB persistence, local workspaces, and integrations such as GitHub, Linear, Slack, MCP servers, Claude Code, and Codex.
React UI / Desktop shell
|
| HTTP, SSE, WebSocket
v
Express Server ---------------- MongoDB
| |
| starts workflows | users, teams, agents, repos,
| manages workspaces | workflows, executions, chats,
| exposes integrations | artifacts, learnings, settings
v
Workflow Engine
|
| runs workflow nodes and agents
v
Agent providers + MCP tools ---- Local repos and workspaces
| Package | Role | More detail |
|---|---|---|
packages/engine |
Workflow runtime, agent invocation, workflow validation, artifacts, traces, and execution state. | Engine module |
packages/server |
API, MongoDB persistence, auth, repo/workspace management, integrations, scheduled jobs, and workflow/agent dispatch. | Server module |
packages/ui |
React interface for chat, executions, workflows, workspaces, repos, agents, teams, tickets, PRs, settings, and design flows. | UI module |
packages/desktop |
Electron host that runs the shared Allen UI and backend as a local desktop app. | Desktop module |
e2e |
Playwright tests for full-product flows. | E2E module |
1. A user starts from chat, a workflow run dialog, a ticket, or automation.
2. The server records the request and chooses an agent or workflow route.
3. The engine executes the workflow graph or agent run.
4. Agents inspect context, call approved tools, create artifacts, and ask for help when needed.
5. Human checkpoints pause risky or ambiguous work.
6. The UI streams logs, traces, state, artifacts, and final output.
Workspaces give agent work a dedicated repo worktree, terminal, file watcher, and preview proxy. They make repository changes easier to observe and review before merge.
See Workspaces and Security and sandboxing.
Allen models work as an organization:
- Teams group agents by responsibility.
- Agents perform or coordinate work.
- Skills guide routing and operating decisions.
- Workflows provide repeatable multi-step execution paths.
This separation keeps the product understandable: teams describe ownership, agents do work, skills help choose a route, and workflows make multi-step processes repeatable.
Allen persists product and execution state in MongoDB. Important records include users, teams, agents, repositories, workspaces, chat sessions, workflows, executions, execution traces, interventions, artifacts, uploaded files, settings, and learnings.
Execution observability is a first-class product surface. Users should be able to see what ran, which agent or workflow produced output, what artifacts were saved, what checkpoints were reached, what changed in the workspace, and — when a model-recovery retry occurred — which provider/model was originally used, why it failed, which replacement was selected, and how many attempts were made.
Important server files:
src/app.ts- HTTP app, route registration, middleware order, WebSocket server bootstrap.src/auth/jwt.ts— JWT issuance and verification.signAccessToken(payload, expiresIn?)accepts an optionalexpiresInoverride so callers can request short-lived tokens (e.g.'5m') without bypassing theACCESS_TOKEN_TTLdefault for normal user sessions.src/middleware/requireAuth.tsandrequireAdmin.ts- route gating.src/services/workspace.service.ts- workspace lifecycle, port allocation, preview wiring.src/services/workspace-terminal.ts- shared terminal + file-watch WebSocket on port4024.src/services/workspace-watcher.ts- file watcher attached to the terminal WebSocket.src/services/workspace-proxy.ts- workspace preview proxy.src/services/github-auth.ts- GitHub token resolution from.env.src/services/linear.service.ts- Linear GraphQL client, TTL caches, agent/workflow dispatch, and issue fetching.listTeams()returns the workspace's teams (name-sorted, own TTL cache);listIssues()accepts an optionalteamIdthat becomes ateam.id.eqGraphQL filter and is part of the serialized filter used as the issue cache key, so different team selections cannot share cached results.src/services/soft-delete.ts— Shared interface (SoftDeleteFields), helpers (softDeleteSet,restoreSet), and thenotDeletedFilterconstant used by route handlers and services to exclude soft-deleted records from queries. Applied across agents, workflows, teams, and skills.src/services/watcher.service.ts— Deterministic Execution Watcher: monitors chat-started workflow and agent executions, generates factual status text from execution logs and known milestones, publishes SSEwatcher_updateevents, and sends hidden Assistant triggers when execution reaches a terminal or waiting-for-input state. Includes boot-time reconciliation to recover watchers after server restart. See TDD §1–§3 for full design.src/services/chat-tools.ts— Implements all 16+ MCP tool handlers (spawn_agent,wait_for_execution,resume_execution,allen_save_artifact, etc.).resume_executionresolves the resumed agent's LLM session ID through a three-layer fallback: (1)executions.sessions[agentName], (2)output.session_idfrom the latestexecution_tracesdocument (sorted{ completedAt: -1, createdAt: -1 }), (3)exec.input.session_id. When a session ID is found via layer 2 or 3, it is written back to the sessions map before the spawn so future resumes use the fast primary path. Chat-started workflow executions (source === 'chat'with a truthyworkflowId) are routed to the checkpoint-based workflow-resume path rather than the agent-resume path.spawn_agentcaptures provider token usage from Codexturn.completedevents and Claude SDKresultmessages, aggregates across turns usingaggregateTokenUsage, and persists the normalizedTokenUsageInfoonto the execution row.src/services/chat-providers.ts— Provider definitions (CLAUDE_COMPATIBLE_PROVIDER_CONFIGS), enabled-provider listing, Claude-compatible environment overlay (buildClaudeCompatibleEnvOverlay), OpenRouter non-Claude model warning (getOpenRouterNonClaudeWarning), and provider availability logic.src/services/chat.service.ts—resolveMentions()resolves@ENG-123-style tokens to Linear ticket context and@nametokens to workflow/repo/agent context before the LLM call.ChatSession.sourceaccepts'ui' | 'slack' | 'automation'; automation sessions carry anautomationKeyfield used as a deduplication key.appendAutomationMessage(sessionId, role, content)inserts a message into an automation thread without starting a live LLM session (content capped at 1 MB,role:adminrejected, throws'Not an automation session'ifsession.source !== 'automation').steerRunningAgent(sessionId, content, sender?)injects a user message into the running agent turn mid-turn; if the persistent runtime cannot accept steering, it transparently falls back toenqueueQueuedMessage.src/services/cron.service.ts— Scheduler usingnode-cron. For agent-target jobs whereagentName === job.name,ensureLinkedSession()upserts a persistentchat_sessionsdocument keyed byautomationKey(race-safe via$setOnInsert+ E11000 fallback), then injects anAUTOMATION_CONTEXTblock into the agent prompt (LINKED_CHAT_SESSION_ID,AUTOMATION_API_TOKEN,AUTOMATION_MESSAGE_URL) so the agent can POST its output back to the linked thread. TheAUTOMATION_API_TOKENis minted with a 5-minute TTL (viasignAccessToken(..., '5m')) to avoid persisting a long-lived credential in thechat_messagescollection. A stale-pointer recovery path re-linkscron_jobs.linkedChatSessionIdif the session was deleted and recreated.src/services/cron-seed.service.ts— Seeds built-in cron jobs covering repo scans/pulls, PR sync, MCP bundle cleanup, CodeRabbit PR-comment sweeps, and the hourly self-healing monitor. WhenSEED_OVERRIDEis set, display fields and schedules are refreshed on existing rows, butlinkedChatSessionIdis intentionally excluded from the$setso any persistent automation chat thread survives restarts.services/slack.service.ts,services/slack-notifier.ts- Slack integrations.src/routes/file.routes.tsandroutes/artifact.routes.ts- capability-URL public routes.
Public capability-style routes exist for generated file links, artifact links, execution SSE, workspace log SSE, and workspace previews. See docs/security.md before changing them.
The React/Vite frontend.
Responsibilities:
- Login and password reset.
- Dashboard views.
- Chat and agent delegation UX, including
@mentionautocomplete for workflows, repos, agents, and Linear tickets. - Workflow list and workflow builder.
- Workflow run dialogs.
- Paginated activity feed: server-side execution list (50 per page) with status filter, type filter (agent / workflow), and debounced text search. Page position is encoded in
?page=NURL state and resets to 0 on filter or search changes. The page auto-refreshes every 5 s while running or queued executions are present. - Execution timeline, node detail, logs, state, artifacts, checkpoints, interventions, and token usage breakdown (cached input, non-cached input, output tokens — omitted when data is unavailable).
- Workspace list/detail, terminal, file preview, service preview. Clicking a workspace in the sidebar opens
ChatPagein workspace mode (/chat?workspaceId=…) rather than the workspace IDE page, giving a browser-style chat tab strip scoped to that workspace. - Repo manager.
- Ticket and PR views.
- Sidebar carousel: the expanded sidebar shows three panels switched via a dot selector at the bottom: Design Studio (left dot, lists Design Studio workspaces with status badges and search), main app navigation (center dot, default), and code workspaces (right dot). When collapsed, the sidebar shows only icon navigation with tooltips.
- Settings for agents, MCP (including preset and repo-based registration with Python MCP support), integrations, and users.
Key activity page components:
src/pages/ExecutionListPage.tsx- Activity page. Renders the paginated execution list. Exports thepaginationViewModel({ page, total, pageSize })pure function that computes UI-state (visible,pageCount,currentPageLabel,prevDisabled,nextDisabled) with no DOM dependency so it can be tested in isolation. A Source filter chip group (All | Chat | Workflow | Design) filters onexecutions.meta.sourceSurface; design-tab runs carrysourceSurface='design_tab'.
Key chat UI components:
src/components/chat/ChatInput.tsx- message composer with model/effort/plan/repo selectors, file attachments, and @mention detection.src/components/chat/MentionAutocomplete.tsx- autocomplete dropdown with two modes: default (workflows, repos, agents filtered by query) and linear (activated by@linear, shows the user's assigned active tickets with priority dots and state badges).src/components/chat/WorkspaceChatContextBar.tsx- context bar rendered in workspace-mode chat. Shows workspace name, repo, branch, baseBranch, and worktree path; quick-action button (Open workspace); archived-workspace banner whenstatus === 'archived'; hidden in non-workspace chat.src/components/chat/WorkspaceChatTabs.tsx- horizontal browser-style tab strip for workspace-linked chats. Supports open/close/restore tabs,+ New Chatbutton, and a Previous chats ▾ dropdown (recent-first, capped at 50 items). Tab labels truncate with a tooltip showing the full title; a streaming indicator appears on live tabs. Close confirmation is shown when the target tab is streaming.src/components/chat/WatcherStatusLines.tsx- renders one non-clickable status line per active execution watcher for the current chat session. Lines are keyed byexecutionIdand replaced in-place viaupdateSeq. Each line shows a state icon (spinner for running, checkmark for completed, alert for failed, ban for cancelled, clock for waiting-for-input), the generated status text, and a "Last checked X ago" label.src/services/api.tslinearobject - typed wrappers for all/api/linear/*endpoints including theassignee: 'me'filter shorthand,linear.teams()forGET /api/linear/teams, and the optionalteamIdfilter onlinear.issues()(omitted from the query string when the Tickets page is on All teams).
On startup packages/server/src/services/org-seed.ts idempotently seeds the agent organization into the teams and agents MongoDB collections — this is the agent set Allen runs in production. packages/engine/agents.yml holds the engine's built-in default agents, used for development and when the database has not been seeded.
Six teams (lead → parent):
| Team | Lead | Parent | Notable members |
|---|---|---|---|
executive |
ceo |
— | the CEO orchestrator |
product |
product-manager |
executive | requirements-analyst, acceptance-tester, brainstormer |
engineering |
engineering-lead |
executive | backend-developer, frontend-developer, devops-engineer, pr-creator, code-reviewer, security-specialist, documentation-writer, codebase-navigator |
quality |
qa-lead |
executive | test-planner, test-writer |
meta |
team-builder-agent |
— | workflow-builder-agent, agent-blueprint-validator, research-agent, planner-agent, repo-scanner; agent-builder-agent is workflow-internal for approved agent blueprints |
unassigned |
unassigned-coordinator |
executive | holding area for imported/created agents |
Agent categories:
- Team leads / orchestrators — no filesystem access; plan and delegate (
ceo,product-manager,engineering-lead,qa-lead,team-builder-agent,unassigned-coordinator). - Specialist / technical agents — filesystem + terminal; do the hands-on work (developers, reviewer, security, docs, navigator, testers, analysts, plus supporting agents like
bug-investigator,solution-architect,technical-designer,implementation-validator,pr-review-bot,pr-workspace-resolver). - Automation / monitoring agents — Allen-internal self-healing:
allen-monitoring-agent,allen-incident-router,allen-memory-diagnostician,allen-tooling-diagnostician,allen-workflow-diagnostician,allen-prompt-instruction-diagnostician.
Re-seeding is idempotent. Set SEED_OVERRIDE=true to refresh existing seeded rows from code on next boot. Seed logic respects soft deletion: if a built-in agent or workflow has been soft-deleted by a user, it is skipped on normal startup (no duplicate re-insertion). Under SEED_OVERRIDE, a soft-deleted built-in is restored with current seed data.
MongoDB stores all operational state. Collections are created and indexed by server startup code (packages/server/src/database/indexes.ts). The main collections:
- Auth —
users,refresh_tokens(TTL auto-purge),bootstrap_locks(first-admin race guard). - Org —
teams,agents,skills. All four org-collection types (includingworkflows) support soft delete: deleted records haveisDeleted=trueand are hidden from all lists, detail endpoints, MCP tools, pickers, and org context. Deleting setsisDeleted=true,deletedAt, and optionallydeletedBy. Recovery in v1 is restore-by-create: creating a resource with the samenameas a soft-deleted record restores it (clears deletion fields, setsrestoredAt). The shared helpers live inpackages/server/src/services/soft-delete.ts. Built-in delete protections still apply; team deletion is refused if the team has active members. - Workflows & executions —
workflows,executions,execution_traces,execution_logs,execution_failure_reports,checkpoints,execution_watchers. Bothexecutionsandexecution_tracesrows carry an optionaltokenUsage: { inputCachedTokens, inputNonCachedTokens, outputTokens }field (each sub-field isnumber | null) that is populated when the provider reports usage data. Old rows without this field render and behave normally. Theexecution_watcherscollection backs the Deterministic Execution Watcher — one document per chat-started execution, tracking polling state, status generation, and hidden trigger deduplication (see serverWatcherService). - Chat —
chat_sessions(automation sessions carry a sparse-uniqueautomationKey; the linked_idis stored ascron_jobs.linkedChatSessionIdand never overwritten by seed updates; workspace-linked sessions carryworkspaceIdplus snapshot fieldsworkspaceName,workspaceRepoId,workspaceRepoName,workspaceBranch,workspaceBaseBranch,workspacePrNumber,workspacePrUrlwritten byWorkspaceManager.linkChat; imported sessions carryisImported=true,importBundleId,sourceEnvironment,sourceSessionId, andreplayLabel),chat_messages,agent_conversations(delegation threads),agent_activity(7-day TTL),chat_export_bundles(tracks export and import operations withbundleId,operation,status,payload,sizeBytes, andimportSessionId). - Docs & checkpoints —
design_docs(PRD/HLD/TDD),workflow_interventions. - Design tab —
design_sessions(kind='design',sourceSurface='design_tab'; carriesdesignRepoId, optionalsourceRepoId/workspaceId,status,routingDecision,lastExecutionId,hasExistingOutputs, andoutputMode),design_messages(per-session messages with optionalroutingDecision,executionId,agentRunId, andartifacts). Design sessions are separate fromchat_sessionsso normal chat history excludes design conversations by default. - Repos & workspaces —
repos(carriesdetected.defaultBranch,defaultBranch, andbranch— the four-step resolution chain isdetected.defaultBranch → defaultBranch → branch → 'main'; extended with optionalroles: RepoRole[],isDefaultDesignRepo?: boolean, anddesignPreviewConfig?: DesignPreviewConfigfor design-tab support),repo_contexts,pull_requests,workspaces,workspace_configs. - MCP & secrets —
mcp_servers,secrets. - Scheduling & alerts —
cron_jobs,cron_runs(90-day TTL),alerts. - Learning —
learnings,memory_injection_audits. - Self-healing —
monitoring_incidents(uniquefingerprint),monitoring_scan_state,monitoring_events,monitoring_evidence_bundles. - Slack —
slack_thread_mappings,slack_processed_events(24h TTL idempotency).
- User starts a workflow from the UI or another trigger.
- Server creates an execution record in MongoDB.
- If the execution originates from a chat session, the Execution Watcher automatically registers a watcher document (fire-and-forget via
setImmediate), starting background polling. - Engine loads the workflow YAML and initial input.
- Nodes run in order, with condition and parallel support.
- Agent nodes spawn Claude Code CLI or SDK sessions.
- Model recovery — if an agent node fails with a recoverable provider error (rate limit, server error, model unavailable, transient connectivity, or session exhaustion), the engine classifies the failure, pauses the node, and emits an
input_requiredSSE event withkind: 'model_recovery'. The operator selects a replacement provider/model; the engine reruns only the failed node with an execution-scoped override. In parallel forks, completed sibling branches are preserved while the failed branch recovers. After bounded retries (default 3), unrecovered nodes escalate as terminal failures. - Human nodes create interventions/checkpoints when input is required.
- Node logs and state changes stream to the UI.
- The watcher polls execution status, generates factual status text from execution logs and milestone terms, and emits
watcher_updateSSE events. Reaching terminal or waiting-for-input states triggers a hidden Assistant trigger (deduplicated per state). Watchers for imported replay executions are registered asresolvedand never polled;pollOnce()force-resolves any watcher linked to an imported session. - Outputs and artifacts are persisted.
- Final status and summaries are visible in the execution detail page.
Allen workspaces are local worktrees under the workspace base directory.
Typical flow:
- A repo is registered.
- A workspace is created from a repo and branch.
- Allen allocates a port block for workspace services.
- Agents work inside the workspace path.
- Terminal and file watch WebSockets attach to the workspace.
- Preview proxy routes expose workspace services in the UI.
- Stale PIDs are cleaned up on server boot.
Workspace-linked chat. Clicking a workspace in the sidebar navigates to /chat?workspaceId=<id>. ChatPage bootstraps in workspace mode: it fetches the workspace document and its linked chat sessions, opens them as a browser-style tab strip (recent-first), and selects the most recently active tab. If no chats exist, a New chat temp tab is created. Sending the first message from a temp tab calls POST /api/chat/sessions with workspaceId, which links the new session and snapshots workspace metadata in one round-trip. The session's workspaceId is used by the agent cwd resolver so all agents in that chat run with cwd = workspace.worktreePath. Navigating to a /chat/:sessionId URL whose session has a workspaceId also bootstraps workspace mode and forces that session active, enabling Dashboard-driven resumption.
Defaults:
- Workspace base: resolved by
WORKSPACE_BASE_DIRor Allen's default home paths. - Port blocks: start at
15000, with 10 ports per workspace. - Terminal WebSocket:
4024(overridable viaTERMINAL_WS_PORT). - File watch: shares the terminal WebSocket on port
4024at/ws/workspaces/:id/watch.
Allen supports Claude Code CLI and SDK execution.
Default behavior:
- Claude-provider execution uses CLI mode by default.
ALLEN_AGENT_EXECUTION_MODE=clikeeps the default explicit.ALLEN_AGENT_EXECUTION_MODE=sdkforces the in-process SDK path.CLAUDE_BINcan point to a specific Claude binary.ALLEN_SYSTEM_PROMPT_MODE=appendpreserves Claude Code scaffolding and appends Allen's role prompt.ALLEN_SYSTEM_PROMPT_MODE=customfully replaces the system prompt where supported.
Allen integrates with external systems through server-managed configuration and tool access. Common integrations include:
- GitHub for pull requests and repo-related workflows.
- Linear for ticket browsing and dispatch.
- Slack for thread-based interaction.
- MCP servers for custom tools and data sources.
- Claude Code, Codex, and Claude-compatible providers (OpenRouter, DeepSeek, Kimi, Xiaomi MiMo, GLM/Z.AI) for agent execution.
See Integrations.
Allen is developer infrastructure with repository and tool access. Treat workflow YAML, agent definitions, credentials, artifacts, MCP servers, and workspace execution as security-sensitive.
Start with Security and sandboxing before changing auth, workspaces, public links, MCP handling, agent execution, or integration credentials.
- Setup and operations docs:
README.md,docs/,scripts/. - Workflow changes:
packages/engine/workflows/and related engine tests. - Agent organization changes: server org seeding and engine defaults.
- API or persistence changes:
packages/server/src/. - Product UI changes:
packages/ui/src/. - Desktop runtime changes:
packages/desktop/src/. - End-to-end behavior:
e2e/.
For public docs, follow the Documentation guidelines.