Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a1edeaf
feat(environment): explain values an application derives from other f…
earakely-scale Oct 24, 2026
8ce1127
docs(environment): record the derived-values verification
earakely-scale Oct 24, 2026
1ec053e
chore: merge main into derived values
earakely-scale Oct 24, 2026
a80a96f
fix(environment): keep clock spellings, linked ids and word boundarie…
earakely-scale Oct 24, 2026
1e6c02c
test(environment): keep a same-width fixed clock out of trimming
earakely-scale Oct 24, 2026
8e23f18
fix(environment): check composed parts and clock fits before they sha…
earakely-scale Oct 24, 2026
5a976d7
chore: merge main into derived values
earakely-scale Oct 24, 2026
09c48c5
test(environment): split the derived-values view tests by rule
earakely-scale Oct 24, 2026
2e5f56d
fix(environment): keep fixed-width, zone and generated-integer eviden…
earakely-scale Oct 24, 2026
96783c7
chore: merge main into derived values
earakely-scale Oct 24, 2026
fb0eece
Merge remote-tracking branch 'origin/main' into feat/environment-deri…
morluto Oct 24, 2026
21b60f4
test(setup): share registration prewarm host preparation
morluto Oct 24, 2026
5f8a954
fix(environment): retain write evidence and match trimmed response cl…
morluto Oct 24, 2026
94f1753
Merge remote-tracking branch 'origin/main' into feat/environment-deri…
morluto Oct 24, 2026
3705fae
fix(environment): withhold creates whose generated integer another st…
earakely-scale Oct 24, 2026
e54b75a
fix(environment): hold later creates and compare to the composed and …
earakely-scale Oct 24, 2026
aeae47f
chore: merge main into derived values
earakely-scale Oct 24, 2026
5fd87e9
fix(environment): preserve composed parts and unique generator families
morluto Oct 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions docs/agent-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ every MCP session and `data/get` then see:
| Effect | Call |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `create` | Adds an entity to the collection the path names, built from the observed entity with each ruled field taken from the call or generated, at the plan's `insert` position. A plan tied to its exemplar's collection writes only there. |
| `update` | Sets the sent members on the entity the path names, constants for members accepted only with their recorded value, and the clock, nested clock, increment, slug, stamp, derived, unique and renewed changes the plan models. |
| `update` | Sets the sent members on the entity the path names, constants for members accepted only with their recorded value, and the clock, nested clock, increment, slug, stamp, derived, composed, unique and renewed changes the plan models. |
| `update` (action) | A `POST`, `PUT` or `PATCH` to an item path plus an action segment (`/{type}/{id}/archive`) sets, on the entity before the segment, each scalar the recorded calls showed the action set (`set`), with any sent members; it is served only when a recorded call found those fields already set, so a toggle never is. |
| `delete` | Removes the entity the path names. |
| bulk `update` or `delete` | A `DELETE`, `PUT` or `PATCH` at a collection, or a `POST` to it plus `delete`, `remove` or `destroy`, applies its effect to every entity the body names, as recorded: an array of ids or of objects carrying the id field, at the root or as the body's one array member (`{"IDs": […], "Read": true}`). |
Expand Down Expand Up @@ -923,6 +923,9 @@ Known limits of served writes:
updates require `updated_at` to match the entity (a `held-clock`).
- A slug derived from a title can repeat across served creates with the same
title, where the application would make it unique.
- A `composed` string copies sent text as sent: an application that escapes or
renders it (HTML entities, Markdown) differs for text that needs it, as
BookStack's `description_html` would for a description holding `&`.
- A served create's sequence id is the state's next value, not the gaps an
application's own sequence would leave.
- Nested clocks are served in the spelling of the write's own response, which
Expand Down Expand Up @@ -1057,9 +1060,11 @@ Numeric arrays retain that containing field's clock context through nested
arrays; an object's own fields establish their own context. Numeric values at
the body root, in root arrays, or under measurement fields remain literal.

Generated strings normalize only where this confirmed, served write's entity
response rules identify generation. A `unique` rule or UUID identity rule must
still compare two UUIDs; a `renewed` rule applies only at its recorded pointers,
Generated values normalize only where this confirmed, served write's entity
response rules identify generation. A UUID identity rule must still compare two
UUIDs, and a `unique` rule two UUIDs or two generated integers (10 to 20
digits) of one JSON kind and length; a `renewed` rule applies only at its
recorded pointers,
with `*` matching actual array items. Token/sequence strings retain the existing
format check: equal length of at least eight, the same character classes, and
a digit. Numeric sequences continue to compare literally unless an ID mapping
Expand All @@ -1071,6 +1076,12 @@ Admitted generated values must also preserve aliases and distinct identities
within that response. UUID identity uses the generator's case-insensitive
matching; token and sequence strings retain their literal identity. This
correspondence ends with the answer and is not inferred across calls.
A `composed` response field must spell the value its parts build from that
response's own fields. Its parts then compare by their rendered text or their
source fields' clock and ID rules. A coherent archive URL can therefore differ
only in normalized clock digits without reporting a value difference; an
incoherent URL still differs even when both sides repeat the same stale text.
Normalized compositions count under `generated`; source fields are counted once.
The report counts each kind of normalised
value; the generation rules remain model-derived facts, rather than new
observations of the application.
Expand Down
12 changes: 12 additions & 0 deletions docs/specs/agent-environments/write-derived-values/plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Implementation plan

1. **Clock formats.** A `trimmed` ISO format, `fixedWidth` on a clock reading, fitting a format to another value, and
calendar digits, in a clock formats module.
2. **Composed strings.** A module that indexes a create's candidate parts once, segments a string, checks the type's
other entities and an update's before value, and spells the string from written fields.
3. **Explaining.** Create explanation composes unexplained strings after templates, learns trimmed clocks from the
type and generated integers; update explanation composes unsent changes after the existing rules.
4. **Later calls.** A later create or update widens the plan's clocks to a trimmed spelling it shows; a later create's
unique value may be a generated integer.
5. **Serving.** Derived fields are rebuilt after other rules; unique integers are seeded by length and kind.
6. **Schema, tests and docs.** The plan schema, view, serving and unit tests, and the write-plan docs.
59 changes: 59 additions & 0 deletions docs/specs/agent-environments/write-derived-values/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Explain values an application derives from other fields

Issue: https://github.com/morluto/rea/issues/4933

## Outcome

Environments an agent built from a prompt withheld creates in three of five applications, each for a value the write
model could not explain, though the application derives it deterministically:

- Linkding's `web_archive_snapshot_url` is `https://web.archive.org/web/<creation time as YYYYMMDDhhmmss>/<sent url>`.
The plan kept it as a constant, which pinned `url` to its recorded value, so a later create with another URL was
refused.
- Grafana's folder `url` is `/dashboards/f/<uid>/<slug of the title>`, which pinned `uid` the same way, and its numeric
`id` is a large time-based integer the plan copied from the first create, which the second create's read-back
contradicted.
- Homebox, written in Go, spells nanosecond clocks with trailing fraction zeros dropped (`…34.38812218Z`), so a later
create's clock did not follow the format learned from the first.

## Behaviour

- **Composed strings.** A created field no other rule explains may be a `composed` string: literal text and parts read
from the fields other rules write, each a field's value, its slug, or a clock's calendar digits (`YYYYMMDDhhmmss`,
`YYYYMMDD`, `YYYY-MM-DD`, `YYYY/MM/DD`, in the clock's zone). Parts are found left to right, longest first, delimited
by non-alphanumerics; generated values may be short, other values need eight characters, as a copy does. A create
composes a string only when at least one other entity of the type spells it with the same parts and none spells it
otherwise, and never when one text comes from two sources serving could tell apart (two clocks the write stamps are
one source when they spell the same zone), and never when another entity holds the field as something other than the
parts spell, a non-string value included. An update's unsent change may be composed from members it stored as sent and
fields it left as they were, when the same parts also spell the value before the call and no other entity spells it
otherwise. Serving rebuilds the string from the written fields after every other rule and refuses a call when a part's
field holds nothing to spell, and a composed field no longer pins the members it reads. A composition learned on a
later call is checked against every earlier call, and a later create whose response spells a composed field otherwise
is withheld.
- **Trimmed clocks.** A clock format may be `trimmed`: its values differ only in how many fraction digits they show and
none ends a fraction in a zero. It is learned from the type's held values of the field, from a later create, and from
a later update; other clocks the plan stamps take the spelling too, and no clock takes it once a held entity, the
exemplar or any call the plan accepted showed the field at a fixed width; a later call that then shows it shorter is
withheld. `fraction` is the most digits shown, and serving drops trailing zeros and the point with them.
- **Generated integers.** A created integer of 10 to 20 digits that no entity of the type holds, where every held entity
holds a distinct one of the same length and JSON kind and none is a clock, is `unique`. Serving draws a seeded integer
of that length and kind that no held entity has. One that another field of the created entity also holds, as a value,
a number at any depth or a delimited part of a nested string, is not `unique`, and the create is withheld as
`unexplained-change`, since seeding cannot keep the two equal. A create is also withheld when another string holds its
digits and no `template` or `composed` rule rebuilds that string from it, or when a later create answers the field
with anything but an integer of the same length and kind. Compare treats two such integers of one JSON kind and length
under a `unique` rule as generated values.

Plans that need none of this are unchanged.

Later creates must retain the exemplar's unique-value family (UUID, integer with
the same digit count and JSON kind, or opaque token). Their recorded composed
fields must equal the values the plan rebuilds; simulation cannot replace a
contradictory captured value and then count that replacement as confirmation.

## Acceptance

- The prompt-built Linkding, Homebox and Grafana captures serve the creates and renames they withheld, and write
tasks that use them pass.
- No write tool of the 50 published captures or the earlier prompt-built captures goes from served to withheld.
10 changes: 10 additions & 0 deletions docs/specs/agent-environments/write-derived-values/tasks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Tasks

- [x] Read and fit trimmed clock formats, and spell calendar digits.
- [x] Compose created strings and unsent update changes from other fields.
- [x] Learn generated integers as unique values and serve them by length and kind.
- [x] Widen plan clocks on later creates and updates, and spread a trimmed spelling to the plan's other clocks.
- [x] Add view, serving and unit tests.
- [x] Document the rules.
- [x] Measure the prompt-built captures, the 50 published captures and the served write tasks.
- [x] Run static, formatting, documentation and test gates.
91 changes: 91 additions & 0 deletions docs/specs/agent-environments/write-derived-values/verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Verification

Executed on macOS with Node v24.22.1 at `a1edeafd` (main `79845063` plus this branch). The prompt-built recordings and
evaluations used a local, unpushed build of this branch merged with the scenario-timing branch (#6967), whose request
times the clock rules need from browser scenarios, on Ubuntu 24.04 VMs with snap Chromium 155. The baseline is the same
merge without this branch.

## Gates

Follow-up on 2026-10-25, after merging main `a5bfd0440`, with Node 24.22.1 and npm 11.16.0 on macOS:

- Environment write/compare source tests: 26 files, 839 passed.
- Analysis-view CLI/MCP, environment served-write MCP, environment-compare CLI, managed bundle read guards, and setup
registration prewarm boundaries: 6 distinct files, 77 passed. The managed low-headroom failure is fixed by main's
Evidence ownership change (#7036); the setup tests share host preparation to satisfy lint without removing cases.
- `check:fast`, `format:check`, and `docs:check`: passed.
- New capture-to-plan regressions reproduce missing composition parts on earlier updates (null and structured sources)
and fixed-width clock evidence from either the selected entity or another held entity. Rule tests exercise several
separator/zone groups in both orders, choosing each group's widest trimmed peer while preserving fixed-width fields.
- Compare uses the domain clock matcher on parsed readings. Tests cover shorter fractions, absent fractions, maximum
width, trailing zeros, separators, zones, and response-entity scope; the compiled CLI accepts a Go-style create whose
live clocks have eight digits and served clocks have none, preserving all input Evidence files.
- The original application's recordings and model evaluations below were not rerun in this follow-up.

Original author validation:

- `npm run -s typecheck`, `lint`, `format:check`, `docs:check`, `mcp-catalog:check`, `verify:test-discovery`,
`scan:todos` and `npx knip`: passed.
- `npx vitest run --project domain --project services --project adapters`: 17,246 passed, 25 skipped, 1 failed ("stops
Inspector target authorization after the current stat settles"), which fails the same way on main in this environment.
- `npm run test:prepare`, then `npm run test:focused --` the environment build, export and serve CLI boundaries, the
analysis-view CLI and MCP boundaries, the environment serve, served-writes and bundle MCP boundaries, MCP schema
validation and output schema constraints: 10 files, 82 passed.

## Tests

- View: Go-spelled tag creates and renames are served with a trimmed clock; bookmark creates are served with a composed
snapshot address and accept any URL; folder creates and renames are served with a composed address and a generated
integer id.
- Serving: a served tag create spells its clocks without trailing zeros; a served bookmark create composes its snapshot
address from the served clock and the sent URL; a served folder create gets a fresh sixteen-digit id and an address
that follows its uid and title, and a rename moves the address.
- Unit: fitting clock formats (trimmed, fixed width, separator and zone), calendar digits, seeded integers, generated
integer detection, composition and its refusals (one call alone, a held entity spelling otherwise, two sources with
one text, a member stored otherwise than sent, a value the parts do not spell before the call), and a wide body
composed within the existing time limit.

## Write plans over recorded captures

Every write plan of 69 captures, built by the baseline and by this branch: the 50 published captures, 18 captures
Claude Code recorded from a prompt for the prompt branch's checks, and one new timed Grafana recording.

| Captures | Write plans | Served on the baseline | Served on this branch |
| ------------------------- | ----------- | ---------------------- | --------------------- |
| 50 published | 187 | 68 | 68 |
| 19 recorded from a prompt | 120 | 56 | 61 |

- No write goes from served to withheld. The five gains are Linkding's bookmark create, Homebox's tag create, and
Grafana's folder create in two recordings and folder rename in the timed one.
- Published plans change only where a value is now composed: Linkding's bookmark create and BookStack's book create and
update (`description_html` as `<p>` around the description) now accept the member they read.
- Unchanged by design: Grafana's published folder, whose uid and title slug are the same text, so its address names two
sources; Ghost's post update, whose `lexical` keeps the `derived` rule that explained it before; BookStack's page HTML
and Jellyfin's playlist path, which other pages and playlists of the capture spell otherwise.
- What still withholds a create the composed value now explains: a later Linkding create that sends a member the first
did not (`shared`), Homebox item creates that differ from the first location create, and a Linkding create whose
read-back lists `tag_names` sorted.

## Served write tasks

The same timed captures, rebuilt by the baseline and by this branch, with the models `fireworks_ai/gpt-oss-120b` and
`fireworks_ai/glm-5p3-flash`. Create tasks are new; recorded write tasks are the applications' existing ones with entity
counts taken relative to each bundle's state.

| Application | Tasks | Baseline (gpt-oss, GLM) | This branch (gpt-oss, GLM) |
| ----------- | ---------------------------------- | ----------------------- | -------------------------- |
| Linkding | 2 bookmark creates | 0/2, 0/2 | 2/2, 2/2 |
| Linkding | 3 recorded (update, notes, delete) | 3/3, 3/3 | 3/3, 3/3 |
| Homebox | 2 tag creates | 0/2, 0/2 | 2/2, 2/2 |
| Homebox | 2 recorded deletes | 0/2, 0/2 | 0/2, 0/2 |
| Grafana | folder create and rename | not served | 1/2, 2/2 |
| Grafana | 2 recorded deletes | | 2/2, 2/2 |

- Smoke and retrieval match on both builds (Linkding 9/9 and 8/9, Homebox 3/3 and 3/3); Grafana's new recording passes
its smoke task and 9/9 retrieval with both models.
- gpt-oss missed the Grafana rename by sending the update without the title it was asked to change, ten times; the
served environment refused each call with the members it accepts.
- Homebox's recorded deletes fail on both builds: this recording's served entity list holds its locations only, so the
models never find the item to delete.
- The created bookmarks' snapshot addresses and the created and renamed folders' addresses are checked from the
environment's state.
Loading
Loading