ENSUREOK
← 返回 Blog
E1 · repository testsSource ↗

This article belongs to the repository-tested set. The related public retrieval artifact is Single-threshold versus three-region retrieval; it remains a fixture-level result, not a production benchmark.

Go Builder's Guide: Add Local Memory Without Choosing a Framework

If your agent stack is already written in Go—or merely needs a portable local binarythe smallest integration surface is a process plus files. Semantix builds as one binary and uses JSONL and a local database rather than requiring a framework SDK.

Build and inspect

go build -o semantix ./cmd/semantix
go vet ./...
go test ./...

The code uses Go interfaces for extractors, stores, indexes, embedders, and verification. The default hash embedder and in-memory vector index have no external runtime service. This keeps the first trial reproducible.

Integrate through contracts

Emit session JSONL with role, content, and tool_calls. Call extraction at a session boundary. Query before a new task and insert the returned marked block into a controlled prompt location.

semantix extract --input session.jsonl --db .semantix/project.db --project demo
semantix search --query "fix the failing Go test" --db .semantix/project.db --retriever hybrid
semantix inject --query "fix the failing Go test" --db .semantix/project.db
semantix verify --session ./sessions --project demo > eval.tsv

Use exit codes and stderr as part of the contract. Treat a retrieval failure as an optimization miss, not a reason to stop the agent.

Tradeoffs

A CLI boundary is framework-neutral and easy to replace. It also adds process startup, file lifecycle, and schema-version responsibilities. The built-in vectors are deterministic and local, not a substitute for a trained embedding model when deeper semantic discrimination is required.

Evidence status

The repository builds and tests these paths and publishes six v0.2.0 platform artifacts in its quickstart. Compatibility with every Go agent framework is not demonstrated. The accurate claim is that integration is framework-agnostic at the file/CLI boundary.

Reproduced package evidence

For this article I tested the smallest stack implied by the integration boundary on 2026-08-12, main e93668e, Go 1.26.5, Windows/amd64:

go test -count=1 ./kernel/event ./kernel/ingest ./kernel/bm25 ./kernel/inject

Observed result:

ok  semantix/kernel/event
ok  semantix/kernel/ingest
ok  semantix/kernel/bm25
ok  semantix/kernel/inject

I consider this evidence for a local Go pipeline, not for universal framework compatibility. The test does not launch LangChain, ADK, Eino, or a production harness. A convincing portability result would implement two independent adapters and publish the event mappings, error behavior, latency, and rollback procedure for both.

Sources and limitations