Implement programmer agent system and consolidate agent infrastructure

Programmer Agent System:
- Add programmer-orchestrator (Opus) for workflow coordination
- Add code-planner (Sonnet) for design and planning
- Add code-implementer (Sonnet) for writing code
- Add code-reviewer (Sonnet) for quality review
- Add /programmer command and project registration skill
- Add state files for preferences and project context

Agent Infrastructure:
- Add master-orchestrator and linux-sysadmin agents
- Restructure skills to use SKILL.md subdirectory format
- Convert workflows from markdown to YAML format
- Add commands for k8s and sysadmin domains
- Add shared state files (model-policy, autonomy-levels, system-instructions)
- Add PA memory system (decisions, preferences, projects, facts)

Cleanup:
- Remove deprecated markdown skills and workflows
- Remove crontab example (moved to workflows)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OpenCode Test
2025-12-29 13:23:42 -08:00
parent 119d2a464e
commit 431e10b449
62 changed files with 3572 additions and 539 deletions

View File

@@ -0,0 +1,52 @@
---
name: cluster-status
description: Get quick cluster health overview
aliases: [status, cs]
invokes: workflow:health/cluster-health-check
---
# /cluster-status Command
Get a quick health overview of the Raspberry Pi Kubernetes cluster.
## Usage
```
/cluster-status
/cluster-status --full # Run complete health check workflow
/cluster-status --quick # Just node and pod status (faster)
```
## What It Does
Invokes the `cluster-health-check` workflow to provide a comprehensive cluster health overview by coordinating specialized agents:
1. **Node Health** - Node statuses, conditions, resource usage
2. **Active Alerts** - Firing alerts from Alertmanager
3. **ArgoCD Status** - App sync and health status
4. **Summary** - Overall health rating and recommendations
## Example Output
```
Cluster Status: Healthy
Nodes:
| Node | Status | CPU | Memory | Conditions |
|--------|--------|------|--------|------------|
| pi5-1 | Ready | 45% | 68% | OK |
| pi5-2 | Ready | 32% | 52% | OK |
Active Alerts: 0
ArgoCD Apps:
| App | Sync | Health |
|-----------|----------|-----------|
| homepage | Synced | Healthy |
Recommendations: None
```
## Autonomy
This command is read-only and runs without confirmation.

61
commands/k8s/deploy.md Normal file
View File

@@ -0,0 +1,61 @@
---
name: deploy
description: Deploy application to K8s cluster
aliases: [d]
invokes: workflow:deploy/deploy-app
---
# /deploy Command
Deploy a new application or update an existing one on the Raspberry Pi Kubernetes cluster.
## Usage
```
/deploy <app-name>
/deploy <app-name> --image <image:tag>
/deploy <app-name> --update
```
## Quick Deploy
```
/deploy myapp --image ghcr.io/user/myapp:latest --namespace apps --port 8080
```
## What It Does
Invokes the `deploy-app` workflow to guide you through deploying via GitOps with ArgoCD:
1. **Check existing state** - See if app exists, current status
2. **Generate manifests** - Create deployment, service, kustomization
3. **Create PR** - Push to GitOps repo, create PR
4. **Sync** - After PR merge, trigger ArgoCD sync
5. **Verify** - Confirm pods are running
## Interactive Mode
When run without full arguments, prompts for:
- Application name
- Container image
- Namespace (default: default)
- Ports
- Resources (Pi-optimized defaults)
- Pi 3 compatibility
## Resource Defaults (Pi-optimized)
```yaml
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "128Mi"
cpu: "200m"
```
## Confirmation Points
- **[CONFIRM]** Creating PR in GitOps repo
- **[CONFIRM]** Syncing ArgoCD application
- **[CONFIRM]** Rollback if deployment fails

77
commands/k8s/diagnose.md Normal file
View File

@@ -0,0 +1,77 @@
---
name: diagnose
description: Investigate cluster issues
aliases: [diag]
invokes: workflow:incidents/*
---
# /diagnose Command
Investigate and diagnose problems in the Raspberry Pi Kubernetes cluster.
## Usage
```
/diagnose <issue-description>
/diagnose pod <pod-name> -n <namespace>
/diagnose app <argocd-app-name>
/diagnose node <node-name>
```
## What It Does
Invokes the k8s-orchestrator to coordinate multiple specialist agents for investigation. May trigger incident workflows:
- `pod-crashloop` - For CrashLoopBackOff issues
- `node-issue-response` - For node problems
- `resource-pressure-response` - For resource alerts
- `argocd-sync-failure` - For sync failures
## Diagnosis Types
### General Issue
```
/diagnose "my app is returning 503 errors"
```
### Pod Diagnosis
```
/diagnose pod myapp-7d9f8b6c5-x2k4m -n production
```
### ArgoCD App Diagnosis
```
/diagnose app homepage
```
### Node Diagnosis
```
/diagnose node pi5-1
```
## Output Format
```
Diagnosis for: [issue description]
Status: [Investigating/Identified/Resolved]
Findings:
1. [Finding with evidence]
Root Cause:
[Explanation]
Recommended Actions:
- [SAFE] Action that can be auto-applied
- [CONFIRM] Action requiring approval
- [INFO] Suggestion for manual follow-up
Severity: [Low/Medium/High/Critical]
```
## Options
- `--verbose` - Include full command outputs
- `--logs` - Focus on log analysis
- `--metrics` - Focus on metrics analysis
- `--quick` - Fast surface-level check only

View File

@@ -64,6 +64,15 @@ PA writes directly to general-instructions.json:
/pa --help # Show this help
```
### Knowledge Base
```
/pa --fact "<description>" # Add fact (PA determines category)
/pa --fact <cat>.<key>=<value> # Add structured fact
/pa --list-facts # Show all KB contents
/pa --list-facts <category> # Show specific category
```
## Context Levels
Context precedence (highest to lowest):

34
commands/programmer.md Normal file
View File

@@ -0,0 +1,34 @@
---
name: programmer
description: Invoke the programmer agent for code development tasks
aliases: [code, dev]
invokes: agent:programmer-orchestrator
---
Routes programming tasks to the programmer-orchestrator agent.
## Usage
```
/programmer <task description>
/code <task description>
/dev <task description>
```
## Examples
```
/programmer add user authentication to the API
/code fix the bug in the payment processing
/dev refactor the database connection pooling
```
## Workflow
The programmer-orchestrator follows this workflow:
1. **Plan** - code-planner explores and designs solution
2. **Approve** - User reviews and approves the plan
3. **Implement** - code-implementer writes the code
4. **Review** - code-reviewer checks quality
5. **Commit** - Orchestrator commits approved changes

View File

@@ -0,0 +1,58 @@
---
name: autonomy
description: View or change session autonomy level
aliases: [auto]
modifies: state:sysadmin/session-autonomy
---
# /autonomy Command
View or change the session autonomy level for agent operations.
## Usage
```
/autonomy # Show current autonomy level
/autonomy <level> # Set autonomy level for this session
/autonomy list # Show all available levels
```
## Available Levels
| Level | Description | Use When |
|-------|-------------|----------|
| **conservative** | Confirm all write operations | Initial setup, unfamiliar systems, production |
| **moderate** | Auto-execute routine maintenance, confirm installs | Trusted dev environments, routine maintenance |
| **trusted** | Auto-execute most operations, confirm only destructive | Well-known environments, time-sensitive ops |
## Examples
```bash
# Check current level
/autonomy
# Output: Current autonomy level: conservative
# Set to moderate for this session
/autonomy moderate
# Output: Session autonomy set to: moderate
# List all levels with details
/autonomy list
```
## State File
Session autonomy is stored in:
`~/.claude/state/sysadmin/session-autonomy.json`
Changes only apply to the current session and reset when the session ends.
## What It Does
1. **View**: Reads `session-autonomy.json` and displays current level
2. **Set**: Updates `current_level` in `session-autonomy.json`
3. **List**: Displays all levels from `autonomy-levels.json` with descriptions
## Autonomy
This command modifies the session state file. The change takes effect immediately for all subsequent agent operations in this session.

View File

@@ -0,0 +1,58 @@
---
name: health
description: Run system health check
aliases: [syshealth, check]
invokes: skill:sysadmin-health
---
# /health Command
Runs a comprehensive health check on the Arch Linux workstation.
## Usage
```
/health
/health --quick # Skip package checks (faster)
/health --full # Include all checks plus security audit
```
## What It Does
1. Invokes the `sysadmin-health` skill
2. Collects system metrics (disk, memory, CPU, swap)
3. Checks for pending updates and package issues
4. Reviews failed services and recent errors
5. Reports overall system health status
## Example Output
```
System Health Report
═══════════════════════════════════════
Status: ⚠️ WARNING
Disk Usage:
/ : 65% (120G/180G)
/home : 82% (450G/550G) ⚠️
Memory: 8.2G / 32G (25%)
Swap: 0B / 8G
Pending Updates: 12 packages
Failed Services: 1 (bluetooth.service)
Recent Errors: 3 in last 24h
- nvidia-persistenced: initialization error
- cups: connection refused
- bluetooth: adapter not found
Recommended Actions:
1. Clean /home (above 80% threshold)
2. Fix bluetooth.service: systemctl restart bluetooth
3. Run system update: pacman -Syu
```
## Autonomy
This command is read-only and runs without confirmation.

View File

@@ -0,0 +1,72 @@
---
name: update
description: Run system package updates
aliases: [upgrade, sysupdate]
invokes: workflow:sysadmin/system-update
---
# /update Command
Runs system package updates on the Arch Linux workstation.
## Usage
```
/update # Full update (pacman + AUR + homebrew)
/update --pacman # Only pacman packages
/update --aur # Only AUR packages
/update --brew # Only homebrew packages
/update --dry-run # Show what would be updated without installing
```
## Update Process
### 1. Pre-flight Checks
- Check available disk space
- Check for conflicting packages
- Verify mirror connectivity
### 2. Update Sequence
```
pacman -Syu # System packages first
yay -Sua # AUR packages second
brew upgrade # Homebrew packages last
```
### 3. Post-update
- Check for .pacnew files
- Report any failed updates
- Suggest reboot if kernel updated
## Autonomy
This command requires confirmation before executing updates.
Default autonomy level: **conservative** (confirm all changes)
With `--yes` flag or elevated autonomy:
- Moderate: Auto-execute routine updates, confirm major version changes
- Trusted: Auto-execute all updates, confirm only kernel changes
## Example Session
```
> /update
Checking for updates...
Pacman Updates (15 packages):
linux 6.7.1 -> 6.7.2 ⚠️ KERNEL
firefox 121.0 -> 122.0
... (13 more)
AUR Updates (3 packages):
yay 12.3.1 -> 12.3.2
...
Homebrew Updates (2 packages):
node 21.5.0 -> 21.6.0
...
Proceed with updates? [y/N]
```