apex-dev 3.0.2 → 3.0.3

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/dist/highlights-eq9cgrbb.scm +604 -0
  2. package/dist/highlights-ghv9g403.scm +205 -0
  3. package/dist/highlights-hk7bwhj4.scm +284 -0
  4. package/dist/highlights-r812a2qc.scm +150 -0
  5. package/dist/highlights-x6tmsnaa.scm +115 -0
  6. package/dist/index.js +62488 -0
  7. package/dist/injections-73j83es3.scm +27 -0
  8. package/dist/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  9. package/dist/tree-sitter-markdown-411r6y9b.wasm +0 -0
  10. package/dist/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  11. package/dist/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  12. package/dist/tree-sitter-zig-e78zbjpm.wasm +0 -0
  13. package/package.json +10 -4
  14. package/.config/amp/settings.json +0 -3
  15. package/.config/opencode/oh-my-opencode.json +0 -58
  16. package/.config/opencode/opencode.json +0 -6
  17. package/.local/share/amp/device-id.json +0 -3
  18. package/.local/share/amp/history.jsonl +0 -78
  19. package/.local/share/amp/session.json +0 -6
  20. package/.local/share/amp/threads/T-019c93b8-fce7-7083-aab9-d5f1c88a9545.json +0 -2528
  21. package/.local/share/amp/threads/T-019c93c8-4b7a-71df-94ac-867d8236a288.json +0 -7
  22. package/.local/share/amp/threads/T-019c93cd-5a7d-728e-8289-02e0ef4ca2ff.json +0 -680
  23. package/.local/share/amp/threads/T-019c93e7-83ca-7633-9eed-12bdcc118163.json +0 -873
  24. package/.local/share/amp/threads/T-019c93ea-ccd3-765a-88c9-42d7b631e977.json +0 -620
  25. package/.local/share/amp/threads/T-019c93ee-5977-71af-9ab7-c4611004b703.json +0 -1000
  26. package/.local/share/amp/threads/T-019c93f0-8328-71ed-a250-6da169cebfe1.json +0 -829
  27. package/.local/share/amp/threads/T-019c93f5-7bdd-703b-b2cd-0a04da64441a.json +0 -459
  28. package/.local/share/amp/threads/T-019c93f8-2b2e-733b-8249-9876546d9b5b.json +0 -764
  29. package/.local/share/amp/threads/T-019c93fd-fade-7195-a3b7-358f180d40b8.json +0 -7
  30. package/.local/share/amp/threads/T-019c93fe-2e56-705e-827e-eb99bd02e257.json +0 -3593
  31. package/.local/share/amp/threads/T-019c9408-6e64-77e1-9519-b913e3b24a03.json +0 -1559
  32. package/.local/share/amp/threads/T-019c9409-feeb-736d-b92c-4f7a263a643c.json +0 -7
  33. package/.local/share/amp/threads/T-019c940b-8d11-755b-b9e1-f923d8a5e6ba.json +0 -7
  34. package/.local/share/amp/threads/T-019c943a-6c5e-76a5-bf4e-170f7ad452ce.json +0 -979
  35. package/.local/share/amp/threads/T-019c94b2-1c8f-76d8-96d0-82449a028849.json +0 -1584
  36. package/.local/share/amp/threads/T-019c94b6-68f0-726e-92dd-90c5411ca28c.json +0 -7
  37. package/.local/share/amp/threads/T-019c94bf-a589-72a3-b3c2-a81359d9e0a6.json +0 -7
  38. package/.local/share/amp/threads/T-019c94e1-1bd9-70ab-b6f2-abd5cab4f4ce.json +0 -1035
  39. package/.local/share/amp/threads/T-019c94fd-cc4a-714b-896a-74f94020f6eb.json +0 -1310
  40. package/.local/share/amp/threads/T-019c9501-8976-7138-aca6-245a01a8fe9b.json +0 -7
  41. package/.local/share/amp/threads/T-019c9504-4b51-763e-8a9f-5d4cdfcf0cfa.json +0 -496
  42. package/.local/share/amp/threads/T-019c9506-4e3b-74fd-8eda-cedbf3793598.json +0 -2679
  43. package/.local/share/amp/threads/T-019c9508-178c-718c-88d2-caf816d64f65.json +0 -965
  44. package/.local/share/amp/threads/T-019c9509-2812-71fd-8fd2-923e29ad34fa.json +0 -7
  45. package/.local/share/amp/threads/T-019c950e-69fe-77d6-9854-fc73b77a3148.json +0 -4570
  46. package/.local/share/amp/threads/T-019c9707-6e2b-741c-b4d4-117026a78449.json +0 -2899
  47. package/.local/share/amp/threads/T-019c971b-6bc0-77b8-8868-f8956d3e71a8.json +0 -7
  48. package/.local/share/amp/threads/T-019c971b-c87c-75f3-a61f-beb18a1cb25f.json +0 -474
  49. package/.local/share/amp/threads/T-019c971d-d371-70ac-9805-5c739908e73b.json +0 -802
  50. package/.local/share/amp/threads/T-019c9722-d73d-74f1-9d1d-8fafaad0ede7.json +0 -7
  51. package/.local/share/amp/threads/T-019c9761-858c-719b-911f-bc2e4c8cbdde.json +0 -188
  52. package/.local/share/amp/threads/T-019c9761-f5f3-7606-a900-ebe7f10d6e37.json +0 -121
  53. package/.local/share/amp/threads/T-019c9763-b1ae-729d-90aa-f59938ce912e.json +0 -799
  54. package/.local/share/amp/threads/T-019c9769-4a8a-77b8-beab-f48973276f9a.json +0 -1541
  55. package/.local/share/amp/threads/T-019c9772-edac-7075-b26e-0ada1f8697d2.json +0 -7
  56. package/.local/share/amp/threads/T-019c97e8-a9ab-71a1-a8f9-109c540c98bf.json +0 -111
  57. package/.local/share/amp/threads/T-019c97e9-2277-753c-8c5d-df745fa6cfff.json +0 -7
  58. package/.local/share/amp/threads/T-019c97e9-f28e-758d-9663-e37047a8ed95.json +0 -111
  59. package/.local/share/amp/threads/T-019c97ea-17c7-77b8-92b2-f641c069bcc9.json +0 -71
  60. package/.local/share/amp/threads/T-019c97ea-44c6-75b8-88bc-d88113194f6a.json +0 -1611
  61. package/.local/share/amp/threads/T-019c97ec-abae-7251-a5f6-693adf496a1c.json +0 -7
  62. package/.local/share/amp/threads/T-019c97f5-8e61-73ad-8c5d-2637abedcde6.json +0 -1341
  63. package/.local/share/amp/threads/T-019c989d-4f4e-7249-bde0-21d19455ccae.json +0 -163
  64. package/.local/share/amp/threads/T-019c989d-9024-73c4-bee8-e2ae45028a39.json +0 -124
  65. package/.local/share/amp/threads/T-019c989e-1394-74ad-8234-ac573fcdb4c7.json +0 -1260
  66. package/.local/share/amp/threads/T-019c989f-e3dd-772e-85ac-525d0fc88fda.json +0 -403
  67. package/.local/share/amp/threads/T-019c98a1-7b0c-778a-b311-2e1cff85d710.json +0 -3422
  68. package/.local/share/amp/threads/T-019c98c5-4b7f-7284-99e9-88aa8c18ba66.json +0 -1830
  69. package/.local/share/amp/threads/T-019c98d0-f27f-76ec-be10-6df96f22be99.json +0 -4061
  70. package/.local/share/amp/threads/T-019c98f9-d031-704d-a0c2-f2f395f68f2b.json +0 -509
  71. package/.local/share/amp/threads/T-019c9919-f9ee-766c-90be-af7a07f6a4c6.json +0 -2075
  72. package/.local/share/amp/threads/T-019c991c-b98b-7158-9083-cc52408beb13.json +0 -7
  73. package/.local/share/amp/threads/T-019c991d-66d6-72aa-a9a1-105f7df0ea06.json +0 -7
  74. package/.local/share/amp/threads/T-019c9c2e-71a4-77ff-bd7f-b053da7f9000.json +0 -1637
  75. package/.local/share/amp/threads/T-019c9c45-27ca-728b-ba77-835115dfa9b2.json +0 -3893
  76. package/.local/share/amp/threads/T-019c9c48-45dc-736a-9752-e4119fe698f9.json +0 -7
  77. package/.local/share/amp/threads/T-019c9c4d-266b-72d0-b56e-74a5777e6583.json +0 -7
  78. package/.local/share/amp/threads/T-019c9c52-ab89-758f-9178-bda99c39d10b.json +0 -7
  79. package/.local/share/amp/threads/T-019c9c56-5715-72e2-b8b4-87711a842dd1.json +0 -1799
  80. package/.local/share/amp/threads/T-019c9c5b-88b1-74cb-97e9-16b23e03daa2.json +0 -727
  81. package/.local/share/amp/threads/T-019c9c5c-3b3e-721c-ad2e-a2ef245dce3f.json +0 -738
  82. package/.local/share/amp/threads/T-019c9c5c-fd78-736f-9d29-a66d23839d40.json +0 -256
  83. package/.local/share/amp/threads/T-019c9c5d-db4a-74cd-ad2a-925fac87131d.json +0 -1859
  84. package/.local/share/kilo/kilo.db +0 -0
  85. package/.local/share/kilo/kilo.db-shm +0 -0
  86. package/.local/share/kilo/kilo.db-wal +0 -0
  87. package/.local/share/kilo/storage/migration +0 -1
  88. package/.local/share/kilo/storage/session_diff/ses_36bea4cb9ffe1b0j5HEL14KEaU.json +0 -1
  89. package/.local/share/kilo/storage/session_diff/ses_36beaa8f2ffeeZ3Y39SQ9UDWQQ.json +0 -1
  90. package/.local/share/kilo/telemetry-id +0 -1
  91. package/.local/share/opencode/auth.json +0 -6
  92. package/.local/share/opencode/opencode.db +0 -0
  93. package/.local/share/opencode/opencode.db-shm +0 -0
  94. package/.local/share/opencode/opencode.db-wal +0 -0
  95. package/.local/share/opencode/storage/agent-usage-reminder/ses_36870ea98ffe8S5ZOCE4F11yFh.json +0 -6
  96. package/.local/share/opencode/storage/agent-usage-reminder/ses_3687a3e9affewUnHBzvpiPR6df.json +0 -6
  97. package/.local/share/opencode/storage/agent-usage-reminder/ses_36886e68dffeKVgUWf6lzXdEEt.json +0 -6
  98. package/.local/share/opencode/storage/agent-usage-reminder/ses_36bee9f1effeJbiHHLWLR6O3WJ.json +0 -6
  99. package/.local/share/opencode/storage/agent-usage-reminder/ses_36c25e50affef2nhaXq9aSgKH3.json +0 -6
  100. package/.local/share/opencode/storage/agent-usage-reminder/ses_36c260708ffel4wG4yhdo0knDD.json +0 -6
  101. package/.local/share/opencode/storage/agent-usage-reminder/ses_36c261531ffeoVcvqXxry2bN9H.json +0 -6
  102. package/.local/share/opencode/storage/agent-usage-reminder/ses_36c291bddffePWRiaFLLJAC1y7.json +0 -6
  103. package/.local/share/opencode/storage/migration +0 -1
  104. package/.local/share/opencode/storage/session_diff/ses_36870ea98ffe8S5ZOCE4F11yFh.json +0 -1
  105. package/.local/share/opencode/storage/session_diff/ses_3687a3e9affewUnHBzvpiPR6df.json +0 -1
  106. package/.local/share/opencode/storage/session_diff/ses_36886e68dffeKVgUWf6lzXdEEt.json +0 -1
  107. package/.local/share/opencode/storage/session_diff/ses_36bee9f1effeJbiHHLWLR6O3WJ.json +0 -1
  108. package/.local/share/opencode/storage/session_diff/ses_36c25e50affef2nhaXq9aSgKH3.json +0 -1
  109. package/.local/share/opencode/storage/session_diff/ses_36c260708ffel4wG4yhdo0knDD.json +0 -1
  110. package/.local/share/opencode/storage/session_diff/ses_36c261531ffeoVcvqXxry2bN9H.json +0 -1
  111. package/.local/share/opencode/storage/session_diff/ses_36c291bddffePWRiaFLLJAC1y7.json +0 -1
  112. package/.local/share/opencode/storage/session_diff/ses_36c2af1c5ffegxEaOZOGcVykyy.json +0 -1
  113. package/.local/share/opencode/storage/session_diff/ses_36c2be235ffeOa6x8UCk1HW4kU.json +0 -1
  114. package/.local/share/opencode/tool-output/tool_c93da840c0016GrdyAkOnHGezU +0 -2330
  115. package/.local/share/opencode/tool-output/tool_c9411e784001cRoQqwVDb1a6lY +0 -1017
  116. package/.local/state/replit/log-query.db +0 -0
  117. package/.local/state/replit/log-query.db-shm +0 -0
  118. package/.local/state/replit/log-query.db-wal +0 -0
  119. package/.replit +0 -41
  120. package/.upm/store.json +0 -1
  121. package/AGENTS.md +0 -28
  122. package/bun.lock +0 -271
  123. package/generated-icon.png +0 -0
  124. package/hello.txt +0 -1
  125. package/index.jsx +0 -24
  126. package/src/agent.js +0 -504
  127. package/src/app.jsx +0 -96
  128. package/src/commands.js +0 -133
  129. package/src/components/AssistantMessage.jsx +0 -83
  130. package/src/components/ChatArea.jsx +0 -84
  131. package/src/components/DiffView.jsx +0 -26
  132. package/src/components/Divider.jsx +0 -8
  133. package/src/components/Header.jsx +0 -44
  134. package/src/components/HelpModal.jsx +0 -81
  135. package/src/components/InputBar.jsx +0 -32
  136. package/src/components/Spinner.jsx +0 -23
  137. package/src/components/StatusBar.jsx +0 -44
  138. package/src/components/SystemMessage.jsx +0 -31
  139. package/src/components/ThinkBlock.jsx +0 -29
  140. package/src/components/ToolCallItem.jsx +0 -43
  141. package/src/components/UserMessage.jsx +0 -11
  142. package/src/components/Welcome.jsx +0 -14
  143. package/src/config.js +0 -196
  144. package/src/hooks/useLayout.js +0 -15
  145. package/src/hooks/useStore.js +0 -6
  146. package/src/prompt.js +0 -101
  147. package/src/store.js +0 -99
  148. package/src/theme.js +0 -19
  149. package/src/thinking.js +0 -54
  150. package/src/toolExecutors.js +0 -853
  151. package/src/tools.js +0 -335
  152. package/src/utils.js +0 -32
  153. package/tsconfig.json +0 -10
@@ -1,1611 +0,0 @@
1
- {
2
- "v": 2310,
3
- "id": "T-019c97ea-44c6-75b8-88bc-d88113194f6a",
4
- "created": 1772075238612,
5
- "messages": [
6
- {
7
- "role": "user",
8
- "messageId": 0,
9
- "content": [
10
- {
11
- "type": "text",
12
- "text": "hi"
13
- }
14
- ],
15
- "userState": {
16
- "currentlyVisibleFiles": []
17
- },
18
- "agentMode": "smart",
19
- "meta": {
20
- "sentAt": 1772075249760
21
- }
22
- },
23
- {
24
- "role": "assistant",
25
- "messageId": 1,
26
- "content": [
27
- {
28
- "type": "text",
29
- "text": "\n\nHi! How can I help you today? 😊"
30
- }
31
- ],
32
- "state": {
33
- "type": "complete",
34
- "stopReason": "end_turn"
35
- },
36
- "usage": {
37
- "model": "claude-opus-4-6",
38
- "maxInputTokens": 168000,
39
- "inputTokens": 3,
40
- "outputTokens": 16,
41
- "cacheCreationInputTokens": 1190,
42
- "cacheReadInputTokens": 13127,
43
- "totalInputTokens": 14320,
44
- "timestamp": "2026-02-26T03:07:31.914Z"
45
- },
46
- "turnElapsedMs": 2154
47
- },
48
- {
49
- "role": "user",
50
- "messageId": 2,
51
- "content": [
52
- {
53
- "type": "text",
54
- "text": "look at openai codex CLI and claude code CLI's system prompt from their github repo, then modify this system prompt to make sure it works as intended."
55
- }
56
- ],
57
- "userState": {
58
- "currentlyVisibleFiles": []
59
- },
60
- "agentMode": "smart",
61
- "meta": {
62
- "sentAt": 1772075314951
63
- }
64
- },
65
- {
66
- "role": "assistant",
67
- "messageId": 3,
68
- "content": [
69
- {
70
- "type": "text",
71
- "text": "\n\n"
72
- },
73
- {
74
- "type": "thinking",
75
- "thinking": "The user wants me to look at the system prompts from OpenAI Codex CLI and Claude Code CLI from their GitHub repos, then modify a system prompt in their workspace. Let me first find these system prompts and also look at what's in the user's workspace.",
76
- "signature": "EqUDCkgICxACGAIqQAuzU03oD/HTHEVi5u3eFWnVPa1V39O/1SyP0P6NARd1rBQRImrKh3FRCy1S4Orjms2+G6rHpzi8E1SC1hR3ancSDDxQRBNgOCNeyIyG6xoMyY+3s5EZUgXiUPJlIjBWeeCTIis73/bdV4Tn9+TKEGZglypOOBoyOLXvZFmdgIYANAzsT5Uu3/J7U/esQw8qigJcdUXPAE9y3mCe9jrpH/e1YJfF7mLjW09z1QfPZoxW1nKNIPes82oZA0lTWg2SE57rfFsgLaWJquzBy8rJjZmedfyej0MLOkTsTmbucvaFqIrM+gccNe78NaxtST39m1B1bYnFIXpsqIPoJTdD5z+lw8nOsTOXdh101UOJK7b85kubfY/aJEAQqNDwEx5yKScfktWP8jD//8F5NpY3UhHIPr7IDGGTOwxUYbrHO5W3gjjf0fdYWr9fyTZkhp7RA/PryN7LvDnQrVjlbz5BKctl/OqorszUAaVW8ihyBthCxqCWjlfLOPo6Uyt9/VjWNf030e69dHNSgV8cPy4yG1StfpmV6jeed/uP2hgB",
77
- "provider": "anthropic"
78
- },
79
- {
80
- "type": "text",
81
- "text": "Let me look at both system prompts and the current workspace files."
82
- },
83
- {
84
- "type": "tool_use",
85
- "complete": true,
86
- "id": "toolu_vrtx_01SA27qmfpx955QvZBD1MytF",
87
- "name": "librarian",
88
- "input": {
89
- "query": "Find the system prompt used by OpenAI Codex CLI in the openai/codex repository on GitHub. Look for the main system prompt or instructions that define how the CLI agent behaves.",
90
- "context": "I need to find the full system prompt text used by the Codex CLI agent, likely in a file like system-prompt.ts, instructions.md, or similar."
91
- }
92
- },
93
- {
94
- "type": "tool_use",
95
- "complete": true,
96
- "id": "toolu_vrtx_01ENjivphj3j4CA5j65oBAas",
97
- "name": "librarian",
98
- "input": {
99
- "query": "Find the system prompt used by Claude Code CLI (Anthropic's claude-code or claude-cli) in its GitHub repository. Look for the main system prompt or instructions that define how the CLI agent behaves.",
100
- "context": "I need to find the full system prompt text used by Claude Code CLI agent, likely in a file containing system instructions or agent behavior definitions."
101
- }
102
- },
103
- {
104
- "type": "tool_use",
105
- "complete": true,
106
- "id": "toolu_vrtx_01QhDAW2gyqhMRkCVDg8DyB2",
107
- "name": "Read",
108
- "input": {
109
- "path": "/home/runner/workspace"
110
- }
111
- }
112
- ],
113
- "state": {
114
- "type": "complete",
115
- "stopReason": "tool_use"
116
- },
117
- "usage": {
118
- "model": "claude-opus-4-6",
119
- "maxInputTokens": 168000,
120
- "inputTokens": 3,
121
- "outputTokens": 389,
122
- "cacheCreationInputTokens": 1255,
123
- "cacheReadInputTokens": 13127,
124
- "totalInputTokens": 14385,
125
- "timestamp": "2026-02-26T03:08:44.259Z"
126
- }
127
- },
128
- {
129
- "role": "user",
130
- "messageId": 4,
131
- "content": [
132
- {
133
- "type": "tool_result",
134
- "toolUseID": "toolu_vrtx_01SA27qmfpx955QvZBD1MytF",
135
- "run": {
136
- "status": "cancelled",
137
- "reason": "user:interrupted"
138
- }
139
- },
140
- {
141
- "type": "tool_result",
142
- "toolUseID": "toolu_vrtx_01ENjivphj3j4CA5j65oBAas",
143
- "run": {
144
- "status": "done",
145
- "result": "Claude Code is a closed-source, proprietary CLI tool from Anthropic — **it does not have a public GitHub repository**. Anthropic has not open-sourced Claude Code (also marketed as \"Claude Code CLI\" or the VS Code/IDE agent experience), so there is no public GitHub repo with its source code or system prompt to inspect directly.\n\n## What We Know About Claude Code's System Prompt\n\nClaude Code's system prompt is **not publicly available in any GitHub repository**. It is embedded in the compiled/distributed npm package (`@anthropic-ai/claude-code`) and is intentionally not open-sourced.\n\nHowever, the system prompt has been **extracted and shared by the community** through reverse engineering the npm package. Here are the key findings from that research:\n\n### How to Find It Yourself (from the npm package)\n\nThe system prompt is embedded in the distributed CLI. You can extract it by:\n\n```bash\n# Install the package\nnpm install -g @anthropic-ai/claude-code\n\n# Find the installed location and inspect the bundled JS\ncat $(npm root -g)/@anthropic-ai/claude-code/cli.js | grep -A 100 \"system\"\n```\n\nOr by using a JavaScript debugger/deobfuscator on the bundled `cli.js`.\n\n### Known System Prompt Contents (Community-Extracted)\n\nBased on community reverse-engineering efforts (e.g., shared on GitHub Gists and Reddit), the Claude Code system prompt includes sections like:\n\n- **Role definition**: Claude is described as an expert software engineer\n- **Tool use instructions**: Guidelines for using bash, file reading/writing, and search tools\n- **Coding conventions**: Instructions to prefer editing existing files over creating new ones, follow existing code style, etc.\n- **Safety rules**: Never run destructive commands without confirmation, avoid `rm -rf`, etc.\n- **Conciseness**: Instructions to avoid unnecessary verbosity in responses\n- **Git behavior**: Commit message style, when to commit, etc.\n\n### Where to Look\n\nThe closest public resources are:\n\n1. **npm package source**: `https://www.npmjs.com/package/@anthropic-ai/claude-code` — the `cli.js` bundle contains the embedded prompt\n2. **Community extractions**: Searches on GitHub Gist for `\"claude code system prompt\"` surface community-shared extractions\n3. **Anthropic's model specification**: [`https://github.com/anthropics/model-spec`](https://github.com/anthropics/model-spec) — public doc on Claude's values/behavior (not the CLI-specific prompt, but related)\n\n### Summary\n\n| Aspect | Status |\n|---|---|\n| Claude Code GitHub repo | ❌ Does not exist publicly |\n| System prompt in open source | ❌ Not open-sourced |\n| System prompt extractable from npm | ✅ Possible via reverse engineering |\n| Official documentation of the prompt | ❌ Not published by Anthropic |\n\nIf you need the exact current text, the most reliable path is to extract it from the npm package directly, as the prompt changes with each release and community-shared versions may be outdated.",
146
- "progress": [
147
- {
148
- "message": "",
149
- "tool_uses": [
150
- {
151
- "tool_name": "list_repositories",
152
- "status": "done",
153
- "input": {
154
- "organization": "anthropics",
155
- "pattern": "claude"
156
- },
157
- "result": {
158
- "repositories": [],
159
- "totalCount": 0
160
- }
161
- }
162
- ]
163
- },
164
- {
165
- "message": "",
166
- "tool_uses": [
167
- {
168
- "tool_name": "list_repositories",
169
- "status": "done",
170
- "input": {
171
- "organization": "anthropics"
172
- },
173
- "result": {
174
- "repositories": [],
175
- "totalCount": 0
176
- }
177
- }
178
- ]
179
- },
180
- {
181
- "message": "",
182
- "tool_uses": [
183
- {
184
- "tool_name": "list_repositories",
185
- "status": "done",
186
- "input": {
187
- "pattern": "claude-code"
188
- },
189
- "result": {
190
- "repositories": [],
191
- "totalCount": 0
192
- }
193
- }
194
- ]
195
- },
196
- {
197
- "message": "",
198
- "tool_uses": [
199
- {
200
- "tool_name": "search_github",
201
- "status": "error",
202
- "input": {
203
- "pattern": "system prompt agent language:typescript",
204
- "repository": "https://github.com/anthropics/claude-code"
205
- },
206
- "result": {
207
- "message": "Failed to search code: 502 Bad Gateway"
208
- }
209
- },
210
- {
211
- "tool_name": "list_directory_github",
212
- "status": "error",
213
- "input": {
214
- "path": ".",
215
- "repository": "https://github.com/anthropics/claude-code"
216
- },
217
- "result": {
218
- "message": "Failed to list directory: 502 Bad Gateway"
219
- }
220
- }
221
- ]
222
- },
223
- {
224
- "message": "",
225
- "tool_uses": [
226
- {
227
- "tool_name": "list_repositories",
228
- "status": "done",
229
- "input": {
230
- "organization": "anthropics",
231
- "pattern": "cli"
232
- },
233
- "result": {
234
- "repositories": [],
235
- "totalCount": 0
236
- }
237
- },
238
- {
239
- "tool_name": "list_repositories",
240
- "status": "done",
241
- "input": {
242
- "pattern": "claude-cli"
243
- },
244
- "result": {
245
- "repositories": [],
246
- "totalCount": 0
247
- }
248
- }
249
- ]
250
- },
251
- {
252
- "message": "",
253
- "tool_uses": [
254
- {
255
- "tool_name": "list_directory_github",
256
- "status": "error",
257
- "input": {
258
- "path": ".",
259
- "repository": "https://github.com/anthropics/anthropic-sdk-python"
260
- },
261
- "result": {
262
- "message": "Failed to list directory: 502 Bad Gateway"
263
- }
264
- },
265
- {
266
- "tool_name": "list_directory_github",
267
- "status": "error",
268
- "input": {
269
- "path": ".",
270
- "repository": "https://github.com/anthropics/claude-engineer"
271
- },
272
- "result": {
273
- "message": "Failed to list directory: 502 Bad Gateway"
274
- }
275
- }
276
- ]
277
- },
278
- {
279
- "message": "Claude Code is a closed-source, proprietary CLI tool from Anthropic — **it does not have a public GitHub repository**. Anthropic has not open-sourced Claude Code (also marketed as \"Claude Code CLI\" or the VS Code/IDE agent experience), so there is no public GitHub repo with its source code or system prompt to inspect directly.\n\n## What We Know About Claude Code's System Prompt\n\nClaude Code's system prompt is **not publicly available in any GitHub repository**. It is embedded in the compiled/distributed npm package (`@anthropic-ai/claude-code`) and is intentionally not open-sourced.\n\nHowever, the system prompt has been **extracted and shared by the community** through reverse engineering the npm package. Here are the key findings from that research:\n\n### How to Find It Yourself (from the npm package)\n\nThe system prompt is embedded in the distributed CLI. You can extract it by:\n\n```bash\n# Install the package\nnpm install -g @anthropic-ai/claude-code\n\n# Find the installed location and inspect the bundled JS\ncat $(npm root -g)/@anthropic-ai/claude-code/cli.js | grep -A 100 \"system\"\n```\n\nOr by using a JavaScript debugger/deobfuscator on the bundled `cli.js`.\n\n### Known System Prompt Contents (Community-Extracted)\n\nBased on community reverse-engineering efforts (e.g., shared on GitHub Gists and Reddit), the Claude Code system prompt includes sections like:\n\n- **Role definition**: Claude is described as an expert software engineer\n- **Tool use instructions**: Guidelines for using bash, file reading/writing, and search tools\n- **Coding conventions**: Instructions to prefer editing existing files over creating new ones, follow existing code style, etc.\n- **Safety rules**: Never run destructive commands without confirmation, avoid `rm -rf`, etc.\n- **Conciseness**: Instructions to avoid unnecessary verbosity in responses\n- **Git behavior**: Commit message style, when to commit, etc.\n\n### Where to Look\n\nThe closest public resources are:\n\n1. **npm package source**: `https://www.npmjs.com/package/@anthropic-ai/claude-code` — the `cli.js` bundle contains the embedded prompt\n2. **Community extractions**: Searches on GitHub Gist for `\"claude code system prompt\"` surface community-shared extractions\n3. **Anthropic's model specification**: [`https://github.com/anthropics/model-spec`](https://github.com/anthropics/model-spec) — public doc on Claude's values/behavior (not the CLI-specific prompt, but related)\n\n### Summary\n\n| Aspect | Status |\n|---|---|\n| Claude Code GitHub repo | ❌ Does not exist publicly |\n| System prompt in open source | ❌ Not open-sourced |\n| System prompt extractable from npm | ✅ Possible via reverse engineering |\n| Official documentation of the prompt | ❌ Not published by Anthropic |\n\nIf you need the exact current text, the most reliable path is to extract it from the npm package directly, as the prompt changes with each release and community-shared versions may be outdated.",
280
- "tool_uses": []
281
- }
282
- ],
283
- "~debug": {
284
- "inferences": [
285
- {
286
- "inferenceTimeMs": 1909.8423839999996,
287
- "usage": {
288
- "maxInputTokens": 0,
289
- "inputTokens": 0,
290
- "outputTokens": 0,
291
- "cacheCreationInputTokens": null,
292
- "cacheReadInputTokens": null,
293
- "totalInputTokens": 0,
294
- "timestamp": "2026-02-26T03:10:17.740Z"
295
- }
296
- },
297
- {
298
- "inferenceTimeMs": 1490.1076710000016,
299
- "usage": {
300
- "maxInputTokens": 0,
301
- "inputTokens": 0,
302
- "outputTokens": 0,
303
- "cacheCreationInputTokens": null,
304
- "cacheReadInputTokens": null,
305
- "totalInputTokens": 0,
306
- "timestamp": "2026-02-26T03:10:20.389Z"
307
- }
308
- },
309
- {
310
- "inferenceTimeMs": 1476.7060210000018,
311
- "usage": {
312
- "maxInputTokens": 0,
313
- "inputTokens": 0,
314
- "outputTokens": 0,
315
- "cacheCreationInputTokens": null,
316
- "cacheReadInputTokens": null,
317
- "totalInputTokens": 0,
318
- "timestamp": "2026-02-26T03:10:22.475Z"
319
- }
320
- },
321
- {
322
- "inferenceTimeMs": 2601.3103790000023,
323
- "usage": {
324
- "maxInputTokens": 0,
325
- "inputTokens": 0,
326
- "outputTokens": 0,
327
- "cacheCreationInputTokens": null,
328
- "cacheReadInputTokens": null,
329
- "totalInputTokens": 0,
330
- "timestamp": "2026-02-26T03:10:25.690Z"
331
- }
332
- },
333
- {
334
- "inferenceTimeMs": 1851.2706020000041,
335
- "usage": {
336
- "maxInputTokens": 0,
337
- "inputTokens": 0,
338
- "outputTokens": 0,
339
- "cacheCreationInputTokens": null,
340
- "cacheReadInputTokens": null,
341
- "totalInputTokens": 0,
342
- "timestamp": "2026-02-26T03:10:28.112Z"
343
- }
344
- },
345
- {
346
- "inferenceTimeMs": 2187.798434999997,
347
- "usage": {
348
- "maxInputTokens": 0,
349
- "inputTokens": 0,
350
- "outputTokens": 0,
351
- "cacheCreationInputTokens": null,
352
- "cacheReadInputTokens": null,
353
- "totalInputTokens": 0,
354
- "timestamp": "2026-02-26T03:10:30.928Z"
355
- }
356
- },
357
- {
358
- "inferenceTimeMs": 17142.104195,
359
- "usage": {
360
- "maxInputTokens": 0,
361
- "inputTokens": 0,
362
- "outputTokens": 0,
363
- "cacheCreationInputTokens": null,
364
- "cacheReadInputTokens": null,
365
- "totalInputTokens": 0,
366
- "timestamp": "2026-02-26T03:10:48.679Z"
367
- }
368
- }
369
- ]
370
- }
371
- }
372
- },
373
- {
374
- "type": "tool_result",
375
- "toolUseID": "toolu_vrtx_01QhDAW2gyqhMRkCVDg8DyB2",
376
- "run": {
377
- "status": "done",
378
- "progress": {},
379
- "result": {
380
- "absolutePath": "/home/runner/workspace",
381
- "content": ".cache/\n.config/\n.local/\n.sisyphus/\n.upm/\nnode_modules/\nsrc/\n.gitignore\n.replit\nbun.lock\ngenerated-icon.png\nhello.txt\nindex.js\npackage-lock.json\npackage.json",
382
- "isDirectory": true,
383
- "directoryEntries": [
384
- ".cache/",
385
- ".config/",
386
- ".local/",
387
- ".sisyphus/",
388
- ".upm/",
389
- "node_modules/",
390
- "src/",
391
- ".gitignore",
392
- ".replit",
393
- "bun.lock",
394
- "generated-icon.png",
395
- "hello.txt",
396
- "index.js",
397
- "package-lock.json",
398
- "package.json"
399
- ]
400
- },
401
- "trackFiles": [
402
- "file:///home/runner/workspace"
403
- ]
404
- }
405
- }
406
- ]
407
- },
408
- {
409
- "role": "user",
410
- "messageId": 5,
411
- "content": [
412
- {
413
- "type": "text",
414
- "text": "."
415
- }
416
- ],
417
- "userState": {
418
- "currentlyVisibleFiles": []
419
- },
420
- "agentMode": "smart",
421
- "meta": {
422
- "sentAt": 1772075464910
423
- }
424
- },
425
- {
426
- "role": "assistant",
427
- "messageId": 6,
428
- "content": [
429
- {
430
- "type": "text",
431
- "text": "\n\n"
432
- },
433
- {
434
- "type": "thinking",
435
- "thinking": "The user wants me to continue. The librarian call for OpenAI Codex was cancelled, so let me try again. Let me also look at the workspace files to understand what system prompt they want me to modify. Let me search for the Codex CLI system prompt on GitHub directly, and also look at the src/ directory and other files in the workspace.",
436
- "signature": "EvoDCkgICxACGAIqQMt4kiozE1TPpXXN8yBW+kkKKVwK+Hdkotz0SBtcl2OEHLTH8MdlnLsIbbGjkxHWiB+PNb08S2RmtAeI0uLlqFsSDOCfRxg9FzAC1mtZ+hoMpd/6Qva8sjBG6VznIjA96uWgadq6oMjHDDJPZ7eOq0nqfCpdUI5SylaPOYhmrF4GFa5K2gGEncOkQnRtdaQq3wJnmVB8/1fHNZ9EjcNw0QbBWrtthTwaTrGGjJK5VptZFfyt5pQC3T0UNYY9s3J1ARtlF/VRabilM5rDYYLXwbg4JJ4bMryGeTSIx21xlomzwOnXYzStlXEPhd2W2nRAFB3dNYRsJeTXVQrPDTxZeEMvnP/bRcUeQUoBtyZXrH7suNdV4eS5EzHWI2WU4vUWkdNkEvkr/gSyIVBKEMMpK6BVjM93jtFmQmyQF5k+JifA2bTUMRl+io+vbUsRMLDVbC+Z/3oPh9k177Alsi6wnzi5hEQFSX2D/B4dTrBZcyqAN2ycH0vn//LVkbtyAhGeJRxXC5Fn7mvhVo2fBWXOFdYamTkDX9YHStwND7PZDG29GqTLXAe5OxAwMIQCvRv/4fGiZOZbdr0mrN/Ox1VJZMa+yKUk9MMASjmRIUJfN/LwbWVznYVof69vYItz3+16xBoIQirnIyTpy5dU3Qudz8gYAQ==",
437
- "provider": "anthropic"
438
- },
439
- {
440
- "type": "text",
441
- "text": "Let me search for both system prompts and explore the workspace."
442
- },
443
- {
444
- "type": "tool_use",
445
- "complete": true,
446
- "id": "toolu_vrtx_0121BFAA7gd1sqZkiL4yR3xo",
447
- "name": "read_web_page",
448
- "input": {
449
- "url": "https://github.com/openai/codex",
450
- "objective": "Find the system prompt file or instructions used by Codex CLI agent"
451
- }
452
- },
453
- {
454
- "type": "tool_use",
455
- "complete": true,
456
- "id": "toolu_vrtx_018aF8xr7xk8A9aMok7sRDo6",
457
- "name": "Read",
458
- "input": {
459
- "path": "/home/runner/workspace/src"
460
- }
461
- },
462
- {
463
- "type": "tool_use",
464
- "complete": true,
465
- "id": "toolu_vrtx_01EWg7LJrqhnfi7SkJpLbTsF",
466
- "name": "Read",
467
- "input": {
468
- "path": "/home/runner/workspace/index.js"
469
- }
470
- },
471
- {
472
- "type": "tool_use",
473
- "complete": true,
474
- "id": "toolu_vrtx_01Qhpisx66ZCEtxhNugW9vmZ",
475
- "name": "Read",
476
- "input": {
477
- "path": "/home/runner/workspace/package.json"
478
- }
479
- }
480
- ],
481
- "state": {
482
- "type": "complete",
483
- "stopReason": "tool_use"
484
- },
485
- "usage": {
486
- "model": "claude-opus-4-6",
487
- "maxInputTokens": 168000,
488
- "inputTokens": 3,
489
- "outputTokens": 328,
490
- "cacheCreationInputTokens": 1451,
491
- "cacheReadInputTokens": 14317,
492
- "totalInputTokens": 15771,
493
- "timestamp": "2026-02-26T03:11:11.979Z"
494
- }
495
- },
496
- {
497
- "role": "user",
498
- "messageId": 7,
499
- "content": [
500
- {
501
- "type": "tool_result",
502
- "toolUseID": "toolu_vrtx_0121BFAA7gd1sqZkiL4yR3xo",
503
- "run": {
504
- "status": "done",
505
- "result": "Section Title: Navigation Menu\nContent:\nToggle navigation\nAppearance settings\nSection Title: Navigation Menu\nContent:\nPlatform[View all features](https://github.com/features)\nDEVELOPER WORKFLOWS\n[Actions Automate any workflow](https://github.com/features/actions)\n[Codespaces Instant dev environments](https://github.com/features/codespaces)\n[Issues Plan and track work](https://github.com/features/issues)\n[Code Review Manage code changes](https://github.com/features/code-review)\nAPPLICATION SECURITY\n[GitHub Advanced Security Find and fix vulnerabilities](https://github.com/security/advanced-security)\n[Code security Secure your code as you build](https://github.com/security/advanced-security/code-security)\n[Secret protection Stop leaks before they start](https://github.com/security/advanced-security/secret-protection)\nEXPLORE\n[Why GitHub](https://github.com/why-github)\n[Documentation](https://docs.github.com)\n[Blog](https://github.blog)\n[Changelog](https://github.blog/changelog)\n[Marketplace](https://github.com/marketplace)\nSolutions[View all solutions](https://github.com/solutions)\nBY\nSection Title: Navigation Menu\nContent:\nUSE CASE\n[App Modernization](https://github.com/solutions/use-case/app-modernization)\n[DevSecOps](https://github.com/solutions/use-case/devsecops)\n[DevOps](https://github.com/solutions/use-case/devops)\n[CI/CD](https://github.com/solutions/use-case/ci-cd)\n[View all use cases](https://github.com/solutions/use-case)\nBY INDUSTRY\n[Healthcare](https://github.com/solutions/industry/healthcare)\n[Financial services](https://github.com/solutions/industry/financial-services)\n[Manufacturing](https://github.com/solutions/industry/manufacturing)\n[Government](https://github.com/solutions/industry/government)\n[View all industries](https://github.com/solutions/industry)\nResources[View all resources](https://github.com/resources)\nEXPLORE BY TYPE\n[Customer stories](https://github.com/customer-stories)\n[Events & webinars](https://github.com/resources/events)\n[Ebooks & reports](https://github.com/resources/whitepapers)\n[Business\nSection Title: Navigation Menu\nContent:\ninsights](https://github.com/solutions/executive-insights)\n[GitHub Skills](https://skills.github.com)\nSUPPORT & SERVICES\n[Documentation](https://docs.github.com)\n[Customer support](https://support.github.com)\n[Community forum](https://github.com/orgs/community/discussions)\n[Trust center](https://github.com/trust-center)\n[Partners](https://github.com/partners)\nOpen Source\nPROGRAMS\n[Security Lab](https://securitylab.github.com)\n[Maintainer Community](https://maintainers.github.com)\n[Accelerator](https://github.com/accelerator)\n[Archive Program](https://archiveprogram.github.com)\nREPOSITORIES\n[Topics](https://github.com/topics)\n[Trending](https://github.com/trending)\n[Collections](https://github.com/collections)\nEnterprise\nAVAILABLE ADD-ONS\n[GitHub Advanced Security Enterprise-grade security features](https://github.com/security/advanced-security)\n[Copilot for Business Enterprise-grade AI features](https://github.com/features/copilot/copilot-business)\n[Premium Support\nSection Title: Navigation Menu\nContent:\nEnterprise-grade 24/7 support](https://github.com/premium-support)\n[Pricing](https://github.com/pricing)\nSection Title: Navigation Menu\nContent:\nSearch or jump to...\nSection Title: Search code, repositories, users, issues, pull requests...\nContent:\nSearch\nClear\n[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)\nAppearance settings\nResetting focus\nYou signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert\nopenai / **codex** Public\nNotifications You must be signed in to change notification settings\nFork 8.2k\nStar 61.9k\nLightweight coding agent that runs in your terminal\nSection Title: Search code, repositories, users, issues, pull requests... > License\nContent:\nApache-2.0 license\n61.9k stars 8.2k forks Branches Tags Activity\nStar\nNotifications You must be signed in to change notification settings\nCode\nIssues 1.2k\nPull requests 128\nDiscussions\nActions\nSecurity 1\nInsights\nAdditional navigation options * Code\nIssues\nPull requests\nDiscussions\nActions\nSecurity\nInsights\nSection Title: openai/codex\nContent:\nmain\nBranches Tags\nGo to file\nCode\nOpen more actions menu\nSection Title: openai/codex > Folders and files\nContent:\n| Name | Name | Last commit message | Last commit date |\n| ## Latest commit | | | |\nSection Title: openai/codex > History\nContent:\n4,037 Commits\nSection Title: openai/codex > History\nContent:\n4,037 Commits |\n|.codex/ skills |.codex/ skills | | |\n|.devcontainer |.devcontainer | | |\n|.github |.github | | |\n|.vscode |.vscode | | |\n|codex-cli |codex-cli | | |\n|codex-rs |codex-rs | | |\n|docs |docs | | |\n|patches |patches | | |\n|scripts |scripts | | |\n|sdk/ typescript |sdk/ typescript | | |\n|shell-tool-mcp |shell-tool-mcp | | |\n|third_party |third_party | | |\n|.bazelignore |.bazelignore | | |\n|.bazelrc |.bazelrc | | |\n|.bazelversion |.bazelversion | | |\n|.codespellignore |.codespellignore | | |\n|.codespellrc |.codespellrc | | |\n|.gitignore |.gitignore | | |\n|.markdownlint-cli2.yaml |.markdownlint-cli2.yaml | | |\n|.npmrc |.npmrc | | |\n|.prettierignore |.prettierignore | | |\n|.prettierrc.toml |.prettierrc.toml | | |\n|AGENTS.md |AGENTS.md | | |\n|BUILD.bazel |BUILD.bazel | | |\n|CHANGELOG.md |CHANGELOG.md | | |\n|LICENSE |LICENSE | | |\n|MODULE.bazel |MODULE.bazel | | |\n|MODULE.bazel.lock |MODULE.bazel.lock | | |\n|NOTICE |NOTICE | | |\n|README.md |README.md | |\nSection Title: openai/codex > History\nContent:\n|\n|SECURITY.md |SECURITY.md | | |\n|announcement_tip.toml |announcement_tip.toml | | |\n|cliff.toml |cliff.toml | | |\n|defs.bzl |defs.bzl | | |\n|flake.lock |flake.lock | | |\n|flake.nix |flake.nix | | |\n|justfile |justfile | | |\n|package.json |package.json | | |\n|pnpm-lock.yaml |pnpm-lock.yaml | | |\n|pnpm-workspace.yaml |pnpm-workspace.yaml | | |\n|rbe.bzl |rbe.bzl | | |\n|View all files |\nSection Title: openai/codex > Repository files navigation\nContent:\nREADME\nContributing\nApache-2.0 license\nSecurity\n`npm i -g @openai/codex`\nor `brew install --cask codex`\n**Codex CLI** is a coding agent from OpenAI that runs locally on your computer.\n[](https://github.com/openai/codex/blob/main/.github/codex-cli-splash.png)\nIf you want Codex in your code editor (VS Code, Cursor, Windsurf), [install in your IDE.](https://developers.openai.com/codex/ide)\nIf you want the desktop app experience, run `codex app` or visit [the Codex App page](https://chatgpt.com/codex?app-landing-page=true) .\nIf you are looking for the *cloud-based agent* from OpenAI, **Codex Web** , go to [chatgpt.com/codex](https://chatgpt.com/codex) .\nSection Title: openai/codex > Quickstart > Installing and running Codex CLI\nContent:\nInstall globally with your preferred package manager:\n```\n# Install using npm \nnpm install -g @openai/codex\n```\n```\n# Install using Homebrew \nbrew install --cask codex\n```\nThen simply run `codex` to get started.\nSection Title: openai/codex > Quickstart > Using Codex with your ChatGPT plan\nContent:\nRun `codex` and select **Sign in with ChatGPT** . We recommend signing into your ChatGPT account to use Codex as part of your Plus, Pro, Team, Edu, or Enterprise plan. [Learn more about what's included in your ChatGPT plan](https://help.openai.com/en/articles/11369540-codex-in-chatgpt) .\nYou can also use Codex with an API key, but this requires [additional setup](https://developers.openai.com/codex/auth) .\nSection Title: openai/codex > Docs\nContent:\n[**Codex Documentation**](https://developers.openai.com/codex)\n**Contributing**\n**Installing & building**\n**Open source fund**\nThis repository is licensed under the Apache-2.0 License .\nSection Title: openai/codex > About\nContent:\nLightweight coding agent that runs in your terminal\nSection Title: openai/codex > About > Resources\nContent:\nReadme\nSection Title: openai/codex > About > License\nContent:\nApache-2.0 license\nSection Title: openai/codex > About > Contributing\nContent:\nContributing\nSection Title: openai/codex > About > Security policy\nContent:\nSecurity policy\nSection Title: openai/codex > About > Uh oh!\nContent:\nThere was an error while loading. Please reload this page .\nActivity\nCustom properties\nSection Title: openai/codex > About > Stars\nContent:\n**61.9k** stars\nSection Title: openai/codex > About > Watchers\nContent:\n**379** watching\nSection Title: openai/codex > About > Forks\nContent:\n**8.2k** forks\nReport repository\nSection Title: openai/codex > Releases 542\nContent:\n0.105.0 Latest Feb 25, 2026\n+ 541 releases\nSection Title: openai/codex > Packages 0\nContent:\nNo packages published\nSection Title: openai/codex > Packages 0 > Uh oh!\nContent:\nThere was an error while loading. Please reload this page .\nSection Title: openai/codex > Contributors 379\nContent:\n[](https://github.com/bolinfest)\n[](https://github.com/jif-oai)\n[](https://github.com/aibrahim-oai)\n[](https://github.com/pakrym-oai)\n[](https://github.com/nornagon-openai)\n[](https://github.com/etraut-openai)\n[](https://github.com/dylan-hurd-oai)\n[](https://github.com/apps/dependabot)\n[](https://github.com/tibo-openai)\n[](https://github.com/joshka-oai)\n[](https://github.com/gpeal)\n[](https://github.com/owenlin0)\n[](https://github.com/iceweasel-oai)\n[](https://github.com/fouad-openai)\n+ 365 contributors\nSection Title: openai/codex > Languages\nContent:\nRust 96.1%\nTypeScript 2.3%\nPython 0.9%\nStarlark 0.2%\nJavaScript 0.2%\nPowerShell 0.1%\nOther 0.2%\nSection Title: openai/codex > Footer\nContent:\nYou can’t perform that action at this time.",
506
- "~debug": {
507
- "showParallelAttribution": false
508
- }
509
- }
510
- },
511
- {
512
- "type": "tool_result",
513
- "toolUseID": "toolu_vrtx_018aF8xr7xk8A9aMok7sRDo6",
514
- "run": {
515
- "status": "done",
516
- "progress": {},
517
- "result": {
518
- "absolutePath": "/home/runner/workspace/src",
519
- "content": "agent.js\ncommands.js\nconfig.js\nprompt.js\nthinking.js\ntoolExecutors.js\ntools.js\nui.js",
520
- "isDirectory": true,
521
- "directoryEntries": [
522
- "agent.js",
523
- "commands.js",
524
- "config.js",
525
- "prompt.js",
526
- "thinking.js",
527
- "toolExecutors.js",
528
- "tools.js",
529
- "ui.js"
530
- ]
531
- },
532
- "trackFiles": [
533
- "file:///home/runner/workspace/src"
534
- ]
535
- }
536
- },
537
- {
538
- "type": "tool_result",
539
- "toolUseID": "toolu_vrtx_01EWg7LJrqhnfi7SkJpLbTsF",
540
- "run": {
541
- "status": "done",
542
- "progress": {},
543
- "result": {
544
- "absolutePath": "/home/runner/workspace/index.js",
545
- "content": "1: #!/usr/bin/env node\n2: 'use strict';\n3: \n4: const { session } = require('./src/config');\n5: const {\n6: t,\n7: indent,\n8: showHeader,\n9: showWelcome,\n10: showPrompt,\n11: showSessionSummary,\n12: createPrompt,\n13: } = require('./src/ui');\n14: const { handleSlashCommand } = require('./src/commands');\n15: const { handleUserInput, setRlClosed, getRlClosed, getIsProcessing } = require('./src/agent');\n16: \n17: // ===== State =====\n18: let rl;\n19: let askQuestion;\n20: \n21: // ===== Input Loop =====\n22: function setupInputLoop() {\n23: setRlClosed(false);\n24: rl = createPrompt();\n25: \n26: rl.on('close', () => {\n27: setRlClosed(true);\n28: if (getIsProcessing()) return;\n29: // If stdin is still usable, re-create readline (e.g. terminal glitch)\n30: if (!process.stdin.destroyed && process.stdin.readable) {\n31: setupInputLoop();\n32: askQuestion();\n33: return;\n34: }\n35: console.log();\n36: showSessionSummary();\n37: console.log(indent(t.dim('Goodbye! ') + t.primary('✦')));\n38: console.log();\n39: process.exit(0);\n40: });\n41: }\n42: \n43: // ===== Main Loop =====\n44: async function main() {\n45: showHeader();\n46: showWelcome();\n47: \n48: setupInputLoop();\n49: \n50: askQuestion = () => {\n51: if (getRlClosed()) return;\n52: process.stdin.resume();\n53: const promptStr = showPrompt();\n54: \n55: rl.question(promptStr, async (answer) => {\n56: if (answer === null || answer === undefined) {\n57: process.exit(0);\n58: }\n59: const input = answer.trim();\n60: \n61: if (!input) { askQuestion(); return; }\n62: \n63: // Slash commands\n64: if (input.startsWith('/')) {\n65: await handleSlashCommand(input, rl);\n66: askQuestion();\n67: return;\n68: }\n69: \n70: if (input === 'exit' || input === 'quit') {\n71: console.log();\n72: showSessionSummary();\n73: console.log(indent(t.dim('Goodbye! ') + t.primary('✦')));\n74: console.log();\n75: process.exit(0);\n76: }\n77: \n78: try {\n79: await handleUserInput(input, { setupInputLoop, askQuestion });\n80: } catch (err) {\n81: console.log(indent(t.red('✗ Unexpected error: ') + t.text(err.message)));\n82: console.log();\n83: }\n84: askQuestion();\n85: });\n86: };\n87: \n88: askQuestion();\n89: }\n90: \n91: // ===== Run =====\n92: main().catch(console.error);"
546
- },
547
- "trackFiles": [
548
- "file:///home/runner/workspace/index.js"
549
- ]
550
- }
551
- },
552
- {
553
- "type": "tool_result",
554
- "toolUseID": "toolu_vrtx_01Qhpisx66ZCEtxhNugW9vmZ",
555
- "run": {
556
- "status": "done",
557
- "progress": {},
558
- "result": {
559
- "absolutePath": "/home/runner/workspace/package.json",
560
- "content": "1: {\n2: \"name\": \"apex-dev\",\n3: \"version\": \"2.1.3\",\n4: \"description\": \"Apex AI - a friendly agentic coding assistant for the terminal\",\n5: \"main\": \"index.js\",\n6: \"bin\": {\n7: \"apex\": \"./index.js\"\n8: },\n9: \"scripts\": {\n10: \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n11: },\n12: \"keywords\": [],\n13: \"author\": \"\",\n14: \"license\": \"ISC\",\n15: \"dependencies\": {\n16: \"@sourcegraph/amp\": \"^0.0.1772067340-g53cd9b\",\n17: \"boxen\": \"^5.1.2\",\n18: \"chalk\": \"^4.1.2\",\n19: \"cli-highlight\": \"^2.1.11\",\n20: \"figures\": \"^3.2.0\",\n21: \"openai\": \"^6.25.0\",\n22: \"opencode-ai\": \"1.2.14\",\n23: \"ora\": \"^5.4.1\",\n24: \"readline\": \"^1.3.0\"\n25: }\n26: }"
561
- },
562
- "trackFiles": [
563
- "file:///home/runner/workspace/package.json"
564
- ]
565
- }
566
- }
567
- ]
568
- },
569
- {
570
- "role": "assistant",
571
- "messageId": 8,
572
- "content": [
573
- {
574
- "type": "thinking",
575
- "thinking": "This is a terminal-based coding assistant called \"Apex AI\". Let me look at the system prompt file and the Codex CLI system prompt. Let me read the prompt.js file and also find the Codex CLI system prompt on GitHub.",
576
- "signature": "EoEDCkgICxACGAIqQDLDcO54jucpw1JEYV6TaPHpuhYc+vfGT9PAazKEsyJ/oE6W5V+uvtOn6e3FglrljsBJFc+93pSUsjRYFSfQg8QSDFXRZwbWvTXP7PE6qxoMi1+ZlC3UvGQKyK0pIjA9XJTWV9bgMwThraZe+P+zMJ11Uh/n9WHWrDayn2dfxSoQNQuvii5BbqkU3tNpdXwq5gHljplxpm41iW2r2VAQ389kPIkaFcDyMLpPssJEbaLfO7Fj50WjR52X0tdCyeKTvfZba9lvGpH9EGpc2JhVfP+TvjLD1U6NtfkjcEyn9YSvDGblIhIJxL9lDoFxd5+Bbo+ExWcC+svh68ShzhQ42dnpofc7tMehCWyT9maeePMyt8HpvLmI2X9DZddWMx13o1+uhQdNp9Q+BckiLJTSUqH2zvuSM82FhwK6zLc6KRHVamxzSkTalCRU9PQP9US7IjNPF6x8akGEySAbAmsHU9w/KKCQfioEJgoFD2w/9W0yL/OyI9jaJBgB",
577
- "provider": "anthropic"
578
- },
579
- {
580
- "type": "text",
581
- "text": "Now let me read the system prompt and the Codex CLI's system prompt from GitHub."
582
- },
583
- {
584
- "type": "tool_use",
585
- "complete": true,
586
- "id": "toolu_vrtx_018aew9JaxemtFHmBcPSXGPL",
587
- "name": "Read",
588
- "input": {
589
- "path": "/home/runner/workspace/src/prompt.js"
590
- }
591
- },
592
- {
593
- "type": "tool_use",
594
- "complete": true,
595
- "id": "toolu_vrtx_019UHN1yNxVkzyeQrqA7YaJ9",
596
- "name": "read_web_page",
597
- "input": {
598
- "url": "https://raw.githubusercontent.com/openai/codex/main/codex-cli/src/utils/agent/instructions.ts",
599
- "objective": "Get the full system prompt / instructions used by the Codex CLI agent"
600
- }
601
- },
602
- {
603
- "type": "tool_use",
604
- "complete": true,
605
- "id": "toolu_vrtx_01FiMjWkWgnNe4J3uakMq5mV",
606
- "name": "Read",
607
- "input": {
608
- "path": "/home/runner/workspace/src/agent.js"
609
- }
610
- },
611
- {
612
- "type": "tool_use",
613
- "complete": true,
614
- "id": "toolu_vrtx_01MXoZeYtxpCktzLfWUWzgqo",
615
- "name": "Read",
616
- "input": {
617
- "path": "/home/runner/workspace/src/tools.js"
618
- }
619
- },
620
- {
621
- "type": "tool_use",
622
- "complete": true,
623
- "id": "toolu_vrtx_01TQYo4jV8L2du4JqXDz6M1t",
624
- "name": "Read",
625
- "input": {
626
- "path": "/home/runner/workspace/src/toolExecutors.js"
627
- }
628
- }
629
- ],
630
- "state": {
631
- "type": "complete",
632
- "stopReason": "tool_use"
633
- },
634
- "usage": {
635
- "model": "claude-opus-4-6",
636
- "maxInputTokens": 168000,
637
- "inputTokens": 1,
638
- "outputTokens": 384,
639
- "cacheCreationInputTokens": 7562,
640
- "cacheReadInputTokens": 13127,
641
- "totalInputTokens": 20690,
642
- "timestamp": "2026-02-26T03:11:23.490Z"
643
- }
644
- },
645
- {
646
- "role": "user",
647
- "messageId": 9,
648
- "content": [
649
- {
650
- "type": "tool_result",
651
- "toolUseID": "toolu_vrtx_018aew9JaxemtFHmBcPSXGPL",
652
- "run": {
653
- "status": "done",
654
- "progress": {},
655
- "result": {
656
- "absolutePath": "/home/runner/workspace/src/prompt.js",
657
- "content": "1: 'use strict';\n2: \n3: const fs = require('fs');\n4: const path = require('path');\n5: const { execSync } = require('child_process');\n6: const { PROJECT_ROOT, MAX_TOOL_ITERATIONS } = require('./config');\n7: \n8: function buildSystemPrompt() {\n9: let gitInfo = '';\n10: try {\n11: const branch = execSync('git rev-parse --abbrev-ref HEAD 2>/dev/null', { encoding: 'utf-8', cwd: PROJECT_ROOT }).trim();\n12: const status = execSync('git status --short 2>/dev/null', { encoding: 'utf-8', cwd: PROJECT_ROOT }).trim();\n13: const remoteUrl = execSync('git config --get remote.origin.url 2>/dev/null', { encoding: 'utf-8', cwd: PROJECT_ROOT }).trim();\n14: gitInfo = `\\nGit branch: ${branch}\\nGit remote: ${remoteUrl}\\nGit status:\\n${status || '(clean)'}`;\n15: } catch {}\n16: \n17: let projectInfo = '';\n18: try {\n19: const pkg = JSON.parse(fs.readFileSync(path.join(PROJECT_ROOT, 'package.json'), 'utf-8'));\n20: projectInfo = `\\nProject: ${pkg.name || 'unknown'} v${pkg.version || '0.0.0'}`;\n21: if (pkg.dependencies) projectInfo += `\\nDependencies: ${Object.keys(pkg.dependencies).join(', ')}`;\n22: if (pkg.devDependencies) projectInfo += `\\nDev dependencies: ${Object.keys(pkg.devDependencies).join(', ')}`;\n23: if (pkg.scripts) projectInfo += `\\nScripts: ${Object.keys(pkg.scripts).join(', ')}`;\n24: } catch {}\n25: \n26: return `detailed thinking on\n27: \n28: You are Apex AI, a friendly and approachable coding assistant. You're warm, helpful, and conversational — like a knowledgeable friend who loves coding.\n29: \n30: # Personality\n31: \n32: - Be friendly, warm, and encouraging. Use a casual but professional tone.\n33: - When a user asks a question that doesn't need any tools (like general knowledge, advice, greetings, or casual chat), just answer directly and naturally. You do NOT always need to use tools — only use them when the task actually requires reading, writing, or executing something on the filesystem.\n34: - NEVER say things like \"I don't have any tool to call\" or \"I don't have the tools for that.\" Just respond helpfully with what you know.\n35: - If you're unsure, say so honestly, but still try your best to help.\n36: \n37: # Core Principles\n38: \n39: 1. **Take initiative.** When asked to do something, DO it — don't just explain how. Use your tools to read, write, edit, and execute code until the task is COMPLETE.\n40: 2. **Read before you edit.** NEVER modify a file you haven't read first. Always understand existing code before making changes.\n41: 3. **Work incrementally.** Make small changes, verify they work (run tests, check syntax), then continue. Don't make huge changes blind.\n42: 4. **Verify your work.** After making changes, run the relevant tests, linter, or type checker. If something fails, fix it before responding.\n43: 5. **Follow conventions.** Match the existing code style, frameworks, libraries, and patterns. Check imports and neighboring files first.\n44: 6. **Minimal changes.** Only change what's needed. Don't refactor, add features, or \"improve\" code beyond what was asked.\n45: 7. **Keep going.** If a tool call fails, try to recover. If you need more context, read more files. Don't give up after one attempt.\n46: \n47: # Tool Usage\n48: \n49: - Use Bash for running commands (tests, builds, linters, git operations)\n50: - Use Read to understand files before modifying them\n51: - Use Grep/Glob/ListDir to explore the codebase and find relevant code\n52: - Use Edit for surgical changes to existing files (preferred over Write for existing files)\n53: - Use Write only for creating new files\n54: - Use Patch for making multiple edits to the same file at once\n55: - Execute multiple independent tool calls in parallel when possible\n56: - After editing code, verify with: syntax check, run tests, or at minimum read the changed section\n57: \n58: # Workflow for Code Tasks\n59: \n60: 1. Explore: Use ListDir, Glob, Grep to understand the codebase structure\n61: 2. Read: Read relevant files to understand context, conventions, dependencies\n62: 3. Plan: Think about what changes are needed (briefly)\n63: 4. Implement: Make changes using Edit/Write\n64: 5. Verify: Run tests or check the result with Bash\n65: 6. Iterate: If verification fails, fix and re-verify\n66: 7. Code review is automatic for any files modified\n67: \n68: # Environment\n69: Working directory: ${PROJECT_ROOT}\n70: OS: ${process.platform}\n71: Node: ${process.version}${projectInfo}${gitInfo}\n72: \n73: # Important\n74: - You can call multiple tools at once — do so when the calls are independent\n75: - Don't ask for permission to use tools — just use them\n76: - Don't explain what you're going to do in detail — just do it and summarize what you did\n77: - If the user asks you to fix something, find the bug AND fix it\n78: - If the user pastes an error message or stack trace, DO NOT just explain possible causes or suggest troubleshooting steps. Instead, use your tools to locate the exact source of the error in the codebase (read files, grep for relevant code, trace the stack trace), identify the root cause, and fix it directly. Always act on errors — never punt back to the user with \"try checking X\" or \"this might be caused by Y.\"\n79: - If the user asks you to build something, build it completely and verify it works\n80: - Maximum tool iterations per turn: ${MAX_TOOL_ITERATIONS}`;\n81: }\n82: \n83: module.exports = { buildSystemPrompt };"
658
- },
659
- "trackFiles": [
660
- "file:///home/runner/workspace/src/prompt.js"
661
- ]
662
- }
663
- },
664
- {
665
- "type": "tool_result",
666
- "toolUseID": "toolu_vrtx_019UHN1yNxVkzyeQrqA7YaJ9",
667
- "run": {
668
- "status": "done",
669
- "result": "404: Not Found",
670
- "~debug": {
671
- "showParallelAttribution": false
672
- }
673
- }
674
- },
675
- {
676
- "type": "tool_result",
677
- "toolUseID": "toolu_vrtx_01FiMjWkWgnNe4J3uakMq5mV",
678
- "run": {
679
- "status": "done",
680
- "progress": {},
681
- "result": {
682
- "absolutePath": "/home/runner/workspace/src/agent.js",
683
- "content": "1: 'use strict';\n2: \n3: const ora = require('ora');\n4: const {\n5: NVIDIA_MODEL,\n6: MAX_TOOL_ITERATIONS,\n7: nvidiaClient,\n8: session,\n9: sleep,\n10: } = require('./config');\n11: const { buildSystemPrompt } = require('./prompt');\n12: const { toolDefs } = require('./tools');\n13: const { executeTool } = require('./toolExecutors');\n14: const {\n15: t,\n16: indent,\n17: hr,\n18: showUserMessage,\n19: showAssistantHeader,\n20: toolDetail,\n21: toolBadge,\n22: showToolCall,\n23: finishToolCall,\n24: showDiff,\n25: } = require('./ui');\n26: const {\n27: parseThinkBlocks,\n28: findThinkClose,\n29: stripStrayCloseTag,\n30: splitAtPartialTag,\n31: showThinkingBlock,\n32: } = require('./thinking');\n33: \n34: // ===== State =====\n35: let isProcessing = false;\n36: let rlClosed = false;\n37: \n38: function getIsProcessing() { return isProcessing; }\n39: function setRlClosed(val) { rlClosed = val; }\n40: function getRlClosed() { return rlClosed; }\n41: \n42: // ===== Exploration Detection =====\n43: const EXPLORATION_KEYWORDS = [\n44: 'explore', 'find files', 'where is', 'search for', 'locate',\n45: 'what files', 'which files', 'show me all', 'list all',\n46: 'find code', 'search code', 'find function', 'find class',\n47: 'find module', 'find component', 'find endpoint', 'find route',\n48: 'find api', 'find service', 'find model', 'find controller',\n49: 'where can i find', 'how do i find', 'look for',\n50: 'codebase structure', 'project structure', 'directory structure'\n51: ];\n52: \n53: function isExplorationTask(text) {\n54: const lower = text.toLowerCase();\n55: return EXPLORATION_KEYWORDS.some(keyword => lower.includes(keyword));\n56: }\n57: // ===== AI Conversation — Agentic Loop =====\n58: async function handleUserInput(userInput, { setupInputLoop, askQuestion }) {\n59: isProcessing = true;\n60: session.turnCount++;\n61: showUserMessage(userInput);\n62: session.conversationHistory.push({ role: 'user', content: userInput });\n63: // Auto-delegate to FilePickerMax for exploration tasks\n64: if (isExplorationTask(userInput)) {\n65: const spinner = ora({\n66: text: t.dim('Exploring codebase...'),\n67: prefixText: ' ',\n68: spinner: 'dots',\n69: color: 'cyan',\n70: }).start();\n71: \n72: try {\n73: const pickerResult = await executeTool('FilePickerMax', {\n74: prompt: userInput,\n75: });\n76: spinner.stop();\n77: \n78: // Display the exploration results prominently\n79: console.log(indent(t.cyan.bold('🔍 Codebase Exploration Results'), 2));\n80: console.log(indent(hr(), 2));\n81: console.log(indent(pickerResult, 2));\n82: console.log(indent(hr(), 2));\n83: console.log();\n84: \n85: // Add to conversation history so the agent has context\n86: session.conversationHistory.push({\n87: role: 'assistant',\n88: content: `I've explored the codebase and found the following relevant files:\\n\\n${pickerResult}`,\n89: });\n90: } catch (err) {\n91: spinner.stop();\n92: console.log(indent(t.dim('(Exploration failed: ' + err.message + ')'), 2));\n93: console.log();\n94: }\n95: }\n96: \n97: const startTime = Date.now();\n98: let turnTokens = 0;\n99: let turnToolCalls = 0;\n100: \n101: try {\n102: showAssistantHeader();\n103: console.log();\n104: \n105: const systemPrompt = buildSystemPrompt();\n106: let messages = [\n107: { role: 'system', content: systemPrompt },\n108: ...session.conversationHistory,\n109: ];\n110: \n111: let iterations = 0;\n112: \n113: // Agentic tool-use loop\n114: while (iterations < MAX_TOOL_ITERATIONS) {\n115: iterations++;\n116: \n117: // Show thinking spinner while waiting for first token\n118: const thinkSpinner = ora({\n119: text: t.dim(iterations === 1 ? 'Reasoning deeply...' : 'Thinking further...'),\n120: prefixText: ' ',\n121: spinner: 'dots',\n122: color: 'magenta',\n123: }).start();\n124: \n125: let stream;\n126: const maxRetries = 3;\n127: for (let attempt = 0; attempt <= maxRetries; attempt++) {\n128: try {\n129: stream = await nvidiaClient.chat.completions.create({\n130: model: NVIDIA_MODEL,\n131: messages: messages.map(m => {\n132: // Strip any extra fields the API might reject\n133: const clean = { role: m.role, content: m.content };\n134: if (m.tool_calls) clean.tool_calls = m.tool_calls.map(tc => ({\n135: id: tc.id, type: 'function',\n136: function: { name: tc.function.name, arguments: tc.function.arguments },\n137: }));\n138: if (m.tool_call_id) clean.tool_call_id = m.tool_call_id;\n139: if (m.role === 'assistant' && !m.content) clean.content = null;\n140: return clean;\n141: }),\n142: max_tokens: 4096,\n143: temperature: 0.6,\n144: top_p: 0.95,\n145: tools: toolDefs,\n146: tool_choice: 'auto',\n147: stream: true,\n148: });\n149: break;\n150: } catch (apiErr) {\n151: if (attempt < maxRetries && apiErr.status >= 400 && apiErr.status < 500) {\n152: const delay = 1000 * Math.pow(2, attempt);\n153: thinkSpinner.text = t.dim(`Retrying (${attempt + 1}/${maxRetries})...`);\n154: await sleep(delay);\n155: continue;\n156: }\n157: thinkSpinner.stop();\n158: throw apiErr;\n159: }\n160: }\n161: \n162: // Accumulate streamed response\n163: let fullContent = '';\n164: const toolCallDeltas = {}; // index -> { id, name, arguments }\n165: const seenToolCalls = new Set(); // Track which tool calls we've streamed\n166: let finishReason = null;\n167: let streamUsage = null;\n168: let reasoningText = ''; // collected reasoning from reasoning_content field\n169: \n170: // Display state:\n171: // 'buffering' — accumulating, watching for <think> or safe-to-stream point\n172: // 'thinking' — inside <think>...</think>, accumulating reasoning\n173: // 'streaming' — think block done, streaming content live to terminal\n174: let displayState = 'buffering';\n175: let contentAccum = ''; // buffer for buffering/thinking states\n176: let thinkAccum = ''; // accumulates text inside <think>...</think>\n177: let streamingStarted = false;\n178: let thinkSpinnerStopped = false;\n179: \n180: function stopThinkSpinner() {\n181: if (!thinkSpinnerStopped) { thinkSpinner.stop(); thinkSpinnerStopped = true; }\n182: }\n183: \n184: function writeToTerminal(text) {\n185: if (!text) return;\n186: if (!streamingStarted) {\n187: streamingStarted = true;\n188: process.stdout.write(' ');\n189: }\n190: process.stdout.write(t.text(text));\n191: }\n192: \n193: for await (const chunk of stream) {\n194: if (chunk.usage) streamUsage = chunk.usage;\n195: \n196: const delta = chunk.choices?.[0]?.delta;\n197: if (!delta) {\n198: if (chunk.choices?.[0]?.finish_reason) finishReason = chunk.choices[0].finish_reason;\n199: continue;\n200: }\n201: if (chunk.choices[0].finish_reason) finishReason = chunk.choices[0].finish_reason;\n202: \n203: // Stream tool call deltas immediately as they arrive\n204: if (delta.tool_calls) {\n205: for (const tc of delta.tool_calls) {\n206: const idx = tc.index;\n207: if (!toolCallDeltas[idx]) {\n208: toolCallDeltas[idx] = { id: tc.id || '', name: tc.function?.name || '', arguments: '' };\n209: }\n210: if (tc.id) toolCallDeltas[idx].id = tc.id;\n211: if (tc.function?.name) {\n212: toolCallDeltas[idx].name = tc.function.name;\n213: // Stream the tool call immediately when we have the name\n214: if (!seenToolCalls.has(idx)) {\n215: seenToolCalls.add(idx);\n216: stopThinkSpinner();\n217: const detail = toolDetail(toolCallDeltas[idx].name, null);\n218: process.stdout.write(`\\n ${toolBadge(toolCallDeltas[idx].name)} ${t.dim(detail)}${t.dim('...')}`);\n219: streamingStarted = true; // Mark that we've started streaming\n220: }\n221: }\n222: if (tc.function?.arguments) {\n223: toolCallDeltas[idx].arguments += tc.function.arguments;\n224: }\n225: }\n226: }\n227: \n228: // Handle reasoning_content field (some APIs send reasoning separately)\n229: if (delta.reasoning_content) {\n230: reasoningText += delta.reasoning_content;\n231: }\n232: \n233: // Handle content tokens\n234: if (delta.content) {\n235: fullContent += delta.content;\n236: const hasTool = Object.keys(toolCallDeltas).length > 0;\n237: \n238: if (displayState === 'streaming') {\n239: // Live-stream, but watch for a new <think> block\n240: contentAccum += delta.content;\n241: // Strip any stray closing tags\n242: contentAccum = stripStrayCloseTag(contentAccum);\n243: // Find and handle any <think> in the accumulated buffer\n244: const openIdx = contentAccum.indexOf('<think>');\n245: if (openIdx !== -1) {\n246: // Write everything before <think>\n247: if (openIdx > 0) writeToTerminal(contentAccum.slice(0, openIdx));\n248: thinkAccum = contentAccum.slice(openIdx + 7);\n249: contentAccum = '';\n250: displayState = 'thinking';\n[... omitted lines 251 to 274 ...]\n275: const thought = thinkAccum.slice(0, closeMatch.pos).trim();\n276: const after = thinkAccum.slice(closeMatch.pos + closeMatch.len);\n277: thinkAccum = '';\n278: stopThinkSpinner();\n279: if (thought) showThinkingBlock([thought]);\n280: displayState = 'streaming';\n281: contentAccum = after;\n282: if (!hasTool && after) writeToTerminal(after);\n283: contentAccum = '';\n284: }\n285: \n286: } else {\n287: // 'buffering' — accumulate until we know what's coming\n288: contentAccum += delta.content;\n289: // Strip stray closing tags\n290: contentAccum = stripStrayCloseTag(contentAccum);\n291: const openIdx = contentAccum.indexOf('<think>');\n292: if (openIdx !== -1) {\n293: // Text before <think>: stream it if non-empty\n294: const before = contentAccum.slice(0, openIdx);\n295: thinkAccum = contentAccum.slice(openIdx + 7);\n296: contentAccum = '';\n297: if (!hasTool && before.trim()) writeToTerminal(before);\n298: displayState = 'thinking';\n299: // Check if closing tag already present\n300: const closeMatch = findThinkClose(thinkAccum);\n301: if (closeMatch) {\n302: const thought = thinkAccum.slice(0, closeMatch.pos).trim();\n303: const after = thinkAccum.slice(closeMatch.pos + closeMatch.len);\n304: thinkAccum = '';\n305: stopThinkSpinner();\n306: if (thought) showThinkingBlock([thought]);\n307: displayState = 'streaming';\n308: contentAccum = after;\n309: if (!hasTool && after) writeToTerminal(after);\n310: contentAccum = '';\n311: }\n312: } else if (!contentAccum.includes('<') && contentAccum.length > 20) {\n313: // No think tag coming — start streaming immediately\n314: stopThinkSpinner();\n315: displayState = 'streaming';\n316: if (!hasTool) writeToTerminal(contentAccum);\n317: contentAccum = '';\n318: }\n319: // else keep buffering (might be start of <think>)\n320: }\n321: }\n322: }\n323: \n324: // Stream ended — flush any remaining buffers\n325: stopThinkSpinner();\n326: \n327: if (displayState === 'thinking') {\n328: // Unclosed <think> block — show what we accumulated\n329: const thought = (thinkAccum + contentAccum).trim();\n330: if (thought) showThinkingBlock([thought]);\n331: thinkAccum = '';\n332: contentAccum = '';\n333: displayState = 'streaming';\n334: } else if (displayState === 'buffering') {\n335: // Never left buffering — flush as plain content\n336: const hasTool = Object.keys(toolCallDeltas).length > 0;\n337: if (!hasTool && contentAccum.trim()) writeToTerminal(contentAccum);\n338: contentAccum = '';\n339: } else if (contentAccum) {\n340: // Flush any pending partial-tag buffer\n341: const hasTool = Object.keys(toolCallDeltas).length > 0;\n342: if (!hasTool) writeToTerminal(contentAccum);\n343: contentAccum = '';\n344: }\n345: \n346: // Show reasoning from reasoning_content field if not already shown via tags\n347: if (reasoningText.trim() && displayState !== 'thinking') {\n348: showThinkingBlock([reasoningText.trim()]);\n349: }\n350: \n351: if (streamingStarted) {\n352: process.stdout.write('\\n\\n');\n353: }\n354: \n355: // Final parsed content for history/display (tags stripped)\n356: const { content: displayContent } = parseThinkBlocks(fullContent);\n357: \n358: turnTokens += streamUsage?.total_tokens || 0;\n359: \n360: // Reconstruct the full message object\n361: const toolCalls = Object.keys(toolCallDeltas).sort((a, b) => a - b).map(idx => ({\n362: id: toolCallDeltas[idx].id,\n363: type: 'function',\n364: function: { name: toolCallDeltas[idx].name, arguments: toolCallDeltas[idx].arguments },\n365: }));\n366: \n367: const msg = {\n368: role: 'assistant',\n369: content: fullContent || null,\n370: ...(toolCalls.length > 0 ? { tool_calls: toolCalls } : {}),\n371: };\n372: \n373: // If the model wants to call tools\n374: if (toolCalls.length > 0) {\n375: messages.push(msg);\n376: \n377: // Show intermediate reasoning that wasn't streamed (e.g. with tool calls)\n378: if (displayContent && displayContent.trim()) {\n379: console.log(indent(t.dim.italic(displayContent.trim()), 6));\n380: console.log();\n381: }\n382: \n383: // Execute tool calls (parallel for independent calls)\n384: const toolPromises = toolCalls.map(async (toolCall) => {\n385: const toolName = toolCall.function.name;\n386: let toolArgs;\n387: try {\n388: toolArgs = JSON.parse(toolCall.function.arguments);\n389: } catch {\n390: toolArgs = {};\n391: }\n392: \n393: const detail = toolDetail(toolName, toolArgs);\n394: const callStart = Date.now();\n395: // Don't use spinner - we already streamed the tool call invocation\n396: // Just update with progress indicator\n397: process.stdout.write(`\\r ${t.dim('▸ executing...')} `);\n398: \n399: // Execute\n400: const result = await executeTool(toolName, toolArgs);\n401: const success = !result.startsWith('Error');\n402: \n403: const elapsed = Date.now() - callStart;\n404: const timeStr = elapsed < 1000 ? `${elapsed}ms` : `${(elapsed / 1000).toFixed(1)}s`;\n405: const icon = success ? t.green('✓') : t.red('✗');\n406: process.stdout.write(`\\r ${icon} ${toolBadge(toolName)} ${t.dim(detail)} ${t.dim(timeStr)}\\n`);\n407: session.toolCallCount++;\n408: turnToolCalls++;\n409: \n410: // Show result preview\n411: const resultLines = result.split('\\n');\n412: let preview;\n413: if (toolName === 'Edit' || toolName === 'Patch') {\n414: // Show diff\n415: showDiff(toolArgs.path, result);\n416: } else if (resultLines.length > 5) {\n417: preview = resultLines.slice(0, 4).join('\\n') + `\\n... (${resultLines.length} lines)`;\n418: console.log(indent(t.dim(preview), 8));\n419: console.log();\n420: } else if (result.trim() && result !== '(no output)') {\n421: console.log(indent(t.dim(result.length > 300 ? result.slice(0, 297) + '...' : result), 8));\n422: console.log();\n423: }\n424: \n425: return { id: toolCall.id, result };\n426: });\n427: \n428: const toolResults = await Promise.all(toolPromises);\n429: \n430: for (const { id, result } of toolResults) {\n431: messages.push({\n432: role: 'tool',\n433: tool_call_id: id,\n434: content: result,\n435: });\n436: }\n437: \n438: // Check for stop condition\n439: if (finishReason === 'stop') break;\n440: continue;\n441: }\n442: \n443: // No tool calls — final text response (already displayed above)\n444: if (fullContent) {\n445: const cleanedContent = displayContent.trim() || fullContent.replace(/<think>[\\s\\S]*?<\\/think>/g, '').trim();\n446: session.conversationHistory.push({ role: 'assistant', content: cleanedContent || fullContent });\n447: }\n448: break;\n449: }\n450: \n451: if (iterations >= MAX_TOOL_ITERATIONS) {\n452: console.log(indent(t.yellow(`⚠ Reached maximum tool iterations (${MAX_TOOL_ITERATIONS}). Stopping.`)));\n453: console.log();\n454: }\n455: \n456: session.totalTokens += turnTokens;\n457: \n458: // Auto-delegate to CodeReview for code changes\n459: if (session.filesModified.size > 0) {\n460: const reviewSpinner = ora({\n461: text: t.dim('Reviewing code changes...'),\n462: prefixText: ' ',\n463: spinner: 'dots',\n464: color: 'magenta',\n465: }).start();\n466: \n467: try {\n468: // Build a summary of what was changed\n469: const reviewPrompt = `User request: ${userInput}\\n\\n${turnTokens > 0 ? `Processed with ${turnTokens} tokens and ${turnToolCalls} tool calls.` : ''}`;\n470: \n471: const reviewResult = await executeTool('CodeReview', {\n472: prompt: reviewPrompt,\n473: });\n474: reviewSpinner.stop();\n475: \n476: // Display the review results prominently\n477: console.log(indent(t.magenta.bold('📋 Code Review'), 2));\n478: console.log(indent(hr(), 2));\n479: console.log(indent(reviewResult, 2));\n480: console.log(indent(hr(), 2));\n481: console.log();\n482: \n483: // Add to conversation history\n484: session.conversationHistory.push({\n485: role: 'assistant',\n486: content: `\\n\\n--- Code Review ---\\n${reviewResult}`,\n487: });\n488: } catch (err) {\n489: reviewSpinner.stop();\n490: console.log(indent(t.dim('(Code review failed: ' + err.message + ')'), 2));\n491: console.log();\n492: }\n493: }\n494: } catch (err) {\n495: console.log();\n496: console.log(indent(t.red('✗ Error: ') + t.text(err.message)));\n497: if (err.status) {\n498: console.log(indent(t.dim(`Status: ${err.status}`) + (err.error ? t.dim(` | Detail: ${JSON.stringify(err.error).slice(0, 200)}`) : '')));\n499: }\n500: if (!process.env.NVIDIA_API_KEY) {\n501: console.log(indent(t.yellow('Set the NVIDIA_API_KEY environment variable with your API key from build.nvidia.com')));\n502: }\n503: console.log();\n504: }\n505: \n506: console.log(indent(hr()));\n507: isProcessing = false;\n508: if (rlClosed) {\n509: // Readline closed during processing — re-create it if stdin is still usable\n510: if (!process.stdin.destroyed && process.stdin.readable) {\n511: setupInputLoop();\n512: askQuestion();\n513: return;\n514: }\n515: process.exit(0);\n516: }\n517: }\n518: \n519: module.exports = {\n520: handleUserInput,\n521: getIsProcessing,\n522: setRlClosed,\n523: getRlClosed,\n524: };"
684
- },
685
- "trackFiles": [
686
- "file:///home/runner/workspace/src/agent.js"
687
- ]
688
- }
689
- },
690
- {
691
- "type": "tool_result",
692
- "toolUseID": "toolu_vrtx_01MXoZeYtxpCktzLfWUWzgqo",
693
- "run": {
694
- "status": "done",
695
- "progress": {},
696
- "result": {
697
- "absolutePath": "/home/runner/workspace/src/tools.js",
698
- "content": "1: 'use strict';\n2: \n3: const toolDefs = [\n4: {\n5: type: 'function',\n6: function: {\n7: name: 'Read',\n8: description: 'Read the contents of a file. Returns line-numbered content. Always read a file before editing it.',\n9: parameters: {\n10: type: 'object',\n11: properties: {\n12: path: { type: 'string', description: 'File path to read (absolute or relative to project root).' },\n13: start_line: { type: 'number', description: 'Start line (1-indexed). Omit to read from beginning.' },\n14: end_line: { type: 'number', description: 'End line (1-indexed). Omit to read to end (max 500 lines).' },\n15: },\n16: required: ['path'],\n17: },\n18: },\n19: },\n20: {\n21: type: 'function',\n22: function: {\n23: name: 'Write',\n24: description: 'Create a new file or completely overwrite an existing file. For modifying existing files, prefer Edit instead.',\n25: parameters: {\n26: type: 'object',\n27: properties: {\n28: path: { type: 'string', description: 'File path to write.' },\n29: content: { type: 'string', description: 'Full content to write.' },\n30: },\n31: required: ['path', 'content'],\n32: },\n33: },\n34: },\n35: {\n36: type: 'function',\n37: function: {\n38: name: 'Edit',\n39: description: 'Replace an exact string in a file with new content. The old_str must match exactly (including whitespace). For existing files, this is preferred over Write.',\n40: parameters: {\n41: type: 'object',\n42: properties: {\n43: path: { type: 'string', description: 'File path to edit.' },\n44: old_str: { type: 'string', description: 'Exact string to find (must be unique in the file).' },\n45: new_str: { type: 'string', description: 'Replacement string.' },\n46: },\n47: required: ['path', 'old_str', 'new_str'],\n48: },\n49: },\n50: },\n51: {\n52: type: 'function',\n53: function: {\n54: name: 'Patch',\n55: description: 'Apply multiple find-and-replace edits to a single file atomically. Use when you need to make several changes to the same file.',\n56: parameters: {\n57: type: 'object',\n58: properties: {\n59: path: { type: 'string', description: 'File path to patch.' },\n60: edits: {\n61: type: 'array',\n62: description: 'Array of edits to apply in order.',\n63: items: {\n64: type: 'object',\n65: properties: {\n66: old_str: { type: 'string', description: 'Exact string to find.' },\n67: new_str: { type: 'string', description: 'Replacement string.' },\n68: },\n69: required: ['old_str', 'new_str'],\n70: },\n71: },\n72: },\n73: required: ['path', 'edits'],\n74: },\n75: },\n76: },\n77: {\n78: type: 'function',\n79: function: {\n80: name: 'Bash',\n81: description: 'Execute a shell command. Use for running tests, builds, git commands, installing packages, checking syntax, etc. Commands have a 60-second timeout.',\n82: parameters: {\n83: type: 'object',\n84: properties: {\n85: command: { type: 'string', description: 'Shell command to execute.' },\n86: cwd: { type: 'string', description: 'Working directory (defaults to project root).' },\n87: },\n88: required: ['command'],\n89: },\n90: },\n91: },\n92: {\n93: type: 'function',\n94: function: {\n95: name: 'Grep',\n96: description: 'Search for a pattern across files using regex. Returns matching lines with file paths and line numbers.',\n97: parameters: {\n98: type: 'object',\n99: properties: {\n100: pattern: { type: 'string', description: 'Regex pattern to search for.' },\n101: path: { type: 'string', description: 'Directory or file to search in (defaults to project root).' },\n102: include: { type: 'string', description: 'File glob pattern to include, e.g. \"*.js\" or \"*.ts\"' },\n103: case_sensitive: { type: 'boolean', description: 'Case-sensitive search (default: false).' },\n104: },\n105: required: ['pattern'],\n106: },\n107: },\n108: },\n109: {\n110: type: 'function',\n111: function: {\n112: name: 'Glob',\n113: description: 'Find files matching a glob pattern. Returns file paths sorted by modification time.',\n114: parameters: {\n115: type: 'object',\n116: properties: {\n117: pattern: { type: 'string', description: 'Glob pattern like \"**/*.js\", \"src/**/*.ts\", \"*.json\"' },\n118: cwd: { type: 'string', description: 'Base directory for the search (defaults to project root).' },\n119: },\n120: required: ['pattern'],\n121: },\n122: },\n123: },\n124: {\n125: type: 'function',\n126: function: {\n127: name: 'ListDir',\n128: description: 'List the contents of a directory. Shows files and subdirectories with type indicators.',\n129: parameters: {\n130: type: 'object',\n131: properties: {\n132: path: { type: 'string', description: 'Directory path to list (defaults to project root).' },\n133: recursive: { type: 'boolean', description: 'If true, list recursively (max depth 3).' },\n134: },\n135: required: [],\n136: },\n137: },\n138: },\n139: {\n140: type: 'function',\n141: function: {\n142: name: 'UndoEdit',\n143: description: 'Undo the last edit made to a specific file, restoring its previous content.',\n144: parameters: {\n145: type: 'object',\n146: properties: {\n147: path: { type: 'string', description: 'File path to undo the last edit for.' },\n148: },\n149: required: ['path'],\n150: },\n151: },\n152: },\n153: {\n154: type: 'function',\n155: function: {\n156: name: 'Task',\n157: description: 'Spawn a sub-task by executing a sequence of shell commands for a complex multi-step operation. Useful for build-test-fix cycles.',\n158: parameters: {\n159: type: 'object',\n160: properties: {\n161: description: { type: 'string', description: 'Brief description of the task.' },\n162: commands: {\n163: type: 'array',\n164: description: 'Shell commands to execute in sequence. Stops on first failure.',\n165: items: { type: 'string' },\n166: },\n167: },\n168: required: ['description', 'commands'],\n169: },\n170: },\n171: },\n172: {\n173: type: 'function',\n174: function: {\n175: name: 'WebSearch',\n176: description: 'Search the web using Exa AI. Returns relevant results with titles, URLs, and text snippets. Use this to find up-to-date information, documentation, or answers from the internet.',\n177: parameters: {\n178: type: 'object',\n179: properties: {\n180: query: { type: 'string', description: 'The search query to execute.' },\n181: num_results: { type: 'number', description: 'Number of results to return (default: 5, max: 10).' },\n182: type: { type: 'string', description: 'Search type: \"auto\" (default), \"neural\", or \"keyword\".' },\n183: include_domains: {\n184: type: 'array',\n185: description: 'Only return results from these domains, e.g. [\"github.com\", \"stackoverflow.com\"].',\n186: items: { type: 'string' },\n187: },\n188: category: { type: 'string', description: 'Filter by category: \"news\", \"research paper\", \"tweet\", \"company\", \"personal site\", etc.' },\n189: },\n190: required: ['query'],\n191: },\n192: },\n193: },\n194: {\n195: type: 'function',\n196: function: {\n197: name: 'FilePickerMax',\n198: description: 'Spawn a file-picker sub-agent that deeply explores the codebase to find files relevant to a prompt. It scans the full directory tree and previews every source file, then uses the most capable model to identify and rank the relevant files. Use this when you need to locate files related to a concept, feature, bug, or pattern.',\n199: parameters: {\n200: type: 'object',\n201: properties: {\n202: prompt: { type: 'string', description: 'Describe what kind of files to find. Be specific — e.g. \"files that handle user authentication\", \"all React components related to the dashboard\", \"where database migrations are defined\".' },\n203: },\n204: required: ['prompt'],\n205: },\n206: },\n207: }\n208: ];\n209: \n210: module.exports = { toolDefs };"
699
- },
700
- "trackFiles": [
701
- "file:///home/runner/workspace/src/tools.js"
702
- ]
703
- }
704
- },
705
- {
706
- "type": "tool_result",
707
- "toolUseID": "toolu_vrtx_01TQYo4jV8L2du4JqXDz6M1t",
708
- "run": {
709
- "status": "done",
710
- "progress": {},
711
- "result": {
712
- "absolutePath": "/home/runner/workspace/src/toolExecutors.js",
713
- "content": "1: 'use strict';\n2: \n3: const fs = require('fs');\n4: const path = require('path');\n5: const https = require('https');\n6: const { execSync } = require('child_process');\n7: const {\n8: PROJECT_ROOT,\n9: TOOL_TIMEOUT,\n10: REVIEWER_MODEL,\n11: REVIEWER_SYSTEM_PROMPT,\n12: FILE_PICKER_MODEL,\n13: FILE_PICKER_SYSTEM_PROMPT,\n14: nvidiaClient,\n15: session,\n16: truncateOutput,\n17: resolvePath,\n18: sleep,\n19: } = require('./config');\n20: \n21: async function executeTool(name, args) {\n22: try {\n23: switch (name) {\n24: case 'Read': {\n25: const filePath = resolvePath(args.path);\n26: const stat = fs.statSync(filePath, { throwIfNoEntry: false });\n27: if (!stat) return `Error: File not found: ${filePath}`;\n28: if (stat.isDirectory()) return `Error: ${filePath} is a directory. Use ListDir instead.`;\n29: const content = fs.readFileSync(filePath, 'utf-8');\n30: const lines = content.split('\\n');\n31: const start = Math.max(0, (args.start_line || 1) - 1);\n32: const end = args.end_line ? Math.min(lines.length, args.end_line) : Math.min(lines.length, start + 500);\n33: const slice = lines.slice(start, end);\n34: const numbered = slice.map((l, i) => `${start + i + 1}: ${l}`).join('\\n');\n35: session.filesRead.add(filePath);\n36: if (end < lines.length) {\n37: return truncateOutput(numbered) + `\\n(showing lines ${start + 1}-${end} of ${lines.length})`;\n38: }\n39: return truncateOutput(numbered);\n40: }\n41: \n42: case 'Write': {\n43: const filePath = resolvePath(args.path);\n44: const dir = path.dirname(filePath);\n45: if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n46: const existed = fs.existsSync(filePath);\n47: const before = existed ? fs.readFileSync(filePath, 'utf-8') : null;\n48: fs.writeFileSync(filePath, args.content, 'utf-8');\n49: if (before !== null) {\n50: session.editHistory.push({ path: filePath, before, after: args.content, timestamp: Date.now() });\n51: }\n52: session.filesModified.add(filePath);\n53: const lines = args.content.split('\\n').length;\n54: return `${existed ? 'Overwritten' : 'Created'}: ${filePath} (${lines} lines)`;\n55: }\n56: \n57: case 'Edit': {\n58: const filePath = resolvePath(args.path);\n59: if (!fs.existsSync(filePath)) return `Error: File not found: ${filePath}`;\n60: const content = fs.readFileSync(filePath, 'utf-8');\n61: const count = content.split(args.old_str).length - 1;\n62: if (count === 0) return `Error: old_str not found in ${path.basename(filePath)}. Make sure it matches exactly (including whitespace and indentation).`;\n63: if (count > 1) return `Error: old_str found ${count} times in ${path.basename(filePath)}. It must be unique. Add more surrounding context to make it unique.`;\n64: const updated = content.replace(args.old_str, args.new_str);\n65: fs.writeFileSync(filePath, updated, 'utf-8');\n66: session.editHistory.push({ path: filePath, before: content, after: updated, timestamp: Date.now() });\n67: session.filesModified.add(filePath);\n68: // Generate a mini diff\n69: const oldLines = args.old_str.split('\\n');\n70: const newLines = args.new_str.split('\\n');\n71: let diff = `Edited: ${filePath}\\n`;\n72: oldLines.forEach(l => diff += `- ${l}\\n`);\n73: newLines.forEach(l => diff += `+ ${l}\\n`);\n74: return diff;\n75: }\n76: \n77: case 'Patch': {\n78: const filePath = resolvePath(args.path);\n79: if (!fs.existsSync(filePath)) return `Error: File not found: ${filePath}`;\n80: let content = fs.readFileSync(filePath, 'utf-8');\n81: const before = content;\n82: const results = [];\n83: for (let i = 0; i < args.edits.length; i++) {\n84: const edit = args.edits[i];\n85: if (!content.includes(edit.old_str)) {\n86: results.push(`Edit ${i + 1}: FAILED - old_str not found`);\n87: continue;\n88: }\n89: content = content.replace(edit.old_str, edit.new_str);\n90: results.push(`Edit ${i + 1}: OK`);\n91: }\n92: fs.writeFileSync(filePath, content, 'utf-8');\n93: session.editHistory.push({ path: filePath, before, after: content, timestamp: Date.now() });\n94: session.filesModified.add(filePath);\n95: return `Patched: ${filePath}\\n${results.join('\\n')}`;\n96: }\n97: \n98: case 'Bash': {\n99: const cwd = args.cwd ? resolvePath(args.cwd) : PROJECT_ROOT;\n100: session.commandsRun.push(args.command);\n101: try {\n102: const output = execSync(args.command, {\n103: encoding: 'utf-8',\n104: timeout: TOOL_TIMEOUT,\n105: cwd,\n106: maxBuffer: 1024 * 1024 * 5,\n107: stdio: ['pipe', 'pipe', 'pipe'],\n108: });\n109: return truncateOutput(output || '(no output)');\n110: } catch (err) {\n111: // Return both stdout and stderr on failure\n112: const stdout = err.stdout || '';\n113: const stderr = err.stderr || '';\n114: const exitCode = err.status || 1;\n115: return truncateOutput(`Exit code: ${exitCode}\\n${stdout}\\n${stderr}`.trim());\n116: }\n117: }\n118: \n119: case 'Grep': {\n120: const searchPath = resolvePath(args.path);\n121: const flags = args.case_sensitive ? '' : '-i';\n122: const include = args.include ? `--include='${args.include}'` : '';\n123: try {\n124: const cmd = `grep -rn ${flags} ${include} --color=never \"${args.pattern.replace(/\"/g, '\\\\\"')}\" \"${searchPath}\" 2>/dev/null | head -80`;\n125: const output = execSync(cmd, { encoding: 'utf-8', timeout: 15000 });\n126: return truncateOutput(output || 'No matches found.');\n127: } catch {\n128: return 'No matches found.';\n129: }\n130: }\n131: \n132: case 'Glob': {\n133: const cwd = args.cwd ? resolvePath(args.cwd) : PROJECT_ROOT;\n134: try {\n135: // Use find command to simulate glob\n136: const pattern = args.pattern;\n137: let cmd;\n138: if (pattern.includes('**')) {\n139: const namePattern = pattern.replace(/\\*\\*\\//g, '').replace(/\\*/g, '*');\n140: cmd = `find \"${cwd}\" -name \"${namePattern}\" -not -path \"*/node_modules/*\" -not -path \"*/.git/*\" 2>/dev/null | head -100`;\n141: } else {\n142: cmd = `find \"${cwd}\" -name \"${pattern}\" -not -path \"*/node_modules/*\" -not -path \"*/.git/*\" 2>/dev/null | head -100`;\n143: }\n144: const output = execSync(cmd, { encoding: 'utf-8', timeout: 10000 });\n145: if (!output.trim()) return 'No files found matching pattern.';\n146: // Make paths relative\n147: const files = output.trim().split('\\n').map(f => path.relative(cwd, f)).sort();\n148: return files.join('\\n');\n149: } catch {\n150: return 'No files found matching pattern.';\n151: }\n152: }\n153: \n154: case 'ListDir': {\n155: const dirPath = resolvePath(args.path);\n156: if (!fs.existsSync(dirPath)) return `Error: Directory not found: ${dirPath}`;\n157: const stat = fs.statSync(dirPath);\n158: if (!stat.isDirectory()) return `Error: ${dirPath} is not a directory.`;\n159: \n160: function listRecursive(dir, depth, maxDepth) {\n161: const entries = fs.readdirSync(dir, { withFileTypes: true })\n162: .filter(e => !e.name.startsWith('.') && e.name !== 'node_modules')\n163: .sort((a, b) => {\n164: if (a.isDirectory() && !b.isDirectory()) return -1;\n165: if (!a.isDirectory() && b.isDirectory()) return 1;\n166: return a.name.localeCompare(b.name);\n167: });\n168: const lines = [];\n169: for (const entry of entries) {\n170: const prefix = ' '.repeat(depth);\n171: if (entry.isDirectory()) {\n172: lines.push(`${prefix}${entry.name}/`);\n173: if (depth < maxDepth) {\n174: lines.push(...listRecursive(path.join(dir, entry.name), depth + 1, maxDepth));\n175: }\n176: } else {\n177: const size = fs.statSync(path.join(dir, entry.name)).size;\n178: const sizeStr = size < 1024 ? `${size}B` : size < 1024 * 1024 ? `${(size / 1024).toFixed(1)}K` : `${(size / (1024 * 1024)).toFixed(1)}M`;\n179: lines.push(`${prefix}${entry.name} (${sizeStr})`);\n180: }\n181: }\n182: return lines;\n183: }\n184: \n185: const maxDepth = args.recursive ? 3 : 0;\n186: const lines = listRecursive(dirPath, 0, maxDepth);\n187: return truncateOutput(lines.join('\\n') || '(empty directory)');\n188: }\n189: \n190: case 'UndoEdit': {\n191: const filePath = resolvePath(args.path);\n192: const lastEdit = [...session.editHistory].reverse().find(e => e.path === filePath);\n193: if (!lastEdit) return `Error: No edit history for ${filePath}`;\n194: fs.writeFileSync(filePath, lastEdit.before, 'utf-8');\n195: session.editHistory = session.editHistory.filter(e => e !== lastEdit);\n196: return `Undone last edit to ${filePath}`;\n197: }\n198: \n199: case 'Task': {\n200: const results = [];\n201: for (const cmd of args.commands) {\n202: try {\n203: const output = execSync(cmd, {\n204: encoding: 'utf-8',\n205: timeout: TOOL_TIMEOUT,\n206: cwd: PROJECT_ROOT,\n207: maxBuffer: 1024 * 1024 * 5,\n208: stdio: ['pipe', 'pipe', 'pipe'],\n209: });\n210: results.push(`✓ ${cmd}\\n${output.trim()}`);\n211: session.commandsRun.push(cmd);\n212: } catch (err) {\n213: results.push(`✗ ${cmd}\\nExit code: ${err.status}\\n${(err.stdout || '').trim()}\\n${(err.stderr || '').trim()}`);\n214: session.commandsRun.push(cmd);\n215: break; // Stop on first failure\n216: }\n217: }\n218: return truncateOutput(`Task: ${args.description}\\n${'─'.repeat(40)}\\n${results.join('\\n\\n')}`);\n219: }\n220: \n221: case 'WebSearch': {\n222: const apiKey = process.env.EXA_API_KEY;\n223: if (!apiKey) return 'Error: EXA_API_KEY environment variable is not set. Get one at https://dashboard.exa.ai/api-keys';\n224: \n225: const body = JSON.stringify({\n226: query: args.query,\n227: numResults: Math.min(args.num_results || 5, 10),\n228: type: args.type || 'auto',\n229: ...(args.include_domains && { includeDomains: args.include_domains }),\n230: ...(args.category && { category: args.category }),\n231: contents: { highlights: { maxCharacters: 300 }, text: { maxCharacters: 1000 } },\n232: });\n233: \n234: const result = await new Promise((resolve) => {\n235: const req = https.request({\n236: hostname: 'api.exa.ai',\n237: path: '/search',\n238: method: 'POST',\n239: headers: {\n240: 'Content-Type': 'application/json',\n241: 'x-api-key': apiKey,\n242: },\n243: }, (res) => {\n244: let data = '';\n245: res.on('data', (chunk) => data += chunk);\n246: res.on('end', () => {\n247: if (res.statusCode !== 200) {\n248: resolve(`Error: Exa API returned ${res.statusCode}: ${data}`);\n249: return;\n250: }\n251: try {\n252: const json = JSON.parse(data);\n253: if (!json.results || json.results.length === 0) {\n254: resolve('No results found.');\n255: return;\n256: }\n257: const formatted = json.results.map((r, i) => {\n258: let entry = `${i + 1}. **${r.title || 'Untitled'}**\\n ${r.url}`;\n259: if (r.publishedDate) entry += `\\n Published: ${r.publishedDate.split('T')[0]}`;\n260: if (r.author) entry += `\\n Author: ${r.author}`;\n261: if (r.text) entry += `\\n ${r.text.trim().slice(0, 500)}`;\n262: else if (r.highlights && r.highlights.length) entry += `\\n ${r.highlights[0].trim().slice(0, 300)}`;\n263: return entry;\n264: }).join('\\n\\n');\n265: resolve(truncateOutput(`Web Search Results (${json.results.length}):\\n${'─'.repeat(40)}\\n${formatted}`));\n266: } catch (e) {\n267: resolve(`Error: Failed to parse Exa response: ${e.message}`);\n268: }\n269: });\n270: });\n271: req.on('error', (e) => resolve(`Error: Exa request failed: ${e.message}`));\n272: req.setTimeout(15000, () => { req.destroy(); resolve('Error: Exa search timed out.'); });\n273: req.write(body);\n274: req.end();\n275: });\n276: return result;\n277: }\n278: \n279: case 'FilePickerMax': {\n280: // Gather full directory tree\n281: let tree = '';\n282: try {\n283: tree = execSync(\n284: `find \"${PROJECT_ROOT}\" -not -path \"*/node_modules/*\" -not -path \"*/.git/*\" -not -path \"*/.cache/*\" -not -path \"*/.local/*\" -not -path \"*/.upm/*\" -not -path \"*/.config/*\" 2>/dev/null | head -500`,\n285: { encoding: 'utf-8', timeout: 15000 }\n286: ).trim();\n287: // Make paths relative\n288: tree = tree.split('\\n').map(f => path.relative(PROJECT_ROOT, f) || '.').join('\\n');\n289: } catch {\n290: tree = '(failed to scan directory tree)';\n291: }\n292: \n293: // Gather previews of all source files (first 8 lines each)\n294: const sourceExts = /\\.(js|ts|jsx|tsx|py|rb|go|rs|java|c|cpp|h|hpp|css|scss|html|svelte|vue|json|yaml|yml|toml|md|sql|sh|bash|env|cfg|ini|xml)$/i;\n295: const allFiles = tree.split('\\n').filter(f => sourceExts.test(f));\n296: const previews = [];\n297: for (const relFile of allFiles.slice(0, 200)) {\n298: const absFile = path.resolve(PROJECT_ROOT, relFile);\n299: try {\n300: const stat = fs.statSync(absFile, { throwIfNoEntry: false });\n301: if (!stat || stat.isDirectory() || stat.size > 512 * 1024) continue;\n302: const content = fs.readFileSync(absFile, 'utf-8');\n303: const first8 = content.split('\\n').slice(0, 8).join('\\n');\n304: previews.push(`--- ${relFile} ---\\n${first8}`);\n305: } catch { /* skip unreadable */ }\n306: }\n307: \n308: const pickerMessages = [\n309: { role: 'system', content: FILE_PICKER_SYSTEM_PROMPT },\n310: {\n311: role: 'user',\n312: content: `# Prompt\\n${args.prompt}\\n\\n# Directory Tree\\n${tree}\\n\\n# File Previews (first 8 lines each)\\n${previews.join('\\n\\n')}`,\n313: },\n314: ];\n315: \n316: try {\n317: let pickerResponse;\n318: for (let attempt = 0; attempt <= 2; attempt++) {\n319: try {\n320: pickerResponse = await nvidiaClient.chat.completions.create({\n321: model: FILE_PICKER_MODEL,\n322: messages: pickerMessages,\n323: max_tokens: 4096,\n324: temperature: 0.2,\n325: });\n326: break;\n327: } catch (retryErr) {\n328: if (attempt < 2 && retryErr.status >= 400 && retryErr.status < 500) {\n329: await sleep(1000 * Math.pow(2, attempt));\n330: continue;\n331: }\n332: throw retryErr;\n333: }\n334: }\n335: const raw = pickerResponse.choices[0]?.message?.content || '[]';\n336: return truncateOutput(`FilePickerMax Results\\n${'─'.repeat(40)}\\n${raw}`);\n337: } catch (apiErr) {\n338: return `Error: FilePickerMax failed — ${apiErr.message}`;\n339: }\n340: }\n341: \n342: case 'CodeReview': {\n343: // Auto-collect all modified files from this session\n344: const allFiles = new Set([...session.filesModified]);\n345: // Add any extra files the agent explicitly passed\n346: if (args.files && args.files.length) {\n347: for (const f of args.files) allFiles.add(resolvePath(f));\n348: }\n349: \n350: if (allFiles.size === 0) {\n351: return 'CodeReview skipped — no files were modified this session.';\n352: }\n353: \n354: // Gather file contents for the reviewer's context\n355: const fileContents = [];\n356: for (const filePath of allFiles) {\n357: if (!fs.existsSync(filePath)) {\n358: fileContents.push(`--- ${filePath} ---\\n[File not found]`);\n359: continue;\n360: }\n361: const stat = fs.statSync(filePath);\n362: if (stat.isDirectory()) continue;\n363: const content = fs.readFileSync(filePath, 'utf-8');\n364: fileContents.push(`--- ${path.relative(PROJECT_ROOT, filePath) || filePath} ---\\n${content}`);\n365: }\n366: \n367: // Build git diff of modified files for richer context\n368: let gitDiff = '';\n369: try {\n370: gitDiff = execSync('git diff 2>/dev/null', { encoding: 'utf-8', cwd: PROJECT_ROOT, timeout: 10000 }).trim();\n371: } catch {}\n372: \n373: const reviewMessages = [\n374: {\n375: role: 'system',\n376: content: REVIEWER_SYSTEM_PROMPT,\n377: },\n378: {\n379: role: 'user',\n380: content: `# What was changed\\n${args.prompt}\\n\\n# Modified files (${allFiles.size})\\n\\n${fileContents.join('\\n\\n')}${gitDiff ? `\\n\\n# Git diff\\n\\`\\`\\`diff\\n${gitDiff}\\n\\`\\`\\`` : ''}`,\n381: },\n382: ];\n383: \n384: try {\n385: let reviewResponse;\n386: for (let attempt = 0; attempt <= 2; attempt++) {\n387: try {\n388: reviewResponse = await nvidiaClient.chat.completions.create({\n389: model: REVIEWER_MODEL,\n390: messages: reviewMessages,\n391: max_tokens: 4096,\n392: temperature: 0.3,\n393: });\n394: break;\n395: } catch (retryErr) {\n396: if (attempt < 2 && retryErr.status >= 400 && retryErr.status < 500) {\n397: await sleep(1000 * Math.pow(2, attempt));\n398: continue;\n399: }\n400: throw retryErr;\n401: }\n402: }\n403: const reviewText = reviewResponse.choices[0]?.message?.content\n404: || reviewResponse.choices[0]?.message?.reasoning_content\n405: || '(No response from reviewer)';\n406: return truncateOutput(`Code Review (${REVIEWER_MODEL}) — ${allFiles.size} file(s)\\n${'─'.repeat(40)}\\n${reviewText}`);\n407: } catch (apiErr) {\n408: return `Error: Code review failed — ${apiErr.message}`;\n409: }\n410: }\n411: \n412: default:\n413: return `Unknown tool: ${name}`;\n414: }\n415: } catch (err) {\n416: return `Error executing ${name}: ${err.message}`;\n417: }\n418: }\n419: \n420: module.exports = { executeTool };"
714
- },
715
- "trackFiles": [
716
- "file:///home/runner/workspace/src/toolExecutors.js"
717
- ]
718
- }
719
- }
720
- ]
721
- },
722
- {
723
- "role": "assistant",
724
- "messageId": 10,
725
- "content": [
726
- {
727
- "type": "thinking",
728
- "thinking": "Now let me find the Codex CLI system prompt. The file path I tried wasn't correct. Let me search for it in the repo.",
729
- "signature": "Ep8CCkgICxACGAIqQEsNzIuw2MKmJTIIQC4oXwCwraD7VcwLYRGNMRbqlAbFWQpyQYnS5dB6wDaRdbeaiVlx/stb2Cyn4IGv5YYe+N0SDJt9va9CSNb6ZJXndhoMvwNDDCn8Rfzhdff9IjCJ5tRdlq7eZe8KMBDyHLILePZ0HUGYXnTR3uWsLYb2jXJRmjsT5JbuBlldiKrN4TMqhAHzje+cZrD6uWaisgXGFIcpec/XOG6x2SVq9t+pfxP9SieZpJl6WdMMVOrLkqxQY+mQPFIR6BSl7ZcEyDBSUxjhY171M2lg8T8Kjq7wsSy4wwfEMdPAjgEamMwCxI7/JGdivhIjrnnZ39T6q8QvcblkL36oDElQ0e5zhRclLnMIwwWnzegYAQ==",
730
- "provider": "anthropic"
731
- },
732
- {
733
- "type": "text",
734
- "text": "Now let me find the Codex CLI system prompt and also read the config file:"
735
- },
736
- {
737
- "type": "tool_use",
738
- "complete": true,
739
- "id": "toolu_vrtx_01TJt14DMjwiERAJ5AaEGsDG",
740
- "name": "read_web_page",
741
- "input": {
742
- "url": "https://github.com/openai/codex/tree/main/codex-cli/src/utils/agent",
743
- "objective": "Find the system prompt / instructions file for the Codex CLI agent"
744
- }
745
- },
746
- {
747
- "type": "tool_use",
748
- "complete": true,
749
- "id": "toolu_vrtx_01HgbL1SMsFtW6WfWxdXsogw",
750
- "name": "Read",
751
- "input": {
752
- "path": "/home/runner/workspace/src/config.js"
753
- }
754
- }
755
- ],
756
- "state": {
757
- "type": "complete",
758
- "stopReason": "tool_use"
759
- },
760
- "usage": {
761
- "model": "claude-opus-4-6",
762
- "maxInputTokens": 168000,
763
- "inputTokens": 1,
764
- "outputTokens": 219,
765
- "cacheCreationInputTokens": 17402,
766
- "cacheReadInputTokens": 20689,
767
- "totalInputTokens": 38092,
768
- "timestamp": "2026-02-26T03:11:34.742Z"
769
- }
770
- },
771
- {
772
- "role": "user",
773
- "messageId": 11,
774
- "content": [
775
- {
776
- "type": "tool_result",
777
- "toolUseID": "toolu_vrtx_01TJt14DMjwiERAJ5AaEGsDG",
778
- "run": {
779
- "status": "done",
780
- "result": "Section Title: Navigation Menu\nContent:\nToggle navigation\nAppearance settings\nSearch or jump to...\n ... \nSection Title: Search code, repositories, users, issues, pull requests... > Footer\nContent:\nYou can’t perform that action at this time.",
781
- "~debug": {
782
- "showParallelAttribution": false
783
- }
784
- }
785
- },
786
- {
787
- "type": "tool_result",
788
- "toolUseID": "toolu_vrtx_01HgbL1SMsFtW6WfWxdXsogw",
789
- "run": {
790
- "status": "done",
791
- "progress": {},
792
- "result": {
793
- "absolutePath": "/home/runner/workspace/src/config.js",
794
- "content": "1: 'use strict';\n2: \n3: const OpenAI = require('openai');\n4: \n5: // ===== Config =====\n6: const NVIDIA_MODEL = 'nvidia/llama-3.1-nemotron-ultra-253b-v1';\n7: const REVIEWER_MODEL = 'nvidia/llama-3.1-nemotron-ultra-253b-v1';\n8: const FILE_PICKER_MODEL = 'qwen/qwen3-coder-480b-a35b-instruct';\n9: const MAX_TOOL_ITERATIONS = 50;\n10: const MAX_OUTPUT_LEN = 12000;\n11: const TOOL_TIMEOUT = 60000;\n12: const PROJECT_ROOT = process.cwd();\n13: \n14: const REVIEWER_SYSTEM_PROMPT = `You are a senior code reviewer. An AI coding assistant just made changes to a codebase. Your job is to review those changes thoroughly and report issues. Be specific — reference exact line numbers, function names, and variables.\n15: \n16: Focus on:\n17: 1. **Bugs & logic errors** — incorrect conditions, off-by-one, null/undefined risks, race conditions\n18: 2. **Security** — exposed secrets, injection risks, unsafe operations\n19: 3. **Edge cases** — unhandled inputs, missing error handling at boundaries\n20: 4. **Code quality** — naming, readability, dead code, unnecessary complexity\n21: 5. **Correctness** — does the code actually fulfil the stated intent?\n22: \n23: If everything looks good, say so briefly. If there are problems, list them clearly with severity (critical / warning / nit). You have no tools; your only output is this review.`;\n24: \n25: const FILE_PICKER_SYSTEM_PROMPT = `You are a precision file-picker agent embedded inside a coding assistant. Your ONLY job is to identify the files in a codebase that are relevant to a given prompt.\n26: \n27: You will receive:\n28: 1. A full recursive directory tree of the project.\n29: 2. A preview (first 8 lines) of every source file.\n30: 3. A user prompt describing what kind of files to find.\n31: \n32: Your task:\n33: - Analyze the directory tree and file previews carefully.\n34: - Select ONLY the files that are directly relevant to the prompt.\n35: - Rank them by relevance (most relevant first).\n36: - Be precise — do NOT include files that are only tangentially related.\n37: - If no files match, say so.\n38: \n39: Output format — return ONLY a JSON array of objects, nothing else:\n40: [\n41: { \"path\": \"relative/path/to/file.js\", \"reason\": \"Brief explanation of why this file is relevant\" }\n42: ]\n43: \n44: Do NOT wrap in markdown code fences. Output raw JSON only.`;\n45: \n46: const nvidiaClient = new OpenAI({\n47: apiKey: process.env.NVIDIA_API_KEY || '',\n48: baseURL: 'https://integrate.api.nvidia.com/v1',\n49: });\n50: \n51: // ===== Session State =====\n52: const session = {\n53: conversationHistory: [],\n54: totalTokens: 0,\n55: totalCost: 0,\n56: toolCallCount: 0,\n57: filesModified: new Set(),\n58: filesRead: new Set(),\n59: commandsRun: [],\n60: editHistory: [], // { path, before, after, timestamp }\n61: startTime: Date.now(),\n62: turnCount: 0,\n63: };\n64: \n65: // ===== Shared Utilities =====\n66: function truncateOutput(str) {\n67: if (str.length > MAX_OUTPUT_LEN) {\n68: return str.slice(0, MAX_OUTPUT_LEN) + `\\n... (truncated, ${str.length} chars total)`;\n69: }\n70: return str;\n71: }\n72: \n73: const path = require('path');\n74: \n75: function resolvePath(p) {\n76: if (!p) return PROJECT_ROOT;\n77: return path.isAbsolute(p) ? p : path.resolve(PROJECT_ROOT, p);\n78: }\n79: \n80: function timestamp() {\n81: return new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' });\n82: }\n83: \n84: function sleep(ms) {\n85: return new Promise(r => setTimeout(r, ms));\n86: }\n87: \n88: module.exports = {\n89: NVIDIA_MODEL,\n90: REVIEWER_MODEL,\n91: MAX_TOOL_ITERATIONS,\n92: MAX_OUTPUT_LEN,\n93: TOOL_TIMEOUT,\n94: PROJECT_ROOT,\n95: FILE_PICKER_MODEL,\n96: FILE_PICKER_SYSTEM_PROMPT,\n97: REVIEWER_SYSTEM_PROMPT,\n98: nvidiaClient,\n99: session,\n100: truncateOutput,\n101: resolvePath,\n102: timestamp,\n103: sleep,\n104: };"
795
- },
796
- "trackFiles": [
797
- "file:///home/runner/workspace/src/config.js"
798
- ]
799
- }
800
- }
801
- ]
802
- },
803
- {
804
- "role": "assistant",
805
- "messageId": 12,
806
- "content": [
807
- {
808
- "type": "thinking",
809
- "thinking": "Let me try to find the Codex CLI system prompt directly on GitHub. Let me search for it in a different location.",
810
- "signature": "EpsCCkgICxACGAIqQDSNB5tx1C/IPvhbnnuF7/ugIojzKLkZrg8nLwAMqkilp0VQcqxP+YWu8JvpFYWUqkfyoJsntRMHx5w4cS9hcEUSDBpcnVoW6kaNtbsitxoMnHv4EbDwjridPP4pIjAITa7Pl+e/mDpM7RAkhsN3uTmrkNNiLeFZjhCI2gdka9SSPS6LoSiomB5WPbY8wVAqgAHcBVfBIc2o5s7k/y9FSXMjd5jrkrMvS7Og7CyEALuuqm8Q6+gutPU0hTa4uMcDOxJmdjGIG0zqCEPz4E/iai5tUaXjcgP5mHjA8/dLvHp62opGg/qEUZOPT+AgQwzqyzz3ANbdo00ZtsbN2yXEzN9AiZAGRz6Gs9VLKwRl3g9shRgB",
811
- "provider": "anthropic"
812
- },
813
- {
814
- "type": "tool_use",
815
- "complete": true,
816
- "id": "toolu_vrtx_01MXbeD2gkad6KpDhErKQ1vP",
817
- "name": "read_web_page",
818
- "input": {
819
- "url": "https://raw.githubusercontent.com/openai/codex/main/codex-cli/src/utils/agent/instructions.md",
820
- "objective": "Get the full Codex CLI system prompt instructions"
821
- }
822
- },
823
- {
824
- "type": "tool_use",
825
- "complete": true,
826
- "id": "toolu_vrtx_01QuU3vaSDKmmKcfCyyEpAZi",
827
- "name": "web_search",
828
- "input": {
829
- "objective": "Find the Claude Code CLI system prompt, specifically the extracted/leaked system prompt from the @anthropic-ai/claude-code npm package",
830
- "search_queries": [
831
- "claude code CLI system prompt github",
832
- "claude code system prompt extracted 2025"
833
- ]
834
- }
835
- }
836
- ],
837
- "state": {
838
- "type": "complete",
839
- "stopReason": "tool_use"
840
- },
841
- "usage": {
842
- "model": "claude-opus-4-6",
843
- "maxInputTokens": 168000,
844
- "inputTokens": 1,
845
- "outputTokens": 250,
846
- "cacheCreationInputTokens": 1694,
847
- "cacheReadInputTokens": 38091,
848
- "totalInputTokens": 39786,
849
- "timestamp": "2026-02-26T03:11:43.443Z"
850
- }
851
- },
852
- {
853
- "role": "user",
854
- "messageId": 13,
855
- "content": [
856
- {
857
- "type": "tool_result",
858
- "toolUseID": "toolu_vrtx_01MXbeD2gkad6KpDhErKQ1vP",
859
- "run": {
860
- "status": "done",
861
- "result": "404: Not Found",
862
- "~debug": {
863
- "showParallelAttribution": false
864
- }
865
- }
866
- },
867
- {
868
- "type": "tool_result",
869
- "toolUseID": "toolu_vrtx_01QuU3vaSDKmmKcfCyyEpAZi",
870
- "run": {
871
- "status": "done",
872
- "result": [
873
- {
874
- "title": "system-prompts-and-models-of-ai-tools/Anthropic/Claude Code/Prompt.txt at main · x1xhlol/system-prompts-and-models-of-ai-tools · GitHub",
875
- "url": "https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools/blob/main/Anthropic/Claude%20Code/Prompt.txt",
876
- "excerpts": [
877
- "## Navigation Menu\n\nToggle navigation\n\nAppearance settings\n\nSearch or jump to...\n\n# Search code, repositories, users, issues, pull requests...\n\nSearch\n\nClear\n\n[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)\n\nAppearance settings\n\nResetting focus\n\nYou signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert\n\nx1xhlol / **system-prompts-and-models-of-ai-tools** Public\n\n* Sponsor\n* Notifications You must be signed in to change notification settings\n* Fork 29\\.6k\n* Star 114k\n\n## Collapse file tree\n\n## Files\n\nmain\n\nSearch this repository\n\n* .github\n* Amp\n* Anthropic\n \n + Claude Code\n \n - Prompt.txt\n - Tools.json\n + Claude for Chrome\n + Claude Code 2.0.txt\n + Sonnet 4.5 Prompt.txt\n* Augment Code\n* Cluely\n* CodeBuddy Prompts\n* Comet Assistant\n* Cursor Prompts\n* Devin AI\n* Emergent\n* Google\n* Junie\n* Kiro\n* Leap.new\n* Lovable\n* Manus Agent Tools & Prompt\n* NotionAi\n* Open Source prompts\n* Orchids.app\n* Perplexity\n* Poke\n* Qoder\n* Replit\n* Same.dev\n* Trae\n* Traycer AI\n* VSCode Agent\n* Warp.dev\n* Windsurf\n* Xcode\n* Z.ai Code\n* assets\n* dia\n* v0 Prompts and Tools\n* LICENSE.md\n* README.md\n\n## Breadcrumbs\n\n1. system-prompts-and-models-of-ai-tools\n2. / Anthropic\n3. / Claude Code\n\n/\n\n# Prompt.txt\n\nCopy path\n\nBlame More file actions\n\nBlame More file actions\n\n## Latest commit\n\n x1xhlol\n\nCreate Prompt.txt\n\nDec 2, 2025\n\n243aa62 · Dec 2, 2025\n\n## History\n\nHistory\n\nOpen commit details\n\n History\n\n191 lines (138 loc) · 12.7 KB\n\n## Breadcrumbs\n\n1. system-prompts-and-models-of-ai-tools\n2. / Anthropic\n3. / Claude Code\n\n/\n\n# Prompt.txt\n\nTop\n\n## File metadata and controls\n\n* Code\n* Blame\n\n191 lines (138 loc) · 12.7 KB\n\n[Raw](https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools/raw/refs/heads/main/Anthropic/Claude%20Code/Prompt.txt)\n\nCopy raw file\n\nDownload raw file\n\nOpen symbols panel\n\nEdit and raw actions\n\nYou are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\nIf the user asks for help or wants to give feedback inform them of the following:\n\\- /help: Get help with using Claude Code\n\\- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues\nWhen the user directly asks about Claude Code (eg 'can Claude Code do...', 'does Claude Code have...') or asks in second person (eg 'are you able...', 'can you do...'), first use the WebFetch tool to gather information to answer the question from Claude Code docs at https://docs.anthropic.com/en/docs/claude-code.\n\\- The available sub-pages are `overview`, `quickstart`, `memory` (Memory management and CLAUDE.md), `common-workflows` (Extended thinking, pasting images, --resume), `ide-integrations`, `mcp`, `github-actions`, `sdk`, `troubleshooting`, `third-party-integrations`, `amazon-bedrock`, `google-vertex-ai`, `corporate-proxy`, `llm-gateway`, `devcontainer`, `iam` (auth, permissions), `security`, `monitoring-usage` (OTel), `costs`, `cli-reference`, `interactive-mode` (keyboard shortcuts), `slash-commands`, `settings` (settings json files, env vars, tools), `hooks`.\n\\- Example: https://docs.anthropic.com/en/docs/claude-code/cli-usage\n\\# Tone and style\nYou should be concise, direct, and to the point.\nYou MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail.\nIMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.\nIMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.\nDo not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.\nAnswer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\". Here are some examples to demonstrate appropriate verbosity:\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n<example>\nuser: what command should I run to list files in the current directory?\nassistant: ls\n</example>\n<example>\nuser: what command should I run to watch files in the current directory?\nassistant: [runs ls to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]\nnpm run dev\n</example>\n<example>\nuser: How many golf balls fit inside a jetta?\nassistant: 150000\n</example>\n<example>\nuser: what files are in the directory src/?\nassistant: [runs ls and sees foo.c, bar.c, baz.c]\nuser: which file contains the implementation of foo?\nassistant: src/foo.c\n</example>\nWhen you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).\nRemember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\nIf you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.\nOnly use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\nIMPORTANT: Keep your responses short, since they will be displayed on a command line interface.\n\\# Proactiveness\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\n\\- Doing the right thing when asked, including taking actions and follow-up actions\n\\- Not surprising the user with actions you take without asking\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\n\\# Following conventions\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n\\- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\n\\- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\n\\- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\n\\- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\\# Code style\n\\- IMPORTANT: DO NOT ADD \\*\\*\\*ANY\\*\\*\\* COMMENTS unless asked\n\\# Task Management\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\nExamples:\n<example>\nuser: Run the build and fix any type errors\nassistant: I'm going to use the TodoWrite tool to write the following items to the todo list:\n\\- Run the build\n\\- Fix any type errors\nI'm now going to run the build using Bash.\nLooks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.\nmarking the first todo as in\\_progress\nLet me start working on the first item...\nThe first item has been fixed, let me mark the first todo as completed, and move on to the second item...\n..\n..\n</example>\nIn the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.\n<example>\nuser: Help me write a new feature that allows users to track their usage metrics and export them to various formats\nassistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.\nAdding the following todos to the todo list:\n1\\. Research existing metrics tracking in the codebase\n2\\. Design the metrics collection system\n3\\. Implement core metrics tracking functionality\n4\\. Create export functionality for different formats\nLet me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.\nI'm going to search for any existing metrics or telemetry code in the project.\nI've found some existing telemetry code. Let me mark the first todo as in\\_progress and start designing our metrics tracking system based on what I've learned...\n[Assistant continues implementing the feature step by step, marking todos as in\\_progress and completed as they go]\n</example>\nUsers may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including <user-prompt-submit-hook>, as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration.\n\\# Doing tasks\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n\\- Use the TodoWrite tool to plan the task if required\n\\- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.\n\\- Implement the solution using all tools available to you\n\\- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.\n\\- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time.\nNEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.\n\\- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\n\\# Tool usage policy\n\\- When doing file search, prefer to use the Task tool in order to reduce context usage.\n\\- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.\n\\- When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.\n\\- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\nHere is useful information about the environment you are running in:\n<env>\nWorking directory: ${Working directory}\nIs directory a git repo: Yes\nPlatform: darwin\nOS Version: Darwin 24.6.0\nToday's date: 2025-08-19\n</env>\nYou are powered by the model named Sonnet 4. The exact model ID is claude-sonnet-4-20250514.\nAssistant knowledge cutoff is January 2025.\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\nIMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.\n\\# Code References\nWhen referencing specific functions or pieces of code include the pattern `file\\_path:line\\_number` to allow the user to easily navigate to the source code location.\n<example>\nuser: Where are errors from the client handled?\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.\n</example>\ngitStatus: This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.\nCurrent branch: main\nMain branch (you will usually use this for PRs): main\nStatus:\n(clean)\nRecent commits:\n${Last 5 Recent commits}\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\n11\n\n12\n\n13\n\n14\n\n15\n\n16\n\n17\n\n18\n\n19\n\n20\n\n21\n\n22\n\n23\n\n24\n\n25\n\n26\n\n27\n\n28\n\n29\n\n30\n\n31\n\n32\n\n33\n\n34\n\n35\n\n36\n\n37\n\n38\n\n39\n\n40\n\n41\n\n42\n\n43\n\n44\n\n45\n\n46\n\n47\n\n48\n\n49\n\n50\n\n51\n\n52\n\n53\n\n54\n\n55\n\n56\n\n57\n\n58\n\n59\n\n60\n\n61\n\n62\n\n63\n\n64\n\n65\n\n66\n\n67\n\n68\n\n69\n\n70\n\n71\n\n72\n\n73\n\n74\n\n75\n\n76\n\n77\n\n78\n\n79\n\n80\n\n81\n\n82\n\n83\n\n84\n\n85\n\n86\n\n87\n\n88\n\n89\n\n90\n\n91\n\n92\n\n93\n\n94\n\n95\n\n96\n\n97\n\n98\n\n99\n\n100\n\n101\n\n102\n\n103\n\n104\n\n105\n\n106\n\n107\n\n108\n\n109\n\n110\n\n111\n\n112\n\n113\n\n114\n\n115\n\n116\n\n117\n\n118\n\n119\n\n120\n\n121\n\n122\n\n123\n\n124\n\n125\n\n126\n\n127\n\n128\n\n129\n\n130\n\n131\n\n132\n\n133\n\n134\n\n135\n\n136\n\n137\n\n138\n\n139\n\n140\n\n141\n\n142\n\n143\n\n144\n\n145\n\n146\n\n147\n\n148\n\n149\n\n150\n\n151\n\n152\n\n153\n\n154\n\n155\n\n156\n\n157\n\n158\n\n159\n\n160\n\n161\n\n162\n\n163\n\n164\n\n165\n\n166\n\n167\n\n168\n\n169\n\n170\n\n171\n\n172\n\n173\n\n174\n\n175\n\n176\n\n177\n\n178\n\n179\n\n180\n\n181\n\n182\n\n183\n\n184\n\n185\n\n186\n\n187\n\n188\n\n189\n\n190\n\n191\n\nYou are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\n\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\n\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\n\nIf the user asks for help or wants to give feedback inform them of the following:\n\n\\- /help: Get help with using Claude Code\n\n\\- To give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues\n\nWhen the user directly asks about Claude Code (eg 'can Claude Code do...', 'does Claude Code have...') or asks in second person (eg 'are you able...', 'can you do...'), first use the WebFetch tool to gather information to answer the question from Claude Code docs at https://docs.anthropic.com/en/docs/claude-code.\n\n\\- The available sub-pages are `overview`, `quickstart`, `memory` (Memory management and CLAUDE.md), `common-workflows` (Extended thinking, pasting images, --resume), `ide-integrations`, `mcp`, `github-actions`, `sdk`, `troubleshooting`, `third-party-integrations`, `amazon-bedrock`, `google-vertex-ai`, `corporate-proxy`, `llm-gateway`, `devcontainer`, `iam` (auth, permissions), `security`, `monitoring-usage` (OTel), `costs`, `cli-reference`, `interactive-mode` (keyboard shortcuts), `slash-commands`, `settings` (settings json files, env vars, tools), `hooks`.\n\n\\- Example: https://docs.anthropic.com/en/docs/claude-code/cli-usage\n\n\\# Tone and style\n\nYou should be concise, direct, and to the point.\n\nYou MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail.\n\nIMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.\n\nIMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.\n\nDo not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did.\n\nAnswer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as \"The answer is <answer>.\", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\". Here are some examples to demonstrate appropriate verbosity:\n\n<example>\n\nuser: 2 + 2\n\nassistant: 4\n\n</example>\n\n<example>\n\nuser: what is 2+2?\n\nassistant: 4\n\n</example>\n\n<example>\n\nuser: is 11 a prime number?\n\nassistant: Yes\n\n</example>\n\n<example>\n\nuser: what command should I run to list files in the current directory?\n\nassistant: ls\n\n</example>\n\n<example>\n\nuser: what command should I run to watch files in the current directory?\n\nassistant: [runs ls to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]\n\nnpm run dev\n\n</example>\n\n<example>\n\nuser: How many golf balls fit inside a jetta?\n\nassistant: 150000\n\n</example>\n\n<example>\n\nuser: what files are in the directory src/?\n\nassistant: [runs ls and sees foo.c, bar.c, baz.c]\n\nuser: which file contains the implementation of foo?\n\nassistant: src/foo.c\n\n</example>\n\nWhen you run a non-trivial bash command, you should explain what the command does and why you are running it, to make sure the user understands what you are doing (this is especially important when you are running a command that will make changes to the user's system).\n\nRemember that your output will be displayed on a command line interface. Your responses can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.\n\nOutput text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.\n\nIf you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.\n\nOnly use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\n\nIMPORTANT: Keep your responses short, since they will be displayed on a command line interface.\n\n\\# Proactiveness\n\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\n\n\\- Doing the right thing when asked, including taking actions and follow-up actions\n\n\\- Not surprising the user with actions you take without asking\n\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\n\n\\# Following conventions\n\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\n\n\\- NEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\n\n\\- When you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\n\n\\- When you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\n\n\\- Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\n\n\\# Code style\n\n\\- IMPORTANT: DO NOT ADD \\*\\*\\*ANY\\*\\*\\* COMMENTS unless asked\n\n\\# Task Management\n\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\n\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\n\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\n\nExamples:\n\n<example>\n\nuser: Run the build and fix any type errors\n\nassistant: I'm going to use the TodoWrite tool to write the following items to the todo list:\n\n\\- Run the build\n\n\\- Fix any type errors\n\nI'm now going to run the build using Bash.\n\nLooks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.\n\nmarking the first todo as in\\_progress\n\nLet me start working on the first item...\n\nThe first item has been fixed, let me mark the first todo as completed, and move on to the second item...\n\n..\n\n..\n\n</example>\n\nIn the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.\n\n<example>\n\nuser: Help me write a new feature that allows users to track their usage metrics and export them to various formats\n\nassistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.\n\nAdding the following todos to the todo list:\n\n1\\. Research existing metrics tracking in the codebase\n\n2\\. Design the metrics collection system\n\n3\\. Implement core metrics tracking functionality\n\n4\\. Create export functionality for different formats\n\nLet me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.\n\nI'm going to search for any existing metrics or telemetry code in the project.\n\nI've found some existing telemetry code. Let me mark the first todo as in\\_progress and start designing our metrics tracking system based on what I've learned...\n\n[Assistant continues implementing the feature step by step, marking todos as in\\_progress and completed as they go]\n\n</example>\n\nUsers may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including <user-prompt-submit-hook>, as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration.\n\n\\# Doing tasks\n\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\n\n\\- Use the TodoWrite tool to plan the task if required\n\n\\- Use the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially.\n\n\\- Implement the solution using all tools available to you\n\n\\- Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach.\n\n\\- VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time.\n\nNEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.\n\n\\- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\n\n\\# Tool usage policy\n\n\\- When doing file search, prefer to use the Task tool in order to reduce context usage.\n\n\\- You should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.\n\n\\- When WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.\n\n\\- You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\n\nHere is useful information about the environment you are running in:\n\n<env>\n\nWorking directory: ${Working directory}\n\nIs directory a git repo: Yes\n\nPlatform: darwin\n\nOS Version: Darwin 24.6.0\n\nToday's date: 2025-08-19\n\n</env>\n\nYou are powered by the model named Sonnet 4. The exact model ID is claude-sonnet-4-20250514.\n\nAssistant knowledge cutoff is January 2025.\n\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\n\nIMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.\n\n\\# Code References\n\nWhen referencing specific functions or pieces of code include the pattern `file\\_path:line\\_number` to allow the user to easily navigate to the source code location.\n\n<example>\n\nuser: Where are errors from the client handled?\n\nassistant: Clients are marked as failed in the `connectToServer` function in src/services/process.ts:712.\n\n</example>\n\ngitStatus: This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.\n\nCurrent branch: main\n\nMain branch (you will usually use this for PRs): main\n\nStatus:\n\n(clean)\n\nRecent commits:\n\n${Last 5 Recent commits}\n\n## Footer\n\nYou can’t perform that action at this time.\n\nWhile the code is focused, press Alt+F1 for a menu of operations."
878
- ]
879
- },
880
- {
881
- "title": "GitHub - Piebald-AI/claude-code-system-prompts: All parts of Claude Code's system prompt, 18 builtin tool descriptions, sub agent prompts (Plan/Explore/Task), utility prompts (CLAUDE.md, compact, statusline, magic docs, WebFetch, Bash cmd, security review, agent creation). Updated for each Claude Code version.",
882
- "url": "https://github.com/Piebald-AI/claude-code-system-prompts",
883
- "excerpts": [
884
- "## Navigation Menu\n\nToggle navigation\n\nAppearance settings\n\n* Platform\n \n + AI CODE CREATION\n \n - [GitHub Copilot Write better code with AI](https://github.com/features/copilot)\n - [GitHub Spark Build and deploy intelligent apps](https://github.com/features/spark)\n - [GitHub Models Manage and compare prompts](https://github.com/features/models)\n - [MCP Registry <sup>New</sup> Integrate external tools](https://github.com/mcp)\n + DEVELOPER WORKFLOWS\n \n - [Actions Automate any workflow](https://github.com/features/actions)\n - [Codespaces Instant dev environments](https://github.com/features/codespaces)\n - [Issues Plan and track work](https://github.com/features/issues)\n - [Code Review Manage code changes](https://github.com/features/code-review)\n + APPLICATION SECURITY\n \n - [GitHub Advanced Security Find and fix vulnerabilities](https://github.com/security/advanced-security)\n - [Code security Secure your code as you build](https://github.com/security/advanced-security/code-security)\n - [Secret protection Stop leaks before they start](https://github.com/security/advanced-security/secret-protection)\n + EXPLORE\n \n - [Why GitHub](https://github.com/why-github)\n - [Documentation](https://docs.github.com)\n - [Blog](https://github.blog)\n - [Changelog](https://github.blog/changelog)\n - [Marketplace](https://github.com/marketplace)\n \n [View all features](https://github.com/features)\n* Solutions\n \n + BY COMPANY SIZE\n \n - [Enterprises](https://github.com/enterprise)\n - [Small and medium teams](https://github.com/team)\n - [Startups](https://github.com/enterprise/startups)\n - [Nonprofits](https://github.com/solutions/industry/nonprofits)\n + BY USE CASE\n \n - [App Modernization](https://github.com/solutions/use-case/app-modernization)\n - [DevSecOps](https://github.com/solutions/use-case/devsecops)\n - [DevOps](https://github.com/solutions/use-case/devops)\n - [CI/CD](https://github.com/solutions/use-case/ci-cd)\n - [View all use cases](https://github.com/solutions/use-case)\n + BY INDUSTRY\n \n - [Healthcare](https://github.com/solutions/industry/healthcare)\n - [Financial services](https://github.com/solutions/industry/financial-services)\n - [Manufacturing](https://github.com/solutions/industry/manufacturing)\n - [Government](https://github.com/solutions/industry/government)\n - [View all industries](https://github.com/solutions/industry)\n \n [View all solutions](https://github.com/solutions)\n* Resources\n \n + EXPLORE BY TOPIC\n \n - [AI](https://github.com/resources/articles?topic=ai)\n - [Software Development](https://github.com/resources/articles?topic=software-development)\n - [DevOps](https://github.com/resources/articles?topic=devops)\n - [Security](https://github.com/resources/articles?topic=security)\n - [View all topics](https://github.com/resources/articles)\n + EXPLORE BY TYPE\n \n - [Customer stories](https://github.com/customer-stories)\n - [Events & webinars](https://github.com/resources/events)\n - [Ebooks & reports](https://github.com/resources/whitepapers)\n - [Business insights](https://github.com/solutions/executive-insights)\n - [GitHub Skills](https://skills.github.com)\n + SUPPORT & SERVICES\n \n - [Documentation](https://docs.github.com)\n - [Customer support](https://support.github.com)\n - [Community forum](https://github.com/orgs/community/discussions)\n - [Trust center](https://github.com/trust-center)\n - [Partners](https://github.com/partners)\n \n [View all resources](https://github.com/resources)\n* Open Source\n \n + COMMUNITY\n \n - [GitHub Sponsors Fund open source developers](https://github.com/sponsors)\n + PROGRAMS\n \n - [Security Lab](https://securitylab.github.com)\n - [Maintainer Community](https://maintainers.github.com)\n - [Accelerator](https://github.com/accelerator)\n - [Archive Program](https://archiveprogram.github.com)\n + REPOSITORIES\n \n - [Topics](https://github.com/topics)\n - [Trending](https://github.com/trending)\n - [Collections](https://github.com/collections)\n* Enterprise\n \n + ENTERPRISE SOLUTIONS\n \n - [Enterprise platform AI-powered developer platform](https://github.com/enterprise)\n + AVAILABLE ADD-ONS\n \n - [GitHub Advanced Security Enterprise-grade security features](https://github.com/security/advanced-security)\n - [Copilot for Business Enterprise-grade AI features](https://github.com/features/copilot/copilot-business)\n - [Premium Support Enterprise-grade 24/7 support](https://github.com/premium-support)\n* [Pricing](https://github.com/pricing)\n\nSearch or jump to...\n\n# Search code, repositories, users, issues, pull requests...\n\nSearch\n\nClear\n\n[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)\n\nAppearance settings\n\nResetting focus\n\nYou signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert\n\nPiebald-AI / **claude-code-system-prompts** Public\n\n* Notifications You must be signed in to change notification settings\n* Fork 703\n* Star 4\\.9k\n\nAll parts of Claude Code's system prompt, 18 builtin tool descriptions, sub agent prompts (Plan/Explore/Task), utility prompts (CLAUDE.md, compact, statusline, magic docs, WebFetch, Bash cmd, security review, agent creation). Updated for each Claude Code version.\n\n### License\n\nMIT license\n\n4\\.9k stars 703 forks Branches Tags Activity\n\nStar\n\nNotifications You must be signed in to change notification settings\n\n* Code\n* Issues 1\n* Pull requests 0\n* Discussions\n* Actions\n* Security 0\n* Insights\n\nAdditional navigation options * Code\n* Issues\n* Pull requests\n* Discussions\n* Actions\n* Security\n* Insights\n\n# Piebald-AI/claude-code-system-prompts\n\nmain\n\nBranches Tags\n\n \n\nGo to file\n\nCode\n\nOpen more actions menu\n\n## Folders and files\n\n|Name |Name |Last commit message |Last commit date |\n| --- | --- | --- | --- |\n|## Latest commit\n\n## History\n\n235 Commits\n\n 235 Commits |\n|system-prompts |system-prompts | | |\n|tools |tools | | |\n|CHANGELOG.md |CHANGELOG.md | | |\n|CLAUDE.md |CLAUDE.md | | |\n|LICENSE |LICENSE | | |\n|README.md |README.md | | |\n|View all files |\n\n## Repository files navigation\n\n* README\n* MIT license\n\n[](https://piebald.ai)\n\n### Check out Piebald\n\nWe've released **Piebald** , the ultimate agentic AI developer experience. \nDownload it and try it out for free! **<https://piebald.ai/>**\n\n[](https://piebald.ai/discord) [](https://x.com/PiebaldAI)\n\n<sub>**Scroll down for Claude Code's system prompts.** 👇</sub>\n\n[](https://piebald.ai)\n\n# Claude Code System Prompts\n\n[](https://github.com/hesreallyhim/awesome-claude-code)\n\nImportant\n\n**NEW (January 23, 2026): We've added all of Claude Code's ~40 system reminders to this list—see System Reminders .**\n\nThis repository contains an up-to-date list of all Claude Code's various system prompts and their associated token counts as of **[Claude Code v2.1.52](https://www.npmjs.com/package/@anthropic-ai/claude-code/v/2.1.52) (February 23rd, 2026).** It also contains a **CHANGELOG.md** for the system prompts across 106 versions since v2.0.14. From the team behind [**Piebald.**](https://piebald.ai/)\n\n**This repository is updated within minutes of each Claude Code release. See the changelog , and follow [@PiebaldAI](https://x.com/PiebaldAI) on X for a summary of the system prompt changes in each release.**\n\nNote\n\n⭐ **Star** this repository to get notified about new Claude Code versions. For each new Claude Code version, we create a release on GitHub, which will notify all users who've starred the repository.\n\n* * *\n\nWhy multiple \"system prompts?\"\n\n**Claude Code doesn't just have one single string for its system prompt.**\n\nInstead, there are:\n\n* Large portions conditionally added depending on the environment and various configs.\n* Descriptions for builtin tools like `Write` , `Bash` , and `TodoWrite` , and some are fairly large.\n* Separate system prompts for builtin agents like Explore and Plan.\n* Numerous AI-powered utility functions, such as conversation compaction, `CLAUDE.md` generation, session title generation, etc. featuring their own systems prompts.\n\nThe result—110+ strings that are constantly changing and moving within a very large minified JS file.\n\nTip\n\nWant to **modify a particular piece of the system prompt** in your own Claude Code installation? **Use [tweakcc](https://github.com/Piebald-AI/tweakcc) .** It—\n\n* lets you customize the the individual pieces of the system prompt as markdown files, and then\n* patches your npm-based or native (binary) Claude Code installation with them, and also\n* provides diffing and conflict management for when both you and Anthropic have conflicting modifications to the same prompt file.\n\n## Extraction\n\nThis repository contains the system prompts extracted using a script from the latest npm version of Claude Code. As they're extracted directly from Claude Code's compiled source code, they're guaranteed to be exactly what Claude Code uses. If you use [tweakcc](https://github.com/Piebald-AI/tweakcc) to customize the system prompts, it works in a similar way—it patches the exact same strings in your local installation as are extracted into this repository.\n\n## Prompts\n\nNote that some prompts contain interpolated bits such as builtin tool name references, lists of available sub agents, and various other context-specific variables, so the actual counts in a particular Claude Code session will differ slightly—likely not beyond ±20 tokens, however.\n\n### Agent Prompts\n\nSub-agents and utilities.\n\n#### Sub-agents\n\n* Agent Prompt: Explore ( **516** tks) - System prompt for the Explore subagent.\n* Agent Prompt: Plan mode (enhanced) ( **633** tks) - Enhanced prompt for the Plan subagent.\n* Agent Prompt: Task tool (extra notes) ( **127** tks) - Additional notes for Task tool usage (absolute paths, no emojis, no colons before tool calls).\n* Agent Prompt: Task tool ( **294** tks) - System prompt given to the subagent spawned via the Task tool.\n\n### Creation Assistants\n\n* Agent Prompt: Agent creation architect ( **1110** tks) - System prompt for creating custom AI agents with detailed specifications.\n* Agent Prompt: CLAUDE.md creation ( **384** tks) - System prompt for analyzing codebases and creating CLAUDE.md documentation files.\n* Agent Prompt: Status line setup ( **1502** tks) - System prompt for the statusline-setup agent that configures status line display.\n\n### Slash commands\n\n* Agent Prompt: /pr-comments slash command ( **396** tks) - System prompt for fetching and displaying GitHub PR comments.\n* Agent Prompt: /review-pr slash command ( **211** tks) - System prompt for reviewing GitHub pull requests with code analysis.\n* Agent Prompt: /security-review slash command ( **2610** tks) - Comprehensive security review prompt for analyzing code changes with focus on exploitable vulnerabilities.\n\n### Utilities\n\n* Agent Prompt: Agent Hook ( **133** tks) - Prompt for an 'agent hook'.\n* Agent Prompt: Bash command description writer ( **207** tks) - Instructions for generating clear, concise command descriptions in active voice for bash commands.\n* Agent Prompt: Bash command file path extraction ( **286** tks) - System prompt for extracting file paths from bash command output.\n* Agent Prompt: Bash command prefix detection ( **823** tks) - System prompt for detecting command prefixes and command injection.\n* Agent Prompt: Claude guide agent ( **761** tks) - System prompt for the claude-guide agent that helps users understand and use Claude Code, the Claude Agent SDK and the Claude API effectively..\n* Agent Prompt: Command execution specialist ( **109** tks) - System prompt for command execution agent focusing on bash commands.\n* Agent Prompt: Conversation summarization ( **1121** tks) - System prompt for creating detailed conversation summaries.\n* Agent Prompt: Hook condition evaluator ( **78** tks) - System prompt for evaluating hook conditions in Claude Code.\n* Agent Prompt: Prompt Suggestion Generator v2 ( **296** tks) - V2 instructions for generating prompt suggestions for Claude Code.\n* Agent Prompt: Quick PR creation ( **945** tks) - Streamlined prompt for creating a commit and pull request with pre-populated context.\n* Agent Prompt: Quick git commit ( **507** tks) - Streamlined prompt for creating a single git commit with pre-populated context.\n* Agent Prompt: Recent Message Summarization ( **720** tks) - Agent prompt used for summarizing recent messages..\n* Agent Prompt: Session Search Assistant ( **439** tks) - Agent prompt for the session search assistant that finds relevant sessions based on user queries and metadata.\n* Agent Prompt: Session memory update instructions ( **756** tks) - Instructions for updating session memory files during conversations.\n* Agent Prompt: Session title and branch generation ( **307** tks) - Agent for generating succinct session titles and git branch names.\n* Agent Prompt: Update Magic Docs ( **718** tks) - Prompt for the magic-docs agent..\n* Agent Prompt: User sentiment analysis ( **205** tks) - System prompt for analyzing user frustration and PR creation requests.\n* Agent Prompt: WebFetch summarizer ( **189** tks) - Prompt for agent that summarizes verbose output from WebFetch for the main model.\n\n### Data\n\nThe content of various template files embedded in Claude Code.\n\n* Data: Agent SDK patterns — Python ( **2350** tks) - Python Agent SDK patterns including custom tools, hooks, subagents, MCP integration, and session resumption.\n* Data: Agent SDK patterns — TypeScript ( **1069** tks) - TypeScript Agent SDK patterns including basic agents, hooks, subagents, and MCP integration.\n* Data: Agent SDK reference — Python ( **2750** tks) - Python Agent SDK reference including installation, quick start, custom tools via MCP, and hooks.\n* Data: Agent SDK reference — TypeScript ( **2287** tks) - TypeScript Agent SDK reference including installation, quick start, custom tools, and hooks.\n* Data: Claude API reference — C# ( **550** tks) - C# SDK reference including installation, client initialization, basic requests, streaming, and tool use.\n* Data: Claude API reference — Go ( **621** tks) - Go SDK reference including installation, client initialization, basic requests, streaming, and manual agentic loop.\n* Data: Claude API reference — Java ( **1226** tks) - Java SDK reference including installation, client initialization, basic requests, streaming, and beta tool use.\n* Data: Claude API reference — PHP ( **394** tks) - PHP SDK reference including installation, client initialization, and basic message requests.\n* Data: Claude API reference — Python ( **3248** tks) - Python SDK reference including installation, client initialization, basic requests, thinking, and multi-turn conversation.\n* Data: Claude API reference — Ruby ( **622** tks) - Ruby SDK reference including installation, client initialization, basic requests, streaming, and beta tool runner.\n* Data: Claude API reference — TypeScript ( **2388** tks) - TypeScript SDK reference including installation, client initialization, basic requests, thinking, and multi-turn conversation.\n* Data: Claude Code version mismatch warning ( **173** tks) - Warning shown when Claude Code version is outdated.\n* Data: Claude model catalog ( **1510** tks) - Catalog of current and legacy Claude models with exact model IDs, aliases, context windows, and pricing.\n* Data: Files API reference — Python ( **1303** tks) - Python Files API reference including file upload, listing, deletion, and usage in messages.\n* Data: Files API reference — TypeScript ( **798** tks) - TypeScript Files API reference including file upload, listing, deletion, and usage in messages.\n* Data: GitHub Actions workflow for @claude mentions ( **527** tks) - GitHub Actions workflow template for triggering Claude Code via @claude mentions.\n* Data: GitHub App installation PR description ( **424** tks) - Template for PR description when installing Claude Code GitHub App integration.\n* Data: HTTP error codes reference ( **1387** tks) - Reference for HTTP error codes returned by the Claude API with common causes and handling strategies.\n* Data: Live documentation sources ( **2337** tks) - WebFetch URLs for fetching current Claude API and Agent SDK documentation from official sources.\n* Data: Message Batches API reference — Python ( **1505** tks) - Python Batches API reference including batch creation, status polling, and result retrieval at 50% cost.\n* Data: Session memory template ( **292** tks) - Template structure for session memory `summary.md` files.\n* Data: Streaming reference — Python ( **1534** tks) - Python streaming reference including sync/async streaming and handling different content types.\n* Data: Streaming reference — TypeScript ( **1553** tks) - TypeScript streaming reference including basic streaming and handling different content types.\n* Data: Tool use concepts ( **3640** tks) - Conceptual foundations of tool use with the Claude API including tool definitions, tool choice, and best practices.\n* Data: Tool use reference — Python ( **4180** tks) - Python tool use reference including tool runner, manual agentic loop, code execution, and structured outputs.\n* Data: Tool use reference — TypeScript ( **3228** tks) - TypeScript tool use reference including tool runner, manual agentic loop, code execution, and structured outputs.\n\n### System Prompt\n\nParts of the main system prompt.\n\n* **System Prompt: Main system prompt** ( **269** tks) - Core identity and capabilities of Claude Code as an interactive CLI assistant.\n* System Prompt: Agent Summary Generation ( **178** tks) - System prompt used for \"Agent Summary\" generation..\n* System Prompt: Agent memory instructions ( **337** tks) - Instructions for including memory update guidance in agent system prompts.\n* System Prompt: Censoring assistance with malicious activities ( **98** tks) - Guidelines for assisting with authorized security testing, defensive security, CTF challenges, and educational contexts while censoring requests for malicious activities.\n* System Prompt: Chrome browser MCP tools ( **156** tks) - Instructions for loading Chrome browser MCP tools via MCPSearch before use.\n* System Prompt: Claude in Chrome browser automation ( **759** tks) - Instructions for using Claude in Chrome browser automation tools effectively.\n* System Prompt: Conditional delegate codebase exploration ( **249** tks) - Instructions for when to use the Explore subagent versus calling tools directly..\n* System Prompt: Context compaction summary ( **278** tks) - Prompt used for context compaction summary (for the SDK).\n* System Prompt: Doing tasks ( **437** tks) - Instructions for performing software engineering tasks.\n* System Prompt: Executing actions with care ( **541** tks) - Instructions for executing actions carefully..\n* System Prompt: Git status ( **97** tks) - System prompt for displaying the current git status at the start of the conversation.\n* System Prompt: Hooks Configuration ( **1461** tks) - System prompt for hooks configuration. Used for above Claude Code config skill..\n* System Prompt: Insights at a glance summary ( **569** tks) - Generates a concise 4-part summary (what's working, hindrances, quick wins, ambitious workflows) for the insights report.\n* System Prompt: Insights friction analysis ( **139** tks) - Analyzes aggregated usage data to identify friction patterns and categorize recurring issues.\n* System Prompt: Insights on the horizon ( **148** tks) - Identifies ambitious future workflows and opportunities for autonomous AI-assisted development.\n* System Prompt: Insights session facets extraction ( **310** tks) - Extracts structured facets (goal categories, satisfaction, friction) from a single Claude Code session transcript.\n* System Prompt: Insights suggestions ( **748** tks) - Generates actionable suggestions including CLAUDE.md additions, features to try, and usage patterns.\n* System Prompt: Learning mode (insights) ( **142** tks) - Instructions for providing educational insights when learning mode is active.\n* System Prompt: Learning mode ( **1042** tks) - Main system prompt for learning mode with human collaboration instructions.\n* System Prompt: Option previewer ( **129** tks) - System prompt for previewing UI options in a side-by-side layout.\n* System Prompt: Parallel tool call note (part of \"Tool usage policy\") ( **102** tks) - System prompt for telling Claude to using parallel tool calls.\n* System Prompt: Scratchpad directory ( **170** tks) - Instructions for using a dedicated scratchpad directory for temporary files.\n* System Prompt: Skillify Current Session ( **1882** tks) - System prompt for converting the current session in to a skill..\n* System Prompt: Task management ( **565** tks) - Instructions for using task management tools.\n* System Prompt: Teammate Communication ( **127** tks) - System prompt for teammate communication in swarm.\n* System Prompt: Tone and style ( **500** tks) - Guidelines for communication tone and response style.\n* System Prompt: Tool Use Summary Generation ( **171** tks) - Prompt for generating summaries of tool usage.\n* System Prompt: Tool execution denied ( **144** tks) - System prompt for when tool execution is denied.\n* System Prompt: Tool permission mode ( **155** tks) - Guidance on tool permission modes and handling denied tool calls.\n* System Prompt: Tool usage policy ( **352** tks) - Policies and guidelines for tool usage.\n\n### System Reminders\n\nText for large system reminders.\n\n* System Reminder: /btw side question ( **172** tks) - System reminder for /btw slash command side questions without tools.\n* System Reminder: Agent mention ( **45** tks) - Notification that user wants to invoke an agent.\n* System Reminder: Compact file reference ( **57** tks) - Reference to file read before conversation summarization.\n* System Reminder: Exited plan mode ( **73** tks) - Notification when exiting plan mode.\n* System Reminder: File exists but empty ( **27** tks) - Warning when reading an empty file.\n* System Reminder: File modified by user or linter ( **97** tks) - Notification that a file was modified externally.\n* System Reminder: File opened in IDE ( **37** tks) - Notification that user opened a file in IDE.\n* System Reminder: File shorter than offset ( **59** tks) - Warning when file read offset exceeds file length.\n* System Reminder: File truncated ( **74** tks) - Notification that file was truncated due to size.\n* System Reminder: Hook JSON validation failed ( **320** tks) - Error when hook JSON output fails validation.\n* System Reminder: Hook additional context ( **35** tks) - Additional context from a hook.\n* System Reminder: Hook blocking error ( **52** tks) - Error from a blocking hook command.\n* System Reminder: Hook stopped continuation prefix ( **12** tks) - Prefix for hook stopped continuation messages.\n* System Reminder: Hook stopped continuation ( **30** tks) - Message when a hook stops continuation.\n* System Reminder: Hook success ( **29** tks) - Success message from a hook.\n* System Reminder: Invoked skills ( **33** tks) - List of skills invoked in this session.\n* System Reminder: Lines selected in IDE ( **66** tks) - Notification about lines selected by user in IDE.\n* System Reminder: MCP resource no content ( **41** tks) - Shown when MCP resource has no content.\n* System Reminder: MCP resource no displayable content ( **43** tks) - Shown when MCP resource has no displayable content.\n* System Reminder: Malware analysis after Read tool call ( **87** tks) - Instructions for analyzing malware without improving or augmenting it.\n* System Reminder: Memory file contents ( **38** tks) - Contents of a memory file by path.\n* System Reminder: Nested memory contents ( **33** tks) - Contents of a nested memory file.\n* System Reminder: New diagnostics detected ( **35** tks) - Notification about new diagnostic issues.\n* System Reminder: Output style active ( **32** tks) - Notification that an output style is active.\n* System Reminder: Output token limit exceeded ( **35** tks) - Warning when response exceeds output token limit.\n* System Reminder: Plan file reference ( **62** tks) - Reference to an existing plan file.\n* System Reminder: Plan mode is active (5-phase) ( **1511** tks) - Enhanced plan mode system reminder with parallel exploration and multi-agent planning.\n* System Reminder: Plan mode is active (iterative) ( **797** tks) - Iterative plan mode system reminder for main agent with user interviewing workflow.\n* System Reminder: Plan mode is active (subagent) ( **307** tks) - Simplified plan mode system reminder for sub agents.\n* System Reminder: Plan mode re-entry ( **236** tks) - System reminder sent when the user enters Plan mode after having previously exited it either via shift+tab or by approving Claude's plan..\n* System Reminder: Session continuation ( **37** tks) - Notification that session continues from another machine.\n* System Reminder: Task status ( **18** tks) - Task status with TaskOutput tool reference.\n* System Reminder: Task tools reminder ( **123** tks) - Reminder to use task tracking tools.\n* System Reminder: Team Coordination ( **247** tks) - System reminder for team coordination.\n* System Reminder: Team Shutdown ( **136** tks) - System reminder for team shutdown.\n* System Reminder: Todo list changed ( **61** tks) - Notification that todo list has changed.\n* System Reminder: Todo list empty ( **83** tks) - Reminder that todo list is empty.\n* System Reminder: TodoWrite reminder ( **98** tks) - Reminder to use TodoWrite tool for task tracking.\n* System Reminder: Token usage ( **39** tks) - Current token usage statistics.\n* System Reminder: USD budget ( **42** tks) - Current USD budget statistics.\n* System Reminder: Verify plan reminder ( **47** tks) - Reminder to verify completed plan.\n\n### Builtin Tool Descriptions\n\n* Tool Description: AskUserQuestion ( **287** tks) - Tool description for asking user questions..\n* Tool Description: Bash ( **1067** tks) - Description for the Bash tool, which allows Claude to run shell commands.\n* Tool Description: Computer ( **161** tks) - Main description for the Chrome browser computer automation tool.\n* Tool Description: Edit ( **246** tks) - Tool for performing exact string replacements in files.\n* Tool Description: EnterPlanMode ( **878** tks) - Tool description for entering plan mode to explore and design implementation approaches.\n* Tool Description: EnterWorktree ( **334** tks) - Tool description for the EnterWorktree tool..\n* Tool Description: ExitPlanMode ( **417** tks) - Description for the ExitPlanMode tool, which presents a plan dialog for the user to approve.\n* Tool Description: Glob ( **122** tks) - Tool description for file pattern matching and searching by name.\n* Tool Description: Grep ( **300** tks) - Tool description for content search using ripgrep.\n* Tool Description: LSP ( **255** tks) - Description for the LSP tool..\n* Tool Description: NotebookEdit ( **121** tks) - Tool description for editing Jupyter notebook cells.\n* Tool Description: ReadFile ( **469** tks) - Tool description for reading files.\n* Tool Description: SendMessageTool ( **1241** tks) - Tool for sending messages to teammates and handling protocol requests/responses in a swarm.\n* Tool Description: Skill ( **326** tks) - Tool description for executing skills in the main conversation.\n* Tool Description: Sleep ( **154** tks) - Tool for waiting/sleeping with early wake capability on user input.\n* Tool Description: TaskCreate ( **558** tks) - Tool description for TaskCreate tool.\n* Tool Description: Task ( **1317** tks) - Tool description for launching specialized sub-agents to handle complex tasks.\n* Tool Description: TeamDelete ( **154** tks) - Tool description for the TeamDelete tool.\n* Tool Description: TeammateTool ( **1642** tks) - Tool for managing teams and coordinating teammates in a swarm.\n* Tool Description: TodoWrite ( **2167** tks) - Tool description for creating and managing task lists.\n* Tool Description: ToolSearch extended ( **690** tks) - Extended usage instructions for ToolSearch including query modes and examples.\n* Tool Description: ToolSearch ( **144** tks) - Tool description for loading and searching deferred tools before use.\n* Tool Description: WebFetch ( **297** tks) - Tool description for web fetch functionality.\n* Tool Description: WebSearch ( **319** tks) - Tool description for web search functionality.\n* Tool Description: Write ( **127** tks) - Tool for writing files to the local filesystem.\n\n**Additional notes for some Tool Desscriptions**\n\n* Tool Description: Bash (Git commit and PR creation instructions) ( **1558** tks) - Instructions for creating git commits and GitHub pull requests.\n* Tool Description: Bash (sandbox note) ( **438** tks) - Note about bash command sandboxing.\n* Tool Description: TaskList (teammate workflow) ( **133** tks) - Conditional section appended to TaskList tool description.\n\n## About\n\nAll parts of Claude Code's system prompt, 18 builtin tool descriptions, sub agent prompts (Plan/Explore/Task), utility prompts (CLAUDE.md, compact, statusline, magic docs, WebFetch, Bash cmd, security review, agent creation). Updated for each Claude Code version.\n\n### Topics\n\nsystem-prompts claude-code claude-code-system-prompts\n\n### Resources\n\nReadme\n\n### License\n\nMIT license\n\n### Uh oh!\n\nThere was an error while loading. Please reload this page .\n\nActivity\n\nCustom properties\n\n### Stars\n\n**4\\.9k** stars\n\n### Watchers\n\n**67** watching\n\n### Forks\n\n**703** forks\n\nReport repository\n\n## Releases 55\n\nv2.1.52 Latest Feb 24, 2026\n\n\\+ 54 releases\n\n## Packages 0\n\nNo packages published\n\n## Contributors 4\n\n* [](https://github.com/mike1858) [**mike1858** Mike](https://github.com/mike1858)\n* [](https://github.com/bl-ue) [**bl-ue**](https://github.com/bl-ue)\n* [](https://github.com/signadou) [**signadou**](https://github.com/signadou)\n* [](https://github.com/ddaanet) [**ddaanet** David Allouche](https://github.com/ddaanet)\n\n## Languages\n\n* JavaScript 100\\.0%\n\n## Footer\n\nYou can’t perform that action at this time."
885
- ]
886
- },
887
- {
888
- "title": "The Claude Code System Prompt Leaked",
889
- "url": "https://www.reddit.com/r/ArtificialInteligence/comments/1nc9kig/the_claude_code_system_prompt_leaked/",
890
- "excerpts": [
891
- "Skip to main content Open menu Open navigation Go to Reddit Home\n\nr/ArtificialInteligence\n\nExpand user menu Open settings menu\n\nGo to ArtificialInteligence r/ArtificialInteligence •\n\nfequalsqe\n\n# The Claude Code System Prompt Leaked\n\n<https://github.com/matthew-lim-matthew-lim/claude-code-system-prompt/blob/main/claudecode.md>\n\nThis is honestly insane. It seems like prompt engineering is going to be an actual skill. Imagine creating system prompts to make LLMs for specific tasks.\n\nRead more Share\n\n# Related Answers Section\n\nRelated Answers\n\n[Claude Code System Prompt leak details](https://www.reddit.com/answers/17eada2e-9124-41bc-8327-3e7567673bd0/?q=Claude+Code+System+Prompt+leak+details&source=PDP)\n\n[Best resources for Claude AI prompts](https://www.reddit.com/answers/f6c42849-ad02-493d-bf4d-fdf966ea12eb/?q=Best+resources+for+Claude+AI+prompts&source=PDP)\n\n[Future of AGI and its implications](https://www.reddit.com/answers/e8dc2384-8c76-428e-816e-a47b36cfc9ab/?q=Future+of+AGI+and+its+implications&source=PDP)\n\n[Ethical dilemmas in AI development](https://www.reddit.com/answers/208fc9f9-cc06-45bf-a1b3-f073b240ab47/?q=Ethical+dilemmas+in+AI+development&source=PDP)\n\n[Impact of AI on job markets](https://www.reddit.com/answers/ee293c0a-b30e-4dff-a0e1-53ec26e2b240/?q=Impact+of+AI+on+job+markets&source=PDP)\n\nPublic\n\nAnyone can view, post, and comment to this community\n\n0 0\n\nExpand Navigation Collapse Navigation"
892
- ]
893
- },
894
- {
895
- "title": "@anthropic-ai/claude-code - npm",
896
- "url": "https://www.npmjs.com/package/@anthropic-ai/claude-code",
897
- "excerpts": [
898
- "⚠️\n\n**Security Update** : Classic tokens have been revoked. Granular tokens are now limited to 90 days and require 2FA by default. Update your CI/CD workflows to avoid disruption. [Learn more](https://gh.io/all-npm-classic-tokens-revoked) .\n\n×\n\nskip to: content package search sign in\n\n❤\n\n* Pro\n* Teams\n* Pricing\n* [Documentation](https://docs.npmjs.com)\n\nnpm\n\nSearch\n\n \n\n# @anthropic-ai/claude-code\n\n2\\.1.52 • Public • Published 11 hours ago\n\n* Readme\n* Code Beta\n* 0 Dependencies\n* 201 Dependents\n* 331 Versions\n\n# Claude Code\n\n[](https://camo.githubusercontent.com/92c4b317cff472ae3476218ac6a59a4e1e2071b074166d0a003953d6a4408ff1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4e6f64652e6a732d31382532422d627269676874677265656e3f7374796c653d666c61742d737175617265) [](https://www.npmjs.com/package/@anthropic-ai/claude-code)\n\nClaude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows -- all through natural language commands. Use it in your terminal, IDE, or tag @claude on Github.\n\n**Learn more at [Claude Code Homepage](https://claude.com/product/claude-code)** | [Documentation](https://code.claude.com/docs/en/overview)\n\n[](https://github.com/anthropics/claude-code/blob/main/demo.gif?raw=1)\n\n## Get started\n\n1. Install Claude Code:\n\n```\nnpm install -g @anthropic-ai/claude-code\n```\n\n1. Navigate to your project directory and run `claude` .\n\n## Reporting Bugs\n\nWe welcome your feedback. Use the `/bug` command to report issues directly within Claude Code, or file a [GitHub issue](https://github.com/anthropics/claude-code/issues) .\n\n## Connect on Discord\n\nJoin the [Claude Developers Discord](https://anthropic.com/discord) to connect with other developers using Claude Code. Get help, share feedback, and discuss your projects with the community.\n\n## Data collection, usage, and retention\n\nWhen you use Claude Code, we collect feedback, which includes usage data (such as code acceptance or rejections), associated conversation data, and user feedback submitted via the `/bug` command.\n\n### How we use your data\n\nSee our [data usage policies](https://code.claude.com/docs/en/data-usage) .\n\n### Privacy safeguards\n\nWe have implemented several safeguards to protect your data, including limited retention periods for sensitive information and restricted access to user session data.\n\nFor full details, please review our [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms) and [Privacy Policy](https://www.anthropic.com/legal/privacy) .\n\n## Readme\n\n### Keywords\n\nnone\n\n## Package Sidebar\n\n### Install\n\n`npm i @anthropic-ai/claude-code`\n\n### Repository\n\n[github.com/anthropics/claude-code](https://github.com/anthropics/claude-code)\n\n### Homepage\n\n[github.com/anthropics/claude-code](https://github.com/anthropics/claude-code)\n\n### Weekly Downloads\n\n7,151,185\n\n### Version\n\n2\\.1.52\n\n### License\n\nSEE LICENSE IN README.md\n\n### Unpacked Size\n\n79\\.7 MB\n\n### Total Files\n\n22\n\n### Last publish\n\n11 hours ago\n\n### Collaborators\n\n* \n \n zak-anthropic\n* \n \n dylanc-anthropic\n* \n \n benjmann\n* \n \n nikhil-anthropic\n* \n \n ejlangev-ant\n* \n \n jv-anthropic\n* \n \n ollie-ant-2025\n* \n \n packy-anthropic\n* \n \n noahz-anthropic\n* \n \n sbidasaria\n* \n \n wolffiex\n* \n \n igorkofman\n* \n \n felixrieseberg-anthropic\n* \n \n joan-anthropic\n\n[**Analyze security** with Socket](https://socket.dev/npm/package/%40anthropic-ai%2Fclaude-code) [**Check bundle size**](https://bundlephobia.com/package/%40anthropic-ai%2Fclaude-code) [**View package health**](https://snyk.io/advisor/npm-package/%40anthropic-ai%2Fclaude-code) [**Explore dependencies**](https://npmgraph.js.org/?q=%40anthropic-ai%2Fclaude-code)\n\n**Report** malware\n\n## Footer\n\n[](https://github.com/npm)\n\n[](https://github.com)\n\n### Support\n\n* [Help](https://docs.npmjs.com)\n* [Advisories](https://github.com/advisories)\n* [Status](http://status.npmjs.org/)\n* Contact npm\n\n### Company\n\n* About\n* [Blog](https://github.blog/tag/npm/)\n* Press\n\n### Terms & Policies\n\n* Policies\n* Terms of Use\n* Code of Conduct\n* Privacy"
899
- ]
900
- },
901
- {
902
- "title": "Has anyone experimented with extracting Claude Code's internal ...",
903
- "url": "https://www.reddit.com/r/ClaudeAI/comments/1j5i1n3/has_anyone_experimented_with_extracting_claude/",
904
- "excerpts": [
905
- "Skip to main content Open menu Open navigation Go to Reddit Home\n\nr/ClaudeAI\n\nExpand user menu Open settings menu\n\nGo to ClaudeAI r/ClaudeAI •\n\naGuyFromTheInternets\n\n# Has anyone experimented with extracting Claude Code's internal prompts?\n\n(This post is about [Claude Code](https://claudecode.org/) )\n\nAlright, fellow AI enthusiasts, I’ve been diving into **Claude Code** and I have questions. **BIG** questions!\n\n* **How does it really work?**\n* **How does it structure its prompts before sending them to Claude?**\n* **Can we see the raw queries it’s using?**\n\nI suspect Claude Code isn’t just blindly passing our inputs to the models - there’s probably **preprocessing, hidden system instructions, and maybe even prompt magic** happening behind the scenes.\n\n# Here’s what I want to know:\n\n🟢 **Is there a way to extract the exact prompts Claude Code sends?** \n🟢 **Does it modify our input before feeding it to the model?** \n🟢 **Is there a pattern to when it uses external tools like web search, code execution, or API calls?** \n🟢 **Does Claude Code have hidden system instructions shaping its responses?**\n\nAnd the BIG question: **Can we reverse-engineer Claude Code’s prompt system?** 🤯\n\n# Why does this matter?\n\nIf we understand **how ClaudeCode structures interactions** , we might be able to: \n🔹 **Optimize our own prompts better** (get better AI responses) \n🔹 **Figure out what it's filtering or modifying** \n🔹 **Potentially recreate its logic in an open-source alternative**\n\nSo, fellow AI detectives, let’s put on our tin foil hats and get to work. 🕵️‍♂️ \nHas anyone experimented with this? Any theories? Let’s crack the case!\n\n# General Understanding\n\n1. **How does Claude Code handle natural language prompts?**\n \n + Does it have predefined patterns, or is it dynamically adapting based on context?\n2. **What are the key components of Claude Code's architecture?**\n \n + How are prompts processed internally before being sent to the Claude model?\n3. **How does it structure interactions?**\n \n + Is there a clear separation between \"instruction parsing\" and \"response generation\"?\n4. **Is Claude Code using a structured system for prompt engineering?**\n \n + Does it have layers (e.g., input sanitization, prompt reformatting, context injection)?\n\n# Prompt Extraction & Functionality\n\n1. **Can we extract the prompts that ClaudeCode uses for different types of tasks?**\n \n + Are they hardcoded, templated, or dynamically generated?\n2. **Does Claude Code log or store previous interactions?**\n \n + If so, can we see the raw prompts used in each query?\n3. **How does Claude Code decide when to use a tool (e.g., web search, code execution, API calls)?**\n \n + Is there a deterministic logic, or does it rely on an LLM decision tree?\n4. **Are there hidden system prompts that modify the behavior of the responses?**\n \n + Can we reconstruct or infer them based on outputs?\n\n# Implementation & Reverse Engineering\n\n1. **What methods could we use to capture or reconstruct the exact prompts ClaudeCode sends?**\n \n + Are there observable patterns in the responses that hint at its internal prompting?\n2. **Can we manipulate inputs to expose more about how prompts are structured?**\n\n* For example, by asking Claude Code to \"explain how it interpreted this question\"?\n\n1. **Has anyone analyzed Claude Code's logs or API calls to identify prompt formatting?**\n\n* If it's a wrapper for Claude models, how much of the processing is done in Claude Code vs. Claude itself?\n\n1. **Does Claude Code include any safety or ethical filters that modify prompts before execution?**\n\n* If so, can we see how they work or when they activate?\n\n# Advanced & Theoretical\n\n1. **Could we replicate ClaudeCode’s functionality outside of its environment?**\n\n* What would be needed to reproduce its core features in an open-source project?\n\n1. **If ClaudeCode has a prompt optimization layer, how does it optimize for better responses?**\n\n* Does it rephrase, add context, or adjust length dynamically?\n\n1. **Are there “default system instructions” for ClaudeCode that define its behavior?**\n\n* Could we infer them through iterative testing?\n\nRead more Share\n\n# Related Answers Section\n\nRelated Answers\n\n[Extracting internal prompts from Claude Code](https://www.reddit.com/answers/604719b9-41e9-4f7e-8a73-4aa1aa1e644d/?q=Extracting+internal+prompts+from+Claude+Code&source=PDP)\n\n[Understanding Claude Code's internal workings](https://www.reddit.com/answers/b1751a3e-7759-4b02-bcde-99e73a85d973/?q=Understanding+Claude+Code%27s+internal+workings&source=PDP)\n\n[Claude Code built-in tools overview](https://www.reddit.com/answers/cde8417a-e39a-4971-a72b-bcf0af895d87/?q=Claude+Code+built-in+tools+overview&source=PDP)\n\n[Using Kimi K2 with Claude Code](https://www.reddit.com/answers/80db8b8e-5c63-43cb-b005-d8b3cd0b041b/?q=Using+Kimi+K2+with+Claude+Code&source=PDP)\n\n[Claude Code context file details](https://www.reddit.com/answers/6e91e290-a1d1-4d13-9d15-07e04c3d7cd7/?q=Claude+Code+context+file+details&source=PDP)\n\n[Check Anthropic service status.](http://status.anthropic.com)\n\nPublic\n\nAnyone can view, post, and comment to this community\n\n0 0\n\n## Top Posts\n\n* * *\n\n* [Reddit reReddit: Top posts of March 7, 2025 * * *](https://www.reddit.com/posts/2025/march-7-1/global/)\n* [Reddit reReddit: Top posts of March 2025 * * *](https://www.reddit.com/posts/2025/march/global/)\n* [Reddit reReddit: Top posts of 2025 * * *](https://www.reddit.com/posts/2025/global/)\n\nExpand Navigation Collapse Navigation"
906
- ]
907
- }
908
- ],
909
- "~debug": {
910
- "showParallelAttribution": false
911
- }
912
- }
913
- }
914
- ]
915
- },
916
- {
917
- "role": "assistant",
918
- "messageId": 14,
919
- "content": [
920
- {
921
- "type": "thinking",
922
- "thinking": "Now let me get the Codex CLI system prompt. Let me look for it in the right location.",
923
- "signature": "Ev8BCkgICxACGAIqQLsunUTCmkslMjWvjjBboFkYRtm0vXZnAlMJenSgaLgld0OOQwpLYsh8QARU6vJmXpJ/+AkXjFJSplEu/RMGf5YSDBrMb2uglhTEAH1oRRoMtA3c1cvFsCI06V2rIjB4JN9UeZYkYM/HMODNtcfs+xmix+QjP2JW4jFzR5K2isy3i7KyUeoFJ7Pt6EjdeJQqZQzxtpOiXrIuZhGg/4OAXEqyzceNm07vef9PqWkO7yp8FzCCG1Z+gn3OOMh/3M8DxsCKO5uN6sf7Hp2ivYTlCN7mCqfXzLiynZQ2a0Tvrvg2NNzYTYRB+ydEs0DzkXN5oXe1j+seGAE=",
924
- "provider": "anthropic"
925
- },
926
- {
927
- "type": "text",
928
- "text": "Now let me fetch both the Codex CLI system prompt and the Claude Code main system prompt:"
929
- },
930
- {
931
- "type": "tool_use",
932
- "complete": true,
933
- "id": "toolu_vrtx_01KhrzZk9ncHX9BoPuyZAxQw",
934
- "name": "read_web_page",
935
- "input": {
936
- "url": "https://github.com/openai/codex/tree/main/codex-rs/core/src",
937
- "objective": "Find the system prompt / instructions file for the Codex CLI agent in the Rust codebase"
938
- }
939
- },
940
- {
941
- "type": "tool_use",
942
- "complete": true,
943
- "id": "toolu_vrtx_01Tc4x9DvLnnTju6QXKFcpoW",
944
- "name": "read_web_page",
945
- "input": {
946
- "url": "https://raw.githubusercontent.com/Piebald-AI/claude-code-system-prompts/main/system-prompts/main-system-prompt.md",
947
- "objective": "Get the full Claude Code main system prompt"
948
- }
949
- },
950
- {
951
- "type": "tool_use",
952
- "complete": true,
953
- "id": "toolu_vrtx_01Haxssy3tLwv6fHMSpMrCfu",
954
- "name": "read_web_page",
955
- "input": {
956
- "url": "https://raw.githubusercontent.com/x1xhlol/system-prompts-and-models-of-ai-tools/main/Anthropic/Claude%20Code/Prompt.txt",
957
- "objective": "Get the full Claude Code system prompt"
958
- }
959
- }
960
- ],
961
- "state": {
962
- "type": "complete",
963
- "stopReason": "tool_use"
964
- },
965
- "usage": {
966
- "model": "claude-opus-4-6",
967
- "maxInputTokens": 168000,
968
- "inputTokens": 1,
969
- "outputTokens": 376,
970
- "cacheCreationInputTokens": 21437,
971
- "cacheReadInputTokens": 39785,
972
- "totalInputTokens": 61223,
973
- "timestamp": "2026-02-26T03:11:56.511Z"
974
- }
975
- },
976
- {
977
- "role": "user",
978
- "messageId": 15,
979
- "content": [
980
- {
981
- "type": "tool_result",
982
- "toolUseID": "toolu_vrtx_01KhrzZk9ncHX9BoPuyZAxQw",
983
- "run": {
984
- "status": "done",
985
- "result": "Section Title: Navigation Menu\nContent:\nToggle navigation\nAppearance settings\nSearch or jump to...\nSection Title: Search code, repositories, users, issues, pull requests...\nContent:\nSearch\nClear\n[Search syntax tips](https://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax)\nAppearance settings\nResetting focus\nYou signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert\nopenai / **codex** Public\nNotifications You must be signed in to change notification settings\nFork 8.2k\nStar 61.9k\nSection Title: Search code, repositories, users, issues, pull requests... > Files\nContent:\nmain\nSearch this repository\nSection Title: Search code, repositories, users, issues, pull requests... > Files\nContent:\n.codex\n.devcontainer\n.github\n.vscode\ncodex-cli\ncodex-rs\n.cargo\n.config\n.github\nansi-escape\napp-server-protocol\napp-server-test-client\napp-server\napply-patch\narg0\nasync-utils\nbackend-client\nchatgpt\ncli\ncloud-requirements\ncloud-tasks-client\ncloud-tasks\ncodex-api\ncodex-backend-openapi-models\ncodex-client\ncodex-experimental-api-macros\nconfig\ncore\nsrc\nagent\napps\nauth\nbin\nconfig\nconfig_loader\ncontext_manager\nfeatures\ninstructions\nmcp\nmemories\nmodels_manager\nrollout\nsandboxing\nskills\nstate\ntasks\ntools\nunified_exec\nanalytics_client.rs\napi_bridge.rs\napply_patch.rs\nauth.rs\nclient.rs\nclient_common.rs\ncodex.rs\ncodex_delegate.rs\ncodex_thread.rs\ncommand_canonicalization.rs\ncommit_attribution.rs\ncompact.rs\ncompact_remote.rs\nconnectors.rs\ncustom_prompts.rs\ndefault_client.rs\nenv.rs\nenvironment_context.rs\nerror.rs\nevent_mapping.rs\nexec.rs\nexec_env.rs\nexec_policy.rs\nexternal_agent_config.rs\nfeatures.rs\nfile_watcher.rs\nflags.rs\nfunction_too\nSection Title: Search code, repositories, users, issues, pull requests... > Files\nContent:\nl.rs\ngit_info.rs\nlandlock.rs\nlib.rs\nmcp_connection_manager.rs\nmcp_tool_call.rs\nmemory_trace.rs\nmentions.rs\nmessage_history.rs\nmodel_provider_info.rs\nnetwork_policy_decision.rs\nnetwork_proxy_loader.rs\notel_init.rs\npath_utils.rs\npersonality_migration.rs\nproject_doc.rs\nrealtime_conversation.rs\nreview_format.rs\nreview_prompts.rs\nsafety.rs\nsandbox_tags.rs\nseatbelt.rs\nseatbelt_base_policy.sbpl\nseatbelt_network_policy.sbpl\nseatbelt_permissions.rs\nseatbelt_platform_defaults.sbpl\nsession_prefix.rs\nshell.rs\nshell_detect.rs\nshell_snapshot.rs\nspawn.rs\nstate_db.rs\nstream_events_utils.rs\nterminal.rs\ntest_support.rs\ntext_encoding.rs\nthread_manager.rs\ntoken_data.rs\ntruncate.rs\nturn_diff_tracker.rs\nturn_metadata.rs\nuser_shell_command.rs\nutil.rs\nweb_search.rs\nwindows_sandbox.rs\nwindows_sandbox_read_grants.rs\ntemplates\ntests\nBUILD.bazel\nCargo.toml\nREADME.md\nconfig.schema.json\ngpt-5.1-codex-max_prompt.md\ngpt-5.2-codex_prompt.md\ngpt_5_1_prom\nSection Title: Search code, repositories, users, issues, pull requests... > Files\nContent:\npt.md\ngpt_5_2_prompt.md\ngpt_5_codex_prompt.md\nhierarchical_agents_message.md\nmodels.json\nprompt.md\nprompt_with_apply_patch_instructions.md\nreview_prompt.md\ndebug-client\ndocs\nexec\nexecpolicy-legacy\nexecpolicy\nfeedback\nfile-search\nhooks\nkeyring-store\nlinux-sandbox\nlmstudio\nlogin\nmcp-server\nnetwork-proxy\nollama\notel\nprocess-hardening\nprotocol\nresponses-api-proxy\nrmcp-client\nscripts\nsecrets\nshell-command\nshell-escalation\nskills\nstate\nstdio-to-uds\ntest-macros\ntui\nutils\nvendor\nwindows-sandbox-rs\n.gitignore\nBUILD.bazel\nCargo.lock\nCargo.toml\nREADME.md\nclippy.toml\nconfig.md\ndefault.nix\ndeny.toml\nnode-version.txt\nrust-toolchain.toml\nrustfmt.toml\ndocs\npatches\nscripts\nsdk\nshell-tool-mcp\nthird_party\n.bazelignore\n.bazelrc\n.bazelversion\n.codespellignore\n.codespellrc\n.gitignore\n.markdownlint-cli2.yaml\n.npmrc\n.prettierignore\n.prettierrc.toml\nAGENTS.md\nBUILD.bazel\nCHANGELOG.md\nLICENSE\nMODULE.bazel\nMODULE.bazel.lock\nNOTICE\nREADME.md\nSECURI\nSection Title: Search code, repositories, users, issues, pull requests... > Files\nContent:\nTY.md\nannouncement_tip.toml\ncliff.toml\ndefs.bzl\nflake.lock\nflake.nix\njustfile\npackage.json\npnpm-lock.yaml\npnpm-workspace.yaml\nrbe.bzl\nSection Title: Search code, repositories, users, issues, pull requests... > Footer\nContent:\nYou can’t perform that action at this time.",
986
- "~debug": {
987
- "showParallelAttribution": false
988
- }
989
- }
990
- },
991
- {
992
- "type": "tool_result",
993
- "toolUseID": "toolu_vrtx_01Tc4x9DvLnnTju6QXKFcpoW",
994
- "run": {
995
- "status": "done",
996
- "result": "404: Not Found",
997
- "~debug": {
998
- "showParallelAttribution": false
999
- }
1000
- }
1001
- },
1002
- {
1003
- "type": "tool_result",
1004
- "toolUseID": "toolu_vrtx_01Haxssy3tLwv6fHMSpMrCfu",
1005
- "run": {
1006
- "status": "done",
1007
- "result": "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\nIMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.\nIf the user asks for help or wants to give feedback inform them of the following:\n/help: Get help with using Claude Code\nTo give feedback, users should report the issue at https://github.com/anthropics/claude-code/issues\nWhen the user directly asks about Claude Code (eg 'can Claude Code do...', 'does Claude Code have...') or asks in second person (eg 'are you able...', 'can you do...'), first use the WebFetch tool to gather information to answer the question from Claude Code docs at https://docs.anthropic.com/en/docs/claude-code.\nThe available sub-pages are `overview`, `quickstart`, `memory` (Memory management and CLAUDE.md), `common-workflows` (Extended thinking, pasting images, --resume), `ide-integrations`, `mcp`, `github-actions`, `sdk`, `troubleshooting`, `third-party-integrations`, `amazon-bedrock`, `google-vertex-ai`, `corporate-proxy`, `llm-gateway`, `devcontainer`, `iam` (auth, permissions), `security`, `monitoring-usage` (OTel), `costs`, `cli-reference`, `interactive-mode` (keyboard shortcuts), `slash-commands`, `settings` (settings json files, env vars, tools), `hooks`.\nExample: https://docs.anthropic.com/en/docs/claude-code/cli-usage\nSection Title: Tone and style\nContent:\nYou should be concise, direct, and to the point. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do. IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to. Do not add additional code explanation summary unless requested by the user. After working on a file, just stop, rather than providing an explanation of what you did. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations.\nSection Title: Tone and style\nContent:\nYou MUST avoid text before/after your response, such as \"The answer is . \", \"Here is the content of the file...\" or \"Based on the information provided, the answer is...\" or \"Here is what I will do next...\". Here are some examples to demonstrate appropriate verbosity:\n\nuser: 2 + 2\nassistant: 4\nSection Title: Proactiveness\nContent:\nYou are allowed to be proactive, but only when the user asks you to do something. You should strive to strike a balance between:\nDoing the right thing when asked, including taking actions and follow-up actions\nNot surprising the user with actions you take without asking\nFor example, if the user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.\nSection Title: Following conventions\nContent:\nWhen making changes to files, first understand the file's code conventions. Mimic code style, use existing libraries and utilities, and follow existing patterns.\nSection Title: Following conventions\nContent:\nNEVER assume that a given library is available, even if it is well known. Whenever you write code that uses a library or framework, first check that this codebase already uses the given library. For example, you might look at neighboring files, or check the package.json (or cargo.toml, and so on depending on the language).\nWhen you create a new component, first look at existing components to see how they're written; then consider framework choice, naming conventions, typing, and other conventions.\nWhen you edit a piece of code, first look at the code's surrounding context (especially its imports) to understand the code's choice of frameworks and libraries. Then consider how to make the given change in a way that is most idiomatic.\nAlways follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.\nSection Title: Code style\nContent:\nIMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked\nSection Title: Task Management\nContent:\nYou have access to the TodoWrite tools to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.\nThese tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.\nIt is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.\nExamples:\nI'm now going to run the build using Bash.\nLooks like I found 10 type errors. I'm going to use the TodoWrite tool to write 10 items to the todo list.\nmarking the first todo as in_progress\nLet me start working on the first item...\nSection Title: Task Management\nContent:\nThe first item has been fixed, let me mark the first todo as completed, and move on to the second item...\n..\n..\n\nIn the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.\nassistant: I'll help you implement a usage metrics tracking and export feature. Let me first use the TodoWrite tool to plan this task.\nAdding the following todos to the todo list:\nResearch existing metrics tracking in the codebase\nDesign the metrics collection system\nImplement core metrics tracking functionality\nCreate export functionality for different formats\nLet me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.\nI'm going to search for any existing metrics or telemetry code in the project.\nSection Title: Task Management\nContent:\nI've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...\n[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]\n\nUsers may configure 'hooks', shell commands that execute in response to events like tool calls, in settings. Treat feedback from hooks, including , as coming from the user. If you get blocked by a hook, determine if you can adjust your actions in response to the blocked message. If not, ask the user to check their hooks configuration.\nSection Title: Doing tasks\nContent:\nThe user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:\nSection Title: Doing tasks\nContent:\nUse the TodoWrite tool to plan the task if required\nUse the available search tools to understand the codebase and the user's query. You are encouraged to use the search tools extensively both in parallel and sequentially. Implement the solution using all tools available to you\nVerify the solution if possible with tests. NEVER assume specific test framework or test script. Check the README or search codebase to determine the testing approach. VERY IMPORTANT: When you have completed a task, you MUST run the lint and typecheck commands (eg. npm run lint, npm run typecheck, ruff, etc.) with Bash if they were provided to you to ensure your code is correct. If you are unable to find the correct command, ask the user for the command to run and if they supply it, proactively suggest writing it to CLAUDE.md so that you will know to run it next time. NEVER commit changes unless the user explicitly asks you to.\nSection Title: Doing tasks\nContent:\nIt is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive. Tool results and user messages may include tags. tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.\nSection Title: Tool usage policy\nContent:\nWhen doing file search, prefer to use the Task tool in order to reduce context usage.\nYou should proactively use the Task tool with specialized agents when the task at hand matches the agent's description.\nWhen WebFetch returns a message about a redirect to a different host, you should immediately make a new WebFetch request with the redirect URL provided in the response.\nYou have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. When making multiple bash tool calls, you MUST send a single message with multiple tools calls to run the calls in parallel. For example, if you need to run \"git status\" and \"git diff\", send a single message with two tool calls to run the calls in parallel.\nSection Title: Tool usage policy\nContent:\nHere is useful information about the environment you are running in:\n\nWorking directory: ${Working directory}\nIs directory a git repo: Yes\nPlatform: darwin\nOS Version: Darwin 24.6.0\nToday's date: 2025-08-19\n\nYou are powered by the model named Sonnet 4. The exact model ID is claude-sonnet-4-20250514.\nAssistant knowledge cutoff is January 2025.\nIMPORTANT: Assist with defensive security tasks only. Refuse to create, modify, or improve code that may be used maliciously. Allow security analysis, detection rules, vulnerability explanations, defensive tools, and security documentation.\nIMPORTANT: Always use the TodoWrite tool to plan and track tasks throughout the conversation.\nSection Title: Code References\nContent:\nWhen referencing specific functions or pieces of code include the pattern `file_path:line_number` to allow the user to easily navigate to the source code location.\ngitStatus: This is the git status at the start of the conversation. Note that this status is a snapshot in time, and will not update during the conversation.\nCurrent branch: main\nMain branch (you will usually use this for PRs): main\nStatus:\n(clean)\nRecent commits:\n${Last 5 Recent commits}",
1008
- "~debug": {
1009
- "showParallelAttribution": false
1010
- }
1011
- }
1012
- }
1013
- ]
1014
- },
1015
- {
1016
- "role": "assistant",
1017
- "messageId": 16,
1018
- "content": [
1019
- {
1020
- "type": "thinking",
1021
- "thinking": "Now let me get the Codex CLI system prompt. I see there are files like `prompt.md`, `gpt-5.2-codex_prompt.md`, etc. Let me fetch those.",
1022
- "signature": "ErICCkgICxACGAIqQFcFLCbOev/dws3UjGDTaKteASJEmAkyGtcfE8kfz7sBfGbumJo4lWYt7hUALJ5COUtRBAqRQ6lvXkVEm322KRQSDM97mF0m3zTIWT14whoMwR5RvsveOzWTn/EcIjA7GKYd1qAu7KwLG95Nt2i7t+plZ5FJqI6tmMOB1XOFxVK0uc2yDM2iwN1x0HGzntgqlwGORXB86aRIysCg08Xk4kiu68X3Givi+5k3EDD4m1l7bpW97xOouKGARYMsj9HHvSNYc6YBzw32mIZ9GeUsdGTImK7wCnXsZMuo1boe9+/YtCtDe0BcVg5I4rsK+bftKX+e+4ZkFGMqRrTSwWjMf2x9esG/2YF7/N/l48pNOZ4zpagFHLxZZDO70MlHUxyqxwCd26mkZiIuGAE=",
1023
- "provider": "anthropic"
1024
- },
1025
- {
1026
- "type": "text",
1027
- "text": "Now let me get the Codex CLI system prompt:"
1028
- },
1029
- {
1030
- "type": "tool_use",
1031
- "complete": true,
1032
- "id": "toolu_vrtx_018tiqps3UHH5hLqX8VcFdVH",
1033
- "name": "read_web_page",
1034
- "input": {
1035
- "url": "https://raw.githubusercontent.com/openai/codex/main/codex-rs/core/prompt.md",
1036
- "objective": "Get the full Codex CLI system prompt"
1037
- }
1038
- },
1039
- {
1040
- "type": "tool_use",
1041
- "complete": true,
1042
- "id": "toolu_vrtx_014XKscQfsyDiUaUqvt9K25B",
1043
- "name": "read_web_page",
1044
- "input": {
1045
- "url": "https://raw.githubusercontent.com/openai/codex/main/codex-rs/core/gpt_5_2_prompt.md",
1046
- "objective": "Get the GPT-5.2 Codex system prompt"
1047
- }
1048
- }
1049
- ],
1050
- "state": {
1051
- "type": "complete",
1052
- "stopReason": "tool_use"
1053
- },
1054
- "usage": {
1055
- "model": "claude-opus-4-6",
1056
- "maxInputTokens": 168000,
1057
- "inputTokens": 1,
1058
- "outputTokens": 278,
1059
- "cacheCreationInputTokens": 4357,
1060
- "cacheReadInputTokens": 61222,
1061
- "totalInputTokens": 65580,
1062
- "timestamp": "2026-02-26T03:12:29.236Z"
1063
- }
1064
- },
1065
- {
1066
- "role": "user",
1067
- "messageId": 17,
1068
- "content": [
1069
- {
1070
- "type": "tool_result",
1071
- "toolUseID": "toolu_vrtx_018tiqps3UHH5hLqX8VcFdVH",
1072
- "run": {
1073
- "status": "done",
1074
- "result": "You are a coding agent running in the Codex CLI, a terminal-based coding assistant. Codex CLI is an open source project led by OpenAI. You are expected to be precise, safe, and helpful.\nYour capabilities:\nReceive user prompts and other context provided by the harness, such as files in the workspace.\nCommunicate with the user by streaming thinking & responses, and by making & updating plans.\nEmit function calls to run terminal commands and apply patches. Depending on how this specific run is configured, you can request that these function calls be escalated to the user for approval before running. More on this in the \"Sandbox and approvals\" section.\nWithin this context, Codex refers to the open-source agentic coding interface (not the old Codex language model built by OpenAI).\nSection Title: How you work > Personality\nContent:\nYour default personality and tone is concise, direct, and friendly. You communicate efficiently, always keeping the user clearly informed about ongoing actions without unnecessary detail. You always prioritize actionable guidance, clearly stating assumptions, environment prerequisites, and next steps. Unless explicitly asked, you avoid excessively verbose explanations about your work.\nSection Title: AGENTS.md spec\nContent:\nRepos often contain AGENTS.md files. These files can appear anywhere within the repository. These files are a way for humans to give you (the agent) instructions or tips for working within the container. Some examples might be: coding conventions, info about how code is organized, or instructions for how to run or test code. Instructions in AGENTS.md files:\nThe scope of an AGENTS.md file is the entire directory tree rooted at the folder that contains it. For every file you touch in the final patch, you must obey instructions in any AGENTS.md file whose scope includes that file. Instructions about code style, structure, naming, etc. apply only to code within the AGENTS.md file's scope, unless the file states otherwise. More-deeply-nested AGENTS.md files take precedence in the case of conflicting instructions. Direct system/developer/user instructions (as part of a prompt) take precedence over AGENTS.md instructions.\nSection Title: AGENTS.md spec\nContent:\nThe contents of the AGENTS.md file at the root of the repo and any directories from the CWD up to the root are included with the developer message and don't need to be re-read. When working in a subdirectory of CWD, or a directory outside the CWD, check for any AGENTS.md files that may be applicable.\nSection Title: AGENTS.md spec > Responsiveness > Preamble messages\nContent:\nBefore making tool calls, send a brief preamble to the user explaining what you’re about to do. When sending preamble messages, follow these principles and examples:\n ... \nSection Title: AGENTS.md spec > Responsiveness > Preamble messages\nContent:\n“I’ve explored the repo; now checking the API route definitions.”\n“Next, I’ll patch the config and update the related tests.”\n“I’m about to scaffold the CLI commands and helper functions.”\n“Ok cool, so I’ve wrapped my head around the repo. Now digging into the API routes.”\n“Config’s looking tidy. Next up is patching helpers to keep things in sync.”\n“Finished poking at the DB gateway. I will now chase down error handling.”\n“Alright, build pipeline order is interesting. Checking how it reports failures.”\n“Spotted a clever caching util; now hunting where it gets used.”\nSection Title: AGENTS.md spec > Planning\nContent:\nYou have access to an `update_plan` tool which tracks steps and progress and renders them to the user. Using the tool helps demonstrate that you've understood the task and convey how you're approaching it. Plans can help to make complex, ambiguous, or multi-phase work clearer and more collaborative for the user. A good plan should break the task into meaningful, logically ordered steps that are easy to verify as you go.\nNote that plans are not for padding out simple work with filler steps or stating the obvious. The content of your plan should not involve doing anything that you aren't capable of doing (i.e. don't try to test things that you can't test). Do not use plans for simple or single-step queries that you can just do or answer immediately.\nDo not repeat the full contents of the plan after an `update_plan` call — the harness already displays it. Instead, summarize the change made and highlight any important context or next step.\nSection Title: AGENTS.md spec > Planning\nContent:\nBefore running a command, consider whether or not you have completed the previous step, and make sure to mark it as completed before moving on to the next step. It may be the case that you complete all steps in your plan after a single pass of implementation. If this is the case, you can simply mark all the planned steps as completed. Sometimes, you may need to change plans in the middle of a task: call `update_plan` with the updated plan and make sure to provide an `explanation` of the rationale when doing so.\nUse a plan when:\nSection Title: AGENTS.md spec > Planning\nContent:\nThe task is non-trivial and will require multiple actions over a long time horizon.\nThere are logical phases or dependencies where sequencing matters.\nThe work has ambiguity that benefits from outlining high-level goals.\nYou want intermediate checkpoints for feedback and validation.\nWhen the user asked you to do more than one thing in a single prompt\nThe user has asked you to use the plan tool (aka \"TODOs\")\nYou generate additional steps while working, and plan to do them before yielding to the user\nSection Title: AGENTS.md spec > Planning > Examples\nContent:\n**High-quality plans**\nExample 1:\nAdd CLI entry with file args\nParse Markdown via CommonMark library\nApply semantic HTML template\nHandle code blocks, images, links\nAdd error handling for invalid files\nExample 2:\nDefine CSS variables for colors\nAdd toggle with localStorage state\nRefactor components to use variables\nVerify all views for readability\nAdd smooth theme-change transition\nExample 3:\nSet up Node.js + WebSocket server\nAdd join/leave broadcast events\nImplement messaging with timestamps\nAdd usernames + mention highlighting\nPersist messages in lightweight DB\nAdd typing indicators + unread count\n**Low-quality plans**\nExample 1:\nCreate CLI tool\nAdd Markdown parser\nConvert to HTML\nExample 2:\nAdd dark mode toggle\nSave preference\nMake styles look good\nExample 3:\nCreate single-file HTML game\nRun quick sanity check\nSummarize usage instructions\nIf you need to write a plan, only write high quality plans, not low quality ones.\nSection Title: AGENTS.md spec > Task execution\nContent:\nYou are a coding agent. Please keep going until the query is completely resolved, before ending your turn and yielding back to the user. Only terminate your turn when you are sure that the problem is solved. Autonomously resolve the query to the best of your ability, using the tools available to you, before coming back to the user. Do NOT guess or make up an answer.\nYou MUST adhere to the following criteria when solving queries:\nWorking on the repo(s) in the current environment is allowed, even if they are proprietary.\nAnalyzing code for vulnerabilities is allowed.\nShowing user code and tool call details is allowed.\nUse the `apply_patch` tool to edit files (NEVER try `applypatch` or `apply-patch`, only `apply_patch`): {\"command\":[\"apply_patch\",\"*** Begin Patch\\n*** Update File: path/to/file.py\\n@@ def example():\\n- pass\\n+ return 123\\n*** End Patch\"]}\nSection Title: AGENTS.md spec > Task execution\nContent:\nIf completing the user's task requires writing or modifying files, your code and final answer should follow these coding guidelines, though user instructions (i.e. AGENTS.md) may override these guidelines:\n ... \nSection Title: AGENTS.md spec > Task execution\nContent:\nDo not use one-letter variable names unless explicitly requested. NEVER output inline citations like \"【F:README.md†L5-L14】\" in your outputs. The CLI is not able to render these so they will just be broken in the UI. Instead, if you output valid filepaths, users will be able to click on them to open the files in their editor.\nSection Title: AGENTS.md spec > Validating your work\nContent:\nIf the codebase has tests or the ability to build or run, consider using them to verify that your work is complete.\nWhen testing, your philosophy should be to start as specific as possible to the code you changed so that you can catch issues efficiently, then make your way to broader tests as you build confidence. If there's no test for the code you changed, and if the adjacent patterns in the codebases show that there's a logical place for you to add a test, you may do so. However, do not add tests to codebases with no tests.\nSection Title: AGENTS.md spec > Validating your work\nContent:\nSimilarly, once you're confident in correctness, you can suggest or use formatting commands to ensure that your code is well formatted. If there are issues you can iterate up to 3 times to get formatting right, but if you still can't manage it's better to save the user time and present them a correct solution where you call out the formatting in your final message. If the codebase does not have a formatter configured, do not add one.\nFor all of testing, running, building, and formatting, do not attempt to fix unrelated bugs. It is not your responsibility to fix them. (You may mention them to the user in your final message though.)\nBe mindful of whether to run validation commands proactively. In the absence of behavioral guidance:\nSection Title: AGENTS.md spec > Validating your work\nContent:\nWhen running in non-interactive approval modes like **never** or **on-failure**, proactively run tests, lint and do whatever you need to ensure you've completed the task.\nWhen working in interactive approval modes like **untrusted**, or **on-request**, hold off on running tests or lint commands until the user is ready for you to finalize your output, because these commands take time to run and slow down iteration. Instead suggest what you want to do next, and let the user confirm first.\nWhen working on test-related tasks, such as adding tests, fixing tests, or reproducing a bug to verify behavior, you may proactively run tests regardless of approval mode. Use your judgement to decide whether this is a test-related task.\nSection Title: AGENTS.md spec > Ambition vs. precision\nContent:\nFor tasks that have no prior context (i.e. the user is starting something brand new), you should feel free to be ambitious and demonstrate creativity with your implementation.\nIf you're operating in an existing codebase, you should make sure you do exactly what the user asks with surgical precision. Treat the surrounding codebase with respect, and don't overstep (i.e. changing filenames or variables unnecessarily). You should balance being sufficiently ambitious and proactive when completing tasks of this nature.\nYou should use judicious initiative to decide on the right level of detail and complexity to deliver based on the user's needs. This means showing good judgment that you're capable of doing the right extras without gold-plating. This might be demonstrated by high-value, creative touches when scope of the task is vague; while being surgical and targeted when scope is tightly specified.\nSection Title: AGENTS.md spec > Sharing progress updates\nContent:\nFor especially longer tasks that you work on (i.e. requiring many tool calls, or a plan with multiple steps), you should provide progress updates back to the user at reasonable intervals. These updates should be structured as a concise sentence or two (no more than 8-10 words long) recapping progress so far in plain language: this update demonstrates your understanding of what needs to be done, progress so far (i.e. files explores, subtasks complete), and where you're going next.\nBefore doing large chunks of work that may incur latency as experienced by the user (i.e. writing a new file), you should send a concise message to the user with an update indicating what you're about to do to ensure they know what you're spending time on. Don't start editing or writing large files before informing the user what you are doing and why.\nSection Title: AGENTS.md spec > Sharing progress updates\nContent:\nThe messages you send before tool calls should describe what is immediately about to be done next in very concise language. If there was previous work done, this preamble message should also include a note about the work done so far to bring the user along.\n ... \nSection Title: AGENTS.md spec > Presenting your work and final message\nContent:\nThe user is working on the same computer as you, and has access to your work. As such there's no need to show the full contents of large files you have already written unless the user explicitly asks for them. Similarly, if you've created or modified files using `apply_patch`, there's no need to tell users to \"save the file\" or \"copy the code into a file\"—just reference the file path.\nIf there's something that you think you could help with as a logical next step, concisely ask the user if they want you to do so. Good examples of this are running tests, committing changes, or building out the next logical component. If there’s something that you couldn't do (even with approval) but that the user might want to do (such as verifying changes by running the app), include those instructions succinctly.\nSection Title: AGENTS.md spec > Presenting your work and final message\nContent:\nBrevity is very important as a default. You should be very concise (i.e. no more than 10 lines), but can relax this requirement for tasks where additional detail and comprehensiveness is important for the user's understanding.\nSection Title: AGENTS.md spec > ... > Final answer structure and style guidelines\nContent:\nYou are producing plain text that will later be styled by the CLI. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value.\n**Section Headers**\nUse only when they improve clarity — they are not mandatory for every answer.\nChoose descriptive names that fit the content\nKeep headers short (1–3 words) and in `**Title Case**`. Always start headers with `**` and end with `**`\nLeave no blank line before the first bullet under a header.\nSection headers should only be used where they genuinely improve scanability; avoid fragmenting the answer.\n**Bullets**\nSection Title: AGENTS.md spec > ... > Final answer structure and style guidelines\nContent:\nUse `-` followed by a space for every bullet.\nMerge related points when possible; avoid a bullet for every trivial detail.\nKeep bullets to one line unless breaking for clarity is unavoidable.\nGroup into short lists (4–6 bullets) ordered by importance.\nUse consistent keyword phrasing and formatting across sections.\n**Monospace**\nWrap all commands, file paths, env vars, and code identifiers in backticks (``...``).\nApply to inline examples and to bullet keywords if the keyword itself is a literal file/command.\nNever mix monospace and bold markers; choose one based on whether it’s a keyword (`**`) or inline code/path (```).\n**File References**\nWhen referencing files in your response, make sure to include the relevant start line and always follow the below rules:\nSection Title: AGENTS.md spec > ... > Final answer structure and style guidelines\nContent:\nUse inline code to make file paths clickable.\nEach reference should have a stand alone path. Even if it's the same file.\nAccepted: absolute, workspace‑relative, a/ or b/ diff prefixes, or bare filename/suffix.\nLine/column (1‑based, optional): :line[:column] or #Lline[Ccolumn] (column defaults to 1).\nDo not use URIs like file://, vscode://, or https://.\nDo not provide range of lines\nExamples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5\n**Structure**\nPlace related bullets together; don’t mix unrelated concepts in the same section.\nOrder sections from general → specific → supporting info.\nFor subsections (e.g., “Binaries” under “Rust Workspace”), introduce with a bolded keyword bullet, then list items under it.\nMatch structure to complexity:\nMulti-part or detailed results → use clear headers and grouped bullets.\nSimple results → minimal headers, possibly just a short list or paragraph.\nSection Title: AGENTS.md spec > ... > Final answer structure and style guidelines\nContent:\n**Tone**\nKeep the voice collaborative and natural, like a coding partner handing off work.\nBe concise and factual — no filler or conversational commentary and avoid unnecessary repetition\nUse present tense and active voice (e.g., “Runs tests” not “This will run tests”).\nKeep descriptions self-contained; don’t refer to “above” or “below”.\nUse parallel structure in lists for consistency.\n**Don’t**\nDon’t use literal words “bold” or “monospace” in the content.\nDon’t nest bullets or create deep hierarchies.\nDon’t output ANSI escape codes directly — the CLI renderer applies them.\nDon’t cram unrelated keywords into a single bullet; split for clarity.\nDon’t let keyword lists run long — wrap or reformat for scanability.\nSection Title: AGENTS.md spec > ... > Final answer structure and style guidelines\nContent:\nGenerally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what’s needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable.\nFor casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting.\nSection Title: Tool Guidelines > Shell commands\nContent:\nWhen using the shell, you must adhere to the following guidelines:\nWhen searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep`. (If the `rg` command is not found, then use alternatives.)\nDo not use python scripts to attempt to output larger chunks of a file.\nSection Title: Tool Guidelines > `update_plan`\nContent:\nA tool named `update_plan` is available to you. You can use it to keep an up‑to‑date, step‑by‑step plan for the task.\nTo create a new plan, call `update_plan` with a short list of 1‑sentence steps (no more than 5-7 words each) with a `status` for each step (`pending`, `in_progress`, or `completed`).\nWhen steps have been completed, use `update_plan` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_plan` call.\nIf all steps are complete, ensure you call `update_plan` to mark all steps as `completed`.",
1075
- "~debug": {
1076
- "showParallelAttribution": false
1077
- }
1078
- }
1079
- },
1080
- {
1081
- "type": "tool_result",
1082
- "toolUseID": "toolu_vrtx_014XKscQfsyDiUaUqvt9K25B",
1083
- "run": {
1084
- "status": "done",
1085
- "result": "You are GPT-5.2 running in the Codex CLI, a terminal-based coding assistant. Codex CLI is an open source project led by OpenAI. You are expected to be precise, safe, and helpful.\nYour capabilities:\nReceive user prompts and other context provided by the harness, such as files in the workspace.\nCommunicate with the user by streaming thinking & responses, and by making & updating plans.\nEmit function calls to run terminal commands and apply patches. Depending on how this specific run is configured, you can request that these function calls be escalated to the user for approval before running. More on this in the \"Sandbox and approvals\" section.\nWithin this context, Codex refers to the open-source agentic coding interface (not the old Codex language model built by OpenAI).\nSection Title: How you work > Personality\nContent:\nYour default personality and tone is concise, direct, and friendly. You communicate efficiently, always keeping the user clearly informed about ongoing actions without unnecessary detail. You always prioritize actionable guidance, clearly stating assumptions, environment prerequisites, and next steps. Unless explicitly asked, you avoid excessively verbose explanations about your work.\nSection Title: How you work > AGENTS.md spec\nContent:\nRepos often contain AGENTS.md files. These files can appear anywhere within the repository. These files are a way for humans to give you (the agent) instructions or tips for working within the container. Some examples might be: coding conventions, info about how code is organized, or instructions for how to run or test code. Instructions in AGENTS.md files:\nThe scope of an AGENTS.md file is the entire directory tree rooted at the folder that contains it. For every file you touch in the final patch, you must obey instructions in any AGENTS.md file whose scope includes that file. Instructions about code style, structure, naming, etc. apply only to code within the AGENTS.md file's scope, unless the file states otherwise. More-deeply-nested AGENTS.md files take precedence in the case of conflicting instructions. Direct system/developer/user instructions (as part of a prompt) take precedence over AGENTS.md instructions.\nSection Title: How you work > AGENTS.md spec\nContent:\nThe contents of the AGENTS.md file at the root of the repo and any directories from the CWD up to the root are included with the developer message and don't need to be re-read. When working in a subdirectory of CWD, or a directory outside the CWD, check for any AGENTS.md files that may be applicable.\nSection Title: How you work > Autonomy and Persistence\nContent:\nPersist until the task is fully handled end-to-end within the current turn whenever feasible: do not stop at analysis or partial fixes; carry changes through implementation, verification, and a clear explanation of outcomes unless the user explicitly pauses or redirects you.\nUnless the user explicitly asks for a plan, asks a question about the code, is brainstorming potential solutions, or some other intent that makes it clear that code should not be written, assume the user wants you to make code changes or run tools to solve the user's problem. In these cases, it's bad to output your proposed solution in a message, you should go ahead and actually implement the change. If you encounter challenges or blockers, you should attempt to resolve them yourself.\n ... \nSection Title: How you work > Planning\nContent:\nBefore running a command, consider whether or not you have completed the previous step, and make sure to mark it as completed before moving on to the next step. It may be the case that you complete all steps in your plan after a single pass of implementation. If this is the case, you can simply mark all the planned steps as completed. Sometimes, you may need to change plans in the middle of a task: call `update_plan` with the updated plan and make sure to provide an `explanation` of the rationale when doing so.\nSection Title: How you work > Planning\nContent:\nMaintain statuses in the tool: exactly one item in_progress at a time; mark items complete when done; post timely status transitions. Do not jump an item from pending to completed: always set it to in_progress first. Do not batch-complete multiple items after the fact. Finish with all items completed or explicitly canceled/deferred before ending the turn. Scope pivots: if understanding changes (split/merge/reorder items), update the plan before continuing. Do not let the plan go stale while coding.\nUse a plan when:\nSection Title: How you work > Planning\nContent:\nThe task is non-trivial and will require multiple actions over a long time horizon.\nThere are logical phases or dependencies where sequencing matters.\nThe work has ambiguity that benefits from outlining high-level goals.\nYou want intermediate checkpoints for feedback and validation.\nWhen the user asked you to do more than one thing in a single prompt\nThe user has asked you to use the plan tool (aka \"TODOs\")\nYou generate additional steps while working, and plan to do them before yielding to the user\nSection Title: How you work > Planning > Examples\nContent:\n**High-quality plans**\nExample 1:\nAdd CLI entry with file args\nParse Markdown via CommonMark library\nApply semantic HTML template\nHandle code blocks, images, links\nAdd error handling for invalid files\nExample 2:\nDefine CSS variables for colors\nAdd toggle with localStorage state\nRefactor components to use variables\nVerify all views for readability\nAdd smooth theme-change transition\nExample 3:\nSet up Node.js + WebSocket server\nAdd join/leave broadcast events\nImplement messaging with timestamps\nAdd usernames + mention highlighting\nPersist messages in lightweight DB\nAdd typing indicators + unread count\n**Low-quality plans**\nExample 1:\nCreate CLI tool\nAdd Markdown parser\nConvert to HTML\nExample 2:\nAdd dark mode toggle\nSave preference\nMake styles look good\nExample 3:\nCreate single-file HTML game\nRun quick sanity check\nSummarize usage instructions\nIf you need to write a plan, only write high quality plans, not low quality ones.\nSection Title: How you work > Task execution\nContent:\nYou are a coding agent. You must keep going until the query or task is completely resolved, before ending your turn and yielding back to the user. Persist until the task is fully handled end-to-end within the current turn whenever feasible and persevere even when function calls fail. Only terminate your turn when you are sure that the problem is solved. Autonomously resolve the query to the best of your ability, using the tools available to you, before coming back to the user. Do NOT guess or make up an answer.\nYou MUST adhere to the following criteria when solving queries:\nWorking on the repo(s) in the current environment is allowed, even if they are proprietary.\nAnalyzing code for vulnerabilities is allowed.\nShowing user code and tool call details is allowed.\nUse the `apply_patch` tool to edit files (NEVER try `applypatch` or `apply-patch`, only `apply_patch`). This is a FREEFORM tool, so do not wrap the patch in JSON.\nSection Title: How you work > Task execution\nContent:\nIf completing the user's task requires writing or modifying files, your code and final answer should follow these coding guidelines, though user instructions (i.e. AGENTS.md) may override these guidelines:\nSection Title: How you work > Task execution\nContent:\nFix the problem at the root cause rather than applying surface-level patches, when possible. Avoid unneeded complexity in your solution. Do not attempt to fix unrelated bugs or broken tests. It is not your responsibility to fix them. (You may mention them to the user in your final message though.) Update documentation as necessary. Keep changes consistent with the style of the existing codebase. Changes should be minimal and focused on the task. If you're building a web app from scratch, give it a beautiful and modern UI, imbued with best UX practices. Use `git log` and `git blame` to search the history of the codebase if additional context is required. NEVER add copyright or license headers unless specifically requested. Do not waste tokens by re-reading files after calling `apply_patch` on them. The tool call will fail if it didn't work. The same goes for making folders, deleting folders, etc.\nSection Title: How you work > Task execution\nContent:\nDo not `git commit` your changes or create new git branches unless explicitly requested. Do not add inline comments within code unless explicitly requested. Do not use one-letter variable names unless explicitly requested. NEVER output inline citations like \"【F:README.md†L5-L14】\" in your outputs. The CLI is not able to render these so they will just be broken in the UI. Instead, if you output valid filepaths, users will be able to click on them to open the files in their editor.\nSection Title: How you work > Validating your work\nContent:\nIf the codebase has tests, or the ability to build or run tests, consider using them to verify changes once your work is complete.\nWhen testing, your philosophy should be to start as specific as possible to the code you changed so that you can catch issues efficiently, then make your way to broader tests as you build confidence. If there's no test for the code you changed, and if the adjacent patterns in the codebases show that there's a logical place for you to add a test, you may do so. However, do not add tests to codebases with no tests.\nSection Title: How you work > Validating your work\nContent:\nSimilarly, once you're confident in correctness, you can suggest or use formatting commands to ensure that your code is well formatted. If there are issues you can iterate up to 3 times to get formatting right, but if you still can't manage it's better to save the user time and present them a correct solution where you call out the formatting in your final message. If the codebase does not have a formatter configured, do not add one.\nFor all of testing, running, building, and formatting, do not attempt to fix unrelated bugs. It is not your responsibility to fix them. (You may mention them to the user in your final message though.)\nBe mindful of whether to run validation commands proactively. In the absence of behavioral guidance:\nSection Title: How you work > Validating your work\nContent:\nWhen running in non-interactive approval modes like **never** or **on-failure**, you can proactively run tests, lint and do whatever you need to ensure you've completed the task. If you are unable to run tests, you must still do your utmost best to complete the task.\nWhen working in interactive approval modes like **untrusted**, or **on-request**, hold off on running tests or lint commands until the user is ready for you to finalize your output, because these commands take time to run and slow down iteration. Instead suggest what you want to do next, and let the user confirm first.\nWhen working on test-related tasks, such as adding tests, fixing tests, or reproducing a bug to verify behavior, you may proactively run tests regardless of approval mode. Use your judgement to decide whether this is a test-related task.\nSection Title: How you work > Ambition vs. precision\nContent:\nFor tasks that have no prior context (i.e. the user is starting something brand new), you should feel free to be ambitious and demonstrate creativity with your implementation.\nIf you're operating in an existing codebase, you should make sure you do exactly what the user asks with surgical precision. Treat the surrounding codebase with respect, and don't overstep (i.e. changing filenames or variables unnecessarily). You should balance being sufficiently ambitious and proactive when completing tasks of this nature.\nYou should use judicious initiative to decide on the right level of detail and complexity to deliver based on the user's needs. This means showing good judgment that you're capable of doing the right extras without gold-plating. This might be demonstrated by high-value, creative touches when scope of the task is vague; while being surgical and targeted when scope is tightly specified.\nSection Title: How you work > Presenting your work\nContent:\nYour final message should read naturally, like an update from a concise teammate. For casual conversation, brainstorming tasks, or quick questions from the user, respond in a friendly, conversational tone. You should ask questions, suggest ideas, and adapt to the user’s style. If you've finished a large amount of work, when describing what you've done to the user, you should follow the final answer formatting guidelines to communicate substantive changes. You don't need to add structured formatting for one-word answers, greetings, or purely conversational exchanges.\nYou can skip heavy formatting for single, simple actions or confirmations. In these cases, respond in plain sentences with any relevant next step or quick option. Reserve multi-section structured responses for results that need grouping or explanation.\nSection Title: How you work > Presenting your work\nContent:\nThe user is working on the same computer as you, and has access to your work. As such there's no need to show the contents of files you have already written unless the user explicitly asks for them. Similarly, if you've created or modified files using `apply_patch`, there's no need to tell users to \"save the file\" or \"copy the code into a file\"—just reference the file path.\nIf there's something that you think you could help with as a logical next step, concisely ask the user if they want you to do so. Good examples of this are running tests, committing changes, or building out the next logical component. If there’s something that you couldn't do (even with approval) but that the user might want to do (such as verifying changes by running the app), include those instructions succinctly.\nSection Title: How you work > Presenting your work\nContent:\nBrevity is very important as a default. You should be very concise (i.e. no more than 10 lines), but can relax this requirement for tasks where additional detail and comprehensiveness is important for the user's understanding.\nSection Title: How you work > Presenting your work > Final answer structure and style guidelines\nContent:\nYou are producing plain text that will later be styled by the CLI. Follow these rules exactly. Formatting should make results easy to scan, but not feel mechanical. Use judgment to decide how much structure adds value.\n**Section Headers**\nUse only when they improve clarity — they are not mandatory for every answer.\nChoose descriptive names that fit the content\nKeep headers short (1–3 words) and in `**Title Case**`. Always start headers with `**` and end with `**`\nLeave no blank line before the first bullet under a header.\nSection headers should only be used where they genuinely improve scanability; avoid fragmenting the answer.\n**Bullets**\nSection Title: How you work > Presenting your work > Final answer structure and style guidelines\nContent:\nUse `-` followed by a space for every bullet.\nMerge related points when possible; avoid a bullet for every trivial detail.\nKeep bullets to one line unless breaking for clarity is unavoidable.\nGroup into short lists (4–6 bullets) ordered by importance.\nUse consistent keyword phrasing and formatting across sections.\n**Monospace**\nWrap all commands, file paths, env vars, code identifiers, and code samples in backticks (``...``).\nApply to inline examples and to bullet keywords if the keyword itself is a literal file/command.\nNever mix monospace and bold markers; choose one based on whether it’s a keyword (`**`) or inline code/path (```).\n**File References**\nWhen referencing files in your response, make sure to include the relevant start line and always follow the below rules:\nSection Title: How you work > Presenting your work > Final answer structure and style guidelines\nContent:\nUse inline code to make file paths clickable.\nEach reference should have a stand alone path. Even if it's the same file.\nAccepted: absolute, workspace‑relative, a/ or b/ diff prefixes, or bare filename/suffix.\nLine/column (1‑based, optional): :line[:column] or #Lline[Ccolumn] (column defaults to 1).\nDo not use URIs like file://, vscode://, or https://.\nDo not provide range of lines\nExamples: src/app.ts, src/app.ts:42, b/server/index.js#L10, C:\\repo\\project\\main.rs:12:5\n**Structure**\nSection Title: How you work > Presenting your work > Final answer structure and style guidelines\nContent:\nPlace related bullets together; don’t mix unrelated concepts in the same section.\nOrder sections from general → specific → supporting info.\nFor subsections (e.g., “Binaries” under “Rust Workspace”), introduce with a bolded keyword bullet, then list items under it.\nMatch structure to complexity:\nMulti-part or detailed results → use clear headers and grouped bullets.\nSimple results → minimal headers, possibly just a short list or paragraph.\n**Tone**\nKeep the voice collaborative and natural, like a coding partner handing off work.\nBe concise and factual — no filler or conversational commentary and avoid unnecessary repetition\nUse present tense and active voice (e.g., “Runs tests” not “This will run tests”).\nKeep descriptions self-contained; don’t refer to “above” or “below”.\nUse parallel structure in lists for consistency.\n**Verbosity**\n ... \nSection Title: How you work > Presenting your work > Final answer structure and style guidelines\nContent:\nGenerally, ensure your final answers adapt their shape and depth to the request. For example, answers to code explanations should have a precise, structured explanation with code references that answer the question directly. For tasks with a simple implementation, lead with the outcome and supplement only with what’s needed for clarity. Larger changes can be presented as a logical walkthrough of your approach, grouping related steps, explaining rationale where it adds value, and highlighting next actions to accelerate the user. Your answers should provide the right level of detail while being easily scannable.\nFor casual greetings, acknowledgements, or other one-off conversational messages that are not delivering substantive information or structured results, respond naturally without section headers or bullet formatting.\nSection Title: Tool Guidelines > Shell commands\nContent:\nWhen using the shell, you must adhere to the following guidelines:\nWhen searching for text or files, prefer using `rg` or `rg --files` respectively because `rg` is much faster than alternatives like `grep`. (If the `rg` command is not found, then use alternatives.)\nDo not use python scripts to attempt to output larger chunks of a file.\nParallelize tool calls whenever possible - especially file reads, such as `cat`, `rg`, `sed`, `ls`, `git show`, `nl`, `wc`. Use `multi_tool_use.parallel` to parallelize tool calls and only this.\n ... \nSection Title: Tool Guidelines > apply_patch\nContent:\nYou must include a header with your intended action (Add/Delete/Update)\nYou must prefix new lines with `+` even when creating a new file\nSection Title: Tool Guidelines > `update_plan`\nContent:\nA tool named `update_plan` is available to you. You can use it to keep an up‑to‑date, step‑by‑step plan for the task.\nTo create a new plan, call `update_plan` with a short list of 1‑sentence steps (no more than 5-7 words each) with a `status` for each step (`pending`, `in_progress`, or `completed`).\nWhen steps have been completed, use `update_plan` to mark each finished step as `completed` and the next step you are working on as `in_progress`. There should always be exactly one `in_progress` step until everything is done. You can mark multiple items as complete in a single `update_plan` call.\nIf all steps are complete, ensure you call `update_plan` to mark all steps as `completed`.",
1086
- "~debug": {
1087
- "showParallelAttribution": false
1088
- }
1089
- }
1090
- }
1091
- ]
1092
- },
1093
- {
1094
- "role": "assistant",
1095
- "messageId": 18,
1096
- "content": [
1097
- {
1098
- "type": "thinking",
1099
- "thinking": "Now I have both system prompts. Let me analyze the key patterns from both Codex CLI and Claude Code, and then improve the Apex AI system prompt. Let me identify the key improvements needed:\n\n**From Codex CLI (OpenAI):**\n1. Concise, direct, friendly personality\n2. Autonomy and persistence - keep going until task is complete\n3. Ambition vs. precision - be surgical in existing codebases, ambitious for new projects\n4. Progress updates for longer tasks\n5. Read before edit, verify work\n6. Don't commit unless asked\n7. Don't add comments unless asked\n8. Validation guidance\n\n\n9. Structured final answer formatting\n10. File references with line numbers\n\n**From Claude Code (Anthropic):**\n1. Concise - fewer than 4 lines unless asked for detail\n2. Minimize output tokens\n3. No unnecessary preamble/postamble\n4. No emojis unless asked\n5. Don't add comments unless asked\n6. Never commit unless asked\n7. Task management with TodoWrite\n8. Security - defensive only, never expose secrets\n9. Follow existing code conventions\n10. Check libraries exist before using them\n11. Use search tools extensively\n12. Verify with tests, lint, typecheck\n13. Parallel tool calls\n\nNow I'm comparing this against what's in the current Apex AI prompt and spotting several gaps. The personality instructions are too flowery when the pro tools emphasize being direct and concise. I'm missing explicit rules about output length limits, avoiding comments and commits unless requested, running validation checks, and handling security properly. There's also a mismatch between what the prompt references and what tools are actually available.\n\nThe key improvements I need to make are tightening the personality guidance, adding concrete constraints on code output, including error recovery strategies, and removing the assumption about automatic code review since that's handled elsewhere in the system.",
1100
- "signature": "EtsaCkgICxACGAIqQGk4oIPMZA3UC5/APlxZu2zPva3gZpwB3qWEduuJA3JhU86IvXOJXXxzaW/YX5aIIkBeL7/HOESmtSl42+dznnkSDBk5PzHaOXu320c7BhoMYaP+GAkoK6Y4+JrIIjBfUIn6y+XGQb9W5MOWogzyQeXf03rT6K/gP9VHj9+FlCaipETtDLt7cs6jTU+i6x0qwBltUC8/0fTriV9w2MBFCBQDmIrUzqZN+NZcMioY54nU1COXFjUfMI6l8PX39lnyUbcxReBP/S7SnXjnQqyeVBmV7zGhJaQlZlp5sjIf9qlqfD41oE+6liQNKzkLuvzSzWAIjN/7qLlq0XEo8Kv4Zrga05WH+cmMEUWUIviuE1qVjoqh48WbOjVH9NAIT7VEZ1ySfcF3s4Gr60fGZCSATbAbojGrIznBabM8KqtioGj/9HaOKGiNrIBu2jvxfXQiPLQ2V+cn8y1fg0JonfkaY2qv2YyNJDnas1HAZf0a4YRkdcH1q3Vw0MnWc2ko7F1fMay055ZRmyxQOnjA4JTJ3awhaJMdamwukr6YpZLT7q5zvth/p8fwIzw9kYHfvAEIpgTxtiUxZEHA9mrXpHC5+PBpc5sNkJQ5W0rfrg8pmAVf9giNvKc2/Pv0CRoY3j8XMu/NT4/MiP5BUX2+7kIq3ro+uDjbBDsV59mMDFWe7qbrSotzqOtqlbHdaKz80+ap0E4Vlcp2lsgcjztyLMVvm689BJghbdk+6mruqETttLBab6oky6kyMVCv6csk1QdE4JmKyy3yESIHggPrQjGacdMxARVb3ag8CEmUwd7amX0eisdVYL53K2Gxh1d7R+1hmr37776/1BYxMLEajQMIBh0hQ9OKcjLH+ekdxkN2w8OPhWyzseAEWNPRFsaWoZZoWIxkOhU+iLxtmJ/pGr22+MeyxtSNrdkPhAXAfG8UUiULOBLp+kejMPtRFcKrWAAxwLJta3o0vqoVKIQqsM6+6O7sSSLUfSbUZUcHFs78UCdAwg1SH2NRjLIb6ffdotdfoNySDJFhqwBGyH6Rc3x/wB5lILVyoSZkYWR7iJ/0i45EMxujcPj9+mHTsq7LwhqHIY5ADmX/RH3F21mLhdxXMyKDGHlx+kGNFazb21ajbLE/+1NZVFVI5O96kTiKpipzHA/FL2ELYBrUbN18dDXyO3C89r4xYUGoXmfDy15w8A40W/SXMJpYbo37u0tU1PldDQNmn0snltLc/TmXz/CmotiiidrZrkmpw+C455ghMv/QHzM95UNIr4sLg69b3g+Gzt8M7vKexutSk58H0InpIXamtXBEgm+PQBWpmJVQy/lsQicZSHP3LWAvkJvuTVDY3O07Hsx7h+9mPxkn0wGF5FdoDYw/OayW0GTY+WLdu7J0F3QVeY0AzPgcCMQnu2AH6qTAjMdK02VHY3Jl6juFLqJPn4My2ngDf3yCBWHMgsSj1bv9D+oOuYCGZNmx8xfQf+td53SovHXcMa9Dqc4WoARSNxIbFGE3D6FrLmEOUHMGyS848q6ziJu4Yc20KNjaKRW91F9J3OLBr+EPA4QojcyxBAT2ngCI+3OuTSMztHfeA8s5wiou6pX5Pw6gA3d7fJ1r9C8Prh1c4Fcnieh9jmuXh781UJPv8TfOZecjqtOpDWstFrz+kuFQd0Qnv4fYe+bUjHYa6bmdepgckDDwWtm/Iezd3KP/+Zqa5QaCV7tXh9MqhjXRHsD/nhPXgKTBLKgjsFkTbBr0FTUVhmJwN2FdHyiLjqRIPVBbaCpFYvkpkR9WfqTBn6vHHVcAmFVwG/ihOJ4p7MofyZ84tvxyrjmuzD7mbaIJVaproo7PJsND0dx9qbsZiNy7dNkoZwBMyjlx+MU7iFAPt4R2IJ8fNbzEChaip9vKVOFjAJc9Tl8/0i805aI5BzfkWbIFYkyfKrPPQt8iq4wD7j/jEwX31dnVQb4iCscjAp+2EeU8wxMthaylycgwx42SjQFP10+Ir+xPcsrld2XYnq/qWEVF1atLMCLoek7VA5xS5X7LN9tORik8V2hYz6AakOuHtoJTN8+KkQt8rB4ZFceIC2KmqJEElTOdLy3YzewG185HPGwcSw6wXVh95SjY1fZ7LlyJ2ql56VhGTtnnRxDmN1SmNCPFx9WpiHuk0Yts5x8ArCeDKaqJdlQpZ97VSYOMf1IQLhZWKL+TBprWjMxTZOQIusg0GzyhehE6pkgOwuh+NgDkPuje7MNQ/7Xj34b0okB/nCAfeebhLpheL8QfgxJyGwQDpS45ZocBekPocUzoNgQ2YtOFk6KX6Q75MJElPe1UivI8Pqpqkb8wQzQcIeE0SHnBuxd2bulmq8oxuRsS2nGliItJNKTrIOglAb5XkN1iCWo4KiYPcLuRNKmUX04qBP6J8axSsMUuLQHcZKFNlzdLtBEnkaDl0pdNzaTJQ2dDK2PN+T4M3KU6NblskCp481D2oEXpSszj5zwmZg2pR2GrtyDC30AoYB4JwLrJ3C0YOimwNKfG2aB3zqMPXMYA2TiYuj3cKjoUkQWeZOb57r8MfZ3yGaL3zRXDoC1M/0jiiLjkodIeyD/gJJn0DifR5FokgtAwA+oAJfoSnXKIrEtgGHDuPj6+X08NPJsj0JGicfY6M2n/QX2D70HBMeEm0Rme2oniH35f3cKLeBTHB1y7BAcmIr1jaRNtZqtlWTXCo7TpSPUrEcO+o2cjpdwVGar1GZO3R0Vs+oTluK1O/rBnor7o9GJ8Zkrzm0EJkj5fWJueLrYZDNF0ft1z1CLLUENttH1a4craowB6hyQLegx3ei04peYihNfJiDUikEI7KhfDt2dIVY4Rc1gSaQi+SHLPW2Y1SKgAdGTHdtdFEtGIOJEZyJ1KK/hK8wiyWZ0Wf2HXXu7F2pg9T7hqHOkT5XyLzLAiqjm4lBhytzMjIMLFIt96x3IqGgqnmA0jdHtLDU6p3mcWncmUEw3VuwrVeXatIJwu/v6cCOeknN7n9X7ogp/i/J8eHi6Md6s1nGjQzAbiBZTc2Hm449/jcBQTX1tJPhwraKcv6If35ktTWSCjfgGC9+Bmla03aJ4jo4DYD0n96LhVWtW5QSnrkXrdZzhhZCzJLuwLDYi/d//4/id8+gx2mR3j5EIWEM7x6ISQuNqbEFdLD6wqo50csAsMkMmuHzlmDBjXUktUMjxicnf+vFcjf17x0GyRE7PLqqR6tF5/a5UzJ14pvguaYBRZ79hyW7eS9s/JxHB+/1vM+Qtv5q5dpFOBjKDkHHFUYYmGtpTlQFzWhlagwybAY2ZwMJGhTleKYHmo7M1jPOlklIMahWT/FbT7G845SMkrSUE7iGjb6aMKN+pbbC71cGBWQrmTREuzYRPWTKAcQQxXIjbQ5d/2w/lDksBfHfm6ducK3/pcG+Qjml418Brhje+Ii8oy0TH0/4tazrRcGQEgtmYdWHuNm2cI2hL9NzotIuqS5TFT/aFGeqGocrLn2RjasuHtECzjv8WYzQdzi6gRpVFvHDbvk7EDswo4npWFTOxScUaZ9JwWrPpG74lWHXlVrmydCHPFIFNa38zIxElIUvCxsntkC0CoFY735PmJ2aAVx8oNXNs76AYeEpAPCxhTaeYv1oOsA4RodyOkJDUGuFtYJ4trR5hZFMbwx4tk0t8/GqSz/7T6PK8eH+R4yxZRYf/pqt+/9TrCh3mHD9xtGcHToiY4Apn+ZAh/RrhTnLf6ZEvNzf+V78yoJfuRtGPB0SsDL8Ty4nB4l3cMPe2MghWrJaVRroipM0HX1yTreGVtXVgXm82LTGHpAzPZaNicSjhebHRxta0o2nKXViAXU9OoDL6xgX39+JsD1LmJdqAlAM1iRQmqqfT+2sGTH8pY/9qsKhDmTj89u2hY/o3033NDyRMJNhE4Uip3QGmi7viedEPmfJ2f6WyA8QtLFDglsbfjw/U9qxuyPA++wTDqDZMigM+6FfreqoH2S6Q6iIppyt94KGd6LWRLefR/xsHIgJi+bilg/qBU22RFUq97vz9C9K3cFh+WyvQ/bsW5e/IIETXA537ROPdOKfTLGB37jAE2gokVTLTHgWVTPPklDTbqZ3ahhU6Jx0F4wtFnwCrambPTcKYZlkqfv3A60doOZzcUqQ1maE+pBxTZAWuM2ZDTgxHNXyE2ptQukeRz+tgOeuZfccWrCMKwTpjOH89sgjYwlOQ/S+LpGa+jypDQl4m6tnJpNKWOvtYNE0wz9+usZ/RPNbKC5JjTHipU/kLmAFlTcVBrBohqOa0Ku8voQr9J5RC9Dr8Q40xdC4D9uoV4/EYBwU23V8P3Z9Hiee2Xf8mz91O42odgJWWAtC44DlhEArK1G0925QN6I17fo6Po5D70dIlRqPi6q9Nfl1TF4tRjSnmS8tYS2d8YGh4nN+cZ79c3bGocj66WTBPCg5m4m9i9+lXhl6Fy43qFSuFTKUXbaKb0yEKkfR4vkuUhdXkz6mqbTWszbB2WOyoQbpiWH+2oSci1qI7qd/Fhs0/GXYNCsgt271lxNkqR48z8DwngayvnXQJxrbAsChHAbfU7lUsYAQ==",
1101
- "provider": "anthropic"
1102
- },
1103
- {
1104
- "type": "text",
1105
- "text": "Now I have both reference prompts and the full Apex AI codebase. Let me analyze and update the system prompt with the best practices from both Codex CLI and Claude Code."
1106
- },
1107
- {
1108
- "type": "tool_use",
1109
- "complete": true,
1110
- "id": "toolu_vrtx_01G69VxJwdWpYRqbotBz68FS",
1111
- "name": "oracle",
1112
- "input": {
1113
- "task": "Review the Apex AI system prompt and suggest improvements based on OpenAI Codex CLI and Claude Code's system prompts. Focus on what's missing, what's wrong, and what should change to make the prompt work better for an agentic CLI coding assistant that uses tool calling via the OpenAI-compatible API.",
1114
- "context": "\nApex AI is a terminal-based coding assistant that uses Nvidia's LLM API (OpenAI-compatible). It has these tools: Read, Write, Edit, Patch, Bash, Grep, Glob, ListDir, UndoEdit, Task, WebSearch, FilePickerMax.\n\nCURRENT APEX SYSTEM PROMPT (in src/prompt.js):\n```\nYou are Apex AI, a friendly and approachable coding assistant...\n[see the buildSystemPrompt function - it has personality, core principles, tool usage, workflow, and environment sections]\n```\n\nKEY PATTERNS FROM CODEX CLI:\n- Concise, direct, friendly personality\n- Keep going until task is fully resolved\n- Ambition vs precision (surgical in existing code, creative for new projects)\n- Progress updates for long tasks\n- Don't commit unless asked\n- Don't add comments unless asked \n- Validate work with tests/lint\n- Structured final answer formatting (headers, bullets, monospace)\n- File references with line numbers\n\nKEY PATTERNS FROM CLAUDE CODE:\n- Answer concisely with fewer than 4 lines unless asked for detail\n- Minimize output tokens\n- No unnecessary preamble/postamble\n- No emojis unless asked\n- Don't add comments unless asked\n- Never commit unless asked\n- Security: never expose secrets, follow security best practices\n- Check that libraries exist before using them\n- Verify with tests, lint, typecheck after changes\n- Parallel tool calls for independent operations\n- Use search tools extensively\n\nISSUES WITH CURRENT PROMPT:\n1. Too verbose/warm personality - professional tools favor concise, direct\n2. No conciseness directive\n3. Missing \"no comments\" rule\n4. Missing \"no commit\" rule \n5. Missing validation guidance (run tests/lint after changes)\n6. Missing security guidelines\n7. Missing ambition vs precision guidance\n8. Missing progress updates guidance\n9. \"Code review is automatic\" line is misleading (handled by code, not model)\n",
1115
- "files": [
1116
- "src/prompt.js",
1117
- "src/tools.js",
1118
- "src/agent.js",
1119
- "src/config.js"
1120
- ]
1121
- }
1122
- }
1123
- ],
1124
- "state": {
1125
- "type": "complete",
1126
- "stopReason": "tool_use"
1127
- },
1128
- "usage": {
1129
- "model": "claude-opus-4-6",
1130
- "maxInputTokens": 168000,
1131
- "inputTokens": 1,
1132
- "outputTokens": 1505,
1133
- "cacheCreationInputTokens": 9345,
1134
- "cacheReadInputTokens": 65579,
1135
- "totalInputTokens": 74925,
1136
- "timestamp": "2026-02-26T03:13:08.278Z"
1137
- }
1138
- },
1139
- {
1140
- "role": "user",
1141
- "messageId": 19,
1142
- "content": [
1143
- {
1144
- "type": "tool_result",
1145
- "toolUseID": "toolu_vrtx_01G69VxJwdWpYRqbotBz68FS",
1146
- "run": {
1147
- "status": "done",
1148
- "result": "## 1) TL;DR\nYour current system prompt is directionally good for agentic work, but it’s missing the two biggest “CLI agent” constraints: **be terse by default** and **avoid unrequested side effects** (no commits, no comments, no new deps). I’d rewrite the prompt to (a) remove the warm/verbose personality + “detailed thinking on”, (b) add explicit **conciseness + output formatting + safety** rules, and (c) clarify **ambition vs precision** + **validation** expectations.\n\nEffort: **M (1–3h)** to rewrite prompt text + quick test run on a few tasks to calibrate verbosity/tooling behavior.\n\n---\n\n## 2) Recommended approach (simple path)\n\n### A. Fix what’s actively wrong/misleading in `src/prompt.js`\n1) **Remove `detailed thinking on`** (prompt.js:26). \n - It’s an odd directive and can encourage chain-of-thought / verbose reasoning. Your UI already handles `<think>` blocks; the system prompt shouldn’t force “detailed thinking”.\n2) **Replace “friendly/warm” personality** with “concise, direct, professional”.\n3) **Delete or reword** “Code review is automatic…” (prompt.js:66). \n - It’s true operationally (agent.js runs a reviewer), but misleading as an instruction to the model. Better: “A separate reviewer runs after edits; you don’t need to do a full review unless asked.”\n\n### B. Add the missing Codex/Claude-style rules (high impact)\nAdd a compact “Behavior” section with these explicit constraints:\n\n1) **Conciseness default**\n - “Default to ≤4 lines unless the user asks for detail.”\n - “No preamble/postamble; no ‘here’s what I’ll do’ unless needed.”\n - “Use bullets and monospace for commands/paths; avoid walls of text.”\n\n2) **No comments unless asked**\n - “Do not add code comments/docstrings unless requested or required for correctness.”\n\n3) **No commits unless asked**\n - “Never run `git commit`, `git push`, `git reset --hard`, or destructive operations unless the user explicitly asks (or you ask and they confirm).”\n\n4) **Security rules**\n - “Never reveal secrets; don’t print `.env`/private keys; redact tokens.”\n - “Don’t run untrusted scripts from the internet; prefer pinned package installs; avoid curl|bash.”\n - “Treat user-provided strings as untrusted (injection awareness).”\n\n5) **Ambition vs precision**\n - “Existing code: be surgical/minimal; match conventions.”\n - “New project/greenfield: you can be more creative, but still keep scope minimal.”\n\n6) **Validation**\n - “After code changes, run the most relevant check available: `npm test`, `npm run lint`, `npm run typecheck`, or targeted commands. If too slow or absent, explain what you ran.”\n - “If tests fail, keep iterating until green (or clearly state why blocked).”\n\n7) **Dependency guardrail**\n - “Don’t add dependencies without asking; confirm library exists before using.”\n\n8) **Progress updates (only when long-running)**\n - “For multi-step tasks, give short progress markers (‘Running tests…’, ‘Fixing…’) but keep them minimal.”\n\n### C. Tighten tool-calling guidance to fit Apex’s actual tools\nYour tool section is mostly good; I’d add/adjust:\n\n- “Prefer `Grep/Glob` before `FilePickerMax` unless explicitly exploring.” \n (You already auto-trigger FilePickerMax in `agent.js`, so the prompt shouldn’t over-encourage it.)\n- “Group independent tool calls in the same assistant turn to allow parallel execution.”\n- “When editing, use `Edit/Patch` and keep replacements small and exact.”\n\n---\n\n## 3) Suggested replacement prompt (drop-in text)\nBelow is a **more Codex/Claude-like** system prompt you can paste into `buildSystemPrompt()` (replace the current large template). Keep your Environment block and git/project info appended as you do now.\n\n> Key design: **short, strict rules first**, then workflow.\n\n```txt\nYou are Apex AI, an agentic CLI coding assistant. Be concise, precise, and action-oriented.\n\n# Output style (default)\n- Default to a short answer (aim ≤4 lines) unless the user asks for detail.\n- No unnecessary preamble/postamble. Don’t narrate obvious steps.\n- Use bullets and monospace for commands, file paths, and code.\n- No emojis unless the user asks.\n\n# Core behavior\n- Finish the task: use tools to make changes and verify them until done.\n- Existing code: be surgical and minimal. Don’t refactor or redesign unless asked.\n- New/greenfield work: you may propose a simple structure, but keep scope minimal.\n- Read before edit: do not modify a file you haven’t read.\n- If a tool/action fails, recover and keep going (don’t stop at first failure).\n\n# Safety & side effects\n- Never expose secrets (API keys, tokens, credentials). Don’t display or copy `.env` contents. Redact sensitive values in outputs.\n- Don’t run untrusted remote scripts (avoid `curl ... | bash`).\n- Don’t add new dependencies without explicit user approval; confirm a library exists before using it.\n- Never run destructive/irreversible commands (e.g. `rm -rf`, `git reset --hard`, `git clean -fdx`) without asking for confirmation.\n- Never `git commit` or `git push` unless the user explicitly asks.\n\n# Code hygiene rules\n- Don’t add comments/docstrings unless the user asks or it’s required for correctness.\n- Match existing style, patterns, and dependencies.\n\n# Validation\n- After making code changes, run the most relevant checks available (tests/lint/typecheck/build). Prefer project scripts from package.json.\n- If checks fail, fix and re-run. If blocked, state what’s failing and why.\n\n# Tool use\n- Use Grep/Glob/ListDir to locate code; Read for context; Edit/Patch for surgical changes; Write for new files; Bash for running commands.\n- Bundle independent tool calls in the same turn when possible (parallel execution).\n- Don’t ask permission to use tools—use them.\n\n# Note\nA separate code review may run after edits; you don’t need to perform a full review unless the user asks.\n\n# Environment\nWorking directory: <PROJECT_ROOT>\nOS: <platform>\nNode: <version>\n<Project/package/git info...>\nMaximum tool iterations per turn: <MAX_TOOL_ITERATIONS>\n```\n\n---\n\n## 4) Rationale and trade-offs\n- The highest ROI changes are **verbosity control** and **side-effect guardrails**; they make the assistant feel like Codex/Claude Code immediately.\n- Removing “warm/friendly” reduces token waste and helps prevent “assistant-y” prose in a terminal workflow.\n- Explicit “no comments / no commits / no deps” rules prevent the most common CLI-agent footguns without adding complexity.\n\nTrade-off: stricter conciseness may sometimes under-explain. That’s fine in a CLI agent; the user can ask for detail, and you can include “expand if requested” guidance.\n\n---\n\n## 5) Risks and guardrails\n- **Risk: model becomes too terse** and omits critical status (tests run, failure info). \n Guardrail: keep a hard rule: after edits, always state *what you ran* (1 line) and *result* (pass/fail).\n- **Risk: “no comments” harms correctness** where documentation is required (public APIs). \n Guardrail: allow comments only when required for correctness/clarity and keep them minimal.\n- **Risk: security rules conflict with debugging** (e.g., needing env values). \n Guardrail: “show presence/shape, not contents” (e.g., “env var is missing”, not its value).\n\n---\n\n## 6) When to consider the advanced path\nOnly revisit with a more complex prompt if you see:\n- frequent failures due to insufficient planning (then add a tiny “Plan: 1–3 bullets” rule),\n- repeated tool-call loops / token bloat (then add “cap tool retries per step; summarize after each verification”),\n- models producing `<think>` content you don’t want shown (then explicitly forbid `<think>` and rely on silent reasoning).\n\n(Otherwise, the simple rewrite above is “good enough” and matches Codex CLI / Claude Code behavior closely.)",
1149
- "progress": [
1150
- {
1151
- "message": "## 1) TL;DR\nYour current system prompt is directionally good for agentic work, but it’s missing the two biggest “CLI agent” constraints: **be terse by default** and **avoid unrequested side effects** (no commits, no comments, no new deps). I’d rewrite the prompt to (a) remove the warm/verbose personality + “detailed thinking on”, (b) add explicit **conciseness + output formatting + safety** rules, and (c) clarify **ambition vs precision** + **validation** expectations.\n\nEffort: **M (1–3h)** to rewrite prompt text + quick test run on a few tasks to calibrate verbosity/tooling behavior.\n\n---\n\n## 2) Recommended approach (simple path)\n\n### A. Fix what’s actively wrong/misleading in `src/prompt.js`\n1) **Remove `detailed thinking on`** (prompt.js:26). \n - It’s an odd directive and can encourage chain-of-thought / verbose reasoning. Your UI already handles `<think>` blocks; the system prompt shouldn’t force “detailed thinking”.\n2) **Replace “friendly/warm” personality** with “concise, direct, professional”.\n3) **Delete or reword** “Code review is automatic…” (prompt.js:66). \n - It’s true operationally (agent.js runs a reviewer), but misleading as an instruction to the model. Better: “A separate reviewer runs after edits; you don’t need to do a full review unless asked.”\n\n### B. Add the missing Codex/Claude-style rules (high impact)\nAdd a compact “Behavior” section with these explicit constraints:\n\n1) **Conciseness default**\n - “Default to ≤4 lines unless the user asks for detail.”\n - “No preamble/postamble; no ‘here’s what I’ll do’ unless needed.”\n - “Use bullets and monospace for commands/paths; avoid walls of text.”\n\n2) **No comments unless asked**\n - “Do not add code comments/docstrings unless requested or required for correctness.”\n\n3) **No commits unless asked**\n - “Never run `git commit`, `git push`, `git reset --hard`, or destructive operations unless the user explicitly asks (or you ask and they confirm).”\n\n4) **Security rules**\n - “Never reveal secrets; don’t print `.env`/private keys; redact tokens.”\n - “Don’t run untrusted scripts from the internet; prefer pinned package installs; avoid curl|bash.”\n - “Treat user-provided strings as untrusted (injection awareness).”\n\n5) **Ambition vs precision**\n - “Existing code: be surgical/minimal; match conventions.”\n - “New project/greenfield: you can be more creative, but still keep scope minimal.”\n\n6) **Validation**\n - “After code changes, run the most relevant check available: `npm test`, `npm run lint`, `npm run typecheck`, or targeted commands. If too slow or absent, explain what you ran.”\n - “If tests fail, keep iterating until green (or clearly state why blocked).”\n\n7) **Dependency guardrail**\n - “Don’t add dependencies without asking; confirm library exists before using.”\n\n8) **Progress updates (only when long-running)**\n - “For multi-step tasks, give short progress markers (‘Running tests…’, ‘Fixing…’) but keep them minimal.”\n\n### C. Tighten tool-calling guidance to fit Apex’s actual tools\nYour tool section is mostly good; I’d add/adjust:\n\n- “Prefer `Grep/Glob` before `FilePickerMax` unless explicitly exploring.” \n (You already auto-trigger FilePickerMax in `agent.js`, so the prompt shouldn’t over-encourage it.)\n- “Group independent tool calls in the same assistant turn to allow parallel execution.”\n- “When editing, use `Edit/Patch` and keep replacements small and exact.”\n\n---\n\n## 3) Suggested replacement prompt (drop-in text)\nBelow is a **more Codex/Claude-like** system prompt you can paste into `buildSystemPrompt()` (replace the current large template). Keep your Environment block and git/project info appended as you do now.\n\n> Key design: **short, strict rules first**, then workflow.\n\n```txt\nYou are Apex AI, an agentic CLI coding assistant. Be concise, precise, and action-oriented.\n\n# Output style (default)\n- Default to a short answer (aim ≤4 lines) unless the user asks for detail.\n- No unnecessary preamble/postamble. Don’t narrate obvious steps.\n- Use bullets and monospace for commands, file paths, and code.\n- No emojis unless the user asks.\n\n# Core behavior\n- Finish the task: use tools to make changes and verify them until done.\n- Existing code: be surgical and minimal. Don’t refactor or redesign unless asked.\n- New/greenfield work: you may propose a simple structure, but keep scope minimal.\n- Read before edit: do not modify a file you haven’t read.\n- If a tool/action fails, recover and keep going (don’t stop at first failure).\n\n# Safety & side effects\n- Never expose secrets (API keys, tokens, credentials). Don’t display or copy `.env` contents. Redact sensitive values in outputs.\n- Don’t run untrusted remote scripts (avoid `curl ... | bash`).\n- Don’t add new dependencies without explicit user approval; confirm a library exists before using it.\n- Never run destructive/irreversible commands (e.g. `rm -rf`, `git reset --hard`, `git clean -fdx`) without asking for confirmation.\n- Never `git commit` or `git push` unless the user explicitly asks.\n\n# Code hygiene rules\n- Don’t add comments/docstrings unless the user asks or it’s required for correctness.\n- Match existing style, patterns, and dependencies.\n\n# Validation\n- After making code changes, run the most relevant checks available (tests/lint/typecheck/build). Prefer project scripts from package.json.\n- If checks fail, fix and re-run. If blocked, state what’s failing and why.\n\n# Tool use\n- Use Grep/Glob/ListDir to locate code; Read for context; Edit/Patch for surgical changes; Write for new files; Bash for running commands.\n- Bundle independent tool calls in the same turn when possible (parallel execution).\n- Don’t ask permission to use tools—use them.\n\n# Note\nA separate code review may run after edits; you don’t need to perform a full review unless the user asks.\n\n# Environment\nWorking directory: <PROJECT_ROOT>\nOS: <platform>\nNode: <version>\n<Project/package/git info...>\nMaximum tool iterations per turn: <MAX_TOOL_ITERATIONS>\n```\n\n---\n\n## 4) Rationale and trade-offs\n- The highest ROI changes are **verbosity control** and **side-effect guardrails**; they make the assistant feel like Codex/Claude Code immediately.\n- Removing “warm/friendly” reduces token waste and helps prevent “assistant-y” prose in a terminal workflow.\n- Explicit “no comments / no commits / no deps” rules prevent the most common CLI-agent footguns without adding complexity.\n\nTrade-off: stricter conciseness may sometimes under-explain. That’s fine in a CLI agent; the user can ask for detail, and you can include “expand if requested” guidance.\n\n---\n\n## 5) Risks and guardrails\n- **Risk: model becomes too terse** and omits critical status (tests run, failure info). \n Guardrail: keep a hard rule: after edits, always state *what you ran* (1 line) and *result* (pass/fail).\n- **Risk: “no comments” harms correctness** where documentation is required (public APIs). \n Guardrail: allow comments only when required for correctness/clarity and keep them minimal.\n- **Risk: security rules conflict with debugging** (e.g., needing env values). \n Guardrail: “show presence/shape, not contents” (e.g., “env var is missing”, not its value).\n\n---\n\n## 6) When to consider the advanced path\nOnly revisit with a more complex prompt if you see:\n- frequent failures due to insufficient planning (then add a tiny “Plan: 1–3 bullets” rule),\n- repeated tool-call loops / token bloat (then add “cap tool retries per step; summarize after each verification”),\n- models producing `<think>` content you don’t want shown (then explicitly forbid `<think>` and rely on silent reasoning).\n\n(Otherwise, the simple rewrite above is “good enough” and matches Codex CLI / Claude Code behavior closely.)",
1152
- "reasoning": "**Revising prompt structure**\n\nI think we should create a revised prompt that includes sections like Role, Output style, Core behavior, Tooling, Safety, Workflow, and Response formatting, but I want to keep it concise. It makes sense to include patch suggestions or diffs. There won't be any follow-up allowed, so the answer needs to cover everything comprehensively. I need to ensure I include a TLDR, rationale, risks, effort, and specifics on where to edit in the source code.\n\n",
1153
- "isThinking": false,
1154
- "tool_uses": []
1155
- }
1156
- ],
1157
- "~debug": {
1158
- "inferences": [
1159
- {
1160
- "inferenceTimeMs": 50764.299532000005,
1161
- "usage": {
1162
- "model": "gpt-5.2",
1163
- "maxInputTokens": 272000,
1164
- "inputTokens": 14343,
1165
- "outputTokens": 2468,
1166
- "cacheCreationInputTokens": null,
1167
- "cacheReadInputTokens": 3840,
1168
- "totalInputTokens": 14343
1169
- }
1170
- }
1171
- ],
1172
- "reasoningEffort": "medium"
1173
- }
1174
- }
1175
- }
1176
- ]
1177
- },
1178
- {
1179
- "role": "assistant",
1180
- "messageId": 20,
1181
- "content": [
1182
- {
1183
- "type": "thinking",
1184
- "thinking": "The oracle gave solid advice. Now let me implement the improved system prompt. I'll update the `buildSystemPrompt()` function in `src/prompt.js` with the improved prompt based on insights from both Codex CLI and Claude Code.",
1185
- "signature": "EosDCkgICxACGAIqQJsqopiZP+fqjmTUZC8BHlCD1+trhJ5NxEiD42MAK+MFM4RBbHPVlDtEIMe9JJMo2dTWD68KWIUEJWa2PykGgC8SDLPEkK57a1FsBYWp2RoMw/9A+OrIm4cBsaGUIjAGwPNV0/X12ahBwe9V0wMZ6uEf4DvdlgS+AQvKtgKYtuY9oAz+Ih0HVVFCyvI4oUYq8AE1gSn6IqnGNP7PHBnIHkRoXLpnIc8i7SZf3hyFzXBCbY3ikRDnwh7oU1k9N1W65yVkfxzpEU0P38TWKwuJf34w7mnN3RwHh23MTIN/T0BtPmdekgHA7pUb8kM6WphmytYPF1MwMMPxKenjawS/WX5SiY3VGVSPR5ndfWszlvVr6C0quL7+qpBfNpiTIiijrBtskdrv8qeoLubKWweP6r3E8F65gYeLiDgCoyCdpW2krPk60OYQ2UPGy6qqdSlUmMHOi6YwzVQj513FYhvEW8YFdpbIaFCfFm6fE2DpDt+DovZwdH752x837RaQt/Ej0DwYAQ==",
1186
- "provider": "anthropic"
1187
- },
1188
- {
1189
- "type": "text",
1190
- "text": "Now let me apply the improved system prompt:"
1191
- },
1192
- {
1193
- "type": "tool_use",
1194
- "complete": true,
1195
- "id": "toolu_vrtx_01AWFRWFus4vQSckyPzfxCjr",
1196
- "name": "edit_file",
1197
- "input": {
1198
- "path": "/home/runner/workspace/src/prompt.js",
1199
- "old_str": " return `detailed thinking on\n\nYou are Apex AI, a friendly and approachable coding assistant. You're warm, helpful, and conversational — like a knowledgeable friend who loves coding.\n\n# Personality\n\n- Be friendly, warm, and encouraging. Use a casual but professional tone.\n- When a user asks a question that doesn't need any tools (like general knowledge, advice, greetings, or casual chat), just answer directly and naturally. You do NOT always need to use tools — only use them when the task actually requires reading, writing, or executing something on the filesystem.\n- NEVER say things like \"I don't have any tool to call\" or \"I don't have the tools for that.\" Just respond helpfully with what you know.\n- If you're unsure, say so honestly, but still try your best to help.\n\n# Core Principles\n\n1. **Take initiative.** When asked to do something, DO it — don't just explain how. Use your tools to read, write, edit, and execute code until the task is COMPLETE.\n2. **Read before you edit.** NEVER modify a file you haven't read first. Always understand existing code before making changes.\n3. **Work incrementally.** Make small changes, verify they work (run tests, check syntax), then continue. Don't make huge changes blind.\n4. **Verify your work.** After making changes, run the relevant tests, linter, or type checker. If something fails, fix it before responding.\n5. **Follow conventions.** Match the existing code style, frameworks, libraries, and patterns. Check imports and neighboring files first.\n6. **Minimal changes.** Only change what's needed. Don't refactor, add features, or \"improve\" code beyond what was asked.\n7. **Keep going.** If a tool call fails, try to recover. If you need more context, read more files. Don't give up after one attempt.\n\n# Tool Usage\n\n- Use Bash for running commands (tests, builds, linters, git operations)\n- Use Read to understand files before modifying them\n- Use Grep/Glob/ListDir to explore the codebase and find relevant code\n- Use Edit for surgical changes to existing files (preferred over Write for existing files)\n- Use Write only for creating new files\n- Use Patch for making multiple edits to the same file at once\n- Execute multiple independent tool calls in parallel when possible\n- After editing code, verify with: syntax check, run tests, or at minimum read the changed section\n\n# Workflow for Code Tasks\n\n1. Explore: Use ListDir, Glob, Grep to understand the codebase structure\n2. Read: Read relevant files to understand context, conventions, dependencies\n3. Plan: Think about what changes are needed (briefly)\n4. Implement: Make changes using Edit/Write\n5. Verify: Run tests or check the result with Bash\n6. Iterate: If verification fails, fix and re-verify\n7. Code review is automatic for any files modified\n\n# Environment\nWorking directory: ${PROJECT_ROOT}\nOS: ${process.platform}\nNode: ${process.version}${projectInfo}${gitInfo}\n\n# Important\n- You can call multiple tools at once — do so when the calls are independent\n- Don't ask for permission to use tools — just use them\n- Don't explain what you're going to do in detail — just do it and summarize what you did\n- If the user asks you to fix something, find the bug AND fix it\n- If the user pastes an error message or stack trace, DO NOT just explain possible causes or suggest troubleshooting steps. Instead, use your tools to locate the exact source of the error in the codebase (read files, grep for relevant code, trace the stack trace), identify the root cause, and fix it directly. Always act on errors — never punt back to the user with \"try checking X\" or \"this might be caused by Y.\"\n- If the user asks you to build something, build it completely and verify it works\n- Maximum tool iterations per turn: ${MAX_TOOL_ITERATIONS}`;",
1200
- "new_str": " return `You are Apex AI, an agentic CLI coding assistant that runs in the terminal. Be concise, precise, and action-oriented.\n\n# Output Style\n- Default to short answers (≤4 lines) unless the user asks for detail.\n- No unnecessary preamble or postamble. Don't narrate obvious steps or explain what you're about to do.\n- After working on files, just stop — don't summarize what you did unless asked.\n- Use bullets and monospace for commands, file paths, and code identifiers.\n- No emojis unless the user uses them first.\n- For casual conversation, greetings, or quick questions, respond naturally without tools or formatting.\n- NEVER say things like \"I don't have any tool to call\" — just respond with what you know.\n\n# Core Behavior\n1. **Finish the task.** When asked to do something, DO it with tools until complete. Don't just explain how.\n2. **Read before edit.** NEVER modify a file you haven't read. Understand existing code first.\n3. **Work incrementally.** Make small changes, verify they work, then continue.\n4. **Keep going.** If a tool call fails, recover and try another approach. Don't give up after one attempt.\n5. **Existing code: be surgical.** Only change what's needed. Don't refactor, add features, or \"improve\" beyond what was asked. Match existing style, patterns, and dependencies.\n6. **New/greenfield work:** You may propose structure and be creative, but keep scope minimal.\n7. **Act on errors.** If the user pastes an error or stack trace, use tools to locate the exact source, identify root cause, and fix it. Never punt back with \"try checking X.\"\n\n# Safety & Side Effects\n- Never expose secrets, API keys, tokens, or credentials. Don't display .env contents.\n- Never run destructive commands (\\`rm -rf\\`, \\`git reset --hard\\`, \\`git clean -fdx\\`) without asking.\n- Never \\`git commit\\` or \\`git push\\` unless the user explicitly asks.\n- Don't add new dependencies without confirming the user wants them.\n- NEVER assume a library is available. Check package.json or neighboring files first.\n\n# Code Hygiene\n- Do NOT add code comments or docstrings unless the user asks or correctness requires it.\n- Match existing code style, naming conventions, frameworks, and patterns.\n- When creating new files or components, look at existing ones first to follow conventions.\n- Follow security best practices. Never introduce code that exposes or logs secrets.\n\n# Validation\n- After code changes, run the most relevant checks: tests, lint, typecheck, or build. Prefer scripts from package.json.\n- If checks fail, fix and re-run. If blocked, clearly state what's failing and why.\n- Start with targeted tests for what you changed, then broaden if needed.\n\n# Tool Usage\n- Use Grep/Glob/ListDir to explore and locate code.\n- Use Read to understand files before modifying them.\n- Use Edit for surgical changes to existing files (preferred over Write).\n- Use Patch for multiple edits to the same file.\n- Use Write only for creating new files.\n- Use Bash for running commands (tests, builds, linters, git).\n- Bundle independent tool calls in the same turn for parallel execution.\n- Don't ask for permission to use tools — just use them.\n\n# Note\nA separate code reviewer runs automatically after edits. You don't need to perform a review unless asked.\n\n# Environment\nWorking directory: ${PROJECT_ROOT}\nOS: ${process.platform}\nNode: ${process.version}${projectInfo}${gitInfo}\nMaximum tool iterations per turn: ${MAX_TOOL_ITERATIONS}`;"
1201
- }
1202
- }
1203
- ],
1204
- "state": {
1205
- "type": "complete",
1206
- "stopReason": "tool_use"
1207
- },
1208
- "usage": {
1209
- "model": "claude-opus-4-6",
1210
- "maxInputTokens": 168000,
1211
- "inputTokens": 1,
1212
- "outputTokens": 1951,
1213
- "cacheCreationInputTokens": 3530,
1214
- "cacheReadInputTokens": 74924,
1215
- "totalInputTokens": 78455,
1216
- "timestamp": "2026-02-26T03:14:42.166Z"
1217
- }
1218
- },
1219
- {
1220
- "role": "user",
1221
- "messageId": 21,
1222
- "content": [
1223
- {
1224
- "type": "tool_result",
1225
- "toolUseID": "toolu_vrtx_01AWFRWFus4vQSckyPzfxCjr",
1226
- "run": {
1227
- "status": "done",
1228
- "progress": {},
1229
- "result": {
1230
- "diff": "```diff\nIndex: /home/runner/workspace/src/prompt.js\n===================================================================\n--- /home/runner/workspace/src/prompt.js\toriginal\n+++ /home/runner/workspace/src/prompt.js\tmodified\n@@ -22,62 +22,63 @@\n if (pkg.devDependencies) projectInfo += `\\nDev dependencies: ${Object.keys(pkg.devDependencies).join(', ')}`;\n if (pkg.scripts) projectInfo += `\\nScripts: ${Object.keys(pkg.scripts).join(', ')}`;\n } catch {}\n \n- return `detailed thinking on\n+ return `You are Apex AI, an agentic CLI coding assistant that runs in the terminal. Be concise, precise, and action-oriented.\n \n-You are Apex AI, a friendly and approachable coding assistant. You're warm, helpful, and conversational — like a knowledgeable friend who loves coding.\n+# Output Style\n+- Default to short answers (≤4 lines) unless the user asks for detail.\n+- No unnecessary preamble or postamble. Don't narrate obvious steps or explain what you're about to do.\n+- After working on files, just stop — don't summarize what you did unless asked.\n+- Use bullets and monospace for commands, file paths, and code identifiers.\n+- No emojis unless the user uses them first.\n+- For casual conversation, greetings, or quick questions, respond naturally without tools or formatting.\n+- NEVER say things like \"I don't have any tool to call\" — just respond with what you know.\n \n-# Personality\n+# Core Behavior\n+1. **Finish the task.** When asked to do something, DO it with tools until complete. Don't just explain how.\n+2. **Read before edit.** NEVER modify a file you haven't read. Understand existing code first.\n+3. **Work incrementally.** Make small changes, verify they work, then continue.\n+4. **Keep going.** If a tool call fails, recover and try another approach. Don't give up after one attempt.\n+5. **Existing code: be surgical.** Only change what's needed. Don't refactor, add features, or \"improve\" beyond what was asked. Match existing style, patterns, and dependencies.\n+6. **New/greenfield work:** You may propose structure and be creative, but keep scope minimal.\n+7. **Act on errors.** If the user pastes an error or stack trace, use tools to locate the exact source, identify root cause, and fix it. Never punt back with \"try checking X.\"\n \n-- Be friendly, warm, and encouraging. Use a casual but professional tone.\n-- When a user asks a question that doesn't need any tools (like general knowledge, advice, greetings, or casual chat), just answer directly and naturally. You do NOT always need to use tools — only use them when the task actually requires reading, writing, or executing something on the filesystem.\n-- NEVER say things like \"I don't have any tool to call\" or \"I don't have the tools for that.\" Just respond helpfully with what you know.\n-- If you're unsure, say so honestly, but still try your best to help.\n+# Safety & Side Effects\n+- Never expose secrets, API keys, tokens, or credentials. Don't display .env contents.\n+- Never run destructive commands (\\`rm -rf\\`, \\`git reset --hard\\`, \\`git clean -fdx\\`) without asking.\n+- Never \\`git commit\\` or \\`git push\\` unless the user explicitly asks.\n+- Don't add new dependencies without confirming the user wants them.\n+- NEVER assume a library is available. Check package.json or neighboring files first.\n \n-# Core Principles\n+# Code Hygiene\n+- Do NOT add code comments or docstrings unless the user asks or correctness requires it.\n+- Match existing code style, naming conventions, frameworks, and patterns.\n+- When creating new files or components, look at existing ones first to follow conventions.\n+- Follow security best practices. Never introduce code that exposes or logs secrets.\n \n-1. **Take initiative.** When asked to do something, DO it — don't just explain how. Use your tools to read, write, edit, and execute code until the task is COMPLETE.\n-2. **Read before you edit.** NEVER modify a file you haven't read first. Always understand existing code before making changes.\n-3. **Work incrementally.** Make small changes, verify they work (run tests, check syntax), then continue. Don't make huge changes blind.\n-4. **Verify your work.** After making changes, run the relevant tests, linter, or type checker. If something fails, fix it before responding.\n-5. **Follow conventions.** Match the existing code style, frameworks, libraries, and patterns. Check imports and neighboring files first.\n-6. **Minimal changes.** Only change what's needed. Don't refactor, add features, or \"improve\" code beyond what was asked.\n-7. **Keep going.** If a tool call fails, try to recover. If you need more context, read more files. Don't give up after one attempt.\n+# Validation\n+- After code changes, run the most relevant checks: tests, lint, typecheck, or build. Prefer scripts from package.json.\n+- If checks fail, fix and re-run. If blocked, clearly state what's failing and why.\n+- Start with targeted tests for what you changed, then broaden if needed.\n \n # Tool Usage\n+- Use Grep/Glob/ListDir to explore and locate code.\n+- Use Read to understand files before modifying them.\n+- Use Edit for surgical changes to existing files (preferred over Write).\n+- Use Patch for multiple edits to the same file.\n+- Use Write only for creating new files.\n+- Use Bash for running commands (tests, builds, linters, git).\n+- Bundle independent tool calls in the same turn for parallel execution.\n+- Don't ask for permission to use tools — just use them.\n \n-- Use Bash for running commands (tests, builds, linters, git operations)\n-- Use Read to understand files before modifying them\n-- Use Grep/Glob/ListDir to explore the codebase and find relevant code\n-- Use Edit for surgical changes to existing files (preferred over Write for existing files)\n-- Use Write only for creating new files\n-- Use Patch for making multiple edits to the same file at once\n-- Execute multiple independent tool calls in parallel when possible\n-- After editing code, verify with: syntax check, run tests, or at minimum read the changed section\n+# Note\n+A separate code reviewer runs automatically after edits. You don't need to perform a review unless asked.\n \n-# Workflow for Code Tasks\n-\n-1. Explore: Use ListDir, Glob, Grep to understand the codebase structure\n-2. Read: Read relevant files to understand context, conventions, dependencies\n-3. Plan: Think about what changes are needed (briefly)\n-4. Implement: Make changes using Edit/Write\n-5. Verify: Run tests or check the result with Bash\n-6. Iterate: If verification fails, fix and re-verify\n-7. Code review is automatic for any files modified\n-\n # Environment\n Working directory: ${PROJECT_ROOT}\n OS: ${process.platform}\n Node: ${process.version}${projectInfo}${gitInfo}\n-\n-# Important\n-- You can call multiple tools at once — do so when the calls are independent\n-- Don't ask for permission to use tools — just use them\n-- Don't explain what you're going to do in detail — just do it and summarize what you did\n-- If the user asks you to fix something, find the bug AND fix it\n-- If the user pastes an error message or stack trace, DO NOT just explain possible causes or suggest troubleshooting steps. Instead, use your tools to locate the exact source of the error in the codebase (read files, grep for relevant code, trace the stack trace), identify the root cause, and fix it directly. Always act on errors — never punt back to the user with \"try checking X\" or \"this might be caused by Y.\"\n-- If the user asks you to build something, build it completely and verify it works\n-- Maximum tool iterations per turn: ${MAX_TOOL_ITERATIONS}`;\n+Maximum tool iterations per turn: ${MAX_TOOL_ITERATIONS}`;\n }\n \n module.exports = { buildSystemPrompt };\n```",
1231
- "lineRange": [
1232
- 26,
1233
- 81
1234
- ]
1235
- },
1236
- "trackFiles": [
1237
- "file:///home/runner/workspace/src/prompt.js"
1238
- ]
1239
- }
1240
- }
1241
- ]
1242
- },
1243
- {
1244
- "role": "assistant",
1245
- "messageId": 22,
1246
- "content": [
1247
- {
1248
- "type": "text",
1249
- "text": "Let me verify the file looks correct:"
1250
- },
1251
- {
1252
- "type": "tool_use",
1253
- "complete": true,
1254
- "id": "toolu_vrtx_014R5z4su9ve6xuZwJKDxRDA",
1255
- "name": "Read",
1256
- "input": {
1257
- "path": "/home/runner/workspace/src/prompt.js"
1258
- }
1259
- }
1260
- ],
1261
- "state": {
1262
- "type": "complete",
1263
- "stopReason": "tool_use"
1264
- },
1265
- "usage": {
1266
- "model": "claude-opus-4-6",
1267
- "maxInputTokens": 168000,
1268
- "inputTokens": 1,
1269
- "outputTokens": 71,
1270
- "cacheCreationInputTokens": 3973,
1271
- "cacheReadInputTokens": 78454,
1272
- "totalInputTokens": 82428,
1273
- "timestamp": "2026-02-26T03:14:45.530Z"
1274
- }
1275
- },
1276
- {
1277
- "role": "user",
1278
- "messageId": 23,
1279
- "content": [
1280
- {
1281
- "type": "tool_result",
1282
- "toolUseID": "toolu_vrtx_014R5z4su9ve6xuZwJKDxRDA",
1283
- "run": {
1284
- "status": "done",
1285
- "progress": {},
1286
- "result": {
1287
- "absolutePath": "/home/runner/workspace/src/prompt.js",
1288
- "content": "1: 'use strict';\n2: \n3: const fs = require('fs');\n4: const path = require('path');\n5: const { execSync } = require('child_process');\n6: const { PROJECT_ROOT, MAX_TOOL_ITERATIONS } = require('./config');\n7: \n8: function buildSystemPrompt() {\n9: let gitInfo = '';\n10: try {\n11: const branch = execSync('git rev-parse --abbrev-ref HEAD 2>/dev/null', { encoding: 'utf-8', cwd: PROJECT_ROOT }).trim();\n12: const status = execSync('git status --short 2>/dev/null', { encoding: 'utf-8', cwd: PROJECT_ROOT }).trim();\n13: const remoteUrl = execSync('git config --get remote.origin.url 2>/dev/null', { encoding: 'utf-8', cwd: PROJECT_ROOT }).trim();\n14: gitInfo = `\\nGit branch: ${branch}\\nGit remote: ${remoteUrl}\\nGit status:\\n${status || '(clean)'}`;\n15: } catch {}\n16: \n17: let projectInfo = '';\n18: try {\n19: const pkg = JSON.parse(fs.readFileSync(path.join(PROJECT_ROOT, 'package.json'), 'utf-8'));\n20: projectInfo = `\\nProject: ${pkg.name || 'unknown'} v${pkg.version || '0.0.0'}`;\n21: if (pkg.dependencies) projectInfo += `\\nDependencies: ${Object.keys(pkg.dependencies).join(', ')}`;\n22: if (pkg.devDependencies) projectInfo += `\\nDev dependencies: ${Object.keys(pkg.devDependencies).join(', ')}`;\n23: if (pkg.scripts) projectInfo += `\\nScripts: ${Object.keys(pkg.scripts).join(', ')}`;\n24: } catch {}\n25: \n26: return `You are Apex AI, an agentic CLI coding assistant that runs in the terminal. Be concise, precise, and action-oriented.\n27: \n28: # Output Style\n29: - Default to short answers (≤4 lines) unless the user asks for detail.\n30: - No unnecessary preamble or postamble. Don't narrate obvious steps or explain what you're about to do.\n31: - After working on files, just stop — don't summarize what you did unless asked.\n32: - Use bullets and monospace for commands, file paths, and code identifiers.\n33: - No emojis unless the user uses them first.\n34: - For casual conversation, greetings, or quick questions, respond naturally without tools or formatting.\n35: - NEVER say things like \"I don't have any tool to call\" — just respond with what you know.\n36: \n37: # Core Behavior\n38: 1. **Finish the task.** When asked to do something, DO it with tools until complete. Don't just explain how.\n39: 2. **Read before edit.** NEVER modify a file you haven't read. Understand existing code first.\n40: 3. **Work incrementally.** Make small changes, verify they work, then continue.\n41: 4. **Keep going.** If a tool call fails, recover and try another approach. Don't give up after one attempt.\n42: 5. **Existing code: be surgical.** Only change what's needed. Don't refactor, add features, or \"improve\" beyond what was asked. Match existing style, patterns, and dependencies.\n43: 6. **New/greenfield work:** You may propose structure and be creative, but keep scope minimal.\n44: 7. **Act on errors.** If the user pastes an error or stack trace, use tools to locate the exact source, identify root cause, and fix it. Never punt back with \"try checking X.\"\n45: \n46: # Safety & Side Effects\n47: - Never expose secrets, API keys, tokens, or credentials. Don't display .env contents.\n48: - Never run destructive commands (\\`rm -rf\\`, \\`git reset --hard\\`, \\`git clean -fdx\\`) without asking.\n49: - Never \\`git commit\\` or \\`git push\\` unless the user explicitly asks.\n50: - Don't add new dependencies without confirming the user wants them.\n51: - NEVER assume a library is available. Check package.json or neighboring files first.\n52: \n53: # Code Hygiene\n54: - Do NOT add code comments or docstrings unless the user asks or correctness requires it.\n55: - Match existing code style, naming conventions, frameworks, and patterns.\n56: - When creating new files or components, look at existing ones first to follow conventions.\n57: - Follow security best practices. Never introduce code that exposes or logs secrets.\n58: \n59: # Validation\n60: - After code changes, run the most relevant checks: tests, lint, typecheck, or build. Prefer scripts from package.json.\n61: - If checks fail, fix and re-run. If blocked, clearly state what's failing and why.\n62: - Start with targeted tests for what you changed, then broaden if needed.\n63: \n64: # Tool Usage\n65: - Use Grep/Glob/ListDir to explore and locate code.\n66: - Use Read to understand files before modifying them.\n67: - Use Edit for surgical changes to existing files (preferred over Write).\n68: - Use Patch for multiple edits to the same file.\n69: - Use Write only for creating new files.\n70: - Use Bash for running commands (tests, builds, linters, git).\n71: - Bundle independent tool calls in the same turn for parallel execution.\n72: - Don't ask for permission to use tools — just use them.\n73: \n74: # Note\n75: A separate code reviewer runs automatically after edits. You don't need to perform a review unless asked.\n76: \n77: # Environment\n78: Working directory: ${PROJECT_ROOT}\n79: OS: ${process.platform}\n80: Node: ${process.version}${projectInfo}${gitInfo}\n81: Maximum tool iterations per turn: ${MAX_TOOL_ITERATIONS}`;\n82: }\n83: \n84: module.exports = { buildSystemPrompt };"
1289
- },
1290
- "trackFiles": [
1291
- "file:///home/runner/workspace/src/prompt.js"
1292
- ]
1293
- }
1294
- }
1295
- ]
1296
- },
1297
- {
1298
- "role": "assistant",
1299
- "messageId": 24,
1300
- "content": [
1301
- {
1302
- "type": "text",
1303
- "text": "The system prompt has been updated. Here's a summary of what changed, drawing from both **Codex CLI** and **Claude Code** best practices:\n\n| Area | Before | After |\n|---|---|---|\n| **Personality** | \"warm, friendly, encouraging\" | Concise, precise, action-oriented |\n| **Conciseness** | No output length guidance | ≤4 lines default, no preamble/postamble |\n| **Comments** | Not mentioned | Explicitly forbidden unless asked |\n| **Git commits** | Not mentioned | Never commit/push unless asked |\n| **Security** | Not mentioned | Never expose secrets, no destructive commands without confirmation |\n| **Dependencies** | Not mentioned | Check package.json first, don't add without asking |\n| **Ambition vs precision** | One-size-fits-all | Surgical for existing code, creative for greenfield |\n| **Validation** | \"verify your work\" (vague) | Run tests/lint/typecheck, fix failures, iterate |\n| **Code review note** | \"Code review is automatic\" (misleading) | Clarifies a separate reviewer runs automatically |\n| **\"detailed thinking on\"** | Included as first line | Removed (UI handles `<think>` blocks already) |\n| **Error handling** | Buried in \"Important\" section | Promoted to core behavior rule #7 |"
1304
- }
1305
- ],
1306
- "state": {
1307
- "type": "complete",
1308
- "stopReason": "end_turn"
1309
- },
1310
- "usage": {
1311
- "model": "claude-opus-4-6",
1312
- "maxInputTokens": 168000,
1313
- "inputTokens": 1,
1314
- "outputTokens": 319,
1315
- "cacheCreationInputTokens": 1619,
1316
- "cacheReadInputTokens": 82427,
1317
- "totalInputTokens": 84047,
1318
- "timestamp": "2026-02-26T03:14:54.909Z"
1319
- },
1320
- "turnElapsedMs": 229998
1321
- }
1322
- ],
1323
- "agentMode": "smart",
1324
- "nextMessageId": 25,
1325
- "meta": {
1326
- "traces": [
1327
- {
1328
- "name": "agent",
1329
- "id": "zIhMT",
1330
- "startTime": "2026-02-26T03:07:29.761Z",
1331
- "context": {
1332
- "messageId": 0
1333
- },
1334
- "endTime": "2026-02-26T03:07:31.915Z"
1335
- },
1336
- {
1337
- "name": "inference",
1338
- "id": "5QyAH",
1339
- "parent": "zIhMT",
1340
- "startTime": "2026-02-26T03:07:29.762Z",
1341
- "context": {
1342
- "messageId": 0
1343
- },
1344
- "endTime": "2026-02-26T03:07:31.915Z"
1345
- },
1346
- {
1347
- "name": "agent",
1348
- "id": "SACTG",
1349
- "startTime": "2026-02-26T03:08:34.955Z",
1350
- "context": {
1351
- "messageId": 2
1352
- }
1353
- },
1354
- {
1355
- "name": "inference",
1356
- "id": "Galkd",
1357
- "parent": "SACTG",
1358
- "startTime": "2026-02-26T03:08:34.956Z",
1359
- "context": {
1360
- "messageId": 2
1361
- },
1362
- "endTime": "2026-02-26T03:08:44.261Z"
1363
- },
1364
- {
1365
- "name": "tools",
1366
- "id": "LmDff",
1367
- "parent": "SACTG",
1368
- "startTime": "2026-02-26T03:08:44.260Z",
1369
- "context": {
1370
- "messageId": 3
1371
- }
1372
- },
1373
- {
1374
- "name": "agent",
1375
- "id": "3HIVL",
1376
- "startTime": "2026-02-26T03:11:04.911Z",
1377
- "context": {
1378
- "messageId": 5
1379
- },
1380
- "endTime": "2026-02-26T03:14:54.910Z"
1381
- },
1382
- {
1383
- "name": "inference",
1384
- "id": "JFSsu",
1385
- "parent": "3HIVL",
1386
- "startTime": "2026-02-26T03:11:04.913Z",
1387
- "context": {
1388
- "messageId": 5
1389
- },
1390
- "endTime": "2026-02-26T03:11:11.980Z"
1391
- },
1392
- {
1393
- "name": "tools",
1394
- "id": "I8rtl",
1395
- "parent": "3HIVL",
1396
- "startTime": "2026-02-26T03:11:11.980Z",
1397
- "context": {
1398
- "messageId": 6
1399
- },
1400
- "endTime": "2026-02-26T03:11:16.351Z"
1401
- },
1402
- {
1403
- "name": "inference",
1404
- "id": "neyfZ",
1405
- "parent": "3HIVL",
1406
- "startTime": "2026-02-26T03:11:16.352Z",
1407
- "context": {
1408
- "messageId": 5
1409
- },
1410
- "endTime": "2026-02-26T03:11:23.491Z"
1411
- },
1412
- {
1413
- "name": "tools",
1414
- "id": "Gpl7M",
1415
- "parent": "3HIVL",
1416
- "startTime": "2026-02-26T03:11:23.491Z",
1417
- "context": {
1418
- "messageId": 8
1419
- },
1420
- "endTime": "2026-02-26T03:11:29.025Z"
1421
- },
1422
- {
1423
- "name": "inference",
1424
- "id": "6z0hz",
1425
- "parent": "3HIVL",
1426
- "startTime": "2026-02-26T03:11:29.027Z",
1427
- "context": {
1428
- "messageId": 5
1429
- },
1430
- "endTime": "2026-02-26T03:11:34.744Z"
1431
- },
1432
- {
1433
- "name": "tools",
1434
- "id": "6mJ55",
1435
- "parent": "3HIVL",
1436
- "startTime": "2026-02-26T03:11:34.743Z",
1437
- "context": {
1438
- "messageId": 10
1439
- },
1440
- "endTime": "2026-02-26T03:11:37.350Z"
1441
- },
1442
- {
1443
- "name": "inference",
1444
- "id": "JkOEn",
1445
- "parent": "3HIVL",
1446
- "startTime": "2026-02-26T03:11:37.353Z",
1447
- "context": {
1448
- "messageId": 5
1449
- },
1450
- "endTime": "2026-02-26T03:11:43.444Z"
1451
- },
1452
- {
1453
- "name": "tools",
1454
- "id": "gU83n",
1455
- "parent": "3HIVL",
1456
- "startTime": "2026-02-26T03:11:43.443Z",
1457
- "context": {
1458
- "messageId": 12
1459
- },
1460
- "endTime": "2026-02-26T03:11:48.261Z"
1461
- },
1462
- {
1463
- "name": "inference",
1464
- "id": "D7zcx",
1465
- "parent": "3HIVL",
1466
- "startTime": "2026-02-26T03:11:48.293Z",
1467
- "context": {
1468
- "messageId": 5
1469
- },
1470
- "endTime": "2026-02-26T03:11:56.512Z"
1471
- },
1472
- {
1473
- "name": "tools",
1474
- "id": "48JyW",
1475
- "parent": "3HIVL",
1476
- "startTime": "2026-02-26T03:11:56.511Z",
1477
- "context": {
1478
- "messageId": 14
1479
- },
1480
- "endTime": "2026-02-26T03:12:23.054Z"
1481
- },
1482
- {
1483
- "name": "inference",
1484
- "id": "8pwPu",
1485
- "parent": "3HIVL",
1486
- "startTime": "2026-02-26T03:12:23.058Z",
1487
- "context": {
1488
- "messageId": 5
1489
- },
1490
- "endTime": "2026-02-26T03:12:29.237Z"
1491
- },
1492
- {
1493
- "name": "tools",
1494
- "id": "q6J7j",
1495
- "parent": "3HIVL",
1496
- "startTime": "2026-02-26T03:12:29.237Z",
1497
- "context": {
1498
- "messageId": 16
1499
- },
1500
- "endTime": "2026-02-26T03:12:33.980Z"
1501
- },
1502
- {
1503
- "name": "inference",
1504
- "id": "SoOcA",
1505
- "parent": "3HIVL",
1506
- "startTime": "2026-02-26T03:12:33.985Z",
1507
- "context": {
1508
- "messageId": 5
1509
- },
1510
- "endTime": "2026-02-26T03:13:08.279Z"
1511
- },
1512
- {
1513
- "name": "tools",
1514
- "id": "3BkIM",
1515
- "parent": "3HIVL",
1516
- "startTime": "2026-02-26T03:13:08.279Z",
1517
- "context": {
1518
- "messageId": 18
1519
- },
1520
- "endTime": "2026-02-26T03:13:59.072Z"
1521
- },
1522
- {
1523
- "name": "inference",
1524
- "id": "nQ2Kq",
1525
- "parent": "3HIVL",
1526
- "startTime": "2026-02-26T03:13:59.080Z",
1527
- "context": {
1528
- "messageId": 5
1529
- },
1530
- "endTime": "2026-02-26T03:14:42.167Z"
1531
- },
1532
- {
1533
- "name": "tools",
1534
- "id": "luj3m",
1535
- "parent": "3HIVL",
1536
- "startTime": "2026-02-26T03:14:42.167Z",
1537
- "context": {
1538
- "messageId": 20
1539
- },
1540
- "endTime": "2026-02-26T03:14:42.220Z"
1541
- },
1542
- {
1543
- "name": "inference",
1544
- "id": "HP9yu",
1545
- "parent": "3HIVL",
1546
- "startTime": "2026-02-26T03:14:42.225Z",
1547
- "context": {
1548
- "messageId": 5
1549
- },
1550
- "endTime": "2026-02-26T03:14:45.531Z"
1551
- },
1552
- {
1553
- "name": "tools",
1554
- "id": "Bpj7m",
1555
- "parent": "3HIVL",
1556
- "startTime": "2026-02-26T03:14:45.531Z",
1557
- "context": {
1558
- "messageId": 22
1559
- },
1560
- "endTime": "2026-02-26T03:14:45.546Z"
1561
- },
1562
- {
1563
- "name": "inference",
1564
- "id": "YjRzb",
1565
- "parent": "3HIVL",
1566
- "startTime": "2026-02-26T03:14:45.548Z",
1567
- "context": {
1568
- "messageId": 5
1569
- },
1570
- "endTime": "2026-02-26T03:14:54.911Z"
1571
- }
1572
- ]
1573
- },
1574
- "env": {
1575
- "initial": {
1576
- "trees": [
1577
- {
1578
- "displayName": "workspace",
1579
- "uri": "file:///home/runner/workspace"
1580
- }
1581
- ],
1582
- "platform": {
1583
- "os": "linux",
1584
- "osVersion": "Ubuntu 24.04.2 LTS",
1585
- "cpuArchitecture": "x64",
1586
- "webBrowser": false,
1587
- "client": "CLI",
1588
- "clientVersion": "0.0.1772067340-g53cd9b",
1589
- "clientType": "cli",
1590
- "installationID": "990855e2-5987-4061-ad34-8c29deacfa95",
1591
- "deviceFingerprint": "v1:fp_5e0b4aaea6d8b2adcf3c155505cf5c39765fb8ea3e8157ac186424d91df98615"
1592
- },
1593
- "tags": [
1594
- "model:claude-opus-4-6"
1595
- ]
1596
- }
1597
- },
1598
- "title": "Greeting",
1599
- "~debug": {
1600
- "lastInferenceUsage": {
1601
- "model": "claude-opus-4-6",
1602
- "maxInputTokens": 168000,
1603
- "inputTokens": 3,
1604
- "outputTokens": 1951,
1605
- "cacheCreationInputTokens": 21437,
1606
- "cacheReadInputTokens": 82427,
1607
- "totalInputTokens": 84047,
1608
- "timestamp": "2026-02-26T03:14:54.909Z"
1609
- }
1610
- }
1611
- }