@aryasaatvik/scratchpad 0.6.1 → 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 +9 -0
- package/README.md +71 -378
- package/dist/scratchpad.js +61 -33
- package/docs/adr/0003-github-provider-seam.md +7 -0
- package/docs/adr/0008-cli-decision-model.md +2 -1
- package/docs/adr/0010-openrouter-decisions-and-note-lifecycle.md +71 -0
- package/docs/adr/0011-trash-instead-of-archive-folders.md +46 -0
- package/docs/adr/0012-local-hybrid-search.md +46 -0
- package/docs/adr/README.md +4 -1
- package/docs/artifacts.md +79 -0
- package/docs/backlog-sync.md +97 -0
- package/docs/codemaps.md +28 -0
- package/docs/configuration.md +127 -0
- package/docs/deploy.md +75 -0
- package/docs/feedback.md +71 -0
- package/docs/lifecycle.md +126 -0
- package/docs/notes.md +83 -0
- package/docs/production-smoke.md +75 -0
- package/docs/release.md +3 -3
- package/docs/search.md +48 -0
- package/package.json +3 -4
package/dist/scratchpad.js
CHANGED
|
@@ -29719,7 +29719,8 @@ var DEFAULT_LAYOUT = {
|
|
|
29719
29719
|
"decisions",
|
|
29720
29720
|
"delivery",
|
|
29721
29721
|
"maintenance",
|
|
29722
|
-
"artifacts"
|
|
29722
|
+
"artifacts",
|
|
29723
|
+
"codemaps"
|
|
29723
29724
|
],
|
|
29724
29725
|
files: ["README.md", "STATE.md"]
|
|
29725
29726
|
};
|
|
@@ -51973,8 +51974,8 @@ var bundleHtml = async (options) => {
|
|
|
51973
51974
|
// package.json
|
|
51974
51975
|
var package_default = {
|
|
51975
51976
|
name: "@aryasaatvik/scratchpad",
|
|
51976
|
-
version: "0.6.
|
|
51977
|
-
description: "
|
|
51977
|
+
version: "0.6.2",
|
|
51978
|
+
description: "Working memory for coding agents: project notes shared across worktrees, instruction feedback, note search and lifecycle cleanup, plus GitHub backlog sync, hosted artifacts and codemaps.",
|
|
51978
51979
|
keywords: [
|
|
51979
51980
|
"bun",
|
|
51980
51981
|
"cli",
|
|
@@ -52013,8 +52014,7 @@ var package_default = {
|
|
|
52013
52014
|
"LICENSE",
|
|
52014
52015
|
"CHANGELOG.md",
|
|
52015
52016
|
"SECURITY.md",
|
|
52016
|
-
"docs
|
|
52017
|
-
"docs/release.md"
|
|
52017
|
+
"docs"
|
|
52018
52018
|
],
|
|
52019
52019
|
type: "module",
|
|
52020
52020
|
publishConfig: {
|
|
@@ -56121,8 +56121,9 @@ nested files the same way.
|
|
|
56121
56121
|
- Treat GitHub as authoritative for PR state and Scratchpad as the planning-to-delivery map.
|
|
56122
56122
|
- In a project with a \`scratchpad.config.ts\`, \`scratchpad sync\` also mirrors these files to GitHub
|
|
56123
56123
|
issues and milestones. A status whose first word is in the config's \`backlog.closedStatuses\`
|
|
56124
|
-
(default: done, complete
|
|
56125
|
-
implemented, historical, moved) syncs as closed. Preview with
|
|
56124
|
+
(default: done, complete, completed, closed, merged, landed, delivered, cancelled, canceled,
|
|
56125
|
+
superseded, implemented, historical, moved) syncs as closed. Preview with
|
|
56126
|
+
\`scratchpad sync --dry-run\` first.
|
|
56126
56127
|
- Keep completed material active while it is useful for delivery; retire it through this skill's
|
|
56127
56128
|
\`archive\` mode (a Trash move with a receipt) when it no longer supports current work.
|
|
56128
56129
|
|
|
@@ -56166,10 +56167,10 @@ For multi-worktree or multi-harness work:
|
|
|
56166
56167
|
releasing the worker lease or removing its worktree.
|
|
56167
56168
|
|
|
56168
56169
|
For durable user-visible tasks, the coordinator owns one Markdown-table registry at
|
|
56169
|
-
\`.scratchpad/
|
|
56170
|
-
|
|
56171
|
-
|
|
56172
|
-
|
|
56170
|
+
\`.scratchpad/handoffs/task-registry.md\`; it records the stable task ID/title, stream, current
|
|
56171
|
+
delivery, worktree/branch/PR, last verified base, next-ready work, exclusions, and write allowlist.
|
|
56172
|
+
Treat the registry as a recovery aid: task runtime, Git, GitHub, tests, and providers remain
|
|
56173
|
+
authoritative.
|
|
56173
56174
|
|
|
56174
56175
|
Treat coordination notes as advisory. Recheck actual worker, Git, and runtime state before assigning
|
|
56175
56176
|
or closing work.
|
|
@@ -56293,12 +56294,14 @@ reported by the harness; do not infer a model from writing style or a product na
|
|
|
56293
56294
|
|
|
56294
56295
|
### Classification
|
|
56295
56296
|
|
|
56296
|
-
When a classifier is configured (\`scratchpad doctor\` reports it
|
|
56297
|
-
|
|
56298
|
-
|
|
56299
|
-
\`
|
|
56300
|
-
|
|
56301
|
-
|
|
56297
|
+
When a classifier is configured (\`scratchpad doctor\` reports it; \`SCRATCHPAD_CLASSIFIER=none\` or
|
|
56298
|
+
\`classifier.model: "none"\` turns it off, and \`SCRATCHPAD_CLASSIFIER\` otherwise overrides the model),
|
|
56299
|
+
\`feedback new\` classifies the redacted text after writing the file and adds a \`classification\` block
|
|
56300
|
+
(\`scope\`: project, global, or tool; \`kind\`; \`actionable\`; \`confidence\`; \`model\`) to the front
|
|
56301
|
+
matter. \`status\` becomes \`classified\`, or \`review\` when confidence is below 0.7. Without a
|
|
56302
|
+
classifier, or when classification fails, the file stays \`status: new\` and the command still
|
|
56303
|
+
succeeds. Classification is triage metadata; it never edits the body and does not replace a review
|
|
56304
|
+
disposition.
|
|
56302
56305
|
|
|
56303
56306
|
\`scratchpad route "<correction>"\` asks the classifier which folder owns a correction (project, or
|
|
56304
56307
|
global for global and tool scope) and writes nothing; it fails when no classifier is configured.
|
|
@@ -56490,11 +56493,13 @@ scratchpad search "instruction feedback" --global
|
|
|
56490
56493
|
Without an embedding key, search falls back to FTS-only keyword matching and prints a notice on
|
|
56491
56494
|
stderr; it still works, so use distinctive terms. Hybrid search needs
|
|
56492
56495
|
\`SCRATCHPAD_OPENROUTER_API_KEY\` or the key in \`~/.config/scratchpad/secrets/openrouter-api-key\`
|
|
56493
|
-
(
|
|
56494
|
-
|
|
56495
|
-
|
|
56496
|
-
|
|
56497
|
-
|
|
56496
|
+
(keep it \`0600\` and its directory \`0700\`; the CLI does not check). The path honors an absolute
|
|
56497
|
+
\`$XDG_CONFIG_HOME\` (default \`~/.config\`). Never print or record the key. With a key, the note title,
|
|
56498
|
+
heading, and chunk text of every indexed note, and each query, are sent to OpenRouter
|
|
56499
|
+
(\`qwen/qwen3-embedding-8b\`). Before searching notes that hold secrets, customer data, or anything
|
|
56500
|
+
the user would not share with that provider, set \`search: { embeddings: false }\` in
|
|
56501
|
+
\`scratchpad.config.ts\` (discovered upward, including ancestor configs), which stays FTS-only even
|
|
56502
|
+
when a key is present.
|
|
56498
56503
|
|
|
56499
56504
|
## Initialize
|
|
56500
56505
|
|
|
@@ -56507,6 +56512,9 @@ first use. The root index should explain:
|
|
|
56507
56512
|
- where the latest handoff lives;
|
|
56508
56513
|
- which checkout or worktree owns shared coordination state.
|
|
56509
56514
|
|
|
56515
|
+
This mode organizes notes; the CLI \`scratchpad init\` only scaffolds \`scratchpad.config.ts\` and
|
|
56516
|
+
backlog mounts for GitHub sync.
|
|
56517
|
+
|
|
56510
56518
|
Do not create placeholder files or elaborate taxonomy without an immediate use. Read the
|
|
56511
56519
|
\`organization\` reference when choosing a layout or retention policy.
|
|
56512
56520
|
|
|
@@ -56718,8 +56726,10 @@ scratchpad review [paths...] [--apply] [--json] [--limit 100]
|
|
|
56718
56726
|
placeholder. Set \`lifecycle.notes.estimatedCostPerCall\` for that fallback.
|
|
56719
56727
|
- Classification uses OpenRouter Decisions with pinned default model \`typesafe/jev-1.14\`. Set
|
|
56720
56728
|
\`classifier.model\` to \`~typesafe/jev-latest\` only when a moving alias is wanted. It shares
|
|
56721
|
-
\`SCRATCHPAD_OPENROUTER_API_KEY\` or \`~/.config/scratchpad/secrets/openrouter-api-key\` (
|
|
56722
|
-
search embeddings. \`classifier.model\` names an OpenRouter model ID
|
|
56729
|
+
\`SCRATCHPAD_OPENROUTER_API_KEY\` or \`~/.config/scratchpad/secrets/openrouter-api-key\` (keep
|
|
56730
|
+
it 0600) with search embeddings. \`classifier.model\` names an OpenRouter model ID;
|
|
56731
|
+
\`SCRATCHPAD_CLASSIFIER\` overrides it. Set \`SCRATCHPAD_CLASSIFIER=none\` or
|
|
56732
|
+
\`classifier.model: "none"\` to turn classification off even when a key is present.
|
|
56723
56733
|
- Without a classifier key, \`review\` says \`classifier disabled\` and exits 0, and \`sweep\` handles
|
|
56724
56734
|
artifacts only. \`scratchpad doctor\` shows whether a classifier is configured; enable it with
|
|
56725
56735
|
\`SCRATCHPAD_OPENROUTER_API_KEY\` or the XDG secret the README describes.
|
|
@@ -56773,30 +56783,38 @@ reorganize other repositories merely to match this example.
|
|
|
56773
56783
|
\`\`\`text
|
|
56774
56784
|
.scratchpad/
|
|
56775
56785
|
\u251C\u2500\u2500 README.md
|
|
56776
|
-
\u251C\u2500\u2500
|
|
56777
|
-
\u251C\u2500\u2500 research/
|
|
56786
|
+
\u251C\u2500\u2500 STATE.md
|
|
56778
56787
|
\u251C\u2500\u2500 backlog/
|
|
56779
56788
|
\u2502 \u251C\u2500\u2500 issues/
|
|
56780
56789
|
\u2502 \u251C\u2500\u2500 milestones/
|
|
56781
|
-
\u2502 \u251C\u2500\u2500 handoffs/
|
|
56782
56790
|
\u2502 \u2514\u2500\u2500 parking-lot.md
|
|
56791
|
+
\u251C\u2500\u2500 research/
|
|
56783
56792
|
\u251C\u2500\u2500 reference/
|
|
56784
|
-
\
|
|
56793
|
+
\u251C\u2500\u2500 feedback/
|
|
56794
|
+
\u251C\u2500\u2500 handoffs/
|
|
56795
|
+
\u251C\u2500\u2500 decisions/
|
|
56796
|
+
\u251C\u2500\u2500 delivery/
|
|
56797
|
+
\u251C\u2500\u2500 maintenance/
|
|
56798
|
+
\u251C\u2500\u2500 artifacts/
|
|
56799
|
+
\u2514\u2500\u2500 codemaps/
|
|
56785
56800
|
\`\`\`
|
|
56786
56801
|
|
|
56802
|
+
Create only what the work needs: \`STATE.md\` and the folders are made on first use, not up front.
|
|
56803
|
+
|
|
56787
56804
|
- Keep \`README.md\` as a small index of active work and important continuity pointers.
|
|
56788
56805
|
- Put instruction-friction occurrences in \`feedback/\` (the \`instruction-feedback\` reference covers
|
|
56789
56806
|
global and project routing). The home-level \`~/.scratchpad/feedback/\` holds shared feedback.
|
|
56790
56807
|
- Put investigations, comparisons, and temporary findings in \`research/\`.
|
|
56791
56808
|
- Put executable work and delivery groupings in \`backlog/\`; the CLI reads issues and milestones only
|
|
56792
56809
|
from \`backlog/issues/\` and \`backlog/milestones/\`, at any depth beneath them.
|
|
56793
|
-
- Put session-continuity artifacts in \`
|
|
56810
|
+
- Put session-continuity artifacts, including \`task-registry.md\`, in the top-level \`handoffs/\`.
|
|
56794
56811
|
- Put unsettled working contracts in \`reference/\`.
|
|
56795
56812
|
- Retire inactive working memory with \`scratchpad archive\`, which moves it to the OS Trash and
|
|
56796
56813
|
records a receipt in \`maintenance/trash-log.md\`. There is no \`archive/\` folder.
|
|
56797
56814
|
- Keep only declared top-level folders; \`scratchpad doctor\` reports the rest against \`layout\` in
|
|
56798
56815
|
\`scratchpad.config.ts\`. Built-in folders: \`backlog\`, \`research\`, \`reference\`, \`feedback\`,
|
|
56799
|
-
\`handoffs\`, \`decisions\`, \`delivery\`, \`maintenance\`, \`artifacts\`; files: \`README.md\`,
|
|
56816
|
+
\`handoffs\`, \`decisions\`, \`delivery\`, \`maintenance\`, \`artifacts\`, \`codemaps\`; files: \`README.md\`,
|
|
56817
|
+
\`STATE.md\`.
|
|
56800
56818
|
|
|
56801
56819
|
This is a convention, not a required schema. Follow an existing repository layout instead of
|
|
56802
56820
|
rewriting it to match this example.
|
|
@@ -56808,7 +56826,7 @@ responsibilities, not a universal schema:
|
|
|
56808
56826
|
|
|
56809
56827
|
| Category | Use when the project needs it |
|
|
56810
56828
|
| -------------- | ------------------------------------------------------------- |
|
|
56811
|
-
| \`backlog/\` | Issues, milestones, deferred
|
|
56829
|
+
| \`backlog/\` | Issues, milestones, and deferred work |
|
|
56812
56830
|
| \`delivery/\` | Delivery plans and current execution evidence |
|
|
56813
56831
|
| \`research/\` | Investigations and comparisons |
|
|
56814
56832
|
| \`reference/\` | Working reference material not yet suitable for tracked docs |
|
|
@@ -56820,6 +56838,11 @@ responsibilities, not a universal schema:
|
|
|
56820
56838
|
| \`maintenance/\` | Trash receipts (\`trash-log.md\`) written by the CLI |
|
|
56821
56839
|
| \`tmp/\` | Explicitly disposable experiments, not authoritative evidence |
|
|
56822
56840
|
|
|
56841
|
+
Folders outside the default layout (\`marketing/\`, \`incidents/\`, \`validation/\`, \`web-audits/\`,
|
|
56842
|
+
\`tmp/\`) must be declared in \`layout.folders\` in \`scratchpad.config.ts\`, or \`scratchpad doctor\` flags
|
|
56843
|
+
them. Prefer the defaults: validation reports to \`maintenance/\`, incidents to \`decisions/\` or
|
|
56844
|
+
\`delivery/\`, temporary output to \`artifacts/\` (which \`sweep\` expires).
|
|
56845
|
+
|
|
56823
56846
|
Keep the root index short and link to owning records. A record's status and evidence matter more
|
|
56824
56847
|
than its folder name. Shared storage does not require one giant state file: assign task-specific
|
|
56825
56848
|
files and one writer per file.
|
|
@@ -56855,7 +56878,8 @@ description:
|
|
|
56855
56878
|
evidence authoritative. Owns .scratchpad only \u2014 not README, docs/, AGENTS.md, project-local
|
|
56856
56879
|
skills, or Claude Code / Codex auto-memory."
|
|
56857
56880
|
argument-hint:
|
|
56858
|
-
"[status | explore | search | init | backlog | feedback | sync | reconcile | archive |
|
|
56881
|
+
"[status | explore | search | init | backlog | feedback | review | sync | reconcile | archive |
|
|
56882
|
+
extract]"
|
|
56859
56883
|
metadata:
|
|
56860
56884
|
opencode/slash: "true"
|
|
56861
56885
|
---
|
|
@@ -56987,6 +57011,10 @@ it. Keep analysis local. Treat static analyzer output as evidence, never as the
|
|
|
56987
57011
|
\`.scratchpad/codemaps/<name>/\`; let the CLI own timestamped bundles.
|
|
56988
57012
|
- Never inspect, copy, upload to, or invoke Foglamp. This workflow implements the independent
|
|
56989
57013
|
Scratchpad product contract.
|
|
57014
|
+
- \`codemaps/\` is part of the default Scratchpad layout. Age-based artifact expiry in
|
|
57015
|
+
\`scratchpad sweep\` skips \`codemap.json\` beside \`codemap.html\` but expires leftover draft files;
|
|
57016
|
+
delete or regenerate drafts instead of relying on them. The HTML is still a note, so a \`stale\` or
|
|
57017
|
+
\`superseded\` review verdict can sweep it; add \`codemaps/**\` to \`lifecycle.protect\` to keep bundles.
|
|
56990
57018
|
- Do not install a skill globally, publish a codemap, or modify tracked repository files.
|
|
56991
57019
|
- Keep the overview at no more than 40 nodes and 80 meaningful edges. Aim below the caps so the map
|
|
56992
57020
|
remains legible.
|
|
@@ -57724,7 +57752,7 @@ var withConsoleBuffer = (program) => acquireUseRelease2(sync2(() => {
|
|
|
57724
57752
|
}
|
|
57725
57753
|
state.buffer.length = 0;
|
|
57726
57754
|
}));
|
|
57727
|
-
var app = make39("scratchpad").pipe(withDescription4("
|
|
57755
|
+
var app = make39("scratchpad").pipe(withDescription4("Working memory for coding agents: project notes shared across worktrees, instruction feedback, note search and lifecycle cleanup, plus GitHub backlog sync, hosted artifacts and codemaps."), withSubcommands([
|
|
57728
57756
|
init,
|
|
57729
57757
|
path,
|
|
57730
57758
|
doctor,
|
|
@@ -33,6 +33,13 @@ domain documents; GitHub DTOs do not cross the `GithubClientShape` or
|
|
|
33
33
|
documents into GitHub requests, resolves milestone slug-to-number linking, and
|
|
34
34
|
maps GitHub failures to `ProviderError`.
|
|
35
35
|
|
|
36
|
+
Translation from wire DTOs to domain documents lives in pure mapping functions in
|
|
37
|
+
`github/client.ts`, beside the DTO schemas, called from the client's decode helpers. Schema handles only
|
|
38
|
+
wire encoding (dates, numbers); the mapping stays a function rather than a
|
|
39
|
+
`Schema` transformation, because it renames fields, derives values such as slugs,
|
|
40
|
+
and builds nested objects (`providerRef`, `sync`) that do not exist on the wire.
|
|
41
|
+
A transformation would also need an `encode` direction nothing uses.
|
|
42
|
+
|
|
36
43
|
Repo identity comes from `scratchpad.config.ts` (`owner/name`), not from git
|
|
37
44
|
remotes. Auth resolves `GITHUB_TOKEN` / `GH_TOKEN`, then `gh auth token`.
|
|
38
45
|
Transport details are documented in
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# 0010 — OpenRouter Decisions and note lifecycle
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
[ADR 0008](0008-cli-decision-model.md) gave the CLI an optional `Classifier` over Effect's
|
|
8
|
+
`DecisionModel`, served by TypeSafe's Jev model over its direct API. Two things changed. Notes
|
|
9
|
+
need lifecycle judgment as well as feedback routing: is a note still fresh, stale, or superseded
|
|
10
|
+
by newer work? And search embeddings arrived ([ADR 0012](0012-local-hybrid-search.md)), which
|
|
11
|
+
made a second provider key a cost for the user. OpenRouter serves both decision models and
|
|
12
|
+
embeddings under one key.
|
|
13
|
+
|
|
14
|
+
## Decision
|
|
15
|
+
|
|
16
|
+
**Transport.** The classifier calls OpenRouter's Decisions API through `@effect/ai-openrouter`.
|
|
17
|
+
Decision models are listed by `GET https://openrouter.ai/api/v1/models?output_modalities=decisions`.
|
|
18
|
+
The model still comes from `SCRATCHPAD_CLASSIFIER`, then `classifier.model`, then the default;
|
|
19
|
+
`none` disables it. One OpenRouter key serves classification, lifecycle review, and search
|
|
20
|
+
embeddings.
|
|
21
|
+
|
|
22
|
+
**Pinned default.** The default is `typesafe/jev-1.14`, an exact version, so cached verdicts stay
|
|
23
|
+
valid until the model is deliberately changed. The moving `~typesafe/jev-latest` alias is opt-in
|
|
24
|
+
through `classifier.model`. `typesafe/jev-router` is a chat model, not a decision model, and is
|
|
25
|
+
not valid.
|
|
26
|
+
|
|
27
|
+
**Confidence.** Confidence is the probability of the chosen label, taken from the Decisions API,
|
|
28
|
+
independent of kind probability and the provider's separate confidence metric. Per-label
|
|
29
|
+
probabilities are returned and cached with each review.
|
|
30
|
+
|
|
31
|
+
**Review.** `scratchpad review` asks one four-label question per note (`fresh`, `stale`,
|
|
32
|
+
`superseded`, `expired`) with repository evidence. Verdicts are cached in the project state
|
|
33
|
+
database, keyed by content, evidence, model, and question revision. A question revision therefore
|
|
34
|
+
invalidates old verdicts. `review --apply` writes only lifecycle front matter.
|
|
35
|
+
|
|
36
|
+
**Sweep consumes the cache.** `sweep` never calls the model. It trashes only cached
|
|
37
|
+
stale/superseded verdicts at or above `lifecycle.notes.autoTrashConfidence` (default 0.9), and
|
|
38
|
+
protects:
|
|
39
|
+
|
|
40
|
+
- README and STATE indexes,
|
|
41
|
+
- backlog and feedback,
|
|
42
|
+
- notes updated within `minFreshDays` (default 7),
|
|
43
|
+
- notes linked from a live (non-stale) note,
|
|
44
|
+
- paths matching `lifecycle.protect` globs.
|
|
45
|
+
|
|
46
|
+
An expired model verdict alone never auto-trashes a note.
|
|
47
|
+
|
|
48
|
+
## Calibration evidence
|
|
49
|
+
|
|
50
|
+
The original four-label question was compared with three sharper prompts on 31 sample notes. The
|
|
51
|
+
original matched 5 of 5 evidence anchors; the three sharper prompts misjudged live or durable
|
|
52
|
+
notes. The whole experiment cost about $0.023. The sharper prompts were not adopted.
|
|
53
|
+
|
|
54
|
+
## Consequences
|
|
55
|
+
|
|
56
|
+
- Classification, lifecycle review, and embeddings depend on one provider account and one key
|
|
57
|
+
location (`~/.config/scratchpad/secrets/openrouter-api-key`, or
|
|
58
|
+
`SCRATCHPAD_OPENROUTER_API_KEY`). Without it, every command still works; review reports that
|
|
59
|
+
the classifier is disabled and sweep handles artifacts only.
|
|
60
|
+
- Moving to a new default model invalidates cached verdicts and is a visible change.
|
|
61
|
+
- The 0008 rules about redaction, writes-first behavior, and deterministic tests are unchanged.
|
|
62
|
+
`TYPESAFE_API_KEY` is no longer used.
|
|
63
|
+
|
|
64
|
+
## Alternatives
|
|
65
|
+
|
|
66
|
+
- **Keep the direct TypeSafe API.** Rejected: a second key beside OpenRouter embeddings, and no
|
|
67
|
+
shared model catalog.
|
|
68
|
+
- **A moving alias as the default.** Rejected: silent model changes would shift verdicts that
|
|
69
|
+
sweep acts on.
|
|
70
|
+
- **A chat model with a free-text verdict.** Rejected: untyped output, no per-label
|
|
71
|
+
probabilities, no calibrated confidence.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 0011 — Trash instead of archive folders
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
Retiring a note used to mean moving it into a dated directory under `archive/`. Those folders
|
|
8
|
+
grew without bound and nothing cleaned them, so retired notes and expired artifacts kept
|
|
9
|
+
occupying disk and showing up in the notes root.
|
|
10
|
+
|
|
11
|
+
## Decision
|
|
12
|
+
|
|
13
|
+
`archive` and `sweep --apply` move files to the operating system's Trash: `/usr/bin/trash` on
|
|
14
|
+
macOS and `gio trash` on Linux. Other platforms report an unsupported-platform error. Trash is
|
|
15
|
+
recoverable and the OS reclaims its space.
|
|
16
|
+
|
|
17
|
+
Each move is receipted in `maintenance/trash-log.md`. The CLI writes and flushes a `pending`
|
|
18
|
+
receipt first, then appends `trashed`, `failed`, or `skipped-changed` with the same id. An
|
|
19
|
+
unmatched `pending` means a crash or interruption between the two and needs a human to reconcile
|
|
20
|
+
the source path against the Trash; the CLI never retries it automatically. A later failure does
|
|
21
|
+
not undo earlier moves.
|
|
22
|
+
|
|
23
|
+
`archive` acts on the paths it is given immediately; it has no preview. `sweep` previews by
|
|
24
|
+
default and moves nothing without `--apply`, and `sweep --json` reports exactly what an apply run
|
|
25
|
+
would do (see [lifecycle.md](../lifecycle.md)).
|
|
26
|
+
|
|
27
|
+
`.md` and `.html` files are notes, never artifacts: artifact expiry does not remove them. Notes
|
|
28
|
+
leave only through `archive` or the cached-verdict rules of
|
|
29
|
+
[ADR 0010](0010-openrouter-decisions-and-note-lifecycle.md).
|
|
30
|
+
The GitHub archive mount of [ADR 0005](0005-closed-object-archive.md) is a separate, read-only
|
|
31
|
+
projection and is unaffected.
|
|
32
|
+
|
|
33
|
+
## Consequences
|
|
34
|
+
|
|
35
|
+
- Retirement is reversible from the OS Trash for as long as the user keeps it.
|
|
36
|
+
- The pending-then-final receipt protocol makes crashes visible instead of silent.
|
|
37
|
+
- Existing `archive/` contents are left alone and may contain expired artifacts, which `sweep`
|
|
38
|
+
can still pick up.
|
|
39
|
+
- Trash behavior differs per platform and is unavailable on others.
|
|
40
|
+
|
|
41
|
+
## Alternatives
|
|
42
|
+
|
|
43
|
+
- **Keep dated archive directories.** Rejected: unbounded growth and no cleanup.
|
|
44
|
+
- **Delete permanently.** Rejected: not recoverable.
|
|
45
|
+
- **A Scratchpad-owned trash directory.** Rejected: it would repeat the unbounded-folder problem
|
|
46
|
+
and skip the OS's own recovery and space reclamation.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 0012 — Local hybrid note search
|
|
2
|
+
|
|
3
|
+
Status: Accepted
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
Agents need to find earlier decisions, handoffs, and feedback in a notes root that grows with
|
|
8
|
+
every session. Grep misses paraphrases. A hosted index would store every note on another service
|
|
9
|
+
and make search depend on it. Embedding calls send chunk text to OpenRouter, while the index itself
|
|
10
|
+
stays on the machine; what the provider retains is governed by its policy, not by this design.
|
|
11
|
+
|
|
12
|
+
## Decision
|
|
13
|
+
|
|
14
|
+
`scratchpad search` runs a local hybrid index:
|
|
15
|
+
|
|
16
|
+
- **Text:** SQLite FTS5.
|
|
17
|
+
- **Vectors:** zvec with a FLAT index and cosine distance.
|
|
18
|
+
- **Fusion:** reciprocal rank fusion of the two result lists; the score is reported with each
|
|
19
|
+
result.
|
|
20
|
+
- **Embeddings:** OpenRouter's `qwen/qwen3-embedding-8b` at 1024 dimensions, using the same key as
|
|
21
|
+
the classifier ([ADR 0010](0010-openrouter-decisions-and-note-lifecycle.md)). Note title,
|
|
22
|
+
heading, and chunk text, and queries, are sent there.
|
|
23
|
+
|
|
24
|
+
The index is derived and rebuildable. It lives under the XDG state directory, per project and per
|
|
25
|
+
selected notes root, and is refreshed by content hash before each query, so edits and removals are
|
|
26
|
+
visible without a daemon. `index --rebuild` recreates a scope's stores, including corrupt ones.
|
|
27
|
+
|
|
28
|
+
Without a key, or with `search.embeddings: false`, ordinary searches are FTS-only and say so on
|
|
29
|
+
stderr without loading native bindings. `index --rebuild` still loads zvec when the scope has
|
|
30
|
+
existing vector state, even without a key. The compiled binary embeds the zvec bindings. zvec
|
|
31
|
+
write batches are capped at 1024 documents.
|
|
32
|
+
|
|
33
|
+
## Consequences
|
|
34
|
+
|
|
35
|
+
- Search sends note text only when embeddings are enabled; `search.embeddings: false` opts out,
|
|
36
|
+
including through ancestor config. Lifecycle review sends note text separately; disable it with
|
|
37
|
+
`classifier.model: "none"` or `SCRATCHPAD_CLASSIFIER=none`.
|
|
38
|
+
- Concurrent writers return a busy error rather than corrupting the index.
|
|
39
|
+
- Linux x64 vector search needs an AVX2-capable CPU.
|
|
40
|
+
- Changing the embedding model or dimensions means rebuilding the index.
|
|
41
|
+
|
|
42
|
+
## Alternatives
|
|
43
|
+
|
|
44
|
+
- **FTS only.** Rejected as the only mode: it misses paraphrased queries. It remains the fallback.
|
|
45
|
+
- **A hosted vector store.** Rejected: keeps every note off the machine and adds a service to run.
|
|
46
|
+
- **Vector search only.** Rejected: exact identifiers and rare terms retrieve better with FTS.
|
package/docs/adr/README.md
CHANGED
|
@@ -10,5 +10,8 @@ Durable record of the decisions behind Scratchpad. Active planning lives in
|
|
|
10
10
|
- [0005 — Closed-object archive projection](0005-closed-object-archive.md)
|
|
11
11
|
- [0006 — GitHub transport: Octokit, GraphQL for issues, REST for milestones](0006-octokit-graphql-and-rest.md)
|
|
12
12
|
- [0007 — Explicit remote delete](0007-explicit-remote-delete.md)
|
|
13
|
-
- [0008 — The CLI classifies notes with an optional decision model](0008-cli-decision-model.md)
|
|
13
|
+
- [0008 — The CLI classifies notes with an optional decision model (superseded in part by 0010)](0008-cli-decision-model.md)
|
|
14
14
|
- [0009 — Worker-proxied multipart uploads](0009-worker-multipart-uploads.md)
|
|
15
|
+
- [0010 — OpenRouter Decisions and note lifecycle](0010-openrouter-decisions-and-note-lifecycle.md)
|
|
16
|
+
- [0011 — Trash instead of archive folders](0011-trash-instead-of-archive-folders.md)
|
|
17
|
+
- [0012 — Local hybrid note search](0012-local-hybrid-search.md)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Artifacts and uploads
|
|
2
|
+
|
|
3
|
+
The hosted Worker (for example `scratchpad.arya.sh`) serves immutable Markdown/HTML artifact
|
|
4
|
+
revisions with review, share, Trash, and export/import, plus unlisted file uploads. Both require a
|
|
5
|
+
deployment profile (or `--url` on each command). Hosted artifacts are immutable presentation and
|
|
6
|
+
review surfaces over the delivery graph.
|
|
7
|
+
|
|
8
|
+
## Artifact commands
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
scratchpad artifact profile set <name> --url <https://…> [--default]
|
|
12
|
+
scratchpad artifact push <path> --slug <slug> [--kind delivery] [--review] [--wait]
|
|
13
|
+
scratchpad artifact list | show <slug>
|
|
14
|
+
scratchpad artifact open <slug>
|
|
15
|
+
scratchpad artifact wait <slug> --json
|
|
16
|
+
scratchpad artifact share | unshare <slug>
|
|
17
|
+
scratchpad artifact delete | restore <slug>
|
|
18
|
+
scratchpad artifact prune --slug <slug> # or --sweep-orphans for abandoned uploads
|
|
19
|
+
scratchpad artifact pull <slug> [--revision <n>]
|
|
20
|
+
scratchpad artifact export | import <zip>
|
|
21
|
+
scratchpad artifact annotations <slug>
|
|
22
|
+
scratchpad artifact resolve <slug> <ordinal> [--dismiss|--reopen] [--reply <text>]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Soft-deleted artifacts go to Trash via `artifact delete`.
|
|
26
|
+
|
|
27
|
+
## Profiles
|
|
28
|
+
|
|
29
|
+
Profiles live at `$XDG_CONFIG_HOME/scratchpad/deployments.json` and may include Cloudflare Access
|
|
30
|
+
service-token fields for non-interactive CLI auth. See [deploy.md](deploy.md) for the Worker and
|
|
31
|
+
Access bypass rules, and [production-smoke.md](production-smoke.md) for an end-to-end checklist.
|
|
32
|
+
|
|
33
|
+
## Uploads
|
|
34
|
+
|
|
35
|
+
Unlisted public file URLs (for example PR screenshots) on the same Worker as artifacts. Also
|
|
36
|
+
require a profile or `--url`.
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
scratchpad upload <file...> [--name <name>] [--ttl-days <n>] [--profile <name>]
|
|
40
|
+
scratchpad upload <file> --resume <session-id> # repeat the original name/type/TTL options
|
|
41
|
+
scratchpad uploads list [--json]
|
|
42
|
+
scratchpad uploads delete <id>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Most commands accept `--json` for machine-readable output.
|
|
46
|
+
|
|
47
|
+
### Size limits and multipart
|
|
48
|
+
|
|
49
|
+
Files up to 1 GiB can be uploaded from the CLI or Files view. The existing single-request path
|
|
50
|
+
handles files up to 100 MiB; larger files stream through the Worker in 32 MiB parts. A public link
|
|
51
|
+
appears only after R2 verifies the whole file's SHA-256. Browser hashing reads bounded slices, and
|
|
52
|
+
text previews keep their separate 100 MiB ceiling.
|
|
53
|
+
|
|
54
|
+
Multipart sessions expire after 24 hours, or earlier if their `--ttl-days` deadline passes.
|
|
55
|
+
Requests retry transient failures without duplicating the link. If a part's storage result is
|
|
56
|
+
ambiguous, cancellation and a fresh upload are safer than replacing a possibly in-flight part.
|
|
57
|
+
Completion receipts let API callers retry completion with the same session ID after a lost
|
|
58
|
+
response. The CLI's `--resume` flag resumes one unchanged file with its original options and
|
|
59
|
+
authenticated identity. Browser uploads retry in-process; they do not persist a resumable session
|
|
60
|
+
across page reloads. `artifact prune --sweep-orphans` retries staging cleanup and removes old,
|
|
61
|
+
cleaned session records. See [the multipart upload design](adr/0009-worker-multipart-uploads.md).
|
|
62
|
+
|
|
63
|
+
### Serving, TTL, and expiry
|
|
64
|
+
|
|
65
|
+
Uploaded bodies are served under `/f/*`. With `--ttl-days`, a link expires that many days after
|
|
66
|
+
registration, stops serving, and disappears from upload listings. Expiring links use
|
|
67
|
+
`Cache-Control: no-store` so subsequent requests recheck the expiration; links without a TTL
|
|
68
|
+
retain their one-year immutable caching policy. Expiration cannot revoke copies already downloaded
|
|
69
|
+
or responses cached under an older cache policy.
|
|
70
|
+
|
|
71
|
+
Expiration is logical, not immediate storage deletion. Run `artifact prune --sweep-orphans` to
|
|
72
|
+
remove expired upload records and reclaim unreferenced blobs after the orphan grace period. Blobs
|
|
73
|
+
shared by another upload or artifact remain available to that reference.
|
|
74
|
+
|
|
75
|
+
## Deployment
|
|
76
|
+
|
|
77
|
+
Worker deploy steps are in [deploy.md](deploy.md); the production checklist is
|
|
78
|
+
[production-smoke.md](production-smoke.md). The Worker's web UI follows the
|
|
79
|
+
[design system](../DESIGN.md).
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Backlog sync with GitHub
|
|
2
|
+
|
|
3
|
+
Scratchpad can project a repository's GitHub issues and milestones to Markdown files with typed
|
|
4
|
+
YAML front matter, and push local edits back. This is optional: it needs `scratchpad init` and a
|
|
5
|
+
`scratchpad.config.ts` with `repo` set. The notes commands in [notes.md](notes.md) work without it.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
scratchpad init # scaffold scratchpad.config.ts + mount dirs + local store
|
|
11
|
+
scratchpad status # repo, mounts, pending pushes, open conflicts
|
|
12
|
+
scratchpad pull # GitHub -> Markdown files (incremental, by cursor)
|
|
13
|
+
scratchpad push # queued local changes -> GitHub
|
|
14
|
+
scratchpad sync # pull then push
|
|
15
|
+
scratchpad watch # daemon: turn local file edits into queued changes
|
|
16
|
+
scratchpad repair # resolve conflicts (interactive, or --take-local/--take-remote)
|
|
17
|
+
scratchpad delete # explicitly delete a mapped remote issue/milestone (--remote)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
In a project directory run `scratchpad init`, edit `scratchpad.config.ts` and set `repo` to
|
|
23
|
+
`owner/name`, then pull:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
bunx @aryasaatvik/scratchpad init
|
|
27
|
+
bunx @aryasaatvik/scratchpad pull
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Make local edits under the configured `.scratchpad/backlog` mount, then preview and apply the
|
|
31
|
+
provider updates:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
bunx @aryasaatvik/scratchpad push --dry-run
|
|
35
|
+
bunx @aryasaatvik/scratchpad push
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The repository includes a basic example, `examples/basic`:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
cd examples/basic
|
|
42
|
+
bun run status
|
|
43
|
+
bun run plan
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`plan` runs `scratchpad push --dry-run`, so it shows the GitHub create operations Scratchpad would
|
|
47
|
+
perform without calling the provider.
|
|
48
|
+
|
|
49
|
+
## Dry runs
|
|
50
|
+
|
|
51
|
+
`pull` / `push` / `sync` accept `--dry-run`, which prints the planned actions without mutating
|
|
52
|
+
files, the queue, or the provider.
|
|
53
|
+
|
|
54
|
+
## Delete semantics
|
|
55
|
+
|
|
56
|
+
Deleting a tracked backlog file is non-destructive remotely: `push` closes the issue or archives
|
|
57
|
+
the milestone. Hard provider deletion is deliberately separate: `scratchpad delete --file <path>
|
|
58
|
+
--remote` deletes the mapped remote object, removes the local file, and removes the projection
|
|
59
|
+
mapping. Live remote deletes require `--yes` or an interactive TTY confirmation; `--dry-run`
|
|
60
|
+
reports the planned delete without mutating anything. Remote deletion is available only through
|
|
61
|
+
this explicit command, not through filesystem removal. See
|
|
62
|
+
[ADR 0007](adr/0007-explicit-remote-delete.md).
|
|
63
|
+
|
|
64
|
+
## Backlog file contract
|
|
65
|
+
|
|
66
|
+
Backlog files follow the Scratchpad skill's contract: `status` is free text in the repository's
|
|
67
|
+
own vocabulary, the title is the first `# ` heading, and `milestone` / `depends_on` are paths
|
|
68
|
+
relative to the file that contains them, so issues and milestones may be nested in subfolders of
|
|
69
|
+
`backlog/issues/` and `backlog/milestones/`.
|
|
70
|
+
|
|
71
|
+
A status whose first word is in `backlog.closedStatuses` (default `done`, `complete(d)`,
|
|
72
|
+
`closed`, `merged`, `landed`, `delivered`, `cancel(l)ed`, `superseded`, `implemented`,
|
|
73
|
+
`historical`, `moved`) syncs as closed; anything else is open. Files in the older shape (`title`,
|
|
74
|
+
`state: open|closed` in front matter) still read, and are rewritten in the new shape on the next
|
|
75
|
+
sync.
|
|
76
|
+
|
|
77
|
+
`scratchpad backlog new` and `backlog validate | graph` create and check these files; see
|
|
78
|
+
[notes.md](notes.md#backlog-notes).
|
|
79
|
+
|
|
80
|
+
## Archive mount
|
|
81
|
+
|
|
82
|
+
The backlog mount holds open work only. With an optional `archive` block, objects closed within
|
|
83
|
+
`closedWithinDays` project to a separate read-only mount (older closures project nowhere, and
|
|
84
|
+
aged-out files are pruned on the next `pull`). Editing or deleting an archived file does nothing;
|
|
85
|
+
only the backlog mount is writable. See [ADR 0005](adr/0005-closed-object-archive.md). Config
|
|
86
|
+
keys: [configuration.md](configuration.md#mounts).
|
|
87
|
+
|
|
88
|
+
## Auth
|
|
89
|
+
|
|
90
|
+
Auth resolves `GITHUB_TOKEN` / `GH_TOKEN`, then `gh auth token`.
|
|
91
|
+
|
|
92
|
+
## Local store
|
|
93
|
+
|
|
94
|
+
The SQLite store lives under `$XDG_STATE_HOME/scratchpad/<project-hash>/store.db`, never in the
|
|
95
|
+
repo. It is local durability (mappings, cursors, outbox, conflicts), not product truth: the
|
|
96
|
+
Markdown files and the provider are the system of record for backlog sync. Every checkout of a
|
|
97
|
+
project whose mounts resolve to the same files shares one store.
|
package/docs/codemaps.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Codemaps
|
|
2
|
+
|
|
3
|
+
Local, evidence-backed architecture maps. Canonical JSON plus a self-contained HTML viewer live
|
|
4
|
+
under ignored `.scratchpad/codemaps/<name>/<timestamp>/`. No Worker profile is required.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
scratchpad skills get codemap # print the bundled producer skill
|
|
8
|
+
scratchpad codemap create --name <name> --input <draft.json>
|
|
9
|
+
scratchpad codemap validate --name <name> [--snapshot <ts>]
|
|
10
|
+
scratchpad codemap render --name <name> [--snapshot <ts>]
|
|
11
|
+
scratchpad codemap list [--name <name>] [--json]
|
|
12
|
+
scratchpad codemap open --name <name> [--snapshot <ts>] [--editor auto|code|cursor|zed]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Flow
|
|
16
|
+
|
|
17
|
+
1. Emit the producer skill with `scratchpad skills get codemap`.
|
|
18
|
+
2. Have an agent write a `CodemapDraft`.
|
|
19
|
+
3. Create the bundle with `codemap create`.
|
|
20
|
+
4. Open the newest snapshot with `codemap open` on a secured loopback session. Source clicks use a
|
|
21
|
+
per-session token to open paths inside the scanned repository only.
|
|
22
|
+
|
|
23
|
+
Validation reports `fresh` / `stale` / `unverifiable` against the current HEAD and dirty
|
|
24
|
+
fingerprint; stale snapshots still open with a warning.
|
|
25
|
+
|
|
26
|
+
Local codemaps are ignored working memory until an explicit later publish path exists. Hosted
|
|
27
|
+
artifacts, by contrast, are immutable presentation and review surfaces; see
|
|
28
|
+
[artifacts.md](artifacts.md).
|