Contributing
Human uses a vtable-driven architecture. New features are added by implementing vtables and registering them in factory code.
Vtable interface pattern
Section titled “Vtable interface pattern”- Define a vtable struct (function pointers)
- Implement the vtable with concrete functions
- Create a “context” struct holding state
- Register in the appropriate factory
Callers receive a struct { void *ctx; const vtable_t *vtable }. The caller does not own the vtable; it is typically static. The caller must own the context (or a wrapper that owns it) — never return a pointer to a temporary.
Adding a provider
Section titled “Adding a provider”- Create
src/providers/<name>.c - Implement
hu_provider_tvtable:chat,supports_native_tools,get_name,deinit - Add
hu_<name>_createfactory function - Register in
src/providers/factory.c(name check + create call) - Add tests for vtable wiring and error paths
- Document in
providers/docs
Adding a channel
Section titled “Adding a channel”- Create
src/channels/<name>.c - Implement
hu_channel_tvtable:start,stop,send,name,health_check - Add create function with config (token, allowlist, etc.)
- Add CMake option
HU_ENABLE_<CHANNEL> - Wire in channel manager / daemon
- Add webhook path in gateway if needed
- Document in
channels/docs
Adding a tool
Section titled “Adding a tool”- Create
src/tools/<name>.c - Implement
hu_tool_tvtable:execute,name,description,parameters_json,deinit - Validate and sanitize all inputs; return
hu_tool_result_t - Add
HU_IS_TESTguard if the tool spawns processes or opens URLs - Register in
src/tools/factory.c - Document in
tools/overview.mdx
Adding a memory backend
Section titled “Adding a memory backend”- Create
src/memory/<name>.c - Implement
hu_memory_tvtable - Add CMake option and factory registration
- Document in
memory/overview.mdx
Adding a peripheral
Section titled “Adding a peripheral”- Create
src/peripherals/<name>.c - Implement
hu_peripheral_tvtable:name,board_type,health_check,read,write,flash,capabilities,destroy - Register in peripheral factory
- Document in
peripherals/overview.mdx
Testing requirements
Section titled “Testing requirements”- 3,185+ tests must pass
- Zero ASan errors — AddressSanitizer enabled in dev builds
- Use
HU_IS_TESTto skip side effects (network, spawning, real hardware) - Tests must be deterministic; no flaky behavior
- Run:
cmake --build build && ./build/human_tests
Code style
Section titled “Code style”- Identifiers:
snake_case(functions, variables, fields) - Types:
hu_<name>_t(e.g.hu_provider_t,hu_channel_t) - Constants/macros:
HU_SCREAMING_SNAKE_CASE - Public functions:
hu_<module>_<action> - Factory keys: lowercase, stable (e.g.
"openai","telegram")
Validation before commit
Section titled “Validation before commit”cd buildcmake --build . -j$(nproc)./human_testsFor release builds:
cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel -DHU_ENABLE_LTO=ONcmake --build .Git hooks
Section titled “Git hooks”Activate pre-configured hooks:
git config core.hooksPath .githooks- pre-commit: Format checks
- pre-push: Build and run tests
Bypass in emergency: git commit --no-verify / git push --no-verify.