Commit Graph
2 Commits
Author SHA1 Message Date
GandClaude Opus 5 caa0e41c3b chore: add a formatter (#449)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier (1062 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore: teach git blame to skip the reformat

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(lint): reattach two guards the reformat detached

Both effects were one-liners, so a trailing eslint-disable-line covered the
setState call:

  useEffect(() => { setSelected(new Set()); }, [q.length]); // eslint-disable-line ...

prettier expanded the block. The comment stayed on the closing line while the
call moved above it, so the guard protected nothing and the rule its author had
deliberately silenced failed the build.

This is the second shape of the same defect — hirnli had the eslint-disable-NEXT-line
variant. Both come from the same fact: an eslint directive binds to a line
number, so reformatting can silently unbind it, which makes 'mechanical, no
behaviour change' false for any bulk reformat.

* chore(desktop): bump the runner version the reformat requires

desktop-release-drift enforces that anything built into Fleet Runner which
differs from the last released tag must carry a version ahead of that tag —
main read 0.8.15 and fleet-runner-v0.8.15 already shipped.

A whole-repo reformat changes bytes under desktop/, so the gate fires. The
alternative was adding desktop/ to .prettierignore, which would buy a quiet PR
by carving a permanent hole in the formatter's coverage — the precise shape of
silent drift this test was written to catch. Bumping is what the rule asks for
and costs one patch release whose only content is whitespace.

* chore: merge main and re-format

A whole-repo reformat conflicts with any concurrent commit, and a conflicting PR
runs no checks at all while reporting nothing. Conflicts resolved to main,
which is correct because this branch changes formatting and nothing else.

* chore: leave desktop/ out of this reformat

desktop-release-drift is right to refuse this. Everything under desktop/ is
built into Fleet Runner, so changing it means shipping: bump the version AND add
a FLEET_RUNNER_RELEASES entry, whose stated audience is 'person who installed
Fleet Runner and wants to know what changed'. For a whitespace-only build the
honest answer is 'nothing', so that release should not exist — and I should not
write release notes claiming otherwise.

I had bumped to 0.8.16 to get the gate green. That was the wrong direction:
publishing a build to three OS runners to keep a formatting PR quiet. Reverted.

desktop/ is excluded in .prettierignore with the reasoning recorded there, to be
formatted alongside the next real runner change, where the bump and the notes are
true anyway.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 09:23:30 +00:00
a32f1b1f03 fix(orchestration): ask agents for the evidence they are graded on — Phase 1 measured, plan corrected (#193)
* docs(roadmap): add the learning phase and the self-improvement plan

FleetCrown grades every agent run against a definition of done and then
forgets the verdict. An audit against the 2026 self-improvement literature
found the loop pointed the wrong way: src/lib/frontier/ ingests arXiv,
Lobsters and HN to propose how the product should evolve, while the
prompt-and-outcome record the fleet generates from its own runs is read by
display surfaces only. Every consumer of prompt_history (activity, digests,
today, export, project-merge) renders it; none learn from it.

The corpus is already the right shape — prompt_history.resolvedPrompt, the
graded orchestration_runs.outcome, and dod-gate's one-sentence `gap` critique
are a (prompt -> textual feedback -> outcome) triple. What blocks it is that
prompt_history has no runId, and the prompt is logged BEFORE the run row
exists in a fire-and-forget call, so the two logs can only be matched by
timestamp proximity under concurrency.

Adds:
- docs/self-improvement-plan.md — phased, every phase with an acceptance AND
  a kill criterion, including one that abandons the effort outright if the
  measurement phase shows failures are infrastructure noise rather than
  instruction quality. Sizes Phase 0 honestly as a column plus a write-ordering
  fix across three call sites, not a one-line migration.
- ROADMAP gains a LEARNING phase (public, capability-level).
- Thoughts essay covering the audit, the fast-loop/slow-loop split, and the
  four documented failure modes (verification horizon, misevolution, context
  collapse, extrinsic metacognition).

Nothing in the loop is built yet and the changelog says so. The standing rule
across every phase: no learned change ever applies itself — the judge stays a
different model lineage from the worker, and a human accepts or dismisses.

Verified individually rather than via the pre-commit hook, which exceeds ten
minutes on a cold worktree: tsc --noEmit clean, eslint clean, design-system
gate ok, 55/55 unit test files pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(orchestration): ask agents for the evidence they are graded on

Phase 1 of the self-improvement plan ran read-only against prod. It needed no
runId FK and no schema change — which was the first thing it corrected. What it
found cancelled the expensive half of the plan and exposed a one-line cause for
the fleet's dominant failure.

Measured over 254 runs (51 graded):
- only 57 are evidence-present; a timeout never writes a handoff at all
- DoD met 3, not met 48 (5.9%)
- 64.6% of every rejection was "work not evidenced", not "work is wrong"
- 48 rejections produced 48 DISTINCT gap sentences — zero repetition

The bar was not the problem. 46 of 51 graded runs ran against "`npm run verify`
passes, with its real output in the handoff (lint:/tsc:/tests:)" — precise and
mechanically checkable. The prompts were the problem: `tests:` was filled 97% of
the time while `tsc:` and `lint:` were filled 3 times in total (zero before
August), because `tests:` appeared in an explicit `field: <hint>` list the agent
could copy and the others were named only inside a paragraph. Agents write the
shape they are shown. The work was being done; the fields it had to land in were
never requested.

- HANDOFF_FIELD_BLOCK is now the single canonical handoff shape, used by every
  close path, and includes the evidence fields.
- evidence-precheck.ts turns the dominant rejection into a deterministic check
  that runs BEFORE the model judge. It can only reject, never approve, and
  defers the moment it cannot decide. Replayed over all 51 graded runs it fires
  on 48, defers on 3, and skips 94% of judge calls.
- It emits a stable gapCode, so the whole rejection history collapses from 48
  snowflake sentences to two categories. Countable gaps are the precondition for
  ever learning from this corpus.

Ordering matters and is enforced: the prompt fix ships WITH the check, because
before today those fields were blank on ~94% of runs and enforcing them would
have punished agents for our instruction bug. scripts/test/handoff-fields.ts
pins the two together — a field the gate can reject you for must be a field the
prompts request, asserted as a field LINE not a substring (verified to fail 8/10
on the pre-fix prompts, so it gates the real bug rather than restating it).

Replay honesty: the pre-check disagreed with the model judge once in 51, on a
run the judge passed with lint: and tsc: both blank against a bar naming them.
That is the direction this gate exists to enforce, so it was not softened.

Consequences recorded in docs/self-improvement-plan.md: GEPA prompt optimisation
is PARKED (no repeating signal to learn from) and the runId FK is DEFERRED (its
only consumer is parked). One read-only query replaced a migration, a
dispatch-path refactor, and an optimiser build.

Verified: tsc clean, eslint clean, design gate ok, 57/57 unit test files.
Post-merge step: `npm run generate:agent-prompts` to refresh the local runner's
JSON menu (server-side dispatch already renders from the TS SSOT).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs(thoughts): record what the measurement actually overturned

The essay described a plan written before the query ran. The query changed it,
and an essay arguing for measurement that quietly edits away its own surprising
result would be making the opposite point.

Adds a postscript with the two things that were wrong: the measurement did not
need the schema fix it had been sequenced behind, and the failures were not
vague rubrics but a prompt that never asked for the fields it graded (tests:
filled 97%, tsc:/lint: filled 3 times ever). Also records the second-order
result — 48 rejections produced 48 distinct sentences, which is exactly why the
corpus was unlearnable, and why collapsing them into countable categories
matters more than the bug fix.

Summary/excerpt and reading time updated to match.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-07 19:14:27 +00:00