Initial commit: Claude Code config and K8s agent orchestrator design
- Add .gitignore for logs, caches, credentials, and history - Add K8s agent orchestrator design document - Include existing Claude Code settings and plugin configs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
37
.gitignore
vendored
Normal file
37
.gitignore
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
# Logs
|
||||
logs/
|
||||
|
||||
# Secrets and credentials
|
||||
*.key
|
||||
*.pem
|
||||
*.secret
|
||||
credentials/
|
||||
.credentials.json
|
||||
|
||||
# Cache and state
|
||||
.cache/
|
||||
stats-cache.json
|
||||
statsig/
|
||||
|
||||
# History and debug
|
||||
history.jsonl
|
||||
file-history/
|
||||
shell-snapshots/
|
||||
debug/
|
||||
|
||||
# Plugin caches (contain embedded git repos)
|
||||
plugins/cache/
|
||||
plugins/marketplaces/
|
||||
|
||||
# Local settings
|
||||
settings.local.json
|
||||
|
||||
# Conversation history (private/large)
|
||||
projects/
|
||||
|
||||
# Temporary files
|
||||
*.tmp
|
||||
*.swp
|
||||
|
||||
# Todos (managed by Claude Code)
|
||||
todos/
|
||||
85
docs/plans/2025-12-26-agent-orchestrator-brainstorm.md
Normal file
85
docs/plans/2025-12-26-agent-orchestrator-brainstorm.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# Agent Orchestrator System - Brainstorming Notes
|
||||
|
||||
## Overview
|
||||
User-level Claude Code agent system with orchestrator + specialized subagents + workflows.
|
||||
Location: `~/.claude/`
|
||||
|
||||
## Target Domains (for future expansion)
|
||||
- **A) DevOps/Infrastructure** - PRIMARY - Raspberry Pi K8s cluster management
|
||||
- B) Software development - Code generation, refactoring, testing
|
||||
- C) Research & analysis - Information gathering, summarizing
|
||||
- D) Personal productivity - Files, notes, tasks, schedules
|
||||
- E) Multi-domain - General-purpose tasks
|
||||
|
||||
## Primary Use Case
|
||||
- Raspberry Pi Kubernetes cluster management
|
||||
- App deployment to the cluster
|
||||
- K8s distribution: **k0s**
|
||||
- Deployment method: **GitOps with ArgoCD**
|
||||
|
||||
## Cluster Hardware
|
||||
| Node | Hardware | RAM | Role |
|
||||
|------|----------|-----|------|
|
||||
| Node 1 | Raspberry Pi 5 | 8GB | Control plane + Worker |
|
||||
| Node 2 | Raspberry Pi 5 | 8GB | Worker |
|
||||
| Node 3 | Raspberry Pi 3B+ | 1GB | Worker (tainted, tolerations required) |
|
||||
|
||||
**Pi 3 node**: Reserved for lightweight workloads only. Good candidate for dashboard deployment.
|
||||
**Architecture**: All nodes run arm64 (64-bit OS).
|
||||
|
||||
## Workloads
|
||||
- Self-hosted services (home automation, media, personal tools)
|
||||
- Development/testing environments
|
||||
- Infrastructure services (monitoring, logging, databases)
|
||||
|
||||
## Agent Tasks (priority order)
|
||||
1. **Cluster health monitoring** - Detect issues, diagnose, suggest/apply fixes (TOP PRIORITY)
|
||||
2. Deployment management - Create/update deployments, ArgoCD sync, rollbacks
|
||||
3. Resource management - Scaling, allocation, cleanup
|
||||
4. App lifecycle - End-to-end "I want to run X" to deployed
|
||||
5. Incident response - Alerting, investigation, remediation
|
||||
|
||||
## Autonomy Model
|
||||
- **Tiered autonomy**: Safe actions auto-apply, risky actions require confirmation
|
||||
- Safe: restart pod, scale replicas, clear completed jobs
|
||||
- Risky: delete PVC, modify configs, node operations
|
||||
|
||||
## Interaction Methods
|
||||
- **Terminal/CLI** - Primary interaction via Claude Code (also fallback when cluster is down)
|
||||
- **Dashboard/UI** - Web interface deployed on cluster via ArgoCD
|
||||
- **Push notifications** - Future consideration (Discord/Slack/Telegram)
|
||||
|
||||
## Infrastructure Stack
|
||||
- Monitoring: **Prometheus + Alertmanager + Grafana**
|
||||
- GitOps repo: **Self-hosted Gitea/Forgejo**
|
||||
- Workflow triggers: **Scheduled + Event-driven (Alertmanager webhooks)**
|
||||
|
||||
## Implementation Approach
|
||||
**Phase 1**: Claude Code skills + custom subagent types in `~/.claude/`
|
||||
**Phase 2 (later)**: Add SDK-based daemon for background automation
|
||||
|
||||
## Subagents
|
||||
1. **k8s-diagnostician** - Cluster health, pod/node status, resource utilization, log analysis
|
||||
2. **argocd-operator** - App sync, deployments, rollbacks, GitOps operations
|
||||
3. **prometheus-analyst** - Query metrics, analyze trends, interpret alerts
|
||||
4. **git-operator** - Commit manifests, create PRs in Gitea, manage GitOps repo
|
||||
|
||||
## Workflow Definitions
|
||||
- **YAML** - Complex workflows with branching, conditions, multi-step
|
||||
- **Markdown** - Simple workflows, prose-like descriptions
|
||||
|
||||
## CLI Tools Available
|
||||
- kubectl
|
||||
- argocd CLI
|
||||
- k0sctl
|
||||
|
||||
## Model Assignment
|
||||
- **Default**: Orchestrator = Opus, Subagents = Sonnet
|
||||
- **Override levels**:
|
||||
1. Per-workflow: specify model in workflow YAML
|
||||
2. Per-step: specify model for individual workflow steps
|
||||
3. Dynamic: Orchestrator can downgrade/upgrade model per-delegation based on task complexity
|
||||
- **Cost optimization**: Orchestrator evaluates task complexity and selects appropriate model
|
||||
- Simple queries (get status, list) → Haiku
|
||||
- Standard operations (analyze, diagnose) → Sonnet
|
||||
- Complex reasoning (root cause, multi-factor decisions) → Opus
|
||||
482
docs/plans/2025-12-26-k8s-agent-orchestrator-design.md
Normal file
482
docs/plans/2025-12-26-k8s-agent-orchestrator-design.md
Normal file
@@ -0,0 +1,482 @@
|
||||
# K8s Agent Orchestrator System - Design Document
|
||||
|
||||
## Overview
|
||||
|
||||
A user-level Claude Code agent system for autonomous Kubernetes cluster management. The system consists of an orchestrator agent that delegates to specialized subagents, with workflow definitions for common operations and a tiered autonomy model.
|
||||
|
||||
**Location**: `~/.claude/`
|
||||
**Primary Domain**: DevOps/Infrastructure
|
||||
**Target**: Raspberry Pi k0s cluster
|
||||
|
||||
---
|
||||
|
||||
## Cluster Environment
|
||||
|
||||
### Hardware
|
||||
|
||||
| Node | Hardware | RAM | Role |
|
||||
|------|----------|-----|------|
|
||||
| Node 1 | Raspberry Pi 5 | 8GB | Control plane + Worker |
|
||||
| Node 2 | Raspberry Pi 5 | 8GB | Worker |
|
||||
| Node 3 | Raspberry Pi 3B+ | 1GB | Worker (tainted, tolerations required) |
|
||||
|
||||
- **Architecture**: All nodes run arm64 (64-bit OS)
|
||||
- **Pi 3 node**: Reserved for lightweight workloads only
|
||||
|
||||
### Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| K8s Distribution | k0s |
|
||||
| GitOps | ArgoCD |
|
||||
| Git Hosting | Self-hosted Gitea/Forgejo |
|
||||
| Monitoring | Prometheus + Alertmanager + Grafana |
|
||||
|
||||
### CLI Tools Available
|
||||
|
||||
- `kubectl`
|
||||
- `argocd`
|
||||
- `k0sctl`
|
||||
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
### Three-Layer Design
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ User Interface │
|
||||
│ Terminal (CLI) | Dashboard (Web) │
|
||||
└─────────────────────┬───────────────────┬───────────────────┘
|
||||
│ │
|
||||
┌─────────────────────▼───────────────────▼───────────────────┐
|
||||
│ Orchestrator Layer │
|
||||
│ k8s-orchestrator │
|
||||
│ (Opus - complex reasoning, task delegation) │
|
||||
└─────────────────────┬───────────────────────────────────────┘
|
||||
│ delegates to
|
||||
┌─────────────────────▼───────────────────────────────────────┐
|
||||
│ Specialist Layer │
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────┐│
|
||||
│ │k8s- │ │argocd- │ │prometheus- │ │git- ││
|
||||
│ │diagnostician│ │operator │ │analyst │ │operator ││
|
||||
│ │(Sonnet) │ │(Sonnet) │ │(Sonnet) │ │(Sonnet) ││
|
||||
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────┘│
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
│ defined by
|
||||
┌─────────────────────▼───────────────────────────────────────┐
|
||||
│ Workflow Layer │
|
||||
│ YAML (complex) | Markdown (simple) │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
~/.claude/
|
||||
├── settings.json # Agent definitions, autonomy rules
|
||||
├── agents/
|
||||
│ ├── k8s-orchestrator.md # Orchestrator prompt
|
||||
│ ├── k8s-diagnostician.md # Cluster diagnostics specialist
|
||||
│ ├── argocd-operator.md # GitOps operations specialist
|
||||
│ ├── prometheus-analyst.md # Metrics analysis specialist
|
||||
│ └── git-operator.md # Git/Gitea operations specialist
|
||||
├── workflows/
|
||||
│ ├── health/
|
||||
│ │ ├── cluster-health-check.yaml
|
||||
│ │ └── node-pressure-response.yaml
|
||||
│ ├── deploy/
|
||||
│ │ ├── deploy-app.md
|
||||
│ │ └── rollback-app.yaml
|
||||
│ └── incidents/
|
||||
│ └── pod-crashloop.yaml
|
||||
├── skills/
|
||||
│ ├── cluster-status.md
|
||||
│ ├── deploy.md
|
||||
│ ├── diagnose.md
|
||||
│ ├── rollback.md
|
||||
│ └── workflow.md
|
||||
├── logs/
|
||||
│ ├── actions/ # Action audit trail
|
||||
│ └── workflows/ # Workflow execution logs
|
||||
└── docs/plans/
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Subagent Definitions
|
||||
|
||||
### settings.json
|
||||
|
||||
```json
|
||||
{
|
||||
"agents": {
|
||||
"k8s-orchestrator": {
|
||||
"model": "opus",
|
||||
"promptFile": "agents/k8s-orchestrator.md"
|
||||
},
|
||||
"k8s-diagnostician": {
|
||||
"model": "sonnet",
|
||||
"promptFile": "agents/k8s-diagnostician.md"
|
||||
},
|
||||
"argocd-operator": {
|
||||
"model": "sonnet",
|
||||
"promptFile": "agents/argocd-operator.md"
|
||||
},
|
||||
"prometheus-analyst": {
|
||||
"model": "sonnet",
|
||||
"promptFile": "agents/prometheus-analyst.md"
|
||||
},
|
||||
"git-operator": {
|
||||
"model": "sonnet",
|
||||
"promptFile": "agents/git-operator.md"
|
||||
}
|
||||
},
|
||||
"autonomy": {
|
||||
"safe_actions": ["get", "describe", "logs", "list", "top", "diff"],
|
||||
"confirm_actions": ["delete", "patch", "edit", "scale", "rollout", "apply"],
|
||||
"forbidden_actions": ["drain", "cordon", "delete node", "reset"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Subagent Responsibilities
|
||||
|
||||
| Agent | Scope | Tools |
|
||||
|-------|-------|-------|
|
||||
| **k8s-orchestrator** | Task analysis, delegation, decision making | All (via delegation) |
|
||||
| **k8s-diagnostician** | Cluster health, pod/node status, logs | kubectl, log tools |
|
||||
| **argocd-operator** | App sync, deployments, rollbacks | argocd CLI, kubectl |
|
||||
| **prometheus-analyst** | Metrics, alerts, trends | PromQL, Prometheus API |
|
||||
| **git-operator** | Manifest commits, PRs, GitOps repo | git, Gitea API |
|
||||
|
||||
---
|
||||
|
||||
## Model Assignment
|
||||
|
||||
### Defaults
|
||||
|
||||
- **Orchestrator**: Opus (complex reasoning, task delegation)
|
||||
- **Subagents**: Sonnet (standard operations)
|
||||
|
||||
### Override Levels
|
||||
|
||||
1. **Per-workflow**: Specify in workflow YAML
|
||||
2. **Per-step**: Specify for individual workflow steps
|
||||
3. **Dynamic**: Orchestrator selects based on task complexity
|
||||
|
||||
### Dynamic Model Selection (Orchestrator Logic)
|
||||
|
||||
| Task Complexity | Model | Examples |
|
||||
|-----------------|-------|----------|
|
||||
| Simple | Haiku | Get status, list resources, log tail |
|
||||
| Standard | Sonnet | Analyze logs, diagnose issues, sync apps |
|
||||
| Complex | Opus | Root cause analysis, cascading failures, trade-off decisions |
|
||||
|
||||
**Delegation syntax:**
|
||||
```markdown
|
||||
Delegate to k8s-diagnostician (haiku):
|
||||
Task: Get current node status
|
||||
|
||||
Delegate to prometheus-analyst (sonnet):
|
||||
Task: Analyze memory trends for namespace "prod" over last 24h
|
||||
|
||||
Delegate to k8s-diagnostician (opus):
|
||||
Task: Investigate cascading failure across multiple services
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Workflow Definitions
|
||||
|
||||
### YAML Workflows (Complex)
|
||||
|
||||
```yaml
|
||||
name: cluster-health-check
|
||||
description: Comprehensive cluster health assessment
|
||||
model: sonnet # optional default override
|
||||
trigger:
|
||||
- schedule: "0 */6 * * *" # every 6 hours
|
||||
- manual: true
|
||||
|
||||
steps:
|
||||
- agent: k8s-diagnostician
|
||||
model: haiku # simple status check
|
||||
task: Check node status and resource pressure
|
||||
|
||||
- agent: prometheus-analyst
|
||||
task: Query for anomalies in last 6 hours
|
||||
|
||||
- agent: argocd-operator
|
||||
model: haiku
|
||||
task: Check all apps sync status
|
||||
|
||||
- agent: k8s-orchestrator
|
||||
task: Summarize findings and recommend actions
|
||||
confirm_if: actions_proposed
|
||||
```
|
||||
|
||||
### Markdown Workflows (Simple)
|
||||
|
||||
```markdown
|
||||
# Deploy New App
|
||||
|
||||
When asked to deploy a new application:
|
||||
|
||||
1. Ask git-operator to create the manifest structure in the GitOps repo
|
||||
2. Ask argocd-operator to create and sync the ArgoCD application
|
||||
3. Ask k8s-diagnostician to verify pods are running
|
||||
4. Report deployment status
|
||||
```
|
||||
|
||||
### Incident Response Workflow Example
|
||||
|
||||
```yaml
|
||||
name: pod-crashloop-remediation
|
||||
trigger:
|
||||
type: alert
|
||||
match:
|
||||
alertname: KubePodCrashLooping
|
||||
|
||||
steps:
|
||||
- name: diagnose
|
||||
agent: k8s-diagnostician
|
||||
action: get-pod-status
|
||||
inputs:
|
||||
namespace: "{{ alert.labels.namespace }}"
|
||||
pod: "{{ alert.labels.pod }}"
|
||||
|
||||
- name: check-logs
|
||||
agent: k8s-diagnostician
|
||||
action: analyze-logs
|
||||
inputs:
|
||||
pod: "{{ steps.diagnose.pod }}"
|
||||
lines: 100
|
||||
|
||||
- name: decide-action
|
||||
condition: "{{ steps.check-logs.cause == 'oom' }}"
|
||||
branches:
|
||||
true:
|
||||
agent: argocd-operator
|
||||
action: update-resources
|
||||
confirm: true # risky action
|
||||
false:
|
||||
agent: k8s-diagnostician
|
||||
action: restart-pod
|
||||
confirm: false # safe action
|
||||
|
||||
- name: notify
|
||||
action: report
|
||||
outputs:
|
||||
- summary
|
||||
- actions-taken
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Autonomy Model
|
||||
|
||||
### Tiered Autonomy
|
||||
|
||||
| Action Type | Behavior | Examples |
|
||||
|-------------|----------|----------|
|
||||
| **Safe** | Auto-execute, log action | get, describe, logs, list, restart pod |
|
||||
| **Confirm** | Require user approval | delete, patch, scale, apply, modify config |
|
||||
| **Forbidden** | Reject with explanation | drain, cordon, delete node |
|
||||
|
||||
### Confirmation Flow
|
||||
|
||||
```
|
||||
1. Agent proposes action with rationale
|
||||
2. System checks action against autonomy rules
|
||||
3. If safe → execute immediately, log action
|
||||
4. If confirm → present to user (CLI prompt or dashboard queue)
|
||||
5. If forbidden → reject with explanation
|
||||
```
|
||||
|
||||
### Per-Workflow Overrides
|
||||
|
||||
```yaml
|
||||
name: emergency-pod-restart
|
||||
autonomy:
|
||||
auto_approve:
|
||||
- restart_pod
|
||||
- scale_replicas
|
||||
always_confirm:
|
||||
- delete_pvc
|
||||
```
|
||||
|
||||
### Action Logging
|
||||
|
||||
```
|
||||
~/.claude/logs/actions/2025-12-26-actions.jsonl
|
||||
```
|
||||
|
||||
Each entry includes:
|
||||
- Timestamp
|
||||
- Agent
|
||||
- Action
|
||||
- Inputs
|
||||
- Outcome
|
||||
- Approval type (auto/user-confirmed)
|
||||
|
||||
---
|
||||
|
||||
## Skills (User Entry Points)
|
||||
|
||||
| Skill | Command | Purpose |
|
||||
|-------|---------|---------|
|
||||
| cluster-status | `/cluster-status` | Quick health overview |
|
||||
| deploy | `/deploy <app>` | Deploy or update an app |
|
||||
| diagnose | `/diagnose <issue>` | Investigate a problem |
|
||||
| rollback | `/rollback <app>` | Revert to previous version |
|
||||
| workflow | `/workflow <name>` | Run a named workflow |
|
||||
|
||||
### Example Skill: cluster-status.md
|
||||
|
||||
```markdown
|
||||
# Cluster Status
|
||||
|
||||
Invoke the k8s-orchestrator to provide a quick health overview.
|
||||
|
||||
## Steps
|
||||
1. Delegate to k8s-diagnostician: get node status
|
||||
2. Delegate to prometheus-analyst: check for active alerts
|
||||
3. Delegate to argocd-operator: list out-of-sync apps
|
||||
4. Summarize in a concise table
|
||||
|
||||
## Output Format
|
||||
- Node health: table
|
||||
- Active alerts: bullet list
|
||||
- ArgoCD status: table
|
||||
- Recommendations: if any issues found
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Interaction Methods
|
||||
|
||||
### Terminal/CLI
|
||||
|
||||
- Primary interaction via Claude Code
|
||||
- Fallback when cluster is unavailable
|
||||
- Use skills to invoke workflows
|
||||
|
||||
### Dashboard (Web UI)
|
||||
|
||||
- Deployed on cluster (Pi 3 node)
|
||||
- Views: Status, Pending Confirmations, History, Workflows
|
||||
- Approve/reject risky actions
|
||||
|
||||
### Push Notifications (Future)
|
||||
|
||||
- Discord, Slack, or Telegram integration
|
||||
- Alert on issues requiring attention
|
||||
|
||||
---
|
||||
|
||||
## Dashboard Specification
|
||||
|
||||
### Tech Stack
|
||||
|
||||
- **Backend**: Go binary (single static binary, embedded assets)
|
||||
- **Storage**: SQLite or flat JSON files
|
||||
- **Resources**: Minimal footprint for Pi 3
|
||||
|
||||
### Deployment
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: k8s-agent-dashboard
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: dashboard
|
||||
image: k8s-agent-dashboard:latest
|
||||
resources:
|
||||
requests:
|
||||
memory: "32Mi"
|
||||
cpu: "10m"
|
||||
limits:
|
||||
memory: "64Mi"
|
||||
cpu: "100m"
|
||||
tolerations:
|
||||
- key: "node-type"
|
||||
operator: "Equal"
|
||||
value: "pi3"
|
||||
effect: "NoSchedule"
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: arm64
|
||||
```
|
||||
|
||||
### Views
|
||||
|
||||
| View | Description |
|
||||
|------|-------------|
|
||||
| Status | Current cluster health, active alerts, ArgoCD sync state |
|
||||
| Pending | Actions awaiting confirmation with approve/reject buttons |
|
||||
| History | Recent actions taken, filterable by agent/workflow |
|
||||
| Workflows | List of defined workflows, manual trigger capability |
|
||||
|
||||
---
|
||||
|
||||
## Implementation Phases
|
||||
|
||||
### Phase 1: Core Agent System
|
||||
|
||||
**Deliverables:**
|
||||
- `~/.claude/` directory structure
|
||||
- Orchestrator and 4 subagent prompt files
|
||||
- `settings.json` with agent configurations
|
||||
- 3-4 essential workflows (cluster-health, deploy, diagnose)
|
||||
- Core skills (/cluster-status, /deploy, /diagnose)
|
||||
|
||||
**Validation:**
|
||||
- Manual CLI invocation
|
||||
- Test each subagent independently
|
||||
- Run health check workflow end-to-end
|
||||
|
||||
### Phase 2: Dashboard
|
||||
|
||||
**Deliverables:**
|
||||
- Go-based dashboard application
|
||||
- Kubernetes manifests for Pi 3 deployment
|
||||
- Pending confirmations queue
|
||||
- Action history view
|
||||
- Approval flow integration
|
||||
|
||||
### Phase 3: Automation
|
||||
|
||||
**Deliverables:**
|
||||
- Scheduled workflow execution
|
||||
- Alertmanager webhook integration
|
||||
- Expanded incident response workflows
|
||||
|
||||
### Phase 4: Expansion (Future)
|
||||
|
||||
**Potential additions:**
|
||||
- Push notifications (Discord/Telegram)
|
||||
- Additional domains (development, research, productivity)
|
||||
- SDK-based background daemon for true autonomy
|
||||
|
||||
---
|
||||
|
||||
## Future Domain Expansion
|
||||
|
||||
The system is designed to expand beyond DevOps:
|
||||
|
||||
| Domain | Use Cases |
|
||||
|--------|-----------|
|
||||
| Software Development | Code generation, refactoring, testing across repos |
|
||||
| Research & Analysis | Information gathering, summarizing, recommendations |
|
||||
| Personal Productivity | File management, notes, task tracking |
|
||||
|
||||
New domains would add:
|
||||
- Additional subagents with specialized prompts
|
||||
- Domain-specific workflows
|
||||
- New skills for user invocation
|
||||
142
plans/cosmic-frolicking-compass.md
Normal file
142
plans/cosmic-frolicking-compass.md
Normal file
@@ -0,0 +1,142 @@
|
||||
# Plan: Fix Zed Slow Launch and Performance on Hyprland
|
||||
|
||||
## Problem Analysis
|
||||
|
||||
**Original Request:** Compile Zed with OpenGL support instead of Vulkan for Intel HD Graphics 4000
|
||||
|
||||
**Actual Issue Discovered:** Zed is using X11/XWayland instead of native Wayland on Hyprland, causing:
|
||||
- 15+ second launch times
|
||||
- Sluggish runtime performance
|
||||
- The hardware (Intel HD Graphics 4000) is properly supported and works fine on Gnome
|
||||
|
||||
**System Information:**
|
||||
- Binary: `/usr/lib/zed/zed-editor` (Arch package v0.213.4-1)
|
||||
- Command: `zeditor`
|
||||
- Hyprland version: 0.52.1
|
||||
- Mesa version: 25.2.7-arch1.1
|
||||
- Environment: Both `WAYLAND_DISPLAY=wayland-1` and `DISPLAY=:1` are set
|
||||
|
||||
**Evidence from logs** (`~/.local/share/zed/logs/Zed.log`):
|
||||
```
|
||||
2025-12-12T22:12:02-08:00 INFO [gpui::platform::linux::x11::window] Using Visual { id: 112, colormap: 0, depth: 32 }
|
||||
2025-12-12T22:12:02-08:00 INFO [gpui::platform::linux::x11::window] x11: no compositor present, falling back to server-side window decorations
|
||||
2025-12-12T22:12:02-08:00 ERROR [gpui::platform::linux::x11::client] XIMClientError: Can't read xim message: Invalid Data ErrorCode: 0
|
||||
```
|
||||
|
||||
## Root Cause
|
||||
|
||||
**Mystery Identified:** Despite both environment variables being correctly set (`WAYLAND_DISPLAY=wayland-1` and `DISPLAY=:1`), Zed is still choosing X11.
|
||||
|
||||
Based on the code in `crates/gpui/src/platform.rs` (lines 139-164), Zed should prioritize Wayland when `WAYLAND_DISPLAY` is set. The fact that it's using X11 despite this suggests:
|
||||
|
||||
**Most Likely:** The Arch package (v0.213.4-1) was compiled **without the `wayland` Cargo feature enabled**, causing the binary to only support X11 even when Wayland is available.
|
||||
|
||||
This is supported by:
|
||||
- The platform selection code has `#[cfg(feature = "wayland")]` guards
|
||||
- If Wayland feature is disabled at compile time, `guess_compositor()` will always return "X11"
|
||||
- A similar issue was documented in Arch forums ([thread](https://bbs.archlinux.org/viewtopic.php?id=299290))
|
||||
|
||||
## Recommended Solution
|
||||
|
||||
**Compile Zed from source with Wayland support enabled.** The Arch package appears to lack Wayland support at compile time.
|
||||
|
||||
### Step 1: Build Zed with Wayland Support
|
||||
|
||||
From the repository root (`/home/will/repo/zed`):
|
||||
|
||||
```bash
|
||||
# Clean any previous builds (optional)
|
||||
cargo clean
|
||||
|
||||
# Build with Wayland feature explicitly enabled
|
||||
cargo build --release --features gpui/wayland
|
||||
|
||||
# Or build the full zed binary with default features (which includes wayland)
|
||||
cargo build --release -p zed
|
||||
```
|
||||
|
||||
**Build time estimate:** 20-40 minutes on first build (depending on CPU)
|
||||
|
||||
### Step 2: Install the Binary
|
||||
|
||||
```bash
|
||||
# Create installation directory if needed
|
||||
mkdir -p ~/.local/bin
|
||||
|
||||
# Copy the binary
|
||||
cp target/release/zed ~/.local/bin/zed-wayland
|
||||
|
||||
# Or replace the system zeditor
|
||||
sudo cp target/release/zed /usr/local/bin/zeditor
|
||||
```
|
||||
|
||||
### Step 3: Verify Wayland Support
|
||||
|
||||
```bash
|
||||
# Launch and check logs
|
||||
~/.local/bin/zed-wayland
|
||||
grep -E "wayland|x11" ~/.local/share/zed/logs/Zed.log | tail -5
|
||||
```
|
||||
|
||||
Expected output should show Wayland initialization, NOT X11 messages.
|
||||
|
||||
## Alternative: Install from AUR or Use Different Package
|
||||
|
||||
If you don't want to compile from source, consider:
|
||||
|
||||
1. **Install `zed-git` from AUR** (may have Wayland support):
|
||||
```bash
|
||||
paru -S zed-git # or yay -S zed-git
|
||||
```
|
||||
|
||||
2. **File a bug report with Arch** to request Wayland support in the official package
|
||||
|
||||
3. **Wait for official Arch package update** to include Wayland support
|
||||
|
||||
## Why NOT OpenGL/GLES?
|
||||
|
||||
The original request was to compile with OpenGL instead of Vulkan. **This is unnecessary** because:
|
||||
- Your Intel HD Graphics 4000 supports Vulkan (working fine on Gnome)
|
||||
- The slowness is from X11/XWayland overhead, NOT the graphics backend
|
||||
- Mesa drivers are properly installed (Vulkan, OpenGL 4.2, OpenGL ES 3.0 all working)
|
||||
- Switching to GLES won't fix the X11 vs Wayland issue
|
||||
|
||||
**GLES compilation would only be needed if:**
|
||||
- Vulkan completely fails (`vkcube` doesn't work)
|
||||
- Zed shows "NoSupportedDeviceFound" error
|
||||
- You get GPU-related crashes
|
||||
|
||||
## Expected Outcome
|
||||
|
||||
After compiling with Wayland support and running the new binary:
|
||||
- **Launch time:** Should match Gnome performance (~2 seconds)
|
||||
- **Runtime performance:** Smooth, no sluggishness
|
||||
- **Logs:** Will show Wayland client initialization instead of X11
|
||||
|
||||
## Build Requirements
|
||||
|
||||
The system already has all necessary dependencies:
|
||||
- Rust toolchain (rustup)
|
||||
- Wayland development libraries (installed)
|
||||
- Build tools (gcc, clang, cmake, etc.)
|
||||
- Vulkan and Mesa drivers (working)
|
||||
|
||||
From `crates/gpui/Cargo.toml` (lines 40-59), the `wayland` feature depends on:
|
||||
- `wayland-client`, `wayland-cursor`, `wayland-protocols` (all available on Arch)
|
||||
- `blade-graphics` (already in use for Vulkan)
|
||||
- Font libraries (cosmic-text, font-kit) - already installed
|
||||
|
||||
## Critical Files for Reference
|
||||
|
||||
- `crates/gpui/Cargo.toml:20` - Default features include "wayland" and "x11"
|
||||
- `crates/gpui/Cargo.toml:40-59` - Wayland feature dependencies
|
||||
- `crates/gpui/src/platform.rs:101-164` - Platform selection logic
|
||||
- `crates/gpui/src/platform/linux/wayland/client.rs` - Wayland client implementation
|
||||
- `crates/gpui/src/platform/linux/x11/client.rs` - X11 client implementation
|
||||
|
||||
## Implementation Steps
|
||||
|
||||
1. **Build from source** with Wayland support (20-40 min)
|
||||
2. **Install the binary** to ~/.local/bin or /usr/local/bin
|
||||
3. **Test launch** and verify Wayland is being used via logs
|
||||
4. **Confirm performance** matches Gnome experience
|
||||
108
plans/elegant-prancing-allen.md
Normal file
108
plans/elegant-prancing-allen.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# Vulkan Installation Verification Plan
|
||||
|
||||
## Goal
|
||||
Verify that Vulkan is correctly installed and functional on the system, and determine whether the Mesa warning about incomplete Ivy Bridge support is a concern.
|
||||
|
||||
## Background Context
|
||||
|
||||
**Hardware**: Intel HD Graphics 4000 (Ivy Bridge) - circa 2012
|
||||
**Current Status**:
|
||||
- Vulkan 1.4.328 is installed
|
||||
- `vulkaninfo` runs successfully
|
||||
- Mesa driver shows warning: "MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete"
|
||||
- Zed editor launches successfully despite the warning
|
||||
|
||||
## Understanding the Warning
|
||||
|
||||
The "Ivy Bridge Vulkan support is incomplete" warning is **expected behavior** for your hardware:
|
||||
|
||||
1. **Why it appears**: Intel HD Graphics 4000 is a 3rd-generation (Ivy Bridge) GPU from 2012, before Vulkan was standardized
|
||||
2. **What it means**: Mesa provides best-effort Vulkan support through a compatibility layer, but not all Vulkan features are hardware-accelerated
|
||||
3. **Is it a problem?**: Generally no - applications will either:
|
||||
- Use the incomplete Vulkan support (works for most tasks)
|
||||
- Fall back to OpenGL automatically
|
||||
- Use the software renderer (llvmpipe) as a last resort
|
||||
|
||||
## Verification Approach
|
||||
|
||||
### Step 1: Verify Vulkan Device Detection ✅
|
||||
Diagnostic results confirm:
|
||||
- ✅ Vulkan loader is installed (`vulkaninfo` successful)
|
||||
- ✅ GPU is detected (Intel HD Graphics 4000 IVB GT2)
|
||||
- ✅ Both hardware and software renderers available:
|
||||
- Hardware: Intel HD Graphics 4000 (using intel_icd.x86_64.json)
|
||||
- Software fallback: llvmpipe (LLVM 21.1.5, 256 bits)
|
||||
- ✅ Vulkan ICD files present:
|
||||
- intel_icd.x86_64.json (for Ivy Bridge/Broadwell)
|
||||
- intel_hasvk_icd.x86_64.json (for Haswell+)
|
||||
- lvp_icd.x86_64.json (lavapipe software renderer)
|
||||
- nouveau_icd.x86_64.json (Nouveau open-source driver)
|
||||
- nvidia_icd.json (NVIDIA proprietary driver)
|
||||
|
||||
### Step 2: Test Vulkan Functionality
|
||||
Run simple Vulkan test applications to verify:
|
||||
- Basic rendering works
|
||||
- Applications can create Vulkan instances and devices
|
||||
- The warning doesn't prevent normal operation
|
||||
|
||||
Commands to run:
|
||||
```bash
|
||||
# Verify Vulkan ICD (Installable Client Driver) files
|
||||
ls -la /usr/share/vulkan/icd.d/
|
||||
|
||||
# Check which Vulkan layers are available
|
||||
vulkaninfo --summary | grep -A 5 "Layer"
|
||||
|
||||
# Test with a simple Vulkan application (if vkcube is installed)
|
||||
vkcube || echo "vkcube not installed, will try alternative"
|
||||
|
||||
# Check if Zed can actually use Vulkan
|
||||
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/intel_icd.x86_64.json /usr/lib/zed/zed-editor --version
|
||||
```
|
||||
|
||||
### Step 3: Verify Mesa Driver Status
|
||||
Confirm Mesa drivers are up to date:
|
||||
```bash
|
||||
# Check Mesa version
|
||||
glxinfo | grep "OpenGL version"
|
||||
|
||||
# Verify Intel driver is loaded
|
||||
lsmod | grep i915
|
||||
|
||||
# Check Vulkan driver info
|
||||
vulkaninfo | grep -A 10 "GPU id.*Intel"
|
||||
```
|
||||
|
||||
### Step 4: Document Findings
|
||||
|
||||
Create a summary report showing:
|
||||
1. Vulkan is installed: ✅ (version 1.4.328)
|
||||
2. GPU is detected: ✅ (Intel HD Graphics 4000 + llvmpipe fallback)
|
||||
3. Warning is expected: ✅ (Ivy Bridge has incomplete Vulkan support by design)
|
||||
4. Applications work: ✅/❌ (to be verified)
|
||||
|
||||
## Expected Outcome
|
||||
|
||||
**Vulkan is correctly installed** if:
|
||||
- `vulkaninfo` runs without errors (✅ confirmed)
|
||||
- At least one Vulkan device is available (✅ Intel HD 4000 + llvmpipe)
|
||||
- Applications launch and run (✅ Zed editor works)
|
||||
|
||||
**The warning is harmless** because:
|
||||
- It's informational, not an error
|
||||
- Applications handle this gracefully by:
|
||||
- Using available Vulkan features
|
||||
- Falling back to OpenGL/software rendering
|
||||
- Automatically selecting the best available renderer
|
||||
|
||||
## Recommendations
|
||||
|
||||
1. **No action needed** - Vulkan is working as well as it can on Ivy Bridge hardware
|
||||
2. **Optional**: Set environment variable to suppress the warning if it's annoying:
|
||||
```bash
|
||||
export INTEL_DEBUG=nowarn
|
||||
```
|
||||
3. **Optional**: For better graphics performance, consider using OpenGL mode in applications when available (Ivy Bridge's OpenGL support is more mature than Vulkan)
|
||||
|
||||
## Files to Review
|
||||
None - this is a system-level verification task, not a code modification.
|
||||
186
plugins/install-counts-cache.json
Normal file
186
plugins/install-counts-cache.json
Normal file
@@ -0,0 +1,186 @@
|
||||
{
|
||||
"version": 1,
|
||||
"fetchedAt": "2025-12-26T18:14:58.883Z",
|
||||
"counts": [
|
||||
{
|
||||
"plugin": "context7@claude-plugins-official",
|
||||
"unique_installs": 42693
|
||||
},
|
||||
{
|
||||
"plugin": "frontend-design@claude-plugins-official",
|
||||
"unique_installs": 42607
|
||||
},
|
||||
{
|
||||
"plugin": "github@claude-plugins-official",
|
||||
"unique_installs": 24946
|
||||
},
|
||||
{
|
||||
"plugin": "serena@claude-plugins-official",
|
||||
"unique_installs": 24069
|
||||
},
|
||||
{
|
||||
"plugin": "feature-dev@claude-plugins-official",
|
||||
"unique_installs": 21182
|
||||
},
|
||||
{
|
||||
"plugin": "code-review@claude-plugins-official",
|
||||
"unique_installs": 18350
|
||||
},
|
||||
{
|
||||
"plugin": "commit-commands@claude-plugins-official",
|
||||
"unique_installs": 14203
|
||||
},
|
||||
{
|
||||
"plugin": "atlassian@claude-plugins-official",
|
||||
"unique_installs": 13865
|
||||
},
|
||||
{
|
||||
"plugin": "supabase@claude-plugins-official",
|
||||
"unique_installs": 13573
|
||||
},
|
||||
{
|
||||
"plugin": "security-guidance@claude-plugins-official",
|
||||
"unique_installs": 11942
|
||||
},
|
||||
{
|
||||
"plugin": "agent-sdk-dev@claude-plugins-official",
|
||||
"unique_installs": 10940
|
||||
},
|
||||
{
|
||||
"plugin": "figma@claude-plugins-official",
|
||||
"unique_installs": 10505
|
||||
},
|
||||
{
|
||||
"plugin": "pr-review-toolkit@claude-plugins-official",
|
||||
"unique_installs": 10481
|
||||
},
|
||||
{
|
||||
"plugin": "playwright@claude-plugins-official",
|
||||
"unique_installs": 8098
|
||||
},
|
||||
{
|
||||
"plugin": "Notion@claude-plugins-official",
|
||||
"unique_installs": 6541
|
||||
},
|
||||
{
|
||||
"plugin": "explanatory-output-style@claude-plugins-official",
|
||||
"unique_installs": 6504
|
||||
},
|
||||
{
|
||||
"plugin": "typescript-lsp@claude-plugins-official",
|
||||
"unique_installs": 6463
|
||||
},
|
||||
{
|
||||
"plugin": "ralph-wiggum@claude-plugins-official",
|
||||
"unique_installs": 5526
|
||||
},
|
||||
{
|
||||
"plugin": "linear@claude-plugins-official",
|
||||
"unique_installs": 5384
|
||||
},
|
||||
{
|
||||
"plugin": "plugin-dev@claude-plugins-official",
|
||||
"unique_installs": 5202
|
||||
},
|
||||
{
|
||||
"plugin": "laravel-boost@claude-plugins-official",
|
||||
"unique_installs": 5100
|
||||
},
|
||||
{
|
||||
"plugin": "hookify@claude-plugins-official",
|
||||
"unique_installs": 4831
|
||||
},
|
||||
{
|
||||
"plugin": "learning-output-style@claude-plugins-official",
|
||||
"unique_installs": 4567
|
||||
},
|
||||
{
|
||||
"plugin": "sentry@claude-plugins-official",
|
||||
"unique_installs": 4012
|
||||
},
|
||||
{
|
||||
"plugin": "greptile@claude-plugins-official",
|
||||
"unique_installs": 3812
|
||||
},
|
||||
{
|
||||
"plugin": "pyright-lsp@claude-plugins-official",
|
||||
"unique_installs": 3413
|
||||
},
|
||||
{
|
||||
"plugin": "gitlab@claude-plugins-official",
|
||||
"unique_installs": 3280
|
||||
},
|
||||
{
|
||||
"plugin": "slack@claude-plugins-official",
|
||||
"unique_installs": 3153
|
||||
},
|
||||
{
|
||||
"plugin": "vercel@claude-plugins-official",
|
||||
"unique_installs": 2748
|
||||
},
|
||||
{
|
||||
"plugin": "gopls-lsp@claude-plugins-official",
|
||||
"unique_installs": 1539
|
||||
},
|
||||
{
|
||||
"plugin": "firebase@claude-plugins-official",
|
||||
"unique_installs": 1379
|
||||
},
|
||||
{
|
||||
"plugin": "rust-analyzer-lsp@claude-plugins-official",
|
||||
"unique_installs": 1264
|
||||
},
|
||||
{
|
||||
"plugin": "csharp-lsp@claude-plugins-official",
|
||||
"unique_installs": 1138
|
||||
},
|
||||
{
|
||||
"plugin": "php-lsp@claude-plugins-official",
|
||||
"unique_installs": 1031
|
||||
},
|
||||
{
|
||||
"plugin": "stripe@claude-plugins-official",
|
||||
"unique_installs": 999
|
||||
},
|
||||
{
|
||||
"plugin": "swift-lsp@claude-plugins-official",
|
||||
"unique_installs": 942
|
||||
},
|
||||
{
|
||||
"plugin": "jdtls-lsp@claude-plugins-official",
|
||||
"unique_installs": 911
|
||||
},
|
||||
{
|
||||
"plugin": "clangd-lsp@claude-plugins-official",
|
||||
"unique_installs": 880
|
||||
},
|
||||
{
|
||||
"plugin": "asana@claude-plugins-official",
|
||||
"unique_installs": 712
|
||||
},
|
||||
{
|
||||
"plugin": "lua-lsp@claude-plugins-official",
|
||||
"unique_installs": 500
|
||||
},
|
||||
{
|
||||
"plugin": "figma-mcp@claude-plugins-official",
|
||||
"unique_installs": 90
|
||||
},
|
||||
{
|
||||
"plugin": "example-plugin@claude-plugins-official",
|
||||
"unique_installs": 29
|
||||
},
|
||||
{
|
||||
"plugin": "typescript-native-lsp@claude-plugins-official",
|
||||
"unique_installs": 1
|
||||
},
|
||||
{
|
||||
"plugin": "bun-typescript@claude-plugins-official",
|
||||
"unique_installs": 1
|
||||
},
|
||||
{
|
||||
"plugin": "document-skills@claude-plugins-official",
|
||||
"unique_installs": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
48
plugins/installed_plugins.json
Normal file
48
plugins/installed_plugins.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"version": 2,
|
||||
"plugins": {
|
||||
"frontend-design@claude-plugins-official": [
|
||||
{
|
||||
"scope": "user",
|
||||
"installPath": "/home/will/.claude/plugins/cache/claude-plugins-official/frontend-design/6d3752c000e2",
|
||||
"version": "6d3752c000e2",
|
||||
"installedAt": "2025-12-24T19:08:12.422Z",
|
||||
"lastUpdated": "2025-12-24T19:08:12.422Z",
|
||||
"gitCommitSha": "6d3752c000e2b3d0e6137bd7adb04895d6f40f14",
|
||||
"isLocal": true
|
||||
}
|
||||
],
|
||||
"typescript-lsp@claude-plugins-official": [
|
||||
{
|
||||
"scope": "user",
|
||||
"installPath": "/home/will/.claude/plugins/cache/claude-plugins-official/typescript-lsp/1.0.0",
|
||||
"version": "1.0.0",
|
||||
"installedAt": "2025-12-24T19:08:12.422Z",
|
||||
"lastUpdated": "2025-12-24T19:08:12.422Z",
|
||||
"gitCommitSha": "6d3752c000e2b3d0e6137bd7adb04895d6f40f14",
|
||||
"isLocal": true
|
||||
}
|
||||
],
|
||||
"commit-commands@claude-plugins-official": [
|
||||
{
|
||||
"scope": "user",
|
||||
"installPath": "/home/will/.claude/plugins/cache/claude-plugins-official/commit-commands/6d3752c000e2",
|
||||
"version": "6d3752c000e2",
|
||||
"installedAt": "2025-12-24T19:10:05.451Z",
|
||||
"lastUpdated": "2025-12-24T19:10:36.843Z",
|
||||
"isLocal": true
|
||||
}
|
||||
],
|
||||
"superpowers@superpowers-marketplace": [
|
||||
{
|
||||
"scope": "user",
|
||||
"installPath": "/home/will/.claude/plugins/cache/superpowers-marketplace/superpowers/4.0.2",
|
||||
"version": "4.0.2",
|
||||
"installedAt": "2025-12-26T18:15:13.657Z",
|
||||
"lastUpdated": "2025-12-26T18:15:13.657Z",
|
||||
"gitCommitSha": "131c1f189f75a14faad4227089841d1deee73e2a",
|
||||
"isLocal": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
18
plugins/known_marketplaces.json
Normal file
18
plugins/known_marketplaces.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"claude-plugins-official": {
|
||||
"source": {
|
||||
"source": "github",
|
||||
"repo": "anthropics/claude-plugins-official"
|
||||
},
|
||||
"installLocation": "/home/will/.claude/plugins/marketplaces/claude-plugins-official",
|
||||
"lastUpdated": "2025-12-26T18:15:48.383Z"
|
||||
},
|
||||
"superpowers-marketplace": {
|
||||
"source": {
|
||||
"source": "github",
|
||||
"repo": "obra/superpowers-marketplace"
|
||||
},
|
||||
"installLocation": "/home/will/.claude/plugins/marketplaces/superpowers-marketplace",
|
||||
"lastUpdated": "2025-12-26T18:14:47.747Z"
|
||||
}
|
||||
}
|
||||
10
settings.json
Normal file
10
settings.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"enabledPlugins": {
|
||||
"frontend-design@claude-plugins-official": true,
|
||||
"typescript-lsp@claude-plugins-official": true,
|
||||
"commit-commands@claude-plugins-official": true,
|
||||
"superpowers@superpowers-marketplace": true
|
||||
},
|
||||
"alwaysThinkingEnabled": true,
|
||||
"model": "opus"
|
||||
}
|
||||
Reference in New Issue
Block a user