# LitePrivateNav Agent Skill

**Current version: 1.0.0**

LitePrivateNav (轻湖私人导航) is a personal start page with categories, ordered
bookmarks and an optional master-password vault. The official agent
integration is a three-file Python skill — no pip, no build step, no platform
executable. It talks to the public Open API (`/api/open/**`) with an
`X-API-Key`, and in encrypted mode it decrypts and encrypts locally: the
server only ever sees ciphertext.

## Install

Choose the skills directory for your agent platform:

| Platform | Directory |
| --- | --- |
| ZCode / DSH | `~/.agents/skills/liteprivatenav` |
| Claude Code | `~/.claude/skills/liteprivatenav` |
| Codex | `~/.codex/skills/liteprivatenav` |
| Pi | `~/.pi/agent/skills/liteprivatenav` |
| OpenClaw | `~/.openclaw/skills/liteprivatenav` |
| Other | any directory on `PYTHONPATH` |

```bash
SKILLS_DIR="$HOME/.agents/skills"          # change for your platform
mkdir -p "$SKILLS_DIR/liteprivatenav" && cd "$SKILLS_DIR/liteprivatenav"
curl -fsSL https://nav.litelake.com/skill/SKILL.md          -o SKILL.md
curl -fsSL https://nav.litelake.com/skill/liteprivatenav.py -o liteprivatenav.py
curl -fsSL https://nav.litelake.com/skill/lite_crypto.py    -o lite_crypto.py
```

Requirements: Python 3.9 or newer. Windows usually provides `python` instead
of `python3`; both commands below work:

```bash
python3 --version    # or: python --version
```

The installation is stateless: update by re-running the three `curl`
commands. Credentials live in `~/.lite-lake/lite-private-nav/` and are never
overwritten by an update.

## Verify downloads

```text
SHA256 (SKILL.md)          ad9e9cb8b094729597f2cc21d30cc44c32f298ba7edb800a0491f4f71a748017
SHA256 (liteprivatenav.py) 13b9df66cdc8fffcb6225ee14614d85b8fae54a6d42f242864dab222af9c1164
SHA256 (lite_crypto.py)    d839f34b090def8a9974ddd06eaffc4d86886b2b5c68b0a2516019658c5db3ef
```

```bash
sha256sum SKILL.md liteprivatenav.py lite_crypto.py   # Windows: certutil -hashfile <file> SHA256
```

The values above are computed from the exact bytes your deployment serves for
this host, so they differ between the `.cn` and `.com` domains when the base
URL differs. Re-check them from `/docs/skill.md` on the same origin.

## Configure

```text
~/.lite-lake/lite-private-nav/
├── master.key      # you create this: the master password, one line (encrypted mode only)
├── config.json     # written by login: base_url, api_key, sub, key_id, key_name, scope
└── state.json      # written by login: mode, kdf, verifier_version, wrapped_dek
```

Create the configuration directory and (only for an encrypted vault) the
master password file yourself:

```bash
mkdir -p ~/.lite-lake/lite-private-nav
chmod 700 ~/.lite-lake/lite-private-nav
# Ask the user to put the master password into this file (one line).
# Never echo it, never paste it into a chat.
chmod 600 ~/.lite-lake/lite-private-nav/master.key
```

Plaintext vaults do not need `master.key`. Get an API key from the web app:
**Settings → API & Skill → create key** with `read_write` scope (or `read`
for a read-only agent). Store it in an environment variable or pass it on
stdin:

```bash
printf '%s\n' "$LITEPRIVATENAV_API_KEY" | python3 liteprivatenav.py --api-key-stdin login
```

`login` validates the key, reads the vault status, derives the KEK from the
master password, unlocks the vault and unwraps the DEK in memory. It writes
`config.json` + `state.json`; it never stores the master password, the KEK or
the DEK.

## Self-check

```bash
python3 liteprivatenav.py doctor --offline
```

This checks the Python version, the built-in AES-GCM/PBKDF2/HKDF test vectors,
the configuration directory, file permissions and whether `master.key` /
the API key exist (presence only). With network access,
`python3 liteprivatenav.py doctor` additionally checks the API, the vault, the
key scope and skill/protocol compatibility with
`https://nav.litelake.com/api/open/version`.

## Use

Agents should use `--json` (stdout is exactly one JSON document). Global flags
are accepted before or after the subcommand.

```bash
python3 liteprivatenav.py --json status
python3 liteprivatenav.py --json limits
python3 liteprivatenav.py --json categories list
python3 liteprivatenav.py --json categories create --name "Work"
python3 liteprivatenav.py --json links list --limit 100
python3 liteprivatenav.py --json links create --url https://example.com --category <id>
python3 liteprivatenav.py --json links update <link-id> --title "New title"
python3 liteprivatenav.py --json links move <link-id> --category <id>
python3 liteprivatenav.py --json links delete <link-id> --yes
python3 liteprivatenav.py --json layout --file layout.json
python3 liteprivatenav.py --json metadata https://example.com --create
python3 liteprivatenav.py --json snapshot
python3 liteprivatenav.py export --output ~/nav-backup.json
python3 liteprivatenav.py --json import ~/bookmarks.html
```

`--version` prints `liteprivatenav-skill 1.0.0`.

## Update

```bash
python3 liteprivatenav.py --version
curl -fsSL https://nav.litelake.com/docs/skill.md | head -20
```

If the published `Current version` is newer, re-run the three `curl` commands
from the install section. Your `~/.lite-lake/lite-private-nav/` configuration
is preserved.

## Security

- Never print or log `master.key`, the API key, the KEK, the DEK or
  `wrapped_dek`, and never put them into a model prompt or chat message.
- Pass secrets as file paths or stdin only.
- Confirm destructive actions (delete, bulk changes) with the user first.
- Export files contain plaintext bookmarks; warn the user and do not upload
  them.
- The AES implementation is table-based and not strictly constant-time; the
  threat model is a trusted local machine.
- Serve everything over HTTPS and verify the sha256 values above when
  installing manually.
