Files
sirmem/AGENTS.md
T
SirStone 0fdcce7bf8
ci / test (push) Failing after 3m39s
ci / release (push) Skipped
feat: sirmem v0.1.0 knowledge-graph memory CLI
2026-11-22 16:10:32 +01:00

1.5 KiB

sirmem

Nim CLI (stdlib only, no nimble deps) for a file-based knowledge-graph memory.

Tooling: devbox

All tooling comes from devbox (nim, zig, git). Use devbox shell or devbox run <script>. Fixing devbox.json / devbox.lock or running devbox update needs no permission.

Layout

  • src/sirmem/core.nim: all logic; every command is a cmdXxx proc returning its output, dispatch routes args.
  • src/sirmem.nim: thin main (--dir/SIRMEM_DIR, exit codes, stderr).
  • tests/test_all.nim: std/unittest; the CLI suite runs bin/sirmem, so build first.
  • scripts/build.sh, scripts/zigcc: cross-compile with zig cc.
  • .gitea/workflows/release.yml: CI (test on push, release on v* tag).

Build / test

  • devbox run build -> bin/sirmem
  • devbox run test (builds the binary, then runs the tests)

Cross-compile (zig cc)

scripts/build.sh <nim-os> <nim-cpu> <zig-target> <out>, or devbox run cross-all -> dist/. Targets: linux amd64 x86_64-linux-musl, linux arm64 aarch64-linux-musl, macosx arm64 aarch64-macos, windows amd64 x86_64-windows-gnu. Known zig 0.16 quirks (documented in build.sh): do not use --opt:size; linux-musl needs -d:useMalloc; linux arm64 needs --tlsEmulation:on and links flakily, so the script retries.

Conventions

  • Errors: raise SirmemError (via fail); main prints sirmem: error: ..., exit 1. Warnings go to Store.warnings (stderr).
  • Relations are always rewritten through saveRels (sorted, unique, atomic).