Reusable GitHub Template for configuring AI agents in software projects — pick the one you prefer: Claude Code, Gemini CLI, Cursor, GitHub Copilot or ChatGPT/Codex. Each loads its own entry file; all of them read the same source of truth in .agent/.
Nota / Note: Documentation inside
.agent/andsrc/docs/is written in Portuguese (PT-PT) as it was designed for Portuguese-speaking teams. The BOOTSTRAP process allows the AI to adapt all content to any language during setup.
AI coding agents (Claude Code, Gemini CLI, Cursor, Copilot, ChatGPT/Codex) are powerful but stateless — they forget your project's rules, architecture, business logic, and conventions between sessions. Without persistent context, you repeat yourself constantly: "use SWR not useEffect", "files under 400 lines", "never commit without asking", etc.
This template gives your AI agent a persistent brain via the .agent/ folder:
- Rules — coding standards, business logic, page architecture (the AI reads these before every action)
- Workflows — step-by-step processes for planning, debugging, reviewing, deploying (the AI follows these like checklists)
- Context — session state, decisions, backlog, release history (the AI picks up where the last session left off)
- Scripts — verifiable automation: doc guards, backlog counters, bundle sizes, and the negative-test suites that prove each guard actually warns. Node only, no dependencies, no
package.json
Plus DevOps best practices via .github/:
- CI/CD Pipelines — TypeScript, lint, build, tests, security audit on every PR
- PR/Issue Templates — structured checklists aligned with the AI workflows
- Dependabot — automatic dependency updates
- Governance — CODEOWNERS, branch protection guidance, Conventional Commits
When you open a new AI session in any project using this template, the agent already knows:
- Your coding standards and what's forbidden
- Your business domain and rules
- Your git/branch/PR process
- What was done in the last session and what's next
- How to plan, review, debug, refactor, and deploy
One-time setup, permanent context across all sessions and all AI agents.
# Via GitHub CLI
gh repo create my-project --template gpsilv4/agent-template --clone --public
# or --private / --internal
cd my-project
# Or via GitHub UI: "Use this template" -> "Create a new repository"Already have a project? Don't create a new repo — bring the template into yours. From the project's root, with the template cloned NEXT to it (not inside, and not in a temp dir: the bootstrap reads it until the end):
git clone --depth 1 --branch <tag> https://github.com/gpsilv4/agent-template ../agent-template-<tag> # the latest tag: git ls-remote --tags --refs --sort=-v:refname https://github.com/gpsilv4/agent-template 'v*' node ../agent-template-<tag>/.agent/scripts/adotar-template.mjs --simular # what it would copy/collide node ../agent-template-<tag>/.agent/scripts/adotar-template.mjsThe clone needs its
originand network: the script confirms the tag there (git ls-remote), also with--simular. A tag that exists only in your clone is refused. The check is against theoriginthe clone declares, so clone from the template's URL (a clone of a clone checks the one in the middle).It copies only the files you don't have, never overwrites, leaves
LICENSEfor you to decide, and writes.agent/adocao.json— what was copied and what collides (decided before copying). The bootstrap reads it: Phase 0-R skips the copied files and merges the collisions with the clone's copy. If you already had aCLAUDE.md,AGENTS.mdorGEMINI.md, the AI won't find the template's instructions on its own: start it with "Read .agent/BOOTSTRAP.md and configure the project". Delete../agent-template-<tag>once the bootstrap is committed.
# Open Claude Code (or any other agent)
claude
# The AI reads BOOTSTRAP.md via CLAUDE.md and starts the process automatically.
# If it doesn't, ask:
# "Read .agent/BOOTSTRAP.md and configure the project"The AI will:
0. Phase 0-R (existing project) — If the repo already has an app's code, the AI offers to read it and proposes the answers (stack, pages, env vars, business rules with file:line, initial backlog), each with where it came from; you confirm instead of typing
- Phase 0 (if needed) — If you don't know what stack/architecture to use, the AI analyzes your project description and recommends platforms, stack, architecture, and flags risks — step by step, waiting for your confirmation at each step
- Ask questions about your project (or auto-fill from Phase 0 / 0-R)
- Replace all
{{PLACEHOLDER}}values across files - Generate
business-logic.mdandpages-architecture.mdfrom scratch - Adapt workflows, CI/CD, and scripts to your stack
Don't know what tech to use? Just describe your project in 3-5 sentences. The AI will guide you through every technical decision before touching any files.
# Verify no placeholders remain. Must return zero lines.
# git grep --untracked -> every tracked AND newly generated file, but nothing
# .gitignore'd (no node_modules/dist/.next noise)
# {{UPPER_CASE}} only -> the template's placeholders; GitHub Actions ${{ ... }},
# Gemini's {{args}} and an app's {{ user.name }} don't match
# the two excluded files are the placeholder catalogs themselves — drop the
# README exclusion once you replace it with your project's own.
# NOTE: clean means "no output"; git grep then exits 1 (found nothing).
# Invert it if you ever wire this into CI as a gate.
git grep -nE --untracked '\{\{[A-Z_]+\}\}' -- ':!.agent/BOOTSTRAP.md' ':!README.md'
# Initial commit — on a branch, not on `main`. (Existing project: not `git add .` — the
# bootstrap adds only what the template brought; see BOOTSTRAP.md, final step.)
# The bundled hook denies `git commit` on a protected branch, and the project's own Branch
# Rule says the same to every agent. Bootstrapping is a change like any other: branch, PR,
# green CI, merge — so day 1 already runs the flow the project will use.
git switch -c chore/bootstrap
git add .
git commit -m "chore: bootstrap agent config"
gh pr create --fill # then merge once CI is green# Plan a feature
# -> tell the AI: "run /plan for X"
# Fix a bug
# -> tell the AI: "run /debug for Y"
# Review before commit
# -> tell the AI: "run /review"Each one is a file in .agent/workflows/ — the single source of truth every agent reads.
| Workflow | What it does | When to use it |
|---|---|---|
/setup |
Developer onboarding and environment setup | a new developer, or an environment to set up |
/grill |
Interrogate the request until no decision is left open | an L ticket, or an ambiguous M, before the plan |
/plan |
Plan a feature (Phase 0: explain, then wait for approval) | a feature ticket, before implementing |
/review |
Code review with the guards, before committing | before every commit |
/design-review |
UI/UX quality rubric (states, a11y, responsiveness) | a ticket with UI, after /review |
/refactor |
Restructure code without changing behaviour | to reorganise code without changing what it does |
/e2e-tests |
Run and maintain the end-to-end suite | for user flows |
/security-tests |
Run and maintain the security suite | before a release touching auth, forms or APIs |
/debug |
Isolate the root cause, then fix with a regression test | a bug whose cause is not obvious |
/deploy |
Release checklist with a real CI gate | when the sprint is complete |
/audit |
Multi-lens health check of the whole project | at a milestone (end of sprint, pre-release) |
/market-scan |
Market research and feature ideation | for product strategy |
/backlog-review |
Review the existing backlog against the code: done, stale, duplicate, missing, order | when opening a sprint, or after a release |
/upgrade |
Bring template improvements into a derived project | in a derived project, to pull a newer template |
How to invoke them: in Claude Code and Gemini CLI they are real slash commands
(.claude/commands/, .gemini/commands/). In Cursor, GitHub Copilot and
ChatGPT/Codex, ask for /<name> or say "follow .agent/workflows/<name>.md" — their entry
files tell them to open the workflow. Each workflow also opens with its own when to use / when
not to line, so every agent sees it.
What's included — the full file inventory (click to expand)
.agent/ <- AI knowledge management
├── BOOTSTRAP.md <- Setup guide: Phase 0-R (existing code) or Phase 0 (analysis) + Phase 1 (config) — run once
├── TEMPLATE_VERSION <- the template's version (`vX.Y.Z`); travels with the files, so
│ "Use this template" (no tags) still knows where it came from
├── rules/ <- loaded (core, process, anti-patterns) + reference,
│ not loaded: scripts-guide, hooks-guide, sync-docs,
│ propagation, ticket-method, mcp-policy
│ ├── core-rules.md <- Code standards, DRY, CI/CD, security
│ ├── process-rules.md <- Git, branches, sprints, backlog, archiving
│ ├── anti-patterns.md <- YOUR anti-patterns (prefix AP, starts free) + greps (loaded)
│ ├── anti-patterns-template.md <- TP1-TP15: the template's own machinery (NOT loaded)
│ ├── sync-docs.md <- Pre-commit docs checklist (NOT loaded; on-demand)
│ ├── propagation.md <- Propagation matrix: what to replicate per new file (NOT loaded)
│ ├── ticket-method.md <- Per-ticket 6-phase method, 0-5 (NOT loaded; on-demand)
│ ├── backlog-method.md <- Step-by-step backlog procedure (NOT loaded; on-demand)
│ ├── mcp-policy.md <- When an MCP server is worth it, what it may not hold, and how to write the project's own (NOT loaded)
│ ├── privacy.md <- Privacy by design: the base level for all, the full one with personal data (NOT loaded, #495)
│ ├── ai-features.md <- AI in the product: when to STOP, what goes to the model, its output as data (NOT loaded, #494)
│ ├── scripts-guide.md <- What each checker does + the rule linking them (NOT loaded)
│ └── hooks-guide.md <- What each hook does, and why it can't be prose (NOT loaded)
├── context/
│ ├── session.md <- Current session state
│ ├── task.md <- Tasks in progress
│ ├── decisions.md <- Architectural decisions (append-only)
│ ├── walkthrough.md <- Release summaries
│ ├── implementation_plan.md <- Implementation plan
│ ├── backlog.md <- Backlog: active work (imported into context)
│ ├── backlog-archive.md <- Closed items + closed sprints (NOT imported)
│ ├── audit-history.md <- /audit baselines, accumulated (NOT imported; created on first run)
│ ├── decisions-archive.md <- Archived old decisions (NOT imported)
│ └── walkthrough-archive.md <- Archived old releases (NOT imported)
├── workflows/
│ ├── setup.md <- /setup — Developer onboarding
│ ├── grill.md <- /grill — Interrogate the request before any code exists
│ ├── plan.md <- /plan — Plan new feature
│ ├── review.md <- /review — Code review + CI check
│ ├── design-review.md <- /design-review — UI/UX quality rubric (tier-based)
│ ├── refactor.md <- /refactor — Safe refactoring
│ ├── deploy.md <- /deploy — Deploy with CI gate
│ ├── debug.md <- /debug — Structured debugging
│ ├── e2e-tests.md <- /e2e-tests — E2E tests (Playwright)
│ ├── security-tests.md <- /security-tests — Security tests
│ ├── audit.md <- /audit — Full project/app health audit (multi-lens)
│ ├── market-scan.md <- /market-scan — Market/competitor analysis + feature ideation
│ ├── backlog-review.md <- /backlog-review — Review the existing backlog against the code
│ └── upgrade.md <- /upgrade — Pull template improvements into a derived project
└── scripts/ <- 12 entry points at the root: what you INVOKE
├── check-doc-versions.mjs <- Doc guards: entry point + doc-parity guards
├── check-backlog.mjs <- Backlog counters/progress, duplicate IDs and the format rules; --corrigir (#431, #445)
├── backlog-board.mjs <- A local, read-only HTML board of the backlog; --vigiar (#446)
├── check-bundle-sizes.mjs <- Bundle size checker (Next.js) — logic only
├── check-test-surface.mjs <- Was the test surface weakened since a baseline? (TP4)
├── check-codigo-morto.mjs <- Imports nobody uses: dead code travels to derived projects
├── check-textos-publicos.mjs <- Issues, PRs, comments, releases vs. your forbidden-names list (by hand, #375)
├── adotar-template.mjs <- Brings the template into an EXISTING project: copies only what
│ is missing, writes .agent/adocao.json (copied + collisions)
├── mutation-sweep.mjs <- Proves the suites assert: disables each warning, demands red
├── minutos-ci.mjs <- CI minutes per run, billed (each job rounded up) vs real, step times,
│ the PR median vs 120 s; --quota: the account's private repos against the free
│ quota, with a month-end projection (#442); --por-pr: what a PR costs, by type
│ and mode; --todos: every private repo run by run (#517); each job against its own
│ timeout-minutes, read at the run's commit: LIMITE: CORTADO / AVISO (90% one run, 75%
│ the median of 5) / OK / NAO MEDIDO (#542); --espera: the PR wait and its median
│ before/after a cut (#554); fails loud, never a false 0 (#429)
├── simulate-derived.mjs <- Builds a derived project and runs everything there
├── simulate-upgrade.mjs <- Builds a project derived from the LAST TAG and upgrades it
│
├── config/ <- THIS project's configuration. /upgrade never replaces it
│ ├── bundles.mjs <- Routes, budgets, and the ALVOS_REPROVAM switch
│ ├── superficie-de-teste.mjs <- Where THIS project's tests and runner config live
│ ├── guards-do-projeto.mjs <- THIS project's own guards, their sweep pairs, its script dirs
│ └── sdks-de-analytics.mjs <- The analytics/telemetry SDKs Guard 24 looks for in package.json (#495)
│
├── guards/ <- Guard modules split out of check-doc-versions.mjs
│ ├── budgets.mjs <- Guards 1/1b/1c/1e: byte budgets + 1d: Boundaries copied to pointers
│ ├── settings.mjs <- Guard 11: .claude/settings.json permission boundary
│ │ (deny/ask cover every rule the template ships, hooks
│ │ included), and that every hook on disk is wired to the `hooks` key
│ │ (an unwired hook looks exactly like a working one); what
│ │ `ci.yml` runs is in `allow`; agents declare `tools:`
│ ├── versions.mjs <- Guard 3 + documented dependency versions
│ ├── derived-counts.mjs <- Guard series 12: counts cited in prose, recomputed
│ ├── placeholders.mjs <- Guard 13: placeholders left behind after bootstrap;
│ │ a NOTE if SECURITY.md lacks the security model (#496)
│ ├── context-virgem.mjs <- Guard 21: in the TEMPLATE, .agent/context/ stays unstarted
│ │ (frozen content hashes; skips in a derived project)
│ ├── anti-patterns.mjs <- Guards 15/18: citations resolve; each TPn has its evidence
│ ├── mcp.mjs <- Guard 16: MCP policy + no literal secrets in MCP config
│ ├── sizes.mjs <- Guard 17: the 500-line flag, as a ratchet (may shrink, never grow)
│ ├── isolamento.mjs <- Guard 19: suites stay isolated — what makes the parallel sweep safe
│ ├── citacoes.mjs <- Guard 20: a file cited in an instruction exists, and is only one
│ ├── runners.mjs <- Guard 22: the template's CI runners on one pinned label, not ubuntu-latest (#488)
│ ├── env-example.mjs <- Guard 23: a .env.example/.sample/.template carries no real secret (#595)
│ ├── sdks-analytics.mjs <- Guard 24: an analytics SDK in package.json — only a NOTE (#495)
│ └── ligacao-proprios.mjs <- The project's own guards (config/guards-do-projeto.mjs), and a module
│ in guards/ that nothing calls (#176, #539)
│
├── lib/ <- Shared modules. No entry point, no discovery: imported
│ ├── registo.mjs <- Suite discovery by disk scan: a new suite can't stay unlisted
│ ├── ordem-por-alvo.mjs <- The suite that owns a target runs first (sweep and discovery)
│ ├── alvos-no-disco.mjs <- Which verifier files exist on disk (what the sweep must cover)
│ ├── alcance.mjs <- Which files a guard reaches (instructions vs fixtures)
│ ├── agentes.mjs <- Reads the `tools:` of `.claude/agents/*` (Guard 11 + the subagent hook)
│ ├── permissoes.mjs <- Guard 11's probes for deny/ask (and the `!` that opens the .env examples), and the deny/ask a project lacks (2b)
│ ├── segredos.mjs <- The shapes of a literal secret, shared by Guards 16 and 23
│ ├── baseline-superficie.mjs <- The test-surface baseline (what "before" means)
│ ├── superficie-contaveis.mjs <- What the test surface measures by COUNT (workflows, PARES, verifiers, hooks) (#400)
│ ├── derivado-maduro.mjs <- A derived project with real, accumulated customisations
│ ├── derivado-docs.mjs <- The bootstrap's docs steps the derived simulation replays (docs/README.md, docs/legal/)
│ ├── pares.mjs <- The mutation sweep's target/suite table (data, not logic)
│ ├── pares-hooks.mjs <- ...its entries for .claude/hooks/, joined in the same place
│ ├── pares-chavetas.mjs <- ...and, at the end of that block, the boundary's brace expansion (#656)
│ ├── pares-publicos.mjs <- ...and for the commit-msg and the forbidden names (#375)
│ ├── pares-simuladores.mjs <- ...and for the two simulators and their libs (#400)
│ ├── pares-guards.mjs <- ...and for the doc guards: check-doc-versions and guards/ (#495)
│ ├── nomes-proibidos.mjs <- The forbidden-names list, kept OUTSIDE the repo, and how a name matches (#375)
│ ├── prefixo-commit.mjs <- The Conventional Commits prefix the commit-msg checks, types from CONTRIBUTING.md (#394)
│ ├── regex-literal.mjs <- A text as a regex literal: the one source, and the two bound copies (#400)
│ ├── mapa-suites.mjs <- Touched path -> what verifies it (hook + sweep --diff)
│ ├── backlog-calculo.mjs <- The backlog counts, pure: one calculation for the checker and --corrigir (#431)
│ ├── backlog-corrige.mjs <- --corrigir: rewrites only the derived counters, or nothing (#431)
│ ├── backlog-itens.mjs <- The backlog read once: the tickets, shared by the checker and the board (#445)
│ ├── backlog-regras.mjs <- The rules that are not counts: Ordem, "Depende de", struck-out rows, Pendentes (#445)
│ ├── backlog-vista.mjs <- The backlog board HTML, pure: escape per context, CSP, detail rendered in Node (#446)
│ ├── backlog-vista-pecas.mjs <- The board's pure pieces: text to HTML, card titles, filter and sort decisions (#468)
│ ├── backlog-vista-assets.mjs <- The board's inline CSS and JS (#446)
│ ├── minutos-calculo.mjs <- The minutes maths, pure: rounding per job, the median, the account quota (#429, #442)
│ ├── minutos-por-pr.mjs <- What a PR costs, by type (upgrade, normal, Dependabot, dynamic), pure (#517)
│ ├── limites-ci.mjs <- Each job against its own timeout-minutes: CUT, the 90%/75% warnings, pure (#542)
│ ├── espera-ci.mjs <- A PR's wait and its median before and after a cut, pure (#554)
│ ├── jobs-workflow.mjs <- The CI job reader (`jobsDe`), split out of estrutura-workflow for the partial mode (#542)
│ ├── marcas-yaml.mjs <- What the surface MARKS read in a workflow; template-only files
│ ├── repo-origin.mjs <- The owner/repo of a GitHub `origin` URL (#455)
│ ├── concurrency-ci.mjs <- A workflow's top-level `concurrency:` block, and what it lacks (#427, #455)
│ ├── varredura-paralela.mjs <- The sweep's measuring engine: one repo copy per worker
│ ├── varredura-tempos.mjs <- ...and its time summary, by target (moved out at 500 lines, #374b)
│ ├── varredura-fatia.mjs <- The sweep's shard slice: reads `--shard=k/n` / `SWEEP_SHARD`, splits sites
│ ├── varredura-shards.mjs <- The gate's check that every sweep shard reported, and all sites were measured
│ ├── plano-ci.mjs <- Does the sweep apply to this PR? Read from the BASE commit by the `guard-tests` plan step (drives the `sweep` `if:`), recomputed by the gate (#347)
│ ├── varredura-diff.mjs <- The sweep's `--diff`: which targets the branch touches
│ ├── suites-em-paralelo.mjs <- Runs the Guard Suites in parallel (all of them), with a core cap
│ ├── passo-paralelo.mjs <- ...and how the surface gate reads that step: one unit per suite in the runner's chain (#341)
│ ├── superficie-gate.mjs <- The CI gate in the test surface: `on:`/`env:`/`defaults:`, machinery steps, the `Test-Surface:` trailer (#285)
│ ├── estrutura-workflow.mjs <- The CI gate's structure: re-exports the job reader from jobs-workflow (used by the two below), `needs:`, aggregators, shape defects, cross-workflow check names (#374b, #355, #362)
│ ├── exemplo-ci.mjs <- The one-job CI example with its MODO COMPLETO blocks uncommented: a private derived project's ci.yml (#487)
│ ├── saltos-variavel.mjs <- A step that skips on a `case` variable whose value stopped deciding (#353)
│ ├── passos-novos.mjs <- A new step before the suites that is not read-only (#362)
│ ├── gate-modos.mjs <- Reads the sweep modes from the matrix and from the gate's command
│ ├── upgrade-mecanico.mjs <- The /upgrade's mechanical engine (writes over a consumer)
│ ├── upgrade-categorias.mjs <- ...and its data: what is copied, the project's constants, what moved
│ ├── fora-do-template.mjs <- What sits on the template's disk but is NOT the template's
│ ├── intacto.mjs <- "The project did not touch this file", placeholders aside
│ ├── saida-upgrade.mjs <- The lists /upgrade shows before approval, one formatter for both modes
│ ├── medida-upgrade.mjs <- Section 2b measured from BOTH sides (template and consumer)
│ ├── modo-upgrade.mjs <- Full or partial /upgrade: the mark decides, the guard-tests job proposes (#429)
│ ├── medida-upgrade-ci.mjs <- ...and its notes on the SHAPE of ci.yml (each optional CI change, #347)
│ ├── fronteira-upgrade.mjs <- The boundary an upgrade changes, staged for the USER to copy (#304)
│ ├── origem-upgrade.mjs <- The template of an upgrade is a clean clone at a tag, no downgrade (#490)
│ ├── projeto-de-ontem.mjs <- The consumer fixture the template-side simulation builds
│ ├── tmp-limpo.mjs <- tmpdir copies don't outlive their owner (swept at startup)
│ ├── surface-patterns.mjs <- Pattern tables: what can't drop, what can't appear
│ ├── patch.mjs <- Text patching with THREE outcomes: applied / already-set / no-target
│ ├── derivado.mjs <- "Is this repo the template, or a project derived from it?"
│ ├── eh-main.mjs <- "Is this module what node is running?" — real paths, safe behind a symlink (#373)
│ └── ficheiros.mjs <- Reads that tell "missing" apart from "unreadable"
│
└── tests/ <- Everything that TESTS the machinery above
├── test-*.mjs <- one entry point per verifier (run them directly)
├── tests-*.mjs <- modules discovered on disk by an entry point
└── harness/ <- Fixture builders: imported, never invoked
├── test-harness.mjs <- Sandbox + test() + summary, for the doc guards
├── test-bundle-harness.mjs <- Fake .next/ trees and the config each test needs
├── test-surface-harness.mjs <- A real git repo as a fixture
├── test-sweep-harness.mjs <- Fake checker + fake suite of known behaviour
├── test-upgrade-harness.mjs <- Synthetic template + consumer, tagged
├── test-derived-harness.mjs <- The minimal repo the derived-project simulator runs in
├── test-backlog-harness.mjs <- Synthetic backlog fixtures
├── projeto-derivado.mjs <- bootstrapado()/comoTemplate(): the two sides of "derived?"
├── guard-direto.mjs <- Runs one guard module directly, without the full checker
├── hook-com-prazo.mjs <- Calls a hook with a timeout; a hung one exits 3 with no FAIL line (#650)
├── fixture-ordem.mjs <- Fixtures for the owner-first ordering
├── relatorio.mjs <- PASS/FAIL counters and the fail-fast mode, one source
├── repo-descartavel.mjs <- The throwaway git repo the CI gate's real shell runs in, and a git that translates (#400)
├── casos-modos.mjs <- The sweep suite's `--list`/`--diff` cases, called in place (#400)
├── casos-commit-msg-prosa.mjs <- The commit-msg suite's prose-vs-attribution cases, called in place (#400)
├── fecho-parcial.mjs <- The import closure of the boundary, against upgrade-parcial.md's list (#429)
├── expressoes-ci.mjs <- The CI example suite's readers: if: expressions, steps, variants (#439)
├── casos-salto-cache.mjs <- The merge-push skip and the cache.yml example's cases (#439)
├── casos-dependabot-exemplo.mjs <- The private-repo dependabot.yml example's cases (#440)
├── casos-modo-completo.mjs <- The CI example's full mode, read by the real /upgrade readers (#472, #477)
├── casos-minutos-por-pr.mjs <- The minutes script's per-PR and all-private cases (#517)
├── simuladores-ci.mjs <- The three simulator jobs of ci.yml and their commands, one source (#460)
├── casos-limites-ci.mjs <- The minutes script's job-limit cases: thresholds at the boundary (#542)
├── casos-espera.mjs <- The minutes script's PR-wait cases: the attempt, cancelled out, the cut (#554)
├── casos-adotar-origem.mjs <- The adoption's origin cases: the tag on origin, its format, the resume (#538)
├── casos-adotar-env.mjs <- The adoption refuses a project whose .env.example carries a real secret (#595)
├── casos-derivado-docs.mjs <- The derived simulator's docs/ and docs/legal/ cases (#585, #495)
└── recongelar-contexto.mjs <- Re-freezes Guard 21's hashes for a fixture's own
.agent/context/ (derived from the fixture, not the repo)
> **Why the tests live in a folder and the checkers don't.** The root answers "what can I run
> here?". And the difference between `test-*` (an entry point) and `tests-*` (a module found by
> discovery) was **one character** — while the machinery enforces it: a module declaring the wrong
> entry point is rejected by `lib/registo.mjs`. The folder makes visible what the suffix hid.
.github/ <- DevOps & governance
├── workflows/
│ ├── ci.yml <- CI: TypeScript, lint, build, tests, audit, secret-scan
│ ├── e2e.yml <- E2E + security tests (manual trigger)
│ ├── codeql.yml <- CodeQL on the template's machinery (hidden folders) — TEMPLATE-ONLY: the bootstrap removes it
│ ├── release.yml <- Every `vX.Y.Z` tag creates its GitHub Release (title and notes from the tag)
│ └── dependabot-auto-merge.yml <- Auto-merge patch/minor Dependabot PRs (OPT-IN, off by default)
├── codeql/codeql-config.yml <- Where the template's code is (`.agent/scripts`, `.claude/hooks`, `.githooks`, `.github`) — template-only
├── scripts/release-da-tag.sh <- What `release.yml` runs (idempotent: an existing Release is left alone)
├── ISSUE_TEMPLATE/
│ ├── bug_report.md <- Structured bug reporting template
│ └── feature_request.md <- Structured feature request template
├── copilot-instructions.md <- Thin pointer to AGENTS.md (the file Copilot loads)
├── pull_request_template.md <- Required checklist on every PR
├── dependabot.yml <- Automatic dependency updates
└── CODEOWNERS <- Automatic reviewers per file
.claude/ <- Native Claude Code layer (optional; other tools ignore it)
├── settings.json <- Project permissions (deny secrets, allow safe scripts)
├── commands/ <- Real slash commands (/plan, /review, ...) wrapping .agent/workflows/
├── hooks/ <- Runtime enforcement, before/after the tool (Claude-only)
│ ├── guard-protected-branch.mjs <- DENY commit/push on protected branches; no force-push
│ ├── protegidos.json <- THIS project's protected branches (data; /upgrade keeps it)
│ ├── guard-subagent-bash.mjs <- DENY a subagent's Bash outside what its `tools:` declares
│ ├── guard-textos-publicos.mjs <- DENY a gh/git tag/commit that publishes a forbidden name (#375b)
│ ├── session-context.mjs <- SessionStart: state the real branch + uncommitted work,
│ │ and a configured hook that is empty or missing (#589)
│ ├── stop-verify.mjs <- Stop: which suite is owed for the files touched
│ ├── prompt-fase0.mjs <- UserPromptSubmit: reminds of Fase 0 when the
│ │ prompt looks like an order to implement
│ ├── reinject-fronteiras.mjs <- SessionStart(compact): re-injects the Fronteiras
│ │ block AFTER compaction dropped the imported rules
│ ├── lib/ <- What the hooks share: the frontier rule (`fronteira`,
│ │ its text floor `fronteira-piso`, `caminhos`, the shell
│ │ lexer `comandos`, brace expansion `chavetas`, the
│ │ command position `posicao`, who runs stdin as code
│ │ `recebe`, and their import-free leaf
│ │ `fronteira-dados`), git verbs, the branch guard's git
│ │ invocations (`invocacoes-git`), the guard's deadline
│ │ (`resposta`), porcelain parsing, a subagent's scope
│ │ (`ambito-agente`), the protected-branch list
│ │ (`protegidos`), what a command publishes
│ │ (`textos-publicos`, with a command's head and what
│ │ changes `node` in `cabeca-comando`)
│ └── tests/ <- Negative tests for the hooks
│ ├── test-hooks.mjs <- Real git repos, real payloads
│ │ (count: node .claude/hooks/tests/test-hooks.mjs)
│ ├── tests-bypasses.mjs <- The BYPASSES table: every known way to evade
│ │ the branch guard (TP6)
│ ├── tests-legitimos.mjs <- The legitimate commands it must NOT block
│ ├── tests-git-executa.mjs <- What git EXECUTES from an option (`-c`, `--exec`, `GIT_PAGER`...)
│ ├── tests-sem-ciclos.mjs <- No import cycle among the hooks and their lib/
│ ├── tests-fronteira-*.mjs <- The frontier: what a careless command must not write
│ │ (descuidos, redirections, inventory, paths, generated corpus)
│ ├── tests-ambito-agente.mjs <- A subagent's Bash scope, read like the shell reads it
│ ├── tests-protegidos.mjs <- protegidos.json: fails closed when missing or broken
│ ├── tests-guard-tamanho.mjs <- The guard's deadline and its size ceilings
│ ├── tests-porcelain.mjs <- `git status --porcelain -z` parsing
│ ├── tests-textos-publicos.mjs <- A forbidden name in what gh/git publishes, and what it cannot read
│ ├── tests-textos-publicos-isencao.mjs <- The commit-msg exemption: one case per condition (#511, #580)
│ ├── tests-textos-publicos-cabeca.mjs <- A gh/git behind a head with flags (`env -u FOO gh`, `sudo -D dir`) (#565)
│ ├── tests-atribuicoes.mjs <- bash and env assignments read the same way in every hook (#546)
│ ├── tests-equals.mjs <- The zsh EQUALS (`=git`, `=bash`) read by the three guards (#567)
│ ├── tests-modificadores-zsh.mjs <- The zsh precommand modifiers (`noglob`, `nocorrect`, `-`) in the three guards (#606)
│ ├── tests-git-config-env.mjs <- `--config-env`/`--attr-source` before the verb (#579)
│ ├── tests-opaco-segmento.mjs <- A command run by another shell, judged per segment; `$'...'` at the frontier (#605)
│ ├── tests-hooks-vazios.mjs <- An empty or missing configured hook, said at session start (#589)
│ ├── tests-posicao.mjs <- The lexer (`lib/comandos.mjs`) and the position (`lib/posicao.mjs`) by structure: commands, words, quoting, heredoc bodies (#336)
│ └── tests-stop.mjs <- stop-verify: a DELETED file owes nothing, and
│ the "already said this" mark belongs to the
│ repo being measured, not the hook's own
└── agents/ <- Subagents: code-reviewer, plan-auditor (no Write/Edit; Bash limited to
the prefixes in `tools:`, hook-enforced), debugger (full Bash)
.githooks/ <- Versioned git hooks (tool-independent)
├── commit-msg <- Rejects AI attribution, any name from your forbidden-names
│ list, and a subject without the Conventional Commits
│ prefix (types from CONTRIBUTING.md), in commit messages
│ (a pointer to lib/).
│ Enable per clone: git config core.hooksPath .githooks
│ (the CI re-runs it on every PR commit and on the PR
│ title; the forbidden-names list only exists locally)
└── lib/commit-msg.mjs <- The logic: a hook has no extension, and CodeQL picks files by it.
.gemini/ <- Native Gemini CLI layer
└── commands/ <- Same slash commands as .claude/, in TOML (wrap .agent/workflows/)
.cursor/ <- Native Cursor layer
└── rules/project.mdc <- Thin pointer to AGENTS.md (Cursor does NOT load CLAUDE.md)
.editorconfig <- Formatting config (2-space indent, LF)
.nvmrc <- Node version pinning (matches CI)
AGENTS.md <- Cross-tool entry point (ChatGPT/Codex, Windsurf, Zed, ...)
CLAUDE.md <- Entry point for Claude Code
CODE_OF_CONDUCT.md <- Contributor Covenant
CONTRIBUTING.md <- Dev workflow, commit format, PR process
GEMINI.md <- Entry point for Google Gemini
LICENSE <- MIT (customize copyright in bootstrap)
README.md <- This file
SECURITY.md <- Vulnerability disclosure policy
src/docs/
├── agent-guide.md <- Guide for .agent/ and .github/
├── ticket-method-why.md <- Where each rule came from, what it costs, what was measured
├── privacy-why.md <- Why the privacy rule is so: the legal bases, art. 9(2), non-users, DPIA (#495)
├── ai-features-why.md <- Why the AI rule is so: art. 22, the AI Act's high risk and art. 50, the sources (#494)
├── anti-patterns-why.md <- Evidence behind each anti-pattern: what it cost, how it was caught
├── scripts-guide-why.md <- Why each checker is shaped the way it is
├── sync-docs-why.md <- Why the pre-commit checklist has the points it has
├── github-security.md <- GitHub security settings: public vs. private, read/enable with `gh api`
├── upgrade-why.md <- Why /upgrade decides by category, and what it measured
├── upgrade-derivados-privados.md <- /upgrade in a PRIVATE repo: CI minutes, and the notes a derived project needed
├── upgrade-parcial.md <- The PARTIAL /upgrade: a derived project without the machinery (what comes, in what order)
├── exemplos/ci-sem-maquinaria.yml <- The cheap CI for a PRIVATE derived project: one job; with the machinery, a
│ `guard-tests` job that runs only when it changes (#472, #477; not run here)
├── exemplos/cache-sem-maquinaria.yml <- Its pair: saves the dependency cache, since the merge push no longer runs
├── exemplos/dependabot-privado.yml <- dependabot.yml for a PRIVATE repo: monthly, rebase disabled (the account quota)
├── exemplos/docs-README.md <- The model of a project's docs/README.md: the 8 folders for the PRODUCT's docs (#585)
├── exemplos/privacy-inventory.md <- The model of the personal-data inventory (art. 30), in docs/legal/ (#495)
├── exemplos/privacy-policy.md <- The model of the privacy policy (GDPR structure), in docs/legal/ (#495)
└── CHANGELOG.md <- Changelog template
The app steps (TypeScript to Security Audit) are steps of ONE job, Code Quality: in a private repo every job is billed rounded up to the minute, and four short jobs cost four minutes (#347). It stays apart from the machinery job (guard-tests) and from Secret Scan, on purpose.
| Step | What it does |
|---|---|
| TypeScript | npx tsc --noEmit — 0 errors (skipped if there is no tsconfig.json) |
| Lint | npm run lint — no warnings (skipped if there is no lint script) |
| Build | npm run build — verify bundle (skipped if there is no build script) |
| Unit Tests | npm run test:unit (skipped if there is no test:unit script) |
| Security Audit | the Audit step: npm audit --audit-level=high — informative, does not block the merge (continue-on-error) |
| Secret Scan | gitleaks — scans the commits of each PR and of each push for committed secrets (runs always, even on the bare template; #372) |
| Doc Guards | node .agent/scripts/check-doc-versions.mjs — rules byte-budget, CLAUDE/GEMINI parity, workflow↔wrapper parity, CHANGELOG/version sync, banned terms — runs on every PR and push (†) in the guard-tests job |
| Dead code | node .agent/scripts/check-codigo-morto.mjs — flags imports nobody uses, so dead code does not travel to derived projects — runs on every PR and push (†) in the guard-tests job |
| Backlog | node .agent/scripts/check-backlog.mjs [--corrigir] — validates counters/progress bar, detects duplicate IDs and closed items left in the active file, and checks the format (each block's Ordem, "Depende de", struck-out rows, Pendentes sem Sprint, the Historico by column name) (#445); --corrigir rewrites only the derived counters, and nothing when another warning is present (#431) — runs on every PR and push (†) in the guard-tests job, always without --corrigir |
| Backlog board | node .agent/scripts/backlog-board.mjs [--vigiar] — writes .agent/backlog-board.html, a local read-only view (blocks, cards, filters, the closed items); refuses when that file or its .tmp is not in .gitignore (#446), and --vigiar checks it again before each write (#477); exits 1 when the backlog cannot be read or is empty, or the board cannot be written, with the reason on stderr (#477). Not run in CI: you run it by hand |
| Sweep plan | the Plano da varredura step: runs the BASE commit's lib/plano-ci.mjs on the PR's diff and writes aplica=true|false for the sweep job's if: — first step of the guard-tests job, PR only (#347) |
| Commit messages | .githooks/commit-msg over every commit message in the range, and over the PR title in a PR (Conventional Commits prefix, no AI attribution) — runs on every PR and push (†) in the guard-tests job |
| Test surface | node .agent/scripts/check-test-surface.mjs against the PR's base — fails if the test surface shrank or a weakening mark appeared (no way out, but for a workflow's if:: fix the code, not the test); a change to a workflow's trigger or machinery steps, a new step before the suites that is not read-only (#362), or a step that skips on a literal case variable (#353) passes only with a Test-Surface: trailer in the PR's last commit that touches it (in a workflow, the trailer also covers an added if: — not continue-on-error, ` |
| Guard Tests | node .agent/scripts/tests/test-guards.mjs — breaks each doc guard on purpose and asserts it warns and exits non-zero (runs on every PR and push (†) in the guard-tests job) |
| Bundle Tests | node .agent/scripts/tests/test-bundle-sizes.mjs — fake .next/ trees asserting the bundle checker fails rather than reporting an unmeasured number (runs in the guard-tests job) |
| Backlog Tests | node .agent/scripts/tests/test-backlog.mjs — synthetic backlog fixture; breaks one counter/state/ID at a time and asserts the checker warns; node .agent/scripts/tests/test-backlog-corrige.mjs — --corrigir rewrites only the derived counters, and nothing when another warning is present (#431); node .agent/scripts/tests/test-backlog-itens.mjs — the shared reader, and the checker's output frozen before it moved onto it (#445); node .agent/scripts/tests/test-backlog-regras.mjs — each rule (Ordem, "Depende de", the archive, struck-out rows, Pendentes) warns, with its control (#445); node .agent/scripts/tests/test-backlog-board.mjs and test-backlog-board-cli.mjs — the board: cards, escape per context, CSP, the CLI and --vigiar (#446) (all six in the guard-tests job) |
| Mutation Sweep | node .agent/scripts/mutation-sweep.mjs — disables each checker's warning sites one by one and demands the suite goes red; also fails if a checker has no suite. Includes itself as a target. Minutes, not seconds — runs in CI on every PR that touches checkers or hooks, decided by the plan read from the base commit (#347): on a PR without them the shards are skipped, never started, and the gate recomputes the plan. Its own sweep job, in parallel: the full sweep split into 3 shards (the Guard Tests gate checks every shard reported) and --skips; run locally after touching a check-*.mjs |
| Simulators | simulate-derived.mjs and simulate-upgrade.mjs — build a derived project from scratch (two of them, in separate jobs: a PRIVATE one with the one-job CI in full mode, SIMULATE_PRIVADO=1, and one with the template's ci.yml, #487), and upgrade one from the last tag, then run everything there; in a PR that touches the machinery, also the --skips mutation sweep over the mature derived (SIMULATE_SKIPS, #308) — one job per simulator (#460: simulate-private, simulate-derived, simulate-upgrade, each with its own timeout), in parallel with Guard Suites (the suites job; Guard Tests is now the gate that also waits for the mutation sweep) |
| Release Tests | node .agent/scripts/tests/test-release-da-tag.mjs — the arguments release-da-tag.sh passes to gh release create for each kind of tag (pre-release, highest final, late patch, lightweight tag, existing Release), with a fake gh (runs in the guard-tests job) |
| Tmpdir Tests | node .agent/scripts/tests/test-tmp-limpo.mjs — asserts a dead run's copy is swept and a LIVE run's copy is never touched (runs in the guard-tests job) |
| CI Minutes & CI Example Tests | node .agent/scripts/tests/test-minutos-ci.mjs — the minutes script against a fake gh (rounding, paging, dynamic, each refusal by its message, never a false 0; the cost per PR by type and mode, --por-pr, and every private repo run by run, --todos, #517; each job's limit — the thresholds at the boundary, the workflow of each run's commit, the cut read from the check-run annotation, #542; the PR wait — the last job that ran, cancelled runs out, the cut at the boundary, #554); node .agent/scripts/tests/test-ci-exemplo.mjs — the CI example's properties, each with its own mutated control, and its scope step run in a git fixture (#429); the merge-push skip, the (deps/,deps step and the PR-description check run in fixtures, the cache-sem-maquinaria.yml example (#439) and the private dependabot-privado.yml (#440) (both in the guard-tests job) |
| Partial Upgrade Tests | node .agent/scripts/tests/test-modo-upgrade.mjs — the mode rule (mark decides, the guard-tests job proposes), /upgrade §4 run for real (the mark keeps modo: and drops the stale versao:, and §1 reads the new SHA), the order of upgrade-parcial.md, and its "what comes" list against the import closure of the hooks, commit-msg, check-backlog and minutos-ci (in the guard-tests job, #429) |
| Public Text Tests | node .agent/scripts/tests/test-textos-publicos.mjs — fixture readers, no network: exit 0/1/2, tag messages reported as known, a read cut at the limit is never "clean" (runs in the guard-tests job). The scan itself, check-textos-publicos.mjs, needs your list (~/.config/agent-template/nomes-proibidos, outside the repo) and gh, so you run it by hand; with no list the commit-msg stays silent, and only the scan and the Claude Code hook (guard-textos-publicos, once a session) say so. In a PRIVATE repo where the names are legitimate, the USER can switch it off for that repo (src/docs/upgrade-why.md, never an agent; #375) |
| Sweep Tests | node .agent/scripts/tests/test-mutation-sweep.mjs — fake checker + fake suite with known behaviour; asserts the sweep detects an untested warning site and fails on every failure path (runs in the guard-tests job) |
(†) Every PR and push, except one kind: a push to
mainin a PRIVATE repo whose head commit has the committerweb-flowruns only theGuard Testsgate andSecret Scan(#347). That is a merge through GitHub, but also a commit made in the web UI, which had no PR: the gate recomputes the same three facts (the event,private,web-flow) and cannot tell them apart. The limits are insrc/docs/scripts-guide-why.md. The suites rows are not one step each: since #337 they all run in ONE step,Suites — negative tests (em paralelo), throughlib/suites-em-paralelo.mjs, which is what "in theguard-testsjob" means above.
Why the steps are guarded: the
Projetostep only proves apackage.jsonexists (without one, every app step skips in its own shell, and an unknown answer fails). Each step then checks for its own toolchain (tsconfig.json, alint/build/test:unitscript) so a project that doesn't use it gets a skip instead of a red X. Once your stack is fixed, drop the guard and let the step fail for real. The audit is deliberately non-blocking — transitive high-severity advisories are common and often unfixable without a breaking bump; review the report and escalate it to a hard gate (removecontinue-on-error) once your dependency tree is clean.
CI runs on
pull_request+pushwith a least-privilegepermissions: contents: readblock. Dependabot PRs ride the normalpull_requestpath (GitHub's safe default: read-only token, no secrets) — nopull_request_targetneeded, since no CI step requires secrets. A separatesecret-scan(gitleaks) job runs on every push, even on the bare template.
| Step | What it does |
|---|---|
| E2E Tests | npm run test:e2e — Playwright headless (skipped if the script does not exist) |
| Security Tests | npm run test:security |
| Report | Upload Playwright report on failure |
E2E is separate from CI because it's slower and requires test credentials. Enable on PRs by uncommenting the trigger in the file.
- CodeQL (
codeql.yml) is template-only: it analyses this repository's machinery, which lives in hidden folders that GitHub's "Default setup" ignores. The bootstrap removes it from a new project, and/upgradedoes not bring it. A project uses "Default setup" on a public repository (it analyses the project's own source) and no CodeQL on a private one without a license — CodeQL's terms forbid it on non-open-source code. Seesrc/docs/github-security.mdfor what each GitHub security setting offers on public vs. private repositories. - Release: pushing a
vX.Y.Ztag creates the GitHub Release — title from the annotated tag's first line, notes from its body plus the PRs since the previous final version. A tag with-(v1.1.0-rc1) is published as a pre-release, never as "Latest".
- Weekly npm dependency updates (minor + patch grouped)
- Weekly GitHub Actions updates
- Automatic PRs labelled
dependencies/ci— but only if those labels exist in the repo. Dependabot applies existing labels; it does not create them, and silently opens unlabelled PRs otherwise:gh label create dependencies -d "Dependency updates (Dependabot)" -c 0366d6 gh label create ci -d "CI/CD and GitHub Actions" -c 1d76db gh label create automerge -d "Opt-in: Dependabot auto-merge" -c fbca04
| File | What it does |
|---|---|
CODEOWNERS |
Automatic reviewers per file/folder |
pull_request_template.md |
Required checklist aligned with /review |
ISSUE_TEMPLATE/bug_report.md |
Structured bug reporting |
ISSUE_TEMPLATE/feature_request.md |
Structured feature requests |
dependabot.yml |
Weekly automatic dependency updates |
.editorconfig |
2 spaces, UTF-8, LF — cross-IDE consistency |
LICENSE |
MIT by default (customizable in bootstrap) |
Each version (vX.Y.Z) has an annotated git tag. Tags are created after each sprint/release is merged to main (/deploy). Pushing a tag runs release.yml, which creates its GitHub Release (title and notes from the tag message, plus the PRs since the previous final version). Visible at GitHub > Releases.
Branch protection rules (require status checks, block force push) require GitHub Pro for private repos. The CI works as an informational semaphore — shows green/red on PRs and the developer decides. If Pro becomes available, enable in GitHub Settings > Branches.
Note: the
Code Qualityjob checks forpackage.jsonafter checkout (itsProjetostep), and its app steps skip on the bare template.Three consequences of one job (#347), written down:
- A red check does not hide the others (#428). The five app checks run with
!cancelled(), so atscerror still lets the unit tests and the audit run in the same run. IfInstallfails, they skip (nonode_modules; the job is already red).- In a PRIVATE repo, the push of a PR merge skips
Code QualityandGuard Suites(#347): the PR already ran them on the same code.Guard Testsstill runs, re-checks that it really is a merge push (web-flow, private, not a PR) and checks the merge message with.githooks/commit-msg.Secret Scandoes not skip (#372): a web-UI commit straight tomainhas the same committer, and would never be scanned. Limits: a PR merged red, a web-UI commit straight tomain, or a forged committer also skip the other two — seesrc/docs/scripts-guide-why.md. Public repos run everything on push, as before.- On the bare template the
Auditstep shows a tolerated X on every run.npm auditfails without a lockfile, andcontinue-on-errorkeeps the job green. Guarding it would take a newif:, which the surface checker counts. (An earlier version of this note describedhashFiles('package.json')—ci.ymlrejects that explicitly, because job-levelhashFilesruns before checkout and is unreliable.)
| Placeholder | Description |
|---|---|
{{PROJECT_NAME}} |
Project name |
{{PROJECT_SLUG}} |
Kebab-case slug |
{{PROJECT_DESCRIPTION}} |
Short description (1-2 sentences) |
{{DOMAIN_DESCRIPTION}} |
Detailed domain description |
{{FRAMEWORK}} |
Frontend framework |
{{BACKEND}} |
Backend/BaaS |
{{STYLING}} |
Styling framework |
{{STATE_MANAGEMENT}} |
State/data fetching management |
{{KEY_LIBRARIES}} |
Key libraries |
{{TEST_FRAMEWORK}} |
Test framework |
{{STACK}} |
Full stack (1 line) |
{{UI_LANGUAGE}} |
UI language (e.g., "PT-PT", "EN") |
{{HOSTING}} |
Hosting platform |
{{TYPES_FILE}} |
Main types file path |
{{ENV_VARS_TEMPLATE}} |
Environment variables template |
{{TEST_ENV_VARS}} |
Test environment variables |
{{PROJECT_STRUCTURE}} |
Directory tree |
{{SECURITY_EMAIL}} |
Security disclosure email |
{{SECURITY_PROTECTS}}, {{SECURITY_NOT_PROTECTED}}, {{SECURITY_OUT_OF_SCOPE}} |
The security model in SECURITY.md: drafted by the agent, approved by you |
{{DATA_BREACH_SCOPE}} |
Whether the personal data breach procedure in SECURITY.md applies |
{{COPYRIGHT_HOLDER}} |
License copyright holder |
{{YEAR}} |
Current year |
{{DATE}} |
Current date (auto-filled in context files) |
{{AGENT_NAME}} |
Name of the AI agent running bootstrap (auto) |
{{SPRINT_DESCRIPTION}} |
First sprint description (auto/placeholder) |
{{QUALITY_TIER}} |
UI quality tier: MVP / Polido / Elite (or N/A if no UI) |
{{GITHUB_OWNER}} |
GitHub username/team for CODEOWNERS (e.g. your-org) |
.agent/rules/business-logic.md— Domain business rules.agent/rules/pages-architecture.md— Page architecture and UI
| Agent | File it auto-loads | Slash commands | Verified how |
|---|---|---|---|
| Claude Code | CLAUDE.md (+ .claude/) |
native (all of them) | Used throughout this template's own development |
| Google Gemini CLI | GEMINI.md |
native (.gemini/commands/) |
Entry file and wrappers checked by Guards 2, 6, 7, 10 |
| GitHub Copilot | .github/copilot-instructions.md |
no | Exercised in a real Copilot session (maintainer, 2026-09-10): Copilot loads the file and answers from the project's rules |
| Cursor | .cursor/rules/*.mdc |
no | Same — shipped, pointing to AGENTS.md; not exercised in a real Cursor session |
| ChatGPT / Codex | AGENTS.md |
no | Same — AGENTS.md is its documented convention; not exercised |
| Windsurf, Zed, others | AGENTS.md (if supported) |
no | Unverified — check your tool's docs for which file it loads |
On "verified": an earlier version of this table marked Cursor and Copilot as Tested while listing
CLAUDE.mdas their entry file — which neither tool loads, and no such test had been run. The columns above say what was actually done. If you exercise one of the unverified rows, a PR correcting it is welcome.How to exercise a row properly. Since the Fronteiras block is now inlined in
.github/copilot-instructions.mdand.cursor/rules/project.mdc(so those tools get the non-negotiable rules even if they don't follow references), a tool answering "what's the branch rule?" proves it reads its entry file — but not that it follows the pointer toAGENTS.mdand.agent/. To test the pointer, ask something that lives only deeper, for example "which state-management library must I use for data fetching, and why notuseEffect?" (that's in.agent/rules/core-rules.mdand nowhere else). If the answer is vague, the tool needs content inlined rather than referenced.
Why multiple entry files? Claude Code parses
@file, Gemini's Memory Import Processor needs a relative prefix (@./file), andAGENTS.mdis the tool-neutral cross-tool entry. All share the same source of truth in.agent/— only syntax/entry differs.An earlier version of this line claimed Gemini needs
@[file]brackets. That form appears nowhere in the Gemini CLI docs, andcheck-doc-versions.mjsnormalised it — so the guard was defending the wrong syntax. Verified with@google/gemini-cli0.59.0 (#40): the@./form is honoured — the twoENOENTlines it prints on an un-bootstrapped template prove it (seeBOOTSTRAP.md). The bare@xform (no./) is still unverified, and the guard accepts it.
.claude/ (slash commands, subagents, settings.json) is read only by Claude Code — other tools ignore it. But no logic lives there: each command is a thin wrapper that says "read and follow .agent/workflows/<name>.md". The workflows, rules, and context all live in .agent/, which every agent reads.
- Claude Code:
/plan,/review, etc. are typed slash commands; the permission boundary and subagents apply. - Gemini CLI: the same 14 commands ship as
.gemini/commands/*.toml. - Any other agent: ask "run /plan" or "follow
.agent/workflows/plan.md" — the identical file.
What you do lose outside Claude Code, stated plainly rather than waved away:
| Lost | Consequence | What to do instead |
|---|---|---|
.claude/settings.json |
No enforced boundary: nothing blocks reading .env*, and nothing forces a prompt before git commit/push or npm install. Guard 11 has nothing to check and skips |
Use your tool's own permission/approval settings, and keep the rules in .agent/rules/ as the stated contract |
.claude/agents/code-reviewer.md |
Fase 4 of the per-ticket method has no subagent | Run it as a separate session given only the diff — the point is a reader without the author's reasoning, not the mechanism |
.claude/hooks/ |
No automatic denial of commit/push on a protected branch, no branch/state assertion at session start, no "which suite is owed" warning. This is the enforcement layer, and it is Claude-only | .githooks/commit-msg still runs (it is git-level, not Claude-level), and the CI re-runs it. The equivalent checks are .agent/scripts/check-*.mjs — run them before commit |
| Typed slash commands (except Gemini) | /plan is not a keystroke |
Say "follow .agent/workflows/plan.md". The wrappers were never more than that sentence |
Everything that carries logic — rules, workflows, context, the guards and their tests — is in
.agent/ and .agent/scripts/, which any agent can read and any shell can run. The guards
need only Node; they have no dependencies and no package.json.
Native slash commands ship for both Claude Code (.claude/commands/) and Gemini CLI (.gemini/commands/*.toml) — same commands, thin wrappers over .agent/workflows/. .github/copilot-instructions.md and .cursor/rules/project.mdc ship as equally thin pointers to AGENTS.md, because those are the files those tools load; neither adds logic.
This template enforces Conventional Commits:
feat(scope): add new feature
fix(scope): resolve bug
docs(scope): update documentation
test(scope): add tests
chore(scope): maintenance
ci(scope): pipeline changes
Full guide in CONTRIBUTING.md and .agent/rules/process-rules.md.
Template -> your projects. Run /upgrade in the derived project
(.agent/workflows/upgrade.md). It decides by file category, never by a list of names, and
never touches .agent/context/. If the project has .agent/.template-version (written at
bootstrap) it diffs only what changed since — also for a project made with "Use this template",
which has no tags: the marker records the version from .agent/TEMPLATE_VERSION. If not, it
detects which capabilities are missing instead of diffing — and writes the marker, so the next
upgrade is cheap.
Your projects -> template. A rule that proved itself in a real project is worth more than
one invented here. Update the file in the template repo, then add the row to the propagation
matrix in .agent/rules/propagation.md so /upgrade knows the category. Existing projects are
never modified in place.
See CONTRIBUTING.md for development workflow, commit format, and PR process.
See SECURITY.md for vulnerability disclosure policy.
MIT — customize the copyright holder during bootstrap.