Skip to main content

Providing library documentation to AI coding assistants

Picture of Adam Warski, Chief R&D Officer at <a href="https://softwaremill.com/">SoftwareMill</a>

Adam Warski

Chief R&D Officer at SoftwareMill
Jul 14, 2025|19 min read
colorfull library
screenshot of library documentation 1

screenshot of library documentation 2

1---
2description:
3globs:
4alwaysApply: true
5---
6# Ox Library Overview
7
8Ox is a Scala 3 library for **safe direct-style streaming, concurrency and resiliency** on the JVM. Requires JDK 21+ and Scala 3.
9
10## Key Concepts
11
12**Direct-Style Programming**: Write blocking-style code using virtual threads instead of async/await or reactive streams. This provides readable, debuggable code without callback hell.
13
14**Dual Error Handling**:
15- Use **exceptions** for bugs and unexpected situations
16- Use **Either values** for application logic errors with `.ok()` unwrapping
17
18**Structured Concurrency**: All concurrent operations happen within high-level operations or low-level scopes that ensure proper cleanup and resource management.
19
20**Streaming with Flows**: Use `Flow[T]` for lazy, composable, reactive-streams compatible data transformation pipelines with built-in concurrency control.
21
22(...)
screenshot of library documentation 3

1{
2 "$schema": "https://context7.com/schema/context7.json",
3 "projectTitle": "Ox",
4 "description": "Safe direct-style concurrency and resiliency for Scala on the JVM",
5 "folders": [
6 "generated-doc"
7 ],
8 "rules": [
9 "Use high-level concurrency operations like par(), race(), and timeout() when possible",
10 "For manual concurrency, always use structured concurrency with supervised scopes to ensure proper cleanup of threads and resources",
11 "Keep concurrency scopes as small as possible, creating short-lived scopes for single requests or jobs",
12 "Use useCloseableInScope() for automatic resource management that ensures cleanup on scope exit",
13 "Handle errors through either exceptions (for bugs/unexpected situations) or application errors as values using Either",
14 “(...”)
15 ]
16}
screenshot of library documentation 4

Subscribe to our newsletter and never miss an article