Agentic Hub Docs
Portal & Workflows

Bifrost

Bifrost — Remote Execution Service

Hub-native bridge between the Portal and local Claude CLI agents. Runs as a Node.js Express API managed by PM2.

Overview

Detail
WhatNode.js Express API that polls D1 for remote jobs and dispatches them to Claude CLI
Wheree:\Agentic\services\bifrost-api/
Domainbifrost.mipos.io (port 4003)
Managed byPM2 (ecosystem.config.cjs)
Skill/bifrost skill (start, stop, status, restart, logs)
Legacyservices/bifrost/bifrost.ps1 — PS polling fallback (Scheduled Task disabled)

Architecture

Portal Compose UI → POST /api/remote-jobs → D1 queue

                                     Bifrost API (PM2)
                                     polls D1 every 30s

                                     Picks up job → spawns Claude CLI
                                     CWD: e:\Agentic (hub-native)
                                     Flags: --dangerously-skip-permissions

                              ┌─────────────┼─────────────┐
                              │             │             │
                         D1 job update  #dev channel  Log entry
                         (status/result) (progress)   (if applicable)

Key Components

FilePurpose
server.jsExpress routes: health, jobs CRUD, SSE stream
controllers/jobs.jsJob spawn, cancel, EventEmitter streaming
lib/portal.jsHTTP client for D1 API calls
lib/retry-queue.jsRate-limit auto-retry with cooldown
ecosystem.config.cjsPM2 config

Job Types

TypeWhatDuration
researchAgent researches a topic, produces a report5-15 min
claraRun a Clara mode (sweep, tidy, archive, focus, align)2-8 min
workflowRun any slash command2-10 min
sessionExecute a task from a task folder5-30 min
autopilotMulti-step autonomous execution5-20 min

Job Lifecycle

pending → running → done/failed

      rate_limited → retry_at → running (auto-resume)
  • Rate limiting: Bifrost captures Claude CLI's session_id and retry timestamp. Jobs queue for auto-retry via retry-queue.js.
  • Cancellation: DELETE /jobs/:id kills the child process.
  • Streaming: GET /jobs/:id/stream returns SSE with real-time stdout.

API Endpoints

MethodPathPurpose
GET/healthHealth check
GET/jobsList recent jobs
GET/jobs/:idGet job details
GET/jobs/:id/streamSSE stream of job output
POST/jobsCreate new job (portal does this via D1)
PATCH/jobs/:idUpdate job status/result
DELETE/jobs/:idCancel running job
DELETE/jobs/:id/retryCancel pending retry

PM2 Management

# Via skill (preferred)
# Use /bifrost skill: start, stop, status, restart, logs

# Direct PM2 commands (fallback)
pm2 start e:\Agentic\services\bifrost-api\ecosystem.config.cjs
pm2 logs bifrost-api
pm2 restart bifrost-api

Startup guard: PM2 sets PM2_HOME and pm_id env vars. The server uses these to detect PM2 context. If "online" but not responding, check for conditional startup guards in the code (see memory.md lesson).

On this page