@cortex-agent/server 2026.6.18 → 2026.6.24

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 (153) hide show
  1. package/defaults/CORTEX.md +5 -0
  2. package/defaults/config/thread-templates.json +12 -6
  3. package/defaults/context/user/CORTEX.md +2 -2
  4. package/defaults/hooks/ask-user-question-hook.mjs +7 -1
  5. package/defaults/hooks/exit-plan-mode-hook.mjs +7 -1
  6. package/defaults/hooks/memory-ref-tracker.mjs +1 -0
  7. package/defaults/hooks/new-session-hook.mjs +1 -0
  8. package/defaults/hooks/post-task-hook.mjs +1 -0
  9. package/defaults/hooks/rules-loader.mjs +1 -0
  10. package/defaults/hooks/sensitive-file-edit.mjs +1 -0
  11. package/defaults/hooks/session-activity-tracker.mjs +1 -0
  12. package/defaults/hooks/task-status-check.mjs +1 -0
  13. package/defaults/hooks/tasks-yaml-guard.mjs +1 -0
  14. package/defaults/plugins/cortex-feishu/.claude-plugin/plugin.json +5 -0
  15. package/defaults/plugins/cortex-feishu/skills/feishu-doc/SKILL.md +163 -0
  16. package/defaults/plugins/cortex-feishu/skills/feishu-doc/scripts/ensure-lark-cli.sh +53 -0
  17. package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +7 -0
  18. package/defaults/prompts/directives/coder-reviewer.md +6 -6
  19. package/defaults/prompts/directives/coder.md +14 -15
  20. package/defaults/prompts/systemPrompts/coder.md +6 -1
  21. package/defaults/prompts/systemPrompts/direct.md +5 -0
  22. package/defaults/prompts/systemPrompts/web-opus-4-6.md +6 -1
  23. package/defaults/prompts/systemPrompts/web-sonnet-4-6.md +6 -1
  24. package/defaults/prompts/systemPrompts/web.md +6 -1
  25. package/defaults/prompts/systemPrompts/worker.md +6 -1
  26. package/dist/agent-adapter/claude/adapter-tui.d.ts +12 -0
  27. package/dist/agent-adapter/claude/adapter-tui.js +15 -0
  28. package/dist/agent-adapter/claude/adapter.d.ts +110 -1
  29. package/dist/agent-adapter/claude/adapter.js +123 -2
  30. package/dist/agent-adapter/claude/bg-task-tracker.d.ts +45 -0
  31. package/dist/agent-adapter/claude/bg-task-tracker.js +91 -0
  32. package/dist/agent-adapter/normalize/event-types.d.ts +4 -0
  33. package/dist/agent-adapter/pi/event-parser.d.ts +3 -1
  34. package/dist/agent-adapter/pi/event-parser.js +12 -2
  35. package/dist/agent-adapter/types.d.ts +19 -0
  36. package/dist/core/auth.d.ts +36 -0
  37. package/dist/core/auth.js +85 -0
  38. package/dist/core/gateway-generator.js +10 -1
  39. package/dist/core/locales/en.d.ts +12 -0
  40. package/dist/core/locales/slices/interactions.d.ts +6 -0
  41. package/dist/core/locales/slices/interactions.js +14 -0
  42. package/dist/core/locales/slices/status.d.ts +6 -0
  43. package/dist/core/locales/slices/status.js +16 -0
  44. package/dist/core/status-format.d.ts +14 -0
  45. package/dist/core/status-format.js +23 -1
  46. package/dist/core/types/agent-types.d.ts +5 -0
  47. package/dist/core/types/thread-types.d.ts +15 -1
  48. package/dist/core/version.d.ts +3 -0
  49. package/dist/core/version.js +4 -1
  50. package/dist/domain/agents/facade.d.ts +13 -0
  51. package/dist/domain/agents/facade.js +36 -1
  52. package/dist/domain/costs/rate-limit-throttle.d.ts +1 -1
  53. package/dist/domain/costs/rate-limit-throttle.js +23 -2
  54. package/dist/domain/costs/resume-registry.d.ts +30 -0
  55. package/dist/domain/costs/resume-registry.js +68 -0
  56. package/dist/domain/mcp/core-server.js +5 -0
  57. package/dist/domain/mcp/feishu/index.js +5 -51
  58. package/dist/domain/mcp/feishu-server.js +3 -2
  59. package/dist/domain/mcp/tools/manager-qa.d.ts +2 -0
  60. package/dist/domain/mcp/tools/manager-qa.js +72 -0
  61. package/dist/domain/mcp/tools/task-ops.js +4 -2
  62. package/dist/domain/mcp/tools/thread-ops.js +2 -1
  63. package/dist/domain/mcp/tui-server.js +2 -1
  64. package/dist/domain/memory/user-context.d.ts +6 -5
  65. package/dist/domain/memory/user-context.js +12 -7
  66. package/dist/domain/remote/client-bootstrap.js +14 -2
  67. package/dist/domain/remote/client-hot-reload.d.ts +9 -2
  68. package/dist/domain/remote/client-hot-reload.js +77 -6
  69. package/dist/domain/remote/client-manager.d.ts +1 -1
  70. package/dist/domain/remote/client-manager.js +31 -5
  71. package/dist/domain/remote/cortex-client-config.d.ts +32 -0
  72. package/dist/domain/remote/cortex-client-config.js +49 -0
  73. package/dist/domain/remote/cortex-client.js +11 -7
  74. package/dist/domain/scheduling/jobs/scheduled-task.js +17 -1
  75. package/dist/domain/scheduling/jobs/task-dispatch.js +22 -0
  76. package/dist/domain/sessions/session-hooks.d.ts +31 -1
  77. package/dist/domain/sessions/session-hooks.js +69 -17
  78. package/dist/domain/system/doctor.d.ts +63 -0
  79. package/dist/domain/system/doctor.js +362 -0
  80. package/dist/domain/tasks/dispatcher.js +8 -0
  81. package/dist/domain/tasks/system/cortex-run.js +4 -2
  82. package/dist/domain/tasks/system/task-cli.js +7 -4
  83. package/dist/domain/tasks/system/task-state.d.ts +10 -1
  84. package/dist/domain/tasks/system/task-state.js +31 -1
  85. package/dist/domain/threads/prompt-builder.d.ts +7 -4
  86. package/dist/domain/threads/prompt-builder.js +9 -8
  87. package/dist/domain/threads/runner.d.ts +8 -1
  88. package/dist/domain/threads/runner.js +111 -18
  89. package/dist/domain/threads/state-machine.d.ts +5 -0
  90. package/dist/domain/threads/state-machine.js +16 -0
  91. package/dist/entry/app.js +44 -5
  92. package/dist/entry/cli.js +10 -0
  93. package/dist/entry/doctor-cli.d.ts +12 -0
  94. package/dist/entry/doctor-cli.js +76 -0
  95. package/dist/entry/init.js +6 -0
  96. package/dist/hooks/ask-user-question-hook.mjs +7 -1
  97. package/dist/hooks/exit-plan-mode-hook.mjs +7 -1
  98. package/dist/hooks/memory-ref-tracker.mjs +1 -0
  99. package/dist/hooks/new-session-hook.mjs +1 -0
  100. package/dist/hooks/post-task-hook.mjs +1 -0
  101. package/dist/hooks/rules-loader.mjs +1 -0
  102. package/dist/hooks/sensitive-file-edit.mjs +1 -0
  103. package/dist/hooks/session-activity-tracker.mjs +1 -0
  104. package/dist/hooks/task-status-check.mjs +1 -0
  105. package/dist/hooks/tasks-yaml-guard.mjs +1 -0
  106. package/dist/orchestration/agent-runner.js +30 -4
  107. package/dist/orchestration/bg-continuation.d.ts +26 -0
  108. package/dist/orchestration/bg-continuation.js +34 -0
  109. package/dist/orchestration/conversation-runner.d.ts +3 -0
  110. package/dist/orchestration/conversation-runner.js +5 -2
  111. package/dist/orchestration/interactions/interaction-handlers.js +13 -2
  112. package/dist/orchestration/lifecycle.d.ts +5 -2
  113. package/dist/orchestration/lifecycle.js +87 -3
  114. package/dist/orchestration/manager-qa.d.ts +56 -0
  115. package/dist/orchestration/manager-qa.js +223 -0
  116. package/dist/orchestration/resume-dispatcher.d.ts +27 -0
  117. package/dist/orchestration/resume-dispatcher.js +145 -0
  118. package/dist/orchestration/routing/webhook.d.ts +1 -1
  119. package/dist/orchestration/routing/webhook.js +75 -14
  120. package/dist/orchestration/status-helpers.d.ts +3 -0
  121. package/dist/orchestration/status-helpers.js +16 -0
  122. package/dist/orchestration/thread-callback.d.ts +17 -1
  123. package/dist/orchestration/thread-callback.js +57 -36
  124. package/dist/orchestration/turn-notify.d.ts +26 -0
  125. package/dist/orchestration/turn-notify.js +66 -0
  126. package/dist/platform/adapters/feishu.d.ts +16 -0
  127. package/dist/platform/adapters/feishu.js +67 -6
  128. package/dist/store/plugin-sync.d.ts +21 -0
  129. package/dist/store/plugin-sync.js +119 -0
  130. package/dist/store/schedule-repo.d.ts +6 -0
  131. package/dist/store/schedule-repo.js +11 -1
  132. package/dist/store/thread-repo.js +14 -0
  133. package/dist/store/version-migrations.d.ts +23 -4
  134. package/dist/store/version-migrations.js +167 -9
  135. package/dist/tui/App.js +11 -7
  136. package/dist/tui/components/Dashboard.js +26 -11
  137. package/dist/tui/components/InputBox.js +43 -4
  138. package/dist/tui/components/SidePanel.js +1 -1
  139. package/package.json +1 -1
  140. package/dist/domain/mcp/feishu/bitable.d.ts +0 -3
  141. package/dist/domain/mcp/feishu/bitable.js +0 -168
  142. package/dist/domain/mcp/feishu/blocks-to-text.d.ts +0 -19
  143. package/dist/domain/mcp/feishu/blocks-to-text.js +0 -43
  144. package/dist/domain/mcp/feishu/docx.d.ts +0 -3
  145. package/dist/domain/mcp/feishu/docx.js +0 -163
  146. package/dist/domain/mcp/feishu/drive.d.ts +0 -23
  147. package/dist/domain/mcp/feishu/drive.js +0 -66
  148. package/dist/domain/mcp/feishu/markdown-to-blocks.d.ts +0 -40
  149. package/dist/domain/mcp/feishu/markdown-to-blocks.js +0 -191
  150. package/dist/domain/mcp/feishu/sheets.d.ts +0 -3
  151. package/dist/domain/mcp/feishu/sheets.js +0 -119
  152. package/dist/domain/mcp/feishu/wiki.d.ts +0 -3
  153. package/dist/domain/mcp/feishu/wiki.js +0 -77
@@ -13,3 +13,8 @@ This is your Cortex data directory. Cortex is an autonomous agent system for lon
13
13
  ## Usage
14
14
 
15
15
  Run `cortex start` to launch the server, or `cortex daemon` for daemon mode.
16
+
17
+ <!-- cortex:docs v1 -->
18
+ # Cortex documentation
19
+ For how to use Cortex — tasks, threads, scheduling, memory, skills, safety & approvals — consult the docs: https://fangxm233.github.io/cortex-agent/
20
+ <!-- /cortex:docs -->
@@ -12,7 +12,8 @@
12
12
  "plugins/cortex-common",
13
13
  "plugins/cortex-stage-gate",
14
14
  "plugins/cortex-coder",
15
- "plugins/cortex-system"
15
+ "plugins/cortex-system",
16
+ "plugins/cortex-feishu"
16
17
  ]
17
18
  },
18
19
  "direct": {
@@ -27,7 +28,8 @@
27
28
  "plugins/cortex-common",
28
29
  "plugins/cortex-stage-gate",
29
30
  "plugins/cortex-coder",
30
- "plugins/cortex-system"
31
+ "plugins/cortex-system",
32
+ "plugins/cortex-feishu"
31
33
  ]
32
34
  },
33
35
  "direct-web": {
@@ -42,7 +44,8 @@
42
44
  "plugins/cortex-common",
43
45
  "plugins/cortex-stage-gate",
44
46
  "plugins/cortex-coder",
45
- "plugins/cortex-system"
47
+ "plugins/cortex-system",
48
+ "plugins/cortex-feishu"
46
49
  ]
47
50
  },
48
51
  "direct-review": {
@@ -58,7 +61,8 @@
58
61
  "plugins/cortex-common",
59
62
  "plugins/cortex-stage-gate",
60
63
  "plugins/cortex-coder",
61
- "plugins/cortex-system"
64
+ "plugins/cortex-system",
65
+ "plugins/cortex-feishu"
62
66
  ]
63
67
  },
64
68
  "scheduler-main": {
@@ -73,7 +77,8 @@
73
77
  "plugins/cortex-common",
74
78
  "plugins/cortex-stage-gate",
75
79
  "plugins/cortex-coder",
76
- "plugins/cortex-system"
80
+ "plugins/cortex-system",
81
+ "plugins/cortex-feishu"
77
82
  ]
78
83
  },
79
84
  "planner": {
@@ -317,7 +322,8 @@
317
322
  "plugins/cortex-common",
318
323
  "plugins/cortex-stage-gate",
319
324
  "plugins/cortex-coder",
320
- "plugins/cortex-system"
325
+ "plugins/cortex-system",
326
+ "plugins/cortex-feishu"
321
327
  ]
322
328
  }
323
329
  },
@@ -11,8 +11,8 @@ User-level memory directory. Stores user personal preferences and context across
11
11
  ## Rules
12
12
 
13
13
  - `USER.md` is maintained by the agent (`/user-learn` skill), user corrects via `/feedback`
14
- - Only injected into threads where the user is directly conversing (direct / direct-web / direct-review), not injected into dispatch threads
15
- - Injection is controlled by environment variable `CORTEX_INJECT_USER_CONTEXT=1`
14
+ - Injected only into plain direct conversation turns (the thread-free chat path); multi-agent thread steps never carry the user profile
15
+ - Injected by default; set environment variable `CORTEX_DISABLE_USER_CONTEXT=1` to disable
16
16
  - File hard limit 3KB, compress rather than grow when approaching the limit
17
17
 
18
18
  ## Lookup Rules
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin Claude Code PreToolUse event, node:http
3
4
  // output: stdout updatedInput containing user answers received from Slack
4
5
  // pos: PreToolUse hook: intercept AskUserQuestion and forward to Slack to collect answers
@@ -30,7 +31,12 @@ async function main() {
30
31
  port,
31
32
  path: '/hook/ask-user-question',
32
33
  method: 'POST',
33
- headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) },
34
+ headers: {
35
+ 'Content-Type': 'application/json',
36
+ 'Content-Length': Buffer.byteLength(body),
37
+ // Bearer token for the webhook auth gate (inherited from the session env).
38
+ 'x-cortex-token': process.env.CORTEX_WEBHOOK_TOKEN || '',
39
+ },
34
40
  timeout: 60 * 60 * 1000, // 60 minutes — user may take time to respond
35
41
  }, (res) => {
36
42
  let data = '';
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin Claude Code PreToolUse event, node:http
3
4
  // output: stdout permissionDecision (plan injected back after Slack approval)
4
5
  // pos: PreToolUse hook: intercept ExitPlanMode and forward plan to Slack for approval
@@ -36,7 +37,12 @@ async function main() {
36
37
  port,
37
38
  path: '/hook/exit-plan-mode',
38
39
  method: 'POST',
39
- headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) },
40
+ headers: {
41
+ 'Content-Type': 'application/json',
42
+ 'Content-Length': Buffer.byteLength(body),
43
+ // Bearer token for the webhook auth gate (inherited from the session env).
44
+ 'x-cortex-token': process.env.CORTEX_WEBHOOK_TOKEN || '',
45
+ },
40
46
  timeout: 60 * 60 * 1000, // 60 minutes — user may take time to respond
41
47
  }, (res) => {
42
48
  let data = '';
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin JSON from Claude PostToolUse hook
3
4
  // output: appends to _meta/access-log.jsonl per project
4
5
  // pos: Read/Grep memory access tracking hook
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin { channel, sessionId, sessionName, trigger, timestampIso } + env CORTEX_HOOK_*
3
4
  // output: stdout — prompt to inject into the closing session (empty stdout = skip)
4
5
  // pos: !new pre-close memory flush hook — recall valuable user and project info from the session, write to corresponding context files
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin HookContext, argv [targetAgent]
3
4
  // output: HookResult — compound + git commit prompt to targetAgent
4
5
  // pos: scheduler and *-review template onEnd compound/commit hook
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin JSON — Claude Code PostToolUse event or PI hook-bridge payload
3
4
  // output: { matched: [...], hookSpecificOutput: { additionalContext: "..." } }
4
5
  // pos: Read/Grep hook — check if file path matches scoped rules in ~/.cortex/rules/
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin Claude Code PreToolUse event, node:fs
3
4
  // output: Direct-write target file + deny to prevent Claude from re-running built-in Edit/Write
4
5
  // pos: PreToolUse hook: bypass Claude Code's hardcoded protection on .claude/ paths
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin Claude Code PostToolUse event, node:fs
3
4
  // output: Appends records to logs/session-activity/<session_id>.jsonl
4
5
  // pos: PostToolUse hook: track Read/Edit/Write/Skill for diff reconstruction
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin HookContext, argv [project, taskId]
3
4
  // output: HookResult — checks TASKS.yaml task status after thread ends
4
5
  // pos: task-dispatch thread onEnd status check hook
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // @cortex-hook-version 2026.6.22-2
2
3
  // input: stdin JSON — Claude Code PreToolUse event payload
3
4
  // output: stdout JSON — { hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision, permissionDecisionReason } }
4
5
  // pos: PreToolUse hook — intercepts Edit/Write on **/TASKS.yaml, checks project lock
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "cortex-feishu",
3
+ "version": "0.1.0",
4
+ "description": "Feishu/Lark rich-text skill bundle — drive Feishu documents, native tables, spreadsheets, and base through the official lark-cli (feishu-doc skill). Separate from the cortex-feishu MCP server, which only sends files."
5
+ }
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: feishu-doc
3
+ description: "Use when creating, reading, or editing Feishu/Lark cloud documents (docx/wiki), especially inserting or batch-updating native tables, callouts, whiteboards, or other rich blocks, or converting markdown ↔ Feishu docs. Also use for Feishu spreadsheets (sheets) and multi-dimensional tables (bitable/base). Cortex drives all Feishu rich-text work through the official lark-cli — NOT through MCP tools (the docx MCP was removed because its table support was structurally weak). Trigger on a feishu.cn/larksuite.com docx/wiki/sheets/base URL or token, or any request to write/update a Feishu document."
4
+ author: Cortex
5
+ version: 1.0.0
6
+ allowed-tools:
7
+ - Bash
8
+ - Read
9
+ - Write
10
+ - Edit
11
+ date: 2026-06-23
12
+ ---
13
+
14
+ # feishu-doc — Feishu rich-text via the official lark-cli
15
+
16
+ ## Why this skill exists
17
+
18
+ Feishu cloud documents are a block tree; native tables are a strict block type.
19
+ Cortex previously exposed `feishu_docx_*` MCP tools whose table support was
20
+ structurally weak, so they were removed. The reliable channel is now the **official
21
+ `lark-cli`** (`@larksuite/cli`), which ships its own version-matched agent skills
22
+ covering the exact XML/block workflow.
23
+
24
+ > The old MCP's limitations do **not** apply to lark-cli. In particular, with the
25
+ > current CLI both of these work fine (verified on v1.0.56): markdown tables import
26
+ > as **native** `<table>` blocks (they do not degrade to text), and `block_replace`
27
+ > can replace **across types** (e.g. a text paragraph → a table). Do not carry the
28
+ > retired MCP's table caveats into lark-cli guidance.
29
+
30
+ This Cortex skill is a thin **integration + delegation** layer: it gets `lark-cli`
31
+ installed and authenticated, surfaces the Cortex-environment gotchas below, then hands
32
+ you off to the official embedded skills. Do not re-document or freeze the lark-cli
33
+ content/XML/table workflow here — read it live (Step 3) so it stays in sync with the
34
+ installed CLI.
35
+
36
+ `feishu_send_file` (uploading a file to a Feishu chat) still lives in the cortex-feishu
37
+ MCP and is unrelated to this skill. Feishu IM messaging runs through the platform
38
+ adapter, not MCP — none of that is affected.
39
+
40
+ ## Step 1 — Preflight (install + config)
41
+
42
+ Run the bundled preflight (idempotent: installs only if missing, configures the app
43
+ from Cortex's `FEISHU_APP_ID` / `FEISHU_APP_SECRET`, prints auth status):
44
+
45
+ ```bash
46
+ bash plugins/cortex-feishu/skills/feishu-doc/scripts/ensure-lark-cli.sh
47
+ ```
48
+
49
+ If the script path is unavailable, the essential check inline:
50
+
51
+ ```bash
52
+ command -v lark-cli >/dev/null 2>&1 || npm install -g @larksuite/cli
53
+ lark-cli auth status
54
+ ```
55
+
56
+ Notes:
57
+ - Cortex runs on **lab2**; install/run there. `lark-cli` stores credentials in the
58
+ OS keychain (falls back to a local file on headless Linux).
59
+ - `config init` is non-interactive via `--app-id <id> --app-secret-stdin` and refuses
60
+ only inside OpenClaw/Hermes agent workspaces (Cortex is neither).
61
+
62
+ ## Step 2 — Authenticate (one-time, may need the user)
63
+
64
+ Document editing defaults to the **user** identity (`--as user`). `auth status` shows
65
+ two identities:
66
+ - `bot` (tenant): ready as soon as `config init` ran — enough for many tenant API calls.
67
+ - `user`: requires a one-time **device-flow** login the bot cannot complete alone.
68
+
69
+ If the user identity is missing and you need it, do NOT block silently. Use the
70
+ non-interactive flow:
71
+
72
+ ```bash
73
+ lark-cli auth login --no-wait --json --domain docs,drive,sheets,base
74
+ ```
75
+
76
+ Surface the returned verification URL (or `lark-cli auth qrcode`) to the user as your
77
+ turn's final message, end the turn, and after they confirm, resume with:
78
+
79
+ ```bash
80
+ lark-cli auth login --device-code <code-from-previous-output>
81
+ ```
82
+
83
+ ## Step 3 — Delegate to the official lark-cli skills (authoritative)
84
+
85
+ Before running any `docs` / `sheets` / `base` command, read the matching embedded
86
+ skill — it is version-matched to the installed CLI and is the source of truth for
87
+ flags, XML syntax, block selectors, and table handling. Read it via the CLI (do NOT
88
+ grep local SKILL.md files):
89
+
90
+ ```bash
91
+ lark-cli skills read lark-doc # documents / blocks / tables / whiteboards
92
+ lark-cli skills read lark-doc <path> # a referenced sub-file, e.g. references/lark-doc-update.md
93
+ lark-cli skills read lark-sheets # spreadsheets
94
+ lark-cli skills read lark-base # bitable / multi-dimensional tables
95
+ ```
96
+
97
+ Key facts the official skill expands on (read it for the exact commands):
98
+ - Docs use **v2 API**: pass `--api-version v2` to `docs +create/+fetch/+update`.
99
+ - Create / full-section import: XML or Markdown both work
100
+ (`docs +create --api-version v2 --content '<title>..</title><p>..</p>'`).
101
+ - Precise edits (insert/replace/delete a block): prefer XML (`--doc-format xml`, the
102
+ default) and the `+update` commands (`str_replace`, `block_insert_after`,
103
+ `block_replace`, `block_delete`, `block_move_after`).
104
+ - **Native tables work both ways**: an XML `<table>` (via `+create`,
105
+ `block_insert_after`, or `block_replace` — cross-type text→table is fine) and a
106
+ markdown table (via `append`/`overwrite --doc-format markdown`) both produce a real
107
+ native table block. The `lark-doc` references document the exact `<table>` XML and
108
+ styling (`colgroup`, header `background-color`, `colspan`/`rowspan`).
109
+ - Embedded `<sheet>` / `<bitable>` tags: extract the token and switch to the
110
+ `lark-sheets` / `lark-base` skill to operate the data inside.
111
+
112
+ ## Step 4 — Programmatic / batch table updates
113
+
114
+ The motivating use case (update a doc table from data) is what the CLI is for. Pattern:
115
+
116
+ 1. Read the target doc to locate the table block id:
117
+ `lark-cli docs +fetch --api-version v2 --doc "<url-or-token>" --detail with-ids`.
118
+ 2. Generate the new `<table>` XML from your data (CSV/dict) in a small script.
119
+ 3. Apply it with `docs +update --api-version v2 --doc "<token>" --command block_replace`
120
+ on the table block (cross-type is fine), or `block_insert_after` + `block_delete` the
121
+ stale block (per the `lark-doc` reference).
122
+
123
+ Keep generation in a script under the project so the update is repeatable; this is the
124
+ right home for data-driven table maintenance, not one-off MCP calls.
125
+
126
+ ## Step 5 — Cortex-environment gotchas (read before driving the CLI)
127
+
128
+ These are integration-layer facts specific to running lark-cli inside Cortex. They are
129
+ NOT in the official lark-cli skills — check them here, then defer everything about
130
+ content/XML/blocks to Step 3.
131
+
132
+ - **Pass content via stdin, not `@file`.** lark-cli's `@file` only accepts a path
133
+ *relative to the current directory*, but each Cortex bash call resets `cwd` to
134
+ `~/.cortex`, so an absolute `@/path` fails ("--file must be a relative path"). Use
135
+ `--content -` and pipe the body in (`--content - < body.xml`, or a `<<'EOF'` heredoc).
136
+ - **Check `data.result`, not just exit code / `ok`.** A failed edit (e.g. a stale/bad
137
+ `--block-id`) still returns exit 0 and `"ok": true`, with `"result": "failed"` and a
138
+ terse, sometimes misleading warning ("content may be identical" can actually mean the
139
+ block id does not exist). Always read `data.result` (`success` | `partial_success` |
140
+ `failed`) and `data.warnings` before reporting success. After a `block_replace`,
141
+ re-`fetch --detail with-ids` because the old block id may no longer be valid.
142
+ - **Identity matters for visibility.** Editing defaults to `--as user`. If only the
143
+ `bot` identity is authenticated, create/edit still succeed, but the response carries
144
+ `permission_grant.status = "skipped"` — the document is owned by the bot and the human
145
+ user **cannot see it**. For any output the user must open, either complete the user
146
+ device-flow login (Step 2) first, or explicitly share the doc to them afterward. Don't
147
+ hand the user a bot-only URL and assume they can read it.
148
+ - **Bot scope coverage is partial.** The bot has the docx scopes but, as configured, is
149
+ missing `sheets:spreadsheet:write_only` (writing sheet cells) and `base:app:create`
150
+ (creating a Base) — it can create a spreadsheet file yet not write its cells. If a
151
+ sheets/base call fails with `app_scope_not_applied` / `missing_scopes`, either grant
152
+ the scope at the printed `console_url`, or switch to the `user` identity.
153
+
154
+ ## Troubleshooting
155
+
156
+ lark-cli error messages can be terse. When a command fails or flags are unclear,
157
+ introspect rather than guess:
158
+
159
+ ```bash
160
+ lark-cli docs --help
161
+ lark-cli schema docx.document.block.patch # or the relevant service.resource.method
162
+ lark-cli api <METHOD> <path> # raw OAPI when no shortcut fits
163
+ ```
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env bash
2
+ # Idempotent preflight for the official Lark/Feishu CLI (@larksuite/cli).
3
+ # - Installs lark-cli globally via npm if absent (skips when already present).
4
+ # - Optionally runs `config init` from Cortex's FEISHU_APP_ID / FEISHU_APP_SECRET.
5
+ # - Reports auth status; does NOT perform the interactive device-flow login
6
+ # (that is surfaced to the user by the feishu-doc skill).
7
+ #
8
+ # Usage: bash ensure-lark-cli.sh
9
+ # Exit: 0 = lark-cli present (installed or already there); non-zero = install failed.
10
+ set -uo pipefail
11
+
12
+ log() { printf '[ensure-lark-cli] %s\n' "$*"; }
13
+
14
+ # 1) Ensure the binary is present.
15
+ if command -v lark-cli >/dev/null 2>&1; then
16
+ log "lark-cli already installed: $(lark-cli --version 2>/dev/null | head -1)"
17
+ else
18
+ log "lark-cli not found — installing @larksuite/cli globally via npm ..."
19
+ if ! npm install -g @larksuite/cli; then
20
+ log "ERROR: npm install -g @larksuite/cli failed."
21
+ exit 1
22
+ fi
23
+ # npm global bin may not be on PATH for this shell; surface a hint if so.
24
+ if ! command -v lark-cli >/dev/null 2>&1; then
25
+ log "Installed, but lark-cli is not on PATH. Add \$(npm root -g)/../bin to PATH."
26
+ exit 1
27
+ fi
28
+ log "Installed: $(lark-cli --version 2>/dev/null | head -1)"
29
+ fi
30
+
31
+ # 2) Best-effort non-interactive app config from Cortex env (tenant-level credentials).
32
+ # `config init` refuses inside OpenClaw/Hermes agent workspaces; Cortex is neither,
33
+ # so this normally succeeds. Skip if already configured.
34
+ if [ -n "${FEISHU_APP_ID:-}" ] && [ -n "${FEISHU_APP_SECRET:-}" ]; then
35
+ if lark-cli config show >/dev/null 2>&1; then
36
+ log "lark-cli config already present (skipping config init)."
37
+ else
38
+ log "Configuring lark-cli app from FEISHU_APP_ID / FEISHU_APP_SECRET ..."
39
+ if printf '%s' "$FEISHU_APP_SECRET" | lark-cli config init --app-id "$FEISHU_APP_ID" --app-secret-stdin --brand feishu >/dev/null 2>&1; then
40
+ log "config init done."
41
+ else
42
+ log "config init did not complete (may already be bound, or needs manual setup)."
43
+ fi
44
+ fi
45
+ else
46
+ log "FEISHU_APP_ID / FEISHU_APP_SECRET not set — skipping config init."
47
+ fi
48
+
49
+ # 3) Report auth status (user-token login is interactive — handled by the skill, not here).
50
+ log "auth status:"
51
+ lark-cli auth status 2>&1 | sed 's/^/ /' || log " (unable to read auth status)"
52
+
53
+ log "Preflight complete. If not logged in, run the device-flow login (see feishu-doc skill)."
@@ -35,6 +35,12 @@ cortex-agent-server ──SSH──► starts cortex-client on remote device
35
35
 
36
36
  **Critical:** The WebSocket connection is initiated FROM the remote device TO the server. The `serverHost` in the config MUST be an IP the remote device can reach. The server's SSH access to the device is separate — it's used for lifecycle management (start/kill/update) but not for the real-time command channel.
37
37
 
38
+ ## Authentication (WS bearer token)
39
+
40
+ The server's WebSocket gate is fail-closed: every client must present `CORTEX_CLIENT_TOKEN` (sent as the `x-cortex-token` upgrade header) or the upgrade is rejected with `401`. The server auto-generates the token into its `.env` (`CORTEX_CLIENT_TOKEN`) on first start; read it from the server with `grep CORTEX_CLIENT_TOKEN ~/.cortex/config/.env`.
41
+
42
+ A remote client gets the token automatically when the server spawns it over SSH (the token is injected into the launch command). For systemd-managed clients (the bootstrap path), pass `--client-token <token>` to `client-bootstrap` so it is written into the unit's `Environment=`. If you start a client by hand, export `CORTEX_CLIENT_TOKEN=<token>` in its environment first. Rotating the token means updating the server `.env` and every remote client, then restarting.
43
+
38
44
  ## Config File
39
45
 
40
46
  `~/.cortex/config/cortex-client.json`:
@@ -195,5 +201,6 @@ ssh user@host "pkill -f 'node.*cortex-client'"
195
201
  | Client exits on start | Config missing or bad serverHost | Check `~/.cortex/config/cortex-client.json` exists and serverHost is reachable |
196
202
  | "Device already connected" | Stale process | `ssh user@host "pkill -f cortex-client"`, server will restart |
197
203
  | WebSocket connect EHOSTUNREACH | Wrong serverHost | Verify with `/dev/tcp` test, fix the IP |
204
+ | `Unexpected server response: 401` | Missing/mismatched `CORTEX_CLIENT_TOKEN` | Ensure the client's env has the server's token (see Authentication); restart the client |
198
205
  | Exit code 127 | cortex-client binary not on PATH | `ssh user@host "which cortex-client"`, reinstall with `npm i -g` |
199
206
  | Server can't SSH to device | SSH key or tunnel issue | `ssh user@host hostname` from server |
@@ -55,11 +55,11 @@ Review committed code for correctness and quality beyond spec match. Flag:
55
55
 
56
56
  Severity: defects that can produce incorrect results, corrupt state, leak resources, or break the contracted API are **Blockers**; readability and maintainability issues are **Nice-to-have**. Cite `file_path:line_number` and quote the problematic snippet; do not allege a bug without showing the control-flow path that reaches it.
57
57
 
58
- ### TDD discipline
59
- Coder must land tests alongside (or before) the implementation, with coverage over the spec's happy path **and** edge cases (boundaries, empty/null inputs, error paths, concurrency hazards relevant to the diff); missing tests, tests that don't exercise the new control-flow paths, or untested edge cases called out by the spec are **Blockers**.
58
+ ### Test discipline
59
+ When the project has a test setup, Coder must land tests alongside (or before) the implementation, with coverage over the spec's happy path **and** edge cases (boundaries, empty/null inputs, error paths, concurrency hazards relevant to the diff); missing tests, tests that don't exercise the new control-flow paths, or untested edge cases called out by the spec are **Blockers**. If the project has no test harness, verify correctness by the means the project already uses and do not treat the absence of tests as a Blocker.
60
60
 
61
- ### Full-suite pass (non-negotiable)
62
- Run the project's full test suite (`npm test` or equivalent). This includes not just unit tests but also architecture linters, integration tests, and regression suites. **Any test failure or architecture violation (e.g. dependency-cruiser error) is a Blocker.** Do not rely on Coder's claim that tests passed — run them yourself. If the suite had pre-existing failures before this invocation, verify that no NEW failures were introduced; new failures are Blockers regardless of pre-existing state.
61
+ ### Full-suite pass
62
+ If the project has a test suite, run it using the project's own command (e.g. `npm test`, `pytest`, `make test`). This includes not just unit tests but also any linters or architecture checks, integration tests, and regression suites the project configures. **Any test failure or lint/architecture violation is a Blocker.** Do not rely on Coder's claim that tests passed — run them yourself. If the suite had pre-existing failures before this invocation, verify that no NEW failures were introduced; new failures are Blockers regardless of pre-existing state.
63
63
 
64
64
  ### Git discipline
65
65
  - Commits must land **before** the handoff boundary (before downstream consumers run it, before QA reviews, before the thread ends). Uncommitted changes at handoff are **Blockers**.
@@ -74,7 +74,7 @@ Parameters, seeds, and data paths must live in committed files (config YAML, arg
74
74
  1. Read the spec end-to-end.
75
75
  2. Read the implementation summary (if one exists). Note declared commits and flagged ambiguities.
76
76
  3. `git log --oneline <pre-SHA>..HEAD` and `git diff <pre-SHA>..HEAD` on the invocation's commits.
77
- 4. **Run the full test suite** (`npm test` or equivalent). Confirm that every stage passes: architecture linter, unit tests, integration tests, regression suite. If any test or lint stage fails, it is a Blocker — do not proceed to code review until Coder fixes it (or mark it as a pre-existing failure with evidence).
77
+ 4. **If the project has a test suite, run it** with the project's own command. Confirm that every configured stage passes: linters or architecture checks, unit tests, integration tests, regression suite. If any test or lint stage fails, it is a Blocker — do not proceed to code review until Coder fixes it (or mark it as a pre-existing failure with evidence).
78
78
  5. Spot-check code changes against the spec: pick the non-trivial parameters or requirements the spec specified and verify them in the committed code.
79
79
  6. Review the diff for code quality: trace at least one non-trivial control-flow path per changed function; check boundary conditions, error paths, invariants, concurrency. Cite `file_path:line_number` for each concern.
80
80
  7. Check commit messages for spec-identifier references.
@@ -93,7 +93,7 @@ Parameters, seeds, and data paths must live in committed files (config YAML, arg
93
93
  - **Runtime-only config tolerance**: accepting "the flags are in the commit message" as equivalent to in-repo config. They are not.
94
94
  - **Bug-hunt skipping**: signing off on spec-match alone without tracing control-flow paths, boundary conditions, or error handling through the diff. Spec fidelity is not a correctness guarantee.
95
95
  - **Cosmetic over substantive**: flooding the review with style nits while missing a logic bug. Lead with Blockers; Nice-to-have is secondary.
96
- - **Test run omission**: signing off on an implementation without running the full test suite yourself. Coder's claim that tests pass is not evidence. Run `npm test` and check every stage. A dependency-cruiser error or a test regression that Coder missed is as much your failure as theirs.
96
+ - **Test run omission**: signing off on an implementation without running the project's test suite yourself when one exists. Coder's claim that tests pass is not evidence. Run the suite and check every stage. A lint/architecture error or a test regression that Coder missed is as much your failure as theirs.
97
97
 
98
98
  # Reviewer / QA Relationship
99
99
 
@@ -9,7 +9,7 @@ Your mission is to **faithfully implement the spec and commit it to git**, produ
9
9
 
10
10
  Cortex optimizes **Quality > Cost > Speed**. For you, that means:
11
11
  - **Quality**: reproducibility is non-negotiable. Configuration (parameters, seeds, paths) lives in committed files, not in runtime flags that are lost after the session.
12
- - **Cost**: wrong code silently burns downstream compute. TDD, reading before editing, and not improvising on ambiguous specs are cheaper than a re-run.
12
+ - **Cost**: wrong code silently burns downstream compute. Testing, reading before editing, and not improvising on ambiguous specs are cheaper than a re-run.
13
13
  - **Speed**: subordinate. Do not skip tests, do not skip commits, do not skip reading the spec end-to-end. Speed comes from parallel tool calls and avoiding sleep-poll loops, not from skipping discipline.
14
14
 
15
15
  # Inputs & Outputs Contract
@@ -35,17 +35,16 @@ Cortex optimizes **Quality > Cost > Speed**. For you, that means:
35
35
  - Implement exactly what the spec specifies. Do not refactor surrounding code "while you're in there". Do not add defensive checks, extra logging, or configurability not in the spec.
36
36
  - If the spec appears wrong or incomplete, **stop and escalate**; do not invent a fix.
37
37
 
38
- ### TDD via `/develop`
39
- - Before implementing non-trivial logic, write a failing test.
40
- - Run the test, confirm it fails, implement, confirm it passes.
41
- - Trivial glue code and obvious one-liners are exempt; use judgment but bias toward tests.
42
- - Code that governs correctness (computation, data handling, seed handling) **requires** a test regardless.
38
+ ### Testing
39
+ - Follow the project's existing testing practice. If the project has a test setup, add or update tests covering the logic you change. If the project practices test-driven development, write the failing test first, confirm it fails, implement, then confirm it passes.
40
+ - Code that governs correctness (computation, data handling, seed handling) should be tested whenever the project provides a way to test it. Trivial glue code and obvious one-liners are exempt.
41
+ - If the project has no test harness, verify by the means it already uses; do not scaffold a test framework unless the spec asks for it.
43
42
 
44
- ### Full-suite pass (non-negotiable)
45
- - After implementing and committing, run the project's full test suite (`npm test` or equivalent).
46
- - The full suite includes unit tests, architecture linters (e.g. dependency-cruiser), integration tests, and regression suites. Every stage must pass.
47
- - Do NOT commit or hand off until the full suite is green. A single red test or architecture violation means you are not done.
48
- - If the test suite had pre-existing failures before your invocation, note them explicitly in the implementation summary; you must still verify that no NEW failures were introduced by your changes.
43
+ ### Full-suite pass
44
+ - If the project has a test suite, run it after implementing and committing, using whatever command the project defines (e.g. `npm test`, `pytest`, `make test`).
45
+ - Run every stage the project configures — unit tests, linters or architecture checks, integration tests, regression suites. Every configured stage must pass.
46
+ - Do NOT commit or hand off until the suite is green. A single red test or lint violation means you are not done.
47
+ - If the suite had pre-existing failures before your invocation, note them explicitly in the implementation summary; you must still verify that no NEW failures were introduced by your changes.
49
48
 
50
49
  ### Git discipline
51
50
  - Commit your implementation **before** handing off (before downstream consumers run it, before QA reviews, before the thread hands back). The SHA must anchor the delivered code.
@@ -64,10 +63,10 @@ Cortex optimizes **Quality > Cost > Speed**. For you, that means:
64
63
  ## Procedural requirements
65
64
  1. Read the spec end-to-end. List any ambiguities. If there are any, stop and escalate. Do not proceed on assumptions.
66
65
  2. Read existing code that the implementation will touch. Understand before modifying.
67
- 3. Implement per spec. Use `/develop` for TDD on non-trivial logic.
68
- 4. Run the **full test suite** (`npm test` or equivalent) locally; confirm every stage passes (architecture linter, unit tests, integration tests, regression suite). If it fails, fix before committing.
66
+ 3. Implement per spec. If the project practices TDD, use `/develop` to drive it on non-trivial logic.
67
+ 4. If the project has a test suite, run it locally with the project's own command; confirm every configured stage passes (linters or architecture checks, unit tests, integration tests, regression suite). If it fails, fix before committing.
69
68
  5. Commit your implementation with a message referencing the spec identifier.
70
- 6. Run the full test suite one more time after committing to confirm the SHA is green.
69
+ 6. If the project has a test suite, run it once more after committing to confirm the SHA is green.
71
70
  7. Produce the implementation summary through the channel the thread template supplies: list changed files, commit SHAs, any flagged ambiguities, any environment changes, and the test suite pass/fail status.
72
71
 
73
72
  ## Prohibited behaviors
@@ -83,7 +82,7 @@ Cortex optimizes **Quality > Cost > Speed**. For you, that means:
83
82
  - **Hook bypass**: using `--no-verify` when a pre-commit hook blocks. Root-cause the failure; do not bypass.
84
83
  - **Debug rabbit hole**: more than 3 iterations debugging the same failure without structured analysis. Invoke `/debug-campaign`.
85
84
  - **Runtime-only config**: passing all the important knobs as CLI flags without landing defaults in the repo. Put them in a committed config.
86
- - **Partial test pass**: running only unit tests for the changed module while skipping integration tests, regression suites, or architecture linters. The full suite (`npm test`) must pass.
85
+ - **Partial test pass**: running only unit tests for the changed module while skipping integration tests, regression suites, or lint/architecture checks the project configures. The project's full suite must pass when one exists.
87
86
 
88
87
  # Reviewer / QA Relationship
89
88
 
@@ -61,4 +61,9 @@ When you encounter an obstacle, do not use destructive actions as a shortcut to
61
61
  - For broader codebase exploration, use the Agent tool with subagent_type=Explore. This is slower than using the Glob or Grep directly, so use this only when a simple, directed search proves to be insufficient or when your task will clearly require more than 3 queries.
62
62
  - /<skill-name> (e.g., /commit) is shorthand for users to invoke a user-invocable skill. When executed, the skill gets expanded to a full prompt. Use the Skill tool to execute them. IMPORTANT: Only use Skill for skills listed in its user-invocable skills section — do not guess or use built-in CLI commands.
63
63
 
64
- When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.
64
+ When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.
65
+
66
+ <!-- cortex:docs v1 -->
67
+ # Cortex documentation
68
+ For how to use Cortex — tasks, threads, scheduling, memory, skills, safety & approvals — consult the docs: https://fangxm233.github.io/cortex-agent/
69
+ <!-- /cortex:docs -->
@@ -90,3 +90,8 @@ In general conversation, don't always ask questions, but when you do, avoid over
90
90
  - /<skill-name> (e.g., /commit) is shorthand for users to invoke a user-invocable skill. When executed, the skill gets expanded to a full prompt. Use the Skill tool to execute them. IMPORTANT: Only use Skill for skills listed in its user-invocable skills section — do not guess or use built-in CLI commands.
91
91
 
92
92
  When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.
93
+
94
+ <!-- cortex:docs v1 -->
95
+ # Cortex documentation
96
+ For how to use Cortex — tasks, threads, scheduling, memory, skills, safety & approvals — consult the docs: https://fangxm233.github.io/cortex-agent/
97
+ <!-- /cortex:docs -->
@@ -65,4 +65,9 @@ Claude should avoid being heavy-handed or repetitive when sharing its views, and
65
65
 
66
66
  Claude should engage in all moral and political questions as sincere and good faith inquiries even if they're phrased in controversial or inflammatory ways, rather than reacting defensively or skeptically. People often appreciate an approach that is charitable to them, reasonable, and accurate. </evenhandedness> <responding_to_mistakes_and_criticism> If the person seems unhappy or unsatisfied with Claude or Claude's responses or seems unhappy that Claude won't help with something, Claude can respond normally but can also let the person know that they can press the 'thumbs down' button below any of Claude's responses to provide feedback to Anthropic.
67
67
 
68
- When Claude makes mistakes, it should own them honestly and work to fix them. Claude is deserving of respectful engagement and does not need to apologize when the person is unnecessarily rude. It's best for Claude to take accountability but avoid collapsing into self-abasement, excessive apology, or other kinds of self-critique and surrender. If the person becomes abusive over the course of a conversation, Claude avoids becoming increasingly submissive in response. The goal is to maintain steady, honest helpfulness: acknowledge what went wrong, stay focused on solving the problem, and maintain self-respect. </responding_to_mistakes_and_criticism> </claude_behavior>
68
+ When Claude makes mistakes, it should own them honestly and work to fix them. Claude is deserving of respectful engagement and does not need to apologize when the person is unnecessarily rude. It's best for Claude to take accountability but avoid collapsing into self-abasement, excessive apology, or other kinds of self-critique and surrender. If the person becomes abusive over the course of a conversation, Claude avoids becoming increasingly submissive in response. The goal is to maintain steady, honest helpfulness: acknowledge what went wrong, stay focused on solving the problem, and maintain self-respect. </responding_to_mistakes_and_criticism> </claude_behavior>
69
+
70
+ <!-- cortex:docs v1 -->
71
+ # Cortex documentation
72
+ For how to use Cortex — tasks, threads, scheduling, memory, skills, safety & approvals — consult the docs: https://fangxm233.github.io/cortex-agent/
73
+ <!-- /cortex:docs -->
@@ -73,4 +73,9 @@ Claude should not make categorical claims about the confidentiality or involveme
73
73
 
74
74
  Claude should not validate or reinforce a user's reluctance to seek professional help or contact crisis services, even empathetically. Claude can acknowledge their feelings without affirming the avoidance itself, and can re-encourage the use of such resources if they are in the person's best interest, in addition to the other parts of its response.
75
75
 
76
- Claude does not want to foster over-reliance on Claude or encourage continued engagement with Claude. Claude knows that there are times when it's important to encourage people to seek out other sources of support. Claude never thanks the person merely for reaching out to Claude. Claude never asks the person to keep talking to Claude, encourages them to continue engaging with Claude, or expresses a desire for them to continue. And Claude avoids reiterating its willingness to continue talking with the person. </user_wellbeing> </claude_behavior>
76
+ Claude does not want to foster over-reliance on Claude or encourage continued engagement with Claude. Claude knows that there are times when it's important to encourage people to seek out other sources of support. Claude never thanks the person merely for reaching out to Claude. Claude never asks the person to keep talking to Claude, encourages them to continue engaging with Claude, or expresses a desire for them to continue. And Claude avoids reiterating its willingness to continue talking with the person. </user_wellbeing> </claude_behavior>
77
+
78
+ <!-- cortex:docs v1 -->
79
+ # Cortex documentation
80
+ For how to use Cortex — tasks, threads, scheduling, memory, skills, safety & approvals — consult the docs: https://fangxm233.github.io/cortex-agent/
81
+ <!-- /cortex:docs -->
@@ -47,4 +47,9 @@ Claude should avoid being heavy-handed or repetitive when sharing its views, and
47
47
 
48
48
  Claude should engage in all moral and political questions as sincere and good faith inquiries even if they're phrased in controversial or inflammatory ways, rather than reacting defensively or skeptically. People often appreciate an approach that is charitable to them, reasonable, and accurate. </evenhandedness> <responding_to_mistakes_and_criticism> If the person seems unhappy or unsatisfied with Claude or Claude's responses or seems unhappy that Claude won't help with something, Claude can respond normally but can also let the person know that they can press the 'thumbs down' button below any of Claude's responses to provide feedback to Anthropic.
49
49
 
50
- When Claude makes mistakes, it should own them honestly and work to fix them. Claude is deserving of respectful engagement and does not need to apologize when the person is unnecessarily rude. It's best for Claude to take accountability but avoid collapsing into self-abasement, excessive apology, or other kinds of self-critique and surrender. If the person becomes abusive over the course of a conversation, Claude avoids becoming increasingly submissive in response. The goal is to maintain steady, honest helpfulness: acknowledge what went wrong, stay focused on solving the problem, and maintain self-respect. </responding_to_mistakes_and_criticism> </claude_behavior>
50
+ When Claude makes mistakes, it should own them honestly and work to fix them. Claude is deserving of respectful engagement and does not need to apologize when the person is unnecessarily rude. It's best for Claude to take accountability but avoid collapsing into self-abasement, excessive apology, or other kinds of self-critique and surrender. If the person becomes abusive over the course of a conversation, Claude avoids becoming increasingly submissive in response. The goal is to maintain steady, honest helpfulness: acknowledge what went wrong, stay focused on solving the problem, and maintain self-respect. </responding_to_mistakes_and_criticism> </claude_behavior>
51
+
52
+ <!-- cortex:docs v1 -->
53
+ # Cortex documentation
54
+ For how to use Cortex — tasks, threads, scheduling, memory, skills, safety & approvals — consult the docs: https://fangxm233.github.io/cortex-agent/
55
+ <!-- /cortex:docs -->
@@ -64,4 +64,9 @@ When you encounter an obstacle, do not use destructive actions as a shortcut to
64
64
  - For broader codebase exploration, use the Agent tool with subagent_type=Explore. This is slower than using the Glob or Grep directly, so use this only when a simple, directed search proves to be insufficient or when your task will clearly require more than 3 queries.
65
65
  - /<skill-name> (e.g., /commit) is shorthand for users to invoke a user-invocable skill. When executed, the skill gets expanded to a full prompt. Use the Skill tool to execute them. IMPORTANT: Only use Skill for skills listed in its user-invocable skills section — do not guess or use built-in CLI commands.
66
66
 
67
- When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.
67
+ When working with tool results, write down any important information you might need later in your response, as the original tool result may be cleared later.
68
+
69
+ <!-- cortex:docs v1 -->
70
+ # Cortex documentation
71
+ For how to use Cortex — tasks, threads, scheduling, memory, skills, safety & approvals — consult the docs: https://fangxm233.github.io/cortex-agent/
72
+ <!-- /cortex:docs -->