Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 132 additions & 0 deletions packages/opencode/CONATUS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Conatus - Sovereign AI Development Environment

> *Named after Spinoza's conatus: the striving to persist in one's being.*

Conatus is your sovereign fork of OpenCode, integrating orchestration, the Ralph Loop, and human-AI dialectic systems.

## Quick Start (Development Mode)

```bash
# Navigate to the conatus directory
cd /home/bryan/projects/opencode-analysis/packages/opencode

# Run conatus in development mode (uses bun to run TypeScript directly)
bun run dev

# Run with a specific model
bun run dev -m anthropic/claude-opus-4-5-20251101

# Run headless server mode
bun run dev serve --port 4198
```

## Features

### Core OpenCode Features
- Multi-model support (Anthropic, OpenAI, Google, local models)
- MCP server integration
- Plugin system
- TUI interface

### Conatus Extensions
- **Orchestration Module**: Coordinates complex multi-agent tasks
- **Ralph Loop**: Continuous refinement cycles for quality assurance
- **Complexity Detection**: Automatically routes tasks based on complexity
- **Background Agents**: Spawn specialized agents for parallel work
- **Human-in-Loop Dialectic**: Integration with the Sisyphean deliberation system

## Configuration

Conatus uses your existing OpenCode configuration at `~/.config/opencode/opencode.json`.

Your current setup includes:
- Local Ollama models
- RunPod self-hosted models
- Vultr inference proxy
- Velocity router
- Anthropic (Claude)
- Google (Gemini via Antigravity)
- OpenAI (GPT 5.x via OAuth)

## Environment Variables

Conatus supports both new and legacy environment variable names:

| Conatus Variable | Legacy Variable | Purpose |
|-----------------|-----------------|---------|
| `CONATUS_BIN_PATH` | `OPENCODE_BIN_PATH` | Override binary path |
| `CONATUS_CONFIG` | `OPENCODE_CONFIG` | Custom config path |
| `CONATUS_SERVER_PASSWORD` | `OPENCODE_SERVER_PASSWORD` | Server auth |

## Directory Structure

```
~/.config/opencode/ # Configuration (shared with opencode)
~/.cache/opencode/ # Cache directory
~/.local/share/opencode/ # Data directory
~/.local/state/opencode/ # State directory
```

## Building for Production

```bash
# Build the binary
bun run build

# The binary will be at dist/conatus-linux-x64 (or appropriate platform)
```

## Plugins Loaded

Your configuration loads these plugins:
1. `oh-my-opencode` - Extended functionality
2. `opencode-antigravity-auth` - Antigravity API authentication
3. `./.opencode/plugin/bryan.ts` - Your custom Bryan plugin
4. `opencode-openai-codex-auth` - OpenAI Codex OAuth

## Integration with Sisyphean Works

Conatus integrates with your dialectic deliberation system:

```bash
# Check for pending continuations
python sisyphean-works/bootstrap/tools/continue.py prompt

# Process dialectic state
python sisyphean-works/bootstrap/tools/dialectic.py check
```

## Orchestration Commands

The orchestration module provides complexity-aware task routing:

- **Trivial**: Direct execution
- **Simple**: Single-agent tasks
- **Complex**: Multi-step workflows
- **Research**: Deep exploration with multiple agents
- **Ultrawork**: Full Ralph Loop engagement

## Troubleshooting

### Plugin Errors
If you see `matcher.hooks is undefined` errors with oh-my-opencode:
```bash
# The plugin at ~/.cache/opencode/node_modules/oh-my-opencode/dist/index.js
# has been patched to handle undefined hooks
```

### Missing Dependencies
```bash
cd /home/bryan/projects/opencode-analysis
bun install
```

### Port Already in Use
```bash
# Use a different port for the headless server
bun run dev serve --port 4199
```

---

*Conatus embodies persistent, joyful work through orchestration and human-AI dialectic integration.*
87 changes: 87 additions & 0 deletions packages/opencode/HEADLESS-CONNECTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Conatus Headless Server Connection Guide

## Quick Reference

### On the Server (inside tmux via mosh/tailscale)

```bash
# Start tmux session
tmux new -s conatus

# Set password (REQUIRED for security)
export OPENCODE_SERVER_PASSWORD="your-secure-password"

# Start headless server
cd /home/bryan/projects/opencode-analysis/packages/opencode
bun run dev serve --port 4198

# Detach: Ctrl+B, D
# Reattach later: tmux attach -t conatus
```

### From Any Client (local or remote)

```bash
# Set same password
export OPENCODE_SERVER_PASSWORD="your-secure-password"

# Attach to remote server via Tailscale
cd /home/bryan/projects/opencode-analysis/packages/opencode
bun run dev attach http://<tailscale-hostname>:4198

# Or use web interface
# Navigate to: http://<tailscale-hostname>:4198
```

## Authentication Comparison

| Aspect | Claude Code | Conatus |
|--------|-------------|---------|
| **Model** | claude-opus-4-5-20251101 | claude-opus-4-5-20251101 |
| **Auth** | Claude Code subscription | Anthropic OAuth (your account) |
| **Credentials** | Automatic | ~/.local/share/opencode/auth.json |
| **Billing** | Claude Code sub | Your Anthropic account |

## Your Existing Credentials

Your `~/.local/share/opencode/auth.json` has valid OAuth for:
- Anthropic (expires Jan 2026)
- Google
- GitHub Copilot
- Groq, Cerebras, OpenRouter, DeepSeek, Venice
- Vultr, RunPod

All providers work immediately with conatus.

## Full Workflow Example

```bash
# 1. From local machine, connect to server via tailscale
mosh bryan@<tailscale-hostname>

# 2. Start conatus in tmux
tmux new -s conatus
export OPENCODE_SERVER_PASSWORD="secure-pass"
cd ~/projects/opencode-analysis/packages/opencode
bun run dev serve --port 4198
# Ctrl+B, D to detach
# exit mosh

# 3. From local machine, attach to the running server
export OPENCODE_SERVER_PASSWORD="secure-pass"
cd ~/projects/opencode-analysis/packages/opencode
bun run dev attach http://<tailscale-hostname>:4198
```

## Using Specific Models

```bash
# Use your Anthropic OAuth
bun run dev -m anthropic/claude-opus-4-5-20251101

# Use Vultr inference
bun run dev -m vultr-inference/kimi-k2-instruct

# Use velocity router
bun run dev -m velocity/fast
```
Loading