PgQue CLAUDE.md

A set of project instructions for PgQue, a PostgreSQL-based queue that stores and delivers background tasks. It describes the project’s naming, architecture, SQL stack, and supported managed database services.

In plain words
What is it for?
Use it when developing or reviewing PgQue’s SQL and PL/pgSQL code, installation scripts, queue API, delayed delivery, acknowledgements, or dead-letter queue behavior.
Why use it?
It gives coding agents the project rules and design context needed to make consistent changes without guessing how the queue is structured.

Instructions file

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/nikolays/pgque/claude-md
Clone the repo
git clone --depth 1 https://github.com/NikolayS/PgQue
Per session 2,477 This file is loaded in full into every session.
When invoked 2,477 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.02477 $0.02477
Opus 5 $0.01239 $0.01239
Sonnet 5 $0.00495 $0.00495
Haiku 4.5 $0.00248 $0.00248

Measured 3d ago against content hash 61f1a6370018, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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 3d 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.

CLAUDE.md · 209 lines

How it starts

The opening of the file, as written. The whole thing — 209 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 prefixes
  • PgQue -- 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 .control file)
  • Anti-extension design: \i pgque.sql to 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 in blueprints/ 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, not SELECT, CREATE FUNCTION
  • snake_case for all identifiers
  • Schema-qualify all internal references: pgque.queue, not just queue
  • Root SQL keywords must be left-aligned within the statement. Do not use decorative vertical indentation like select / from / where shifted by different amounts. This is non-negotiable for generated and source SQL.
  • Put and / or at the start of continuation lines, aligned under the statement's where clause indentation.
  • All SECURITY DEFINER functions MUST include SET search_path = pgque, pg_catalog
  • Use xid8 for transaction ID columns, pg_snapshot for snapshot columns
  • Use modern PG14+ function names: pg_current_xact_id() not txid_current()

Read the full file on GitHub · 209 lines

Changes

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.

  1. 3d ago First seen · 209 lines · 2,477 tokens per session scan A 61f1a6370018

Subscribe to this mod's changes

PgQue CLAUDE.md is an instructions file published in the GitHub repository NikolayS/PgQue (1,813 stars, last pushed 8d ago), licensed Apache-2.0. It adds 2,477 tokens to every session, about $0.0124 per session on Opus 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.