pi-workfeed 0.1.0 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.1] - 2026-12-04
4
+
5
+ **Docs only.** The README was rewritten; the package, schema and shipped files are
6
+ unchanged, and the wire version stays `1`.
7
+
8
+ - Sixteen headings merged into eleven. Three sections that each described the output
9
+ were consolidated, and the "Honest notes" list was split into Privacy, What you get,
10
+ How it works and Limitations, where each item belongs.
11
+ - Rhetoric trimmed: em dashes down from 57 to 0 in new prose, antithetical constructions
12
+ cut, mechanical boldface removed. All numbers, samples and tables are kept as they were.
13
+ - A four-line Chinese introduction now sits under the badges, linking to the existing
14
+ 中文速用 section.
15
+ - One factual fix the old text already carried: `PI_WORKFEED_CONTENT=0` is described as
16
+ disabling content recording and keeping metadata, which matches the privacy channel
17
+ table. The old wording, "keeps timing", understates what the mode keeps.
18
+
3
19
  ## [0.1.0] - 2026-11-10
4
20
 
5
21
  **First public release.**
package/README.md CHANGED
@@ -4,34 +4,25 @@
4
4
  [![npm version](https://img.shields.io/npm/v/pi-workfeed.svg)](https://www.npmjs.com/package/pi-workfeed)
5
5
  [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Wren-Xin/pi-workfeed/blob/main/LICENSE)
6
6
 
7
- **Agent Workflow Evidence** — workflow telemetry for the [pi](https://pi.dev) coding agent.
7
+ Workflow telemetry for the [pi](https://pi.dev) coding agent. pi-workfeed records what the agent did during a session, in a form a model can read and reason about, so answers to "where did this task's time go" or "why was this run slow" come from recorded evidence instead of impressions.
8
8
 
9
- > Record the Work. Preserve the Evidence.
9
+ 中文简介:pi-workfeed 是 pi 编码 agent 的工作流记录扩展。它把任务、工具调用、token 和待办耗时写进本地 JSONL 日志,并派生一份模型可读的摘要(digest),用来回答「这次任务的时间花在哪、哪次调用慢」。每次会话在日志目录下产出两个文件:JSONL 日志和 digest。默认会记录提示词与工具输出,设 `PI_WORKFEED_CONTENT=0` 可只留元数据。安装与用法见文末[中文速用](#中文速用)。
10
10
 
11
- Not another todo list and not another tracer. `pi-workfeed` is a **data entry point**:
12
- it records what the agent did, in a form a model can read and reason about, so that
13
- answers like "where did this task's time go" or "why was this run slow" are derived
14
- from evidence instead of impressions.
11
+ The package has three pieces:
15
12
 
16
- Three smallest necessary pieces:
13
+ 1. A todo tool, `workfeed_todo`, with per-item timing. The prefixed name avoids a load-time name conflict, so it can coexist with other todo extensions.
14
+ 2. An event journal: tasks, turns, tool calls, tokens and todo changes in one JSONL stream.
15
+ 3. A digest, a small summary derived from that stream, so the model reads 200 lines, not 20 000.
17
16
 
18
- 1. **`workfeed_todo` tool with per-item timing** — the task structure the agent already
19
- maintains, now with timing attached. The tool is deliberately named `workfeed_todo` so it
20
- can coexist with other todo extensions instead of failing to load on a name conflict.
21
- 2. **event journal** — tasks, turns, tool calls, tokens, todo changes as one JSONL stream.
22
- 3. **digest** — a small derived summary so the model reads 200 lines, not 20 000.
17
+ **Contents:** [How it works](#how-it-works) · [Install](#install) · [Privacy](#privacy) ·
18
+ [What you get](#what-you-get) · [Ask the agent](#ask-the-agent) ·
19
+ [How this relates to other tooling](#how-this-relates-to-other-tooling) ·
20
+ [Reference](#reference) · [Limitations](#limitations) · [Verification](#verification) ·
21
+ [Roadmap](#roadmap) · [中文速用](#中文速用)
23
22
 
24
- Read it two ways. As the person installing it, top to bottom: Install → Privacy → the digest
25
- sample. As the model at run time, the digest plus `skills/workfeed-analysis/SKILL.md`, which is
26
- the contract for interpreting it — the file below is for you, not for the parser.
23
+ ## How it works
27
24
 
28
- **Contents:** [How it fits together](#how-it-fits-together) · [Install](#install) ·
29
- [Privacy](#privacy) · [What you get](#what-you-get) ·
30
- [What the digest looks like](#what-the-digest-looks-like) ·
31
- [Ask the agent](#ask-the-agent-not-a-dashboard) · [Design philosophy](#design-philosophy) ·
32
- [Verification](#verification) · [中文速用](#中文速用)
33
-
34
- ## How it fits together
25
+ A session is a workflow: tasks, work items, turns, tool calls, outcomes. Recording it as correlated events is what makes "where did the time go" answerable.
35
26
 
36
27
  ```text
37
28
  pi session ── tasks · turns · tool calls · tokens
@@ -50,12 +41,9 @@ pi session ── tasks · turns · tool calls · tokens
50
41
  "where did this task's time go, and which call was slow"
51
42
  ```
52
43
 
53
- The arrows only go one way: the extensions write the log, the digest is computed from the
54
- log, and nothing feeds the digest back into the log. That is why `rebuildDigest(path)` can
55
- rebuild it for a session this process never saw.
44
+ The arrows only go one way. The extensions write the log, and the digest is computed from the log by `replay.ts` (parse → aggregate), never accumulated in memory. Nothing feeds the digest back into the log. That is why `rebuildDigest(path)` can rebuild it for a session this process never saw, and why 2 000 calls still count 2 000.
56
45
 
57
- Here is what the stream actually looks like — the same call at `start` and at `end`, taken
58
- verbatim from a real session (only the session id is shortened, nothing else edited):
46
+ Every line carries four join keys: `v`, `sid`, `task`, `item`. Here is the same call at `start` and at `end`, verbatim from a real session (only the session id is shortened, nothing else edited):
59
47
 
60
48
  ```json
61
49
  {"v":1,"ts":1794306999849,"sid":"<sid>","task":1,"item":1,"t":"tool","phase":"start","id":"call_00_ET_8lw2J5KaRKaxvp6nfIEi3067","name":"edit","args":{"path":"note.txt"}}
@@ -63,46 +51,27 @@ verbatim from a real session (only the session id is shortened, nothing else edi
63
51
  ```
64
52
 
65
53
  - `t` is the event type, `ts` is epoch milliseconds, and `id` is what joins the two lines.
66
- - `task` and `item` are identical on both because **attribution is frozen when the call
67
- starts** — if the todo list moves mid-call, the start and the end still belong together.
68
- - `durMs` is monotonic execution time; `wallMs` includes scheduling, so it is an upper bound.
69
- - This producer writes `args` only on `start` and `out` only on `end`; the schema allows
70
- either as optional, and a digest must not assume otherwise.
71
-
72
- The field tables, per-`phase` required keys, envelope rules and the consumer checklist live in
73
- the package's docs bundle; [`docs/README.md`](https://github.com/Wren-Xin/pi-workfeed/blob/main/docs/README.md) is the index and the protocol is
74
- its first entry. The machine-checkable twin is
75
- [`schemas/workfeed-event-v1.schema.json`](https://github.com/Wren-Xin/pi-workfeed/blob/main/schemas/workfeed-event-v1.schema.json), and
76
- `test/schema-docs.test.mjs` parses the two lines above and fails if they use a field the schema
77
- does not declare.
54
+ - `task` and `item` are identical on both because attribution is frozen when the call starts. If the todo list moves mid-call, the start and the end still belong together. Read each line's own `item`; do not pair lines by timestamp.
55
+ - `durMs` is monotonic execution time. `wallMs` includes scheduling, so it is an upper bound.
56
+ - This producer writes `args` only on `start` and `out` only on `end`. The schema allows either as optional, and a digest must not assume otherwise.
57
+
58
+ Todo state is stored twice on purpose: in tool result `details` (correct after `/fork` and `/tree`) and in a `pi.appendEntry` custom entry (survives compaction, which drops old messages). Losing the list on `/compact` is the bug this design avoids.
59
+
60
+ The field tables, per-`phase` required keys, envelope rules and the consumer checklist live in the package's docs bundle; [`docs/README.md`](https://github.com/Wren-Xin/pi-workfeed/blob/main/docs/README.md) is the index and the protocol is its first entry. The machine-checkable twin is [`schemas/workfeed-event-v1.schema.json`](https://github.com/Wren-Xin/pi-workfeed/blob/main/schemas/workfeed-event-v1.schema.json), and `test/schema-docs.test.mjs` parses the two lines above and fails if they use a field the schema does not declare.
78
61
 
79
62
  ## Install
80
63
 
81
- > **Before you install: this records what you and the agent typed.** Prompt text and tool
82
- > output go to a JSONL log under `~/.pi/agent/logs/<date>/`. Redaction is best effort
83
- > (truncation, argument masking, path basenames) — not a guarantee. `PI_WORKFEED_CONTENT=0`
84
- > turns content recording off and keeps timing. Read [Privacy](#privacy) before turning it on
85
- > in a repository you would not want logged.
64
+ This records what you and the agent typed: prompt text and tool output go to a JSONL log under `~/.pi/agent/logs/<date>/`. Redaction is best effort. Set `PI_WORKFEED_CONTENT=0` to disable content recording and keep metadata only. Read [Privacy](#privacy) before enabling it in a repository you would not want logged.
86
65
 
87
66
  Requirements:
88
67
 
89
- | Requirement | What this release was actually checked against |
68
+ | Requirement | Support statement |
90
69
  |---|---|
91
- | Node.js | **22.19.0 or newer** — pi's own floor (`@earendil-works/pi-coding-agent` declares the same in its `engines`), not a stricter one this package invented. Below it you are outside the version support is *stated* against, which is not the same as "will not run": the suites have also come back green on Node 22.12.0, and the first thing that would break on an older 22.x is the `--experimental-strip-types` flag itself |
92
- | pi coding agent | **1.5.0 and 1.5.1** — the two versions this release was exercised on end to end, not a compatibility range. Other versions are untested; a mismatch in event field names is exactly the kind of break this package survives by reporting rather than guessing |
93
- | OS | **Windows 11 and Ubuntu 24.04 only**; macOS is untested (no Apple hardware here) |
94
-
95
- The extensions import four packages they do not ship: `@earendil-works/pi-ai`,
96
- `@earendil-works/pi-coding-agent`, `@earendil-works/pi-tui` and `typebox`. All four are
97
- supplied by the running pi host, so they are declared as `peerDependencies` with `*` —
98
- a version range there would promise compatibility this package cannot verify, and the copy
99
- that actually loads is pi's, not npm's.
100
-
101
- Which Node, which pi and which OS each of those numbers came from is stated in exactly one
102
- place: [Verification](#verification).
70
+ | Node.js | 22.19.0 or newer (pi's own floor; details in [Verification](#verification)) |
71
+ | pi coding agent | 1.5.0, 1.5.1, 1.6.1, 1.7.0. These are tested versions, not a compatibility range; coverage differs per version, see [Verification](#verification) |
72
+ | OS | Windows 11 and Ubuntu 24.04. macOS is untested (no Apple hardware here) |
103
73
 
104
- Install through `pi install`; a bare `npm i pi-workfeed` makes npm resolve those peers on its
105
- own, which is not how this package is meant to be loaded.
74
+ The extensions import four packages they do not ship: `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, `@earendil-works/pi-tui` and `typebox`. The running pi host supplies all four, so they are declared as `peerDependencies` with `*`; the copy that actually loads is pi's. Install through `pi install`, because a bare `npm i pi-workfeed` makes npm resolve those peers on its own, which is not how this package is meant to be loaded.
106
75
 
107
76
  ### 1. Install the package
108
77
 
@@ -120,44 +89,30 @@ pi install ./pi-workfeed -l # project-local: .pi/settings.json, loads after
120
89
  /reload
121
90
  ```
122
91
 
123
- A new session picks the package up at startup; an already-open session needs `/reload`.
124
- Two extensions (`todo`, `journal`) and one skill (`workfeed-analysis`) load together.
92
+ A new session picks the package up at startup; an already-open session needs `/reload`. Two extensions (`todo`, `journal`) and one skill (`workfeed-analysis`) load together.
125
93
 
126
94
  ### 3. Verify that all three arrived
127
95
 
128
96
  | Check | What it proves |
129
97
  |---|---|
130
- | `pi config` (Tab switches personal / project scope) | the package is listed and its resources — two extensions and the skill — are there and enabled |
131
- | `/wf-todos` in a session | the todo extension loaded: it prints the current list (empty at first) |
132
- | `/workfeed` | the journal loaded and is already writing: it prints the session id and both file paths |
133
- | the first prompt after `/reload` | one line appears naming the log file — that is the journal announcing itself once, not a second install |
98
+ | `pi config` (Tab switches personal / project scope) | the package is listed; two extensions and the skill are present and enabled |
99
+ | `/wf-todos` in a session | the todo extension loaded; it prints the current list (empty at first) |
100
+ | `/workfeed` | the journal loaded and is already writing; it prints the session id and both file paths |
101
+ | the first prompt after `/reload` | one line appears naming the log file: the journal announcing itself once, not a second install |
134
102
 
135
- If `/wf-todos` and `/workfeed` work but the skill never appears in `pi config`, the skill
136
- directory was filtered out: check that `pi.skills` in the installed `package.json` still
137
- points at `./skills`.
103
+ If `/wf-todos` and `/workfeed` work but the skill never appears in `pi config`, the skill directory was filtered out: check that `pi.skills` in the installed `package.json` still points at `./skills`.
138
104
 
139
- **What gets created.** One entry in the pi settings file at install time, nothing else. After
140
- the first session there are two files under `~/.pi/agent/logs/<date>/` — what each one is for
141
- is in [What you get](#what-you-get). The digest appears only once the first task settles, and
142
- is refreshed at session start, at session end and on `/workfeed-digest`; nothing is written
143
- outside that directory.
105
+ What gets created: one entry in the pi settings file at install time, nothing else. After the first session there are two files under `~/.pi/agent/logs/<date>/` (see [What you get](#what-you-get)). The digest appears once the first task settles, and is refreshed at session start, at session end and on `/workfeed-digest`. Nothing is written outside that directory.
144
106
 
145
- **To uninstall.** `pi remove pi-workfeed` (or delete the entry from
146
- `~/.pi/agent/settings.json`). That removes the code and stops all recording; the logs stay
147
- until you delete `~/.pi/agent/logs/` — they are yours, not the package's.
107
+ To uninstall: `pi remove pi-workfeed`, or delete the entry from `~/.pi/agent/settings.json`. That removes the code and stops all recording. The logs stay until you delete `~/.pi/agent/logs/`; they are yours.
148
108
 
149
- **To stop recording content** before the first prompt: `PI_WORKFEED_CONTENT=0` — timing,
150
- tool names and todo structure still recorded, prompt text and tool output never written.
151
- The per-channel detail is in [Privacy](#privacy).
109
+ To stop recording content before the first prompt, set `PI_WORKFEED_CONTENT=0`. Timing, tool names and todo structure are still recorded; prompt text and tool output are never written. The per-channel detail is in [Privacy](#privacy).
152
110
 
153
111
  ## Privacy
154
112
 
155
- The first session after install prints one line — where the log is, that prompt text and
156
- tool output are recorded, and the switch that stops it — so the policy is visible at the
157
- moment it starts applying, not only here.
113
+ The first session after install prints one line: where the log is, that prompt text and tool output are recorded, and the switch that stops it. The policy is visible at the moment it starts applying, not only here.
158
114
 
159
- What each channel records is a fixed policy, not an accident — a log is expected to be
160
- shared, attached to a bug report, or read by a colleague:
115
+ What each channel records is a fixed policy. A log is expected to be shared, attached to a bug report, or read by a colleague:
161
116
 
162
117
  | Data | Default | `PI_WORKFEED_CONTENT=0` |
163
118
  |---|---|---|
@@ -172,17 +127,9 @@ shared, attached to a bug report, or read by a colleague:
172
127
  | other tool arguments | per-tool summary (`redacted`) | key names + byte counts (`shape`) |
173
128
  | todo text | kept ≤120 chars | omitted, length only |
174
129
 
175
- `PI_WORKFEED_ARGS` overrides the argument channel alone: `full` (debugging), `redacted`,
176
- `shape`, `off`. Argument values are scrubbed in **every** mode, including `full` and the
177
- fallback branch used for tools this package does not know (MCP servers, other extensions).
130
+ `PI_WORKFEED_ARGS` overrides the argument channel alone: `full` (debugging), `redacted`, `shape`, `off`. Argument values are scrubbed in every mode, including `full` and the fallback branch used for tools this package does not know (MCP servers, other extensions).
178
131
 
179
- **Redaction is best effort, not a guarantee.** It matches common shapes: `--token …`,
180
- `Authorization: …`, `API_KEY=…`, `sk-…`, `AKIA…`, JWTs, inline PEM keys, `curl -u u:p`,
181
- `DATABASE_URL=…`, and `scheme://user:password@host` DSNs. A secret that reads like an
182
- ordinary word will survive — no pattern list can fix that. The log is written `0600` in a
183
- `0700` directory (best effort on Windows, which has no POSIX modes) because even a
184
- metadata-only log reveals which tools ran, on which files, and for how long. Treat the
185
- directory as sensitive either way.
132
+ Redaction is best effort, not a guarantee. It matches common shapes: `--token …`, `Authorization: …`, `API_KEY=…`, `sk-…`, `AKIA…`, JWTs, inline PEM keys, `curl -u u:p`, `DATABASE_URL=…`, and `scheme://user:password@host` DSNs. A secret that reads like an ordinary word will survive; no pattern list can fix that. The log is written `0600` in a `0700` directory (best effort on Windows, which has no POSIX modes). Even a metadata-only log reveals which tools ran, on which files, and for how long, so treat the directory as sensitive either way.
186
133
 
187
134
  ## What you get
188
135
 
@@ -192,28 +139,24 @@ directory as sensitive either way.
192
139
  └── workfeed-<sid>.digest.md # derived: rebuilt from the .jsonl above, not from memory
193
140
  ```
194
141
 
195
- Status line shows `⏱ elapsed · tool · #item · tN · calls`.
142
+ The status line shows `elapsed · tool · #item · tN · calls`, in the same faint style as pi's own footer.
196
143
 
197
- Two surfaces, both real:
144
+ Two surfaces:
198
145
 
199
146
  | Surface | What it is | How you reach it |
200
147
  |---|---|---|
201
- | `/wf-todos`, `/workfeed`, `/workfeed-digest` | **pi slash commands**, handled in-process by the extension | type them inside a pi session — they are not shell commands |
202
- | `rebuildDigest(path)` | **library API** (`extensions/journal/replay.ts`), returns `{ text, integrity }` | import it from your own script; `hasDamage(integrity)` gives the same verdict |
148
+ | `/wf-todos`, `/workfeed`, `/workfeed-digest` | pi slash commands, handled in-process by the extension | type them inside a pi session; they are not shell commands |
149
+ | `rebuildDigest(path)` | library API (`extensions/journal/replay.ts`), returns `{ text, integrity }` | import it from your own script; `hasDamage(integrity)` gives the same verdict |
203
150
 
204
- Why the names differ: `wf-` is the short form for the command you type *while working*, and
205
- `wf-todos` names the noun it touches because another todo extension may be loaded beside this
206
- one; `workfeed` stays whole on the two commands that report on the record itself.
151
+ `wf-` is the short form for the command you type while working; `wf-todos` names the noun it touches because another todo extension may be loaded beside this one. `workfeed` stays whole on the two commands that report on the record itself.
207
152
 
208
- `/workfeed-digest` rebuilds the digest *inside a session* (after a restart, or when a digest
209
- looks stale); rebuilding offline is the library call, not a command. There is no shell command
210
- and no `npx` entry — the reasoning is in the CHANGELOG.
153
+ `/workfeed-digest` rebuilds the digest inside a session (after a restart, or when a digest looks stale). Rebuilding offline is the library call. There is no shell command and no `npx` entry; the reasoning is in the CHANGELOG.
211
154
 
212
- ## What the digest looks like
155
+ File names are prefixed `workfeed-` so this logger never collides with another extension that writes `session-*.jsonl` into the same directory. Two loggers in one folder would interleave foreign lines into each other's files.
213
156
 
214
- One real session — three prompts, seven tool calls, one failed bash, one todo list that was
215
- partly cleared — rebuilt offline from the JSONL. Session id and paths shortened, nothing else
216
- edited:
157
+ ### What the digest looks like
158
+
159
+ One real session: three prompts, seven tool calls, one failed bash, one todo list that was partly cleared. Rebuilt offline from the JSONL; session id and paths shortened, nothing else edited:
217
160
 
218
161
  ```text
219
162
  # workfeed digest
@@ -274,66 +217,39 @@ last failures
274
217
  | 3 | pending · dropped | 0s | 0% | edit a file |
275
218
  ```
276
219
 
277
- What each block is for, in the order to read them:
278
-
279
- - **`## data quality` first, on purpose.** `4/7 calls carry an item (57%)` says the item column
280
- is a lower bound; `1 skipped` is pi answering "nothing to compact" on a small session, not a
281
- failure — calling that an error would make a healthy install look broken.
282
- - **`## tasks`** — one row per prompt; `ok` means a `settle` arrived, and a killed prompt shows
283
- up as started-without-settle instead of vanishing.
284
- - **`## tools`** — keeps a slow tool and a broken tool apart (separate `failed` count) and keeps
285
- sub-second detail (`108ms`, `1.4s`): a floored column of `0s` cannot answer "which call was
286
- slow", which is the question this digest exists for.
287
- - **`slowest calls` / `last failures`** — ranked evidence with `task` and `item` attached. Only
288
- two of these five carry an `item`; the ratio above is what tells you that.
289
- - **`## todo items`** — `dropped (timing kept)`: an item that left the list keeps the time it
290
- already spent, so 2.5s does not collapse into "0 items".
291
- - **Ranked lists are capped, and a missing row means "outside the cap", not "did not happen".**
292
- `## tools` keeps the eight tool names with the highest total, `slowest calls` is the top five
293
- by `durMs`, `last failures` is the last five failing calls. The counters still cover every
294
- call — the caps are on rendering, not on counting.
295
-
296
- ## Ask the agent, not a dashboard
297
-
298
- There is deliberately no report generator, no HTML page, no metrics daemon. The entry
299
- point is the files; the consumer is the model. Typical prompts that work out of the box:
220
+ How to read each block, in order:
221
+
222
+ - `## data quality` comes first on purpose. `4/7 calls carry an item (57%)` says the item column is a lower bound. `1 skipped` is pi answering "nothing to compact" on a small session; calling that an error would make a healthy install look broken.
223
+ - `## tasks`: one row per prompt. `ok` means a `settle` arrived; a killed prompt shows up as started-without-settle instead of vanishing.
224
+ - `## tools` keeps a slow tool and a broken tool apart (separate `failed` count) and keeps sub-second detail (`108ms`, `1.4s`). A floored column of `0s` cannot answer "which call was slow", which is the question this digest exists for.
225
+ - `slowest calls` / `last failures`: ranked evidence with `task` and `item` attached. Only two of these five carry an `item`; the ratio above is what tells you that.
226
+ - `## todo items`: an item that left the list keeps the time it already spent (`dropped`, timing kept), so 2.5s does not collapse into "0 items".
227
+ - Ranked lists are capped, and a missing row means "outside the cap", not "did not happen". `## tools` keeps the eight tool names with the highest total, `slowest calls` the top five by `durMs`, `last failures` the last five failing calls. The counters still cover every call; the caps are on rendering only.
228
+
229
+ ### Log size and cleanup
230
+
231
+ This package never rotates or deletes logs, and their size is predictable: a three-prompt, seven-call session wrote 11.7 KB of JSONL and a 1.7 KB digest (43 events, about 270 bytes per event), so a 2 000-call day is roughly half a megabyte. Every session appends to `~/.pi/agent/logs/<date>/`; delete the date folders you no longer need. A digest is derived, so removing it costs nothing; removing a day removes that day's evidence. Each session prints its log path on startup, so a cleanup never has to guess.
232
+
233
+ ## Ask the agent
234
+
235
+ There is no report generator, no HTML page, no metrics daemon. The entry point is the files; the consumer is the model. Typical prompts that work out of the box:
300
236
 
301
237
  - "read today's workfeed digest and tell me where this session's time went"
302
238
  - "which tool calls were slow, and were they slow because of the tool or the model?"
303
239
  - "which todo item ate the most time, and did it actually finish?"
304
240
  - "look at the last failures and tell me whether they are one root cause"
305
241
 
306
- The bundled skill gives the agent the measurement definitions and the drill-down
307
- procedure, so it does not guess what `durationMs` means or confuse wall clock with
308
- monotonic tool time.
242
+ The bundled skill gives the agent the measurement definitions and the drill-down procedure, so it does not guess what `durationMs` means or confuse wall clock with monotonic tool time.
309
243
 
310
- ## Design philosophy
244
+ ## How this relates to other tooling
311
245
 
312
- A session is a workflow — tasks, work items, turns, tool calls, outcomes — not a transcript, and
313
- recording it as correlated events is what makes "where did the time go" answerable. Raw events
314
- are the truth and the digest is derived: rebuilt from the log by `replay.ts`
315
- (`parse → aggregate → digest`), never accumulated in memory, so 2 000 calls still count 2 000.
316
- Models are the consumer, not dashboards; every number has a definition, and where the log
317
- cannot answer, the answer is "not recorded".
246
+ SQLite tool-call audit extensions are forensic logs for humans: what ran, in what order, after the fact. Workfeed records the layer above the command, which task and which work item the call belonged to, so "where did this task's time go" is already in the data rather than reconstructed by hand.
318
247
 
319
- Every line carries the four join keys (`v` / `sid` / `task` / `item`), which is what makes the
320
- stream joinable. The protocol — per-type field tables, the digest contract, the invariants —
321
- lives in the docs bundle ([`docs/README.md`](https://github.com/Wren-Xin/pi-workfeed/blob/main/docs/README.md) is the index), with a
322
- machine-readable twin at
323
- [`schemas/workfeed-event-v1.schema.json`](https://github.com/Wren-Xin/pi-workfeed/blob/main/schemas/workfeed-event-v1.schema.json).
248
+ OpenTelemetry's GenAI semantic conventions describe model and tool activity as spans for exporters and backends. This is not an OTLP exporter and does not replace tracing: it writes a local JSONL plus a digest the agent reads in-session. Fleet-level latency and cost live there; "what happened during this task, and why was it slow" lives here.
324
249
 
325
- ## How this relates to other tooling
250
+ ## Reference
326
251
 
327
- - **SQLite tool-call audit extensions** are forensic logs for humans: what ran, in what
328
- order, after the fact. Workfeed records the layer above the command — which task and which
329
- work item the call belonged to — so "where did this task's time go" is already in the data
330
- rather than reconstructed by hand.
331
- - **OpenTelemetry's GenAI semantic conventions** describe model and tool activity as spans
332
- for exporters and backends. This is not an OTLP exporter and does not replace tracing: it
333
- writes a local JSONL plus a digest the agent reads in-session. Fleet-level latency and cost
334
- live there; "what happened during this task, and why was it slow" lives here.
335
-
336
- ## Environment variables
252
+ ### Environment variables
337
253
 
338
254
  | Variable | Default | Effect |
339
255
  |---|---|---|
@@ -344,85 +260,49 @@ machine-readable twin at
344
260
  | `PI_WORKFEED_OFF` | — | `1` disables the journal |
345
261
  | `PI_WORKFEED_TODO_OFF` | — | `1` disables the todo extension |
346
262
 
347
- ## Honest notes
348
-
349
- - **Cost is not recorded.** Self-hosted OpenAI-compatible endpoints report `cost: 0`;
350
- writing that number into a log teaches wrong lessons. Tokens are recorded, price them
351
- yourself.
352
- - **Todo state is stored twice on purpose**: in tool result `details` (correct after
353
- `/fork` and `/tree`) and in a `pi.appendEntry` custom entry (survives compaction, which
354
- drops old messages). Losing the list on `/compact` is the bug this design avoids.
355
- - **Item timing cannot separate agent time from human time.** It measures how long an item
356
- stayed `in_progress`.
357
- - **Attribution is frozen at tool start, not at settle.** A slow call keeps the `task` and
358
- `item` that launched it; if the todo list moves mid-call the `todo` line moves, the call
359
- does not. Read each line's own `item` instead of pairing lines by timestamp.
360
- - **File names are prefixed `workfeed-`** so this logger never collides with another
361
- extension that writes `session-*.jsonl` into the same directory. Two loggers in one
362
- folder would interleave foreign lines into each other's files.
363
- - **Path handling is portable** (`os.homedir()` + `path.join`, no separators assumed); which
364
- platforms that was actually checked on is in [Verification](#verification).
365
- - **Logs are never rotated or deleted** by this package, and their size is predictable: a
366
- three-prompt, seven-call session wrote **11.7 KB** of JSONL and a **1.7 KB** digest (43
367
- events, ≈270 bytes per event), so a 2 000-call day is roughly half a megabyte. Every session
368
- appends to `~/.pi/agent/logs/<date>/`, so delete the date folders you no longer need; a
369
- digest is derived, so removing it costs nothing, and removing a day removes that day's
370
- evidence. Each session prints its log path on startup, so a cleanup never has to guess.
263
+ ### Versioning
264
+
265
+ Wire, package and source versions are independent on purpose, and only the wire one is a contract. It is frozen at `v: 1` for this release: no new fields, no new event types, enforced by a snapshot test instead of a note in a document. Bump criteria, the release checklist and the rules that keep the three numbers apart are one click in: [`docs/README.md`](https://github.com/Wren-Xin/pi-workfeed/blob/main/docs/README.md) (second entry). The protocol itself and its machine-readable schema are linked from [How it works](#how-it-works).
266
+
267
+ ## Limitations
268
+
269
+ - Cost is not recorded. Self-hosted OpenAI-compatible endpoints report `cost: 0`, and writing that number into a log teaches wrong lessons. Tokens are recorded; price them yourself.
270
+ - Item timing cannot separate agent time from human time. It measures how long an item stayed `in_progress`.
371
271
 
372
272
  ## Verification
373
273
 
374
- Reproduce the suite yourself from a git checkout — the suite is **not** shipped in the
375
- tarball, so this cannot be run from an npm install; no build step or dev install beyond Node:
274
+ Reproduce the suite yourself from a git checkout. The suite is not shipped in the tarball, so this cannot be run from an npm install; no build step or dev install beyond Node:
376
275
 
377
276
  ```bash
378
277
  node --experimental-strip-types test/run.mjs # exactly what `npm test` calls
379
278
  ```
380
279
 
381
- The run ends with `ALL SUITES PASS`. `--experimental-strip-types` needs Node 22.6+ (the
382
- suites import the TypeScript sources directly); Node 22.19+ is the version this release
383
- states support against.
280
+ The run ends with `ALL SUITES PASS`. `--experimental-strip-types` needs Node 22.6+ (the suites import the TypeScript sources directly); Node 22.19+ is the version this release states support against.
384
281
 
385
- Test suites run against stubs, and a stub can only prove the code matches *our description*
386
- of pi's interface. A real session was therefore run end to end — real extension loading,
387
- real `bash`/`read`/`edit`, real compaction, real fork, real restart — and it found two
388
- field names the stubs had got wrong. The record — what the run covered, what the stubs could
389
- not prove, and the platform matrix — is the third entry in the
390
- [`docs/` index](https://github.com/Wren-Xin/pi-workfeed/blob/main/docs/README.md).
282
+ Test suites run against stubs, and a stub can only prove the code matches our description of pi's interface. A real session was therefore run end to end: real extension loading, real `bash`/`read`/`edit`, real compaction, real fork, real restart. It found two field names the stubs had got wrong. The record (what the run covered, what the stubs could not prove, and the platform matrix) is the third entry in the [`docs/` index](https://github.com/Wren-Xin/pi-workfeed/blob/main/docs/README.md).
391
283
 
392
- The matrix in full — this is the only place the exact versions are written down:
284
+ The matrix in full. This is the only place the exact versions are written down:
393
285
 
394
286
  - Windows 11 (pi 1.5.0, Node 22.23.2): verified.
395
- - Ubuntu 24.04 (pi 1.5.1, Node 24.22.1): verified by a second-environment rerun of the
396
- same flow (the maintainer's own run on another machine, not a third party)
397
- — all suites pass, the nine-step scenario completed with a real compaction, 11
398
- JSONL↔digest cross-checks matched, and `0600`/`0700` file modes held.
399
- - macOS: **not verified** — this project is limited by resources and has no Apple hardware
400
- available, so it was never exercised on macOS. If you run it there and hit a problem,
401
- [file an issue](https://github.com/Wren-Xin/pi-workfeed/issues/new/choose); the form asks
402
- for pi version, Node version and the `## data quality` block, which is exactly what a
403
- report needs to be diagnosable.
404
-
405
- ## Versioning
406
-
407
- Wire, package and source versions are independent on purpose, and only the wire one is a
408
- contract: it is **frozen at `v: 1` for this release** — no new fields, no new event types,
409
- enforced by a snapshot test instead of a note in a document. Bump criteria, the release
410
- checklist and the rules that keep the three numbers apart are one click in:
411
- [`docs/README.md`](https://github.com/Wren-Xin/pi-workfeed/blob/main/docs/README.md) (second entry).
287
+ - Ubuntu 24.04 (pi 1.5.1, Node 24.22.1): verified by a second-environment rerun of the same flow (the maintainer's own run on another machine, not a third party). All suites pass, the nine-step scenario completed with a real compaction, 11 JSONL↔digest cross-checks matched, and `0600`/`0700` file modes held.
288
+ - Windows 11 (pi 1.6.1, Node 24.22.1): session lifecycle only. Both extensions load, events arrive, log and digest are written, `workfeed_todo` is registered; tool calls, compaction, fork and restart were not re-run on this version.
289
+ - Windows 11 (pi 1.7.0, Node 24.22.1): session lifecycle + event path only. Both extensions load, events arrive, the journal is written and `pi` exits 0; 1.7.0's only breaking change (telemetry removal) does not touch this package. The retry-inflates-turns behaviour reproduced live and the 0-based `turn` fix was confirmed in a real log; tool calls, todo attribution, compaction, fork and restart were not re-run on this version.
290
+ - macOS: not verified. This project is limited by resources and has no Apple hardware available, so it was never exercised on macOS. If you run it there and hit a problem, [file an issue](https://github.com/Wren-Xin/pi-workfeed/issues/new/choose); the form asks for pi version, Node version and the `## data quality` block, which is exactly what a report needs to be diagnosable.
291
+
292
+ On the Node floor: 22.19.0 is pi's own floor (`@earendil-works/pi-coding-agent` declares the same in its `engines`), not a stricter one this package invented. The suites have also come back green on Node 22.12.0; below 22.19 you are outside the version support is stated against, which is not the same as "will not run". The first thing that would break on an older 22.x is the `--experimental-strip-types` flag itself.
293
+
294
+ Path handling is portable (`os.homedir()` + `path.join`, no separators assumed); the platforms actually checked are listed in the matrix above.
412
295
 
413
296
  ## Roadmap
414
297
 
415
- - v0.1.0 (this)
298
+ - v0.1.1 (this)
416
299
 
417
300
  Next, in no promised order:
418
301
 
419
302
  - per-task token attribution to work items
420
303
  - cross-session query examples in the bundled skill
421
304
 
422
- Release history — the pre-release iteration from `0.1.0-dev` to `0.4.6` — is in
423
- [`HISTORY.md`](https://github.com/Wren-Xin/pi-workfeed/blob/main/HISTORY.md), kept in the
424
- repository and deliberately not shipped in the package (so the link points at GitHub, not at
425
- a path inside the tarball).
305
+ Release history (the pre-release iteration from `0.1.0-dev` to `0.4.6`) is in [`HISTORY.md`](https://github.com/Wren-Xin/pi-workfeed/blob/main/HISTORY.md), kept in the repository and deliberately not shipped in the package, so the link points at GitHub rather than at a path inside the tarball.
426
306
 
427
307
  ## 中文速用
428
308
 
@@ -435,4 +315,4 @@ a path inside the tarball).
435
315
 
436
316
  ## License
437
317
 
438
- MIT
318
+ MIT
package/docs/README.md CHANGED
@@ -6,6 +6,9 @@
6
6
  checklist
7
7
  - [verification.md](verification.md) — what a real pi session covered, what the stubs could
8
8
  not prove, and the platform matrix
9
+ - [decisions/有效决策主表.md](decisions/有效决策主表.md) — the decision log owned by this repo
10
+ (`ADR-WF` 3 items, migrated from the platform master table on 2026-11-30; cross-repo source
11
+ pointers are plain text, not links)
9
12
 
10
13
  The machine-readable form of the protocol is
11
14
  [`schemas/workfeed-event-v1.schema.json`](../schemas/workfeed-event-v1.schema.json);
@@ -0,0 +1,17 @@
1
+ # 有效决策主表(pi-workfeed · ADR-WF)
2
+
3
+ - 状态:已接受
4
+ - Owner:L2 运维岗位
5
+ - 最后更新:2026-11-30(决策分域迁移:本表按 `ADR-WF` 域重建,承 `ADR-PLT-023`)
6
+ - 维护:L2 运维岗位登记并署名留痕;被取代/作废条目移入同目录淘汰条目表并保留替代关系;每次登记刷新本行日期
7
+
8
+ > 本表只收 pi-workfeed 仓内的技术决策:wire schema、发行起号、分支与 tag 策略。跨仓或全机约束走平台层 `PLT`。
9
+ > 编号:`ADR-WF-NNN`,迁移时一次性重排;此后因取代/作废腾出的号永久空置、不复用。旧号 `001~052` 已封存,只用于历史文本与迁移前快照。
10
+ > 状态口径(依据平台库 specs 子目录的「文档书写规范」§4.2):状态列只写生命周期词(提议/已接受/已取代),实施列独立记实施态(未实施/实施中/已落地),两维不混写。
11
+ > 条数口径:本表 3 条,全部由平台主表迁入(迁移日 2026-11-30,映射见平台文档库 decisions 子目录的「项目仓决策索引」)。
12
+
13
+ | 编号 | 主题 | 状态 | 实施 | 定案 | 有效结论(可直接执行) | 权威链接 | 备注 |
14
+ |---|---|---|---|---|---|---|---|
15
+ | ADR-WF-001 | pi-workfeed wire schema v1 首发前冻结 | 已接受 | 已落地 | 2026-11-10 | **首发前 wire `schemaVersion = 1` 冻结**:不新增字段、不新增事件类型;冻结以**快照测试**守住(契约摘要存 `test/fixtures/schema-freeze-v1.json`,测试从机器 schema 重建摘要逐字段比对,增删字段、改 `required`、增事件类型均挂测);确需改 wire 则按三轴版本策略升 wire 版本并同提交更新快照,**不得以普通补丁带出**;派生视图(digest)新增行不受此冻结约束 | 平台库 plans/当前任务清单.md(S 行) | 操作层=pi-workfeed 项目仓的 docs/schema.md「Freeze」节与 docs/versioning.md 第 4 条;落地证据=负向探针(给 `settle` 加一字段即 FAIL,探针后 schema 按 sha256 复原)+`v0.4.6` tag |
16
+ | ADR-WF-002 | 首次公开发行独立起号,不承接内部迭代号 | 已接受 | 已落地 | 2026-11-10 | **首次对外发布的版本号独立起号**:内部迭代号(含 `0.1.0`…`0.4.6` 等开发里程碑、均已打 tag)**不与发行号同一序列**;发行前重定 `package.json` / `CHANGELOG` 首条 / `README` Roadmap / `HEAD` tag 四处为新号并逐处核对,内部里程碑在 `CHANGELOG` 里以 `-dev` 或明确标注区分,**不改写历史 tag、不重建历史提交**;版本一致性判据随之改为「**每个 tag 必须命名它自己提交里的版本**」,不再用「最新 tag 不得高于当前版本」——后者会把有意降号判成缺陷 | 平台库 plans/当前任务清单.md(S 行) | 操作层=pi-workfeed 项目仓的 docs/versioning.md 与 test/version.test.mjs;依据=2026-11-10 用户口径「第一个发行版本采用 v0.1 的版本号」,而内部迭代已到 0.4.6 且 npm 从未发布;落地=`7598ad8` + tag `v0.1.0`;判据部分已由 ADR-WF-003 在 tag 分线后加严 |
17
+ | ADR-WF-003 | pi-workfeed 版本 tag 分线:release 只用 v*,开发里程碑用 dev/ | 已接受 | 已落地 | 2026-11-10 | **tag 命名空间分线**:可发布的 release tag 只用 `v<package version>`;开发里程碑一律 `dev/<version>`(如 `dev/0.4.6`),保留历史但不与 release 线并列。判据随之加严为两条——每个 tag(含 `dev/`)都必须命名它自己提交里的版本,且**任何 `v*` tag 不得声称高于 `package.json` 的版本**;理由:`v0.4.6` 与 npm `0.1.0` 并列,在 GitHub 上会被读成「最新版是 0.4.6」,与读者刚装的包自相矛盾 | 平台库 plans/当前任务清单.md(S 行) | 操作层=pi-workfeed 的 docs/versioning.md「What enforces this」与 test/version.test.mjs;落地=`v0.3.1`…`v0.4.6` 改名为 `dev/*` 并双远端同步、`v0.1.0` 解绑后重打到 `4323e2f`;对 ADR-WF-002 的关系=编号结论不变,仅其「判据」在 tag 分线后加严 |
package/docs/schema.md CHANGED
@@ -160,7 +160,7 @@ No extra fields. Marks the agent loop beginning after a `prompt`.
160
160
 
161
161
  | `phase` | Field | Type | Req | Notes |
162
162
  |---|---|---|---|---|
163
- | `start` | `turn` | integer | yes | 1-based index within the task |
163
+ | `start` | `turn` | integer | yes | 0-based index within the task; pi numbers the first turn `0` |
164
164
  | `start` | `model` | string | opt | model serving this turn |
165
165
  | `end` | `turn` | integer | yes | same index as its `start` |
166
166
  | `end` | `durMs` | integer | opt | `turn_start`→`turn_end` wall clock |
@@ -53,6 +53,75 @@ regress a path that the suite covers only with stubs.
53
53
  | `/compact` | either a real compaction with `before`, or the empty answer reported as `skipped` — never as a failure | pass — small session: `0 completed, 0 failed, 1 skipped — skipped: …Nothing to compact…`; large session: `1 completed, 0 failed`, `before: 24604` |
54
54
  | abnormal exit (kill mid-tool) | `1 started without an end line`, `0/1 prompts have a settle — … unknown, not zero`; offline rebuild needs no pi | pass — 5 events, rebuilt digest says exactly that |
55
55
 
56
+ ## pi 1.6.1 re-check (2026-11-27)
57
+
58
+ pi 1.6.1 replaced 1.5.0 on the Windows host this release was originally verified on. A
59
+ version bump can break a package like this without any change here — the extension API and
60
+ the event names the handlers subscribe to are the host's, not ours — so the upgrade was
61
+ followed by the checks below.
62
+
63
+ - `pi --version` → `1.6.1`; `pi list` still resolves the checkout as a package.
64
+ - every event the two extensions subscribe to is declared in 1.6.1's
65
+ `dist/core/extensions/types.d.ts` — `session_start`, `session_shutdown`,
66
+ `before_agent_start`, `agent_start`, `turn_start`, `turn_end`, `tool_call`,
67
+ `tool_execution_end`, `user_bash`, `after_provider_response`, `session_compact`,
68
+ `session_compact_failed`, `agent_settled`, and `session_tree` for the todo list — and so
69
+ are the context members used: `cwd`, `hasUI`, `model`, `thinkingLevel`,
70
+ `sessionManager.getSessionId/getSessionFile/getBranch`, `ui.notify/setStatus`,
71
+ `pi.events`, `pi.appendEntry`.
72
+ - the compat view 1.6.1 hands extensions for `@earendil-works/pi-ai` still exports
73
+ `StringEnum` (now built with TypeBox's `TUnsafe` instead of a bare JSON schema), and
74
+ `pi-tui`'s `Text` and `typebox` are still among the virtual modules.
75
+ - a headless session (`pi -p --no-session --mode json`) still produced the journal's own
76
+ picture: 16 events, `1/1 prompts have a settle`, `16 lines, 0 dropped, 0 of unknown
77
+ type`, digest written, and `workfeed_todo` present in the system prompt's tool list.
78
+ The provider was unreachable in that run (`ECONNREFUSED`, the local model was not
79
+ running), which is why no tool calls and no tokens appear — the point was extension
80
+ loading and the event path, not a model answer.
81
+
82
+ What this does **not** cover: tool calls, todo attribution, `/compact`, fork and restart on
83
+ 1.6.1. Those paths are recorded above on 1.5.x only; a session with a real model and real
84
+ tools is still what closes them.
85
+
86
+ Two behaviours observed on 1.6.1. The first is left as it is (it comes from the host); the second was a schema/prose mismatch that is now reconciled on the schema side:
87
+
88
+ - pi's automatic retry re-emits `agent_start` / `turn_start` / `turn_end` per attempt, so
89
+ one prompt that failed three times is recorded as four turns and the digest row reads
90
+ `| 1 | 14s | 4 | 0 |`. The settle line stays single and task coverage stays `1/1`.
91
+ - `turn` numbers are 0-based (`0` for the first turn). Pre-upgrade logs from 2026-11-10,
92
+ 11-13 and 11-19 already carried `turn: 0`, so this was a standing mismatch between the
93
+ prose/schema (`minimum: 1`) and pi's counter, not something 1.6.1 introduced. **Reconciled
94
+ 2026-12-03 on the schema side**: the schema now declares `turn` as `minimum: 0` with a
95
+ 0-based description, `docs/schema.md` says 0-based, and `test/fixtures/all-events.jsonl`
96
+ records the first turn as `turn: 0` — a value the old `minimum: 1` would have rejected, so
97
+ it now guards the relaxation. pi's behaviour is unchanged and correct; only the contract was wrong.
98
+
99
+ ## pi 1.7.0 re-check (2026-12-03)
100
+
101
+ pi 1.7.0 replaced 1.6.1 on the same Windows host (Node 24.22.1). 1.7.0's only breaking change
102
+ is the removal of install telemetry (`enableInstallTelemetry`, `PI_TELEMETRY`,
103
+ `/api/report-install`) — a surface this package does not touch. What pi-workfeed depends on was
104
+ re-checked:
105
+
106
+ - `pi --version` → `1.7.0`; `pi list` still resolves the checkout as a package, and
107
+ `workfeed_todo` still appears in the system prompt's tool list.
108
+ - all 14 subscribed event names are still declared in 1.7.0's `dist/core/extensions/types.d.ts`
109
+ (no rename). `sessionManager.getSessionId` / `getBranch` are absent from that file in **both**
110
+ 1.6.1 and 1.7.0 — they live in `agent-session.js` and are reached at runtime, so this is not a
111
+ 1.7.0 change.
112
+ - the compat exports pi-workfeed imports are unchanged: `StringEnum` (pi-ai compat view, built
113
+ with TypeBox `TUnsafe`), `pi-tui`'s `Text`, and `typebox` (still 1.3.27).
114
+ - a headless session (`pi -p --no-session --mode json`) loaded both extensions and wrote the
115
+ journal: `session`, `prompt`, `agent_start`, `turn`, `settle`, `shutdown` all recorded, `pi`
116
+ exit 0, no extension error. The provider was unreachable (`ECONNREFUSED`, local model not
117
+ running), so pi auto-retried 3× — which live-reproduced the retry-inflates-turns note above
118
+ (`settle turns=4`, `4× agent_start`, `8× turn`, settle still single, coverage still `1/1`).
119
+ The recorded `turn` values were all `0`, confirming the 0-based fix in `1ecffd3`.
120
+
121
+ What this does **not** cover: tool calls, todo attribution, `/compact`, fork and restart on
122
+ 1.7.0 — the same scope limit as the 1.6.1 re-check; a session with a real model and real tools
123
+ is still what closes them.
124
+
56
125
  ## Clean install from the published artifact
57
126
 
58
127
  Installing from the checkout proves nothing about the artifact: the checkout has `test/`, the
@@ -111,6 +180,8 @@ The digest states the real ratio instead of rounding it.
111
180
  |---|---|
112
181
  | Windows 11 · pi 1.5.0 · Node 22 | verified with the flow above |
113
182
  | Linux (Ubuntu 24.04 x64) · pi 1.5.1 · Node 24 | **verified** by a second-environment rerun of the same flow (the maintainer's own run on another machine, not a third party): all suites pass, the nine-step scenario completed including a real compaction, and 11 JSONL↔digest cross-checks matched (80 events, 4 tasks, 15 finished calls, `10/15` item attribution, `1 completed, 0 failed`). Linux-specific expectations held: log and digest `0600`, log dir `0700`, POSIX paths, Chinese text intact, date directory in local time |
183
+ | Windows 11 · pi 1.6.1 · Node 24 | **partially re-verified** — session lifecycle only, per the re-check above: extensions load, events arrive, log and digest are written, `workfeed_todo` is registered; tool calls, todo attribution, compaction, fork and restart were not re-run on this version |
184
+ | Windows 11 · pi 1.7.0 · Node 24 | **partially re-verified** — session lifecycle + event path only, per the 1.7.0 re-check above: extensions load, events arrive, journal written, `pi` exit 0, the retry-inflates-turns behaviour reproduced live and the 0-based `turn` fix confirmed in a real log; tool calls, todo attribution, compaction, fork and restart were not re-run on this version |
114
185
  | macOS | **not verified.** This project is limited by resources — no Apple hardware is available, so the extension has never been exercised on macOS. If you run it there and hit a problem, please open an issue with your pi version, your Node version, and the `## data quality` block of the affected digest |
115
186
 
116
187
  Linux and macOS run the same Node code path; the only platform-specific parts are the file
@@ -37,6 +37,16 @@ const SCHEMA_VERSION = 1;
37
37
  const FILE_MODE = 0o600;
38
38
  const DIR_MODE = 0o700;
39
39
 
40
+ /**
41
+ * Wrap footer status text in the same faint intensity pi applies to its own footer line.
42
+ *
43
+ * `ctx.ui.setStatus()` takes plain text and exposes no theme accessor, and pi does not dim
44
+ * extension statuses (footer.js dims only the truncation ellipsis), so we carry the exact
45
+ * sequence `theme.fg("dim", …)` emits — SGR 2 … 22;39 (theme.js). `sanitizeStatusText` strips
46
+ * only \r\n\t and pi-tui's visibleWidth/truncateToWidth ignore ANSI, so layout is unaffected.
47
+ */
48
+ const faint = (text: string): string => `\x1b[2m${text}\x1b[22;39m`;
49
+
40
50
  const EXCERPT = Math.max(0, Number(process.env.PI_WORKFEED_EXCERPT ?? 2048));
41
51
  const CONTENT = process.env.PI_WORKFEED_CONTENT !== "0";
42
52
  const ROOT = process.env.PI_WORKFEED_DIR || join(homedir(), ".pi", "agent", "logs");
@@ -349,13 +359,13 @@ export default function (pi: ExtensionAPI) {
349
359
  const status = (ctx: ExtensionContext | undefined, running: boolean) => {
350
360
  if (!ctx?.hasUI) return;
351
361
  if (!running) {
352
- ctx.ui.setStatus("workfeed", lastTaskMs ? `⏱ last ${fmtDur(lastTaskMs)}` : "");
362
+ ctx.ui.setStatus("workfeed", lastTaskMs ? faint(`last ${fmtDur(lastTaskMs)}`) : "");
353
363
  return;
354
364
  }
355
365
  const elapsed = taskStartTs ? Date.now() - taskStartTs : 0;
356
366
  const tail = currentTool ? ` · ${currentTool}` : "";
357
367
  const it = item ? ` · #${item}` : "";
358
- ctx.ui.setStatus("workfeed", `⏱ ${fmtDur(elapsed)}${tail}${it} · t${turnIndex} · ${tools} calls`);
368
+ ctx.ui.setStatus("workfeed", faint(`${fmtDur(elapsed)}${tail}${it} · t${turnIndex} · ${tools} calls`));
359
369
  };
360
370
 
361
371
  const startTicker = (ctx: ExtensionContext) => {
@@ -74,6 +74,14 @@ function maxIdOf(todos: Todo[]): number {
74
74
  return todos.reduce((m, t) => Math.max(m, t.id), 0);
75
75
  }
76
76
 
77
+ /**
78
+ * Wrap footer status text in the same faint intensity pi applies to its own footer line, so the
79
+ * todo status reads like the journal status beside it. `ctx.ui.setStatus()` has no theme accessor
80
+ * and pi does not dim extension statuses, so we carry the sequence `theme.fg("dim", …)` emits
81
+ * (SGR 2 … 22;39). Only \r\n\t are stripped and ANSI is ignored for width, so layout is unaffected.
82
+ */
83
+ const faint = (text: string): string => `\x1b[2m${text}\x1b[22;39m`;
84
+
77
85
  function summarize(todos: Todo[], now = Date.now()): string {
78
86
  if (todos.length === 0) return "todo list is empty";
79
87
  const done = todos.filter((t) => t.status === "completed").length;
@@ -172,7 +180,7 @@ export default function (pi: ExtensionAPI) {
172
180
  const active = todos.find((t) => t.status === "in_progress");
173
181
  const parts = [`${done}/${todos.length}`];
174
182
  if (active) parts.push(`> ${active.text.slice(0, 28)} ${fmtDur(itemElapsedMs(active))}`);
175
- ctx.ui.setStatus("workfeed-todo", parts.join(" · "));
183
+ ctx.ui.setStatus("workfeed-todo", faint(parts.join(" · ")));
176
184
  }
177
185
  }
178
186
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-workfeed",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Structured event journal for Pi agent workflows, with task timing, replay, and evidence-based analysis",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -42,7 +42,7 @@
42
42
  "properties": {
43
43
  "t": { "const": "turn" },
44
44
  "phase": { "enum": ["start", "end"] },
45
- "turn": { "type": "integer", "minimum": 1 },
45
+ "turn": { "type": "integer", "minimum": 0, "description": "0-based turn index within the task; pi numbers the first turn 0" },
46
46
  "durMs": { "type": "integer", "minimum": 0 },
47
47
  "outcome": { "type": "string" },
48
48
  "stopReason": { "type": "string" },