The last piece of #866. #899 stopped a linked folder's subdirectories from
collapsing, and same-named documents no longer overwrite or vanish — but the
reporter's actual workflow still could not rebuild his tree. He added one
subtree at a time, and a browser folder pick reports each file's path
relative to the chosen directory: `应用开发/钉钉CLI/` arrives as
`钉钉CLI/...`, with no way to say it belongs under `应用开发/`. Every batch
piled up at the KB root, and the ancestor was not missing data — it was
never in the payload.
Uploads now take an optional destination folder, composed ahead of each
file's own relative path. The picker offers the KB's existing folders (and
its root, the default) once files are staged, so batching a large tree is a
matter of picking where each part goes. It runs through the same
_sanitize_rel_subdir guard as a directory upload's own path, so a crafted
value cannot escape raw/.
Listing folders is best-effort: if that call fails the picker simply does
not appear and the batch goes to the root exactly as before.
Linked-folder sync keeps its own root-relative staging and does not take a
destination prefix yet — that needs the prefix persisted per linked folder
in metadata, which is a separate change.
#923 fixed the blank transcript in #912 — an orphaned message tree. The
same report's other screenshot is a different failure that survived it: the
overlay stuck on "Loading conversation / Still loading…" with the request
already answered in devtools.
Two paths led there, and both told the user their history was gone:
* The wait was unbounded ("the overlay stays until the API responds (no
timeout)"). A fetch that never settled span forever, and the only exit was
✕ — which abandons the conversation. The wait is now bounded, and the 8s
hint is no longer the last thing that ever happens.
* A cold open that *failed* ran router.replace("/home"), dropping the
session id from the URL. A transient error was indistinguishable from a
lost conversation, and the id needed to retry was gone.
Both now end in one terminal, retryable state with the id still in the URL:
the overlay shows the failure and a Retry, ✕ still means "leave". A failed
background revalidate is unchanged — the cached transcript stays on screen
rather than being replaced by an error.
Which of the three aborts counts as a failure is the whole subtlety (a
newer load and the user's ✕ own the state that replaces this one; a timeout
owns nothing), so that decision lives in a tested predicate rather than
inline in the component.
Builds on #899, which stopped a linked folder's subdirectories from
collapsing into raw/'s top level. Preserving structure removes most name
clashes but not the one #866 actually hit: a folder too large to sync at
once is added one subfolder at a time, and each batch roots at its own
folder, so `cli/README.md` and `events/README.md` both want raw/README.md.
The second was skipped as a "filename collision" — a document the user
asked to index, dropped with nothing in the response to say so.
A clash between different bytes now stages under a free sibling name.
Identical bytes still recover the staged copy, and content-level dedup via
file_hashes is untouched, so a repeated sync neither duplicates nor churns.
The staging log also reports the path a file actually landed at rather than
its source basename, which is no longer the same thing.
Builds on #922, which made read-only scans tolerate undecodable bytes and
kept the read-modify-write paths strict. Strict was the right call, but the
refusal was invisible: append_note / set_property let a raw
UnicodeDecodeError escape, _ObsidianTool.execute catches only VaultError,
so the model was told "an unknown error occurred" — the exact failure mode
#914 reported spending rounds guessing at.
* The two write paths raise VaultError naming the note, the byte offset and
the fix. The vault is still never rewritten with U+FFFD in place of the
user's bytes.
* Both decoders now live in one place each (_read_text / _read_text_exact)
rather than four repeated read_text calls, so which of the two a new
caller wants is a decision the module states once.
* execute() reports any other unexpected exception to the model by type and
message, and logs the traceback for the operator.
* Frontmatter dates serialise through isoformat() rather than str(), so a
YAML timestamp reaches the model as 2026-08-11T09:30:00 instead of
2026-08-11 09:30:00, which is not a date it can hand back.
Asking the tutor "what am I studying?" in a fresh chat answered "no
mastery path has been built yet, let me create one" to learners who had
several, and left an empty path behind for every attempt (#909).
Both halves come from reads going through get_or_create. A turn with no
explicit path and no selected book resolves its id to the conversation's
own scratch id, so the creating read manufactured a path under that id —
five such asks, five orphaned empty paths — and then truthfully reported
the empty thing it had just made.
Reads now load without creating (_load_path). mastery_status treats a
missing path exactly like an unbuilt one, and mastery_quiz / _grade /
_assess refuse an unbuilt path by name instead of half-creating it.
The empty-status message is the other half: unconditionally telling the
model to build is what made it replace a course rather than look for it.
It now reports how many built paths exist elsewhere and points at
mastery_paths / mastery_switch, keeping the build prompt for a learner
who genuinely has none.
Building still creates — mastery_build goes through its own write path.
eslint is not one of CI's gates, so #921 merged with three errors in it. Two
were real:
* ``useMarkdown`` is a pure predicate, but the ``use`` prefix made it read as a
hook and calling it inside the message map tripped
react-hooks/rules-of-hooks. Renamed to ``rendersMarkdown``.
* The connect effect called ``setConnected(false)`` synchronously. It runs once
on mount, ``connected`` already starts false, and the client's own onClose
clears it — so the call did nothing but cascade a render.
`npx eslint .` is now clean of errors (79 pre-existing i18n literal warnings
remain).
The non-SSE JSON stream branch carried a TODO and passed reasoning blocks straight through. Share one incremental thinking-block parser between both branches, so a tag split across chunks or left unclosed is handled the same way either way.
#924 and #921 each added a magic string to the capability↔runtime contract —
``end_loop`` read by the chat pipeline, ``agent_output`` / ``event_metadata``
read by the orchestrator — discoverable only by reading the code that consumes
them. An out-of-tree capability had to guess.
Declare the three in deeptutor/capabilities/protocol.py, beside the interface a
capability author is already reading, with the semantics stated once. Turn
metadata stays a scratchpad; these are just the keys that leave it.
Adds PageIndex OSS as a knowledge-base type and moves PageIndex retrieval from traditional RAG to reasoning-based retrieval: a small workflow-owned agent loop reads the document tree instead of going through the built-in MCP server, which this removes.
#908 and #911 landed two plugin groups — deeptutor.plugins for registry
capabilities, deeptutor.loop_capabilities for chat-loop ones — each with its own
copy of the same plumbing: read the group, import each target, warn and skip
whatever fails. Only the coercer actually differed.
Move the plumbing into core/entry_points.py, which both layers already depend
on, so the containment guarantee (one bad plugin cannot stop the others) is
stated and tested once instead of twice. Both suites now stub the single seam
rather than a module-local alias.
Drops #908's Python <3.10 entry_points() fallback along the way: the project
requires >=3.11, so the keyword form is the only API in play.
Scope stale-page detection to the KB documents that actually changed, and refuse to clear a drift warning while flagged pages are still awaiting recompilation (force=true overrides, since detection over-marks by design). One walk over raw/ per check, and a fingerprint-scheme tag so changing the formula re-baselines instead of marking every existing book stale.
Adds a /whisper workspace page (seat switch, room_id from the stream, trainee-only whisper/debrief) over the existing unified-ws with capability + config.room_id, and lets a capability publish a body and declared extras on CAPABILITY_COMPLETE via context.metadata['agent_output'] / ['event_metadata'] — capability, session_id and turn_id stay unspoofable.
When a loop capability sets context.metadata['end_loop'] during on_user_resume, skip further LLM rounds so the capability owns the final message. The user's reply still reaches the transcript — only the work that feeds it back to the model is skipped.
Adds max_concurrent_files, llm_model_max_async and entity_extract_max_gleaning to the lightrag.json slice and its config endpoint (#640). The wiring asks the installed RAG-Anything what it accepts and drops the rest with a warning, so an older install keeps working on the library defaults instead of raising TypeError; the extra's floor moves to the first release that carries the passthrough.
Persist captured reading segments per book under learning_captures.json with an explicit status lifecycle, so selections can be reviewed before any downstream export. Follows the existing book storage conventions: a path_service seam, atomic writes, and per-row validation that skips bad entries instead of failing the read.
Preserve POSIX directory traversal bits when retrying failed knowledge-base cleanup, so a failed rmtree leaves an orphan a later pass can still enter. Resolve the LlamaIndex image LLM client only after the embedding prerequisite passes, keeping text-only embedding setups independent of LLM configuration.
Adds a neutral deeptutor.loop_capabilities entry-point group so third-party packages can register chat-loop capabilities. LOOP_CAPABILITIES stays the builtin tuple; builtins win on name collisions and broken entry points are skipped. Discovery is cached for the process so plugin capabilities stay singletons like the builtins and neither hot path rescans distribution metadata.
`codebuddy-agent-sdk>=0.1.24,<0.2` cannot be satisfied: PyPI has no 0.1.24 —
the 0.1 series stops at 0.1.19 — so `pip install "deeptutor[codebuddy]"` and
`uv sync` both failed to resolve (reported in #854). Track the published
series with an upper bound intact.
The provider already handles kwarg drift across SDK versions: it tries the
snake_case and camelCase spellings of the turn limit and permission mode and
raises a clear error if neither lands, so it never degrades to running the
agent unrestricted.
CapabilityRegistry.load_plugins() and /plugins/list already imported deeptutor.plugins.loader behind a try/except, but the module never existed — plugin discovery was a dead path. Implement it: discover manifests from the deeptutor.plugins entry-point group and instantiate BaseCapability subclasses. PluginManifest carries exactly the fields both call sites read.
#923 inlined 25 lines of orphan detection into the middle of
buildVisiblePath, between "group by parent" and "walk". Extract it as
walkStartKey() so the function reads as its three steps again; behaviour and
the #912 regression tests are unchanged.
#920 called sanitize_invalid_ssl_env() through a function-local import, but
core.agentic.client already imports from services.llm at module scope, so
there was no cycle to dodge.
#910's runtime_context block branched on language inside the code to pick a
fallback paragraph, so the same guidance prose existed three times: once per
language in agentic_chat.yaml, and once per language inline. Every other block
in this assembler passes a short English default and lets the yaml carry the
localised wording.
The date *format* stays in code — that is locale data, not copy. The default
is now just the invariant fact.
#928 returned JSON for unhandled exceptions via @app.exception_handler
(Exception). Starlette installs that on its outermost ServerErrorMiddleware,
so the response skips every middleware registered in this module: the 500
carried no CORS headers — a cross-origin caller saw an opaque CORS failure
instead of the JSON body, defeating the point — and never reached the
selective access log either.
Same body, same status, registered as a middleware ahead of CORSMiddleware so
it sits inside it and the response travels back out through the normal stack.
One boundary rather than an out-of-band second mechanism.
Token counts arrive as a plain dict, a pydantic model, or a bare object with
attributes, and four readers each guessed the shape for themselves. #919 fixed
one of them (UsageTracker missed the dict case, so every streamed call on the
native adapters recorded zero), which left the other three still guessing.
Move the guess into services/llm/usage_frame.py: usage_mapping() answers "give
me this payload as a mapping", token_counts() returns DeepTutor's canonical
triple and takes the source key names, so the Responses API's
input_/output_tokens dialect stops needing its own hand-rolled copy.
Behaviour change, in the readers' favour: a provider that omits total_tokens
now gets prompt+completion instead of 0. An all-zero frame still reads as
falsy, which is what the streaming loop relies on to mean "no usage report".
Follow-up to #845. Tika is remote-only: files are sent to a configured tika-server via PUT /tika and the extracted text is written as Markdown, so no local install or model download is needed.
Fixes#866. DocumentAdder staged every externally-sourced file at raw/<basename>, collapsing a linked folder's subdirectories and colliding same-named files. Pass the sync root through so each file stages at its path relative to it.
Without the real date the model resolved 'today' from its training cutoff when composing web_search queries. Inject a day-granularity runtime_context block so the system prompt stays byte-stable within a day and keeps prompt-cache hits.
Fixes#912. Deleting a turn left descendants pointing at deleted rows, so the session lost its root and rendered a blank page. Splice deleted rows out of the parent-pointer tree on delete, and let buildVisiblePath recover already-corrupted sessions from their oldest orphan.
A stale SSL_CERT_FILE / SSL_CERT_DIR (common after a conda env is cloned without ca-certificates) made httpx raise FileNotFoundError mid client __init__. Drop broken CA paths so TLS falls back to the default bundle.
Fixes#914, Fixes#915. Read-only vault scans degrade one note instead of aborting the whole search; json.dumps(default=str) keeps unquoted YAML dates serialisable. Read-modify-write paths deliberately stay strict so replacement chars never land back in the vault.
UsageTracker.add_from_response read usage via attribute access, but TutorStreamChunk.usage is a plain dict, so every streamed call recorded 0 tokens and summary() returned None. Normalise dict / model_dump / attribute shapes in one place.
Immersive Reading, self-configuration, and a two-way IMA library.
- Immersive Reading: a new capability that opens a document beside the
thread. New reading engine (PDF pages / slides / page-sized sections),
five reading tools, a deterministic locate pre-pass that grounds the
turn without a second LLM call, /api/v1/reading, and a reader pane with
selection, highlights, notes, and export to an annotated PDF or Markdown.
- Setup capability: inspect the install, apply a setting, install a
parsing engine, or request a credential from a chat turn. New settings
spec table; a candidate value is probed before it is committed, and API
keys never enter the model's context.
- Tencent IMA: pipeline split into transport/envelope/models/sources/
notes/media/inventory, an additive capability with five tools, and
connected libraries that can finally be enumerated (bounded listings
are reported as a lower bound).
- Retrieval: supports_rag_retrieval() replaces is_connected_kb() for the
"can I sweep this?" question, so linked / lightrag_server / ima sources
stop being silently dropped from every book.
- Notebooks: their own console at /notebook, per-notebook locks and atomic
writes, copy / move / export routes, damaged files surfaced instead of
dropped, and renaming a record no longer clears its knowledge-base link.
- Settings persistence: one lock and one atomic replace shared by every
writer of interface.json; the PUT endpoints stop writing the
defaults-merged view back to disk.
Release notes: assets/releases/ver1-5-14.md
Book is the bulk of this one. Compilation outlives the request that
started it, so a bus owned by that request dropped every background event
and "watch your book being written" degraded into a frozen page; the
stream is now owned per book by the process and survives a refresh or a
reconnect. Reading progress is finally recorded — `visited_page_ids` and
`bookmarked_page_ids` had been declared but never written for the life of
the feature — and rolls up into a completion score and weak chapters. A
book can also leave the app now, as one self-contained Markdown document,
with non-ASCII titles surviving the download.
Two scheduling defects that were invisible in production are fixed: the
same page compiled twice concurrently (billed twice, one result
discarded), and a book grinding on through a provider outage until every
chapter was half-generated. The source sweep is bounded and allocated
round-robin rather than spent on the first few knowledge bases, and
retrieval now tells indexed bases from connected pointers, so an Obsidian
vault or a remote IMA library no longer contributes zero while looking
like a source with nothing relevant. Confirming a spine shows a live
per-chapter estimate derived from the Section Architect's own templates.
Also here: three home starter suggestions built from memory recall,
mastery-path handoff moved into one module that changes lease, session
preference, and live turn together, and account-level Tencent IMA
credentials with the per-KB pair still winning.
Notes: assets/releases/ver1-5-13.md
This commit also carries the README prose sync, the eleven translated
READMEs, the release-notes archive sweep, and the version bump. Two gate
fixes ride along: the `Stamped` protocol is declared read-only so the
frozen `EntityStamp` satisfies it, and six GraphRAG adapter tests that
reached a deep `graphrag` import without guarding it now skip like their
four neighbours instead of failing where the extra is not installed.
Changing the model-output language made the whole block vanish. Two causes,
and the second is the more interesting one.
The cache is keyed by language, so a switch correctly invalidates it and the
read returns nothing — but the background regeneration that would refill it was
being swallowed by the probe throttle. That interval exists because page loads
arrive in bursts and the material rarely changes between them; it is exactly
wrong when the caller already knows the cached set is unusable. A read that
finds a cache in another language now forces the probe past the interval. The
in-flight guard still applies, so forcing cannot fan out concurrent calls.
The deeper problem is that "no lines" rendered as "no slot". Every way this can
come up empty — cold cache, failed model call, re-reads that timed out, a
language just switched, no history at all — produced an identical blank space
with no way to act on it. The component now always renders its control once the
first read lands: a spinner with "finding what to explore next" while work is
in flight, and an explicit "suggest what to explore next" button whenever it is
not, which generates synchronously on click. When that returns nothing because
there is genuinely nothing to draw on, it says so rather than looking broken.
This is not the generic fallback copy that was removed earlier — that was
filler pretending to be a suggestion. This is a button that says what it does.
Two inputs, which is what this always should have been.
**L3.** The consolidated read on the learner — and in particular the
familiar/practising/unsure split in ``scope`` — is the single most useful thing
to know when proposing what to look at next, and it was not being read at all.
Now rendered through the memory parser (so footnote markers and their HTML
comments never reach the prompt) and bounded, with each slot's unspent budget
carried to the next: ``preferences`` is two lines, and its leftover is what
lets ``scope`` be shown in full. Section names pass through untranslated
because the consolidator writes them in the deployment's own language
("不确定" / "Unsure") and reading them is exactly the model's job.
**The last k activities, flat.** The per-surface quota and round-robin are
gone. What someone touched most recently is the signal; which surface it
happened on says nothing about whether they are in the middle of it. Noise is
still dropped, but now *before* the cut rather than after — placeholder titles
are the newest rows by definition, so "take k then filter" returns nothing on
an install where someone just opened three blank chats.
k defaults to 20 and is adjustable in Settings → Chat → Starting points. Per
user, not admin-gated: it changes the size of one prompt built from the
caller's own memory, not a resource anyone else shares.
**Language comes from the setting, not the caller.** The endpoint no longer
takes a language parameter; the service reads the learner's model-output
setting (Settings → Appearance), the same one the chat agent answers in. The
UI locale could resolve before settings loaded, and with one cache per user the
two would overwrite each other on every visit. This also retires the
scope+language throttle key — there is one language now, so one key.
On a real install this took the material from 5 traces to 18 plus 6k of
profile, and the proposals from "DeepTutor 这种 AI 助教如何实现启发式引导" to
"LangGraph 状态共享与竞争条件处理".
English installs got nothing. The model was answering correctly — well-formed
JSON, three grounded proposals — and every one was discarded before rendering.
The label bound was 60 characters, set while testing in Chinese, where
"LangGraph 中状态机与有向无环图的区别" says the whole thing in 20. The same
proposal in English is "How Self-Correction loops in LangGraph reduce
pedagogical hallucinations" — 72 characters, same line on screen, three times
the count. All three came back over the bound, the batch went entirely, and it
presented as a generation failure on English installs only.
Bounds are now per language for both fields. The three labels above are pinned
as a regression case, together with the assertion that the Chinese bound still
rejects them — the point is that one number cannot serve both, not that the
number should be bigger.
Found on a real install with 20+ sessions, where the slot stayed empty.
**A failed generation was cached as an answer.** One call failed shortly after
boot; the empty result was written with the fingerprint of the material it
failed on. The background pass then saw "fresh, and the material has not
changed" and skipped every retry — six hours of empty slot from one timeout.
An empty result is now only saved when it is the right answer (no material to
work from); an empty result produced despite having material is dropped, so
the next visit retries. Collecting the material once and passing it down is
what makes that distinction available.
**The throttle swallowed the language switch.** The component asked before
i18n settled, which resolves to "en" for everyone, so the cache was built in
English. The Chinese UI then asked for "zh", got nothing (a cached set in one
language is not an answer for another), and its background pass was throttled
behind the English one — for the whole interval, with a perfectly fresh cache
sitting there unusable. The throttle is now keyed by scope *and* language, and
the component waits for i18n's ready flag rather than guessing.
**The material was mostly noise.** A week's lookback plus label dedup left one
usable trace out of twenty sessions; the other two slots went to knowledge
bases the user had named "q" and "q2". Now: 30 days (dedup and per-surface caps
already bound the list, so a longer window means depth, not length), labels
under 3 chars dropped, placeholder titles dropped — those are the *newest* rows
by definition, so they were taking the budget from named work — and the brief
tells the model to skip the noise it still sees rather than build on it.
Also: the single delayed re-read assumed a model answers within 3.5s. A cold
provider does not, and the first visit is exactly when nothing is cached. Four
spaced attempts, stopping as soon as something lands.
The previous brief still produced lines that pointed *at* the traces —
"Redo the two eigenvalue questions you missed", "Pick up where Agentic RAG
retrieval left off". Those restate what the learner already knows they did.
They propose nothing to understand.
What earns a click is one step further out: read the traces for the *subject*
behind them, then name something specific about that subject worth
understanding. Same root, one jump.
Trace: [conversation, 2d ago] Agentic RAG retrieval flow
now: "How agentic RAG differs from naive RAG"
was: "Continue the Agentic RAG conversation" <- restates the trace
also bad: "Explore retrieval" <- a field, not a question
The brief now leads with that jump, shows it worked both ways, and asks for
three different *kinds* of question (a distinction, a mechanism, a why, a
boundary case) so the three do not collapse into one shape. The floor is
unchanged and still explicit: one step beyond a trace is the point, a subject
with no root in the material is invention.
The fixed fallback is gone. Its three lines named activities — exactly what
the brief now calls failure — and more importantly the whole value of this
slot is that it is about *this* learner's material; generic copy sitting there
teaches people to stop reading it. With nothing in memory, the component
renders nothing and the home screen looks as it did before. That also drops
the fixed/generated split and its i18n keys: everything rendered here is now
generated, so nothing in it goes through the translation table.
Two problems with the first pass, and they were the same problem.
The copy named activities, not subjects. "Explain a topic" fits any learner's
screen, which is exactly what makes it useless — it proposes nothing. The
model's brief now leads with concreteness and shows it both ways (BAD "Review
your notes" / GOOD "Redo the two eigenvalue questions you missed"), and the
label bound goes 40 → 60 chars because naming the actual thing costs words.
The fixed starters shown to a learner with no history got the same treatment:
they cannot name that learner's material, but they can still propose a
concrete first move.
And a specific sentence in a pill reads as a tag, not as an invitation. So the
pills are gone: one line each, left-aligned to the composer's own edge, serif,
no border or fill, with an arrow that is the only coloured thing at rest and
steps right on hover.
Note the colour is written as color-mix rather than `text-[var(--x)]/60` —
that Tailwind form compiles to nothing, and the arrow was silently inheriting
its parent's colour until this was checked against the computed style.
Each chip renders its label and sends its prompt — the whole sentence the
learner would have typed — so one click starts a real conversation instead of
prefilling something they still have to finish. No handoff is involved: the
home screen is already a draft session while it has no messages, so the chips
go through the same send path as the composer, which both creates the session
and starts it on the topic.
The time-of-day greeting above the composer is untouched. Chips sit between
the composer and the flex spacer, so they ride up with it on the empty screen
and disappear the moment there is a first message.
Generated text does NOT go through the i18n table — a generated label that
happened to match a key would be silently replaced by an unrelated
translation. Only the fixed starters are keys, and the component tracks which
of the two it is holding.
Nothing renders until the first response lands: chips appearing a beat late is
calmer than fixed copy visibly swapping for generated copy. A failed read
falls back to the fixed starters rather than an empty row, and a reroll that
comes back empty keeps what is already on screen.
Three chips for the home composer, each two strings doing different jobs:
``label`` is what the learner reads, sized for a chip; ``prompt`` is what gets
sent as their own message when they click, so it is first-person and complete
— "把我上次做错的那道链式法则的题再讲一遍", not "你上次在学链式法则", which a
model can only agree with.
Reads are stale-while-revalidate. The request path does exactly one thing:
read a small JSON file. Deciding whether the material changed means walking
seven surfaces, so that lives in the background task, throttled to once a
minute per user and deduped by an in-flight map — a burst of page loads must
not become a burst of LLM calls. Regeneration is due when the material's
fingerprint moves or the set is older than six hours; the reroll endpoint
bypasses both, because there a human is waiting.
Material comes from recall, capped per surface and interleaved so the three
chips differ in kind rather than being three chat sessions. No material means
no model call at all — a new learner gets an empty list, and the client shows
its own fixed starters, which is honest about knowing nothing yet.
Partial model output is discarded whole: one lonely chip under the composer
reads as a rendering bug.
The endpoints go above dashboard's ``/{entry_id}``, which matches any single
segment and would otherwise turn /suggestions into an activity lookup.
L1 keeps two kinds of record and answering "what happened lately" needs both.
The snapshot knows what exists (sessions, notebook records, quiz attempts,
documents, books) with a label and a timestamp; the trace knows what was done,
of which knowledge-base queries are the one kind holding a question the
learner typed themselves.
``recent`` merges the seven surfaces newest-first; ``recent_queries`` reads
the trace. Both run on stamps — no message body, no document text, no answer
is read — which is what makes them callable outside consolidation.
Two shaping rules earn their place. Undated items are dropped rather than
assumed recent: knowledge bases stamp their *earliest* index time, so one in
daily use would otherwise be filtered out as ancient while claiming to be
inside the window — the trace answers for KBs instead. And a label repeated on
one surface collapses to its newest occurrence, so a session reopened all
afternoon counts once rather than crowding out everything else.
The chat adapter inlines every message body of every session into each
Entity's ``content``. That is what L2 consolidation needs, and it is the
wrong price for a caller that only wants to know what the sessions are
called — or for the diff, which reads nothing but fingerprints and labels.
Adds ``EntityStamp`` (identity + label + fingerprint + timestamp) and a
per-surface probe that produces stamps directly. ``read_stamps`` uses a
surface's probe when it has one and projects the full read otherwise, so a
surface without a probe is slower rather than unsupported, and a probe that
raises degrades to the full read rather than reporting the surface empty —
which the diff would take for a mass deletion.
Only ``chat`` gets a probe: every other adapter reads a bounded amount, and
each probe is a standing obligation to match its full reader expression by
expression. The chat probe's fingerprint deliberately picks the last message
under ``created_at ASC, id ASC`` via a window function rather than MAX(id);
the two diverge on backfilled rows, and a probe-driven refresh would then
disagree with a content-driven one about what changed.