Knowledge, notes, memory and skills, and a harness to make them used
Four places a model can reach for, differing in who writes a record and how it gets in front of the model. **Knowledge** is uploaded by a person and searched by the model. It goes through `services/files.py:prepare` — the same pipeline as a chat attachment — so the same PDF produces the same text whichever way it arrived, and `Document` carries the same content columns as `Attachment` for the same reason. **Notes** are written by the model and edited by you. Too long to inject, so they are searched. **Memory** is short facts, and every one of them goes into every request. That single decision is where the rest of its design comes from: records are capped short, the block has a budget, there is no search tool because the model is already looking at them, and they are not shareable — a record about a person is not content to hand round. **Skills** are saved procedures. Only the name and description are injected; the body is fetched when the model decides one applies, which is what makes a hundred skills affordable. A model may write and revise its own — the safety story is not a gate but a record: every revision is kept, attributed and revertible. A model that has just read a hostile page can save a skill that outlives the conversation, and the honest mitigation is that it is visible and undoable rather than that it was prevented. **The harness** is why any of it gets used. A model handed a tools array ignores it and answers from recall, because nothing in the request suggests otherwise. `services/harness.py` assembles a preamble from what this chat actually has: when to reach for each tool, the memories, the skill index. This is an exception to "system prompts are precedence, not concatenation", and a deliberate one. That rule governs the three *authored* layers and is untouched — exactly one still wins. The harness is a different axis: it describes the machinery rather than the behaviour, nobody authored it, and there is nothing for it to disagree with. It is prepended to whichever authored prompt won, in one system message, since several endpoints reject a second. Supporting changes: - **Sharing**, in one helper. `visible_to()` is the only definition of who can see a library item and every listing and tool goes through it. Sharing grants *reading*; two people editing one note with no history and no merge is worse than copying it. **Administrators do not bypass this** — they bypass permissions elsewhere because an admin can grant themselves those anyway, but reading somebody's private notes is a different act. - **FTS5**, created by `db/migrations.py:ensure_fts` with the triggers an external-content index needs. Idempotent, like the column sync beside it. Terms are ANDed and then ORed: the caller is usually a model writing a whole question, and requiring every word loses the match on one absent term. - **The attach button is a menu** — file, image, a web page, or a document from the library. Attaching a document copies it, because history must not change when a document is edited later. - **A URL fetcher with an SSRF guard.** This server can reach the router, the other services on the box and LLeMbas itself, and the address can come from a model. Private ranges are refused *after resolution* and redirects are followed by hand so every hop is checked. An admin can open it deliberately. - **Model capabilities split** into protocol support and a toggle per built-in tool. Rows predating the split have no `tool_*` keys, and absent counts as on when `tools` is on — otherwise an upgrade silently takes web search away from every model already configured for it. Also fixes the test fixture, which built the schema with `create_all` and so ran against a database without the FTS tables production has; it now runs `sync_schema`, the same path startup takes. 430 tests, ruff clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -124,10 +124,11 @@
|
||||
<section class="card">
|
||||
<h2 class="card__title">Capabilities</h2>
|
||||
<p class="card__lede">
|
||||
Endpoints rarely advertise these reliably, so they are your call.
|
||||
<strong>reasoning</strong> shows the thinking block,
|
||||
<strong>vision</strong> lets images be sent to this model, and
|
||||
<strong>tools</strong> is reserved for a feature not built yet.
|
||||
What this endpoint can do. Endpoints rarely advertise it reliably, so it
|
||||
is your call. <strong>reasoning</strong> shows the thinking block,
|
||||
<strong>vision</strong> lets images be sent, and <strong>tools</strong> is
|
||||
whether a tool list may be sent at all — turn it on for a model that does
|
||||
not support tool calling and every one of its replies fails.
|
||||
</p>
|
||||
<div class="checkbox-row">
|
||||
{% for name in capabilities %}
|
||||
@@ -140,6 +141,35 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">
|
||||
Built-in tools
|
||||
{% if not (model.capabilities_json or {}).get("tools") %}
|
||||
<span class="badge">needs tools</span>
|
||||
{% endif %}
|
||||
</h2>
|
||||
<p class="card__lede">
|
||||
What this model is given, as opposed to what it is capable of. None of it
|
||||
applies unless <strong>tools</strong> is ticked above. Each one is also
|
||||
subject to the instance being configured for it and to the reader's own
|
||||
permissions — this only decides whether it is offered to <em>this</em>
|
||||
model.
|
||||
</p>
|
||||
<div class="checkbox-row">
|
||||
{# A model configured before these existed has no tool_* keys. Ticked by
|
||||
default when `tools` is on, matching what the tool registry does, so
|
||||
the form shows what will actually happen rather than a row of empty
|
||||
boxes that would take web search away on the next save. #}
|
||||
{% for key, label in tool_capabilities %}
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="capability" value="{{ key }}"
|
||||
{{ 'checked' if (model.capabilities_json or {}).get(key, tool_default) }}>
|
||||
<span>{{ label }}</span>
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">Availability</h2>
|
||||
|
||||
|
||||
@@ -108,6 +108,28 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">Saving links</h2>
|
||||
<p class="card__lede">
|
||||
Applies to the composer's <strong>Link</strong> option and to anything the
|
||||
model fetches: LLeMbas retrieves the page and keeps its text.
|
||||
</p>
|
||||
<div class="field">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="allow_private_fetch" value="true"
|
||||
{{ 'checked' if values.allow_private_fetch }}>
|
||||
<span>Allow fetching addresses on this machine and this network</span>
|
||||
</label>
|
||||
<p class="field__hint">
|
||||
Off by default, and worth leaving off. This server can reach your
|
||||
router, your other services and LLeMbas itself; the address to fetch can
|
||||
come from a model, which can be talked into things by a web page it just
|
||||
read. Turn this on only if you actually want to archive pages from your
|
||||
own network.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2 class="card__title">Firecrawl</h2>
|
||||
<div class="grid grid--2">
|
||||
|
||||
Reference in New Issue
Block a user