@hasna/knowledge 0.2.15 → 0.2.17
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.
- package/README.md +28 -1
- package/bin/open-knowledge-mcp.js +2275 -1643
- package/bin/open-knowledge.js +105 -79
- package/docs/architecture/ai-native-knowledge-base.md +11 -2
- package/docs/architecture/hybrid-semantic-search.md +12 -2
- package/package.json +2 -1
- package/src/agent.ts +367 -0
- package/src/cli.ts +58 -7
- package/src/mcp.js +36 -0
- package/src/providers.ts +1 -1
- package/src/retrieval.ts +326 -0
- package/src/service.ts +20 -0
package/README.md
CHANGED
|
@@ -97,6 +97,11 @@ open-knowledge embeddings search "company wiki policy" --scope project --json
|
|
|
97
97
|
# Hybrid search over source chunks, generated wiki pages, indexes, and optional vectors
|
|
98
98
|
open-knowledge search "company wiki policy" --scope project --json
|
|
99
99
|
open-knowledge search "company wiki policy" --scope project --semantic --json
|
|
100
|
+
open-knowledge search "company wiki policy" --scope project --context --json
|
|
101
|
+
|
|
102
|
+
# Build a citation answer/context draft for a prompt
|
|
103
|
+
open-knowledge ask "How do we cite handbook policy?" --scope project --json
|
|
104
|
+
knowledge "How do we cite handbook policy?" --scope project --json
|
|
100
105
|
```
|
|
101
106
|
|
|
102
107
|
## Commands
|
|
@@ -245,6 +250,7 @@ permission/path/delete metadata, and records a local run ledger.
|
|
|
245
250
|
```bash
|
|
246
251
|
open-knowledge search <query> [--scope project] [--limit <n>] [--json]
|
|
247
252
|
open-knowledge search <query> --semantic [--model openai:text-embedding-3-small] [--scope project] [--json]
|
|
253
|
+
open-knowledge search <query> --context [--semantic] [--scope project] [--json]
|
|
248
254
|
```
|
|
249
255
|
Run hybrid search over `chunks_fts`, generated wiki chunks, wiki/index catalog
|
|
250
256
|
rows, and optional vector results. The default path is local-only keyword and
|
|
@@ -252,6 +258,24 @@ catalog search. `--semantic` embeds the query and merges vector results from
|
|
|
252
258
|
`vector_index_entries`, preserving source refs, artifact URIs, citations,
|
|
253
259
|
revision/hash metadata, and provenance in each structured result.
|
|
254
260
|
|
|
261
|
+
`--context` returns a reranked context pack for agents: selected excerpts,
|
|
262
|
+
assembled citations, freshness and permission notes, graph evidence from
|
|
263
|
+
`citations`/`wiki_backlinks`, and final rerank scores. This is the shape future
|
|
264
|
+
`knowledge <prompt>` flows should send to a model instead of raw search rows.
|
|
265
|
+
|
|
266
|
+
### ask / build
|
|
267
|
+
```bash
|
|
268
|
+
open-knowledge ask <prompt> [--scope project] [--json]
|
|
269
|
+
open-knowledge build <prompt> [--generate] [--model default|provider:model] [--scope project] [--json]
|
|
270
|
+
knowledge <prompt> [--scope project] [--json]
|
|
271
|
+
```
|
|
272
|
+
Build an agent-native prompt run. The command first creates a read-only context
|
|
273
|
+
pack, returns a local citation draft by default, records a run ledger in
|
|
274
|
+
`runs`/`run_events`, and proposes durable wiki updates without writing them.
|
|
275
|
+
`--generate` explicitly calls AI SDK text generation; `--fake --generate` keeps
|
|
276
|
+
the flow deterministic for local tests. `--approve-write` records approval
|
|
277
|
+
intent, but durable wiki writes remain deferred to the wiki compile/write task.
|
|
278
|
+
|
|
255
279
|
### safety
|
|
256
280
|
```bash
|
|
257
281
|
open-knowledge safety status [--scope project] [--json]
|
|
@@ -331,7 +355,10 @@ The MCP server exposes item tools (`ok_add`, `ok_list`, `ok_get`, `ok_update`,
|
|
|
331
355
|
`ok_storage_status`), provider/embedding tools (`ok_provider_status`,
|
|
332
356
|
`ok_provider_models`, `ok_embeddings_status`, `ok_embeddings_index`,
|
|
333
357
|
`ok_semantic_search`), hybrid retrieval (`ok_search`), and source-ref
|
|
334
|
-
parsing/resolution (`ok_parse_source_ref`, `ok_resolve_source`).
|
|
358
|
+
parsing/resolution (`ok_parse_source_ref`, `ok_resolve_source`). The
|
|
359
|
+
`knowledge_search` MCP tool returns reranked citation context packs for agent
|
|
360
|
+
prompts, and `knowledge_ask` runs the same prompt flow exposed by
|
|
361
|
+
`open-knowledge ask`.
|
|
335
362
|
|
|
336
363
|
## Source And Artifact Boundary
|
|
337
364
|
|