@kitakitsune/memoria 0.1.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 ADDED
@@ -0,0 +1,172 @@
1
+ # Memoria
2
+
3
+ Structured memory system for AI agents with local markdown vault and two-way Notion sync.
4
+
5
+ > Local-first. Markdown-first. Notion-synced.
6
+
7
+ ## Requirements
8
+
9
+ - Node.js 18+
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install -g memoria
15
+ ```
16
+
17
+ Or run locally:
18
+
19
+ ```bash
20
+ git clone <repo-url>
21
+ cd memoria
22
+ npm install
23
+ npm run build
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ```bash
29
+ # Initialize a vault
30
+ memoria init ~/memory --name my-brain
31
+
32
+ # Store memories
33
+ memoria remember decision "Use PostgreSQL" --content "Chosen for JSONB and reliability"
34
+ memoria remember lesson "Cache invalidation" --content "TTL-based is simpler than event-driven"
35
+ memoria store inbox "meeting-notes" --content "Discussed Q2 roadmap" --tags "meetings,planning"
36
+
37
+ # Search
38
+ memoria search "postgresql"
39
+
40
+ # List documents
41
+ memoria list
42
+ memoria list decisions
43
+
44
+ # Session lifecycle
45
+ memoria wake
46
+ memoria checkpoint --working-on "auth module" --focus "token refresh"
47
+ memoria sleep "finished auth module" --next "deploy to staging"
48
+
49
+ # Check vault status
50
+ memoria status
51
+ ```
52
+
53
+ ## Notion Integration
54
+
55
+ Memoria syncs your local vault to Notion, giving you a rich UI for browsing and editing memories while keeping local markdown files as the source of truth.
56
+
57
+ ### Setup
58
+
59
+ 1. Create a [Notion integration](https://www.notion.so/my-integrations) and copy the token.
60
+ 2. Create a root page in Notion and share it with your integration.
61
+ 3. Copy the page ID from the URL (the 32-character hex string).
62
+
63
+ ```bash
64
+ memoria setup-notion --token ntn_your_token_here --page abc123def456...
65
+ ```
66
+
67
+ ### Sync
68
+
69
+ ```bash
70
+ # Push local changes to Notion
71
+ memoria sync --push
72
+
73
+ # Pull Notion changes to local
74
+ memoria sync --pull
75
+
76
+ # Two-way sync (default)
77
+ memoria sync
78
+
79
+ # Preview changes without modifying anything
80
+ memoria sync --dry-run
81
+
82
+ # On conflict, prefer Notion's version over local
83
+ memoria sync --pull --prefer-notion
84
+ ```
85
+
86
+ ### How Sync Works
87
+
88
+ - **Push**: Local documents are compared against the last sync state. New or updated files are created/updated in Notion.
89
+ - **Pull**: Notion databases are queried for pages modified since the last sync. Changes are written back to local markdown.
90
+ - **Conflicts**: When both sides have changed, local is preferred by default. Use `--prefer-notion` to override.
91
+ - **Databases**: One Notion database is created per category (decisions, lessons, facts, etc.) under the root page.
92
+
93
+ ## CLI Reference
94
+
95
+ | Command | Description |
96
+ |---------|-------------|
97
+ | `memoria init <path>` | Initialize a new vault |
98
+ | `memoria remember <type> <title>` | Store a typed memory |
99
+ | `memoria store <category> <title>` | Store in explicit category |
100
+ | `memoria search <query>` | Search by text query |
101
+ | `memoria list [category]` | List documents |
102
+ | `memoria get <id>` | Retrieve a document |
103
+ | `memoria wake` | Start a session |
104
+ | `memoria sleep <summary>` | End session with handoff |
105
+ | `memoria checkpoint` | Mid-session snapshot |
106
+ | `memoria status` | Vault stats and session state |
107
+ | `memoria setup-notion` | Configure Notion integration |
108
+ | `memoria sync` | Sync with Notion |
109
+
110
+ ### Memory Types
111
+
112
+ Used with `memoria remember <type>`:
113
+
114
+ - `fact` -- raw information, data points
115
+ - `decision` -- choices made with reasoning
116
+ - `lesson` -- insights, patterns learned
117
+ - `commitment` -- promises, goals, obligations
118
+ - `preference` -- likes, dislikes, how you want things
119
+ - `relationship` -- people, connections
120
+ - `project` -- active work, ongoing efforts
121
+
122
+ Each type maps to a category folder in the vault.
123
+
124
+ ## Vault Structure
125
+
126
+ ```
127
+ ~/memory/
128
+ .memoria.json # vault configuration
129
+ .sync-state.json # Notion sync tracking
130
+ decisions/
131
+ use-postgresql.md
132
+ lessons/
133
+ cache-invalidation.md
134
+ facts/
135
+ ...
136
+ sessions/
137
+ current.md # active session state
138
+ handoffs/
139
+ 2026-02-21.md # session handoff documents
140
+ ```
141
+
142
+ Each document uses YAML frontmatter:
143
+
144
+ ```markdown
145
+ ---
146
+ title: Use PostgreSQL
147
+ type: decision
148
+ tags:
149
+ - database
150
+ - infrastructure
151
+ created: 2026-02-21T10:00:00Z
152
+ updated: 2026-02-21T10:00:00Z
153
+ ---
154
+ Chosen for JSONB support and reliability. Evaluated against MySQL and SQLite.
155
+ ```
156
+
157
+ ## AGENTS.md Integration
158
+
159
+ Add these to your agent's instructions for session-aware memory:
160
+
161
+ ```markdown
162
+ ## Memoria
163
+ - Run `memoria wake` at session start.
164
+ - Run `memoria checkpoint --working-on "<task>"` during heavy work.
165
+ - Run `memoria sleep "<summary>" --next "<next steps>"` before ending.
166
+ - Use `memoria search "<query>"` before complex decisions.
167
+ - Use `memoria remember <type> "<title>" --content "<details>"` for important observations.
168
+ ```
169
+
170
+ ## License
171
+
172
+ MIT
package/bin/memoria.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { run } from '../dist/cli/index.js';
3
+ run().catch((err) => {
4
+ console.error(err.message || err);
5
+ process.exit(1);
6
+ });