cognitive-memory/systemd/README.md
Cal Corum d8dd1f35a5 feat: complete multi-graph support across CLI, scripts, and systemd timers
Non-default graphs were second-class citizens — timers only maintained the
default graph, git sync ignored named graphs, there was no way to create
a graph without editing config manually, cross-graph edge errors were
confusing, and utility scripts were hardcoded to the default graph.

- Add `graph-create` CLI command + `create_graph()` in common.py, with
  custom path registration written to the default graph's _config.json
- Add `scripts/maintain-all-graphs.sh` to loop decay/core/embed/reflect
  over all discovered graphs; update systemd services to call it
- Refactor `memory-git-sync.sh` into sync_repo() function that iterates
  default + all named graphs with .git directories
- Improve cross-graph edge ValueError to explain the same-graph constraint
- Add --graph flag to edge-proposer.py and session_memory.py
- Update systemd/README.md with portable paths and new architecture

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 22:35:55 -06:00

63 lines
2.1 KiB
Markdown

# Cognitive Memory Systemd Timers
Reference copies of the systemd user units that automate memory maintenance.
## Services
| Unit | Schedule | What it does |
|------|----------|-------------|
| `cognitive-memory-daily` | daily | Decay scores, regenerate CORE.md, git sync — for ALL graphs |
| `cognitive-memory-embed` | hourly | Refresh embeddings (skips if unchanged) — for ALL graphs |
| `cognitive-memory-weekly` | weekly | Run reflection cycle — for ALL graphs |
All three services now call `scripts/maintain-all-graphs.sh` instead of
individual `claude-memory` commands. The script discovers every graph via
`claude-memory graphs` (default graph + named graphs under
`~/.local/share/cognitive-memory-graphs/`) and runs the appropriate command
for each one, passing `--graph <name>` for non-default graphs.
Named graph directories that do not exist on disk are silently skipped.
## Scripts
| Script | Purpose |
|--------|---------|
| `scripts/maintain-all-graphs.sh` | Loop decay/core/embed/reflect over all graphs |
| `scripts/memory-git-sync.sh` | Git commit+push for default graph and all named git repos |
## Install / Update
```bash
# Copy units into place (adjust source path to your cognitive-memory install)
CMDIR=~/.claude/skills/cognitive-memory # or /mnt/NV2/Development/cognitive-memory
cp "$CMDIR"/systemd/*.service "$CMDIR"/systemd/*.timer \
~/.config/systemd/user/
# Reload and enable
systemctl --user daemon-reload
systemctl --user enable --now cognitive-memory-daily.timer
systemctl --user enable --now cognitive-memory-embed.timer
systemctl --user enable --now cognitive-memory-weekly.timer
```
## Verify
```bash
systemctl --user list-timers 'cognitive-memory-*'
systemctl --user start cognitive-memory-daily.service # manual test run
journalctl --user -u cognitive-memory-daily.service --since today
```
## Manual test (single graph)
```bash
# Default graph only
claude-memory decay && claude-memory core
# Named graph
claude-memory --graph paper-dynasty decay && claude-memory --graph paper-dynasty core
# All graphs at once (adjust path to your install)
/path/to/cognitive-memory/scripts/maintain-all-graphs.sh --daily
```