Skip to content

Platform Layer

The platform layer (internal/platform/) provides shared infrastructure for all agents. Buck, Dolly, and Pearl each import platform packages to handle event routing, LLM access, session tracking, storage, and external service integrations.

NATS JetStream is the central message bus for all webhook events and session lifecycle updates. Two streams handle different concerns.

PropertyValue
Subjectswebhooks.>
RetentionWorkQueue
MaxAge72 hours
MaxMsgs100,000
StorageFile

All incoming webhook events are published to this stream. The WorkQueue retention policy ensures each message is delivered to exactly one consumer.

PropertyValue
Subjectssessions.>
RetentionLimits
MaxAge24 hours
MaxMsgsPerSubject10
StorageFile

Session lifecycle events (status changes, pause/resume notifications) are published here. The Limits retention with per-subject caps keeps a rolling window of recent events per session.

Each agent runs its own durable consumer that pulls from its namespace within the WEBHOOKS stream:

PropertyValue
Consumer name{agent}-webhook-workers
Filter subjectwebhooks.{agent}.*
Ack policyExplicit
Ack wait10 minutes
Max deliveries5

Session event consumers use ordered consumers with a sessions.{sessionID}.> filter and DeliverLastPerSubject policy to catch up on the latest state.

Publishers route events to webhooks.{agentName}.{jobType} where:

  • agentName is buck, dolly, or pearl
  • jobType is one of: slack, slack_interaction, jira, session-update, github_comment, dashboard_message

Each agent’s consumer only receives events matching its own namespace, so Buck never processes Dolly’s Slack mentions and vice versa.

A 256-slot sharded mutex (FNV32a hash of session ID) ensures that events for the same session execute sequentially. This prevents race conditions when multiple events arrive for the same conversation in rapid succession, while still allowing high concurrency across different sessions.

Failed messages follow a backoff schedule before redelivery:

AttemptDelay
10s (immediate)
25s
330s
42m
510m

After 5 failed attempts, the message is terminated and logged for investigation.

The shared Claude model wrapper (internal/platform/bedrock/) provides LLM access to all agents via the AWS Bedrock Converse API:

  • Translates between ADK’s genai types and Bedrock’s message/content block types
  • Handles consecutive same-role message merging (required by Bedrock)
  • Converts tool use and tool result blocks between ADK and Bedrock formats
  • Supports multimodal input — images from Slack threads and Jira attachments are passed as Bedrock ImageBlock payloads
  • Uses the ECS task role for AWS credentials

Each agent can configure a different model ID (e.g., Buck defaults to Sonnet, Dolly and Pearl default to Opus).

The session index (internal/platform/sessionindex/) maps platform-specific identifiers to canonical UUID sessions. This enables cross-platform session continuity — a conversation started in Slack can continue in Jira or the dashboard.

Key format: {agent}:{platform}:{identifier}

PatternExample
Slack threadbuck:slack:{channelID}:{threadTS}
Jira ticketdolly:jira:{issueKey}
Dashboard sessionpearl:dashboard:{sessionID}

The index is backed by PostgreSQL with a 30-day expiry on unused entries. Lookups are bidirectional — given a platform key, find the session; given a session ID, find all linked platform keys.

The storage layer (internal/platform/storage/) provides an S3 image store with CloudFront CDN:

  • Re-hosts images from Slack (bot token download), Jira (API download), and runner uploads
  • Returns permanent CloudFront URLs when CLOUDFRONT_DOMAIN is configured
  • Falls back to pre-signed S3 GET URLs (7-day TTL) without CloudFront
  • Used by all agents to persist images referenced in conversations

Shared API clients available to all agents:

ClientPathAuthUsed by
Jirainternal/platform/jira/REST API v3, basic auth (email + API token)All agents
Slackinternal/platform/slack/Web API + Block Kit, bot OAuth tokenAll agents
GitHubinternal/platform/github/App installation tokensBuck
Confluenceinternal/platform/confluence/REST API, basic authDolly
Google Driveinternal/platform/gdrive/Service account credentialsDolly
Figmainternal/platform/figma/Personal access tokenPearl
Celestialsinternal/platform/celestials/Internal service, no authAll agents