# Agent instructions for working on Jig ## Design goals Always keep the following design goals and principles in mind when evaluating tradeoffs and decisions. 1. Performance and small resource footprint Jig should consume as few system resources as possible. Avoid unnecessary memory allocations, optimize CPU bound sections, avoid doing work at runtime when it can be done at compile time. 2. Cross platform Use conditional compilation with `comptime` to create generic cross platform interfaces. Use cross platform `std` APIs instead of `std.c` or `std.posix` wherever possible. 3. Extensible Jig has a small core that can be extended with Lua scripts. The core and UI communicate over a channel so that the core can run headless. The core sends UI events to attached UIs and the UI is responsible for rendering. ## Behavior Write tests that test behavior and interfaces. Write tests first based on the requirements or specification, then prove that the test fails before writing the implementation. Keep comments spare. Comments should never describe or narrate what code is doing, they should exist only to explain "why" when non-obvious. When you DO write comments, keep them BRIEF, FOCUSED, and free of jargon. Doc comments are comments on public interfaces (functions, APIs, types, etc). Doc comments must describe BEHAVIOR and INTERFACES only, NOT implementation details. Use generic examples (if at all) in doc comments, do not couple doc comments to the implementation. ## Zig Use Zig cross platform APIs and avoid `std.posix` and `std.c`. Use `std.Io`. Use comptime to do computation at compile time when possible.