postgrebase: Instructions file for Codex

AGENTS.md

postgrebase AGENTS.md is an instructions file for Codex, OpenCode from zhenruyan/postgrebase. It costs 5,684 tokens per session, scanned A, original, MIT.

Development instructions for PostgreBase, a no-code API platform based on PocketBase that can work with PostgreSQL, MySQL, and SQLite. They describe its Go backend, Svelte frontend, project layout, dependencies, and offline build setup.

In plain words
What is it for?
Finding backend and frontend code, understanding database and cache support, preserving vendored packages, and building or running the project.
Why use it?
They give agents the technical context needed to navigate and modify the codebase correctly. They also highlight important constraints such as vendored dependencies and builds without CGO.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md.

This is zhenruyan/postgrebase's own configuration. It tells Codex and OpenCode how to work on postgrebase itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything postgrebase configures →

Reuse

Borrowing it

Nothing to install: this file belongs to zhenruyan/postgrebase. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/zhenruyan/postgrebase/master/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/zhenruyan/postgrebase

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for postgrebase AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/zhenruyan/postgrebase/agents-md/github.svg)](https://agentmods.dev/instructions/zhenruyan/postgrebase/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/zhenruyan/postgrebase/agents-md"><img src="https://agentmods.dev/badge/instructions/zhenruyan/postgrebase/agents-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.

agentmods 80×15 button for postgrebase AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/zhenruyan/postgrebase/agents-md"><img src="https://agentmods.dev/badge/instructions/zhenruyan/postgrebase/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 5,684 This file is loaded in full into every session.
When invoked 5,684 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.05684 $0.05684
Opus 5.5 $0.02274 $0.02274
Sonnet 5.5 $0.01137 $0.01137
Haiku 4.5 $0.00568 $0.00568

Measured 22d ago against content hash 8967f2113680, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

postgrebase AGENTS.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 22d 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.

AGENTS.md · 361 lines

How it starts

The opening of the file, as written. The whole thing — 361 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PostgreBase — Agent Development Guide

This file provides context for AI coding agents (Cursor, Claude, Windsurf, etc.) working on the PostgreBase codebase. Read this before exploring or modifying code.

Overview

PostgreBase 是 AI 原生的无代码 API 开发平台,基于 PocketBase 重构。内置 MCP (Model Context Protocol) 服务器,让 AI 工具直接操作数据。支持 PostgreSQL、MySQL、SQLite 三种数据库,混合缓存(Redis / 内存),100% 兼容 PocketBase API、Admin UI 和业务逻辑。

Tech Stack

  • Language: Go 1.26.2+ (builds with CGO_ENABLED=0)
  • HTTP Framework: github.com/labstack/echo/v5
  • CLI: github.com/spf13/cobra
  • Database Drivers:
    • github.com/lib/pq — PostgreSQL
    • github.com/go-sql-driver/mysql — MySQL
    • modernc.org/sqlite — SQLite (pure Go, no CGO)
  • Caching: github.com/redis/go-redis/v9 (Redis) / built-in memory store
  • Frontend: Svelte 3, svelte-spa-router, Vite 4, PocketBase JS SDK
  • Vendor: /vendor/ directory must be preserved — all dependencies are vendored for offline builds.

Project Structure

postgrebase/
├── build/              # Server entry point (main.go)
├── postgrebase.go      # Root package: CLI setup, Config struct, Bootstrap
├── core/               # Application logic
│   ├── base.go         # BaseApp: cache init, app lifecycle
│   ├── db_postgresql.go # connectDB(): DSN parsing and driver detection
│   └── app.go          # App interface definition
├── daos/               # Data access objects (CRUD for all models)
│   ├── base.go         # Dao struct, ModelQuery, RunInTransaction
│   ├── record.go       # Record CRUD
│   ├── record_table_sync.go # Table schema sync (driver-aware DDL)
│   ├── table.go        # HasTable, TableColumns, TableInfo, TableIndexes (driver-aware)
│   ├── collection.go   # Collection queries
│   ├── admin.go        # Admin auth and queries
│   └── view.go         # SQL view management
├── models/             # Data models
│   ├── base.go         # BaseModel (Id, Created, Updated, RefreshId)
│   ├── record.go       # Record model
│   ├── collection.go   # Collection model
│   ├── admin.go        # Admin model (bcrypt password, JWT token key)
│   └── schema/
│       └── schema_field.go # SchemaField.ColDefinition(driverName) — driver-aware DDL
├── apis/               # HTTP API handlers
│   ├── base.go         # InitApi(): route registration, MCP route binding
│   ├── serve.go        # HTTP server, migration runner, startup banner
│   ├── record_crud.go  # Record CRUD endpoints
│   ├── admin.go        # Admin auth endpoints
│   ├── mcp_token.go    # MCP token management API (CRUD)
│   └── middlewares.go   # Auth middleware (RequireAdminAuth, etc.)
├── mcp/                # MCP (Model Context Protocol) server
│   ├── server.go       # JSON-RPC 2.0 core, method routing, tool schemas
│   ├── tools.go        # 8 MCP tools (CRUD + search for records/collections)
│   ├── resources.go    # 2 MCP resources (collections, settings)
│   ├── auth.go         # Token validation (JWT admin tokens + mcp_ prefixed tokens)
│   ├── transport_sse.go    # SSE + Streamable HTTP transport
│   └── transport_stdio.go  # Stdin/stdout transport
├── migrations/         # Database migrations (driver-aware SQL)
│   ├── 1640988000_init.go              # Core tables (admins, collections, params, externalAuths)
│   ├── 1691747914_add_cache_columns.go # Cache columns migration
│   ├── 1704067200_mcp_tokens.go        # MCP tokens collection
│   └── 1730000000_agent_runtime.go     # Agent sessions/messages/audit/project-config tables
├── agents/             # Embedded agent platform (orchestration over controlled tools)
│   ├── service.go      # Service facade (runtime, sessions, tools, run)
│   ├── runtime.go      # RunSession: mothx agent loop, naming, audit
│   ├── toolkit.go      # ToolRegistry + schema.*/data.* executors + ChartHint
│   ├── sdk_tools.go    # agent.ExternalTool adapter (project scope + write authz)
│   ├── authz.go        # RunOptions, write-approval policy, audit sink
│   ├── project_config.go # per-project overrides (§9.1)
│   ├── files.go        # record file ref → image content block (§6.2)
│   └── store_db.go     # DB-backed session/message store
├── vector/             # Vector runtime + SQLite cluster coordination
│   ├── manager.go      # State machine (entries, tasks, status); Persist/snapshotLocked
│   ├── cluster.go      # Coordinator: lightweight raft leader/log/snapshot replication
│   ├── cluster_http.go # HTTP transport (heartbeat/replicate/forward/send-snapshot)
│   ├── operation.go    # ReplicatedOperation kinds + vector op wrap/unwrap
│   ├── engine_db.go    # DB-backed snapshot storage
│   └── store_db.go     # DB-backed task/entry stores + metrics.go
├── replication/        # operations.go — ReplicatedOperation encode/decode + Apply() to the main DAO
├── cmd/                # CLI commands
│   ├── serve.go        # `serve` command
│   ├── admin.go        # `admin create` command
│   └── mcp.go          # `mcp` command (stdio transport)
├── dbx/                # Database query builder (fork of ozzo-dbx)
│   ├── builder.go      # BaseBuilder: CreateTable, AddColumn, DropColumn, etc.
│   ├── builder_sqlite.go # SqliteBuilder: SQLite-specific overrides
│   ├── builder_pgsql.go  # PgsqlBuilder: PostgreSQL-specific overrides
│   └── builder_mysql.go  # MysqlBuilder: MySQL-specific overrides
├── tools/              # Shared utilities
│   ├── security/       # JWT, bcrypt, random string generation
│   ├── types/          # DateTime (custom time type with Scan/MarshalJSON)
│   ├── search/         # Filter/sort/search provider
│   ├── migrate/        # Migration runner
│   └── list/           # Slice/string helpers
├── ui/                 # Admin UI (Svelte SPA)
│   ├── src/
│   │   ├── components/settings/PageMCPTokens.svelte # MCP token management page
│   │   └── routes.js   # SPA routes (includes /settings/mcp-tokens)
│   └── dist/           # Built frontend (embedded in Go binary)
└── vendor/             # **DO NOT DELETE.** All Go dependencies.

Read the full file on GitHub · 361 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. 22d ago Changed · +67 lines · +1,154 tokens per session 8967f2113680
  2. 2mo ago First seen · 294 lines · 4,530 tokens per session scan A 99f39855f263

Subscribe to this mod's changes

postgrebase AGENTS.md is an instructions file published in the GitHub repository zhenruyan/postgrebase (99 stars, last pushed 23d ago), licensed MIT. It adds 5,684 tokens to every session, about $0.0227 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.

Related

postgrebase AGENTS.md compared with instructions from other repositories

postgrebase AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
postgrebase AGENTS.mdzhenruyan/postgrebaseInstructions file9923d agoMITA5,684Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode