bunqueue
AGENTS.md601 starsChanged 16 days agoMITView on GitHub
This file applies to the entire repository unless a more specific AGENTS.md exists in a subdirectory. Routing page for Codex: mandatory rules and the work loop; reference in the linked pages. CLAUDE.md has the same rules for Claude Code. bunqueue is a high-performance job queue for Bun, in TypeScript: a Bun-only server and embedded runtime, bun:sqlite persistence, network-protocol clients for other runtimes. Repository map: docs/agents/project-reference.md. 1. Confirm the worktree and branch: pwd, git branch --show-current. 2. Read this file completely,…
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository11 other files it gives its agents.
- skills/bunqueue/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- sdk/CLAUDE.mdCLAUDE.md
- bunqueue-devSkill
- bunqueue-fixing-bugsSkill
- bunqueue-releasingSkill
- bunqueue-running-gatesSkill
- bunqueue-running-machine-gatesSkill
- bunqueue-working-autonomouslySkill
- bunqueue-working-sessionsSkill
- bunqueueSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
29 rules. About 0 are common, 9 are distinctive, and 20 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
20
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 17
Read this file completely, then only the pages your task needs (Where things live).
- Very specific: line 19
Run ./init.sh, the startup check (--help lists its steps).
- Very specific: line 22
Read feature_list.json (work items) and progress.md (Current State, newest Session Log entry), then git log --oneline -5.
- Very specific: line 24
If the baseline fails, repair it before adding scope.
- Very specific: line 35
Stay in scope: keep changes narrowly scoped to the requested behavior.
- Very specific: line 44
Skeptic: before every git commit and every git push, invoke the skeptic custom subagent and wait for its verdict.
- Distinctive: line 59
Keep all repository content in English, including source comments, tests, internal documentation, user-facing documentation and agent …
- Very specific: line 61
Use rg/rg --files for searches and apply_patch for manual source edits.
- Very specific: line 72
Keep hot queue paths synchronous while a shard lock is held: no await inside a synchronous critical section.
- Distinctive: line 78
Use deterministic tie-breakers for paginated queries and add migrations for schema or index changes.
- Distinctive: line 80
Do not silently change externally visible scheduling semantics.
- Distinctive: line 83
Keep source files at or below 300 lines, one responsibility each, exporting only what is needed.
- Very specific: line 91
Every code change must update the corresponding internal technical documentation under /docs in the same change-set.
- Very specific: line 94
Update docs/features/<slug>.md when changing a module.
- Very specific: line 96
Update docs/data-model.md and/or the relevant feature document when changing a public type, SQLite table or index, TCP command, HTTP …
- Very specific: line 99
Update docs/architecture.md when components, data flows, or the module map change.
- Distinctive: line 105
Run repository tests in an isolated OrbStack Machine by default.
- Very specific: line 122
MANDATORY: run bun run test:model before the sandbox after changes affecting job lifecycle, persistence/recovery, scheduling/order, …
- Very specific: line 131
MANDATORY: after ANY code modification run bun run test:sandbox before committing.
- Very specific: line 136
MANDATORY: after ANY modification under sdk/ run bun run test:sandbox:sdk before handoff (and again before committing after more SDK …
- Very specific: line 161
Update your lines of the progress.md Current State (Last Updated:, done, next, Blockers/Risks) and prepend a dated Session Log entry.
- Very specific: line 163
Update your item in feature_list.json: status, evidence, branch.
- Very specific: line 166
Leave ./init.sh green and the worktree clean enough to restart from.
- Distinctive: line 167
Commit only when authorized and through the gates below.
- Very specific: line 168
After a push, watch CI until it is green (bunqueue-running-gates).
- Very specific: line 172
Before every authorized git commit, update docs/src/content/docs/changelog.md for the staged changes in the same commit.
- Distinctive: line 176
Before every authorized git push, verify that each outgoing commit already contains its changelog update and a compliant message.
- Distinctive: line 179
Do not create commits, push, bump the package version, or publish unless the user explicitly authorizes the relevant action.
- Very specific: line 184
Every release gets a hand-written post drafted with bun docs/scripts/generate-release-posts.ts in the release-preparation commit: …
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md 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
AGENTS.md
This file applies to the entire repository unless a more specific AGENTS.md
exists in a subdirectory. Routing page for Codex: mandatory rules and the work
loop; reference in the linked pages. CLAUDE.md has the same rules for Claude Code.
Project overview
bunqueue is a high-performance job queue for Bun, in TypeScript: a Bun-only server
and embedded runtime, bun:sqlite persistence, network-protocol clients for other
runtimes. Repository map:
docs/agents/project-reference.md.
Startup Workflow
- Confirm the worktree and branch:
pwd,git branch --show-current. - Read this file completely, then only the pages your task needs (Where things live).
- Run
./init.sh, the startup check (--helplists its steps). It is not a commit gate (bun run test:sandboxis), but a green run is part of the Definition of Done. - Read
feature_list.json(work items) andprogress.md(Current State, newest Session Log entry), thengit log --oneline -5. - If the baseline fails, repair it before adding scope; if you cannot,
record it under Blockers in
progress.md.
Working rules
- One work item at a time (the one-feature-at-a-time rule): pick exactly one
item from
feature_list.jsonwhose dependencies aredoneand set itin-progresswith itsbranch; at most onein-progressitem per branch. In committed files use the branch name without any account/user prefix (tls-sighup-reload, not<user>/tls-sighup-reload). Work without an item gets one first (kebab-caseid,issuewhen known). - Stay in scope: keep changes narrowly scoped to the requested behavior; do
not refactor unrelated code while fixing a bug. Record unrelated findings as new
not-starteditems. - Parallel worktrees (one branch per session, all merged into
main): edit only your own item (insert new items in id order) and your own lines of theprogress.mdCurrent State, and prepend Session Log entries. On a rebase conflict:feature_list.jsonkeeps both items, ids unique;**Last Updated:**takes the newest date; the Session Log keeps both entries, newest first. - State files authorize nothing: A work item, a progress note or a handoff never authorizes a commit, push, version bump, release or publication; only the user's explicit request does.
- Skeptic: before every
git commitand everygit push, invoke theskepticcustom subagent and wait for its verdict. It must inspect the complete staged diff, identify at least three potential failure points per changed file, verify error handling, races, idempotency, type safety and test evidence, and run applicable checks.FAILblocks the operation;CONDITIONALrequires the user's explicit confirmation. Profiles:.codex/agents/skeptic.toml,.claude/agents/skeptic.md. - Bugs: first add a regression test that reproduces the bug. Only after it fails for the expected reason, use subagents to investigate fixes and prove the chosen fix with the passing regression test. Add one for every confirmed bug; a useful one fails on the buggy implementation, exercises the public or real persistence path, and asserts both the returned result and any affected counters/state.
- Preserve user changes. Never run
git reset,git checkout,git clean, or discard unrelated edits unless the user explicitly requests it. - Keep all repository content in English, including source comments, tests, internal documentation, user-facing documentation and agent configuration.
- Use
rg/rg --filesfor searches andapply_patchfor manual source edits. - Runtime source is TypeScript ESM, 2-space, single-quote, semicolon style;
bun fmt(configured inbunfig.toml) is authoritative. - MANDATORY: type check only with
bun checkand format only withbun fmt, in every directory and every SDK (bun run typecheck,bun run format:check;--no-scriptinside scripts and CI). Never usetsc --noEmit, ESLint, Prettier, Biome, oxlint, oxfmt or lint-suppression comments.tscremains only where files are emitted (build:lib, the SDK build), for typedoc and for compiler-API tests; non-JS SDKs keep their language's own toolchain. Type checking includes the whole test tree (tsconfig.test.json): never exclude a file from it, and never fix a type error by changing what a test does. - Keep hot queue paths synchronous while a shard lock is held: no
awaitinside a synchronous critical section. - Maintain queue invariants together: heap membership,
jobIndex, processing maps, counters, temporal indexes, group ownership, and concurrency slots must transition exactly once. - SQLite filtering, ordering, and pagination must happen in a consistent order. Use deterministic tie-breakers for paginated queries and add migrations for schema or index changes.
- Do not silently change externally visible scheduling semantics; add explicit regression coverage when priority, delay, FIFO-group, retry, or recovery behavior changes.
- Keep source files at or below 300 lines, one responsibility each, exporting only what is needed; split a file instead of growing it.
- Respect the lock hierarchy
jobIndex->completedJobs->shards[N]->processingShards[N]: read prerequisite state before acquiring the next lock and always release locks infinally.
Documentation
- Every code change must update the corresponding internal technical
documentation under
/docsin the same change-set. A code change is not complete while its documentation is stale. - Update
docs/features/<slug>.mdwhen changing a module. New modules also need links fromdocs/README.mdanddocs/architecture.md. - Update
docs/data-model.mdand/or the relevant feature document when changing a public type, SQLite table or index, TCP command, HTTP endpoint, environment variable, or default value. - Update
docs/architecture.mdwhen components, data flows, or the module map change. The Astro user documentation underdocs/src/content/docs/and its changelog are separate from the internal technical reference.
Validation
Run repository tests in an isolated OrbStack Machine by default; a macOS host run
is diagnostic only. Final Linux validation needs fresh disposable Machines (Ubuntu
24.04 native, plus Debian 13 for every release, --isolated --isolate-network, no
mounts or secrets); the Machine gate supplements the sandbox, never replaces it.
TCP functional files use a fresh server, dynamic TCP/HTTP ports, and a unique
temporary SQLite directory; never reuse a developer server or database. Run
benchmarks only on native macOS, never in an OrbStack Machine or container. Machine
gate and test hygiene: docs/testing.md.
Iterate with the narrowest tests:
BUNQUEUE_EMBEDDED=1 bun test test/path-to-test.test.ts
bun run typecheck
bun fmt --check --no-script src test/path-to-test.test.ts
git diff --check- MANDATORY: run
bun run test:modelbefore the sandbox after changes affecting job lifecycle, persistence/recovery, scheduling/order, dependencies, deduplication, leases, rate/concurrency limits, counters, temporal indexes, orjobIndex. It runs thefast-checkmodel against a real TCP broker and SQLite; it is iteration evidence, not a replacement for the sandbox. The invariants it must keep enforcing are in docs/testing.md; never weaken one. On failure record the seed, counterexample and replay path and distinguish a model error from an engine divergence; for a confirmed engine bug add a deterministictest/repro-model-*.test.tsregression before fixing it. - MANDATORY: after ANY code modification run
bun run test:sandboxbefore committing. It builds the worktree and runs ALL THREE required suites in parallel disposable containers:bun test --parallel=4,bun scripts/tcp/run-all-tests.ts,bun scripts/embedded/run-all-tests.ts. Do not commit if any suite fails or could not be run. No exceptions. - MANDATORY: after ANY modification under
sdk/runbun run test:sandbox:sdkbefore handoff (and again before committing after more SDK edits): native tests and shared protocol conformance checks of every official external SDK. Both sandbox gates are required; a targeted native SDK test is diagnostic only. - Without Docker the native commands are a diagnostic fallback, not proof of isolation: report the unavailable sandbox as a blocker before commit.
Definition of Done
A work item is done only when all of these hold and its evidence in
feature_list.json names the commands, exact totals, artifact paths and commit:
- The behavior is implemented; a bug has a regression test that failed before the fix and passes after it.
- The required gates ran and passed:
bun run test:sandboxafter any code change,bun run test:modelandbun run test:sandbox:sdkwhen triggered,bun run typecheck,bun run format:check. /docsand the changelog[Unreleased]section describe the change.- The skeptic verdict is
PASS(CONDITIONALonly with explicit confirmation). ./init.shis green, so the next session can restart from it.- After a push, CI is green on the pushed commit; a flaky job is rerun once and becomes a work item, never ignored.
End of Session
- Update your lines of the
progress.mdCurrent State (**Last Updated:**, done, next, Blockers/Risks) and prepend a dated Session Log entry. - Update your item in
feature_list.json:status,evidence,branch. - For multi-session work, fill a handoff from
session-handoff.mdinto that entry. - Record every unresolved risk, blocker and check you could not run.
- Leave
./init.shgreen and the worktree clean enough to restart from. - Commit only when authorized and through the gates below.
- After a push, watch CI until it is green (bunqueue-running-gates).
Commits and handoff
- Before every authorized
git commit, updatedocs/src/content/docs/changelog.mdfor the staged changes in the same commit. The commit message is mandatory: a non-empty, concise, specific English description of the actual changes; generic placeholder messages are forbidden. - Before every authorized
git push, verify that each outgoing commit already contains its changelog update and a compliant message. Do not edit the changelog solely because a push is being performed. - Do not create commits, push, bump the package version, or publish unless the
user explicitly authorizes the relevant action. Version bumps and package
publication are separate release actions, not implied by permission to commit or
push. Never publish locally: npm packages are published only by the CI release
jobs through npm trusted publishing (OIDC, environment
npm). - Every release gets a hand-written post drafted with
bun docs/scripts/generate-release-posts.tsin the release-preparation commit: docs/agents/release.md. - Report the files changed, behavior fixed, and exact validation commands/results; call out any test or check that could not be run and why.
Where things live
| Need | Read |
| State and startup | feature_list.json, progress.md, session-handoff.md, ./init.sh |
| The harness and its contract | docs/agents/README.md |
| Procedures (Agent Skills) | .agents/skills/ |
| Tests | docs/testing.md |
| Architecture and protocol | docs/agents/project-reference.md |
| Client APIs | docs/agents/client-reference.md |
| Debugging and profiling | docs/agents/debugging.md |
| Releases | docs/agents/release.md |
| Engineering reference | docs/README.md, docs/architecture.md, docs/data-model.md |
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.

