code-style

Coding conventions for the Open Agents codebase, covering package management, TypeScript settings, formatting, naming, and imports.

In plain words
What is it for?
Choosing the correct package manager, writing TypeScript, naming files and symbols, formatting code, and following project import rules.
Why use it?
It keeps contributions consistent with the repository and helps avoid problems caused by unsupported tools, formatting, or type-checking rules.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/vercel-labs/open-agents/code-style
Clone the repo
git clone --depth 1 https://github.com/vercel-labs/open-agents
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,120 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01120
Opus 5 $0.00000 $0.00560
Sonnet 5 $0.00000 $0.00224
Haiku 4.5 $0.00000 $0.00112

Measured today against content hash 84df309bb9ba, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-style scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/code-style.md · 140 lines

How it starts

The opening of the file, as written. The whole thing — 140 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Style & Patterns

Detailed coding conventions, tool implementation patterns, and common patterns for the Open Agents codebase.

Package Manager

  • Use pnpm exclusively for dependency management
  • The monorepo uses [email protected] through Corepack
  • Use Node 24's built-in TypeScript support for utility scripts
  • Use Bun only as the test runner

TypeScript Configuration

  • Strict mode enabled
  • Target: ESNext with module "Preserve"
  • noUncheckedIndexedAccess: true - always check indexed access
  • verbatimModuleSyntax: true - use explicit type imports

Formatting (Ultracite — oxfmt)

  • Indent: 2 spaces
  • Quote style: double quotes for JavaScript/TypeScript
  • Run pnpm fix before committing

Naming Conventions

  • Files: kebab-case (e.g., deep-agent.ts, paste-blocks.ts)
  • Types/Interfaces: PascalCase (e.g., TodoItem, AgentContext)
  • Functions/Variables: camelCase (e.g., getSandbox, workingDirectory)
  • Constants: UPPER_SNAKE_CASE for true constants (e.g., TIMEOUT_MS, SAFE_COMMAND_PREFIXES)

Imports

  • Do NOT use .js extensions in imports (e.g., import { foo } from "./utils" not "./utils.js")
    • The .js extension causes module resolution issues with Next.js/Turbopack
    • This applies to all packages and apps in the monorepo
  • Use explicit .ts extensions in modules loaded directly by Node 24 utility scripts
  • Prefer named exports over default exports
  • Group imports: external packages first, then internal packages, then relative imports
  • Use type imports when importing only types: import type { Foo } from "./types"

Types

  • Never use any - use unknown and narrow with type guards
  • Define schemas with Zod, then derive types: type Foo = z.infer<typeof fooSchema>
  • Prefer interfaces for object shapes, types for unions/intersections
  • Export types alongside their related functions

Error Handling

  • Return structured error objects rather than throwing when possible:
    return { success: false, error: `Failed to read file: ${message}` };
    
  • When catching errors, extract message safely:
    const message = error instanceof Error ? error.message : String(error);
    
  • Use descriptive error messages that include context (tool name, file path, etc.)

Read the full file on GitHub · 140 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 140 lines · 0 tokens per session scan A 84df309bb9ba

Subscribe to this mod's changes

code-style is an agent published in the GitHub repository vercel-labs/open-agents (5,798 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,120 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.