This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Do not use emojis in code, comments, commit messages, or documentation
- Keep log messages concise and informative
- Use structured logging with fields (e.g.,
log.WithFields) for context
make build # Build the main colonies binary and libraries
make container # Build Docker container
make install # Install binaries to /usr/local/binIMPORTANT: Container Image Name When building Docker containers, NEVER change the image name. Always use:
BUILD_IMAGE=colonyos/colonies:latest make containerThe deployment docker-compose files expect colonyos/colonies:latest. Using a different image name will cause the container to not be updated when restarting.
make test # Run all tests (requires grc for colored output)
make github_test # Run tests without grc (for CI)docker-compose up -d # Start Colonies server with dependencies (TimescaleDB, MinIO)
docker-compose down # Stop all services
docker-compose logs -f # View logsmake coverage # Generate test coverage reportsColonyOS is a distributed meta-orchestrator framework that creates compute continuums across different platforms. This repository contains the core Colonies server implementation.
- Colony: A distributed runtime environment consisting of networked Executors
- Process: A computational workload defined by a FunctionSpec, with states (WAITING, RUNNING, SUCCESS, FAILED)
- Executor: Distributed workers that pull and execute processes, can run anywhere on the Internet
- FunctionSpec: Specification defining what computation to run and execution conditions
pkg/core/: Core domain models (Process, Executor, Colony, FunctionSpec)pkg/service/: HTTP RPC service implementationpkg/client/: Go SDK for Colonies APIpkg/database/postgresql/: PostgreSQL database layer with TimescaleDB supportpkg/security/: Zero-trust security protocol implementationpkg/scheduler/: Process scheduling and assignment logicinternal/cli/: Command-line interface implementation using Cobra
- Zero-trust security: All communication is cryptographically signed
- Process graphs: Workflows as DAGs with parent-child relationships
- Distributed scheduling: Processes assigned to available Executors based on conditions
- Meta-orchestration: Coordinates workloads across multiple platforms without direct control
The system uses PostgreSQL with TimescaleDB for time-series data. Database interactions are abstracted through interfaces in pkg/database/.
The main binary is built from cmd/main.go which delegates to internal/cli/ for all command handling. Commands are organized by domain (process, executor, colony, etc.).
Tests are co-located with source files using _test.go suffix. The test suite covers reliability, crypto, core domain models, database layer, RPC protocol, security, and scheduling components.
The reconciliation system uses blueprints to manage container deployments. When debugging reconciliation issues:
# View logs from a specific reconciler executor
colonies log get -e local-docker-reconciler
# View logs for a specific reconciliation process
colonies log get -p <processID>
# Follow logs in real-time (requires process ID)
colonies log get -p <processID> --follow# Normal reconciliation (checks if changes needed)
colonies blueprint reconcile --name <blueprint-name>
# Force reconciliation (recreates all containers with fresh images)
colonies blueprint reconcile --name <blueprint-name> --force# List all blueprints
colonies blueprint ls
# Get blueprint details
colonies blueprint get --name <blueprint-name>
# Check running processes
colonies process ps
# Get process details (includes output and errors)
colonies process get -p <processID># Find reconciler containers
docker ps | grep reconciler
# View container logs directly
docker logs <container-name>
# Follow container logs
docker logs -f <container-name>-
Process not closing: Check if executor received the close message via
colonies log get -e <executor>. Verify channels are cleaned up when process closes. -
Containers not starting: Check reconciler logs for image pull errors or container start failures. Use
colonies log get -p <processID>to see detailed reconciliation steps. -
Force reconcile not working: Ensure the
--forceflag is being passed. Check logs for "Force flag enabled" message. -
Executor not registering: Check reconciler logs for registration errors. Verify colony owner key has permissions.
pkg/server/handlers/blueprint/handlers.go: Blueprint CRUD and reconciliation triggeringpkg/channel/router.go: Channel management (cleanup on process close)- Docker reconciler repo (
colonyos/executors/docker-reconciler):pkg/executor/process_handler.go: Handles reconcile/cleanup processespkg/reconciler/reconciler.go: Core reconciliation logicpkg/reconciler/executor_deployment.go: ExecutorDeployment handling