Skip to the content.

Negframe and managed context are one positive-state pipeline

internal/negframe and managed context implement one rule on two data types: before a model-visible emission, construct the positive prose and positive working state that downstream reasoning should reuse. Negframe performs that construction on fak-authored sentences; managed context performs it on the session view. Both reduce stale operands in the same shared workspace.

One principle, two surfaces

Surface Unmanaged form Positive-state form Checkable implementation
Prose A denial or stale error remains salient and asks the model to invert it. Emit the reason plus the available action or target state. internal/negframe.Reframe, internal/negframe.ReframeFakOnly
Session state A chronological transcript accumulates errors, abandoned plans, and repeated corrections. Keep one originating-task pin and replace the current working state; page durable detail by content ID. ManagedQuerySession, CtxRestoreTombstoneIDs, AssembleInvariantReseed

The mechanistic justification and authoring rule are canonical in Positive-state construction. The append-versus-reseed decision is specified in Query, not chat.

The shared gateway emit seam

The two transformations meet where internal/gateway assembles model-visible guidance from managed state:

  1. adviseCtxStep reads the current context-headroom state, derives a sessionsteer.StepClass, and builds an affordance for the next model step.
  2. In that same symbol, a.Affordance = negframe.Reframe(sessionsteer.StepAdviceAffordance(...)) turns the state-derived advice into positive fak-authored prose before it is returned in the managed-context view.
  3. adjudicationNote applies negframe.ReframeFakOnly at the result-admission boundary, preserving opaque user/tool bytes while reframing only fak-owned fragments.
  4. journalReframePass and journalReframeFragments provide the observation seam: treatment rows run ReframePass, control rows preserve the text, and the bounded journal records content-free outcomes.

This is the named conjunction: managed context decides which state and affordance enter the request; negframe decides how fak-owned guidance states that affordance. They are not independent post-processing features.

What is wired now

What remains intentionally incomplete

Evidence commands

The prose-side contract is exercised by:

go test ./internal/negframe/... -run Reframe

The state-side contract is exercised by:

go test ./internal/gateway/... -run Context

Those selectors cover real symbols in the table above, but they prove implementation behavior only. They do not upgrade the open model-side validation work into a measured performance claim.