create-ai-memory 0.1.2 → 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/README.md +7 -2
- package/package.json +5 -1
- package/shell/ai-mem.zsh +49 -2
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm create ai-memory@latest
|
|
|
17
17
|
|
|
18
18
|
[](https://www.npmjs.com/package/create-ai-memory)
|
|
19
19
|

|
|
20
|
-

|
|
21
21
|

|
|
22
22
|

|
|
23
23
|

|
|
@@ -75,7 +75,7 @@ hands it to the agent as its opening message:
|
|
|
75
75
|
├─ create a fresh session log from the template
|
|
76
76
|
├─ gather: Global Profile + Standards (who you are)
|
|
77
77
|
│ Project note (this repo)
|
|
78
|
-
│
|
|
78
|
+
│ prior session's outcome (where you left off, inlined)
|
|
79
79
|
├─ ask which session skills to enable (optional)
|
|
80
80
|
└─ launch the agent with all of it as the first prompt
|
|
81
81
|
│
|
|
@@ -88,6 +88,11 @@ hands it to the agent as its opening message:
|
|
|
88
88
|
→ the NEXT session inherits it as carryover
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
The prior session's outcome is extracted from the log and inlined into the opening
|
|
92
|
+
prompt directly — not just a path the agent is told to go read. No separate file,
|
|
93
|
+
no index, nothing new in the vault: it's read straight out of the session log you
|
|
94
|
+
already have, every launch.
|
|
95
|
+
|
|
91
96
|
One environment variable, `AI_MEM_ROOT`, points at the vault, so the whole system
|
|
92
97
|
moves between machines by pointing at the same folder.
|
|
93
98
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ai-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Persistent, agent-agnostic session memory for AI coding CLIs (Claude Code, Codex, Gemini, Cursor, opencode). One Markdown vault, any agent.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-ai-memory": "bin/create-ai-memory.js"
|
|
7
7
|
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "zsh tests/run.sh",
|
|
10
|
+
"prepublishOnly": "npm test"
|
|
11
|
+
},
|
|
8
12
|
"type": "commonjs",
|
|
9
13
|
"engines": {
|
|
10
14
|
"node": ">=18"
|
package/shell/ai-mem.zsh
CHANGED
|
@@ -182,14 +182,62 @@ _ai_mem_prepare_session() {
|
|
|
182
182
|
print -r -- "$project_name|$project_note|$previous_session_note|$session_note"
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
# Pull one "* **Label:** value" bullet out of a session log's fixed
|
|
186
|
+
# "# Session Outcome" section. Reads the log directly — no separate file is
|
|
187
|
+
# ever written, so there is nothing extra sitting in the vault.
|
|
188
|
+
_ai_mem_session_field() {
|
|
189
|
+
local file="$1" label="$2" value
|
|
190
|
+
[[ -f "$file" ]] || return 0
|
|
191
|
+
value="$(grep -m1 -E "^\* \*\*${label}:\*\*" "$file" | sed -E "s|^\* \*\*${label}:\*\*[[:space:]]*||")"
|
|
192
|
+
# An untouched template still has its literal [bracket] placeholder — that
|
|
193
|
+
# is not real content, so treat it the same as an empty field.
|
|
194
|
+
[[ "$value" == \[*\] ]] && return 0
|
|
195
|
+
print -r -- "$value"
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
# Defensive cap so one unusually long freeform bullet can't blow up the
|
|
199
|
+
# prompt. Never triggers for the template's intended single-line bullets.
|
|
200
|
+
_ai_mem_cap_field() {
|
|
201
|
+
local text="$1" cap="${2:-500}" source_ref="$3"
|
|
202
|
+
if (( ${#text} > cap )); then
|
|
203
|
+
print -r -- "${text[1,$cap]}… (truncated, ${#text} chars total — see $source_ref)"
|
|
204
|
+
else
|
|
205
|
+
print -r -- "$text"
|
|
206
|
+
fi
|
|
207
|
+
}
|
|
208
|
+
|
|
185
209
|
_ai_mem_context_prompt() {
|
|
186
210
|
local project_note="${1:-}"
|
|
187
211
|
local previous_session_note="${2:-}"
|
|
188
212
|
local session_note="${3:-}"
|
|
189
213
|
local previous_session_label="(none yet)"
|
|
214
|
+
local previous_session_block="- Latest prior session log: (none yet)"
|
|
190
215
|
|
|
191
216
|
if [[ -n "$previous_session_note" ]]; then
|
|
192
217
|
previous_session_label="$previous_session_note"
|
|
218
|
+
|
|
219
|
+
local summary decisions blockers next
|
|
220
|
+
summary="$(_ai_mem_session_field "$previous_session_note" 'High-Level Summary')"
|
|
221
|
+
decisions="$(_ai_mem_session_field "$previous_session_note" 'Important Decisions')"
|
|
222
|
+
blockers="$(_ai_mem_session_field "$previous_session_note" 'Constraints / Blockers')"
|
|
223
|
+
next="$(_ai_mem_session_field "$previous_session_note" 'Next Step')"
|
|
224
|
+
|
|
225
|
+
if [[ -z "${AI_MEM_NO_DIGEST:-}" && ( -n "$summary" || -n "$decisions" || -n "$blockers" || -n "$next" ) ]]; then
|
|
226
|
+
[[ -n "$summary" ]] || summary="—"
|
|
227
|
+
[[ -n "$decisions" ]] || decisions="—"
|
|
228
|
+
[[ -n "$blockers" ]] || blockers="—"
|
|
229
|
+
[[ -n "$next" ]] || next="—"
|
|
230
|
+
|
|
231
|
+
previous_session_block="- Latest prior session ($previous_session_note), summarized below:"
|
|
232
|
+
previous_session_block+=$'\n'"* **Summary:** $(_ai_mem_cap_field "$summary" 500 "$previous_session_note")"
|
|
233
|
+
previous_session_block+=$'\n'"* **Decisions:** $(_ai_mem_cap_field "$decisions" 500 "$previous_session_note")"
|
|
234
|
+
previous_session_block+=$'\n'"* **Blockers:** $(_ai_mem_cap_field "$blockers" 500 "$previous_session_note")"
|
|
235
|
+
previous_session_block+=$'\n'"* **Next:** $(_ai_mem_cap_field "$next" 500 "$previous_session_note")"
|
|
236
|
+
else
|
|
237
|
+
previous_session_block="- Latest prior session log: $previous_session_label"
|
|
238
|
+
previous_session_block+=$'\n'
|
|
239
|
+
previous_session_block+="Read the latest prior session log for continuity before acting. Do not load the full session history unless the user asks for it."
|
|
240
|
+
fi
|
|
193
241
|
fi
|
|
194
242
|
|
|
195
243
|
cat <<EOF
|
|
@@ -201,12 +249,11 @@ $(_ai_mem_note_contents "$AI_MEM_GLOBAL")
|
|
|
201
249
|
$(_ai_mem_note_contents "$AI_MEM_STANDARDS")
|
|
202
250
|
|
|
203
251
|
- Project context: $project_note
|
|
204
|
-
|
|
252
|
+
$previous_session_block
|
|
205
253
|
- Active session log: $session_note
|
|
206
254
|
|
|
207
255
|
Use the Obsidian vault as the persistent memory layer.
|
|
208
256
|
Treat the global profile and standards note as the shared baseline for every run.
|
|
209
|
-
Read the latest prior session log for continuity before acting. Do not load the full session history unless the user asks for it.
|
|
210
257
|
Keep durable preferences and project facts in the vault, and keep the active session log updated with decisions, blockers, and next steps.
|
|
211
258
|
EOF
|
|
212
259
|
}
|