pi-weave 0.1.20 → 0.1.21
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 +22 -21
- package/package.json +1 -1
- package/skills/weave-explore/SKILL.md +2 -0
- package/skills/weave-notepad/SKILL.md +10 -0
- package/src/core/concurrency.ts +1 -1
- package/src/core/frontmatter.ts +30 -0
- package/src/core/index.ts +25 -1
- package/src/core/paths.ts +1 -0
- package/src/core/sessions.ts +963 -0
- package/src/core/vault.ts +93 -1
- package/src/pi/index.ts +108 -9
- package/src/pi/sessionScan.ts +105 -0
- package/src/pi/summarize.ts +48 -5
- package/src/pi/tools/noteTool.ts +1 -1
package/README.md
CHANGED
|
@@ -13,20 +13,17 @@
|
|
|
13
13
|
|
|
14
14
|
**A local knowledge workspace you can talk to.**
|
|
15
15
|
|
|
16
|
-
pi-weave is an extension for [pi](https://github.com/earendil-works/pi). Ask Pi to take notes while you think out loud, keep your exact
|
|
17
|
-
words alongside a useful summary, and explore everything in `/weave-view`.
|
|
16
|
+
pi-weave is an extension for [pi](https://github.com/earendil-works/pi). Ask Pi to take notes while you think out loud, keep your exact words alongside a useful summary, and explore everything in `/weave-view`.
|
|
18
17
|
|
|
19
|
-
It also understands the repository you are working in. Personal notes live in a Markdown vault; repository knowledge lives in a disposable
|
|
20
|
-
`.okf` index. Both are plain files that humans and agents can read.
|
|
18
|
+
It also understands the repository you are working in. Personal notes live in a Markdown vault; repository knowledge lives in a disposable `.okf` index. Both are plain files that humans and agents can read.
|
|
21
19
|
|
|
22
20
|
## Core capabilities
|
|
23
21
|
|
|
24
|
-
- **Conversational note-taking.** Create and update notes through natural-language requests such as “start a note”, “add this”, or “remember
|
|
25
|
-
|
|
26
|
-
- **Verbatim narration with structured summaries.** During dictation, Pi preserves each spoken passage in an append-only `## Raw` section
|
|
27
|
-
while maintaining an organized summary above it.
|
|
22
|
+
- **Conversational note-taking.** Create and update notes through natural-language requests such as “start a note”, “add this”, or “remember that”.
|
|
23
|
+
- **Verbatim narration with structured summaries.** During dictation, Pi preserves each spoken passage in an append-only `## Raw` section while maintaining an organized summary above it.
|
|
28
24
|
- **Knowledge retrieval.** Pi searches existing notes when answering questions about previous decisions, people, projects, or meetings.
|
|
29
25
|
- **Unified visual workspace.** `/weave-view` presents notes, links, repository structure, and provenance in a live browser interface.
|
|
26
|
+
- **Optional session memory.** `/weave-scan sessions` turns changed pi transcripts into searchable notes with reusable technical takeaways.
|
|
30
27
|
- **Repository exploration.** A lightweight, git-aware index gives Pi a structural overview of the current codebase before it reads files.
|
|
31
28
|
|
|
32
29
|
Nothing is captured silently. pi-weave creates or extends a personal note only when you ask it to.
|
|
@@ -74,8 +71,7 @@ For each chunk, Pi:
|
|
|
74
71
|
2. refreshes the structured summary above it;
|
|
75
72
|
3. leaves the raw record untouched.
|
|
76
73
|
|
|
77
|
-
This makes the note readable during the conversation without replacing your words with an AI reconstruction. Notes based on your dictation
|
|
78
|
-
remain marked `source: human`; notes drafted by Pi are marked `source: agent`.
|
|
74
|
+
This makes the note readable during the conversation without replacing your words with an AI reconstruction. Notes based on your dictation remain marked `source: human`; notes drafted by Pi are marked `source: agent`.
|
|
79
75
|
|
|
80
76
|
Useful requests include:
|
|
81
77
|
|
|
@@ -102,13 +98,21 @@ The browser workspace has four connected views:
|
|
|
102
98
|
- **Graph** — a navigable map of notes, links, mentions, modules, and repository relationships. Selecting something updates every view.
|
|
103
99
|
- **Context** — links, backlinks, tags, and code mentions for the current selection.
|
|
104
100
|
|
|
105
|
-
Search with `⌘K` / `Ctrl K`. Press `?` for all shortcuts. The workspace updates as notes change on disk, so a note written by Pi appears
|
|
106
|
-
without a reload. It follows the system theme by default and can be switched between light and dark.
|
|
101
|
+
Search with `⌘K` / `Ctrl K`. Press `?` for all shortcuts. The workspace updates as notes change on disk, so a note written by Pi appears without a reload. It follows the system theme by default and can be switched between light and dark.
|
|
107
102
|
|
|
108
103
|
The browser is read-only. Edit with `$EDITOR`, Obsidian, or the `weave_note` tool; unknown front-matter fields remain preserved.
|
|
109
104
|
|
|
110
105
|
`/weave-view tui` is the smaller, read-only terminal explorer: tree, focused neighborhood, details, and link health over the same graph.
|
|
111
106
|
|
|
107
|
+
## Remember past pi sessions
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
/weave-scan sessions # pi history (default)
|
|
111
|
+
/weave-scan sessions /path/to/history # explicit history root
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
This opt-in scan treats a supplied file—or every bounded text file under a supplied directory—as opaque session material for the active model to interpret, then writes generated notes under `~/.okf/notes/sessions/`. That makes it usable with Claude Code, opencode, Codex, or exported history trees without requiring their schema or file extension. It skips unchanged files, captures outcomes plus reusable technical takeaways, works outside Git repositories, and can be stopped with `/weave-scan-cancel`.
|
|
115
|
+
|
|
112
116
|
## Repository knowledge
|
|
113
117
|
|
|
114
118
|
Inside a Git repository, pi-weave detects whether `<repo>/.okf/` is missing, fresh, or stale.
|
|
@@ -118,11 +122,9 @@ Inside a Git repository, pi-weave detects whether `<repo>/.okf/` is missing, fre
|
|
|
118
122
|
/weave-scan deep # also summarize changed files with the active model
|
|
119
123
|
```
|
|
120
124
|
|
|
121
|
-
The light index covers languages, packages, modules, entry points, and Git state. A deep scan adds short per-file summaries and only
|
|
122
|
-
revisits files whose content changed.
|
|
125
|
+
The light index covers languages, packages, modules, entry points, and Git state. A deep scan adds short per-file summaries and only revisits files whose content changed.
|
|
123
126
|
|
|
124
|
-
The repository index is a cache, not a source of truth. Delete `.okf`, scan again, and nothing important is lost. pi-weave excludes it
|
|
125
|
-
locally from Git by default.
|
|
127
|
+
The repository index is a cache, not a source of truth. Delete `.okf`, scan again, and nothing important is lost. pi-weave excludes it locally from Git by default.
|
|
126
128
|
|
|
127
129
|
## Commands and tools
|
|
128
130
|
|
|
@@ -134,7 +136,8 @@ Most people only need natural language and `/weave-view`.
|
|
|
134
136
|
| Command | `/weave` | Show vault and repository status |
|
|
135
137
|
| Command | `/weave-scan` | Build or refresh the repository index |
|
|
136
138
|
| Command | `/weave-scan deep` | Add incremental model-written file summaries |
|
|
137
|
-
| Command | `/weave-scan
|
|
139
|
+
| Command | `/weave-scan sessions [path]` | Turn changed session-history files into durable memory notes |
|
|
140
|
+
| Command | `/weave-scan-cancel` | Stop a deep or session scan |
|
|
138
141
|
| Tool | `weave_note` | List, read, add, append, finalize, and search notes |
|
|
139
142
|
| Tool | `weave_repo` | Check, scan, and summarize the repository index |
|
|
140
143
|
|
|
@@ -178,8 +181,7 @@ We probably want OIDC next quarter…
|
|
|
178
181
|
|
|
179
182
|
Set `PI_WEAVE_VAULT` to use a different vault location.
|
|
180
183
|
|
|
181
|
-
Reading, writing, searching, and viewing notes are local operations. Deep repository scans send bounded input to whichever model you
|
|
182
|
-
configured in pi. The browser workspace binds only to loopback, uses a per-session token, and shuts down with the pi session.
|
|
184
|
+
Reading, writing, searching, and viewing notes are local operations. Deep repository scans and session summaries send bounded input to whichever model you configured in pi. The browser workspace binds only to loopback, uses a per-session token, and shuts down with the pi session.
|
|
183
185
|
|
|
184
186
|
The vault format, repository index, and skills are intentionally harness-agnostic. `src/core` contains no pi-specific imports.
|
|
185
187
|
|
|
@@ -199,8 +201,7 @@ npm run coverage
|
|
|
199
201
|
npm run build:web
|
|
200
202
|
```
|
|
201
203
|
|
|
202
|
-
Coverage must remain at or above **95%** for lines, branches, functions, and statements. If browser source changes, rebuild and commit
|
|
203
|
-
`src/web/client/dist/app.js`.
|
|
204
|
+
Coverage must remain at or above **95%** for lines, branches, functions, and statements. If browser source changes, rebuild and commit `src/web/client/dist/app.js`.
|
|
204
205
|
|
|
205
206
|
Read [AGENTS.md](AGENTS.md) before contributing. Work on a feature branch; do not commit directly to `main`.
|
|
206
207
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-weave",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
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,
|
|
@@ -34,6 +34,8 @@ directly.
|
|
|
34
34
|
and incremental**: it never runs implicitly, and it only re-summarizes files whose content hash changed since their last summary. If
|
|
35
35
|
summaries are missing or stale, offer `/weave-scan deep` to create or refresh them before diving into full files.
|
|
36
36
|
|
|
37
|
+
Its sibling `/weave-scan sessions` is a different scope: it summarizes past *session transcripts* into the vault (`notes/sessions/`), not the repository. See the `weave-notepad` skill — nothing it writes lands in `.okf/`.
|
|
38
|
+
|
|
37
39
|
## On-disk layout
|
|
38
40
|
|
|
39
41
|
```text
|
|
@@ -95,6 +95,16 @@ down". Never promote conversation into a note on your own initiative — capture
|
|
|
95
95
|
for user-scribbled notes. Notes you draft from scratch are `source: agent` (the default). Never overwrite a `source: human` note's
|
|
96
96
|
meaning; append with a dated "Agent addendum" section instead.
|
|
97
97
|
|
|
98
|
+
## Session memory (`notes/sessions/`)
|
|
99
|
+
|
|
100
|
+
`/weave-scan sessions` summarizes past agent session transcripts into generated notes under `notes/sessions/`. These are ordinary vault notes — `search` and `get` reach them like any other — with three differences worth knowing:
|
|
101
|
+
|
|
102
|
+
- They are `source: generated`, not human knowledge. Treat one as a recollection of what a past session did, not as a decision record; a human note that contradicts it wins.
|
|
103
|
+
- Each carries a `## Takeaways` section: reusable technical lessons (gotchas, root causes, non-obvious rules) from that session. When the user hits a problem that smells familiar, search the vault before re-deriving the answer — a previous session may already have paid for it.
|
|
104
|
+
- They are re-derivable. The scan rewrites a note in place when its transcript changes, preserving human edits above the raw tail, so no session note is the only copy of anything.
|
|
105
|
+
|
|
106
|
+
The scan is opt-in and never runs on its own. Suggest it when the user asks why the agent keeps forgetting across sessions, or wants history from another tool (`/weave-scan sessions <path>` accepts any history file or directory). Never run it unprompted: it spends model tokens per changed session.
|
|
107
|
+
|
|
98
108
|
## Retrieving knowledge
|
|
99
109
|
|
|
100
110
|
Use `weave_note` action=search with the user's key terms, then `get` the best hits. When a note and the repository index disagree, trust the
|
package/src/core/concurrency.ts
CHANGED
package/src/core/frontmatter.ts
CHANGED
|
@@ -301,6 +301,36 @@ export function parseFrontMatter(text: string): ParsedFrontMatter | null {
|
|
|
301
301
|
return { fields, body, lines };
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
+
/** Upsert generated scalar fields while preserving unrelated front matter. */
|
|
305
|
+
export function upsertFrontMatterFields(
|
|
306
|
+
lines: NoteFrontMatter,
|
|
307
|
+
fields: Record<string, string>,
|
|
308
|
+
): NoteFrontMatter {
|
|
309
|
+
const wanted = new Set(Object.keys(fields));
|
|
310
|
+
const written = new Set<string>();
|
|
311
|
+
const out: string[] = [];
|
|
312
|
+
let droppingBlock = false;
|
|
313
|
+
for (const line of scanFrontMatter(lines)) {
|
|
314
|
+
if (droppingBlock) {
|
|
315
|
+
if (/^\s/.test(line.text)) continue;
|
|
316
|
+
droppingBlock = false;
|
|
317
|
+
}
|
|
318
|
+
if (line.key !== null && wanted.has(line.key)) {
|
|
319
|
+
if (!written.has(line.key)) {
|
|
320
|
+
out.push(`${line.key}: ${quoteField(fields[line.key] ?? "")}`);
|
|
321
|
+
written.add(line.key);
|
|
322
|
+
droppingBlock = !line.scalar;
|
|
323
|
+
}
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
out.push(line.text);
|
|
327
|
+
}
|
|
328
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
329
|
+
if (!written.has(key)) out.push(`${key}: ${quoteField(value)}`);
|
|
330
|
+
}
|
|
331
|
+
return out;
|
|
332
|
+
}
|
|
333
|
+
|
|
304
334
|
/**
|
|
305
335
|
* Parse a note file. Throws on missing/invalid front matter so callers can
|
|
306
336
|
* treat the file as malformed rather than guessing.
|
package/src/core/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* NO harness imports allowed in this tree (see docs/design.md §21).
|
|
5
5
|
*/
|
|
6
6
|
export type { WorkspaceStatus } from "./types";
|
|
7
|
-
export { NOTES_DIR, repoIndexDir, resolveVaultRoot } from "./paths";
|
|
7
|
+
export { NOTES_DIR, SESSIONS_DIR, repoIndexDir, resolveVaultRoot } from "./paths";
|
|
8
8
|
export { findGitRoot } from "./git";
|
|
9
9
|
export {
|
|
10
10
|
assessStaleness,
|
|
@@ -14,6 +14,29 @@ export {
|
|
|
14
14
|
writeRepoIndex,
|
|
15
15
|
} from "./repoIndex";
|
|
16
16
|
export { runDeepScan, type DeepScanOptions, type DeepScanResult, type SummarizeFn } from "./summaries";
|
|
17
|
+
export {
|
|
18
|
+
DEFAULT_SESSIONS_ROOT,
|
|
19
|
+
SESSIONS_ENV_VAR,
|
|
20
|
+
deriveSessionTitle,
|
|
21
|
+
listSessionFiles,
|
|
22
|
+
migrateLegacySessionNotes,
|
|
23
|
+
parseSessionDigest,
|
|
24
|
+
peekSessionHeader,
|
|
25
|
+
projectTagOf,
|
|
26
|
+
readSessionNoteIndex,
|
|
27
|
+
renderSessionDigest,
|
|
28
|
+
resolveSessionsRoot,
|
|
29
|
+
runSessionScan,
|
|
30
|
+
sessionHasContent,
|
|
31
|
+
sessionNoteBody,
|
|
32
|
+
sessionNoteFields,
|
|
33
|
+
sessionNoteTags,
|
|
34
|
+
writeSessionNote,
|
|
35
|
+
type SessionChain,
|
|
36
|
+
type SessionDigest,
|
|
37
|
+
type SessionScanOptions,
|
|
38
|
+
type SessionScanResult,
|
|
39
|
+
} from "./sessions";
|
|
17
40
|
export {
|
|
18
41
|
addNote,
|
|
19
42
|
appendToNote,
|
|
@@ -34,6 +57,7 @@ export {
|
|
|
34
57
|
resolveHtmlPath,
|
|
35
58
|
resolveNotePath,
|
|
36
59
|
searchNotes,
|
|
60
|
+
upsertNote,
|
|
37
61
|
} from "./vault";
|
|
38
62
|
export type { HtmlArtifact } from "./types";
|
|
39
63
|
export { withMutationQueue } from "./mutex";
|
package/src/core/paths.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { join } from "node:path";
|
|
|
14
14
|
export const OKF_DIR = ".okf";
|
|
15
15
|
export const OKF_MANIFEST = "okf.json";
|
|
16
16
|
export const NOTES_DIR = "notes";
|
|
17
|
+
export const SESSIONS_DIR = "sessions";
|
|
17
18
|
export const REPOSITORY_DIR = "repository";
|
|
18
19
|
export const VAULT_ENV_VAR = "PI_WEAVE_VAULT";
|
|
19
20
|
|