AGENTS.md · redis/ioredis
AGENTS.md from redis/ioredis: 116 lines covering Project Overview, Common Commands, Generated Code, Architecture and more.
Template by redis
Chalk Labs
Need help deploying AGENTS.md · redis/ioredis?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code. Read the repository before you give any tool access to your data.
curl -fsSL https://raw.githubusercontent.com/redis/ioredis/main/AGENTS.md -o AGENTS.md
Read it and adapt it to your project before use.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: prompt-engineering
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
What's in it
An AGENTS.md file: instructions coding agents (Codex, Cursor, Copilot, Gemini CLI and others) read before working in a repo.
- For
- Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Claude Code
- Length
- 116 lines
- File
AGENTS.md
Sections
- Project Overview
- Common Commands
- Generated Code
- Architecture
- Commit Messages
First lines (shown under the repo's MIT license)
# AGENTS.md
This file provides guidance to AI coding agents (Claude Code, Codex, Copilot, Cursor, Aider, etc.) when working with code in this repository.
## Project Overview
ioredis is a full-featured Redis client for Node.js, written 100% in TypeScript. Source lives in `lib/`, compiles to CommonJS in `built/` (the published artifact), and supports standalone, Sentinel, and Cluster topologies.
## Common Commands
### Building
```bash
npm run build # Wipe built/ and compile TypeScript
node bin/index.js # Regenerate lib/utils/RedisCommander.ts
```
### Linting and Formatting
```bash
npm run lint # Run ESLint over lib/
npm run format # Format files with Prettier
npm run format-check # Check formatting
```
### Testing
Functional and cluster tests require running Redis servers. Unit tests under `test/unit/` mock the network and do not need a server.
To start and stop local Redis test infrastructure:
```bash
npm run docker:setup # Start standalone Redis on 6379 and cluster nodes on 3000-3005
npm run docker:teardown # Stop test Redis servers
```
```bash
npm test # Default non-cluster test: test:js then test:tsd
npm run test:js # Mocha over test/helpers, test/unit, test/functional
npm run test:cluster # Mocha over test/cluster
npm run test:tsd # Build then run tsd against test/typing
npm run test:cov # Test coverage
# Run a single test file
TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test npx mocha --no-experimental-strip-types "test/unit/foo.ts"
# Run a single test by name
TS_NODE_TRANSPILE_ONLY=true NODE_ENV=test npx mocha --no-experimental-strip-types "test/unit/foo.ts" --grep "partial test title"
```
## Generated Code
**Do not hand-edit**: `lib/utils/RedisCommander.ts` (generated), `built/` (build output), and `node_modules/`.
`lib/utils/RedisCommander.ts` holds the typed signatures for every Redis command. This is what gives calls like `redis.set(...)` their types.
Regenerate it with:
```bash
node bin/index.js
```
Generation uses `@ioredis/interface-generator` plus per-command config in `bin/`:
- **`bin/template.ts`** — File skeleton; generated interface is spliced into the `////` marker.
- **`bin/overrides.js`** — Hand-written signatures for commands the generator gets wrong, such as `hgetall` and `mset`.
- **`bin/argumentTypes.js`**, **`bin/returnTypes.js`**, **`bin/sortArguments.js`**, **`bin/typeMaps.js`** — Argument and return type mapping and ordering.
When adding command typing support, edit the `bin/` config and regenerate. Never patch `RedisCommander.ts` directly.
## Architecture
### Layered Design
```text
Public API (`Redis`, `Cluster`, `Pipeline`, `Command`, options)
→ Command facade (`Commander`, generated `RedisCommander` typings, Lua scripts)
→ Command objects and queues (`Command`, offline queue, command queue, pipeline queue)
→ Topology routing (standalone, Sentinel, Cluster slots, subscriber groups)
→ Connection layer (`connectors/`, `redis/event_handler.ts`, retry and ready checks)
→ RESP parsing and reply handling (`DataHandler`, `redis-parser`)
```
### Key Source Areas
- **`lib/index.ts`** — Public export surface for the package. Changes here affect the published TypeScript declarations and user-facing API.
- **`lib/Redis.ts`** — Main standalone and Sentinel client. Manages connection lifecycle (`wait → connecting → connect → ready → close → reconnecting → end`), offline queue behavior, reconnection strategy, and connector selection.
- **`lib/utils/Commander.ts`** — Shared command facade for `Redis` and `Cluster`. Dynamically attaches builtin Redis commands, string and `Buffer` variants, autopipelining dispatch, direct `sendCommand`, and `defineCommand` Lua registration.
- **`lib/Command.ts`** — Single Redis command representation. Handles argument transformation, reply transformation, promise/callback resolution, key-slot calculation, and subscriber/monitor-mode command flags.
- **`lib/DataHandler.ts`** — Parser and reply dispatcher. Wraps `redis-parser`, consumes socket data, resolves queued commands, and routes Pub/Sub replies and monitor messages.
- **`lib/connectors/`** — Network connector implementations. `StandaloneConnector` handles TCP/TLS sockets; `SentinelConnector/` resolves masters through Sentinel using `FailoverDetector` and `SentinelIterator`.
- **`lib/cluster/`** — Cluster client, per-node connection pool, slot cache refresh, redirection handling for `MOVED` and `ASK`, retry scheduling, and cluster Pub/Sub through `ClusterSubscriber`, `ShardedSubscriber`, and `ClusterSubscriberGroup`.
- **`lib/Pipeline.ts`** and **`lib/transaction.ts`** — Batched command execution. `pipeline()` is non-atomic batching; `multi()` adds MULTI/EXEC transaction behavior.
- **`lib/autoPipelining.ts`** — Same-tick command batching. `notAllowedAutoPipelineCommands` lists commands that must bypass autopipelining, such as auth, subscribe, and multi.
- **`lib/Script.ts`** — Lua script abstraction used by `defineCommand`, with `EVALSHA` execution and `EVAL` fallback.
- **`lib/ScanStream.ts`** — Readable stream wrapper for `SCAN`, `HSCAN`, `SSCAN`, and `ZSCAN`.
- **`lib/tracing.ts`** — Command and connection tracing hooks with argument sanitization.
### How Commands Execute
1. User calls a method such as `redis.get()` or `cluster.set()`.
2. `Commander` routes the call through autopipelining, pipeline/transaction handling, or direct `sendCommand`.
3. A `Command` object is created with transformed arguments and callback/promise state.
4. Standalone clients enqueue the command on one connection; Cluster clients choose a node by key slot and may retry on redirects.
5. The command is written to the socket after connection readiness checks and offline queue handling.
6. `redis-parser` parses the RESP reply from the socket.
7. `DataHandler` resolves the matching queued command, applies reply transformers, and emits Pub/Sub or monitor events when relevant.
## Commit Messages
Follow [Conventional Commits](https://www.conventionalcommits.org/): `<type>: <subject>`.
Common types include `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, and `chore`.
Releases are automated via semantic-release (`.releaserc.json`), so commit messages drive the changelog and version bump.Signals
- Stars
- 15,347
- Forks
- 1,271
- Open issues
- 144
- Last commit (this folder)
- Jul 1, 2026 (4 months ago)
- Last release
- Jul 31, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/redis/ioredis
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from redis
- 0.756score
Redis MCP Server
redisOfficial
Natural language interface designed for agentic applications to manage and search data in Redis.
ConnectorBFreshness: BLocal↓ 3.6K/wkClaude Code +5 - 0.745score
iris-development
redisOfficial
Iris is Redis's umbrella for AI-focused products.
SkillBFreshness: B★ 169Claude Code +9 - 0.674score
AGENTS.md · redis/redis-py
redis
AGENTS.md from redis/redis-py: 289 lines covering Common commands, Architecture, Python and dependency notes, MUST and more.
TemplateAFreshness: A★ 13.7KCodex +5 - 0.644score
AGENTS.md · redis/node-redis
redis
AGENTS.md from redis/node-redis: 82 lines covering What this is, Packages (packages/), Core layout — packages/client/lib/, Command pattern and more.
TemplateBFreshness: B★ 17.6KCodex +5 - 0.550score
AGENTS.md · redis/RedisInsight
redis
AGENTS.md from redis/RedisInsight: 178 lines covering Project Overview, Setup Commands, Testing Instructions, Always-On Rules and more.
TemplateCFreshness: C★ 8.9KCodex +5
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get AGENTS.md · redis/ioredis running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
AGENTS.md · redis/ioredis. Agent Mart. https://agentmart.dev/templates/redis-ioredis-agents-md (last updated 2026-10-24)