Commit de6054e
committed
feat(core,storage,cli): evidence pointers and staleness flags for foreign session handoff
Follow-up to #1057 (parts 1+2 merged as #1208/#1221), implementing the
compatible half of ofekron's post-merge design feedback: the handoff
should carry claims with evidence pointers and confidence flags, not
just a summary.
- ForeignSessionDigest gains `transcriptPath` (the evidence pointer for
the whole digest) and `filesTouched` entries carry `lastEventAtMs` —
the source event's own timestamp. Timestamps were chosen over
transcript line offsets deliberately: large transcripts are read as a
bounded TAIL window, where line numbers would be window-relative and
silently wrong.
- New handoff-time staleness check: @maka/storage probes the CURRENT
repo state (cwd existence, branch via .git/HEAD — worktree gitdir
files followed one level, no git spawn — and per-touched-file
mtimes), and pure core assessment turns mismatches into typed flags
(cwd_missing / branch_changed / files_changed / files_missing).
Per-file mtimes compare against each touch's own event timestamp,
falling back to the session clock.
- The report renders as a Maka-authored <repo-state-check> block
between the instruction and the untrusted envelope. An empty flag
list renders an explicit all-clear (a receiving agent must be able to
tell "checked and clean" from "never checked"), and stripEnvelopeTags
now covers the new tag so a hostile path cannot forge maka-verified
content. Probe failure degrades to the unchecked handoff shape.
- Deliberately NOT implemented from the feedback: carrying "checks run
and observed results" forward — tool outputs stay excluded per the
#1057 safety contract; the staleness flags provide the confidence
signal without trusting the transcript's account of the world.
Tests: core 1183/1183 (evidence semantics, every flag kind, all-clear
rendering, envelope-forgery defense, handoff composition), storage
530/530 (probe on real dirs: branch, worktree gitdir, detached HEAD,
missing cwd), cli 652/652 (handoff carries the flagged report
end-to-end through the picker import).1 parent 9d9a47b commit de6054e
7 files changed
Lines changed: 392 additions & 26 deletions
File tree
- packages
- cli/src
- __tests__
- core/src
- __tests__
- storage/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5819 | 5819 | | |
5820 | 5820 | | |
5821 | 5821 | | |
| 5822 | + | |
| 5823 | + | |
| 5824 | + | |
| 5825 | + | |
5822 | 5826 | | |
5823 | 5827 | | |
5824 | 5828 | | |
| |||
5829 | 5833 | | |
5830 | 5834 | | |
5831 | 5835 | | |
5832 | | - | |
| 5836 | + | |
5833 | 5837 | | |
| 5838 | + | |
5834 | 5839 | | |
5835 | 5840 | | |
5836 | | - | |
| 5841 | + | |
5837 | 5842 | | |
5838 | 5843 | | |
5839 | 5844 | | |
| |||
5867 | 5872 | | |
5868 | 5873 | | |
5869 | 5874 | | |
| 5875 | + | |
| 5876 | + | |
| 5877 | + | |
| 5878 | + | |
| 5879 | + | |
5870 | 5880 | | |
5871 | 5881 | | |
5872 | 5882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
1784 | 1785 | | |
1785 | 1786 | | |
1786 | 1787 | | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
1787 | 1797 | | |
1788 | 1798 | | |
1789 | 1799 | | |
1790 | 1800 | | |
1791 | 1801 | | |
1792 | 1802 | | |
1793 | | - | |
| 1803 | + | |
1794 | 1804 | | |
1795 | 1805 | | |
1796 | 1806 | | |
| |||
Binary file not shown.
0 commit comments