@ivotoby/postgram-cli 1.37.2 → 1.37.3
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 +19 -2
- package/dist/pgm.js +5 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,13 +75,30 @@ pgm queue
|
|
|
75
75
|
pgm store "hello" --json
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
Search retrieves both semantic vector neighbors and chunks matching query
|
|
79
|
+
keywords. Whitespace-separated terms are ORed; each term's `simple` lexemes
|
|
80
|
+
are ANDed, preserving compound identifiers such as `ABC-1234`. For multi-term
|
|
81
|
+
queries, standalone English stopwords are omitted using the English dictionary;
|
|
82
|
+
matching and ranking still use the `simple` configuration. This lets a chunk
|
|
83
|
+
matching one complete term enter the bounded candidate set for a long query.
|
|
84
|
+
It deduplicates chunks and ranks the candidates with reciprocal-rank fusion
|
|
85
|
+
(RRF): `1 / (60 + vector_rank) + 1 / (60 + keyword_rank)`, with a missing
|
|
86
|
+
branch contributing zero. The `--threshold` value is a cosine similarity
|
|
87
|
+
floor; below-floor keyword matches need at least half of the retained distinct
|
|
88
|
+
query terms, rounded up. A single-term query, including a compound identifier,
|
|
89
|
+
requires its one retained term.
|
|
90
|
+
Human-readable scores are relative RRF values, printed with six decimal places,
|
|
91
|
+
and are not percentages. A candidate ranked first in both branches scores about
|
|
92
|
+
`0.03279` before recency. Equal final scores prefer the lower keyword rank,
|
|
93
|
+
then vector rank, then stable identifiers.
|
|
94
|
+
|
|
78
95
|
Agent-facing `--json` output is compact by default for search, list, task list,
|
|
79
96
|
graph expansion, write acknowledgements, and link acknowledgements. Search
|
|
80
|
-
returns identifiers, scores, matched chunks, tags, and edge summaries without
|
|
97
|
+
returns identifiers, numeric RRF scores, matched chunks, tags, and edge summaries without
|
|
81
98
|
complete result or graph-neighbor content. Select an ID from those chunks and
|
|
82
99
|
use `pgm recall <id>` when complete content is needed. Other compact outputs
|
|
83
100
|
omit token-heavy fields such as timestamps, metadata, nested `entity` objects,
|
|
84
|
-
and raw similarity unless you pass `--full-response`. Use `--toon` on list-like
|
|
101
|
+
and raw cosine similarity unless you pass `--full-response`. Use `--toon` on list-like
|
|
85
102
|
commands (`search`, `list`, `task list`, `expand`) when an agent needs the
|
|
86
103
|
smallest readable output. TOON and compacting are CLI-layer formats; the
|
|
87
104
|
Postgram API remains JSON.
|
package/dist/pgm.js
CHANGED
|
@@ -37,7 +37,7 @@ function formatSearchResults(results) {
|
|
|
37
37
|
}
|
|
38
38
|
const lines = [];
|
|
39
39
|
for (const result of results) {
|
|
40
|
-
lines.push(`${result.entity.type} ${shortId(result.entity.id)} score=${result.score.toFixed(
|
|
40
|
+
lines.push(`${result.entity.type} ${shortId(result.entity.id)} score=${result.score.toFixed(6)}`);
|
|
41
41
|
lines.push(` ${result.chunk_content}`);
|
|
42
42
|
if (result.related && result.related.length > 0) {
|
|
43
43
|
lines.push(` related (${result.related.length}):`);
|
|
@@ -292,15 +292,16 @@ program
|
|
|
292
292
|
});
|
|
293
293
|
program
|
|
294
294
|
.command('search')
|
|
295
|
-
.description('
|
|
295
|
+
.description('Hybrid vector + keyword search over stored entity chunks.')
|
|
296
|
+
.addHelpText('after', '\nRRF scores use 1/(60+vector_rank) + 1/(60+keyword_rank); a missing branch contributes zero. Scores are relative numbers (about 0.03279 when ranked first in both branches before recency), not percentages. --threshold is a cosine similarity floor; keyword chunks covering at least half the keyword terms (rounded up) may pass below it. A single-term query, including a compound identifier, requires its one retained term. Whitespace-separated keyword terms are ORed, while simple lexemes within each term are ANDed so compound identifiers such as ABC-1234 remain intact. Keyword parsing retains the first 24 distinct non-empty terms after multi-term English stopword filtering; embedding uses the full original query.\n')
|
|
296
297
|
.argument('query', 'search query')
|
|
297
298
|
.option('--type <type>', 'entity type')
|
|
298
299
|
.option('--tags <tags>', 'comma-separated tags')
|
|
299
300
|
.option('--visibility <visibility>', 'entity visibility filter')
|
|
300
301
|
.option('--owner <owner>', 'entity owner filter')
|
|
301
302
|
.option('--limit <limit>', 'result limit', '10')
|
|
302
|
-
.option('--threshold <threshold>', 'similarity
|
|
303
|
-
.option('--recency-weight <recencyWeight>', 'recency
|
|
303
|
+
.option('--threshold <threshold>', 'cosine similarity floor; below-floor keyword chunks need at least half the keyword terms', '0.35')
|
|
304
|
+
.option('--recency-weight <recencyWeight>', 'recency multiplier (RRF score uses a 30-day half-life)', '0.1')
|
|
304
305
|
.option('--expand-graph', 'include graph-connected entities in results')
|
|
305
306
|
.option('--include-archived', 'include archived entities in results')
|
|
306
307
|
.option('--memory-role <role>', 'memory role filter: session_context for continuity; durable_memory for stable facts')
|