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.
curl -O https://raw.githubusercontent.com/zhenruyan/postgrebase/master/AGENTS.mdgit clone --depth 1 https://github.com/zhenruyan/postgrebaseWrote 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/zhenruyan/postgrebase/agents-md)<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.
<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>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.05684 | $0.05684 |
| Opus 5.5 | $0.02274 | $0.02274 |
| Sonnet 5.5 | $0.01137 | $0.01137 |
| Haiku 4.5 | $0.00568 | $0.00568 |
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.
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— PostgreSQLgithub.com/go-sql-driver/mysql— MySQLmodernc.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.
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.
- 22d ago Changed · +67 lines · +1,154 tokens per session 8967f2113680
- 2mo ago First seen · 294 lines · 4,530 tokens per session scan A 99f39855f263
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.
postgrebase AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| postgrebase AGENTS.mdzhenruyan/postgrebase | Instructions file | 99 | 23d ago | MIT | A | 5,684 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | 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 |