Universal lessons with project handover; whole-document edits; worker discovery and routing
ci / tests (macos-latest, python 3.10) (push) Canceled after 0s
ci / tests (macos-latest, python 3.11) (push) Canceled after 0s
ci / tests (macos-latest, python 3.13) (push) Canceled after 0s
ci / tests (macos-latest, python 3.9) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.10) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.11) (push) Canceled after 0s
ci / tests (ubuntu-latest, python 3.13) (push) Canceled after 0s

Lessons and statements carry a required scope; project items leave the shared
store for a per-project handover pile filed into that project's own docs.
Every learning round ends with a whole-document edit with traced lessons.
sisi workers / route / delegate discover tools, choose the most affordable
adequate worker and record results in the personal store; the host tool's own
subagents come first, the command-line runner is the fallback.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-23 08:59:21 -07:00
1 parent dad13062a1
commit ba84772acf
33 files changed
+4623 -125

No files matched your search

+1
View File
@@ -5,6 +5,7 @@
| [../README.md](../README.md) | learn what sisi is, install it and try it |
| [design.md](design.md) | understand why sisi works the way it does, and what is built versus only designed |
| [learning.md](learning.md) | how a recorded lesson takes effect, is measured, strengthened, consolidated or withdrawn |
| [workers.md](workers.md) | how the agent tools and models on the machine are found, chosen between by measured results, and run |
| [personal-data.md](personal-data.md) | know where sisi keeps what it learns, how the overlay works, and what an update touches |
| [verifier-format.md](verifier-format.md) | write or review an entry in the verifier library (`verifiers/`) or a recipe (`done/`) |
| [developing.md](developing.md) | work on sisi while also using it: the source folder, stable releases and rollback |
+17 -3
View File
@@ -156,8 +156,14 @@ default the agent is proceeding on. Work that does not depend on it continues. `
queue. An answer that differs from the default re-opens only the nodes that used it.
**Delegation records.** A person who already delegates work to cheaper models may keep a ledger of outcomes.
The design folds such a ledger and its routing table into the shared store. Built so far, sisi only reads an optional
ledger file, to match delegations with sessions when it builds the task set.
The design folds such a ledger and its routing table into the shared store. Built: the worker layer
([workers.md](workers.md)) discovers the agent tools and models installed on the machine, imports such a
ledger once into the shared store, and routes work by pure arithmetic over the judged record — the most
affordable usable worker that is good enough, with load spread in proportion to the allowance each plan has
left and reviews sent to a different maker. `sisi delegate` runs one brief unattended through a per-tool
driver and leaves the run waiting for a judgement. No model is preferred in code, and nothing refreshes on a
schedule: discovery is re-read during normal use when the stored copy is old or after a failure. What is not
built on top of it is the conductor above: framing, splitting and closing a tree of work.
## Part 3: learning that compounds
@@ -296,6 +302,13 @@ Built and covered by tests:
into the product.
- The data layer for learning: harvest of Claude Code transcripts, task set, ground truth, escape candidates,
check statistics, scoreboard.
- The worker layer: discovery of the installed agent tools and their models (`sisi workers`), the delegation
ledger in the shared store with a one-time lossless import of the earlier hand-kept ledger, unavailability
kept apart from judged quality, choice by measured results (`sisi route`), and unattended runs with
judgement (`sisi delegate`). The session's model is kept from hook payloads, strength comes from the record
plus a stored prior with source and date (no ranking shipped in code), and session start says whether the
session should plan and delegate or work itself. Stored price and strength tables are ready for a later
research refresh; that refresh, and any driver for a host with its own delegation interface, are not built.
Designed, not built:
@@ -326,7 +339,8 @@ resumes without redoing closed nodes (to be model-checked, then tested).
## Decisions
1. Delegation tooling is folded into sisi in the design; only the optional ledger read is built.
1. Delegation tooling is folded into sisi: discovery, the ledger, the choice rule and unattended runs are
built (see [workers.md](workers.md)); the conductor that frames and splits whole products is not.
2. The end-of-turn gate is on by default. Each check has a time limit, and after three send-backs in a row the
agent is let through with the result marked unverified. One setting turns the gate off.
3. Session text may be read by any provider the user already uses as a worker, never by a model whose id marks it
+127 -11
View File
@@ -9,7 +9,28 @@ what "done" means, verifying, or being sent back by the gate.
1. **A lesson is recorded.** At the end of each piece of work the agent answers how it could have gone
better (`sisi retro`): the aim it fell short of, the concrete moment, why, and the change to sisi
that would make the next agent do it right without being told. It also names, with `--when` (at
that would make the next agent do it right without being told. Every lesson, and every
`sisi learn` statement, has a scope (`--scope everywhere|project` is required; a missing scope is
refused with a paragraph saying what each means). **Scope: lessons are universal, or they leave.**
`everywhere` is for a lesson that holds in any project, stated in general terms; `project` is for
a fact about this one project, and it does not stay in sisi's store: it moves to that project's
handover pile (below) and on into the project's own documentation or work list. A project is
identified by its git remote URL when it has one — normalised, so clones, an ssh or https remote,
and a renamed folder are the same project — else by its repository root path (a clone or rename
with no remote is then, unavoidably, a different project). The lesson splits in two: the
delivered part (`change`, `short`, `--when`; a learn statement) must be universal when scoped
`everywhere`, and a structural check (no model call) refuses it when that part names the current
project — the repository's name, a path or file name that exists in it, or its remote URL —
saying to rewrite it in general terms or scope it to the project (the word `sisi` alone is exempt
in tool lessons, which are changes to sisi itself). Its history (`moment`, `cause`, the
occurrence records with repository, date and tool) is the historical example of where it came
from and may name the project freely; only the delivered part is checked. Lessons and statements
recorded before scopes existed are `unscoped`: they keep being delivered as before until a
learning round scopes them (below), and printed headings count the short line when present.
`sisi lessons show ID` prints the universal lesson first, then a section headed "Where this came
from (historical example)" with the moment, cause and occurrences; session start, request-time
delivery and field notes show only the universal part plus the command that prints the example.
It also names, with `--when` (at
least five comma-separated words or short phrases, required), the kinds of work the lesson applies
to in the words a different agent would use, synonyms included — for a CSV lesson: "csv, tsv,
spreadsheet, tabular data, import, export, parse, delimited file". This matters because word
@@ -47,8 +68,10 @@ what "done" means, verifying, or being sent back by the gate.
"done means" list in short form plus the matching lessons' short lines, each with the command
that prints it in full (`sisi done ID`, `sisi lessons show ID`), within a 2,000-character cap.
A recipe counts only when at least two distinct non-generic request words hit its title,
applies-to or id (matched on stems, so "tag" meets "tagging"); trivial messages (a bare yes or
no, a slash command, a short question) and unmatched requests inject nothing at all. These
applies-to or id, at least one of them in its title (matched on stems, so "tag" meets
"tagging") — the same strict floor lessons use. A message that is a question to the agent and
names no work (no fix, build, change or the like), trivial messages (a bare yes or no, a slash
command, a short question) and unmatched requests inject nothing at all. These
showings count as *listed* at place `prompt`. The hook never blocks a turn: any error exits
silently. Draft recipe notes
appear in `sisi done for` when their words match. Lesson text is always framed as information to
@@ -74,11 +97,37 @@ what "done" means, verifying, or being sent back by the gate.
still recurs at strength 3 is withdrawn, and the same wording will not be learned again.
6. **Consolidation happens in a cycle**, run by whichever agent is working — see below.
## Project facts are handed over, not kept (`sisi handover`)
Project-specific details might be recorded, with where the lesson came from as a historical
example — but they might not live in the global store: sisi is used across many projects, so
everything it leaves behind is at the broad or meta level, and project facts belong in that
project's own work list and design documentation. Scoping an item `project` (at `sisi retro` /
`sisi learn` time, or in a learning round) moves it out of the delivered global data into a
per-project handover pile in the personal store, kept only until filed. At session start inside
that project (and in request-time delivery there) sisi says, in plain words, how many items
belong to this project and asks the agent to file each in the project's own design documentation
or work list — wherever the project keeps them; if it has neither, a short section in its main
agent instructions file or a docs file — and then confirm with `sisi handover done ID --where
PATH`. `sisi handover` lists the waiting items in full, including the owner's quoted words and
the date, so nothing is lost in the move. The confirmation checks that the named file exists
inside the project and contains the item's key text (or a quoted fragment passed with `--quote`)
before removing it from the pile, and records where it went (id, project, path, date) in a small
filed log. After confirmation the item is gone from every global listing, digest and delivery;
the digest shows only a count per project of items still waiting to be filed. History stays in
the personal store's git history. The end-of-turn check is not involved: this is a
start-of-session notice that repeats until filed.
## The cycle (`sisi cycle`)
Consolidation is due when enough lessons have been recorded since the last cycle, or a lesson is
waiting to move up a step, or the learned notes or the loose lessons pass their limits (`sisi cycle
due` states the live reason and its limit) — the loose list stays short
due` states the live reason and its limit). The due test counts only what a round can act on:
tool lessons (changes to sisi itself, which a round cannot fold) and project-scoped items (handed
over to their project) do not count toward it; tool lessons are shown by `sisi backlog` under
their own separate heading cap, and a tool lesson whose change has been built is closed with
`sisi lessons set ID --status applied`, which takes it off the backlog and stops the digest
calling it "not built yet". The loose list stays short
by construction, because the brief's first instruction is to fold lessons into the recipe or entry
for their kind of work, or lift several into one rule, so they leave it. That is a counter check, not a
schedule: it runs at session start, at the end of every turn in the gate, and in the output of
@@ -102,16 +151,37 @@ states the short and topic limits, and requires a `set-short` entry for each lis
prints exactly what would change, changing nothing. A round can be started on demand even when
none is due: `sisi cycle --now` (or plain `sisi cycle`) prints the brief either way.
The brief also lists every unscoped lesson and `sisi learn` statement, with the repository each
was recorded in where known, and requires a scope decision for each: a note
`{"lesson": A, "action": "set-scope", "scope": "everywhere|project", "project": "<id, when
project>"}` for a lesson, and the equivalent `{"text": "<the exact statement>", "action":
"set-scope", ...}` in a top-level `"learn"` list for a statement (the full format is behind
`sisi cycle help`). Scoping to a project moves the item to that project's handover pile, and
`sisi cycle check` refuses to fold a project-scoped item into the rulebook or the general
recipe/technique notes. A learn statement about how the owner wants all work done (how to ask
questions, spending limits, no scheduled jobs) is universal; a statement about one product's
design is project. A file containing only the required set-short/set-scope entries is acceptable
when nothing else is ready to fold — a cleanup-only round, startable at once with
`sisi cycle --now`. Reading lessons during a round cannot stale it: automatic retirement (a
folded lesson shown 20 times) is deferred while a round is open, so `sisi lessons show` during
the round leaves its base current. `sisi cycle apply` prints the rulebook's lines and characters
before and after, matching what `sisi cycle check` predicted.
```json
{"version": 1, "base": "<base version from the brief>", "summary": "one line",
"rules": [{"id": "rule-id", "title": "Title", "body": "text, ending with Why: ...", "action": "add|replace",
"shortens": "rule-id: what is removed (required when the book would grow in characters)"}],
"disable_rules": ["rule-id"],
"notes": [{"lesson": 3, "action": "merge|fold-into-rule|fold-into-entry|retire|withdraw|keep|set-when|create-entry|keep-as-draft|set-short",
"notes": [{"lesson": 3, "action": "merge|fold-into-rule|fold-into-entry|retire|withdraw|keep|set-when|create-entry|keep-as-draft|set-short|set-scope",
"into": "rule/entry id or [ids]", "merged_into": 4, "note": "split text (optional)",
"when": "at least 5 terms (optional)", "short": "one plain sentence (set-short)", "topic": "topic words (set-short)",
"entry_kind": "recipe|verifier", "entry_text": "full file (create-entry)",
"entry_kind": "recipe|verifier", "entry_text": "full file (create-entry)", "scope": "everywhere|project (set-scope)", "project": "id (set-scope)",
"reason": "why it stays a draft (keep-as-draft)"}],
"learn": [{"text": "the exact learn statement", "action": "set-scope", "scope": "everywhere|project", "project": "id, when project"}],
"documents": [{"doc": "recipe:<id>", "action": "rewrite", "text": "<full new text>",
"trace": [{"lesson": 3, "fragment": "the exact sentence in the new text that carries it"}]},
{"doc": "verifier:<id>", "action": "reviewed", "reason": "why its structure is already right"}],
"rule_order": ["every rule id exactly once, in reading order"],
"enforced": [{"lesson": 3, "type": "command", "cmd": "...", "expect": {"exit": 0}, "timeout_s": 30},
{"lesson": 4, "type": "contract-requirement", "when": "parser",
"require_kind": "parsing", "max_rung": 2}]}
@@ -153,6 +223,40 @@ deliveries, send-backs each, median time, and recurrences of the lessons it touc
deliveries got worse after at least 10 of them is flagged, and the next brief says to revert or repair
it first.
Every round ends with a whole-document edit. The things agents read are documents — the
rulebook, each "what done means" recipe, each technique entry — and a folded lesson belongs in
the document's own text, in the section where it fits (in a recipe: Done means, Checks, or
Common false finishes), in the document's voice, not as one more dated bullet in a journal.
The brief prints, for every document that has appended field notes, was folded into, has a
personal copy whose product text has since changed, or has had no whole-document review for
the configured number of rounds, its full current text and the lessons folded into it
(universal part only), together with a short editorial standard: one instruction per bullet or
sentence; most important and most often violated first; related instructions grouped under
one heading; no duplicates; imperative, concrete, plain words; each rule keeps its reason;
exceptions beside the instruction they qualify; no history or narrative. The cycle file then
needs, for each listed document, a rewrite (the full new text) or a `reviewed` entry with a
one-line reason; `sisi cycle check` refuses a file that skips one. The personal version of a
recipe or technique lives in the overlay and shadows the product's, with the product hash it
was derived from on record; when the product later changes, the next brief lists the document
as needing a re-merge rather than silently keeping the stale copy. Field-note files from
before this existed are listed the same way and keep being shown until rewritten.
Nothing folded may be lost in a rewrite. For each lesson folded into a document the file gives
the exact sentence or bullet in the new text that carries it, or an explicit disposition:
moved to another named document (with its fragment there), merged with another lesson (both
ids point at the same fragment), or retired under the usual retirement rule. A rewrite that
leaves any lesson without one of these is refused. For the rulebook the same holds for rule
ids: each survives or is merged into another id, and each keeps its Why. The trace map is
stored beside the document, outside the text agents load; `sisi lessons show ID`,
`sisi rule N` and `sisi done ID --trace` print where a lesson lives. Structure is checked
mechanically: the rulebook budgets, rule headings with ids, Why paragraphs and the generated
pointer lines, the library lint for recipes and techniques, the house width after wrapping,
run-on bullets, and dated journal-style bullets. A round may also reorder the rulebook
(`rule_order`): ids stay stable, numbers follow the order, and stored data refers to rules by
id. Each rewrite is recorded on its cycle, so `sisi cycle status` shows recurrences of the
rewritten document's lessons before and after it, and flags a rewrite followed by more.
Reverting a round restores documents, order and trace maps along with everything else.
Enforced checks live in `overlay/enforced.json` and are checked like the minimum-rung floors: a
contract-requirement fails a contract that touches its subject without a check of the required kind;
a command check runs in the project like a contract check, and only in projects already on the trust
@@ -179,13 +283,18 @@ sent back twice.
`sisi lessons digest` is for the human, not for agents. Its first line says how much has been
learned in one sentence, and its last line says how to see a lesson in full (`sisi lessons show
ID`), with the lesson number on every line. Preferences recorded with `sisi learn` appear first,
ID`), with the lesson number on every line. Universal items come first; items waiting to be
filed in their projects appear only as a count per project (run `sisi handover` inside that
project to see them). Preferences recorded with `sisi learn` appear first,
in the person's own words, under "What you said" when any are stored. Short lines are grouped
under their topic headings, ordered by how much each topic holds, most first. After every line
comes its state in plain words — in the rulebook; attached to a kind of work; a loose note; or a
change to sisi itself, not built yet — plus "seen N times" only when a lesson has been seen more
than once. Lessons without a short line go last, under "Not yet summarized", cut at a word
boundary. Retired, withdrawn and superseded lessons are left out unless `--all` is given.
comes its state in plain words — in the rulebook; attached to a kind of work (named by the
entry's human title, never its internal id); a loose note; a change to sisi itself, not built
yet, or built once closed with `sisi lessons set ID --status applied` — plus "seen N times" only
when a lesson has been seen more than once. Lessons without a short line go last, under "Not yet
summarized", cut at a word boundary. Retired, withdrawn and superseded lessons are left out
unless `--all` is given. `sisi rule N` lists the lessons behind a rule the same split way as
`sisi lessons show ID`: the lesson line, then its historical example.
## Is it getting better?
@@ -220,6 +329,13 @@ reach 21/21 (20 of them already in part one; one — a request sharing a single
only as a heading, as designed), part-one wrong 0/24. Both sets are small and hand-written; treat
even those figures as evidence about this mechanism on these examples, not as a promise about yours.
Two more labelled sets guard the newer checks, measured the same way in `tests/test_scope.py`
and `tests/test_prompt.py`: lesson texts labelled universal or project-bound (including
universal lessons that merely mention common file names such as README or CHANGELOG, which
pass, and universal changes whose moment names a project, which also pass because only the
delivered part is checked), and long real-style multi-part requests plus plain questions for
request-time recipe delivery (a hit is the expected recipe; any other recipe is a false match).
Delivery therefore depends on the quality of the when-terms the recording agent writes. Thin or
copy-of-the-text terms leave a lesson findable only by its own wording, exactly the failure they
exist to prevent. What sisi ultimately measures is not match scores but the outcome that matters:
+108
View File
@@ -0,0 +1,108 @@
# Workers: discovery, choice and delegation
sisi finds the agent command-line tools on the machine, keeps a judged record of work given to
them, and chooses the most affordable worker that is good enough for each new piece of work. No
list of preferred models is shipped in code, and nothing is scheduled: information refreshes when
a command runs and the stored copy is old, or after a failure.
## The commands
- `sisi workers` prints, in plain words, each tool found on `PATH`, the models it lists, whether
it is usable now and why not (not logged in, limit reached until a stated time), the allowance
left where the tool itself reports one, and the price where one is known. A tool with no model
listing command is shown as "models learned by use": the record names its models as they are
used. `sisi workers --refresh` reads the tools again instead of using the stored copy.
- `sisi route --kind K --difficulty N [--review-of W] [--explain]` prints the worker the record
chooses for a kind of task (such as `search`, `impl`, `tests`, `review`) at a difficulty of 1, 2
or 3. It is plain arithmetic over the record; no model is called. `--explain` also prints why
each other candidate was passed over. `--review-of W` chooses a reviewer from a different maker
than the author `W`, peer review style.
- `sisi delegate --kind K --difficulty N --brief FILE [--worker W] [--review-of W] [--cwd DIR]`
runs the brief unattended on the chosen worker in the given folder, writes the full transcript
to a file under the state folder, and prints only the worker's final report, the transcript path
and the command that records the judgement.
- `sisi delegate judge ID --outcome accepted|rejected --check none|diffstat|tests|read|review
[--minutes N]` records how a run turned out and how strongly it was checked. That judgement is
what later choices learn from. A run nobody judged is listed by `sisi workers` and named at
session start.
- `sisi delegate amend ID` marks a judged result that later proved wrong, so it stops counting as
a success.
## How the choice is made
In order: a model whose id contains "contributor" is never chosen, because those tiers train on
prompts. A worker marked unavailable is skipped until its retry time, as is a flat-rate plan whose
allowance is known to be spent. For a review, the author's maker is skipped while another maker
is available.
A worker counts as proven for a kind and difficulty after enough judged attempts (one threshold
constant in code) with an accepted rate at or above the bar, where accepted means accepted and not
later found wrong. Above the lowest difficulty, proven workers come first. At the lowest
difficulty, workers with a thin record stay in the pool, so low-stakes work is what gathers their
first attempts. A worker with enough attempts and a rate below the bar is passed over while
anything else remains.
Cheapest means: a flat-rate plan with allowance left and no recent failure comes before anything
billed per use, because one more task on it costs nothing extra. Per-use workers order by their
known price. An unknown price is treated as the most expensive of its class until it is learned;
`--explain` says so rather than inventing a number.
Work is then spread, not drained: within one price tier and price, the worker that has taken the
least work relative to the allowance it has left goes first. Every delegation is recorded, so the
choice rotates as work is done, yet is deterministic for one fixed record. Ties break on the
worker id.
On a fresh install the record is empty and no prices are known, so every worker is thin and
unpriced: the first usable worker in id order is chosen, with flat-rate allowance winning where a
tool reports it. Each judgement then shapes the next choice. That is the whole bootstrap; there is
no shipped roster to fall back on.
## Failures that are not bad work
Some tools report a limit or a missing login with a success exit status, so failure is recognised
from the output text, never from the exit status alone. A limit, login, missing tool or outage is
recorded as unavailability, with a retry time that grows on repeat failures, and the same brief is
tried on the next choice at once. Unavailability never counts against a worker's quality. A worker
that ran and did poor work is a different thing: that is a rejected judgement.
sisi never passes a flag that switches off a tool's approvals or sandbox unless the config
explicitly allows it for that tool (`workers.allow_bypass`). When a run times out, the message
says it may be stalled on such a decision and names that setting.
## The main thread
Hook payloads carry the session's model; sisi keeps it with the session record. Model strength
comes from the judged record where it is thick enough, otherwise from a stored prior table in
which every figure carries its source and date. No ranking ships in code: with no prior and no
record, the strength of a model is stated as unknown.
At session start, one plain line follows from that: a session whose model is among the strongest
available on the machine is told to plan, delegate with `sisi delegate` and judge; a weaker one is
told to do the work itself, and told once which stronger models are available. A session another
agent started (a subagent, or a worker run by `sisi delegate`) is told nothing about delegating.
## What is stored, and the seams left open
In the personal data folder: `workers.json` (discovery, with the time it was read),
`delegations.jsonl` (the ledger: runs, judged attempts, amendments), `worker-availability.json`
(unavailable workers and retry times), and two tables that start empty:
- `worker-prices.json`: `{"models": {"<model or worker>": {"plan": "flat" or "per-use",
"cost_per_million_tokens": number, "maker": name, "source": text, "date": "YYYY-MM-DD"}},
"tools": {"<tool>": entries of the same shape}}`.
- `model-strength.json`: `{"models": {"<model or worker>": {"score": number from 0 to 100,
"source": text, "date": "YYYY-MM-DD"}}}`.
A ledger kept by the earlier hand-written orchestrator is imported once, without changing the
original, when its path is named by the `ledger` config key or the `SISI_LEDGER` environment
variable; `sisi workers` reports how many rows came in.
Settings live under a `workers` key in the config: `refresh_after_s` (how old discovery may get
before a command refreshes it), `timeout_s` (how long one delegated run may take), and
`allow_bypass` (per tool, whether approval- or sandbox-switching flags may be passed; off unless
named).
Deliberately not built in this slice, with the tables above ready for them: refreshing prices and
published benchmark scores by web research into those tables; using a cheap fast model to classify
tasks, match lessons or draft review plans; a driver for hosts that delegate through their own
interface rather than a command line; and removing the prose orchestrator this replaces.