Skip to content

Commit 09c1aed

Browse files
gHashTagclaude
andauthored
Ralph/dep 001 docker zig 0152 (#16)
* feat(vibee): Cycle 49 - Fix generator imports and test aliases Generator fixes for Zig 0.15 compatibility and test compatibility: 1. Added Allocator import to all generated files - writeImports() now includes "const Allocator = std.mem.Allocator;" 2. Added snake_case aliases for test compatibility - New writeBehaviorAliases() creates const aliases - Tests reference snake_case (check_recovery_cooldown) - Generated functions are camelCase (checkRecoveryCooldown) - Aliases bridge the gap: const check_recovery_cooldown = checkRecoveryCooldown; 3. Fixed test generation for agent/cluster tests - Replaced undefined "cluster.agents" references - Now creates proper AgentPool test structures 4. Fixed Cycle 48 specs for Zig 0.15 compatibility - self_scale_agents: @floatToInt → @as(usize, @intFromFloat(...)) - self_improving_v2: fixed syntax error (}; → }) - Removed unused parameters to avoid warnings All Cycle 48 specs now pass: - auto_healing: 8/8 tests ✓ - self_scale_agents: 8/8 tests ✓ - self_improving_v2: 10/10 tests ✓ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * feat(v8.21): AGENT MU — Full Autonomous Evolution + Production Deployment Phase 4-7: PAS Daemon + Docker/K8s + CI/CD New Files: - src/agent_mu/daemon/pas_daemon.zig (678 lines) - src/agent_mu/daemon/sacred_constants.zig (785 lines) - docker/Dockerfile.agent-mu (multi-stage build) - k8s/agent-mu-deployment.yaml (K8s deployment + HPA) - .github/workflows/agent-mu-deploy.yml (CI/CD pipeline) Features: - PAS Daemon with real-time WebSocket streaming - Auto-apply threshold: 95% confidence - Sacred confidence boost (φ-weighted) - Priority task queue (low/normal/high/critical) - Cross-agent validation (PAS + PHI + VIBEE) - 33 tests passing Production: - Multi-stage Docker build (Zig 0.15.0) - K8s Deployment with HPA (3-10 pods) - Security scanning (Trivy) - Staging + Production environments TECH_TREE.md: - Added AMU-001 through AMU-004 nodes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude Opus <claude@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent d2605fa commit 09c1aed

File tree

6 files changed

+1916
-0
lines changed

6 files changed

+1916
-0
lines changed
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# AGENT MU v8.21 - CI/CD Pipeline
2+
# Builds, tests, and deploys AGENT MU to production
3+
4+
name: AGENT MU - Build & Deploy
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- vibee-v*-production-swarm
11+
paths:
12+
- 'src/agent_mu/**'
13+
- 'docker/Dockerfile.agent-mu'
14+
- 'k8s/agent-mu-deployment.yaml'
15+
- '.github/workflows/agent-mu-deploy.yml'
16+
pull_request:
17+
branches:
18+
- main
19+
paths:
20+
- 'src/agent_mu/**'
21+
workflow_dispatch:
22+
inputs:
23+
version:
24+
description: 'Version tag (e.g., v8.21.0)'
25+
required: true
26+
default: 'v8.21.0'
27+
28+
env:
29+
REGISTRY: ghcr.io
30+
IMAGE_NAME: ghashtag/trinity/agent-mu
31+
32+
jobs:
33+
test:
34+
name: Test AGENT MU
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Install Zig
41+
uses: goto-bus-stop/setup-zig@v2
42+
with:
43+
version: 0.15.2
44+
45+
- name: Run Tests
46+
run: |
47+
zig test src/agent_mu/meta_learner.zig
48+
zig test src/agent_mu/comptime_optimizer.zig
49+
zig test src/agent_mu/runtime_pattern_manager.zig
50+
zig test src/agent_mu/predictive/markov_predictor.zig
51+
zig test src/agent_mu/predictive/monte_carlo.zig
52+
zig test src/agent_mu/evolution/checkpoint_manager.zig
53+
zig test src/agent_mu/daemon/pas_daemon.zig
54+
55+
- name: Build Test
56+
run: zig build -Drelease-fast=true
57+
58+
build:
59+
name: Build Docker Image
60+
needs: test
61+
runs-on: ubuntu-latest
62+
permissions:
63+
contents: read
64+
packages: write
65+
outputs:
66+
image-tag: ${{ steps.meta.outputs.tags }}
67+
image-digest: ${{ steps.build.outputs.digest }}
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
72+
- name: Set up Docker Buildx
73+
uses: docker/setup-buildx-action@v3
74+
75+
- name: Log in to Container Registry
76+
uses: docker/login-action@v3
77+
with:
78+
registry: ${{ env.REGISTRY }}
79+
username: ${{ github.actor }}
80+
password: ${{ secrets.GITHUB_TOKEN }}
81+
82+
- name: Extract metadata
83+
id: meta
84+
uses: docker/metadata-action@v5
85+
with:
86+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
87+
tags: |
88+
type=raw,value=${{ github.ref_name }},prefix=
89+
type=raw,value=latest,enable={{is_default_branch}}
90+
type=semver,pattern={{version}}
91+
type=sha,prefix={{branch}}-
92+
93+
- name: Build and push
94+
id: build
95+
uses: docker/build-push-action@v5
96+
with:
97+
context: .
98+
file: ./docker/Dockerfile.agent-mu
99+
push: true
100+
tags: ${{ steps.meta.outputs.tags }}
101+
labels: ${{ steps.meta.outputs.labels }}
102+
cache-from: type=gha
103+
cache-to: type=gha,mode=max
104+
platforms: linux/amd64,linux/arm64
105+
106+
security-scan:
107+
name: Security Scan
108+
needs: build
109+
runs-on: ubuntu-latest
110+
steps:
111+
- name: Run Trivy vulnerability scanner
112+
uses: aquasecurity/trivy-action@master
113+
with:
114+
image-ref: ${{ needs.build.outputs.image-tag }}
115+
format: 'sarif'
116+
output: 'trivy-results.sarif'
117+
severity: 'CRITICAL,HIGH'
118+
119+
- name: Upload Trivy results to GitHub Security
120+
uses: github/codeql-action/upload-sarif@v2
121+
if: always()
122+
with:
123+
sarif_file: 'trivy-results.sarif'
124+
125+
deploy-staging:
126+
name: Deploy to Staging
127+
needs: [build, security-scan]
128+
runs-on: ubuntu-latest
129+
if: github.ref != 'refs/heads/main'
130+
environment: staging
131+
steps:
132+
- name: Checkout
133+
uses: actions/checkout@v4
134+
135+
- name: Set up kubectl
136+
uses: azure/setup-kubectl@v3
137+
138+
- name: Configure kubectl
139+
run: |
140+
echo "${{ secrets.KUBE_CONFIG_STAGING }}" | base64 -d > kubeconfig
141+
export KUBECONFIG=kubeconfig
142+
143+
- name: Deploy to Kubernetes
144+
run: |
145+
export KUBECONFIG=kubeconfig
146+
kubectl set image deployment/agent-mu \
147+
agent-mu=${{ needs.build.outputs.image-tag }} \
148+
-n trinity-staging
149+
150+
- name: Verify deployment
151+
run: |
152+
export KUBECONFIG=kubeconfig
153+
kubectl rollout status deployment/agent-mu -n trinity-staging
154+
kubectl get pods -n trinity-staging -l app=agent-mu
155+
156+
deploy-production:
157+
name: Deploy to Production
158+
needs: [build, security-scan]
159+
runs-on: ubuntu-latest
160+
if: github.ref == 'refs/heads/main'
161+
environment: production
162+
steps:
163+
- name: Checkout
164+
uses: actions/checkout@v4
165+
166+
- name: Set up kubectl
167+
uses: azure/setup-kubectl@v3
168+
169+
- name: Configure kubectl
170+
run: |
171+
echo "${{ secrets.KUBE_CONFIG_PROD }}" | base64 -d > kubeconfig
172+
export KUBECONFIG=kubeconfig
173+
174+
- name: Deploy to Kubernetes
175+
run: |
176+
export KUBECONFIG=kubeconfig
177+
kubectl apply -f k8s/agent-mu-deployment.yaml
178+
179+
- name: Wait for rollout
180+
run: |
181+
export KUBECONFIG=kubeconfig
182+
kubectl rollout status deployment/agent-mu -n trinity --timeout=5m
183+
184+
- name: Verify deployment
185+
run: |
186+
export KUBECONFIG=kubeconfig
187+
kubectl get pods -n trinity -l app=agent-mu
188+
kubectl get svc -n trinity agent-mu
189+
190+
- name: Run smoke tests
191+
run: |
192+
export KUBECONFIG=kubeconfig
193+
POD=$(kubectl get pod -n trinity -l app=agent-mu -o jsonpath='{.items[0].metadata.name}')
194+
kubectl exec -n trinity $POD -- curl -f http://localhost:8080/health
195+
196+
notify:
197+
name: Notify Results
198+
needs: [test, build, security-scan]
199+
runs-on: ubuntu-latest
200+
if: always()
201+
steps:
202+
- name: Send notification
203+
run: |
204+
echo "Deployment status: ${{ job.status }}"
205+
# Add Slack/Discord/webhook notification here

.ralph/TECH_TREE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
## ✅ Recently Completed
2121
| ID | Name | Branch | Gain |
2222
|----|------|--------|------|
23+
|**AMU-004**|**AGENT MU v8.21 PAS Daemon**|**vibee-v8-production-swarm**|**PAS Daemon: pas_daemon.zig (678 lines) + sacred_constants.zig, 33 tests pass. WebSocket real-time streaming, auto-apply threshold 95%, sacred confidence boost, task queue with priority ordering. Docker + K8s + CI/CD pipeline.**|
24+
|**AMU-003**|**AGENT MU v8.21 Evolution Time Travel**|**vibee-v8-production-swarm**|**checkpoint_manager.zig (420 lines): Git-style evolution, branches, rollback to generation, 14 tests pass. History tracking with metadata, merge support.**|
25+
|**AMU-002**|**AGENT MU v8.21 Predictive Intelligence**|**vibee-v8-production-swarm**|**markov_predictor.zig (310 lines) + monte_carlo.zig (370 lines): Markov chain state transitions, Monte Carlo simulation with 95% CI, 33 total tests pass.**|
26+
|**AMU-001**|**AGENT MU v8.21 Meta-Learner**|**vibee-v8-production-swarm**|**meta_learner.zig + comptime_optimizer.zig + runtime_pattern_manager.zig: Cross-agent validation, φ-weighted consensus, compile-time optimization, 58 total tests pass.**|
27+
|----|------|--------|------|
2328
|**CODEGEN-009**|**VIBEE v8.1 Production Swarm**|**ralph/dev-003-swarm-watch**|**32-agent swarm: 51.59% consensus, 97.2% self-improve. Fixed: bundle-based hypervectors, similarity measurement, metric capping. 7/7 tests pass.**|
2429
|----|------|--------|------|
2530
|**CODEGEN-008**|**VIBEE v8 Production Swarm**|**ralph/dev-003-swarm-watch**|**32-agent Trinity swarm: runtime_swarm.zig (270 lines) + vsa_swarm_production_32.vibee (35 behaviors, 39/40 tests). Docker/K8s packaging, CI workflow, demo script. Runtime: 32/32 online, phi-spiral consensus, self-healing, Prometheus :9090.**|

docker/Dockerfile.agent-mu

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# AGENT MU v8.21 - Production Docker Image
2+
# Multi-stage build for minimal image size
3+
4+
FROM ziglang/zig:0.15.0 AS builder
5+
6+
WORKDIR /app
7+
8+
# Copy build files
9+
COPY build.zig ./
10+
COPY zig-cache ./
11+
COPY src ./src
12+
13+
# Build AGENT MU with release optimizations
14+
RUN zig build -Drelease-fast=true
15+
16+
# Production stage
17+
FROM ubuntu:22.04
18+
19+
# Install runtime dependencies
20+
RUN apt-get update && apt-get install -y \
21+
ca-certificates \
22+
libssl3 \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
# Copy built binary
26+
COPY --from=builder /app/zig-out/bin/agent-mu /usr/local/bin/
27+
28+
# Copy configuration
29+
COPY config/agent-mu.yaml /etc/agent-mu/config.yaml
30+
31+
# Expose ports
32+
# 8080 - HTTP API
33+
# 8081 - WebSocket
34+
# 9090 - Metrics
35+
EXPOSE 8080 8081 9090
36+
37+
# Health check
38+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
39+
CMD curl -f http://localhost:8080/health || exit 1
40+
41+
# Run AGENT MU daemon
42+
CMD ["agent-mu", "daemon", "--config", "/etc/agent-mu/config.yaml"]

0 commit comments

Comments
 (0)