Skip to main content

Overview

Weavers are ephemeral Kubernetes pods that provide isolated, remote development environments for running Loom REPL sessions. Each weaver runs a container with a full development environment and can optionally clone a git repository.

Quick Start

Commands

new

Create a new remote weaver session.
--image, -i
string
default:"ghcr.io/ghuntley/loom/weaver:latest"
Container image to use for the weaver
--org, -o
string
Organization ID, slug, or name. Defaults to your personal organization if not specified.
--repo
string
Git repository to clone (public HTTPS URL)Example: https://github.com/user/repo
--branch
string
Git branch to checkout (requires --repo)Example: main, develop, feature/new-api
--env, -e
string
Environment variables (repeatable)Format: KEY=VALUEExample: -e NODE_ENV=production -e DEBUG=true
--ttl
integer
default:4
Lifetime in hours (max: 48)Weaver will automatically terminate after this duration.
Example:
Output:

attach

Attach to a running weaver’s terminal.
weaver-id
string
required
Weaver ID to attach to
Example:
Output:
Detaching:
  • The connection uses WebSocket for bidirectional terminal I/O
  • Press Ctrl+C or close terminal to detach
  • The weaver continues running after detach
  • Reattach later with loom attach <weaver-id>

ps

List all running weavers.
--json
boolean
default:false
Output as JSON
Example:
Output:
JSON Output:

delete

Delete a weaver (terminates the pod).
weaver-id
string
required
Weaver ID to delete
Example:
Output:
Deletion is immediate and irreversible. Any unsaved work in the weaver will be lost.

Architecture

Kubernetes Backend

Weavers run as Kubernetes pods in the loom-weavers namespace:
  • Orchestration: Managed by loom-server-weaver provisioner
  • Networking: Each pod gets a cluster IP for WebSocket connections
  • Storage: Ephemeral storage (data is lost when pod terminates)
  • Resources: Configurable CPU/memory limits via server config

WebSocket Protocol

Attachment uses WebSocket for bidirectional terminal I/O:
  1. Connection: CLI connects to wss://server/api/weaver/<id>/attach
  2. Authentication: Bearer token in Authorization header
  3. Stdin: Binary messages sent to pod’s stdin
  4. Stdout/Stderr: Binary messages received from pod
  5. Ping/Pong: Automatic keepalive
  6. Close: Graceful disconnection on Ctrl+C or EOF

Lifecycle

States:
  • Pending: Pod is being scheduled/started
  • Running: Container is running and ready
  • Succeeded: Container exited with code 0
  • Failed: Container crashed or failed to start
  • Unknown: Status cannot be determined

Organization Management

Personal Organization

Every user has a personal organization for individual weavers:

Team Organizations

Create weavers in shared team organizations:
The CLI resolves organization references automatically:
  1. If it looks like a UUID → use as organization ID
  2. Otherwise → lookup by slug or name via API

Environment Variables

Pass environment variables to weavers:
Variables are set in the container environment and available to all processes.

Git Integration

Clone Repository

Weavers can automatically clone a git repository on startup:
Requirements:
  • Repository must be public (HTTPS URL)
  • Branch is optional (defaults to repository’s default branch)
  • Clone happens during container initialization

Working Directory

When a repository is cloned:
  • Working directory: /workspace/<repo-name>
  • Git repository is ready to use
  • All tools operate within this workspace

Troubleshooting

Weaver Creation Fails

Image Pull Error:
Solutions:
  • Verify the image exists and is accessible
  • Check image registry credentials are configured on server
  • Use a public image for testing
Authentication Error:
Solution:

Weaver Exits Immediately

Container has no long-running process:
Solution:
  • Weaver images must run a persistent process (e.g., tail -f /dev/null, shell, or REPL)
  • Check container’s CMD/ENTRYPOINT is not a one-shot command

Connection Issues

WebSocket Connection Failed:
Solutions:
  • Check network connectivity to server
  • Verify server allows WebSocket connections
  • Check firewall allows WSS traffic
Timeout During Attach:
  • Weaver may be starting up (wait for Running status)
  • Check weaver status: loom weaver ps

Debug with kubectl

Server operators can debug weavers directly:

Server Configuration

Weaver behavior is configured server-side in loom-server config:
See server configuration documentation for full details.

Security Considerations

Isolation

  • Each weaver runs in an isolated Kubernetes pod
  • Network policies can restrict pod-to-pod communication
  • Resource limits prevent resource exhaustion

Authentication

  • All weaver API calls require valid authentication token
  • WebSocket connections verify token before allowing attachment
  • Users can only access weavers in their authorized organizations

Secrets

Do not pass secrets via --env flags. They will be visible in command history and potentially logs.
Better approaches:
  • Use Kubernetes secrets (requires server-side configuration)
  • Mount secrets as files in container
  • Fetch secrets from secret manager at runtime

Best Practices

Resource Management

  1. Set appropriate TTL: Don’t waste resources on idle weavers
  2. Delete when done: Manually delete weavers you’re finished with
  3. Monitor usage: Use loom weaver ps to track active weavers

Container Images

  1. Use specific tags: Avoid latest for reproducibility
  2. Keep images small: Faster startup times
  3. Include necessary tools: Git, text editors, language runtimes
  4. Set working directory: Use WORKDIR /workspace in Dockerfile

Git Workflows

  1. Clone vs Manual: Use --repo for quick setup, manual clone for flexibility
  2. Branch naming: Use descriptive branch names for easy identification
  3. Commit often: Weaver storage is ephemeral

CLI Overview

Main CLI commands and setup

REPL Commands

Interactive session tools and usage