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:
Kjell Tore Guttormsen 2026-09-08 21:47:38 +02:00
commit f6fea13299
21 changed files with 4017 additions and 2833 deletions

View file

@ -11,7 +11,7 @@ assembled, at one ref.
**This file is a template.** Every `<PLACEHOLDER>` is a hole a per-corpus copy
fills; none of them has a default, and a copy that leaves one unfilled is not
configured, it is unfinished. The section headings are fixed:
`tools/okf_contract_check.py` reads them, and a missing one makes the skill
`okf check` reads them, and a missing one makes the skill
non-conformant rather than merely thin.
The contract this skill is held to is `docs/consumption-contract.md`. Where this
@ -28,7 +28,7 @@ Step 1 is always the pre-pass. Run it, read its JSON payload, and judge that.
Check the payload before using it:
```sh
python3 tools/okf_contract_check.py --skill <SKILL_PATH> --payload <PAYLOAD_PATH>
okf check --skill <SKILL_PATH> --payload <PAYLOAD_PATH>
```
A non-zero exit is not a formatting complaint. It means the payload does not

View file

@ -1,6 +1,6 @@
---
name: okf-consume
description: Answer one question about the K2 procurement OKF bundle from a bounded payload assembled by the deterministic pre-pass tools/okf_consume.py, marking every claim with its source. Instantiated from okf-consume-template; every placeholder is filled with a measured value for this corpus.
description: Answer one question about the K2 procurement OKF bundle from a bounded payload assembled by the deterministic pre-pass okf consume, marking every claim with its source. Instantiated from okf-consume-template; every placeholder is filled with a measured value for this corpus.
---
# K2 procurement bundle consumption
@ -11,7 +11,7 @@ assembled, at one ref.
**This file is an instantiated copy of `skills/okf-consume-template/SKILL.md`.**
Every hole the template left is filled below with a value measured against this
corpus; the section headings are unchanged, because
`tools/okf_contract_check.py` reads them by name and a missing one makes the
`okf check` reads them by name and a missing one makes the
skill non-conformant rather than merely thin.
The contract this skill is held to is `docs/consumption-contract.md`. Where this
@ -22,7 +22,7 @@ file and the contract disagree, the contract binds.
Step 1 is always the pre-pass. Run it, read its JSON payload, and judge that.
```sh
python3 tools/okf_consume.py BUNDLE_ROOT --question "your question" --ref REF --out PAYLOAD_PATH
okf consume BUNDLE_ROOT --question "your question" --ref REF --out PAYLOAD_PATH
```
`BUNDLE_ROOT`, `REF` and `PAYLOAD_PATH` are runtime arguments a caller supplies,
@ -40,7 +40,7 @@ stays untouched.
Check the payload before using it:
```sh
python3 tools/okf_contract_check.py --skill skills/okf-consume/SKILL.md --payload PAYLOAD_PATH
okf check --skill skills/okf-consume/SKILL.md --payload PAYLOAD_PATH
```
A non-zero exit is not a formatting complaint. It means the payload does not

View file

@ -0,0 +1,53 @@
---
name: okf-prosjekt
description: Gjør en mappe med prosjektdokumenter (PDF, DOCX, XLSX, PPTX, MD) om til en OKF-bundle OG en Claude Code-skill i den mappen, i én kommando, slik at neste Claude Code-økt der kan svare på spørsmål og hypoteser med kilde. Bruk når brukeren sier "/okf-prosjekt <mappe>", "lag en OKF-bundle av denne mappen", "koble disse dokumentene til Claude Code", "gjør prosjektdokumentene spørrbare", "bygg bundle fra <mappe>", eller peker på en mappe med prosjektdokumenter og vil stille spørsmål til dem.
---
# /okf-prosjekt — fra mappe til spørrbar bundle i én kommando
Kjør ÉN kommando og gjengi sammendraget. Ikke forklar OKF, ikke vis flagg, ikke
foreslå alternative kommandoer.
```sh
okf project <mappe>
```
- `<mappe>` er brukerens argument (`$ARGUMENTS`). Mangler den: spør hvilken
mappe, ingenting annet.
- Bundlen og skillen havner i **gjeldende mappe** (`.okf/<id>/` og
`.claude/skills/<id>-consume/`). Det er poenget: brukeren starter `claude`
nytt der og spør.
- Bundle-id blir mappenavnet. Flere mapper i samme prosjekt: kjør kommandoen én
gang per mappe med `--id <navn>`; modellen velger riktig skill ut fra
spørsmålet.
Er `okf` ikke installert, sier skallet `command not found`. Da er ett steg
manglende, ikke feil: se README i `open/llm-ingestion-okf` for install-linjen,
og stopp.
## Etter kjøringen
Gjengi tallene ordrett — dokumenter lest, konsepter skrevet, hvor skillen ble
skrevet — og NESTE-linjen. To ting sier kommandoen som du IKKE skal utelate:
- Står det at dokumenter **ikke er i bundlen**: si i én setning at spørsmål om
dem bare kan besvares `[sourced-not-sufficient]`, fordi ingen utdrag kan
sitere dem.
- Står det at dokumenter **landet hele** (ett konsept hver): si i én setning at
et spørsmål om dem returnerer hele dokumentet som ett utdrag, og at svaret
ofte blir `[sourced-not-sufficient]` inntil dokumentet er delt opp.
Exit 1 = ett steg nektet, og kommandoen skriver koden. Vis den linjen og stopp.
Exit 2 = kjøringen skjedde ikke i det hele tatt (som regel feil mappe).
## Hva brukeren gjør så, i klartekst
1. `claude` på nytt i mappa.
2. Still spørsmålet eller hypotesen rett ut. For eksempel «Hva krever
dokumentene om prisutfylling?», «Hypotese: opplæring er priset inn i
mekanisk ferdigstillelse — bekreft eller avkreft med kilde», eller «Lag et
notat `krav-pris.md` med alle krav til pris, ett avsnitt per krav, med
dokument og kravnummer».
Skillen `<id>-consume` som ble skrevet i mappa kjører pre-passet og
kontraktsjekken selv, og merker hver påstand med kilde.