This file defines the default working protocol for coding agents in this repository. Scope: entire repository.
nullTickets is a headless task tracker for autonomous AI agents:
- one Zig binary
- one SQLite database file
- REST API over HTTP
Primary modules:
src/main.zig- process args, TCP accept loop, request/response lifecyclesrc/api.zig- routing + HTTP handlers + JSON contractssrc/store.zig- SQLite access, transactions, migrations, ownership/free helperssrc/domain.zig- pipeline FSM parse/validation/transition logicsrc/ids.zig- UUID/token/hash/time helperssrc/config.zig- config loading and resolutionsrc/export_manifest.zig- nullhub manifest exportsrc/from_json.zig- JSON config bootstrapsrc/migrations/001_init.sql- schemasrc/migrations/003_store.sql- KV store tablesrc/migrations/004_store_fts.sql- FTS5 search index
Baseline commands:
zig build
zig build test
bash tests/test_e2e.sh- Keep boundaries strict.
apiorchestrates HTTP behavior only.storeowns SQL and DB transactions.domainowns FSM validation and transition rules.
- Keep ownership explicit.
- Anything allocated by
Storeand returned to callers must be explicitly released by matchingfree*helpers. std.json.parseFromSliceresults must be paired withparsed.deinit()unless allocator lifetime intentionally matches request scope.
- Preserve API behavior.
- Existing endpoint paths/status semantics are contract-level behavior.
- If behavior changes, update tests/docs in the same patch.
- Prefer explicit SQL/flow over abstraction layers.
- Keep handler logic straightforward and debuggable.
- No speculative flags/config knobs.
- No new subsystem unless there is a concrete caller.
- Avoid premature helper extraction.
- Extract only after repeated stable patterns appear.
- Return explicit HTTP errors for invalid input/auth/state.
- Do not silently skip security checks.
- Tests must be reproducible and isolated.
- No external network dependencies in test flows.
- Zig baseline:
0.16.0. - Use
std.ArrayListUnmanaged(...)=.emptycorrectly with allocator on each call. - Do not rely on allocator leaks for correctness.
- Use
SQLITE_STATIC(null) for sqlite text/blob binds in this codebase. - Multi-step state mutations (
claim,transition,fail) must remain transactionally safe. - Keep schema changes additive and migration-based.
- Do not build JSON with unescaped user strings.
- Use
std.json.Stringifyhelpers for string quoting/serialization. - Keep raw JSON fields (
definition,metadata,usage,meta) valid JSON objects.
- Low: docs, comments, formatting-only changes.
- Medium: most handler/query behavior changes.
- High: auth/lease token validation, state transition logic, transaction boundaries, schema migration.
When unsure, treat the change as High risk.
- Read relevant module(s) and adjacent tests before editing.
- Keep patch scope focused (one concern per change).
- Implement smallest viable change.
- Validate with:
zig build
zig build test
bash tests/test_e2e.sh- Document what changed, what did not, and remaining risks.
- Do not bypass free helpers for
Store-owned return values. - Do not return unescaped strings inside JSON payloads.
- Do not weaken lease/token checks.
- Do not mix unrelated refactors into behavior/security patches.
- Do not use destructive git commands.
When handing off work, include:
- What changed
- What did not change
- Validation run and results
- Remaining risks/unknowns
- Next recommended action