Status: accepted
Context. Phase 1.7 closes the deterministic prepare workflow: inspection, recommendations, chunk inventory, lexical selection, and prepare benchmark coverage are all mechanical and model-free. The roadmap’s first Phase 2 capability is optional local semantic retrieval, but retrieval execution is still not implemented. Before any retrieval code lands, the repository needs an accepted implementation boundary that keeps Phase 2 from weakening the deterministic promises in ADR 0005 through ADR 0010.
Decision. Accept a disabled-by-default opt-in scaffold for future local semantic
retrieval. The scaffold may validate the boundary and report that retrieval is disabled or
blocked, but it must not perform retrieval. It does not retrieve, rank, select, embed,
summarize, rewrite, paraphrase, call a model, touch the network, or build a prompt.
Optional local semantic retrieval stays outside the deterministic core, outside the inspection
boundary, and outside the deterministic benchmark harness. It must not enter cleaning,
token_budget, prompt_builder, reporting, pipeline, inspection, or benchmarking.
The first runtime slice is intentionally small:
lcc.semantic_retrieval package owns the semantic retrieval boundary scaffold.lcc semantic-retrieval CLI command reports the boundary state.semantic_retrieval mapping.The scaffold is disabled by default. Existing deterministic commands (inspect, prepare,
optimize, and bench) keep their default behavior and do not invoke semantic retrieval.
The only Phase 2 CLI surface accepted by this ADR is:
lcc semantic-retrieval \
[--enable-semantic-retrieval] \
[--index-manifest PATH] \
[--embedding-assets PATH] \
[--top-k N] \
[--config lcc.yaml] \
[--report semantic-status.json]
The equivalent config surface is:
semantic_retrieval:
enabled: false
index_manifest: path/to/semantic.index.json
embedding_assets: path/to/local-assets
top_k: 8
CLI flags override config values. semantic_retrieval.enabled defaults to false. When it is
false, the command emits a deterministic disabled report and exits successfully. The accepted
configuration keys are semantic_retrieval.enabled, semantic_retrieval.index_manifest,
semantic_retrieval.embedding_assets, and semantic_retrieval.top_k. When enabled is true,
the command must fail closed unless all required local artifacts are present and a later
accepted implementation actually supports retrieval execution. In the current scaffold, even
valid local artifacts produce a blocked report and a non-zero exit because retrieval execution
is not implemented.
The semantic layer is owned by lcc.semantic_retrieval. It sits above and outside the
deterministic core, like lcc.cli, lcc.inspection, and lcc.benchmarking.
Import direction is part of the contract:
lcc.cli may import lcc.semantic_retrieval for the separate boundary command.cleaning, token_budget, prompt_builder, reporting, pipeline, inspection, and
benchmarking must not import lcc.semantic_retrieval.No embedding model, vector store, tokenizer, local model, remote model, API client, runtime download, or non-stdlib dependency is required by the scaffold.
Future retrieval execution must satisfy all of these conditions before it can be implemented:
lcc[semantic] extra.A future retrieval adapter must use a versioned local index manifest. The reserved first
manifest version is semantic-index-1.0. The manifest must be deterministic JSON and must
record at least:
sha256:<hex>, for the exact source text used to create the
index;chunk_inventory IDs or a clearly
versioned replacement inventory;Selected evidence must preserve provenance as source spans. The first retrieval slice may select or reference literal source spans, but it must not rewrite, paraphrase, or summarize source evidence by default. Any later prompt integration must assemble literal source text from provenance spans, not from generated summaries.
Existing report schemas are unchanged by this ADR:
schema_version: "1.0";schema_version: "1.0";schema_version: "1.0";prepare-1.0.The scaffold has its own boundary status report schema:
{
"schema_version": "semantic-retrieval-0.1",
"enabled": false,
"status": "disabled",
"reason_code": "semantic_retrieval_disabled",
"retrieval_performed": false
}
Future integration that adds semantic retrieval metadata to prepare, optimization,
inspection, or benchmark reports requires a new accepted ADR or an explicit ADR 0011 revision.
Any breaking report-shape change must bump that report’s schema version. Semantic metadata
must be clearly separate from token-count fields, and exact-vs-approximate token-count honesty
must remain visible.
The boundary must fail closed:
status: "disabled" and performs no retrieval.top_k fails before any retrieval attempt.status: "blocked" and exit non-zero.Tests for this boundary must prove:
lcc.semantic_retrieval is disabled by default;lcc.semantic_retrieval;Why. Phase 2 is valuable only if it is clearly optional. The project promise is still that
lcc can inspect, prepare, optimize, and benchmark local context without making a model call,
touching a network, or hiding approximation. Accepting this boundary lets the next
implementation step start from explicit contracts without smuggling semantic behavior into
deterministic surfaces.
Forecloses. Future Phase 2 work may not add semantic selection, embeddings, vector stores,
RAG, local-model calls, remote model calls, runtime downloads, model-backed inspection, or
semantic benchmark claims inside cleaning, token_budget, prompt_builder, reporting,
pipeline, inspection, or benchmarking. Retrieval execution remains blocked until a
future accepted ADR or ADR 0011 revision defines a concrete adapter while keeping the semantic
retrieval layer opt-in, separable, and honest about dependencies and limits.