bunqueue-dev
Skill601 starsChanged 16 days agoMITView on GitHub
Orientation map of the bunqueue repository for contributors. Use when asked how bunqueue works internally or where code lives (request flow of PUSH, PULL and ACK, shards, lock order, embedded versus TCP mode, Workflow Engine files), when planning or reviewing a feature or a refactor of the source, or when unsure which bunqueue skill or reference page covers a task. Load it before searching the source. Skip it for a bug fix, a gate, a Machine run, a release or a session: load the bunqueue-* skill that owns the task instead. Not for applications that use bunqueue as a library.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/bunqueue/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- sdk/CLAUDE.mdCLAUDE.md
- bunqueue-fixing-bugsSkill
- bunqueue-releasingSkill
- bunqueue-running-gatesSkill
- bunqueue-running-machine-gatesSkill
- bunqueue-working-autonomouslySkill
- bunqueue-working-sessionsSkill
- bunqueueSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 103
Every code change updates /docs and the changelog in the same change-set.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
bunqueue development guide
bunqueue is a high-performance job queue for Bun with SQLite persistence. The mandatory rules are in CLAUDE.md (Claude Code) and AGENTS.md (Codex); read the one for your agent completely before changing anything. This skill is a map: what the code looks like and where each procedure lives.
Which skill or page
| Task | Go to |
Start, resume, track or hand off a session; edit feature_list.json or progress.md | bunqueue-working-sessions (skill) |
| A bug, regression or failing behavior to fix | bunqueue-fixing-bugs (skill) |
| Which gates to run, reading sandbox artifacts, a failing gate, a post-gate change, watching CI after a push | bunqueue-running-gates (skill) |
| Ubuntu and Debian OrbStack Machine evidence | bunqueue-running-machine-gates (skill) |
| A release the user explicitly asked for | bunqueue-releasing (skill) |
| Working through the work items unattended, when the user explicitly asked for it | bunqueue-working-autonomously (skill) |
| Architecture, env vars, TCP commands, CLI, schema | docs/agents/project-reference.md |
| Simple Mode, Workflow Engine, Client SDK options | docs/agents/client-reference.md |
| Debug endpoints, CPU and heap profiling | docs/agents/debugging.md |
| Test isolation, the gates and their rationale | docs/testing.md |
| Engineering reference (authoritative) | docs/README.md, docs/architecture.md, docs/data-model.md |
Architecture
A sharded priority-queue broker:
- Shards: auto-detected from CPU cores (power of 2, max 64); a queue maps to
fnv1aHash(queue) & SHARD_MASK. - Persistence: SQLite in WAL mode behind a 10 ms WriteBuffer that batches writes;
durable: truebypasses it. - Transport: TCP (msgpack) on port 6789, HTTP on port 6790, native TLS on both when
TLS_CERT_FILEandTLS_KEY_FILEare set. - Two modes: embedded (in-process) and TCP (client-server).
Request flow:
- PUSH: Client -> TcpPool -> TcpServer -> QueueManager -> Shard -> PriorityQueue -> WriteBuffer -> SQLite
- PULL: Client -> TcpServer -> QueueManager -> Shard -> PriorityQueue.pop()
- ACK: Client -> TcpServer -> AckBatcher -> Shard.complete() -> jobResults (LRU)
- FAIL: Client -> TcpServer -> Shard.fail() -> retry (backoff) or DLQ
Source layout
src/
cli/ CLI interface
client/ SDK: Queue, Worker, FlowProducer, Bunqueue (Simple Mode)
queue/ Queue with DLQ, stall detection
worker/ Worker with heartbeat, ack batching
tcp/ connection pool, reconnection
workflow/ Workflow Engine: Workflow DSL, Engine, Executor, Store
domain/ pure business logic
queue/ Shard, PriorityQueue, DlqShard, UniqueKeyManager
application/ use cases and managers
operations/ push, pull, ack, query, queueControl
infrastructure/ persistence, server, scheduler, backup
shared/ utilities: hash, lock, lru, skipList, minHeapThe Workflow Engine in src/client/workflow/ is a pure consumer of the queue (no core
changes): workflow.ts is the fluent DSL (.step(), .branch(), .path(),
.waitFor()), engine.ts the public facade, executor.ts step execution, branching,
compensation and signals, store.ts the SQLite execution state, types.ts the shared
types. It is exported as bunqueue/workflow.
Code conventions
- At most 300 lines per source file; split instead of growing one. One concern per file, export only what is needed.
- Lock hierarchy:
jobIndex->completedJobs->shards[N]->processingShards[N]; read first, then lock, release infinally, and neverawaitinside a shard's synchronous critical section. - Queue invariants (heap membership,
jobIndex, processing maps, counters, temporal indexes, group ownership, concurrency slots) transition exactly once. - Type check with
bun checkand format withbun fmtonly, through the package scripts.
Gotchas
.claude/skills/<name>are relative symlinks into.agents/skills/. On Windows Git checks symlinks out as plain text files unless symlinks are enabled, and Claude Code then finds no skill: clone withgit clone -c core.symlinks=true(symlinks need Windows Developer Mode or an elevated shell). A clone made without it needs a fresh clone with the setting; the canonical.agents/skills/is unaffected.- The repository root also holds
skills/bunqueue/andagents/: the Claude Code plugin for people who use bunqueue in their applications. They are product documentation, not contributor instructions; contributor skills live in.agents/skills/. - The reference pages under
docs/agents/are summaries. When one disagrees with the engineering reference or the code, the code anddocs/win, and the summary is fixed in the same change. - Every code change updates
/docsand the changelog in the same change-set; a change is not complete while its documentation is stale.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

