Skip to content

docs(rfc): propose input and output gates for token optimization - #1990

Closed
hidb4ai wants to merge 4 commits into
oceanbase:masterfrom
hidb4ai:codex/rfc-token-budgeted-evidence-delivery
Closed

hidb4ai wants to merge 4 commits into
oceanbase:masterfrom
hidb4ai:codex/rfc-token-budgeted-evidence-delivery

Conversation

@hidb4ai

@hidb4ai hidb4ai commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Design proposal for #1989, with community feedback in Discussion #1971. The implementation issue remains open.

RFC 1990: English / Chinese.

Rationale for this change

Smaller prepared context does not recover tokens already spent generating memories. PowerContext should reduce repeated input at both boundaries it controls:

Saved original Sources → input gate → memory extraction/publication
Stored memories → recall → output gate in prepare_context → caller

For example, snapshots [m1], [m1,m2], and [m1,m2,m3] can share message bodies while preserving every complete snapshot, Source identity, timestamp, and occurrence. The extraction model still sees the context needed to interpret m3. After extraction, prepare can independently remove repeated field values, snippets, and table keys from delivery.

What changes are included in this PR?

This PR contains only the English and Chinese RFC documents. Evaluation scripts, measurements, samples, and images remain outside this PR.

The RFC specifies:

  • Independently default-off input and output gates, each with off / shadow / active modes and the existing caller workflow.
  • Input rules for duplicate payloads and complete window-local snapshot sharing. Private typed input views, built-in generator bindings, and consistent serialization make the measured plan the actual model input; domain evidence and original citation IDs remain authoritative.
  • Separate shadow qualification for skipping non-memorable input. Original window and publication checks remain in place. Disabling input optimization does not automatically recover omitted memories or rewind cursors.
  • Prepare-side representation rules and fallback contracts, with lossy paragraph/candidate selection qualified separately.
  • A four-combination evaluation using two generated memory snapshots: both off, input only, output only, and both active. Independent durable facts, future questions, evidence support, all model stages, unknown usage, retries, and latency determine acceptance. Static prebuilt-Memory experiments cannot establish extraction savings.

Are there any user-facing changes?

This PR changes only design documentation. It does not implement the input gate or change production runtime behavior, dependencies, repository configuration, public contracts, or database schemas. The proposal adds no tables, columns, migrations, HTTP/MCP operations, or public request/response fields, and preserves original Sources and Artifacts.

PR #1991 separately covers prepare-side implementation; extraction input optimization remains proposed work.

Shadow executes the original path without a second extraction call. Active rules require complete-request savings and independent quality acceptance; unsupported or invalid plans fall back. The current MCP search/get surface and external agent history do not automatically receive prepare optimization.

How was this change tested?

  • Verified that the PR diff contains exactly the two RFC documents.
  • Checked that both documents are self-contained and have no references to the offline evaluation script or its output files.
  • git diff --check origin/master...HEAD: passed.

This documentation PR does not establish runtime token savings. Implementation and real-model experiments are required to qualify savings and quality.

AI usage statement

OpenAI Codex (GPT-6) assisted with source analysis, design, bilingual documentation, independent review, and validation.

@hidb4ai hidb4ai changed the title docs(rfc): propose token-efficient prepared context docs(rfc): design token optimization at extraction and delivery Oct 14, 2026
@hidb4ai hidb4ai changed the title docs(rfc): design token optimization at extraction and delivery docs(rfc): propose input and output gates for token optimization Oct 14, 2026
@AlexStocks AlexStocks added the 1.4.0 v1.4.0 release tracking label Oct 14, 2026
@hidb4ai hidb4ai removed the 1.4.0 v1.4.0 release tracking label Oct 15, 2026
@AlexStocks AlexStocks added the 1.4.1 v1.4.1 release tracking label Oct 17, 2026
@hidb4ai hidb4ai added 1.5.0 v1.5.0 release tracking and removed 1.4.1 v1.4.1 release tracking 1.5.0 v1.5.0 release tracking labels Oct 23, 2026
@hidb4ai hidb4ai closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants