wendkeep 0.29.1 → 0.29.2

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
@@ -4,6 +4,19 @@ 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.29.2] — 2026-07-09
8
+
9
+ ### Fixed
10
+ - **Iteration turn marker renamed `codex-turn` → `wk-turn`** (provider-neutral). A **Claude**
11
+ session's iterations carried `<!-- codex-turn: … -->` — a legacy name from when this was a
12
+ Codex-only tool, confusing in the note source. The marker is a dedup key, so the change is
13
+ backward-compatible: `hasTurnMarker` still recognizes the legacy name, and `insertIteration`
14
+ **self-migrates** any `codex-turn` → `wk-turn` on the next write (backfill re-processes older
15
+ notes). Shared helpers `turnMarker` / `hasTurnMarker` / `normalizeTurnMarkers` in obsidian-common;
16
+ `vault-health` recognizes both.
17
+ - Note-visible fallback text "Checkpoint registrado pelo hook Stop do **Codex**" → provider-neutral.
18
+ - Stderr log prefix `[codex-obsidian]` → `[wendkeep]` across the hooks.
19
+
7
20
  ## [0.29.1] — 2026-07-09
8
21
 
9
22
  ### Added
@@ -557,6 +557,27 @@ export function wikilinkFromRel(relPath) {
557
557
  return `[[${relPath.replace(/\.md$/i, '').replaceAll('\\', '/')}]]`;
558
558
  }
559
559
 
560
+ // Per-iteration dedup marker (an invisible HTML comment). Provider-neutral name `wk-turn`; the
561
+ // old `codex-turn` (legacy, from when this was a Codex-only tool) is still RECOGNIZED so notes
562
+ // written by older versions keep deduping, and normalizeTurnMarkers migrates them on the next write.
563
+ export const TURN_MARKER = 'wk-turn';
564
+ export const LEGACY_TURN_MARKERS = ['codex-turn'];
565
+
566
+ export function turnMarker(id) {
567
+ return `<!-- ${TURN_MARKER}: ${id} -->`;
568
+ }
569
+
570
+ export function hasTurnMarker(content, id) {
571
+ return [TURN_MARKER, ...LEGACY_TURN_MARKERS].some((m) => String(content || '').includes(`<!-- ${m}: ${id} -->`));
572
+ }
573
+
574
+ // Rewrite any legacy turn markers in a note to the current name (self-healing migration).
575
+ export function normalizeTurnMarkers(content) {
576
+ let c = String(content || '');
577
+ for (const m of LEGACY_TURN_MARKERS) c = c.replaceAll(`<!-- ${m}: `, `<!-- ${TURN_MARKER}: `);
578
+ return c;
579
+ }
580
+
560
581
  export function listMarkdownFiles(dir) {
561
582
  try {
562
583
  return readdirSync(dir).filter((f) => f.endsWith('.md'));
@@ -36,7 +36,9 @@ function parseArgs(argv) {
36
36
  }
37
37
 
38
38
  function hasTurnMarker(content, turnId) {
39
- return content.includes(`<!-- codex-turn: ${turnId} -->`);
39
+ // recognize both the current `wk-turn` and the legacy `codex-turn`
40
+ return content.includes(`<!-- wk-turn: ${turnId} -->`)
41
+ || content.includes(`<!-- codex-turn: ${turnId} -->`);
40
42
  }
41
43
 
42
44
  function sessionEntries(vaultBase, args) {
@@ -135,7 +137,7 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
135
137
  try {
136
138
  main();
137
139
  } catch (error) {
138
- process.stderr.write(`[codex-obsidian] Backfill falhou: ${error.message}\n`);
140
+ process.stderr.write(`[wendkeep] Backfill falhou: ${error.message}\n`);
139
141
  process.exitCode = 1;
140
142
  }
141
143
  }
@@ -387,6 +387,6 @@ function main() {
387
387
  try {
388
388
  main();
389
389
  } catch (error) {
390
- process.stderr.write(`[codex-obsidian] UserPromptSubmit falhou: ${error.message}\n`);
390
+ process.stderr.write(`[wendkeep] UserPromptSubmit falhou: ${error.message}\n`);
391
391
  writeHookOutput({});
392
392
  }
@@ -161,7 +161,7 @@ function main() {
161
161
  try {
162
162
  sweepStaleSessionsFile(vaultBase, now, undefined, input.transcript_path || input.transcriptPath || '');
163
163
  } catch (error) {
164
- process.stderr.write(`[codex-obsidian] sweep de sessões falhou: ${error.message}\n`);
164
+ process.stderr.write(`[wendkeep] sweep de sessões falhou: ${error.message}\n`);
165
165
  }
166
166
 
167
167
  // Reuso da nota apontada pelo CURRENT_SESSION só quando é a MESMA conversa
@@ -309,9 +309,9 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
309
309
  try {
310
310
  main();
311
311
  } catch (error) {
312
- process.stderr.write(`[codex-obsidian] SessionStart falhou: ${error.message}\n`);
312
+ process.stderr.write(`[wendkeep] SessionStart falhou: ${error.message}\n`);
313
313
  writeHookOutput({
314
- systemMessage: `[codex-obsidian] Não foi possível criar a sessão Obsidian: ${error.message}`,
314
+ systemMessage: `[wendkeep] Não foi possível criar a sessão Obsidian: ${error.message}`,
315
315
  });
316
316
  }
317
317
  }
@@ -30,6 +30,9 @@ import {
30
30
  wikilinkFromRel,
31
31
  writeControl,
32
32
  writeHookOutput,
33
+ turnMarker,
34
+ hasTurnMarker,
35
+ normalizeTurnMarkers,
33
36
  } from './obsidian-common.mjs';
34
37
 
35
38
  function extractContentText(content) {
@@ -596,7 +599,7 @@ export function buildIterationBlock(tx, input) {
596
599
  // inclui recortes da conversa do turno, sem despejar outputs brutos.
597
600
  return `
598
601
  ### ${formatTimeForHeading(now)} - ${heading}
599
- <!-- codex-turn: ${turnId} -->
602
+ ${turnMarker(turnId)}
600
603
 
601
604
  **Pedido:** ${compactText(promptText, 1000)}
602
605
 
@@ -609,7 +612,7 @@ ${formatConversation(turn)}
609
612
 
610
613
  **Arquivos detectados no turno:** ${formatInlineList(files, 'Nenhum arquivo detectado automaticamente.')}
611
614
 
612
- **Estado ao final do turno:** ${compactText(latestAssistant || 'Checkpoint registrado pelo hook Stop do Codex.', 900)}
615
+ **Estado ao final do turno:** ${compactText(latestAssistant || 'Checkpoint registrado automaticamente ao final do turno.', 900)}
613
616
  `;
614
617
  }
615
618
 
@@ -751,17 +754,19 @@ function relocateOrphanIterations(content) {
751
754
  }
752
755
 
753
756
  export function insertIteration(sessionPath, block, turnId, tx) {
754
- let content = readFileSync(sessionPath, 'utf-8');
755
- if (content.includes(`<!-- codex-turn: ${turnId} -->`)) {
757
+ const original = readFileSync(sessionPath, 'utf-8');
758
+ // Self-heal: migrate any legacy `codex-turn` markers to the neutral name on this write.
759
+ let content = normalizeTurnMarkers(original);
760
+ if (hasTurnMarker(content, turnId)) {
756
761
  // Turno já registrado: ainda assim repara órfãos e seções dedicadas.
757
762
  const repaired = applyDedicatedSections(relocateOrphanIterations(content), tx);
758
- if (repaired !== content) writeFileSync(sessionPath, repaired, 'utf-8');
763
+ if (repaired !== original) writeFileSync(sessionPath, repaired, 'utf-8');
759
764
  return false;
760
765
  }
761
766
  content = relocateOrphanIterations(content);
762
767
  content = insertIntoIteracoes(content, block);
763
768
  content = applyDedicatedSections(content, tx);
764
- writeFileSync(sessionPath, content, 'utf-8');
769
+ if (content !== original) writeFileSync(sessionPath, content, 'utf-8');
765
770
  return true;
766
771
  }
767
772
 
@@ -1037,7 +1042,7 @@ function main() {
1037
1042
  try {
1038
1043
  applyLinearLinks(sessionPath, tx, vaultBase, sessionRel);
1039
1044
  } catch (error) {
1040
- process.stderr.write(`[codex-obsidian] Linear link falhou: ${error.message}\n`);
1045
+ process.stderr.write(`[wendkeep] Linear link falhou: ${error.message}\n`);
1041
1046
  }
1042
1047
 
1043
1048
  try {
@@ -1048,7 +1053,7 @@ function main() {
1048
1053
  transcriptPath,
1049
1054
  });
1050
1055
  } catch (error) {
1051
- process.stderr.write(`[codex-obsidian] Token usage falhou: ${error.message}\n`);
1056
+ process.stderr.write(`[wendkeep] Token usage falhou: ${error.message}\n`);
1052
1057
  }
1053
1058
 
1054
1059
  // Subagent/workflow telemetry (0.10.0): fold sibling subagent transcripts into the note.
@@ -1056,7 +1061,7 @@ function main() {
1056
1061
  try {
1057
1062
  upsertSubagentUsage(sessionPath, transcriptPath);
1058
1063
  } catch (error) {
1059
- process.stderr.write(`[codex-obsidian] Subagent usage falhou: ${error.message}\n`);
1064
+ process.stderr.write(`[wendkeep] Subagent usage falhou: ${error.message}\n`);
1060
1065
  }
1061
1066
 
1062
1067
  if (!shouldFinalizeSession()) {
@@ -1127,7 +1132,7 @@ function main() {
1127
1132
  const rows = buildBrainIndex(vaultBase);
1128
1133
  buildBrainDigest(vaultBase, rows);
1129
1134
  } catch (error) {
1130
- process.stderr.write(`[codex-obsidian] brain index/digest falhou: ${error.message}\n`);
1135
+ process.stderr.write(`[wendkeep] brain index/digest falhou: ${error.message}\n`);
1131
1136
  }
1132
1137
 
1133
1138
  pingObsidianVault(input.obsidian_api_key);
@@ -1138,7 +1143,7 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
1138
1143
  try {
1139
1144
  main();
1140
1145
  } catch (error) {
1141
- process.stderr.write(`[codex-obsidian] Stop falhou: ${error.message}\n`);
1146
+ process.stderr.write(`[wendkeep] Stop falhou: ${error.message}\n`);
1142
1147
  writeHookOutput({});
1143
1148
  }
1144
1149
  }
@@ -966,7 +966,7 @@ if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
966
966
  try {
967
967
  runCli();
968
968
  } catch (error) {
969
- process.stderr.write(`[codex-obsidian] Token usage falhou: ${error.message}\n`);
969
+ process.stderr.write(`[wendkeep] Token usage falhou: ${error.message}\n`);
970
970
  process.exitCode = 1;
971
971
  }
972
972
  }
@@ -39,7 +39,7 @@ function parseArgs(argv) {
39
39
  function findDuplicateTurnMarkers(content) {
40
40
  const seen = new Set();
41
41
  const duplicated = new Set();
42
- const regex = /<!-- codex-turn: ([^>]+) -->/g;
42
+ const regex = /<!-- (?:wk-turn|codex-turn): ([^>]+) -->/g;
43
43
  let match;
44
44
  while ((match = regex.exec(content)) !== null) {
45
45
  const turnId = match[1].trim();
@@ -104,10 +104,10 @@ function checkSession({ vaultBase, sessionRel, control, registry }) {
104
104
 
105
105
  const content = readFileSync(sessionPath, 'utf-8');
106
106
  const duplicates = findDuplicateTurnMarkers(content);
107
- metrics.turnMarkers = (content.match(/<!-- codex-turn:/g) || []).length;
107
+ metrics.turnMarkers = (content.match(/<!-- (?:wk-turn|codex-turn):/g) || []).length;
108
108
  metrics.duplicateTurnMarkers = duplicates.length;
109
109
 
110
- if (duplicates.length) failures.push(`Marcadores codex-turn duplicados: ${duplicates.join(', ')}`);
110
+ if (duplicates.length) failures.push(`Marcadores de turno duplicados: ${duplicates.join(', ')}`);
111
111
  if (hasHeadingAfterClosing(content)) failures.push('Há headings/iterações após ## Encerramento.');
112
112
  if (!usageSectionIsPlaced(content)) failures.push('## Uso de tokens e custos está fora da posição esperada.');
113
113
  if (hasDefaultPending(content)) warnings.push('Pendências ainda contém placeholders padrão.');
@@ -197,7 +197,7 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href)
197
197
  try {
198
198
  main();
199
199
  } catch (error) {
200
- process.stderr.write(`[codex-obsidian] Vault health falhou: ${error.message}\n`);
200
+ process.stderr.write(`[wendkeep] Vault health falhou: ${error.message}\n`);
201
201
  process.exitCode = 1;
202
202
  }
203
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wendkeep",
3
- "version": "0.29.1",
3
+ "version": "0.29.2",
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": {