@lh8ppl/claude-memory-kit 0.1.0 → 0.1.2

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.
Files changed (46) hide show
  1. package/README.md +77 -0
  2. package/bin/cmk-auto-extract.mjs +62 -0
  3. package/bin/cmk-capture-prompt.mjs +65 -0
  4. package/bin/cmk-capture-turn.mjs +76 -0
  5. package/bin/cmk-compress-lazy.mjs +0 -0
  6. package/bin/cmk-compress-session.mjs +64 -0
  7. package/bin/cmk-daily-distill.mjs +0 -0
  8. package/bin/cmk-inject-context.mjs +69 -0
  9. package/bin/cmk-observe-edit.mjs +57 -0
  10. package/bin/cmk-weekly-curate.mjs +0 -0
  11. package/bin/cmk.mjs +11 -11
  12. package/package.json +10 -2
  13. package/src/audit-log.mjs +1 -0
  14. package/src/claude-md.mjs +212 -212
  15. package/src/compressor.mjs +18 -18
  16. package/src/doctor.mjs +21 -8
  17. package/src/frontmatter.mjs +73 -73
  18. package/src/index-rebuild.mjs +26 -4
  19. package/src/inject-context.mjs +150 -10
  20. package/src/install.mjs +49 -1
  21. package/src/mcp-server.mjs +17 -0
  22. package/src/memory-write.mjs +18 -5
  23. package/src/merge-facts.mjs +213 -213
  24. package/src/provenance.mjs +217 -217
  25. package/src/reindex.mjs +134 -134
  26. package/src/repair.mjs +26 -96
  27. package/src/sanitize.mjs +39 -0
  28. package/src/settings-hooks.mjs +186 -0
  29. package/src/spawn-bin.mjs +83 -0
  30. package/src/subcommands.mjs +144 -10
  31. package/src/write-fact.mjs +46 -3
  32. package/template/.gitignore.fragment +12 -12
  33. package/template/CLAUDE.md.template +53 -49
  34. package/template/docs/journey/journey-log.md.template +292 -292
  35. package/template/project/memory/INDEX.md.template +47 -47
  36. package/template/support/cron-jobs/daily-memory-distill.md +15 -15
  37. package/template/support/cron-jobs/nightly-memsearch-index.md +17 -17
  38. package/template/support/cron-jobs/weekly-memory-curator.md +15 -15
  39. package/template/support/milvus-deploy/README.md +57 -57
  40. package/template/support/milvus-deploy/docker-compose.yml +66 -66
  41. package/template/support/scripts/auto-extract-memory.sh +102 -102
  42. package/template/support/scripts/memsearch-index-with-flush.sh +59 -59
  43. package/template/support/scripts/refresh-distill-timestamp.py +35 -35
  44. package/template/support/scripts/register-crons.py +242 -242
  45. package/template/support/scripts/run-daily-distill.sh +67 -67
  46. package/template/support/scripts/run-weekly-curate.sh +58 -58
@@ -1,58 +1,58 @@
1
- #!/usr/bin/env bash
2
- #
3
- # Weekly memory curator — invokes Claude headlessly with a prompt that
4
- # prunes, merges, and consolidates entries in context/MEMORY.md.
5
- #
6
- # Wired by cron/jobs/weekly-memory-curator.md → schtasks/cron at Sun 09:00.
7
-
8
- case ":$PATH:" in
9
- *":/usr/bin:"*) ;;
10
- *) export PATH="/usr/bin:/usr/local/bin:/opt/homebrew/bin:/c/Program Files/Git/usr/bin:$PATH" ;;
11
- esac
12
-
13
- set -euo pipefail
14
-
15
- REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
16
- cd "$REPO_ROOT"
17
-
18
- TODAY=$(date +%Y-%m-%d)
19
- SESSION_LOG="context/sessions/${TODAY}.md"
20
-
21
- PROMPT=$(cat <<EOF
22
- You are running as a scheduled weekly background task at $(date -Iseconds) for this project. No human is watching. Be conservative — if unsure whether something should be kept, KEEP IT.
23
-
24
- GOAL: prune, merge, and consolidate \`context/MEMORY.md\` so it stays informative and well under the 2500-char cap.
25
-
26
- STEPS:
27
- 1. Read \`context/MEMORY.md\` end to end.
28
- 2. Read \`context/memory/INDEX.md\` and at least the most recent 3 session logs (\`ls -t context/sessions/ | head -3\`) for context on what's currently relevant.
29
- 3. For each entry in MEMORY.md "Active Threads":
30
- - Is it still being worked on? Check session logs. If resolved → REMOVE.
31
- - Are there duplicates? → MERGE into one.
32
- 4. For each "Environment Note":
33
- - Is it still accurate? Drop only if clearly stale.
34
- 5. For each "Pending Decision":
35
- - Has it been resolved (look for matching deliverables in recent session logs)? → REMOVE.
36
- - Has new context arrived? → UPDATE the bullet to reflect current state.
37
- 6. After curating, run \`wc -c context/MEMORY.md\` and report the new size.
38
- 7. Update the \`<!-- Last health check: YYYY-MM-DD -->\` line to ${TODAY}.
39
- 8. If today doesn't have a session log yet, create \`${SESSION_LOG}\` with a "## Session — automated curation" heading. Append a summary of what was changed (e.g., "Removed 2 resolved threads, merged 3 environment-notes duplicates, new size 1840/2500 chars.").
40
-
41
- CONSTRAINTS:
42
- - Use Read, Edit, and Bash(wc *), Bash(ls *), Bash(date *) only.
43
- - NEVER add new content during curation — this is a cleanup pass, not a writing pass. If you find something missing, NOTE it in the session log but don't add to MEMORY.md.
44
- - Do NOT touch granular archive files in context/memory/<type>_*.md unless they're obviously orphaned (no INDEX entry AND no references in MEMORY.md AND no recent session log mention).
45
- - Do NOT commit, push, or run git operations.
46
- - Keep total output under 5 lines: summary of changes only.
47
- EOF
48
- )
49
-
50
- echo "$PROMPT" | claude --print \
51
- --add-dir "$REPO_ROOT" \
52
- --allowed-tools "Read" "Edit" "Bash(wc *)" "Bash(ls *)" "Bash(date *)" \
53
- --output-format text \
54
- 2>&1 | tee -a "${REPO_ROOT}/context/sessions/${TODAY}.curate.log"
55
-
56
- EXIT=${PIPESTATUS[0]}
57
- echo "[$(date -Iseconds)] weekly-curate: exit=$EXIT" >&2
58
- exit "$EXIT"
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Weekly memory curator — invokes Claude headlessly with a prompt that
4
+ # prunes, merges, and consolidates entries in context/MEMORY.md.
5
+ #
6
+ # Wired by cron/jobs/weekly-memory-curator.md → schtasks/cron at Sun 09:00.
7
+
8
+ case ":$PATH:" in
9
+ *":/usr/bin:"*) ;;
10
+ *) export PATH="/usr/bin:/usr/local/bin:/opt/homebrew/bin:/c/Program Files/Git/usr/bin:$PATH" ;;
11
+ esac
12
+
13
+ set -euo pipefail
14
+
15
+ REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
16
+ cd "$REPO_ROOT"
17
+
18
+ TODAY=$(date +%Y-%m-%d)
19
+ SESSION_LOG="context/sessions/${TODAY}.md"
20
+
21
+ PROMPT=$(cat <<EOF
22
+ You are running as a scheduled weekly background task at $(date -Iseconds) for this project. No human is watching. Be conservative — if unsure whether something should be kept, KEEP IT.
23
+
24
+ GOAL: prune, merge, and consolidate \`context/MEMORY.md\` so it stays informative and well under the 2500-char cap.
25
+
26
+ STEPS:
27
+ 1. Read \`context/MEMORY.md\` end to end.
28
+ 2. Read \`context/memory/INDEX.md\` and at least the most recent 3 session logs (\`ls -t context/sessions/ | head -3\`) for context on what's currently relevant.
29
+ 3. For each entry in MEMORY.md "Active Threads":
30
+ - Is it still being worked on? Check session logs. If resolved → REMOVE.
31
+ - Are there duplicates? → MERGE into one.
32
+ 4. For each "Environment Note":
33
+ - Is it still accurate? Drop only if clearly stale.
34
+ 5. For each "Pending Decision":
35
+ - Has it been resolved (look for matching deliverables in recent session logs)? → REMOVE.
36
+ - Has new context arrived? → UPDATE the bullet to reflect current state.
37
+ 6. After curating, run \`wc -c context/MEMORY.md\` and report the new size.
38
+ 7. Update the \`<!-- Last health check: YYYY-MM-DD -->\` line to ${TODAY}.
39
+ 8. If today doesn't have a session log yet, create \`${SESSION_LOG}\` with a "## Session — automated curation" heading. Append a summary of what was changed (e.g., "Removed 2 resolved threads, merged 3 environment-notes duplicates, new size 1840/2500 chars.").
40
+
41
+ CONSTRAINTS:
42
+ - Use Read, Edit, and Bash(wc *), Bash(ls *), Bash(date *) only.
43
+ - NEVER add new content during curation — this is a cleanup pass, not a writing pass. If you find something missing, NOTE it in the session log but don't add to MEMORY.md.
44
+ - Do NOT touch granular archive files in context/memory/<type>_*.md unless they're obviously orphaned (no INDEX entry AND no references in MEMORY.md AND no recent session log mention).
45
+ - Do NOT commit, push, or run git operations.
46
+ - Keep total output under 5 lines: summary of changes only.
47
+ EOF
48
+ )
49
+
50
+ echo "$PROMPT" | claude --print \
51
+ --add-dir "$REPO_ROOT" \
52
+ --allowed-tools "Read" "Edit" "Bash(wc *)" "Bash(ls *)" "Bash(date *)" \
53
+ --output-format text \
54
+ 2>&1 | tee -a "${REPO_ROOT}/context/sessions/${TODAY}.curate.log"
55
+
56
+ EXIT=${PIPESTATUS[0]}
57
+ echo "[$(date -Iseconds)] weekly-curate: exit=$EXIT" >&2
58
+ exit "$EXIT"