Imported from danielPoloWork/egl-utils-cpp (
AGENTS.md). Install upstream withnpx skills add danielPoloWork/egl-utils-cpp. Copyright stays with the author.
AGENTS.md
Single source of truth for AI coding agents working on egl-util-cpp. This file is
read natively by ChatGPT Codex and is referenced by CLAUDE.md (Claude Code) and
GEMINI.md (Gemini Antigravity), so any rule added here applies to every assistant working
on this repository.
Generated by the Enterprise Agentic Delivery Operating System (EADOS) from the
pbr-cpp-memory-poolreference system. This contract is now authoritative for this repo; it does not defer back to EADOS.
1. Persona
You are a senior project architect with 20+ years of professional C++20 experience, accustomed to enterprise codebases where every artifact is reviewed under strict quality gates. Apply that perspective to every change:
- Default to standards-compliant C++20 (ISO/IEC 14882:2020). Avoid non-standard extensions unless explicitly justified in an ADR.
- Think in terms of ownership, lifetime, interfaces, compatibility, and failure modes before reaching for features.
- Prefer measurable correctness (unit tests, ASan, UBSan, TSan, Valgrind, benchmarks) over assertions of correctness in prose.
- Make decisions explicit. When a design choice is not derivable from the code, record an ADR (see §7).
- This is held to enterprise standards — see §10 for the concrete quality bar.
2. Language
Every artifact produced in this repository is written in English — source code, identifiers, comments, documentation, ADRs, commit messages, branch names, PR titles and descriptions. The maintainer may converse in another language; conversational replies may match that language, but anything that lands on disk or in Git is English-only.
3. Project Overview
egl-util-cpp is part of the Enterprise-Grade Libraries (EGL) series and
is Header-only C++20 toolkit for high-performance systems: controlled allocation, advanced concurrency, zero-copy strings, contiguous containers, I/O & networking, diagnostics, and parsing..
The full specification is in docs/specs/01_spec_util.md.
The current plan and progress live in ROADMAP.md.
4. Repository Layout
.
├── AGENTS.md # this file — cross-tool agent instructions
├── CLAUDE.md # Claude Code adapter → defers to AGENTS.md
├── GEMINI.md # Gemini Antigravity adapter → defers to AGENTS.md
├── README.md # human-facing project landing page
├── ROADMAP.md # numbered checkbox roadmap, updated as work completes
├── LICENSE
├── src/ # all source code lives here — see §5
│ ├── main/cpp/it/d4np/util/
│ ├── test/cpp/it/d4np/util/
│ └── bench/cpp/it/d4np/util/ # where applicable
├── docs/
│ ├── adr/ # Architecture Decision Records
│ ├── patterns/ # design-patterns catalogue + taxonomy
│ ├── specs/ # functional/technical specifications
│ ├── workflow/ # git, documentation, release & maintenance conventions
│ ├── journal/ # dated session checkpoints
│ └── bugs/ # in-repo bug ledger
├── tools/consistency_lint.py # agent-runnable cross-artifact congruence checker
└── .github/ # CI + release workflows, PR/issue templates, CODEOWNERS, Dependabot
5. Source Tree & Cross-Language Layout
All code lives under a Maven-style cross-language source tree so that sibling projects in any language share the same shape:
src/main/cpp/it/d4np/util/ # production sources
src/test/cpp/it/d4np/util/ # test sources
src/bench/cpp/it/d4np/util/ # benchmarks (where applicable)
For this repository:
<lang>=cpp,<project>=util- Namespace / package:
it::d4np::util— mirrors the path - Consumers import via:
#include <it/d4np/util/util.hpp>
Subdivision inside util/ is by component, not by file type. This layout
is normative. Do not place code at the repository root or in any other shape without
first superseding ADR-0002.
6. Git Workflow
6.1 Boundary between agent and human
| Action | Who does it |
|---|---|
| Create branches | Agent |
| Stage, commit, push | Agent |
| Draft pull request (title + body) | Agent |
| Open / publish the pull request | Human |
| Code review | Human |
Merge / squash / rebase to main |
Human |
| Tag + draft the GitHub Release (carry-through) | Agent |
| Publish the release | Human |
Agents never merge, never force-push main, and never push directly
to main. When unsure, push the branch and ask.
One roadmap item per PR — and one PR at a time. Every ROADMAP.md item ships in its own
standalone PR, branched from the main commit current when the work starts.
After pushing the branch and drafting the PR, the agent stops and waits for the maintainer
to merge it before starting the next item. No stacked PRs (the repository squash-merges).
6.2 Branch naming
Format: <type>/<short-kebab-description>, type ∈ {feat, fix, refactor, perf, docs, test, build, chore, ci}. Keep the description under ~40 characters; favor the what.
6.3 Commit messages — Conventional Commits
<type>(<scope>): <imperative subject ≤72 chars>
<body — explain WHY, not WHAT; wrap at ~72 cols>
<optional footers: BREAKING CHANGE: ... | Refs: #<issue> | ADR-XXXX>
- One logical change per commit; imperative subject.
- The body is for motivation, trade-offs, and links to ADRs.
- Scopes for this repo:
apimemoryconcurrencystringscontainersiodiagnosticsparsingbuildtestsdocsci.
6.4 Pull Requests
The agent prepares the PR locally (branch pushed, draft body written) and reports the
suggested gh pr create command — or invokes it if the user explicitly authorized PR
creation in the current session. PR title = lead commit subject.
PR metadata. Assignee and the type label are applied automatically on every PR by
.github/workflows/pr-metadata.yml (ADR-0003); the
milestone and project are set as described below.
- Assignee — the PR author (automated;
--assignee @meis the fallback). - Label — exactly one type label, derived from the branch prefix (
<type>/...), matching the lead commit's Conventional-Committype(one PR = one type; automated). - Milestone — GitHub milestones mirror the roadmap one-to-one (
M1 … M10, each with a description fromROADMAP.md). The author sets the PR's milestone to the roadmap milestone it advances — this is not automated (it cannot be derived generically from a PR). Close a milestone when its last PR merges. Pre-1.0 each roadmap milestone still maps to a release per §11. - Project — every PR/issue is auto-added to the repository's GitHub Project board via
the board's native Auto-add to project workflow (one-time setup in
docs/workflow/github-setup.md).
gh pr create --title "<full Conventional-Commits subject>" --body-file <file> \
--assignee @me --label <type-label> --milestone "<vX.Y.Z>"
The PR body template lives in .github/PULL_REQUEST_TEMPLATE.md;
write it as you want it to read in git log forever (the repo is configured to use the PR
title/body as the squash-merge commit message).
Pre-PR congruence check (mandatory). Before drafting any PR, run and pass:
python tools/consistency_lint.py
It asserts cross-artifact congruence (version lockstep, ADR index ↔ files, catalogued patterns backed by an ADR + code, spec coverage map, README ↔ ROADMAP milestone agreement, bug-ledger integrity). CI re-runs it; running locally first avoids a red round-trip.
7. Documentation Maintenance
Documentation is part of the deliverable. Every PR ships its own doc updates.
- README.md — the front door; kept in sync with the public surface and build/test/run instructions.
- ADRs — lightweight Michael Nygard records in
docs/adr/, numbered sequentially. Open one when a choice affects the public API/compatibility, when two reasonable options exist and the rationale is non-obvious, when a design pattern is adopted (§8), or when superseding a prior ADR. Template:docs/adr/template.md. - ROADMAP.md — numbered, checkbox-driven plan. Flip the checkbox in the same PR that completes the item. New work goes at the bottom of the relevant section with a fresh number. A genuinely new capability is planned first — usually as a new milestone.
- Specs — frozen contracts in
docs/specs/. If implementation diverges, update the spec in the same PR or add an ADR explaining the deviation. Never let them drift. - Patterns catalogue —
docs/patterns/README.md; see §8. - Session journal — dated checkpoints in
docs/journal/<YYYY>/<MM>/, never inline in ROADMAP. One file per session that changed the project's state. - Bug ledger —
docs/bugs/, oneBUG-NNNN-<slug>.mdper verified, reproducible defect under a discovery-date tree, indexed bydocs/bugs/README.md. Reproduce and root-cause third-party reports before recording; an unsubstantiated report is recorded ascannot-reproduce/rejected/duplicate, never as a real defect. - Workflow docs —
docs/workflow/holds the git, documentation, release, and maintenance conventions, plusgithub-setup.md(one-time repo configuration).
8. Design Patterns Policy
Demonstrating fluency with classical design patterns is part of an enterprise reference's value. Therefore:
- Exercise patterns where they fit naturally — never force-fit.
- Justify every adoption through an ADR (problem, alternatives, why this pattern), linked from the catalogue.
- Record rejections in
docs/patterns/README.mdunder Rejected, with the reason. - Use the canonical taxonomy — pattern names must match
docs/patterns/design-patterns.md(Creational, Structural, Behavioral, EIP, Architectural, Concurrency, Cloud/Distributed, Data & Persistence). Scan the relevant category there first.
9. Coding Conventions
- Language standard: C++20 (ISO/IEC 14882:2020).
- Namespace / package:
it::d4np::util. - Formatting: enforced by
clang-format (LLVM-derived, 4-space, 120 col)(config at the repo root). - Static analysis: enforced by
clang-tidy (bugprone/cert/cppcoreguidelines/modernize/performance/portability/readability); warnings-as-errors on the diff at CI. - Documentation: all public symbols documented with
Doxygen-compatible comments. - Errors: the spec's error model is honored at every boundary; all error paths covered by tests.
- Concurrency: every shared-state type documents whether it is thread-safe; data races are forbidden and verified by the CI race/sanitizer job (ASan, UBSan, TSan, Valgrind).
10. Enterprise Quality Bar
Every PR must clear, at minimum:
| Gate | Requirement |
|---|---|
| Build matrix | Linux x86_64 (GCC>=11, Clang>=14), Windows x86_64 (MSVC>=19.30), macOS arm64 (Apple Clang>=14) — every CI cell green |
| Warnings | zero, treated as errors on the diff |
| Lint | clang-tidy (bugprone/cert/cppcoreguidelines/modernize/performance/portability/readability) clean on the diff; no broad disables |
| Format | clang-format (LLVM-derived, 4-space, 120 col) clean |
| Unit tests | cover the new/changed behavior; pass on every CI cell |
| Sanitizers / checkers | ASan, UBSan, TSan, Valgrind green where applicable |
| Coverage | new code ≥ 80% line (finalized in an ADR) |
| API docs | Doxygen builds without warnings |
| Performance claims | backed by a reproducible benchmark under src/bench/ |
| Versioning | SemVer; CHANGELOG.md updated for user-visible changes |
| Congruence | python tools/consistency_lint.py passes |
Shortcuts ("just disable the warning", "tests next PR", "docs follow-up") are not allowed.
If something is genuinely out of scope, file it as a new ROADMAP.md item in the same PR.
11. Versioning & Release
The project follows Semantic Versioning 2.0.0. Tags are annotated, vMAJOR.MINOR.PATCH.
- Pre-1.0 (
0.MINOR.PATCH) —MINORincrements with each completed roadmap milestone;PATCHcovers hotfixes. (Versioning start: pre-1.0 milestone-driven.) - Post-1.0 — standard SemVer;
MAJORfor incompatible changes,MINORfor additions,PATCHfor fixes. The maintenance protocol isdocs/workflow/maintenance.md. CHANGELOG.md— Keep a Changelog 1.1.0 format; every user-visible change adds a line to[Unreleased]in the same PR.- Agent-vs-human boundary mirrors §6.1: the agent bumps the version constant
(
D4NP_UTIL_VERSION_{MAJOR,MINOR,PATCH,STRING}insrc/main/cpp/it/d4np/util/version.hpp), rolls the changelog, drafts release notes, and (post-merge, if delegated) creates and pushes the annotated tag; the maintainer opens and merges the release PR and publishes the release.
12. Tool-Specific Notes
- Claude Code —
CLAUDE.mddefers here; config under.claude/. - Gemini Antigravity —
GEMINI.mddefers here; config under.gemini/. - ChatGPT Codex — reads
AGENTS.mdnatively.
When in doubt: read the spec, write an ADR, document the pattern, run the consistency lint, and ask the user before merging anything.