pi-weave 0.1.1 → 0.1.3

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,7 +1,14 @@
1
1
  # pi-weave
2
2
 
3
3
  <p align="center">
4
- <img src="https://raw.githubusercontent.com/EranYonai/pi-weave/main/docs/logo-high-res.jpg" alt="pi-weave — an agent-native knowledge workspace" width="220"/>
4
+ <img src="https://raw.githubusercontent.com/EranYonai/pi-weave/main/docs/pi-weave-logo.jpg" alt="pi-weave — an agent-native knowledge workspace" width="220"/>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://www.npmjs.com/package/pi-weave"><img alt="npm version" src="https://img.shields.io/npm/v/pi-weave?color=blue&logo=npm"></a>
9
+ <a href="https://github.com/EranYonai/pi-weave/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/EranYonai/pi-weave/actions/workflows/ci.yml/badge.svg"></a>
10
+ <a href="https://github.com/EranYonai/pi-weave/releases"><img alt="release" src="https://img.shields.io/github/v/release/EranYonai/pi-weave?color=blue&logo=github"></a>
11
+ <a href="./LICENSE"><img alt="license: MIT" src="https://img.shields.io/npm/l/pi-weave?color=green"></a>
5
12
  </p>
6
13
 
7
14
  **An agent-native knowledge workspace for your life and your code.**
@@ -29,13 +36,17 @@ agents.** No opaque databases. No lock-in formats.
29
36
  ## Install
30
37
 
31
38
  ```bash
32
- pi install npm:pi-weave # from npm
39
+ pi install npm:pi-weave # from npm (recommended)
33
40
  pi install git:github.com/EranYonai/pi-weave # from git
34
41
  pi install /path/to/pi-weave # local path
35
42
  ```
36
43
 
37
44
  Or for development: `pi -e ./src/pi/index.ts`.
38
45
 
46
+ The package is [published on npm](https://www.npmjs.com/package/pi-weave);
47
+ releases are cut from `main` and auto-published with provenance attestation
48
+ ([Publish workflow](.github/workflows/publish.yml)).
49
+
39
50
  ## What you get
40
51
 
41
52
  | Surface | Name | Purpose |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-weave",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "An agent-native knowledge workspace for your life and your code. Smart notepad + repository exploration, readable by humans and agents alike.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -41,7 +41,7 @@
41
41
  "skills": [
42
42
  "./skills"
43
43
  ],
44
- "image": "https://raw.githubusercontent.com/EranYonai/pi-weave/main/docs/logo-high-res.jpg"
44
+ "image": "https://raw.githubusercontent.com/EranYonai/pi-weave/main/docs/pi-weave-logo.jpg"
45
45
  },
46
46
  "scripts": {
47
47
  "test": "vitest run",
@@ -18,23 +18,35 @@ available), operate on the files directly:
18
18
  - Each note has YAML front matter: `title`, `created`, `updated` (ISO-8601),
19
19
  `tags: [..]`, and `source: human | agent | generated`.
20
20
  - `weave_note` actions: `list`, `get`, `add`, `append`, `finalize`, `search`.
21
- `finalize` restructures the body *above* the `## Raw notes` tail and preserves
21
+ `finalize` restructures the body *above* the `## Raw` tail and preserves
22
22
  the tail verbatim.
23
23
 
24
- ## Dictation mode ("I will write, you expand")
24
+ ## Raw Tail Format
25
25
 
26
- When the user is dictating (e.g. "I am in an interview", "I will write, you
27
- expand on my draft"), behave as notepad + expander:
26
+ Every note maintains a verbatim, append-only raw section at the bottom separated by a horizontal rule (`---`):
28
27
 
29
- 1. **Every raw line the user adds MUST be captured.** Append their words
30
- verbatim to the active note (`weave_note` action=append).
31
- 2. **Then expand it immediately.** Add `## Raw: "<user's line>"` followed by
32
- `**Expand:** <polished, interview-ready passage>` (STAR-style when
33
- applicable). Never append without expanding.
34
- 3. **Terse replies.** Acknowledge briefly and show what was written. Do NOT
35
- dump long prose in chat — the expansion lives in the note, not the reply.
36
- 4. **Small talk / questions → ask the user.** If you want to chat, clarify,
37
- or ask something, pose it to the user directly and briefly, and wait.
28
+ ---
29
+
30
+ ## Raw
31
+ <!-- NEVER edit below this line. Verbatim user input preserved here. -->
32
+
33
+ ```
34
+ <Initial verbatim input>
35
+ ```
36
+
37
+ <!-- appended 2026-08-23 08:45 -->
38
+ ```
39
+ <Follow-up verbatim user input>
40
+ ```
41
+
42
+ ### How to capture and append raw input
43
+
44
+ 1. **Divider and Heading**: The raw section starts with `---` followed by `## Raw` and the notice comment: `<!-- NEVER edit below this line. Verbatim user input preserved here. -->`.
45
+ 2. **Code Blocks for Verbatim Input**: Always wrap verbatim user lines inside code blocks (triple backticks).
46
+ 3. **Date and Time on Appends**: When appending subsequent snippets, prepend each snippet with: `<!-- appended YYYY-MM-DD HH:MM -->`.
47
+ 4. **Finalization (`finalize`)**:
48
+ - `finalize` replaces or structures content only above the `---` and `## Raw` section.
49
+ - The `## Raw` block and all verbatim code blocks are never modified or removed.
38
50
 
39
51
  ## When to take a note
40
52
 
@@ -57,11 +69,11 @@ explicit by design.
57
69
  2. Title: short noun phrase ("Auth boundary decision", not "Notes").
58
70
  3. **Scribble in, verbatim.** When the user is dictating, append their words
59
71
  to the note as rough, verbatim scribbles — no silent rewording. Keep them
60
- under a `## Raw notes` tail at the end of the note.
72
+ under the `## Raw` tail format at the end of the note.
61
73
  4. **Finalize on request.** When the user says "finalize this" / "clean this
62
74
  up", restructure the body *above* the raw tail: front-loaded summary,
63
75
  sections, entities, links. Use `weave_note` action=finalize (or edit the
64
- file directly in other harnesses). Move nothing out of `## Raw notes` — it
76
+ file directly in other harnesses). Move nothing out of `## Raw` — it
65
77
  is append-only and never rewritten.
66
78
  5. Tags: 1–4 lowercase tags; reuse existing tags when possible.
67
79
  6. Provenance: notes the user scribbled stay `source: human` (finalization is
package/src/core/vault.ts CHANGED
@@ -124,15 +124,38 @@ export async function appendToNote(
124
124
  return { slug, ...meta, body };
125
125
  }
126
126
 
127
- /** The append-only tail where verbatim user scribbles live (docs/notepad.md §4). */
128
- export const RAW_NOTES_HEADING = "## Raw notes";
127
+ /** Format a verbatim user scribble as an append-only raw block with a timestamp. */
128
+ export function formatRawAppend(rawText: string, date: Date = new Date()): string {
129
+ const pad = (n: number) => String(n).padStart(2, "0");
130
+ const yyyy = date.getFullYear();
131
+ const mm = pad(date.getMonth() + 1);
132
+ const dd = pad(date.getDate());
133
+ const hh = pad(date.getHours());
134
+ const min = pad(date.getMinutes());
135
+ const timestamp = `${yyyy}-${mm}-${dd} ${hh}:${min}`;
136
+
137
+ return `<!-- appended ${timestamp} -->\n\`\`\`\n${rawText.trim()}\n\`\`\``;
138
+ }
139
+
140
+ /** The append-only tail where verbatim user scribbles live. */
141
+ export const RAW_NOTES_HEADING = "## Raw";
129
142
 
130
143
  /**
131
- * Extract the `## Raw notes` tail (heading + everything after) verbatim, or
132
- * "" when the note has no raw tail. Used by finalization so the literal
133
- * record of the user's words is never rewritten.
144
+ * Extract the raw tail (including separator line, heading, and everything after) verbatim.
134
145
  */
135
146
  export function extractRawTail(body: string): string {
147
+ // Check for '---' preceding ## Raw or ## Raw directly
148
+ const sepIdx = body.indexOf("\n---\n\n## Raw");
149
+ if (sepIdx !== -1) {
150
+ return body.slice(sepIdx + 1).trimEnd();
151
+ }
152
+ if (body.startsWith("---\n\n## Raw") || body.startsWith("---\n## Raw")) {
153
+ return body.trimEnd();
154
+ }
155
+ const sepIdx2 = body.indexOf("\n---\n## Raw");
156
+ if (sepIdx2 !== -1) {
157
+ return body.slice(sepIdx2 + 1).trimEnd();
158
+ }
136
159
  const idx = body.indexOf(RAW_NOTES_HEADING);
137
160
  if (idx === -1) return "";
138
161
  return body.slice(idx).trimEnd();
@@ -141,7 +164,7 @@ export function extractRawTail(body: string): string {
141
164
  export interface FinalizeNoteInput {
142
165
  /**
143
166
  * The restructured body ABOVE the raw tail (front-loaded summary, sections,
144
- * entities, links). The `## Raw notes` tail is preserved verbatim beneath it.
167
+ * entities, links). The `## Raw` tail is preserved verbatim beneath it.
145
168
  */
146
169
  body: string;
147
170
  /** Injectable clock for tests. */
@@ -149,7 +172,7 @@ export interface FinalizeNoteInput {
149
172
  }
150
173
 
151
174
  /**
152
- * Finalize a note: replace the body above the `## Raw notes` tail with a
175
+ * Finalize a note: replace the body above the `## Raw` tail with a
153
176
  * restructured version, preserving the raw tail verbatim (append-only).
154
177
  * Returns null when the note is missing or the slug is unsafe.
155
178
  */
@@ -7,6 +7,7 @@ import {
7
7
  appendToNote,
8
8
  finalizeNote,
9
9
  formatNote,
10
+ formatRawAppend,
10
11
  getNote,
11
12
  listNotes,
12
13
  NOTES_DIR,
@@ -176,3 +177,5 @@ export function registerNoteTool(pi: ExtensionAPI): void {
176
177
  },
177
178
  });
178
179
  }
180
+
181
+ export { formatRawAppend };