AI Package Boundary (src/ai/)
Applies to: zmodu v0.20.1+ · Gate: src/test/AiBoundary.zig
src/ai/ is an optional subsystem (~12k lines) designed so it can be extracted into a standalone package. src/test/AiBoundary.zig enforces two directional import rules on every zig build test run:
- Core never imports
src/ai/: No file undersrc/{core,api,data,sqlx,http,security,messaging,runtime}may@importany file insrc/ai/. The single top-level re-export insrc/root.zigis the only entry point. src/ai/only imports domain seams: Files insidesrc/ai/may only import approved domain barrels and seams:data.zig(neversqlx/sqlx.zigorpersistence/backends/**directly; both baselines are frozen at0)http.zigandhttp/Sse.zigruntime.zig(used bysrc/ai/agent_worker.zigto run anAgentas a runtime worker)core/,messaging/,scheduler/,resilience/,tracing/,redis/,api/,security/,test/
// Disallowed in src/ai/:
// const sqlx = @import("../sqlx/sqlx.zig");
// Required: import through the domain barrel
const data = @import("../data.zig");
Any new import outside the allowlist in src/test/AiBoundary.zig fails the test suite with error.AiBoundaryViolation.