interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / research / README.md

334 lines · 24140 bytes Raw Blame History Rendered
1# Research on Interplane
2
3Research is a literature registry with author pages, citations and an ask agent. Papers can come
4from a Radicle repository or public Zenodo metadata. Zenodo mints DOIs in the author's account;
5Interplane does not mint them or take custody of a Zenodo or ORCID token.
6
7This branch implements the source change. It is not deployed. The live service and its data folder
8were not changed. Host fixture checks are not a claim of deployment or of scientific review.
9
10## Parts
11
12| Part | Purpose |
13|---|---|
14| `registry/catalog.tsv`, `registry/text/` | Drake's existing catalog and full text; existing work URLs and documents remain compatible |
15| `registry/a/<id>/*.tsv` | raw records from accepted requests; outside forged's writable folder |
16| `registry/show/<id>.tsv` | derived catalogs after removal and shelf-state checks; the publisher reads these, not the raw records |
17| `build.om`, `publish.sh` | build the hub, author and work pages, JSON, BibTeX and the ask corpus without a network |
18| `route.om`, `intake-route.om` | serve built documents, queue questions and reuse the open shelf intake |
19| `sync.om`, `sync.sh` | metadata admission in Omega and thin curl/git/file IO outside forged |
20| `lib/jflat.om`, `lib/PROVENANCE` | seeded Omega JSON decoder, copied at a recorded source commit |
21| `agent.om` | retrieval, quoted-data model request and code-owned answer/source documents |
22| `../tools/doi/` | local-author deposit tool and its fixture gate |
23
24Transport uses first-argument curl `-q`, `--globoff`, an empty proxy setting and explicit `--url`
25data. A bracket/brace in an attachment URI is one literal request, not a curl expansion program;
26operator curlrc redirect/auth options are not inherited. The local TLS fixture uses real curl,
27not only an option-logging stand-in.
28
29There is no second file-upload endpoint. `forged` still runs without a network. The sync program is
30separate, like `agent.om`; only it reads the public Zenodo API and repositories accepted by the shelf.
31
32## Pages
33
34| URL | Document |
35|---|---|
36| `/research` | hub across authors, works and the ask box |
37| `/research/authors/<id>` | an author's record, works and provenance |
38| `/research/<slug>`, `.json`, `.bib` | a work and its machine-readable citations |
39| `/research.json`, `/research.bib`, `/research.txt` | aggregate documents |
40| `/research/add` | the three ways to add work |
41| `/research/add/` | Radicle-key sign-in and forms: repository ID, ORCID iD or Zenodo DOI |
42| `/research/doi` | Get a DOI for your work; links to the local tool |
43| `/research/ask?q=...`, `/research/ask/<id>[.json]` | question queue and public answer |
44
45Pages use `/assets/tokens.css` and research.css, with no scripts. forge.css and token colours are
46unchanged. Author IDs and work slugs are restricted to lowercase letters, digits and hyphens.
47Drake's author ID is `drakestapleton`. His existing 16 HTML/JSON/BibTeX work documents are checked
48against base hashes in `tests/fixtures/base-sha256.txt`; the hub changes to list other authors.
49
50## Bring a paper repository
51
52On the author's machine, put the paper in `paper.pdf`, `paper.md` or `paper.txt`, a `LICENSE`
53(`LICENSE.md`, `LICENSE.txt`, `LICENCE` or `COPYING` also works), and `.zenodo.json` at the top level.
54The supported metadata format is JSON, not a partial CFF/YAML parser. For example:
55
56```json
57{
58 "title": "A result with its limits",
59 "description": "The abstract.",
60 "creators": [{"name": "Family, Given"}],
61 "upload_type": "publication",
62 "publication_type": "preprint",
63 "license": "cc-by-4.0"
64}
65```
66
67Commit it, run `rad init`, seed and announce the repository with Radicle from that machine. Sign
68in at `/research/add/` with the Radicle key and give its `rad:z...` ID. The repository form calls
69the existing shelf POST: sign-in, CSRF, consent, rate counter, disk-space checks, queue and intake
70refusals are shared. Research does not fetch a repository itself. It waits for the shelf to accept
71it under that key, then pins a commit and reads its metadata, tree and paper through read-only git commands. A G record binds the listing to that commit and the paper SHA256.
72No repository hook, filter, checkout or paper-supplied command is run.
73
74The listing says **Not verified** and names the key that brought it. This is not a claim that the
75key wrote the paper or belongs to a named person. A repository without a usable LICENSE or paper
76file is refused by research. The shelf may still list the project as an open build.
77
78## Sync public records
79
80Give an ORCID iD, a Zenodo DOI (`10.5281/zenodo.<number>`) or both at `/research/add/`. A DOI-only
81request uses a creator ORCID iD from that record; a DOI whose creators have no ORCID iD is refused.
82For a claimed iD, a record is included only if the Zenodo record itself carries that exact iD
83among its creators. A matching search result alone is insufficient. Requesting public metadata
84gives a key no ownership or exclusive ORCID custody. A second key can sync the same iD, including
85after the first key is removed. Author and work pages separate the public author name/ORCID from
86the requesting key and state that no personal identity or ownership is established. The page names
87the requester, not a verified author account. No ORCID sign-in or ownership proof step is required.
88For a coauthored record, work slugs and cached text are consistently namespaced by the author ID;
89each creator's catalog can include the record without colliding in the combined publication.
90
91Full text is copied and included in the ask corpus only for these licence identifiers (case folded):
92
93- `cc-by-4.0`, `cc-by-sa-4.0`
94- `cc-by-3.0`, `cc-by-sa-3.0`
95- `cc0-1.0`
96
97Conflicting duplicate licence identifiers or containers deny full text in either order. The JSON
98decoder preserves container occurrences, so disjoint duplicate objects cannot hide the conflict.
99These identifiers permit redistribution, subject to their terms. Other or missing licences give
100metadata only: title, abstract, DOI and links, with no full text in the corpus. Code-licence names
101are not treated as permission to redistribute a paper. The provenance names the source and licence;
102a listing is not legal advice or an independent licence audit. An already-copied text is not used
103if a later record's licence is not on the list. At most one PDF, text or Markdown file is copied per
104record. The live comparison check fetched metadata only, not the papers.
105
106## Takedown and who may add
107
108The operator supplies the **same** `allow` and `remove` files used by `open/intake.om`. A missing
109allow file refuses additions; `*` permits a signed-in key, or the file can list allowed DIDs.
110The remove file can name a key or repository as on the shelf. Sync also recognises a bare ORCID iD
111or DOI there. It filters author/work listings, and withdrawn or refused shelf rows stop producing
112research works. Raw accepted catalogs are retained outside the published tree; obsolete or failed-refresh cached text may be discarded; they are not
113served or fed to the model after filtering. Existing published foreign work/author documents are
114absent from the newly selected public generation; `ask/` and the intake queue stay outside that generation. Previously public answer URLs
115may still cite a taken-down work. Removing those answers is an operator decision, not automatic here.
116
117A pending shelf request is retained in a private pending file for retry; it does not hold up queue reclamation. Refusals from metadata, allow or remove
118checks are logged; removals are applied before network IO and again when a pass finishes. The
119operator must run sync and publish to update the research listing. No new daemon is installed by
120this change. A private synced registry is not a public deployment.
121
122## Admission transactions and decoder containment
123
124The worker holds the registry lock and first builds a removal-only candidate. It then stages each
125addition or refresh separately and runs the complete publisher on that candidate, including the
126aggregate metadata, page and corpus limits. A candidate that exceeds a limit or cannot build is
127refused before it becomes active. `requests.tsv` records the requesting key and a validated,
128refused-publication, refused-metadata or pending-shelf result. Validated means the candidate built;
129activation is the later atomic `current` switch, not the log entry. A rejected addition does not prevent
130an unrelated takedown from publishing. The worker atomically switches `current` only to a complete
131validated generation; `a`, `show` and `text` are compatibility links into it. The publisher pins that
132private registry generation under the same lock; public publication is the separate transaction below. There is one retained active generation; raw accepted metadata
133remains in it, while old generation directories are removed only under the lock. A fresh staging
134registry is initialised with the tracked legacy catalog/text if those are absent.
135
136Queue and direct `--zenodo` refreshes do not reuse a slug's old text as proof of the new attachment. Its candidate discards
137the old cache for each refreshed work; a failed fetch, decode, unsupported attachment or missing
138text makes that refreshed work metadata-only. If the refresh itself fails admission, the previous
139consistent generation is kept. Remove-file absence means no removals, as on the shelf. Other policy
140open/read/type errors and a policy beyond 65,535 bytes fail closed, with no replacement generation.
141The operator must shorten an oversized policy file; it is not silently truncated.
142
143PDF decoding is the one systemd dependency here: an authorised, uniquely named transient **user
144scope**, not an installed unit file. `decode.sh` uses `systemd-run --user --scope --collect` with
145`MemoryMax=128M`, `MemorySwapMax=0`, `TasksMax=8` and `KillMode=control-group`, enclosing the timed
146namespaced decoder. The scope bounds the decoder process tree, not just one process. The decoder
147has 30 seconds (an outer 35-second manager deadline), no home/network/writable host filesystem,
148and at most 8,388,607 stdout bytes persisted through a bounded pipe. Extra output, memory/task
149exhaustion or failure discards the staged text. Diagnostics are bounded to 4,096 saved bytes.
150No user manager/controller means no extraction: there is no unbounded fallback. Only a scope whose nonce description, manager invocation/group and live claimant/launcher identity
151prove this extraction owns it is stopped. A name collision or failure before unit creation does
152not stop an existing scope. The owned scope is collected after extraction. The policy is deliberately small for untrusted PDFs;
153a legitimate PDF can be refused and still have a metadata-only listing. This transient-scope host
154adapter is recorded migration debt against the aien-supervise rule, not an Omega decoder or a new
155supervisor deployment. No unit file, timer, enable, daemon-reload or existing-unit change is made.
156
157## Lossless layout and selected-state provenance
158
159`research-sync layout raw` converts one complete raw import without applying policy, selecting,
160deduplicating or aggregating licences. It preserves W/P/R/T/G facts and original P flags, attaching
161`N slug key value` static profile facts and `I slug original-open` to each bundle. These are private
162registry facts, not new public author/identity claims. A selected catalog keeps these associations
163for **each** work even though its public-compatible O block describes just one current author
164profile. Repeated filtering cannot substitute another work's or a rejected request's profile.
165
166The worker lays out each retained raw file, concatenates all copies, then gathers once. It does
167not use gather as a layout converter: a nonwinning or ineligible copy can still carry an explicit
168work-wide DOI/RID takedown witness. The fallback lays out the prior selected state and fresh import;
169retained raw copies after an internal `X` boundary are auxiliary evidence for explicit denials and
170eligible-copy licence checks only. They cannot win selection or render. Requester removals remain
171per-bundle, distinct from explicit work/source takedowns across copies.
172
173`layout selected` requires the per-bundle N/I association. An old selected catalog that lost this
174information refuses with `SELECTED_PROFILE_UNBOUND` and rebuild instructions; the tool does not
175invent a profile from its shared O block. Rebuild from retained raw imports (layout each raw file,
176then one gather). A legacy standalone raw header profile can still be converted. Public publisher
177O/U compatibility and the existing work URLs/documents are unchanged.
178
179I retains original own permission, but a selected-only/fallback gather deliberately does not reopen
180an aggregate-closed effective P flag merely because losing copies are absent from the selected
181stream. A successful full raw selection recomputes eligibility and may reopen text after a closed
182requester is removed. Until then, conservative withholding can leave a work metadata-only; this is
183not ownership or exclusive requester custody.
184
185## Public publication and reader visibility
186
187`publish.sh` stages the complete public set and `corpus.txt` in `OUT/gen/public.<unique>`.
188After building and syncing that set, it replaces **one** `OUT/current` link. Fixed compatibility
189links (`OUT/w`, `OUT/a`, index and aggregate leaves) and the external corpus path all follow that
190same pointer. Mutable `OUT/ask` answers and `OUT/add` intake state are outside the switched tree.
191The research router resolves and pins the concrete generation once per HTTP request, before its
192existence check and later stream open. The agent opens one corpus inode for a question. Each such
193reader gets a complete old or complete new generation, including if a publisher is interrupted.
194Independent HTTP requests, or an HTTP request and a later corpus open, may straddle a switch:
195there is no cross-request/session snapshot promise. A link in a previously loaded index can lead
196to a removed work's current 404 after a later switch. Already loaded questions/answers are not
197revoked by a takedown.
198
199The first publication or conversion of a legacy layout must finish **before readers start**;
200bootstrap compatibility-link installation is not an atomic live conversion. Old named public
201generations are retained for delayed path opens; do not delete them while readers can still be
202using them. This retention consumes disk and is not a fixed-time garbage-collection claim.
203Incomplete staging names are recovered under the publisher lock. Private registry activation is
204namespace-atomic, not a power-loss durability certification. No live conversion/deployment was
205performed by this source work.
206
207## Removal acknowledgement boundary
208
209For an online full replacement of the operator's REMOVE file, use:
210
211```sh
212sh research/policy.sh REMOVE < replacement-remove-file
213```
214
215The helper bounds input to 65,535 bytes, atomically replaces the same shelf policy file under
216`REMOVE.lock`, and emits `REMOVE_REPLACED sha256=...` under that lock. The worker holds that lock
217while it re-reads policy and shelf state, gathers the selected candidate again, validates and
218activates its final private generation. A helper acknowledgement preceding this commit is consumed
219by that completed pass, including when additions fetched/decoded/built unsuccessfully. An
220acknowledgement after lock release belongs to the next pass. Raw editor writes outside this
221protocol have no acknowledgement/commit timing guarantee. The consumed digest is recorded as
222`.remove-sha256` (`absent` if the file is missing); private publication still needs the public
223publisher to complete. The acknowledgement alone is not a claim that the live page has changed.
224
225When an older surviving raw bundle would exceed current capacity after reselection, the worker
226tries the prior validated selection plus the fresh import instead and reports
227`WITHHELD_RESELECTION`. If no foreign selection can build, it withholds foreign show records and
228validates legacy-only state so an explicitly removed work is not left active by a failed commit.
229Raw bundles and their immutable cache identities remain available for later capacity recovery;
230this is capacity containment, not exclusive requester authority. The fixture checks that a large
231older copy can be withheld while unrelated works/removals continue, then restored with its own
232matching old text when capacity is available.
233
234## Build and stage (after review)
235
236Dependencies: the repository-pinned Linux AArch64 omc (SHA checked by the scripts), curl, git,
237`pdftotext`, bwrap and a systemd user manager with delegated memory/tasks controllers for PDF extraction, and the existing shelf intake. Tests use Python as an independent JSON/hash
238oracle and a C host-only resource adversary (not product code); the product admission and page logic are Omega.
239
240Use a new staging folder, not the live data directory:
241
242```sh
243sh research/build-tools.sh "$HOME/research-stage/bin"
244mkdir -p "$HOME/research-stage/registry"
245cp research/registry/catalog.tsv "$HOME/research-stage/registry/"
246cp -R research/registry/text "$HOME/research-stage/registry/"
247export RESEARCH_TOOLS="$HOME/research-stage/bin"
248# ADD/ is the new forged queue location <data>research/add/.
249# ALLOW and REMOVE are the existing open intake work folder's allow/remove paths.
250# LIST is <data>open/list.tsv; STORAGE is the Radicle storage root.
251sh research/sync.sh --queue ADD/ STATE ALLOW REMOVE \
252 "$HOME/research-stage/registry/" LIST STORAGE
253sh research/publish.sh "$HOME/research-stage/pages/" \
254 "$HOME/research-stage/corpus.txt" "$HOME/research-stage/registry"
255```
256
257The placeholders must be replaced with the operator's configured paths. Do not point a trial run
258at the live queue or live corpus. To replay a saved public API response without network IO:
259
260```sh
261RESEARCH_TOOLS="$HOME/research-stage/bin" sh research/sync.sh --zenodo \
262 0009-0002-6890-7111 did:key:z6MkAbcdefghijkmnopqrstuvw111111111111111111111 \
263 2026-11-11 example /tmp/example/a/example/zenodo.tsv research/tests/fixtures/zenodo.json
264```
265
266The raw catalog is not published until `gather` has checked each bundle against removals and shelf state.
267Direct `--zenodo` can take a final optional SERIAL after RESPONSE_JSON and TEXT_DIR (default 1);
268this operator serializer is not queue serial authority. The queue loads `.serial` from its active
269generation and assigns increasing signed-machine counters. At 9223372036854775807 it refuses a
270further import cleanly but still commits final removals. Use the queue
271path for normal operation. `--zenodo` is a local import/replay interface, not an HTTP authentication
272path. A sync pass advances its saved offset after processing. Pending shelf fetches are retried from the private pending file. Consumed queue prefixes are reclaimed under the same queue.lock that forged takes when appending. Cursor reset precedes atomic replacement, so a crash may replay an idempotent import but cannot skip an unread request. Running the queue adapter in parallel is unsupported; one operator runs a pass at a time.
273The existing research agent can read the staged corpus in `once` mode with a staged ask folder.
274Installation of a service, publication of pages and deployment of forged remain operator actions.
275
276For the author's DOI tool, see `tools/doi/README.md`. It runs on that author's machine with their
277token in the environment, defaults to sandbox, records a reserved DOI in repository metadata and
278requires an explicit typed `yes` to publish. The server does not receive that token.
279
280## Registry and limits
281
282Legacy tab-separated facts are unchanged: `O key value`; `H id title blurb`; `W slug thread date
283kind venue concept-doi version-doi version version-count on-orcid licence title`; `S/A/C/B slug text`;
284`V slug doi date version`; `F slug name bytes https-url`; `K slug keyword`; `E slug relation slug`;
285`L slug relation https-url`. A field has no tab or line end.
286
287New facts: `U id name orcid added-by via checked` is an author; `J slug id` connects a work to its
288author; `P slug how did date source open-text` records provenance (`how`: zenodo/radicle;
289`open-text`: 1/0). `R slug serial` orders eligible complete provenance bundles; `T slug text-sha256`
290binds cached normalised text (`-` means absent). Text is stored as `text/<slug>.<sha256>.txt`, not
291a mutable slug-only alias. Removal/shelf eligibility is checked per complete bundle before
292deduplication; the newest eligible R supplies its metadata, requester and T together. A removed
293copy cannot suppress another eligible one or close its licence; conservative licence reconciliation
294uses surviving copies only. `G slug commit paper-sha256` binds repository data to one source snapshot (40 and 64 lowercase hex characters). Overlapping imports select one eligible complete work bundle; a closed surviving licence decision closes full-text admission. `merge` converts a filtered author's `O` facts into `U`, adds `J` for its works,
295and retains its work facts. The legacy `O` profile still describes Drake. No fake key is attributed
296to old imported records; their existing ORCID/DOIs stay intact.
297
298Inherited builder limits: catalog 262,143 bytes, document 2,097,152; title 400, summary 600,
299abstract 12,000 bytes, cut at UTF-8 boundaries. Corpus 4,194,303 bytes, 256 works, 8,192 passages.
300Question 300 bytes, answer 65,536. The write gate is the shelf's 30 writes per key per minute plus
301its address limit and free-space measure. Research's request queue has the ask queue's 4 MiB
302containment boundary. Input metadata is bounded to 8 MiB, fields decoded to one line, foreign text keeps complete paragraphs up to 262,144 bytes, at most 200
303records/author, 16 files/keywords/links per work and 64 creators. File transport also refuses over
3048 MiB and has a 60 second timeout; PDF extraction has a 30 second timeout and a bwrap sandbox without a home, writable host files or a network. These contain untrusted
305foreign input, not a claimed machine capacity. The local DOI tool currently targets Linux AArch64 and has its own documented input
306limits. The inherited caps and any refusal are reported rather than described as unlimited scale.
307
308Untrusted strings are escaped separately for HTML, JSON and BibTeX; links other than https are
309dropped. Foreign corpus paragraphs are prefixed as quoted data, so a planted corpus header cannot
310invent a source. Titles, passages and the question stay out of the model's system instructions.
311Passage fallback splits align to complete UTF-8 characters and resume without dropping a byte;
312only an actually found separator is skipped. The gate reconstructs long multibyte/unbroken
313paragraphs through the real splitter and strictly decodes the selected model request.
314The code, not a model response, builds source lists and the HTML/JSON output frame. `--gate` on the
315agent exercises that boundary with a fixed answer and no model socket. It does not prove a live
316model's resistance to prompt injection. Retrieved passages are lexical matches, not a truth test.
317
318## Checks and what is not run
319
320```sh
321sh research/tests/run.sh
322```
323
324The gate checks legacy baseline SHA256, separate authors, escaped stranger markup, https filtering,
325licence and ORCID refusals, distinct negative controls, fixture text copying, withdrawals, signed-in
326intake, prompt framing and DOI fixtures. Regressions also cover overlapping imports through the publisher, same-batch key custody, a HEAD change between validation and copying, queue reclamation and DOI symlink/snapshot safety. The saved public live response is
327`tests/fixtures/zenodo-live.json`: 15 accepted Zenodo records, matching 15 Zenodo rows in the
32816-work legacy registry (the other work is Crossref). The public request was read-only.
329
330Not run: a real Zenodo deposit (sandbox or production, an author's token is required), a live model
331injection trial, deployment, production intake, publication or changes to live data. No statement
332here claims the branch has landed. Confirm the remaining policy with Drake: which keys may add,
333takedown treatment of old answers, and the accepted licence identifiers. The confirmed default is
334requester-only public metadata: no exclusive ORCID custody and no ownership proof step.