@arshdelight/practi 0.14.0 → 0.14.1

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # practi
2
2
 
3
- The `practi` command (formerly `pop` / `@arshdelight/pop-cli`): a local registry for POP (Protocol of Practice) documents — a personal, content-addressed collection of practice documents, built on [@arshdelight/pop-sdk](https://www.npmjs.com/package/@arshdelight/pop-sdk). Fully offline: everything lives in your data directory, nothing leaves the machine.
3
+ The `practi` command (formerly `pop` / `@arshdelight/pop-cli`): a local registry for POP (Protocol of Practice) documents — a personal, content-addressed collection of practice documents, built on [@arshdelight/pop-sdk](https://www.npmjs.com/package/@arshdelight/pop-sdk). Your data lives in your data directory and never leaves the machine; the only network calls are the ones you ask for — self-update (`practi update`), fetching the offline vector model (`practi embed pull`), and staging a URL attachment (`practi blob add <url>`).
4
4
 
5
5
  ## Install
6
6
 
@@ -33,19 +33,47 @@ practi skill import <dir> | export <ref> [--dir]
33
33
  replay a skill-export directory back into a POP / project one out
34
34
  practi show <hash> [--json] [--doc] inspect one node (hash prefix OK)
35
35
  practi web [--port 4317] [--no-open] browse direct POPs in a local web UI
36
- practi search [query...] search the local workspace (name/description/content substring
37
- + hash prefixes; empty = browse direct roots; --limit N; --json)
36
+ practi search [query...] search every stored node — direct, indirect and orphans alike:
37
+ field-weighted BM25, title-first ranking, multi-word AND that may
38
+ match across fields, `field:` scoping (name: desc: content: flow:
39
+ loop: op: hash:), and a labeled relax tier for a partial majority
40
+ of terms. --limit N; --json; --notes also indexes local notes
41
+ (off by default); --semantic fuses vector recall with the lexical
42
+ ranking (needs embed pull + build). Empty = browse direct roots
43
+ practi similar <hash> [--limit N] [--json]
44
+ content neighbours: the target subtree becomes the query, every
45
+ stored node is scored against it, and each hit lists the shared
46
+ terms that carried it. Literal (character-bigram + latin-word
47
+ relevance), not semantics — a paraphrase will not surface
48
+ practi lint [--json] [--limit N] audit recording quality across every direct pop: the same W_*
49
+ hints `practi new` prints once, on demand. Read-only and never
50
+ blocking (exit code is always 0) — a to-do list, not a gate
51
+ practi embed status report model readiness and index coverage (--json)
52
+ practi embed pull fetch the offline vector model into <data-dir>/models/
53
+ practi embed build [--notes] build/refresh the vector index, incrementally — only hashes not
54
+ already cached; --notes embeds local notes too
55
+ practi embed prune drop vector buckets left by an older model fingerprint
56
+ (the whole layer is optional: no model means lexical-only, and
57
+ `search --semantic` says what is missing rather than recalling less)
38
58
  practi remove <hash> take a direct pop out of the local directory (registry op;
39
59
  GCs nodes unreachable from the rest — shared indirect nodes survive)
40
60
  practi claim <hash> register an existing stored node as a direct pop (indirect → direct)
41
61
  practi unclaim <hash> take a referenced direct pop back to indirect (fails when unreferenced —
42
62
  that would orphan it; delete with "remove" instead)
43
- practi blob add <file-or-url> stage an attachment; emits the attachment entry
44
- (hashes the bytes, stores local blobs in the workspace)
63
+ practi blob add <file-or-url> [--name <name>]
64
+ stage an attachment; emits the attachment entry (hashes the bytes,
65
+ stores local blobs in the workspace). A URL source is fetched
66
+ through the system proxy and its bytes are stored too — the
67
+ pointer itself stays hash-only
45
68
  practi note add <node> -m "<text>" pin a local learning note to any node hash (sidecar
46
69
  notes.json; hash prefix OK)
47
70
  practi note list [hash] [--json] list notes — all (grouped by document) or a subtree
48
71
  practi note edit|delete <note-id> edit (-m "<text>") or remove a note (id prefix OK)
72
+ practi note promote <note-id> [--out <file>]
73
+ turn a note back into a **draft** document of its owning direct
74
+ root, with the note spliced in at the node it was pinned to — it
75
+ drafts and stops, never edits for you (an edit is a new hash:
76
+ that call is yours)
49
77
  ```
50
78
 
51
79
  The data directory is a POP workspace (nodes content-addressed under `nodes/*.md`); `practi.json` records the registered **direct** roots, each with a claim timestamp (time lives on the claim event, never inside content-addressed nodes — the git refs/reflog split; indirect = every other node the direct POPs reference).
@@ -56,9 +84,17 @@ Editing is replacing: content addressing means an edit produces a **new root has
56
84
 
57
85
  ### Search
58
86
 
59
- - `practi search <query...>` searches the local workspace: case-insensitive substring match over name/description/content of every stored node (including indirect); pure-hex queries (≥4 chars) also match hash prefixes.
87
+ - `practi search <query...>` searches **every stored node** — direct, indirect, nodes referenced only through `inputs.from`, and orphans alike. The index text covers name / description / content / declared inputs+outputs / loop prose / op, ranked by field-weighted BM25 with title-first ordering; hits report which field matched. Pure-hex queries (≥4 chars) also match hash prefixes. Derived at search time only: never written back into a node, never part of a hash.
88
+ - **Words are ANDed** — every word must match somewhere, and words may match in *different* fields. Quote a phrase to search it whole. `field:value` scopes one word: `name: desc: content: flow: loop: op: hash:`.
89
+ - **Partial match is labeled** — when strict matching finds nothing, results relax to a strict majority of terms and say so. Treat a relaxed row as a lead, not an answer.
60
90
  - Empty query = browse: lists direct roots with their node counts.
61
- - `--json` emits `{query, results, total}`; `--limit N` caps the output (default 20, max 50).
91
+ - `--json` emits `{query, mode, results, total}`; `--limit N` caps the output (default 20, max 50). `--notes` additionally indexes your local notes (off by default, so existing hit sets are unchanged); `--semantic` fuses vector recall with the lexical ranking via RRF — it needs `embed pull` + `embed build`, and otherwise reports what is missing and is ignored.
92
+
93
+ ### Recording quality (`W_*` hints)
94
+
95
+ `practi new` prints `W_*` hints **once, at creation**. `practi lint` runs the same checks — the same code, no second standard — across every direct pop, aggregates them by code, and ranks the worst nodes first, so the debt you skipped at creation time stays visible instead of quietly accumulating. It is read-only and always exits 0: a to-do list, not a gate.
96
+
97
+ `W_*` are never errors: a document that draws them is stored and registered exactly like one that does not (`E_*` remain the only codes that refuse a document). The vocabulary is the shared part, the thresholds are this implementation's own calibration (pop-spec §6) — and `practi lint --json` emits the full set with `code`/`hash`/`name`/`message` for scripting.
62
98
 
63
99
  ### Web
64
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arshdelight/practi",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Local registry CLI for POP (Protocol of Practice): manage a personal, content-addressed collection of practice documents on top of @arshdelight/pop-sdk. Fully offline.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -79,6 +79,7 @@ Check every document against these before `practi new`:
79
79
  - **Detailed** — someone who wasn't here can reproduce it: exact commands, file changes, config values, concrete specs. Record what was actually done — dead ends included — not the idealized version.
80
80
  - **Sanitized** — remove values specific to the author that a reproducer won't reuse: own repos, accounts, usernames, addresses, phones, credentials, personal hostnames/IPs — even embedded in commands, and even inside attachment bytes (screenshots, logs). Replace with descriptive placeholders (`<your-github-username>/repo`). Keep third-party package names, public endpoints, standard tools, and command structure.
81
81
  - **Curated** — a child step is something a reproducer physically does. Research and deciding are not steps; their conclusions go in `content`. Test: *would a reproducer physically do this, or only need its conclusion?*
82
+ - **Bounded** — one document is one thing a reproducer pulls up and follows end-to-end for a single trigger. Sessions are time units; practices are structural ones — "record a session" means extracting the *practices* the session produced (zero, one, or several documents). Split when the parts would be invoked by different triggers (a client asking for analytics ≠ you deciding access policy) or share few or no steps; if what remains after a split has 1–2 steps and no judgment content, it was an action — don't manufacture a document around it.
82
83
 
83
84
  ### E_ blocks, W_ only prompts
84
85
 
@@ -234,7 +235,7 @@ practi skill import <dir> # replay a `practi skill export` direct
234
235
 
235
236
  ## Workflow quick reference
236
237
 
237
- - **Record a session** — extract what was done from the conversation → shape one JSON tree (quality rules above) → `practi new doc.json` → confirm `status: valid, registered as direct` → replace any `W_*` prompts you can → `practi show <hash>` to review.
238
+ - **Record a session** — extract the *practices* the conversation produced → shape one JSON tree per practice (quality rules above; see **Bounded** for document boundaries) → `practi new doc.json` → confirm `status: valid, registered as direct` → replace any `W_*` prompts you can → `practi show <hash>` to review.
238
239
  - **Find prior art** — `practi search <query>` (add `--notes`; use `field:` when you know which field it was in) → `practi show <hash>`. When you cannot recall any wording, start from a node you *do* have and run `practi similar <hash>`.
239
240
  - **Learn from a practice** — reproduce it, then pin what you learned to the step that taught it: `practi note add <node-hash> -m "…"` (notes stay local). Later, `practi note promote <note-id>` turns that note back into a draft of the practice it belongs to, so the lesson does not rot in the sidecar.
240
241
  - **Organize under a set** — a `set` op document is a directory: it pins episodes as `{ hash }` children (episodes live once, as indirect nodes). To move standalone POPs under a set, edit the set to reference them, then `practi unclaim` each — unclaim fails with `E_NOT_REFERENCED` if nothing references the node (that would orphan it; `practi remove` is the delete path). `practi claim <hash>` registers any stored node back as direct.