ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
AI Attribution Policy

Hard rule, no exceptions. Zero AI attribution anywhere in this codebase. The pre-commit gate scripts/checks/check_no_ai_attribution.py enforces this STRICTLY.

This is a personal, hand-written firmware project. Every line of code, every test, every comment, every doc page is presented as the work of a human developer. AI assistants may be used as a tool (the same way an editor, a debugger, or a search engine is a tool), but the codebase must never attribute itself to an AI system.

What is banned

Any reference to an AI tool as the author, reviewer, contributor, or generator of an artifact in the repository. This covers:

Banned token Notes
Claude Reserved EXCLUSIVELY for the filename CLAUDE.md. Any other usage is banned. The .claude config directory is allowed (it is a path, not an attribution).
Anthropic No legitimate in-tree use.
OpenAI No legitimate in-tree use.
Copilot No legitimate in-tree use.
ChatGPT No legitimate in-tree use.
GPT-3, GPT-4, GPT-4o, GPT-3.5, ... OpenAI product family. The bare token GPT and Renesas channel names GPT0..GPT13, GPT320..GPT323, ra8_gpt, GPT_BASE etc. are ALLOWED – the RA8D2 chip has a GPT (general PWM timer) peripheral, so the dash is what discriminates the AI product from the hardware block.
Co-Authored-By: Claude, Co-Authored-By: Anthropic, ... Banned in commit messages too (CLAUDE.md "Git Commits and Pull Requests" section), but this gate also catches them if they end up in tracked files.
Generated by Claude, Generated with GPT, Generated by AI, ... Same.

Forbidden patterns (examples)

// BANNED: annotation attributing review to an AI
RA8_REVIEWED_BY("Claude") // AI-OK: forbidden-pattern example
// BANNED: comment attribution
// Refactored by Claude on 2026-04-30 // AI-OK: forbidden-pattern example
// BANNED: author line // AI-OK: forbidden-pattern example
#define RA8_REVIEWED_BY(name)
Safety-critical review sign-off marker.
# BANNED in commit messages and tracked files alike
Co-Authored-By: Claude <noreply@anthropic.com> # AI-OK: forbidden-pattern example
Generated with Claude Code # AI-OK: forbidden-pattern example

Allowed patterns

// ALLOWED: Renesas GPT timer references
ra8_gpt_init(k_ra8_gpt_ch0, &cfg);
volatile uint32_t* base = (uint32_t*)k_ra8_gpt0_base;
// MSTPE18 GPT13, MSTPE19 GPT12 -- standard hardware nomenclature
ra8_err_t ra8_gpt_init(uint8_t channel, const ra8_gpt_cfg_t *cfg)
Initialise a GPT channel with a full config descriptor.
Definition ra8_gpt.c:329
# ALLOWED: the project's own filename
See CLAUDE.md for the full rule.
just hooks
# ALLOWED: the .claude config directory referenced as a path
EXCLUDE_DIRS=("build" ".git" ".claude")

Per-line opt-out: AI-OK: <reason>

A handful of files (this one, CLAUDE.md, CONTRIBUTING.md) legitimately need to spell the banned tokens in order to quote the policy. Append an HTML comment, line comment, or hash comment containing the literal tag AI-OK: <reason> to the offending line:

* **No AI attribution.** Do not add `Co-Authored-By: Claude`. <!-- AI-OK: quoting the banned footer -->
BANNED_TOKENS = ("claude", "anthropic", "openai") # AI-OK: gate self-reference
/* The legacy header used "Claude" as a placeholder author. AI-OK: quoting historic text */

The opt-out is per line – it does not span multiple lines. Use it sparingly. Reviewers should reject opt-outs that don't have a clear reason (i.e. "I just wanted to write Claude here" is not acceptable).

How the gate works

scripts/checks/check_no_ai_attribution.py walks every tracked file in the repository, enumerated from git ls-files through the shared first_party_paths helper. The hand-written directory list this used to carry silently exempted tools/, .github/, .devcontainer/, cmake/ and the whole repository root from a ban that applies to any tracked file, so a new top-level directory is now policed the day it lands. For each text file with a recognised extension (.c, .h, .md, .py, .sh, .cmake, .yml, .txt, ...) it scans line by line for the banned patterns and reports each violation as:

<path>:<line>: AI attribution found ('<token>'): <line excerpt>

The script exits non-zero on any violation. The pre-commit hook (scripts/git/pre-commit) runs it after the existing checks; CI runs it on every PR.

Generated, vendored and build-output trees are skipped. The check is strict from day one – there are no warn-only / grace-period semantics.

Why this matters

  1. Provenance honesty. A safety-critical firmware codebase that targets IEC 61508 SIL 3 / DO-178C Level B / ISO 26262 ASIL C/D needs a clear chain of human responsibility. "An AI wrote this" is not a valid line in a certification artefact.
  2. Tool-churn resilience. AI tooling changes weekly. Hard-coding "Claude" or "GPT-4" or "Copilot" into review annotations or docstrings dates the codebase the moment those tools are renamed, retired, or replaced.
  3. Single source of truth. The project's policy on AI attribution lives in CLAUDE.md and this file. Scattering free-form attribution throughout the source tree fragments that policy and makes it impossible to audit.