Skip to main content

KALNET Agent Batch Executor Guide

How to actually invoke agents to build out KALNET’s full architecture in parallel.

Quick Start: Run One Stage

# Stage 0: Foundation (all 4 agents in parallel)
./execute-stage.sh 0

# Stage 1: Core Services (all 5 agents in parallel)
./execute-stage.sh 1

# Stage 2: Integration (all 3 agents in parallel)
./execute-stage.sh 2

# Stage 3: Validation (both agents in parallel)
./execute-stage.sh 3

Batch A: Build Foundation Tonight (30 mins, 4 agents)

Goal: Infrastructure layer ready for services
STAGE=0
BATCH="A"

# Run in parallel:
AGENTS=(0.1 0.2 0.3 0.4)

for agent in "${AGENTS[@]}"; do
  invoke_agent "kalnet-stage-$STAGE-agent-$agent" &
done
wait
What you’ll have:
  • Traefik reverse proxy configured
  • Storage/volume strategy defined
  • Observability/logging ready
  • Security foundation + secrets management
Time: ~30 mins (all in parallel)

Batch B: Deploy Core Services (45 mins, 5 agents)

Goal: Streaming, automation, chat, CI/CD, service mesh Run AFTER Stage 0 completes.
STAGE=1
BATCH="B"

# Run in parallel (with soft dependency noted):
AGENTS=(1.1 1.2 1.3 1.4 1.5)

for agent in "${AGENTS[@]}"; do
  invoke_agent "kalnet-stage-$STAGE-agent-$agent" &
done
wait
What you’ll have:
  • Game streaming (Sunshine/Moonlight)
  • Private encrypted comms (Matrix)
  • CI/CD pipeline with git webhooks
  • n8n automation workflows
  • Enhanced discovery service with service mesh
Time: ~45 mins (all in parallel)

Batch C: Polish & Integration (30 mins, 3 agents)

Goal: Unified UI, setup wizard, documentation Run AFTER Stage 1 completes.
STAGE=2
BATCH="C"

# Run in parallel (independent):
AGENTS=(2.1 2.2 2.3)

for agent in "${AGENTS[@]}"; do
  invoke_agent "kalnet-stage-$STAGE-agent-$agent" &
done
wait
What you’ll have:
  • Beautiful unified dashboard
  • Interactive setup wizard
  • Comprehensive documentation (user + dev)
Time: ~30 mins (all in parallel)

Batch D: Validate & Release (20 mins, 2 agents)

Goal: Tests passing, release procedures ready Run AFTER Stage 2 completes.
STAGE=3
BATCH="D"

# Run in parallel (independent):
AGENTS=(3.1 3.2)

for agent in "${AGENTS[@]}"; do
  invoke_agent "kalnet-stage-$STAGE-agent-$agent" &
done
wait
What you’ll have:
  • Full test suite (integration, performance, stress tests)
  • Release procedures and deployment automation
  • Pre-release checklist
  • Rollback procedures
Time: ~20 mins (all in parallel)

Individual Agent Invocation

If you want to run agents one at a time or in custom batches:
# Run a single agent
invoke_agent "kalnet-stage-0-agent-0.1"

# Run multiple agents sequentially
invoke_agent "kalnet-stage-0-agent-0.1"
invoke_agent "kalnet-stage-0-agent-0.2"
invoke_agent "kalnet-stage-0-agent-0.3"
invoke_agent "kalnet-stage-0-agent-0.4"

# Run multiple agents in parallel
invoke_agent "kalnet-stage-0-agent-0.1" &
invoke_agent "kalnet-stage-0-agent-0.2" &
invoke_agent "kalnet-stage-0-agent-0.3" &
invoke_agent "kalnet-stage-0-agent-0.4" &
wait

Agent Prompts (Inline)

If using Claude directly, here are the prompts formatted for copy-paste:

STAGE 0 (Copy one at a time to Claude)

Agent 0.1: Network & Infrastructure

You are building KALNET's networking and infrastructure layer.
Your task is to create:

1. Enhanced docker-compose.yml that includes:
   - Traefik reverse proxy service (listens on 80, 443)
   - Service labels for automatic routing
   - Health checks on all services
   - Resource limits (CPU, memory)
   - Restart policies with backoff
   - Network segmentation (if needed for security)

[... full prompt from KALNET-AGENT-STRATEGY.md Agent 0.1 ...]
[See KALNET-AGENT-STRATEGY.md for full prompts to copy]

Integration Points Between Agents

When Agent Finishes

Each agent should report:
  1. Status: PASS or FAIL
  2. Deliverables: List of files created
  3. Dependencies Met: What it depends on (and did they complete?)
  4. Blocking Issues: Anything that would block next stage

Validation Checkpoints

After each stage, verify:
# Stage 0 validation
├─ docker-compose.prod.yml exists
├─ traefik-config.yml exists
├─ .env.example exists
├─ init-storage.sh is executable
├─ .secrets.example exists
├─ observability-compose-fragment.yml exists
└─ All markdown documentation exists

# Stage 1 validation
├─ Game streaming setup guide exists
├─ Communications service config exists
├─ Deployment pipeline scripts exist
├─ n8n workflow templates exist
├─ Enhanced discovery service code exists
└─ All services build without errors

# Stage 2 validation
├─ Dashboard app exists (React or vanilla JS)
├─ Setup wizard runs without errors
├─ Documentation is complete and searchable
└─ All files are in proper structure

# Stage 3 validation
├─ Integration tests run and pass
├─ Release procedures documented
├─ Rollback tested
└─ Deployment validated

Workflow: Step-by-Step Execution

If You Have 2+ Hours (Run All Stages in Parallel)

# 1. Run Stage 0
echo "Running STAGE 0..."
run_stage 0
# Wait: ~30 mins

# 2. Run Stage 1 (after Stage 0 completes)
echo "Running STAGE 1..."
run_stage 1
# Wait: ~45 mins

# 3. Run Stage 2 (after Stage 1 completes)
echo "Running STAGE 2..."
run_stage 2
# Wait: ~30 mins

# 4. Run Stage 3 (after Stage 2 completes)
echo "Running STAGE 3..."
run_stage 3
# Wait: ~20 mins

# Total wall-clock time: ~2 hours
# Total agent-hours: ~5.5 hours

If You Have 30 Mins (Just Run Stage 0)

# Build foundation layer only
run_stage 0

# You'll have:
# - Traefik proxy configured
# - Storage architecture designed
# - Observability logging ready
# - Security foundation + secrets

# Continue with next stage when ready

If You Have 1.5 Hours (Stages 0-2)

# Run foundation + services + integration
run_stage 0
run_stage 1
run_stage 2

# You'll have almost everything except tests/release procedures

Agent Communication

Status Messages

Each agent should output:
{
  "agent": "0.1",
  "stage": 0,
  "status": "COMPLETE",
  "duration_minutes": 8,
  "deliverables": [
    "docker-compose.prod.yml",
    "traefik-config.yml",
    ".env.example",
    "KALNET-NETWORKING.md"
  ],
  "dependencies_met": true,
  "blocking_issues": [],
  "next_agent": "0.2"
}

Failure Handling

If an agent reports failure:
{
  "agent": "1.3",
  "stage": 1,
  "status": "FAILED",
  "blocking_issues": [
    "Docker build failed for webhook-receiver",
    "Error: syntax error in main.go line 45"
  ],
  "suggested_fix": "Check Go version, ensure go.mod is present",
  "can_proceed_without": false
}
What to do: Fix the issue (or skip this agent if not critical) before proceeding.

Monitoring Agent Progress

Real-Time Progress

# Watch all agents
watch -n 1 'ps aux | grep "invoke_agent"'

# Check output in real-time
tail -f kalnet-build.log

# Count completed agents
ls -1 kalnet_*/deliverables/ | wc -l

Summary After Each Stage

# Show what was built in Stage N
echo "=== STAGE $N SUMMARY ==="
find kalnet_stage_$N -name "*.md" -o -name "*.yml" -o -name "*.sh" -o -name "*.go" | head -20

Customization: Skip/Reorder Agents

Example: Run Only Networking (0.1) + Code Deployment (1.3)

# Just the network layer
invoke_agent "kalnet-stage-0-agent-0.1"

# Just the deployment pipeline
invoke_agent "kalnet-stage-1-agent-1.3"

# These will have missing dependencies, but can still work

Example: Prioritize Dashboard + Docs

# Run Stage 0 (foundation)
run_stage 0

# Run Stage 1 (core services)
run_stage 1

# Run ONLY Stage 2.1 + 2.3 (dashboard + docs), skip wizard
invoke_agent "kalnet-stage-2-agent-2.1"
invoke_agent "kalnet-stage-2-agent-2.3"

Output Organization

All agent deliverables should be organized as:
kalnet/
├── stage-0/
│   ├── networking/
│   │   ├── docker-compose.prod.yml
│   │   ├── traefik-config.yml
│   │   └── KALNET-NETWORKING.md
│   ├── storage/
│   │   ├── init-storage.sh
│   │   ├── KALNET-STORAGE.md
│   │   └── storage-structure.txt
│   ├── observability/
│   │   ├── observability-compose-fragment.yml
│   │   ├── metrics-collector.go
│   │   ├── dashboard.html
│   │   └── KALNET-OBSERVABILITY.md
│   └── security/
│       ├── security-config.yaml
│       ├── init-security.sh
│       ├── firewall-rules.sh
│       └── KALNET-SECURITY.md

├── stage-1/
│   ├── game-streaming/
│   │   ├── sunshine-docker-compose.yml
│   │   ├── game-import-script.sh
│   │   └── KALNET-GAME-STREAMING.md
│   ├── communications/
│   │   ├── comms-docker-compose.yml
│   │   ├── comms-init.sh
│   │   └── KALNET-COMMUNICATIONS.md
│   ├── deployment/
│   │   ├── webhook-receiver.go
│   │   ├── deployment-pipeline.sh
│   │   └── KALNET-DEPLOYMENT-PIPELINE.md
│   ├── automation/
│   │   ├── n8n-workflows/
│   │   ├── workflow-templates/
│   │   └── KALNET-AUTOMATION.md
│   └── service-mesh/
│       ├── enhanced-discovery-service.go
│       ├── service-mesh-config.yaml
│       └── KALNET-SERVICE-MESH.md

├── stage-2/
│   ├── dashboard/
│   │   ├── dashboard/ (React app)
│   │   ├── dashboard-server.go
│   │   └── KALNET-DASHBOARD.md
│   ├── wizard/
│   │   ├── setup-wizard.go
│   │   ├── config-schema.yaml
│   │   └── KALNET-CONFIGURATION.md
│   └── docs/
│       ├── docs/
│       ├── quick-ref-cards.pdf
│       └── KALNET-DOCS.md

└── stage-3/
    ├── tests/
    │   ├── integration_test.go
    │   ├── performance_test.go
    │   ├── scenarios/
    │   └── KALNET-TESTING.md
    └── release/
        ├── release.sh
        ├── deploy-prod.sh
        ├── rollback.sh
        └── KALNET-DEPLOYMENT.md

Checkpoints: Before Proceeding to Next Stage

After Stage 0
  • All 4 agents report COMPLETE
  • docker-compose.prod.yml validates
  • .env.example has all required variables
  • Security foundation is documented
  • No blocking issues reported
After Stage 1
  • All 5 agents report COMPLETE
  • All service docker images build successfully
  • Enhanced discovery service compiles
  • Workflow templates are valid n8n exports
  • No blocking issues reported
After Stage 2
  • All 3 agents report COMPLETE
  • Dashboard loads without errors
  • Setup wizard runs and creates config
  • Documentation is complete and searchable
  • No blocking issues reported
After Stage 3
  • All tests pass
  • Release procedures documented
  • Rollback tested successfully
  • Ready for production deployment!

Estimated Timelines

ScenarioApproachWall ClockAgent Hours
Full build (all 14 agents)All parallel by stage~2 hours5.5 hours
Build Stages 0-2All parallel~1.75 hours4.5 hours
Just Stage 0 (foundation)4 in parallel~30 mins0.5 hours
Sequential (one agent/time)One at a time~1.75 hours5.5 hours
Pick & choose (8 agents)Custom selection~1 hour3 hours

Pro Tips

  1. Validate early: Don’t wait for stage to complete. Check agent 0.1 output while 0.2-0.4 are running.
  2. Skip non-critical agents: Don’t need observability yet? Skip 0.3. Need to ship fast? Skip 2.3 docs (for now).
  3. Reuse from existing: If you already have Traefik config from another project, tell agent 0.1 and it can adapt it instead of starting from scratch.
  4. Parallelize more aggressively: If you have compute, don’t wait for stage to complete. Start Stage 1 agents once Stage 0.1-0.2 are done (they don’t depend on 0.3-0.4).
  5. Create a Makefile:
.PHONY: build-stage-0 build-stage-1 build-all validate-stage-0

build-stage-0:
	@echo "Running Stage 0 agents..."
	agent-0.1 & agent-0.2 & agent-0.3 & agent-0.4 & wait

build-stage-1: build-stage-0
	@echo "Running Stage 1 agents..."
	agent-1.1 & agent-1.2 & agent-1.3 & agent-1.4 & agent-1.5 & wait

build-all: build-stage-0 build-stage-1
	@echo "KALNET fully built!"

validate-stage-0:
	./validate-stage.sh 0
Then just run:
make build-stage-0
make validate-stage-0
make build-stage-1

If Something Goes Wrong

Agent Fails During Stage 0

# Check what failed
tail -100 kalnet-stage-0-agent-0.3.log

# Fix the issue (usually missing dependency or Docker not running)
# Re-run just that agent
invoke_agent "kalnet-stage-0-agent-0.3"

# Or skip it for now and come back later
invoke_agent "kalnet-stage-0-agent-0.4"  # Run next agent

Agent Completes But Output Is Wrong

# Review the deliverables
ls -la kalnet_stage_1/automation/

# If output is unusable, re-run with clarification
invoke_agent "kalnet-stage-1-agent-1.4" --clarification "Include example workflows, not just templates"

Stage N Has Blocking Issue for Stage N+1

# Don't proceed to next stage yet
# Fix the blocker first
# Re-run agent that failed
# THEN proceed to next stage

This guide gives you everything needed to orchestrate agent-driven KALNET development at scale! 🚀