Metadata-Version: 2.4
Name: spectrallock
Version: 0.3.1
Summary: SpectralLock: Rosetta spectral analysis. Same lenses as Aziel Corpus Library OCR (overlays, ink/page). Author Aziel Eliab, 2026.
Author: Aziel Eliab
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a copy of the attributable notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be in the following terms and
              conditions of this License, without any additional terms or
              conditions. Notwithstanding the above, nothing herein shall
              supersede or modify the terms of any separate license agreement you
              may have executed with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely
              responsible for determining the appropriateness of using or
              redistributing the Work and assume any risks associated with Your
              exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright 2026 Aziel Eliab
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        
Project-URL: Homepage, https://github.com/AzielEliab/spectrallock
Project-URL: Download, https://spectrallock-download-tracker.vibelock.workers.dev/download?asset=spectrallock-0.3.1.tar.gz
Project-URL: Issues, https://github.com/AzielEliab/spectrallock/issues
Project-URL: Counted-downloads, https://spectrallock-download-tracker.vibelock.workers.dev/
Keywords: advisory,manuscript,overlay,ocr,rosetta,spectral,tazel,vyrn,zero,spectrallock,visualization
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: Pillow>=10.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Dynamic: license-file

# SpectralLock

**Rosetta spectral analysis** software (RSA-2.0 family).

Same **SpectralLock lenses** as [Aziel Corpus Library OCR](https://www.azielcorpuslibrary.net/ocr):
overlays plus ink/page targets.

**Author:** Aziel Eliab
**Date:** 2026
**License:** [Apache-2.0](LICENSE)
**Version:** 0.3.1

> The human still reads the page.

RSA-2.0 is the decoding composite `0.40·Z′ + 0.35·T′ + 0.25·V′`. Ink isolates
writing; page isolates parchment. Balance never invents marks — it only
reweights existing readings. Synthetic UV is a 365–400 nm look from an
ordinary photograph. Candlelight, indent, and lemon are synthetic looks
from ordinary photos. Hosted `/v1/overlay` is a 256 px preview; the full
pipeline is this Python package.

**Forks are welcome and always allowed.**


## One-click install

```bash
curl -fsSL https://spectrallock-download-tracker.vibelock.workers.dev/install.sh | bash
```

The script curls the **counted** tarball from this project's Worker
(`/download`, User-Agent `Mozilla/5.0`), extracts, makes a venv, and
`pip install -e .`. Then run `spectrallock ui`.

Or tap **Download** / **One-click install** on the Worker homepage
(a 6th-grader can tap it):
https://spectrallock-download-tracker.vibelock.workers.dev/

## Counted download (Cloudflare Worker)

**This is the counted download.** GitHub releases exist as a mirror.
The Worker serves the gzip itself (HTTP 200, no 302 to GitHub).

# → [https://spectrallock-download-tracker.vibelock.workers.dev/](https://spectrallock-download-tracker.vibelock.workers.dev/) ←

Direct tarball (also counted):
[spectrallock-0.3.1.tar.gz](https://spectrallock-download-tracker.vibelock.workers.dev/download?asset=spectrallock-0.3.1.tar.gz)

- Live count JSON: [https://spectrallock-download-tracker.vibelock.workers.dev/count](https://spectrallock-download-tracker.vibelock.workers.dev/count) (`{project, views, downloads, total}`)
- Full stats JSON: [https://spectrallock-download-tracker.vibelock.workers.dev/stats](https://spectrallock-download-tracker.vibelock.workers.dev/stats)
- OpenAPI: [https://spectrallock-download-tracker.vibelock.workers.dev/openapi.json](https://spectrallock-download-tracker.vibelock.workers.dev/openapi.json)
- Skill: [https://spectrallock-download-tracker.vibelock.workers.dev/v1/skill](https://spectrallock-download-tracker.vibelock.workers.dev/v1/skill)
- Suite mesh proxy: [https://spectrallock-download-tracker.vibelock.workers.dev/v1/mesh](https://spectrallock-download-tracker.vibelock.workers.dev/v1/mesh) — default OFF; QNM live / locked / isolated; QNS-CD-1.0 cross-map (photon QNS1 packet transfer; no public qnsd proxy)
- llms.txt: [https://spectrallock-download-tracker.vibelock.workers.dev/llms.txt](https://spectrallock-download-tracker.vibelock.workers.dev/llms.txt)
- ai.txt: [https://spectrallock-download-tracker.vibelock.workers.dev/ai.txt](https://spectrallock-download-tracker.vibelock.workers.dev/ai.txt)
- cite.json: [https://spectrallock-download-tracker.vibelock.workers.dev/cite.json](https://spectrallock-download-tracker.vibelock.workers.dev/cite.json)
- One-click install: [https://spectrallock-download-tracker.vibelock.workers.dev/install.sh](https://spectrallock-download-tracker.vibelock.workers.dev/install.sh)
- GitHub: [https://github.com/AzielEliab/spectrallock](https://github.com/AzielEliab/spectrallock)

Isolated counter: Worker `spectrallock-download-tracker`, KV `SPECTRALLOCK_DOWNLOADS`. SpectralLock only. `/v1` does not increment downloads.


## Quick start

1. Install (Python 3.10+):

   ```bash
   python -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]"
   ```

2. Open the local app:

   ```bash
   spectrallock ui
   ```

3. In the browser at http://127.0.0.1:8861 (loopback only): tap **Add file**
   (or **Sample page**), pick SpectralLock lenses, choose **Ink** or **Page**,
   then **Export**. Optional: **Verify** shows a receipt (lenses, target,
   paper, SHA-256 in/out, size). No CDN, no telemetry. Dark gold.

Counted download: [https://spectrallock-download-tracker.vibelock.workers.dev/](https://spectrallock-download-tracker.vibelock.workers.dev/)

Direct tarball: [spectrallock-0.3.1.tar.gz](https://spectrallock-download-tracker.vibelock.workers.dev/download?asset=spectrallock-0.3.1.tar.gz)

Papers: [docs/source/](docs/source/) · spec: [docs/whitepaper.md](docs/whitepaper.md) ·
runtime sync: [docs/runtime-sync.md](docs/runtime-sync.md)

How to contribute: [CONTRIBUTING.md](CONTRIBUTING.md).

---

## Honest scope

v1 is **image processing** (Pillow + numpy) on a photograph you already
have. It reweights hues and contrast so faint marks are easier to *look
at*.

The hosted Worker `/v1/overlay` is a **simplified preview** (longest side
capped at 256 px, PNG in/out). The full pipeline is this Python package.

**Unredact / lift-overlay** locates leftover bytes and residual only.
Never invent letters. Opaque replace with no leftover container
bytes refuses (`SL-UNREDACT-OPAQUE`). Heatmaps are residual overlays.

**Handwriting** is synthetic image analysis of a scan or photo of ink
on paper. Indicators are heuristics — human verification required.

## Lenses (all live in 0.3.1)

Same names as the Corpus OCR SpectralLock lens checkboxes, plus candle /
indent / lemon synthetic looks. Aliases resolve to the canonical id.

| id | paper | formula / action |
|----|-------|------------------|
| `zero` | ZSA-1.0 | Grayscale, hist-eq, band-pass, unsharp. Hue ~260°, `#6F6485`. |
| `tazel` | TSA-1.0 | Boost green–gold–turquoise (~170°, `#1EC9A5`). Lift faint midtones. |
| `vyrn` | VSA-1.0 | Boost magenta–red-violet (~350°, `#C00066`). Suppress green/cyan. |
| `uv` | UVSA-1.0 | Ultraviolet light analysis (synthetic). 365–400 nm look. Aliases: `ultraviolet`, `uv-light`, `uvsa`. |
| `rosetta` | RSA-2.0 | `0.40·Z′ + 0.35·T′ + 0.25·V′` after per-channel normalize. |
| `zen` | ZENA-1.0 | `(Z′ + T′ + U′ + V′) / 4` after normalize. |
| `chaos` | CSA-1.0 | `0.40·U′ + 0.35·V′ + 0.20·T′ + 0.05·Z′` after normalize. |
| `balance` | BSA | `B=(Zn−Cn)/(Zn+Cn+ε)`, `α=(1+B)/2`, `RGB = α·Zen + (1−α)·Chaos`. Never invents marks. |
| `candle` | CLSA-1.0 | Candlelight analysis (synthetic). Amber ~1800–2700K flame-side look. Aliases: `candlelight`, `candle-light`. |
| `indent` | ISA-1.0 | Ink-suppress / indentation reveal (synthetic). Prefer `page`. Aliases: `indentation`, `suppress-ink`, `ink-suppress`, `revealer-indent`. |
| `lemon` | LISA-1.0 | Hidden lemon ink analysis (synthetic). Heat-/acid-style browning from existing pixels. Never invents marks. Aliases: `lemon-ink`, `hidden-lemon`, `invisible-ink-lemon`. |

Stub (refused): `spectrometer`, `forensic`, `invent_mark`.

## Unredact / lift-overlay (operator lock — NO-LIE)

Family: `unredact` / `lift` / `redact-locate`.
Ops: `locate`, `lift`, `recover`, `refuse`.

| op | honesty |
|----|---------|
| `locate` | Report text still in the PDF, metadata, attachments, twin-page residual, leftover container bytes, and historical page revisions (stale `/Page` graphs, prior streams, xref/ObjStm, after-EOF, incremental `startxref`/`Prev` revision graph + per-revision tip-cut copies). Do not invent letters. |
| `lift` | Non-opaque cover only. Contrast / residual with `--no-inject` (gray of the same gate). Heatmaps are residual overlays. |
| `recover` | If leftover / historical bytes remain (incremental update, unused/orphan objects, prior streams, stale pages, attachments, after-EOF), extract them with character provenance. That is reading present bytes. |
| `refuse` | Opaque sanitized rewrite / flattened screenshot and no leftover bytes → `SL-UNREDACT-OPAQUE`. |

Returns `opaque_replace`, `residual_usable`, `leftover_bytes`, `recovered_from`, `page_revisions`, `revision_compare`, `revision_graph` (revisions + edges + tip-cut `copy` / embeds; hosted may cite sha256+offsets when `b64` is capped), `operator_text`, `classifications`, `recovered_characters` (page, object_id, generation, xref_revision, stream_offset, operator, font, decoded_bytes, source_revision, sha256), `ocr` (after structural only; `covered_letters_from_context` is always false), `refuse_code`. OCR never reconstructs covered letters from context. Never invents letters.

## Handwriting / ink-on-paper (operator lock — NO-LIE)

Family: `handwriting` / `handwrite` / `ink-hand` / `forgery-scan`.
Ops: `analyze`, `compare`, `side-by-side`, `graph`, `forgery-indicators`, `refuse`.

Synthetic image analysis of a user-supplied scan or photo of physical ink on paper. Looks at present pixels only: stroke-weight variation (pressure proxy), speed cues (taper / tremor — heuristic), ink density, bleed / feathering, baseline / slant / size shifts, erasures, tracing evidence, and forgery indicators (tremor-copy, unnatural lifts, retouch, dual-ink, clone-stamp, compression paste-up, ductus, style-shift). Side-by-side questioned vs known. Stroke/feature graph flags anomalous edges. Density / bleed / erasure heatmaps are residual overlays.

| honesty | meaning |
|---------|---------|
| LIVE | pixel heuristics listed in `docs/audit/HANDWRITING-FORGERY-AUDIT.md` |
| SLOT | ESDA, chemical ink dating, force in newtons, speed in mm/s, writer identity as fact, court examiner opinion |
| refuse | `SL-HANDWRITING-NO-INK` · `SL-HANDWRITING-UNSUPPORTED` · `SL-HANDWRITING-LIMIT` |

Phrasing: **indicator / heuristic / candidate — human verification required.** Confidence is signal quality from pixels, not “this is forged.” Spectral helpers (`uv`, `candle`, `indent`, `lemon`) may be cited with inject OFF. Balance / lemon never invent marks.

```bash
spectrallock unredact locate page.pdf --json
spectrallock unredact recover page.pdf --json
spectrallock recover locate page.pdf --json
spectrallock recover deep file.docx --all-metadata --scan-orphans --json
spectrallock recover compare old.json new.json --json
spectrallock recover revision-graph page.pdf --json
spectrallock handwriting analyze ink_scan.png --json
spectrallock handwriting compare questioned.png --twin known.png --json
spectrallock forgery-scan ink_scan.png --json
spectrallock pigment restore page.png --json
spectrallock restore-pigment page.png -o restored.png --json
spectrallock lift cover.png --no-inject -o residual.png --json
spectrallock redact-locate page.pdf --twin page_less.pdf --query "Alice"
```

## Restore lost pigment (operator lock 2026-09-22 — NO-LIE)

Family: `pigment` / `restore-pigment`.
Ops: `restore`, `estimate`, `refuse`.

LIVE on SpectralLock (CLI, local UI, Worker `GET|POST /v1/pigment`, alias `POST /v1/restore-pigment`). Estimates faded pigment where pixels still differ from the page in a supported cluster. Visible dark ink stays already-present pigment. When the faded signal is gone the op refuses `SL-PIGMENT-GONE` and writes no new marks. Receipts set `pigment_recovery` true only when this path ran. Overlay and unredact receipts keep `pigment_recovery` false. Wheel paint is a separate plane from this estimate.

```bash
spectrallock pigment restore page.png -o restored.png --json
spectrallock pigment estimate page.png --json
spectrallock restore-pigment page.png --json
```

## Ink / page targets

Same polarity as Corpus OCR ink/page modes. Applied after the lens overlay.
Reweights existing pixels only.

| id | action |
|----|--------|
| `ink` | Isolate writing: crush parchment, keep strokes. Default. |
| `page` | Isolate substrate: lift parchment, wash ink. |

Several lenses may be selected (Corpus OCR checkbox family). They are mixed
equally, then the target is applied.

## Color inject switch (19 Sep 2026)

Each named mode accepts `--inject` / `--no-inject` (CLI, Python `inject=`,
Worker `POST /v1/overlay` `{inject: true|false}`).

| switch | meaning |
|--------|---------|
| **ON** (`--inject`) | False-color membership tint (paint). |
| **OFF** (`--no-inject`) | Luminance of the **same gate** (gray). |
| `zero` | Ignores the switch (stays gray either way). |

- In-band spectral math stays tazel 170° `#1EC9A5`, vyrn 350° `#C00066`, zero `#6F6485`.
- Membership paint (Spectral Harmonic Wheel, operator lock 2026-09-22): ZERO `#325767`, CHAOS `#8D223D`, VYRN `#A22639`, UV `#9F3B2B`, TAZEL `#797A2D`, ROSETTA `#467542`, ZEN `#DFD2B5`. Source: `docs/source/color-wheel-paint.txt`.
- `uv`: synthetic 365–400 look (violet parchment / residual) from an ordinary photograph.
- `rosetta` / `zen` / `chaos` / `balance`: composite tint when ON; gray gate when OFF. Balance never invents marks.
- `candle` / `indent` / `lemon`: honest ON tint vs OFF gray of the same gate.

Overlay and verify JSON report **`tazel_inband_pct`** and **`vyrn_inband_pct`**
before any hit claim. An empty gate is a valid reading. Copy-of-copy only works if
the hue is still in-band.

```bash
python3 spectrallock_inject.py page.jpg --mode vyrn --inject -o vyrn_on.jpg
python3 spectrallock_inject.py page.jpg --mode vyrn --no-inject -o vyrn_off.jpg
python3 spectrallock_inject.py page.jpg --all --inject --outdir out/
python3 spectrallock_inject.py page.jpg --all --no-inject --outdir out_plain/
python3 spectrallock_inject.py page.jpg --mode zero --target ink --no-inject
```

Hosted `/v1/overlay` may accept `inject` on a 256 px PNG preview. Prefer the
local package (`spectrallock_inject.py`) for the full pipeline.

## Install

Python 3.10+. Pillow + numpy. No OpenCV.

```bash
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
python -m pytest -q
```

## CLI

```bash
spectrallock version
spectrallock doctor
spectrallock modes
spectrallock lenses
spectrallock overlay --mode zero|tazel|vyrn|uv|rosetta|zen|chaos|balance|candle|indent|lemon --target ink|page --inject|--no-inject IN.png OUT.png
spectrallock overlay --lens tazel --target page --no-inject page.jpg out.png --json
spectrallock overlay --mode tazel page.jpg out.png --verify --sidecar
spectrallock inject page.jpg --mode vyrn --inject -o vyrn_on.jpg
spectrallock unredact locate page.pdf --json
spectrallock unredact recover page.pdf --json
spectrallock recover locate page.pdf --json
spectrallock recover production ./case_folder --recursive --json
spectrallock handwriting analyze ink_scan.png --json
spectrallock handwriting compare questioned.png known.png --json
spectrallock pigment restore page.png --json
spectrallock restore-pigment page.png -o restored.png --json
spectrallock lift cover.png --no-inject -o residual.png --json
spectrallock redact-locate page.pdf --twin other.pdf --query Alice
spectrallock ui          # 127.0.0.1:8861
spectrallock serve       # alias for ui
```

PNG or JPEG in. `--verify` prints lenses, target, paper, sha256 in/out, size.
`--sidecar` writes a JSON next to the overlay PNG.
`SPECTRALLOCK_DEBUG=1` traces to stderr (never image bytes).

## iPhone & Android

Flutter sources: [`mobile/`](mobile/). Application id `com.azieeliab.spectrallock`.
Offline color-matrix approximation of the hues. The full Python pipeline is this package.
**Add file** + **Export**.

```bash
cd mobile
flutter create --org com.azieeliab --project-name spectrallock .
flutter pub get
flutter run
```

## Hosted preview

- OpenAPI: https://spectrallock-download-tracker.vibelock.workers.dev/openapi.json
- Health: `GET /v1/health`
- Lenses: `GET /v1/lenses` (alias `GET /v1/modes`)
- Targets: `GET /v1/targets`
- Overlay: `POST /v1/overlay` `{b64, mode|lens|lenses, target, inject}` — PNG, max 256 px longest side. `inject` true\|false is paint (false-color membership). Mode aliases (`ultraviolet`, `candlelight`, `ink-suppress`, `hidden-lemon`, …) resolve to canonical ids. Does **not** increment the download counter.
- Unredact: `GET /v1/unredact` honesty banner; `POST /v1/unredact` `{b64, op, query, twin_b64?}` locate / leftover-historical recover / residual lift. Returns `revision_graph` (startxref/Prev edges + per-revision tip-cut copies). Opaque rewrite + no leftover → `SL-UNREDACT-OPAQUE`. Aliases `POST /v1/lift`, `POST /v1/redact-locate`. Hosted preview may cap size / copy `b64` (sha256+offset cites, no invented bytes) and has no OCR engine — it does not lie about that. Never invents letters.
- Recover: `GET /v1/recover` ops + LIVE vs SLOT matrix; `POST /v1/recover` `{b64, op, filename, twin_b64?}` universal artifact recovery. Present bytes only. Secrets suppressed. SLOT stays SLOT; LIVE stays LIVE. Audit: `docs/audit/UNIVERSAL-RECOVER-AUDIT.md`.
- Handwriting: `GET /v1/handwriting` ops + LIVE vs SLOT features; `POST /v1/handwriting` `{b64, op, filename, twin_b64?}` synthetic ink-on-paper scan heuristics. Hosted 256 px PNG preview. Audit: `docs/audit/HANDWRITING-FORGERY-AUDIT.md`.
- Suite mesh: `GET /v1/mesh` PROXY to aziel-runtime (default OFF; QNM-BUILD-1.0 live|locked|isolated; QNS-CD-1.0 hub cite / Worker mesh cross-map only — photon QNS1 packet transfer; local qnsd in [qnm-node](https://github.com/AzielEliab/qnm-node); runtime cites in [aziel-runtime](https://github.com/AzielEliab/aziel-runtime); no Node Gate; no public qnsd proxy)
- AI help: https://spectrallock-download-tracker.vibelock.workers.dev/ai
- Catalog: https://aziel-runtime.vibelock.workers.dev/ (MCP tools `spectrallock_modes`, `spectrallock_overlay`; catalog `mesh_*` + FragGate `slug=mesh`)
- Corpus OCR: https://www.azielcorpuslibrary.net/ocr

Isolated counter: Worker `spectrallock-download-tracker`, project `spectrallock`,
KV `SPECTRALLOCK_DOWNLOADS`. `totalKey` `spectrallock|__total__`. `/download`
serves gzip from Worker assets (`private, no-store`). No 302 to GitHub.

## Use with ChatGPT, Grok, Venice, Claude, Cursor, and other MCP/OpenAPI-capable assistants

Catalog OpenAPI: https://aziel-runtime.vibelock.workers.dev/openapi.json
Catalog MCP: `POST https://aziel-runtime.vibelock.workers.dev/mcp`
This Worker skill: https://spectrallock-download-tracker.vibelock.workers.dev/v1/skill
This Worker OpenAPI: https://spectrallock-download-tracker.vibelock.workers.dev/openapi.json
Suite mesh `/v1/mesh/*` PROXY via `AZIEL_RUNTIME` (default OFF; QNM-BUILD-1.0 live|locked|isolated; QNS-CD-1.0 hub cite / Worker mesh cross-map only; no Node Gate; no public qnsd proxy). Catalog MCP `mesh_*` + FragGate `slug=mesh`. Local qnsd lives in [qnm-node](https://github.com/AzielEliab/qnm-node); runtime cites + catalog field live in [aziel-runtime](https://github.com/AzielEliab/aziel-runtime). AZInterface holds pair custody.

Works with ChatGPT (GPT Actions / OpenAI), Grok (xAI), Venice, Claude (Anthropic), Cursor (MCP), Glama (MCP), Perplexity, Microsoft Copilot / Bing, Google Gemini / Vertex, Mistral, Meta AI, Apple Intelligence surfaces, Amazon Q tooling, DuckAssist, You.com, Cohere, and other MCP/OpenAPI-capable assistants. Import the catalog or Worker OpenAPI as a custom tool, GPT Action (no auth), HTTP tool, or MCP connector. Always send `User-Agent: Mozilla/5.0`.

## Cite this

Aziel Eliab. SpectralLock. https://github.com/AzielEliab/spectrallock. https://spectrallock-download-tracker.vibelock.workers.dev.

- Catalog: https://aziel-runtime.vibelock.workers.dev/
- Worker homepage: https://spectrallock-download-tracker.vibelock.workers.dev/
- Counted download (gzip HTTP 200, no 302): https://spectrallock-download-tracker.vibelock.workers.dev/download
- GitHub: https://github.com/AzielEliab/spectrallock
- Citation JSON: https://spectrallock-download-tracker.vibelock.workers.dev/cite.json

## License

Apache License 2.0. Copyright 2026 Aziel Eliab.
