@gmickel/gno 1.19.0 → 1.21.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 (85) hide show
  1. package/README.md +28 -8
  2. package/assets/skill/SKILL.md +73 -27
  3. package/assets/skill/mcp-reference.md +7 -2
  4. package/assets/skill/recipes/citation-and-provenance.md +32 -9
  5. package/package.json +1 -1
  6. package/spec/cli.md +142 -17
  7. package/spec/db/schema.sql +170 -0
  8. package/spec/evals-agentic.md +87 -5
  9. package/spec/mcp.md +75 -3
  10. package/spec/output-schemas/ask.schema.json +198 -0
  11. package/spec/output-schemas/capsule-reverified-event.schema.json +47 -0
  12. package/spec/output-schemas/changes.schema.json +280 -0
  13. package/spec/output-schemas/claim-verification.schema.json +291 -0
  14. package/spec/output-schemas/context-capsule-v1.schema.json +36 -1
  15. package/spec/output-schemas/document-diff.schema.json +185 -0
  16. package/spec/output-schemas/impact.schema.json +122 -0
  17. package/spec/output-schemas/saved-capsule-list.schema.json +16 -0
  18. package/spec/output-schemas/saved-capsule-registration.schema.json +172 -0
  19. package/spec/output-schemas/saved-capsule-reverification.schema.json +59 -0
  20. package/spec/output-schemas/saved-capsule-unwatch.schema.json +16 -0
  21. package/spec/output-schemas/saved-capsule-watch.schema.json +17 -0
  22. package/src/app/context-runtime-contract.ts +10 -5
  23. package/src/app/context-runtime-input.ts +29 -1
  24. package/src/app/context-runtime-types.ts +4 -0
  25. package/src/app/context-runtime.ts +5 -1
  26. package/src/app/context-surface.ts +4 -0
  27. package/src/app/verified-ask.ts +291 -0
  28. package/src/cli/commands/ask-format.ts +255 -0
  29. package/src/cli/commands/ask.ts +40 -149
  30. package/src/cli/commands/changes.ts +160 -0
  31. package/src/cli/commands/context-saved.ts +189 -0
  32. package/src/cli/options.ts +8 -0
  33. package/src/cli/program.ts +227 -1
  34. package/src/core/capsule-registry.ts +279 -0
  35. package/src/core/capsule-reverification-scheduler.ts +218 -0
  36. package/src/core/capsule-reverification.ts +289 -0
  37. package/src/core/change-diff.ts +182 -0
  38. package/src/core/change-journal.ts +228 -0
  39. package/src/core/context-budget.ts +6 -0
  40. package/src/core/context-capsule-retrieval-schema.ts +4 -0
  41. package/src/core/context-capsule-schema.ts +17 -0
  42. package/src/core/context-capsule-validation.ts +3 -2
  43. package/src/core/context-capsule.ts +18 -0
  44. package/src/core/context-compiler.ts +33 -21
  45. package/src/core/context-evidence.ts +6 -0
  46. package/src/core/knowledge-delta.ts +395 -0
  47. package/src/core/knowledge-impact.ts +202 -0
  48. package/src/core/retrieval-trace-evidence-origin.ts +3 -0
  49. package/src/core/retrieval-trace-session.ts +15 -2
  50. package/src/ingestion/sync.ts +214 -165
  51. package/src/llm/errors.ts +10 -1
  52. package/src/llm/httpGeneration.ts +11 -1
  53. package/src/llm/nodeLlamaCpp/generation.ts +54 -10
  54. package/src/llm/types.ts +6 -0
  55. package/src/mcp/tools/ask.ts +228 -0
  56. package/src/mcp/tools/changes.ts +80 -0
  57. package/src/mcp/tools/context.ts +28 -7
  58. package/src/mcp/tools/index.ts +38 -0
  59. package/src/pipeline/claim-verification-schema.ts +235 -0
  60. package/src/pipeline/claim-verification.ts +487 -0
  61. package/src/pipeline/claim-verifier.ts +474 -0
  62. package/src/pipeline/types.ts +25 -0
  63. package/src/sdk/client.ts +77 -2
  64. package/src/sdk/index.ts +7 -0
  65. package/src/sdk/types.ts +22 -0
  66. package/src/serve/doc-events.ts +12 -1
  67. package/src/serve/public/components/AskVerificationPanel.tsx +189 -0
  68. package/src/serve/public/globals.built.css +1 -1
  69. package/src/serve/public/pages/Ask.tsx +42 -4
  70. package/src/serve/resident-runtime.ts +22 -0
  71. package/src/serve/routes/api.ts +162 -3
  72. package/src/serve/routes/changes.ts +102 -0
  73. package/src/serve/server.ts +34 -0
  74. package/src/serve/watch-service.ts +9 -0
  75. package/src/store/index.ts +21 -0
  76. package/src/store/migrations/015-document-change-journal.ts +85 -0
  77. package/src/store/migrations/016-saved-capsules.ts +131 -0
  78. package/src/store/migrations/017-document-change-retention-counters.ts +33 -0
  79. package/src/store/migrations/018-saved-capsule-registration-epoch.ts +24 -0
  80. package/src/store/migrations/019-saved-capsule-registration-generation.ts +53 -0
  81. package/src/store/migrations/index.ts +10 -0
  82. package/src/store/sqlite/adapter.ts +291 -7
  83. package/src/store/sqlite/capsule-registry-store.ts +534 -0
  84. package/src/store/sqlite/change-journal-store.ts +473 -0
  85. package/src/store/types.ts +262 -0
@@ -19,6 +19,8 @@
19
19
  -- retrieval_traces - Opt-in private retrieval trace headers
20
20
  -- retrieval_trace_runs/events/judgments - Bounded trace outcome records
21
21
  -- retrieval_trace_exports/export_traces - Export manifests and trace joins
22
+ -- document_changes - Bounded metadata-only document lifecycle journal
23
+ -- document_change_journal_state - Monotonic cursor/retention boundary
22
24
 
23
25
  -- ─────────────────────────────────────────────────────────────────────────────
24
26
  -- Schema Metadata
@@ -361,6 +363,64 @@ CREATE TABLE IF NOT EXISTS retrieval_trace_export_traces (
361
363
  -- and an absolute 100,000 subordinate-record safety cap per trace. Runtime
362
364
  -- retention applies the lower configured maxRecordsPerTrace bound.
363
365
 
366
+ -- ─────────────────────────────────────────────────────────────────────────────
367
+ -- Document Change Journal
368
+ -- ─────────────────────────────────────────────────────────────────────────────
369
+
370
+ -- Append-only while retained. Rows contain identity, hashes, active state, and
371
+ -- compact structural summaries only; source and converted bodies are excluded.
372
+
373
+ CREATE TABLE IF NOT EXISTS document_changes (
374
+ sequence INTEGER PRIMARY KEY AUTOINCREMENT,
375
+ document_id INTEGER NOT NULL CHECK (document_id > 0),
376
+ collection TEXT NOT NULL,
377
+ change_kind TEXT NOT NULL
378
+ CHECK (change_kind IN ('create', 'update', 'rename', 'inactivate', 'reactivate')),
379
+ old_rel_path TEXT,
380
+ new_rel_path TEXT,
381
+ old_docid TEXT,
382
+ new_docid TEXT,
383
+ old_uri TEXT,
384
+ new_uri TEXT,
385
+ old_source_hash TEXT,
386
+ new_source_hash TEXT,
387
+ old_mirror_hash TEXT,
388
+ new_mirror_hash TEXT,
389
+ old_active INTEGER CHECK (old_active IS NULL OR old_active IN (0, 1)),
390
+ new_active INTEGER CHECK (new_active IS NULL OR new_active IN (0, 1)),
391
+ heading_delta_json TEXT NOT NULL DEFAULT '{"added":[],"removed":[]}',
392
+ link_delta_json TEXT NOT NULL DEFAULT '{"added":[],"removed":[]}',
393
+ typed_edge_delta_json TEXT NOT NULL DEFAULT '{"added":[],"removed":[]}',
394
+ date_delta_json TEXT NOT NULL
395
+ DEFAULT '{"added":[],"removed":[],"changed":[]}',
396
+ structure_truncated INTEGER NOT NULL DEFAULT 0
397
+ CHECK (structure_truncated IN (0, 1)),
398
+ observed_at_ms INTEGER NOT NULL CHECK (observed_at_ms >= 0),
399
+ byte_size INTEGER NOT NULL CHECK (byte_size > 0 AND byte_size <= 131072),
400
+ CHECK (length(CAST(heading_delta_json AS BLOB)) <= 16384),
401
+ CHECK (length(CAST(link_delta_json AS BLOB)) <= 16384),
402
+ CHECK (length(CAST(typed_edge_delta_json AS BLOB)) <= 16384),
403
+ CHECK (length(CAST(date_delta_json AS BLOB)) <= 16384)
404
+ );
405
+
406
+ CREATE INDEX IF NOT EXISTS idx_document_changes_collection_sequence
407
+ ON document_changes(collection, sequence);
408
+ CREATE INDEX IF NOT EXISTS idx_document_changes_document_sequence
409
+ ON document_changes(document_id, sequence);
410
+ CREATE INDEX IF NOT EXISTS idx_document_changes_retention
411
+ ON document_changes(observed_at_ms, sequence);
412
+
413
+ CREATE TABLE IF NOT EXISTS document_change_journal_state (
414
+ singleton_id INTEGER PRIMARY KEY CHECK (singleton_id = 1),
415
+ last_sequence INTEGER NOT NULL DEFAULT 0 CHECK (last_sequence >= 0),
416
+ retention_floor INTEGER NOT NULL DEFAULT 0
417
+ CHECK (retention_floor >= 0 AND retention_floor <= last_sequence),
418
+ retained_entries INTEGER NOT NULL DEFAULT 0
419
+ CHECK (retained_entries >= 0),
420
+ retained_bytes INTEGER NOT NULL DEFAULT 0
421
+ CHECK (retained_bytes >= 0)
422
+ );
423
+
364
424
  -- ─────────────────────────────────────────────────────────────────────────────
365
425
  -- Document Tags
366
426
  -- ─────────────────────────────────────────────────────────────────────────────
@@ -440,3 +500,113 @@ CREATE TABLE IF NOT EXISTS doc_edges (
440
500
 
441
501
  CREATE INDEX IF NOT EXISTS idx_doc_edges_src_type ON doc_edges(src_doc_id, edge_type);
442
502
  CREATE INDEX IF NOT EXISTS idx_doc_edges_dst_type ON doc_edges(dst_doc_id, edge_type);
503
+
504
+ -- ─────────────────────────────────────────────────────────────────────────────
505
+ -- Saved Context Capsules (metadata only)
506
+ -- ─────────────────────────────────────────────────────────────────────────────
507
+
508
+ CREATE TABLE IF NOT EXISTS saved_capsule_registrations (
509
+ registration_id TEXT PRIMARY KEY,
510
+ file_path TEXT NOT NULL UNIQUE,
511
+ file_hash TEXT NOT NULL,
512
+ capsule_id TEXT NOT NULL,
513
+ index_name TEXT NOT NULL,
514
+ question TEXT,
515
+ label TEXT,
516
+ notification_preference TEXT NOT NULL DEFAULT 'none'
517
+ CHECK (notification_preference IN ('none', 'local')),
518
+ registered_at_ms INTEGER NOT NULL CHECK (registered_at_ms >= 0),
519
+ updated_at_ms INTEGER NOT NULL CHECK (updated_at_ms >= registered_at_ms),
520
+ last_attempted_sequence INTEGER NOT NULL DEFAULT 0
521
+ CHECK (last_attempted_sequence >= 0),
522
+ registration_generation INTEGER NOT NULL DEFAULT 0
523
+ CHECK (registration_generation >= 0),
524
+ CHECK (length(registration_id) BETWEEN 1 AND 128),
525
+ CHECK (length(CAST(file_path AS BLOB)) BETWEEN 1 AND 8192),
526
+ CHECK (length(file_hash) = 64 AND file_hash NOT GLOB '*[^0-9a-f]*'),
527
+ CHECK (length(capsule_id) = 64 AND capsule_id NOT GLOB '*[^0-9a-f]*'),
528
+ CHECK (length(CAST(index_name AS BLOB)) BETWEEN 1 AND 128),
529
+ CHECK (question IS NULL OR length(CAST(question AS BLOB)) <= 8192),
530
+ CHECK (label IS NULL OR length(CAST(label AS BLOB)) <= 512)
531
+ );
532
+
533
+ CREATE INDEX IF NOT EXISTS idx_saved_capsules_index
534
+ ON saved_capsule_registrations(index_name, registration_id);
535
+
536
+ CREATE TABLE IF NOT EXISTS saved_capsule_evidence (
537
+ registration_id TEXT NOT NULL,
538
+ evidence_id TEXT NOT NULL,
539
+ canonical_uri TEXT NOT NULL,
540
+ collection TEXT NOT NULL,
541
+ source_hash TEXT NOT NULL,
542
+ mirror_hash TEXT NOT NULL,
543
+ passage_hash TEXT NOT NULL,
544
+ PRIMARY KEY (registration_id, evidence_id),
545
+ FOREIGN KEY (registration_id)
546
+ REFERENCES saved_capsule_registrations(registration_id)
547
+ ON DELETE CASCADE,
548
+ CHECK (length(evidence_id) = 64 AND evidence_id NOT GLOB '*[^0-9a-f]*'),
549
+ CHECK (length(CAST(canonical_uri AS BLOB)) BETWEEN 1 AND 8192),
550
+ CHECK (length(CAST(collection AS BLOB)) BETWEEN 1 AND 256),
551
+ CHECK (length(source_hash) = 64 AND source_hash NOT GLOB '*[^0-9a-f]*'),
552
+ CHECK (length(mirror_hash) = 64 AND mirror_hash NOT GLOB '*[^0-9a-f]*'),
553
+ CHECK (length(passage_hash) = 64 AND passage_hash NOT GLOB '*[^0-9a-f]*')
554
+ );
555
+
556
+ CREATE INDEX IF NOT EXISTS idx_saved_capsule_evidence_uri
557
+ ON saved_capsule_evidence(canonical_uri, registration_id);
558
+ CREATE INDEX IF NOT EXISTS idx_saved_capsule_evidence_source
559
+ ON saved_capsule_evidence(source_hash, registration_id);
560
+ CREATE INDEX IF NOT EXISTS idx_saved_capsule_evidence_mirror
561
+ ON saved_capsule_evidence(mirror_hash, registration_id);
562
+
563
+ CREATE TABLE IF NOT EXISTS saved_capsule_verifications (
564
+ registration_id TEXT PRIMARY KEY,
565
+ trigger_kind TEXT NOT NULL CHECK (trigger_kind IN ('manual', 'journal')),
566
+ from_sequence INTEGER NOT NULL CHECK (from_sequence >= 0),
567
+ through_sequence INTEGER NOT NULL CHECK (through_sequence >= from_sequence),
568
+ operation_status TEXT NOT NULL CHECK (operation_status IN ('completed', 'failed')),
569
+ affected_question_state TEXT NOT NULL
570
+ CHECK (affected_question_state IN ('unaffected', 'affected', 'unknown')),
571
+ affected_reasons_json TEXT NOT NULL,
572
+ receipt_json TEXT,
573
+ receipt_hash TEXT,
574
+ error_code TEXT,
575
+ error_message TEXT,
576
+ verified_at_ms INTEGER NOT NULL CHECK (verified_at_ms >= 0),
577
+ FOREIGN KEY (registration_id)
578
+ REFERENCES saved_capsule_registrations(registration_id)
579
+ ON DELETE CASCADE,
580
+ CHECK (length(CAST(affected_reasons_json AS BLOB)) <= 4096),
581
+ CHECK (receipt_json IS NULL OR length(CAST(receipt_json AS BLOB)) <= 16777216),
582
+ CHECK (receipt_hash IS NULL OR (
583
+ length(receipt_hash) = 64 AND receipt_hash NOT GLOB '*[^0-9a-f]*'
584
+ )),
585
+ CHECK (error_code IS NULL OR length(CAST(error_code AS BLOB)) <= 256),
586
+ CHECK (error_message IS NULL OR length(CAST(error_message AS BLOB)) <= 4096),
587
+ CHECK (
588
+ (
589
+ operation_status = 'completed'
590
+ AND receipt_json IS NOT NULL
591
+ AND receipt_hash IS NOT NULL
592
+ AND error_code IS NULL
593
+ AND error_message IS NULL
594
+ )
595
+ OR
596
+ (
597
+ operation_status = 'failed'
598
+ AND receipt_json IS NULL
599
+ AND receipt_hash IS NULL
600
+ AND error_code IS NOT NULL
601
+ AND error_message IS NOT NULL
602
+ )
603
+ )
604
+ );
605
+
606
+ CREATE TABLE IF NOT EXISTS saved_capsule_reverification_state (
607
+ singleton_id INTEGER PRIMARY KEY CHECK (singleton_id = 1),
608
+ last_processed_sequence INTEGER NOT NULL DEFAULT 0
609
+ CHECK (last_processed_sequence >= 0),
610
+ registration_epoch INTEGER NOT NULL DEFAULT 0
611
+ CHECK (registration_epoch >= 0)
612
+ );
@@ -22,6 +22,8 @@ evals/agentic/
22
22
  fixture-db.ts
23
23
  scoring.ts
24
24
  promotion.ts
25
+ verified-ask-outcome.ts
26
+ verified-ask-promotion.ts
25
27
  registry.ts
26
28
  report.ts
27
29
  report-artifacts.ts
@@ -51,7 +53,13 @@ evals/fixtures/agentic-retrieval/
51
53
  agent-model.lock.json
52
54
  baseline/
53
55
  README.md
54
- fixture-agent/{report.json,canonical.json,observations.json,report.md}
56
+ fixture-agent/
57
+ report.json
58
+ canonical.json
59
+ observations.json
60
+ report.md
61
+ verified-ask-promotion.json
62
+ verified-ask-promotion.md
55
63
  optional/{qmd,local-model}/ # local opt-in evidence; not authoritative
56
64
  ```
57
65
 
@@ -400,7 +408,9 @@ and hashes, and promotion results remain included. `report.json` is schema
400
408
  valid. `canonical.json` contains that exact projection. `observations.json`
401
409
  holds environment, build observations, and full-identity receipt observations;
402
410
  committed temporary paths are projected to `<temp>`. `report.md` is the readable
403
- summary. The four files are staged and directory-renamed as one baseline set.
411
+ summary. The six files are staged and directory-renamed as one baseline set.
412
+ The verified Ask files are a separate attributable outcome lane; they do not
413
+ rename the Capsule retrieval promotion in `report.json`.
404
414
 
405
415
  ## Deterministic scoring
406
416
 
@@ -455,6 +465,19 @@ Claim linkage is:
455
465
  linkedSupportedClaims_capsule / substantiveClaims_capsule >= 0.95
456
466
  ```
457
467
 
468
+ Unsupported substantive claims must strictly decrease on a comparable paired
469
+ cohort:
470
+
471
+ ```text
472
+ unsupportedClaims_capsule < unsupportedClaims_gno
473
+ 1 - unsupportedClaims_capsule / unsupportedClaims_gno
474
+ ```
475
+
476
+ The report records both counts and the reduction. A missing paired baseline,
477
+ an identity mismatch, or a zero unsupported-claim baseline makes this reduction
478
+ unavailable/non-comparable; GNO reports that state rather than fabricating an
479
+ improvement.
480
+
458
481
  All denominators must be non-zero. Abstention-only tasks use their completion
459
482
  predicate and do not fabricate substantive claims. Every fixture-agent Capsule
460
483
  task must also emit byte-identical canonical Capsule payload JSON and matching
@@ -464,6 +487,64 @@ duplicates, identity mismatches,
464
487
  pairwise or aggregate accuracy loss, denominator failure, threshold miss, or
465
488
  nondeterminism fails promotion.
466
489
 
490
+ ## Verified Ask promotion formulas
491
+
492
+ The authoritative fixture-agent write additionally runs a separate 22-task
493
+ outcome lane. It excludes only the two declared expected-missing/abstention
494
+ tasks. Every included task must contain exactly one required substantive claim;
495
+ missing, duplicate, extra, or mismatched pairs fail closed.
496
+
497
+ The compatible cohort is an independent frozen contract, not inferred from the
498
+ artifact under validation:
499
+
500
+ ```text
501
+ t012ab3c t0a1b2c3 t123bc4d t1b2c3d4 t2c3d4e5 t3d4e5f6
502
+ t456ef70 t4e5f607 t567f081 t5f60718 t6071829 t6780192
503
+ t718293a t7891a03 t8293a4b t93a4b5c ta4b5c6d tb5c6d7e
504
+ tc6d7e8f td7e8f90 te8f901a tf901a2b
505
+ ```
506
+
507
+ The exact exclusions are `t234cd5e` and `t345de6f`, both with reason
508
+ `expected_missing_evidence`. Removing or replacing a complete receipt/score
509
+ pair and resealing every derived fingerprint still fails validation.
510
+
511
+ The baseline executes the production raw Ask path:
512
+ `searchHybrid` → `generateGroundedAnswer` → `processAnswerResult`. The candidate
513
+ executes production `buildVerifiedAsk`. Each pair shares the immutable native
514
+ index, task goal, collection, structured search modes, deterministic answer
515
+ agent/model fingerprint, and initial answer draft. Receipt and score identities
516
+ bind task, lane, trial, seed, and agent. Pairing also requires identical fixture,
517
+ index, request, and model fingerprints.
518
+
519
+ Four fixed, diverse tasks receive an unsupported deterministic draft in both
520
+ lanes. The other 18 receive the oracle-supported draft. This controlled
521
+ adversarial subset tests enforcement at the product boundary; it does not claim
522
+ general model quality.
523
+
524
+ For every pair and in aggregate:
525
+
526
+ ```text
527
+ answerAccuracy_verified(p) >= answerAccuracy_raw(p)
528
+ mean(answerAccuracy_verified) >= mean(answerAccuracy_raw)
529
+ unsupportedSubstantiveClaims_verified < unsupportedSubstantiveClaims_raw
530
+ ```
531
+
532
+ `verified-ask-promotion.json` contains canonical receipts, identity-bearing
533
+ scores, exact cohort/exclusions, metrics, and the gate result.
534
+ `verified-ask-promotion.md` is its readable projection. Temporary collection
535
+ paths and timings are excluded from the canonical contract; fixture, index,
536
+ request, model, exact answer, citation hashes, verification status, and scored
537
+ outcome remain bound. The evaluator parses the typed claim from the exact final
538
+ product answer and scores it against the independent fn-97 oracle; it
539
+ recomputes receipt, answer, score, and artifact fingerprints rather than
540
+ trusting harness-assigned claim or score fields. Raw and verified lane semantics
541
+ are validated independently. A supported final answer is exactly one encoded
542
+ typed claim followed by its lane citation (`[1].` or one
543
+ `[evidence:<sha256>].`); prefixes, extra claims, and trailing prose are invalid.
544
+ An abstention must equal the production abstention text and contain no
545
+ citations. Authoritative generation refuses a dirty Git checkout and records
546
+ the exact clean source commit.
547
+
467
548
  ## Commands
468
549
 
469
550
  Contract tests are ordinary offline tests:
@@ -486,9 +567,10 @@ lifecycles, and the fixture agent. qmd is lazily registered and never runs by
486
567
  default. A requested unavailable qmd lane produces the complete requested
487
568
  harness-error matrix/report and exits `2`; it never disappears or downgrades.
488
569
 
489
- Exit `0` means a complete run and, when applicable, passing promotion. Exit `1`
490
- means the complete Capsule promotion gate failed. Exit `2` means invalid CLI,
491
- preflight, harness, or requested-adapter failure. `--write` accepts only a full
570
+ Exit `0` means a complete run and, when applicable, both promotions pass. Exit
571
+ `1` means the complete Capsule or verified Ask promotion gate failed. Exit `2`
572
+ means invalid CLI, preflight, harness, or requested-adapter failure. `--write`
573
+ accepts only a full
492
574
  24-task/two-lifecycle lane: the fixture-agent three-adapter lane writes the
493
575
  authoritative baseline, while qmd and the three-trial cached-local-model lane
494
576
  write only under `baseline/optional/`. Filtered or mixed writes are refused and
package/spec/mcp.md CHANGED
@@ -151,7 +151,8 @@ Collection names are case-insensitive on input and normalized to lowercase in re
151
151
  ### Private retrieval metadata
152
152
 
153
153
  When local tracing is enabled, successful `gno_search`, `gno_vsearch`,
154
- `gno_query`, `gno_get`, and `gno_context` results include non-model-visible
154
+ `gno_query`, `gno_get`, `gno_context`, and `gno_ask` results include
155
+ non-model-visible
155
156
  top-level response metadata:
156
157
 
157
158
  ```json
@@ -196,6 +197,54 @@ content or a filesystem path. Aggregate exports reject open/missing traces and
196
197
  preserve each stored terminal state without treating partial, failed, or
197
198
  cancelled as negative feedback.
198
199
 
200
+ ### gno_ask
201
+
202
+ Generate and verify one answer against a closed Context Capsule. This is a
203
+ separate read-only tool; raw retrieval remains on `gno_query`, and trace
204
+ mutation authority is not widened.
205
+
206
+ Required input:
207
+
208
+ ```json
209
+ {
210
+ "query": "Who owns the launch decision?",
211
+ "verify": true
212
+ }
213
+ ```
214
+
215
+ `verify` must be the literal `true`; implicit or raw Ask requests are rejected.
216
+ Optional fields are `collection`, `limit` (default 5), `minScore`, `lang`,
217
+ `intent`, `candidateLimit`, `exclude`, `queryModes`, `tagsAll`, `tagsAny`,
218
+ `since`, `until`, `categories`, `author`, `graph`, `noGraph`, `noRerank`,
219
+ `maxAnswerTokens`, `contextBudgetTokens`, and `contextBudgetBytes`. Input
220
+ objects are closed.
221
+
222
+ `structuredContent` uses the
223
+ [`ask`](./output-schemas/ask.schema.json) contract. Its `verification` object
224
+ contains the canonical Capsule, freshness receipt, four-state per-claim
225
+ verdicts, exact support/conflict evidence IDs and line spans, coverage, gaps,
226
+ semantic verifier capability, and explicit abstention. Every substantive claim
227
+ must be supported; otherwise the draft is withheld and `answerStatus` is
228
+ `abstained`. Contradiction is never inferred from missing evidence.
229
+
230
+ Model-visible text renders the same answer status, coverage, semantic state,
231
+ per-claim verdicts, exact `gno://` line spans, evidence IDs, gaps, and cited
232
+ sources. Capability degradation comes from the Capsule's
233
+ requested/attempted/outcome states.
234
+
235
+ Verification is a closed-Capsule support classification, not a factual
236
+ guarantee. It does not assert that the indexed corpus is complete or that source
237
+ statements are true. Unavailable, incapable, failed, or malformed semantic
238
+ verification cannot produce support; unresolved substantive claims remain
239
+ uncertain and force abstention.
240
+
241
+ The server-owned effective index is used for both Capsule compilation and
242
+ freshness verification. One Ask-owned trace covers retrieval, Context,
243
+ generation, verification, and exact retained citations. The trace ID remains
244
+ transport-only in `_meta`; no dead ID is emitted after retention eviction.
245
+ Support/conflict spans are inspectable and explicitly labelable, but they do
246
+ not create implicit relevance judgments.
247
+
199
248
  ### gno_context
200
249
 
201
250
  Compile a deterministic, extractive Context Capsule. The active MCP server
@@ -213,8 +262,9 @@ Required input:
213
262
  ```
214
263
 
215
264
  Optional input fields are `query`, `collections`, `uriPrefix`, `queryModes`,
216
- `tagsAll`, `tagsAny`, `categories`, `author`, `lang`, `since`, `until`, `graph`,
217
- `limit`, `candidateLimit`, `budgetBytes`, `safetyMarginTokens`,
265
+ `tagsAll`, `tagsAny`, `categories`, `author`, `lang`, `intent`, `exclude`,
266
+ `minScore`, `since`, `until`, `graph`, `noRerank`, `limit`, `candidateLimit`,
267
+ `budgetBytes`, `safetyMarginTokens`,
218
268
  `safetyMarginBytes`, `depthPolicy` (`fast`, `balanced`, or `thorough`), and
219
269
  `format` (`json` or `md`). Input objects are closed: unknown fields return
220
270
  `invalid_input`. Unknown collections return `invalid_filter` before model or
@@ -1476,6 +1526,28 @@ Use for explicit relationship questions over typed edges such as `works_at`,
1476
1526
  `attended`, or `mentions` after a seed ref is known. Use `gno_query` first if
1477
1527
  the seed document is unknown.
1478
1528
 
1529
+ ### gno_changes
1530
+
1531
+ Read-only metadata journal listing. Input fields: `since` (ISO-8601 time or
1532
+ opaque cursor), `collection`, and `limit` (1-1000, default 100). Structured
1533
+ content is contract-identical to CLI/REST/SDK `changes.schema.json`; it never
1534
+ contains source bodies.
1535
+
1536
+ ### gno_diff
1537
+
1538
+ Read-only structural diff for `ref`, optionally selecting opaque `change`.
1539
+ Structured content is `document-diff.schema.json`. Expired/purged history and
1540
+ metadata-only content are explicit output states, while unavailable prior
1541
+ structure is derived from `structureDelta.truncated`.
1542
+
1543
+ ### gno_impact
1544
+
1545
+ Read-only inbound dependency traversal for `ref`. Inputs `maxDepth`,
1546
+ `maxNodes`, `maxEdges`, `frontierLimit`, and `visitedLimit` use the same bounds
1547
+ as CLI/REST/SDK. Structured content is `impact.schema.json`; each impacted
1548
+ document includes a deterministic evidence path over typed or backlink
1549
+ projections. Truncation is explicit when any cap is reached.
1550
+
1479
1551
  ---
1480
1552
 
1481
1553
  ### gno_graph_neighbors
@@ -4,7 +4,96 @@
4
4
  "title": "GNO Ask Response",
5
5
  "description": "Response from gno ask command",
6
6
  "type": "object",
7
+ "additionalProperties": false,
7
8
  "required": ["query", "mode", "results", "meta"],
9
+ "allOf": [
10
+ {
11
+ "if": {
12
+ "properties": { "verification": {} },
13
+ "required": ["verification"]
14
+ },
15
+ "then": {
16
+ "required": ["answer", "citations"],
17
+ "properties": {
18
+ "answer": {},
19
+ "citations": {
20
+ "type": "array",
21
+ "items": {
22
+ "type": "object",
23
+ "properties": { "evidenceId": {} },
24
+ "required": ["evidenceId"]
25
+ }
26
+ },
27
+ "meta": {
28
+ "type": "object",
29
+ "required": ["verificationRequested", "abstained"],
30
+ "properties": {
31
+ "verificationRequested": { "const": true },
32
+ "abstained": {}
33
+ }
34
+ }
35
+ }
36
+ }
37
+ },
38
+ {
39
+ "if": {
40
+ "properties": {
41
+ "meta": {
42
+ "type": "object",
43
+ "required": ["verificationRequested"],
44
+ "properties": { "verificationRequested": { "const": true } }
45
+ }
46
+ },
47
+ "required": ["meta"]
48
+ },
49
+ "then": {
50
+ "properties": { "verification": {} },
51
+ "required": ["verification"]
52
+ }
53
+ },
54
+ {
55
+ "if": {
56
+ "properties": {
57
+ "verification": {
58
+ "type": "object",
59
+ "properties": {
60
+ "claims": {
61
+ "type": "object",
62
+ "properties": { "answerStatus": { "const": "abstained" } },
63
+ "required": ["answerStatus"]
64
+ }
65
+ },
66
+ "required": ["claims"]
67
+ }
68
+ },
69
+ "required": ["verification"]
70
+ },
71
+ "then": {
72
+ "properties": {
73
+ "citations": { "type": "array", "maxItems": 0 },
74
+ "meta": {
75
+ "type": "object",
76
+ "properties": { "abstained": { "const": true } }
77
+ }
78
+ }
79
+ },
80
+ "else": {
81
+ "if": {
82
+ "properties": { "verification": {} },
83
+ "required": ["verification"]
84
+ },
85
+ "then": {
86
+ "properties": {
87
+ "citations": { "type": "array", "minItems": 1 },
88
+ "meta": {
89
+ "type": "object",
90
+ "properties": { "abstained": { "const": false } }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ ],
8
97
  "$defs": {
9
98
  "searchResult": {
10
99
  "type": "object",
@@ -165,8 +254,13 @@
165
254
  "description": "Citations for the answer",
166
255
  "items": {
167
256
  "type": "object",
257
+ "additionalProperties": false,
168
258
  "required": ["docid", "uri"],
169
259
  "properties": {
260
+ "evidenceId": {
261
+ "type": "string",
262
+ "pattern": "^[a-f0-9]{64}$"
263
+ },
170
264
  "docid": {
171
265
  "type": "string",
172
266
  "description": "Document ID",
@@ -197,8 +291,106 @@
197
291
  "$ref": "#/$defs/searchResult"
198
292
  }
199
293
  },
294
+ "verification": {
295
+ "type": "object",
296
+ "additionalProperties": false,
297
+ "required": [
298
+ "schemaVersion",
299
+ "mode",
300
+ "capsule",
301
+ "freshness",
302
+ "claims",
303
+ "semantic"
304
+ ],
305
+ "properties": {
306
+ "schemaVersion": { "const": "1.0" },
307
+ "mode": { "const": "closed_capsule" },
308
+ "capsule": {
309
+ "$ref": "gno://schemas/context-capsule-v1@1.0"
310
+ },
311
+ "freshness": {
312
+ "$ref": "gno://schemas/context-capsule-verification@1.0"
313
+ },
314
+ "claims": {
315
+ "$ref": "gno://schemas/claim-verification@1.0"
316
+ },
317
+ "semantic": {
318
+ "type": "object",
319
+ "additionalProperties": false,
320
+ "required": [
321
+ "status",
322
+ "reason",
323
+ "schemaRequested",
324
+ "schemaEnforced",
325
+ "modelFingerprint",
326
+ "configFingerprint",
327
+ "verifierFingerprint",
328
+ "candidateClaims",
329
+ "verifiedClaims",
330
+ "unresolvedClaims",
331
+ "modelCalls",
332
+ "durationMs"
333
+ ],
334
+ "properties": {
335
+ "status": {
336
+ "enum": ["completed", "unavailable", "failed"]
337
+ },
338
+ "reason": {
339
+ "enum": [
340
+ "verified",
341
+ "no_candidates",
342
+ "verifier_unavailable",
343
+ "structured_output_unavailable",
344
+ "input_limit_exceeded",
345
+ "generation_failed",
346
+ "invalid_output"
347
+ ]
348
+ },
349
+ "schemaRequested": { "type": "boolean" },
350
+ "schemaEnforced": { "type": "boolean" },
351
+ "modelFingerprint": {
352
+ "oneOf": [
353
+ {
354
+ "type": "string",
355
+ "pattern": "^[a-f0-9]{64}$"
356
+ },
357
+ { "type": "null" }
358
+ ]
359
+ },
360
+ "configFingerprint": {
361
+ "type": "string",
362
+ "pattern": "^[a-f0-9]{64}$"
363
+ },
364
+ "verifierFingerprint": {
365
+ "oneOf": [
366
+ {
367
+ "type": "string",
368
+ "pattern": "^[a-f0-9]{64}$"
369
+ },
370
+ { "type": "null" }
371
+ ]
372
+ },
373
+ "candidateClaims": {
374
+ "type": "integer",
375
+ "minimum": 0
376
+ },
377
+ "verifiedClaims": {
378
+ "type": "integer",
379
+ "minimum": 0
380
+ },
381
+ "unresolvedClaims": {
382
+ "type": "integer",
383
+ "minimum": 0
384
+ },
385
+ "modelCalls": { "enum": [0, 1] },
386
+ "durationMs": { "type": "number", "minimum": 0 }
387
+ }
388
+ }
389
+ }
390
+ },
200
391
  "meta": {
201
392
  "type": "object",
393
+ "additionalProperties": false,
202
394
  "description": "Retrieval metadata",
203
395
  "required": ["expanded", "reranked", "vectorsUsed"],
204
396
  "properties": {
@@ -250,6 +442,12 @@
250
442
  "type": "boolean",
251
443
  "description": "Whether an answer was generated"
252
444
  },
445
+ "verificationRequested": {
446
+ "type": "boolean"
447
+ },
448
+ "abstained": {
449
+ "type": "boolean"
450
+ },
253
451
  "totalResults": {
254
452
  "type": "integer",
255
453
  "description": "Number of results returned",