Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3ee0669
feat(knowledge): add opt-in snapshot catalog selection and bounded reads
amy-why-3459 Nov 20, 2026
14952bb
docs: record ten-query catalog selection comparison
amy-why-3459 Nov 20, 2026
f825e15
perf(knowledge): reuse content-checked catalog snapshots and resource…
amy-why-3459 Nov 20, 2026
2a17a09
fix(tools): handle legacy retrieval assembly labels in timings
amy-why-3459 Nov 20, 2026
2ebf99b
docs: record catalog latency and output equivalence measurements
amy-why-3459 Nov 20, 2026
32bc57f
fix(knowledge): preserve catalog evidence and isolate optional read f…
amy-why-3459 Nov 20, 2026
a96d0f8
docs: verify retained catalog deliveries against reviewed code
amy-why-3459 Nov 20, 2026
131e762
fix(knowledge): preserve legacy pins and isolate catalog expansion fa…
amy-why-3459 Nov 23, 2026
9944ce0
Replay catalog timings with the Apps layout of each pinned checkout
Dong1017 Nov 25, 2026
523f661
fix(knowledge): redact catalog errors and report exact budget omissions
amy-why-3459 Nov 25, 2026
39b8bc0
Merge current main and reconcile catalog readers and operations guide
amy-why-3459 Nov 27, 2026
24e095a
Add compact catalog cards and prioritize evidence for blocking questions
amy-why-3459 Nov 27, 2026
faca670
Identify the pinned primary resource in catalog entry omissions
amy-why-3459 Nov 27, 2026
d897398
Report paired selector measurements and pinned native Find controls
amy-why-3459 Nov 27, 2026
4ea6462
Build the local knowledge directory and bind pinned evidence to decis…
amy-why-3459 Nov 27, 2026
d9574dc
Measure Qwen Image decision arms through decoded NPU images
amy-why-3459 Nov 27, 2026
ac87d8b
Reuse the scoped catalog for fallback and share decision and benchmar…
amy-why-3459 Nov 27, 2026
9c0e1c4
Remove standalone image and historical timing benchmarks
amy-why-3459 Nov 27, 2026
d89e90f
Archive catalog selection comparison and pilot results
amy-why-3459 Nov 27, 2026
12255d9
fix(knowledge): preserve exact matches and redact partial read errors
amy-why-3459 Nov 28, 2026
3c915b9
Run decision retrieval before managed candidate generation
amy-why-3459 Nov 28, 2026
f4723de
fix(apps): redact decision search and page read failures
amy-why-3459 Nov 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/apps-module-migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,16 @@
"read"
],
"consumers": [
"docs/catalog-selection.md",
"docs/guides/operations.md",
"src/inferrsi/apps/cli/__init__.py",
"src/inferrsi/apps/workflows/decision_round.py",
"src/inferrsi/apps/workflows/session_knowledge.py",
"tests/apps/test_apps_context_provider.py",
"tests/apps/test_apps_knowledge.py",
"tests/harness/test_harness_generation_seal.py",
"tests/knowledge/test_catalog_selection.py",
"tools/compare_catalog_selection.py",
"tools/evaluate_indexer.py"
],
"status": "retired",
Expand Down
218 changes: 218 additions & 0 deletions docs/catalog-selection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Select evidence from a complete catalog

`catalog-select` is an explicit alternative to Find. Load the appropriate primary
task with `skills enter <primary-id>` first. The seven task routes and the default
Find command are unchanged. Knowledge builds and validates views; the current
Agent or an application callback makes the selection. No model service, model
credentials or autonomous Harness search is introduced.

```bash
inferrsi catalog-select 'Describe the task' --tokenizer o200k_base \
--token-budget 128000 > catalog.json
# Read every card in prompt.catalog.cards; write the Agent response to selected.json.
inferrsi catalog-select 'Describe the task' --tokenizer o200k_base \
--token-budget 128000 --selection selected.json > evidence.json
```

The optional `--tokenizer` requires `tiktoken`. Without it, the byte count of the
complete compact JSON model input is used as a conservative token estimate, one
UTF-8 byte per token. `--reserved-tokens` reserves conversation/output capacity;
include all other context in this allowance. Over-budget input returns an explicit
`catalog_over_budget` fallback with ordinary Find results, no truncated directory
and no selector call. Find ranks the candidates from that snapshot. If membership or
source revisions change before delivery, refresh the stale snapshot and retry.
A tokenizer counter/name can also be supplied through Python.
Neither estimate nor encoding selection proves the host's actual token usage.

### Short cards and question priority

Pass `--projection short` to present every candidate as a qualified ref, kind,
summary, declared conditions, missing condition fields and a limitations preview.
Summary and limitations previews each use up to 200 UTF-8 bytes. A missing preview
is `null`. `preview_truncated` names clipped fields. Unreadable candidates retain
their error category. The default `full` projection exposes the source and reference
details at the same snapshot ID. Both formats budget the serialized prompt.

To read the timing method first when a single expansion must serve a TTS regression,
include these options on **both** CLI calls above:

```bash
--projection short --priority-question 'Which events define first audio?' \
--priority-question 'How should complete audio quality be compared?'
```

The selector copies the applicable question strings into each selection.
In Python, pass `projection="short"` and `priority_questions=[...]` to
`select_catalog_evidence`. Direct callers pass the question list to preparation
and completion. The reader tries the earliest question without a delivered
source, prefers entries that also address other uncovered questions, and breaks
ties by qualified ref. An omission leaves its questions open for another entry.
Direct reads use complete required procedures and dependencies. After all direct
reads, explicit references share the separate expansion budget in the same
priority order. The trace records the attempted direct read order and priority
questions without a delivered source. A delivered source still needs a
claim-specific quote and applicability check. Without priority questions the
reader uses the submitted order.

An Agent response has this shape (copy the exact snapshot and qualified refs):

```json
{
"snapshot_id": "sha256:<snapshot>",
"model": "<actual-model-or-unknown>",
"selections": [
{"ref": "<authority>:<id>", "reason": "Relevant mechanism",
"questions": ["Does the original bound include this execution stage?"],
"purpose": "method"}
]
}
```

Empty selections are valid. Every selected ref must appear in that snapshot;
unqualified, outside-snapshot and duplicate identities fail. Refresh and reselect
after `stale_snapshot`; there is no silent substitution. Source content and file
membership are checked before reads and again after assembly, including dependency
changes. Within one `CatalogSelection` instance, an unchanged prepared snapshot
reuses its directory, reference graph and readers. Checks hash actual file bytes,
including package records/build inputs and the declared checkout, and verify current
store revisions; matching sizes or timestamps alone do not authorize reuse. A change
invalidates the prepared view, and changes detected during construction are rejected.
Sources containing symlinks or directory redirects use fresh full snapshots rather
than reusing a prepared view, leaving target access to the existing readers.
An I/O error during the optional fingerprint scan also disables reuse. Normal
discovery and reading then determine which entries can be delivered. Completing
a selection still checks the current snapshot before and after assembly.
Completion releases the retained view, including on errors. Returned prompt dictionaries
are independent copies. Reader-local resource digest reuse is keyed by path and
immutable bytes; metadata and dependency validation still run for every manifest.
Snapshots are content identities, not an authorization credential.

Python uses the same implementation:

```python
from inferrsi.apps.workflows.knowledge import select_catalog_evidence
from inferrsi.knowledge.catalog_selection import CatalogSelection

result = select_catalog_evidence(
CatalogSelection(), "Describe the task", current_agent_selector,
model="<actual-model>", token_budget=128000,
token_counter=lambda text: len(tokenizer.encode(text)), tokenizer="<encoding>",
conditions={"backend": "ascend", "dtype": "bf16", "engine_version": None},
read_options={"expansion_depth": 1, "expansion_items": 5,
"expansion_bytes": 32768, "context_bytes": 65536},
)
```

`current_agent_selector(prompt)` returns the response above. The application calls
it once only after the complete input fits. The two-command CLI lets a native
Agent do this using its own current model, without an API dependency. Its model
identity/usage fields are caller reports, not host attestations.

## Scope, cards and conditions

The source is the shared Find evidence collection: supporting Skills, Records
and Cases, excluding primary task entries and the compatibility router. Counts
are dynamic. A custom `--skill-root` replaces the installed library; installed
records remain visible. A read-only `--store` adds its qualified owners. Backend
and kind filters record every exclusion; no lexical ranking or item limit is
applied before selection. Different authorities retain different identities.

Cards derive summary, keywords, applicability, validation state and limitations
from the existing sources, following the layered disclosure direction in #500.
They retain source digests, bundle revisions and available byte sizes. Text
previews are capped with explicit truncation flags. Reference previews show three
edges; full navigation is retained internally and bound to the snapshot. This
caps card fields, never the candidate list. `read_bytes` is the complete bundle
size, not a promise about budgeted context size. Missing parsers/resources remain
visible as unreadable cards, never as successful reads.

Pass a JSON object with `--conditions`. Supported fields are `backend`, `hardware`,
`os`, `model`, `phase`, `engine`, `engine_version`, `dependency_version`, `dtype`,
`workload`, `quality`, and `measurement`. Values are strings or explicit nulls.
Source scalar/list values compare by case-insensitive exact membership. Prose,
version ranges, unknowns and missing fields are **unknown**; no guessed SemVer
ordering or alias normalization is applied. Source content revisions never stand
in for tested engine/dependency versions. Field coverage is reported in the view.
Cards and post-read judgments use the same resolved conditions. If applicability
omits the backend, the entry's declared backend or skill registry supplies it.
The comparison locator identifies the field used. A generic `common` backend
stays unknown. Given a source list such as `["1.4.2", "2.x"]`, task version
`1.4.2` matches the explicit entry. Task version `2.3.0` stays unknown because
the wildcard would need interpretation. A conflict requires every entry to be
comparable and different from the task value.

A mismatch is **conflict** for a bounded conclusion and **analogue** for a method.
All comparable fields matching yields **match** for those fields only. No supplied
conditions yields **unknown**. These judgments do not change source lifecycle or
verification. The original source is delivered before the final structured
comparison; the Agent must read it, locate any prose-only bounds and explain
claim-specific applicability, missing evidence and minimal target validation.
A hardware-specific conflict does not reject all methods in the document.

## Reads, expansion and trace

Optional navigation follows explicit Markdown links, including owner resources;
external URLs remain pointers. Default expansion is one hop, with separate
optional item/byte limits. Cycles and duplicates, unresolved links, depth/budget
stops and actual resource deliveries are recorded. Deduplication includes revision.
The selected material has its own byte budget. Required skill procedures/resources,
source attribution and license closure are atomic: insufficient space produces an
omission, never a partial procedure marked complete. No imported code is executed.

Catalog checkout skill revisions include declared references, provenance readsets,
third-party notices and applicable ancestor license/notice files up to the
declared root. This larger closure applies only to catalog selection; ordinary
`read`/`resource` retain their existing revisions for unchanged checkout sources.
A change to any required byte changes the catalog revision. Malformed optional
URLs produce an unresolved edge and allow other entries to be read. Invalid or
non-UTF-8 optional resource closures produce a resource-level omission without
discarding other selections; revision conflicts still reject the snapshot.
Within one ref/revision, shared required resources are delivered and charged once.
Each expansion checks its complete closure before budgeting the remaining unique
resources, so deduplication does not permit partial required deliveries.

`context_bytes` and `expansion_bytes` count the UTF-8 bytes in delivered
resource `content`. For a typed `SKILL.md`, the reader delivers the procedure
with its embedded `metadata.inferrsi` block removed, records the original file
hash and byte ranges, and charges the resulting procedure bytes. A separately
delivered `metadata.json` or `record.json` counts in full. JSON keys, hashes,
the output envelope and trace are outside these two resource budgets. The
selection prompt has its own serialized-input token budget.

Top-level omissions use `scope: entry` when a whole entry could not be
delivered. Budget omissions identify the pinned primary resource and revision.
A failed optional resource expansion uses `scope: resource` and
records its path and originating edge in `via`. The owner can already have
delivered other resources. The failed expansion contributes zero bytes.

Results reuse the retrieval observation envelope: snapshot/coverage, selections,
reasons, comparisons, expansion paths, exact resource hashes, omissions, byte
counts and timings. Callback runs additionally retain model/prompt version,
call count and reported usage. Delivery is observable; model reading/adoption
remain unknown unless independently reported. This preserves the discovery,
delivery and use distinctions from #344/#379/#380. An `open` command is never
counted as a successful read.

Functional tests and a ten-query observational comparison do not demonstrate
optimization quality or serving speed. Task benefit remains **INCONCLUSIVE** until
an independently frozen evaluation establishes it. Default-entry promotion is
separate from implementing this mode.

After reading the returned sources, call
`inferrsi.apps.workflows.knowledge.confirm_catalog_evidence(result, assessments)` or add an
`assessments` array to the selection JSON and submit it again. Each assessment
contains `ref`, `revision`, `path`, an exact `quote`, the specific `claim`,
`verdict`, `reason`, `missing` (string list), and `validation_step`. The interface
rejects quotes not present in delivered bytes at that revision. It records a
source-grounded Agent judgment without upgrading source validation or claiming
that citation checking proves the interpretation. The application callback can
use this function after its source-reading turn.

The CLI emits the preparation as compact sorted JSON and counts that exact
transport, including its accounting envelope. Reformatting the prompt, adding
chat framing or other history requires a corresponding host-side allowance.
Record `skill_documents` declarations are expanded as explicit resources. Linked
procedures include their owner files, declared references/readsets/notices and ancestor
licenses atomically; cross-owner Markdown navigation does not become required.
A missing declared resource or unsupported version query stops
that resource expansion with an explicit reason.
6 changes: 6 additions & 0 deletions docs/guides/knowledge/navigation/constraints/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Conditions for drawing a conclusion

Compare first-audio latency only after both runs identify the same event. A source revision pins the evidence. Target release compatibility requires separate release evidence or a local replay. Until then record unknown.

- [`package:vllm_omni.common.audio.streaming_serving_measurement`](../../../../../src/inferrsi/knowledge/data/skill_library/records/vllm_omni.common.audio.streaming_serving_measurement.json) — Which events define first audio and chunk continuity? The endpoint called first packet differs between engines or releases. Measurement method. Target release behavior requires a local event trace. Read `record.json` at `sha256:d88cae264916abce761108bed26ab471fe5cd4ed8ff964fe0ad17058dd3abd8a`.
- [`package:inferrsi.ascend.skills.ascend_aclgraph_capture_replay`](../../../../../src/inferrsi/knowledge/data/skill_library/systems/platforms/ascend/ascend-aclgraph-capture-replay/SKILL.md) — How do I isolate capture and replay failures? An Ascend or vLLM upgrade changed graph execution on identical inputs. Procedure only. Target stack compatibility stays unknown until replay. Read `data/skill_library/systems/platforms/ascend/ascend-aclgraph-capture-replay/SKILL.md` at `sha256:182c537e8bb8856b97009726ec0b49d3aed267c2a1c29a32bf3ef44accd0f708`.
8 changes: 8 additions & 0 deletions docs/guides/knowledge/navigation/guidance/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Measurement and validation methods

Fix input, reference audio, load and versions. Record first received data, first decoded packet, first audible speech and complete output. For a graph migration, capture and replay the same input on both stacks and compare outputs.

- [`package:vllm_omni.common.audio.streaming_serving_measurement`](../../../../../src/inferrsi/knowledge/data/skill_library/records/vllm_omni.common.audio.streaming_serving_measurement.json) — Which events define first audio and chunk continuity? The endpoint called first packet differs between engines or releases. Measurement method. Target release behavior requires a local event trace. Read `record.json` at `sha256:d88cae264916abce761108bed26ab471fe5cd4ed8ff964fe0ad17058dd3abd8a`.
- [`package:sglang_omni.common.audio.serving_and_streaming_quality`](../../../../../src/inferrsi/knowledge/data/skill_library/records/sglang_omni.common.audio.serving_and_streaming_quality.json) — How should streaming speech quality and completeness be checked? A successful HTTP request produced degraded or truncated audio. SGLang-Omni provides a method analogue. Validate the target codec and load. Read `record.json` at `sha256:8b256066de12d761cf6944b449a6234f1857c8fce6e5a94b6813b236d81371f9`.
- [`package:inferrsi.ascend.skills.ascend_aclgraph_capture_replay`](../../../../../src/inferrsi/knowledge/data/skill_library/systems/platforms/ascend/ascend-aclgraph-capture-replay/SKILL.md) — How do I isolate capture and replay failures? An Ascend or vLLM upgrade changed graph execution on identical inputs. Procedure only. Target stack compatibility stays unknown until replay. Read `data/skill_library/systems/platforms/ascend/ascend-aclgraph-capture-replay/SKILL.md` at `sha256:182c537e8bb8856b97009726ec0b49d3aed267c2a1c29a32bf3ef44accd0f708`.
- [`package:inferrsi.ascend.skills.vllm_ascend`](../../../../../src/inferrsi/knowledge/data/skill_library/systems/engines/vllm-ascend/SKILL.md) — Which stack and devices does the cited release declare? A graph configuration is being moved across vLLM-Ascend releases. The release declaration is tag-specific. Compare installed versions and SKU. Read `data/skill_library/systems/engines/vllm-ascend/SKILL.md` at `sha256:2b3427b1422c0c2a350d789c53ed1f830896bbb37059bc694687ad3ba5e09f56`.
Loading
Loading