pi-sleep-agent 0.8.4 → 0.8.5
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 +2 -1
- package/package.json +1 -1
- package/sleepkit/store.py +21 -2
package/README.md
CHANGED
|
@@ -319,7 +319,7 @@ Run the two dream components separately when you want more control:
|
|
|
319
319
|
| `./sleep.py replay --run --limit 3` | Compare selected tasks with memory off and on |
|
|
320
320
|
| `./sleep.py mine --dry-run` | Find preferences repeated across sessions |
|
|
321
321
|
| `./sleep.py nightly --dry-run` | Preview the unattended nightly workflow |
|
|
322
|
-
| `./sleep.py doctor` | Find duplicate or overlapping memory records, flag contradicting candidates (same subject, one side carries a correction marker), flag provisional candidates not rediscovered for 4+ weeks, and report records parked in quarantine awaiting a human (report only
|
|
322
|
+
| `./sleep.py doctor` | Find duplicate or overlapping memory records, flag contradicting candidates (same subject, one side carries a correction marker) and print the `supersede <older> <newer>` command to run, flag provisional candidates not rediscovered for 4+ weeks, and report records parked in quarantine awaiting a human (report only: it never supersedes, drops, merges or un-parks anything itself) |
|
|
323
323
|
| `./sleep.py doctor --stale <value>` | Show which approved records still hold a stale value (e.g. a changed URL) |
|
|
324
324
|
| `./sleep.py supersede <old> <new>` | Mark `<old>` invalid as of now and `<new>` valid as of now (`valid_until` / `valid_from`), so the window a memory was true is readable from the files |
|
|
325
325
|
| `./sleep.py inject --project "$PWD"` | Print provisional context for the current project, newest first, each line dated |
|
|
@@ -445,5 +445,6 @@ Run `./sleep.py show <id>` and check its `cwd`. Mixed-project batches are partit
|
|
|
445
445
|
|
|
446
446
|
- [Sleep: the reviewable-memory extension for coding agents](https://aydinnyunus.github.io/2026/11/01/sleep-agent-memory-extension/) (blog)
|
|
447
447
|
- [Measured evidence and validation history](docs/EVIDENCE.md)
|
|
448
|
+
- [Agent-memory landscape: what other tools do that sleep does not](docs/MEMORY-TOOLS-COMPARISON.md)
|
|
448
449
|
- [Sleep Framework analysis](sleep-framework.md)
|
|
449
450
|
- [Shared `/sleep` skill](shared-skill/sleep/SKILL.md)
|
package/package.json
CHANGED
package/sleepkit/store.py
CHANGED
|
@@ -600,6 +600,15 @@ def prune_buffer(older_than_hours: float = 0.0, session: str | None = None) -> d
|
|
|
600
600
|
return {"moved": moved, "remaining": buffer_counts()}
|
|
601
601
|
|
|
602
602
|
|
|
603
|
+
def _older_newer(a: str, b: str, ts_by_id: dict) -> tuple[str, str]:
|
|
604
|
+
"""Order two candidate ids by capture time, oldest first. ts is ISO-ish and sorts
|
|
605
|
+
lexicographically; a missing ts falls back to the id so a pair is always returned."""
|
|
606
|
+
ta, tb = ts_by_id.get(a, ""), ts_by_id.get(b, "")
|
|
607
|
+
if ta and tb and ta != tb:
|
|
608
|
+
return (a, b) if ta < tb else (b, a)
|
|
609
|
+
return (a, b) if a <= b else (b, a)
|
|
610
|
+
|
|
611
|
+
|
|
603
612
|
def doctor(memory_dir: str | None = None, targets: list[str] | None = None,
|
|
604
613
|
needle: str | None = None) -> list[dict]:
|
|
605
614
|
"""Read-only hygiene report.
|
|
@@ -642,7 +651,9 @@ def doctor(memory_dir: str | None = None, targets: list[str] | None = None,
|
|
|
642
651
|
if nlow in text.lower():
|
|
643
652
|
out.append({"issue": "stale-value-in-memory", "file": p,
|
|
644
653
|
"value": needle})
|
|
645
|
-
|
|
654
|
+
pool_records = list_candidates(with_body=True)
|
|
655
|
+
pool = [(c["id"], c.get("_body", "")) for c in pool_records]
|
|
656
|
+
pool_ts = {c["id"]: str(c.get("ts", "")) for c in pool_records}
|
|
646
657
|
for i in range(len(pool)):
|
|
647
658
|
for j in range(i + 1, len(pool)):
|
|
648
659
|
sim = similarity(pool[i][1], pool[j][1])
|
|
@@ -656,8 +667,16 @@ def doctor(memory_dir: str | None = None, targets: list[str] | None = None,
|
|
|
656
667
|
elif sim >= CONTRADICTION_OVERLAP:
|
|
657
668
|
mi, mj = bool(_CORRECTION.search(pool[i][1])), bool(_CORRECTION.search(pool[j][1]))
|
|
658
669
|
if mi != mj:
|
|
670
|
+
# Name the older/newer side so a person does not diff two timestamps by
|
|
671
|
+
# eye: the older record is the claim, the newer one is the correction.
|
|
672
|
+
# The suggestion is a command to RUN, never one this code runs -
|
|
673
|
+
# superseding on a keyword match could kill a true memory, so the gate
|
|
674
|
+
# stays human.
|
|
675
|
+
older, newer = _older_newer(pool[i][0], pool[j][0], pool_ts)
|
|
659
676
|
out.append({"issue": "contradicting-candidates",
|
|
660
|
-
"pair": [pool[i][0], pool[j][0]], "similarity": round(sim, 2)
|
|
677
|
+
"pair": [pool[i][0], pool[j][0]], "similarity": round(sim, 2),
|
|
678
|
+
"older": older, "newer": newer,
|
|
679
|
+
"suggest": "sleep.py supersede %s %s" % (older, newer)})
|
|
661
680
|
cutoff_hours = STALE_CANDIDATE_WEEKS * 7 * 24
|
|
662
681
|
for c in list_candidates():
|
|
663
682
|
if c.get("status") != "provisional":
|