PgQue is a PostgreSQL-based event queue that stores a shared log of events and lets each consumer track its own position. Teams use it to build durable event-driven workflows inside PostgreSQL without a separate queue daemon, on PostgreSQL 14 or later. It is installed from one SQL file and advanced by pg_cron or pg_timetable.
Borrowing it
Nothing to install: this file belongs to NikolayS/PgQue. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/NikolayS/PgQue/main/CLAUDE.mdgit clone --depth 1 https://github.com/NikolayS/PgQueWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/nikolays/pgque/claude-md)<a href="https://agentmods.dev/instructions/nikolays/pgque/claude-md"><img src="https://agentmods.dev/badge/instructions/nikolays/pgque/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/nikolays/pgque/claude-md"><img src="https://agentmods.dev/badge/instructions/nikolays/pgque/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02536 | $0.02536 |
| Opus 5.5 | $0.01014 | $0.01014 |
| Sonnet 5.5 | $0.00507 | $0.00507 |
| Haiku 4.5 | $0.00254 | $0.00254 |
Grade A, and why
PgQue CLAUDE.md 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 1mo ago.
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.
How it starts
The opening of the file, as written. The whole thing — 214 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md -- PgQue
Project
PgQue (pgque) -- PgQ Universal Edition. Zero-bloat PostgreSQL queue repackaged from PgQ for managed database environments. Repo: NikolayS/pgque.
Naming Convention
pgque-- lowercase for schema, package names, CLI, repo, function prefixesPgQue-- capitalized form for prose, headings, README titles- Mirrors PostgreSQL ecosystem convention (pgmq, pg_cron, psycopg)
Architecture
Two-layer design:
- pgque-core: Productization of PgQ (rename, PG14+ modernization, pg_cron, security hardening, single-file install). Mechanical transformation of ~4,028 lines of proven PL/pgSQL.
- pgque-api: Modern convenience layer (send/receive/ack/nack, DLQ, delayed delivery). New code (~1,500 lines) that must reduce cleanly to PgQ primitives.
See blueprints/SPECx.md for the full specification.
See blueprints/SPEC.md for PgQ internals reference (rotation mechanics,
snapshot isolation, batch_event_sql algorithm, dual-filter optimization).
Stack
- Pure SQL + PL/pgSQL (no extensions, no
.controlfile) - Anti-extension design:
\i pgque.sqlto install - Works on RDS, Aurora, Cloud SQL, AlloyDB, Supabase, Neon, Crunchy Bridge
- Optional pg_cron for automated ticker and maintenance
- PostgreSQL 14+ required (uses
pg_snapshot,xid8)
Style Rules
These rules are the source of truth for agentic engineering in this repo. Agents and AI coding tools must read this file before making changes.
SQL Style
- Follow the Postgres.AI SQL style guide: https://gitlab.com/postgres-ai/rules/-/blob/main/rules/development__db-sql-style-guide.mdc The rules below restate its core plus pgque-specific additions; on any conflict, this file wins.
- Prefer C-style
/* ... */block comments for anything spanning 2+ lines; use--only for single-line comments. - Comments state what the code cannot: a constraint, a non-obvious
invariant, a concurrency hazard. Per-function headers and inline
comments say that in 1-3 lines; do NOT write per-function essays or
step-by-step narration alongside the code. One consolidated
design-notes block per file (or per section) is encouraged for the
bigger picture -- keep it C-style, and it may cite the spec
(
SPEC section 15). - Do NOT cite user-story or requirement IDs (
US-13.4,I2,G2) or other spec-process artifacts in code, and do not restate the spec at length. Longer rationale lives inblueprints/and the specs; a short pointer (SPEC section 15,see blueprints/...) is fine. - These style rules govern pgque-authored code only. The inherited PgQ engine (batch/tick/rotation and other repackaged PgQ internals) keeps its original comment style and is never restyled.
- Collapse single-argument keyword clauses onto one line (
select 1,from t,where x = y,into v); expand only multi-argument clauses, one argument per line. - Lowercase SQL keywords:
select,create function, notSELECT,CREATE FUNCTION snake_casefor all identifiers- Schema-qualify all internal references:
pgque.queue, not justqueue - Root SQL keywords must be left-aligned within the statement. Do not use
decorative vertical indentation like
select/from/whereshifted by different amounts. This is non-negotiable for generated and source SQL. - Put
and/orat the start of continuation lines, aligned under the statement'swhereclause indentation. - All
SECURITY DEFINERfunctions MUST includeSET search_path = pgque, pg_catalog - Use
xid8for transaction ID columns,pg_snapshotfor snapshot columns - Use modern PG14+ function names:
pg_current_xact_id()nottxid_current()
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.
- 1mo ago Changed · +5 lines · +59 tokens per session 6d3b03c8314d
- 2mo ago First seen · 209 lines · 2,477 tokens per session scan A 61f1a6370018
PgQue CLAUDE.md is an instructions file published in the GitHub repository NikolayS/PgQue (1,873 stars, last pushed 10d ago), licensed Apache-2.0. It adds 2,536 tokens to every session, about $0.0101 per session on Opus 5.5. 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-30.
PgQue CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| PgQue CLAUDE.mdNikolayS/PgQue | Instructions file | 1.9k | 10d ago | Apache-2.0 | A | 2,536 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |