Skip to content

Slice 4: posture-aware context injection — the Active mode block #808

Description

@aarontrowbridge

Important

Problem — The context splice is posture-blind: nothing tells a mid-campaign or post-compaction agent which director posture it is in. The plugin can resolve the session's agent but does not, so an autodev session that compacted re-enters as a generic helper — the exact "agent doesn't know it's in autodev mode" failure this campaign exists to fix.
Approach — Resolve the session's agent (primary: the session-info agent id, availability inside the transform hook verified by a fixture FIRST) and emit an ## Active mode block on director-posture sessions: posture, phase/gate summary read from the registry bundle, ledger path convention, resolved-agent + registry-digest stamp. Emitted per request — it survives compaction by construction.
Scope — in: agent resolution + the mode block + the posture-binding map + honest degradation · out: any fork change (if the session-API fixture shows the hook cannot resolve the agent, NO widening executes — the contingency is amendment-gated, see Key Decisions).

Acceptance Criteria

  • A director-posture session emits the stamped mode block; a copilot session (every agent id outside the registry's mode agents — plan, build, role agents, custom) emits nothing
  • A simulated compaction (fresh request, history dropped) still emits the block from session state alone (primary path)
  • A staged bundle with an unresolvable agent emits the explicit posture: unresolvable — re-bind from the ledger line
  • A resolved director posture with missing bundle parts emits a degraded line naming them
  • A PLUGIN version gap emits the unresolvable block (the loud failure), never silence
  • The fallback fires only for non-compaction resolution failures and DECLINES when the agent-switched stream shows a switch newer on a monotonic key from the same store (never wall-clock across stores, never prose matching) — the unresolvable line is emitted, never a wrong posture
  • The session-API availability fixture runs before anything consumes it; its outcome is recorded whichever way it decides

Testing Decisions

New plugin fixtures (the injection cases); the session-API availability fixture lands FIRST and gates the rest.

Key Decisions

Posture binding is a MAP, not a heuristic: registry mode agents bind their mode; every other agent id binds the copilot posture and is silent; dispatched role-agent sessions re-bind the parent posture from the ledger (casts may not receive the transform at all). The compactor runs outside the splice and is NOT posture-aware — post-compaction summaries are audited against the ledger per the discovery rule, no new mechanism. THE CONTINGENCY: if the fixture shows the call is insufficient, NO widening executes — the widening is proposed to the harness campaign at its next pin and requires an explicit amendment of the spec's fork invariant before execution; until amended, the slice runs fallback-only with the unresolvable semantics preserved, and the mode-block criteria are evaluated against the amended-or-fallback contract, honestly recorded either way.

Constraints & Invariants

The plugin stays dependency-free (no new IPC without the fixture proving it); the block never guesses — named outcomes only.

Prior Art

Spec decision D4; the registry slice's bundle (the phase/gate summary source); the fork's session-info agent field and agent-switched event stream (existing, preserved by the harness contract).

Source

Spec spec-20260905-063000-modes-first-class · Campaign ledger session-20260905-modes-first-class · Blocked by the mode-registry slice (bundle). Published with Aaron's standing approval to execute (autodev, 2026-09-05).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    afkImplementable without human interaction

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions