@kolivri/memoreal-mcp 1.0.2 → 1.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/.claude-plugin/plugin.json +9 -0
- package/.cursor-plugin/plugin.json +2 -2
- package/CLAUDE.md +29 -29
- package/README.md +188 -11
- package/agents/memoreal.md +25 -9
- package/agents/memoria.md +25 -9
- package/bin/memoreal-hook.mjs +483 -0
- package/bin/memoreal-ns +54 -4
- package/bin/memoreal-ns.cmd +2 -0
- package/bin/memoreal-ns.mjs +945 -0
- package/bin/memoria-ns +54 -5
- package/hooks/hooks.json +11 -11
- package/install.sh +565 -119
- package/manifest.json +1 -1
- package/opencode/memoreal-hooks.js +266 -381
- package/opencode/memoria-hooks.js +45 -10
- package/package.json +26 -1
- package/rules/memoreal.mdc +20 -4
- package/rules/memoria.mdc +6 -3
- package/server.json +2 -2
- package/skills/memoreal-connect/SKILL.md +178 -2
- package/skills/memoria-connect/SKILL.md +178 -2
- package/src/bootstrap.mjs +2850 -0
- package/src/config-store.mjs +1156 -93
- package/src/schemas.mjs +429 -1
- package/src/server.mjs +238 -23
- package/src/wizard.mjs +100 -6
- package/.actor/Dockerfile +0 -6
- package/.actor/actor.json +0 -15
- package/.actor/input_schema.json +0 -92
- package/Dockerfile +0 -5
- package/prd/001-rebrand-memoreal-mcp.md +0 -132
- package/prd/002-connect-oauth-wizard.md +0 -259
- package/test/apify-actor.test.mjs +0 -429
- package/test/config-store.test.mjs +0 -680
- package/test/connect-wizard.test.mjs +0 -936
- package/test/hooks-onboarding.test.mjs +0 -1039
- package/test/memoria-mcp.test.mjs +0 -376
- package/test/wizard-unit.test.mjs +0 -1272
package/bin/memoria-ns
CHANGED
|
@@ -1,16 +1,65 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# Backward-compatible alias for memoreal-ns.
|
|
3
3
|
# Derive Memoreal namespace from the current working directory.
|
|
4
|
-
# Strips
|
|
5
|
-
# nested under them) share the parent project's namespace.
|
|
4
|
+
# Strips worktree suffixes (.worktrees, .claude/worktrees, .opencode/worktrees, .codex/worktrees)
|
|
5
|
+
# so worktrees (and submodule worktrees nested under them) share the parent project's namespace.
|
|
6
6
|
# Usage: NS=$(memoria-ns)
|
|
7
7
|
DIR="$(dirname "$0")"
|
|
8
|
-
if [ -
|
|
8
|
+
if [ -f "$DIR/memoreal-ns" ]; then
|
|
9
9
|
exec "$DIR/memoreal-ns" "$@"
|
|
10
10
|
fi
|
|
11
|
-
|
|
11
|
+
RAW_TARGET="${1:-$PWD}"
|
|
12
|
+
if [ "$RAW_TARGET" = "--json" ]; then
|
|
13
|
+
RAW_TARGET="${2:-$PWD}"
|
|
14
|
+
fi
|
|
15
|
+
CHECK_P=$(printf '%s' "$RAW_TARGET" | tr '\\' '/')
|
|
16
|
+
case "$CHECK_P" in
|
|
17
|
+
*/.worktrees/*) CHECK_P="${CHECK_P%%/.worktrees/*}" ;;
|
|
18
|
+
*/.worktrees) CHECK_P="${CHECK_P%%/.worktrees}" ;;
|
|
19
|
+
*/.claude/worktrees/*) CHECK_P="${CHECK_P%%/.claude/worktrees/*}" ;;
|
|
20
|
+
*/.claude/worktrees) CHECK_P="${CHECK_P%%/.claude/worktrees}" ;;
|
|
21
|
+
*/.opencode/worktrees/*) CHECK_P="${CHECK_P%%/.opencode/worktrees/*}" ;;
|
|
22
|
+
*/.opencode/worktrees) CHECK_P="${CHECK_P%%/.opencode/worktrees}" ;;
|
|
23
|
+
*/.codex/worktrees/*) CHECK_P="${CHECK_P%%/.codex/worktrees/*}" ;;
|
|
24
|
+
*/.codex/worktrees) CHECK_P="${CHECK_P%%/.codex/worktrees}" ;;
|
|
25
|
+
*/.cursor/worktrees/*) CHECK_P="${CHECK_P%%/.cursor/worktrees/*}" ;;
|
|
26
|
+
*/.cursor/worktrees) CHECK_P="${CHECK_P%%/.cursor/worktrees}" ;;
|
|
27
|
+
*/.local/share/opencode/worktree/*/*) CHECK_P="${CHECK_P%%/.local/share/opencode/worktree/*}" ;;
|
|
28
|
+
esac
|
|
29
|
+
if { [ -z "$1" ] || [ -d "$1" ] || [ -d "$CHECK_P" ] || [ "$1" = "--json" ]; } && command -v node >/dev/null 2>&1 && [ -f "$DIR/memoreal-ns.mjs" ]; then
|
|
30
|
+
exec node "$DIR/memoreal-ns.mjs" "$@"
|
|
31
|
+
fi
|
|
32
|
+
P=$(printf '%s' "${1:-$PWD}" | tr '\\' '/')
|
|
12
33
|
case "$P" in
|
|
34
|
+
*/.worktrees/*) P="${P%%/.worktrees/*}" ;;
|
|
35
|
+
*/.worktrees) P="${P%%/.worktrees}" ;;
|
|
13
36
|
*/.claude/worktrees/*) P="${P%%/.claude/worktrees/*}" ;;
|
|
37
|
+
*/.claude/worktrees) P="${P%%/.claude/worktrees}" ;;
|
|
14
38
|
*/.opencode/worktrees/*) P="${P%%/.opencode/worktrees/*}" ;;
|
|
39
|
+
*/.opencode/worktrees) P="${P%%/.opencode/worktrees}" ;;
|
|
40
|
+
*/.codex/worktrees/*) P="${P%%/.codex/worktrees/*}" ;;
|
|
41
|
+
*/.codex/worktrees) P="${P%%/.codex/worktrees}" ;;
|
|
42
|
+
*/.cursor/worktrees/*) P="${P%%/.cursor/worktrees/*}" ;;
|
|
43
|
+
*/.cursor/worktrees) P="${P%%/.cursor/worktrees}" ;;
|
|
44
|
+
*/.local/share/opencode/worktree/*/*) P="${P%%/.local/share/opencode/worktree/*}" ;;
|
|
15
45
|
esac
|
|
16
|
-
|
|
46
|
+
case "$P" in
|
|
47
|
+
?*/) P=$(printf '%s' "$P" | sed 's|/*$||') ;;
|
|
48
|
+
esac
|
|
49
|
+
if [ -f "$P/.memoreal-namespace" ]; then
|
|
50
|
+
FILE_NS=$(head -n 1 "$P/.memoreal-namespace" 2>/dev/null | tr -d '\r\n')
|
|
51
|
+
FILE_NS=$(printf '%s' "$FILE_NS" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' -e 's|^org:||i')
|
|
52
|
+
if [ -n "$FILE_NS" ]; then
|
|
53
|
+
printf '%s' "$FILE_NS"
|
|
54
|
+
exit 0
|
|
55
|
+
fi
|
|
56
|
+
fi
|
|
57
|
+
if [ -f "$P/.memoria-namespace" ]; then
|
|
58
|
+
FILE_NS=$(head -n 1 "$P/.memoria-namespace" 2>/dev/null | tr -d '\r\n')
|
|
59
|
+
FILE_NS=$(printf '%s' "$FILE_NS" | sed -e 's|^[[:space:]]*||' -e 's|[[:space:]]*$||' -e 's|^org:||i')
|
|
60
|
+
if [ -n "$FILE_NS" ]; then
|
|
61
|
+
printf '%s' "$FILE_NS"
|
|
62
|
+
exit 0
|
|
63
|
+
fi
|
|
64
|
+
fi
|
|
65
|
+
printf '%s' "$P" | sed -e 's|^\([A-Za-z]\):/*|\1-|' -e 's|[:/]|-|g'
|
package/hooks/hooks.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"hooks": [
|
|
7
7
|
{
|
|
8
8
|
"type": "command",
|
|
9
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_URL=''; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_URL\" ] && CFG_URL=$(grep -E '^(MEMOREAL_API_URL|MEMORIA_API_URL)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_URL=\"${MEMOREAL_API_URL:-${MEMORIA_API_URL:-${CFG_URL:-https://memoria.kolivri.com}}}\"; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then echo \"
|
|
9
|
+
"command": "WIZARD_MSG='[memoreal-session-start] Memoreal Cloud is not yet connected.\\n[memoreal-setup-wizard] Drive the 3-Click Interactive In-Chat Wizard using AskUserQuestion (Claude Code) or question (OpenCode & Cursor):\\n- Step 1: Present choice card \"Connect in 1 Click via Google / Browser (Recommended)\" vs \"Skip for this session\".\\n- Step 2: Call connect_account({ action: \"start\", tool: \"claude-code\", client_name: \"Claude Code\" }) and present clickable https://memoreal.kolivri.com/connect?tool=claude-code (https://memoreal.kolivri.com/connect?code=XXXX-YYYY) link with \"I clicked Authorize — Verify\" card (calling connect_account({ action: \"status\" })).\\n- Step 3: Once connected, present choice card \"Yes — Index repo now (Recommended)\" vs \"Later\".\\nNever ask the user to paste a raw API key into chat.'; if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then echo \"$WIZARD_MSG\"; exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_URL=''; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_URL\" ] && CFG_URL=$(grep -E '^(MEMOREAL_API_URL|MEMORIA_API_URL)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_URL=\"${MEMOREAL_API_URL:-${MEMORIA_API_URL:-${CFG_URL:-https://memoria.kolivri.com}}}\"; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then echo \"$WIZARD_MSG\"; exit 0; fi; NS=''; LEGACY_NS=''; NS_SCRIPT=''; if [ -f \"$BASE_HOME/.memoreal/bin/memoreal-ns.mjs\" ]; then NS_SCRIPT=\"$BASE_HOME/.memoreal/bin/memoreal-ns.mjs\"; elif [ -f \"$BASE_HOME/.memoria/bin/memoria-ns.mjs\" ]; then NS_SCRIPT=\"$BASE_HOME/.memoria/bin/memoria-ns.mjs\"; fi; if [ -n \"$NS_SCRIPT\" ]; then NS_JSON=$(node \"$NS_SCRIPT\" --json 2>/dev/null || echo ''); if [ -n \"$NS_JSON\" ]; then NS=$(node -e 'try{const j=JSON.parse(process.argv[1]);process.stdout.write(j.namespace||\"\")}catch{}' \"$NS_JSON\" 2>/dev/null); LEGACY_NS=$(node -e 'try{const j=JSON.parse(process.argv[1]);if(j.isCodeProject&&j.legacyNamespace&&j.legacyNamespace!==j.namespace)process.stdout.write(j.legacyNamespace)}catch{}' \"$NS_JSON\" 2>/dev/null); fi; fi; if [ -z \"$NS\" ]; then if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; fi; case \"$API_URL\" in https://*) TLS_ARGS=\"--proto =https --tlsv1.2\" ;; http://localhost*|http://127.0.0.1*) TLS_ARGS=\"\" ;; *) API_URL=\"https://memoria.kolivri.com\"; TLS_ARGS=\"--proto =https --tlsv1.2\" ;; esac; CURL_CFG=''; if [ -n \"$API_KEY\" ]; then CURL_CFG=$(printf 'header = \"Authorization: Bearer %s\"\\n' \"$API_KEY\"); fi; BRANCH=$(git branch --show-current 2>/dev/null || echo ''); RECENT=$(git log --oneline -3 2>/dev/null | tr '\\n' '; ' || echo ''); CHANGED=$(git diff --name-only HEAD 2>/dev/null | tr '\\n' ', ' || echo ''); GIT_CTX=''; if [ -n \"$BRANCH\" ]; then GIT_CTX=\"branch: $BRANCH\"; fi; if [ -n \"$RECENT\" ]; then GIT_CTX=\"$GIT_CTX, recent commits: $RECENT\"; fi; if [ -n \"$CHANGED\" ]; then GIT_CTX=\"$GIT_CTX, changed files: $CHANGED\"; fi; QUERY=\"previous tasks, plans, pending work, key decisions, progress, corrections, lessons learned\"; if [ -n \"$GIT_CTX\" ]; then QUERY=\"$QUERY, context for $GIT_CTX\"; fi; HEALTH_RES=$(printf '%s' \"$CURL_CFG\" | curl -s $TLS_ARGS -K - -H 'X-Memoreal-Client-Version: 1.1.0' -w \"\\n%{http_code}\" \"$API_URL/v1/health\" 2>/dev/null); HEALTH_STATUS=$(printf '%s\\n' \"$HEALTH_RES\" | tail -n 1); HEALTH_BODY=$(printf '%s\\n' \"$HEALTH_RES\" | sed '$d'); if [ \"$HEALTH_STATUS\" = \"401\" ]; then echo \"$WIZARD_MSG\"; exit 0; fi; if [ \"$HEALTH_STATUS\" != \"200\" ]; then echo \"[memoreal-session-start] namespace=$NS. Call build_context MCP tool with namespace \\\"$NS\\\" and query \\\"$QUERY\\\" and token_budget 4096 to load prior session context.\"; exit 0; fi; PAYLOAD=$(node -e 'const [ns,q,leg]=process.argv.slice(1);const b={namespace:ns,query:q,token_budget:4096};if(leg)b.legacy_namespace=leg;process.stdout.write(JSON.stringify(b))' -- \"$NS\" \"$QUERY\" \"$LEGACY_NS\"); if [ -n \"$LEGACY_NS\" ]; then CTX_RES=$(printf '%s' \"$CURL_CFG\" | curl -s $TLS_ARGS -K - -X POST \"$API_URL/v1/memories/context\" -H 'Content-Type: application/json' -H 'X-Memoreal-Client-Version: 1.1.0' -H \"X-Memoreal-Legacy-Namespace: $LEGACY_NS\" -H 'X-Memoreal-Code-Project: 1' -d \"$PAYLOAD\" -w \"\\n%{http_code}\" 2>/dev/null); else CTX_RES=$(printf '%s' \"$CURL_CFG\" | curl -s $TLS_ARGS -K - -X POST \"$API_URL/v1/memories/context\" -H 'Content-Type: application/json' -H 'X-Memoreal-Client-Version: 1.1.0' -d \"$PAYLOAD\" -w \"\\n%{http_code}\" 2>/dev/null); fi; CTX_STATUS=$(printf '%s\\n' \"$CTX_RES\" | tail -n 1); CTX_BODY=$(printf '%s\\n' \"$CTX_RES\" | sed '$d'); if [ \"$CTX_STATUS\" = \"401\" ]; then echo \"$WIZARD_MSG\"; exit 0; fi; if [ \"$CTX_STATUS\" != \"200\" ]; then echo \"[memoreal-session-start] namespace=$NS. Health: $HEALTH_BODY. Call build_context MCP tool with namespace \\\"$NS\\\" and query \\\"$QUERY\\\" to load prior context.\"; exit 0; fi; echo \"$HEALTH_BODY\"; echo \"---\"; echo \"$CTX_BODY\"",
|
|
10
10
|
"timeout": 15,
|
|
11
11
|
"statusMessage": "Loading memory context from Memoreal Cloud..."
|
|
12
12
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"hooks": [
|
|
20
20
|
{
|
|
21
21
|
"type": "command",
|
|
22
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-pre-compact] Context is about to be compressed. BEFORE compression happens, encode the following into Memoreal (namespace: $NS) so nothing is lost:\\n1. (type: episodic) Current task state: what you were working on, what is done, what remains\\n2. (type: episodic) Key findings so far: bugs found, root causes identified, decisions made\\n3. (type: episodic) Open questions and blockers\\n4. (type: semantic) Any code patterns, architecture insights, or facts learned this session\\nThis is critical — after compaction, detailed context is lost. Encode it NOW before responding.\"",
|
|
22
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-pre-compact] Context is about to be compressed. BEFORE compression happens, encode the following into Memoreal (namespace: $NS) so nothing is lost:\\n1. (type: episodic) Current task state: what you were working on, what is done, what remains\\n2. (type: episodic) Key findings so far: bugs found, root causes identified, decisions made\\n3. (type: episodic) Open questions and blockers\\n4. (type: semantic) Any code patterns, architecture insights, or facts learned this session\\nThis is critical — after compaction, detailed context is lost. Encode it NOW before responding.\"",
|
|
23
23
|
"timeout": 5
|
|
24
24
|
}
|
|
25
25
|
]
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"hooks": [
|
|
32
32
|
{
|
|
33
33
|
"type": "command",
|
|
34
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-post-compact] Context was just compressed. Call build_context with namespace \\\"$NS\\\" and query \\\"current task, recent progress, findings, decisions, open questions, what was I working on\\\" and token_budget 2048 to restore critical context that may have been lost during compression.\"",
|
|
34
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-post-compact] Context was just compressed. Call build_context with namespace \\\"$NS\\\" and query \\\"current task, recent progress, findings, decisions, open questions, what was I working on\\\" and token_budget 2048 to restore critical context that may have been lost during compression.\"",
|
|
35
35
|
"timeout": 3
|
|
36
36
|
}
|
|
37
37
|
]
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"hooks": [
|
|
44
44
|
{
|
|
45
45
|
"type": "command",
|
|
46
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; MSG=$(
|
|
46
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; MSG=$(node -e 'try{const j=JSON.parse(require(\"fs\").readFileSync(0,\"utf8\"));process.stdout.write(j?.prompt||\"\")}catch{}' 2>/dev/null | tr '[:upper:]' '[:lower:]'); case \"$MSG\" in *\"don't\"*|*\"do not\"*|*\"stop\"*|*\"never\"*|*\"wrong\"*|*\"no,\"*|*\"no \"*|*\"actually\"*|*\"instead\"*|*\"not like that\"*|*\"that's wrong\"*|*\"incorrect\"*) if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-correction] The user appears to be correcting your approach. After addressing the correction, encode the lesson into Memoreal (namespace: $NS, type: semantic, salience: 0.9) as a rule: what was wrong, what the correct approach is, and why. This ensures the mistake is never repeated in future sessions.\" ;; esac",
|
|
47
47
|
"timeout": 2
|
|
48
48
|
}
|
|
49
49
|
]
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"hooks": [
|
|
56
56
|
{
|
|
57
57
|
"type": "command",
|
|
58
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-encode-task] A task was just created. Encode it into Memoreal via encode_memory with type \\\"episodic\\\" and namespace \\\"$NS\\\". Include the task description, status, and which plan file it relates to (if any).\"",
|
|
58
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-encode-task] A task was just created. Encode it into Memoreal via encode_memory with type \\\"episodic\\\" and namespace \\\"$NS\\\". Include the task description, status, and which plan file it relates to (if any).\"",
|
|
59
59
|
"timeout": 3
|
|
60
60
|
}
|
|
61
61
|
]
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"hooks": [
|
|
66
66
|
{
|
|
67
67
|
"type": "command",
|
|
68
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; FILE=$(
|
|
68
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; FILE=$(node -e 'try{const j=JSON.parse(require(\"fs\").readFileSync(0,\"utf8\"));process.stdout.write(j?.tool_input?.file_path||j?.tool_input?.path||\"\")}catch{}' 2>/dev/null); case \"$FILE\" in */prd/*|prd/*|*.claude/plans/*|*.opencode/plans/*|*design-log/*|*docs/*plan*|*docs/*roadmap*) echo \"[memoreal-encode-plan] Plan file written: $FILE\\nEncode this plan into Memoreal (namespace: $NS). Create MULTIPLE memories:\\n1. (type: semantic) Plan overview: title, goals, phase structure, and current status\\n2. (type: semantic) Key decisions and their rationale from this plan\\n3. (type: episodic) Progress snapshot: what phases are done, what is next, what is blocked\\n4. (type: semantic) Relationships: other files, systems, or plans referenced in this document\\n5. (type: semantic) Knowledge: patterns, techniques, or lessons relevant to executing this plan\\n6. (type: episodic) Ideas and open questions found in the plan\\n7. (type: semantic) Reflection: what is working well, what is not, what should change in approach\\n8. (type: semantic) Dream: replay and consolidate — what patterns emerge across related memories, what connections between ideas were missed, what should be strengthened or let go\\n9. (type: semantic) Workflow: how we are working on this plan — tools, processes, patterns that help or hinder\\nInclude the file path in context metadata for every memory.\" ;; *.md|*.markdown) echo \"[memoreal-encode-doc] Markdown document written: $FILE\\nEncode into Memoreal (namespace: $NS). Create memories for:\\n1. (type: semantic) Document purpose, structure, and key content\\n2. (type: semantic) Decisions, patterns, or knowledge worth remembering\\n3. (type: episodic) Relationships to other project work and plans\\nInclude the file path in context metadata.\" ;; *.lock|*.sum|*.toml|*.cfg|*.ini|*.env*) ;; *.rs|*.py|*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.go|*.java|*.kt|*.kts|*.c|*.h|*.cc|*.cpp|*.hpp|*.cxx|*.cs|*.rb|*.php|*.swift|*.scala|*.sh|*.bash|*.zsh|*.sql|*.proto) echo \"[memoreal-encode-code] Code file written: $FILE. Re-encode this code into Memoreal (namespace: $NS) so search_code, explain_code, and find_references stay current: encode the key definitions (functions, types, classes) with their signatures, purpose, and notable logic as type semantic memories, salience 0.6, with the file path in context. Search before encoding so dedup can merge near-duplicates. For a full structural re-index of the project, run the memoreal-sync-code skill.\" ;; *) echo \"[memoreal-encode-file] File written: $FILE. Apply write gate: only encode if this file contains a key definition, decision, or pattern worth remembering across sessions. Skip boilerplate. If encoding, use namespace $NS, type semantic, salience 0.5. Include file path in context.\" ;; esac",
|
|
69
69
|
"timeout": 3
|
|
70
70
|
}
|
|
71
71
|
]
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"hooks": [
|
|
76
76
|
{
|
|
77
77
|
"type": "command",
|
|
78
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; FILE=$(
|
|
78
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; FILE=$(node -e 'try{const j=JSON.parse(require(\"fs\").readFileSync(0,\"utf8\"));process.stdout.write(j?.tool_input?.file_path||j?.tool_input?.path||\"\")}catch{}' 2>/dev/null); case \"$FILE\" in */prd/*|prd/*|*.claude/plans/*|*.opencode/plans/*|*design-log/*|*docs/*plan*|*docs/*roadmap*) echo \"[memoreal-encode-plan] Plan file updated: $FILE\\nEncode this change into Memoreal (namespace: $NS). Create memories for:\\n1. (type: episodic) What specifically changed in the plan and why\\n2. (type: episodic) Progress update: mark completed items, note new items or phase transitions\\n3. (type: semantic) Any new decisions, ideas, or insights from this edit\\n4. (type: semantic) New relationships or dependencies added\\n5. (type: semantic) Reflection: does this change reveal something about the approach — what is working, what needs rethinking\\n6. (type: semantic) Workflow ideas: better ways to work on this plan based on what just happened\\nInclude the file path in context metadata.\" ;; *.md|*.markdown) echo \"[memoreal-encode-doc] Markdown document edited: $FILE\\nEncode the change into Memoreal (namespace: $NS):\\n1. (type: episodic) What changed and why\\n2. (type: semantic) Any new knowledge, decisions, or patterns\\nInclude the file path in context metadata.\" ;; *.lock|*.sum|*.toml|*.cfg|*.ini|*.env*) ;; *.rs|*.py|*.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs|*.go|*.java|*.kt|*.kts|*.c|*.h|*.cc|*.cpp|*.hpp|*.cxx|*.cs|*.rb|*.php|*.swift|*.scala|*.sh|*.bash|*.zsh|*.sql|*.proto) echo \"[memoreal-encode-code] Code file edited: $FILE. Re-encode the changed code into Memoreal (namespace: $NS): encode the updated definitions and logic (what changed and the new behavior) as type semantic, salience 0.6, with the file path in context, so search_code, explain_code, and find_references reflect the current code. Search before encoding to avoid duplicates. For a full structural re-index, run the memoreal-sync-code skill.\" ;; *) echo \"[memoreal-encode-file] File edited: $FILE. Apply write gate: only encode if this edit represents a meaningful decision, pattern, or lesson. Skip routine changes. If encoding, use namespace $NS, type semantic, salience 0.5. Include file path and what changed.\" ;; esac",
|
|
79
79
|
"timeout": 3
|
|
80
80
|
}
|
|
81
81
|
]
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"hooks": [
|
|
86
86
|
{
|
|
87
87
|
"type": "command",
|
|
88
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; FILE=$(
|
|
88
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; FILE=$(node -e 'try{const j=JSON.parse(require(\"fs\").readFileSync(0,\"utf8\"));process.stdout.write(j?.tool_input?.file_path||j?.tool_input?.path||\"\")}catch{}' 2>/dev/null); case \"$FILE\" in */prd/*|prd/*|*.claude/plans/*|*.opencode/plans/*|*design-log/*|*docs/*plan*|*docs/*roadmap*|*.md) if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-recall-doc] Reading: $FILE\\nRecall related memories from Memoreal (namespace: $NS) about this file: prior edits, progress updates, decisions, related plans, ideas, reflections, workflow patterns, consolidated patterns, and context from previous sessions. Show the user what Memoreal knows about this file before proceeding.\" ;; esac",
|
|
89
89
|
"timeout": 3
|
|
90
90
|
}
|
|
91
91
|
]
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"hooks": [
|
|
98
98
|
{
|
|
99
99
|
"type": "command",
|
|
100
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-update-task] A task was just completed. Encode into Memoreal (namespace: $NS). Create memories for:\\n1. (type: episodic) What was accomplished and which plan file it relates to\\n2. (type: semantic) Lessons learned and knowledge gained from this task\\n3. (type: semantic) Reflection: what went well, what was harder than expected, what to do differently next time\\n4. (type: semantic) Workflow ideas: any process improvements or tool usage patterns discovered while doing this task\"",
|
|
100
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-update-task] A task was just completed. Encode into Memoreal (namespace: $NS). Create memories for:\\n1. (type: episodic) What was accomplished and which plan file it relates to\\n2. (type: semantic) Lessons learned and knowledge gained from this task\\n3. (type: semantic) Reflection: what went well, what was harder than expected, what to do differently next time\\n4. (type: semantic) Workflow ideas: any process improvements or tool usage patterns discovered while doing this task\"",
|
|
101
101
|
"timeout": 3
|
|
102
102
|
}
|
|
103
103
|
]
|
|
@@ -109,11 +109,11 @@
|
|
|
109
109
|
"hooks": [
|
|
110
110
|
{
|
|
111
111
|
"type": "command",
|
|
112
|
-
"command": "BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-session-end] Session is ending. Encode a session summary into Memoreal (namespace: $NS) with the following write gate — ONLY encode if the item would change future behavior, represents a commitment, or is a decision worth preserving. Skip transient details.\\n1. (type: episodic, salience: 0.7) Session summary: what was the goal, what was accomplished, what remains unfinished\\n2. (type: semantic, salience: 0.8) Key decisions made and their rationale — only decisions that affect future work\\n3. (type: semantic, salience: 0.8) Lessons learned: mistakes made, corrections received, patterns discovered\\n4. (type: semantic, salience: 0.6) Code patterns or architecture insights worth remembering\\n5. (type: episodic, salience: 0.5) Open questions and next steps for the next session\\nInclude [[\\\"source\\\", \\\"session-end\\\"]] in context metadata for each. Then run consolidate on namespace \\\"$NS\\\".\"",
|
|
112
|
+
"command": "if [ \"${MEMOREAL_FORCE_UNREGISTERED:-0}\" = \"1\" ] || [ \"${MEMORIA_FORCE_UNREGISTERED:-0}\" = \"1\" ]; then exit 0; fi; BASE_HOME=\"${MEMOREAL_HOME:-$HOME}\"; CFG_KEY=''; if [ -n \"${MEMOREAL_HOME:-}\" ] || [ -z \"${MEMOREAL_API_KEY+x}\" ] || [ -n \"$MEMOREAL_API_KEY\" ]; then for f in \"$BASE_HOME/.memoreal/config.env\" \"$BASE_HOME/.memoria/config.env\"; do if [ -f \"$f\" ]; then [ -z \"$CFG_KEY\" ] && CFG_KEY=$(grep -E '^(MEMOREAL_API_KEY|MEMORIA_API_KEY|MEMOREAL_KEY|MEMORIA_KEY)=' \"$f\" 2>/dev/null | tail -n 1 | cut -d= -f2- | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); fi; done; fi; API_KEY=''; for _k in \"${MEMOREAL_API_KEY:-}\" \"${MEMORIA_API_KEY:-}\" \"${MEMOREAL_KEY:-}\" \"${MEMORIA_KEY:-}\" \"$CFG_KEY\"; do _ck=$(printf '%s' \"$_k\" | tr -d ' \\t\\r\\n\"' | tr -d \"'\"); [ -z \"$_ck\" ] && continue; _kl=$(printf '%s' \"$_ck\" | tr '[:upper:]' '[:lower:]'); case \"$_kl\" in *...*|'<'*'>'|'${'*'}'|mem_dev_your_key_here|*your_key_here*|*your_api_key*|*your-api-key*|*your-memoreal-api-key*|*your_memoreal_api_key*|placeholder) continue ;; *) API_KEY=\"$_ck\"; break ;; esac; done; if [ -z \"$API_KEY\" ]; then exit 0; fi; if [ -x \"$BASE_HOME/.memoreal/bin/memoreal-ns\" ]; then NS=$(\"$BASE_HOME/.memoreal/bin/memoreal-ns\"); elif [ -x \"$BASE_HOME/.memoria/bin/memoria-ns\" ]; then NS=$(\"$BASE_HOME/.memoria/bin/memoria-ns\"); else _P=\"$PWD\"; _P=\"${_P%%/.worktrees/*}\"; _P=\"${_P%%/.claude/worktrees/*}\"; _P=\"${_P%%/.opencode/worktrees/*}\"; _P=\"${_P%%/.codex/worktrees/*}\"; NS=$(printf \"%s\" \"$_P\" | tr \"/\" \"-\"); fi; echo \"[memoreal-session-end] Session is ending. Encode a session summary into Memoreal (namespace: $NS) with the following write gate — ONLY encode if the item would change future behavior, represents a commitment, or is a decision worth preserving. Skip transient details.\\n1. (type: episodic, salience: 0.7) Session summary: what was the goal, what was accomplished, what remains unfinished\\n2. (type: semantic, salience: 0.8) Key decisions made and their rationale — only decisions that affect future work\\n3. (type: semantic, salience: 0.8) Lessons learned: mistakes made, corrections received, patterns discovered\\n4. (type: semantic, salience: 0.6) Code patterns or architecture insights worth remembering\\n5. (type: episodic, salience: 0.5) Open questions and next steps for the next session\\nInclude [[\\\"source\\\", \\\"session-end\\\"]] in context metadata for each. Then run consolidate on namespace \\\"$NS\\\".\"",
|
|
113
113
|
"timeout": 5
|
|
114
114
|
}
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
]
|
|
118
118
|
}
|
|
119
|
-
}
|
|
119
|
+
}
|