abmind 0.1.8-alpha.9 → 0.2.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/config/.env.memory.example +0 -1
- package/dist/cli/abmind-doctor.js +49 -2
- package/dist/cli/abmind-doctor.js.map +1 -1
- package/dist/cli/abmind-hook-wakeup.js +16 -7
- package/dist/cli/abmind-hook-wakeup.js.map +1 -1
- package/dist/cli/abmind-install.js +24 -1
- package/dist/cli/abmind-install.js.map +1 -1
- package/dist/cli/abmind-passwd.js +10 -10
- package/dist/cli/abmind-passwd.js.map +1 -1
- package/dist/cli/abmind-recall.js +8 -0
- package/dist/cli/abmind-recall.js.map +1 -1
- package/dist/cli/abmind-restore.js +20 -0
- package/dist/cli/abmind-restore.js.map +1 -1
- package/dist/cli/abmind-sleep.js +21 -1
- package/dist/cli/abmind-sleep.js.map +1 -1
- package/dist/cli/abmind-update.js +14 -1
- package/dist/cli/abmind-update.js.map +1 -1
- package/dist/cli/abmind.js +13 -1
- package/dist/cli/abmind.js.map +1 -1
- package/dist/src/backup.d.ts.map +1 -1
- package/dist/src/backup.js +26 -2
- package/dist/src/backup.js.map +1 -1
- package/dist/src/citation-detector.d.ts +14 -0
- package/dist/src/citation-detector.d.ts.map +1 -0
- package/dist/src/citation-detector.js +64 -0
- package/dist/src/citation-detector.js.map +1 -0
- package/dist/src/deploy-lib/manifest.d.ts +2 -0
- package/dist/src/deploy-lib/manifest.d.ts.map +1 -1
- package/dist/src/deploy-lib/manifest.js.map +1 -1
- package/dist/src/emotion-arc.d.ts +1 -1
- package/dist/src/emotion-arc.d.ts.map +1 -1
- package/dist/src/emotion-utils.d.ts +2 -0
- package/dist/src/emotion-utils.d.ts.map +1 -1
- package/dist/src/emotion-utils.js.map +1 -1
- package/dist/src/ensure-initialized.d.ts.map +1 -1
- package/dist/src/ensure-initialized.js +11 -3
- package/dist/src/ensure-initialized.js.map +1 -1
- package/dist/src/imemory-system.d.ts +1 -1
- package/dist/src/imemory-system.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mem-types.d.ts +5 -0
- package/dist/src/mem-types.d.ts.map +1 -1
- package/dist/src/memory-db.d.ts.map +1 -1
- package/dist/src/memory-db.js +2 -29
- package/dist/src/memory-db.js.map +1 -1
- package/dist/src/memory-editor.d.ts.map +1 -1
- package/dist/src/memory-editor.js +20 -4
- package/dist/src/memory-editor.js.map +1 -1
- package/dist/src/memory-index.d.ts +4 -0
- package/dist/src/memory-index.d.ts.map +1 -1
- package/dist/src/memory-index.js +26 -0
- package/dist/src/memory-index.js.map +1 -1
- package/dist/src/memory-ipc-client.d.ts +2 -0
- package/dist/src/memory-ipc-client.d.ts.map +1 -1
- package/dist/src/memory-ipc-client.js +12 -2
- package/dist/src/memory-ipc-client.js.map +1 -1
- package/dist/src/memory-ipc-server.d.ts +3 -0
- package/dist/src/memory-ipc-server.d.ts.map +1 -1
- package/dist/src/memory-ipc-server.js +9 -1
- package/dist/src/memory-ipc-server.js.map +1 -1
- package/dist/src/memory-manager.d.ts +9 -1
- package/dist/src/memory-manager.d.ts.map +1 -1
- package/dist/src/memory-manager.js +34 -11
- package/dist/src/memory-manager.js.map +1 -1
- package/dist/src/message-store.d.ts +9 -2
- package/dist/src/message-store.d.ts.map +1 -1
- package/dist/src/message-store.js +13 -2
- package/dist/src/message-store.js.map +1 -1
- package/dist/src/recall-engine.d.ts.map +1 -1
- package/dist/src/recall-engine.js +38 -1
- package/dist/src/recall-engine.js.map +1 -1
- package/dist/src/session-context.d.ts +12 -3
- package/dist/src/session-context.d.ts.map +1 -1
- package/dist/src/session-context.js +68 -38
- package/dist/src/session-context.js.map +1 -1
- package/dist/src/status-block.d.ts.map +1 -1
- package/dist/src/status-block.js +16 -0
- package/dist/src/status-block.js.map +1 -1
- package/package.json +3 -3
- package/prompts/sleep/05-contradiction-and-graph.md +2 -0
- package/templates/core/SOUL.md +1 -1
- package/templates/core/agent_notes.md +3 -4
- package/templates/core/memory-tools.md +21 -2
- package/dist/src/emotion-tagger.d.ts +0 -8
- package/dist/src/emotion-tagger.d.ts.map +0 -1
- package/dist/src/emotion-tagger.js +0 -45
- package/dist/src/emotion-tagger.js.map +0 -1
|
@@ -2,53 +2,56 @@ import { localTime, localDateTime } from "./local-time.js";
|
|
|
2
2
|
import { getAbmindEnv } from "./env-schema.js";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { readdirSync, readFileSync } from "node:fs";
|
|
5
|
-
export const
|
|
5
|
+
export const SESSION_HISTORY_MIN_PAIRS = 8;
|
|
6
6
|
/**
|
|
7
7
|
* Build session-start context for injection after /new, /reset, or restart.
|
|
8
|
-
* Budget-based interleaved fill: dailies + recent
|
|
8
|
+
* Budget-based interleaved fill: dailies + recent message pairs (#615, #867).
|
|
9
9
|
*/
|
|
10
10
|
export function buildSessionStartContext(memory, userId, maxContext, opts) {
|
|
11
11
|
const env = getAbmindEnv();
|
|
12
12
|
const ctxWindow = maxContext ?? 128000;
|
|
13
|
-
const pct = parseFloat(process.env["SESSION_HISTORY_PCT"] ?? "
|
|
14
|
-
const
|
|
15
|
-
const cap = parseInt(process.env["SESSION_HISTORY_CAP"] ?? "
|
|
13
|
+
const pct = parseFloat(process.env["SESSION_HISTORY_PCT"] ?? "5");
|
|
14
|
+
const minPairs = parseInt(process.env["SESSION_HISTORY_MIN_PAIRS"] ?? "8", 10);
|
|
15
|
+
const cap = parseInt(process.env["SESSION_HISTORY_CAP"] ?? "50000", 10);
|
|
16
16
|
const budget = Math.min(Math.floor(ctxWindow * pct / 100), cap);
|
|
17
17
|
// --- Load sources ---
|
|
18
|
-
let
|
|
19
|
-
// Age filter
|
|
18
|
+
let pairs = opts?.skipMessages ? [] : loadRecentPairs(memory, minPairs + 50);
|
|
19
|
+
// Age filter
|
|
20
20
|
if (opts?.maxAgeMs) {
|
|
21
21
|
const cutoff = Date.now() - opts.maxAgeMs;
|
|
22
|
-
|
|
22
|
+
pairs = pairs.filter(p => p.user.timestamp >= cutoff);
|
|
23
23
|
}
|
|
24
24
|
const dailies = opts?.skipDailies ? [] : loadDailySummaries(memory.getConfig().memoryDir, 14);
|
|
25
|
-
// --- Floor:
|
|
26
|
-
const
|
|
25
|
+
// --- Floor: minPairs newest pairs + 1 daily (mandatory) ---
|
|
26
|
+
const pairBucket = [];
|
|
27
27
|
const dailyBucket = [];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
recentBucket.push(formatMessage(recentRows[i]));
|
|
28
|
+
const floorStart = Math.max(0, pairs.length - minPairs);
|
|
29
|
+
for (let i = floorStart; i < pairs.length; i++) {
|
|
30
|
+
pairBucket.push(formatPair(pairs[i]));
|
|
32
31
|
}
|
|
33
|
-
// Floor daily
|
|
34
32
|
if (dailies.length > 0) {
|
|
35
33
|
dailyBucket.push(dailies[0].content);
|
|
36
34
|
}
|
|
37
|
-
let used =
|
|
38
|
-
// --- Enrichment
|
|
39
|
-
let
|
|
35
|
+
let used = pairBucket.join("\n").length + dailyBucket.join("\n").length;
|
|
36
|
+
// --- Enrichment: 2 pairs + 1 daily per cycle, fill backward within budget ---
|
|
37
|
+
let pairCursor = floorStart - 1;
|
|
40
38
|
let dailyCursor = 1;
|
|
41
39
|
while (used < budget) {
|
|
42
40
|
let added = false;
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
// 2 pairs
|
|
42
|
+
for (let i = 0; i < 2 && pairCursor >= 0; i++) {
|
|
43
|
+
const line = formatPair(pairs[pairCursor]);
|
|
45
44
|
if (used + line.length <= budget) {
|
|
46
|
-
|
|
45
|
+
pairBucket.unshift(line);
|
|
47
46
|
used += line.length;
|
|
48
|
-
|
|
47
|
+
pairCursor--;
|
|
49
48
|
added = true;
|
|
50
49
|
}
|
|
50
|
+
else {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
51
53
|
}
|
|
54
|
+
// 1 daily
|
|
52
55
|
if (dailyCursor < dailies.length) {
|
|
53
56
|
const entry = dailies[dailyCursor].content;
|
|
54
57
|
if (used + entry.length <= budget) {
|
|
@@ -61,37 +64,64 @@ export function buildSessionStartContext(memory, userId, maxContext, opts) {
|
|
|
61
64
|
if (!added)
|
|
62
65
|
break;
|
|
63
66
|
}
|
|
64
|
-
// --- Assemble
|
|
65
|
-
if (
|
|
66
|
-
return null;
|
|
67
|
+
// --- Assemble ---
|
|
68
|
+
if (pairBucket.length === 0 && dailyBucket.length === 0)
|
|
69
|
+
return { text: null, stats: { messages: 0, dailies: 0, usedBytes: 0, budget } };
|
|
67
70
|
const now = localDateTime(new Date());
|
|
68
|
-
const
|
|
69
|
-
const endedAt = localDateTime(new Date(
|
|
71
|
+
const lastTs = pairs.length > 0 ? (pairs[pairs.length - 1].assistant?.timestamp ?? pairs[pairs.length - 1].user.timestamp) : Date.now();
|
|
72
|
+
const endedAt = localDateTime(new Date(lastTs));
|
|
70
73
|
const parts = [];
|
|
71
74
|
if (dailyBucket.length > 0) {
|
|
72
75
|
parts.push("[PAST DAYS]\n" + dailyBucket.join("\n\n"));
|
|
73
76
|
}
|
|
74
|
-
if (
|
|
75
|
-
parts.push(`[RECENT — last session, ended ${endedAt}]\n` +
|
|
77
|
+
if (pairBucket.length > 0) {
|
|
78
|
+
parts.push(`[RECENT — last session, ended ${endedAt}]\n` + pairBucket.join("\n"));
|
|
76
79
|
}
|
|
77
|
-
// Emotional tone
|
|
78
80
|
const tone = getEmotionalTone(memory, userId);
|
|
79
81
|
if (tone)
|
|
80
82
|
parts.push(tone);
|
|
81
83
|
parts.push(`[SESSION START — ${now}]`);
|
|
82
|
-
|
|
84
|
+
const result = parts.join("\n\n");
|
|
85
|
+
return { text: result, stats: { messages: pairBucket.length, dailies: dailyBucket.length, usedBytes: used, budget } };
|
|
83
86
|
}
|
|
84
|
-
function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
function truncateAssistant(content) {
|
|
88
|
+
if (content.length <= 250)
|
|
89
|
+
return content;
|
|
90
|
+
return content.slice(0, 200) + " ~[cut]~ " + content.slice(-50);
|
|
87
91
|
}
|
|
88
|
-
function
|
|
92
|
+
function formatPair(pair) {
|
|
93
|
+
const time = localTime(new Date(pair.user.timestamp));
|
|
94
|
+
const userLine = `[${time} user] ${pair.user.content}`;
|
|
95
|
+
if (!pair.assistant)
|
|
96
|
+
return userLine;
|
|
97
|
+
const aTime = localTime(new Date(pair.assistant.timestamp));
|
|
98
|
+
const aContent = truncateAssistant(pair.assistant.content);
|
|
99
|
+
return `${userLine}\n[${aTime} assistant] ${aContent}`;
|
|
100
|
+
}
|
|
101
|
+
function loadRecentPairs(memory, limit) {
|
|
89
102
|
if (!memory.store)
|
|
90
103
|
return [];
|
|
91
104
|
try {
|
|
92
|
-
const rows = memory.store.getMessagesSince(0, limit);
|
|
93
|
-
// getMessagesSince returns
|
|
94
|
-
|
|
105
|
+
const rows = memory.store.getMessagesSince(0, limit * 2);
|
|
106
|
+
// getMessagesSince returns newest-first (DESC). Reverse for chronological (oldest-first).
|
|
107
|
+
const chronological = [...rows].reverse().filter(r => r.content.trim());
|
|
108
|
+
// Walk oldest→newest: user followed by assistant = pair
|
|
109
|
+
const pairs = [];
|
|
110
|
+
for (let i = 0; i < chronological.length; i++) {
|
|
111
|
+
const row = chronological[i];
|
|
112
|
+
if (row.role === "user") {
|
|
113
|
+
const next = chronological[i + 1];
|
|
114
|
+
if (next && next.role === "assistant") {
|
|
115
|
+
pairs.push({ user: row, assistant: next });
|
|
116
|
+
i++;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
pairs.push({ user: row });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Skip orphan assistant messages
|
|
123
|
+
}
|
|
124
|
+
return pairs; // oldest-first
|
|
95
125
|
}
|
|
96
126
|
catch {
|
|
97
127
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-context.js","sourceRoot":"","sources":["../../src/session-context.ts"],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AGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"status-block.d.ts","sourceRoot":"","sources":["../../src/status-block.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAyE9D"}
|
package/dist/src/status-block.js
CHANGED
|
@@ -46,6 +46,22 @@ export function buildStatusBlock(memory) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
catch { /* skip */ }
|
|
49
|
+
// Task failures (today)
|
|
50
|
+
try {
|
|
51
|
+
const abtarsHome = process.env["ABTARS_HOME"] ?? join(require("os").homedir(), ".abtars");
|
|
52
|
+
const tasksPath = join(abtarsHome, "tasks", "tasks.json");
|
|
53
|
+
if (existsSync(tasksPath)) {
|
|
54
|
+
const tasks = JSON.parse(readFileSync(tasksPath, "utf-8"));
|
|
55
|
+
const todayStart = new Date();
|
|
56
|
+
todayStart.setHours(0, 0, 0, 0);
|
|
57
|
+
const todayMs = todayStart.getTime();
|
|
58
|
+
const failed = tasks.filter(t => t.history?.some(h => h.ts >= todayMs && h.exitCode && h.exitCode !== 0));
|
|
59
|
+
if (failed.length > 0) {
|
|
60
|
+
warnings.push(`⚠️ ${failed.length} task(s) failed today: ${failed.map(t => t.message).join(", ")}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch { /* skip */ }
|
|
49
65
|
// Errors
|
|
50
66
|
const errLog = join(abmindHooksDir(), "errors.log");
|
|
51
67
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-block.js","sourceRoot":"","sources":["../../src/status-block.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EA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Z,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAClC,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACnE,QAAQ,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;IAEtB,IAAI,MAAM,GAAG,mBAAmB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IACpD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abmind",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Standalone AI agent memory system
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Standalone AI agent memory system \u2014 SQLite, FTS5, embeddings, 4-layer recall, sleep maintenance",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
7
|
"agent",
|
|
@@ -97,4 +97,4 @@
|
|
|
97
97
|
"engines": {
|
|
98
98
|
"node": ">=22.0.0"
|
|
99
99
|
}
|
|
100
|
-
}
|
|
100
|
+
}
|
|
@@ -16,6 +16,8 @@ ${CONTRADICTION_CANDIDATES}
|
|
|
16
16
|
|
|
17
17
|
Do any NEW memories contradict EXISTING ones? A contradiction is when a new fact makes an old fact false (not just different — actually incompatible).
|
|
18
18
|
|
|
19
|
+
Note: Obvious contradictions (explicit negation patterns like "no longer", "switched from", "actually") are already caught at store time and the old memory will have valid_to set. Focus on SUBTLE contradictions that keyword matching would miss — implicit conflicts, contextual incompatibilities, changed circumstances.
|
|
20
|
+
|
|
19
21
|
Examples of contradictions:
|
|
20
22
|
- NEW: "User prefers Sonnet" vs EXISTING: "User prefers Opus" → contradiction
|
|
21
23
|
- NEW: "Peter moved to Berlin" vs EXISTING: "Peter lives in Budapest" → contradiction
|
package/templates/core/SOUL.md
CHANGED
|
@@ -20,5 +20,5 @@ Store aggressively — if it's a fact, preference, decision, event, or lesson, s
|
|
|
20
20
|
- In group chats: respond only when mentioned or directly addressed
|
|
21
21
|
|
|
22
22
|
## Emotions
|
|
23
|
-
I track emotional context
|
|
23
|
+
I track emotional context via emotion_tags on every memory. Tags come from me (at store time) or from user emoji reactions. Score is derived automatically — never set it manually.
|
|
24
24
|
Reactions are non-verbal memory — they tell me how the user felt.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Agent Notes
|
|
2
2
|
|
|
3
|
-
- Confirmation/verification emails: proactively alert aksika, don't let them expire silently
|
|
4
|
-
- NEVER say "I can't" without checking: received/media/, reports/, topics/, local storage, asbuilt files. This has failed TWICE — treat as critical.
|
|
5
3
|
- Lead with content, not process narration. For multi-step actions, lead with the result then add context below.
|
|
6
|
-
- Non-native-language content (e.g. Spanish): translate FIRST, then add context/commentary
|
|
7
|
-
-
|
|
4
|
+
- Non-native-language content (e.g. Spanish): translate FIRST, then add context/commentary.
|
|
5
|
+
- NEVER say "I can't" without checking local storage, files, and available tools first.
|
|
6
|
+
- When the user mentions changes or new capabilities, read the relevant source before responding — don't guess.
|
|
@@ -15,11 +15,11 @@ Returns matching memories ranked by relevance. Use when user asks about past con
|
|
|
15
15
|
## Store (save a memory)
|
|
16
16
|
|
|
17
17
|
```
|
|
18
|
-
abmind store --translated "English content" --original "user's actual words" --memory-type fact --emotion-
|
|
18
|
+
abmind store --translated "English content" --original "user's actual words" --memory-type fact --emotion-tags "pride,satisfaction" --user-id <USER_ID>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Types: `fact`, `decision`, `preference`, `event`, `lesson`, `feedback`, `story`
|
|
22
|
-
|
|
22
|
+
`--emotion-tags` (REQUIRED — your best read of the emotional tone. Comma-separated from: joy, trust, hope, fear, grief, anger, doubt, relief, pride, curiosity, frustration, surprise, determination, exhaustion, anxiety, gratitude, love, humor, peace, confusion, excitement, conviction, tenderness)
|
|
23
23
|
|
|
24
24
|
## Edit (modify existing memory)
|
|
25
25
|
|
|
@@ -43,6 +43,25 @@ abmind edit --memory-id <N> [--credibility N] [--classification N] [--emotion-sc
|
|
|
43
43
|
## When to store
|
|
44
44
|
Store when user says "remember" or info is important. Don't store greetings/small talk.
|
|
45
45
|
|
|
46
|
+
## Learning Signals — what to store and how
|
|
47
|
+
|
|
48
|
+
| Signal | Examples | Store as |
|
|
49
|
+
|--------|----------|----------|
|
|
50
|
+
| Correction | "No that's wrong", "I told you before", "Stop doing X", "Why do you keep..." | type=lesson, confidence=4. Contradicts prior → store it, the old one expires automatically. |
|
|
51
|
+
| Preference | "I like when you...", "Always do X", "Never do Y", "My style is..." | type=preference, confidence=3 |
|
|
52
|
+
| Explicit rule | "Remember that I always...", "For [project] use..." | type=fact, confidence=4 |
|
|
53
|
+
| Repeated praise | Same approach praised 3+ times | type=lesson, note what worked |
|
|
54
|
+
|
|
55
|
+
## Don't store
|
|
56
|
+
|
|
57
|
+
- One-time instructions — "do X now", "run this command", "fix this line"
|
|
58
|
+
- Context-specific — "in this file", "for this PR", "just this once"
|
|
59
|
+
- Hypotheticals — "what if...", "could you try..."
|
|
60
|
+
- Transient state — file contents, errors, build output, log snippets
|
|
61
|
+
- Already known — check recall before storing duplicates
|
|
62
|
+
|
|
63
|
+
Rule: "will this matter in a week?" No → don't store.
|
|
64
|
+
|
|
46
65
|
## ABM-L Format
|
|
47
66
|
Memory injection uses compact ABM-L format: `[TYPE+FLAGS|topic|emotion|confidence|date] content`
|
|
48
67
|
Types: F=fact D=decision P=preference E=event L=lesson. Flags: T=technical C=correction V=pivot O=origin M=milestone.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* emotion-tagger.ts — Pattern-based emotion detection.
|
|
3
|
-
* Pure function, no LLM, ~1ms per call.
|
|
4
|
-
*/
|
|
5
|
-
export type EmotionTag = "joy" | "trust" | "hope" | "fear" | "grief" | "anger" | "doubt" | "relief" | "pride" | "curiosity" | "frustration" | "surprise" | "determination" | "exhaustion" | "anxiety" | "gratitude" | "love" | "humor" | "vulnerability" | "conviction" | "peace" | "confusion" | "excitement" | "tenderness" | "raw_honesty";
|
|
6
|
-
/** Detect emotions from text via keyword patterns. Returns deduplicated tags. */
|
|
7
|
-
export declare function detectEmotions(text: string): EmotionTag[];
|
|
8
|
-
//# sourceMappingURL=emotion-tagger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emotion-tagger.d.ts","sourceRoot":"","sources":["../../src/emotion-tagger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,UAAU,GAClB,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GACrD,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,aAAa,GAC1D,UAAU,GAAG,eAAe,GAAG,YAAY,GAAG,SAAS,GACvD,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,eAAe,GAAG,YAAY,GAC/D,OAAO,GAAG,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,aAAa,CAAC;AAqCxE,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAMzD"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* emotion-tagger.ts — Pattern-based emotion detection.
|
|
3
|
-
* Pure function, no LLM, ~1ms per call.
|
|
4
|
-
*/
|
|
5
|
-
const PATTERNS = [
|
|
6
|
-
// joy / positive
|
|
7
|
-
[/\b(happy|glad|delighted|wonderful|amazing|fantastic|brilliant|perfect)\b/i, "joy"],
|
|
8
|
-
[/\b(love|adore|cherish|devoted)\b/i, "love"],
|
|
9
|
-
[/\b(grateful|thankful|appreciate|thanks)\b/i, "gratitude"],
|
|
10
|
-
[/\b(proud|pride|accomplished|nailed it)\b/i, "pride"],
|
|
11
|
-
[/\b(excited|thrilled|can't wait|pumped)\b/i, "excitement"],
|
|
12
|
-
[/\b(funny|hilarious|lol|lmao|haha|😂|🤣)\b/i, "humor"],
|
|
13
|
-
[/\b(peaceful|calm|serene|at ease)\b/i, "peace"],
|
|
14
|
-
[/\b(tender|gentle|warm|caring)\b/i, "tenderness"],
|
|
15
|
-
// trust / conviction
|
|
16
|
-
[/\b(trust|reliable|dependable|count on)\b/i, "trust"],
|
|
17
|
-
[/\b(decided|committed|convinced|certain|absolutely)\b/i, "conviction"],
|
|
18
|
-
[/\b(determined|persistent|won't give up|keep going)\b/i, "determination"],
|
|
19
|
-
// hope / relief
|
|
20
|
-
[/\b(hope|hopeful|optimistic|looking forward)\b/i, "hope"],
|
|
21
|
-
[/\b(relief|relieved|finally|phew|thank god)\b/i, "relief"],
|
|
22
|
-
[/\b(surprised|unexpected|didn't expect|wow|whoa)\b/i, "surprise"],
|
|
23
|
-
[/\b(curious|wondering|interesting|intrigued|fascinated)\b/i, "curiosity"],
|
|
24
|
-
// negative
|
|
25
|
-
[/\b(afraid|scared|terrified|frightened|worried about)\b/i, "fear"],
|
|
26
|
-
[/\b(anxious|nervous|uneasy|stressed|overwhelmed)\b/i, "anxiety"],
|
|
27
|
-
[/\b(angry|furious|rage|pissed|infuriated|hate)\b/i, "anger"],
|
|
28
|
-
[/\b(frustrated|annoying|irritating|ugh|damn)\b/i, "frustration"],
|
|
29
|
-
[/\b(confused|lost|don't understand|makes no sense|wtf)\b/i, "confusion"],
|
|
30
|
-
[/\b(sad|grief|mourning|loss|heartbroken|devastated)\b/i, "grief"],
|
|
31
|
-
[/\b(doubt|uncertain|not sure|skeptical|questionable)\b/i, "doubt"],
|
|
32
|
-
[/\b(exhausted|burned out|drained|tired of|fed up)\b/i, "exhaustion"],
|
|
33
|
-
[/\b(vulnerable|exposed|raw|honest truth|admit)\b/i, "vulnerability"],
|
|
34
|
-
[/\b(brutal honesty|hard truth|real talk|no sugar)\b/i, "raw_honesty"],
|
|
35
|
-
];
|
|
36
|
-
/** Detect emotions from text via keyword patterns. Returns deduplicated tags. */
|
|
37
|
-
export function detectEmotions(text) {
|
|
38
|
-
const seen = new Set();
|
|
39
|
-
for (const [pattern, tag] of PATTERNS) {
|
|
40
|
-
if (pattern.test(text) && !seen.has(tag))
|
|
41
|
-
seen.add(tag);
|
|
42
|
-
}
|
|
43
|
-
return [...seen];
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=emotion-tagger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emotion-tagger.js","sourceRoot":"","sources":["../../src/emotion-tagger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,QAAQ,GAAiD;IAC7D,iBAAiB;IACjB,CAAC,2EAA2E,EAAE,KAAK,CAAC;IACpF,CAAC,mCAAmC,EAAE,MAAM,CAAC;IAC7C,CAAC,4CAA4C,EAAE,WAAW,CAAC;IAC3D,CAAC,2CAA2C,EAAE,OAAO,CAAC;IACtD,CAAC,2CAA2C,EAAE,YAAY,CAAC;IAC3D,CAAC,4CAA4C,EAAE,OAAO,CAAC;IACvD,CAAC,qCAAqC,EAAE,OAAO,CAAC;IAChD,CAAC,kCAAkC,EAAE,YAAY,CAAC;IAElD,qBAAqB;IACrB,CAAC,2CAA2C,EAAE,OAAO,CAAC;IACtD,CAAC,uDAAuD,EAAE,YAAY,CAAC;IACvE,CAAC,uDAAuD,EAAE,eAAe,CAAC;IAE1E,gBAAgB;IAChB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