@primitive.ai/prim 0.1.0-alpha.127 → 0.1.0-alpha.128

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 (44) hide show
  1. package/README.md +76 -5
  2. package/dist/{chunk-NVDPKW7Z.js → chunk-3KPTVK4N.js} +3 -51
  3. package/dist/{chunk-URYZDQFH.js → chunk-4DYEBYKM.js} +3 -5
  4. package/dist/{chunk-HZI5PBN4.js → chunk-6QAXVFRJ.js} +1129 -39
  5. package/dist/{chunk-A5VTE43F.js → chunk-ANMNGGTN.js} +2 -2
  6. package/dist/{chunk-TNWI3JWK.js → chunk-B3ICJZXV.js} +4 -2
  7. package/dist/{chunk-RV3JFSMX.js → chunk-C357P37M.js} +4 -4
  8. package/dist/{chunk-KFRGVHGB.js → chunk-E57UVUJL.js} +6 -6
  9. package/dist/{chunk-MGKSZSTV.js → chunk-EQWUCFXK.js} +3 -3
  10. package/dist/{chunk-72NIZMZN.js → chunk-M6KIDB5R.js} +8 -3
  11. package/dist/{chunk-O65UVJZH.js → chunk-N6PZE7HX.js} +2 -2
  12. package/dist/{chunk-WGTUNUIS.js → chunk-NYDM4HSS.js} +5 -5
  13. package/dist/{chunk-R4EYLEIK.js → chunk-P4O7L7JZ.js} +2 -2
  14. package/dist/{chunk-UUQT5GMO.js → chunk-PRJ7P6J5.js} +1 -1
  15. package/dist/{chunk-H74RDXKP.js → chunk-PTZ6BWSU.js} +2 -2
  16. package/dist/{chunk-F3FDVHR7.js → chunk-QQ3G5SXX.js} +1 -1
  17. package/dist/{chunk-VVFVENU4.js → chunk-RDT2IV2Z.js} +6 -6
  18. package/dist/{chunk-L6IL4N6Y.js → chunk-VLT2KGPE.js} +34 -34
  19. package/dist/{chunk-H6X52UVF.js → chunk-WEGZGF3K.js} +1 -1
  20. package/dist/{chunk-C4QNBSWB.js → chunk-XINFTNA2.js} +8 -8
  21. package/dist/{chunk-JCKOW45X.js → chunk-ZCT23NBS.js} +2 -2
  22. package/dist/daemon/server.js +1311 -364
  23. package/dist/hook-runtime/daemon/server.js +1311 -364
  24. package/dist/hook-runtime/hooks/post-commit.js +395 -242
  25. package/dist/hook-runtime/hooks/post-rewrite.js +391 -238
  26. package/dist/hook-runtime/hooks/post-tool-use.js +1442 -498
  27. package/dist/hook-runtime/hooks/pre-commit.js +1293 -349
  28. package/dist/hook-runtime/hooks/pre-tool-use-worker.js +1087 -143
  29. package/dist/hook-runtime/hooks/prim-hook.js +1457 -513
  30. package/dist/hook-runtime/hooks/session-end.js +369 -216
  31. package/dist/hook-runtime/hooks/session-start.js +1209 -219
  32. package/dist/hook-runtime/index.js +2406 -1036
  33. package/dist/hook-runtime/statusline-main.js +360 -207
  34. package/dist/hooks/post-commit.js +7 -7
  35. package/dist/hooks/post-rewrite.js +6 -6
  36. package/dist/hooks/post-tool-use.js +18 -18
  37. package/dist/hooks/pre-commit.js +4 -4
  38. package/dist/hooks/pre-tool-use-worker.js +9 -9
  39. package/dist/hooks/prim-hook.js +16 -16
  40. package/dist/hooks/session-end.js +4 -4
  41. package/dist/hooks/session-start.js +63 -20
  42. package/dist/index.js +387 -43
  43. package/dist/statusline-main.js +360 -207
  44. package/package.json +1 -1
@@ -1,32 +1,32 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  recordPostCommitFired
4
- } from "../chunk-F3FDVHR7.js";
4
+ } from "../chunk-QQ3G5SXX.js";
5
5
  import {
6
6
  unattendedEnv
7
7
  } from "../chunk-OYHYCK4K.js";
8
8
  import {
9
9
  commitAttributionFromEnvironment,
10
10
  toCommitMove
11
- } from "../chunk-JCKOW45X.js";
11
+ } from "../chunk-ZCT23NBS.js";
12
12
  import {
13
13
  getOrCreateWorkspaceId
14
14
  } from "../chunk-EZXEWFDG.js";
15
15
  import {
16
16
  appendMove,
17
17
  resolveOrg
18
- } from "../chunk-O65UVJZH.js";
19
- import "../chunk-R4EYLEIK.js";
18
+ } from "../chunk-N6PZE7HX.js";
19
+ import "../chunk-P4O7L7JZ.js";
20
20
  import {
21
21
  cachedCollectScopeAdmits
22
- } from "../chunk-WGTUNUIS.js";
23
- import "../chunk-NVDPKW7Z.js";
22
+ } from "../chunk-NYDM4HSS.js";
23
+ import "../chunk-3KPTVK4N.js";
24
24
  import {
25
25
  githubRepositoryFullName,
26
26
  isRepoActiveForCapture,
27
27
  repoSyncId,
28
28
  resolveRepositoryContext
29
- } from "../chunk-HZI5PBN4.js";
29
+ } from "../chunk-6QAXVFRJ.js";
30
30
  import "../chunk-JSBRDJBE.js";
31
31
 
32
32
  // src/hooks/post-commit.ts
@@ -5,25 +5,25 @@ import {
5
5
  import {
6
6
  canonicalRewritePairs,
7
7
  toRewriteMove
8
- } from "../chunk-JCKOW45X.js";
8
+ } from "../chunk-ZCT23NBS.js";
9
9
  import {
10
10
  getOrCreateWorkspaceId
11
11
  } from "../chunk-EZXEWFDG.js";
12
12
  import {
13
13
  appendMove,
14
14
  resolveOrg
15
- } from "../chunk-O65UVJZH.js";
16
- import "../chunk-R4EYLEIK.js";
15
+ } from "../chunk-N6PZE7HX.js";
16
+ import "../chunk-P4O7L7JZ.js";
17
17
  import {
18
18
  cachedCollectScopeAdmits
19
- } from "../chunk-WGTUNUIS.js";
20
- import "../chunk-NVDPKW7Z.js";
19
+ } from "../chunk-NYDM4HSS.js";
20
+ import "../chunk-3KPTVK4N.js";
21
21
  import {
22
22
  githubRepositoryFullName,
23
23
  isRepoActiveForCapture,
24
24
  repoSyncId,
25
25
  resolveRepositoryContext
26
- } from "../chunk-HZI5PBN4.js";
26
+ } from "../chunk-6QAXVFRJ.js";
27
27
  import "../chunk-JSBRDJBE.js";
28
28
 
29
29
  // src/hooks/post-rewrite.ts
@@ -4,58 +4,58 @@ import {
4
4
  buildOrganizationBoundMoveRequest,
5
5
  parseOrganizationBinding,
6
6
  requireDurableIngestAcknowledgement
7
- } from "../chunk-L6IL4N6Y.js";
7
+ } from "../chunk-VLT2KGPE.js";
8
8
  import {
9
9
  enrichHookPayloadWithFileRefs,
10
10
  preserveHookFileMetadata
11
- } from "../chunk-RV3JFSMX.js";
11
+ } from "../chunk-C357P37M.js";
12
12
  import {
13
13
  appendCodexContext,
14
14
  prepareCodexContext
15
- } from "../chunk-KFRGVHGB.js";
16
- import "../chunk-URYZDQFH.js";
15
+ } from "../chunk-E57UVUJL.js";
16
+ import "../chunk-4DYEBYKM.js";
17
17
  import {
18
18
  postToolInvocationId,
19
19
  toMove,
20
20
  toolOutcomeFor
21
- } from "../chunk-JCKOW45X.js";
21
+ } from "../chunk-ZCT23NBS.js";
22
22
  import {
23
23
  getOrCreateWorkspaceId
24
24
  } from "../chunk-EZXEWFDG.js";
25
25
  import {
26
26
  appendMove,
27
27
  resolveOrg
28
- } from "../chunk-O65UVJZH.js";
29
- import "../chunk-H6X52UVF.js";
28
+ } from "../chunk-N6PZE7HX.js";
29
+ import "../chunk-WEGZGF3K.js";
30
30
  import {
31
31
  observeDemoInvocation
32
- } from "../chunk-A5VTE43F.js";
32
+ } from "../chunk-ANMNGGTN.js";
33
33
  import {
34
34
  normalizeEnvelope,
35
35
  readHookStdin,
36
36
  shouldSuppressImportedCursorHandler
37
- } from "../chunk-H74RDXKP.js";
38
- import "../chunk-MGKSZSTV.js";
39
- import "../chunk-UUQT5GMO.js";
37
+ } from "../chunk-PTZ6BWSU.js";
38
+ import "../chunk-EQWUCFXK.js";
39
+ import "../chunk-PRJ7P6J5.js";
40
40
  import {
41
41
  scrubFromCwd
42
- } from "../chunk-R4EYLEIK.js";
42
+ } from "../chunk-P4O7L7JZ.js";
43
43
  import {
44
44
  bold,
45
45
  cachedCollectScopeAdmits,
46
46
  color
47
- } from "../chunk-WGTUNUIS.js";
47
+ } from "../chunk-NYDM4HSS.js";
48
48
  import {
49
49
  getClient,
50
- getPinnedClient,
51
- terminalSafeLine
52
- } from "../chunk-NVDPKW7Z.js";
50
+ getPinnedClient
51
+ } from "../chunk-3KPTVK4N.js";
53
52
  import {
54
53
  currentBranch,
55
54
  isRepoActiveForCapture,
56
55
  repoSyncId,
57
- resolveRepositoryContext
58
- } from "../chunk-HZI5PBN4.js";
56
+ resolveRepositoryContext,
57
+ terminalSafeLine
58
+ } from "../chunk-6QAXVFRJ.js";
59
59
  import {
60
60
  parseAgent
61
61
  } from "../chunk-KZB4ABIB.js";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  checkAffectedDecisions,
4
4
  formatDecisionsWarning
5
- } from "../chunk-VVFVENU4.js";
6
- import "../chunk-H6X52UVF.js";
7
- import "../chunk-NVDPKW7Z.js";
8
- import "../chunk-HZI5PBN4.js";
5
+ } from "../chunk-RDT2IV2Z.js";
6
+ import "../chunk-WEGZGF3K.js";
7
+ import "../chunk-3KPTVK4N.js";
8
+ import "../chunk-6QAXVFRJ.js";
9
9
  import "../chunk-JSBRDJBE.js";
10
10
 
11
11
  // src/hooks/pre-commit.ts
@@ -15,15 +15,15 @@ import {
15
15
  toolInputDigest,
16
16
  unverifiedResult,
17
17
  waitForPreflight
18
- } from "../chunk-C4QNBSWB.js";
18
+ } from "../chunk-XINFTNA2.js";
19
19
  import {
20
20
  observeDemoInvocation
21
- } from "../chunk-A5VTE43F.js";
21
+ } from "../chunk-ANMNGGTN.js";
22
22
  import {
23
23
  normalizeEnvelope,
24
24
  readHookStdin,
25
25
  shouldSuppressImportedCursorHandler
26
- } from "../chunk-H74RDXKP.js";
26
+ } from "../chunk-PTZ6BWSU.js";
27
27
  import {
28
28
  buildCodexOutput,
29
29
  buildCursorOutput,
@@ -35,13 +35,13 @@ import {
35
35
  failOpenHermes,
36
36
  failOpenOutput,
37
37
  readHookMode
38
- } from "../chunk-MGKSZSTV.js";
39
- import "../chunk-UUQT5GMO.js";
40
- import "../chunk-R4EYLEIK.js";
38
+ } from "../chunk-EQWUCFXK.js";
39
+ import "../chunk-PRJ7P6J5.js";
40
+ import "../chunk-P4O7L7JZ.js";
41
41
  import {
42
42
  cachedCollectScopeAdmits
43
- } from "../chunk-WGTUNUIS.js";
44
- import "../chunk-NVDPKW7Z.js";
43
+ } from "../chunk-NYDM4HSS.js";
44
+ import "../chunk-3KPTVK4N.js";
45
45
  import {
46
46
  canonicalGitRoot,
47
47
  cloudSetupPointer,
@@ -50,7 +50,7 @@ import {
50
50
  packageVersion,
51
51
  repoActiveFlag,
52
52
  repoSyncId
53
- } from "../chunk-HZI5PBN4.js";
53
+ } from "../chunk-6QAXVFRJ.js";
54
54
  import {
55
55
  parseAgent
56
56
  } from "../chunk-KZB4ABIB.js";
@@ -8,58 +8,58 @@ import {
8
8
  acknowledgeDecisionFeedback,
9
9
  leaseDecisionFeedback,
10
10
  renderFeedback
11
- } from "../chunk-TNWI3JWK.js";
11
+ } from "../chunk-B3ICJZXV.js";
12
12
  import {
13
13
  recordConversationCaptured
14
- } from "../chunk-F3FDVHR7.js";
14
+ } from "../chunk-QQ3G5SXX.js";
15
15
  import {
16
16
  unattendedEnv
17
17
  } from "../chunk-OYHYCK4K.js";
18
18
  import {
19
19
  enrichHookPayloadWithFileRefs,
20
20
  preserveHookFileMetadata
21
- } from "../chunk-RV3JFSMX.js";
21
+ } from "../chunk-C357P37M.js";
22
22
  import {
23
23
  prepareCodexContext
24
- } from "../chunk-KFRGVHGB.js";
25
- import "../chunk-URYZDQFH.js";
24
+ } from "../chunk-E57UVUJL.js";
25
+ import "../chunk-4DYEBYKM.js";
26
26
  import {
27
27
  postToolInvocationId,
28
28
  shouldFlushAfter,
29
29
  toMove
30
- } from "../chunk-JCKOW45X.js";
30
+ } from "../chunk-ZCT23NBS.js";
31
31
  import {
32
32
  getOrCreateWorkspaceId
33
33
  } from "../chunk-EZXEWFDG.js";
34
34
  import {
35
35
  appendMove,
36
36
  resolveOrg
37
- } from "../chunk-O65UVJZH.js";
38
- import "../chunk-H6X52UVF.js";
37
+ } from "../chunk-N6PZE7HX.js";
38
+ import "../chunk-WEGZGF3K.js";
39
39
  import {
40
40
  observeDemoInvocation
41
- } from "../chunk-A5VTE43F.js";
41
+ } from "../chunk-ANMNGGTN.js";
42
42
  import {
43
43
  normalizeEnvelope,
44
44
  readHookStdin,
45
45
  shouldSuppressImportedCursorHandler
46
- } from "../chunk-H74RDXKP.js";
47
- import "../chunk-MGKSZSTV.js";
48
- import "../chunk-UUQT5GMO.js";
46
+ } from "../chunk-PTZ6BWSU.js";
47
+ import "../chunk-EQWUCFXK.js";
48
+ import "../chunk-PRJ7P6J5.js";
49
49
  import {
50
50
  scrubFromCwd,
51
51
  writeHookDebug
52
- } from "../chunk-R4EYLEIK.js";
52
+ } from "../chunk-P4O7L7JZ.js";
53
53
  import {
54
54
  cachedCollectScopeAdmits
55
- } from "../chunk-WGTUNUIS.js";
56
- import "../chunk-NVDPKW7Z.js";
55
+ } from "../chunk-NYDM4HSS.js";
56
+ import "../chunk-3KPTVK4N.js";
57
57
  import {
58
58
  currentBranch,
59
59
  isRepoActiveForCapture,
60
60
  repoSyncId,
61
61
  resolveRepositoryContext
62
- } from "../chunk-HZI5PBN4.js";
62
+ } from "../chunk-6QAXVFRJ.js";
63
63
  import {
64
64
  parseAgent
65
65
  } from "../chunk-KZB4ABIB.js";
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  daemonRequest
4
- } from "../chunk-H6X52UVF.js";
4
+ } from "../chunk-WEGZGF3K.js";
5
5
  import {
6
6
  normalizeEnvelope,
7
7
  readHookStdin,
8
8
  shouldSuppressImportedCursorHandler
9
- } from "../chunk-H74RDXKP.js";
10
- import "../chunk-UUQT5GMO.js";
9
+ } from "../chunk-PTZ6BWSU.js";
10
+ import "../chunk-PRJ7P6J5.js";
11
11
  import {
12
12
  isRepoActiveForCapture
13
- } from "../chunk-HZI5PBN4.js";
13
+ } from "../chunk-6QAXVFRJ.js";
14
14
  import {
15
15
  parseAgent
16
16
  } from "../chunk-KZB4ABIB.js";
@@ -8,7 +8,7 @@ import {
8
8
  kickDaemonEnsure,
9
9
  refreshClaudePlugins,
10
10
  warmBinCache
11
- } from "../chunk-72NIZMZN.js";
11
+ } from "../chunk-M6KIDB5R.js";
12
12
  import {
13
13
  buildHookOutput,
14
14
  handoffHookOutput
@@ -18,60 +18,71 @@ import {
18
18
  acknowledgeDecisionFeedback,
19
19
  leaseDecisionFeedback,
20
20
  renderFeedback
21
- } from "../chunk-TNWI3JWK.js";
21
+ } from "../chunk-B3ICJZXV.js";
22
22
  import {
23
23
  clearHooksWired,
24
24
  recordHooksWired
25
- } from "../chunk-F3FDVHR7.js";
25
+ } from "../chunk-QQ3G5SXX.js";
26
26
  import "../chunk-OYHYCK4K.js";
27
27
  import {
28
28
  prepareCodexContext
29
- } from "../chunk-KFRGVHGB.js";
30
- import "../chunk-URYZDQFH.js";
29
+ } from "../chunk-E57UVUJL.js";
30
+ import "../chunk-4DYEBYKM.js";
31
31
  import {
32
32
  getOrCreateWorkspaceId
33
33
  } from "../chunk-EZXEWFDG.js";
34
34
  import {
35
35
  daemonRequest
36
- } from "../chunk-H6X52UVF.js";
36
+ } from "../chunk-WEGZGF3K.js";
37
37
  import {
38
38
  normalizeEnvelope,
39
39
  readHookStdin,
40
40
  shouldSuppressImportedCursorHandler
41
- } from "../chunk-H74RDXKP.js";
41
+ } from "../chunk-PTZ6BWSU.js";
42
42
  import {
43
43
  MANAGED_GIT_HOOK_NAMES
44
- } from "../chunk-UUQT5GMO.js";
44
+ } from "../chunk-PRJ7P6J5.js";
45
45
  import {
46
46
  fetchAndCacheCollectScope
47
- } from "../chunk-WGTUNUIS.js";
47
+ } from "../chunk-NYDM4HSS.js";
48
48
  import {
49
49
  getSiteUrl,
50
50
  isSessionEnded
51
- } from "../chunk-NVDPKW7Z.js";
51
+ } from "../chunk-3KPTVK4N.js";
52
52
  import {
53
53
  CLOUD_CREDENTIALS_REMEDY,
54
- CLOUD_REJECTED_CREDENTIALS_REMEDY,
54
+ CLOUD_REJECTED_CREDENTIALS_NOTICE,
55
+ ENVIRONMENT_CREDENTIAL_REMEDY,
56
+ ensureSessionIdentity,
55
57
  gitToplevel,
56
58
  hasMachineConfiguration,
57
59
  isClaudeCloudSession,
58
60
  isRepoActiveForCapture,
59
61
  markActivationImplicit,
60
62
  repoActiveFlag,
63
+ sessionIdentityMessage,
64
+ sessionIdentityMode,
61
65
  setRepoActive,
62
66
  withdrawImplicitActivation
63
- } from "../chunk-HZI5PBN4.js";
67
+ } from "../chunk-6QAXVFRJ.js";
64
68
  import {
65
69
  parseAgent
66
70
  } from "../chunk-KZB4ABIB.js";
67
71
  import "../chunk-JSBRDJBE.js";
68
72
 
69
73
  // src/hooks/reauth-notice.ts
74
+ function sharedEnvironment() {
75
+ try {
76
+ return sessionIdentityMode();
77
+ } catch {
78
+ return false;
79
+ }
80
+ }
70
81
  var REAUTH_NOTICE = "[prim] authentication ended \u2014 run `prim auth login` to resume decision capture";
71
82
  function reauthNoticeFields(agent) {
72
83
  if (agent === "claude_code") {
73
84
  if (isClaudeCloudSession()) {
74
- const notice = `Primitive is not connected in this Claude Code cloud session: ${hasMachineConfiguration() ? `its credentials were rejected. To fix it, ${CLOUD_REJECTED_CREDENTIALS_REMEDY}` : `its sign-in ended. To fix it, ${CLOUD_CREDENTIALS_REMEDY}`}.`;
85
+ const notice = !hasMachineConfiguration() ? `Primitive is not connected in this Claude Code cloud session: its sign-in ended. To fix it, ${CLOUD_CREDENTIALS_REMEDY}.` : sharedEnvironment() ? `Primitive is not connected in this Claude Code cloud session: its environment credential was rejected. To fix it, ${ENVIRONMENT_CREDENTIAL_REMEDY}.` : CLOUD_REJECTED_CREDENTIALS_NOTICE;
75
86
  return {
76
87
  systemMessage: notice,
77
88
  additionalContext: `${notice} Tell the user this in one sentence before starting their task.`
@@ -88,6 +99,18 @@ function reauthNoticeFields(agent) {
88
99
  var DAEMON_TIMEOUT_MS = 250;
89
100
  var REPOSITORY_BIND_TIMEOUT_MS = 1e3;
90
101
  var CLOUD_REPOSITORY_BIND_TIMEOUT_MS = 1e4;
102
+ var SESSION_IDENTITY_TIMEOUT_MS = 35e3;
103
+ function sessionIdentityNotice(outcome) {
104
+ if (!outcome || outcome.status === "ok") return void 0;
105
+ const notice = `${sessionIdentityMessage(outcome)} Until then, nothing this session captures is sent to Primitive.`;
106
+ return outcome.status === "link_required" ? {
107
+ notice,
108
+ instruction: `${notice} Before starting their task, tell the user this in one sentence. When they agree, run \`prim auth link\` as a background command (it waits until they finish signing in), and give them the sign-in URL and code it prints as soon as they appear.`
109
+ } : {
110
+ notice,
111
+ instruction: `${notice} Tell the user this in one sentence before starting their task.`
112
+ };
113
+ }
91
114
  var PRIM_TRIGGER = "When this task chooses between plausible approaches or establishes or changes a lasting goal, priority, constraint, invariant, default, commitment, tradeoff, exception, or shared instruction";
92
115
  var PRIM_EXCLUSIONS = "Never invoke `prim` for routine implementation that merely follows an existing decision made before this task or for temporary tactics; they never qualify, including for evaluation.";
93
116
  function primReminder(action, rationaleAction) {
@@ -140,9 +163,9 @@ async function activeProjectRoot(cwd) {
140
163
  } catch {
141
164
  }
142
165
  return { root, binding };
143
- } catch {
166
+ } catch (error) {
167
+ return { root, bindFailure: error };
144
168
  }
145
- return { root };
146
169
  } catch {
147
170
  return null;
148
171
  }
@@ -189,11 +212,31 @@ async function processSessionStart(raw, agent, feedbackSignal) {
189
212
  let active = false;
190
213
  let skillState = { installed: 0, refreshed: 0 };
191
214
  let claudeBinding;
215
+ let bindFailure;
216
+ let identityNotice;
192
217
  if (agent === "claude_code") {
218
+ let identityMode = false;
219
+ try {
220
+ identityMode = sessionIdentityMode();
221
+ } catch {
222
+ }
223
+ if (identityMode) {
224
+ try {
225
+ identityNotice = sessionIdentityNotice(
226
+ await ensureSessionIdentity({
227
+ cwd,
228
+ explicit: true,
229
+ signal: AbortSignal.timeout(SESSION_IDENTITY_TIMEOUT_MS)
230
+ })
231
+ );
232
+ } catch {
233
+ }
234
+ }
193
235
  const activeProject = await activeProjectRoot(cwd);
194
236
  projectRoot = activeProject?.root ?? null;
195
237
  active = projectRoot !== null;
196
238
  claudeBinding = activeProject?.binding;
239
+ bindFailure = activeProject?.bindFailure;
197
240
  try {
198
241
  skillState = await refreshClaudePlugins(
199
242
  cwd,
@@ -202,7 +245,7 @@ async function processSessionStart(raw, agent, feedbackSignal) {
202
245
  } catch {
203
246
  }
204
247
  }
205
- if (isSessionEnded() && agent !== "codex" && agent !== "cursor") {
248
+ if (isSessionEnded() && agent !== "codex" && agent !== "cursor" && !identityNotice) {
206
249
  const notice = reauthNoticeFields(agent);
207
250
  if (notice) {
208
251
  return {
@@ -265,15 +308,15 @@ async function processSessionStart(raw, agent, feedbackSignal) {
265
308
  };
266
309
  }
267
310
  if (agent === "claude_code") {
268
- let cloudNotice;
269
- if (active && !claudeBinding && isClaudeCloudSession()) {
311
+ let cloudNotice = identityNotice?.notice;
312
+ if (active && !claudeBinding && isClaudeCloudSession() && !identityNotice) {
270
313
  try {
271
- cloudNotice = await diagnoseCloudSession({ cwd: projectRoot ?? cwd });
314
+ cloudNotice = await diagnoseCloudSession({ cwd: projectRoot ?? cwd, bindFailure });
272
315
  } catch {
273
316
  }
274
317
  }
275
318
  const additionalContext = [
276
- cloudNotice ? `${cloudNotice} Tell the user this in one sentence before starting their task.` : void 0,
319
+ identityNotice ? identityNotice.instruction : cloudNotice ? `${cloudNotice} Tell the user this in one sentence before starting their task.` : void 0,
277
320
  claudeBinding ? claudeBindingReminder(claudeBinding, isClaudeCloudSession()) : void 0,
278
321
  active && skillState.installed > 0 ? PRIM_SKILL_REMINDER : void 0
279
322
  ].filter((value) => value !== void 0).join("\n\n");