Skip to content

Commit 2eabadd

Browse files
committed
docs: add OpenCode plugin and integration instructions
- Add beans-prime.ts plugin for OpenCode integration - Document plugin location options (project-local vs user-global) - Update README with OpenCode setup instructions
1 parent bf9a4ec commit 2eabadd

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

.opencode/plugin/beans-prime.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type { Plugin } from "@opencode-ai/plugin";
2+
3+
/**
4+
* Beans Prime Plugin for OpenCode
5+
*
6+
* This plugin injects the output of `beans prime` into OpenCode's system prompt,
7+
* giving the AI context about your project's beans (issues/tasks). It runs on:
8+
*
9+
* - Chat session start: Adds bean context to the system prompt
10+
* - Session compaction: Re-injects context when the session is compacted
11+
*
12+
* Plugin Location Options:
13+
*
14+
* 1. Project-local (current): .opencode/plugin/beans-prime.ts
15+
* - Only available in this project
16+
* - Committed to version control, shared with collaborators
17+
*
18+
* 2. User-global: ~/.opencode/plugin/beans-prime.ts
19+
* - Available in all your projects that use beans
20+
* - Personal configuration, not shared
21+
*/
22+
23+
export const BeansPrimePlugin: Plugin = async ({ $ }) => {
24+
const primeOuput = await $`beans prime`.text();
25+
26+
return {
27+
"experimental.chat.system.transform": async (_, output) => {
28+
output.system.push(primeOuput);
29+
},
30+
"experimental.session.compacting": async (_, output) => {
31+
output.context.push(primeOuput);
32+
},
33+
};
34+
};
35+
36+
export default BeansPrimePlugin;

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ But more importantly, you'll want to get your coding agent set up to use it. Let
7575

7676
We'll need to teach your coding agent that it should use Beans to track tasks, and how to do so. The exact steps will depend on which agent you're using.
7777

78-
### Claude Code
78+
### [Claude Code](https://www.claude.com/product/claude-code)
7979

8080
An official Beans plugin for Claude is in the works, but for the time being, please manually add the following hooks to your project's `.claude/settings.json` file:
8181

@@ -92,6 +92,10 @@ An official Beans plugin for Claude is in the works, but for the time being, ple
9292
}
9393
```
9494

95+
### [OpenCode](https://opencode.ai/)
96+
97+
Beans integrates with OpenCode via a plugin that injects task context into your sessions. To set it up, **copy the plugin** from [`.opencode/plugin/beans-prime.ts`](.opencode/plugin/beans-prime.ts) to your project's `.opencode/plugin/` directory (or `~/.opencode/plugin/` for global availability across all projects).
98+
9599
### Other Agents
96100

97101
You can use Beans with other coding agents by configuring them to run `beans prime` to get the prompt instructions for task management. We'll add specific integrations for popular agents over time.

0 commit comments

Comments
 (0)