dreamcontext 0.10.5 → 0.11.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 (154) hide show
  1. package/README.md +80 -0
  2. package/agents/curator-auditor.md +1 -1
  3. package/agents/curator-verifier.md +3 -3
  4. package/agents/curator-worker.md +1 -1
  5. package/agents/sleep-federation.md +1 -1
  6. package/agents/sleep-migration.md +1 -1
  7. package/agents/sleep-product.md +10 -9
  8. package/agents/sleep-state.md +1 -1
  9. package/agents/sleep-tasks.md +9 -5
  10. package/dist/agents/curator-auditor.md +1 -1
  11. package/dist/agents/curator-verifier.md +3 -3
  12. package/dist/agents/curator-worker.md +1 -1
  13. package/dist/agents/sleep-federation.md +1 -1
  14. package/dist/agents/sleep-migration.md +1 -1
  15. package/dist/agents/sleep-product.md +10 -9
  16. package/dist/agents/sleep-state.md +1 -1
  17. package/dist/agents/sleep-tasks.md +9 -5
  18. package/dist/dashboard/assets/{BrainCanvas3D-8hG96aAi.js → BrainCanvas3D-BG5EC27O.js} +1 -1
  19. package/dist/dashboard/assets/{_baseUniq-b4AibH2-.js → _baseUniq-BBdAvxIr.js} +1 -1
  20. package/dist/dashboard/assets/{ar-SA-G6X2FPQ2-DpGPIe5Z.js → ar-SA-G6X2FPQ2-Cr8uJAl3.js} +1 -1
  21. package/dist/dashboard/assets/{arc-BHNPUsz3.js → arc-DehvUlnl.js} +1 -1
  22. package/dist/dashboard/assets/{architectureDiagram-Q4EWVU46-IzEd_B2U.js → architectureDiagram-Q4EWVU46-DocWLhJ3.js} +1 -1
  23. package/dist/dashboard/assets/{az-AZ-76LH7QW2-Ccf6e1ON.js → az-AZ-76LH7QW2-UlZ4eYCI.js} +1 -1
  24. package/dist/dashboard/assets/{bg-BG-XCXSNQG7-XnDUjubv.js → bg-BG-XCXSNQG7-Er9YEeCL.js} +1 -1
  25. package/dist/dashboard/assets/{blockDiagram-DXYQGD6D-CEINLAFi.js → blockDiagram-DXYQGD6D-Cg9oDuzC.js} +1 -1
  26. package/dist/dashboard/assets/{bn-BD-2XOGV67Q-E9FzPBnu.js → bn-BD-2XOGV67Q-Cho39eqB.js} +1 -1
  27. package/dist/dashboard/assets/{c4Diagram-AHTNJAMY-VrHpmy8U.js → c4Diagram-AHTNJAMY-BUm8oDH_.js} +1 -1
  28. package/dist/dashboard/assets/{ca-ES-6MX7JW3Y-Cnp7YBQb.js → ca-ES-6MX7JW3Y-CMkem7bw.js} +1 -1
  29. package/dist/dashboard/assets/channel-Sgeb6qBc.js +1 -0
  30. package/dist/dashboard/assets/{chunk-4BX2VUAB-CuueCQHq.js → chunk-4BX2VUAB-5zNAwkrB.js} +1 -1
  31. package/dist/dashboard/assets/{chunk-4TB4RGXK-BhlZWQoi.js → chunk-4TB4RGXK-Bolly_uT.js} +1 -1
  32. package/dist/dashboard/assets/{chunk-55IACEB6-ClixcVTq.js → chunk-55IACEB6-DYdXQ_w1.js} +1 -1
  33. package/dist/dashboard/assets/{chunk-EDXVE4YY-DUj1uWsJ.js → chunk-EDXVE4YY-BcDcaZ9P.js} +1 -1
  34. package/dist/dashboard/assets/{chunk-FMBD7UC4-BZClSbG6.js → chunk-FMBD7UC4-BIVvJRKA.js} +1 -1
  35. package/dist/dashboard/assets/{chunk-OYMX7WX6-CMMXG2K9.js → chunk-OYMX7WX6-Dsp-XPYC.js} +1 -1
  36. package/dist/dashboard/assets/{chunk-QZHKN3VN-CI5x9wkp.js → chunk-QZHKN3VN-DHQlULoN.js} +1 -1
  37. package/dist/dashboard/assets/{chunk-YZCP3GAM-DnpOMFO-.js → chunk-YZCP3GAM-nfLb4HWe.js} +1 -1
  38. package/dist/dashboard/assets/classDiagram-6PBFFD2Q-DCtc4HRg.js +1 -0
  39. package/dist/dashboard/assets/classDiagram-v2-HSJHXN6E-DCtc4HRg.js +1 -0
  40. package/dist/dashboard/assets/clone-C1gU65sS.js +1 -0
  41. package/dist/dashboard/assets/{cose-bilkent-S5V4N54A-C9xnvFgj.js → cose-bilkent-S5V4N54A-DCIbVeFN.js} +1 -1
  42. package/dist/dashboard/assets/{cs-CZ-2BRQDIVT-BHebgNbB.js → cs-CZ-2BRQDIVT-DyFbnAib.js} +1 -1
  43. package/dist/dashboard/assets/{da-DK-5WZEPLOC-DYuNSWM8.js → da-DK-5WZEPLOC-BHXqHOuV.js} +1 -1
  44. package/dist/dashboard/assets/{dagre-KV5264BT-Ck8mmM53.js → dagre-KV5264BT-CL9d19L-.js} +1 -1
  45. package/dist/dashboard/assets/{de-DE-XR44H4JA-CMw5lMuT.js → de-DE-XR44H4JA-CJTodYJe.js} +1 -1
  46. package/dist/dashboard/assets/{diagram-5BDNPKRD-L4erno22.js → diagram-5BDNPKRD-BKw8TLKP.js} +1 -1
  47. package/dist/dashboard/assets/{diagram-G4DWMVQ6-Dkmwa2-B.js → diagram-G4DWMVQ6-DgG0hw4A.js} +1 -1
  48. package/dist/dashboard/assets/{diagram-MMDJMWI5-v2PnfbZO.js → diagram-MMDJMWI5-BJo4X0Wn.js} +1 -1
  49. package/dist/dashboard/assets/{diagram-TYMM5635-1ZO4tNjc.js → diagram-TYMM5635-CcR6aJeo.js} +1 -1
  50. package/dist/dashboard/assets/{el-GR-BZB4AONW-PXD8ArOs.js → el-GR-BZB4AONW-CBB6l2Bg.js} +1 -1
  51. package/dist/dashboard/assets/{erDiagram-SMLLAGMA-B8gV0kGN.js → erDiagram-SMLLAGMA-B6KYcAaM.js} +1 -1
  52. package/dist/dashboard/assets/{es-ES-U4NZUMDT-CbfskKe2.js → es-ES-U4NZUMDT-B1QetQmg.js} +1 -1
  53. package/dist/dashboard/assets/{eu-ES-A7QVB2H4-iqrfeyOI.js → eu-ES-A7QVB2H4-0kZWTDZ_.js} +1 -1
  54. package/dist/dashboard/assets/{fa-IR-HGAKTJCU-PzU2OiC1.js → fa-IR-HGAKTJCU-BV_G972f.js} +1 -1
  55. package/dist/dashboard/assets/{fi-FI-Z5N7JZ37-CbFLdQ9f.js → fi-FI-Z5N7JZ37-4uRqjpqj.js} +1 -1
  56. package/dist/dashboard/assets/{flowDiagram-DWJPFMVM-CKx3j3bI.js → flowDiagram-DWJPFMVM-3-llVL4u.js} +1 -1
  57. package/dist/dashboard/assets/{fr-FR-RHASNOE6-BuF2MviY.js → fr-FR-RHASNOE6-oiuA60jk.js} +1 -1
  58. package/dist/dashboard/assets/{ganttDiagram-T4ZO3ILL-CAbTd_KO.js → ganttDiagram-T4ZO3ILL-CS8zsjp0.js} +1 -1
  59. package/dist/dashboard/assets/{gitGraphDiagram-UUTBAWPF-Di7htCsA.js → gitGraphDiagram-UUTBAWPF-B0eMvQC7.js} +1 -1
  60. package/dist/dashboard/assets/{gl-ES-HMX3MZ6V-BqePaODm.js → gl-ES-HMX3MZ6V-CRxgAbK5.js} +1 -1
  61. package/dist/dashboard/assets/{graph-CC7SYwBm.js → graph-DqQ_drOx.js} +1 -1
  62. package/dist/dashboard/assets/{he-IL-6SHJWFNN-w9d4AvyL.js → he-IL-6SHJWFNN-BToDYgJ7.js} +1 -1
  63. package/dist/dashboard/assets/{hi-IN-IWLTKZ5I-BwHo17vR.js → hi-IN-IWLTKZ5I-o-ioqjhK.js} +1 -1
  64. package/dist/dashboard/assets/{hu-HU-A5ZG7DT2-Dm80xRge.js → hu-HU-A5ZG7DT2-CDW6wTqV.js} +1 -1
  65. package/dist/dashboard/assets/{id-ID-SAP4L64H-RpPM18i0.js → id-ID-SAP4L64H-ResY2pug.js} +1 -1
  66. package/dist/dashboard/assets/index-BelyM9a_.css +32 -0
  67. package/dist/dashboard/assets/{index-sA_NxF_Y.js → index-D71-76eF.js} +1 -1
  68. package/dist/dashboard/assets/index-DKts-kEI.js +516 -0
  69. package/dist/dashboard/assets/index-NsrznfmA.js +1 -0
  70. package/dist/dashboard/assets/{infoDiagram-42DDH7IO-z-1I4Qyj.js → infoDiagram-42DDH7IO-C2THbOkD.js} +1 -1
  71. package/dist/dashboard/assets/{ishikawaDiagram-UXIWVN3A-DWGoVsQO.js → ishikawaDiagram-UXIWVN3A-CM5Uqs__.js} +1 -1
  72. package/dist/dashboard/assets/{it-IT-JPQ66NNP-DhOvhKWm.js → it-IT-JPQ66NNP-fJefQ0PG.js} +1 -1
  73. package/dist/dashboard/assets/{ja-JP-DBVTYXUO-CEZ1K0xn.js → ja-JP-DBVTYXUO-CX5o3NDj.js} +1 -1
  74. package/dist/dashboard/assets/{journeyDiagram-VCZTEJTY-Dqh8uQwc.js → journeyDiagram-VCZTEJTY-8Y11-EOo.js} +1 -1
  75. package/dist/dashboard/assets/{kaa-6HZHGXH3-DuFoQ8nX.js → kaa-6HZHGXH3-C2vaD2tX.js} +1 -1
  76. package/dist/dashboard/assets/{kab-KAB-ZGHBKWFO-BkQCP_3o.js → kab-KAB-ZGHBKWFO-VKTEWRZv.js} +1 -1
  77. package/dist/dashboard/assets/{kanban-definition-6JOO6SKY-DCs65HUc.js → kanban-definition-6JOO6SKY-fdXdNyv1.js} +1 -1
  78. package/dist/dashboard/assets/{kk-KZ-P5N5QNE5-Dh9BXA8_.js → kk-KZ-P5N5QNE5-B2fu3rFx.js} +1 -1
  79. package/dist/dashboard/assets/{km-KH-HSX4SM5Z-D1S2EcQ_.js → km-KH-HSX4SM5Z-WkZWPeXS.js} +1 -1
  80. package/dist/dashboard/assets/{ko-KR-MTYHY66A-DsI3vrEx.js → ko-KR-MTYHY66A-CqdCI7AW.js} +1 -1
  81. package/dist/dashboard/assets/{ku-TR-6OUDTVRD-CyjK_3XH.js → ku-TR-6OUDTVRD-Dao-7Eyh.js} +1 -1
  82. package/dist/dashboard/assets/{layout-B_y9BOh6.js → layout-NO-i8A2F.js} +1 -1
  83. package/dist/dashboard/assets/{linear-BdGSdQOc.js → linear-DfqSzNjQ.js} +1 -1
  84. package/dist/dashboard/assets/{lt-LT-XHIRWOB4-C6tJka1D.js → lt-LT-XHIRWOB4-BT-wFvV7.js} +1 -1
  85. package/dist/dashboard/assets/{lv-LV-5QDEKY6T-C_xyL_ee.js → lv-LV-5QDEKY6T-DU4U7Z9Y.js} +1 -1
  86. package/dist/dashboard/assets/{min-U_KGhNEt.js → min-CEcHmSlm.js} +1 -1
  87. package/dist/dashboard/assets/{mindmap-definition-QFDTVHPH-sXmpEpKw.js → mindmap-definition-QFDTVHPH-BJw02kFe.js} +1 -1
  88. package/dist/dashboard/assets/{mr-IN-CRQNXWMA-C0TwGtAU.js → mr-IN-CRQNXWMA-1qeodviH.js} +1 -1
  89. package/dist/dashboard/assets/{my-MM-5M5IBNSE-RlAQCiXW.js → my-MM-5M5IBNSE-CrvbSOvz.js} +1 -1
  90. package/dist/dashboard/assets/{nb-NO-T6EIAALU-C1JHqr1t.js → nb-NO-T6EIAALU-B_1bglU7.js} +1 -1
  91. package/dist/dashboard/assets/{nl-NL-IS3SIHDZ-B0BVD_2p.js → nl-NL-IS3SIHDZ-CSkrTKk7.js} +1 -1
  92. package/dist/dashboard/assets/{nn-NO-6E72VCQL-zQTko94P.js → nn-NO-6E72VCQL-BZk5efFe.js} +1 -1
  93. package/dist/dashboard/assets/{oc-FR-POXYY2M6-CBZRg6ku.js → oc-FR-POXYY2M6-Bv7XOHck.js} +1 -1
  94. package/dist/dashboard/assets/{pa-IN-N4M65BXN-7s6qpn6h.js → pa-IN-N4M65BXN-CqwtWDAw.js} +1 -1
  95. package/dist/dashboard/assets/{percentages-BXMCSKIN-DckRvLSG.js → percentages-BXMCSKIN-FEVpi1aK.js} +7 -7
  96. package/dist/dashboard/assets/{pica-ByOjSUxE.js → pica-By0ke6np.js} +1 -1
  97. package/dist/dashboard/assets/{pieDiagram-DEJITSTG-BJJsFOH9.js → pieDiagram-DEJITSTG-CGiIN9rP.js} +1 -1
  98. package/dist/dashboard/assets/{pl-PL-T2D74RX3-QTzNyi10.js → pl-PL-T2D74RX3-BPL4bpVg.js} +1 -1
  99. package/dist/dashboard/assets/{pt-BR-5N22H2LF-tntUlote.js → pt-BR-5N22H2LF-LrCGDR4f.js} +1 -1
  100. package/dist/dashboard/assets/{pt-PT-UZXXM6DQ-B9M5aHl1.js → pt-PT-UZXXM6DQ-MzDeZ8io.js} +1 -1
  101. package/dist/dashboard/assets/{quadrantDiagram-34T5L4WZ-BearsU1w.js → quadrantDiagram-34T5L4WZ-6_OTN0xX.js} +1 -1
  102. package/dist/dashboard/assets/{requirementDiagram-MS252O5E-BixosHER.js → requirementDiagram-MS252O5E-Ck8soX2R.js} +1 -1
  103. package/dist/dashboard/assets/{ro-RO-JPDTUUEW-qbgXrb57.js → ro-RO-JPDTUUEW-Be8UTIAL.js} +1 -1
  104. package/dist/dashboard/assets/{ru-RU-B4JR7IUQ-CgX4A1Ib.js → ru-RU-B4JR7IUQ-D6wZSeLr.js} +1 -1
  105. package/dist/dashboard/assets/{sankeyDiagram-XADWPNL6-DMSd55sU.js → sankeyDiagram-XADWPNL6-BDl2kRaQ.js} +1 -1
  106. package/dist/dashboard/assets/{sequenceDiagram-FGHM5R23-D2-Uwrtb.js → sequenceDiagram-FGHM5R23-u0Lxjo21.js} +1 -1
  107. package/dist/dashboard/assets/{si-LK-N5RQ5JYF-CWEkBvJB.js → si-LK-N5RQ5JYF-BcvqeVKa.js} +1 -1
  108. package/dist/dashboard/assets/{sk-SK-C5VTKIMK-CG8moyh9.js → sk-SK-C5VTKIMK-BKBcl8fa.js} +1 -1
  109. package/dist/dashboard/assets/{sl-SI-NN7IZMDC-CsBFEfKt.js → sl-SI-NN7IZMDC-CH8BpLHn.js} +1 -1
  110. package/dist/dashboard/assets/{stateDiagram-FHFEXIEX-vG3jGBpo.js → stateDiagram-FHFEXIEX-p6FESVEx.js} +1 -1
  111. package/dist/dashboard/assets/stateDiagram-v2-QKLJ7IA2-s6Ql63bp.js +1 -0
  112. package/dist/dashboard/assets/{subset-shared.chunk-Bin8VoC6.js → subset-shared.chunk-B4Hz462f.js} +1 -1
  113. package/dist/dashboard/assets/{subset-worker.chunk-mRsEjVpS.js → subset-worker.chunk-B7VKgsUg.js} +1 -1
  114. package/dist/dashboard/assets/{sv-SE-XGPEYMSR-BMD7GbQV.js → sv-SE-XGPEYMSR-ClNuCh1A.js} +1 -1
  115. package/dist/dashboard/assets/{ta-IN-2NMHFXQM-CjZ7GPuA.js → ta-IN-2NMHFXQM-CAnDI3eq.js} +1 -1
  116. package/dist/dashboard/assets/{th-TH-HPSO5L25-BTE57yWh.js → th-TH-HPSO5L25-Dz-3ZPUJ.js} +1 -1
  117. package/dist/dashboard/assets/{timeline-definition-GMOUNBTQ-Bz7MuXCz.js → timeline-definition-GMOUNBTQ-CIac4xXn.js} +1 -1
  118. package/dist/dashboard/assets/{tr-TR-DEFEU3FU-CKY-uY5_.js → tr-TR-DEFEU3FU-BDzr5oow.js} +1 -1
  119. package/dist/dashboard/assets/{uk-UA-QMV73CPH-BuopbANh.js → uk-UA-QMV73CPH-Da9cYKW9.js} +1 -1
  120. package/dist/dashboard/assets/{vennDiagram-DHZGUBPP-TsesBmH7.js → vennDiagram-DHZGUBPP-BrX9xqo7.js} +1 -1
  121. package/dist/dashboard/assets/{vi-VN-M7AON7JQ-CLrvMDM6.js → vi-VN-M7AON7JQ-e-doFs6_.js} +1 -1
  122. package/dist/dashboard/assets/{wardley-RL74JXVD-DlttwW9K.js → wardley-RL74JXVD-Ca-_RvNV.js} +1 -1
  123. package/dist/dashboard/assets/{wardleyDiagram-NUSXRM2D-BfZXChhy.js → wardleyDiagram-NUSXRM2D-WO1s20SP.js} +1 -1
  124. package/dist/dashboard/assets/{xychartDiagram-5P7HB3ND-jjeDn8EJ.js → xychartDiagram-5P7HB3ND-BcKK53PD.js} +1 -1
  125. package/dist/dashboard/assets/{zh-CN-LNUGB5OW-C1MYPzyx.js → zh-CN-LNUGB5OW-C2WmUiS8.js} +1 -1
  126. package/dist/dashboard/assets/{zh-HK-E62DVLB3-BriaHjNV.js → zh-HK-E62DVLB3-CdwVKtJe.js} +1 -1
  127. package/dist/dashboard/assets/{zh-TW-RAJ6MFWO-BUDimtjA.js → zh-TW-RAJ6MFWO-B_UG5PdF.js} +1 -1
  128. package/dist/dashboard/index.html +2 -2
  129. package/dist/git-sync/askpass.cjs +31 -0
  130. package/dist/index.js +6279 -1587
  131. package/dist/templates/AGENTS.md +1 -1
  132. package/dist/templates/CLAUDE.md +1 -1
  133. package/dist/templates/feature.md +5 -0
  134. package/dist/templates/obsidian/graph.json +1 -1
  135. package/package.json +2 -1
  136. package/skill/SKILL.md +6 -4
  137. package/skill/references/cli-reference.md +20 -1
  138. package/skill/references/integrations.md +45 -1
  139. package/skill/references/knowledge-and-recall.md +1 -1
  140. package/skill/references/sleep.md +2 -2
  141. package/skill/references/tasks-and-features.md +27 -6
  142. package/skill-curator/SKILL.md +3 -2
  143. package/skill-deep-research/SKILL.md +2 -2
  144. package/skill-initializer/SKILL.md +2 -2
  145. package/skill-sync/SKILL.md +94 -0
  146. package/skill-sync/references/merge-rules.md +201 -0
  147. package/dist/dashboard/assets/channel-DwaG7WPN.js +0 -1
  148. package/dist/dashboard/assets/classDiagram-6PBFFD2Q-COGCH4LQ.js +0 -1
  149. package/dist/dashboard/assets/classDiagram-v2-HSJHXN6E-COGCH4LQ.js +0 -1
  150. package/dist/dashboard/assets/clone-DwBiydth.js +0 -1
  151. package/dist/dashboard/assets/index-BK87l45R.js +0 -1
  152. package/dist/dashboard/assets/index-CkxvR2LH.css +0 -32
  153. package/dist/dashboard/assets/index-DalMBSek.js +0 -511
  154. package/dist/dashboard/assets/stateDiagram-v2-QKLJ7IA2-V8xCsZlI.js +0 -1
@@ -0,0 +1,201 @@
1
+ # Brain-Repo Sync — Merge Rules & State Machine
2
+
3
+ Authoritative spec for `dreamcontext brain sync` / `/dream-sync` (github-cloud-collaboration-brain-repo-sync,
4
+ plan v3.3). The CLI (`src/lib/git-sync/*`) implements everything on this page.
5
+
6
+ ## 1. Modes
7
+
8
+ - **`separate`** — the brain (`_dream_context/`) lives in its own git repo + remote. Full
9
+ auto-sync: fetch → merge → commit → push. Opt-in (`dreamcontext brain init`/`attach`).
10
+ - **`in-tree`** — the brain is nested inside the code repo (the default for every existing
11
+ project). **Commit-only — NEVER auto-pushes** (a push here would push the code repo). The scrub
12
+ gate still runs before every in-tree commit — an in-tree commit lands in the code repo's history
13
+ and can be pushed to a public OSS remote by the user's own normal `git push`.
14
+
15
+ ## 2. Cloud-sync master switch (v3.3)
16
+
17
+ `brainRepo.enabled` (explicit) always wins. Absent ⇒ derived: **ON** iff the project is already
18
+ GitHub-connected (code repo's `origin` is a `github.com` URL, OR `taskBackend==='github'`, OR a
19
+ `brainRepo.remote` is configured) — **OFF** otherwise (new/unconnected projects stay off until the
20
+ user runs `dreamcontext brain enable` or flips the Settings toggle). When OFF: `sleep done` skips
21
+ the whole block with one dim line, the session-start pull is never spawned, and `brain sync`
22
+ returns `action:'disabled'`.
23
+
24
+ ## 3. Tracked vs local — the brain repo's own `.gitignore`
25
+
26
+ | Path | `taskBackend=local` | `taskBackend=github`/`clickup` |
27
+ |---|---|---|
28
+ | `core/**` (soul/user/memory, features, CHANGELOG.json, RELEASES.json, taxonomy.json, objectives/) | tracked | tracked |
29
+ | `knowledge/**` | tracked | tracked |
30
+ | `overrides/**` | tracked | tracked |
31
+ | `state/*.md` (tasks) | tracked (source of truth) | gitignored (local mirror; issues/ClickUp are source of truth) |
32
+ | `state/.config.json`, `.active-version.json`, `.migrations.json` | tracked | tracked |
33
+ | `state/.secrets.json`, `.sleep.json`, `.sleep-history.json`, `.agent-sessions.json`, `.session-digests/`, `.conflicts/`, `.brain-merge/`, `.version-check.json`, `.auto-upgrade.json`, `.brain-local.json`, `.tasks-map.json`, `.tasks-sync.*`, `.tasks-queue.json`, `.obsidian/`, `tmp/`, `**/.env` | gitignored | gitignored |
34
+
35
+ Built by `buildBrainGitignore(taskBackend)` (`src/lib/git-sync/brain-repo.ts`) and written on
36
+ bootstrap (`brain init`/`attach`); `ensureLocalOnlyArtifacts` re-asserts it after a clone/pull.
37
+
38
+ ## 4. Credential supply (GIT_ASKPASS — decision F)
39
+
40
+ The token is NEVER embedded in a remote URL, env, or argv. Every networked git call runs inside
41
+ `withGitCredentials(token, fn)` (`src/lib/git-sync/credentials.ts`):
42
+
43
+ 1. Token written to a fresh `os.tmpdir()` file, created 0600 **atomically at write**
44
+ (`writeFileSync(path, token, { mode: 0o600 })`), belt-and-suspenders `chmodSync`.
45
+ 2. Child env: `GIT_ASKPASS=<askpass.cjs>`, `DREAMCONTEXT_ASKPASS_TOKEN_FILE=<tmp path>`,
46
+ `GIT_TERMINAL_PROMPT=0`. Every call also passes `-c credential.helper=` to disable any
47
+ persisted helper (osxkeychain etc).
48
+ 3. `fn(env)` runs the actual git call.
49
+ 4. `finally`: the tmp file is unlinked — even if `fn` throws.
50
+
51
+ `askpass.cjs` prints `x-access-token` for a username prompt, and the tmp file's token otherwise.
52
+
53
+ ## 5. Token resolution (decision D)
54
+
55
+ `resolveBrainSyncToken(projectRoot)` — **M1: per-project `.secrets.json` github token → env
56
+ (`GITHUB_TOKEN`/`GH_TOKEN`)**. Secrets-first, env-last — the INTENTIONAL reverse of
57
+ `resolveGitHubToken` (env-first): a stray `GITHUB_TOKEN` in some inherited shell must never
58
+ silently override the account a non-technical collaborator is actually logged in as. (M2 inserts a
59
+ global `~/.dreamcontext/.secrets.json` tier between the two.)
60
+
61
+ ## 6. Scrub gate (decisions — BLOCK vs WARN)
62
+
63
+ Runs before EVERY brain content commit: in-tree, separate, `brain init`'s first commit, `brain
64
+ detach`, and after every merge (a merge can reintroduce a secret).
65
+
66
+ - **BLOCK** (aborts everywhere, loudly, non-zero exit): GitHub PAT/OAuth tokens, AWS/Google/Slack/
67
+ OpenAI/Anthropic/Stripe keys, private-key headers, 3-part JWTs.
68
+ - **WARN** (non-blocking in every FOREGROUND mode — a human is present to judge): home-directory
69
+ paths, generic `token = "..."` style assignments.
70
+ - **Headless pull-only is effective-`--strict`**: because NO human sees a background auto-commit
71
+ before it can be pushed, pull-only treats a WARN hit as blocking too — it refuses the auto-commit
72
+ and returns `blocked-scrub` with a "looks sensitive — review and run `brain sync` manually" notice
73
+ surfaced at the next session start. Foreground `auto`/`push-only`/`--resume` keep WARN
74
+ non-blocking.
75
+
76
+ ## 7. Deterministic merge rules (per file class)
77
+
78
+ | File class | Rule |
79
+ |---|---|
80
+ | `core/CHANGELOG.json` | Set-union by fingerprint = hash(`date`+`type`+`scope`+`description`). Dedupe, sort date desc (LIFO). No entry lost. |
81
+ | `core/RELEASES.json` | Union by `version`/`id`. Same key both sides → field-merge: union `features[]`/`tasks[]`/`changelog[]`; scalars (`date`/`summary`/`status`/`breaking`) — non-empty side wins. |
82
+ | `state/*.md` (tasks) | **Furthest status wins** (`todo < in_progress < in_review < completed`) + **changelog LIFO union** (dedup by normalized text) + everything else via `merge3Bodies`. |
83
+ | `state/.config.json` | `people[]`/`packs[]`/`platforms[]` union; `peopleIdentity` key-union; other scalars — "ours" (local) wins on conflict. |
84
+ | `core/taxonomy.json` | Union tag entries per facet. |
85
+ | `knowledge/**` (incl. `knowledge/features/**` — features are typed knowledge) | **Clean union via `merge3Bodies` ONLY when no section was touched differently by both sides.** Otherwise (see §8) the CLI discards its own remote-wins attempt and defers to an agent. |
86
+ | anything else | Same rule as knowledge/features: clean union or defer. |
87
+
88
+ **CLI does:** every JSON class, task status/changelog, clean markdown unions — fully automatic,
89
+ zero data loss by construction. **Agent (`/dream-sync`) does:** only prose where two people
90
+ genuinely edited the same section.
91
+
92
+ ## 8. The C1 discard contract (why some files defer to an agent)
93
+
94
+ `merge3Bodies` (`src/lib/task-backend/merge.ts`) is **remote-always-wins and never fails**: when
95
+ both sides changed the SAME section differently, it silently returns the remote version and
96
+ records the section name in `conflictSections`. Writing that "resolution" to disk would silently
97
+ throw away the local author's words. So the wrapper (`mergeMarkdownDoc`,
98
+ `src/lib/git-sync/semantic-merge.ts`) is stricter:
99
+
100
+ - `conflictSections.length > 0` → `{ merged: null, needsAgent: true }` — **the CLI writes nothing**;
101
+ the section-overlap is real disagreement, not something a heuristic should silently arbitrate.
102
+ - `conflictSections.length === 0` → the union is safe and is written directly.
103
+
104
+ ## 9. The conflict report (the agent handoff contract)
105
+
106
+ When any file needs an agent, the CLI writes `_dream_context/state/.brain-merge/report.json`
107
+ (gitignored) with `base`/`ours`/`theirs` snapshot files alongside it:
108
+
109
+ ```jsonc
110
+ { "startedAt": 1720000000, "remoteRef": "origin/main",
111
+ "resolvedByCli": ["core/CHANGELOG.json", "state/task-foo.md"],
112
+ "deferred": [ { "path": "knowledge/architecture.md", "class": "knowledge-md",
113
+ "reason": "overlapping edits to same section",
114
+ "basePath": "state/.brain-merge/knowledge__architecture.md.base.md",
115
+ "oursPath": "state/.brain-merge/knowledge__architecture.md.ours.md",
116
+ "theirsPath": "state/.brain-merge/knowledge__architecture.md.theirs.md" } ],
117
+ "status": "awaiting-agent" }
118
+ ```
119
+
120
+ `clearConflictReport` removes the report AND every snapshot file. It fires at exactly three
121
+ points: **(a)** `--continue` success (after the agent-resolved files are re-scrubbed and pushed —
122
+ this covers BOTH the classic-auto completion and the pull-only → `--resume` → `--continue`
123
+ completion, since they share the same `--continue` code path), **(b)** `--resume`'s START (the OLD
124
+ pull-only report is superseded by a fresh attempt, before that attempt runs), **(c)** a genuinely
125
+ STALE report (`!MERGE_HEAD && !pendingAgentMerge` — a report left behind with no live handoff).
126
+
127
+ **Staleness is NOT "no `MERGE_HEAD`" alone** — a legitimate pull-only defer, by design, has no
128
+ `MERGE_HEAD` (pull-only aborts the merge before returning `awaiting-agent`). A report is stale only
129
+ when BOTH `MERGE_HEAD` is absent AND `pendingAgentMerge` is false. A `pendingAgentMerge:true`
130
+ report is a LIVE handoff — never auto-cleared, consumable only via `--resume`.
131
+
132
+ ## 10. The reentrancy guard — 5-clause precedence (v3.2)
133
+
134
+ Every `runBrainSync` call (separate mode only — in-tree bypasses this entirely, see §1) checks, in
135
+ order, BEFORE acquiring the lock:
136
+
137
+ 1. **Flag misuse** → `invalid-flag` + a guiding `note`: `--continue` without `MERGE_HEAD`;
138
+ `--resume` with `MERGE_HEAD` present; `--resume` without a pending handoff.
139
+ 2. **`MERGE_HEAD` present** → only `--continue` proceeds; everything else (including `--resume`)
140
+ returns `already-awaiting-agent`, touching nothing.
141
+ 3. **`pendingAgentMerge && !MERGE_HEAD`** (a LIVE pull-only-deferred handoff) → only `--resume`
142
+ proceeds; everything else returns `already-awaiting-agent`.
143
+ 4. **Stale report** (`!MERGE_HEAD && !pendingAgentMerge`, and an existing report) → cleared, then
144
+ proceed normally in the requested mode.
145
+ 5. Otherwise → normal. Then `acquireBrainLock` — held by a LIVE holder → `locked`. A lock left by a
146
+ DEAD PID past the staleness window is reclaimed (PID-liveness probe via `process.kill(pid, 0)`);
147
+ a lock held by an ALIVE PID is never reclaimed regardless of age.
148
+
149
+ ## 11. `--resume` vs `--continue`
150
+
151
+ - **`--continue`** — commit an IN-PROGRESS merge (requires a real `MERGE_HEAD`). The single
152
+ completion path for BOTH the classic-auto defer and a resumed-pull-only re-defer.
153
+ - **`--resume`** — ATTENDED redo of a pull-only-deferred handoff (requires `pendingAgentMerge` with
154
+ no `MERGE_HEAD`). Pre-clears the OLD report, then runs a fresh FOREGROUND fetch+merge (WARN
155
+ non-blocking — a human/agent is present): if the remote moved on, this alone completes
156
+ (`pushed`/`pulled`, `pendingAgentMerge` flips false, no agent step). If it re-defers, a FRESH
157
+ report + a real `MERGE_HEAD` now exist for the classic `--continue`.
158
+
159
+ **Unattended callers (`sleep done` autoSync, the session-start pull, the dashboard) NEVER resume or
160
+ continue themselves** — they print the `/dream-sync` instruction on `already-awaiting-agent` and
161
+ stop. Only `/dream-sync` or a human at `brain sync` drives these two flags.
162
+
163
+ ## 12. Pull-only — content delivery, safe headless (P2/C6)
164
+
165
+ The zero-git promise means a teammate's content must arrive even for someone who never sleeps,
166
+ without ever leaving the working tree broken mid-session:
167
+
168
+ 1. Fetch. Remote not ahead → `noop`.
169
+ 2. Dirty tracked tree → auto-commit first (`chore(brain): auto-checkpoint local edits before team
170
+ merge`, M1 author tiering) under **effective-`--strict`** scrub (§6) — ANY hit refuses the
171
+ auto-commit and returns `blocked-scrub`, delivering nothing.
172
+ 3. Merge the remote ref:
173
+ - **Clean or all-deterministic** → commit → `pulled`, `pulledUpdates>0`. **Never pushes.**
174
+ - **Agent-class conflict** → write the report + snapshots, `git merge --abort` back to a CLEAN
175
+ COMMITTED tree (never left mid-merge), `pendingAgentMerge:true` → `awaiting-agent`. The redo
176
+ happens later via `--resume` (§11), driven by `/dream-sync` or a human — never automatically.
177
+
178
+ ## 13. Non-fast-forward push race (C4)
179
+
180
+ `push` rejected → `fetch` → `attemptMerge` (clean/all-deterministic → commit, push again;
181
+ agent-class → write report, `awaiting-agent`, no infinite loop) → retry the push **at most once**.
182
+ Still rejected → a loud `GitSyncError` (this is the one case that's allowed to surface as a thrown
183
+ error rather than a typed `SyncResult`, since two failed pushes in a row means something
184
+ operationally wrong, not a normal conflict).
185
+
186
+ ## 14. Commit author tiering (amendment 2)
187
+
188
+ **M1 tier (default):** let git resolve its own `user.name`/`user.email`. If unset, fall back to
189
+ the fixed `dreamcontext-sync <noreply@dreamcontext.local>` author (passed explicitly via
190
+ `GIT_AUTHOR_*`/`GIT_COMMITTER_*` env) — a commit never fails on a missing git identity, and M1
191
+ takes zero forward dependency on M3. **M3 tier (adds, does not replace):** once a GitHub login
192
+ exists, `mapLoginToPerson(login)` swaps in the resolved `person:` identity on top.
193
+
194
+ ## 15. Manual UI checklist (M2 — appendix)
195
+
196
+ When M2 (launcher/dashboard) ships, verify by hand: device-flow login (shows `user_code`, opens
197
+ `verification_uri`) AND the PAT-paste fallback, both with the scope disclosure visible; `Discover`
198
+ lists only `dreamcontext-brain`-topic repos; `Create` defaults private (public requires a
199
+ confirmed toggle); `Attach` shows the trust warning + incoming diff preview and refuses without
200
+ confirmation; the team-updates badge shows N after a teammate pushes, driven by a background fetch
201
+ (the badge endpoint itself makes no network call in the request path).
@@ -1 +0,0 @@
1
- import{aq as o,ar as n}from"./index-DalMBSek.js";const t=(r,a)=>o.lang.round(n.parse(r)[a]);export{t as c};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-BhlZWQoi.js";import{_ as i}from"./index-DalMBSek.js";import"./chunk-FMBD7UC4-BZClSbG6.js";import"./chunk-YZCP3GAM-DnpOMFO-.js";import"./chunk-55IACEB6-ClixcVTq.js";import"./chunk-EDXVE4YY-DUj1uWsJ.js";var u={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{u as diagram};
@@ -1 +0,0 @@
1
- import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK-BhlZWQoi.js";import{_ as i}from"./index-DalMBSek.js";import"./chunk-FMBD7UC4-BZClSbG6.js";import"./chunk-YZCP3GAM-DnpOMFO-.js";import"./chunk-55IACEB6-ClixcVTq.js";import"./chunk-EDXVE4YY-DUj1uWsJ.js";var u={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{u as diagram};
@@ -1 +0,0 @@
1
- import{b as r}from"./graph-CC7SYwBm.js";var e=4;function a(o){return r(o,e)}export{a as c};
@@ -1 +0,0 @@
1
- import{i}from"./core-Cn4yfEqx.js";async function o(e={}){return typeof e=="object"&&Object.freeze(e),await i("plugin:dialog|open",{options:e})}export{o as open};