Two files, one repository
K-Mistele/opensearch ships 2 formats across 5 indexed files. The question worth asking is whether the second one says anything the first does not.
CompareAGENTS.md ↔ Cursor rules
| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 5 | 0 | 0% |
| Commands | 0 | 7 | 0 | 0% |
| Section tags | 1 | 5 | 0 | 17% |
What each file covers
Sections
0 shared · 5 only in A · 0 only in B- − Agent Guidelines for OpenSearch Project
- − Build/Test Commands
- − Code Style & Conventions
- − BAML Integration
- − Error Handling & Testing
Commands
0 shared · 7 only in A · 0 only in B- − bun run dev
- − bun run cli
- − bun test
- − bun test <test-file>
- − bun test test/generate-query.test.ts
- − bunx biome format .
- − bunx biome lint .
Section tags
1 shared · 5 only in A · 0 only in B- − build
- − test
- − lint-format
- − do-not
- − agent-behaviour
- code-style
Line diff
K-Mistele/opensearch · AGENTS.md
@@ −1 @@
1# Agent Guidelines for OpenSearch Project
2
3## Build/Test Commands
4- **Run dev**: `bun run dev` (watches src/index.ts)
5- **Run CLI**: `bun run cli` (starts interactive CLI)
6- **Run tests**: `bun test` (runs all tests)
7- **Run single test**: `bun test <test-file>` (e.g., `bun test test/generate-query.test.ts`)
8- **Format/Lint**: Use Biome via `bunx biome format .` and `bunx biome lint .`
9
10## Code Style & Conventions
11- **Runtime**: Use Bun instead of Node.js/npm/pnpm (see .cursor/rules)
12- **Formatting**: Tabs for indentation, single quotes for strings (biome.json)
13- **Imports**: Organize imports enabled, use path aliases `@/*` for src, `@baml-client` for BAML
14- **Types**: Strict TypeScript, interfaces for data structures, explicit return types
15- **Naming**: PascalCase for React components/BAML functions, camelCase for variables/functions
16- **Files**: .tsx for React components, .ts for utilities, .baml for BAML functions
17
18## BAML Integration
19- **Source files**: Only edit files in `baml_src/` directory (*.baml files)
20- **Generated code**: `baml_client/` is auto-generated from `baml_src/` - never edit directly
21- **Functions**: Import and call via `import { b } from '@baml-client'; await b.SomeFunction(...)`
22- **Types**: All classes/enums exported from `@baml-client` (e.g., `import { SearchResult } from '@baml-client'`)
23- **Naming**: BAML functions use PascalCase (e.g., `GenerateQuery`, `Reflect`)
24- **Prompts**: Include `{{ ctx.output_format }}` and `{{ _.role("user") }}` for user inputs
25- **Schema**: Prefer enums over confidence numbers, use classes for structured outputs
26
27## Error Handling & Testing
28- Use Bun's built-in test framework with `import { test, expect } from "bun:test"`
29- Async/await for BAML function calls and API interactions
30- Type-safe error handling with proper TypeScript types
K-Mistele/opensearch · .cursor/rules/baml.mdc
@@ +1 @@
1---
2description:
3globs: *.ts,*.tsx,*.baml
4alwaysApply: false
5---
6<Overview>
7 BAML (Basically, A Made-Up Language) is a domain-specific language for building LLM prompts as functions.
8 You can build an agentic workflow with BAML.
9</Overview>
10
11 <Schema>
12 // Define output schemas using classes
13 class MyObject {
14 // Optional string fields use ?
15 // @description is optional, but if you include it, it goes after the field.
16 name string? @description("The name of the object")
17
18 // Arrays of primitives
19 // arrays cannot be optional.
20 tags string[]
21
22 // Enums must be declared separately and are optional
23 status MyEnum?
24
25 // Union types
26 type "success" | "error"
27
28 // Primitive types
29 count int
30 enabled bool
31 score float
32
33 // nested objects
34 nested MyObject2
35
36 // image type
37 myImg image
38
39 {#// checks and assertions. Uses jinja syntax inside the parentheses.
40 // For a single property use one @
41 bar int @assert(between_0_and_10, {{ "{{ this > 0 and this < 10 }}" }}) //this = MyObject.bar value
42 quux string
43 // assertions for multiple fields use @@ and go at the bottom of the class. Uses jinja syntax inside the parentheses.
44 // Do NOT add descriptions after the assertion.
45 @@assert(length_limit, {{ "{{ this.quux|length < this.baz }}" }})#}
46 }
47
48 // Enums are declared separately
49 enum MyEnum {
50 PENDING
51 ACTIVE @description("Item is currently active")
52 COMPLETE
53 }
54
55 // Comments use double slashes
56 // Recursive types and inline definitions are not supported
57
58 </Schema>
59
60 <Functions>
61 // Functions define inputs, outputs and prompts
62 // function name is always PascalCase
63 function MyFunction(input: MyObject) -> string {
64 client "openai/gpt-4o"
65 // prompt with jinja syntax inside here. with double curly braces for variables.
66 // make sure to include: \{\{ ctx.output_format \}\} in the prompt, which prints the output schema instructions so the LLM returns the output in the correct format (json or string, etc.). DO NOT write the output schema manually.
67 prompt #"
68
69 "#
70 }
71
72 <LLMClients>
73 You can use any of the following:
74 - openai/gpt-4o
75 - openai/gpt-4o-mini
76 - anthropic/claude-3-5-sonnet-latest (note the "3-5")
77 - anthropic/claude-3-5-haiku-latest
78 </LLMClients>
79
80 <Prompt>
81 When writing the prompt:
82 1. Make sure to include the input in the prompt (even if it's an image) using {{ "{{ input }}" }}
83 2. Make sure to include {{ "{{ ctx.output_format }}" }} in the prompt so the LLM knows how to format the output.
84 3. You do not need to specify to "answer in JSON format". Only write in the prompt brief instruction, and any other task-specific things to keep in mind for the task.
85 4. Write a {{ "{{ _.role(\"user\") }}" }} tag to indicate where the user's inputs start. So if there's a convo you can write
86 #"{{ "{{ _.role(\"user\") }}" }} {{ "{{ some-variable }}" }}#
87
88 DO NOT REPEAT output schema fields in the prompt. They are included with {{ "{{ ctx.output_format }}" }}.
89 ```baml
90 class TweetAnalysis {
91 mainTopic string @description("The primary topic or subject matter of the tweet")
92 isSpam bool @description("Whether the tweet appears to be spam")
93 }
94
95 function ClassifyTweets(tweets: string[]) -> TweetAnalysis[] {
96 client "openai/gpt-4o-mini"
97 prompt #"
98 Analyze each of the following tweets and classify them:
99 {{ "{{ _.role(\"user\") }}" }} {{ "{{ tweets }}" }}
100
101 {{ "{{ ctx.output_format }}" }}
102 "#
103 }
104 ```
105 </Prompt>
106
107 </Functions>
108
109 <Usage in other languages>
110 You can use BAML in python, typescript, and other languages.
111
112 ```python
113 import asyncio
114 from baml_client import b // this client is autogenerated
115 from baml_client.types import WeatherAPI
116
117 def main():
118 # In python, BAML functions are synchronous.
119 weather_info = b.UseTool("What's the weather like in San Francisco?")
120 print(weather_info)
121 assert isinstance(weather_info, WeatherAPI)
122 print(f"City: {weather_info.city}")
123 print(f"Time of Day: {weather_info.timeOfDay}")
124
125 if __name__ == '__main__':
126 main()
127 ```
128
129 ```typescript
130 import { b } from './baml_client' // this client is autogenerated
131 import { WeatherAPI } from './baml_client/types'
132 import assert from 'assert'
133
134 const main = async () => {
135 const weatherInfo = await b.UseTool("What's the weather like in San Francisco?")
136 console.log(weatherInfo)
137 assert(weatherInfo instanceof WeatherAPI)
138 console.log(`City: ${weatherInfo.city}`)
139 console.log(`Time of Day: ${weatherInfo.timeOfDay}`)
140 }
141 ```
142
143 </Usage>
144
145Do NOT use numbers as confidence intervals if you need to use them. Prefer an enum with descriptions or literals like "high", "medium", "low".
146Don't add confidence levels to extraction schemas.
147
148Don't use LLM functions to "validate" any other output. {#You should use @assert for that on each field in the output type. Search the docs for "assert" to see how to use it.#}
149
150Dedent all declarations.
151
152Note that the types exported by BAML are pydantic classes in python, and interfaces in Tyepscript, except for primitive types.
@@ −1 +1 @@
1−# Agent Guidelines for OpenSearch Project
1+---
2+description:
3+globs: *.ts,*.tsx,*.baml
4+alwaysApply: false
5+---
6+<Overview>
7+ BAML (Basically, A Made-Up Language) is a domain-specific language for building LLM prompts as functions.
8+ You can build an agentic workflow with BAML.
9+</Overview>
210
3−## Build/Test Commands
4−- **Run dev**: `bun run dev` (watches src/index.ts)
5−- **Run CLI**: `bun run cli` (starts interactive CLI)
6−- **Run tests**: `bun test` (runs all tests)
7−- **Run single test**: `bun test <test-file>` (e.g., `bun test test/generate-query.test.ts`)
8−- **Format/Lint**: Use Biome via `bunx biome format .` and `bunx biome lint .`
11+ <Schema>
12+ // Define output schemas using classes
13+ class MyObject {
14+ // Optional string fields use ?
15+ // @description is optional, but if you include it, it goes after the field.
16+ name string? @description("The name of the object")
17+
18+ // Arrays of primitives
19+ // arrays cannot be optional.
20+ tags string[]
21+
22+ // Enums must be declared separately and are optional
23+ status MyEnum?
24+
25+ // Union types
26+ type "success" | "error"
27+
28+ // Primitive types
29+ count int
30+ enabled bool
31+ score float
932
10−## Code Style & Conventions
11−- **Runtime**: Use Bun instead of Node.js/npm/pnpm (see .cursor/rules)
12−- **Formatting**: Tabs for indentation, single quotes for strings (biome.json)
13−- **Imports**: Organize imports enabled, use path aliases `@/*` for src, `@baml-client` for BAML
14−- **Types**: Strict TypeScript, interfaces for data structures, explicit return types
15−- **Naming**: PascalCase for React components/BAML functions, camelCase for variables/functions
16−- **Files**: .tsx for React components, .ts for utilities, .baml for BAML functions
33+ // nested objects
34+ nested MyObject2
1735
18−## BAML Integration
19−- **Source files**: Only edit files in `baml_src/` directory (*.baml files)
20−- **Generated code**: `baml_client/` is auto-generated from `baml_src/` - never edit directly
21−- **Functions**: Import and call via `import { b } from '@baml-client'; await b.SomeFunction(...)`
22−- **Types**: All classes/enums exported from `@baml-client` (e.g., `import { SearchResult } from '@baml-client'`)
23−- **Naming**: BAML functions use PascalCase (e.g., `GenerateQuery`, `Reflect`)
24−- **Prompts**: Include `{{ ctx.output_format }}` and `{{ _.role("user") }}` for user inputs
25−- **Schema**: Prefer enums over confidence numbers, use classes for structured outputs
36+ // image type
37+ myImg image
2638
27−## Error Handling & Testing
28−- Use Bun's built-in test framework with `import { test, expect } from "bun:test"`
29−- Async/await for BAML function calls and API interactions
30−- Type-safe error handling with proper TypeScript types
39+ {#// checks and assertions. Uses jinja syntax inside the parentheses.
40+ // For a single property use one @
41+ bar int @assert(between_0_and_10, {{ "{{ this > 0 and this < 10 }}" }}) //this = MyObject.bar value
42+ quux string
43+ // assertions for multiple fields use @@ and go at the bottom of the class. Uses jinja syntax inside the parentheses.
44+ // Do NOT add descriptions after the assertion.
45+ @@assert(length_limit, {{ "{{ this.quux|length < this.baz }}" }})#}
46+ }
47+
48+ // Enums are declared separately
49+ enum MyEnum {
50+ PENDING
51+ ACTIVE @description("Item is currently active")
52+ COMPLETE
53+ }
54+
55+ // Comments use double slashes
56+ // Recursive types and inline definitions are not supported
57+
58+ </Schema>
59+
60+ <Functions>
61+ // Functions define inputs, outputs and prompts
62+ // function name is always PascalCase
63+ function MyFunction(input: MyObject) -> string {
64+ client "openai/gpt-4o"
65+ // prompt with jinja syntax inside here. with double curly braces for variables.
66+ // make sure to include: \{\{ ctx.output_format \}\} in the prompt, which prints the output schema instructions so the LLM returns the output in the correct format (json or string, etc.). DO NOT write the output schema manually.
67+ prompt #"
68+
69+ "#
70+ }
71+
72+ <LLMClients>
73+ You can use any of the following:
74+ - openai/gpt-4o
75+ - openai/gpt-4o-mini
76+ - anthropic/claude-3-5-sonnet-latest (note the "3-5")
77+ - anthropic/claude-3-5-haiku-latest
78+ </LLMClients>
79+
80+ <Prompt>
81+ When writing the prompt:
82+ 1. Make sure to include the input in the prompt (even if it's an image) using {{ "{{ input }}" }}
83+ 2. Make sure to include {{ "{{ ctx.output_format }}" }} in the prompt so the LLM knows how to format the output.
84+ 3. You do not need to specify to "answer in JSON format". Only write in the prompt brief instruction, and any other task-specific things to keep in mind for the task.
85+ 4. Write a {{ "{{ _.role(\"user\") }}" }} tag to indicate where the user's inputs start. So if there's a convo you can write
86+ #"{{ "{{ _.role(\"user\") }}" }} {{ "{{ some-variable }}" }}#
87+
88+ DO NOT REPEAT output schema fields in the prompt. They are included with {{ "{{ ctx.output_format }}" }}.
89+ ```baml
90+ class TweetAnalysis {
91+ mainTopic string @description("The primary topic or subject matter of the tweet")
92+ isSpam bool @description("Whether the tweet appears to be spam")
93+ }
94+
95+ function ClassifyTweets(tweets: string[]) -> TweetAnalysis[] {
96+ client "openai/gpt-4o-mini"
97+ prompt #"
98+ Analyze each of the following tweets and classify them:
99+ {{ "{{ _.role(\"user\") }}" }} {{ "{{ tweets }}" }}
100+
101+ {{ "{{ ctx.output_format }}" }}
102+ "#
103+ }
104+ ```
105+ </Prompt>
106+
107+ </Functions>
108+
109+ <Usage in other languages>
110+ You can use BAML in python, typescript, and other languages.
111+
112+ ```python
113+ import asyncio
114+ from baml_client import b // this client is autogenerated
115+ from baml_client.types import WeatherAPI
116+
117+ def main():
118+ # In python, BAML functions are synchronous.
119+ weather_info = b.UseTool("What's the weather like in San Francisco?")
120+ print(weather_info)
121+ assert isinstance(weather_info, WeatherAPI)
122+ print(f"City: {weather_info.city}")
123+ print(f"Time of Day: {weather_info.timeOfDay}")
124+
125+ if __name__ == '__main__':
126+ main()
127+ ```
128+
129+ ```typescript
130+ import { b } from './baml_client' // this client is autogenerated
131+ import { WeatherAPI } from './baml_client/types'
132+ import assert from 'assert'
133+
134+ const main = async () => {
135+ const weatherInfo = await b.UseTool("What's the weather like in San Francisco?")
136+ console.log(weatherInfo)
137+ assert(weatherInfo instanceof WeatherAPI)
138+ console.log(`City: ${weatherInfo.city}`)
139+ console.log(`Time of Day: ${weatherInfo.timeOfDay}`)
140+ }
141+ ```
142+
143+ </Usage>
144+
145+Do NOT use numbers as confidence intervals if you need to use them. Prefer an enum with descriptions or literals like "high", "medium", "low".
146+Don't add confidence levels to extraction schemas.
147+
148+Don't use LLM functions to "validate" any other output. {#You should use @assert for that on each field in the output type. Search the docs for "assert" to see how to use it.#}
149+
150+Dedent all declarations.
151+
152+Note that the types exported by BAML are pydantic classes in python, and interfaces in Tyepscript, except for primitive types.
