# Agent Notes
## API-Level Strategy (All Crates)
When feature-gating modules, use the file-level `@since` value from the corresponding SDK header under:
`${OHOS_SDK_NATIVE}/sysroot/usr/include`
Steps:
1. Open the header and find the `@file` block.
2. Read the `@since` value in that block (not per-symbol `@since` tags).
3. Map to Cargo features:
- `@since 9`: no feature gate (always enabled) per project policy.
- `@since 10+`: gate the module with `#[cfg(feature = "api-XX")]` and `doc(cfg)` where `XX` is the `@since` value.
Notes:
- If a header lacks a file-level `@since`, verify in the SDK release notes or ask for clarification before gating.
- Prefer placing feature gates at the module declaration in each crate's `lib.rs` or top-level module file; keep per-item gates inside bindgen output as generated.
## Contributor Workflow
`CONTRIBUTING.md` is authoritative for these workflows — read the relevant section first and follow the numbered steps in order, without skipping:
- Adding a new `-sys` crate → "Adding a new `-sys` crate for an OpenHarmony module / API".
- Regenerating or fine-tuning bindings → "Fixing and Fine-tuning the bindings". Never hand-edit `*_ffi.rs` files; always change `DirBindingsConf` and rerun `scripts/generate_bindings.sh`.
- Adding modules → also update `<crate>/tests/link_smoke.rs` per "Link Smoke Tests".
- Bindings-generation errors → check "Fixing common issues when generating bindings" before diverging.
## Linker Library Check
After adding or updating a module, confirm the module has a `#[link(name = "...")]` stanza matching the header
file’s `@library` annotation (strip the `lib` prefix and `.so` suffix). This should live in the module file
next to the `mod ..._ffi;` re-export.
## Environment Setup Tip
When running SDK-dependent scripts or tests locally, load OpenHarmony variables from `.envrc`:
`source .envrc`