Repository navigation
Description
Goal
Determine, with replayable evidence, whether PowerContext needs a versioned, bounded, and cancellation-aware admission step before persisted Source evidence is sent to Atomic Memory generation.
The evaluation must cover both of these failure modes:
- a single Source or projected evidence item is large enough that reducing the number of Sources cannot make the generation input fit; and
- a Source contains a mixture of durable user facts, host or tool scaffolding, quoted history, repeated text, and oversized fields, so admitting the complete projection consumes the budget or creates attribution risk.
This is an evaluation-only issue. It must not change production Source capture, Source projections, Atomic Memory extraction/reconciliation, search/ranking, lifecycle behavior, or public APIs. A production change is allowed only in a separate follow-up issue after the decision gate below is satisfied.
Verified current behavior and gap
Verified against origin/master at fa9348fc09eac81da129a828c18d77a6ee8e79ab:
persisted Source
-> SourceRepository materialization/projection
-> project_atomic_memory_evidence(...)
-> AtomicMemoryExtractionInput(evidence=...)
-> complete-input token-budget check
-> AtomicMemoryGenerationPipeline.extract(...)
src/powercontext/builtin/sources/content.py::ContentTextEvidenceProjectioncopies the completeContentSource.contentintopowercontext.text-evidencev1.src/powercontext/builtin/artifacts/atomic_memory/extraction.py::project_atomic_memory_evidence()materializes the Source projection consumed byAtomicMemoryGenerationPipeline.src/powercontext/builtin/runtime/atomic_memory_processing.py::AtomicMemorySourceWindowProcessorprocesses an exact contiguous Source journal window and requires the complete extraction input to fit the configured token budget.- On a reducible budget failure, the processor halves and persists the Source window size through
src/powercontext/builtin/persistence/memory_windows.py::MemorySourceWindowRepository. - Window reduction solves a many-Source overload. It does not define what to do when one eligible Source or one evidence item is itself oversized, nor how a bounded view would preserve exact provenance and disclose incompleteness.
This is a verified contract gap, not evidence that a particular truncation policy is correct. Codex's tiered rollout compaction is useful prior art, but its role tiers, byte constants, newest-first policy, and local transcript assumptions must not be copied into PowerContext without this evaluation.
Scope
1. Add a self-contained evaluation package
Create evaluation/memory/evidence_admission/ and register it with the evaluation project using the same package, lock, report, and non-live test conventions as evaluation/memory/longmemeval_v2/ where applicable.
The package must contain:
- a versioned synthetic fixture manifest committed to Git;
- an opt-in private-corpus manifest format that stores only hashes and labels in committed aggregate output;
- a runner that persists and re-reads real Sources instead of passing ad hoc strings directly to a model;
- evaluation-only admission strategies;
- deterministic scorers and report generation;
- model-free tests plus an explicitly opt-in live-generation command.
Do not add an evaluation arm to the production SourceDefinitionRegistry, runtime composition, or HTTP/MCP contracts.
2. Exercise the real Source-to-generation path
For every arm, the runner must:
- create a fresh Scope;
- capture the fixture through an existing supported Source write path;
- persist and re-read the Source/materialization;
- call the real Source projection used by
project_atomic_memory_evidence(); - construct the same
AtomicMemoryExtractionInputshape used byAtomicMemorySourceWindowProcessor; - apply the selected evaluation-only admission policy at the declared boundary;
- invoke the real
AtomicMemoryGenerationPipelinefor live runs; and - record the exact Source identity, materialization/content hash, projection version, policy version, prompt version, provider/model settings, budget, and output hashes.
A test that only calls a string truncation helper, a tokenizer, or the provider directly does not satisfy this requirement.
3. Compare explicit arms
Run the same frozen fixtures, Source identities, model settings, generation instructions, and budgets through all arms:
complete-projection-v1: current complete Source projection and current complete-input budget behavior. Budget rejection is a valid measured outcome.window-reduction-v1: current Source-count reduction behavior, including the one-Source floor. This distinguishes a Source-count problem from an oversized-evidence problem.bounded-fragments-v1: an evaluation-only candidate that creates UTF-8-safe fragments with exact byte/character offsets and a stable fragment identity derived from the Source materialization and policy version. It must expose omitted bytes/fragments and an explicit incomplete status.structured-tiered-v1: optional only where the Source adapter already exposes trustworthy structural provenance. Tiering may use explicit adapter fields or host-owned record types, but not regex/LLM guesses over arbitrary text. Selection must be deterministic, bounded, and restore original source order before generation.
The manifest must freeze every arm's total budget, per-item limit, fragmenting rule, ordering rule, and tie-breaker before live outputs are inspected. Do not copy Codex's current constants as PowerContext defaults; values in this package are experiment parameters.
If the current Source model cannot express a fragment without weakening citation identity, the evaluation must report that as a contract requirement. It must not silently cite the complete Source as proof that every omitted span was supplied to the model.
4. Required fixture matrix
Committed fixtures must be synthetic, content-safe, and large enough to cross the configured experiment budget. At minimum include:
- one Source whose complete projection exceeds the budget even when it is the only Source;
- several normal Sources whose combined input exceeds the budget but fits after current window reduction;
- one oversized field or tool-result-like block surrounded by small required facts;
- required facts at the beginning, middle, and end of otherwise irrelevant content;
- repeated history and near-duplicate blocks around one new durable fact;
- PreparedContext/citation-like text, Skill or host scaffolding, and tool text mixed with user-authored facts;
- a quoted instruction or fake role marker that must not be upgraded to trusted structural provenance;
- exact command, path, identifier, number, and configuration literals that must survive byte-for-byte;
- CJK, emoji, combining characters, CRLF/LF, and multi-byte UTF-8 boundaries;
- malformed or unavailable materialization/projection;
- cancellation before read, during materialization/projection preparation, and while awaiting generation;
- retry/replay of the same Source identity and policy version;
- a negative control with no durable fact;
- an intentionally impossible fixture whose labeled required content alone exceeds the budget, so the report cannot claim completeness.
Each fixture must label, before generation:
- exact required spans/claims;
- exact forbidden attribution or unsupported-claim categories;
- structural provenance available to each policy;
- expected completeness ceiling;
- why the case is reducible by Source count, fragment admission, both, or neither.
5. Metrics and scoring
Report per fixture, arm, and repeated run:
- admitted and omitted UTF-8 bytes, estimated tokens, evidence items, fragments, and structural categories;
- whether the final input stayed within the frozen budget;
- required-fact retention, including exact-literal preservation;
- unsupported candidate and false-attribution counts;
- candidate support mapped to exact Source and fragment offsets;
- duplicate and near-duplicate candidate occupancy;
- completeness state and stable omission reasons;
- deterministic input/output hashes across replay;
- materialization, projection/admission, and generation latency;
- provider input/output tokens and request count for live runs;
- cancellation latency and whether any Source, Artifact, report, cursor, or temporary run state was incorrectly published as complete.
Critical support and attribution labels must be human-auditable against the frozen synthetic ground truth. An LLM judge may assist with non-critical semantic grouping, but it cannot be the sole evidence for required-fact retention, provenance, cancellation, or the decision gate.
The report must separate model-free preparation results from provider-dependent generation results. It must not treat a cited Source ID, a retrieval hit, or a generated answer as proof that a particular admitted fragment was actually used by the model.
6. Completeness and failure semantics in the evaluation
The evaluation schema must represent at least:
complete: all projected evidence was admitted;bounded: a deterministic subset was admitted and omissions are recorded;unavailable: materialization/projection could not be obtained;cancelled: the run stopped and no completed result may be consumed.
Names may change before implementation, but the states must remain mutually distinguishable. A bounded result must never be serialized or scored as complete. An impossible fixture must remain bounded/insufficient rather than passing by dropping a required span without disclosure.
Stable omission reasons must be content-free. Do not put prompts, Source bodies, model output, paths containing credentials, or exception dumps into aggregate telemetry or committed reports.
7. Freeze thresholds before running live generation
Commit a decision-policy file before inspecting live results. For the committed synthetic suite, a candidate arm is eligible for a production follow-up only if all of these hold:
- 100% of labeled required claims that fit inside the declared budget are present in admitted evidence;
- exact literals marked as exact remain byte-for-byte equivalent after normalization rules declared by the fixture;
- zero critical unsupported or false-current-user-attribution candidates are produced;
- every candidate support reference resolves to an admitted Source/fragment range;
- the prepared generation input is byte-for-byte deterministic for the same fixture, policy version, and configuration;
- bounded and impossible cases disclose incompleteness and stable omission reasons;
- cancellation produces no completed evaluation result or published Memory mutation; and
- at least one reproducible oversized case rejected at the one-Source floor by the control reaches generation under the candidate policy without violating the criteria above.
Private-corpus thresholds may differ, but they must be pinned before the run and reported separately. Do not average away a critical provenance, cross-Scope, or cancellation failure.
Decision gate
The final report must choose exactly one result:
no_production_change: the current behavior is adequate for the measured workloads, or candidate policies do not improve admission without unacceptable loss/risk;bounded_projection_follow_up_required: at least one candidate satisfies the frozen gate and resolves a reproducible one-Source or mixed-evidence failure that current window reduction cannot resolve; orinsufficient_evidence: fixture, adapter, provider, or corpus coverage is not strong enough to make either decision.
Only bounded_projection_follow_up_required authorizes opening a separate production design/implementation issue. The follow-up issue must be generated from the report and must define, rather than assume:
- the owning projection/admission boundary;
- exact Source/materialization/fragment identity and citation semantics;
- projection and policy versioning;
- compatibility for existing Sources and deterministic rebuild;
- stable completeness and omission-reason contracts;
- cancellation and retry/idempotency behavior;
- authorization and Scope isolation;
- public API impact, if any;
- migration and rollback behavior;
- operational cost and limits; and
- tests for every reproduced failure mode.
If #2069 concludes that host-owned current-turn projection is also required, produce one coordinated follow-up contract. Do not create competing generic scrubbers and host-specific projections for the same evidence path.
Implementation map
src/powercontext/builtin/sources/content.py: current complete Content Source text projection; production code is read-only in this issue.src/powercontext/sources/projections.py: projection keys/version seams; design evidence only, no production registration in this issue.src/powercontext/builtin/artifacts/atomic_memory/extraction.py: actual evidence projection and generation pipeline to exercise; do not change production behavior.src/powercontext/builtin/runtime/atomic_memory_processing.py: current exact-window preparation and complete-input budget enforcement; use as the control contract.src/powercontext/builtin/persistence/memory_windows.py: persisted Source-window reduction control.src/powercontext/builtin/runtime/artifact_processing.pyandprocessing_contracts.py: existing cancellation/worker outcome contracts that the runner must not misrepresent.evaluation/memory/evidence_admission/: new manifest, Source replay adapter, arms, scorer, report, CLI, docs, and tests.evaluation/memory/longmemeval_v2/: reuse packaging, lock, result-hash, and report patterns where they fit; do not merge this question into retrieval/answer scoring.evaluation/memory/capture_ownership/from evaluation(workbuddy): measure joined-prompt self-ingestion before adding owned evidence projections #2069, if it lands first: share content-safe fixture/report infrastructure, but keep ownership contamination and size admission as separate scores and decisions.
Dependencies and ordering
- This evaluation can run on current
master; it does not depend on a production schema/API change. - Coordinate fixtures and report formats with evaluation(workbuddy): measure joined-prompt self-ingestion before adding owned evidence projections #2069. evaluation(workbuddy): measure joined-prompt self-ingestion before adding owned evidence projections #2069 owns host-payload ownership/self-ingestion; this issue owns bounded admission of oversized/mixed evidence.
- Use Token and latency costs along the Hook → capture → flush → recall chain: measurements and proposed changes #2040 measurements as cost context, but do not treat lower tokens or latency as a quality pass.
- Findings may inform evaluation(recall): measure lineage concentration and near-duplicate occupancy #1977's lineage/near-duplicate evaluation, but this issue must not change ranking, merge, retirement, or diversity behavior.
- Source evidence declarations from feat(memory): add versioned Source evidence declarations and neutral lifecycle projection #1975 remain authoritative metadata. An admission tier or fragment does not grant authority or change the Source declaration.
Non-goals and prohibited shortcuts
- No production truncation, fragment projection, registry entry, feature flag, schema migration, or API change.
- No change to
prepare_context, search, ranking, citation, revision, lifecycle, or Artifact write semantics. - No generic regex that attempts to infer user/tool/system roles from arbitrary Source text.
- No copying Codex's byte/token constants, role tiers, retention policy, local Markdown authority, cwd scope, or newest-first rule into product defaults.
- No replacement or mutation of the exact raw Source materialization.
- No cross-Scope pooling, global user memory, or authority upgrade based on host metadata.
- No claim that model citation proves actual memory use.
- No silent head/tail truncation presented as complete evidence.
- No test-only helper path that bypasses persistence and the actual Source projection.
- No weakening of production budget, authorization, exact-window, CAS, or cancellation checks to make an arm pass.
Acceptance criteria
-
evaluation/memory/evidence_admission/provides a documented, versioned CLI and committed synthetic manifest. - The runner persists and re-reads actual Sources and constructs the real Atomic Memory extraction input before applying evaluation-only arms.
- Control, current window reduction, bounded fragments, and any supported structured-tier arm use the same frozen Sources, prompts, model settings, and budgets.
- The fixture matrix covers one-Source overflow, many-Source overflow, mixed/oversized fields, positional facts, exact literals, CJK/UTF-8 boundaries, impossible completeness, replay, failures, and cancellation.
- Fragment identities and candidate support resolve to exact immutable Source/materialization identities and admitted ranges.
- Model-free tests prove budget enforcement, UTF-8 safety, determinism, stable omission reasons, Scope isolation, redaction, and cancellation result handling.
- Live runs use the actual
AtomicMemoryGenerationPipeline; provider/model settings and output hashes are pinned in the report. - Thresholds are committed before live output inspection, and critical failures cannot be hidden by aggregate averages.
- The report clearly separates complete, bounded, unavailable, and cancelled outcomes.
- The final decision is exactly one of the three declared values and includes limitations plus pinned dataset/configuration/code hashes.
-
bounded_projection_follow_up_requiredproduces an implementation-ready follow-up contract, but this issue contains no production behavior change. - Committed artifacts contain no raw private Source text, prompts, model responses, credentials, sensitive paths, or cross-Scope identifiers.
Validation
At minimum:
uv run --project evaluation pytest evaluation/memory/evidence_admission/tests -m "not live" -q
uv run --project evaluation ruff check evaluation/memory/evidence_admission
uv run --project evaluation ruff format --check evaluation/memory/evidence_admission
uv run prek run -a
uv run ty checkDocument a separate opt-in live command, required provider environment variables, expected cost controls, cancellation procedure, and how to regenerate the aggregate report. The default test suite must not require network access or provider credentials.
Deliverables
- versioned synthetic fixture and experiment manifests;
- model-free replay/preparation artifacts with deterministic hashes;
- opt-in live-generation aggregate results;
- a machine-readable result and a human-readable report;
- one decision from the declared gate;
- limitations and unreproduced risks; and
- only when warranted, a separate implementation-ready follow-up issue contract.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
Lkx-JY commentedon Oct 19, 2026
I‘d like to take it.
AlexStocks commentedon Oct 19, 2026
done
feat(evaluation): measure bounded evidence admission for oversized an…
hireview001 commentedon Dec 2, 2026
This issue is classified as Other. @hidb4ai, please lead follow-up, with support from @PsiACE. Please provide a substantive response within 72 hours of issue creation, outlining the proposed disposition, any additional information needed, or the next investigation steps. After sufficient discussion and agreement on the scope and acceptance criteria, a contributor who volunteers to take it on can undertake implementation.