everything-gemini 2.5.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/BENCHMARK.md +30 -30
  2. package/CHANGELOG.md +21 -0
  3. package/README.md +36 -2
  4. package/agents/cross-repo-orchestrator.md +33 -0
  5. package/agents/darwin-prompt-engineer.md +35 -0
  6. package/bin/everything-gemini +234 -9
  7. package/docs/LAUNCH_KIT_PHP2SHELL.md +240 -0
  8. package/docs/LAUNCH_KIT_v2.6.0.md +174 -0
  9. package/docs/index.html +27 -13
  10. package/examples/python-sdk/cross_repo_swarm_and_compaction.py +175 -0
  11. package/hooks/context-compactor/hooks.json +16 -0
  12. package/hooks/context-compactor/scripts/compact-context.sh +40 -0
  13. package/package.json +1 -1
  14. package/skills/adversarial-fuzz-generator/SKILL.md +95 -0
  15. package/skills/context-distillation-compressor/SKILL.md +109 -0
  16. package/skills/cross-repo-swarm-sync/SKILL.md +122 -0
  17. package/skills/cve-remediation-orchestrator/SKILL.md +111 -0
  18. package/skills/cve-remediation-orchestrator/scripts/verify-host-hardening.sh +72 -0
  19. package/skills/ebpf-microvm-sandbox/SKILL.md +113 -0
  20. package/skills/gemini-live-screen-vision/SKILL.md +109 -0
  21. package/skills/genetic-prompt-cross-pollinator/SKILL.md +110 -0
  22. package/skills/instinct-distillation-compiler/SKILL.md +103 -0
  23. package/skills/php2shell-version-auditor/SKILL.md +95 -0
  24. package/skills/phpcheck-server/SKILL.md +102 -0
  25. package/skills/phpcheck-server/scripts/audit-server.sh +112 -0
  26. package/skills/phpcheck-url/SKILL.md +72 -0
  27. package/skills/phpcheck-url/scripts/phpcheck.js +160 -0
  28. package/skills/speculative-decoding-orchestrator/SKILL.md +108 -0
  29. package/tests/cli.test.js +99 -16
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: cve-remediation-orchestrator
3
+ description: >-
4
+ Orchestrates defense-in-depth vulnerability remediation, virtual patching, kernel hardening, and service restart verification for critical CVEs without relying on exploit tools. Use when mitigating zero-days, evaluating container runtime isolation, or applying emergency WAF/gateway filters.
5
+ ---
6
+
7
+ # CVE Remediation & Hardening Orchestrator (`cve-remediation-orchestrator`)
8
+
9
+ An enterprise security skill that coordinates four-layer defensive mitigations for critical CVEs, neutralizing attack vectors at the architecture, kernel, and gateway levels without referencing or running exploit scripts.
10
+
11
+ ## Core Philosophy: Exploit-Agnostic Defense
12
+
13
+ Rather than tracking fragile or dangerous exploit PoCs, this skill enforces **architectural invariants** that render entire vulnerability classes inoperable:
14
+ 1. **Virtual Patching**: Block malformed stream headers and buffer boundary exploits at the API gateway or WAF before they reach the runtime.
15
+ 2. **Kernel & Host Hardening**: Enforce Full Address Space Layout Randomization (ASLR), Data Execution Prevention (DEP/NX), and strict Seccomp profiles to thwart memory exploitation primitives.
16
+ 3. **Container Confinement**: Apply read-only root filesystems and drop all Linux capabilities to prevent post-exploitation persistence.
17
+ 4. **Permanent Remediation**: Verify vendor package upgrades and ensure web worker daemons (`php-fpm`, `nginx`, `apache2`) are restarted so no stale vulnerable inodes remain mapped in RAM.
18
+
19
+ ---
20
+
21
+ ## Defense-in-Depth Architecture
22
+
23
+ ```mermaid
24
+ graph TD
25
+ CVE[Critical CVE / Zero-Day Disclosed] --> L1[Layer 1: Virtual Patching]
26
+ L1 --> L2[Layer 2: Kernel & ASLR Hardening]
27
+ L2 --> L3[Layer 3: Container Least Privilege]
28
+ L3 --> L4[Layer 4: Package Upgrade & Worker Restart]
29
+
30
+ L1 -->|Gateway Regex / Header Filter| Drop1[Blocked at Perimeter]
31
+ L2 -->|sysctl randomize_va_space=2| Drop2[Exploit Memory Layout Broken]
32
+ L3 -->|readOnlyRootFilesystem| Drop3[Payload Write Denied]
33
+ L4 -->|Clean Inodes in RAM| Secured[Verified Secure]
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Remediation Runbook
39
+
40
+ ### Layer 1: Ingress Virtual Patching (Envoy / WAF)
41
+ When official runtime packages cannot be deployed immediately, apply an edge filter to drop malicious header boundaries:
42
+
43
+ ```yaml
44
+ # Envoy Gateway Filter Example
45
+ apiVersion: gateway.envoyproxy.io/v1alpha1
46
+ kind: EnvoyFilter
47
+ metadata:
48
+ name: drop-malformed-boundaries
49
+ spec:
50
+ configPatches:
51
+ - applyTo: HTTP_FILTER
52
+ match:
53
+ context: SIDECAR_INBOUND
54
+ patch:
55
+ operation: INSERT_BEFORE
56
+ value:
57
+ name: envoy.filters.http.lua
58
+ typed_config:
59
+ "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua
60
+ inlineCode: |
61
+ function envoy_on_request(handle)
62
+ local content_type = handle:headers():get("content-type")
63
+ if content_type and string.find(content_type, "boundary=.*[\r\n\x00]") then
64
+ handle:respond({[":status"] = "400"}, "Malformed stream boundary rejected.")
65
+ end
66
+ end
67
+ ```
68
+
69
+ ### Layer 2: Host & Kernel ASLR Hardening
70
+ Ensure the host operating system enforces strict memory space randomization:
71
+
72
+ ```bash
73
+ # Verify kernel ASLR level (2 = Full ASLR)
74
+ cat /proc/sys/kernel/randomize_va_space
75
+
76
+ # Enforce Full ASLR permanently
77
+ sudo sysctl -w kernel.randomize_va_space=2
78
+ echo "kernel.randomize_va_space = 2" | sudo tee -a /etc/sysctl.d/99-aslr-hardening.conf
79
+ ```
80
+
81
+ ### Layer 3: Container Runtime Confinement
82
+ Harden Kubernetes deployment manifests against shellcode execution and disk persistence:
83
+
84
+ ```yaml
85
+ securityContext:
86
+ allowPrivilegeEscalation: false
87
+ readOnlyRootFilesystem: true
88
+ runAsNonRoot: true
89
+ runAsUser: 10001
90
+ capabilities:
91
+ drop:
92
+ - ALL
93
+ ```
94
+
95
+ ### Layer 4: Permanent Patching & Worker Daemon Restart
96
+ Verify that running worker processes are executing the upgraded package:
97
+
98
+ ```bash
99
+ # Run automated defense verification
100
+ bash skills/cve-remediation-orchestrator/scripts/verify-host-hardening.sh
101
+
102
+ # Verify no running workers hold unlinked deleted executables
103
+ ls -l /proc/*/exe 2>/dev/null | grep '(deleted)'
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Related Skills
109
+ - [phpcheck-server](file:///Users/salmanshaikh/development/github/everything-gemini/skills/phpcheck-server/SKILL.md) - Deep server and package backport auditor.
110
+ - [security-audit](file:///Users/salmanshaikh/development/github/everything-gemini/skills/security-audit/SKILL.md) - General code, dependency, and vulnerability analysis.
111
+ - [envoy-ai-gateway](file:///Users/salmanshaikh/development/github/everything-gemini/skills/envoy-ai-gateway/SKILL.md) - Production AI gateway routing, rate limiting, and virtual patching.
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Host Hardening & Defense-in-Depth Verification Script
4
+ # Verifies kernel ASLR, container capability constraints, and unlinked worker inodes in RAM.
5
+
6
+ set -eo pipefail
7
+
8
+ JSON_MODE=false
9
+ if [[ "$1" == "--json" ]]; then
10
+ JSON_MODE=true
11
+ fi
12
+
13
+ # 1. Check Kernel ASLR
14
+ ASLR_LEVEL="unknown"
15
+ ASLR_STATUS="unknown"
16
+ if [ -f /proc/sys/kernel/randomize_va_space ]; then
17
+ ASLR_LEVEL="$(cat /proc/sys/kernel/randomize_va_space)"
18
+ if [ "$ASLR_LEVEL" -eq 2 ]; then
19
+ ASLR_STATUS="hardened" # Full ASLR (stack, VDSO, mmap, brk)
20
+ elif [ "$ASLR_LEVEL" -eq 1 ]; then
21
+ ASLR_STATUS="partial" # Partial ASLR
22
+ else
23
+ ASLR_STATUS="disabled" # Disabled ASLR (High Risk!)
24
+ fi
25
+ elif command -v sysctl >/dev/null 2>&1; then
26
+ ASLR_VAL="$(sysctl -n vm.aslr 2>/dev/null || echo "unknown")"
27
+ if [ "$ASLR_VAL" != "unknown" ]; then
28
+ ASLR_LEVEL="$ASLR_VAL"
29
+ ASLR_STATUS="active"
30
+ else
31
+ ASLR_STATUS="unsupported_platform"
32
+ fi
33
+ fi
34
+
35
+ # 2. Check for unlinked/deleted running binaries (Stale worker trap)
36
+ STALE_WORKERS_COUNT=0
37
+ if [ -d /proc ]; then
38
+ STALE_WORKERS_COUNT="$(ls -l /proc/*/exe 2>/dev/null | grep -c '(deleted)' || true)"
39
+ fi
40
+
41
+ # 3. Overall Verdict
42
+ VERDICT="pass"
43
+ if [ "$ASLR_STATUS" = "disabled" ] || [ "$STALE_WORKERS_COUNT" -gt 0 ]; then
44
+ VERDICT="warn"
45
+ fi
46
+
47
+ if [ "$JSON_MODE" = true ]; then
48
+ cat <<EOF
49
+ {
50
+ "defense_in_depth_verdict": "$VERDICT",
51
+ "kernel_aslr": {
52
+ "level": "$ASLR_LEVEL",
53
+ "status": "$ASLR_STATUS"
54
+ },
55
+ "stale_memory_workers_detected": $STALE_WORKERS_COUNT
56
+ }
57
+ EOF
58
+ else
59
+ echo "🛡️ Host Hardening & Defense-in-Depth Verification"
60
+ echo "================================================"
61
+ echo "Kernel ASLR Status: $ASLR_STATUS (level: $ASLR_LEVEL)"
62
+ echo "Stale Memory Workers: $STALE_WORKERS_COUNT deleted process handles"
63
+ if [ "$STALE_WORKERS_COUNT" -gt 0 ]; then
64
+ echo "⚠️ Warning: Daemons were updated on disk but not restarted in RAM."
65
+ fi
66
+ fi
67
+
68
+ if [ "$VERDICT" = "pass" ]; then
69
+ exit 0
70
+ else
71
+ exit 1
72
+ fi
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: ebpf-microvm-sandbox
3
+ description: Enforces rootless ephemeral Micro-VM isolation, Linux Landlock filesystem jails, and Cilium eBPF network filtering for zero-trust speculative tool and code execution.
4
+ ---
5
+
6
+ # eBPF Micro-VM Sandbox (`ebpf-microvm-sandbox`)
7
+
8
+ Provides kernel-enforced rootless ephemeral Micro-VM isolation (Firecracker and gVisor), Linux Landlock path jails, seccomp-bpf syscall filtering, and Cilium eBPF network security for untrusted, speculative tool execution in Google Antigravity and Gemini agent loops.
9
+
10
+ ---
11
+
12
+ ## 1. Architectural Model: Kernel-Enforced Isolation Hierarchy
13
+
14
+ ```
15
+ ┌─────────────────────────────────────────────────────────────────────────────┐
16
+ │ ZERO-TRUST AGENT SANDBOX RUNTIME │
17
+ │ │
18
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
19
+ │ │ 1. Antigravity Agent Runtime (Host Process) │ │
20
+ │ │ • Speculative tool proposal (e.g. `run_command`, `eval_python`) │ │
21
+ │ │ • Intercepted by PreToolUse Lifecycle Security Hook │ │
22
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
23
+ │ │ │
24
+ │ ▼ │
25
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
26
+ │ │ 2. OPA Policy Gatekeeper & Sandbox Dispatcher │ │
27
+ │ │ • Validates command safety signature and environment constraints │ │
28
+ │ │ • Allocates ephemeral rootless micro-VM workspace │ │
29
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
30
+ │ │ │
31
+ │ ▼ │
32
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
33
+ │ │ 3. Ephemeral Micro-VM Jail (Firecracker / gVisor runsc) │ │
34
+ │ │ ┌────────────────────────────────────────────────────────────┐ │ │
35
+ │ │ │ A. Filesystem: Linux Landlock V4 ephemeral copy-on-write │ │ │
36
+ │ │ │ • Host files outside sandbox mounted READ-ONLY │ │ │
37
+ │ │ │ • Temp workdir deleted on tool completion │ │ │
38
+ │ │ ├────────────────────────────────────────────────────────────┤ │ │
39
+ │ │ │ B. Syscalls: Strict Seccomp-BPF whitelist filter │ │ │
40
+ │ │ │ • Blocks ptrace, mount, bpf, reboot, setuid, unshare │ │ │
41
+ │ │ ├────────────────────────────────────────────────────────────┤ │ │
42
+ │ │ │ C. Network: Cilium eBPF Socket Filtering & Egress Policy │ │ │
43
+ │ │ │ • Strict CIDR whitelist (e.g. npmjs, pypi, googleapis) │ │ │
44
+ │ │ │ • Blocks RFC 1918 internal subnets & cloud metadata IPs │ │ │
45
+ │ │ └────────────────────────────────────────────────────────────┘ │ │
46
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
47
+ │ │ │
48
+ │ ▼ │
49
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
50
+ │ │ 4. Execution Telemetry & Differential Sync │ │
51
+ │ │ • Captured stdout, stderr, exit code, and modified file diffs │ │
52
+ │ │ • Automatic rollback on policy violation or timeout abort │ │
53
+ │ └─────────────────────────────────────────────────────────────────────┘ │
54
+ └─────────────────────────────────────────────────────────────────────────────┘
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 2. Kernel Security Primitives
60
+
61
+ ### A. Linux Landlock V4 Path Rules
62
+ - Speculative tools receive scoped path access:
63
+ - `LANDLOCK_ACCESS_FS_READ`: Allowed on workspace root.
64
+ - `LANDLOCK_ACCESS_FS_WRITE`: Confined strictly to `/tmp/agent-sandbox/<execution-id>`.
65
+ - Sensitive paths (`~/.ssh`, `~/.aws`, `~/.config/gcloud`, `/etc/shadow`) are masked with empty dummy inodes.
66
+
67
+ ### B. Seccomp-BPF Syscall Restriction
68
+ - The sandbox enforces an allow-list BPF program at `execve`:
69
+ ```text
70
+ ALLOWED: read, write, openat, close, fstat, lseek, mmap, mprotect, munmap, brk, exit_group
71
+ DENIED (SIGKILL): ptrace, process_vm_readv, init_module, kexec_load, bpf, clone(NEWUSER)
72
+ ```
73
+
74
+ ### C. Cilium eBPF Network Quarantine
75
+ - Egress is strictly blocked to Cloud Metadata Endpoints:
76
+ - `169.254.169.254/32` (AWS/GCP Instance Metadata Service)
77
+ - `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16` (Internal LAN)
78
+ - Only TLS port 443 egress to explicit DNS-validated dependency endpoints is permitted.
79
+
80
+ ---
81
+
82
+ ## 3. Operational Recipes
83
+
84
+ ### Launching an Isolated Speculative Command
85
+ ```bash
86
+ # Verify sandbox status and host kernel security primitives
87
+ everything-gemini doctor --profile full
88
+
89
+ # Run speculative untrusted build in micro-VM jail
90
+ everything-gemini resilience inject --target "speculative-build" --sandbox microvm
91
+ ```
92
+
93
+ ### Landlock Python Runner Pattern
94
+ ```python
95
+ from google_antigravity.security import EphemeralMicroVMSandbox
96
+
97
+ with EphemeralMicroVMSandbox(
98
+ memory_mb=512,
99
+ cpu_limit=1.0,
100
+ allow_network=False,
101
+ timeout_sec=30
102
+ ) as sandbox:
103
+ result = sandbox.exec(["python3", "-c", "import os; print(os.listdir('.'))"])
104
+ print(f"Sandbox Exit Code: {result.exit_code}")
105
+ print(f"Sandbox Output: {result.stdout}")
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 4. Cross-Reference & Links
111
+ - See [skills/ebpf-sandbox-enforcer/SKILL.md](file:///Users/salmanshaikh/development/github/everything-gemini/skills/ebpf-sandbox-enforcer/SKILL.md) for Landlock baseline rules.
112
+ - See [skills/opa-gatekeeper-policy/SKILL.md](file:///Users/salmanshaikh/development/github/everything-gemini/skills/opa-gatekeeper-policy/SKILL.md) for OPA policy syntax.
113
+ - See [agents/security-auditor.md](file:///Users/salmanshaikh/development/github/everything-gemini/agents/security-auditor.md) for automated vulnerability auditing.
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: gemini-live-screen-vision
3
+ description: Streams high-framerate desktop/browser screen frames, analyzes visual DOM repaints, and extracts terminal OCR errors for live multimodal voice/visual pair programming with Gemini Live.
4
+ ---
5
+
6
+ # Gemini Live Screen Vision & Repaint Analyzer (`gemini-live-screen-vision`)
7
+
8
+ Integrates real-time desktop screen capture, browser DOM repaint diffing, terminal OCR error extraction, and synchronized audio-visual feedback loops directly with the Gemini 3.8 Live API for sub-second multimodal pair programming.
9
+
10
+ ---
11
+
12
+ ## 1. Architectural Model: Multimodal Video & Voice Duplex
13
+
14
+ ```
15
+ ┌─────────────────────────────────────────────────────────────────────────────┐
16
+ │ GEMINI LIVE SCREEN VISION STREAMING RUNTIME │
17
+ │ │
18
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
19
+ │ │ 1. Client Screen & IDE Capture Engine │ │
20
+ │ │ • 1080p @ 30–60fps WebRTC screen track or periodic JPEG stream │ │
21
+ │ │ • Active viewport region extraction (Browser canvas, Terminal) │ │
22
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
23
+ │ │ │
24
+ │ ▼ │
25
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
26
+ │ │ 2. Visual Repaint Diff & Change Detector │ │
27
+ │ │ • Pixel-level perceptual hash (pHash) & structural similarity │ │
28
+ │ │ • Filters static frames; transmits only on repaint transitions │ │
29
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
30
+ │ │ │
31
+ │ ▼ │
32
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
33
+ │ │ 3. Gemini Live Bidirectional WebSocket Gateway │ │
34
+ │ │ ┌───────────────────────────┐ ┌──────────────────────────┐ │ │
35
+ │ │ │ Video Inbound: VP9/H.264 │ │ Audio Duplex: Opus 24kHz │ │ │
36
+ │ │ │ (DOM renders, stack traces│ │ (Real-time voice pairs) │ │ │
37
+ │ │ └─────────────┬─────────────┘ └────────────┬─────────────┘ │ │
38
+ │ └──────────────────┼────────────────────────────────┼─────────────────┘ │
39
+ │ └────────────────┬───────────────┘ │
40
+ │ ▼ │
41
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
42
+ │ │ 4. Multimodal Cognitive Fusion Engine │ │
43
+ │ │ • Correlates developer speech ("why is the button misaligned?") │ │
44
+ │ │ with exact visual bounding box coordinates on active screen │ │
45
+ │ │ • Emits proactive vocal guidance before test failures compound │ │
46
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
47
+ │ │ │
48
+ │ ▼ │
49
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
50
+ │ │ 5. Surgical IDE Code Patching │ │
51
+ │ │ • Proposes atomic diffs directly to IDE active editor buffer │ │
52
+ │ └─────────────────────────────────────────────────────────────────────┘ │
53
+ └─────────────────────────────────────────────────────────────────────────────┘
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 2. Streaming Primitives & Frame Optimization
59
+
60
+ ### A. Perceptual Diff Filter (pHash)
61
+ Streaming raw 60fps 1080p video incurs excessive bandwidth and token consumption. The vision engine computes frame-to-frame hamming distance:
62
+ - $\Delta(\text{Frame}_t, \text{Frame}_{t-1}) < 5$: Static screen; transmission bypassed.
63
+ - $\Delta \ge 5$: Visual transition (e.g. page repaint, terminal scroll); frame emitted to Gemini Live.
64
+
65
+ ### B. High-Precision Bounding Box Grounding
66
+ When Gemini Live detects UI layout anomalies, it outputs normalized coordinate bounding boxes $[y_{\min}, x_{\min}, y_{\max}, x_{\max}]$:
67
+ ```json
68
+ {
69
+ "anomaly": "CSS Flexbox Overflow in Hero Title",
70
+ "bounding_box": [120, 450, 240, 890],
71
+ "recommendation": "Set flex-wrap: wrap on #hero-container"
72
+ }
73
+ ```
74
+
75
+ ---
76
+
77
+ ## 3. Operational Recipes
78
+
79
+ ### Launching Live Screen Vision Session via CLI
80
+ ```bash
81
+ # Start live screen streaming bridge to Gemini Live API
82
+ everything-gemini live-vision stream --fps 15 --resolution 1080p
83
+
84
+ # Capture single-frame visual diagnostic of active IDE
85
+ everything-gemini live-vision capture --workspace . --json
86
+ ```
87
+
88
+ ### Python SDK Multimodal Screen Session
89
+ ```python
90
+ from google_antigravity.live import GeminiLiveVisionSession
91
+
92
+ session = GeminiLiveVisionSession(
93
+ model="gemini-3.8-live",
94
+ audio_format="opus",
95
+ video_fps=15,
96
+ enable_vad=True
97
+ )
98
+
99
+ # Attach desktop window display capture
100
+ session.attach_display_stream(display_id=1)
101
+ session.start_bidirectional_loop()
102
+ ```
103
+
104
+ ---
105
+
106
+ ## 4. Cross-Reference Links
107
+ - See [skills/gemini-live-multimodal/SKILL.md](file:///Users/salmanshaikh/development/github/everything-gemini/skills/gemini-live-multimodal/SKILL.md) for core WebSocket protocols.
108
+ - See [skills/webrtc-agent-gateway/SKILL.md](file:///Users/salmanshaikh/development/github/everything-gemini/skills/webrtc-agent-gateway/SKILL.md) for WebRTC ICE negotiation.
109
+ - See [agents/browser-qa.md](file:///Users/salmanshaikh/development/github/everything-gemini/agents/browser-qa.md) for automated visual QA assertions.
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: genetic-prompt-cross-pollinator
3
+ description: Optimizes agent prompt surfaces and subagent contracts through multi-generation tournament selection, genetic crossover, and Pareto-frontier fitness evaluation.
4
+ ---
5
+
6
+ # Genetic Prompt Cross-Pollinator (`genetic-prompt-cross-pollinator`)
7
+
8
+ Implements Harness³ autonomous agentic Darwinism: applying evolutionary algorithms, multi-generation tournament selection, genetic crossover of prompt surfaces, and Pareto-frontier fitness evaluation to recursively discover optimal agent prompts without altering base model weights.
9
+
10
+ ---
11
+
12
+ ## 1. Evolutionary Architecture: Genetic Prompt Recombination
13
+
14
+ ```
15
+ ┌─────────────────────────────────────────────────────────────────────────────┐
16
+ │ GENETIC PROMPT CROSS-POLLINATION PIPELINE │
17
+ │ │
18
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
19
+ │ │ 1. Seed Population Generation ($N=8$ Harness Candidates) │ │
20
+ │ │ • Baseline prompts from `.agents/`, `rules/`, and `skills/` │ │
21
+ │ │ • Stochastic prompt perturbations across 8 harness surfaces │ │
22
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
23
+ │ │ │
24
+ │ ▼ │
25
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
26
+ │ │ 2. Tournament Selection ($K=3$ Candidates per Bracket) │ │
27
+ │ │ • Multi-task probe evaluation on local test suite │ │
28
+ │ │ • Fitness function: $F = \frac{\text{PassRate} \times \text{Resilience}}{\text{Tokens} \times \text{Latency}}$ │
29
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
30
+ │ │ │
31
+ │ ▼ │
32
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
33
+ │ │ 3. Genetic Crossover & Semantic Recombination │ │
34
+ │ │ ┌───────────────────────────┐ ┌──────────────────────────┐ │ │
35
+ │ │ │ Parent A: High Accuracy │ │ Parent B: Low Token Burn │ │ │
36
+ │ │ │ (Deep reasoning guidance) │ │ (Concise AST formatting) │ │ │
37
+ │ │ └─────────────┬─────────────┘ └────────────┬─────────────┘ │ │
38
+ │ └──────────────────┼────────────────────────────────┼─────────────────┘ │
39
+ │ └────────────────┬───────────────┘ │
40
+ │ ▼ │
41
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
42
+ │ │ 4. Mutation & Adversarial Validation │ │
43
+ │ │ • Mutation Rate: $P_m = 0.15$ (Synonym swap, bullet compaction) │ │
44
+ │ │ • Adversarial fuzz verification against prompt regression probes │ │
45
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
46
+ │ │ │
47
+ │ ▼ │
48
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
49
+ │ │ 5. Pareto Frontier Composition & Master Deployment │ │
50
+ │ │ • Selects non-dominated solutions balancing cost vs accuracy │ │
51
+ │ │ • Commits winning harness phenotype to `.agents/` repository │ │
52
+ │ └─────────────────────────────────────────────────────────────────────┘ │
53
+ └─────────────────────────────────────────────────────────────────────────────┘
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 2. Core Mathematical Formalism
59
+
60
+ ### A. Multi-Objective Fitness Metric ($F$)
61
+ Every candidate harness configuration $h_i$ is evaluated against an empirical test suite:
62
+ $$F(h_i) = w_1 \cdot \text{Accuracy}(h_i) + w_2 \cdot \text{Resilience}(h_i) - w_3 \cdot \log(\text{Tokens}(h_i)) - w_4 \cdot \text{Latency}(h_i)$$
63
+
64
+ Where:
65
+ - $\text{Accuracy} \in [0, 1]$: Unit and integration test pass percentage.
66
+ - $\text{Resilience} \in [0, 1]$: Survival rate under fault injection (Harness³ mutation testing).
67
+ - $\text{Tokens}$: Cumulative prompt and output token consumption.
68
+ - Weights $w = [0.45, 0.35, 0.10, 0.10]$ prioritizing correctness and stability.
69
+
70
+ ### B. Genetic Operators
71
+ 1. **Uniform Crossover**: Selects prompt sections (role instructions, tool guidelines, format envelopes) randomly from winning parent pairs.
72
+ 2. **Point Mutation**: Mutates prompt temperature, thinking token caps, and few-shot examples.
73
+ 3. **Elitism**: Top 10% highest-scoring harnesses pass unaltered into the next generation.
74
+
75
+ ---
76
+
77
+ ## 3. Operational Recipes
78
+
79
+ ### Running Genetic Evolution via CLI
80
+ ```bash
81
+ # Evolve prompt surfaces across 5 generations with tournament selection
82
+ everything-gemini genetic evolve --generations 5 --population 8 --max-usd 2.50
83
+
84
+ # Inspect Pareto frontier trade-offs between cost and accuracy
85
+ everything-gemini genetic pareto --workspace .
86
+ ```
87
+
88
+ ### Python SDK Integration Blueprint
89
+ ```python
90
+ from google_antigravity.darwin import GeneticPromptOptimizer
91
+
92
+ optimizer = GeneticPromptOptimizer(
93
+ target_skill="skills/cross-repo-swarm-sync/SKILL.md",
94
+ population_size=8,
95
+ generations=4,
96
+ tournament_k=3,
97
+ model="gemini-3.8-thinking"
98
+ )
99
+
100
+ winning_harness = optimizer.run_evolution()
101
+ print(f"Optimal Fitness Score: {winning_harness.fitness_score:.4f}")
102
+ winning_harness.commit_to_workspace()
103
+ ```
104
+
105
+ ---
106
+
107
+ ## 4. Cross-Reference Links
108
+ - See [skills/harness3-mutation-testing/SKILL.md](file:///Users/salmanshaikh/development/github/everything-gemini/skills/harness3-mutation-testing/SKILL.md) for adversarial fault injection.
109
+ - See [agents/darwin-prompt-engineer.md](file:///Users/salmanshaikh/development/github/everything-gemini/agents/darwin-prompt-engineer.md) for evolutionary subagent operations.
110
+ - See [ROADMAP_AGI_v3.0.md](file:///Users/salmanshaikh/development/github/everything-gemini/ROADMAP_AGI_v3.0.md) for the Harness³ Darwinian roadmap.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: instinct-distillation-compiler
3
+ description: Compiles resolved edge cases, runtime exceptions, and developer corrections into enduring behavioral instinct rules without manual intervention.
4
+ ---
5
+
6
+ # Learned Instinct Distillation & Rule Compiler (`instinct-distillation-compiler`)
7
+
8
+ Continuously extracts, deduplicates, and compiles resolved edge cases, runtime stack traces, and developer feedback into persistent behavioral instinct rules within `.agents/hooks/learned-instincts/` to guarantee that errors resolved once are never repeated in future sessions.
9
+
10
+ ---
11
+
12
+ ## 1. Architectural Pipeline: Automated Instinct Distillation
13
+
14
+ ```
15
+ ┌─────────────────────────────────────────────────────────────────────────────┐
16
+ │ INSTINCT DISTILLATION & COMPILER PIPELINE │
17
+ │ │
18
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
19
+ │ │ 1. Trajectory Exception & Correction Harvester │ │
20
+ │ │ • Listens to PostToolUse failures and subsequent recovery turns │ │
21
+ │ │ • Captures developer corrections: "do not use X; use Y instead" │ │
22
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
23
+ │ │ │
24
+ │ ▼ │
25
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
26
+ │ │ 2. Semantic Distillation & Invariant Synthesis │ │
27
+ │ │ • Strips ephemeral data (timestamps, temporary file paths) │ │
28
+ │ │ • Generalizes root cause: "When invoking tool T, ensure schema S"│ │
29
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
30
+ │ │ │
31
+ │ ▼ │
32
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
33
+ │ │ 3. Deduplication & Conflict Resolution Engine │ │
34
+ │ │ • Compares candidate rule against existing `.agents/rules/` │ │
35
+ │ │ • Semantic vector embedding match: if cosine similarity > 0.88, │ │
36
+ │ │ refines existing rule instead of appending duplicate │ │
37
+ │ └──────────────────────────────────┬──────────────────────────────────┘ │
38
+ │ │ │
39
+ │ ▼ │
40
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
41
+ │ │ 4. Deterministic Rule Compiler & Commit │ │
42
+ │ │ • Formats valid markdown rule with clear triggers & constraints │ │
43
+ │ │ • Appends to `.agents/hooks/learned-instincts/rules/<topic>.md` │ │
44
+ │ └─────────────────────────────────────────────────────────────────────┘ │
45
+ └─────────────────────────────────────────────────────────────────────────────┘
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 2. Rule Structure & Compilation Grammar
51
+
52
+ Compiled instinct rules strictly adhere to a standardized 3-part layout:
53
+ ```markdown
54
+ # Instinct: [Descriptive Title]
55
+ **Trigger Context**: [When the agent performs X on Y]
56
+ **Observed Failure**: [Stack trace / root cause description]
57
+ **Mandatory Invariant**:
58
+ - DO: Always verify condition C before execution.
59
+ - NEVER: Never invoke tool T with unvalidated parameter P.
60
+ ```
61
+
62
+ ### Example Compiled Rule:
63
+ ```markdown
64
+ # Instinct: Safe BigQuery Partition Filtering
65
+ **Trigger Context**: Running SQL queries against analytics tables with `run_command` (bq query).
66
+ **Observed Failure**: Query failed due to missing partition filter scanning entire 10TB table.
67
+ **Mandatory Invariant**:
68
+ - DO: Always include `WHERE DATE(_PARTITIONTIME) >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)`.
69
+ - NEVER: Never run unrestricted `SELECT *` without explicit `LIMIT` and partition bounds.
70
+ ```
71
+
72
+ ---
73
+
74
+ ## 3. Operational Recipes
75
+
76
+ ### Triggering Instinct Compilation via CLI
77
+ ```bash
78
+ # Review active learned instincts
79
+ everything-gemini status --json | jq .instincts
80
+
81
+ # Audit instinct repository and compile pending lessons
82
+ everything-gemini audit --workspace .
83
+ ```
84
+
85
+ ### Python SDK Instinct Ingestion
86
+ ```python
87
+ from google_antigravity.learning import InstinctDistiller
88
+
89
+ distiller = InstinctDistiller(workspace_root=".")
90
+ distiller.distill_correction(
91
+ trigger="npm test failed with missing module 'uuid'",
92
+ fix="Run npm install uuid --save-dev before running test suites",
93
+ category="dependency_hygiene"
94
+ )
95
+ distiller.commit_rules()
96
+ ```
97
+
98
+ ---
99
+
100
+ ## 4. Cross-Reference Links
101
+ - See [skills/continuous-learning/SKILL.md](file:///Users/salmanshaikh/development/github/everything-gemini/skills/continuous-learning/SKILL.md) for session learning protocols.
102
+ - See [hooks/learned-instincts/hooks.json](file:///Users/salmanshaikh/development/github/everything-gemini/hooks/learned-instincts/hooks.json) for the active instinct lifecycle hook.
103
+ - See [agents/documentation-writer.md](file:///Users/salmanshaikh/development/github/everything-gemini/agents/documentation-writer.md) for rule curation standards.