feat(fleet): inject persona contract at launch (A3b) #664
Reference in New Issue
Block a user
Delete Branch "feat/a3b-persona-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A3b — inject resolved persona contract at launch by class
At agent launch,
composeContractnow readsMOSAIC_AGENT_CLASS(exported into the pane env by the companion A3a goal) and injects the agent's resolved persona role contract into the system prompt, so its identity (mandate + boundaries) is resident from the first turn.What it does
readPersonaContractBlock(mosaicHome, klass)inpackages/mosaic/src/fleet/persona-contract.ts(mirrorscomms-onboarding.tsstructure; standalone, no heavyfleet.tsimport).composeContractbefore the fleet comms block: identity first, then how-to-reach-peers. Guarded exactly like the comms block (only pushed when non-empty).Override-aware (AC-NS-7 launch proof)
fleet/roles.local/wins over the baselinefleet/roles/of the same class. A dedicated test asserts the override body is injected and the baseline is NOT — the launch-time proof that a customized persona actually reaches the model (not justmosaic fleet persona show).Tolerant / no-op
''so the launcher no-ops silently. Never throws during launch (mirrorsreadFleetCommsBlock).Sync resolver twin
composeContractis synchronous and cannotawaitthe asyncresolvePersona. AddedresolvePersonaSync/extractClassesFromDirSyncinfleet-personas.tswith identical extraction semantics, sharing a pureaccumulateEntryhelper so async and sync paths never drift.Tests
persona-contract.spec.ts(7): baseline inject, override wins, override-only custom persona, no-op for undefined/empty/whitespace/unknown class, no-throw when no roles dirs exist.compose-contract.spec.ts(+5): baseline inject at launch, override wins at launch (AC-NS-7), no-inject when class unset, no-throw on unknown class, persona placed before fleet comms. Env saved/restored inafterEach.Gates
vitest run: 606 passed (43 files).typecheck: clean.lint: clean.prettier --check: clean.Reviewable — do NOT merge. Does not touch
generateAgentEnv/fleet.ts(A3a's scope); only readsMOSAIC_AGENT_CLASSfrom env.🤖 Generated with Claude Code