Commit b87ce05
* feat(kg): SPOC temporal validity — context slot + auto-derived valid_from + as_of timeline
KG triples gain a `context` fourth axis on the AGE backend that anchors
each fact to its witnessing drawer/conversation. Read paths
(`query_triples`, `query_entity`, `query_relationship`, `timeline`) all
surface the slot; triples written before this change read back with
`context=None` so consumers don't need a missing-key check. No AGE
schema migration needed — just a new property on existing RELATION
edges.
The async KG-extraction worker (`kg_triple_worker.py`) now anchors
every auto-extracted triple to `context=drawer:{drawer_id}` and falls
back to the drawer's metadata `timestamp` / `filed_at` /
`session_created_at` (first non-empty wins) for `valid_from` when the
LLM extractor doesn't supply one. An explicit `valid_from` from the
extractor — a date parsed out of the prose — still takes precedence.
MCP-tool surface:
* `mempalace_kg_add` accepts `context` (AGE backend stores;
SQLite silently ignores so callers don't branch on backend).
* `mempalace_kg_timeline` accepts `as_of` and validates it through
the same ISO-8601 gate as `mempalace_kg_query`; the accepted value
round-trips in the response.
Tests: +20 (3631 → 3651). Worker unit tests cover the context-anchor,
auto-derive priority, extractor-vs-drawer precedence, and the
missing-timestamp open-interval path; AGE tests cover the context slot
on every read path + `timeline(as_of=...)` filtering both with and
without an entity filter; MCP tests cover boundary rejection on `as_of`
and `context` plus the round-trip response shape.
Closes #161
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(docs): backtick-quote `_derive_valid_from` in fork-changes entry
CI's markdownlint reads underscores following ", " as italic-emphasis
markers (MD037), tripping on the unquoted `_derive_valid_from` test
description. Backtick-quoting promotes it to inline-code and lets the
lint pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1e6327a commit b87ce05
12 files changed
Lines changed: 970 additions & 185 deletions
File tree
- docs
- mempalace
- tests
- website
- public
- reference/python-api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
71 | 115 | | |
72 | 116 | | |
73 | 117 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
79 | 133 | | |
80 | 134 | | |
81 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
200 | 234 | | |
201 | 235 | | |
202 | 236 | | |
| |||
208 | 242 | | |
209 | 243 | | |
210 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
211 | 274 | | |
212 | 275 | | |
213 | 276 | | |
| |||
459 | 522 | | |
460 | 523 | | |
461 | 524 | | |
| 525 | + | |
462 | 526 | | |
463 | 527 | | |
464 | 528 | | |
| |||
467 | 531 | | |
468 | 532 | | |
469 | 533 | | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
470 | 538 | | |
471 | 539 | | |
472 | 540 | | |
| |||
492 | 560 | | |
493 | 561 | | |
494 | 562 | | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
495 | 566 | | |
496 | 567 | | |
497 | 568 | | |
| |||
526 | 597 | | |
527 | 598 | | |
528 | 599 | | |
| 600 | + | |
529 | 601 | | |
530 | 602 | | |
531 | 603 | | |
| |||
540 | 612 | | |
541 | 613 | | |
542 | 614 | | |
| 615 | + | |
| 616 | + | |
543 | 617 | | |
544 | 618 | | |
545 | 619 | | |
| |||
549 | 623 | | |
550 | 624 | | |
551 | 625 | | |
| 626 | + | |
552 | 627 | | |
553 | 628 | | |
554 | 629 | | |
| |||
633 | 708 | | |
634 | 709 | | |
635 | 710 | | |
636 | | - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
637 | 714 | | |
638 | 715 | | |
639 | 716 | | |
640 | 717 | | |
641 | 718 | | |
642 | 719 | | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
643 | 727 | | |
644 | 728 | | |
645 | 729 | | |
| |||
663 | 747 | | |
664 | 748 | | |
665 | 749 | | |
666 | | - | |
667 | | - | |
| 750 | + | |
| 751 | + | |
668 | 752 | | |
| 753 | + | |
669 | 754 | | |
670 | 755 | | |
671 | 756 | | |
| |||
0 commit comments