{"id":"89a2af20-7495-4870-8991-c023c52fa0f4","shortId":"QjFhRJ","kind":"skill","title":"wiki-fold","tagline":"Rollup of wiki log entries into meta-pages. Reads the last 2^k entries from wiki/log.md, writes a structurally-idempotent fold page to wiki/folds/ that links back to children. Extractive summarization (no invention). Dry-run by default, stdout-only; commit mode writes and accepts","description":"# wiki-fold: Extractive Log Rollup\n\nImplements a bounded subset of Mechanism 1 from [[DragonScale Memory]]: flat fold over raw `wiki/log.md` entries. Fold-of-folds (hierarchical level-stacking) is **out of scope for this skill**; see \"Scope boundary\" below.\n\nA fold is **additive**: child log entries and their referenced pages are never modified, moved, or deleted. A fold is **extractive**: every outcome and theme in the output must be traceable to a specific child log entry. No invented facts, no synthesis beyond what the child entries support.\n\n---\n\n## Scope boundary (explicit)\n\nThis skill does **not** implement:\n- Fold-of-folds / hierarchical level stacking (DragonScale spec calls for it; deferred to a future skill).\n- Automatic triggering (folds are always human-invoked in Phase 1).\n- Semantic-tiling dedup (Mechanism 3; separate skill).\n\nIt **does** implement:\n- Flat fold over raw log.md entries at a chosen batch exponent `k`.\n- Structural idempotency via a deterministic fold ID.\n- Extractive summarization with count-checking.\n\nWhen referring to level in frontmatter, use `batch_exponent: k` (not `level: k`), because this skill does not produce hierarchical levels.\n\n---\n\n## Modes\n\n| Mode | Writes? | Invocation |\n|---|---|---|\n| **dry-run (default)** | **No Write tool calls.** Emit fold content via Bash `cat`/`heredoc` to stdout only. | `fold the log, dry-run k=3` |\n| **commit** | Uses Write/Edit tools. Each Write fires the repo PostToolUse hook which auto-commits wiki changes. Accept this. Compose full content first, then sequence writes. | `fold the log, commit k=3` (only after a clean dry-run) |\n\n**Why stdout-only in dry-run**: the repo's `hooks/hooks.json` PostToolUse hook fires on any `Write|Edit` and runs `git add wiki/ .raw/`. Writing to `/tmp` does not stage /tmp, but it still triggers the hook, which will commit *any pending wiki changes* under a generic message. Dry-run must leave zero residue. Bash stdout does not fire the hook.\n\n---\n\n## Deterministic fold ID\n\nEvery fold has an ID derived from its inputs:\n\n```\nfold-k{K}-from-{EARLIEST-DATE}-to-{LATEST-DATE}-n{COUNT}\n```\n\nExample: `fold-k3-from-2026-04-10-to-2026-04-23-n8`.\n\nThe filename in commit mode is `wiki/folds/{FOLD-ID}.md`. No date-of-creation in the filename. No timestamp in the title.\n\n**Duplicate detection (required)**: before emitting any output, check if `wiki/folds/{FOLD-ID}.md` already exists. If so, report \"Fold already exists at wiki/folds/{FOLD-ID}.md. Use --force to overwrite, or pick a different range.\" and stop. This is the no-op idempotency guarantee; byte-identical content is NOT guaranteed (LLM prose varies) but the filename and scope are.\n\n---\n\n## Parameters\n\n- `k` (default 4): batch exponent. Batch size = `2^k`. Typical values: k=3 (8), k=4 (16), k=5 (32).\n- `range` (optional): explicit entry range `entries 1-16`. Overrides k.\n- `--force`: overwrite an existing fold with the same ID. Default no.\n- `--commit`: write to wiki/. Without it, dry-run stdout-only.\n\nIf fewer than `2^k` log entries exist, report the shortfall and stop. Do not silently fold a partial batch.\n\n---\n\n## Procedure\n\n### 1. Parse log entries\n\n```\ngrep -n \"^## \\[\" wiki/log.md | head -{2^k}\n```\n\nRecord for each entry: line number, date, operation, title, and the following bullet lines until the next `## [` or end-of-section.\n\n### 2. Extract child page identifiers\n\nFrom each entry's bullet list, extract:\n- `Location: wiki/path/to/page.md` (the primary page)\n- `[[Wikilinks]]` inline\n- `Pages created:` and `Pages updated:` lists\n\nBuild a structured children list:\n```yaml\nchildren:\n  - date: \"2026-04-23\"\n    op: \"save\"\n    title: \"DragonScale Memory v0.2 — post-adversarial-review\"\n    page: \"[[DragonScale Memory]]\"\n  - ...\n```\n\nOne record per log entry. Do not dedupe by page: if two entries both point to `[[DragonScale Memory]]`, both records appear, distinguishable by date and title.\n\n### 3. Read referenced pages (bounded)\n\nRead only the pages that are not already captured fully in the log entry's bullets. Budget: 0-10 page reads. Hard ceiling: 15. If an entry's referenced page is missing, record `page_missing: true` and proceed.\n\n### 4. Extractive summarization with count checks\n\nWrite the fold body per `references/fold-template.md`. **Rules**:\n\n- **Extractive only.** Every outcome bullet and theme bullet must cite a specific child entry (e.g., `(from 2026-04-14 session)`) or a quoted line from that entry. Do not introduce events, counts, or interpretations not present in a child entry.\n- **Log entry is the primary source.** If the log entry's bullets and the referenced meta-page disagree on a fact (e.g., a count), prefer the log-entry bullets and flag the mismatch as \"source mismatch: log says X, meta says Y.\"\n- **Count checks.** If you write \"N concept pages\" or \"M repos updated,\" grep the source entries for the number and verify. Numeric mismatches are dry-run blockers.\n- **No merging across entries without naming them.** A theme that spans multiple entries must name each contributing entry inline.\n- **Uncertainty is a feature.** If an entry is ambiguous, say \"ambiguous in source: [[Entry]]\" rather than picking one interpretation.\n\n### 5. Self-check before emitting\n\nBefore printing output, verify:\n- Every child in `children:` frontmatter appears exactly once in the Child Entries table.\n- Every entry in the table appears in the `children:` frontmatter.\n- Every numeric claim in Key Outcomes is grep-verifiable against a child entry.\n- The fold ID is deterministic and the file does not already exist (or `--force` is set).\n\nIf any check fails, abort and report the specific failure.\n\n### 6. Emit\n\n**Dry-run**: use Bash `cat <<'EOF' ... EOF` to stdout. Do not use Write. Print the fold ID and a one-line summary of what the commit step would do.\n\n**Commit** (only after user says \"commit the fold\"):\n1. `Write` the fold page to `wiki/folds/{FOLD-ID}.md`. (PostToolUse hook will auto-commit this.)\n2. `Edit` `wiki/index.md` to add the fold link under a `## Folds` section (create section if missing). (Hook auto-commits.)\n3. `Edit` `wiki/log.md` to prepend one entry:\n   ```\n   ## [YYYY-MM-DD] fold | batch-exponent-k{K} rollup of N entries\n   - Location: wiki/folds/{FOLD-ID}.md\n   - Range: {EARLIEST-DATE} to {LATEST-DATE}\n   - Children: N log entries\n   ```\n   (Hook auto-commits.)\n\nThree auto-commits result. The user sees three separate `wiki: auto-commit` entries in git log. This is expected; do not attempt to suppress the hook.\n\n---\n\n## Output schema\n\nSee `references/fold-template.md` for the canonical frontmatter and body layout.\n\n---\n\n## Invariants\n\n1. **Structural idempotency**: same range + same k → same fold ID → duplicate detection prevents double-writes. LLM prose may vary across runs; the *location and scope* are fixed.\n2. **Additive**: children are never modified.\n3. **Bounded reads**: 0-15 child-page reads per fold.\n4. **Extractive**: zero invented facts. Count checks enforced.\n5. **No chaining**: wiki-fold does not invoke wiki-lint, wiki-ingest, autoresearch, or save.\n\n---\n\n## What NOT to do\n\n- Do not use Write/Edit during dry-run. Bash stdout only.\n- Do not include the current date in the fold filename or title. Use the child entry range.\n- Do not silently dedupe children by page title. One record per log entry.\n- Do not write \"emergent themes\" that span entries without naming which entries contribute.\n- Do not claim byte-identical idempotency. Structural idempotency is the actual guarantee.\n- Do not suppress or bypass the PostToolUse auto-commit hook.\n- Do not update `wiki/hot.md`. Ownership stays with save/ingest skills.\n\n---\n\n## Reversal\n\nCommitted fold reversal (three commits, land in this order):\n1. Remove the log.md fold entry.\n2. Remove the index.md entry.\n3. Delete the fold page file.\n\nOr: `git revert` the three auto-commits. Child pages are untouched in either path.\n\n---\n\n## Example dry-run sequence\n\nUser: \"fold the log, dry-run k=3\"\n\n1. Parse `wiki/log.md` top 8 entries.\n2. Build structured children list (8 records).\n3. Read 0-10 referenced pages as needed.\n4. Produce fold ID: `fold-k3-from-2026-04-10-to-2026-04-23-n8`.\n5. Check `wiki/folds/fold-k3-from-2026-04-10-to-2026-04-23-n8.md` does not exist.\n6. Write fold body following the template.\n7. Run self-check (frontmatter/table consistency, count verification).\n8. Emit via `cat <<'EOF' ... EOF` to stdout.\n9. Report: \"Dry-run complete. Fold ID: {FOLD-ID}. To commit: 'commit the fold'.\"","tags":["wiki","fold","claude","obsidian","agricidaniel","agent-skills","ai-second-brain","autonomous-research","claude-code","claude-code-skill","claude-plugin","karpathy-llm-wiki"],"capabilities":["skill","source-agricidaniel","skill-wiki-fold","topic-agent-skills","topic-ai-second-brain","topic-autonomous-research","topic-claude-code","topic-claude-code-skill","topic-claude-plugin","topic-karpathy-llm-wiki","topic-knowledge-graph","topic-knowledge-management","topic-llm","topic-multi-agent","topic-obsidian"],"categories":["claude-obsidian"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/AgriciDaniel/claude-obsidian/wiki-fold","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add AgriciDaniel/claude-obsidian","source_repo":"https://github.com/AgriciDaniel/claude-obsidian","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 5150 github stars · SKILL.md body (8,454 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:52:44.390Z","embedding":null,"createdAt":"2026-05-18T12:53:57.493Z","updatedAt":"2026-05-18T18:52:44.390Z","lastSeenAt":"2026-05-18T18:52:44.390Z","tsv":"'-04':398,402,633,747,1363,1367 '-10':399,697,1349,1364 '-14':748 '-15':1153 '-16':520 '-2026':401,1366 '-23':403,634,1368 '/tmp':330,334 '0':696,1152,1348 '1':64,176,519,567,994,1115,1287,1333 '15':702 '16':509 '2':16,500,549,575,599,1012,1143,1293,1339 '2026':397,632,746,1362 '3':182,263,295,505,674,1032,1149,1298,1332,1346 '32':512 '4':495,508,717,1160,1354 '5':511,880,1168,1370 '6':953,1376 '7':1383 '8':506,1337,1344,1392 '9':1400 'abort':947 'accept':51,281 'across':844,1135 'actual':1255 'add':325,1016 'addit':96,1144 'adversari':643 'alreadi':443,449,686,937 'alway':170 'ambigu':869,871 'appear':668,895,908 'attempt':1098 'auto':277,1009,1030,1073,1077,1087,1265,1310 'auto-commit':276,1008,1029,1072,1076,1086,1264,1309 'automat':166 'autoresearch':1183 'back':32 'bash':250,359,959,1198 'batch':197,220,496,498,565,1045 'batch-exponent-k':1044 'beyond':135 'blocker':841 'bodi':726,1112,1379 'bound':60,678,1150 'boundari':91,142 'budget':695 'build':624,1340 'bullet':589,608,694,734,737,781,800 'bypass':1261 'byte':477,1248 'byte-ident':476,1247 'call':158,245 'canon':1109 'captur':687 'cat':251,960,1395 'ceil':701 'chain':1170 'chang':280,347 'check':212,436,722,815,883,945,1166,1371,1387 'child':97,127,138,601,742,768,891,900,925,1155,1215,1312 'child-pag':1154 'children':34,627,630,893,911,1067,1145,1222,1342 'chosen':196 'cite':739 'claim':915,1246 'clean':299 'commit':47,264,278,293,343,408,534,982,986,991,1010,1031,1074,1078,1088,1266,1278,1282,1311,1412,1413 'complet':1405 'compos':283 'concept':820 'consist':1389 'content':248,285,479 'contribut':858,1243 'count':211,391,721,761,794,814,1165,1390 'count-check':210 'creat':619,1024 'creation':420 'current':1205 'date':385,389,418,583,631,671,1062,1066,1206 'date-of-cr':417 'dd':1042 'dedup':180,655,1221 'default':43,241,494,532 'defer':161 'delet':109,1299 'deriv':374 'detect':430,1126 'determinist':204,366,931 'differ':464 'disagre':788 'distinguish':669 'doubl':1129 'double-writ':1128 'dragonscal':66,156,638,646,664 'dri':40,239,260,301,309,353,541,839,956,1196,1321,1329,1403 'dry-run':39,238,259,300,308,352,540,838,955,1195,1320,1328,1402 'duplic':429,1125 'e.g':744,792 'earliest':384,1061 'earliest-d':383,1060 'edit':321,1013,1033 'either':1317 'emerg':1234 'emit':246,433,885,954,1393 'end':596 'end-of-sect':595 'enforc':1167 'entri':8,18,73,99,129,139,193,516,518,552,570,580,606,652,660,692,705,743,756,769,771,779,799,829,845,854,859,867,874,901,904,926,1038,1052,1070,1089,1216,1230,1238,1242,1292,1297,1338 'eof':961,962,1396,1397 'event':760 'everi':114,369,732,890,903,913 'exact':896 'exampl':392,1319 'exist':444,450,526,553,938,1375 'expect':1095 'explicit':143,515 'expon':198,221,497,1046 'extract':35,55,113,207,600,610,718,730,1161 'fact':132,791,1164 'fail':946 'failur':952 'featur':864 'fewer':547 'file':934,1303 'filenam':406,423,488,1210 'fire':270,317,363 'first':286 'fix':1142 'flag':802 'flat':68,188 'fold':3,26,54,69,75,77,94,111,150,152,168,189,205,247,256,290,367,370,379,394,413,440,448,454,527,562,725,928,971,993,997,1002,1018,1022,1043,1056,1123,1159,1173,1209,1279,1291,1301,1325,1356,1359,1378,1406,1409,1415 'fold-id':412,439,453,1001,1055,1408 'fold-k':378 'fold-k3-from':393,1358 'fold-of-fold':74,149 'follow':588,1380 'forc':458,523,940 'frontmatt':218,894,912,1110 'frontmatter/table':1388 'full':284 'fulli':688 'futur':164 'generic':350 'git':324,1091,1305 'grep':571,826,921 'grep-verifi':920 'guarante':475,482,1256 'hard':700 'head':574 'heredoc':252 'hierarch':78,153,232 'hook':274,316,340,365,1006,1028,1071,1102,1267 'hooks/hooks.json':314 'human':172 'human-invok':171 'id':206,368,373,414,441,455,531,929,972,1003,1057,1124,1357,1407,1410 'idempot':25,201,474,1117,1250,1252 'ident':478,1249 'identifi':603 'implement':58,148,187 'includ':1203 'index.md':1296 'ingest':1182 'inlin':617,860 'input':377 'interpret':763,879 'introduc':759 'invari':1114 'invent':38,131,1163 'invoc':237 'invok':173,1176 'k':17,199,222,225,262,294,380,381,493,501,504,507,510,522,550,576,1047,1048,1121,1331 'k3':395,1360 'key':917 'land':1283 'last':15 'latest':388,1065 'latest-d':387,1064 'layout':1113 'leav':356 'level':80,154,216,224,233 'level-stack':79 'line':581,590,753,977 'link':31,1019 'lint':1179 'list':609,623,628,1343 'llm':483,1131 'locat':611,1053,1138 'log':7,56,98,128,258,292,551,569,651,691,770,778,798,808,1069,1092,1229,1327 'log-entri':797 'log.md':192,1290 'm':823 'may':1133 'md':415,442,456,1004,1058 'mechan':63,181 'memori':67,639,647,665 'merg':843 'messag':351 'meta':11,786,811 'meta-pag':10,785 'mismatch':804,807,836 'miss':710,713,1027 'mm':1041 'mode':48,234,235,409 'modifi':106,1148 'move':107 'multipl':853 'must':121,355,738,855 'n':390,572,819,1051,1068 'n8':404,1369 'name':847,856,1240 'need':1353 'never':105,1147 'next':593 'no-op':471 'number':582,832 'numer':835,914 'one':648,878,976,1037,1226 'one-lin':975 'op':473,635 'oper':584 'option':514 'order':1286 'outcom':115,733,918 'output':120,435,888,1103 'overrid':521 'overwrit':460,524 'ownership':1272 'page':12,27,103,602,615,618,621,645,657,677,682,698,708,712,787,821,998,1156,1224,1302,1313,1351 'paramet':492 'pars':568,1334 'partial':564 'path':1318 'pend':345 'per':650,727,1158,1228 'phase':175 'pick':462,877 'point':662 'post':642 'post-adversarial-review':641 'posttoolus':273,315,1005,1263 'prefer':795 'prepend':1036 'present':765 'prevent':1127 'primari':614,774 'print':887,969 'procedur':566 'proceed':716 'produc':231,1355 'prose':484,1132 'quot':752 'rang':465,513,517,1059,1119,1217 'rather':875 'raw':71,191,327 'read':13,675,679,699,1151,1157,1347 'record':577,649,667,711,1227,1345 'refer':214 'referenc':102,676,707,784,1350 'references/fold-template.md':728,1106 'remov':1288,1294 'repo':272,312,824 'report':447,554,949,1401 'requir':431 'residu':358 'result':1079 'revers':1277,1280 'revert':1306 'review':644 'rollup':4,57,1049 'rule':729 'run':41,240,261,302,310,323,354,542,840,957,1136,1197,1322,1330,1384,1404 'save':636,1185 'save/ingest':1275 'say':809,812,870,990 'schema':1104 'scope':85,90,141,490,1140 'section':598,1023,1025 'see':89,1082,1105 'self':882,1386 'self-check':881,1385 'semant':178 'semantic-til':177 'separ':183,1084 'sequenc':288,1323 'session':749 'set':942 'shortfal':556 'silent':561,1220 'size':499 'skill':88,145,165,184,228,1276 'skill-wiki-fold' 'sourc':775,806,828,873 'source-agricidaniel' 'span':852,1237 'spec':157 'specif':126,741,951 'stack':81,155 'stage':333 'stay':1273 'stdout':45,254,305,360,544,964,1199,1399 'stdout-on':44,304,543 'step':983 'still':337 'stop':467,558 'structur':24,200,626,1116,1251,1341 'structurally-idempot':23 'subset':61 'summar':36,208,719 'summari':978 'support':140 'suppress':1100,1259 'synthesi':134 'tabl':902,907 'templat':1382 'theme':117,736,850,1235 'three':1075,1083,1281,1308 'tile':179 'timestamp':425 'titl':428,585,637,673,1212,1225 'tool':244,267 'top':1336 'topic-agent-skills' 'topic-ai-second-brain' 'topic-autonomous-research' 'topic-claude-code' 'topic-claude-code-skill' 'topic-claude-plugin' 'topic-karpathy-llm-wiki' 'topic-knowledge-graph' 'topic-knowledge-management' 'topic-llm' 'topic-multi-agent' 'topic-obsidian' 'traceabl':123 'trigger':167,338 'true':714 'two':659 'typic':502 'uncertainti':861 'untouch':1315 'updat':622,825,1270 'use':219,265,457,958,967,1192,1213 'user':989,1081,1324 'v0.2':640 'valu':503 'vari':485,1134 'verif':1391 'verifi':834,889,922 'via':202,249,1394 'wiki':2,6,53,279,326,346,537,1085,1172,1178,1181 'wiki-fold':1,52,1171 'wiki-ingest':1180 'wiki-lint':1177 'wiki/folds':29,411,438,452,1000,1054 'wiki/folds/fold-k3-from-2026-04-10-to-2026-04-23-n8.md':1372 'wiki/hot.md':1271 'wiki/index.md':1014 'wiki/log.md':20,72,573,1034,1335 'wiki/path/to/page.md':612 'wikilink':616 'without':538,846,1239 'would':984 'write':21,49,236,243,269,289,320,328,535,723,818,968,995,1130,1233,1377 'write/edit':266,1193 'x':810 'y':813 'yaml':629 'yyyi':1040 'yyyy-mm-dd':1039 'zero':357,1162","prices":[{"id":"9a504238-2b81-4750-8db0-de09eefcc92a","listingId":"89a2af20-7495-4870-8991-c023c52fa0f4","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"AgriciDaniel","category":"claude-obsidian","install_from":"skills.sh"},"createdAt":"2026-05-18T12:53:57.493Z"}],"sources":[{"listingId":"89a2af20-7495-4870-8991-c023c52fa0f4","source":"github","sourceId":"AgriciDaniel/claude-obsidian/wiki-fold","sourceUrl":"https://github.com/AgriciDaniel/claude-obsidian/tree/main/skills/wiki-fold","isPrimary":false,"firstSeenAt":"2026-05-18T12:53:57.493Z","lastSeenAt":"2026-05-18T18:52:44.390Z"}],"details":{"listingId":"89a2af20-7495-4870-8991-c023c52fa0f4","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"AgriciDaniel","slug":"wiki-fold","github":{"repo":"AgriciDaniel/claude-obsidian","stars":5150,"topics":["agent-skills","ai","ai-second-brain","autonomous-research","claude-code","claude-code-skill","claude-plugin","karpathy-llm-wiki","knowledge-graph","knowledge-management","llm","multi-agent","obsidian","obsidian-ai","obsidian-plugin","open-source","pkm","rag","second-brain","wiki"],"license":"mit","html_url":"https://github.com/AgriciDaniel/claude-obsidian","pushed_at":"2026-04-24T10:21:48Z","description":"Claude + Obsidian knowledge companion. Persistent, compounding wiki vault based on Karpathy's LLM Wiki pattern. /wiki /save /autoresearch","skill_md_sha":"351c086c44af5225ba9368500ea81a0960c2fb37","skill_md_path":"skills/wiki-fold/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/AgriciDaniel/claude-obsidian/tree/main/skills/wiki-fold"},"layout":"multi","source":"github","category":"claude-obsidian","frontmatter":{"name":"wiki-fold","description":"Rollup of wiki log entries into meta-pages. Reads the last 2^k entries from wiki/log.md, writes a structurally-idempotent fold page to wiki/folds/ that links back to children. Extractive summarization (no invention). Dry-run by default, stdout-only; commit mode writes and accepts that the PostToolUse hook auto-commits. Triggers on: fold the log, run a fold, run wiki-fold, log rollup, roll up log entries."},"skills_sh_url":"https://skills.sh/AgriciDaniel/claude-obsidian/wiki-fold"},"updatedAt":"2026-05-18T18:52:44.390Z"}}