t3code-session-manager 0.0.0-stage → 0.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 (172) hide show
  1. package/.claude-plugin/marketplace.json +21 -0
  2. package/.claude-plugin/plugin.json +19 -0
  3. package/CHANGELOG.md +138 -0
  4. package/LICENSE +21 -0
  5. package/README.md +660 -2
  6. package/README.pt.md +616 -0
  7. package/bin/entry.d.mts +2 -0
  8. package/bin/entry.mjs +19 -0
  9. package/bin/t3sm.mjs +44 -0
  10. package/commands/import.md +30 -0
  11. package/commands/organize.md +36 -0
  12. package/commands/status.md +24 -0
  13. package/commands/sync.md +26 -0
  14. package/dist/apply/apply.js +993 -0
  15. package/dist/apply/claudeWriter.js +168 -0
  16. package/dist/apply/copyTranscript.js +116 -0
  17. package/dist/apply/importer.js +697 -0
  18. package/dist/apply/materialize.js +335 -0
  19. package/dist/apply/waves.js +108 -0
  20. package/dist/assistant/core.js +295 -0
  21. package/dist/assistant/deps.js +256 -0
  22. package/dist/assistant/i18n.js +38 -0
  23. package/dist/assistant/messages.en.js +494 -0
  24. package/dist/assistant/messages.pt.js +495 -0
  25. package/dist/assistant/runner.js +64 -0
  26. package/dist/assistant/steps.js +1362 -0
  27. package/dist/build.json +1 -0
  28. package/dist/cli/applyScreen.js +158 -0
  29. package/dist/cli/commands/accounts.js +254 -0
  30. package/dist/cli/commands/apply.js +199 -0
  31. package/dist/cli/commands/changelog.js +61 -0
  32. package/dist/cli/commands/doctor.js +105 -0
  33. package/dist/cli/commands/help.js +158 -0
  34. package/dist/cli/commands/merge.js +224 -0
  35. package/dist/cli/commands/organize.js +872 -0
  36. package/dist/cli/commands/plan.js +161 -0
  37. package/dist/cli/commands/projects.js +430 -0
  38. package/dist/cli/commands/quarantine.js +203 -0
  39. package/dist/cli/commands/recover.js +230 -0
  40. package/dist/cli/commands/rollback.js +281 -0
  41. package/dist/cli/commands/scan.js +117 -0
  42. package/dist/cli/commands/schedule.js +288 -0
  43. package/dist/cli/commands/start.js +45 -0
  44. package/dist/cli/commands/status.js +615 -0
  45. package/dist/cli/commands/sync.js +336 -0
  46. package/dist/cli/commands/update.js +398 -0
  47. package/dist/cli/errors.js +53 -0
  48. package/dist/cli/failures.js +91 -0
  49. package/dist/cli/flags.js +53 -0
  50. package/dist/cli/help.en.js +549 -0
  51. package/dist/cli/help.pt.js +566 -0
  52. package/dist/cli/helpText.js +211 -0
  53. package/dist/cli/helpTopics.js +58 -0
  54. package/dist/cli/locked.js +12 -0
  55. package/dist/cli/main.js +155 -0
  56. package/dist/cli/screen.js +3 -0
  57. package/dist/cli/ui.js +111 -0
  58. package/dist/cli/words.js +2 -0
  59. package/dist/core/activity.js +16 -0
  60. package/dist/core/changelog.js +47 -0
  61. package/dist/core/config.js +530 -0
  62. package/dist/core/fsutil.js +171 -0
  63. package/dist/core/glob.js +34 -0
  64. package/dist/core/history.js +32 -0
  65. package/dist/core/journal.js +274 -0
  66. package/dist/core/lock.js +337 -0
  67. package/dist/core/mask.js +31 -0
  68. package/dist/core/paths.js +68 -0
  69. package/dist/core/pid.js +101 -0
  70. package/dist/core/run.js +4 -0
  71. package/dist/core/semver.js +18 -0
  72. package/dist/core/sysroot.js +29 -0
  73. package/dist/core/types.js +229 -0
  74. package/dist/core/uuid.js +29 -0
  75. package/dist/core/version.js +72 -0
  76. package/dist/help/convert.md +20 -0
  77. package/dist/help/convert.pt.md +21 -0
  78. package/dist/help/cwd-unreadable.md +22 -0
  79. package/dist/help/cwd-unreadable.pt.md +22 -0
  80. package/dist/help/decisions.md +20 -0
  81. package/dist/help/decisions.pt.md +20 -0
  82. package/dist/help/errors.md +20 -0
  83. package/dist/help/errors.pt.md +22 -0
  84. package/dist/help/held.md +20 -0
  85. package/dist/help/held.pt.md +20 -0
  86. package/dist/help/history.md +27 -0
  87. package/dist/help/history.pt.md +29 -0
  88. package/dist/help/instance-unavailable.md +18 -0
  89. package/dist/help/instance-unavailable.pt.md +19 -0
  90. package/dist/help/not-imported.md +19 -0
  91. package/dist/help/not-imported.pt.md +19 -0
  92. package/dist/help/orphaned.md +19 -0
  93. package/dist/help/orphaned.pt.md +19 -0
  94. package/dist/help/project-mismatch.md +15 -0
  95. package/dist/help/project-mismatch.pt.md +15 -0
  96. package/dist/help/t3-native.md +22 -0
  97. package/dist/help/t3-native.pt.md +22 -0
  98. package/dist/help/updates.md +26 -0
  99. package/dist/help/updates.pt.md +28 -0
  100. package/dist/help/watcher.md +24 -0
  101. package/dist/help/watcher.pt.md +25 -0
  102. package/dist/i18n/cli.js +41 -0
  103. package/dist/i18n/lang.js +55 -0
  104. package/dist/i18n/messages.en.js +1140 -0
  105. package/dist/i18n/messages.pt.js +1149 -0
  106. package/dist/i18n/words.js +12 -0
  107. package/dist/ops/accounts.js +170 -0
  108. package/dist/ops/autoUpdate.js +223 -0
  109. package/dist/ops/discoverAccounts.js +343 -0
  110. package/dist/ops/doctor.js +811 -0
  111. package/dist/ops/elevated.js +47 -0
  112. package/dist/ops/errorCodes.js +39 -0
  113. package/dist/ops/follow.js +558 -0
  114. package/dist/ops/merge.js +830 -0
  115. package/dist/ops/notify.js +249 -0
  116. package/dist/ops/plugin.js +92 -0
  117. package/dist/ops/projects.js +113 -0
  118. package/dist/ops/quarantine.js +415 -0
  119. package/dist/ops/rollback.js +868 -0
  120. package/dist/ops/schedule.js +464 -0
  121. package/dist/ops/successor.js +51 -0
  122. package/dist/ops/sync.js +859 -0
  123. package/dist/ops/syncStatus.js +290 -0
  124. package/dist/ops/update.js +273 -0
  125. package/dist/ops/updater.js +641 -0
  126. package/dist/ops/watch.js +676 -0
  127. package/dist/ops/watcherControl.js +212 -0
  128. package/dist/ops/watcherHealth.js +75 -0
  129. package/dist/organize/apply.js +495 -0
  130. package/dist/organize/history.js +192 -0
  131. package/dist/organize/plan.js +283 -0
  132. package/dist/organize/rename.js +58 -0
  133. package/dist/organize/sessions.js +100 -0
  134. package/dist/organize/titles.js +70 -0
  135. package/dist/organize/types.js +73 -0
  136. package/dist/plan/categories.js +104 -0
  137. package/dist/plan/dedupe.js +137 -0
  138. package/dist/plan/folders.js +82 -0
  139. package/dist/plan/names.js +93 -0
  140. package/dist/plan/ownership.js +316 -0
  141. package/dist/plan/planner.js +669 -0
  142. package/dist/plan/rehome.js +101 -0
  143. package/dist/plan/report.js +407 -0
  144. package/dist/sources/cache.js +89 -0
  145. package/dist/sources/claude.js +297 -0
  146. package/dist/sources/codex.js +496 -0
  147. package/dist/sources/flatten.js +23 -0
  148. package/dist/sources/jsonl.js +169 -0
  149. package/dist/sources/native.js +233 -0
  150. package/dist/sources/opencode.js +483 -0
  151. package/dist/sources/pi.js +133 -0
  152. package/dist/sources/registry.js +67 -0
  153. package/dist/sources/types.js +80 -0
  154. package/dist/t3/api.js +492 -0
  155. package/dist/t3/auth.js +248 -0
  156. package/dist/t3/compat.js +62 -0
  157. package/dist/t3/decode.js +408 -0
  158. package/dist/t3/errors.js +185 -0
  159. package/dist/t3/rpc.js +185 -0
  160. package/dist/t3/runtime.js +80 -0
  161. package/dist/ui/caps.js +56 -0
  162. package/dist/ui/components.js +202 -0
  163. package/dist/ui/layout.js +205 -0
  164. package/dist/ui/list.js +423 -0
  165. package/dist/ui/locale.js +73 -0
  166. package/dist/ui/organizePreview.js +72 -0
  167. package/dist/ui/progress.js +237 -0
  168. package/dist/ui/style.js +32 -0
  169. package/dist/ui/terminal.js +126 -0
  170. package/dist/ui/text.js +186 -0
  171. package/package.json +58 -4
  172. package/skills/t3code-sessions/SKILL.md +183 -0
@@ -0,0 +1,186 @@
1
+ // Display-width-correct text helpers (plain text in, plain text out; ANSI is only stripped for measuring). One shared
2
+ // Intl.Segmenter. Width: East-Asian Wide/Fullwidth and emoji presentation = 2; combining marks, format and control
3
+ // characters = 0; an emoji cluster (ZWJ sequence, VS16, flag, keycap) counts once, as 2.
4
+
5
+ const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
6
+ const graphemes = (s ) => [...segmenter.segment(s)].map((g) => g.segment);
7
+
8
+ const ANSI = /\u001b\[[0-?]*[ -/]*[@-~]|\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)/g;
9
+ export function stripAnsi(s ) { return s.replace(ANSI, ""); }
10
+
11
+ /** [from, to] code point ranges drawn two cells wide, sorted. */
12
+ const WIDE = [
13
+ [0x1100, 0x115f], [0x231a, 0x231b], [0x2329, 0x232a], [0x23e9, 0x23ec], [0x23f0, 0x23f0], [0x23f3, 0x23f3],
14
+ [0x25fd, 0x25fe], [0x2614, 0x2615], [0x2648, 0x2653], [0x267f, 0x267f], [0x2693, 0x2693], [0x26a1, 0x26a1],
15
+ [0x26aa, 0x26ab], [0x26bd, 0x26be], [0x26c4, 0x26c5], [0x26ce, 0x26ce], [0x26d4, 0x26d4], [0x26ea, 0x26ea],
16
+ [0x26f2, 0x26f3], [0x26f5, 0x26f5], [0x26fa, 0x26fa], [0x26fd, 0x26fd], [0x2705, 0x2705], [0x270a, 0x270b],
17
+ [0x2728, 0x2728], [0x274c, 0x274c], [0x274e, 0x274e], [0x2753, 0x2755], [0x2757, 0x2757], [0x2795, 0x2797],
18
+ [0x27b0, 0x27b0], [0x27bf, 0x27bf], [0x2b1b, 0x2b1c], [0x2b50, 0x2b50], [0x2b55, 0x2b55],
19
+ [0x2e80, 0x303e], [0x3041, 0x33ff], [0x3400, 0x4dbf], [0x4e00, 0x9fff], [0xa000, 0xa4cf], [0xa960, 0xa97f],
20
+ [0xac00, 0xd7a3], [0xf900, 0xfaff], [0xfe30, 0xfe6f], [0xff00, 0xff60], [0xffe0, 0xffe6],
21
+ [0x1f004, 0x1f004], [0x1f0cf, 0x1f0cf], [0x1f18e, 0x1f18e], [0x1f191, 0x1f19a], [0x1f1e6, 0x1f1ff], [0x1f200, 0x1f251],
22
+ [0x1f300, 0x1f320], [0x1f32d, 0x1f335], [0x1f337, 0x1f37c], [0x1f37e, 0x1f393], [0x1f3a0, 0x1f3ca], [0x1f3cf, 0x1f3d3],
23
+ [0x1f3e0, 0x1f3f0], [0x1f3f4, 0x1f3f4], [0x1f3f8, 0x1f43e], [0x1f440, 0x1f440], [0x1f442, 0x1f4fc], [0x1f4ff, 0x1f53d],
24
+ [0x1f54b, 0x1f54e], [0x1f550, 0x1f567], [0x1f57a, 0x1f57a], [0x1f595, 0x1f596], [0x1f5a4, 0x1f5a4], [0x1f5fb, 0x1f64f],
25
+ [0x1f680, 0x1f6c5], [0x1f6cc, 0x1f6cc], [0x1f6d0, 0x1f6d2], [0x1f6d5, 0x1f6d7], [0x1f6dc, 0x1f6df], [0x1f6eb, 0x1f6ec],
26
+ [0x1f6f4, 0x1f6fc], [0x1f7e0, 0x1f7eb], [0x1f7f0, 0x1f7f0], [0x1f90c, 0x1f93a], [0x1f93c, 0x1f945], [0x1f947, 0x1f9ff],
27
+ [0x1fa70, 0x1faff], [0x20000, 0x2fffd], [0x30000, 0x3fffd],
28
+ ];
29
+
30
+ function isWide(cp ) {
31
+ let lo = 0;
32
+ let hi = WIDE.length - 1;
33
+ while (lo <= hi) {
34
+ const mid = (lo + hi) >> 1;
35
+ const [a, b] = WIDE[mid] ;
36
+ if (cp < a) hi = mid - 1;
37
+ else if (cp > b) lo = mid + 1;
38
+ else return true;
39
+ }
40
+ return false;
41
+ }
42
+
43
+ const ZERO = /^[\p{M}\p{Cc}\p{Cf}]$/u;
44
+ const EMOJI_MARK = /‍|️|⃣|\p{Emoji_Modifier}/u;
45
+ const EMOJI_BASE = /\p{Extended_Pictographic}|[#*0-9]️?⃣/u;
46
+
47
+ function graphemeWidth(g ) {
48
+ if (EMOJI_MARK.test(g) && EMOJI_BASE.test(g)) return 2;
49
+ let w = 0;
50
+ for (const ch of g) {
51
+ const cw = ZERO.test(ch) ? 0 : isWide(ch.codePointAt(0) ) ? 2 : 1;
52
+ if (cw > w) w = cw;
53
+ }
54
+ return w;
55
+ }
56
+
57
+ const PLAIN = /^[\x20-\x7e]*$/;
58
+
59
+ export function displayWidth(s ) {
60
+ const t = stripAnsi(s);
61
+ if (PLAIN.test(t)) return t.length;
62
+ let w = 0;
63
+ for (const g of graphemes(t)) w += graphemeWidth(g);
64
+ return w;
65
+ }
66
+
67
+ /**
68
+ * At most `w` cells, cut at the end with `ellipsis` (callers pass `style.sym.ellipsis`, so an ASCII console gets "...").
69
+ * The ellipsis's own display width is budgeted. When even the ellipsis does not fit, as much of it as fits.
70
+ */
71
+ export function truncateEnd(s , w , ellipsis = "…") {
72
+ if (w <= 0) return "";
73
+ if (displayWidth(s) <= w) return s;
74
+ const ew = displayWidth(ellipsis);
75
+ if (ew >= w) return cutEnd(ellipsis, w);
76
+ let out = "";
77
+ let used = 0;
78
+ for (const g of graphemes(s)) {
79
+ const gw = graphemeWidth(g);
80
+ if (used + gw > w - ew) break;
81
+ out += g;
82
+ used += gw;
83
+ }
84
+ return out + ellipsis;
85
+ }
86
+
87
+ function cutEnd(s , w ) {
88
+ let out = "";
89
+ let used = 0;
90
+ for (const g of graphemes(s)) {
91
+ const gw = graphemeWidth(g);
92
+ if (used + gw > w) break;
93
+ out += g;
94
+ used += gw;
95
+ }
96
+ return out;
97
+ }
98
+
99
+ /** At most `w` cells, cut in the middle with `ellipsis` so the start and the end stay visible (paths, titles). `w <= 0` gives "". */
100
+ export function truncateMiddle(s , w , ellipsis = "…") {
101
+ if (w <= 0) return "";
102
+ if (displayWidth(s) <= w) return s;
103
+ const ew = displayWidth(ellipsis);
104
+ if (ew >= w) return cutEnd(ellipsis, w);
105
+ const keep = w - ew;
106
+ const headBudget = Math.ceil(keep / 2);
107
+ const tailBudget = keep - headBudget;
108
+ const g = graphemes(s);
109
+ let head = "";
110
+ let used = 0;
111
+ let i = 0;
112
+ for (; i < g.length; i++) {
113
+ const gw = graphemeWidth(g[i] );
114
+ if (used + gw > headBudget) break;
115
+ head += g[i];
116
+ used += gw;
117
+ }
118
+ let tail = "";
119
+ used = 0;
120
+ for (let j = g.length - 1; j >= i; j--) {
121
+ const gw = graphemeWidth(g[j] );
122
+ if (used + gw > tailBudget) break;
123
+ tail = g[j] + tail;
124
+ used += gw;
125
+ }
126
+ return head + ellipsis + tail;
127
+ }
128
+
129
+ export function padEnd(s , w ) { return s + " ".repeat(Math.max(0, w - displayWidth(s))); }
130
+ export function padStart(s , w ) { return " ".repeat(Math.max(0, w - displayWidth(s))) + s; }
131
+
132
+ /**
133
+ * Wraps plain text to `w` cells: words stay whole, a word wider than the line is broken by grapheme, `hang` spaces
134
+ * indent every continuation line, "\n" starts a new paragraph. A line is never wider than `w`, except when one
135
+ * character is itself wider than `w` (a CJK character at w = 1), which stands alone. `w < 1` is treated as 1. The same
136
+ * holds when `hang` leaves less than 2 columns of room: a single wide character (CJK, emoji) then overflows the line
137
+ * by one cell rather than being split. Callers that need a strict bound keep `hang <= w - 2`.
138
+ */
139
+ export function wrapText(s , w , o = {}) {
140
+ const width = Math.max(1, Math.floor(w) || 1);
141
+ const hang = Math.min(Math.max(0, Math.floor(o.hang ?? 0)), width - 1);
142
+ const out = [];
143
+ for (const para of s.split(/\r?\n/)) {
144
+ let line = "";
145
+ let lineW = 0;
146
+ let indent = 0; // the first line has none, continuation lines `hang`
147
+ const next = () => { out.push(line); indent = hang; line = " ".repeat(hang); lineW = hang; };
148
+ for (const word of para.split(/ +/)) {
149
+ if (word === "") continue;
150
+ const ww = displayWidth(word);
151
+ if (lineW > indent) {
152
+ if (lineW + 1 + ww <= width) { line += " " + word; lineW += 1 + ww; continue; }
153
+ next();
154
+ }
155
+ if (lineW + ww <= width) { line += word; lineW += ww; continue; }
156
+ for (const g of graphemes(word)) {
157
+ const gw = graphemeWidth(g);
158
+ if (lineW + gw > width && lineW > indent) next();
159
+ line += g;
160
+ lineW += gw;
161
+ }
162
+ }
163
+ out.push(line);
164
+ }
165
+ return out;
166
+ }
167
+
168
+ /**
169
+ * Text wrapped to `w` cells, each of its lines on its own: a short line stays as it is; a line's leading spaces are kept
170
+ * on every piece; a bullet ("- ", "• ", "* ", "1. ") hangs its continuation under its text, or `hang` columns when
171
+ * given; a word longer than the line (a long path) is broken. ANSI styling inside a word is kept.
172
+ */
173
+ export function wrapTo(text , w , o = {}) {
174
+ const width = Math.max(1, Math.floor(w) || 1);
175
+ const out = [];
176
+ for (const line of text.split("\n")) {
177
+ if (displayWidth(line) <= width) { out.push(line.trimEnd()); continue; }
178
+ const lead = /^ */.exec(line) [0].length;
179
+ const ind = lead < width - 8 ? lead : 0;
180
+ const bullet = /^(?:[-•*] |\d+\. )/.exec(line.slice(lead));
181
+ const want = o.hang ?? (bullet ? bullet[0].length : 0);
182
+ const hang = Math.min(Math.max(0, want), Math.max(0, width - ind - 2));
183
+ for (const l of wrapText(line.slice(lead), width - ind, { hang })) out.push((" ".repeat(ind) + l).trimEnd());
184
+ }
185
+ return out;
186
+ }
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "t3code-session-manager",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "Bring every Claude Code, Codex, Pi and OpenCode session into T3 Code: resumable, under the right Claude subscription, each project showing its recent history, kept in sync by a background watcher that updates itself.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "BolaLabs (https://github.com/brunobola-portfolio)",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/brunobola-portfolio/t3code-session-manager.git"
11
+ },
12
+ "homepage": "https://github.com/brunobola-portfolio/t3code-session-manager#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/brunobola-portfolio/t3code-session-manager/issues"
15
+ },
16
+ "keywords": [
17
+ "t3code",
18
+ "t3-code",
19
+ "claude-code",
20
+ "codex",
21
+ "opencode",
22
+ "pi",
23
+ "ai-agents",
24
+ "coding-agents",
25
+ "session-import",
26
+ "session-history",
27
+ "multiple-accounts",
28
+ "cli"
29
+ ],
30
+ "bin": {
31
+ "t3sm": "bin/t3sm.mjs"
32
+ },
33
+ "engines": {
34
+ "node": ">=22.18"
35
+ },
36
+ "files": [
37
+ "bin/",
38
+ "dist/",
39
+ "skills/",
40
+ "commands/",
41
+ ".claude-plugin/",
42
+ "CHANGELOG.md"
43
+ ],
44
+ "scripts": {
45
+ "test": "node --test --test-timeout=60000 \"test/**/*.test.ts\"",
46
+ "typecheck": "tsc --noEmit",
47
+ "build": "node scripts/build.js",
48
+ "prepare": "npm run build",
49
+ "assets": "node scripts/build-assets.js",
50
+ "release": "node scripts/release.js",
51
+ "release:check": "node scripts/release.js --check"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^22.20.5",
55
+ "typescript": "^5.9.3"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ }
60
+ }
@@ -0,0 +1,183 @@
1
+ ---
2
+ name: t3code-sessions
3
+ description: Use when the user wants to import, sync or merge AI coding-agent sessions (Claude Code, Codex, Pi, OpenCode) into T3 Code, bring old or terminal history into T3 Code threads, pick which Claude account or subscription a T3 Code project or thread uses, or fix T3 Code history that is missing, duplicated, stale or under the wrong account. Also when they mention t3sm or t3code-session-manager.
4
+ ---
5
+
6
+ # T3 Code sessions (t3sm)
7
+
8
+ `t3sm` brings the user's agent sessions into T3 Code as resumable threads, each under
9
+ the Claude account it was run with. It reviews before it writes, journals every change
10
+ and can undo a run. This skill runs it for the user. It never decides for them.
11
+
12
+ ## How to run t3sm
13
+
14
+ Use `t3sm` if `t3sm --version` works. Otherwise use the pinned release:
15
+
16
+ ```bash
17
+ npx -y github:brunobola-portfolio/t3code-session-manager#v0.4.0 <command>
18
+ ```
19
+
20
+ Below, `t3sm` means whichever of the two works. T3 Code must be open (exit code 3 means
21
+ it is not running: ask the user to open it from the Start menu or their desktop launcher,
22
+ never from a shell that sets `CLAUDE_CONFIG_DIR`).
23
+
24
+ **Run t3sm with `CLAUDE_CONFIG_DIR` removed.** t3sm reads every Claude account itself, so the
25
+ account folder of the conversation you are in must not reach it. Bash:
26
+ `env -u CLAUDE_CONFIG_DIR t3sm <command>`. PowerShell:
27
+ `Remove-Item Env:CLAUDE_CONFIG_DIR -ErrorAction SilentlyContinue; t3sm <command>`. A thread
28
+ in T3 Code on a second account has its own `CLAUDE_CONFIG_DIR` set, which is why this matters.
29
+
30
+ Every command takes `--lang en|pt` (the language of what it prints; default: config.json "language",
31
+ then the system's) and `--no-color`. Pass `--lang en` when you read the output yourself;
32
+ `--json` output is always English.
33
+
34
+ ## Inside T3 Code: the `/t3sm:*` commands
35
+
36
+ When this plugin is installed, T3 Code's "/" menu offers four short commands, each following
37
+ the rules below (read-only form first, then a question, then the write only after a yes):
38
+
39
+ - `/t3sm:status`: `t3sm status`, whether t3sm needs anything from the user: "All good", "Needs you (N)" with the
40
+ command for each item, or "Working". Read-only. It exits 10 when something needs the user: that is an answer, not
41
+ an error.
42
+ - `/t3sm:sync`: `t3sm sync --dry-run`, then `t3sm sync` (the unattended command: it never asks and takes no
43
+ `--yes`; run it only after the user's yes).
44
+ - `/t3sm:organize`: `t3sm organize --dry-run`, then `t3sm organize --yes` (tidies the history t3sm
45
+ imported: readable titles, archived automated chats and chats of projects t3sm created in
46
+ temporary or system folders, pinned recent projects; undo with `t3sm organize --undo <run>`).
47
+ Scope flags of `organize`: `--only <folder>`, `--no-pin <ids>`, `--no-delete`,
48
+ `--no-archive-folders` (keeps the temporary / system folder chats unarchived),
49
+ `--history <days|all|off>` and `--min <n>` (the history rule for this run only: the last
50
+ 1-3650 days, and at least 0-1000 chats per project) and `--auto-settle <1..90|off>` (changes
51
+ T3 Code's own auto-settle setting); keep the ones of the dry run when you run it with `--yes`.
52
+ - `/t3sm:import`: `t3sm plan` and `t3sm apply --dry-run`, then `t3sm apply --yes`.
53
+
54
+ For `/t3sm:sync` and `/t3sm:import`, the conversation running them is "in use", so t3sm skips
55
+ it: that conversation's own project waits for the next cycle (it is retried once the
56
+ conversation has been idle for about ten minutes). To bring that project in too, suggest
57
+ running the command from a conversation in the General project. With T3 Code closed there are
58
+ no threads, so this does not arise. `/t3sm:organize` has no such hold: it may give the running
59
+ conversation a new title or show it inside its project.
60
+ `t3sm doctor` and `t3sm status` say which Claude accounts have the plugin;
61
+ `t3sm start` offers to install it. To remove it:
62
+ `claude plugin uninstall t3sm@t3code-session-manager`.
63
+
64
+ ## The rule that matters most
65
+
66
+ These commands change files or T3 Code: `apply`, `dedupe`, `quarantine`, `merge --all`,
67
+ `merge --session <id>`, `recover <session id>`, `rollback`, `accounts --apply`, `accounts --rename`,
68
+ `accounts --init`, `schedule install`, `schedule remove`, `schedule restart`, `sync` (without `--dry-run`),
69
+ `organize`, `organize --undo`, `projects rename --suggest`, `projects set`, `projects unset`,
70
+ `doctor --repair` and `update` without `--check` or `--dry-run` (it reinstalls t3sm itself with npm;
71
+ also `update --from <folder>`, `update --source npm` and `update --source github`), and `update --auto on|off` (a preference switch in config.json, like `projects unset`: it needs no `--yes`,
72
+ but still ask first).
73
+
74
+ - Run them only after the user has said yes, in this conversation, to that exact command.
75
+ A yes to an earlier command or to a plan "in general" is not a yes to the next one.
76
+ - Your shell is not a terminal, so they need `--yes` to proceed. Add `--yes` only after
77
+ that explicit yes. `--allow-untested` only hides the untested-version warning; add it
78
+ only if the user asks.
79
+ - Before `dedupe`, `quarantine`, `recover`, `rollback`, `organize`, `organize --undo` or
80
+ `projects rename --suggest`, run the same command with `--dry-run` and show the user
81
+ what would move, change or be undone.
82
+ - `rollback --yes` needs `--run <id>` and `organize --undo --yes` needs the run id
83
+ (`organize --undo <run> --yes`): take it from `t3sm runs` or the dry run, and say which
84
+ run it is.
85
+
86
+ Read-only, safe to run without asking: `doctor`, `scan`, `plan`, `apply --dry-run`,
87
+ `accounts` (no option; emails are masked, do not add `--show-emails` unless asked), `runs`, `status` (or `status --json`), `merge` (no option) or `merge --dry-run`, `recover <session id> --dry-run`, `sync --dry-run`,
88
+ `organize --dry-run`, `organize --undo --dry-run`, `projects` (no option),
89
+ `projects rename --suggest --dry-run`, `schedule status`, `schedule install|remove|restart --dry-run`, `update --check`, `update --dry-run`, `changelog`
90
+ (or `changelog --since <version>`), `help` (or `help <topic>`: what a message means and what to do, in the user's
91
+ language), every `--help`. `update --check` and `update --dry-run` look up
92
+ the newest release online (t3sm's only network call besides installing a release with npm and the optional plugin
93
+ install through `claude plugin`); they install nothing.
94
+
95
+ ## Workflow
96
+
97
+ 1. **Check.** Run `t3sm doctor`. Report each `fail` and `warn` line with its `->` fix in
98
+ plain words. Stop on a `fail` and help fix it first. Common ones:
99
+ `instance-home-drift` (T3 Code was started from a shell with `CLAUDE_CONFIG_DIR`: close
100
+ it and open it from the Start menu), `t3-version` (a warning: this T3 Code build was not tested, t3sm proceeds),
101
+ `backups-present` (suggest `quarantine` later), `harness:pi` without a Pi instance.
102
+ 2. **Plan.** Run `t3sm plan`. It prints a summary and `Full report: <path>/plan.md`.
103
+ Read that `plan.md` and tell the user, briefly:
104
+ - the totals (import, convert, skip) and the new instances and projects;
105
+ - the **Project accounts** table: each project root, the account it will open with,
106
+ and why (`route`, `vscode-pin`, `recent-activity`, `default`). Ask whether any
107
+ project is under the wrong subscription. A wrong one is fixed with a `routes` entry
108
+ in `config.json` (docs/configuration.md), then a new `t3sm plan`;
109
+ - every line under **Warnings**, and diverged forks if any;
110
+ - the biggest skip reasons, only if they look surprising.
111
+ 3. **Clean up duplicates (optional, ask).** If the plan lists mirror copies, offer
112
+ `t3sm dedupe` (moves stale copies of a session in a second account to a reversible
113
+ quarantine). If doctor reported backup folders, offer `t3sm quarantine`. Show the
114
+ `--dry-run` first. Both need a file system with hard links.
115
+ 4. **Dry run (no need to ask).** `t3sm apply --dry-run` runs every check and prints what
116
+ apply would do, writing nothing. Summarise it.
117
+ 5. **Pilot (recommended, ask).** Offer one project first:
118
+ `t3sm apply --only <project root> --yes`. Then ask the user to open that project in
119
+ T3 Code and check the threads and the account picker.
120
+ 6. **Apply (ask).** `t3sm apply --yes`. Exit 0 is success; exit 5 means some sessions
121
+ failed (a table names each one's project, conversation, why and what to do, then the
122
+ `t3sm help <topic>` that explains it; they stay retryable). Report the run id it prints.
123
+ One progress bar covers the whole import; `--verbose` (apply and sync) also prints one
124
+ line per import wave.
125
+ 7. **Keep in sync (optional, ask).** `t3sm schedule install` (every 15 minutes) or
126
+ `t3sm schedule install --watch` (a watcher started at logon). Unattended sync never
127
+ creates instances, never moves files and imports nothing when more than 200
128
+ sessions are pending.
129
+ 8. **Terminal work.** If the user continued an imported session in a terminal, T3 Code
130
+ does not see those turns. `t3sm merge` lists them (read-only). With a yes,
131
+ `t3sm merge --session <id> --yes` or `t3sm merge --all --yes` creates a new session
132
+ file next to the original, imports it as a new thread and archives the old one.
133
+ Compacted sessions are not merged; terminal work on a side branch is listed with a
134
+ `claude --resume <id>` hint and never merged.
135
+ 9. **Undo.** `t3sm runs` lists runs. `t3sm rollback --run <id> --dry-run`, then with a
136
+ yes `t3sm rollback --run <id> --yes`. Imported threads are listed, never deleted
137
+ (`--archive-threads` archives them).
138
+
139
+ ## What t3sm does by itself
140
+
141
+ Tell the user, when it matters, what the background sync (`schedule install --watch`) does without asking, each
142
+ change journaled and undone with `t3sm rollback --run <id>`:
143
+
144
+ - imports new sessions once idle, and organizes only what it just imported;
145
+ - applies the history rule (the last 90 days shown inside each project, at least 10 per project; `organize.history`)
146
+ after an import and once a day, never moving a conversation the user changed by hand;
147
+ - brings in what the user adds, outside T3 Code, to the original of a home-folder conversation t3sm copied (a new
148
+ thread with the same title; the old one archived);
149
+ - once a day, installs a newer patch or minor t3sm release by itself and restarts into it, rolling back if the new
150
+ version does not start within 2 minutes (`update.auto`; `t3sm update --auto off` turns it off); a major release is
151
+ only announced. The release lookup is t3sm's only network call (installing then downloads the release with npm; the
152
+ optional plugin install goes through `claude plugin`). A rolled-back update is only worth knowing in `t3sm status`:
153
+ the previous version runs again, and the automatic check skips that version (`t3sm update` can still install it).
154
+
155
+ Conversations started in T3 Code are never imported again; one whose thread the user deleted comes back as a copy
156
+ only after a yes in `t3sm start` (`organize.sessions.orphaned`). When its transcript names no T3 thread, t3sm cannot
157
+ tell that the thread is gone (`t3sm status` lists it under Worth knowing): `t3sm recover <session id>` brings that one
158
+ back, after `--dry-run` and the user's yes. Say that if the thread still exists in T3 Code, this makes a duplicate.
159
+
160
+ ## Tell the user about the limits
161
+
162
+ - T3 Code shows at most 200 visible messages per imported thread; resuming still uses
163
+ the full history.
164
+ - Tool activity (commands, file edits) is not in the imported timeline, only the text.
165
+ - Imported threads show the import time as their last activity.
166
+ - A thread stays on the account its session was run with. To use the other
167
+ subscription, start a new thread in T3 Code and pick it there.
168
+ - Never keep the same session open in T3 Code and in a terminal at the same time.
169
+
170
+ ## Exit codes
171
+
172
+ `0` ok, nothing to do, declined, or another run holds the lock; `1` unexpected error; `2` usage or config error, a
173
+ write command without `--yes` on a non-terminal, a stale plan (plan again), or T3 Code's default instance reading
174
+ another account folder (`instance-home-drift`: reopen T3 Code from the Start menu); `3` T3 Code not running; `4` T3 Code
175
+ speaking another protocol (or an unexpected response shape); `5` finished, but some sessions
176
+ failed; `10` (`t3sm status` only) something needs the user, not an error. `130` interrupted (file times were restored).
177
+
178
+ More: `t3sm help` lists the help topics (a screen that shows a problem names its topic: `t3sm help not-imported`,
179
+ `t3sm help held`, ...); the project README and `docs/` (configuration, accounts, troubleshooting).
180
+
181
+ In a shell run as Administrator (Windows), `start`, `schedule` and `update` print one warning: what they install (the
182
+ schedule, the plugin, t3sm itself) is for that user only. Nothing is blocked; suggest running t3sm from the user's own
183
+ account unless that is what they want.