docs: formalize Linear Temporal Progression model over Variant Voting

This commit is contained in:
Your Name
2026-04-08 01:10:59 +00:00
parent 1f2ca6d0e7
commit 23fce4656d
+22 -25
View File
@@ -20,23 +20,23 @@ The "Ship" is no longer a dumb array; it is encapsulated in a rich `ContextWorki
The Buffer manages its own audit trail and lineage. If a processor needs the pristine, unaltered data of a deeply compressed node (e.g., a Snapshotter summarizing masked tools), it queries the Buffer directly:
`buffer.getPristineNode(id)`
### The Variant Voting System (The "Patch Market")
Processors no longer blindly mutate the context. They act as "Advisors" generating **Proposals** (`ProcessorProposal`).
### Linear Temporal Progression (The Conveyor Belt)
Processors do not vote or compete. Context degradation is a linear temporal progression defined by triggers:
1. **Frontbuffer Trim:** E.g., Tool Masking replaces raw tools immediately.
2. **Backbuffer Normalize:** E.g., Summarization replaces aging nodes in the background.
3. **GC Backstop:** E.g., Truncation brutally destroys nodes only when the absolute budget is breached.
* **Background Processors** continually propose highly semantic summaries or masks (low destruction priority).
* **Emergency Processors** propose brutal truncation (high destruction priority).
When a budget threshold is breached (e.g., `gc_backstop`), the Buffer evaluates all accumulated proposals. It accepts the proposals with the lowest destruction priority that resolve the token deficit, leaving the rest of the pristine graph untouched.
When a pipeline triggers, the Orchestrator runs its processors, gathers their `ContextPatch`es, and applies them to the Buffer immediately. The state simply advances.
## 3. Type-Safe Async Coordination (The `ContextInbox`)
To solve the async/sync barrier (where a slow background worker generates a summary that a fast synchronous emergency backstop needs instantly), we introduce the `ContextInbox`.
This is a strictly-typed messaging system. A worker dispatches a `SNAPSHOT_READY` message to the Inbox. The backstop peeks at the Inbox, instantly retrieving the pre-computed summary and proposing it to the Buffer.
This is a strictly-typed messaging system. A worker dispatches a `SNAPSHOT_READY` message to the Inbox. The backstop peeks at the Inbox, instantly retrieving the pre-computed summary and applying it.
## 4. The Processor Contract
Processors are pure functions that evaluate unprotected targets and return an array of `ProcessorProposal`s.
Processors are pure functions that evaluate unprotected targets and return an array of `ContextPatch`es based on their phase in the lifecycle.
```typescript
export type InboxMessage =
@@ -76,29 +76,26 @@ export interface ProcessArgs {
readonly inbox: ContextInbox;
}
export interface ProcessorProposal {
/** The specific Concrete Nodes this proposal intends to replace or remove. */
readonly targetIds: ReadonlyArray<string>;
/** The new synthetic Concrete Nodes to insert in their place. */
readonly proposedNodes: ReadonlyArray<ConcreteNode>;
/**
* Priority/Destruction score.
* 1 = Ideal (Semantic Masking), 10 = Brutal (Emergency Truncation).
* The Buffer votes based on this and the token deficit.
*/
readonly priority: number;
readonly metadata: IrMetadata;
export interface ContextPatch {
/** The IDs of the Concrete Nodes to remove from the Ship. */
removedIds: string[];
/** The new synthetic Concrete Nodes to insert. */
insertedNodes?: ConcreteNode[];
/** The index at which to insert the new nodes. If omitted, they replace the first removedId. */
insertionIndex?: number;
/** Audit metadata explaining who made this patch, when, and why. */
metadata: IrMetadata;
}
export interface ContextProcessor {
readonly id: string;
readonly name: string;
/** Returns an array of declarative proposals for the Buffer to evaluate. */
process(args: ProcessArgs): Promise<ProcessorProposal[]>;
/** Returns an array of declarative patches applied at this specific temporal phase. */
process(args: ProcessArgs): Promise<ContextPatch[]>;
}
```