feat(cli): okf project/consume/check/skill, and a generated skill with no path into a checkout
The reading direction existed only for someone standing in a clone. `consume`, `contract_check` and `skill` moved from `tools/` into the package and are reachable as `okf consume`, `okf check` and `okf skill`; `okf project` is new and does the whole thing in one command. The red measurement: a consumption skill generated from a checkout carried 4 lines naming that checkout by absolute path, 2 of them the commands the skill tells a reader to run. It now names `okf consume` and `okf check`, and a test asserts this repository appears in it nowhere, with a known-positive so the zero is a measurement rather than a search that could not find. The `tools/` files stay as ALIASES, not re-exports: a re-export binds copies of the names into a second module object, so a caller patching one patches a binding the implementation never reads. Two tests that monkeypatch okf_consume went green again only under the alias. Every published reproduction block runs unchanged. The template and docs/consumption-contract.md (the section 7.4 known-positive) are force-included into the wheel from the file they are authored in, so both travel with the commands that cannot run without them and there is still one authored copy of each. Step 0, before any of it: okf build's default gained Arm E (--table-grid), with --no-table-grid as its opt-out. The default moved to D plus F earlier the same day on Arm F's published 5 of 12 -- a figure measured with Arm E ON. Without it the fold has no joined table to fold, and the shipped default scored 2 of 12 with docx 0 of 3. Measured on the operator's folder: 30 md / 15 concepts on the new default against 43 / 28 without Arm E. Install measurement from a fresh uv tool install, empty folder, this repository nowhere on PYTHONPATH: 5 documents in, 15 concepts out, 0 references to tools/ in the generated skill, okf check conformant (15 rules, 0 findings). Deviation stated rather than hidden: the order asked that tests/test_okf_consume.py be left untouched. Two assertions in it read a PATH, which is the one thing this work changes. Both were moved and the second made stronger -- it now asserts every command the README recipe names is a subcommand the CLI registers, which a file existing on disk never proved. Suite 1414 -> 1427. ruff clean, mypy --strict clean over 21 files. Record: docs/2026-09-08-o5-okf-project.md Co-Authored-By: Claude <claude-opus-5>
This commit is contained in:
parent
efa92ce170
commit
f6fea13299
21 changed files with 4017 additions and 2833 deletions
46
CLAUDE.md
46
CLAUDE.md
|
|
@ -247,6 +247,13 @@ and fixtures, never code.
|
|||
- Test: `pytest`
|
||||
- Lint: `ruff check .` + `ruff format --check .`
|
||||
- Type check: `mypy --strict src/`
|
||||
- Folder to questionable bundle in ONE command: `okf project <folder>` —
|
||||
`okf build` with the package default into `<out>/.okf/<id>/` plus `okf skill`
|
||||
into `<out>/.claude/skills/<id>-consume/`, `<out>` defaulting to cwd and
|
||||
`<id>` to the folder name reduced to `[a-z0-9-]`. It owns NO flag that moves
|
||||
a bundle's bytes and a test holds it byte-equal to `okf build`; two build
|
||||
paths would leave every measurement report pinned to a bundle nobody
|
||||
produces. `skills/okf-prosjekt/` is the Claude Code skill over it.
|
||||
- Build a bundle: `okf build <folder> --bundle <dir> --bundle-id <id>
|
||||
--okf-version <v>` — the installed console script (`[project.scripts]`),
|
||||
the packaged form of what used to be a shell loop over two `tools/`
|
||||
|
|
@ -259,11 +266,14 @@ and fixtures, never code.
|
|||
collide); `--ingested-at` and `--proposed-at` default to one shared epoch
|
||||
constant rather than the clock, because a wall-clock default takes
|
||||
rebuild-equals-incremental away from anyone who omits them.
|
||||
**Six segmentation rules are REACHABLE here, and since 2026-09-08 TWO of
|
||||
them are ON by default** -- `--outline-run 3` and `--unit-fold`, the
|
||||
operator's D3 answer (alternative b), each with an explicit opt-out
|
||||
(`--outline-run 0`, `--no-unit-fold`) that together reproduce the pre-move
|
||||
bytes. **The proposer's own defaults did NOT move** (`propose.py`'s rules stay
|
||||
**Six segmentation rules are REACHABLE here, and since 2026-09-08 THREE of
|
||||
them are ON by default** -- `--outline-run 3`, `--table-grid` and
|
||||
`--unit-fold`, each with an explicit opt-out (`--outline-run 0`,
|
||||
`--no-table-grid`, `--no-unit-fold`) that together reproduce the pre-move
|
||||
bytes. Arm E joined a session after the other two, on a number measured
|
||||
AFTER the first move: without it Arm F's table clause has no joined table to
|
||||
fold, and the shipped D+F default scored 2 of 12 with `docx` 0 of 3 against
|
||||
the 5 of 12 the fold was published with. **The proposer's own defaults did NOT move** (`propose.py`'s rules stay
|
||||
off): the goldens and every published reproduction block are pinned to them,
|
||||
so the two layers disagree on purpose and `cli.DEFAULT_OUTLINE_RUN` /
|
||||
`cli.DEFAULT_UNIT_FOLD` say where. The cost to a consumer is a re-run and it
|
||||
|
|
@ -297,15 +307,18 @@ and fixtures, never code.
|
|||
`docs/2026-09-08-k3-arm-f-mot-enhetsarket.md`,
|
||||
`docs/2026-09-08-k3-runde2-per-filtype.md` and
|
||||
`docs/2026-09-08-k3-runde3-per-filtype.md`.
|
||||
- Consume a bundle: `python3 tools/okf_consume.py <bundle> --question "<q>"
|
||||
- Consume a bundle: `okf consume <bundle> --question "<q>"
|
||||
[--k N] [--limit N] [--out PATH] [--ref IDENTITY]` — the **pre-pass**
|
||||
`docs/consumption-contract.md` § 1 defines, and the only reading direction
|
||||
this library has. It lives in `tools/` for the reason
|
||||
`okf_contract_check.py` states for itself: outside `src/`, so no consumer's
|
||||
install surface changes because it exists. Its entry point is
|
||||
`build_payload(...)` with the CLI a thin `main()`, so lifting it into `src/`
|
||||
the day a consumer asks for a wheel-installed command is a move, not a
|
||||
rewrite. Deterministic and offline by construction: no model call, no socket,
|
||||
this library has. **It moved into the package 2026-09-08 (O5)** and the move
|
||||
it was written for is the one that happened: `build_payload(...)` was always
|
||||
the entry point with the CLI a thin `main()`, so it was a move and not a
|
||||
rewrite. What forced it was the generated skill — from `tools/` it emitted
|
||||
`python3 <absolute path>/tools/okf_consume.py`, so the skill could not be
|
||||
moved, shared or run by anyone without that clone. `tools/okf_consume.py`
|
||||
remains as an ALIAS (`sys.modules[__name__] = _impl`, never a re-export: a
|
||||
re-export binds copies, and a caller patching one patches a binding the
|
||||
implementation never reads). Deterministic and offline by construction: no model call, no socket,
|
||||
no clock, stdlib plus this package only. It **walks the index tree, never a
|
||||
directory** — § 9.2 forbids enumerating one unless the named profile says the
|
||||
index is derived, and measured, `entries_match_directory` is `True` for
|
||||
|
|
@ -326,12 +339,17 @@ and fixtures, never code.
|
|||
`excerpt_unnamed`) and the rest SHOULD, because they are conditional on the
|
||||
producer. The measurement behind it: rank 1 of 8 on 3 of 3 bundles, correct
|
||||
answer on 1 of 3.
|
||||
- Connect a bundle to Claude Code: `python3 tools/okf_skill.py <bundle> --out
|
||||
- Connect a bundle to Claude Code: `okf skill <bundle> --out
|
||||
<dir>` instantiates `skills/okf-consume-template/` for THAT bundle — its id,
|
||||
ref, concept count, conditional-field denominators, whole-bundle cost and
|
||||
breaking point, all measured, plus a reference payload the checker accepts.
|
||||
In `tools/` for the reason the other two are, and because a wheel-installed
|
||||
It was kept in `tools/` until 2026-09-08 because a wheel-installed
|
||||
`okf skill` would emit a command pointing at a file the wheel does not carry.
|
||||
That objection was about what the GENERATED skill NAMES, and O5 answered it
|
||||
by changing that: the emitted commands are `okf consume` and `okf check`,
|
||||
names on PATH. The template and `docs/consumption-contract.md` (the § 7.4
|
||||
known-positive) are force-included into the wheel from the file they are
|
||||
authored in — one authored copy, no committed duplicate.
|
||||
The form was chosen on a measurement: the contract checker passes the
|
||||
UNFILLED template and passes a skill built for another bundle, so it cannot
|
||||
tell the two apart — the choice rests on § 5/§ 6.4/§ 7.6 being per-bundle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue