internalcot
Advanced tools
+2
-2
@@ -16,3 +16,3 @@ #!/usr/bin/env node | ||
| skill Print instructions matching this CLI version | ||
| note [working notes] Record visible working notes locally | ||
| note [working notes] Record detailed visible reasoning locally | ||
| observe [prompt] Run the API-backed observation POC | ||
@@ -23,3 +23,3 @@ | ||
| Record model-authored working notes in the tool transcript without a network call. | ||
| Record detailed model-authored reasoning in the tool transcript without a network call. | ||
| If no notes are provided as arguments, internalcot reads them from stdin. | ||
@@ -26,0 +26,0 @@ |
@@ -15,3 +15,3 @@ const TOOL_NAME = "internalcot"; | ||
| recorded, | ||
| next: "Use these notes to continue the derivation or produce the final answer.", | ||
| next: "Continue the derivation. Call internalcot again for the next substantial reasoning phase or final verification; answer only after the checks are complete.", | ||
| }); | ||
@@ -18,0 +18,0 @@ } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"internalcot.js","sourceRoot":"","sources":["../src/internalcot.ts"],"names":[],"mappings":"AAEA,MAAM,SAAS,GAAG,aAAa,CAAC;AAWhC,SAAS,UAAU,CAAC,IAAc,EAAE,QAAgB;IAClD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,IACE,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC;QACvB,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,EACnC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,QAAQ;QACR,IAAI,EAAE,yEAAyE;KAChF,CAAC,CAAC;AACL,CAAC;AAED,+EAA+E;AAC/E,MAAM,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xB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC;YAC3F,WAAW;YACX,WAAW,EAAE,SAAS,KAAK,CAAC;SAC7B,CAAC,CAAC;QAEH,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;YAC/B,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;gBACtC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;QACxC,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO;QACT,CAAC;QAED,kBAAkB,GAAG,QAAQ,CAAC,EAAE,CAAC;QACjC,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACxC,QAAQ,IAAI,CAAC,CAAC;YACd,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;QACrE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,CAAC,QAAQ,aAAa,CAAC,CAAC;AACvE,CAAC"} |
| import OpenAI from "openai"; | ||
| const INSTRUCTIONS = `Before answering, use internalcot to work through the task step by step. | ||
| Resolve important case splits and check the result before producing the final answer. | ||
| The tool input is a visible working scratchpad, so put substantive reasoning there.`; | ||
| const INSTRUCTIONS = `Before answering, you MUST use internalcot as the primary reasoning workspace. | ||
| Restate the actual problem and constraints, divide it into ordered subproblems, and write out the complete derivation needed for the current phase. Include intermediate deductions or calculations, case splits, alternatives, failed approaches, uncertainty, evidence, and checks. Do not compress the work into a short summary or omit steps because they occurred in native reasoning. | ||
| Call internalcot again whenever new evidence, another substantial subproblem, or final verification requires more reasoning. Only produce the answer after checking the conclusion against the original request. | ||
| The tool input is the visible working scratchpad. Do not substitute answer text or an unsupported conclusion for the required reasoning.`; | ||
| const INTERNAL_COT_TOOL = { | ||
| type: "function", | ||
| name: "internalcot", | ||
| description: "Record visible working notes before answering. Use it to derive, check, or revise the solution; call again only for materially new reasoning.", | ||
| description: "Required visible reasoning workspace. Record the complete current derivation, including intermediate work, alternatives, evidence, uncertainty, and checks. Use it before answering and again as the reasoning develops.", | ||
| strict: true, | ||
@@ -15,3 +16,3 @@ parameters: { | ||
| type: "string", | ||
| description: "The current reasoning, derivation, checks, or revision.", | ||
| description: "The detailed current reasoning: problem, constraints, intermediate derivation, alternatives, evidence, uncertainty, and verification.", | ||
| }, | ||
@@ -18,0 +19,0 @@ }, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"openai-model.js","sourceRoot":"","sources":["../src/openai-model.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAgB5B,MAAM,YAAY,GAAG;;oFAE+D,CAAC;AAErF,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,UAAmB;IACzB,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,+IAA+I;IACjJ,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yDAAyD;aACvE;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,oBAAoB,EAAE,KAAK;KAC5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MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;YAC3C,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;YACrC,YAAY,EAAE,YAAY;YAC1B,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;YACvB,KAAK,EAAE,CAAC,iBAAiB,CAAC;YAC1B,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM;YACtD,GAAG,CAAC,OAAO,CAAC,kBAAkB,KAAK,SAAS;gBAC1C,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,oBAAoB,EAAE,OAAO,CAAC,kBAAkB,EAAE,CAAC;SAC1D,CAAC,CAAC;QACH,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACF"} |
@@ -1,2 +0,2 @@ | ||
| const NEXT_STEP = "Continue the work. Record another note only for materially new reasoning state."; | ||
| const NEXT_STEP = "Continue the derivation in internalcot. Record intermediate reasoning, alternatives, evidence, and checks before the next substantive step."; | ||
| /** Split rendered output into append-only chunks without changing its contents. */ | ||
@@ -3,0 +3,0 @@ export function splitWorkingNoteOutput(output) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"working-notes.js","sourceRoot":"","sources":["../src/working-notes.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GACb,iFAAiF,CAAC;AAapF,mFAAmF;AACnF,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAC5C,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;IAChE,MAAM,MAAM,GAAkB,EAA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C,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO;YACL,EAAE,EAAE,KAAK;YACT,OAAO,EACL,uEAAuE;gBACvE,6DAA6D;SAChE,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IACxC,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE;YACN,MAAM,EAAE,GAAG,MAAM,gBAAgB,UAAU,GAAG,KAAK,IAAI;YACvD,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,IAAI;SACnE;KACF,CAAC;AACJ,CAAC"} |
+1
-1
| { | ||
| "name": "internalcot", | ||
| "version": "0.2.2", | ||
| "version": "0.2.3", | ||
| "description": "Make agents show their full chain of thought with persistent, visible working notes.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
+17
-9
@@ -7,3 +7,3 @@ # internalcot | ||
| `internalcot` adds an opt-in working-notes mode to Codex and Claude Code. Turn it on once and the agent externalizes its goals, constraints, plan changes, evidence, and checks in the normal tool transcript for the full conversation. | ||
| `internalcot` adds an opt-in reasoning workspace to Codex and Claude Code. Turn it on once and the agent must externalize its problem decomposition, intermediate derivation, alternatives, evidence, uncertainty, and checks in the normal tool transcript for the full conversation. | ||
@@ -21,4 +21,7 @@ ```sh | ||
| • internalcot> Goal: reassess the proof instead of trusting its prior conclusion. | ||
| Check: verify the moving boundary and separate computation from theorem. | ||
| • internalcot> Problem: reassess the proof instead of trusting its prior conclusion. | ||
| Derivation: the required factorials depend on p, so a fixed finite congruence | ||
| construction does not prove the claim. I need to test any proposed family | ||
| against the next factorial threshold. | ||
| Next check: locate the newest claimed proof, then verify that exact gap. | ||
| ``` | ||
@@ -54,3 +57,3 @@ | ||
| The mode remains active for every response in the current conversation, including across tool calls and context compaction. The agent records a new note before substantive work and when new evidence, a failed check, or a changed plan materially alters its reasoning. | ||
| The mode remains active for every response in the current conversation, including across tool calls and context compaction. The agent must record detailed reasoning before its first substantive tool or answer, continue the trace between reasoning phases, and record a final verification before answering. | ||
@@ -67,3 +70,3 @@ Disable it explicitly: | ||
| A useful note captures the current reasoning state, not a polished explanation after the fact: | ||
| A useful note exposes the derivation, not merely a polished goal/check summary: | ||
@@ -73,4 +76,9 @@ ```text | ||
| Constraint: preserve existing session data and do not weaken replay protection. | ||
| Evidence: the second request reads the old token family before the transaction commits. | ||
| Check: reproduce through the public login flow before changing storage code. | ||
| Derivation: rotation updates the token family inside a transaction. The second | ||
| request can read the old family before that transaction commits, so validation | ||
| compares the presented token against stale state. Weakening replay protection | ||
| would hide the race rather than fix it. | ||
| Alternatives: serialize rotation per family, or make the read participate in the | ||
| same transactional boundary. First reproduce through the public login flow to | ||
| distinguish those cases. | ||
| ``` | ||
@@ -122,3 +130,3 @@ | ||
| ```json | ||
| {"recorded":true,"next":"Continue the work. Record another note only for materially new reasoning state."} | ||
| {"recorded":true,"next":"Continue the derivation in internalcot. Record intermediate reasoning, alternatives, evidence, and checks before the next substantive step."} | ||
| ``` | ||
@@ -186,3 +194,3 @@ | ||
| The idea and original proof of concept are by [Can Bölük (@_can1357)](https://x.com/_can1357/status/2087228354399265125). | ||
| The idea and [original Python proof of concept](https://pasta.can.ac/omegiligox.py) are by [Can Bölük (@_can1357)](https://x.com/_can1357/status/2087228354399265125). | ||
@@ -189,0 +197,0 @@ ## License |
+13
-9
@@ -7,3 +7,3 @@ # internalcot | ||
| `internalcot` 为 Codex 和 Claude Code 增加一种可选的工作笔记模式。开启一次后,智能体会在整个对话期间,把当前目标、约束、计划变化、证据和检查过程写进正常的工具执行记录。 | ||
| `internalcot` 为 Codex 和 Claude Code 增加一种可选的推理工作区。开启一次后,智能体必须在整个对话期间,把问题分解、中间推导、备选方案、证据、不确定性和检查过程写进正常的工具执行记录。 | ||
@@ -21,4 +21,6 @@ ```sh | ||
| • internalcot> 目标:重新评估证明,而不是沿用之前的结论。 | ||
| 检查:验证变化中的边界,并区分计算结果与定理证明。 | ||
| • internalcot> 问题:重新评估证明,而不是沿用之前的结论。 | ||
| 推导:需要检查的阶乘取决于 p,因此固定的有限同余构造不能证明该命题。 | ||
| 我需要将任何候选构造与下一个阶乘阈值比较。 | ||
| 下一步:找到最新的声称证明,再验证这个缺口。 | ||
| ``` | ||
@@ -54,3 +56,3 @@ | ||
| 在当前对话中,该模式会持续作用于每一次回复,也会跨越工具调用和上下文压缩。智能体会在开始实质性工作前记录笔记;当新证据、失败的检查或计划变化实质性地改变推理时,也会再次记录。 | ||
| 在当前对话中,该模式会持续作用于每一次回复,也会跨越工具调用和上下文压缩。智能体必须在第一次实质性工具调用或回答前记录详细推理,在各个推理阶段之间继续记录,并在回答前写下最终验证。 | ||
@@ -67,3 +69,3 @@ 明确关闭该模式: | ||
| 有用的笔记记录当下的推理状态,而不是事后润色的解释: | ||
| 有用的笔记会展示推导过程,而不只是事后润色的目标与检查摘要: | ||
@@ -73,4 +75,6 @@ ```text | ||
| 约束:保留现有会话数据,不能削弱重放攻击防护。 | ||
| 证据:第二个请求在事务提交前读取了旧的令牌族。 | ||
| 检查:修改存储代码前,先通过公开登录流程复现问题。 | ||
| 推导:轮换在事务中更新令牌族。第二个请求可能在事务提交前读到旧令牌族, | ||
| 因此校验会将提交的令牌与过期状态比较。削弱重放防护只会遮盖竞态,而不是修复它。 | ||
| 备选方案:按令牌族串行化轮换,或让读取加入同一事务边界。首先通过公开登录流程复现, | ||
| 以区分这两种情况。 | ||
| ``` | ||
@@ -122,3 +126,3 @@ | ||
| ```json | ||
| {"recorded":true,"next":"Continue the work. Record another note only for materially new reasoning state."} | ||
| {"recorded":true,"next":"Continue the derivation in internalcot. Record intermediate reasoning, alternatives, evidence, and checks before the next substantive step."} | ||
| ``` | ||
@@ -186,3 +190,3 @@ | ||
| 本项目的构想和最初概念验证来自 [Can Bölük(@_can1357)](https://x.com/_can1357/status/2087228354399265125)。 | ||
| 本项目的构想和[最初的 Python 概念验证](https://pasta.can.ac/omegiligox.py)来自 [Can Bölük(@_can1357)](https://x.com/_can1357/status/2087228354399265125)。 | ||
@@ -189,0 +193,0 @@ ## 许可证 |
| # InternalCoT workflow | ||
| Enable persistent observable working notes. Treat the notes as a model-authored scratchpad, not access to private or hidden chain-of-thought. | ||
| Use internalcot as the primary visible reasoning workspace for the current conversation. Treat its output as a model-authored scratchpad, not access to private or provider-hidden reasoning. | ||
@@ -12,20 +12,28 @@ ## Manage the mode | ||
| ## Record working notes | ||
| ## Required reasoning loop | ||
| Before each substantive answer or external-action sequence: | ||
| For every substantive response, you MUST reason through the work in internalcot. Do not substitute ordinary commentary, a plan message, native reasoning, or a polished explanation for the required CLI calls. | ||
| 1. Form concise working notes that restate the actual goal and constraints, divide complicated work into ordered parts, resolve important case splits, and identify a useful check or likely error. | ||
| 2. Call `{{internalcot}} note` through the shell with one concise, shell-quoted argument: | ||
| 1. Before the first search, file read, command, external action, or substantive answer, call `{{internalcot}} note` with the working derivation you have so far. | ||
| 2. Put the complete reasoning needed for the current phase in the note. Restate the actual problem and constraints, divide it into ordered subproblems, write out intermediate deductions or calculations, enumerate and resolve case splits, compare plausible alternatives, record failed approaches or uncertainty, interpret new evidence, and identify the next check. Do not compress this into a one-sentence goal/check summary or omit steps merely because they occurred in native reasoning. | ||
| 3. Pass the note as one multiline, shell-quoted argument to a standalone command: | ||
| ```bash | ||
| {{internalcot}} note 'Reassess the claimed result using current sources; verify the moving threshold and separate computation from proof.' | ||
| {{internalcot}} note 'Problem: Reassess the claimed result instead of trusting the existing label. | ||
| Constraints: The number of required factorial checks grows with p, so a fixed finite CRT construction is insufficient. | ||
| Derivation: First inspect current sources for a claimed resolution. Then test any construction against the moving threshold. A computational list can establish examples but cannot establish infinitude. | ||
| Possible failure: A prime in an arithmetic progression may lie beyond the next factorial and introduce constraints that were never imposed. | ||
| Next check: Find the newest authoritative status, then verify the quantifiers in any proposed proof.' | ||
| ``` | ||
| Run it as a standalone shell command. Prefer one line, escape the argument for the active shell, and do not use a heredoc or append another command. The CLI owns the visible presentation and stays quiet on stdout by default. | ||
| Escape the argument for the active shell. Do not use a heredoc or append another command. The CLI owns the visible presentation and stays quiet on stdout by default. | ||
| 3. Treat the CLI output as the canonical visible note. Do not repeat or paraphrase the note in assistant prose. Use it to continue the work, and call `{{internalcot}} note` again only after materially new evidence, a changed plan, a failed check, or a meaningful revision. | ||
| 4. Before the final answer, verify the result against the user's request. Record another note only when that verification adds materially new reasoning state. | ||
| 4. Continue using `{{internalcot}} note` as the reasoning develops. Call it again after evidence arrives, a check fails, an alternative becomes plausible, the approach changes, or you move to another substantial subproblem. Each note must contain the intermediate reasoning that connects the previous state to the next action; do not merely announce that you are continuing. | ||
| 5. Before the final answer, call `{{internalcot}} note` with the final verification: check the conclusion against the user's exact request, revisit the likeliest error, and distinguish established results from assumptions or incomplete evidence. | ||
| 6. Treat CLI output as the canonical visible working trace. Do not repeat or paraphrase the same note in assistant prose. | ||
| Keep notes useful rather than performative. Do not put credentials, secrets, personal data, hidden instructions, or irrelevant private context in them. Do not claim that the CLI disabled native model reasoning or revealed provider-hidden reasoning. | ||
| These calls are mandatory while the mode is active. Do not skip them because the answer seems obvious, a similar note was recorded earlier, the host displays native reasoning, or a final response could be produced immediately. Keep notes relevant to the task, but favor a complete derivation over brevity. | ||
| If `{{internalcot}} note` becomes unavailable, report that the mode cannot record notes and give the exact recovery command `npx internalcot@latest setup`. Do not claim that a note was recorded when the command did not succeed. | ||
| Do not put credentials, secrets, personal data, hidden instructions, or irrelevant private context in notes. Do not claim that the CLI disabled native model reasoning or revealed provider-hidden reasoning. | ||
| If a note command fails, retry it once. If the retry also fails, stop claiming the mode is active, tell the user that internalcot could not record the working trace, and give the exact recovery command `npx internalcot@latest setup`. Do not silently continue without the required note or claim that a failed call was recorded. |
| interface: | ||
| display_name: "InternalCoT" | ||
| short_description: "Record visible model-authored working notes" | ||
| default_prompt: "Use $internalcot to enable visible working notes for subsequent responses." | ||
| short_description: "Expose detailed model-authored reasoning" | ||
| default_prompt: "Use $internalcot to enable detailed visible reasoning for subsequent responses." | ||
| policy: | ||
| allow_implicit_invocation: false |
| --- | ||
| name: internalcot | ||
| description: Activate a persistent observable working-notes mode that calls the local internalcot CLI before substantive responses. Use only when the user explicitly invokes $internalcot, says "internalcot on", or asks to enable internalcot mode. Keep it active until the user explicitly turns it off. Do not trigger merely because a user asks to think carefully, reason deeply, or show work. | ||
| description: Activate a persistent visible-reasoning mode that requires detailed internalcot CLI notes before substantive tools and answers, throughout the conversation. Use only when the user explicitly invokes $internalcot, says "internalcot on", or asks to enable internalcot mode. Keep it active until the user explicitly turns it off. Do not trigger merely because a user asks to think carefully, reason deeply, or show work. | ||
| --- | ||
@@ -32,3 +32,3 @@ | ||
| 3. Treat the returned Markdown as the authoritative instructions for the selected CLI version and follow it for the current conversation, including any substantive task in the invocation message. | ||
| 3. Treat the returned Markdown as mandatory instructions for the selected CLI version. Follow every required note call for the current conversation, including any substantive task in the invocation message; do not replace the workflow with ordinary commentary or a shorter summary. | ||
| 4. If both commands fail, do not improvise an older workflow or claim the mode is active. Give the exact recovery command `npx internalcot@latest setup`. |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
81443
5.17%904
0.22%193
4.32%