@postnesia/cli 0.1.4 → 0.1.6
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 +30 -97
- package/dist/index.js +6 -6
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,117 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @postnesia/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Commander CLI for the Postnesia memory system. A like-for-like interface over the MCP tools for use when no MCP connection is available.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
|
|
9
|
-
npm install
|
|
10
|
-
npm run db:generate
|
|
8
|
+
npx postnesia <command> [options]
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Requires `DATABASE_URL` and `GEMINI_API_KEY` in a `.env` file in your working directory, or set as environment variables.
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
## Commands
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
"mcpServers": {
|
|
20
|
-
"postnesia": {
|
|
21
|
-
"command": "/absolute/path/to/tsx",
|
|
22
|
-
"env": {
|
|
23
|
-
"DATABASE_URL": "file:/absolute/path/to/memory.db",
|
|
24
|
-
"GEMINI_API_KEY": "token-for-gemini-embedding-model-api"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Or use npm script:
|
|
15
|
+
### Memory
|
|
32
16
|
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
17
|
+
```bash
|
|
18
|
+
postnesia memory search "<query>" [--limit N]
|
|
19
|
+
postnesia memory add "<content>" --type <type> --importance <1-5> --tags "<t1,t2>" [--content-l1 "<summary>"] [--context "<ctx>"] [--core]
|
|
20
|
+
postnesia memory update-core <id> --content "<content>" --content-l1 "<summary>"
|
|
21
|
+
postnesia memory recent [--hours N] [--limit N]
|
|
22
|
+
postnesia memory stats
|
|
23
|
+
postnesia memory consolidate
|
|
24
|
+
postnesia memory relationships <id>
|
|
45
25
|
```
|
|
46
26
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### memory_search
|
|
50
|
-
Semantic search across memories.
|
|
51
|
-
- `query` (required): Search text
|
|
52
|
-
- `maxResults` (optional): Max results (default: 10)
|
|
53
|
-
- `minScore` (optional): Min similarity 0-1 (default: 0.3)
|
|
54
|
-
|
|
55
|
-
### memory_add
|
|
56
|
-
Create a new memory.
|
|
57
|
-
- `content` (required): Full memory text
|
|
58
|
-
- `contentL1` (optional): Compressed form
|
|
59
|
-
- `type` (required): event|decision|lesson|preference|person|technical
|
|
60
|
-
- `importance` (required): 1-5
|
|
61
|
-
- `tags` (required): Array of tags
|
|
62
|
-
- `context` (optional): Creation context
|
|
63
|
-
|
|
64
|
-
### memory_recent
|
|
65
|
-
Get recent memories.
|
|
66
|
-
- `hours` (optional): Hours to look back (default: 24)
|
|
67
|
-
- `limit` (optional): Max results (default: 20)
|
|
68
|
-
|
|
69
|
-
### memory_context
|
|
70
|
-
Get contextually related memories.
|
|
71
|
-
- `query` (required): Context query
|
|
72
|
-
- `maxResults` (optional): Max results (default: 5)
|
|
73
|
-
|
|
74
|
-
### memory_stats
|
|
75
|
-
Get database statistics. No parameters.
|
|
27
|
+
**Memory types:** `event` `decision` `lesson` `preference` `person` `technical`
|
|
76
28
|
|
|
77
|
-
###
|
|
78
|
-
Run consolidation cycle (decay + boost). No parameters - always applies changes.
|
|
29
|
+
### Journal
|
|
79
30
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
- `learned` (optional): What I learned
|
|
85
|
-
- `learnedAboutRye` (optional): What I learned about Rye
|
|
86
|
-
- `keyMoments` (optional): Key moments
|
|
87
|
-
- `mood` (optional): Mood/feeling
|
|
88
|
-
|
|
89
|
-
### journal_recent
|
|
90
|
-
Get recent journal entries.
|
|
91
|
-
- `days` (optional): Days to look back (default: 7)
|
|
92
|
-
|
|
93
|
-
### memory_relationships
|
|
94
|
-
View relationship graph for a memory.
|
|
95
|
-
- `memoryId` (required): Memory ID to explore
|
|
96
|
-
|
|
97
|
-
## Access Tracking
|
|
98
|
-
|
|
99
|
-
All read operations (search, recent, context) automatically log accesses, which feed into the importance dynamics system.
|
|
100
|
-
|
|
101
|
-
## Testing
|
|
31
|
+
```bash
|
|
32
|
+
postnesia journal add <YYYY-MM-DD> "<content>" [--learned "..."] [--learned-about-rye "..."] [--key-moments "..."] [--mood "..."]
|
|
33
|
+
postnesia journal recent [--days N]
|
|
34
|
+
```
|
|
102
35
|
|
|
103
|
-
|
|
36
|
+
### Tasks
|
|
104
37
|
|
|
105
38
|
```bash
|
|
106
|
-
|
|
39
|
+
postnesia task create "<title>" [-d "<description>"] [-s <session-id>] [-m <memory-id>]
|
|
40
|
+
postnesia task update <id> [-s <status>] [-t "<title>"] [-d "<description>"]
|
|
41
|
+
postnesia task list [--status <status>] [--session-id <id>] [-l N]
|
|
107
42
|
```
|
|
108
43
|
|
|
109
|
-
|
|
44
|
+
**Task statuses:** `pending` `in_progress` `completed` `cancelled`
|
|
110
45
|
|
|
111
|
-
##
|
|
46
|
+
## Notes
|
|
112
47
|
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
- Relationship graph support
|
|
117
|
-
- Journal integration
|
|
48
|
+
- `memory search` uses Gemini vector embeddings — `GEMINI_API_KEY` is required
|
|
49
|
+
- `memory add` and `memory update-core` also embed content before writing
|
|
50
|
+
- Output is JSON for list/search commands; plain text for mutations
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import 'dotenv/config';
|
|
|
8
8
|
import { Command } from 'commander';
|
|
9
9
|
import { getDb, queries, createMemory } from '@postnesia/db';
|
|
10
10
|
import { embed } from '@postnesia/db/embeddings';
|
|
11
|
-
import { logAccess } from '@postnesia/
|
|
12
|
-
import { runConsolidation } from '@postnesia/
|
|
11
|
+
import { logAccess } from '@postnesia/db/access';
|
|
12
|
+
import { runConsolidation } from '@postnesia/db/importance';
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
// Bootstrap
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
@@ -27,10 +27,10 @@ memory
|
|
|
27
27
|
.command('search <query>')
|
|
28
28
|
.description('Search memories by content')
|
|
29
29
|
.option('-l, --limit <n>', 'Max results', '10')
|
|
30
|
-
.action((query, opts) => {
|
|
30
|
+
.action(async (query, opts) => {
|
|
31
31
|
const limit = parseInt(opts.limit, 10);
|
|
32
|
-
const
|
|
33
|
-
const results = queries.
|
|
32
|
+
const embedding = await embed(query);
|
|
33
|
+
const results = queries.vectorSearch(db).all(Buffer.from(embedding.buffer), limit);
|
|
34
34
|
for (const r of results)
|
|
35
35
|
logAccess(r.id, 'search');
|
|
36
36
|
process.stdout.write(JSON.stringify(results, null, 2) + '\n');
|
|
@@ -61,7 +61,7 @@ memory
|
|
|
61
61
|
tags,
|
|
62
62
|
embedding,
|
|
63
63
|
});
|
|
64
|
-
process.stdout.write(`✓ Created memory #${id}\n Type: ${opts.type}\n Core: ${core ? 'yes' : 'no'}\n Importance: ${
|
|
64
|
+
process.stdout.write(`✓ Created memory #${id}\n Type: ${opts.type}\n Core: ${core ? 'yes' : 'no'}\n Importance: ${importance}/5\n Tags: ${tags.join(', ')}\n`);
|
|
65
65
|
});
|
|
66
66
|
memory
|
|
67
67
|
.command('update-core <memoryId>')
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postnesia/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Commander CLI for Postnesia — direct tool access for agents",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"private": false,
|
|
6
7
|
"files": [
|
|
7
8
|
"dist"
|
|
8
9
|
],
|
|
@@ -10,8 +11,7 @@
|
|
|
10
11
|
"postnesia": "./dist/index.js"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
13
|
-
"@postnesia/db": "^0.1.
|
|
14
|
-
"@postnesia/mcp": "^0.1.4",
|
|
14
|
+
"@postnesia/db": "^0.1.5",
|
|
15
15
|
"commander": "^14.0.3",
|
|
16
16
|
"dotenv": "^17.3.1"
|
|
17
17
|
},
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"typescript": "^5.7.3"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "tsc -p tsconfig.json",
|
|
24
|
+
"build": "pnpm clean && tsc -p tsconfig.json",
|
|
25
|
+
"clean": "rm -rf ./dist",
|
|
25
26
|
"start": "tsx src/index.ts"
|
|
26
27
|
}
|
|
27
28
|
}
|