@tangle-network/agent-knowledge 1.11.0 → 1.11.2

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 (2) hide show
  1. package/README.md +48 -20
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -7,15 +7,16 @@ This package turns raw sources and generated markdown knowledge into a versionab
7
7
  ## Contents
8
8
 
9
9
  - [Install](#install)
10
- - [Start here](#start-here) pick CLI vs programmatic
11
- - [CLI](#cli) `init` `source-add` `index` `search` `lint`
12
- - [Design](#design) the invariants (immutable sources, cited claims, deterministic graph)
13
- - [Benchmark harness](#benchmark-harness) BEIR/MTEB/qrels, RAG answer, hallucination, KB-improvement cases
14
- - [Agent-Eval integration](#agent-eval-integration) retrieval eval + readiness bundles + release reports
15
- - [Memory adapters](#memory-adapters) generic memory contract + Neo4j Agent Memory bridge
16
- - [Research loop](#research-loop) `runKnowledgeResearchLoop` + control-loop adapter
17
- - [Runtime integration](#runtime-integration) how agent runners plug into the pure KB loop
18
- - [Pluggable knowledge sources](#pluggable-knowledge-sources) live authorities eval re-runs
10
+ - [Start here](#start-here): pick CLI vs programmatic
11
+ - [Common uses](#common-uses): wiki, RAG, memory, new KBs, existing KBs, and parallel agents
12
+ - [CLI](#cli): `init` `source-add` `index` `search` `lint`
13
+ - [Design](#design): the invariants, including immutable sources, cited claims, and deterministic graph output
14
+ - [Benchmark harness](#benchmark-harness): BEIR/MTEB/qrels, RAG answer, hallucination, KB-improvement cases
15
+ - [Agent-Eval integration](#agent-eval-integration): retrieval eval, readiness bundles, and release reports
16
+ - [Memory adapters](#memory-adapters): generic memory contract plus Neo4j Agent Memory bridge
17
+ - [Research loop](#research-loop): `runKnowledgeResearchLoop` plus the control-loop adapter
18
+ - [Runtime integration](#runtime-integration): how agent runners plug into the pure KB loop
19
+ - [Pluggable knowledge sources](#pluggable-knowledge-sources): live authorities → eval re-runs
19
20
 
20
21
  ## Install
21
22
 
@@ -44,6 +45,18 @@ Two ways in, depending on what you're doing:
44
45
 
45
46
  Storage stays consumer-owned via `KbStore` (`MemoryKbStore`, `FileSystemKbStore`, or your own D1/Postgres). Every primitive below is source-grounded: claims cite immutable source records, and lint fails on un-grounded citations.
46
47
 
48
+ ## Common Uses
49
+
50
+ | Use case | What this package owns | Front door |
51
+ |---|---|---|
52
+ | LLM wiki or docs KB | Source records, cited markdown pages, lint, readiness scoring, candidate promotion | `improveKnowledgeBase` or `runKnowledgeResearchLoop` |
53
+ | RAG | Retrieval eval, source-span labels, answer quality checks, missing/stale/noisy-source diagnosis | `runRagKnowledgeImprovementLoop` |
54
+ | Memory DB | Adapter contract that turns memory hits into source-like evidence and benchmark rows | `/memory` plus `runMemoryAdapterBenchmark` |
55
+ | From scratch | Empty KB layout, source ingestion, write-block application, indexing, readiness checks | CLI `init` or `runKnowledgeResearchLoop` |
56
+ | Existing KB | Candidate workspace, resume state, base-hash conflict check, promotion only after evals pass | `improveKnowledgeBase` |
57
+ | Parallel agents | Per-run locks, isolated candidates, `promote: false` handoff, retry with the same `runId` | `improveKnowledgeBase` with runtime workers |
58
+ | One-call agent job | Runtime supervisor plus all KB mechanics above | `runKnowledgeImprovementJob` from `@tangle-network/agent-runtime/knowledge` |
59
+
47
60
  ## CLI
48
61
 
49
62
  ```bash
@@ -122,7 +135,7 @@ from `@tangle-network/agent-knowledge`.
122
135
  `rrfScore` are the raw reciprocal-rank-fusion value (typically 0.01–0.05);
123
136
  use them when intent matters or when fusing across queries.
124
137
  `normalizedScore` is the same value scaled into [0, 1] relative to the top
125
- hit *in this result set* (top hit = 1, others = score / topScore) use it
138
+ hit *in this result set* (top hit = 1, others = score / topScore). Use it
126
139
  when comparing against natural confidence thresholds. The normalization is
127
140
  within-set ranking, not a cross-query absolute confidence.
128
141
  - Release confidence uses `@tangle-network/agent-eval` release gates (`evaluateReleaseConfidence`) instead of reimplementing them.
@@ -229,7 +242,7 @@ This is the path for Neo4j Agent Memory, Mem0, Zep, Letta, Graphiti, a vector st
229
242
 
230
243
  ## Agent-Eval Integration
231
244
 
232
- Use `ragAnswerQualityJudge` or `createRagAnswerQualityHook` when the product already has answer traces and needs SOTA-style RAG scoring without rebuilding metrics.
245
+ Use `ragAnswerQualityJudge` or `createRagAnswerQualityHook` when the product already has answer traces and needs RAG answer scoring without rebuilding metrics.
233
246
  The built-in checks are deterministic and general; pass external scores from Ragas, DeepEval, TruLens, RAGChecker, or a custom evaluator when you want model-based judging.
234
247
 
235
248
  ```ts
@@ -500,13 +513,13 @@ with a differentiated worker/driver split over ONE knowledge base: the `worker`
500
513
  does primary research (discovers sources, proposes pages for the open gaps); the
501
514
  `driver` verifies each candidate source before it commits, optionally gap-fills
502
515
  with its own pass (`driverResearches: true`), and gates on the readiness check.
503
- Both are yours (no creds) the loop owns the deterministic mechanics (indexing,
516
+ Both are yours (no creds). The loop owns the deterministic mechanics (indexing,
504
517
  applying write blocks, scoring readiness) and stops once no blocking gap remains.
505
518
 
506
519
  Does the verifying driver actually earn its keep? See
507
520
  [docs/two-agent-research-ab.md](docs/two-agent-research-ab.md) for an equal-compute
508
521
  A/B (9 ML topics, `glm-5.2`): the two-agent loop admits ~2.33 fewer sources per topic
509
- at identical coverage though most of that win is de-duplication, not relevance
522
+ at identical coverage, though most of that win is de-duplication, not relevance
510
523
  filtering. Honest caveats and how to reproduce included.
511
524
 
512
525
  ```ts
@@ -544,7 +557,22 @@ await runTwoAgentResearchLoop({
544
557
 
545
558
  `agent-knowledge` owns knowledge state and measurement.
546
559
  It deliberately does not own an agent runner.
547
- Live agent orchestration belongs in `@tangle-network/agent-runtime`, which can call `improveKnowledgeBase` by passing an `updateKnowledge` callback:
560
+ Live agent orchestration belongs in `@tangle-network/agent-runtime`.
561
+ Use the one-call runtime job when you want agents, candidate workspaces, readiness checks, promotion, and spend measurement wired together:
562
+
563
+ ```ts
564
+ import { runKnowledgeImprovementJob } from '@tangle-network/agent-runtime/knowledge'
565
+
566
+ await runKnowledgeImprovementJob({
567
+ root: './kb',
568
+ goal: 'Build a grounded onboarding wiki for billing support',
569
+ readinessSpecs,
570
+ budget: { maxIterations: 8, maxTokens: 120_000, maxUsd: 10 },
571
+ backend,
572
+ })
573
+ ```
574
+
575
+ Use `improveKnowledgeBase` directly when your product already owns the agent runner and only needs the pure KB mechanics:
548
576
 
549
577
  ```ts
550
578
  import { improveKnowledgeBase } from '@tangle-network/agent-knowledge'
@@ -574,26 +602,26 @@ score = 0.4 · citation_density
574
602
  + 0.2 · gap_coverage
575
603
  ```
576
604
 
577
- The output preserves agent intelligence `items`, `citations`,
605
+ The output preserves agent intelligence: `items`, `citations`,
578
606
  `proposedWrites` are typed; `gaps`, `notes`, and any extras the agent
579
607
  emitted land in `raw` rather than getting dropped.
580
608
 
581
609
  ## Pluggable Knowledge Sources
582
610
 
583
611
  Static knowledge rots. Authorities like Cornell LII, the IRS, and state
584
- Secretaries of State change without warning a ruling vacates an FTC
612
+ Secretaries of State change without warning. A ruling vacates an FTC
585
613
  non-compete rule, a CFR section renumbers, a state replaces Beverly-Killea
586
614
  with RULLCA. The `@tangle-network/agent-knowledge/sources` subpath ships
587
615
  three primitives that bridge "live authority" → "eval re-runs":
588
616
 
589
- - `KnowledgeSource` pluggable contract (`fetch(opts) → KnowledgeFragment[]`).
617
+ - `KnowledgeSource`: pluggable contract (`fetch(opts) → KnowledgeFragment[]`).
590
618
  Every fragment carries `provenance` (URL, source-attested timestamp,
591
619
  jurisdiction, `verifiable` flag) and `dimensionHints` (which eval
592
620
  dimensions a change in this fragment should re-score).
593
- - `KnowledgeFreshnessStore` per-`(workspaceId, sourceId)` last-refresh
621
+ - `KnowledgeFreshnessStore`: per-`(workspaceId, sourceId)` last-refresh
594
622
  tracker. Filesystem adapter ships in-package; D1 / Postgres adapter
595
623
  scaffold is shipped as `createD1FreshnessStoreStub(adapter)`.
596
- - `detectChanges(prev, next)` diffs two fragment snapshots, emits
624
+ - `detectChanges(prev, next)`: diffs two fragment snapshots, emits
597
625
  `KnowledgeChange[]` tagged with the affected eval dimensions so a cron
598
626
  scheduler knows exactly which campaigns to re-run.
599
627
 
@@ -623,7 +651,7 @@ const sources = [
623
651
  publications: ['p15', 'p17', 'p463'],
624
652
  revenueProcedures: [],
625
653
  }),
626
- // Generic state SOS adapter one config per state you need tracked.
654
+ // Generic state SOS adapter: one config per state you need tracked.
627
655
  createStateSosSource({
628
656
  state: 'CA',
629
657
  baseUrl: 'https://www.sos.ca.gov',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-knowledge",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "Source-grounded, eval-gated knowledge growth primitives for agents.",
5
5
  "homepage": "https://github.com/tangle-network/agent-knowledge#readme",
6
6
  "repository": {
@@ -68,7 +68,7 @@
68
68
  "format": "biome format --write src tests"
69
69
  },
70
70
  "dependencies": {
71
- "@tangle-network/agent-eval": "^0.107.0",
71
+ "@tangle-network/agent-eval": "^0.113.0",
72
72
  "zod": "^4.3.6"
73
73
  },
74
74
  "devDependencies": {