feat(dynasty): add legitimacy signal from chronicle events - #35
Merged
Merged
Conversation
Adds dynastyLegitimacy(state, dynastyId) — a [-1, 1] score computed from the dynasty's recent historicalEventIds. Positive events (heir-born, succession, dynasty-restored, dynastic-marriage) push toward +1; negative events (heir-died, succession-crisis, pretender-revolt, dynasty-extinct) push toward -1. The score lightly shifts the pretender revolt cohesion threshold by ±0.10: - High legitimacy (+1) requires cohesion ≤ 0.45 before revolt can fire - Low legitimacy (−1) allows revolt when cohesion ≤ 0.65 The inspector now shows "Legitimacy: Stable / Contested / Fragile" above the Dynasty Chronicle when chronicle events exist. The headless report shows the top dynasty's legitimacy score alongside its prestige. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RPPpxsKfPvjTpLdZLBLC6V
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dynastyLegitimacy(state, dynastyId)— a[-1, 1]score derived from a dynasty's recenthistoricalEventIds, requiring no new storageArchitecture answers (pre-implementation inspection)
state.dynasties: Record<Id, Dynasty>inGalaxyState;Dynasty.tsowns all logicrecordDynastyEvent()inDynasty.ts— pushes intodynasty.historicalEventIds(capped at 12)maybePretenderRevolt()inDynasty.ts, called frommaybeLifeEvents()dynasty.prestige(0–100), grows with long reigns, drops on coups/extinctionDynasty;Factionhas one but is unrelatedhistoricalEventIdsand shift the revolt thresholdBehavior
dynastyLegitimacy(state, dynastyId)— pure, derived, no new storage:heir-born,succession,dynasty-restored,dynastic-marriageheir-died,succession-crisis,pretender-revolt,dynasty-extinctRevolt threshold shift (was fixed at 0.55):
revoltThreshold = 0.55 − legitimacy × 0.10Inspector label: Stable (green) / Contested (yellow) / Fragile (red) — shown when chronicle exists.
Headless report line (new):
Test results
Noet advisory layer
Noet was used in advisory/cognitive mode only (no Noet source modified). Mode recommendation: Implementer. The
noet cognitiondigest confirmed the right constraints: stay model-agnostic, keep behavior deterministic, prefer derived signals over stored state.Dogfood receipt
Generated by Claude Code