Implement ADR 0024 as the semantic-coherence layer for role-style agents, with coordination-first constraints and explicit authority-gated profile lifecycle operations.
Primary outcomes:
- Role semantics are explicit, versioned, and opt-in via
RoleProfile. - Continuity drift (state-key/signature/shape disagreement across sibling methods) is observable, explainable, and repairable.
- Constraint enforcement defaults to environmental coordination over role-wide scope, not prescriptive pinning.
- Profile lifecycle mutations are proposal-based and authority-gated through ADR 0025 lanes.
- Promotion decisions for profile-enabled roles combine reliability evidence (ADR 0023) with profile compliance evidence (ADR 0024).
- Methods-first profile schema is removed (clean break); runtime/docs/examples adopt scope-first contracts only.
Baseline observations before ADR 0024 enforcement (from docs/reports/adr-0025-phase-validation-report.md and recent trace runs):
- Reliability and awareness evidence can look healthy while role semantics drift (for example, calculator produced an incorrect algebra result in reruns).
- Tool-level guardrail and retry mechanisms are active, but they do not guarantee sibling-method state continuity for role-style interfaces.
- Non-profile flows remain operational under tolerant interfaces, with failures surfacing primarily as recoverable guardrail exhaustion rather than typed continuity diagnostics.
- Profile-enabled role calls expose explicit continuity pass/fail evidence for every constrained family.
- Calculator continuity-drift class shifts from silent correctness drift to typed recoverable
role_profile_continuity_violationwith correction hints. - Durable eligibility for profile-enabled roles improves semantic precision by combining reliability and profile-compliance signals.
- False promotion of semantically inconsistent role artifacts drops relative to pre-profile baseline.
- Non-profile tools remain on reliability-only lifecycle policy and do not require role profile adoption.
- Tolerant interface behavior for existing non-profile capabilities remains unchanged.
- ADR 0025 authority boundaries remain unchanged (
enactdenied by default without explicit approval).
- Tests: full Ruby suite remains green at every phase gate.
- Trace fields:
active_role_profile_version, continuity violation records, correction hints, and profile compliance summaries are present where expected. - Rollout thresholds:
- minimum observation window for promotion coupling:
>= 10calls across>= 2sessions, - profile-enabled durable eligibility requires continuity pass-rate at or above configured threshold (initial target
>= 0.99), - specialization of thresholds only when class false-hold or false-promotion exceeds
2xglobal average.
- minimum observation window for promotion coupling:
- Coordination enforcement causes repeated terminal failures beyond retry budget in stable scenarios -> revert affected role to shadow mode and tune correction hints before re-enabling enforcement.
- Profile coupling creates material false holds for one capability class (
> 2xglobal average) -> keep global defaults for others and introduce class-specific thresholds only for the outlier class. - Non-profile regressions after continuity rollout -> isolate and remove unintended coupling so non-profile paths remain reliability-only.
- No automatic runtime inference of "this agent is a role".
- No domain-specific semantic grader beyond authored profile constraints.
- No bypass of ADR 0025 authority gates for profile creation, versioning, or mode changes.
- No forced prescriptive canonical key/shape in coordination mode.
- No backward-compatibility layer for legacy methods-first role-profile schema.
- Separate reliability from correctness:
- Coordination mode is default:
- enforce agreement among siblings,
- do not dictate specific key names/shapes.
- Scope defaults to role-wide:
scope: all_methodsunless explicitly narrowed,- new forged methods are included automatically,
- explicit method lists are opt-in narrowing (
scope: explicit_methods) only.
- Prescriptive mode is explicit opt-in:
- requires declared canonical value,
- requires proposal + approval + apply workflow.
- Keep non-profile tools behaviorally unchanged (tolerant interfaces remain default).
- Preserve deterministic, typed diagnostics for every continuity decision.
- Remove legacy methods-first schema paths in runtime/docs/tests; do not dual-run both shapes.
Already available:
- ADR 0023 reliability scorecards and lifecycle states.
- ADR 0025 awareness substrate, proposal artifacts, and authority gates.
- Existing recoverable guardrail retry lanes (ADR 0014/0016).
Dependency rule:
- ADR 0024 enforcement paths must call ADR 0025 authority checks for any profile mutation.
- Continuity checks run in validation lanes; mutation authority remains outside hot-path runtime decisions.
Add/confirm these UL terms in docs/ubiquitous-language.md and use them consistently in code/docs/logs:
Role ProfileState ContinuityState Continuity GuardCoordination ConstraintPrescriptive ConstraintProfile ComplianceProfile DriftActive Profile VersionProfile Lifecycle Proposal
Deliver in seven phases with hard exit gates and evidence artifacts.
Goals:
- Freeze profile schema and continuity report contract.
- Freeze coordination vs prescriptive semantics.
- Capture baseline behavior before continuity logic affects execution.
- Freeze clean-break policy for schema removal.
Implementation:
- Define/confirm canonical schema for:
RoleProfileConstraintDefinitionProfileComplianceReportrole_profile_updateproposal artifact payload- scope semantics (
all_methods,explicit_methods,exclude_methods)
- Document active-profile binding rule per call.
- Capture baseline traces for:
- calculator flow,
- assistant flow,
- one known continuity-drift scenario.
- Document removal plan for methods-first shape from runtime/docs/tests.
Suggested files:
docs/adrs/0024-contract-first-role-profiles-and-state-continuity-guard.mddocs/ubiquitous-language.mddocs/observability.mddocs/baselines/<date>/adr-0024-phase0/
Phase Improvement Contract:
- Baseline snapshot: pre-ADR-0024 traces with no typed continuity evidence.
- Expected delta: baseline evidence is captured and indexed with known drift exemplars.
- Observed delta: to be recorded in
docs/baselines/<date>/adr-0024/phase-0-validation.md.
Exit criteria:
- Schema fields and semantics are unambiguous.
- Baseline traces are stored and indexed.
- UL terms added/updated.
- Removal targets for methods-first shape are enumerated.
Goals:
- Introduce runtime-readable role profiles with explicit versioning.
- Enforce scope-first schema (
scoperequired/defaulted toall_methods). - Remove legacy methods-first parsing and persistence shape.
Implementation:
- Add profile model and validation:
- required fields (
role,version,constraints), - mode validation (
coordination,prescriptive), - scope validation (
all_methodsorexplicit_methods), - prescriptive canonical value requirements.
- required fields (
- Add profile registry/store and lookup API.
- Bind calls to one active profile version and emit binding metadata.
- Ensure profile absence is first-class (
nil/unset path remains valid). - Remove/replace methods-first examples, fixtures, and stored artifacts in test setup.
Suggested files:
runtimes/ruby/lib/recurgent/role_profile.rb(new)runtimes/ruby/lib/recurgent/role_profile_registry.rb(new)runtimes/ruby/lib/recurgent/call_state.rbruntimes/ruby/lib/recurgent/observability.rbruntimes/ruby/spec/...(unit + acceptance)
Phase Improvement Contract:
- Baseline snapshot: role profile version is not bound as explicit call metadata.
- Expected delta: profile-enabled calls record deterministic active-profile binding while non-profile calls remain unchanged.
- Observed delta: to be recorded in
docs/baselines/<date>/adr-0024/phase-1-validation.md.
Exit criteria:
- Runtime can resolve and bind active profile version when configured.
- Non-profile agents execute unchanged.
- Observability includes profile-binding metadata.
- Methods-first schema inputs fail fast.
Goals:
- Compute continuity compliance without affecting outcomes.
- Generate correction hints and structured drift diagnostics.
Implementation:
- Implement continuity evaluator:
- shared state slot coherence,
- method-family return-shape coherence,
- signature-family coherence.
- Implement mode-aware checks:
- coordination: agreement across sibling observations,
- prescriptive: agreement with canonical values.
- Implement scope-aware sibling set resolution:
all_methods: include all observed role methods by default,- apply
exclude_methodscarve-outs, explicit_methods: include only listed methods.
- Emit structured shadow results:
- pass/fail by constraint,
- violation reason,
- suggested correction hint.
- Persist per-attempt continuity evidence for later rollout tuning.
Suggested files:
runtimes/ruby/lib/recurgent/role_profile_guard.rb(new)runtimes/ruby/lib/recurgent/observability.rbruntimes/ruby/lib/recurgent/observability_attempt_fields.rbruntimes/ruby/spec/...
Phase Improvement Contract:
- Baseline snapshot: semantic drift is not represented as typed continuity findings.
- Expected delta: drift is observable as structured continuity shadow findings with actionable hints.
- Observed delta: to be recorded in
docs/baselines/<date>/adr-0024/phase-2-validation.md.
Exit criteria:
- Shadow reports are deterministic and human-explainable.
- No execution blocking occurs in this phase.
- Violations and hints appear in logs for profile-enabled calls.
- Newly forged methods are automatically included under
all_methodsconstraints.
Goals:
- Enforce coordination constraints through existing recoverable guardrail paths.
- Preserve tolerant behavior via retries and correction hints.
Implementation:
- Raise typed recoverable continuity violation for coordination failures.
- Route violations through existing retry budget and regeneration logic.
- Attach deterministic correction hints to regeneration prompts.
- Keep non-profile and shadow-disabled paths unchanged.
- Verify recoverable enforcement on forged methods not predeclared in profiles.
Suggested files:
runtimes/ruby/lib/recurgent/call_execution.rbruntimes/ruby/lib/recurgent/outcome.rbruntimes/ruby/lib/recurgent/observability.rbruntimes/ruby/spec/...
Phase Improvement Contract:
- Baseline snapshot: coordination drift can pass as apparent success.
- Expected delta: coordination drift triggers recoverable continuity guardrails and retry-based repair attempts.
- Observed delta: to be recorded in
docs/baselines/<date>/adr-0024/phase-3-validation.md.
Exit criteria:
- Coordination violations trigger recoverable retries, not immediate terminal failures.
- Logs show violation type, correction hint, retry path, and final outcome.
- Calculator continuity drift class is reduced in phase evidence.
Goals:
- Enforce ADR 0025 governance for all profile lifecycle mutations.
- Ensure profile updates are explicit, auditable, and reviewable.
Implementation:
- Encode profile lifecycle changes as
role_profile_updateproposals. - Gate creation/version bump/mode change/apply through authority checks.
- Emit typed
authority_deniedon unauthorized mutation attempts. - Add operator review/apply workflow docs and examples.
- Require scope-first contract payloads in
role_profile_updateproposals.
Suggested files:
runtimes/ruby/lib/recurgent/proposal_store.rbruntimes/ruby/lib/recurgent/authority.rbdocs/governance.mddocs/maintenance.md
Phase Improvement Contract:
- Baseline snapshot: profile lifecycle governance paths are not fully standardized.
- Expected delta: all role-profile mutations flow through proposal + authority lanes with complete auditability.
- Observed delta: to be recorded in
docs/baselines/<date>/adr-0024/phase-4-validation.md.
Exit criteria:
- No direct profile mutation path bypasses proposal + authority lanes.
- End-to-end proposal approval/apply flow works for role profile updates.
- Audit trail is complete for profile lifecycle operations.
Goals:
- Add optional deterministic constraints where needed.
- Keep prescriptive usage deliberate and narrow.
Implementation:
- Enable prescriptive checks for selected constraints only.
- Require explicit canonical values and active version selection.
- Add migration path for profile version bumps and rollback.
- Add guardrails preventing accidental coordination->prescriptive drift without approved proposal.
- Keep prescriptive constraints scope-first by default; use explicit narrowing only when justified.
Suggested files:
runtimes/ruby/lib/recurgent/role_profile_guard.rbruntimes/ruby/lib/recurgent/role_profile_registry.rbruntimes/ruby/spec/...docs/adrs/0024-contract-first-role-profiles-and-state-continuity-guard.md
Phase Improvement Contract:
- Baseline snapshot: only coordination expectations are enforced.
- Expected delta: selected deterministic constraints are enforceable via explicit prescriptive mode and versioned activation.
- Observed delta: to be recorded in
docs/baselines/<date>/adr-0024/phase-5-validation.md.
Exit criteria:
- Prescriptive constraints pass only when canonical values are met.
- Version switch and rollback are deterministic and audited.
- Coordination-only roles remain unaffected.
Goals:
- Couple profile compliance evidence into durable eligibility for profile-enabled roles.
- Keep reliability-only policy for non-profile tools.
Implementation:
- Add profile-compliance input to durability gate logic.
- Define initial thresholds:
- minimum observation window:
>= 10calls across>= 2sessions, - global defaults first,
- specialization trigger when class false-hold/false-promotion >
2xglobal rate.
- minimum observation window:
- Add coherence signal in scorecard for sibling-state agreement (
state_key_consistency_ratio). - Publish rollout metrics and tuning notes.
- Ensure promotion metrics consume scope-resolved continuity evidence (including newly forged methods).
Goals:
- Remove all methods-first profile shape references from runtime/docs/tests.
- Remove transitional helpers/fixtures used only for dual-shape support.
- Validate repository only emits scope-first role-profile contracts.
Implementation:
- Delete methods-first parsing branches and tests.
- Rewrite examples/docs/snippets to scope-first contracts.
- Purge or regenerate stale baseline fixtures that encode old profile shape.
- Add lint/spec guard that forbids methods-first role-profile examples in repo docs.
Exit criteria:
- No runtime code path accepts methods-first as default schema.
- No docs/examples show methods-first coordination as baseline.
- CI/spec guard fails if methods-first profile snippets reappear.
Suggested files:
runtimes/ruby/lib/recurgent/promotion_policy.rbruntimes/ruby/lib/recurgent/tool_scorecard.rbruntimes/ruby/lib/recurgent/observability.rbdocs/observability.md
Phase Improvement Contract:
- Baseline snapshot: durable eligibility is reliability-only for all artifacts.
- Expected delta: profile-enabled roles require reliability + continuity compliance; non-profile tools remain reliability-only.
- Observed delta: to be recorded in
docs/baselines/<date>/adr-0024/phase-6-validation.md.
Exit criteria:
- Profile-enabled roles require both reliability and continuity compliance for durable eligibility.
- Non-profile tools remain reliability-only.
- False-hold/false-promotion metrics are visible and reviewable.
Run and archive results for each phase:
- Entire test suite (
bundle exec rspec). - Calculator example (
runtimes/ruby/examples/calculator.rb) and verify arithmetic outputs. - Personal assistant example (
runtimes/ruby/examples/assistant.rb) with prompts:What's the top news items in Google News, Yahoo! News, and NY TimesWhat's are the action adventure movies playing in theatersWhat's a good recipe for Jaffna Kool
- Log and trace review after calculator and assistant runs:
- exact execution path,
- output accuracy assessment,
- what improved,
- what regressed,
- next remediation action.
Evidence location convention:
docs/baselines/<date>/adr-0024/phase-<n>-validation.mddocs/baselines/<date>/adr-0024/logs/phase-<n>-*.jsonl
- Unit tests:
- profile schema/mode validation,
- continuity evaluator behavior per constraint kind/mode,
- authority checks on profile lifecycle actions.
- Integration tests:
- shadow-mode reporting,
- recoverable continuity retries,
- proposal approve/apply profile lifecycle flow.
- Acceptance tests:
- calculator role continuity,
- assistant role behavior under profile/no-profile modes.
- Regression tests:
- non-profile tools remain behaviorally unchanged,
- tolerant interface behavior preserved.
- Risk: over-prescription blocks evolution. Mitigation: coordination default + explicit approval required for prescriptive mode.
- Risk: shadow false positives overwhelm logs. Mitigation: deterministic extraction, thresholded reporting, and tune before enforcement.
- Risk: hidden profile mutation paths bypass authority. Mitigation: centralize lifecycle operations behind authority-gated service.
- Risk: promotion coupling causes premature holds. Mitigation: minimum observation window + shadow ledger calibration.
- Risk: complexity drift in role contracts. Mitigation: keep constraint kinds minimal; expand only with evidence.
ADR 0024 is complete when all are true:
- Role profiles are opt-in, versioned, and authority-governed.
- Continuity drift is visible in shadow and recoverable in enforcement.
- Coordination mode works as environmental pressure without dictating canonical values.
- Prescriptive mode is available but explicitly controlled.
- Promotion for profile-enabled roles uses both reliability and profile-compliance evidence.
- UL/docs/tests/trace artifacts are updated and internally consistent.
- Methods-first profile schema has been removed from runtime/docs/tests (clean cut complete).