Skip to content

Feature Request: Opencode Compatibility Adapter for PAI Integration #98

@wallase16

Description

@wallase16

🎯 Feature Request

Create an official Opencode compatibility adapter for Daniel Miessler's Personal AI Infrastructure (PAI) to enable cross-platform AI agent support.

📋 Problem Statement

PAI currently claims platform agnosticism ("works with any AI platform") but is entirely Claude Code-dependent in practice. Opencode users cannot access PAI's powerful personal AI infrastructure due to architectural incompatibilities.

🔍 Research Findings

PAI Current Limitations:

  • Hook System: Requires Claude Code's specific TypeScript hooks (initialize-pai-session.ts, update-tab-titles.ts)
  • Directory Structure: Hardcoded to ~/.claude/ (Claude Code's home directory)
  • Settings Format: Uses Claude Code's exclusive settings.json schema
  • Skills Framework: Dependent on Claude Code's natural language routing
  • MCP Integration: Designed for Claude Code's MCP implementation

Opencode Capabilities:

  • Plugin System: Extensible with event hooks (tool.execute.before, event, etc.)
  • Agent Framework: Primary/subagent system with tool permissions
  • Configuration: JSON-based with schema validation and environment variables
  • MCP Support: Comprehensive MCP server integration
  • Client/Server: HTTP server architecture for universal access

No Cross-Platform Evidence:

🛠️ Proposed Solution

Phase 1: Platform Abstraction Layer

Create adapters/ directory in PAI:

adapters/
├── claude-code/     # Current implementation
├── opencode/        # New adapter needed
├── gpt-cli/         # Future adapters
└── platform-agnostic/  # Common interface

Phase 2: Opencode Adapter Implementation

  • Translate PAI hooks to Opencode plugin events
  • Map PAI skills to Opencode agents
  • Convert PAI settings to Opencode JSON format
  • Bridge directory structure differences

Phase 3: Configuration Migration

  • Automatic detection of Opencode environment
  • Transform .claude/ structure to Opencode-compatible format
  • Maintain backward compatibility with Claude Code

📊 Technical Requirements

PAI Changes Needed:

  1. Platform Interface: Abstract core PAI functionality from Claude Code dependencies
  2. Hook Translation: Convert TypeScript hooks to platform-agnostic events
  3. Config Adapter: Transform settings between formats
  4. Skill Mapping: Translate PAI skills to agent definitions

Opencode Changes Needed:

  1. PAI Plugin: Official plugin to load PAI infrastructure
  2. Configuration Import: Support for PAI configuration files
  3. Directory Bridge: Map .claude/ to Opencode's structure
  4. Skill Integration: Load PAI skills as Opencode agents

🎯 Expected Benefits

  • True Platform Agnosticism: PAI works with Claude Code, Opencode, GPT, Gemini
  • Larger User Base: Opencode's open-source nature expands PAI adoption
  • Reduced Vendor Lock-in: Users can choose AI platform based on needs
  • Community Growth: Cross-platform compatibility drives contributions

📝 Implementation Considerations

  • Maintain backward compatibility with existing Claude Code integration
  • Follow Opencode's plugin development guidelines
  • Ensure security best practices across platforms
  • Provide migration tools for existing users

🔗 Related Issues

📊 Impact Assessment

High Impact: Enables PAI's mission of "AI for everyone" by supporting truly platform-agnostic operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions