File size: 1,161 Bytes
c3a3710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# store_session.sh — Store session outcomes into MnemoCore
# =========================================================
# Call this at the end of an AI coding session to persist key findings.
#
# Usage (interactive):
#   ./store_session.sh
#
# Usage (non-interactive / scripted):
#   ./store_session.sh "Fixed race condition in tier_manager.py" "bugfix,async" "my-project"

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BRIDGE_PY="${BRIDGE_PY:-$(realpath "$SCRIPT_DIR/../mnemo_bridge.py")}"

if [[ $# -ge 1 ]]; then
    CONTENT="$1"
    TAGS="${2:-cli}"
    CTX="${3:-}"
else
    echo "Enter memory content (what was done/decided/fixed):"
    read -r CONTENT
    echo "Tags (comma-separated, e.g. bugfix,python,auth):"
    read -r TAGS
    echo "Context/project ID (optional, press Enter to skip):"
    read -r CTX
fi

if [[ -z "$CONTENT" ]]; then
    echo "No content provided, nothing stored." >&2
    exit 0
fi

ARGS=(store "$CONTENT" --source "manual-session" --tags "$TAGS")
if [[ -n "$CTX" ]]; then
    ARGS+=(--ctx "$CTX")
fi

python3 "$BRIDGE_PY" "${ARGS[@]}"