@AGENTS.md
- Use plan mode for architectural changes (memory, scheduler, VFS redesign)
- Before changing existing architecture:
- Search for an existing abstraction — grep the codebase
- Reuse it if possible — prefer composition/extension
- If introducing new abstraction, justify: why existing is insufficient, trade-offs, impact on layering, migration path
- Run
xmaketo verify kernel builds after kernel changes - Run
xmake -bv Test && xmake run Testafter modifying LibFK or LibC - Run
xmake check-layersafter modifying Kernel files to verify layer separation - See @.claude/rules/ for path-specific coding guidelines
- All source/header files MUST use
snake_case— see AGENTS.md "File Naming (ENFORCED)" - When creating new files, always use
snake_casenaming - Renames must use
git mvand update all#includereferences - Naming cleanup tracked in TODO.md Phase 22
- Always use log functions:
fk::algorithms::klog/kwarn/kerror/kdebug— never rawkprintf()in kernel code - Prefix convention:
UPPER_SNAKE_CASEsubsystem name, max 20 chars (e.g.,SCHEDULER,VFS,NVME_REG) - Error messages: Include context:
"Failed to mount: error=NOT_FOUND path=/dev/sda1" - Init messages: Log at INFO level during subsystem initialization
- Don't use
kerror()for recoverable errors — it halts the CPU; usekwarn()instead - Debug messages: Use
kdebug()for diagnostic output; these may be stripped in release builds - See
Docs/Kernel/Logging/README.mdfor full architecture - See
.ai-docs/development-patterns/kernel-logging.mdfor conventions
- Kernel code MUST NOT include
<LibC/...>headers — use LibFK equivalents (see AGENTS.md mapping table) - LibFK MUST NOT include
<Kernel/...>headers — use allocator backend pattern for callbacks - Run
xmake check-layersafter modifying Kernel or LibFK files - Only exceptions:
Panic.cppandkernel_puts.cpp(documented in AGENTS.md)
- Kernel changes MUST include regression tests for the modified subsystem
- Edge cases: Always test null inputs, boundary values, error paths, concurrent access
- Run
xmake -bv Test && xmake run Testafter any LibFK or LibC changes
- Mermaid only: All diagrams in Docs/ must use Mermaid syntax
- MathJax: Use
$$...$$for mathematical formulas in Docs/ - No ASCII art: Replace any ASCII diagrams with Mermaid equivalents
- Source-first: Read actual source code before writing/updating Docs/
- Keep in sync: When modifying kernel code, update the matching Docs/ file
- Cross-link: Use relative markdown links between Docs/ files
- Stubs must be filled: Empty README.md files under Docs/Kernel/ must have content