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