Turn recovered code into a reusable library
Find the useful parts hiding inside old nsite ZIPs, HTML projects, and repositories, then turn those parts into functions other apps can import. This is the Loopy Library workflow that stops us rebuilding the same signer, relay, and storage machinery for every project.
When to use it: Use this when a project needs something we already built elsewhere, or when recovering code from an older app.
What happens
- Find the originals. Scan source projects safely, record filenames and hashes, and identify exact duplicates.
- Recover real code. Keep exact source bytes and the original project paths so nothing useful is lost.
- Ask Loopy and Embeddy. Search the existing semantic index and Code Quarry for related implementations, rather than trusting filename matches alone.
- Make a clean API. Extract one reusable operation with standard inputs, outputs, errors, and dependencies; do not clone the whole old app.
- Try it in another app. Run positive and failure tests, and use the module from a fresh consumer project.
- Package and explain. Update the library, human documentation, machine-readable contracts, tests, and source history together.
What you get
A tested, importable capability with an API, documentation, examples, and a way to trace it back to its source.
For agents: workflow instructions
A search result or embedding match is only a lead. A capability becomes reusable after extraction and consumer testing.
The structured recipe below is available for automation and integration tools. You do not need to read it to understand the workflow.
Show exact agent workflow (JSON)
{
"schema": "loopy.workflow/1",
"id": "recover-unify-verify-nsite",
"trigger": "new Nostr/nsite ZIP, HTML, or donor code needs reusable API",
"steps": [
{
"id": "discover",
"action": "scripts/nsite_source_audit.py scan",
"output": "source index, exact hashes",
"gate": "source safely inspected"
},
{
"id": "restore",
"action": "scripts/source_collection.py export",
"output": "exact source collection",
"gate": "no path traversal / object hash mismatches"
},
{
"id": "reuse",
"action": "inspect IC Loopy/Embeddy and Code Quarry + docs/API_INDEX.json",
"output": "candidate and existing API mapping",
"gate": "avoid parallel implementations"
},
{
"id": "implement",
"action": "extend src namespace and types/index.d.ts",
"output": "callable implementation and documented options",
"gate": "no mock-only claims"
},
{
"id": "verify",
"action": "npm run verify; python3 -m unittest discover -s tests -p test_*.py",
"output": "test receipt",
"gate": "all local checks pass"
},
{
"id": "consumer",
"action": "test adapted module outside donor app",
"output": "working consumer or explicit live/device gap",
"gate": "requires evidence of requested behavior"
},
{
"id": "export",
"action": "pack source, skills, docs, workflows, tests, provenance",
"output": "portable SDK and private source archive",
"gate": "re-extract and exact hash readback"
}
],
"authority": "read, local build, local test, private owner-controlled preservation; no unauthorized publication"
}