api-uses-lazy-imports

IN premise

Heavy modules (`derive`, `compact`, `export_markdown`, `check_stale`, `import_beliefs`, `import_agent`) are imported inside function bodies in `api.py`, not at module level, to keep the module fast to import for callers that only need a subset of operations.

Summary

The API module deliberately delays loading its heaviest dependencies until they are actually needed, rather than pulling everything in up front. This means tools or scripts that only use a few operations from the API stay fast to start up, avoiding the cost of initializing code paths they never call.

Dependents

These beliefs depend on this one:

Details

Sourceentries/2026/04/24/reasons_lib-api.md