@aryasaatvik/scratchpad 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## @aryasaatvik/scratchpad@0.6.2
2
+
3
+ ### Treat `codemaps/` as part of the default notes layout
4
+
5
+ `scratchpad doctor` no longer reports `.scratchpad/codemaps/` as an out-of-layout folder. The
6
+ embedded `scratchpad` skill now matches the default layout (top-level `handoffs/`, `decisions/`,
7
+ `delivery/`, `artifacts/`, `codemaps/`, `STATE.md`), documents `SCRATCHPAD_CLASSIFIER=none`, and
8
+ lists the exact default closed statuses.
9
+
10
+ ## @aryasaatvik/scratchpad@0.6.1
11
+
12
+ ### Index notes with more than 1024 chunks
13
+
14
+ `scratchpad search` and `scratchpad index` failed with "Too many docs: N exceeds max write batch
15
+ size of 1024" when one note, or one cleanup pass, touched more than 1024 vector chunks. Vector
16
+ writes and deletes now go to zvec in batches of at most 1024.
17
+
1
18
  ## @aryasaatvik/scratchpad@0.6.0
2
19
 
3
20
  ### Note lifecycle: sweep, review, and hybrid search
package/README.md CHANGED
@@ -1,27 +1,14 @@
1
1
  # Scratchpad
2
2
 
3
- Local-first project tracking through Markdown files backed by provider services,
4
- plus hosted immutable artifacts, unlisted file uploads, and local architecture
5
- codemaps. Issues and milestones are projected to Markdown with typed YAML front
6
- matter; the first provider is GitHub. Artifacts and uploads target a deployed
7
- Worker (for example `scratchpad.arya.sh`). Codemaps stay on disk under
8
- `.scratchpad/codemaps/`.
3
+ Working memory for coding agents: project notes shared across worktrees, instruction feedback,
4
+ note search and lifecycle cleanup, plus GitHub backlog sync, hosted artifacts and codemaps.
9
5
 
10
- Status: 0.2.1. Scratchpad is Bun-first.
11
-
12
- ## Packages
13
-
14
- - `packages/core`: domain model, front matter codecs, SQLite projection store,
15
- the `Provider` seam (GitHub + in-memory layers), sync engine, watcher, artifact
16
- client contracts, and codemap schemas.
17
- - `packages/cli`: the `scratchpad` command tree, config discovery, and XDG paths.
18
- - `apps/worker`: Cloudflare Worker for the hosted catalog, review UI, HTML
19
- renderer, and unlisted uploads.
20
- - `examples/basic`: minimal local-first project with sample issue and milestone
21
- files.
22
-
23
- The SQLite store builds on drizzle-orm's native `effect-sqlite-bun` integration
24
- (`drizzle-orm/effect-sqlite-bun`).
6
+ Each project has one notes root: the checkout's `.scratchpad`, else the primary checkout's, else
7
+ `$XDG_DATA_HOME/scratchpad/projects/<project-id>`. Worktrees share it when their `.scratchpad` is a
8
+ symlink to the primary's (`wt` creates one); a real worktree-local `.scratchpad` is separate. Agent
9
+ skills are embedded in the CLI (`scratchpad skills get scratchpad`), and a deterministic CLI does
10
+ the filing, searching, and cleanup around them. Models only classify and embed, and every command
11
+ works without them.
25
12
 
26
13
  ## Install
27
14
 
@@ -31,14 +18,8 @@ Run with Bun 1.4.4 or newer:
31
18
  bunx @aryasaatvik/scratchpad --help
32
19
  ```
33
20
 
34
- Or install the checksummed standalone binary without Bun:
35
-
36
- ```sh
37
- curl -fsSL https://github.com/aryasaatvik/scratchpad/releases/latest/download/install.sh | sh
38
- ```
39
-
40
- While the repository is private, fetch the installer through the GitHub CLI instead; it then
41
- downloads the release with the same signed-in `gh`:
21
+ Or install the checksummed standalone binary without Bun. The repository is private, so the
22
+ installer is fetched with the signed-in GitHub CLI, which then downloads the release the same way:
42
23
 
43
24
  ```sh
44
25
  gh release download --repo aryasaatvik/scratchpad --pattern install.sh --output - | sh
@@ -52,380 +33,94 @@ bun run dev:prepare
52
33
  bun run cli -- --help
53
34
  ```
54
35
 
55
- ## Quickstart
56
-
57
- In a project directory:
58
-
59
- ```sh
60
- bunx @aryasaatvik/scratchpad init
61
- ```
62
-
63
- Edit `scratchpad.config.ts` and set `repo` to `owner/name`, then pull GitHub
64
- issues and milestones into Markdown:
65
-
66
- ```sh
67
- bunx @aryasaatvik/scratchpad pull
68
- ```
69
-
70
- Make local edits under the configured `.scratchpad/backlog` mount, then preview
71
- and apply the provider updates:
72
-
73
- ```sh
74
- bunx @aryasaatvik/scratchpad push --dry-run
75
- bunx @aryasaatvik/scratchpad push
76
- ```
77
-
78
- Auth resolves `GITHUB_TOKEN` / `GH_TOKEN`, then `gh auth token`.
79
-
80
- ## Example
81
-
82
- The repo includes a basic example:
83
-
84
- ```sh
85
- cd examples/basic
86
- bun run status
87
- bun run plan
88
- ```
89
-
90
- `plan` runs `scratchpad push --dry-run`, so it shows the GitHub create operations
91
- Scratchpad would perform without calling the provider.
92
-
93
- ## CLI
94
-
95
- ### Backlog sync
96
-
97
- ```
98
- scratchpad init # scaffold scratchpad.config.ts + mount dirs + local store
99
- scratchpad status # repo, mounts, pending pushes, open conflicts
100
- scratchpad pull # GitHub -> Markdown files (incremental, by cursor)
101
- scratchpad push # queued local changes -> GitHub
102
- scratchpad sync # pull then push
103
- scratchpad watch # daemon: turn local file edits into queued changes
104
- scratchpad repair # resolve conflicts (interactive, or --take-local/--take-remote)
105
- scratchpad delete # explicitly delete a mapped remote issue/milestone (--remote)
106
- ```
107
-
108
- `pull` / `push` / `sync` accept `--dry-run`, which prints the planned actions
109
- without mutating files, the queue, or the provider.
110
-
111
- Deleting a tracked backlog file is non-destructive remotely: `push` closes the
112
- issue or archives the milestone. Hard provider deletion is deliberately
113
- separate: `scratchpad delete --file <path> --remote` deletes the mapped remote
114
- object, removes the local file, and removes the projection mapping. Live remote
115
- deletes require `--yes` or an interactive TTY confirmation; `--dry-run` reports
116
- the planned delete without mutating anything.
117
-
118
- Backlog files follow the Scratchpad skill's contract: `status` is free text in
119
- the repository's own vocabulary, the title is the first `# ` heading, and
120
- `milestone` / `depends_on` are paths relative to the file that contains them, so issues
121
- and milestones may be nested in subfolders of `backlog/issues/` and `backlog/milestones/`. A status whose first word is in
122
- `backlog.closedStatuses` (default `done`, `complete(d)`, `closed`, `merged`,
123
- `landed`, `delivered`, `cancel(l)ed`, `superseded`, `implemented`, `historical`,
124
- `moved`) syncs as closed; anything else is open. Files in the older shape
125
- (`title`, `state: open|closed` in front matter) still read, and are rewritten in
126
- the new shape on the next sync.
127
-
128
- ### Agent notes
129
-
130
- These commands need no config. They work on the project's notes root: the
131
- checkout's `.scratchpad`, else the primary checkout's, else
132
- `$XDG_DATA_HOME/scratchpad/projects/<project-id>` (project id = the origin
133
- remote, e.g. `github.com/owner/repo`).
134
-
135
- ```
136
- scratchpad path [--global] [--real] # print the notes root; --real resolves symlinks
137
- scratchpad doctor # project id, layout drift, store, token
138
- scratchpad skills list | path # skills embedded in this CLI
139
- scratchpad skills get <name> [--full | --ref <reference>]
140
- scratchpad backlog new <issue|milestone> "<title>" [--milestone <slug>] [--depends-on <path>]
141
- scratchpad backlog validate | graph # decode, check fields, links and cycles; show the tree
142
- scratchpad feedback new "<text>" [--global] [--harness <h>] [--model <m>] [--session <id>]
143
- scratchpad feedback normalize [--global] [--dry-run] [--json]
144
- scratchpad feedback review [--global] [--classify] [--json]
145
- scratchpad feedback list [--global] [--status <s>] [--disposition <d>]... [--all]
146
- scratchpad feedback resolve <id|file|path> --disposition <d> --review <name|path> [--evidence <e>]...
147
- scratchpad route "<correction>" [--write] [--json]
148
- scratchpad archive <paths...> --reason "<why>" # move notes or directories to the OS Trash
149
- scratchpad review [paths...] [--apply] [--json] [--limit 100] # classify notes; --apply writes review metadata
150
- scratchpad sweep [--apply] [--json] # preview expired artifacts; --apply moves them to Trash
151
- ```
152
-
153
- `scratchpad skills get scratchpad` prints the agent skill that drives these commands; its source is
154
- [`packages/cli/skill-data/scratchpad/`](packages/cli/skill-data/scratchpad/). Outside a Git
155
- repository the project id is local to the directory. `--global` feedback lives in `~/.scratchpad`
156
- (override with `SCRATCHPAD_GLOBAL_HOME`).
36
+ ## Agent quickstart
157
37
 
158
- `path` keeps the selected notes path by default, including a worktree's `.scratchpad` symlink.
159
- Use `path --real` when an agent needs the physical storage path for writes. It preserves the same
160
- plain-text or JSON output shape, works with `--global`, and fails if the selected root is missing
161
- or inaccessible; it never creates the directory.
162
-
163
- `doctor` checks the notes root's top-level entries against `layout` in `scratchpad.config.ts`.
164
- It reports unlisted folders and loose files, without moving them or inspecting nested layout.
165
- The JSON report adds `layout` with `folders`, `files`, `rootExists`, `outOfLayoutFolders`, and
166
- `looseFiles`. A missing notes root is reported without creating it. Omitted lists use the defaults:
167
-
168
- - Folders: `backlog`, `research`, `reference`, `feedback`, `handoffs`, `decisions`, `delivery`,
169
- `maintenance`, `artifacts`.
170
- - Files: `README.md`, `STATE.md`.
171
-
172
- `archive` retires local notes to the operating system's Trash and appends receipts to
173
- `maintenance/trash-log.md`. It no longer creates dated directories under `archive/`.
174
- `sweep` previews expired artifacts with byte totals; `--apply` moves eligible entries to Trash
175
- and records receipts. Trash uses `/usr/bin/trash` on macOS and `gio trash` on Linux; other platforms report an unsupported-platform error. Each move first writes and flushes a `pending` receipt, then appends `trashed`, `failed`, or `skipped-changed` with the same id. An unmatched pending receipt means the operation needs reconciliation against the source and OS Trash; do not automatically retry it. A later failure does not undo earlier moves. Markdown and HTML files are notes, so artifact expiry does not remove them.
176
- Existing `archive/` contents may contain expired artifacts. Unwritable entries are reported as
177
- refused, allowing other eligible entries to proceed. This local-note lifecycle is separate from
178
- the optional read-only GitHub archive mount described below.
179
-
180
- `sweep --json` emits version 1 of the report: `version: 1`, `apply`, `groups`, `totalBytes`,
181
- `refused`, `warningCount`, and `trashed`. Each group contains `source`, `entries`, and `bytes`;
182
- entries contain `path`, `bytes`, `reason`, and `source`. Refused entries contain `path` and
183
- `reason`; `trashed` contains the entries successfully moved by an apply run. Paths are relative to
184
- the real notes root, bytes are file sizes, and `totalBytes` sums eligible entries (excluding refusals).
185
- Groups are ordered by source and entries by path. Dry runs have an empty `trashed` array.
186
- Refusals produce warnings and exit 0. Artifact windows use mtime (strictly older than the window);
187
- the last matching override wins. Relative Markdown/HTML links (including linked directories) and
188
- `lifecycle.protect` globs protect artifacts. Symlinks are not traversed or swept.
189
-
190
- Note lifecycle review uses the same OpenRouter decision model as routing. Paths are relative to
191
- the resolved notes root. The dry run reports kind, verdict (`fresh`, `stale`, `superseded`,
192
- `expired`), confidence, repository evidence, cache hits, calls, and provider token usage.
193
- `review --apply` updates only lifecycle front matter, preserving unknown YAML and body bytes.
194
- Existing front matter remains reviewable: unrecognized lifecycle values are preserved verbatim,
195
- treated as absent in the normalized view, and supplied as field-local lifecycle evidence.
196
- Only lifecycle keys enter that fallback; unrelated front matter is never copied into it.
197
- Sensitive key values, including block scalars, are masked structurally before model serialization.
198
- Local reference checks use the complete original bytes, including YAML comments and non-mapping
199
- headers. The model receives a separate redacted lifecycle projection; local inbound links still
200
- protect targets on cached reviews.
201
- Non-finite and cyclic legacy values use JSON-safe representations; their original YAML is preserved.
202
- `metadataWarnings` identifies each field and redacted value; only unparseable YAML is skipped.
203
- Recognized lifecycle dates use ISO dates or timestamps.
204
- Only regular Markdown/HTML files inside the notes root can be reviewed. HTML is dry-run only;
205
- `--apply` accepts Markdown and uses a locked, checked atomic replacement. Configured issue,
206
- milestone and archive-projection mounts are excluded by physical path, wherever they live.
207
- Review-only metadata writes preserve mtime, so reviewing an old note does not make it newly fresh.
208
- Declared kind corrections invalidate the cache; generated review metadata does not.
209
- Confidence is exactly the Decisions API probability of the chosen lifecycle label, independent
210
- of kind probability and the provider's separate confidence metric. Full per-label probabilities
211
- are returned in `notes[].reviewed.probabilities` and cached with the review. Question revisions
212
- invalidate old verdicts. The default auto-trash threshold remains 0.9.
213
- Backlog and feedback retain their own schemas.
214
-
215
- ```ts
216
- lifecycle: {
217
- notes: { autoTrashConfidence: 0.9, minFreshDays: 7, estimatedCostPerCall: 0.001 },
218
- protect: ["decisions/**"],
219
- }
220
- ```
221
-
222
- OpenRouter-reported cost is used when available, including zero-cost responses. Missing costs
223
- fall back to calls × `estimatedCostPerCall` in USD and are labeled estimates; the default is a
224
- configurable budget placeholder, not a provider quote. Mixed runs report the measured subtotal
225
- and number of estimated calls separately. Cache hits incur no new model cost. Verdicts are cached in the
226
- project state database by content, evidence and model. Age changes or repository changes
227
- invalidate the cache. `sweep` consumes only current cached stale/superseded verdicts and never
228
- calls the model. It protects README/STATE indexes, backlog/feedback, recently updated notes,
229
- notes linked from a non-stale note, and configured protect globs. Expired model verdicts alone
230
- do not auto-trash notes. With the classifier disabled, review exits successfully with a clear
231
- message and sweep handles artifacts only.
232
-
233
- The classifier uses OpenRouter's Decisions API with pinned default model `typesafe/jev-1.14`.
234
- Users may select the moving `~typesafe/jev-latest` alias through `classifier.model`. Decision
235
- models are listed by `GET https://openrouter.ai/api/v1/models?output_modalities=decisions`;
236
- chat-completion model IDs are a separate catalog.
237
- Classification and search embeddings share one OpenRouter key. Store it in
238
- `$XDG_CONFIG_HOME/scratchpad/secrets/openrouter-api-key` (default
239
- `~/.config/scratchpad/secrets/openrouter-api-key`), or set `SCRATCHPAD_OPENROUTER_API_KEY` to override it.
240
- Keep the secrets directory private (`0700`) and the key file readable only by its owner (`0600`).
241
- Relative `XDG_CONFIG_HOME` values are ignored. Optionally choose a model
242
- with `SCRATCHPAD_CLASSIFIER` or `classifier.model` in `scratchpad.config.ts`
243
- (`SCRATCHPAD_CLASSIFIER=none` or `classifier.model: "none"` disables it). Model overrides name
244
- OpenRouter model IDs. Feedback is redacted before it is
245
- sent for classification. Feedback files are written first, and classifier
246
- failures never block or undo those writes.
247
-
248
- Every checkout of a project whose mounts resolve to the same files (for example
249
- `wt` worktrees linking `.scratchpad` to the primary) shares one local store.
250
-
251
- ### Search notes
38
+ These commands need no config. Run them in any project directory or worktree.
252
39
 
253
40
  ```sh
254
- scratchpad index --rebuild --json
255
- scratchpad search "deployment decision" --limit 10 --kind decision --json
256
- scratchpad search "instruction feedback" --global
257
- ```
258
-
259
- Search scans the resolved project's Markdown notes before every query, including edits and
260
- removals. `--kind` matches front matter `kind` exactly; notes without a kind are excluded when
261
- filtering. Results include the physical path, heading, snippet and reciprocal rank fusion score.
262
- `--global` also includes `feedback/` under `SCRATCHPAD_GLOBAL_HOME` (default `~/.scratchpad`).
263
-
264
- Without credentials, commands use SQLite FTS5 and print a notice on stderr (also included in
265
- JSON). Hybrid search shares the classifier's OpenRouter key: set `SCRATCHPAD_OPENROUTER_API_KEY` or put it in
266
- `$XDG_CONFIG_HOME/scratchpad/secrets/openrouter-api-key` (default `~/.config/...`), with mode
267
- `0600`. Hybrid indexing sends note title, heading and chunk text to OpenRouter's
268
- `qwen/qwen3-embedding-8b` model at 1024 dimensions; queries are sent there too. To opt out even
269
- when a key is present, set `search: { embeddings: false }` in `scratchpad.config.ts`.
270
- Config discovery walks upward, so ancestor opt-outs apply too.
271
-
272
- The rebuildable index lives in `$XDG_STATE_HOME/scratchpad/<project hash>/search/`, beside the
273
- project sync database. Private (`0700`) caches are separated by the selected physical notes roots,
274
- so toggling `--global` or switching worktrees retains each scope’s index. `index --rebuild`
275
- recreates that scope’s text and vector stores, including corrupt stores. A concurrent refresh or
276
- native writer returns a busy error; retry after the other operation exits. Linux x64 vector
277
- search requires an AVX2-capable CPU. Ordinary FTS-only search does not load native bindings.
278
- Rebuilding a scope with existing vector state briefly loads zvec to check that no native reader or writer has it open, even without a key.
279
-
280
- ### Artifacts
281
-
282
- Hosted immutable Markdown/HTML revisions with review, share, Trash, and
283
- export/import. Requires a deployment profile (or `--url` on each command).
284
-
285
- ```
286
- scratchpad artifact profile set <name> --url <https://…> [--default]
287
- scratchpad artifact push <path> --slug <slug> [--kind delivery] [--review] [--wait]
288
- scratchpad artifact list | show <slug>
289
- scratchpad artifact open <slug>
290
- scratchpad artifact wait <slug> --json
291
- scratchpad artifact share | unshare <slug>
292
- scratchpad artifact delete | restore <slug>
293
- scratchpad artifact prune --slug <slug> # or --sweep-orphans for abandoned uploads
294
- scratchpad artifact pull <slug> [--revision <n>]
295
- scratchpad artifact export | import <zip>
296
- scratchpad artifact annotations <slug>
297
- scratchpad artifact resolve <slug> <ordinal> [--dismiss|--reopen] [--reply <text>]
298
- ```
299
-
300
- Profiles live at `$XDG_CONFIG_HOME/scratchpad/deployments.json` and may include
301
- Cloudflare Access service-token fields for non-interactive CLI auth. See
302
- [`docs/deploy.md`](docs/deploy.md) for the Worker and Access bypass rules, and
303
- [`docs/production-smoke.md`](docs/production-smoke.md) for an end-to-end checklist.
304
-
305
- ### Codemaps
306
-
307
- Local, evidence-backed architecture maps. Canonical JSON plus a self-contained
308
- HTML viewer live under ignored `.scratchpad/codemaps/<name>/<timestamp>/`. No Worker
309
- profile is required.
310
-
311
- ```
312
- scratchpad skills get codemap # print the bundled producer skill
313
- scratchpad codemap create --name <name> --input <draft.json>
314
- scratchpad codemap validate --name <name> [--snapshot <ts>]
315
- scratchpad codemap render --name <name> [--snapshot <ts>]
316
- scratchpad codemap list [--name <name>] [--json]
317
- scratchpad codemap open --name <name> [--snapshot <ts>] [--editor auto|code|cursor|zed]
318
- ```
319
-
320
- Typical flow: emit the producer skill, have an agent write a `CodemapDraft`, create
321
- the bundle, then open the newest snapshot on a secured loopback session. Source
322
- clicks use a per-session token to open paths inside the scanned repository only.
323
- Validation reports `fresh` / `stale` / `unverifiable` against the current HEAD
324
- and dirty fingerprint; stale snapshots still open with a warning.
325
-
326
- ### Uploads
327
-
328
- Unlisted public file URLs (for example PR screenshots) on the same Worker as
329
- artifacts. Also require a profile or `--url`.
330
-
331
- ```
332
- scratchpad upload <file...> [--name <name>] [--ttl-days <n>] [--profile <name>]
333
- scratchpad upload <file> --resume <session-id> # repeat the original name/type/TTL options
334
- scratchpad uploads list [--json]
335
- scratchpad uploads delete <id>
336
- ```
337
-
338
- Files up to 1 GiB can be uploaded from the CLI or Files view. The existing
339
- single-request path handles files up to 100 MiB; larger files stream through
340
- the Worker in 32 MiB parts. A public link appears only after R2 verifies the
341
- whole file's SHA-256. Browser hashing reads bounded slices, and text previews
342
- keep their separate 100 MiB ceiling.
343
-
344
- Multipart sessions expire after 24 hours, or earlier if their `--ttl-days`
345
- deadline passes. Requests retry transient failures without duplicating the
346
- link. If a part's storage result is ambiguous, cancellation and a fresh upload
347
- are safer than replacing a possibly in-flight part. Completion receipts let
348
- API callers retry completion with the same session ID after a lost response.
349
- The CLI's `--resume` flag resumes one unchanged file with its original options
350
- and authenticated identity. Browser uploads retry in-process; they do not
351
- persist a resumable session across page reloads.
352
- `artifact prune --sweep-orphans` retries staging cleanup and removes old,
353
- cleaned session records. See [the multipart upload design](docs/adr/0009-worker-multipart-uploads.md).
354
-
355
- Uploaded bodies are served under `/f/*`. With `--ttl-days`, a link expires that
356
- many days after registration, stops serving, and disappears from upload listings.
357
- Expiring links use `Cache-Control: no-store` so subsequent requests recheck the
358
- expiration; links without a TTL retain their one-year immutable caching policy.
359
- Expiration cannot revoke copies already downloaded or responses cached under an
360
- older cache policy.
361
-
362
- Expiration is logical, not immediate storage deletion. Run
363
- `artifact prune --sweep-orphans` to remove expired upload records and reclaim
364
- unreferenced blobs after the orphan grace period. Blobs shared by another upload
365
- or artifact remain available to that reference. Soft-deleted artifacts go to
366
- Trash via `artifact delete`.
41
+ scratchpad path # where this project's notes live
42
+ scratchpad doctor # project id, layout drift, store, token
43
+ scratchpad skills get scratchpad # the agent skill that drives these commands
44
+ scratchpad feedback new "<what went wrong>" # record instruction feedback
45
+ scratchpad search "deployment decision" # hybrid text and vector search over notes
46
+ scratchpad review # classify notes against repository evidence
47
+ scratchpad sweep # preview what would move to Trash
48
+ ```
49
+
50
+ `review --apply` writes lifecycle front matter and `sweep --apply` moves files to the OS Trash;
51
+ run both without `--apply` first. `archive <paths>` moves files to the Trash immediately. Run
52
+ `scratchpad init` only in projects that want a `scratchpad.config.ts` or GitHub backlog sync.
53
+
54
+ ## What it does
55
+
56
+ - **Notes and layout.** Notes root resolution, worktree sharing, `path --real`, `doctor` layout
57
+ checks, embedded skills. See [docs/notes.md](docs/notes.md).
58
+ - **Instruction feedback and routing.** `feedback new|review|list|resolve` and `route` record
59
+ corrections, with an optional OpenRouter classifier and redaction. Files are written first. See
60
+ [docs/feedback.md](docs/feedback.md).
61
+ - **Search.** `index` and `search` build a rebuildable SQLite FTS5 plus vector index. Without a key
62
+ they fall back to text only. See [docs/search.md](docs/search.md).
63
+ - **Lifecycle.** `review`, `sweep`, and `archive` retire stale notes and expired artifacts to the
64
+ OS Trash with receipts. `sweep` previews unless `--apply`; `archive` acts immediately. See [docs/lifecycle.md](docs/lifecycle.md).
65
+ - **Backlog sync with GitHub.** Issues and milestones as Markdown with typed front matter, pulled
66
+ and pushed by `pull`, `push`, `sync`, and `watch`. See
67
+ [docs/backlog-sync.md](docs/backlog-sync.md).
68
+ - **Artifacts and uploads.** A hosted Worker at `https://scratchpad.arya.sh` serves immutable
69
+ Markdown/HTML artifacts with review, and unlisted file uploads up to 1 GiB. See
70
+ [docs/artifacts.md](docs/artifacts.md).
71
+ - **Codemaps.** Local, evidence-backed architecture maps with a self-contained viewer. See
72
+ [docs/codemaps.md](docs/codemaps.md).
367
73
 
368
74
  Most commands accept `--json` for machine-readable output.
369
75
 
370
76
  ## Config
371
77
 
372
- `scratchpad.config.ts` at the project root:
78
+ `scratchpad.config.ts` at the project root is optional for notes and required for backlog sync:
373
79
 
374
80
  ```ts
375
81
  export default {
376
82
  repo: "owner/name",
377
- // Optional: each list replaces the corresponding built-in layout list.
378
- layout: {
379
- folders: ["backlog", "research", "maintenance", "artifacts"],
380
- files: ["README.md", "STATE.md"],
381
- },
382
- lifecycle: {
383
- artifacts: {
384
- maxAgeDays: 14,
385
- overrides: [{ path: "artifacts/sre/**", maxAgeDays: 30 }],
386
- },
387
- protect: ["artifacts/keep/**"],
388
- },
83
+ lifecycle: { protect: ["decisions/**"] },
389
84
  mounts: [
390
85
  {
391
86
  provider: "github",
392
87
  issues: ".scratchpad/backlog/issues",
393
88
  milestones: ".scratchpad/backlog/milestones",
394
- // Optional: project recently-closed objects to a read-only archive.
395
- archive: {
396
- issues: ".scratchpad/archive/issues",
397
- milestones: ".scratchpad/archive/milestones",
398
- closedWithinDays: 7,
399
- },
400
89
  },
401
90
  ],
402
91
  };
403
92
  ```
404
93
 
405
- The backlog mount holds open work only. With an optional `archive` block, objects
406
- closed within `closedWithinDays` project to a separate read-only mount (older
407
- closures project nowhere, and aged-out files are pruned on the next `pull`).
408
- Editing or deleting an archived file does nothing — only the backlog mount is
409
- writable. See [ADR 0005](docs/adr/0005-closed-object-archive.md).
94
+ See [docs/configuration.md](docs/configuration.md) for every key and environment variable.
95
+ Classification, lifecycle review, and search embeddings share one OpenRouter key, read from
96
+ `SCRATCHPAD_OPENROUTER_API_KEY` or `~/.config/scratchpad/secrets/openrouter-api-key` (mode `0600`).
410
97
 
411
- Remote deletion is available only through the explicit `delete --remote` command,
412
- not through filesystem removal. See [ADR 0007](docs/adr/0007-explicit-remote-delete.md).
98
+ ## Docs
413
99
 
414
- Auth resolves `GITHUB_TOKEN` / `GH_TOKEN`, then `gh auth token`. The SQLite store
415
- lives under `$XDG_STATE_HOME/scratchpad/<project-hash>/store.db`, never in the repo.
100
+ - [Notes root and layout](docs/notes.md)
101
+ - [Instruction feedback and routing](docs/feedback.md)
102
+ - [Search](docs/search.md)
103
+ - [Note lifecycle](docs/lifecycle.md)
104
+ - [Backlog sync with GitHub](docs/backlog-sync.md)
105
+ - [Artifacts and uploads](docs/artifacts.md)
106
+ - [Codemaps](docs/codemaps.md)
107
+ - [Configuration](docs/configuration.md)
108
+ - [Worker deploy](docs/deploy.md) and [production smoke checklist](docs/production-smoke.md)
109
+ - [Release](docs/release.md)
110
+ - [Web UI design system](DESIGN.md)
111
+ - [Architecture decision records](docs/adr/README.md)
416
112
 
417
- ## Design
113
+ ## Packages
418
114
 
419
- Architecture decisions are tracked in [`docs/adr/`](docs/adr/). The runtime is
420
- Bun + Effect v4; SQLite is local durability (mappings, cursors, outbox, conflicts),
421
- not product truth — the Markdown files and the provider are the system of record
422
- for backlog sync. Hosted artifacts are immutable presentation and review surfaces
423
- over that execution graph; local codemaps are ignored working memory until an
424
- explicit later publish path exists.
115
+ - `packages/core`: domain model, front matter codecs, SQLite projection store, the `Provider`
116
+ seam, sync engine, artifact client contracts, and codemap schemas.
117
+ - `packages/cli`: the `scratchpad` command tree, config discovery, XDG paths, and embedded skills.
118
+ - `apps/worker`: Cloudflare Worker for the hosted catalog, review UI, HTML renderer, and uploads.
119
+ - `examples/basic`: minimal project with sample issue and milestone files.
425
120
 
426
121
  ## Development
427
122
 
428
- ```
123
+ ```sh
429
124
  bun install
430
125
  bun run dev:prepare
431
126
  bun run check # format + lint + typecheck + tests
@@ -435,7 +130,5 @@ bun run test:worker-integration # ephemeral Worker + paired HTML bridge; require
435
130
 
436
131
  ## Release
437
132
 
438
- The npm package is `@aryasaatvik/scratchpad`. See
439
- [`docs/release.md`](docs/release.md) for the preflight, publish, public
440
- repository, and tag checklist. Worker deploy steps live in
441
- [`docs/deploy.md`](docs/deploy.md).
133
+ The npm package is `@aryasaatvik/scratchpad`. See [docs/release.md](docs/release.md) for the
134
+ preflight, publish, and tag checklist. Worker deploy steps live in [docs/deploy.md](docs/deploy.md).