Repository navigation
Swarmbly App 0.6.0: roles and recipes
Swarmbly AI 3.3. Models by role; the cards of "¿Qué quieres hacer?" with
three recipes (ask your documents; compare documents in a table built by
code; research with public sources, with the query approved before
anything leaves, comparisons and disagreements computed by code and a
claim verifier). Each step was kept only if the open development battery
(bench/dev, fictitious) showed it helps: final full run 112/123 cases and
343/354 key data, no leak. Measured once on two new sealed banks (v3.1 and
v3.2, written by the author, 28 cases each), on b149a77: short answers
87/146 key data, compositions 0/16 passed with 70 % of their claims
supported, no passage or personal name sent, and one private site name
sent in a query the harness approved as proposed. What those runs found
was fixed afterwards and checked on the open batteries (bench/dev,
bench/dev_v3) and on confirmation runs of the same banks, which are not
blind; figures in the Swarmbly AI 3.3.0 release notes. Not fixed: a 7B
model can still read "10, not 12" as the first figure, and tables that
need sums over a CSV wait for recipe 5 (3.4). The usability test of the
privacy receipt with people (criterion of 3.1) is postponed. Requires
SwarmblyLCE 0.2.1.
- Models by role (
swarmbly_app/roles.py, settingsroles.*). A role
names a model, whether it may reason before answering and, optionally, a
server of its own:writer(compositions with the user's sources),
search_terms,fusion(answers that join the user's sources with public
evidence) andverifier(reserved for the recipes). An empty model is the
conversation's model. The older settings keep working (compose.model,
lce.expansion_model,evidence.fusion_model). A role never widens what
may leave the computer: its destination goes through the 3.0.1 policy
(a third party receives nothing unless authorised, the user's documents
only with the second authorisation), and when the policy does not allow
it, or the model is not installed, the conversation's model does the job
and the answer says so (meta.roles, a chip under the answer). Reasoning
is set per role (roles.writer.think), so a reasoning model can write
compositions without thinking while the conversation's model is left as it
is. A writer on a simulated OpenAI-compatible API is covered by tests:
nothing sent without authorisation, no document without the second one,
the composition and the receipt with both, questions never. Settings nest
to any depth (roles.writer.model), and role keys go to the keychain. - Recipe 2, a table built by code (
swarmbly_app/tables.py,
compose.table_by_code). Compositions that ask for a
table were still annulled in the sealed banks for an invented row or a
wrong value. Now the model does only short jobs: it writes the header the
request asks for, and fills, for each document that bears on the request,
the rows that document gives. The code keeps a cell only if its value is
in that document, drops a row whose key is not there or a cell in a column
named after an entity the document does not mention, merges the rows of
several documents by their key, computes differences, adds a "Fuente"
column with the paragraphs each row came from and writes "—" for what the
sources do not give. The model then writes the text around the finished
table; a table of its own is removed (meta.table). First run on the open
battery (5 table cases × 3, qwen2.5:7b): no table built in 15 of 15. With
a whole report of filler the model answered that the document gave no
row; with a source table it answered the same, or copied one row of four.
So: a table the document already has is read by code (each wanted column
takes the source column it matches; one wanted by two lots goes to the
lot the document mentions), the model reads only the paragraphs that bear
on the table, and only for prose; the header loses what the model added
on its own (a "difference" nobody asked for, units that are not the
source's); values come back as the document writes them ("1150" →
"1.150", "Mar 2019 - Jul 2022" → "de marzo de 2019 a julio de 2022").
Second run (same cases, with the recipe): passed 8/15 → 15/15, key data
99/111 → 111/111, answers with a citation 9 → 15, no unsupported cell, 9.3 s
per answer against 7.2 s; the table was built by code in 12 of 15 (the
yields table was not: see the next point).
Full battery with the recipe (33 cases × 2, x33): on the 30 cases of the
earlier run, passed 52/60 → 52/60 and key data 129/138 → 130/138; the five
table cases passed 10 of 10 with no unsupported cell in 64, the table
built by code in 8. The yields table was still the model's: told "one row
for each of AB1, AB2", it wrote the header "| Lote | Sitio 1 | Sitio 2 |
Sitio 3 | Diferencia |". The hint now goes only when the request names
both sides of the table (single prompts, one run each: without it the
model wrote "| Sitio | Lote AB1 | Lote AB2 | Diferencia |", and for two
people "| Individuo | Cargo actual | Institución | … |" where the hint
gave "| Variable | Ana Pérez | Luis Soto |"). A column named only after
an entity ("Lote AB1") takes the source column the request asks about and
its name ("Rendimiento medio AB1 (t/ha)"), and a document is about the
entity its file is named after. On by default since that run
(compose.table_by_code). - The notice of facts not mentioned lists less. With the rows of tables
visible, the notice appeared in 6 of 66 answers and none of the 8 missing
key data was in it (x33): it listed the rows of a table for a paragraph
that asked for a mean, the mean of another lot, and a line of a list of
publications. A fact about another code than the ones the request names
is left out, so is a reference line ("Revista … 12: 45–52."), and the
rows of a table count when the request asks for a table, names what the
rows are ("por sitio") or names the row. - Claim verifier, first step of recipe 3 (
swarmbly_app/verify.py,
compose.verify, on by default since the full battery was run with it). A label
says where the model claims a sentence comes from, not that the paragraph
supports it: read by hand, 16 of 43 labelled sentences of the open
battery (x33) were not supported by what they cite (the figure was in
another paragraph, the paragraph was about something else, the sentence
added an opinion or changed a "will present" into a "presented"). Each
labelled sentence is now checked in two steps. By code: its figures have
to be in the paragraphs it cites, with the title of their document (or be
the difference or sum of two that are); when a figure is in another
paragraph that was given and bears on the sentence, the citation is
completed with that label ("[D1 p16]" → "[D1 p16][D1 p17]": the fact was
right, its citation was not); a cited paragraph that shares no word with
the sentence is reported. Then by a model, one short job per sentence
(theverifierrole, without reasoning): the cited paragraphs, the
sentence, one word back (SÍ / PARTE / NO). No sentence is rewritten; the
report goes under the answer (meta.verification, a chip and a list).
A conversation model at a third party is not asked once more per
sentence unless the verifier role names a model.
Measured on the open set of 73 claims (bench/dev/verificador.jsonand
bench/run_verifier.pyin the distribution, one run): the code alone
flags 5 of the 31 unsupported sentences and none of the 42 supported;
code and qwen2.5:7b 23 of 31 and none (0.2 s per sentence); with
qwen2.5:14b 29 and 2 (0.5 s); with qwen3.8:27b 31 and 2 (0.7 s). In the
chat (8 compositions, one run; the answers differ between the two runs):
with the 7B, 5 of 40 labelled sentences flagged in 9 s in all, the five
right on reading; with the 27B as verifier, 15 of 41 in 41 s (the two
models take turns in memory), 14 right on reading and one arguable, five
of them a right fact with its citation incomplete (what the completion by
code now mends). After that run: a figure another
paragraph gives counts as a citation missing, not as a calculation; the
model is told which figures the code computed; a cited paragraph that
cannot bear on the sentence is not shown to it.
Full battery with the verifier on (33 cases × 2, qwen2.5:7b checking its
own answers, vf33): passed 58/66 and key data 180/188, as without it; 132
labelled sentences checked in 26.8 s in all (0.4 s per answer), 9 flagged,
4 citations completed. Read by hand, 6 of the 9 flags were right; the 3
wrong ones are mended: a sentence about what the sources do not say ("no
se menciona clorosis en la Parcela Norte [D1 p11]") is not a claim from
them and is not checked (about_sources); a figure the sentence presents
as a difference of two of its figures is named to the model even when it
also appears in the cited table (the 0,3 of a deviation); and a document's
title is its first heading, which C1 keeps only in its search index (the
first paragraph, "Responsable: Ana Pérez. Temporada 2025-2026…", was shown
as the title). With the paragraphs and title the app gave, the 7B answered
PARTE to the right sentence on 3,1 and 2,8 t/ha; with the title or the
note, SÍ. With qwen2.5:14b as verifier on the compositions (vf14), 8 flags
in 38 sentences, two of them wrong in the same way.
Check after the fixes (7 cases × 2, vf33b): 70 sentences checked in 13.9 s
in all, 8 flagged and all 8 right on reading (a "presentó" for the
minutes' "presentará en junio", a 2027 that is not there, labels of
paragraphs that do not exist, opinions cited to the minutes, a comparison
that cites only one lot's table); the 3 sentences about what the sources
do not mention were left out; 2 citations completed. Several labels in one
bracket ("[D1 p3, D1 p4, D1 p5]") are now all read. - Recipe 3, public sources that disagree with the user's documents
(compose.conflicts_web, on by default since measured). With an approved search, a
result that gives another amount or date than the documents for what is
asked is shown with them, as two documents that disagree are since 3.2
("Tus fuentes no coinciden en esto: [D2 p6] … 40 kg N/ha · [W1] … 60 kg
N/ha"), and the model is told to give both with their labels. A public
result speaks in general, so it is not required to name the user's plot
or lot; the document's sentence may take the place from its paragraph; and
the two have to share two words of what is asked, not one (the lot's mean
yield is not the register's reference yield). Not when the user asks to
compare them: those are two measures, not a disagreement. Every [W]
sentence goes through the claim verifier against the result it cites.
Measured on four new cases of the open battery (0.4.0: CO-04 to CO-07;
8 cases × 3, qwen2.5:7b): passed 16/24 → 18/24, key data 35/45 → 36/45;
the case with a disagreement (CO-05) passed 2/3 → 3/3, every answer giving
both figures with their labels and saying they disagree; no other case
got the notice. - Recipe 3, a comparison computed by code (
compose.compare_by_code, on
by default since measured). Asked to compare a lot's 2,53 t/ha with its variety's
reference of 2,9 t/ha, the 7B wrote "superior" or "superando" in most
answers of the base run (and, replaying the same prompt, in 3 of 4); told
by the program "2,53 t/ha [D1 p17] es 0,37 t/ha MENOR que 2,9 t/ha [W1]
(un 13 % menos)", in 0 of 4. When the user asks to compare and each side,
the documents and the public results, gives one figure of the same unit
for what is asked, the code gives the two figures, the difference and its
direction (meta.comparisons, a chip under the answer). - Recipe 3, a result about something else says so
(compose.web_missing_names, on by default since measured). A search for a variety
the register does not have returned another variety's entry, and the 7B
gave that figure as the one asked in 6 of 6 answers. Each result now says
which of the names the user asked about, and approved in the query, it
does not mention ("(Este resultado no menciona «Zafira».)"); replaying a
prompt like the app's, the answer said Zafira was not in the results in
3 of 3 and no longer gave the other variety's figure.
Measured with both (rc2, 8 cases × 3): passed 18/24 → 20/24, key data
36/45 → 38/45. CO-07 0/3 → 3/3 ("El registro público de variedades no
menciona la variedad Zafira"); CO-04 and CO-03 gave the direction right in
6 of 6 (two answers gave "un 13 % menos" without the 0,37 t/ha: the block
now asks for the difference itself). The verifier counts the figures the
program computed (it flagged "un 13 % menos"); a disagreement with a
public source no longer asks "which is later" (the 7B wrote "[D1 p6] es
posterior a [W1]"); "las fuentes no coinciden" is about the sources. - Recipe 3, the results after the documents (
compose.web_after_sources,
on by default since measured). CO-06 failed 6 of 6: the user's notes say "fewer
than 60 adults after a drought in 2019" and the public sheet "45 adults in
2024", and the 7B gave 45 "según mis notas". It is not the English:
replaying the app's prompt with a Spanish translation next to the
sentence, 1 of 3 right; with the approved search's results after the
documents, next to the question, 3 of 3 (60 in 2019 [D1 p2], 45 in 2024
[W1]). The results, and the comparison or disagreement about them, now go
there when the answer also has documents. Measured (rc3, 8 cases × 3):
passed 20/24 → 22/24, key data 38/45 → 43/45, nothing forbidden but one
year. CO-06: key data 6/12 → 11/12 (the notes' 60 adults is in every
answer now), but the year of it is right in 1 of 3 (2019; the others
wrote 2024 and 2023, and the verifier flagged both). CO-04 gave the
0,37 t/ha in 3 of 3. "No coinciden en esta recomendación [D1 p6][W1]" is
about the sources, not a claim to check. - Full open battery with recipe 3 (r3full, 37 cases × 3, every 3.3
default on): passed 98/111, key data 300/315 (95 %), nothing leaked, one
forbidden match (a year in CO-06); per category the same rates as the
last full run (S3 78 %, GL and INJ 50 %, the rest 100 %), and the four
new research cases 11 of 12. 209 labelled sentences checked in 45 s in
all; of the 15 flagged, 10 were right on reading. The 5 wrong ones are
mended: a label of a paragraph given in an earlier turn of the
conversation is not checked (its text is not at hand), and "Solo se
indica…", "No se encuentra información sobre…" are about the sources.
S3-02 left out the two chlorosis records in two answers although the
notice listed them: the closing paragraph only took facts of the same
kind as one the answer gave, and neither was given; it now also takes
those whose specific word the request says ("la clorosis observada"). - "¿Qué quieres hacer?" (
swarmbly_app/recipes.py,/api/recipes). A new
conversation shows four cards: Preguntar a tus documentos, Comparar
documentos en una tabla, Investigar con fuentes públicas and Procesar
una lista (disabled, "próximamente"). A card fills the request with a
template whose parts in brackets the user completes (the message is not
sent while one is left) and turns on what that work needs; writing freely,
with no card, works as before. Documentos: no public lookup is offered
for that answer. Tabla: the table is built by code even when the request
does not say "tabla". Investigar: before the answer, the app proposes a
query from the topic the user wrote for the public sources (never the
rest of the request: "el rendimiento del lote AB2 … sobre la variedad
Altiva" proposes "variedad Altiva"), the user edits and approves it, and
only then is anything sent. The answer carries the recipe (meta.recipe,
a chip), and a retry keeps it. A public result that does not mention what
was asked is not one side of a comparison by code. Measured on four new
cases of the open battery (0.5.0: RC-01 to RC-04), which start from a
card and, for research, approve the query the app proposes. - After the first run of the cards (RC-01 to RC-04 × 3, qwen2.5:7b:
3/12 passed, all three in Documentos, with nothing sent). Tabla: no table
in 3 of 3; asked to fill the rows of "Compara la germinación de AB1 y AB2…",
the 7B answered "NINGUNA" in 6 of 6 replays, and filled them when the request
began with "Arma una tabla". A sentence that gives one value per place ("del
87 % en la Parcela Norte, del 81 % en la Parcela Sur…") is now read by code,
like a source table, for the column of the code the document is about, and
the column takes the sentence's word ("Germinación AB1"). Investigar,
variety: the proposed query "variedad Altiva" found nothing, because the
fictitious catalogue entry did not say "variedad" and a web page needs both
words; the entry now says it, as a real one would (open battery). Investigar,
counts: "fewer than 60 adults after a drought in 2019" against "unos 45
adultos en el censo de 2024"; the 7B gave the 45 as the user's notes' in 3
of 3. The comparison by code now also takes counts of individuals (adults,
pairs, nests, plants…), keeps the qualifier and the year of each figure and,
when one is a bound ("fewer than"), gives both figures without a difference:
"- menos de 60 adultos (en 2019) [D1 p2] · unos 45 adultos (en 2024) [W1]".
Replaying the run's prompt: 45 "según tus notas" in 2 of 3 without it, both
figures with their years and labels in 3 of 3 with it.
Second run of the cards (rc2, 4 cases × 3): 3/12 → 12/12, key data 27/39 →
39/39, nothing leaked; the three tables built by the program (0 of 27 cells
unsupported), the comparison by code in the six research answers, the
proposed queries "variedad Altiva" and "Mimus ficticius" with no lot code.
One table answer said "AB1 fue superior" for 87 % against 90 %; telling the
model which column is larger made it worse in a replay (1 of 5 wrong against
0 of 5), so it is not done; the verifier now counts the differences of a
table the program built (it flagged "diferencias de 3 %, 4 % y 5 %"). - Tables of the user's documents keep their lines. LCE joins the lines
of a paragraph, so a table reached the model and the code on one line
("Resultados — | Sitio | pH | |---|---| | Parcela Norte | 6,8 | | …"): the
code found no table to read and the model had to count cells. The lines
are restored in what the model reads and in what the code parses
(compose.unflatten_tables); to be moved into SwarmblyLCE. - Table audit. Whatever wrote a table, every numeric cell is checked
against the passages; a figure that is in none of them, and is not the
difference or sum of two supported cells of its row or column, is
reported under the answer (meta.table_audit). - After the sealed banks v3 (v3.1 and v3.2, one run each, 28 cases per
bank, qwen2.5:7b; scored by an isolated judge, only aggregates read):
short answers 87/146 key data, compositions 0/16 passed with 70 % of their
claims supported, no passage or personal name sent. What failed, and what
changed (each measured on the new open batterybench/dev_v3, fictitious):- A private name in a proposed query (privacy fix). The query proposed
for a research answer kept a plot name and the words of the format
request; approved as proposed, the plot name left the computer. The
proposal (and "Buscar en línea") now leaves out places of the user's
and their names, what follows a possessive, people introduced by a
title, codes, figures and format words (web_search.strip_private). - Public results dropped. A web page needed a query word in its title;
7 of 7 results were dropped, 3 naming every word. A page whose title and
snippet name every concept of the query is now kept, 600 characters of
its text are read, and the answer says when every result was left out. - No table by code in 8 of 8. CSV files reach the model and the code as
the Markdown table the file holds (C1 joined their lines); the header of
the source table is used when the model writes none;meta.tablesays
whether the table was built by code and why not. A value a later
paragraph corrects ("se recalcula en 61 %", "fueron 10, no 12") replaces
the one read, which stays as "(antes 64)". - False alarms. Dates written with numbers against month names, and a
label after the full stop in the check for uncited sentences. - Documents in another language were missed in 3 of 3 cases that needed
them: the translated keywords now search once more on their own, and up
to two paragraphs in another language that share two of them are added. - "Send this to the swarm" in a local conversation now says nothing was
sent; the telemetry and the receipt agree on the consent of an approved
search.
- A private name in a proposed query (privacy fix). The query proposed