Repository navigation
gemma example: local agent loop with Gemma over Ollama, vector recall, and the verification barrier - #519
Merged
Conversation
…r recall, and the verification barrier
gerardrecinto
enabled auto-merge (squash)
October 8, 2026 20:54
Gemini PR ReviewReviewed commit:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/gemma_ollama: a local agent loop with Gemma (gemma3:4b) andembeddinggemmathrough Ollama, and Joltrin embedded in the same Go process. No remote database, no network hop beyond localhost Ollama.ai/vector), enforces ordering (verify.Workflow), and commits state (database.Databasetransactions).human_approve. Only the application calls it, so a model cannot approve its own work.Flow
flowchart LR A[App] --> G[Gemma via Ollama] G --> S[App schema check] S -->|valid| B[verify barrier<br/>CheckSafety] S -->|invalid| G B -->|allowed| T[ACID commit<br/>vector store + storage] B -->|violation| GWhat the demo does
publish_notecommits.Commit order: the read-only
CheckSafetyruns first, before any embedding or transaction work. The data commit comes next, thenCheckAndCommitIdempotentrecords the step. A crash between the last two leaves a row with no trace entry, which fails closed: later steps stay blocked until the step is recorded again.Testing
Offline (scripted Ollama server, real vector store and barrier), also run in CI by the new
gemma-exampleworkflow:go test ./examples/gemma_ollama -race -count=1passes.CheckSafetycall makesTestBarrierBlocksPublishUntilHumanApprovesandTestDemoWithScriptedModelfail.Live, against local Ollama with
gemma3:4bandembeddinggemma(Apple laptop,JOLTRIN_OLLAMA_LIVE=1 go test ./examples/gemma_ollama -run TestLiveGemma -v), 3 runs, 3 passes, about 11 seconds each:The live test is skipped unless
JOLTRIN_OLLAMA_LIVE=1, so CI does not need a model.Tips
num_ctx: 4096and 2 to 4 retrieved chunks.embeddinggemmais 768 dims, which matchesOllamaEmbedder.Dim()(hardcoded to 768).Thanks,
Gerard Recinto