opencode-swarm-plugin 0.12.26 → 0.12.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ name: opencode
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+
9
+ jobs:
10
+ opencode:
11
+ if: |
12
+ contains(github.event.comment.body, ' /oc') ||
13
+ startsWith(github.event.comment.body, '/oc') ||
14
+ contains(github.event.comment.body, ' /opencode') ||
15
+ startsWith(github.event.comment.body, '/opencode')
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ id-token: write
19
+ contents: read
20
+ pull-requests: read
21
+ issues: read
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Run opencode
27
+ uses: sst/opencode/github@latest
28
+ env:
29
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
30
+ with:
31
+ model: anthropic/claude-sonnet-4-5
package/README.md CHANGED
@@ -197,20 +197,13 @@ skills_use(name="swarm-coordination") # Load swarm workflow
197
197
 
198
198
  ### Bundled Skills
199
199
 
200
- | Skill | Tags | Description |
201
- | ---------------------------- | -------------------- | ------------------------------------------------------------------------------------ |
202
- | `agent-patterns` | ai, agents, patterns | AI agent design patterns - capability whiteboards, architecture evolution, evals |
203
- | `cli-builder` | cli, typescript, bun | Building TypeScript CLIs with Bun - argument parsing, subcommands, output formatting |
204
- | `code-review` | review, quality | Code review patterns - systematic checklists, feedback patterns |
205
- | `debugging` | debugging, errors | Systematic debugging - root cause analysis, error resolution |
206
- | `learning-systems` | learning, feedback | Implicit feedback scoring, confidence decay, anti-pattern detection |
207
- | `mcp-tool-authoring` | mcp, tools | Building MCP tools - schema definition, context passing, error handling |
208
- | `resilience-patterns` | errors, recovery | Error recovery, retry strategies, graceful degradation |
209
- | `skill-creator` | meta, skills | Guide for creating effective skills |
210
- | `swarm-coordination` | swarm, multi-agent | Multi-agent coordination patterns for swarm workflows |
211
- | `tacit-knowledge-extraction` | knowledge, patterns | Extracting tacit knowledge into pattern languages |
212
- | `testing-strategies` | testing, vitest | Testing async/swarm operations, mocking patterns |
213
- | `zod-validation` | zod, typescript | Schema validation patterns with Zod |
200
+ | Skill | Tags | Description |
201
+ | -------------------- | -------------------- | ------------------------------------------------------------------------------------ |
202
+ | `cli-builder` | cli, typescript, bun | Building TypeScript CLIs with Bun - argument parsing, subcommands, output formatting |
203
+ | `learning-systems` | learning, feedback | Implicit feedback scoring, confidence decay, anti-pattern detection |
204
+ | `mcp-tool-authoring` | mcp, tools | Building MCP tools - schema definition, context passing, error handling |
205
+ | `skill-creator` | meta, skills | Guide for creating effective skills |
206
+ | `swarm-coordination` | swarm, multi-agent | Multi-agent coordination patterns for swarm workflows |
214
207
 
215
208
  ### Skill Locations
216
209
 
package/bin/swarm.ts CHANGED
@@ -1072,6 +1072,127 @@ async function setup() {
1072
1072
  }
1073
1073
  }
1074
1074
 
1075
+ // Offer to update AGENTS.md with skill awareness
1076
+ const agentsPath = join(configDir, "AGENTS.md");
1077
+ if (existsSync(agentsPath)) {
1078
+ const updateAgents = await p.confirm({
1079
+ message: "Update AGENTS.md with skill awareness?",
1080
+ initialValue: true,
1081
+ });
1082
+
1083
+ if (!p.isCancel(updateAgents) && updateAgents) {
1084
+ const s = p.spinner();
1085
+ s.start("Updating AGENTS.md...");
1086
+
1087
+ const agentsPrompt = `You are updating the user's AGENTS.md file to add swarm plugin awareness.
1088
+
1089
+ ## Task
1090
+ Read ${agentsPath} and add sections for Skills, CASS, and Semantic Memory if they don't exist. Update existing sections if present.
1091
+
1092
+ ## What to Add
1093
+
1094
+ 1. **Tool Preferences** - If there's a tool_preferences section, add these tools:
1095
+ - skills_list, skills_use, skills_read - knowledge injection
1096
+ - cass_search, cass_view, cass_expand - search past agent sessions
1097
+ - semantic-memory_find, semantic-memory_store - persistent learning
1098
+
1099
+ 2. **Skills Section** - Add this (adapt style to match the file):
1100
+
1101
+ ### Skills (Knowledge Injection)
1102
+
1103
+ Skills are reusable knowledge packages. Load them on-demand for specialized tasks.
1104
+
1105
+ **When to Use:**
1106
+ - Before unfamiliar work - check if a skill exists
1107
+ - When you need domain-specific patterns
1108
+ - For complex workflows that benefit from guidance
1109
+
1110
+ **Usage:**
1111
+ \`\`\`
1112
+ skills_list() # See available skills
1113
+ skills_use(name="swarm-coordination") # Load a skill
1114
+ skills_use(name="cli-builder", context="building a new CLI") # With context
1115
+ \`\`\`
1116
+
1117
+ **Bundled Skills:** cli-builder, learning-systems, mcp-tool-authoring, skill-creator, swarm-coordination
1118
+
1119
+ 3. **CASS Section** - Add this:
1120
+
1121
+ ### CASS (Cross-Agent Session Search)
1122
+
1123
+ Search across ALL your AI coding agent histories before solving problems from scratch.
1124
+
1125
+ **When to Use:**
1126
+ - BEFORE implementing anything - check if any agent solved it before
1127
+ - When debugging - "what did I try last time this error happened?"
1128
+ - When learning patterns - "how did Cursor handle this API?"
1129
+
1130
+ **Usage:**
1131
+ \`\`\`
1132
+ cass_search(query="authentication token refresh", limit=5) # Search all agents
1133
+ cass_search(query="useEffect cleanup", agent="claude", days=7) # Filter by agent/time
1134
+ cass_view(path="/path/from/search", line=42) # View specific result
1135
+ cass_expand(path="/path", line=42, context=10) # Expand context around match
1136
+ \`\`\`
1137
+
1138
+ **Pro tip:** Query CASS at the START of complex tasks. Past solutions save time.
1139
+
1140
+ 4. **Semantic Memory Section** - Add this:
1141
+
1142
+ ### Semantic Memory (Persistent Learning)
1143
+
1144
+ Store and retrieve learnings across sessions. Memories persist and are searchable.
1145
+
1146
+ **When to Use:**
1147
+ - After solving a tricky problem - store the solution
1148
+ - After making architectural decisions - store the reasoning
1149
+ - Before starting work - search for relevant past learnings
1150
+ - When you discover project-specific patterns
1151
+
1152
+ **Usage:**
1153
+ \`\`\`
1154
+ # Store a learning
1155
+ semantic-memory_store(information="OAuth refresh tokens need 5min buffer before expiry", metadata="auth, tokens")
1156
+
1157
+ # Search for relevant memories
1158
+ semantic-memory_find(query="token refresh", limit=5)
1159
+
1160
+ # Validate a memory is still accurate (resets decay timer)
1161
+ semantic-memory_validate(id="mem_123")
1162
+ \`\`\`
1163
+
1164
+ **Pro tip:** Store the WHY, not just the WHAT. Future you needs context.
1165
+
1166
+ ## Rules
1167
+ - Preserve existing content and style
1168
+ - Don't duplicate - update existing sections if present
1169
+ - Keep tone consistent with the rest of the file
1170
+ - Place sections in logical order (Skills, CASS, Semantic Memory)
1171
+ - If there's a tool_preferences section, add the tools there too
1172
+
1173
+ Edit the file now.`;
1174
+
1175
+ try {
1176
+ const result = Bun.spawnSync(["opencode", "run", agentsPrompt], {
1177
+ stdout: "pipe",
1178
+ stderr: "pipe",
1179
+ timeout: 120000,
1180
+ });
1181
+
1182
+ if (result.exitCode === 0) {
1183
+ s.stop("AGENTS.md updated");
1184
+ p.log.success("Added skill awareness to AGENTS.md");
1185
+ } else {
1186
+ s.stop("Could not update AGENTS.md");
1187
+ p.log.warn("You can manually add skills section later");
1188
+ }
1189
+ } catch {
1190
+ s.stop("Could not update AGENTS.md");
1191
+ p.log.warn("You can manually add skills section later");
1192
+ }
1193
+ }
1194
+ }
1195
+
1075
1196
  p.note(
1076
1197
  'cd your-project\nbd init\nopencode\n/swarm "your task"\n\nSkills: Use skills_list to see available skills',
1077
1198
  "Next steps",
@@ -1351,6 +1472,7 @@ ${cyan("Commands:")}
1351
1472
  swarm doctor Health check - shows status of all dependencies
1352
1473
  swarm init Initialize beads in current project
1353
1474
  swarm config Show paths to generated config files
1475
+ swarm agents Update AGENTS.md with skill awareness
1354
1476
  swarm update Update to latest version
1355
1477
  swarm version Show version and banner
1356
1478
  swarm tool Execute a tool (for plugin wrapper)
@@ -1525,6 +1647,133 @@ async function listTools() {
1525
1647
  );
1526
1648
  }
1527
1649
 
1650
+ // ============================================================================
1651
+ // Agents Command - Update AGENTS.md with skill awareness
1652
+ // ============================================================================
1653
+
1654
+ async function agents() {
1655
+ const home = process.env.HOME || process.env.USERPROFILE || "~";
1656
+ const agentsPath = join(home, ".config", "opencode", "AGENTS.md");
1657
+
1658
+ p.intro(yellow(BANNER));
1659
+
1660
+ // Check if AGENTS.md exists
1661
+ if (!existsSync(agentsPath)) {
1662
+ p.log.warn("No AGENTS.md found at " + agentsPath);
1663
+ p.log.message(
1664
+ dim("Create one first, then run this command to add skill awareness"),
1665
+ );
1666
+ p.outro("Aborted");
1667
+ return;
1668
+ }
1669
+
1670
+ // Check if opencode is available
1671
+ const opencode = await checkCommand("opencode", ["--version"]);
1672
+ if (!opencode.available) {
1673
+ p.log.error("OpenCode not found");
1674
+ p.log.message(dim("Install: npm install -g opencode"));
1675
+ p.outro("Aborted");
1676
+ return;
1677
+ }
1678
+
1679
+ const confirm = await p.confirm({
1680
+ message: "Update AGENTS.md with skill awareness?",
1681
+ initialValue: true,
1682
+ });
1683
+
1684
+ if (p.isCancel(confirm) || !confirm) {
1685
+ p.outro("Aborted");
1686
+ return;
1687
+ }
1688
+
1689
+ const s = p.spinner();
1690
+ s.start("Updating AGENTS.md with skill awareness...");
1691
+
1692
+ const prompt = `You are updating the user's AGENTS.md file to add swarm plugin awareness.
1693
+
1694
+ ## Task
1695
+ Read ~/.config/opencode/AGENTS.md and add sections for Skills, CASS, and Semantic Memory if they don't exist.
1696
+
1697
+ ## What to Add
1698
+
1699
+ 1. **Tool Preferences** - Add these tools to any tool_preferences section:
1700
+ - skills_list, skills_use, skills_read - knowledge injection
1701
+ - cass_search, cass_view, cass_expand - search past agent sessions
1702
+ - semantic-memory_find, semantic-memory_store - persistent learning
1703
+
1704
+ 2. **Skills Section**:
1705
+
1706
+ ### Skills (Knowledge Injection)
1707
+
1708
+ Skills are reusable knowledge packages. Load on-demand for specialized tasks.
1709
+
1710
+ **When to Use:** Before unfamiliar work, when you need domain patterns, for complex workflows.
1711
+
1712
+ \`\`\`
1713
+ skills_list() # See available skills
1714
+ skills_use(name="swarm-coordination") # Load a skill
1715
+ \`\`\`
1716
+
1717
+ **Bundled:** cli-builder, learning-systems, mcp-tool-authoring, skill-creator, swarm-coordination
1718
+
1719
+ 3. **CASS Section**:
1720
+
1721
+ ### CASS (Cross-Agent Session Search)
1722
+
1723
+ Search ALL your AI coding agent histories before solving from scratch.
1724
+
1725
+ **When to Use:** BEFORE implementing - check if solved before. When debugging - what worked last time?
1726
+
1727
+ \`\`\`
1728
+ cass_search(query="auth token refresh", limit=5) # Search all agents
1729
+ cass_view(path="/path/from/search", line=42) # View result
1730
+ \`\`\`
1731
+
1732
+ 4. **Semantic Memory Section**:
1733
+
1734
+ ### Semantic Memory (Persistent Learning)
1735
+
1736
+ Store and retrieve learnings across sessions.
1737
+
1738
+ **When to Use:** After solving tricky problems, after architectural decisions, before starting work.
1739
+
1740
+ \`\`\`
1741
+ semantic-memory_store(information="OAuth needs 5min buffer", metadata="auth")
1742
+ semantic-memory_find(query="token refresh", limit=5)
1743
+ \`\`\`
1744
+
1745
+ ## Rules
1746
+ - Preserve existing content and style
1747
+ - Don't duplicate - update if sections exist
1748
+ - Keep tone consistent
1749
+
1750
+ Edit the file now.`;
1751
+
1752
+ try {
1753
+ const result = Bun.spawnSync(["opencode", "run", prompt], {
1754
+ stdio: ["inherit", "pipe", "pipe"],
1755
+ timeout: 120000, // 2 minute timeout
1756
+ });
1757
+
1758
+ if (result.exitCode === 0) {
1759
+ s.stop("AGENTS.md updated with skill awareness");
1760
+ p.log.success("Skills section added to " + agentsPath);
1761
+ p.log.message(
1762
+ dim("Skills available: skills_list, skills_use, skills_read"),
1763
+ );
1764
+ } else {
1765
+ const stderr = result.stderr?.toString() || "";
1766
+ s.stop("Failed to update AGENTS.md");
1767
+ p.log.error(stderr || "Unknown error");
1768
+ }
1769
+ } catch (error) {
1770
+ s.stop("Failed to update AGENTS.md");
1771
+ p.log.error(String(error));
1772
+ }
1773
+
1774
+ p.outro("Done");
1775
+ }
1776
+
1528
1777
  // ============================================================================
1529
1778
  // Main
1530
1779
  // ============================================================================
@@ -1560,6 +1809,9 @@ switch (command) {
1560
1809
  }
1561
1810
  break;
1562
1811
  }
1812
+ case "agents":
1813
+ await agents();
1814
+ break;
1563
1815
  case "version":
1564
1816
  case "--version":
1565
1817
  case "-v":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.12.26",
3
+ "version": "0.12.28",
4
4
  "description": "Multi-agent swarm coordination for OpenCode with learning capabilities, beads integration, and Agent Mail",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",