wendkeep 0.41.0 → 0.42.0
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 +11 -0
- package/README.md +43 -2
- package/hooks/renumber-decisions.mjs +47 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,17 @@ All notable changes to **wendkeep** are documented here. Format based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this project follows
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.42.0] — 2026-07-17
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- `wendkeep renumber-decisions --apply` agora **move** as notas de subpastas `DIA N` para a
|
|
12
|
+
pasta do mês da sua data (achatando o legado), consistente com `renumber-bugs`/
|
|
13
|
+
`renumber-learnings` do 0.41.0. Antes só renomeava in-place para `ADR-NNNN-<slug>` e
|
|
14
|
+
deixava as pastas de dia intactas. Os wikilinks já eram reescritos vault-wide; agora
|
|
15
|
+
acompanham o novo caminho de mês, e as pastas `DIA` que ficam vazias são removidas.
|
|
16
|
+
Notas sem data resolvível preservam a pasta atual (nunca são perdidas). Idempotente.
|
|
17
|
+
|
|
7
18
|
## [0.41.0] — 2026-07-16
|
|
8
19
|
|
|
9
20
|
### Added
|
package/README.md
CHANGED
|
@@ -138,14 +138,18 @@ Restart Codex and Claude Code after reseeding their generated skills.
|
|
|
138
138
|
| `wendkeep cost rebuild [opts]` | Recalcula custos históricos do transcript principal e subagents usando `SESSION_REGISTRY`. Dry-run por padrão; `--apply` atualiza notas e grava `.brain/COST_REBUILD.json`. Aceita `--session`, `--limit` e `--json`. |
|
|
139
139
|
| `wendkeep session list\|show\|use` | Lista o registry multi-sessão, mostra uma conversa ou muda somente o foco humano de `CURRENT_SESSION.md`. |
|
|
140
140
|
| `wendkeep change bind <slug> --session <id>` | Vincula ou transfere uma change para uma conversa canônica sem esconder as demais pendências. |
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
| `wendkeep note new --type bug\|learning "<title>"` | Create a **numbered** derived note (`BUG-`/`APR-NNNN`) in the month folder and print its vault path. `--date YYYY-MM-DD`. |
|
|
142
|
+
| `wendkeep renumber-decisions` | Renumber `04-Decisões` to `ADR-NNNN-<slug>` chronologically, move notes out of legacy `DIA N` subfolders into the month folder, and rewrite wikilinks. Preview by default; `--apply` / `--json`. |
|
|
143
|
+
| `wendkeep renumber-bugs` | Same for `05-Bugs` → `BUG-NNNN-<slug>`. |
|
|
144
|
+
| `wendkeep renumber-learnings` | Same for `06-Aprendizados`/`06-Learnings` → `APR-NNNN-<slug>`. |
|
|
143
145
|
| `wendkeep lesson add "t" "l"` | Record a project-local lesson (injected at the next SessionStart). |
|
|
144
146
|
| `wendkeep sync-defs` | Copy `.brain/agents\|skills` into `.codex/agents`, `.claude/skills`, `.agents/skills`; `--check` detects drift. |
|
|
145
147
|
| `wendkeep validate-memory [path]` | Validate `.brain/CORE.md` (cap 25, 3 sections, no secrets/PII). |
|
|
146
148
|
| `wendkeep doctor [--vault P]` | Run a vault health check (integrity of sessions, registry, links). |
|
|
147
149
|
| `wendkeep --version` / `--help` | Version / usage. |
|
|
148
150
|
|
|
151
|
+
Session notes use one live `## Agentes, tokens e custos` snapshot. Main-agent and subagent hooks recompose it atomically, with costs, token dimensions, reasoning tokens and effort per model/source.
|
|
152
|
+
|
|
149
153
|
## Retroactive memory (`import`) — install today, remember yesterday
|
|
150
154
|
|
|
151
155
|
Install wendkeep into an existing project and it only remembers sessions **from now on**. `wendkeep import` fixes that: one command backfills your project's past **Claude & Codex** sessions into the vault — deduped, dated, with cost — so the graph starts full, not empty. It rebuilds each transcript as a full session note in its **real** date folder — frontmatter (tagged with the transcript's real provider), one iteration block per turn, cost + subagent telemetry, derived decision/bug/learning notes, finalized closing. An offline replay of the live capture flow, so an imported note is indistinguishable from a captured one.
|
|
@@ -162,6 +166,43 @@ wendkeep import --vault .myproject-vault --source codex # just Codex
|
|
|
162
166
|
- **`--from <dir>`** / **`--codex-from <dir>`** point at the transcript folders explicitly (use if the auto-derived path misses). Also: `--since <date>`, `--limit <n>`, `--json`.
|
|
163
167
|
- Once imported, `wendkeep cost` aggregates your entire history — retroactively, across both agents.
|
|
164
168
|
|
|
169
|
+
## Derived notes — numbered like ADRs (`note new`, `renumber-*`)
|
|
170
|
+
|
|
171
|
+
Decisions, bugs and learnings are **derived notes**: they live in the month folder of their tree (`<folder>/<year>/<MM-MON>/`) and carry a sequential id — `ADR-0001`, `BUG-0001`, `APR-0001`. One glance tells you what a note is and where it sits in the project's history. No day-level subfolders: a `DIA N` folder holding one note is noise, and it hides the note from folder-wide search.
|
|
172
|
+
|
|
173
|
+
**Creating one** (never write the file by hand — the command owns the number, the folder and the frontmatter):
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
wendkeep note new --type bug "login 500s when the token expires mid-refresh"
|
|
177
|
+
# → 05-Bugs/2026/07-JUL/BUG-0007-login-500s-when-the-token-expires.md
|
|
178
|
+
|
|
179
|
+
wendkeep note new --type learning "a regex without /g only ever returns the first match"
|
|
180
|
+
# → 06-Aprendizados/2026/07-JUL/APR-0003-a-regex-without-g-only-ever-returns.md
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
It prints the created path, numbers from the current max (recursive scan), files it in the month folder for today (`--date YYYY-MM-DD` to override), and links the active session in `source:` so the graph stays connected. Agents get this rule injected at SessionStart — they call the command instead of guessing a filename.
|
|
184
|
+
|
|
185
|
+
**Migrating an existing vault.** Notes created before `0.41.0` have date-prefixed names (`2026-07-16-bug-<slug>.md`) and may sit in legacy `DIA N` subfolders. One command per tree renumbers them chronologically, moves them up into the month folder, and rewrites every wikilink across the vault:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Bugs — 05-Bugs → BUG-NNNN
|
|
189
|
+
wendkeep renumber-bugs # preview: prints every from → to, writes nothing
|
|
190
|
+
wendkeep renumber-bugs --apply # migrate
|
|
191
|
+
|
|
192
|
+
# Learnings — 06-Aprendizados → APR-NNNN
|
|
193
|
+
wendkeep renumber-learnings # preview
|
|
194
|
+
wendkeep renumber-learnings --apply # migrate
|
|
195
|
+
|
|
196
|
+
# Decisions — 04-Decisões → ADR-NNNN (since 0.30.0)
|
|
197
|
+
wendkeep renumber-decisions # preview
|
|
198
|
+
wendkeep renumber-decisions --apply # migrate
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
- **Preview is the default.** Nothing is written until `--apply` — read the `from → to` list first; that is where a mangled slug shows up, before it touches your files.
|
|
202
|
+
- **One tree at a time, on purpose.** There is no `renumber-all`: each folder is migrated and reviewed on its own.
|
|
203
|
+
- **Order is chronological**, derived from the note's date (frontmatter → filename prefix → folder), so `BUG-0001` is genuinely the oldest bug — not the first one the scanner happened to read.
|
|
204
|
+
- **Wikilinks are rewritten vault-wide** (full-path and basename forms, aliases preserved), the body's `type`/`bug:`/`apr:`/H1 are normalized, and emptied `DIA` folders are removed. **Idempotent**: a second `--apply` renames nothing. Close Obsidian while migrating, and commit the vault first if it is under git.
|
|
205
|
+
|
|
165
206
|
## Change lifecycle — the a2 loop (spec‑driven, native)
|
|
166
207
|
|
|
167
208
|
Beyond capturing sessions, wendkeep is a **harness**: a native, zero‑dependency loop that keeps *intent* (specs), *work* (changes) and *proof* (sensors) together in the vault, wikilinked into the Obsidian graph.
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
// chronological order (the order decisions were made), renames the files in place, updates every
|
|
6
6
|
// wikilink to them across the whole vault, and normalizes each note's `type`/`adr`/H1. Idempotent:
|
|
7
7
|
// running it again on an already-canonical vault is a no-op (same order, same names).
|
|
8
|
-
import { readdirSync, readFileSync, renameSync, writeFileSync, existsSync } from 'node:fs';
|
|
8
|
+
import { readdirSync, readFileSync, renameSync, rmdirSync, writeFileSync, existsSync } from 'node:fs';
|
|
9
9
|
import { join, dirname, relative } from 'node:path';
|
|
10
10
|
import { getLocale } from './locale.mjs';
|
|
11
|
+
import { ensureDir, monthFolderRelFromDateStr } from './obsidian-common.mjs';
|
|
11
12
|
|
|
12
13
|
export const padAdr = (n) => String(n).padStart(4, '0');
|
|
13
14
|
|
|
@@ -29,17 +30,25 @@ function walkDecisions(vaultBase, decisionsDir) {
|
|
|
29
30
|
return out;
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
// Resolve a decision's date: frontmatter `date:` > filename `YYYY-MM-DD` prefix > dated folder
|
|
34
|
+
// (`.../YYYY/MM-.../DIA N/`). Returns '' when nothing is derivable. Used by both the sort key
|
|
35
|
+
// and the destination-folder computation (so a note is filed under the month of its real date).
|
|
36
|
+
export function decisionDate({ abs, base, content }) {
|
|
37
|
+
const c = content ?? (existsSync(abs) ? safeRead(abs) : '');
|
|
38
|
+
const fmDate = c.match(/^date:\s*(\d{4}-\d{2}-\d{2})/m);
|
|
39
|
+
if (fmDate) return fmDate[1];
|
|
40
|
+
const fnDate = base.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
41
|
+
if (fnDate) return fnDate[1];
|
|
42
|
+
const folderDate = String(abs).replaceAll('\\', '/').match(/\/(\d{4})\/(\d{2})-[^/]+\/DIA\s+(\d{1,2})\//i);
|
|
43
|
+
if (folderDate) return `${folderDate[1]}-${folderDate[2]}-${String(folderDate[3]).padStart(2, '0')}`;
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
|
|
32
47
|
// Chronological sort key: date, then time, then existing ADR number, then filename — all derived
|
|
33
48
|
// from (in priority) frontmatter, filename prefix, and the dated folder path.
|
|
34
49
|
export function decisionSortKey({ abs, base, content }) {
|
|
35
50
|
const c = content ?? (existsSync(abs) ? safeRead(abs) : '');
|
|
36
|
-
const
|
|
37
|
-
const fnDate = base.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
38
|
-
const folderDate = abs.replaceAll('\\', '/').match(/\/(\d{4})\/(\d{2})-[^/]+\/DIA\s+(\d{1,2})\//i);
|
|
39
|
-
let date = '9999-12-31';
|
|
40
|
-
if (fmDate) date = fmDate[1];
|
|
41
|
-
else if (fnDate) date = fnDate[1];
|
|
42
|
-
else if (folderDate) date = `${folderDate[1]}-${folderDate[2]}-${String(folderDate[3]).padStart(2, '0')}`;
|
|
51
|
+
const date = decisionDate({ abs, base, content: c }) || '9999-12-31';
|
|
43
52
|
|
|
44
53
|
const fmTime = c.match(/^started_at:\s*\S*T(\d{2}:\d{2}:\d{2})/m);
|
|
45
54
|
const srcTime = c.match(/\[\[[^\]]*\/(\d{2})-(\d{2})-[^\]]*\]\]/); // session wikilink HH-MM prefix
|
|
@@ -131,13 +140,16 @@ export function planRenumber(vaultBase) {
|
|
|
131
140
|
const num = i + 1;
|
|
132
141
|
const slug = slugFromDecisionName(n.base);
|
|
133
142
|
const newBase = `ADR-${padAdr(num)}-${slug}.md`;
|
|
134
|
-
|
|
135
|
-
|
|
143
|
+
// Destination = the month folder of the note's date (like renumber-derived): flatten legacy
|
|
144
|
+
// `DIA N` subfolders. No derivable date -> keep the current dirname (never lose the note).
|
|
145
|
+
const date = decisionDate(n);
|
|
146
|
+
const destDirRel = date ? monthFolderRelFromDateStr(decisionsDir, date, vaultBase) : dirname(n.rel);
|
|
147
|
+
const newRel = `${destDirRel.replaceAll('\\', '/')}/${newBase}`;
|
|
136
148
|
const oldAdr = n.base.match(/^ADR-(\d+)/i);
|
|
137
149
|
renames.push({
|
|
138
150
|
num, slug,
|
|
139
151
|
oldAbs: n.abs,
|
|
140
|
-
newAbs: join(
|
|
152
|
+
newAbs: join(vaultBase, destDirRel, newBase),
|
|
141
153
|
oldRelNoExt: n.rel.replace(/\.md$/i, ''),
|
|
142
154
|
newRelNoExt: newRel.replace(/\.md$/i, ''),
|
|
143
155
|
oldBaseNoExt: n.base.replace(/\.md$/i, ''),
|
|
@@ -173,11 +185,12 @@ export function renumberDecisions(vaultBase, { apply = false } = {}) {
|
|
|
173
185
|
temps.set(r, tmp);
|
|
174
186
|
});
|
|
175
187
|
|
|
176
|
-
// Phase B — normalize each note's body, then land it at its final path
|
|
177
|
-
// write the normalized content
|
|
178
|
-
// temp
|
|
188
|
+
// Phase B — normalize each note's body, then land it at its final path (possibly a different
|
|
189
|
+
// month directory). For a renamed note we write the normalized content over its temp and
|
|
190
|
+
// renameSync temp -> final; for an unchanged name we rewrite in place.
|
|
179
191
|
for (const r of renames) {
|
|
180
192
|
const tmp = temps.get(r);
|
|
193
|
+
ensureDir(dirname(r.newAbs));
|
|
181
194
|
if (tmp) {
|
|
182
195
|
writeFileSync(tmp, normalizeDecisionContent(safeRead(tmp), r.num), 'utf8');
|
|
183
196
|
renameSync(tmp, r.newAbs);
|
|
@@ -194,5 +207,25 @@ export function renumberDecisions(vaultBase, { apply = false } = {}) {
|
|
|
194
207
|
const after = rewriteLinks(before, linkRenames);
|
|
195
208
|
if (after !== before) { writeFileSync(abs, after, 'utf8'); report.filesTouched += 1; report.linksUpdated += 1; }
|
|
196
209
|
}
|
|
210
|
+
|
|
211
|
+
// Phase D — drop legacy `DIA *` folders left empty by the move to the month folder.
|
|
212
|
+
pruneEmptyDayFolders(vaultBase, getLocale(vaultBase).folders.decisions);
|
|
197
213
|
return report;
|
|
198
214
|
}
|
|
215
|
+
|
|
216
|
+
// Remove now-empty `DIA *` folders under the decisions root (best-effort, fail-quiet).
|
|
217
|
+
function pruneEmptyDayFolders(vaultBase, folderRel) {
|
|
218
|
+
const walk = (dir) => {
|
|
219
|
+
let entries;
|
|
220
|
+
try { entries = readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
221
|
+
for (const e of entries) {
|
|
222
|
+
if (!e.isDirectory()) continue;
|
|
223
|
+
const abs = join(dir, e.name);
|
|
224
|
+
walk(abs);
|
|
225
|
+
if (/^DIA\s/i.test(e.name)) {
|
|
226
|
+
try { rmdirSync(abs); } catch { /* não-vazio — fica */ }
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
walk(join(vaultBase, folderRel));
|
|
231
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wendkeep",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "A persistent-memory harness for AI coding agents on your Obsidian vault: turn-by-turn session capture plus a native, zero-dependency spec→change→verify→archive loop (sensor-gated, independent verdict, mutation discrimination). Local-first, agent-agnostic (Claude Code, Codex, Cursor…).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|