Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"useTabs": true,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"jsxSingleQuote": true,
"bracketSpacing": true,
"endOfLine": "lf",
"arrowParens": "always"
}
26 changes: 24 additions & 2 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
"@tsconfig/bun": "catalog:",
},
},
"packages/openmodes": {
"name": "@openmodes/web",
"dependencies": {
"async-mutex": "^0.5.0",
"express": "^5.1.0",
"hono": "^4.8.0",
},
"devDependencies": {
"@types/bun": "^1.2.16",
"@types/node": "^20.0.0",
},
},
"packages/web": {
"name": "@models.dev/web",
"dependencies": {
Expand All @@ -39,14 +51,18 @@

"@models.dev/web": ["@models.dev/web@workspace:packages/web"],

"@openmodes/web": ["@openmodes/web@workspace:packages/openmodes"],

"@tsconfig/bun": ["@tsconfig/[email protected]", "", {}, "sha512-JlJaRaS4hBTypxtFe8WhnwV8blf0R+3yehLk8XuyxUYNx6VXsKCjACSCvOYEFUiqlhlBWxtYCn/zRlOb8BzBQg=="],

"@types/bun": ["@types/[email protected]", "", { "dependencies": { "bun-types": "1.2.16" } }, "sha512-1aCZJ/6nSiViw339RsaNhkNoEloLaPzZhxMOYEa7OzRzO41IGg5n/7I43/ZIAW/c+Q6cT12Vf7fOZOoVIzb5BQ=="],

"@types/node": ["@types/node@24.0.3", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg=="],
"@types/node": ["@types/node@20.19.9", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-cuVNgarYWZqxRJDQHEB58GEONhOK79QVR/qYx4S7kcUObQvUwvFnYxJuuHUKm2aieN9X3yZB4LZsuYNU1Qphsw=="],

"accepts": ["[email protected]", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],

"async-mutex": ["[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA=="],

"available-typed-arrays": ["[email protected]", "", { "dependencies": { "possible-typed-array-names": "^1.0.0" } }, "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ=="],

"aws-sdk": ["[email protected]", "", { "dependencies": { "buffer": "4.9.2", "events": "1.1.1", "ieee754": "1.1.13", "jmespath": "0.16.0", "querystring": "0.2.0", "sax": "1.2.1", "url": "0.10.3", "util": "^0.12.4", "uuid": "8.0.0", "xml2js": "0.6.2" } }, "sha512-x511uiJ/57FIsbgUe5csJ13k3uzu25uWQE+XqfBis/sB0SFoiElJWXRkgEAUh0U6n40eT3ay5Ue4oPkRMu1LYw=="],
Expand Down Expand Up @@ -267,9 +283,11 @@

"toidentifier": ["[email protected]", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="],

"tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],

"type-is": ["[email protected]", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw=="],

"undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],

"unpipe": ["[email protected]", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],

Expand All @@ -295,12 +313,16 @@

"zod-to-json-schema": ["[email protected]", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-HIAfWdYIt1sssHfYZFCXp4rU1w2r8hVVXYIlmoa0r0gABLs5di3RCqPU5DDROogVz1pAdYBaz7HK5n9pSUNs3A=="],

"bun-types/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg=="],

"http-errors/statuses": ["[email protected]", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],

"opencontrol/@tsconfig/bun": ["@tsconfig/[email protected]", "", {}, "sha512-udGrGJBNQdXGVulehc1aWT73wkR9wdaGBtB6yL70RJsqwW/yJhIg6ZbRlPOfIUiFNrnBuYLBi9CSmMKfDC7dvA=="],

"opencontrol/hono": ["[email protected]", "", {}, "sha512-Pst8FuGqz3L7tFF+u9Pu70eI0xa5S3LPUmrNd5Jm8nTHze9FxLTK9Kaj5g/k4UcwuJSXTP65SyHOPLrffpcAJg=="],

"openid-client/jose": ["[email protected]", "", {}, "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA=="],

"bun-types/@types/node/undici-types": ["[email protected]", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],
}
}
218 changes: 218 additions & 0 deletions packages/openmodes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Creating OpenModes

Create AI agent modes for OpenCode.

## Structure

Each mode needs 3 files in `modes/your-mode-name/`:

```
modes/your-mode-name/
├── opencode.json # Configuration
├── your-mode.mode.md # Main prompt
└── metadata.json # Info (author, description, date)
```

## Quick Start

**1. Create `metadata.json`:**

```json
{
"author": "Your Name",
"description": "What your mode does",
"date": "2025-01-20",
"version": "0.1.0",
"pr_number": 123
}
```

**Fields:**

- `author`: Your name or GitHub username
- `description`: Brief description of what your mode does
- `date`: Last updated date (YYYY-MM-DD format)
- `version`: Semantic version of your mode (e.g., "0.1.0")
- `pr_number`: (Optional) PR number where this mode was introduced

**2. Create `opencode.json`:**

```json
{
"instructions": [],
"mcp": {},
"mode": {
"your-mode-name": {
"prompt": "{file:./your-mode.mode.md}",
"tools": {}
}
}
}
```

**3. Create `your-mode.mode.md`:**

```markdown
<prompt `your-mode.prompt.md`>

<profile name="Your Mode Name">
You are a specialized AI that [does what].
</profile>

<core_directives>

1. Always [behavior]
2. Never [restriction]
3. Focus on [priority]
</core_directives>

</prompt>
```

## Adding Tools

**MCP Tools:**

```json
{
"mcp": {
"context7": {
"type": "local",
"command": ["npx", "-y", "@upstash/context7-mcp"],
"enabled": true,
"url": "https://github.com/upstash/context7"
}
}
}
```

**Disable Built-ins:**

```json
{
"mode": {
"your-mode": {
"tools": {
"bash": false,
"write": false
}
}
}
}
```

## Additional Files

**Instructions:** Create `*.instructions.md` files and reference them:

```json
{
"instructions": ["./guidelines.instructions.md"]
}
```

**Extra Prompts:** Create `*.prompt.md` files and reference with:

```markdown
<prompt `filename.prompt.md`>
```

## Examples

See `modes/archie/` for a complete example with MCP tools, instructions, and prompt files.

## API

The OpenModes database provides a REST API to access mode data programmatically.

### Endpoints

**Get all modes (basic info only):**

```bash
GET /mode/index
```

Returns: `{ id, author, description, votes, downloads, updated_at, version, pr_number? }`

**Get all modes (full data):**

```bash
GET /mode/all
```

Returns: Complete mode data including prompts, tools, and context instructions

**Get specific mode:**

```bash
GET /mode/{mode-id}
```

Returns: Full data for a single mode

**Example:**

```bash
curl https://openmodes.dev/mode/index
curl https://openmodes.dev/mode/archie
```

### Response Format

**Index endpoint (`/mode/index`):**

```json
{
"archie": {
"id": "archie",
"author": "spoon",
"description": "Architectural guidance mode...",
"votes": 5,
"downloads": 25,
"updated_at": "2025-01-20",
"version": "0.1.0",
"pr_number": 123
}
}
```

**Full mode endpoint (`/mode/{id}` or `/mode/all`):**

```json
{
"id": "archie",
"author": "spoon",
"description": "Architectural guidance mode...",
"votes": 5,
"downloads": 25,
"updated_at": "2025-01-20",
"version": "0.1.0",
"pr_number": 123,
"opencode_config": {
"instructions": ["./adr.instructions.md"],
"mcp": {
"context7": {
"type": "local",
"command": ["npx", "-y", "@upstash/context7-mcp"],
"enabled": true,
"url": "https://github.com/upstash/context7" // for user verification purposes
}
},
"mode": {
"test": {
"prompt": "{file:./archie.mode.md}",
"tools": {
"bash": false
}
}
}
},
"mode_prompt": "Your complete system prompt...",
"context_instructions": [{ "title": "ADR Guidelines", "content": "..." }]
}
```

---

That's it! Drop your mode folder in `modes/` and make a pull request.
Loading