Commit Graph
5 Commits
Author SHA1 Message Date
CatoandClaude Fable 5.1 95c40a9cd8 refactor: rename the product from FleetCrown to Loki (#695)
The product, its assistant, the repo, the host and every unit on the box now
share one name. 638 files, ~3,000 mentions: UI copy, config, env keys
(FLEETCROWN_* -> LOKI_*), systemd units (fleetcrown-* -> loki-*), docs,
articles, the deploy workflow other repos reuse, and nine file names.

- Three article slugs carried the old name and had been shared; permanent
  redirects keep those links alive (next.config.ts).
- test-no-retired-name.sh now also forbids the old product name across the
  whole repo, so the rename cannot creep back through templates and examples.
- ASSISTANT_STACK collapses the product and the assistant into one entry,
  because they are now the same name.

Infra was cut over ahead of this merge: /opt/loki, loki-* units, the `loki`
database and role, loki.orangecat.ch (old host 308s to it; /api, /widget,
/embed keep proxying), GitHub repos bitbaum/loki and bitbaum/loki-releases.
The Resend sending domain stays fleetcrown.orangecat.ch until the new domain
is verified in DNS.


Claude-Session: https://claude.ai/code/session_016YJVAanfj8keVSXyZnTemh

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 16:13:10 -07:00
d97fd69db1 refactor(deps): ai-kit comes from npm — @bitbaum/ai-kit ^0.6.2 (#473)
The package is now published to the npm registry as @bitbaum/ai-kit
(npm's typosquat guard blocked the bare name "ai-kit", hence the scope;
ai-kit PR #25 documents the rename — content is identical to the
github:bitbaum/ai-kit#v0.6.2 tag). The git pin is retired: the lockfile
no longer records the writer's ssh transport and npm-major-specific
resolution for this dependency, so the whole lockfile-writer trap class
dies with it. All imports move from 'ai-kit' / 'ai-kit/grounding' to
'@bitbaum/ai-kit' / '@bitbaum/ai-kit/grounding'.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-04 00:11:06 +00:00
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
bc0493f68f refactor(agent): the grounding harness is imported, not mirrored (#448)
FleetCrown half of the mirror retirement (fleet AI-engine plan, Phase 2).
src/lib/agent/core was the CANONICAL copy of the harness, mirrored
byte-for-byte into OrangeCat and policed by scripts/test/agent-core-drift.ts
plus scripts/sync-agent-core.ts. Its own README called the duplication
"deliberate and temporary" and named extraction to a package as the exit.
ai-kit v0.6.2 is that exit; OrangeCat's twin PR (#846, merged) deletes the
other side.

Fourteen imports across nine files collapse from three deep paths to one
subpath import. The sync script, the drift check and the npm script that ran
it are deleted rather than kept green: with a single copy there is nothing
left to drift, and a gate with no possible failure mode is noise wearing a
uniform. ai-kit also moves v0.2.1 -> v0.6.2 (still the ai-ration name in the
old lock entry); the three root imports this repo uses (chain, fair-share,
limits) are unchanged surfaces across that jump, which typecheck confirms.

The packaged copy differs from the deleted canonical by two mechanical
deltas, both made where the code now lives: .js extensions on relative
imports (pure ESM) and two null-guards under ai-kit's
noUncheckedIndexedAccess.

tsc clean; 124/124 unit test files pass (one fewer than before: the drift
check no longer exists to run).


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-31 09:45:07 +02:00
5317762404 feat(loki): ground every answer in typed records instead of prose (#212)
* feat(loki): ground every answer in typed records instead of prose

Loki answered a five-part "plan my day" prompt with three fabricated
answers, then produced an unverified correction when challenged. Traced:

  - "rotate the expired GROQ_API_KEY, it blocks truthseeker" — the key
    returns HTTP 200. Both cited .env paths were invented.
  - "Ilya Druzhnikov (UZH)" — the record has no org field and "UZH"
    exists nowhere in the operator's data. It is the substring inside
    dr-UZH-nikov: a keyword-match artifact narrated as an affiliation.
  - "Elena Weber, Accelerator & Bridge Program Manager, University of
    Liechtenstein alumna" — the record is a display name and a phone
    number. No web search was performed.

Root cause is architectural, not prompt quality. buildLokiFleetContext
injected projects + RAG only; people, goals, habits, commitments and
events were never in context, though FleetCrown could already answer
every one of those questions exactly (getStuckGoals, getGoalsDueSoon,
listUpcomingCommitments, getEventsDueSoon have existed for months).
So a prompt demanding five items met a context supporting one, and the
model filled the rest — the ordinary failure mode of a small model
under format pressure, which is precisely who will be running this.

The fix makes unsupported claims hard to EXPRESS, not just discouraged:

  agent/core/facts.ts     records with a declared field set; unstored
                          fields render as an explicit `<not recorded>`,
                          turning absence into a stated negative
  agent/core/contract.ts  rules generated from THIS turn's facts —
                          enumerated citation ids, named concrete gaps,
                          a verbatim refusal phrase; plus Directive for
                          answers computed in SQL that the model may
                          only phrase, never re-derive
  agent/core/verify.ts    deterministic post-generation check. No extra
                          model call, so it runs on free-tier turns too.
                          Flags unresolvable citations and proper nouns
                          / numbers / paths absent from the records.

  agent/brief.ts          wires the existing SQL into the assistant at
                          last; an empty result is reported as empty
  agent/sources.ts        people (new), projects, pgvector docs, and
                          OrangeCat demand → Facts
  agent/context.ts        assembly; contract first, records last

loki-core now verifies each answer and gives the model one repair pass
to DELETE unsupported claims. Surviving violations ride back as
`grounding` metadata rather than being swallowed: the original failure
was not that Loki was wrong, it was that wrong looked exactly like right.

scripts/test/agent-grounding.ts asserts all four fabrications above are
caught and that a clean grounded answer still passes. core/ is mirrored
to OrangeCat with a SHA-256 drift gate, pending @fleet/agent-core.

Removes loki-fleet-context/-index — superseded, and a second definition
of the fleet index would be the SSOT violation this replaces.

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

* feat(agent): scope the name check by assistant, not one rule for both

The verifier's original closed-world rule — every proper noun must be
attested in the records — is right for Loki and wrong for Cat, and
shipping it unchanged to both would have made Cat unusable.

Loki reports one operator's records. Any unattested name there is a
fabrication. Cat also answers general questions ("how do I get paid in
Switzerland"), where naming Twint, Lightning or PayPal is correct and
required. Flagging those would have produced constant false positives on
a live multi-tenant product, and a check that cries wolf gets switched
off within a week — at which point it protects nothing.

So `mode`:

  closed-world        every unattested proper noun is a violation (Loki)
  entity-attribution  only sentences naming one of the USER'S OWN records
                      are checked (Cat)

The narrower mode is genuinely weaker and that is a real trade, not a
loophole: Cat can still be wrong about the wider world. It can no longer
invent an employer for someone in your contacts — the failure that
actually destroys trust in a personal assistant.

Also adds buildAssistantRules() — the fact-id-free half of the contract,
for an assistant whose context is still prose. Weaker by construction
(nothing to cite), but it keeps the rules that stopped the worst failure:
never state an attribute a record does not carry, never imply research
you did not perform. A stepping stone to typed records, not a
destination.

Two new adversarial checks assert BOTH halves — general economic advice
passes in entity-attribution mode, an invented employer for a known
contact does not, and closed-world remains strictly stronger.

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

---------

Co-authored-by: test <test@test>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 10:34:36 +00:00