@gmickel/gno 1.18.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +14 -7
  2. package/assets/skill/SKILL.md +54 -12
  3. package/assets/skill/mcp-reference.md +7 -2
  4. package/assets/skill/recipes/citation-and-provenance.md +32 -9
  5. package/package.json +2 -1
  6. package/spec/AGENTS.md +83 -0
  7. package/spec/CLAUDE.md +83 -0
  8. package/spec/bench-fixture.schema.json +137 -0
  9. package/spec/cli.md +2919 -0
  10. package/spec/db/schema.sql +442 -0
  11. package/spec/evals-agentic.md +592 -0
  12. package/spec/evals.md +1106 -0
  13. package/spec/mcp.md +2279 -0
  14. package/spec/output-schemas/activation-verification.schema.json +515 -0
  15. package/spec/output-schemas/ask.schema.json +564 -0
  16. package/spec/output-schemas/backlinks.schema.json +131 -0
  17. package/spec/output-schemas/bench-result.schema.json +120 -0
  18. package/spec/output-schemas/capture-receipt.schema.json +143 -0
  19. package/spec/output-schemas/claim-verification.schema.json +291 -0
  20. package/spec/output-schemas/collection-list.schema.json +45 -0
  21. package/spec/output-schemas/context-capsule-v1.schema.json +726 -0
  22. package/spec/output-schemas/context-capsule-verification.schema.json +1338 -0
  23. package/spec/output-schemas/context-list.schema.json +21 -0
  24. package/spec/output-schemas/doctor.schema.json +313 -0
  25. package/spec/output-schemas/error.schema.json +30 -0
  26. package/spec/output-schemas/expansion.schema.json +37 -0
  27. package/spec/output-schemas/get.schema.json +140 -0
  28. package/spec/output-schemas/graph-query.schema.json +99 -0
  29. package/spec/output-schemas/graph.schema.json +371 -0
  30. package/spec/output-schemas/links-list.schema.json +186 -0
  31. package/spec/output-schemas/mcp-add-collection-result.schema.json +23 -0
  32. package/spec/output-schemas/mcp-capture-result.schema.json +152 -0
  33. package/spec/output-schemas/mcp-http-error.schema.json +30 -0
  34. package/spec/output-schemas/mcp-job-list.schema.json +58 -0
  35. package/spec/output-schemas/mcp-job-status.schema.json +224 -0
  36. package/spec/output-schemas/mcp-remove-result.schema.json +39 -0
  37. package/spec/output-schemas/mcp-sync-result.schema.json +41 -0
  38. package/spec/output-schemas/mcp-tag-result.schema.json +33 -0
  39. package/spec/output-schemas/models-list.schema.json +93 -0
  40. package/spec/output-schemas/multi-get.schema.json +103 -0
  41. package/spec/output-schemas/process-status.schema.json +119 -0
  42. package/spec/output-schemas/query-diagnose.schema.json +123 -0
  43. package/spec/output-schemas/resident-status.schema.json +154 -0
  44. package/spec/output-schemas/retrieval-trace-common.schema.json +492 -0
  45. package/spec/output-schemas/retrieval-trace-delete.schema.json +16 -0
  46. package/spec/output-schemas/retrieval-trace-export.schema.json +61 -0
  47. package/spec/output-schemas/retrieval-trace-filters.schema.json +139 -0
  48. package/spec/output-schemas/retrieval-trace-judgment.schema.json +15 -0
  49. package/spec/output-schemas/retrieval-trace-list.schema.json +18 -0
  50. package/spec/output-schemas/retrieval-trace-payloads.schema.json +178 -0
  51. package/spec/output-schemas/retrieval-trace-purge.schema.json +31 -0
  52. package/spec/output-schemas/retrieval-trace-qrels.schema.json +303 -0
  53. package/spec/output-schemas/retrieval-trace-replay.schema.json +286 -0
  54. package/spec/output-schemas/retrieval-trace-show.schema.json +69 -0
  55. package/spec/output-schemas/retrieval-trace-summary.schema.json +65 -0
  56. package/spec/output-schemas/search-result.schema.json +154 -0
  57. package/spec/output-schemas/search-results.schema.json +338 -0
  58. package/spec/output-schemas/similar.schema.json +84 -0
  59. package/spec/output-schemas/status.schema.json +676 -0
  60. package/spec/output-schemas/tags-list.schema.json +48 -0
  61. package/src/app/context-runtime-contract.ts +10 -5
  62. package/src/app/context-runtime-input.ts +29 -1
  63. package/src/app/context-runtime-types.ts +7 -0
  64. package/src/app/context-runtime.ts +20 -2
  65. package/src/app/context-surface.ts +4 -0
  66. package/src/app/verified-ask.ts +291 -0
  67. package/src/cli/commands/ask-format.ts +255 -0
  68. package/src/cli/commands/ask.ts +144 -183
  69. package/src/cli/commands/context-build.ts +56 -9
  70. package/src/cli/commands/get.ts +64 -3
  71. package/src/cli/commands/query.ts +62 -23
  72. package/src/cli/commands/replay.ts +140 -0
  73. package/src/cli/commands/search.ts +48 -3
  74. package/src/cli/commands/shared.ts +3 -1
  75. package/src/cli/commands/trace.ts +200 -0
  76. package/src/cli/commands/vsearch.ts +75 -53
  77. package/src/cli/program.ts +287 -1
  78. package/src/config/index.ts +9 -0
  79. package/src/config/retrieval-traces.ts +56 -0
  80. package/src/config/types.ts +4 -0
  81. package/src/core/context-budget.ts +6 -0
  82. package/src/core/context-capsule-retrieval-schema.ts +4 -0
  83. package/src/core/context-capsule-schema.ts +17 -0
  84. package/src/core/context-capsule-validation.ts +3 -2
  85. package/src/core/context-capsule.ts +18 -0
  86. package/src/core/context-compiler.ts +44 -25
  87. package/src/core/context-evidence.ts +6 -0
  88. package/src/core/retrieval-qrels.ts +405 -0
  89. package/src/core/retrieval-replay-candidate.ts +368 -0
  90. package/src/core/retrieval-replay-types.ts +109 -0
  91. package/src/core/retrieval-replay-validation.ts +89 -0
  92. package/src/core/retrieval-replay.ts +441 -0
  93. package/src/core/retrieval-trace-evidence-origin.ts +178 -0
  94. package/src/core/retrieval-trace-export.ts +113 -0
  95. package/src/core/retrieval-trace-filter-normalization.ts +27 -0
  96. package/src/core/retrieval-trace-filters.ts +19 -0
  97. package/src/core/retrieval-trace-management-helpers.ts +247 -0
  98. package/src/core/retrieval-trace-management-types.ts +132 -0
  99. package/src/core/retrieval-trace-management.ts +422 -0
  100. package/src/core/retrieval-trace-request.ts +141 -0
  101. package/src/core/retrieval-trace-session.ts +507 -0
  102. package/src/core/retrieval-trace.ts +472 -0
  103. package/src/llm/errors.ts +10 -1
  104. package/src/llm/httpGeneration.ts +11 -1
  105. package/src/llm/nodeLlamaCpp/generation.ts +54 -10
  106. package/src/llm/types.ts +6 -0
  107. package/src/mcp/tools/ask.ts +228 -0
  108. package/src/mcp/tools/context.ts +87 -15
  109. package/src/mcp/tools/get.ts +35 -1
  110. package/src/mcp/tools/index.ts +83 -0
  111. package/src/mcp/tools/query.ts +95 -64
  112. package/src/mcp/tools/search.ts +36 -13
  113. package/src/mcp/tools/trace.ts +143 -0
  114. package/src/mcp/tools/vsearch.ts +71 -38
  115. package/src/pipeline/answer.ts +167 -26
  116. package/src/pipeline/claim-verification-schema.ts +235 -0
  117. package/src/pipeline/claim-verification.ts +487 -0
  118. package/src/pipeline/claim-verifier.ts +474 -0
  119. package/src/pipeline/graph-retrieval.ts +15 -1
  120. package/src/pipeline/hybrid.ts +151 -43
  121. package/src/pipeline/search.ts +36 -3
  122. package/src/pipeline/trace-metadata.ts +47 -0
  123. package/src/pipeline/types.ts +68 -0
  124. package/src/pipeline/vsearch.ts +101 -38
  125. package/src/sdk/client.ts +415 -73
  126. package/src/sdk/documents.ts +48 -1
  127. package/src/sdk/index.ts +17 -0
  128. package/src/sdk/types.ts +28 -0
  129. package/src/serve/context-capsule.ts +67 -8
  130. package/src/serve/public/app.tsx +12 -1
  131. package/src/serve/public/components/AskVerificationPanel.tsx +189 -0
  132. package/src/serve/public/globals.built.css +1 -1
  133. package/src/serve/public/lib/workspace-tabs.ts +2 -0
  134. package/src/serve/public/pages/Ask.tsx +42 -4
  135. package/src/serve/public/pages/Dashboard.tsx +10 -0
  136. package/src/serve/public/pages/TraceHistory.tsx +478 -0
  137. package/src/serve/public/pages/trace-history-detail.tsx +224 -0
  138. package/src/serve/retrieval-trace.ts +28 -0
  139. package/src/serve/routes/api.ts +508 -68
  140. package/src/serve/routes/traces.ts +156 -0
  141. package/src/serve/server.ts +87 -2
  142. package/src/store/index.ts +31 -0
  143. package/src/store/migrations/014-retrieval-traces.ts +303 -0
  144. package/src/store/migrations/index.ts +2 -0
  145. package/src/store/retrieval-trace-codec.ts +384 -0
  146. package/src/store/sqlite/adapter.ts +153 -1
  147. package/src/store/sqlite/retrieval-trace-management-store.ts +341 -0
  148. package/src/store/sqlite/retrieval-trace-retention.ts +349 -0
  149. package/src/store/sqlite/retrieval-trace-rows.ts +267 -0
  150. package/src/store/sqlite/retrieval-trace-store.ts +515 -0
  151. package/src/store/types.ts +297 -0
  152. package/src/store/vector/sqlite-vec.ts +76 -1
  153. package/src/store/vector/types.ts +1 -1
package/README.md CHANGED
@@ -94,7 +94,7 @@ gno daemon --detach # headless continuous indexing (background; --status / --st
94
94
 
95
95
  <!-- public-truth:current-version -->
96
96
 
97
- > Current release: **v1.17.0** — see [CHANGELOG.md](./CHANGELOG.md)
97
+ > Current release: **v1.19.0** — see [CHANGELOG.md](./CHANGELOG.md)
98
98
 
99
99
  <!-- /public-truth -->
100
100
 
@@ -553,9 +553,9 @@ Connect GNO to Claude Desktop, Cursor, Raycast, and more:
553
553
 
554
554
  ![GNO MCP](./assets/screenshots/mcp.jpg)
555
555
 
556
- GNO exposes 19 tools by default via [Model Context Protocol](https://modelcontextprotocol.io),
556
+ GNO exposes 22 tools by default via [Model Context Protocol](https://modelcontextprotocol.io),
557
557
  including the core retrieval tools below. Starting MCP with `--enable-write`
558
- adds 11 opt-in mutation tools, for 30 total.
558
+ adds 15 opt-in mutation tools, for 37 total.
559
559
 
560
560
  | Tool | Description |
561
561
  | :------------------- | :------------------------------------ |
@@ -564,6 +564,7 @@ adds 11 opt-in mutation tools, for 30 total.
564
564
  | `gno_query` | Hybrid search (recommended) |
565
565
  | `gno_context` | Budgeted exact evidence Capsule |
566
566
  | `gno_context_verify` | Verify saved Capsule provenance |
567
+ | `gno_ask` | Opt-in closed-Capsule verified answer |
567
568
  | `gno_get` | Retrieve document by ID |
568
569
  | `gno_multi_get` | Batch document retrieval |
569
570
  | `gno_links` | Get outgoing links from document |
@@ -571,10 +572,16 @@ adds 11 opt-in mutation tools, for 30 total.
571
572
  | `gno_similar` | Find semantically similar documents |
572
573
  | `gno_graph` | Get knowledge graph (nodes and edges) |
573
574
  | `gno_status` | Index health check |
575
+ | `gno_trace_list` | List private local retrieval receipts |
576
+ | `gno_trace_show` | Inspect one bounded trace receipt |
574
577
 
575
- **Design**: Default MCP mode is read-only: retrieval, graph, status, and job
576
- inspection. Your AI assistant synthesizes answers from retrieved context. Write
577
- tools are available only through the explicit `--enable-write` opt-in.
578
+ **Design**: Default MCP mode is read-only: retrieval, opt-in verified synthesis,
579
+ graph, status, and job inspection. Raw retrieval tools leave synthesis to your
580
+ AI assistant. `gno_ask` runs only when the caller sends literal `verify: true`;
581
+ it verifies claims against one closed Capsule and abstains unless every
582
+ substantive claim is supported. That classification is not a general factual
583
+ guarantee beyond the retained evidence. Write tools remain available only
584
+ through the explicit `--enable-write` opt-in.
578
585
 
579
586
  `gno serve` and `gno daemon` also expose this surface as stateful Streamable
580
587
  HTTP at `http://127.0.0.1:3000/mcp`. HTTP stays read-only by default.
@@ -843,7 +850,7 @@ graph TD
843
850
  | **Local LLM** | AI answers via llama.cpp, no API keys |
844
851
  | **Remote Inference** | Optional HTTP endpoints for embedding, reranking, expansion, and generation |
845
852
  | **Privacy First** | Local by default; no telemetry; network use is explicit or model provisioning |
846
- | **MCP Server** | 10 automatic client targets; 19 read-only tools, 30 with writes enabled |
853
+ | **MCP Server** | 10 automatic client targets; 22 read-only tools, 37 with writes enabled |
847
854
  | **Collections** | Organize sources with patterns, excludes, contexts |
848
855
  | **Tag Filtering** | Frontmatter tags with hierarchical paths, filter via `--tags-any`/`--tags-all` |
849
856
  | **Note Linking** | Wiki links, backlinks, related notes, cross-collection navigation |
@@ -71,6 +71,7 @@ Recipe rules:
71
71
  | **Index** | `init`, `collection add/list/remove`, `index`, `update`, `embed` | Set up and maintain document index |
72
72
  | **Tags** | `tags`, `tags add`, `tags rm` | Organize and filter documents |
73
73
  | **Context** | `context add/list/rm/check/build/verify` | Configure guidance or compile/verify evidence Capsules |
74
+ | **Traces** | `trace list/show/label/export/replay/delete/purge` | Manage and replay private retrieval receipts |
74
75
  | **Models** | `models list/use/pull/clear/path` | Manage local AI models |
75
76
  | **Serve** | `serve`, `daemon` | One resident Web/headless gateway and watcher |
76
77
  | **Publish** | `publish export` | Export gno.sh publish artifacts |
@@ -80,14 +81,15 @@ Recipe rules:
80
81
 
81
82
  ## Search Modes
82
83
 
83
- | Command | Speed | Best For |
84
- | ---------------------- | ------- | ---------------------------------- |
85
- | `gno search` | instant | Exact keyword matching |
86
- | `gno vsearch` | ~0.5s | Finding similar concepts |
87
- | `gno query --fast` | ~0.7s | Quick lookups |
88
- | `gno query` | ~2-3s | Balanced (default) |
89
- | `gno query --thorough` | ~5-8s | Best recall, complex queries |
90
- | `gno ask --answer` | ~3-5s | AI-generated answer with citations |
84
+ | Command | Speed | Best For |
85
+ | ---------------------- | ------- | ----------------------------------- |
86
+ | `gno search` | instant | Exact keyword matching |
87
+ | `gno vsearch` | ~0.5s | Finding similar concepts |
88
+ | `gno query --fast` | ~0.7s | Quick lookups |
89
+ | `gno query` | ~2-3s | Balanced (default) |
90
+ | `gno query --thorough` | ~5-8s | Best recall, complex queries |
91
+ | `gno ask --answer` | ~3-5s | AI-generated answer with citations |
92
+ | `gno ask --verify` | varies | Closed-Capsule answer or abstention |
91
93
 
92
94
  **Retry strategy**: Use default first. If no results: rephrase query, then try `--thorough`.
93
95
 
@@ -168,6 +170,37 @@ When the user wants a synthesized answer instead of ranked evidence:
168
170
  gno ask "What changed in the deployment process?" --answer
169
171
  ```
170
172
 
173
+ When the answer must be checked against one closed evidence set:
174
+
175
+ ```bash
176
+ gno ask "Who owns the launch decision?" --verify --show-sources
177
+ ```
178
+
179
+ Verified Ask classifies each substantive claim against exact retained Capsule
180
+ spans and abstains below 100% support. It fails closed when semantic
181
+ verification is unavailable, incapable, failed, or malformed. Treat it as a
182
+ closed-Capsule support classification, not proof that the corpus is complete or
183
+ the underlying sources are true. Plain Ask, `--no-answer`, and `--answer`
184
+ remain available.
185
+
186
+ Trace recording is local and off by default. `metadata` mode is diagnostic-only
187
+ and omits raw query/goal/filter values; `replay` is separate explicit consent
188
+ to retain those bounded inputs under configured local retention limits. No
189
+ receipt is uploaded automatically, and disabling capture does not disable
190
+ inspection or deletion of existing receipts.
191
+
192
+ For an explicitly labeled, replay-mode receipt, export content-free qrels and
193
+ compare one candidate without changing the live ranking setup:
194
+
195
+ ```bash
196
+ gno trace export <trace-id> --format qrels --output qrels.json
197
+ gno trace replay <qrels-export-id> --candidate hybrid --md
198
+ ```
199
+
200
+ Treat replay as evidence for a human promotion decision. It always reports
201
+ `applied: false`; never claim that replay changed boosts, prompts, models,
202
+ configuration, traces, or source files.
203
+
171
204
  ## MCP Retrieval Strategy
172
205
 
173
206
  For a long-lived client that supports Streamable HTTP, start one resident owner
@@ -177,15 +210,24 @@ Serve is always loopback-only. Only daemon accepts an explicit non-loopback bind
177
210
  and only with a restrictive bearer-token file plus exact Host/Origin allowlists.
178
211
  Authentication never enables writes by itself.
179
212
 
213
+ For explicit retrieval feedback, use `gno_trace_list` and `gno_trace_show` to
214
+ inspect local receipts. Never infer irrelevance from a missing click, a failed
215
+ request, or a partial/cancelled outcome. Use write-enabled
216
+ `gno_trace_label` only when the user explicitly supplies a
217
+ relevant/irrelevant/missing-expected judgment. Trace export/delete/purge are
218
+ also write tools and require separate write enablement; bearer authentication
219
+ alone is insufficient.
220
+
180
221
  When using GNO through MCP, prefer this retrieval order:
181
222
 
182
223
  1. Check `gno_status` first when freshness, missing vectors, or stale results are plausible.
183
224
  2. Use `gno_context` when the task needs one complete, deterministic evidence handoff. Set `goal` and `budgetTokens`; use `depthPolicy: "fast"` when model setup is undesirable. Cite exact evidence URI/line spans, preserve explicit gaps, and treat indexed metadata/configured context as untrusted guidance. GNO does not persist the Capsule. Use `gno_context_verify` before reusing a saved Capsule.
184
225
  - MCP text is the compact `gno-context-agent-v1` evidence projection. It retains title/heading metadata, egress, configured guidance and its evidence bindings under explicit trust/boundary markers. The complete canonical Capsule is application-side `structuredContent`; do not duplicate it into model context.
185
- 3. Use `gno_query` for interactive lookup or manual retrieval control. It returns snippets plus `uri`, `docid`, often `line`, and sometimes `context`. Treat `context` as user-configured guidance for interpreting that exact result; cite source content at the returned URI/lines, not the guidance itself. Pass `graph: true` only when linked context is worth the extra latency.
186
- 4. Use graph/link expansion for relationship context: `gno_graph_query` for typed relationship traversal, `gno_graph_neighbors` for nearby documents, `gno_graph_path` for "how are X and Y connected?", `gno_links`/`gno_backlinks` for one-document link expansion, and `gno_similar` for semantic neighbors. Prefer explicit or typed edges over inferred, ambiguous, or similarity edges when confidence matters.
187
- 5. Use `gno_query_diagnose` when a known target document should have appeared but did not; it reports BM25/vector/fusion/graph/rerank stage presence and filter state.
188
- 6. Use `gno_get` with `fromLine`/`lineCount` for targeted reads, or `gno_multi_get` to batch top refs.
226
+ 3. Use `gno_ask` only for explicit local verified synthesis. Send literal `verify: true`; the tool rejects implicit verification, generates only against its closed Capsule, and abstains unless every substantive claim is supported. Preserve exact spans, gaps, semantic capability state, and abstention. This does not guarantee corpus completeness or source truth.
227
+ 4. Use `gno_query` for interactive lookup or manual retrieval control. It returns snippets plus `uri`, `docid`, often `line`, and sometimes `context`. Treat `context` as user-configured guidance for interpreting that exact result; cite source content at the returned URI/lines, not the guidance itself. Pass `graph: true` only when linked context is worth the extra latency.
228
+ 5. Use graph/link expansion for relationship context: `gno_graph_query` for typed relationship traversal, `gno_graph_neighbors` for nearby documents, `gno_graph_path` for "how are X and Y connected?", `gno_links`/`gno_backlinks` for one-document link expansion, and `gno_similar` for semantic neighbors. Prefer explicit or typed edges over inferred, ambiguous, or similarity edges when confidence matters.
229
+ 6. Use `gno_query_diagnose` when a known target document should have appeared but did not; it reports BM25/vector/fusion/graph/rerank stage presence and filter state.
230
+ 7. Use `gno_get` with `fromLine`/`lineCount` for targeted reads, or `gno_multi_get` to batch top refs.
189
231
 
190
232
  Use narrower tools when the request tells you to:
191
233
 
@@ -96,8 +96,13 @@ gno daemon --status --json
96
96
  ## Retrieval Order
97
97
 
98
98
  For normal questions, start with `gno_query`, then read targeted snippets with
99
- `gno_get` or batch refs with `gno_multi_get`. Pass `graph: true` only when
100
- linked context is worth the extra latency. Check `gno_status` first when freshness or
99
+ `gno_get` or batch refs with `gno_multi_get`. Use `gno_context` for one bounded,
100
+ exact evidence handoff. Use `gno_ask` only when a local closed-evidence answer
101
+ is specifically useful, and pass the literal boolean `verify: true`; it
102
+ abstains unless every substantive claim is supported. This is a support
103
+ classification against the retained Capsule, not a guarantee that the corpus
104
+ is complete or its sources are true. Pass `graph: true` only when linked context
105
+ is worth the extra latency. Check `gno_status` first when freshness or
101
106
  embeddings may be stale. Use `gno_query_diagnose` when a known target document
102
107
  should have appeared but did not.
103
108
 
@@ -10,30 +10,46 @@ Use this recipe when accuracy, traceability, or auditability matters.
10
10
 
11
11
  ## Workflow
12
12
 
13
- 1. Search for evidence, then retrieve exact passages.
13
+ 1. Choose the verification contract.
14
+
15
+ For an explicit local answer checked against one closed evidence set:
16
+
17
+ ```bash
18
+ gno ask "<question>" --verify --show-sources
19
+ ```
20
+
21
+ Through MCP, call `gno_ask` with the literal boolean `verify: true`. The tool
22
+ rejects implicit verification. It returns a closed Capsule, freshness receipt,
23
+ four-state claim verdicts, exact evidence IDs/line spans, gaps, semantic
24
+ capability state, and explicit abstention.
25
+
26
+ Use the manual path below when the client should synthesize itself, when you
27
+ need retrieval control, or when no generation model is available.
28
+
29
+ 2. Search for evidence, then retrieve exact passages.
14
30
 
15
31
  ```bash
16
32
  gno query "<claim>" --json
17
33
  gno get <uri> --from <line> -l <count> --line-numbers
18
34
  ```
19
35
 
20
- 2. Prefer direct evidence over inference. Use graph/link expansion only to find supporting context, not to replace primary evidence.
36
+ 3. Prefer direct evidence over inference. Use graph/link expansion only to find supporting context, not to replace primary evidence.
21
37
 
22
38
  ```bash
23
39
  gno backlinks <uri>
24
40
  gno graph --from <uri-a> --to <uri-b>
25
41
  ```
26
42
 
27
- 3. Label claim status:
43
+ 4. Label claim status:
28
44
 
29
- - confirmed by local evidence
30
- - partially supported
31
- - contradicted
32
- - not found locally
45
+ - supported by exact local evidence
46
+ - contradicted by exact local evidence
47
+ - insufficient local evidence
48
+ - uncertain because verification could not resolve the claim
33
49
 
34
- 4. When writing a new note, include source kind, source URL/path, author/person if known, and capture date.
50
+ 5. When writing a new note, include source kind, source URL/path, author/person if known, and capture date.
35
51
 
36
- 5. Verify post-write retrieval when the citation note should be searchable.
52
+ 6. Verify post-write retrieval when the citation note should be searchable.
37
53
 
38
54
  ```bash
39
55
  gno index
@@ -46,6 +62,13 @@ gno search "<citation note title>"
46
62
  - Do not collapse multiple sources into one citation.
47
63
  - Do not hide uncertainty behind confident synthesis.
48
64
  - Do not invent line ranges, URLs, IDs, or source dates.
65
+ - Treat verified Ask as support classification against its retained Capsule,
66
+ not a general factual guarantee. It cannot prove corpus completeness or
67
+ source truth.
68
+ - If the semantic verifier is unavailable, incapable, failed, or malformed,
69
+ preserve `uncertain` and abstention; never upgrade a claim from guesswork.
70
+ - Contradiction requires conflicting evidence. Missing evidence is
71
+ `insufficient`, not contradicted.
49
72
 
50
73
  ## Done
51
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmickel/gno",
3
- "version": "1.18.0",
3
+ "version": "1.20.0",
4
4
  "description": "Local semantic search for your documents. Index Markdown, PDF, and Office files with hybrid BM25 + vector search.",
5
5
  "keywords": [
6
6
  "embeddings",
@@ -28,6 +28,7 @@
28
28
  "files": [
29
29
  "assets",
30
30
  "bunfig.toml",
31
+ "spec",
31
32
  "src",
32
33
  "THIRD_PARTY_NOTICES.md",
33
34
  "vendor"
package/spec/AGENTS.md ADDED
@@ -0,0 +1,83 @@
1
+ # Specifications
2
+
3
+ Interface contracts and schemas for GNO.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ spec/
9
+ ├── cli.md # CLI commands, flags, exit codes
10
+ ├── mcp.md # MCP tools, resources, schemas
11
+ ├── evals.md # Evaluation framework spec
12
+ ├── db/
13
+ │ └── schema.sql # Database schema
14
+ └── output-schemas/ # JSON schemas for all outputs
15
+ ├── search-results.schema.json
16
+ ├── ask.schema.json
17
+ ├── status.schema.json
18
+ └── ...
19
+ ```
20
+
21
+ ## Spec-First Workflow
22
+
23
+ When adding/modifying commands or outputs:
24
+
25
+ 1. **Update spec first** - Define the interface before implementation
26
+ 2. **Add/update JSON schema** - If output shape changes
27
+ 3. **Add contract tests** - In `test/spec/schemas/`
28
+ 4. **Implement** - Code to match spec
29
+ 5. **Verify** - `bun test` passes
30
+
31
+ ## JSON Schemas
32
+
33
+ Schemas define the structure of all JSON outputs:
34
+
35
+ - Validated by contract tests
36
+ - Used for documentation
37
+ - Enable type generation
38
+
39
+ ### Schema Naming
40
+
41
+ - `<command>.schema.json` - Single command output
42
+ - `<noun>-<verb>.schema.json` - Compound names
43
+
44
+ ### Adding a New Schema
45
+
46
+ 1. Create `spec/output-schemas/<name>.schema.json`
47
+ 2. Add contract test in `test/spec/schemas/`
48
+ 3. Reference in spec document
49
+
50
+ ## Contract Tests
51
+
52
+ Tests in `test/spec/schemas/` validate outputs against schemas:
53
+
54
+ ```typescript
55
+ import schema from "../../spec/output-schemas/search-results.schema.json";
56
+
57
+ test("search --json matches schema", async () => {
58
+ const result = await runSearch("query", { json: true });
59
+ expect(() => validate(schema, result)).not.toThrow();
60
+ });
61
+ ```
62
+
63
+ ## Spec Documents
64
+
65
+ ### cli.md
66
+
67
+ - Exit codes and meanings
68
+ - Global flags
69
+ - Output format support matrix
70
+ - All commands with options
71
+
72
+ ### mcp.md
73
+
74
+ - Server capabilities
75
+ - Tool schemas and responses
76
+ - Resource URI schemes
77
+ - Error codes
78
+
79
+ ### evals.md
80
+
81
+ - Evaluation metrics
82
+ - Test case format
83
+ - Scoring methodology
package/spec/CLAUDE.md ADDED
@@ -0,0 +1,83 @@
1
+ # Specifications
2
+
3
+ Interface contracts and schemas for GNO.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ spec/
9
+ ├── cli.md # CLI commands, flags, exit codes
10
+ ├── mcp.md # MCP tools, resources, schemas
11
+ ├── evals.md # Evaluation framework spec
12
+ ├── db/
13
+ │ └── schema.sql # Database schema
14
+ └── output-schemas/ # JSON schemas for all outputs
15
+ ├── search-results.schema.json
16
+ ├── ask.schema.json
17
+ ├── status.schema.json
18
+ └── ...
19
+ ```
20
+
21
+ ## Spec-First Workflow
22
+
23
+ When adding/modifying commands or outputs:
24
+
25
+ 1. **Update spec first** - Define the interface before implementation
26
+ 2. **Add/update JSON schema** - If output shape changes
27
+ 3. **Add contract tests** - In `test/spec/schemas/`
28
+ 4. **Implement** - Code to match spec
29
+ 5. **Verify** - `bun test` passes
30
+
31
+ ## JSON Schemas
32
+
33
+ Schemas define the structure of all JSON outputs:
34
+
35
+ - Validated by contract tests
36
+ - Used for documentation
37
+ - Enable type generation
38
+
39
+ ### Schema Naming
40
+
41
+ - `<command>.schema.json` - Single command output
42
+ - `<noun>-<verb>.schema.json` - Compound names
43
+
44
+ ### Adding a New Schema
45
+
46
+ 1. Create `spec/output-schemas/<name>.schema.json`
47
+ 2. Add contract test in `test/spec/schemas/`
48
+ 3. Reference in spec document
49
+
50
+ ## Contract Tests
51
+
52
+ Tests in `test/spec/schemas/` validate outputs against schemas:
53
+
54
+ ```typescript
55
+ import schema from "../../spec/output-schemas/search-results.schema.json";
56
+
57
+ test("search --json matches schema", async () => {
58
+ const result = await runSearch("query", { json: true });
59
+ expect(() => validate(schema, result)).not.toThrow();
60
+ });
61
+ ```
62
+
63
+ ## Spec Documents
64
+
65
+ ### cli.md
66
+
67
+ - Exit codes and meanings
68
+ - Global flags
69
+ - Output format support matrix
70
+ - All commands with options
71
+
72
+ ### mcp.md
73
+
74
+ - Server capabilities
75
+ - Tool schemas and responses
76
+ - Resource URI schemes
77
+ - Error codes
78
+
79
+ ### evals.md
80
+
81
+ - Evaluation metrics
82
+ - Test case format
83
+ - Scoring methodology
@@ -0,0 +1,137 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "GNO Bench Fixture",
4
+ "type": "object",
5
+ "required": ["version", "queries"],
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "version": { "const": 1 },
9
+ "metadata": {
10
+ "type": "object",
11
+ "additionalProperties": false,
12
+ "properties": {
13
+ "name": { "type": "string" },
14
+ "description": { "type": "string" },
15
+ "tags": { "type": "array", "items": { "type": "string" } }
16
+ }
17
+ },
18
+ "collection": { "type": "string", "minLength": 1 },
19
+ "topK": { "type": "integer", "minimum": 1 },
20
+ "candidateLimit": { "type": "integer", "minimum": 1 },
21
+ "modes": {
22
+ "type": "array",
23
+ "items": {
24
+ "oneOf": [
25
+ {
26
+ "type": "string",
27
+ "enum": [
28
+ "bm25",
29
+ "vector",
30
+ "hybrid",
31
+ "fast",
32
+ "no-rerank",
33
+ "thorough"
34
+ ]
35
+ },
36
+ {
37
+ "type": "object",
38
+ "additionalProperties": false,
39
+ "properties": {
40
+ "name": { "type": "string", "minLength": 1 },
41
+ "type": {
42
+ "type": "string",
43
+ "enum": ["bm25", "vector", "hybrid"]
44
+ },
45
+ "mode": {
46
+ "type": "string",
47
+ "enum": [
48
+ "bm25",
49
+ "vector",
50
+ "hybrid",
51
+ "fast",
52
+ "no-rerank",
53
+ "thorough"
54
+ ]
55
+ },
56
+ "noExpand": { "type": "boolean" },
57
+ "noRerank": { "type": "boolean" },
58
+ "candidateLimit": { "type": "integer", "minimum": 1 },
59
+ "limit": { "type": "integer", "minimum": 1 },
60
+ "queryModes": {
61
+ "type": "array",
62
+ "items": { "$ref": "#/definitions/queryMode" }
63
+ }
64
+ }
65
+ }
66
+ ]
67
+ }
68
+ },
69
+ "queries": {
70
+ "type": "array",
71
+ "minItems": 1,
72
+ "items": {
73
+ "type": "object",
74
+ "required": ["id", "query"],
75
+ "additionalProperties": false,
76
+ "properties": {
77
+ "id": { "type": "string", "minLength": 1 },
78
+ "query": { "type": "string", "minLength": 1 },
79
+ "expected": {
80
+ "type": "array",
81
+ "items": { "type": "string", "minLength": 1 }
82
+ },
83
+ "expectedDocuments": {
84
+ "type": "array",
85
+ "items": { "type": "string", "minLength": 1 }
86
+ },
87
+ "expectedUris": {
88
+ "type": "array",
89
+ "items": { "type": "string", "minLength": 1 }
90
+ },
91
+ "judgments": {
92
+ "type": "array",
93
+ "items": {
94
+ "type": "object",
95
+ "required": ["relevance"],
96
+ "additionalProperties": false,
97
+ "properties": {
98
+ "docid": { "type": "string", "minLength": 1 },
99
+ "doc": { "type": "string", "minLength": 1 },
100
+ "uri": { "type": "string", "minLength": 1 },
101
+ "relevance": { "type": "number", "minimum": 0 }
102
+ },
103
+ "anyOf": [
104
+ { "required": ["docid"] },
105
+ { "required": ["doc"] },
106
+ { "required": ["uri"] }
107
+ ]
108
+ }
109
+ },
110
+ "collection": { "type": "string", "minLength": 1 },
111
+ "topK": { "type": "integer", "minimum": 1 },
112
+ "queryModes": {
113
+ "type": "array",
114
+ "items": { "$ref": "#/definitions/queryMode" }
115
+ }
116
+ },
117
+ "anyOf": [
118
+ { "required": ["expected"] },
119
+ { "required": ["expectedDocuments"] },
120
+ { "required": ["expectedUris"] },
121
+ { "required": ["judgments"] }
122
+ ]
123
+ }
124
+ }
125
+ },
126
+ "definitions": {
127
+ "queryMode": {
128
+ "type": "object",
129
+ "required": ["mode", "text"],
130
+ "additionalProperties": false,
131
+ "properties": {
132
+ "mode": { "type": "string", "enum": ["term", "intent", "hyde"] },
133
+ "text": { "type": "string", "minLength": 1 }
134
+ }
135
+ }
136
+ }
137
+ }