@ivotoby/postgram-cli 1.36.1 → 1.37.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.
- package/README.md +13 -7
- package/dist/pgm.js +4 -7
- package/dist/search-output.js +4 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,10 +31,11 @@ pgm store "decided to use pgvector" --type memory --tags "decisions,architecture
|
|
|
31
31
|
# Search with human output
|
|
32
32
|
pgm search "pgvector decisions" --limit 5
|
|
33
33
|
|
|
34
|
-
# Agent-friendly
|
|
35
|
-
pgm search "pgvector decisions" --json
|
|
36
|
-
pgm search "pgvector decisions" --
|
|
37
|
-
pgm
|
|
34
|
+
# Agent-friendly discovery, then selective full retrieval
|
|
35
|
+
pgm search "pgvector decisions" --limit 5 --json # matched chunks by default
|
|
36
|
+
pgm search "pgvector decisions" --limit 5 --toon # smallest discovery output
|
|
37
|
+
pgm recall <selected-entity-id> # complete selected content
|
|
38
|
+
pgm search "pgvector decisions" --json --full-response # complete legacy response
|
|
38
39
|
pgm list --json # compact JSON rows
|
|
39
40
|
pgm list --json --full-response # full API-shaped rows
|
|
40
41
|
pgm list --toon # compact TOON rows
|
|
@@ -75,9 +76,12 @@ pgm store "hello" --json
|
|
|
75
76
|
```
|
|
76
77
|
|
|
77
78
|
Agent-facing `--json` output is compact by default for search, list, task list,
|
|
78
|
-
graph expansion, write acknowledgements, and link acknowledgements.
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
graph expansion, write acknowledgements, and link acknowledgements. Search
|
|
80
|
+
returns identifiers, scores, matched chunks, tags, and edge summaries without
|
|
81
|
+
complete result or graph-neighbor content. Select an ID from those chunks and
|
|
82
|
+
use `pgm recall <id>` when complete content is needed. Other compact outputs
|
|
83
|
+
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
|
|
81
85
|
commands (`search`, `list`, `task list`, `expand`) when an agent needs the
|
|
82
86
|
smallest readable output. TOON and compacting are CLI-layer formats; the
|
|
83
87
|
Postgram API remains JSON.
|
|
@@ -93,6 +97,8 @@ Compact search may include an `edges` summary:
|
|
|
93
97
|
|
|
94
98
|
`edges.count` and `edges.relations` are traversal affordances. They tell an
|
|
95
99
|
agent that graph context exists without returning neighbor content. Use
|
|
100
|
+
`--full-response` only when a machine consumer needs the complete legacy search
|
|
101
|
+
envelope, not as a substitute for recalling one selected result. Use
|
|
96
102
|
`--expand-graph` or `pgm expand <entity-id>` when the user asks about causes,
|
|
97
103
|
provenance, decisions, dependencies, blockers, ownership, involvement,
|
|
98
104
|
discussion participants, connected context, or ambiguous search hits. Do not
|
package/dist/pgm.js
CHANGED
|
@@ -39,10 +39,6 @@ function formatSearchResults(results) {
|
|
|
39
39
|
for (const result of results) {
|
|
40
40
|
lines.push(`${result.entity.type} ${shortId(result.entity.id)} score=${result.score.toFixed(3)}`);
|
|
41
41
|
lines.push(` ${result.chunk_content}`);
|
|
42
|
-
if (result.entity.content &&
|
|
43
|
-
result.entity.content !== result.chunk_content) {
|
|
44
|
-
lines.push(` entity: ${result.entity.content}`);
|
|
45
|
-
}
|
|
46
42
|
if (result.related && result.related.length > 0) {
|
|
47
43
|
lines.push(` related (${result.related.length}):`);
|
|
48
44
|
for (const rel of result.related) {
|
|
@@ -296,7 +292,7 @@ program
|
|
|
296
292
|
});
|
|
297
293
|
program
|
|
298
294
|
.command('search')
|
|
299
|
-
.description('Search stored entities (
|
|
295
|
+
.description('Search stored entities (chunks by default; full content with --json --full-response)')
|
|
300
296
|
.argument('query', 'search query')
|
|
301
297
|
.option('--type <type>', 'entity type')
|
|
302
298
|
.option('--tags <tags>', 'comma-separated tags')
|
|
@@ -308,7 +304,7 @@ program
|
|
|
308
304
|
.option('--expand-graph', 'include graph-connected entities in results')
|
|
309
305
|
.option('--include-archived', 'include archived entities in results')
|
|
310
306
|
.option('--memory-role <role>', 'memory role filter: session_context for continuity; durable_memory for stable facts')
|
|
311
|
-
.option('--full-response', 'emit the full API response
|
|
307
|
+
.option('--full-response', 'emit the full API response with complete entity content when used with --json')
|
|
312
308
|
.option('--toon', 'emit compact TOON output for lower agent token use; formatting is applied in the CLI, not the API')
|
|
313
309
|
.action(async (query, options, command) => {
|
|
314
310
|
await runWithClient(command, async (client, json) => {
|
|
@@ -330,7 +326,8 @@ program
|
|
|
330
326
|
recency_weight: Number(options.recencyWeight),
|
|
331
327
|
expand_graph: options.expandGraph === true ? true : undefined,
|
|
332
328
|
include_archived: options.includeArchived === true ? true : undefined,
|
|
333
|
-
memory_role: options.memoryRole
|
|
329
|
+
memory_role: options.memoryRole,
|
|
330
|
+
include_content: options.fullResponse === true
|
|
334
331
|
});
|
|
335
332
|
if (options.toon === true) {
|
|
336
333
|
return searchResponseToToon(compactSearchResponse(body));
|
package/dist/search-output.js
CHANGED
|
@@ -57,7 +57,6 @@ export function compactSearchResponse(response) {
|
|
|
57
57
|
id: entry.entity.id,
|
|
58
58
|
type: entry.entity.type,
|
|
59
59
|
score: entry.score,
|
|
60
|
-
content: entry.entity.content,
|
|
61
60
|
chunk: entry.chunk_content,
|
|
62
61
|
...(entry.entity.tags?.length ? { tags: entry.entity.tags } : {}),
|
|
63
62
|
...(entry.edges ? { edges: entry.edges } : {}),
|
|
@@ -67,8 +66,7 @@ export function compactSearchResponse(response) {
|
|
|
67
66
|
id: related.entity.id,
|
|
68
67
|
type: related.entity.type,
|
|
69
68
|
relation: related.relation,
|
|
70
|
-
direction: related.direction
|
|
71
|
-
content: related.entity.content
|
|
69
|
+
direction: related.direction
|
|
72
70
|
}))
|
|
73
71
|
}
|
|
74
72
|
: {})
|
|
@@ -110,7 +108,7 @@ function formatEdgeSummary(edges) {
|
|
|
110
108
|
}
|
|
111
109
|
export function searchResponseToToon(response) {
|
|
112
110
|
const lines = [
|
|
113
|
-
`results[${response.results.length}]{id,type,score,
|
|
111
|
+
`results[${response.results.length}]{id,type,score,chunk,tags,edges,related}:`
|
|
114
112
|
];
|
|
115
113
|
for (const result of response.results) {
|
|
116
114
|
lines.push([
|
|
@@ -119,7 +117,6 @@ export function searchResponseToToon(response) {
|
|
|
119
117
|
Number.isFinite(result.score)
|
|
120
118
|
? Number(result.score.toFixed(6))
|
|
121
119
|
: result.score,
|
|
122
|
-
result.content,
|
|
123
120
|
result.chunk,
|
|
124
121
|
result.tags,
|
|
125
122
|
formatEdgeSummary(result.edges),
|
|
@@ -128,14 +125,13 @@ export function searchResponseToToon(response) {
|
|
|
128
125
|
.map(toonScalar)
|
|
129
126
|
.join(','));
|
|
130
127
|
if (result.related?.length) {
|
|
131
|
-
lines.push(` related[${result.related.length}]{id,type,relation,direction
|
|
128
|
+
lines.push(` related[${result.related.length}]{id,type,relation,direction}:`);
|
|
132
129
|
for (const related of result.related) {
|
|
133
130
|
lines.push(` ${[
|
|
134
131
|
related.id,
|
|
135
132
|
related.type,
|
|
136
133
|
related.relation,
|
|
137
|
-
related.direction
|
|
138
|
-
related.content
|
|
134
|
+
related.direction
|
|
139
135
|
]
|
|
140
136
|
.map(toonScalar)
|
|
141
137
|
.join(',')}`);
|