feat(s2c): debatten navigerer basen i stedet for aa faa den utlevert [skip-docs]
MAJOR-3/S7a-3 gjorde utforskningen billig og lot pipelinen staa. Maalt paa K2
(630 konsepter, S7bs eget instrument, kjent-positiv-kontrollen reprodusert
eksakt FOER bruk): okf.bundle_context er 648 962 o200k-tokens og rir i TRE
kopier = 1 947 342 = 99,1 % av en kjoerings prompt-tokens.
Et premiss i maaledokumentet ble presisert foerst: de tre kopiene er tre
DEBATT-turer (proposer x2, checker x1), mens genererings-prompten er 156
tokens, fordi gen_context = debate_output or context. Det avgjorde formen -
generering trengte ingen egen soem, for aa binde `context` binder
siste-utvei-fallbacken ved konstruksjon.
run_project sender naa en PEKER (fast tekst + erklaert bundle_id + antall
konseptdokumenter i scope + stigen, O(1) i korpuset) og gir debatten de SAMME
fire verktoeyene utforskningen bruker - explore.navigator_tools gjenbrukt,
aldri en andre kopi av policyen.
Etter: 753 tokens like-for-like (samme manus, samme fire prompter, -99,96 %)
og 8 942 med en debatt som faktisk gaar stigen (-99,5 %), mot operatoerens
terskel 195 000 = 4,6 % av taket. Validert besparelse og validatorens dom er
UENDRET (850 000 NOK av 3 852 500, 2 av 5 felt paa stage 4 og 5, samme
dom-noekkel), og utforskningens 18 355 er uendret til tokenet.
§4.1a maatte flytte, ikke forsvinne: dimensjonsfilteret bodde i renderingen og
bor naa i VERKTOEYENE, paa begge trinn - en listing som skjuler et fremmed
dokument mens read_file serverer det paa sti er et filter i navnet alene.
okf.in_dimension er eneste predikat.
Sporet er kaller-eid (ExplorationToolRecorder -> RunResult.debate_tool_calls ->
{run_id}-debate.json fra en finally) og skrives ogsaa TOMT: en debatt som
navigerer ingenting ER S2c-regresjonen, saa den maa kunne leses.
Load-bearing MAALT: aatte mutasjoner roede mot HELE suiten, groenn kontroll
1306/5 (fra 1295/5), golden demo-transcript.stdout BYTE-UENDRET
(shasum -a 1 av innholdet = ea8c534773acdbe41ae68f2c55724d69aaf8be4f).
M7 falsifiserte seg selv, ikke gaten - staar som maalt.
Maaling: docs/2026-09-04-s2c-debatt-k2.md
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
5d8844fef5
commit
da5f10f140
13 changed files with 1044 additions and 98 deletions
|
|
@ -1015,6 +1015,25 @@ def assert_declared_ids_agree(bundle: Bundle) -> None:
|
|||
)
|
||||
|
||||
|
||||
def in_dimension(file: BundleFile, dimension: str | None) -> bool:
|
||||
"""Whether a concept file belongs to a run scoped to ``dimension`` (§4.1a).
|
||||
|
||||
ONE copy of the rule (kø-(p)), because two renderings now answer it: ``bundle_context`` renders
|
||||
the matched bodies, and ``directory_listing`` lists the matched documents for a navigator that
|
||||
reads them one at a time. Two copies of "which knowledge is in scope" would be free to disagree
|
||||
about the same base, and the disagreement would show up as an agent being shown a document it
|
||||
is then refused.
|
||||
|
||||
``dimension=None`` admits everything (byte-identical to the unscoped rendering), and a file
|
||||
carrying NO ``dimension`` is never dropped: un-scoped knowledge belongs to every scope, which
|
||||
is what makes a method or a cost reference usable across dimensions.
|
||||
"""
|
||||
if dimension is None:
|
||||
return True
|
||||
declared = file.frontmatter.get("dimension")
|
||||
return declared is None or declared == dimension
|
||||
|
||||
|
||||
class BundlePathNotFound(ValueError):
|
||||
"""A listing was asked for a directory the navigated bundle does not have.
|
||||
|
||||
|
|
@ -1025,7 +1044,9 @@ class BundlePathNotFound(ValueError):
|
|||
"""
|
||||
|
||||
|
||||
def directory_listing(bundle: Bundle, path: str = "") -> dict[str, Any]:
|
||||
def directory_listing(
|
||||
bundle: Bundle, path: str = "", *, dimension: str | None = None
|
||||
) -> dict[str, Any]:
|
||||
"""One LEVEL of a navigated bundle: the subdirectories under ``path`` with what each holds, and
|
||||
the concept documents that sit directly in it.
|
||||
|
||||
|
|
@ -1049,6 +1070,12 @@ def directory_listing(bundle: Bundle, path: str = "") -> dict[str, Any]:
|
|||
relative name would have to be composed by the caller, and the caller is a model: a path that
|
||||
never existed is worse than no path (``_index_excerpt``'s rule, one rung up).
|
||||
|
||||
``dimension`` scopes the listing exactly as it scopes ``bundle_context`` — ONE predicate
|
||||
(``in_dimension``) serves both, so a navigator is never shown a document the run would then
|
||||
refuse to open. Under a scope a directory holding only foreign-dimension documents raises
|
||||
``BundlePathNotFound`` like any other unknown path: within this run it holds nothing, and
|
||||
answering with an empty listing is the very confusion the refusal exists to prevent.
|
||||
|
||||
``documents`` on a directory entry is the count of concept documents in its whole SUBTREE — what
|
||||
the subtree holds, not what one ``read_dir`` on it returns. It is the price signal a navigator
|
||||
chooses against, and the tool description says which of the two it is rather than leaving the
|
||||
|
|
@ -1060,7 +1087,7 @@ def directory_listing(bundle: Bundle, path: str = "") -> dict[str, Any]:
|
|||
directories: dict[str, int] = {}
|
||||
documents: list[dict[str, Any]] = []
|
||||
for f in bundle.context_files:
|
||||
if not f.name.startswith(prefix):
|
||||
if not f.name.startswith(prefix) or not in_dimension(f, dimension):
|
||||
continue
|
||||
rest = f.name[len(prefix) :]
|
||||
head, sep, _ = rest.partition("/")
|
||||
|
|
@ -1113,10 +1140,8 @@ def bundle_context(bundle: Bundle, *, dimension: str | None = None) -> str:
|
|||
against — see ``tests/test_okf.py`` nav-golden gates."""
|
||||
sections = [bundle.index_summary.strip("\n")]
|
||||
for f in bundle.context_files:
|
||||
if dimension is not None:
|
||||
file_dim = f.frontmatter.get("dimension")
|
||||
if file_dim is not None and file_dim != dimension:
|
||||
continue
|
||||
if not in_dimension(f, dimension):
|
||||
continue
|
||||
title = unquote_scalar(f.frontmatter.get("title", f.name))
|
||||
body = f.body.strip("\n")
|
||||
sections.append(f"## {f.type or 'document'}: {title}\n\n{body}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue