Imported from alexandremendoncaalvaro/CorridorKey-Runtime (
AGENTS.md). Install upstream withnpx skills add alexandremendoncaalvaro/CorridorKey-Runtime. Copyright stays with the author.
AI Agent Rules
This file is read automatically by supported coding agents at the start of each session. It contains the non-negotiable rules for this repository.
Project Identity
- Name: CorridorKey Runtime
- Language: C++20 (no modules)
- Build: CMake 3.28+ with vcpkg manifest mode and CMake Presets
- License: CC BY-NC-SA 4.0
Structural Rules
ARCHITECTURE.md is the source of truth for the directory layout, layer
boundaries, public API surface, PIMPL/visibility/zero-copy/SIMD/Result
contracts, and the Active ADRs list. Read it before adding new files,
exporting new symbols, or moving code across layers. Do not duplicate its
rules here.
Code Standards (see docs/GUIDELINES.md for details)
snake_casefor functions, variables, filesPascalCasefor types (classes, structs, enums)m_prefix for private membersUPPER_SNAKE_CASEfor constants.hppfor headers,.cppfor implementation — no.hfiles- Const correctness everywhere
- RAII for all resources — no raw
new/delete - Error handling via
std::expectedorstd::optional, not exceptions for expected failures - Max cognitive complexity per function: 15
- Max ~200 lines per
.cpp, ~100 lines per.hpp(guideline, not hard rule) - Prefer early returns over nested if/else
- No abbreviations in names except standard domain terms:
rgb,exr,fps,io
Testing
- Framework: Catch2 v3
- Tags:
[unit],[integration],[e2e],[regression] - Bug fixes must include a regression test
- Unit tests: no I/O, no GPU, < 1 second each
- Test file naming:
test_<module>.cpp
Build & Infrastructure
- Use
CMakePresets.jsonas the source of truth for build configurations - Always use vcpkg Manifest Mode with
vcpkg-configuration.jsonfor baseline pinning - Strict warnings:
-Wall -Wextra -Wpedantic -Werroror the MSVC equivalent - Enable AddressSanitizer (ASAN) in Debug presets
- Keep build behavior target-based in CMake. Do not use global include, link, or warning configuration when a target-scoped setting is available
Operational Rules
- Use feature branches and PRs. Do not work directly on
main scripts/windows.ps1is the only Windows entrypoint. Every Windows build, package, certification, and release runs through it via-Task build | prepare-rtx | certify-rtx-artifacts | package-ofx | package-adobe | package-runtime | package-suite | release | regen-rtx-release | sync-version. Never callscripts/build.ps1,scripts/prepare_windows_rtx_release.ps1,scripts/release_pipeline_windows.ps1, or any other sub-script directly; they are internal delegates and skip the version metadata sync, track resolution, and validation the wrapper applies.- When any prerequisite is missing (TensorRT-RTX SDK at
vendor/TensorRT-RTX/,vcpkgatVCPKG_ROOT,uv, CUDA Toolkit 12.9), fix the prerequisite. Do not route around the canonical pipeline. - The only supported repo-local Windows runtime roots are
vendor/onnxruntime-windows-rtxandvendor/onnxruntime-windows-dml - Do not use
vendor/onnxruntime-universalor a globally installed ONNX Runtime as a Windows build or release dependency - Do not create git worktrees that shadow
vendor/.git worktree remove --forcehas followed Windows junctions intovendor/and erased the real curated runtimes. If a second working copy is needed, stage its own curated runtimes instead of sharing them. - Changes to the render hot path (
src/plugins/ofx/,src/core/inference_session.cpp,src/core/engine.cpp,src/core/gpu_prep.cpp,src/core/gpu_resize.cpp,src/post_process/) must be measured against thephase_8_gpu_preparebaseline indocs/OPTIMIZATION_MEASUREMENTS.mdviascripts/run_corpus.sh+scripts/compare_benchmarks.py. Reject the change whenavg_latency_msorort_runregresses by more than 10%. - Windows packaging may proceed with a partial model set, but missing packaged models must be surfaced in generated inventory and validation reports. Missing models are reportable packaging state; invalid packaged models that are present still block the release flow.
- Keep
AGENTS.mdandCLAUDE.mdidentical. If one changes, change the other in the same diff
Commit Style
- Conventional Commits:
feat:,fix:,test:,refactor:,chore:,docs:,perf: - Do not commit to
maindirectly - Every commit must carry a
Signed-off-by:trailer. The repository enforces the Developer Certificate of Origin (seeCONTRIBUTING.mdsection "Developer Certificate of Origin (DCO)") via a status check that blocks merge on any commit lacking the trailer. Usegit commit --signoff(or-s) so the trailer is added at commit time. Commits authored through the Claude Code agent are no exception — passing--signofffrom the start avoids the "rebase + force-push to add sign-off retroactively" remediation that rewrites every commit hash on the branch (and detaches any tag previously published from the branch ancestry it once shared). Past remediation required an admin merge because unsigned commits had accumulated; preserving the published Windows prerelease tag's commit hash precluded the rewrite path.
Documentation Rules (see docs/GUIDELINES.md section 10 for details)
- Documentation contains definitions and decisions, not speculation, history, or unfounded plans
- No dates, version stamps,
DRAFTmarkers, or changelogs in general docs; ADRs and task records may include date/status fields required by their templates - No emoji anywhere: not in docs, code, or commits
- Every document starts with business context (why) before technical details
- Each document has one scope. Do not duplicate content across documents
- Code is the primary documentation of behavior. Comments explain why, not what
- No commented-out code and no
TODO/FIXMEin source. Use GitHub Issues - Tests are living documentation of behavior
What NOT to Do
- Do not use
std::vectorfor image data; useImageBuffer - Do not use expensive math functions (
std::pow,std::exp) inside hot pixel loops - Do not add files to root unless they are project-level config or documentation
- Do not put business logic in
src/cli/ - Do not leak external library types into
include/corridorkey/ - Do not create documentation files unless explicitly asked
- Do not bypass hooks with
--no-verify - Do not commit model files (
.onnx,.pth) unless the repository already tracks them - Do not add dependencies without a
$commentinvcpkg.json - Do not put source code in documentation files
- Do not write comments that restate what the code does
- Do not use
std::exitorabortin the library; returnResult<T>instead - Do not use global state or static variables in the library
RTK & Graphify Project Capabilities
RTK (Rust Token Killer)
- Always prefix shell commands with
rtk(e.g.,rtk git status,rtk cargo test,rtk ls,rtk grep). - Reduces token consumption by 60-90%.
Graphify (Codebase Knowledge Graph)
- This project supports Graphify mapping. When unfamiliar with an architectural component, run
/graphify .or consultgraphify-out/before brute-force reading files.
Skills installed by agentic
Generated by @alexandrealvaro/agentic init. Do not edit this section by hand — re-running the installer regenerates it. Edit the kit instead: https://github.com/alexandremendoncaalvaro/agentic-development.
| Skill | Invoke | Notes |
|---|---|---|
ad-bootstrap |
/ad-bootstrap |
Generate or audit AGENTS.md at the repo root. |
ad-philosophy |
/ad-philosophy (also implicit) |
Universal agent guardrails (think, decide when grounded, verify done, report for a decision-maker). Auto-loads as posture on non-trivial work; an explicit /ad-philosophy additionally forces a binding statement applying all eight behaviors to the current task. |
ad-architecture |
/ad-architecture |
Generate or audit ARCHITECTURE.md at the repo root. |
ad-adr |
/ad-adr |
Draft a new ADR at doc/adr/NNNN-<slug>.md. |
ad-prd |
/ad-prd |
Lazy lifecycle owner of doc/product/PRD.md (or doc/product/<slug>.md multi-product). Layer 3 — product-level scope (target user, problem, success metrics, multi-feature roadmap) that feature specs inherit from. Distinct from ad-spec (feature-level). |
ad-guidelines |
/ad-guidelines |
Lazy lifecycle owner of GUIDELINES.md (Layer 1 Constitution, full engineering reference). Twelve sections — design principles, code standards, complexity, API, performance, build, static analysis, quality gates, testing, git, documentation, security. Pre-suggested defaults from canon + scan-first detection. |
ad-spec |
/ad-spec |
Draft a feature spec at doc/specs/NNNN-<slug>.md (Spec Kit-aligned mandatory sections). Layer 4 of the six-layer artifact stack. References parent PRD (ad-prd, Layer 3) for product-scope inheritance. |
ad-task |
/ad-task |
Draft a new task at doc/tasks/NNNN-<slug>.md. |
ad-drift |
/ad-drift |
Read-only drift report comparing AGENTS.md / ARCHITECTURE.md / ADRs against the code. |
ad-review |
/ad-review |
Two-axis code review per WORKFLOW §10. Claude Code uses fresh-context subagents; Codex writes an audit trail, reviews inline by default, and ships a reviewer subagent for explicit escalation. |
ad-audit |
/ad-audit |
Maximum-gate rules-anchored audit. Fans out one fresh-context reviewer per rule-group, exhaustive per-rule verdicts (coverage matrix), cross-model on critical groups via the dual-host split, evidence-gated, never approves. Heavier than ad-review; hands rule gaps to ad-level-up. |
ad-level-up |
/ad-level-up |
Human-gated rule-set curation, companion to ad-audit. Four anti-overfitting gates + effectiveness pass + adversarial multi-lens review of each candidate, then a HARD human-approval gate — never writes unprompted, one item at a time. Writes to the ADR-0035 machine store or the ADR-0043 project layer (.agentic/rules/). |
ad-ground |
/ad-ground |
Four-source pre-implementation research (docs / impl-refs / in-repo / git history) + happy-path synthesis + deviation gate. WORKFLOW §4 + §5. |
ad-next |
/ad-next |
State survey + prioritized next-action recommendations across the six-layer artifact stack. Read-only navigation aid (flutter doctor pattern). |
ad-rules |
/ad-rules |
Load the host's global rules file (~/.claude/CLAUDE.md, ~/.codex/AGENTS.md, symlinks resolved) and reinforce it by listing topics in the conversation, plus the repo's binding docs and the kit's rule-set layers by reference. Read-only; audits nothing. |
ad-archive |
/ad-archive |
Hard-delete completed plan files (tasks / specs / PRDs / superseded ADRs) into git history. ADR-accepted requires absorption proof. |
ad-spike |
/ad-spike |
Staged spike with golden fixtures per WORKFLOW §14. Discovery + fixture + pipeline-with-gates + two-layer evaluation, when the technique is uncertain across multiple plausible approaches. |
ad-tdg |
/ad-tdg |
Outcome-based prompting per WORKFLOW §9. Ground truth pair + Test Dependency Map + three approaches + single-criterion selection, when the technique is known but the implementation strategy is uncertain. |
ad-tdd |
/ad-tdd |
Test-Driven Development per WORKFLOW §16. Red-green-refactor as deterministic LLM guardrail. Five phases — confirm regime, plan, tracer bullet, incremental loop, refactor. Tests verify behavior through public interfaces. Horizontal slicing rejected. |
ad-domain |
/ad-domain |
Lazy lifecycle owner of CONTEXT.md (Layer 2 — ubiquitous language per Evans 2003). Captures canonical project-specific nouns with aliases-to-avoid, relationships, and flagged ambiguities. Single-context or CONTEXT-MAP.md multi-context. |
ad-grill-me |
/ad-grill-me |
Interview-before-research grilling session — one question at a time with recommendation, codebase-first, sharpens vocabulary against CONTEXT.md, captures terms via ad-domain and decisions via ad-adr (three-criteria rule). Upstream of ad-ground. |
ad-deepen |
/ad-deepen |
Surface deepening opportunities using WORKFLOW §8 vocabulary (Module / Interface / Depth / Seam / Adapter / Leverage / Locality). Three phases — explore, present numbered candidates with deletion-test framing, grill the chosen one. Pairs with ad-drift. Profile-scoped to team and mature only. |
ad-diagnose |
/ad-diagnose |
Disciplined diagnosis loop for hard bugs and performance regressions per WORKFLOW §15. Five phases — build a feedback loop (the skill itself), reproduce, hypothesise (3-5 ranked falsifiable), instrument (one variable at a time), fix + regression-test. |
ad-commit |
/ad-commit |
Atomic Conventional Commits with DCO Signed-off-by sign-off. Four phases — scope intake, stage-split when concerns mix, draft message in Conventional Commits format, sign + write. Helper posture, not blocker. |
ad-pr |
/ad-pr |
Open a GitHub pull request with a uniform body shape (Summary / Test plan / Links). Four phases — preflight (gh auth + branch pushed), scope assembly, draft body, open + report URL. Title format = Conventional Commits. |
ad-merge |
/ad-merge |
Evaluate and merge a GitHub pull request. Four phases — preflight, evaluate (CI / fresh-context review / linked task / unresolved comments / mergeability), decision (CI green = hard gate; others = warnings), merge with auto-detected mode + --delete-branch. |
ad-handoff |
/ad-handoff |
Compact current session into a handoff doc in the OS temp dir. Rebuilds the work as a done/open roadmap checklist, sweeps for asks that never landed, reports repo hygiene without acting on it, binds the next agent to ad-philosophy, references artifacts by path, redacts secrets. Never commits. |
ad-design |
/ad-design |
Bootstrap DESIGN.md from existing tokens (frontend projects). |
ad-subagent |
/ad-subagent |
Draft a host-specific custom subagent for bounded delegated work — Claude Code .claude/agents/<name>.md, Codex .codex/agents/<name>.toml. |
ad-skill |
/ad-skill |
Draft a new Claude Code or Codex skill at the appropriate path. |