Skip to main content

Weavers

Weavers are ephemeral, container-based execution environments that run Loom CLI sessions in isolated Kubernetes pods. They enable:
  • Remote Development: Code from anywhere without local setup
  • Clean Environments: Fresh container per session with custom images
  • Resource Isolation: CPU/memory limits per weaver
  • Automatic Cleanup: TTL-based lifecycle management
  • Git Integration: Clone repositories on creation

Architecture

Components:
  • loom-cli: User-facing commands (new, attach, ps, delete)
  • loom-server-weaver: Provisioning logic and cleanup
  • loom-server-k8s: Kubernetes client wrapper
  • Kubernetes: Pod orchestration and lifecycle

Quick Start

1

Authenticate

2

Create a weaver

This:
  • Creates a Kubernetes pod
  • Waits for pod to be ready
  • Attaches to the weaver terminal
3

Work in the weaver

You now have an interactive Loom REPL running in the container.
4

Detach and reattach

Press Ctrl+D to detach.Later, reattach:

CLI Commands

Create Weaver

--image
string
Container image to useDefault: ghcr.io/ghuntley/loom/weaver:latest
--org
string
Organization ID for the weaverDefaults to your personal organization if not specified.
--repo
string
Git repository to clone (public HTTPS URL)Example: https://github.com/user/project
--branch
string
Branch to checkout after cloningDefault: Repository default branch
-e, --env
KEY=VALUE
Environment variable for the containerCan be specified multiple times:
--ttl
integer
Lifetime in hours (max: 48)Default: 4 hoursWeaver is automatically deleted when TTL expires.

List Weavers

Attach to Weaver

Attaches your terminal to the running weaver. Press Ctrl+D or exit to detach.
Attaching does NOT create a new session. Multiple users can attach to the same weaver simultaneously.

Delete Weaver

Immediately terminates the pod and removes all data. This operation is irreversible.

Server API

Create Weaver

Request:
Response:

List Weavers

Returns all weavers for the authenticated user’s organization.

Get Weaver Status

Response:

Attach Terminal (WebSocket)

Upgrades to WebSocket connection for bidirectional terminal I/O. Protocol:
  • Client sends stdin as text frames
  • Server sends stdout/stderr as text frames
  • Resize events as JSON: {"type": "resize", "rows": 24, "cols": 80}

Delete Weaver

Terminates the pod and cleans up resources.

Lifecycle Management

Status States

1

Pending

Pod is being created by Kubernetes.
2

Running

Pod is active and accepting connections.
3

Succeeded

Pod completed successfully (rare for weavers).
4

Failed

Pod encountered an error (check logs).
5

Unknown

Kubernetes lost contact with the pod.

Automatic Cleanup

The WeaverCleanupJob runs every 60 seconds to:
  1. Query all weavers from database
  2. Check if created_at + lifetime_hours > now
  3. Delete expired weavers via Kubernetes API
  4. Remove database records
Configuration:

Kubernetes Integration

Pod Specification

Weavers are created as Kubernetes Pods with:

Resource Limits

Default limits (configurable per deployment):

Namespace Setup

Server validates the namespace on startup:
Create the namespace manually:

Weaver Images

A weaver image must:
  1. Include loom binary in $PATH
  2. Run a persistent process (e.g., loom REPL)
  3. Accept terminal connections

Official Image

Build and publish:

Custom Images

You can use any image that:
  • Runs a shell or REPL
  • Has development tools installed
  • Optionally pre-installs dependencies

Git Repository Cloning

When --repo is specified:
  1. Weaver starts in empty workspace
  2. Loom automatically runs: git clone {repo}
  3. If --branch provided: git checkout {branch}
  4. Workspace root set to cloned directory
Only public HTTPS repositories are supported. Private repos require SSH keys or credentials in the image.

Security Considerations

Isolation

  • Each weaver runs in a separate pod
  • Network policies can restrict pod-to-pod communication
  • No persistent volumes by default

Image Trust

Always use trusted images:
Never use unverified public images. They may contain malware or leak sensitive data.

Secrets Management

  • Use loom-weaver-secrets crate for secure secret injection
  • Avoid passing secrets via --env (visible in pod spec)
  • Use Kubernetes Secrets for sensitive data

Troubleshooting

Check pod status:
Common causes:
  • Image pull failure (check events)
  • Insufficient cluster resources
  • Invalid image name
The container exited because it has no long-running process.Fix:
  • Ensure image has ENTRYPOINT or CMD that blocks
  • Use loom REPL as the main process
Check if pod is running:
View logs:
Check server logs:
Possible causes:
  • Manual deletion
  • Server restart with TTL recalculation
  • Database inconsistency

Advanced Usage

SSH Access

Establishes SSH connection through WireGuard tunnel. Requires:
  • WireGuard tunnel configured (loom tunnel up)
  • SSH server running in weaver image

WireGuard Tunnel

Enables direct network access to weaver pods for SSH, databases, etc.

Webhook Notifications

Configure webhooks for weaver lifecycle events:
Payload:

Performance Tuning

Pod Startup Time

Reduce cold start latency:
  • Use smaller base images (Alpine, distroless)
  • Pre-pull images on cluster nodes
  • Increase pod resource requests

Resource Allocation

Adjust based on workload:

Cleanup Performance

For large deployments, increase cleanup frequency: