alterlab-labarchive
Installation
SKILL.md
LabArchives Integration
Overview
LabArchives is an electronic lab notebook platform for research documentation and data management. Its REST API (XML responses, HMAC-signed requests) exposes notebooks, the page tree, entries, attachments, and backups. The core job here needs no account: write and review the integration, draft entry content, and audit a notebook the user has exported. Only live notebook access uses their credentials.
Keyless Path (default — no LabArchives account)
- Write and review the integration code against the real clients —
labapi(maintained;uv run --with "labapi[dotenv]" python ...) or the git-onlylabarchives-pythe bundled scripts use. Check method names rather than guessing: in labapi 1.2.0 (verified 2026-10-22) a notebook has.export(dest, source="auto"|"walk"|"backup")and.backup(dest, include_attachments=, as_json=), entries are created withpage.entries.create(TextEntry, html)/create(AttachmentEntry, Attachment.from_file(...)), and the client readsAPI_URL/ACCESS_KEYID/ACCESS_PWDfrom the environment. - Know the signing before you run it. Requests are signed
sig = b64(HMAC(access_password, akid + method + expires)),expiresin epoch-ms. The two clients differ on the hash —labapiuses HMAC-SHA512, the gitlabarchives-pywrapper uses HMAC-SHA1 — so the signature must be tested against the tenant, not assumed; match the client to what your institution's API expects. - Audit an exported notebook offline.
labapi'snotebook.export(dest)writes a folder mirror (<order>_<name>/directories holdingNN_text.html,NN_text.txt,NN_<filename>).python3 scripts/analyze_export.py <dir>walks that tree (or any same-shape export/backup) with no credentials and reports pages, text vs attachment entries, word counts, attachment types, and provenance gaps — pages that hold raw-data attachments with no text entry describing them. - Draft entry content and upload plans offline — the rich-text HTML for
add_entry, the caption/provenance note for an attachment, the page-tree layout — ready to push once the user supplies credentials. - Hand over the live step. The bundled scripts (
notebook_operations.py,entry_operations.py) readconfig.yamland exit non-zero with a clear message if it is absent; they run only against the user's own notebook. Without credentials, stop at the validated code and the offline audit — never invent notebook contents.