emrsyah/AgentBlessed

"Blessed are those who orchestrate for they shall ship faster."

โ˜… 0Forks 0TypeScriptGitHub โ†—Compare

README

๐Ÿ™ AgentBlessed

"Blessed are the code smiths, for they shall inherit productivity."

A divine plugin for OpenCode that brings blessed multi-agent orchestration to your development workflow.

License: MIT OpenCode

โœจ What is AgentBlessed?

AgentBlessed transforms your OpenCode experience into a blessed workflow where you have full visibility and control over your AI agents. Track session activity, receive notifications when work completes, and gain insights into your development process.

Key Blessings:

  • ๐ŸŽฏ Activity Tracking: Monitor all tool invocations and file changes
  • ๐Ÿ”” Smart Notifications: Get notified when sessions complete or encounter errors
  • ๐Ÿ“Š Session Statistics: Track productivity metrics in real-time
  • ๐Ÿ›ก๏ธ Permission Awareness: Never miss an approval request
  • ๐ŸŽฎ Custom Commands: Built-in /bless and /stats commands

๐Ÿš€ Installation

Method 1: Project-Level (Recommended for Testing)

# Clone into your project
git clone https://github.com/yourusername/opencode-agentblessed.git .opencode/plugins/agentblessed

# Or create manually
mkdir -p .opencode/plugins/agentblessed
curl -o .opencode/plugins/agentblessed/index.ts https://raw.githubusercontent.com/yourusername/opencode-agentblessed/main/index.ts

Method 2: Global Installation

# Create global plugin directory
mkdir -p ~/.config/opencode/plugins/agentblessed

# Copy the plugin file
cp index.ts ~/.config/opencode/plugins/agentblessed/

Method 3: Via NPM (Coming Soon)

npm install -g opencode-agentblessed

Then add to your ~/.config/opencode/opencode.json:

{
  "plugin": ["opencode-agentblessed"]
}

๐ŸŽฎ Usage

Once installed, AgentBlessed works automatically in the background:

Automatic Features

  • โœ… Session Tracking: Every session is blessed and monitored
  • โœ… Tool Logging: See what tools are being invoked in real-time
  • โœ… File Change Tracking: Know which files are being modified
  • โœ… Notifications: Get system notifications when work completes
  • โœ… Error Alerts: Immediate notification when something goes wrong

Custom Commands

AgentBlessed adds these blessed commands to OpenCode:

/bless - Receive a Blessing

/bless

Get a random coding blessing for inspiration:

๐Ÿ™ A BLESSING FOR YOUR CODE ๐Ÿ™

   May your functions be pure and your side effects minimal.

/stats - View Statistics

/stats

See your blessed productivity metrics:

๐Ÿ“Š AGENTBLESSED STATISTICS
   Active Sessions: 3
   Total Tools Invoked: 47
   Unique Files Modified: 12

๐Ÿ“ธ Example Output

When you start OpenCode with AgentBlessed installed:

$ opencode
๐Ÿ™ AgentBlessed initialized
   Project: my-awesome-project
   Directory: /home/dev/projects/my-awesome-project
   Working Tree: /home/dev/projects/my-awesome-project
   May your code be blessed!

# When you start working
โœจ Blessed session created: a1b2c3d4...

# As tools are invoked
๐Ÿ“ Blessed write: src/components/Button.tsx
โœ… write completed successfully
โšก Blessed command: npm run build
๐Ÿค– Blessed agent invoked: Find all API endpoints...

# When session completes
๐Ÿ™ Session completed in 5m 23s
   Tools invoked: 12
   Files modified: 4
๐Ÿ”” [System Notification] Session completed

โš™๏ธ Configuration

AgentBlessed works out of the box with sensible defaults. No configuration required!

Optional: Custom Configuration

Create .opencode/agentblessed.json:

{
  "agentblessed": {
    "notifications": {
      "enabled": true,
      "sound": true,
      "onComplete": true,
      "onError": true
    },
    "logging": {
      "level": "info",
      "showTimestamps": true
    },
    "features": {
      "trackFileChanges": true,
      "trackToolUsage": true,
      "showBlessingOnComplete": false
    }
  }
}

๐ŸŽฏ Features in Detail

Session Lifecycle Tracking

Every session is monitored from creation to completion:

  • Created: Session starts, timer begins
  • Updated: Ongoing activity tracked
  • Idle: Work completed, stats calculated
  • Error: Immediate error detection

Tool Execution Monitoring

See exactly what tools are being used:

Tool Type Blessed Output
write ๐Ÿ“ Blessed write: filepath
edit ๐Ÿ“ Blessed edit: filepath
bash โšก Blessed command: command
task ๐Ÿค– Blessed agent invoked: prompt
grep ๐Ÿ” Blessed search: pattern

File Change Tracking

Know what's being modified:

  • Tracks unique files modified per session
  • Prevents duplicate entries
  • Shows final count on completion

Smart Notifications

Cross-platform notifications:

  • โœ… macOS: Native notifications with sound
  • โœ… Linux: notify-send support
  • โœ… Windows: PowerShell notifications
  • โœ… Fallback: Console logging

Permission Awareness

Never miss an approval:

โณ Awaiting your blessing...
   Tool: bash
   Action: execute
   Press 'a' to allow, 'd' to deny

๐Ÿ—๏ธ Architecture

AgentBlessed Plugin
โ”œโ”€โ”€ Session Lifecycle Hooks
โ”‚   โ”œโ”€โ”€ session.created
โ”‚   โ”œโ”€โ”€ session.updated
โ”‚   โ”œโ”€โ”€ session.idle
โ”‚   โ””โ”€โ”€ session.error
โ”œโ”€โ”€ Tool Execution Hooks
โ”‚   โ”œโ”€โ”€ tool.execute.before
โ”‚   โ””โ”€โ”€ tool.execute.after
โ”œโ”€โ”€ File Operation Hooks
โ”‚   โ”œโ”€โ”€ file.edited
โ”‚   โ””โ”€โ”€ file.watcher.updated
โ”œโ”€โ”€ Permission Hooks
โ”‚   โ”œโ”€โ”€ permission.asked
โ”‚   โ””โ”€โ”€ permission.replied
โ”œโ”€โ”€ TUI Hooks
โ”‚   โ”œโ”€โ”€ tui.command.execute
โ”‚   โ””โ”€โ”€ tui.toast.show
โ””โ”€โ”€ Helper Functions
    โ”œโ”€โ”€ sendBlessedNotification
    โ”œโ”€โ”€ showBlessing
    โ””โ”€โ”€ showStats

๐Ÿ› ๏ธ Development

Prerequisites

  • OpenCode installed
  • TypeScript knowledge (optional, for modifications)
  • Node.js and npm (for type definitions)

Setting Up Development Environment

# 1. Clone the repository
git clone https://github.com/yourusername/opencode-agentblessed.git
cd opencode-agentblessed

# 2. Install TypeScript definitions (optional)
npm install --save-dev @opencode-ai/plugin

# 3. Link to your test project
ln -s $(pwd) /path/to/your/project/.opencode/plugins/agentblessed

# 4. Run OpenCode in debug mode
opencode -d

Project Structure

AgentBlessed/
โ”œโ”€โ”€ index.ts              # Main plugin file
โ”œโ”€โ”€ README.md             # This file
โ”œโ”€โ”€ package.json          # NPM metadata (optional)
โ”œโ”€โ”€ tsconfig.json         # TypeScript config (optional)
โ””โ”€โ”€ docs/                 # Documentation
    โ”œโ”€โ”€ API.md
    โ””โ”€โ”€ HOOKS.md

Available Hooks

AgentBlessed uses these OpenCode hooks:

Hook Purpose
session.created Initialize session tracking
session.updated Monitor ongoing sessions
session.idle Handle completion, send notifications
session.error Error detection and alerts
tool.execute.before Pre-execution logging
tool.execute.after Post-execution confirmation
file.edited File change tracking
permission.asked Alert user to pending approvals
tui.command.execute Handle custom commands

Adding Custom Features

Want to extend AgentBlessed? Here are some ideas:

// Add a new hook
"session.compacted": async (input, output) => {
  console.log("๐Ÿ“ฆ Session compacted to save tokens")
},

// Add cost tracking
"tool.execute.after": async (input, output) => {
  // Estimate token usage
  // Track costs per session
  // Alert if approaching budget
}

๐Ÿงช Testing

Manual Testing Checklist

  • Plugin loads without errors
  • Session creation shows blessing message
  • Tool execution shows appropriate icons
  • File modifications are tracked
  • Session completion shows stats
  • Notifications appear (if supported)
  • /bless command works
  • /stats command works
  • Permission requests are highlighted

Debug Mode

Run OpenCode with debug flag to see detailed logs:

opencode -d

๐Ÿ“ฆ Distribution

As NPM Package

# Build
npm run build

# Publish
npm publish

As Git Repository

Users can install via:

git clone https://github.com/yourusername/opencode-agentblessed.git \
  .opencode/plugins/agentblessed

๐Ÿค Contributing

Contributions are blessed! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-blessing)
  3. Commit your changes (git commit -m 'Add amazing blessing')
  4. Push to the branch (git push origin feature/amazing-blessing)
  5. Open a Pull Request

Ideas for Contributions

  • Add more blessings to the collection
  • Create dashboard visualization
  • Add cost tracking features
  • Support for custom notification sounds
  • Integration with external analytics
  • More blessed commands
  • Theme support (colors, icons)

๐Ÿ› Troubleshooting

Plugin Not Loading

# Check file location
ls -la .opencode/plugins/agentblessed/index.ts

# Verify syntax
npx tsc --noEmit index.ts

# Run with debug
opencode -d

Notifications Not Working

  • macOS: Ensure Terminal has notification permissions
  • Linux: Install notify-send (sudo apt install libnotify-bin)
  • Windows: PowerShell execution policy may need adjustment

TypeScript Errors

# Install types
npm install --save-dev @opencode-ai/plugin

# Or add to package.json in config directory
cat > ~/.config/opencode/package.json << 'EOF'
{
  "dependencies": {
    "@opencode-ai/plugin": "latest"
  }
}
EOF

๐Ÿ“ License

MIT License - see LICENSE file

๐Ÿ™ Acknowledgments

  • OpenCode Team: For the amazing platform
  • Oh My OpenCode: Inspiration for multi-agent patterns
  • Community: For feedback and contributions

๐Ÿ”ฎ Roadmap

  • v0.2.0: Dashboard overlay (Ctrl+B)
  • v0.3.0: Cost tracking and budget alerts
  • v0.4.0: Smart agent routing
  • v0.5.0: Agent marketplace integration
  • v1.0.0: Full multi-agent orchestration

๐Ÿ“ž Support


May your code be blessed and your bugs be few. ๐Ÿ™

Contributors

emrsyah

Issues