agentleFS
egeominottiegeominotti/bunqueue/AGENTS.md

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

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
  1. Distinctive:

    Read this file completely, then only the pages your task needs (Where things live).

    line 17
  2. Very specific:

    Run ./init.sh, the startup check (--help lists its steps).

    line 19
  3. Very specific:

    Read feature_list.json (work items) and progress.md (Current State, newest Session Log entry), then git log --oneline -5.

    line 22
  4. Very specific:

    If the baseline fails, repair it before adding scope.

    line 24
  5. Very specific:

    Stay in scope: keep changes narrowly scoped to the requested behavior.

    line 35
  6. Very specific:

    Skeptic: before every git commit and every git push, invoke the skeptic custom subagent and wait for its verdict.

    line 44
  7. Distinctive:

    Keep all repository content in English, including source comments, tests, internal documentation, user-facing documentation and agent …

    line 59
  8. Very specific:

    Use rg/rg --files for searches and apply_patch for manual source edits.

    line 61
  9. Very specific:

    Keep hot queue paths synchronous while a shard lock is held: no await inside a synchronous critical section.

    line 72
  10. Distinctive:

    Use deterministic tie-breakers for paginated queries and add migrations for schema or index changes.

    line 78
  11. Distinctive:

    Do not silently change externally visible scheduling semantics.

    line 80
  12. Distinctive:

    Keep source files at or below 300 lines, one responsibility each, exporting only what is needed.

    line 83
  13. Very specific:

    Every code change must update the corresponding internal technical documentation under /docs in the same change-set.

    line 91
  14. Very specific:

    Update docs/features/<slug>.md when changing a module.

    line 94
  15. Very specific:

    Update docs/data-model.md and/or the relevant feature document when changing a public type, SQLite table or index, TCP command, HTTP …

    line 96
  16. Very specific:

    Update docs/architecture.md when components, data flows, or the module map change.

    line 99
  17. Distinctive:

    Run repository tests in an isolated OrbStack Machine by default.

    line 105
  18. Very specific:

    MANDATORY: run bun run test:model before the sandbox after changes affecting job lifecycle, persistence/recovery, scheduling/order, …

    line 122
  19. Very specific:

    MANDATORY: after ANY code modification run bun run test:sandbox before committing.

    line 131
  20. Very specific:

    MANDATORY: after ANY modification under sdk/ run bun run test:sandbox:sdk before handoff (and again before committing after more SDK …

    line 136
  21. Very specific:

    Update your lines of the progress.md Current State (Last Updated:, done, next, Blockers/Risks) and prepend a dated Session Log entry.

    line 161
  22. Very specific:

    Update your item in feature_list.json: status, evidence, branch.

    line 163
  23. Very specific:

    Leave ./init.sh green and the worktree clean enough to restart from.

    line 166
  24. Distinctive:

    Commit only when authorized and through the gates below.

    line 167
  25. Very specific:

    After a push, watch CI until it is green (bunqueue-running-gates).

    line 168
  26. Very specific:

    Before every authorized git commit, update docs/src/content/docs/changelog.md for the staged changes in the same commit.

    line 172
  27. Distinctive:

    Before every authorized git push, verify that each outgoing commit already contains its changelog update and a compliant message.

    line 176
  28. Distinctive:

    Do not create commits, push, bump the package version, or publish unless the user explicitly authorizes the relevant action.

    line 179
  29. Very specific:

    Every release gets a hand-written post drafted with bun docs/scripts/generate-release-posts.ts in the release-preparation commit: …

    line 184

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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

  1. Confirm the worktree and branch: pwd, git branch --show-current.
  2. Read this file completely, then only the pages your task needs (Where things live).
  3. Run ./init.sh, the startup check (--help lists its steps). It is not a commit gate (bun run test:sandbox is), but a green run is part of the Definition of Done.
  4. Read feature_list.json (work items) and progress.md (Current State, newest Session Log entry), then git log --oneline -5.
  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.json whose dependencies are done and set it in-progress with its branch; at most one in-progress item 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-case id, issue when 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-started items.
  • 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 the progress.md Current State, and prepend Session Log entries. On a rebase conflict: feature_list.json keeps 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 commit and every git push, invoke the skeptic custom 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. FAIL blocks the operation; CONDITIONAL requires 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 --files for searches and apply_patch for manual source edits.
  • Runtime source is TypeScript ESM, 2-space, single-quote, semicolon style; bun fmt (configured in bunfig.toml) is authoritative.
  • MANDATORY: type check only with bun check and format only with bun fmt, in every directory and every SDK (bun run typecheck, bun run format:check; --no-script inside scripts and CI). Never use tsc --noEmit, ESLint, Prettier, Biome, oxlint, oxfmt or lint-suppression comments. tsc remains 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 await inside 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 in finally.

Documentation

  • Every code change must update the corresponding internal technical documentation under /docs in the same change-set. A code change is not complete while its documentation is stale.
  • Update docs/features/<slug>.md when changing a module. New modules also need links from docs/README.md and docs/architecture.md.
  • Update docs/data-model.md and/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.md when components, data flows, or the module map change. The Astro user documentation under docs/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:model before the sandbox after changes affecting job lifecycle, persistence/recovery, scheduling/order, dependencies, deduplication, leases, rate/concurrency limits, counters, temporal indexes, or jobIndex. It runs the fast-check model 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 deterministic test/repro-model-*.test.ts regression before fixing it.
  • MANDATORY: after ANY code modification run bun run test:sandbox before 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/ run bun run test:sandbox:sdk before 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:sandbox after any code change, bun run test:model and bun run test:sandbox:sdk when triggered, bun run typecheck, bun run format:check.
  • /docs and the changelog [Unreleased] section describe the change.
  • The skeptic verdict is PASS (CONDITIONAL only with explicit confirmation).
  • ./init.sh is 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

  1. Update your lines of the progress.md Current State (**Last Updated:**, done, next, Blockers/Risks) and prepend a dated Session Log entry.
  2. Update your item in feature_list.json: status, evidence, branch.
  3. For multi-session work, fill a handoff from session-handoff.md into that entry.
  4. Record every unresolved risk, blocker and check you could not run.
  5. Leave ./init.sh green and the worktree clean enough to restart from.
  6. Commit only when authorized and through the gates below.
  7. After a push, watch CI until it is green (bunqueue-running-gates).

Commits and handoff

  • Before every authorized git commit, update docs/src/content/docs/changelog.md for 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.ts in 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

NeedRead
State and startupfeature_list.json, progress.md, session-handoff.md, ./init.sh
The harness and its contractdocs/agents/README.md
Procedures (Agent Skills).agents/skills/
Testsdocs/testing.md
Architecture and protocoldocs/agents/project-reference.md
Client APIsdocs/agents/client-reference.md
Debugging and profilingdocs/agents/debugging.md
Releasesdocs/agents/release.md
Engineering referencedocs/README.md, docs/architecture.md, docs/data-model.md

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.