gopdfsuit
AGENTS.md607 starsChanged 59 days agoMITView on GitHub
This file is the conventions ledger for every coding agent working in this repo (opencode, grok, gemini, codex, antigravity/agy, claude). Read it at session start. Keep it current as the repo evolves. Template-based PDF platform in Go with React UI and Python bindings. 1. Create todos in the response via API before any work. On receiving any task (feature, fix, docs, question with multi-step work), immediately call the todo API (todowrite or equivalent) to publish the plan as todos. Do…
- Reads credentials
- Commits and pushes
We split this AGENTS.md into the rules it gives an agent
15 rules. About 0 are common, 4 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
11
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
- Very specific: line 13
Default branch: master (origin/HEAD points to origin/master)
- Very specific: line 36
Do not store todos on disk: Do not create TODO.md, todos.json, or any other todo-tracking file.
- Distinctive: line 45
If the todo API is unavailable, state that in the response and list todos inline as a fallback - still do not write a file.
- Distinctive: line 50
No git commands without explicit permission: Never run git add, git commit, git push, git restore, git clean, git reset, or git stash …
- Distinctive: line 61
Run targeted checks during a session.
- Very specific: line 78
Do not hand-edit docs/ (Vite output).
- Very specific: line 79
Do not import internal/* from outside the module.
- Very specific: line 80
Do not use encoding/json on hot paths.
- Very specific: line 81
Do not trust veraPDF alone.
- Very specific: line 82
Do not assume XFDF fill works on compressed object streams.
- Very specific: line 83
Do not commit secrets, certs, .env, verapdf/ binaries, .pdf-validators/, reports/, or temp_*.pdf.
- Very specific: line 84
Do not rely on WSL-only scripts or make targets inside PowerShell or CMD.
- Very specific: line 85
Do not claim completion without gate output.
- Distinctive: line 114
No Ghostscript. No browser.
- Very specific: line 116
Add deps only via go mod tidy plus setup-auth.sh flow.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 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.
Files
AGENTS.md
This file is the conventions ledger for every coding agent working in this repo (opencode, grok, gemini, codex, antigravity/agy, claude). Read it at session start. Keep it current as the repo evolves.
Project
Template-based PDF platform in Go with React UI and Python bindings.
- Module:
github.com/chinmay-sawant/gopdfsuit/v7(Go 1.26.4) - GitHub repo:
https://github.com/chinmay-sawant/gopdfsuit - Default branch:
master(origin/HEADpoints toorigin/master) - Binaries / libraries / apps:
bin/appfromcmd/gopdfsuit/main.go(Gin REST API on :8080)frontend/public/compress.wasmfromcmd/wasmcompress/main.go(in-browser compressor)pkg/gopdflib/public Go library (Generate, Merge, Split, Compress, Fill, Redact, HTML)bindings/python/wheelpypdfsuitvia CGOexports.gopluslibgopdfsuit.sofrontend/React 18 + Vite appgopdfsuit-frontend, builds todocs/static sitedockerfolder/DockerfileandDockerfile_cloudrunimages
- Pipeline / architecture overview:
- Upload JSON template plus base64 assets to
/api/v1/*, handlers ininternal/handlers/decode with pooled Sonic JSON, in-memory engine ininternal/pdf/renders (fonts embed, tagging, XMP, ECDSA sign, AES-256), PDF bytes in response. - Ops:
generate/template-pdf,fill(AcroForm/XFDF),merge/split,compress(Light/Med/Heavy tiers, server or WASM, no Ghostscript),htmltopdf/htmltoimage(pure-Go via gowkhtmltopdf, no browser),redact/*,fontsGET/POST,template-data. - Compliance: PDF 2.0 base, opt-in PDF/A-4 (
pdfaCompliant:true) plus PDF/UA-2 (tagging, MCID, ParentTree), PKCS#7/X.509 RSA plus ECDSA P-256 signatures. Validation via vendoredverapdf/(needs Java 11+) plusstructure_tree_check.pyandtest/verify_pdfs.sh.
- Upload JSON template plus base64 assets to
Todo protocol - response-only (mandatory)
- Create todos in the response via API before any work. On receiving any
task (feature, fix, docs, question with multi-step work), immediately call
the todo API (
todowriteor equivalent) to publish the plan as todos. Do not start work until the todo list is visible in the API response. - Show current todos in every response. Each assistant turn must render
the current todo list with status markers (
pending,in_progress,completed,cancelled) and clearly highlight which item isin_progress. - Do not store todos on disk. Do not create
TODO.md,todos.json, or any other todo-tracking file. Todos live only in the API response state. - Keep response todos updated as you go. Mark items
in_progresswhen started andcompletedwhen finished. If scope changes, update the list immediately. - Completion requires todos to show done. A task is done only when all
todos show
completedand you have sent a final summary stating what shipped.
If the todo API is unavailable, state that in the response and list todos inline as a fallback - still do not write a file.
Golden rules
- No git commands without explicit permission. Never run
git add,git commit,git push,git restore,git clean,git reset, orgit stashunless the user asks. - No em dashes in any written output, docs, or commit messages. Use plain hyphens or restructure.
- Branch naming:
feat/<slug>,fix/<slug>,chore/<slug>,exp/<slug>(seefeature/compression-nogs,chore/improves-fixes,exp/cursor-optimization). Create from issue number context, push with-u. - PR / issue process: use
skills/PR/templates verbatim. Self-assign with--assignee "@me", apply at least one label, linkCloses #NorRelates to #N, save process-gated body underplans/PR/pr-<slug>.mdbeforegh pr create. - Checklist rule: for phased work use
skills/phase-wise-checklist/with one canonical ledger underplans/. Update a row to[x]only after itsmakegate passes. Never keep duplicate active rows in two files. - Writing quality: run
skills/unslop/on all prose, explain withskills/feynman/loop when touching PDF engine semantics (fonts, tagging, xref, compress tiers, XFDF).
Verification gates
Run targeted checks during a session. Run the full set once at session end before claiming done.
| Gate | Command | What it proves |
| Full Go plus Python plus PDF compliance | make test | go test ./... plus bindings/python pytest plus test/verify_pdfs.sh pass |
| Integration suite | make test-integration | go test -count=1 -v ./test handler suite standalone (full gate is make test: go plus python plus verify, sequential) |
| Lint backend plus frontend | make lint | golangci-lint run -E revive,gocritic,gocyclo,goconst ./... plus frontend npm run lint clean |
| Build binary | make build | Integration tests pass plus go build -o bin/app ./cmd/gopdfsuit succeeds |
| Frontend bundle | cd frontend && npm run build | Vite build plus WASM compressor bundle succeed |
| Format and vet | make fmt && make vet then go fmt ./..., go vet ./... | Formatting and vet clean before lint |
| PDF compliance spot check | make test-verify-pdfs or make test-scan-pdfs-compliance or make test-zerodha-compliance | veraPDF plus structure tree checks pass on fixtures |
| WASM artifact | make wasm-compress | GOOS=js GOARCH=wasm build to frontend/public/compress.wasm succeeds |
Notes: CI only runs lint plus docs/ build. Always run make fmt && make lint && make test locally. Frontend needs zero ESLint warnings. Never hand-edit docs/ output, it is Vite build output auto-committed by CI.
Things to AVOID
- Do not hand-edit
docs/(Vite output). Editfrontend/src/and rebuild. - Do not import
internal/*from outside the module. External Go code usespkg/gopdflib. - Do not use
encoding/jsonon hot paths. Usebytedance/sonicplus pooledStreamDecoder. Preservesync.Poolreuse (pdfBuffer, zlib, fontRegistry) and tier prealloc. - Do not trust veraPDF alone. ParentTree MCID checks need
structure_tree_check.py(MCID must point to TD or TH, not TR).avalpdfoutput is warnings-only unlessVERIFY_AVALPDF_STRICT=1. - Do not assume XFDF fill works on compressed object streams. The
/NeedAppearances truebyte approach fails there and needs pdfcpu path. - Do not commit secrets, certs,
.env,verapdf/binaries,.pdf-validators/,reports/, ortemp_*.pdf. Respect.gitignore(*.exe,*.so,*.test,*.out, coverage profiles). - Do not rely on WSL-only scripts or
maketargets inside PowerShell or CMD. - Do not claim completion without gate output. Paste
make test,make lint, ormake test-integrationresults.
Code structure
cmd/gopdfsuit/main.go: Gin server entrypoint.cmd/wasmcompress/main.go: WASM compressor entrypoint.pkg/gopdflib/: public API, one file per op (generator, merge, split, compress, fill, redact, html).pkg/fontutils/: font helpers.internal/pdf/: private engine (generator, pagemanager, draw, merge/, compress/, redact/, form/xfdf, signature/, encryption/, svg/, xref/).internal/pdf/font/: split intosubset.go,ttf.go,metrics.go,compression.go,compress_cache.go,pdfa.go,registry.go,types.go.internal/handlers/,internal/models/(PDFTemplate JSON),internal/middleware/(cors, Google auth),internal/benchmarktemplates/.frontend/src/pages/: Merge, Split, Compress, Viewer, Editor, converters. Stack: Vite 5, React 18, react-router-dom 6, react-pdf 10, HeadlessUI 2.bindings/python/pypdfsuit/: generator, merge, split, fill, redact, html, compress viacgo/exports.go.test/: Go integration testsintegration_*_test.goplus k6 scripts intest/generate_template-pdf/.sampledata/: fixtures per feature (merge/,split/,compress/,filler/,financialreport/,typstsyntax/,gopdflib/zerodha/,benchmarks/).documentation/: operational docs (AUTHENTICATION.md,BENCHMARKS.md,DEPLOYMENT_CHECKLIST.md,TEMPLATE_REFERENCE.md, plus caching, validators, signatures, getting started).guides/holds remaining build and optimization notes.plans/: design notes plusplans/PR/ledger.typstsyntax/: Typst subset lexer, parser, renderer.- Tests colocated as
*_test.go. Directory name equals package name (pdf,font,xref,models,middleware,gopdflib,typstsyntax).
Skills (this repo)
Skills live under skills/<name>/. Current inventory:
skills/PR/- templates for PRs, issues, review comments (gopdfsuit gates and examples)skills/feynman/- plain-words explanation loop with self-auditskills/unslop/- cut AI tells from writing, add human voiceskills/phase-wise-checklist/- evidence-backed, phase-wise implementation checklists
Dependency policy
Allowed runtime deps are pinned in go.mod (v7, go 1.26.4 exact):
gin-gonic/gin,chinmay-sawant/gowkhtmltopdf(pure-Go HTML),bytedance/sonic,golang.org/x/sync,google.golang.org/api. Indirect:goccy/go-json,ugorji/go.- No Ghostscript. No browser. System prereqs only: Java 11+ (veraPDF), Node 18+ (frontend), Python 3.8+ (bindings).
policy.jsonis GAR artifact retention only, not a PDF policy.- Add deps only via
go mod tidyplussetup-auth.shflow. Frontend deps viafrontend/package.jsonplusnpm ci. Keepgo.sumin sync.
FAQ - does the root AGENTS.md get read automatically?
Yes. Creating AGENTS.md at the repo root is the standard, and it is read
automatically by every major tool: opencode, codex, gemini CLI,
antigravity/agy, grok, claude code, cursor. You do not need anything under
.agents/. Keep this one file at the root and keep it current.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository4 other files it gives its agents.
- feynmanSkill
- phase-wise-checklistSkill
- PRSkill
- unslopSkill
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
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.

