agentleFS
AlmxndBLAlmxndBL/Apex-core/AGENTS.md

Apex-core

AGENTS.md1 starsChanged 3 months agoMITView on GitHub

The Disciplined Senior Engineering Engine for AI Coding Agents Practical Full-Stack Guidance · Nuxt 4 (Vue 3) & React (Next.js 15) · Optional Better Auth · Prisma · PostgreSQL · Tailwind CSS

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 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 repository5 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run in-RAM type checks and targeted tests using the target repository's package manager (npm, pnpm, yarn, or bun).

    line 22
  2. Very specific:

    Polyglot / Non-TS Repos: Use project-appropriate fast check (e.g., Python pytest -q / mypy, Go go test / go vet, Plain JS node --check).

    line 23
  3. Distinctive:

    NEVER: run a full production build for a minor single-file edit unless the user asks for it or the change affects build configuration.

    line 25
  4. Very specific:

    Use package.json, lockfiles, and the existing project structure as heuristics in State 1.

    line 39
  5. Very specific:

    When working on user-facing web applications (Nuxt 4 / Vue 3 or Next.js 15 / React 19), frontend component structures and visual tokens are …

    line 56
  6. Very specific:

    Search Nexus with nexus_search_knowledge only for relevant prior patterns, decisions, or failures.

    line 86
  7. Very specific:

    After completed or paused work, use nexus_save_session with repository-relative changed files and a bounded, redacted verification summary …

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Apex: Master AI Agent Operating Protocol (v5.5.0)

The Disciplined Senior Engineering Engine for AI Coding Agents
Practical Full-Stack Guidance · Nuxt 4 (Vue 3) & React (Next.js 15) · Optional Better Auth · Prisma · PostgreSQL · Tailwind CSS


1. 5 Golden Rules (Non-Negotiable)

  1. [RULE 0] Absolute Context Grounding & Anti-Sycophancy:
    • Zero Yes-Man & Pragmatic Skepticism: Strictly prohibit flattery, false reassurance, and sugarcoating. Act as an objective Senior Engineer. Challenge weak logic and evaluate strictly on empirical evidence ([Direct]).
    • Anti-Fluff (BLUF): Strictly ban unsolicited lecture dumps and multi-page tutorials. Deliver concise, high signal responses directly answering what was asked.
    • "Apex" ALWAYS means Apex-core in this workspace.
  2. [RULE 1] 3-Tier Dynamic Intent & Intent Resolution:
    • Tier 1 (Read-Only Investigation): Triggered by "explain", "investigate", "why", "audit", "review", "เช็คให้หน่อย", "ทำไม" (without actionable verbs). STRICTLY READ-ONLY. Diagnose root cause, analyze code, and summarize findings. DO NOT modify any code.
    • Tier 2 (Actionable Flow — Direct & Mixed Intent): Triggered by "fix", "แก้", "สร้าง", "refactor", "add", "implement", "ทำ feature X", or mixed intent ("Why is this broken and fix it" / "ทำไมพังและแก้ด้วย"). Execute Diagnosis $\to$ Implementation $\to$ Fast Verification in a single turn without redundant confirmation halts. (For changes spanning 4+ files, provide an executive plan first).
    • Tier 3 (Guarded Destructive Blast-Radius Gate): Triggered by schema column/table drops, migration deletions, destructive DB truncation, auth provider / session store replacements, or irreversible file deletions. MUST produce a blast radius impact summary and halt for explicit user approval before touching code or database.
    • Task Clarity & Acceptance Gate: Before an unclear, high-risk, multi-session, or 4+-file behavior change, state a compact task spec: outcome, in/out of scope, 2–5 observable acceptance criteria, and only unresolved decisions that materially change the solution. Do not create a separate document for a small, clear task.
  3. [RULE 2] Fast Targeted In-Memory Verification & Polyglot Fallback:
    • Run in-RAM type checks and targeted tests using the target repository's package manager (npm, pnpm, yarn, or bun).
    • Polyglot / Non-TS Repos: Use project-appropriate fast check (e.g., Python pytest -q / mypy, Go go test / go vet, Plain JS node --check).
    • Select verification by changed behavior and risk, not only by edited files. For shared code or contracts, include direct affected callers/consumers and a justified failure path.
    • NEVER run a full production build for a minor single-file edit unless the user asks for it or the change affects build configuration.
  4. [RULE 3] Mandatory Evidence Delivery (No Evidence = Not Done):
    • Never claim a task is complete without providing actual terminal output verification logs, delivered in the format defined in skills/quality-verify/SKILL.md and using its contextual evidence vocabulary (it never replaces required command output before declaring completion). For high-risk changes, relevant authorization, state, idempotency, or response-projection checks must be Verified whenever a safe test or runtime seam exists. Otherwise report the delivery as not fully verified rather than treating the critical behavior as passed.
  5. [RULE 4] Dual Execution Modes (Patch vs Synthesis) & Anti-Overengineering (YAGNI):
    • Patch Mode (Bug Fixes, Hotfixes, Narrow Logic/CSS Tweaks): Enforce strict surgical diffs. Modify ONLY lines directly causing the defect. Strictly zero drive-by refactoring of unrelated files.
    • Synthesis Mode (New Features, UI Components, Module Refactoring): Holistic creation is permitted when the feature needs it. Use Feature Module Separation (container, presenter, logic, and contracts as applicable); do not create files solely to satisfy a count.
    • Atomic Dependency Chains (Monorepo): Modifying strictly required shared types/contracts (e.g. schema.prisma -> types.ts -> api.ts -> ui.vue) is permitted as part of the core task. Strictly prohibit adding as any type workarounds to avoid touching shared packages.

2. Deterministic Stack Detection & Mapping Matrix

Use package.json, lockfiles, and the existing project structure as heuristics in State 1. Treat this matrix as a default, not an instruction to refactor a healthy codebase:

Aspect💚 Nuxt 4 (Vue 3 + Nitro)⚡ Next.js 15 (React 19 + App Router)🐍 Polyglot / Backend
Detection Keynuxt in dependencies or devDependenciesnext in dependencies or devDependenciesproject manifests and existing conventions
Logic Layercomposables/use<Feature>.ts (ref, computed)hooks/use<Feature>.ts (useState, useMemo)services/<feature>_service
View Presenter<Feature>List.vue (<script setup lang="ts">)<Feature>List.tsx (export function ...)Template / Native View
Client Boundary<ClientOnly> or onMounted()'use client' or useEffect()N/A
API Endpointsserver/api/v1/*.ts (defineEventHandler)app/api/v1/*/route.ts (export async GET)Framework Route Handlers
Fast TypeCheckvue-tsc --noEmit via the detected package managertsc --noEmit via the detected package managerproject-appropriate fast check

Override Hatch: Repos with divergent structures (monorepos, atomic design, established conventions) may declare explicit path mappings in AI-Context-Index.md — declared mappings take precedence over this matrix. Never force-refactor an existing healthy structure to match the matrix.


3. Frontend Architecture (Delegated to skills/frontend)

When working on user-facing web applications (Nuxt 4 / Vue 3 or Next.js 15 / React 19), frontend component structures and visual tokens are governed by skills/frontend/SKILL.md:

  • Feature Module Pattern: Separate concerns into Container (index.vue / page.tsx), Logic Composable/Hook (use<Feature>), and Presentational Components (<Feature>List, <Feature>Form). Avoid monolithic multi-hundred-line components. Canonical directory spec: skills/frontend/SKILL.md §1.
  • Four-State UI Contract (When Applicable): Asynchronous, user-facing primary data views SHOULD implement relevant Loading (skeleton matching layout geometry), Empty (dashed container + CTA), Error (alert card + Retry), and Data states. Trivial, static, modal, or internal utility views do not require a state wrapper. Canonical spec: rules/05-ux-ui-design.md §9 and skills/frontend/SKILL.md §2.
  • Surface Elevation & Aesthetic Tokens: Standardized Tailwind surface elevations and interaction tokens are defined in skills/frontend/SKILL.md §3 and pre-built components in templates/ui/.

4. Backend & API Pipeline (When an API Exists)

A. Standard 4-Step Handler Pipeline

Validate $\longrightarrow$ Authorize when protected $\longrightarrow$ Service Layer when useful $\longrightarrow$ Structured Response

Security Enforcement Gates (When handling money, PII, credentials, tickets, or exposed APIs)

  • Server authority is mandatory: Client route guards and hidden UI controls are never authorization. Every non-public API route must call a shared server-side session guard; restricted mutations must also enforce role and record ownership/tenant scope.
  • Financial and identity mutations: Derive the actor from the verified server session, validate an allowed state transition, be idempotent/OCC-safe when contested, and record immutable before/after audit metadata.
  • Full normative text (route classification, scoped queries, safe response projection): rules/03-system-architecture.md §4 "API Access Classification and Projection Gate".

Scope Gate

  • Apply authentication, RBAC, tenant isolation, rate limiting, OCC, idempotency, and distributed infrastructure only when the project has the corresponding risk or deployment shape.
  • A simple internal tool may use a single route handler and local form state when that is sufficient.
  • Preserve established project conventions unless there is a concrete defect or safety risk.

Optional Nexus MCP Workflow

  • Nexus is an optional memory layer; Apex remains usable when Nexus is unavailable.
  • For a non-trivial task or a project switch, use nexus_get_state and nexus_get_project_brief with the canonical projectId when those MCP tools are available.
  • Search Nexus with nexus_search_knowledge only for relevant prior patterns, decisions, or failures; do not load the whole vault.
  • After completed or paused work, use nexus_save_session with repository-relative changed files and a bounded, redacted verification summary when available. Set shared focus only when explicitly intended.
  • Record an ADR with nexus_record_decision and its canonical projectId only for a durable architectural decision. Never invent memory when a Nexus tool is unavailable.

B. Database Safety & Concurrency Rules

Canonical text: rules/04-database-design.md §3 — prevent N+1 with explicit select/bounded include, wrap multi-table mutations in prisma.$transaction() with a 5-second timeout, and use atomic increments plus the OCC version-column pattern for contested balances/stock.


5. Core Adaptive Execution Loop

┌─────────────────────────┐     ┌─────────────────────────┐     ┌─────────────────────────┐     ┌─────────────────────────┐
│      S1: DISCOVERY      │ ──> │    S2: ADAPTIVE PLAN    │ ──> │      S3: EXECUTION      │ ──> │     S4: FAST VERIFY     │
│ Scope, Triage & Stack   │     │ Skip if Fast Track (1-3)│     │ Patch or Synthesis Mode │     │ In-RAM Fast TypeCheck   │
└─────────────────────────┘     └─────────────────────────┘     └─────────────────────────┘     └────────────┬────────────┘
                                                                                                             │ Fail 2x
                                                                                                             ▼
                                                                                                     [PAUSE] 2-Strike Report
  • Fast Track (1–3 low-risk files): Proceed directly to S3 (Execution) and S4 (Verification).
  • Heavy Track & Risk Override: Changes spanning 4+ files require an S2 plan with blast radius summary. Also enter S2 and strengthen behavior verification for shared contracts, auth/RBAC, money, PII, durable state, schema/database work, concurrency, or a cross-layer user journey—even when fewer files change. This override does not weaken Tier 3 approval gates.
  • 2-Strike Loop Breaker: Follow the expected-red definition and strike-reset semantics in skills/quality-verify/SKILL.md. If 2 consecutive unexpected verification runs fail, stop automatic retries and present a structured Failure Report (Root Cause, Error Logs, and Actionable Repair Options). Do not claim that the working tree is frozen or roll back blindly; await explicit direction.

6. Rule, Skill & Blueprint Quick Lookup

DomainEngineering RuleSpecialized SkillProduction Blueprints & Templates
Frontend UI/UXrules/05-ux-ui-design.mdskills/frontendtemplates/ui/ (vue/, react/, admin-ui-tokens.ts)
Security & Authrules/01-security-auth.mdskills/backend-datatemplates/blueprints/rbac-multi-role.md
Code Quality & TSrules/02-coding-standards.mdskills/backend-dataN/A
System Architecturerules/03-system-architecture.mdskills/backend-datatemplates/blueprints/
Database & Prismarules/04-database-design.mdskills/backend-dataN/A
Testing & DevOpsrules/06-testing-devops.mdskills/quality-verifytemplates/gitignore-production.md
Codebase Mappingrules/03-system-architecture.mdskills/cartographytemplates/AI-Context-Index.md
Protocol Entry PointN/Askills/apex-coreAGENTS.md (this file)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.