Corpus Ref code
  • Nushell 90.9%
  • Nickel 5.8%
  • Just 1.7%
  • Shell 1.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
claude-bot dcbe4c9686
Make the entry point resolve itself, and stop config aborting on an empty corpus
bin/corpusref died with "CORPUSREF_PATH: unbound variable" on every invocation.
The variable is exported by nothing in this project, and ~/.local/bin/corpusref
is a symlink to this file, so the command was broken on $PATH.

The line it replaced — a plain `dirname "${BASH_SOURCE[0]}"` — was not enough
either: through that symlink it answers ~/.local/bin, where the library is not.
That gap is presumably what pushed the edit to an env var in the first place.
Resolving the symlink chain is what both attempts were reaching for, and it is
what the file's own comment has always claimed. $CORPUSREF_PATH still overrides,
for a caller serving a checkout it does not stand in.

Verified three ways from an unrelated cwd: directly, through the PATH symlink,
and with the override set.

`corpusref config` then aborted with «Unsupported input»: `[] | math sum` raises
in nushell rather than returning 0, and an empty inventory is the state of every
fresh install and of this checkout. That is this file's own contract broken in
the command the README tells you to run first — «Exit codes: 0 ok · 1 failure ·
2 nothing to do. Empty is not broken.» `append 0` gives the sum an identity
element instead of a special case.

`corpusref config` now reports `integration: ontoref … manual: ontoref qa show
corpusref-howto` — the second altitude answering from the spine, end to end.

Claude-Session: https://claude.ai/code/session_01TKE8dpnKJmnv7LcPDZZtpR
2026-09-04 07:12:15 +01:00
.claude Initial commit: corpusref, the anchored-source tool 2026-09-03 13:37:03 +01:00
assets Materialize the brand assets for the forge 2026-09-03 22:24:28 +01:00
bin Make the entry point resolve itself, and stop config aborting on an empty corpus 2026-09-04 07:12:15 +01:00
justfiles Initial commit: corpusref, the anchored-source tool 2026-09-03 13:37:03 +01:00
lib Make the entry point resolve itself, and stop config aborting on an empty corpus 2026-09-04 07:12:15 +01:00
schemas Initial commit: corpusref, the anchored-source tool 2026-09-03 13:37:03 +01:00
.gitignore Materialize the brand assets for the forge 2026-09-03 22:24:28 +01:00
justfile Initial commit: corpusref, the anchored-source tool 2026-09-03 13:37:03 +01:00
MANUAL.md Fix spine resolution in doc, so the manual reaches its queryable source 2026-09-03 17:13:14 +01:00
README.md Initial commit: corpusref, the anchored-source tool 2026-09-03 13:37:03 +01:00

corpusref

Turns texts somebody else wrote into a substrate you can cite and study.

A book is one kind of source. A project's documentation, an RFC, a paper and a repository are others. What they share is the only thing this tool requires: an anchor that makes a claim resolve back in the original — a PDF's page, a markdown heading, a line range, a commit.

corpusref init ~/my-sources --template software   # a new corpusref
corpusref add ~/my-sources/arch/some-book.pdf     # extract, anchored
corpusref brief some-book                         # the cataloguing work order
corpusref project                                 # project, derive topics, validate
corpusref doc                                     # the manual

Layout

Path What
bin/corpusref the entry point; resolves the library beside itself, works from anywhere
lib/corpusref.nu the CLI — the only surface a consumer calls
lib/config.nu where an instance's layers live; nothing else knows a path
lib/{extract,find,project,validate}.nu the pieces the CLI drives
lib/{log,verify,due,attest-kata,frontmatter}.nu the study loop
schemas/source.ncl the closed Source contract
MANUAL.md generated from the queryable manual; corpusref doc --export

An instance is any tree with a corpusref.ncl declaring its layers. corpusref init writes one.

Two altitudes

corpusref config reports which one you are at.

  • Standalone: everything works, the ontology check reports «not checked» instead of failing, and the manual comes from MANUAL.md.
  • With ontoref: relevance[].tension is enforced against a real ontology, the manual is queryable via cli command (ontoref qa show corpusref-howto), and the curate-corpusref mode, the biops and the Work Orders exist. Absence of a spine is a fact about the installation, never a defect.

The output format is a projection

The catalog knows nothing about OKF. projection = { format = 'OKF, version = "0.2" } declares the target and the projector is the only code that reads it. A second format is another projector and one more enum value.

Full manual: corpusref doc.