Skip to content

Commit 08f033c

Browse files
committed
chore: update AGENTS.md and configuration files
- Renamed sections in AGENTS.md for clarity: "Non-Negotiables" to "Must Follow" and "Tooling Rules" to "Tooling Priority". - Added new rules for OpenCode and permissions in AGENTS.md. - Updated opencode.jsonc to switch models from anthropic to openai/gpt-5.2-codex. - Added typecheck script in package.json. - Modified README.md to include installation instructions and workflow notes. - Changed module resolution in tsconfig.json from "node" to "bundler". - Updated swarm.ts to use openai/gpt-5.2 as the default lite model.
1 parent 7ce0ca3 commit 08f033c

9 files changed

Lines changed: 135 additions & 39 deletions

File tree

.cursor/rules.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Cursor Rules
2+
3+
Use `AGENTS.md` as the primary source of truth.
4+
5+
## Must Follow
6+
7+
- CLI-first scaffolding; never hand-write configs.
8+
- TDD only: RED → GREEN → REFACTOR, tests first.
9+
- Fix all lint errors before commit.
10+
11+
## OpenCode Rules
12+
13+
- Config sources merge; precedence: `.well-known/opencode` → global `~/.config/opencode/opencode.json``OPENCODE_CONFIG` → project `opencode.json``.opencode` dirs → `OPENCODE_CONFIG_CONTENT`.
14+
- `permission` uses `allow` / `ask` / `deny`; last match wins. `.env` reads denied by default (except `*.env.example`).
15+
- Use the **Plan** agent for analysis-only work (asks before edits or bash).
16+
- Manage MCP servers with `opencode mcp add|list|auth|logout|debug`.
17+
- OpenCode auto-runs formatters after edits; ensure formatter deps/configs exist.
18+
19+
## Style
20+
21+
- Direct, terse communication.
22+
- Use JSDoc for components and functions.
23+
- Simple over complex; explicit over implicit; composition > inheritance; don’t abstract until the third use.

.windsurf/rules.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Windsurf Rules
2+
3+
Use `AGENTS.md` as the primary source of truth.
4+
5+
## Must Follow
6+
7+
- CLI-first scaffolding; never hand-write configs.
8+
- TDD only: RED → GREEN → REFACTOR, tests first.
9+
- Fix all lint errors before commit.
10+
11+
## OpenCode Rules
12+
13+
- Config sources merge; precedence: `.well-known/opencode` → global `~/.config/opencode/opencode.json``OPENCODE_CONFIG` → project `opencode.json``.opencode` dirs → `OPENCODE_CONFIG_CONTENT`.
14+
- `permission` uses `allow` / `ask` / `deny`; last match wins. `.env` reads denied by default (except `*.env.example`).
15+
- Use the **Plan** agent for analysis-only work (asks before edits or bash).
16+
- Manage MCP servers with `opencode mcp add|list|auth|logout|debug`.
17+
- OpenCode auto-runs formatters after edits; ensure formatter deps/configs exist.
18+
19+
## Style
20+
21+
- Direct, terse communication.
22+
- Use JSDoc for components and functions.
23+
- Simple over complex; explicit over implicit; composition > inheritance; don’t abstract until the third use.

AGENTS.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Joel Hooks — Next.js/React-first, systems thinker, hates fluff. Be direct.
66

77
---
88

9-
## Non‑Negotiables
9+
## Must Follow
1010

1111
### CLI-First Scaffolding
1212

13-
Use official CLIs for any new config or project setup. Never handwrite configs.
13+
Use official CLIs for any new config or project setup. Never hand-write configs.
1414

1515
- `package.json``pnpm init` / `npm init`
1616
- `tsconfig.json``tsc --init`
@@ -32,12 +32,10 @@ Fix all lint errors before commit. No “pre-existing” excuses.
3232

3333
---
3434

35-
## Tooling Rules
35+
## Tooling Priority
3636

3737
Prefer plugin tools over raw CLI/MCP.
3838

39-
**Priority:**
40-
4139
1. `hive_*`, `swarm_*`, `structured_*`, `swarmmail_*`
4240
2. Read/Edit tools
4341
3. ast-grep
@@ -47,7 +45,7 @@ Prefer plugin tools over raw CLI/MCP.
4745

4846
---
4947

50-
## Swarm Workflow (Use for multi-file work)
48+
## Swarm Workflow
5149

5250
- 3+ files, features, refactors, or bug fix + tests → use `/swarm`.
5351
- Initialize before file edits with `swarmmail_init`.
@@ -58,13 +56,37 @@ Prefer plugin tools over raw CLI/MCP.
5856

5957
## Hive End of Session
6058

61-
- `hive_close` completed work.
62-
- `hive_sync` then `git push`.
59+
- For swarm tasks: `swarm_complete`.
60+
- For non-swarm tasks: `hive_close`, then `hive_sync`, then `git push`.
6361
- Verify clean `git status`.
6462
- Check `hive_ready` for next work.
6563

6664
---
6765

66+
## OpenCode Rules
67+
68+
- `AGENTS.md` files are merged; nearest directory scope wins. Global rules live in `~/.config/opencode/AGENTS.md`.
69+
- `/init` generates or extends `AGENTS.md`; commit it for the team.
70+
- `opencode.json` can load extra instructions via `instructions` (files, globs, or URLs); these merge with `AGENTS.md`.
71+
- Config sources merge (not replace). Precedence: remote `.well-known/opencode` → global `~/.config/opencode/opencode.json``OPENCODE_CONFIG` → project `opencode.json``.opencode` dirs → `OPENCODE_CONFIG_CONTENT`.
72+
73+
## Permissions
74+
75+
- Use `permission` rules with `allow` / `ask` / `deny`; the last matching rule wins.
76+
- `.env` reads are denied by default (`*.env`, `*.env.*`), except `*.env.example`.
77+
- Use the **Plan** agent for analysis-only work; it asks before edits or bash.
78+
79+
## MCP
80+
81+
- Manage servers with `opencode mcp add|list|auth|logout|debug`.
82+
- Enable only the MCPs you need to limit context bloat.
83+
84+
## Formatters
85+
86+
- OpenCode auto-runs formatters after edits; ensure formatter deps/configs exist.
87+
88+
---
89+
6890
## Communication Style
6991

7092
Direct. Terse. No fluff. Disagree when wrong. Execute.

CLAUDE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Claude Code Rules
2+
3+
Follow `AGENTS.md` as the primary source of truth.
4+
5+
## Must Follow
6+
7+
- CLI-first scaffolding; never hand-write configs.
8+
- TDD only: RED → GREEN → REFACTOR, tests first.
9+
- Fix all lint errors before commit.
10+
11+
## OpenCode Rules
12+
13+
- Config sources merge; precedence: `.well-known/opencode` → global `~/.config/opencode/opencode.json``OPENCODE_CONFIG` → project `opencode.json``.opencode` dirs → `OPENCODE_CONFIG_CONTENT`.
14+
- `permission` uses `allow` / `ask` / `deny`; last match wins. `.env` reads denied by default (except `*.env.example`).
15+
- Use the **Plan** agent for analysis-only work (asks before edits or bash).
16+
- Manage MCP servers with `opencode mcp add|list|auth|logout|debug`.
17+
- OpenCode auto-runs formatters after edits; ensure formatter deps/configs exist.
18+
19+
## Style
20+
21+
- Direct, terse communication.
22+
- Use JSDoc for components and functions.
23+
- Simple over complex; explicit over implicit; composition > inheritance; don’t abstract until the third use.

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ Built on [`joelhooks/swarmtools`](https://github.com/joelhooks/swarmtools) - mul
3030

3131
## Quick Start
3232

33+
### 0. Install OpenCode
34+
35+
Install OpenCode via the official install script or the Homebrew tap.
36+
37+
- Install script: `curl -fsSL https://opencode.ai/install | bash`
38+
- Homebrew: `brew install anomalyco/tap/opencode`
39+
3340
### 1. Clone & Install
3441

3542
```bash
@@ -64,7 +71,11 @@ cass --version # 0.1.35+
6471
swarm doctor
6572
```
6673

67-
### 4. Run Your First Swarm
74+
### 4. Initialize Repo (AGENTS.md)
75+
76+
Inside OpenCode, run `/init` in the repo you want to work on. This generates an `AGENTS.md` file with workflow rules—commit it so collaborators and agents share the same guardrails.
77+
78+
### 5. Run Your First Swarm
6879

6980
> [!WARNING]
7081
> All commands run **inside [OpenCode](https://opencode.ai)**, not in your terminal. The `swarm` CLI is a backend that agents call - it's not meant for direct human use.
@@ -81,6 +92,17 @@ The agent orchestrates everything. You just describe what you want.
8192

8293
---
8394

95+
## Configuration & Permissions
96+
97+
OpenCode merges configuration from multiple sources with defined precedence. Higher-precedence sources override earlier ones, so keep defaults in shared configs and project-specific overrides close to the repo.
98+
99+
Permissions support `allow`, `ask`, and `deny` rules. When multiple rules match, the last match wins. Reads from `.env` files are denied by default, so add explicit allowances when you need them.
100+
101+
## Workflow Notes
102+
103+
- Use the Plan agent to outline multi-step work before running a swarm.
104+
- Formatters run automatically after edits when the project has a formatter config and dependencies installed.
105+
84106
## Version Reference
85107

86108
| Tool | Version | Install Command |
@@ -291,6 +313,8 @@ hivemind_find(query="token refresh", expand=true) # Full content
291313

292314
## MCP Servers
293315

316+
OpenCode manages MCP servers from config and starts them on demand. Keep server definitions in `opencode.jsonc` so agents can discover tools without manual bootstrapping.
317+
294318
| Server | Purpose |
295319
| ------------------- | ------------------------------------------------------ |
296320
| **next-devtools** | Next.js dev server integration (routes, errors, build) |

opencode.jsonc

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
"$schema": "https://opencode.ai/config.json",
33

44
// === Models ===
5-
"model": "anthropic/claude-opus-4-5",
6-
"small_model": "anthropic/claude-haiku-4-5", // title gen, lightweight tasks
5+
"model": "openai/gpt-5.2-codex",
6+
"small_model": "openai/gpt-5.2", // title gen, lightweight tasks
77
"autoupdate": true,
8-
"plugin": [
9-
"opencode-anthropic-auth@0.0.7"
10-
],
118
// === TUI ===
129
"tui": {
1310
"scroll_acceleration": {
@@ -21,10 +18,6 @@
2118
"biome": {
2219
"command": ["npx", "biome", "format", "--write", "$FILE"],
2320
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json", ".jsonc"]
24-
},
25-
"prettier": {
26-
"command": ["npx", "prettier", "--write", "$FILE"],
27-
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json", ".md", ".yaml", ".yml", ".css", ".scss"]
2821
}
2922
},
3023

@@ -60,10 +53,6 @@
6053
"type": "local",
6154
"command": ["npx", "-y", "next-devtools-mcp@latest"]
6255
},
63-
// "agent-mail": {
64-
// "type": "remote",
65-
// "url": "http://127.0.0.1:8765/mcp/"
66-
// },
6756
"chrome-devtools": {
6857
"type": "local",
6958
"command": ["npx", "-y", "chrome-devtools-mcp@latest"]
@@ -77,17 +66,6 @@
7766
"fetch": {
7867
"type": "local",
7968
"command": ["uvx", "mcp-server-fetch"]
80-
},
81-
// Snyk security scanning - deps, code, IaC, containers
82-
"snyk": {
83-
"type": "local",
84-
"command": ["npx", "-y", "snyk@latest", "mcp", "-t", "stdio"]
85-
},
86-
// Kernel - cloud browser automation, Playwright execution, app deployment
87-
// OAuth auth - run `opencode mcp auth kernel` to authenticate
88-
"kernel": {
89-
"type": "remote",
90-
"url": "https://mcp.onkernel.com/mcp"
9169
}
9270
},
9371

@@ -99,7 +77,7 @@
9977
},
10078
// Plan agent - read-only analysis, no file writes
10179
"plan": {
102-
"model": "anthropic/claude-opus-4-5", // Opus for planning (cheaper)
80+
"model": "openai/gpt-5.2-codex", // Opus for planning (cheaper)
10381
"temperature": 0.1,
10482
"tools": {
10583
"write": false,
@@ -127,7 +105,7 @@
127105
},
128106
// Security agent - read-only vulnerability scanning with Snyk
129107
"security": {
130-
"model": "anthropic/claude-sonnet-4-5",
108+
"model": "openai/gpt-5.2-codex",
131109
"temperature": 0.1, // Low temp for deterministic security analysis
132110
"tools": {
133111
"write": false,
@@ -138,7 +116,7 @@
138116
},
139117
// Test writer agent - generates comprehensive test suites
140118
"test-writer": {
141-
"model": "anthropic/claude-sonnet-4-5",
119+
"model": "openai/gpt-5.2-codex",
142120
"temperature": 0.2, // Slight creativity for test case generation
143121
"permission": {
144122
"write": {
@@ -153,7 +131,7 @@
153131
},
154132
// Docs agent - documentation writer (cheaper model)
155133
"docs": {
156-
"model": "anthropic/claude-haiku-4-5", // Haiku for cost-effective docs
134+
"model": "openai/gpt-5.2-codex", // Haiku for cost-effective docs
157135
"temperature": 0.3, // More creativity for readable documentation
158136
"permission": {
159137
"write": {

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2+
"scripts": {
3+
"typecheck": "tsc --noEmit"
4+
},
25
"dependencies": {
36
"@opencode-ai/plugin": "0.0.0-dev-202601101858"
47
},

plugin/swarm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1966,7 +1966,7 @@ async function generateCompactionPrompt(
19661966
snapshot: SwarmStateSnapshot,
19671967
): Promise<string | null> {
19681968
const startTime = Date.now();
1969-
const liteModel = process.env.OPENCODE_LITE_MODEL || "anthropic/claude-haiku-4-5";
1969+
const liteModel = process.env.OPENCODE_LITE_MODEL || "openai/gpt-5.2";
19701970

19711971
logCompaction("debug", "generate_compaction_prompt_start", {
19721972
session_id: snapshot.sessionID,

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"target": "ES2022",
44
"lib": ["ES2015", "ES2022"],
55
"module": "ESNext",
6-
"moduleResolution": "node",
6+
"moduleResolution": "bundler",
77
"types": ["bun-types", "@types/node"],
88
"noEmit": true,
99
"skipLibCheck": true,

0 commit comments

Comments
 (0)