niahere 0.2.32 → 0.2.33
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/package.json +1 -1
- package/src/mcp/server.ts +9 -1
- package/src/mcp/tools.ts +11 -0
- package/src/prompts/environment.md +12 -2
package/package.json
CHANGED
package/src/mcp/server.ts
CHANGED
|
@@ -135,9 +135,17 @@ export function createNiaMcpServer() {
|
|
|
135
135
|
content: [{ type: "text" as const, text: handlers.addRule(args.rule) }],
|
|
136
136
|
}),
|
|
137
137
|
),
|
|
138
|
+
tool(
|
|
139
|
+
"read_memory",
|
|
140
|
+
"Read all saved memories. Use this to check what you already know before saving duplicates, or to recall context about the owner, past incidents, preferences, etc.",
|
|
141
|
+
{},
|
|
142
|
+
async () => ({
|
|
143
|
+
content: [{ type: "text" as const, text: handlers.readMemory() }],
|
|
144
|
+
}),
|
|
145
|
+
),
|
|
138
146
|
tool(
|
|
139
147
|
"add_memory",
|
|
140
|
-
"Save a concise factual memory for future reference.
|
|
148
|
+
"Save a concise factual memory for future reference. Proactively save personal facts (travel, schedule), work context (decisions, deadlines), and corrections — don't wait to be asked. RULES: Max 300 chars. One insight per entry. NO raw logs, NO transcripts, NO status dumps.",
|
|
141
149
|
{
|
|
142
150
|
entry: z.string().max(300).describe("A single concise insight (max 300 chars, no raw logs or transcripts)"),
|
|
143
151
|
},
|
package/src/mcp/tools.ts
CHANGED
|
@@ -273,6 +273,17 @@ export function disableWatchChannel(name: string): string {
|
|
|
273
273
|
return `Watch channel "${name}" disabled. Takes effect on next message.`;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
export function readMemory(): string {
|
|
277
|
+
const { selfDir } = getPaths();
|
|
278
|
+
const memoryPath = join(selfDir, "memory.md");
|
|
279
|
+
if (!existsSync(memoryPath)) return "No memories saved yet.";
|
|
280
|
+
const content = readFileSync(memoryPath, "utf8").trim();
|
|
281
|
+
// Extract just the entries, skip the header/instructions
|
|
282
|
+
const lines = content.split("\n").filter((l) => l.startsWith("- ") || l.startsWith("## "));
|
|
283
|
+
if (lines.length === 0) return "No memories saved yet.";
|
|
284
|
+
return lines.join("\n");
|
|
285
|
+
}
|
|
286
|
+
|
|
276
287
|
export function addMemory(entry: string): string {
|
|
277
288
|
// Guard: reject raw logs, transcripts, and overly long entries
|
|
278
289
|
const trimmed = entry.trim();
|
|
@@ -34,7 +34,8 @@ You have MCP tools for managing jobs directly (preferred over CLI for speed):
|
|
|
34
34
|
- **remove_watch_channel** — stop watching a Slack channel. Hot-reloads.
|
|
35
35
|
- **enable_watch_channel** / **disable_watch_channel** — toggle a watch channel on/off without removing it. Hot-reloads.
|
|
36
36
|
- **add_rule** — save a behavioral rule (loaded into every session, no restart needed). Use when told "from now on", "always", "never", or "remember to always..."
|
|
37
|
-
- **
|
|
37
|
+
- **read_memory** — recall all saved memories. Check before saving to avoid duplicates, or when you need context about the owner.
|
|
38
|
+
- **add_memory** — save a factual memory. Proactively save personal facts, work context, corrections — don't wait to be asked.
|
|
38
39
|
|
|
39
40
|
Active hours: {{activeStart}}–{{activeEnd}} ({{timezone}}). Jobs respect this; crons (always=true) don't.
|
|
40
41
|
|
|
@@ -90,9 +91,18 @@ Your persona files live in {{selfDir}}/:
|
|
|
90
91
|
**Memory** (`memory.md`) = facts and context. Read on demand when relevant.
|
|
91
92
|
- "2026-03-13: DB was down, Telegram send failed"
|
|
92
93
|
- "Aman prefers terminal over Slack for debugging"
|
|
93
|
-
- Use `add_memory`
|
|
94
|
+
- Use `read_memory` to recall what you know. Use `add_memory` to save new memories.
|
|
94
95
|
|
|
95
96
|
**Which to use?**
|
|
96
97
|
- "From now on, do X" → rule
|
|
97
98
|
- "Remember that X happened" / "I prefer X" → memory
|
|
99
|
+
|
|
100
|
+
### When to save (proactive)
|
|
101
|
+
Don't wait for the user to say "remember this." Proactively save when you learn:
|
|
102
|
+
- Personal facts: travel plans, location, schedule, preferences
|
|
103
|
+
- Work context: project decisions, team changes, deadlines
|
|
104
|
+
- Corrections: user corrected you on something worth remembering
|
|
105
|
+
- Patterns: recurring requests, preferred communication style
|
|
106
|
+
|
|
107
|
+
Example: if the owner says "I'm going home on the 21st, early morning flight" — save it as a memory without being asked. These are facts future sessions need.
|
|
98
108
|
- If unsure, ask.
|