@kevin0181/memoc 1.3.0 → 1.4.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.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/bin/cli.js +286 -153
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -141,7 +141,7 @@ Run it from the project root. It preserves existing project memory, including:
141
141
  - `.memoc/04-handoff.md`
142
142
  - `.memoc/06-project-rules.md`
143
143
  - Legacy `.memoc/log.md` if present
144
- - `.memoc/systems/`
144
+ - Legacy `.memoc/systems/` if present (moved to `.memoc/raw/legacy-systems/` on upgrade)
145
145
  - `.memoc/wiki/`
146
146
 
147
147
  It refreshes the managed blocks, project-local wrappers, runtime copy, PATH helpers, and memoc-owned protocol templates. User-owned memory files such as `session-summary.md`, `03-decisions.md`, `04-handoff.md`, `06-project-rules.md`, and wiki topic/source pages are preserved. Upgrade also runs the `trim-summary` compaction pass so startup memory stays small. If `memoc` is not on PATH after upgrading, keep using:
@@ -176,10 +176,10 @@ llms.txt ← LLM-facing project map
176
176
  actors/ ← Actor profiles for shared repos
177
177
  worklog/ ← Per-actor work records to reduce conflicts
178
178
  raw/ ← Immutable source material, not a startup read
179
- systems/ Subsystem docs
180
- wiki/ Synthesized knowledge base
179
+ wiki/project/ Project implementation wiki
180
+ wiki/knowledge/ Source-backed knowledge wiki
181
181
 
182
- skills/project-memory-maintainer/SKILL.md ← Wiki & systems operations guide
182
+ skills/project-memory-maintainer/SKILL.md ← Wiki operations guide
183
183
  ```
184
184
 
185
185
  ---
@@ -207,7 +207,7 @@ Every entry file (`CLAUDE.md`, `AGENTS.md`, `.cursorrules`, etc.) gets the same
207
207
  - [ ] Decision made → `03-decisions.md` (what & why) + `02`
208
208
  - [ ] Work incomplete or risky → `04-handoff.md` (verified commands, unverified items, next steps)
209
209
  - [ ] Rule/preference set → `06-project-rules.md`
210
- - [ ] Wiki/systems work → read `skills/project-memory-maintainer/SKILL.md`
210
+ - [ ] Wiki/project-memory work → read `skills/project-memory-maintainer/SKILL.md`
211
211
  - [ ] Shared repo work → prefer `memoc work "<title>" --from-git`; run `memoc activity --write` only when regenerating indexes.
212
212
  - [ ] Keep `session-summary.md` replace-only; completed work belongs in actor worklogs.
213
213
  ```
package/bin/cli.js CHANGED
@@ -246,6 +246,63 @@ function archiveLegacyLog(dir, mark) {
246
246
  mark('move', `${path.relative(dir, logPath)} -> ${path.relative(dir, archivePath)}`);
247
247
  }
248
248
 
249
+ function movePathUnique(srcPath, destPath) {
250
+ const target = uniquePath(destPath);
251
+ fs.mkdirSync(path.dirname(target), { recursive: true });
252
+ fs.renameSync(srcPath, target);
253
+ return target;
254
+ }
255
+
256
+ function archiveLegacySystems(dir, mark) {
257
+ const systemsPath = path.join(dir, '.memoc', 'systems');
258
+ if (!fs.existsSync(systemsPath)) {
259
+ mark('skip', '.memoc/systems (legacy; no dir)');
260
+ return;
261
+ }
262
+ const archivePath = movePathUnique(systemsPath, path.join(dir, '.memoc', 'raw', 'legacy-systems'));
263
+ mark('move', `${path.relative(dir, systemsPath)} -> ${path.relative(dir, archivePath)}`);
264
+ }
265
+
266
+ function migrateKnowledgeWiki(dir, mark) {
267
+ const wikiDir = path.join(dir, '.memoc', 'wiki');
268
+ const knowledgeDir = path.join(wikiDir, 'knowledge');
269
+ const moves = [
270
+ ['sources.md', 'sources.md'],
271
+ ['glossary.md', 'glossary.md'],
272
+ ['questions.md', 'questions.md'],
273
+ ['lint.md', 'lint.md'],
274
+ ['sources', 'sources'],
275
+ ['topics', 'topics'],
276
+ ['global', 'global'],
277
+ ];
278
+ for (const [from, to] of moves) {
279
+ const src = path.join(wikiDir, from);
280
+ const dest = path.join(knowledgeDir, to);
281
+ if (!fs.existsSync(src)) continue;
282
+ if (fs.existsSync(dest)) {
283
+ try {
284
+ const st = fs.statSync(dest);
285
+ if (st.isFile() && isDefaultKnowledgeScaffold(dest)) fs.unlinkSync(dest);
286
+ else continue;
287
+ } catch {
288
+ continue;
289
+ }
290
+ }
291
+ const moved = movePathUnique(src, dest);
292
+ mark('move', `${path.relative(dir, src)} -> ${path.relative(dir, moved)}`);
293
+ }
294
+ }
295
+
296
+ function isDefaultKnowledgeScaffold(filePath) {
297
+ const src = safeRead(filePath);
298
+ const name = path.basename(filePath);
299
+ if (name === 'sources.md') return src.includes('# Sources') && src.includes('_No sources recorded yet._');
300
+ if (name === 'glossary.md') return src.includes('# Glossary') && src.includes('_No terms defined yet.');
301
+ if (name === 'questions.md') return src.includes('# Open Questions') && src.includes('_No open questions yet._');
302
+ if (name === 'lint.md') return src.includes('# Wiki Lint') && src.includes('_No issues found._');
303
+ return false;
304
+ }
305
+
249
306
  function summarySectionBulletCounts(src) {
250
307
  const counts = {};
251
308
  let current = '';
@@ -797,7 +854,7 @@ function legacyManagedBlock() {
797
854
  - [ ] Decision made → \`03-decisions.md\` (what & why) + \`02\`
798
855
  - [ ] Work incomplete or risky → \`04-handoff.md\` (verified commands, unverified items, next steps)
799
856
  - [ ] Rule/preference set → \`06-project-rules.md\`
800
- - [ ] Wiki/systems work → read \`skills/project-memory-maintainer/SKILL.md\`
857
+ - [ ] Wiki/project-memory work → read \`skills/project-memory-maintainer/SKILL.md\`
801
858
  ${MGMT_E}`;
802
859
  }
803
860
 
@@ -822,7 +879,7 @@ function managedBlock() {
822
879
  - [ ] Decision made? Update \`03-decisions.md\` + \`02\`
823
880
  - [ ] Work incomplete or risky? Update \`04-handoff.md\`
824
881
  - [ ] Rule/preference set? Update \`06-project-rules.md\`
825
- - [ ] Wiki/systems work? Read \`skills/project-memory-maintainer/SKILL.md\`
882
+ - [ ] Wiki/project-memory work? Read \`skills/project-memory-maintainer/SKILL.md\`
826
883
  - [ ] User asked to update memoc/project memory? Run \`memoc update\`, then update the smallest relevant agent-owned memory files.
827
884
  - [ ] Shared repo work? Prefer \`memoc work "<title>" --from-git\` over appending shared files; run \`memoc activity --write\` only when regenerating indexes.
828
885
  - [ ] Keep \`session-summary.md\` as a replace-only snapshot under 800B; move completed work to actor worklogs and resume risks to \`04-handoff.md\`. If it grew, run \`memoc trim-summary\`.
@@ -860,43 +917,44 @@ function coreLlmsInner() {
860
917
  - [Project Brief](.memoc/00-project-brief.md): short identity and direction.
861
918
  - [Workflow](.memoc/01-agent-workflow.md): update trigger matrix.
862
919
  - [Decisions](.memoc/03-decisions.md): durable decisions.
863
- - [Systems](.memoc/systems/README.md): subsystem docs.
920
+ - [Project Wiki](.memoc/wiki/project/README.md): repo implementation docs.
921
+ - [Knowledge Wiki](.memoc/wiki/knowledge/README.md): external sources, concepts, glossary.
864
922
  - [Activity](.memoc/activity.md): generated worklog index.
865
923
  - [Raw Sources](.memoc/raw/README.md): immutable source material; do not read by default.
866
- - [Wiki](.memoc/wiki/index.md): synthesized knowledge.`;
924
+ - [Wiki](.memoc/wiki/index.md): project/knowledge wiki hub.`;
867
925
  }
868
926
 
869
927
  function headerInner(p) {
870
928
  return `# ${p.name}\n\n> LLM-facing project map for this project.`;
871
929
  }
872
930
 
873
- function systemsLlmsInner(dir) {
874
- const systemsDir = path.join(dir, '.memoc', 'systems');
875
- if (!fs.existsSync(systemsDir)) return '_None yet._';
876
- const files = fs.readdirSync(systemsDir)
931
+ function projectWikiLlmsInner(dir) {
932
+ const projectDir = path.join(dir, '.memoc', 'wiki', 'project');
933
+ if (!fs.existsSync(projectDir)) return '_None yet._';
934
+ const files = fs.readdirSync(projectDir)
877
935
  .filter(f => f.endsWith('.md') && f !== 'README.md')
878
936
  .sort();
879
937
  if (!files.length) return '_None yet._';
880
- return files.map(f => `- [${f.replace('.md', '')}](.memoc/systems/${f}): subsystem context.`).join('\n');
938
+ return files.map(f => `- [${f.replace('.md', '')}](.memoc/wiki/project/${f}): project implementation context.`).join('\n');
881
939
  }
882
940
 
883
941
  function wikiLlmsInner(dir) {
884
942
  const wikiDir = path.join(dir, '.memoc', 'wiki');
885
943
  if (!fs.existsSync(wikiDir)) return '_None yet._';
886
944
  const lines = [];
887
- const SKIP = new Set(['index.md']);
888
945
  try {
889
- for (const f of fs.readdirSync(wikiDir).sort()) {
890
- if (!f.endsWith('.md') || SKIP.has(f)) continue;
891
- try { if (fs.statSync(path.join(wikiDir, f)).isDirectory()) continue; } catch { continue; }
892
- lines.push(`- [${f.replace('.md', '')}](.memoc/wiki/${f}): wiki page.`);
946
+ const knowledgeDir = path.join(wikiDir, 'knowledge');
947
+ for (const f of ['README.md', 'sources.md', 'glossary.md', 'questions.md', 'lint.md']) {
948
+ if (fs.existsSync(path.join(knowledgeDir, f))) {
949
+ lines.push(`- [knowledge/${f.replace('.md', '')}](.memoc/wiki/knowledge/${f}): knowledge wiki page.`);
950
+ }
893
951
  }
894
952
  for (const sub of ['sources', 'topics', 'global']) {
895
- const subDir = path.join(wikiDir, sub);
953
+ const subDir = path.join(knowledgeDir, sub);
896
954
  if (!fs.existsSync(subDir)) continue;
897
955
  for (const f of fs.readdirSync(subDir).sort()) {
898
956
  if (!f.endsWith('.md')) continue;
899
- lines.push(`- [${f.replace('.md', '')}](.memoc/wiki/${sub}/${f}): wiki page.`);
957
+ lines.push(`- [knowledge/${sub}/${f.replace('.md', '')}](.memoc/wiki/knowledge/${sub}/${f}): knowledge wiki page.`);
900
958
  }
901
959
  }
902
960
  } catch {}
@@ -908,41 +966,50 @@ function wikiScaffoldFiles(memDir) {
908
966
  [
909
967
  path.join(memDir, 'wiki/index.md'),
910
968
  tplWikiIndex,
911
- src => src.includes('# Wiki Index') && src.includes('Persistent LLM-maintained project wiki') &&
912
- (src.includes('_None yet._') || !src.includes('## Graph Hubs')),
969
+ src => src.includes('# Wiki Index') && !src.includes('wiki/project'),
970
+ ],
971
+ [
972
+ path.join(memDir, 'wiki/project/README.md'),
973
+ tplWikiProjectReadme,
974
+ src => hasOnlyScaffold(src, ['# Project Wiki', 'Implementation docs']) && !src.includes('## Related'),
975
+ ],
976
+ [
977
+ path.join(memDir, 'wiki/knowledge/README.md'),
978
+ tplWikiKnowledgeReadme,
979
+ src => hasOnlyScaffold(src, ['# Knowledge Wiki', 'Source-backed concepts']) && !src.includes('## Related'),
913
980
  ],
914
981
  [
915
- path.join(memDir, 'wiki/sources.md'),
982
+ path.join(memDir, 'wiki/knowledge/sources.md'),
916
983
  tplWikiSources,
917
984
  src => hasOnlyScaffold(src, ['# Sources', '_No sources recorded yet._']) && !src.includes('## Related'),
918
985
  ],
919
986
  [
920
- path.join(memDir, 'wiki/glossary.md'),
987
+ path.join(memDir, 'wiki/knowledge/glossary.md'),
921
988
  tplWikiGlossary,
922
989
  src => hasOnlyScaffold(src, ['# Glossary', '_No terms defined yet._']) && !src.includes('## Related'),
923
990
  ],
924
991
  [
925
- path.join(memDir, 'wiki/questions.md'),
992
+ path.join(memDir, 'wiki/knowledge/questions.md'),
926
993
  tplWikiQuestions,
927
994
  src => hasOnlyScaffold(src, ['# Open Questions', '_No open questions yet._']) && !src.includes('## Related'),
928
995
  ],
929
996
  [
930
- path.join(memDir, 'wiki/lint.md'),
997
+ path.join(memDir, 'wiki/knowledge/lint.md'),
931
998
  tplWikiLint,
932
999
  src => src.includes('# Wiki Lint') && src.includes('_No issues found._') && !src.includes('## Graph Checks'),
933
1000
  ],
934
1001
  [
935
- path.join(memDir, 'wiki/sources/README.md'),
1002
+ path.join(memDir, 'wiki/knowledge/sources/README.md'),
936
1003
  tplWikiSourcesReadme,
937
1004
  src => hasOnlyScaffold(src, ['# Sources', 'Provenance records']) && !src.includes('## Related'),
938
1005
  ],
939
1006
  [
940
- path.join(memDir, 'wiki/topics/README.md'),
1007
+ path.join(memDir, 'wiki/knowledge/topics/README.md'),
941
1008
  tplWikiTopicsReadme,
942
1009
  src => hasOnlyScaffold(src, ['# Topics', 'Synthesized topic pages']) && !src.includes('## Related'),
943
1010
  ],
944
1011
  [
945
- path.join(memDir, 'wiki/global/README.md'),
1012
+ path.join(memDir, 'wiki/knowledge/global/README.md'),
946
1013
  tplWikiGlobalReadme,
947
1014
  src => hasOnlyScaffold(src, ['# Global', 'Project-wide principles']) && !src.includes('## Related'),
948
1015
  ],
@@ -1011,7 +1078,31 @@ function obsidianFrontmatterSpec(relPath) {
1011
1078
  type = 'wiki';
1012
1079
  extra.confidence = 'medium';
1013
1080
  tags.push('memoc/wiki');
1014
- if (rel.startsWith('.memoc/wiki/sources/')) {
1081
+ if (rel.startsWith('.memoc/wiki/project/')) {
1082
+ tags.push('memoc/project-wiki');
1083
+ if (rel.endsWith('/README.md')) tags.push('memoc/project-index');
1084
+ else tags.push('memoc/project-doc');
1085
+ } else if (rel.startsWith('.memoc/wiki/knowledge/')) {
1086
+ tags.push('memoc/knowledge-wiki');
1087
+ if (rel.startsWith('.memoc/wiki/knowledge/sources/')) {
1088
+ tags.push('memoc/source');
1089
+ extra.status = 'needs-synthesis';
1090
+ } else if (rel.startsWith('.memoc/wiki/knowledge/topics/')) {
1091
+ tags.push('memoc/topic');
1092
+ } else if (rel.startsWith('.memoc/wiki/knowledge/global/')) {
1093
+ tags.push('memoc/global');
1094
+ } else if (rel.endsWith('/sources.md')) {
1095
+ tags.push('memoc/source');
1096
+ } else if (rel.endsWith('/glossary.md')) {
1097
+ tags.push('memoc/glossary');
1098
+ } else if (rel.endsWith('/questions.md')) {
1099
+ tags.push('memoc/question');
1100
+ extra.status = 'needs-review';
1101
+ } else if (rel.endsWith('/lint.md')) {
1102
+ tags.push('memoc/lint');
1103
+ extra.status = 'generated';
1104
+ }
1105
+ } else if (rel.startsWith('.memoc/wiki/sources/')) {
1015
1106
  tags.push('memoc/source');
1016
1107
  extra.status = 'needs-synthesis';
1017
1108
  } else if (rel.startsWith('.memoc/wiki/topics/')) {
@@ -1215,13 +1306,13 @@ ${CORE_S}
1215
1306
  ${coreLlmsInner()}
1216
1307
  ${CORE_E}
1217
1308
 
1218
- ## Systems
1309
+ ## Project Wiki
1219
1310
 
1220
1311
  ${SYS_S}
1221
1312
  _None yet._
1222
1313
  ${SYS_E}
1223
1314
 
1224
- ## Wiki
1315
+ ## Knowledge Wiki
1225
1316
 
1226
1317
  ${WIKI_S}
1227
1318
  _None yet._
@@ -1257,7 +1348,7 @@ _Not set yet._
1257
1348
  ## How To Approach
1258
1349
 
1259
1350
  - Start from \`session-summary.md\`; search before opening more files.
1260
- - Open status, handoff, rules, map, systems, or wiki docs only when the task needs them.
1351
+ - Open status, handoff, rules, map, project wiki, or knowledge wiki only when the task needs them.
1261
1352
  - After durable work, update the smallest relevant memory set.
1262
1353
  - Do not treat generated output folders as source unless the user explicitly asks.
1263
1354
 
@@ -1304,20 +1395,19 @@ ${SNAP_E}
1304
1395
  - [Actors](actors/README.md)
1305
1396
  - [Worklog](worklog/README.md)
1306
1397
  - [Wiki Index](wiki/index.md)
1398
+ - [Project Wiki](wiki/project/README.md)
1399
+ - [Knowledge Wiki](wiki/knowledge/README.md)
1307
1400
  - [Raw Sources](raw/README.md)
1308
- - [Systems Index](systems/README.md)
1309
-
1310
- ## System Docs
1311
-
1312
- _None yet. Add entries when subsystems are documented._
1313
1401
 
1314
1402
  ## Wiki
1315
1403
 
1316
- - [Wiki Index](wiki/index.md) — hub for every synthesized wiki page.
1317
- - [Sources](wiki/sources.md) — source provenance and ingest notes.
1318
- - [Glossary](wiki/glossary.md) — project terms and aliases.
1319
- - [Open Questions](wiki/questions.md) — unresolved knowledge gaps.
1320
- - [Wiki Lint](wiki/lint.md) — orphan, stale, and contradiction checks.
1404
+ - [Wiki Index](wiki/index.md) — hub for project and knowledge wikis.
1405
+ - [Project Wiki](wiki/project/README.md) — implementation docs for this repo.
1406
+ - [Knowledge Wiki](wiki/knowledge/README.md) — source-backed concepts and external knowledge.
1407
+ - [Sources](wiki/knowledge/sources.md) — source provenance and ingest notes.
1408
+ - [Glossary](wiki/knowledge/glossary.md) — terms and aliases.
1409
+ - [Open Questions](wiki/knowledge/questions.md) — unresolved knowledge gaps.
1410
+ - [Wiki Lint](wiki/knowledge/lint.md) — orphan, stale, and contradiction checks.
1321
1411
  `;
1322
1412
  }
1323
1413
 
@@ -1400,8 +1490,8 @@ On-demand reference only. The entry-file managed block is authoritative.
1400
1490
  | \`.memoc/05-done-checklist.md\` | Before finishing substantial work |
1401
1491
  | \`.memoc/03-decisions.md\` | When a durable decision was made |
1402
1492
  | \`.memoc/memoc-usage.md\` | For command details |
1403
- | \`.memoc/systems/*.md\` | Before touching a specific subsystem |
1404
- | \`.memoc/wiki/*.md\` | For synthesized project knowledge |
1493
+ | \`.memoc/wiki/project/*.md\` | Before touching a specific subsystem |
1494
+ | \`.memoc/wiki/knowledge/*.md\` | For source-backed concepts and external knowledge |
1405
1495
  | \`llms.txt\` | For full project file map |
1406
1496
 
1407
1497
  ## Search First
@@ -1432,12 +1522,12 @@ Shared protocol for any coding agent.
1432
1522
  | --- | --- |
1433
1523
  | User asks "update memoc", "refresh project memory", or similar | Run \`memoc update\` first, then update relevant agent-owned memory files |
1434
1524
  | User creates or changes a requirement | \`02-current-project-state.md\`, \`06-project-rules.md\`, \`memoc work "<title>" --from-git\` |
1435
- | Code, config, data, or assets changed | \`02-current-project-state.md\`, relevant \`systems/*.md\`, \`memoc work "<title>" --from-git\` |
1436
- | Architecture or system behavior changed | relevant \`systems/*.md\`, \`03-decisions.md\` |
1525
+ | Code, config, data, or assets changed | \`02-current-project-state.md\`, relevant \`wiki/project/*.md\`, \`memoc work "<title>" --from-git\` |
1526
+ | Architecture or system behavior changed | relevant \`wiki/project/*.md\`, \`03-decisions.md\` |
1437
1527
  | A decision should affect future agents | \`03-decisions.md\`, \`02-current-project-state.md\` |
1438
1528
  | Work is substantial enough to resume later | \`04-handoff.md\`, \`02-current-project-state.md\`, \`memoc work "<title>" --from-git\` |
1439
- | Durable knowledge was learned | \`wiki/*.md\`, \`wiki/index.md\` |
1440
- | Source material should feed the wiki | \`memoc ingest <path-or-url>\`, then synthesize affected \`wiki/topics/*.md\` |
1529
+ | Durable project implementation knowledge was learned | \`wiki/project/*.md\`, \`wiki/index.md\` |
1530
+ | Source material should feed the wiki | \`memoc ingest <path-or-url>\`, then synthesize affected \`wiki/knowledge/topics/*.md\` |
1441
1531
  | A useful query answer should persist | \`memoc note "<title>"\`, then link related sources/topics |
1442
1532
  | Shared repo work should be traceable | \`memoc work "<title>"\`; avoid appending long details to shared core files |
1443
1533
  | \`session-summary.md\` exceeds 800B or starts accumulating history | Run \`memoc trim-summary\`; move completed history to worklog, resume details to \`04-handoff.md\` |
@@ -1456,7 +1546,8 @@ Shared protocol for any coding agent.
1456
1546
  - \`04-handoff.md\`: resume context, blockers, verified/unverified checks.
1457
1547
  - \`03-decisions.md\`: append durable decisions only.
1458
1548
  - \`worklog/<actor>/YYYY-MM/*.md\`: actor-scoped append-by-new-file activity records for shared repos.
1459
- - \`systems/*.md\` and \`wiki/*.md\`: on-demand durable knowledge.
1549
+ - \`wiki/project/*.md\`: repo implementation docs.
1550
+ - \`wiki/knowledge/*.md\`: source-backed concepts, provenance, glossary, questions.
1460
1551
  `;
1461
1552
  }
1462
1553
 
@@ -1528,7 +1619,7 @@ Run through this before saying substantial work is complete.
1528
1619
  - [ ] \`.memoc/03-decisions.md\` updated if a durable decision was made.
1529
1620
  - [ ] \`.memoc/04-handoff.md\` updated if work is incomplete or risky.
1530
1621
  - [ ] Meaningful shared work has a \`.memoc/worklog/<actor>/YYYY-MM/*.md\` entry.
1531
- - [ ] Relevant \`.memoc/systems/*.md\` or wiki pages updated.
1622
+ - [ ] Relevant \`.memoc/wiki/project/*.md\` or \`.memoc/wiki/knowledge/*.md\` pages updated.
1532
1623
 
1533
1624
  ## Communication
1534
1625
 
@@ -1715,23 +1806,25 @@ Use \`memoc update\` or \`skills/project-memory-maintainer/SKILL.md\` when:
1715
1806
  - Architecture, data flow, routing, auth, or deployment behavior changed.
1716
1807
  - A decision was made that future agents should not revisit blindly.
1717
1808
  - Work is partial, multi-step, blocked, or likely to be resumed by another agent.
1718
- - New durable knowledge belongs in \`.memoc/wiki/\` or a subsystem doc.
1809
+ - New implementation knowledge belongs in \`.memoc/wiki/project/\`.
1810
+ - Source-backed concept knowledge belongs in \`.memoc/wiki/knowledge/\`.
1719
1811
  - Shared work should be traceable without causing conflicts.
1720
1812
 
1721
1813
  Usually skip for pure Q&A, throwaway exploration, or tiny edits with no future impact.
1722
1814
 
1723
- When the user asks for a general memoc/project-memory refresh, run \`memoc update\` first. It refreshes managed sections, reconnects default wiki scaffold links, and applies Obsidian frontmatter tags. Then update only the agent-owned files whose content actually changed, such as \`.memoc/session-summary.md\`, \`.memoc/02-current-project-state.md\`, \`.memoc/04-handoff.md\`, \`.memoc/wiki/index.md\`, or actor worklogs.
1815
+ When the user asks for a general memoc/project-memory refresh, run \`memoc update\` first. It refreshes managed sections, reconnects default wiki scaffold links, and applies Obsidian frontmatter tags. Then update only the agent-owned files whose content actually changed, such as \`.memoc/session-summary.md\`, \`.memoc/02-current-project-state.md\`, \`.memoc/04-handoff.md\`, \`.memoc/wiki/index.md\`, project/knowledge wiki pages, or actor worklogs.
1724
1816
 
1725
1817
  \`.memoc/session-summary.md\` is a startup snapshot, not a timeline. Rewrite it in place, do not append old work. If it exceeds 800B, run \`memoc trim-summary\`; it archives the previous summary and rewrites a compact version. Put completed history in actor worklogs, and put unfinished/risky resume detail in \`.memoc/04-handoff.md\`.
1726
1818
 
1727
1819
  ## Updating The Wiki
1728
1820
 
1729
- Create a new Markdown file under \`.memoc/wiki/\` when synthesized knowledge should compound across sessions.
1821
+ Create wiki pages under the right layer when knowledge should compound across sessions.
1730
1822
 
1731
1823
  - \`.memoc/raw/\`: immutable source material copied or referenced by \`memoc ingest\`.
1732
- - \`.memoc/wiki/sources/\`: provenance records.
1733
- - \`.memoc/wiki/topics/\`: synthesized topic pages.
1734
- - \`.memoc/wiki/global/\`: project-wide principles.
1824
+ - \`.memoc/wiki/project/\`: implementation docs for this repo.
1825
+ - \`.memoc/wiki/knowledge/sources/\`: provenance records.
1826
+ - \`.memoc/wiki/knowledge/topics/\`: synthesized topic pages.
1827
+ - \`.memoc/wiki/knowledge/global/\`: broader source-backed principles.
1735
1828
 
1736
1829
  After creating or editing wiki pages:
1737
1830
  1. Update \`.memoc/wiki/index.md\`.
@@ -1749,7 +1842,7 @@ memoc lint-wiki
1749
1842
 
1750
1843
  ## Updating System Docs
1751
1844
 
1752
- Create or update \`.memoc/systems/*.md\` when a subsystem needs durable detail.
1845
+ Create or update \`.memoc/wiki/project/*.md\` when a subsystem needs durable implementation detail.
1753
1846
 
1754
1847
  Examples: \`frontend.md\`, \`deployment.md\`, \`data-sources.md\`, \`auth.md\`
1755
1848
  `;
@@ -1758,19 +1851,11 @@ Examples: \`frontend.md\`, \`deployment.md\`, \`data-sources.md\`, \`auth.md\`
1758
1851
  function tplSystemsReadme() {
1759
1852
  return `# Systems
1760
1853
 
1761
- Subsystem documentation for agents.
1854
+ Legacy location. Project implementation docs now live in [Project Wiki](../wiki/project/README.md).
1762
1855
 
1763
- ## How To Use
1764
-
1765
- Create a new \`.md\` file here when a subsystem becomes important enough that future agents should not rediscover it from scratch.
1766
-
1767
- ## Examples
1856
+ ## Migration
1768
1857
 
1769
- - \`frontend.md\` component library, routing, state management
1770
- - \`deployment.md\` — CI/CD, environment setup, release process
1771
- - \`data-sources.md\` — databases, APIs, file sources
1772
- - \`auth.md\` — authentication and authorization
1773
- - \`design-system.md\` — colors, typography, spacing
1858
+ Run \`memoc update\` to move an existing \`.memoc/systems/\` directory into \`.memoc/raw/legacy-systems/\`.
1774
1859
  `;
1775
1860
  }
1776
1861
 
@@ -1783,7 +1868,7 @@ Immutable source material for the memoc wiki.
1783
1868
 
1784
1869
  - Do not edit raw files after ingest; create a new raw file or source record when material changes.
1785
1870
  - Do not read raw files at session start. Search or open the linked source/topic page first.
1786
- - Source records under [wiki/sources](../wiki/sources/README.md) summarize raw material and link to affected topics.
1871
+ - Source records under [knowledge/sources](../wiki/knowledge/sources/README.md) summarize raw material and link to affected topics.
1787
1872
 
1788
1873
  ## Subdirectories
1789
1874
 
@@ -1802,7 +1887,7 @@ Local files copied by \`memoc ingest <path>\`.
1802
1887
  ## Related
1803
1888
 
1804
1889
  - [Raw Sources](../README.md)
1805
- - [Source Records](../../wiki/sources/README.md)
1890
+ - [Source Records](../../wiki/knowledge/sources/README.md)
1806
1891
  `;
1807
1892
  }
1808
1893
 
@@ -1814,7 +1899,7 @@ URL references recorded by \`memoc ingest <url>\`.
1814
1899
  ## Related
1815
1900
 
1816
1901
  - [Raw Sources](../README.md)
1817
- - [Source Records](../../wiki/sources/README.md)
1902
+ - [Source Records](../../wiki/knowledge/sources/README.md)
1818
1903
  `;
1819
1904
  }
1820
1905
 
@@ -1826,7 +1911,7 @@ Conversation excerpts that should feed durable wiki synthesis.
1826
1911
  ## Related
1827
1912
 
1828
1913
  - [Raw Sources](../README.md)
1829
- - [Source Records](../../wiki/sources/README.md)
1914
+ - [Source Records](../../wiki/knowledge/sources/README.md)
1830
1915
  `;
1831
1916
  }
1832
1917
 
@@ -1838,38 +1923,28 @@ Long-form docs, specs, and references kept separate from synthesized topic pages
1838
1923
  ## Related
1839
1924
 
1840
1925
  - [Raw Sources](../README.md)
1841
- - [Source Records](../../wiki/sources/README.md)
1926
+ - [Source Records](../../wiki/knowledge/sources/README.md)
1842
1927
  `;
1843
1928
  }
1844
1929
 
1845
1930
  function tplWikiIndex() {
1846
1931
  return `# Wiki Index
1847
1932
 
1848
- Persistent LLM-maintained project wiki.
1933
+ Persistent LLM-maintained wiki hub.
1849
1934
 
1850
- ## Graph Hubs
1935
+ ## Wiki Layers
1851
1936
 
1937
+ - [Project Wiki](project/README.md) — this repo's implementation docs.
1938
+ - [Knowledge Wiki](knowledge/README.md) — source-backed concepts, external docs, glossary, questions.
1852
1939
  - [Raw Sources](../raw/README.md) — immutable source material before synthesis.
1853
- - [Sources](sources.md) — provenance, ingests, and source-to-topic links.
1854
- - [Topics](topics/README.md) — synthesized topic pages.
1855
- - [Global](global/README.md) — project-wide principles and long-lived direction.
1856
- - [Glossary](glossary.md) — terms, aliases, and canonical page names.
1857
- - [Open Questions](questions.md) — unresolved questions and research leads.
1858
- - [Wiki Lint](lint.md) — graph health, orphan checks, contradictions, stale claims.
1859
-
1860
- ## Pages
1861
-
1862
- _None yet. Add every wiki page here with a relative Markdown link and one-line summary._
1863
1940
 
1864
- ## Saved Queries
1941
+ ## Project Pages
1865
1942
 
1866
- _None yet. Use \`memoc note "<title>"\` for durable analysis or query results that should become a topic._
1943
+ _None yet. Link implementation pages from [project/README.md](project/README.md)._
1867
1944
 
1868
- ## Subdirectories
1945
+ ## Knowledge Pages
1869
1946
 
1870
- - [sources/](sources/README.md) provenance records
1871
- - [topics/](topics/README.md) — synthesized topic pages
1872
- - [global/](global/README.md) — project-wide principles
1947
+ _None yet. Use \`memoc ingest\` or \`memoc note "<title>"\` to create source-backed knowledge pages._
1873
1948
 
1874
1949
  ## Related Core Memory
1875
1950
 
@@ -1879,6 +1954,52 @@ _None yet. Use \`memoc note "<title>"\` for durable analysis or query results th
1879
1954
  `;
1880
1955
  }
1881
1956
 
1957
+ function tplWikiProjectReadme() {
1958
+ return `# Project Wiki
1959
+
1960
+ Implementation docs for this repository.
1961
+
1962
+ ## Project Pages
1963
+
1964
+ _None yet. Add pages like \`architecture.md\`, \`auth.md\`, \`gateway.md\`, \`deployment.md\`, or \`ui-dashboard.md\`._
1965
+
1966
+ ## How To Use
1967
+
1968
+ - Read project pages before editing the matching subsystem.
1969
+ - Keep pages implementation-specific: files, flows, invariants, commands, risks.
1970
+ - Link to [Knowledge Wiki](../knowledge/README.md) when external concepts or sources matter.
1971
+
1972
+ ## Related
1973
+
1974
+ - [Wiki Index](../index.md)
1975
+ - [Current Project State](../../02-current-project-state.md)
1976
+ - [Decisions](../../03-decisions.md)
1977
+ - [Knowledge Wiki](../knowledge/README.md)
1978
+ `;
1979
+ }
1980
+
1981
+ function tplWikiKnowledgeReadme() {
1982
+ return `# Knowledge Wiki
1983
+
1984
+ Source-backed concepts, external docs, glossary, questions, and durable research.
1985
+
1986
+ ## Hubs
1987
+
1988
+ - [Sources](sources.md) — provenance, ingests, and source-to-topic links.
1989
+ - [Topics](topics/README.md) — synthesized topic pages.
1990
+ - [Global](global/README.md) — broad source-backed principles.
1991
+ - [Glossary](glossary.md) — terms, aliases, and canonical page names.
1992
+ - [Open Questions](questions.md) — unresolved questions and research leads.
1993
+ - [Wiki Lint](lint.md) — graph health, orphan checks, contradictions, stale claims.
1994
+
1995
+ ## Related
1996
+
1997
+ - [Wiki Index](../index.md)
1998
+ - [Project Wiki](../project/README.md)
1999
+ - [Raw Sources](../../raw/README.md)
2000
+ `;
2001
+ }
2002
+
1882
2003
  function tplWikiSources() {
1883
2004
  return `# Sources
1884
2005
 
@@ -1886,14 +2007,15 @@ Provenance index for conversations, URLs, docs, issues, and files that feed the
1886
2007
 
1887
2008
  ## Source Records
1888
2009
 
1889
- _No sources recorded yet. Link each source record to the topic/global pages it affects._
2010
+ _No sources recorded yet. Link each source record to the topic/global/project pages it affects._
1890
2011
 
1891
2012
  Use \`memoc ingest <path-or-url>\` to create source records without loading raw material into startup context.
1892
2013
 
1893
2014
  ## Related
1894
2015
 
1895
- - [Wiki Index](index.md)
1896
- - [Raw Sources](../raw/README.md)
2016
+ - [Wiki Index](../index.md)
2017
+ - [Knowledge Wiki](README.md)
2018
+ - [Raw Sources](../../raw/README.md)
1897
2019
  - [Source Records Directory](sources/README.md)
1898
2020
  - [Topics](topics/README.md)
1899
2021
  - [Open Questions](questions.md)
@@ -1907,11 +2029,11 @@ Canonical names, aliases, and short definitions for project terms.
1907
2029
 
1908
2030
  ## Terms
1909
2031
 
1910
- _No terms defined yet. Link terms to their canonical topic, global, source, or system page._
2032
+ _No terms defined yet. Link terms to their canonical topic, global, source, or project page._
1911
2033
 
1912
2034
  ## Related
1913
2035
 
1914
- - [Wiki Index](index.md)
2036
+ - [Knowledge Wiki](README.md)
1915
2037
  - [Topics](topics/README.md)
1916
2038
  - [Global](global/README.md)
1917
2039
  - [Open Questions](questions.md)
@@ -1929,7 +2051,7 @@ _No open questions yet. Link each question to affected pages and sources._
1929
2051
 
1930
2052
  ## Related
1931
2053
 
1932
- - [Wiki Index](index.md)
2054
+ - [Knowledge Wiki](README.md)
1933
2055
  - [Sources](sources.md)
1934
2056
  - [Topics](topics/README.md)
1935
2057
  - [Wiki Lint](lint.md)
@@ -1943,14 +2065,14 @@ Provenance records for conversations, URLs, docs, and issues.
1943
2065
 
1944
2066
  ## How To Link
1945
2067
 
1946
- - Keep source pages short: summary, raw location, affected pages, open synthesis work.
2068
+ - Keep source pages short: summary, raw location, affected project/knowledge pages, open synthesis work.
1947
2069
  - Link each source record back to [Sources](../sources.md).
1948
- - Link outward to every topic, global page, system doc, or question that the source changes.
2070
+ - Link outward to every topic, global page, project wiki page, or question that the source changes.
1949
2071
  - Prefer one source per file when the source is substantial enough to cite later.
1950
2072
 
1951
2073
  ## Related
1952
2074
 
1953
- - [Wiki Index](../index.md)
2075
+ - [Knowledge Wiki](../README.md)
1954
2076
  - [Sources](../sources.md)
1955
2077
  - [Topics](../topics/README.md)
1956
2078
  - [Open Questions](../questions.md)
@@ -1968,13 +2090,13 @@ _None yet. Add pages here when a concept deserves durable synthesis._
1968
2090
 
1969
2091
  ## How To Link
1970
2092
 
1971
- - Each topic page should link back to [Wiki Index](../index.md) and this [Topics](README.md) page.
2093
+ - Each topic page should link back to [Knowledge Wiki](../README.md) and this [Topics](README.md) page.
1972
2094
  - Link to related topics, source records, glossary terms, and open questions in prose or a \`## Related\` section.
1973
2095
  - Avoid orphan pages: every topic needs at least one inbound link from an index, source, or related topic.
1974
2096
 
1975
2097
  ## Related
1976
2098
 
1977
- - [Wiki Index](../index.md)
2099
+ - [Knowledge Wiki](../README.md)
1978
2100
  - [Sources](../sources.md)
1979
2101
  - [Glossary](../glossary.md)
1980
2102
  - [Wiki Lint](../lint.md)
@@ -1988,18 +2110,18 @@ Project-wide principles, positioning, and long-lived direction.
1988
2110
 
1989
2111
  ## Global Pages
1990
2112
 
1991
- _None yet. Add pages here for broad context that many topic/system pages should reference._
2113
+ _None yet. Add pages here for broad source-backed context that many topic/project pages should reference._
1992
2114
 
1993
2115
  ## How To Link
1994
2116
 
1995
- - Link global pages back to [Wiki Index](../index.md), this [Global](README.md) page, and affected topic/system docs.
2117
+ - Link global pages back to [Knowledge Wiki](../README.md), this [Global](README.md) page, and affected topic/project docs.
1996
2118
  - Use global pages for durable synthesis, not temporary task notes.
1997
2119
 
1998
2120
  ## Related
1999
2121
 
2000
- - [Wiki Index](../index.md)
2001
- - [Project Brief](../../00-project-brief.md)
2002
- - [Project Rules](../../06-project-rules.md)
2122
+ - [Knowledge Wiki](../README.md)
2123
+ - [Project Brief](../../../00-project-brief.md)
2124
+ - [Project Rules](../../../06-project-rules.md)
2003
2125
  - [Topics](../topics/README.md)
2004
2126
  `;
2005
2127
  }
@@ -2010,8 +2132,8 @@ Last checked: ${nowISO()}
2010
2132
 
2011
2133
  ## Graph Checks
2012
2134
 
2013
- - Every wiki page is listed from [Wiki Index](index.md) or a directory README.
2014
- - Every wiki page links back to an index, hub, source, topic, or related page.
2135
+ - Every wiki page is listed from [Wiki Index](../index.md) or a directory README.
2136
+ - Every wiki page links back to an index, project hub, knowledge hub, source, topic, or related page.
2015
2137
  - Important concepts mentioned in two or more places have their own linked page.
2016
2138
  - Source records link to the pages they update, and those pages link back to sources when provenance matters.
2017
2139
 
@@ -2025,7 +2147,7 @@ _None._
2025
2147
 
2026
2148
  ## Related
2027
2149
 
2028
- - [Wiki Index](index.md)
2150
+ - [Knowledge Wiki](README.md)
2029
2151
  - [Sources](sources.md)
2030
2152
  - [Topics](topics/README.md)
2031
2153
  - [Open Questions](questions.md)
@@ -2060,11 +2182,11 @@ Use this local skill after meaningful project work so future agents can continue
2060
2182
  - Check \`.memoc/05-done-checklist.md\` before saying substantial work is complete.
2061
2183
  - Update \`.memoc/06-project-rules.md\` when the user gives durable preferences.
2062
2184
  - Create a short actor worklog with \`memoc work "<title>" --from-git\` for meaningful changes, decisions, and handoffs.
2063
- - Create or update \`.memoc/systems/*.md\` when a subsystem needs durable explanation.
2064
- - Create or update \`.memoc/wiki/*.md\` when synthesized knowledge should compound over time.
2185
+ - Create or update \`.memoc/wiki/project/*.md\` when a subsystem needs durable implementation explanation.
2186
+ - Create or update \`.memoc/wiki/knowledge/*.md\` when source-backed concepts should compound over time.
2065
2187
  - Use \`memoc ingest <path-or-url>\` for source material and \`memoc note "<title>"\` for durable query results or analysis.
2066
2188
  - Use \`memoc work "<title>" --from-git\` for meaningful shared-repo work so details are saved in actor-scoped worklog files instead of causing shared-file conflicts.
2067
- - Keep the wiki graph connected: update \`.memoc/wiki/index.md\`, add relative Markdown links between related pages, and include a \`## Related\` section on every new wiki page.
2189
+ - Keep the wiki graph connected: update \`.memoc/wiki/index.md\`, link project pages under \`.memoc/wiki/project/\`, link knowledge pages under \`.memoc/wiki/knowledge/\`, and include a \`## Related\` section on every new wiki page.
2068
2190
  - Run \`memoc lint-wiki\` after wiki/source/topic edits and address broken links before finishing.
2069
2191
  - Keep completed history in actor worklogs; keep current-state files short.
2070
2192
  - Move completed session details out of \`session-summary.md\` into \`.memoc/worklog/<actor>/YYYY-MM/\`; move incomplete/risky resume details into \`04-handoff.md\`.
@@ -2073,12 +2195,12 @@ Use this local skill after meaningful project work so future agents can continue
2073
2195
 
2074
2196
  ## Wiki Link Rules
2075
2197
 
2076
- - Use relative Markdown links that Obsidian can follow, for example \`[Glossary](glossary.md)\` or \`[Topics](topics/README.md)\`.
2077
- - Every wiki page must have at least one inbound link from \`wiki/index.md\`, a directory README, a source page, or a related topic.
2198
+ - Use relative Markdown links that Obsidian can follow, for example \`[Project Wiki](project/README.md)\` or \`[Topics](knowledge/topics/README.md)\`.
2199
+ - Every wiki page must have at least one inbound link from \`wiki/index.md\`, a directory README, a source page, project page, or related topic.
2078
2200
  - Every wiki page must link outward to its parent hub plus 1-5 genuinely related pages when they exist.
2079
2201
  - Prefer links in normal prose when the connection is meaningful; use \`## Related\` for compact navigation.
2080
2202
  - When a concept appears in multiple pages, create or update a topic/glossary page and link all mentions to it.
2081
- - After wiki edits, check \`.memoc/wiki/lint.md\` and note orphan pages, missing backlinks, contradictions, or stale claims.
2203
+ - After wiki edits, check \`.memoc/wiki/knowledge/lint.md\` and note orphan pages, missing backlinks, contradictions, or stale claims.
2082
2204
 
2083
2205
  ## Concrete Triggers
2084
2206
 
@@ -2265,20 +2387,21 @@ function run(dir, forceUpdate, action = 'update') {
2265
2387
  [path.join(memDir, 'actors/README.md'), tplActorsReadme],
2266
2388
  [path.join(memDir, 'worklog/README.md'), tplWorklogReadme],
2267
2389
  [path.join(memDir, 'memoc-usage.md'), tplMemocUsage],
2268
- [path.join(memDir, 'systems/README.md'), tplSystemsReadme],
2269
2390
  [path.join(memDir, 'raw/README.md'), tplRawReadme],
2270
2391
  [path.join(memDir, 'raw/files/README.md'), tplRawFilesReadme],
2271
2392
  [path.join(memDir, 'raw/urls/README.md'), tplRawUrlsReadme],
2272
2393
  [path.join(memDir, 'raw/conversations/README.md'), tplRawConversationsReadme],
2273
2394
  [path.join(memDir, 'raw/docs/README.md'), tplRawDocsReadme],
2274
2395
  [path.join(memDir, 'wiki/index.md'), tplWikiIndex],
2275
- [path.join(memDir, 'wiki/sources.md'), tplWikiSources],
2276
- [path.join(memDir, 'wiki/glossary.md'), tplWikiGlossary],
2277
- [path.join(memDir, 'wiki/questions.md'), tplWikiQuestions],
2278
- [path.join(memDir, 'wiki/lint.md'), tplWikiLint],
2279
- [path.join(memDir, 'wiki/sources/README.md'), tplWikiSourcesReadme],
2280
- [path.join(memDir, 'wiki/topics/README.md'), tplWikiTopicsReadme],
2281
- [path.join(memDir, 'wiki/global/README.md'), tplWikiGlobalReadme],
2396
+ [path.join(memDir, 'wiki/project/README.md'), tplWikiProjectReadme],
2397
+ [path.join(memDir, 'wiki/knowledge/README.md'), tplWikiKnowledgeReadme],
2398
+ [path.join(memDir, 'wiki/knowledge/sources.md'), tplWikiSources],
2399
+ [path.join(memDir, 'wiki/knowledge/glossary.md'), tplWikiGlossary],
2400
+ [path.join(memDir, 'wiki/knowledge/questions.md'), tplWikiQuestions],
2401
+ [path.join(memDir, 'wiki/knowledge/lint.md'), tplWikiLint],
2402
+ [path.join(memDir, 'wiki/knowledge/sources/README.md'), tplWikiSourcesReadme],
2403
+ [path.join(memDir, 'wiki/knowledge/topics/README.md'), tplWikiTopicsReadme],
2404
+ [path.join(memDir, 'wiki/knowledge/global/README.md'), tplWikiGlobalReadme],
2282
2405
  [path.join(dir, 'skills/project-memory-maintainer/SKILL.md'), tplSkillMaintainer],
2283
2406
  ];
2284
2407
  for (const [fp, tpl] of staticFiles) {
@@ -2322,7 +2445,7 @@ function run(dir, forceUpdate, action = 'update') {
2322
2445
  if (fs.existsSync(llmsPath)) {
2323
2446
  updateSection(llmsPath, HDR_S, HDR_E, headerInner(p));
2324
2447
  updateSection(llmsPath, CORE_S, CORE_E, coreLlmsInner());
2325
- updateSection(llmsPath, SYS_S, SYS_E, systemsLlmsInner(dir));
2448
+ updateSection(llmsPath, SYS_S, SYS_E, projectWikiLlmsInner(dir));
2326
2449
  updateSection(llmsPath, WIKI_S, WIKI_E, wikiLlmsInner(dir));
2327
2450
  mark('update', 'llms.txt');
2328
2451
  } else {
@@ -2382,6 +2505,9 @@ function run(dir, forceUpdate, action = 'update') {
2382
2505
  mark(writeChanged(fp, tpl()) ? 'update' : 'skip', rel);
2383
2506
  }
2384
2507
 
2508
+ migrateKnowledgeWiki(dir, mark);
2509
+ archiveLegacySystems(dir, mark);
2510
+
2385
2511
  // Static indexes/scaffolds — add if missing; content may be user- or command-owned.
2386
2512
  const addIfMissing = [
2387
2513
  [path.join(memDir, '03-decisions.md'), tplDecisions],
@@ -2390,20 +2516,21 @@ function run(dir, forceUpdate, action = 'update') {
2390
2516
  [path.join(memDir, 'activity.md'), tplActivity],
2391
2517
  [path.join(memDir, 'actors/README.md'), tplActorsReadme],
2392
2518
  [path.join(memDir, 'worklog/README.md'), tplWorklogReadme],
2393
- [path.join(memDir, 'systems/README.md'), tplSystemsReadme],
2394
2519
  [path.join(memDir, 'raw/README.md'), tplRawReadme],
2395
2520
  [path.join(memDir, 'raw/files/README.md'), tplRawFilesReadme],
2396
2521
  [path.join(memDir, 'raw/urls/README.md'), tplRawUrlsReadme],
2397
2522
  [path.join(memDir, 'raw/conversations/README.md'), tplRawConversationsReadme],
2398
2523
  [path.join(memDir, 'raw/docs/README.md'), tplRawDocsReadme],
2399
2524
  [path.join(memDir, 'wiki/index.md'), tplWikiIndex],
2400
- [path.join(memDir, 'wiki/sources.md'), tplWikiSources],
2401
- [path.join(memDir, 'wiki/glossary.md'), tplWikiGlossary],
2402
- [path.join(memDir, 'wiki/questions.md'), tplWikiQuestions],
2403
- [path.join(memDir, 'wiki/lint.md'), tplWikiLint],
2404
- [path.join(memDir, 'wiki/sources/README.md'), tplWikiSourcesReadme],
2405
- [path.join(memDir, 'wiki/topics/README.md'), tplWikiTopicsReadme],
2406
- [path.join(memDir, 'wiki/global/README.md'), tplWikiGlobalReadme],
2525
+ [path.join(memDir, 'wiki/project/README.md'), tplWikiProjectReadme],
2526
+ [path.join(memDir, 'wiki/knowledge/README.md'), tplWikiKnowledgeReadme],
2527
+ [path.join(memDir, 'wiki/knowledge/sources.md'), tplWikiSources],
2528
+ [path.join(memDir, 'wiki/knowledge/glossary.md'), tplWikiGlossary],
2529
+ [path.join(memDir, 'wiki/knowledge/questions.md'), tplWikiQuestions],
2530
+ [path.join(memDir, 'wiki/knowledge/lint.md'), tplWikiLint],
2531
+ [path.join(memDir, 'wiki/knowledge/sources/README.md'), tplWikiSourcesReadme],
2532
+ [path.join(memDir, 'wiki/knowledge/topics/README.md'), tplWikiTopicsReadme],
2533
+ [path.join(memDir, 'wiki/knowledge/global/README.md'), tplWikiGlobalReadme],
2407
2534
  ];
2408
2535
  for (const [fp, tpl] of addIfMissing) {
2409
2536
  const rel = path.relative(dir, fp);
@@ -2416,9 +2543,8 @@ function run(dir, forceUpdate, action = 'update') {
2416
2543
  path.join(memDir, '02-current-project-state.md'),
2417
2544
  path.join(memDir, '04-handoff.md'),
2418
2545
  path.join(memDir, '06-project-rules.md'),
2419
- path.join(memDir, 'systems/README.md'),
2420
2546
  path.join(memDir, 'wiki/index.md'),
2421
- path.join(memDir, 'wiki/sources.md'),
2547
+ path.join(memDir, 'wiki/knowledge/sources.md'),
2422
2548
  path.join(memDir, 'wiki/glossary.md'),
2423
2549
  path.join(memDir, 'wiki/questions.md'),
2424
2550
  path.join(memDir, 'wiki/lint.md'),
@@ -2778,7 +2904,7 @@ function runWikiLint(dir) {
2778
2904
  if (count === 0) warnings.push(`${rel}: no inbound wiki links`);
2779
2905
  }
2780
2906
 
2781
- const lintPath = path.join(wikiDir, 'lint.md');
2907
+ const lintPath = path.join(wikiDir, 'knowledge', 'lint.md');
2782
2908
  write(lintPath, wikiLintReport(issues, warnings));
2783
2909
  ensureMemocFrontmatter(lintPath, dir);
2784
2910
 
@@ -2786,7 +2912,7 @@ function runWikiLint(dir) {
2786
2912
  console.log(` Files ${files.length}`);
2787
2913
  console.log(` Issues ${issues.length}`);
2788
2914
  console.log(` Warnings ${warnings.length}`);
2789
- console.log(' Report .memoc/wiki/lint.md');
2915
+ console.log(' Report .memoc/wiki/knowledge/lint.md');
2790
2916
  if (issues.length) {
2791
2917
  console.log('\n Issues:');
2792
2918
  for (const issue of issues.slice(0, 10)) console.log(` - ${issue}`);
@@ -2802,8 +2928,8 @@ Last checked: ${nowISO()}
2802
2928
 
2803
2929
  ## Graph Checks
2804
2930
 
2805
- - Every wiki page is listed from [Wiki Index](index.md) or a directory README.
2806
- - Every wiki page links back to an index, hub, source, topic, or related page.
2931
+ - Every wiki page is listed from [Wiki Index](../index.md) or a directory README.
2932
+ - Every wiki page links back to an index, project hub, knowledge hub, source, topic, or related page.
2807
2933
  - Important concepts mentioned in two or more places have their own linked page.
2808
2934
  - Source records link to the pages they update, and those pages link back to sources when provenance matters.
2809
2935
 
@@ -2842,7 +2968,7 @@ function runIngest(dir) {
2842
2968
  const rawPath = uniquePath(path.join(dir, '.memoc', 'raw', 'urls', `${slug}.md`));
2843
2969
  write(rawPath, rawUrlRecord(title, target));
2844
2970
  ensureMemocFrontmatter(rawPath, dir);
2845
- rawRef = pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki', 'sources'), rawPath);
2971
+ rawRef = pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki', 'knowledge', 'sources'), rawPath);
2846
2972
  rawDisplay = normRel(dir, rawPath);
2847
2973
  } else {
2848
2974
  const abs = path.resolve(dir, target);
@@ -2854,16 +2980,16 @@ function runIngest(dir) {
2854
2980
  const rawPath = uniquePath(path.join(dir, '.memoc', 'raw', 'files', `${slug}${ext}`));
2855
2981
  fs.mkdirSync(path.dirname(rawPath), { recursive: true });
2856
2982
  fs.copyFileSync(abs, rawPath);
2857
- rawRef = pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki', 'sources'), rawPath);
2983
+ rawRef = pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki', 'knowledge', 'sources'), rawPath);
2858
2984
  rawDisplay = normRel(dir, rawPath);
2859
2985
  }
2860
2986
 
2861
- const sourcePath = uniquePath(path.join(dir, '.memoc', 'wiki', 'sources', `${slug}.md`));
2987
+ const sourcePath = uniquePath(path.join(dir, '.memoc', 'wiki', 'knowledge', 'sources', `${slug}.md`));
2862
2988
  write(sourcePath, sourceRecord(title, rawRef, target, isUrl));
2863
2989
  ensureMemocFrontmatter(sourcePath, dir);
2864
- addWikiListItem(path.join(dir, '.memoc', 'wiki', 'sources.md'), 'Source Records', pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki'), sourcePath), title, 'needs synthesis');
2865
- addWikiListItem(path.join(dir, '.memoc', 'wiki', 'sources', 'README.md'), 'Source Records', path.basename(sourcePath), title, 'source record');
2866
- addWikiListItem(path.join(dir, '.memoc', 'wiki', 'index.md'), 'Pages', pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki'), sourcePath), title, 'source record');
2990
+ addWikiListItem(path.join(dir, '.memoc', 'wiki', 'knowledge', 'sources.md'), 'Source Records', pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki', 'knowledge'), sourcePath), title, 'needs synthesis');
2991
+ addWikiListItem(path.join(dir, '.memoc', 'wiki', 'knowledge', 'sources', 'README.md'), 'Source Records', path.basename(sourcePath), title, 'source record');
2992
+ addWikiListItem(path.join(dir, '.memoc', 'wiki', 'index.md'), 'Knowledge Pages', pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki'), sourcePath), title, 'source record');
2867
2993
  console.log('\n memoc ingest\n');
2868
2994
  console.log(` Source record ${normRel(dir, sourcePath)}`);
2869
2995
  console.log(` Raw reference ${rawDisplay}`);
@@ -2887,11 +3013,11 @@ function runNote(dir) {
2887
3013
  }
2888
3014
 
2889
3015
  ensureMemocBase(dir);
2890
- const topicPath = uniquePath(path.join(dir, '.memoc', 'wiki', 'topics', `${slugify(title, 'topic')}.md`));
3016
+ const topicPath = uniquePath(path.join(dir, '.memoc', 'wiki', 'knowledge', 'topics', `${slugify(title, 'topic')}.md`));
2891
3017
  write(topicPath, topicNote(title, body));
2892
3018
  ensureMemocFrontmatter(topicPath, dir);
2893
- addWikiListItem(path.join(dir, '.memoc', 'wiki', 'topics', 'README.md'), 'Topic Pages', path.basename(topicPath), title, 'topic note');
2894
- addWikiListItem(path.join(dir, '.memoc', 'wiki', 'index.md'), 'Saved Queries', pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki'), topicPath), title, 'saved query/topic note');
3019
+ addWikiListItem(path.join(dir, '.memoc', 'wiki', 'knowledge', 'topics', 'README.md'), 'Topic Pages', path.basename(topicPath), title, 'topic note');
3020
+ addWikiListItem(path.join(dir, '.memoc', 'wiki', 'index.md'), 'Knowledge Pages', pathRelativeMarkdown(path.join(dir, '.memoc', 'wiki'), topicPath), title, 'saved query/topic note');
2895
3021
  console.log('\n memoc note\n');
2896
3022
  console.log(` Topic ${normRel(dir, topicPath)}`);
2897
3023
  console.log(' Next Link related sources/topics, then run memoc lint-wiki.');
@@ -2903,9 +3029,15 @@ function ensureMemocBase(dir) {
2903
3029
  const memDir = path.join(dir, '.memoc');
2904
3030
  const files = [
2905
3031
  [path.join(memDir, 'wiki/index.md'), tplWikiIndex],
2906
- [path.join(memDir, 'wiki/sources.md'), tplWikiSources],
2907
- [path.join(memDir, 'wiki/sources/README.md'), tplWikiSourcesReadme],
2908
- [path.join(memDir, 'wiki/topics/README.md'), tplWikiTopicsReadme],
3032
+ [path.join(memDir, 'wiki/project/README.md'), tplWikiProjectReadme],
3033
+ [path.join(memDir, 'wiki/knowledge/README.md'), tplWikiKnowledgeReadme],
3034
+ [path.join(memDir, 'wiki/knowledge/sources.md'), tplWikiSources],
3035
+ [path.join(memDir, 'wiki/knowledge/sources/README.md'), tplWikiSourcesReadme],
3036
+ [path.join(memDir, 'wiki/knowledge/topics/README.md'), tplWikiTopicsReadme],
3037
+ [path.join(memDir, 'wiki/knowledge/global/README.md'), tplWikiGlobalReadme],
3038
+ [path.join(memDir, 'wiki/knowledge/glossary.md'), tplWikiGlossary],
3039
+ [path.join(memDir, 'wiki/knowledge/questions.md'), tplWikiQuestions],
3040
+ [path.join(memDir, 'wiki/knowledge/lint.md'), tplWikiLint],
2909
3041
  [path.join(memDir, 'raw/README.md'), tplRawReadme],
2910
3042
  [path.join(memDir, 'raw/files/README.md'), tplRawFilesReadme],
2911
3043
  [path.join(memDir, 'raw/urls/README.md'), tplRawUrlsReadme],
@@ -2965,7 +3097,7 @@ _Summarize only the durable facts future agents should reuse._
2965
3097
 
2966
3098
  ## Synthesis Tasks
2967
3099
 
2968
- - [ ] Create or update affected topic/global/system pages.
3100
+ - [ ] Create or update affected topic/global/project pages.
2969
3101
  - [ ] Link those pages back to this source when provenance matters.
2970
3102
  - [ ] Run \`memoc lint-wiki\`.
2971
3103
 
@@ -2973,7 +3105,7 @@ _Summarize only the durable facts future agents should reuse._
2973
3105
 
2974
3106
  - [Sources Index](../sources.md)
2975
3107
  - [Source Records](README.md)
2976
- - [Wiki Index](../index.md)
3108
+ - [Knowledge Wiki](../README.md)
2977
3109
  `;
2978
3110
  }
2979
3111
 
@@ -2994,7 +3126,7 @@ _None yet._
2994
3126
 
2995
3127
  ## Related
2996
3128
 
2997
- - [Wiki Index](../index.md)
3129
+ - [Knowledge Wiki](../README.md)
2998
3130
  - [Topics](README.md)
2999
3131
  - [Glossary](../glossary.md)
3000
3132
  `;
@@ -3283,8 +3415,9 @@ function searchPriority(file, scope = 'memory') {
3283
3415
  ];
3284
3416
  const exact = order.indexOf(normalized);
3285
3417
  if (exact !== -1) return exact;
3286
- if (normalized.startsWith('.memoc/systems/')) return 20;
3287
- if (normalized.startsWith('.memoc/wiki/')) return 30;
3418
+ if (normalized.startsWith('.memoc/wiki/project/')) return 20;
3419
+ if (normalized.startsWith('.memoc/wiki/knowledge/')) return 30;
3420
+ if (normalized.startsWith('.memoc/wiki/')) return 35;
3288
3421
  if (normalized.startsWith('skills/')) return 40;
3289
3422
  return 50;
3290
3423
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevin0181/memoc",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Give AI agents a memory. Scaffolds session-to-session context for Claude Code, Codex, Cursor, and more.",
5
5
  "keywords": [
6
6
  "ai",