Skip to content

OpenCode plugin that sends detailed Agent messages and usage statistics to your iOS device via the Bark app.

License

Notifications You must be signed in to change notification settings

Decade-qiu/opencode-message-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencode-message-notify

OpenCode plugin that sends detailed Agent messages and usage statistics to your iOS device via the Bark app.

Features

  • Real-time iOS notifications via Bark app - get notified anywhere
  • Detailed Agent message content - see exactly what your Agent is telling you, not just "task completed"
  • Usage statistics tracking - monitor cost, tokens, and cache usage
  • Permission request notifications - never miss a permission prompt
  • Zero dependencies - lightweight and fast

Installation

Add the plugin to your opencode.json or opencode.jsonc:

{
  "plugin": ["@decade-qzj/opencode-message-notify@latest"]
}

Using @latest ensures you always get the newest version when the cache is refreshed.

To pin a specific version:

{
  "plugin": ["@decade-qzj/opencode-message-notify@0.1.0"]
}

Restart OpenCode. The plugin will be automatically installed and loaded.

Updating

OpenCode caches plugins in ~/.cache/opencode. Plugins are not auto-updated; you need to clear the cache to get new versions.

If you use @latest

Clear the cache and restart OpenCode:

Linux/macOS:

rm -rf ~/.cache/opencode/node_modules/@decade-qzj/opencode-message-notify

Windows (PowerShell):

Remove-Item -Recurse -Force "$env:USERPROFILE\.cache\opencode\node_modules\@decade-qzj\opencode-message-notify"

Then restart OpenCode - it will download the latest version automatically.

If you use a pinned version (e.g., @0.1.0)

  1. Update the version in your opencode.json:

    {
      "plugin": ["@decade-qzj/opencode-message-notify@0.1.0"]
    }
  2. Clear the cache (see commands above)

  3. Restart OpenCode

Check installed version

Linux/macOS:

cat ~/.cache/opencode/node_modules/@decade-qzj/opencode-message-notify/package.json | grep version

Windows (PowerShell):

Get-Content "$env:USERPROFILE\.cache\opencode\node_modules\@decade-qzj\opencode-message-notify\package.json" | Select-String "version"

Setup Bark App

  1. Download Bark from the App Store
  2. Register for a free account
  3. Copy your device token from the app
  4. Configure the plugin (see below)

Configuration

Environment Variable (Recommended)

Set the DAY_APP_TOKEN environment variable in your shell profile:

# Add to your ~/.zshrc or ~/.bashrc
export DAY_APP_TOKEN="your_bark_device_token"

Config File

Create ~/.config/opencode/opencode-notify.json:

{
  "token": "your_bark_device_token",
  "title": "OpenCode",
  "notifyOnComplete": true,
  "notifyOnPermission": true,
  "includeUsageStats": true,
  "includeMessageContent": true
}

Options

Option Type Default Description
token string (env) Bark device token
title string "OpenCode" Notification title prefix
notifyOnComplete boolean true Send notification on session completion
notifyOnPermission boolean true Send notification for permission requests
includeUsageStats boolean true Include cost and token statistics
includeMessageContent boolean true Include Agent's actual message content

How It Works

Message Content

Unlike other plugins that just notify "task completed", this plugin captures and sends the actual Agent message content. You'll see:

  • What the Agent was working on
  • The final result or summary
  • Any important notes or next steps

Usage Statistics

The plugin tracks and reports:

  • Cost - API cost in USD
  • Tokens - Input, Output, Reasoning breakdown
  • Cache - Cache Read/Write statistics

Example notification:

I've analyzed the codebase and found 3 potential areas for optimization:

💰 Cost: 0.0235
🧮 Tokens
  - Input: 15,420
  - Output: 3,280
  - Reasoning: 8,150
💾 Cache
  - Read: 2,100
  - Write: 450

Platform Notes

This plugin works on all platforms that OpenCode supports:

  • macOS - No additional setup required
  • Linux - No additional setup required
  • Windows - No additional setup required

The only requirement is having the Bark app configured on your iOS device.

Troubleshooting

Notifications not appearing on iOS

  1. Verify your Bark token - Make sure it's correct in your config
  2. Check Bark app - Test with a manual notification in the Bark app
  3. Clear the cache - Remove the plugin from cache and restart OpenCode

Testing the plugin

Send a test notification manually using curl:

curl "https://api.day.app/YOUR_TOKEN/Test/Hello%20World"

Plugin not loading

  1. Check your opencode.json syntax
  2. Verify the plugin name is correct
  3. Clear the cache and restart OpenCode

Development

Building

npm run build

Type checking

npm run typecheck

License

MIT

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Support

If you have any questions or issues, please open a GitHub issue.

About

OpenCode plugin that sends detailed Agent messages and usage statistics to your iOS device via the Bark app.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published