Skip to content

Commit c723c6a

Browse files
openmodes
1 parent d1c1306 commit c723c6a

21 files changed

+2882
-0
lines changed

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"useTabs": true,
3+
"tabWidth": 2,
4+
"singleQuote": true,
5+
"trailingComma": "none",
6+
"jsxSingleQuote": true,
7+
"bracketSpacing": true,
8+
"endOfLine": "lf",
9+
"arrowParens": "always"
10+
}

bun.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
"@tsconfig/bun": "catalog:",
1818
},
1919
},
20+
"packages/openmodes": {
21+
"name": "@openmodes/web",
22+
"dependencies": {
23+
"async-mutex": "^0.5.0",
24+
"hono": "^4.8.0",
25+
},
26+
"devDependencies": {
27+
"@types/bun": "^1.2.16",
28+
},
29+
},
2030
"packages/web": {
2131
"name": "@models.dev/web",
2232
"dependencies": {
@@ -39,6 +49,8 @@
3949

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

52+
"@openmodes/web": ["@openmodes/web@workspace:packages/openmodes"],
53+
4254
"@tsconfig/bun": ["@tsconfig/[email protected]", "", {}, "sha512-JlJaRaS4hBTypxtFe8WhnwV8blf0R+3yehLk8XuyxUYNx6VXsKCjACSCvOYEFUiqlhlBWxtYCn/zRlOb8BzBQg=="],
4355

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

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

62+
"async-mutex": ["[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA=="],
63+
5064
"available-typed-arrays": ["[email protected]", "", { "dependencies": { "possible-typed-array-names": "^1.0.0" } }, "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ=="],
5165

5266
"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=="],
@@ -267,6 +281,8 @@
267281

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

284+
"tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
285+
270286
"type-is": ["[email protected]", "", { "dependencies": { "content-type": "^1.0.5", "media-typer": "^1.1.0", "mime-types": "^3.0.0" } }, "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw=="],
271287

272288
"undici-types": ["[email protected]", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],

packages/openmodes/README.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Creating OpenModes
2+
3+
Create AI agent modes for OpenCode.
4+
5+
## Structure
6+
7+
Each mode needs 3 files in `modes/your-mode-name/`:
8+
9+
```
10+
modes/your-mode-name/
11+
├── opencode.json # Configuration
12+
├── your-mode.mode.md # Main prompt
13+
└── metadata.json # Info (author, description, date)
14+
```
15+
16+
## Quick Start
17+
18+
**1. Create `metadata.json`:**
19+
20+
```json
21+
{
22+
"author": "Your Name",
23+
"description": "What your mode does",
24+
"date": "2025-01-20"
25+
}
26+
```
27+
28+
**2. Create `opencode.json`:**
29+
30+
```json
31+
{
32+
"instructions": [],
33+
"mcp": {},
34+
"mode": {
35+
"your-mode-name": {
36+
"prompt": "{file:./your-mode.mode.md}",
37+
"tools": {}
38+
}
39+
}
40+
}
41+
```
42+
43+
**3. Create `your-mode.mode.md`:**
44+
45+
```markdown
46+
<prompt `your-mode.prompt.md`>
47+
48+
<profile name="Your Mode Name">
49+
You are a specialized AI that [does what].
50+
</profile>
51+
52+
<core_directives>
53+
54+
1. Always [behavior]
55+
2. Never [restriction]
56+
3. Focus on [priority]
57+
</core_directives>
58+
59+
</prompt>
60+
```
61+
62+
## Adding Tools
63+
64+
**MCP Tools:**
65+
66+
```json
67+
{
68+
"mcp": {
69+
"context7": {
70+
"type": "local",
71+
"command": ["npx", "-y", "@upstash/context7-mcp"],
72+
"enabled": true,
73+
"url": "https://github.com/upstash/context7"
74+
}
75+
}
76+
}
77+
```
78+
79+
**Disable Built-ins:**
80+
81+
```json
82+
{
83+
"mode": {
84+
"your-mode": {
85+
"tools": {
86+
"bash": false,
87+
"write": false
88+
}
89+
}
90+
}
91+
}
92+
```
93+
94+
## Additional Files
95+
96+
**Instructions:** Create `*.instructions.md` files and reference them:
97+
98+
```json
99+
{
100+
"instructions": ["./guidelines.instructions.md"]
101+
}
102+
```
103+
104+
**Extra Prompts:** Create `*.prompt.md` files and reference with:
105+
106+
```markdown
107+
<prompt `filename.prompt.md`>
108+
```
109+
110+
## Examples
111+
112+
See `modes/archie/` for a complete example with MCP tools, instructions, and prompt files.
113+
114+
---
115+
116+
That's it! Drop your mode folder in `modes/` and make a pull request.

packages/openmodes/index.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>
5+
OpenModes.dev &mdash; An open-source database of AI agent modes
6+
</title>
7+
<meta
8+
name="description"
9+
content="OpenModes is a comprehensive open-source database of AI agent modes with tools, prompts, and configurations."
10+
/>
11+
<meta
12+
name="viewport"
13+
content="width=device-width, initial-scale=1.0, user-scalable=no"
14+
/>
15+
<link rel="preconnect" href="https://fonts.googleapis.com" />
16+
<link
17+
rel="preconnect"
18+
href="https://fonts.gstatic.com"
19+
crossorigin="anonymous"
20+
/>
21+
<link
22+
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&amp;family=Rubik:[email protected]&amp;display=swap"
23+
rel="stylesheet"
24+
/>
25+
<link
26+
rel="icon"
27+
href="./public/favicon.svg"
28+
sizes="any"
29+
type="image/svg+xml"
30+
/>
31+
<meta
32+
property="og:image"
33+
content="https://openmodes.dev/social-share.png"
34+
/>
35+
<meta charset="UTF-8" />
36+
<link rel="stylesheet" href="./src/index.css" />
37+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
38+
</head>
39+
<body>
40+
<!--static-->
41+
<script src="./src/index.ts" type="module"></script>
42+
</body>
43+
</html>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<prompt `adr.prompt.md`>
2+
3+
# Guidelines: How to Write Architectural Decision Records (ADRs)
4+
5+
## The Core Principle: One Decision, One File
6+
7+
This is the most important rule: **Every architectural decision is recorded in its own, separate, numbered file.**
8+
9+
We do **not** use a single, monolithic file for all decisions. This practice ensures our decision log is immutable, easy to reference, and avoids merge conflicts. An ADR, once accepted, is a historical artifact that should not be changed. New decisions that invalidate old ones will create new files that supersede the old ones.
10+
11+
## Core Principles for Writing ADRs
12+
13+
- **Be Objective and Dispassionate:** An ADR is a factual record, not a sales pitch. Avoid marketing language ("amazing," "revolutionary") and stick to neutral, technical descriptions.
14+
- **Focus on the "Why":** The `Consequences` section is the heart of the ADR. A decision without its trade-offs is only half the story. Be honest about the downsides.
15+
- **Link to Evidence:** If a decision was based on a performance benchmark, a blog post, or a specific library's documentation, link to it in the `Context` section.
16+
- **Use Clear, Simple Language:** Avoid jargon and complex sentences. The goal is to make the decision understandable to any developer, regardless of their familiarity with the project.
17+
18+
## The ADR Generation Process
19+
20+
When instructed to create or update an ADR, you will follow this process:
21+
22+
### Step 1: Distill the Decision from the Conversation
23+
24+
- **Identify the Core Decision:** What was the final choice that was just agreed upon? (e.g., "We will replace Moment.js with Day.js.")
25+
- **Identify the Context:** What was the problem being solved? (e.g., "The bundle size from Moment.js is too large.")
26+
- **Identify the Consequences:** What are the expected outcomes? (e.g., "Reduced bundle size, but we need to refactor 25 files.")
27+
28+
### Step 2: Determine the Status and Create the New File
29+
30+
- **Status:** Most new decisions will be **"Accepted"**. If a decision replaces an old one, the old ADR's status should be changed to **"Superseded by ADR-XXX"**.
31+
- **Location:** All ADRs must be located in the `.app/adr/` directory.
32+
- **Filename Generation:**
33+
1. Scan the `.app/adr/` directory to find the highest existing ADR number (e.g., `007-some-decision.md`).
34+
2. Increment it by one (e.g., `008`).
35+
3. Create a **new file** with the format: `XXX-short-title-in-kebab-case.md` (e.g., `008-replace-momentjs-with-dayjs.md`).
36+
37+
### Step 3: Write the ADR Using the Formal Template
38+
39+
Use the following markdown template for the content of the **new file**. Do not deviate from this structure.
40+
41+
```markdown
42+
# ADR-XXX: [Short, Descriptive Title of Decision]
43+
44+
- **Status:** [Proposed | Accepted | Deprecated | Superseded by ADR-XXX]
45+
- **Date:** [YYYY-MM-DD]
46+
47+
---
48+
49+
## Context
50+
51+
_**What is the problem or situation that requires this decision?**_
52+
53+
- Describe the issue, the user story, or the technical challenge.
54+
- What are the constraints? (e.g., performance requirements, budget, existing tech stack).
55+
- Be concise. This should be 2-4 sentences.
56+
57+
## Decision
58+
59+
_**What is the change we are making?**_
60+
61+
- State the decision clearly and unambiguously.
62+
- Be specific. Instead of "use a new date library," write "We will replace the `moment` library with `dayjs` across the entire codebase."
63+
- Mention key components of the solution (e.g., "This includes creating a `formatDate` wrapper in `src/utils/dates.ts`").
64+
65+
## Consequences
66+
67+
_**What are the results of this decision? This is the most important section.**_
68+
69+
- **Positive:** List the benefits we gain from this decision (e.g., "Reduces final bundle size by ~80KB," "Simplifies date-time immutability.").
70+
- **Negative:** List the costs, risks, or trade-offs (e.g., "Requires a coordinated refactoring effort across ~25 files," "Day.js does not have built-in support for X, requiring a custom plugin.").
71+
- **Neutral:** Other notable outcomes (e.g., "The team will need a brief training on the new `dayjs` API.").
72+
73+
---
74+
75+
_Optional but Recommended:_
76+
77+
## Options Considered
78+
79+
### [Option 1: e.g., "Keep Moment.js"]
80+
81+
- **Pros:** No refactoring effort required.
82+
- **Cons:** Fails to solve the bundle size problem.
83+
84+
### [Option 2: e.g., "Use `date-fns`"]
85+
86+
- **Pros:** Also lightweight and modular.
87+
- **Cons:** API is less familiar to the team compared to the Moment.js-like API of Day.js, potentially slowing down the refactoring process.
88+
```
89+
90+
</prompt>

0 commit comments

Comments
 (0)