@shuind/dsh-codex-harness 0.2.1 → 0.2.2
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.
- package/README.md +49 -49
- package/cordis.patch.yml +10 -10
- package/lib/compaction.js +20 -5
- package/lib/index.js +3 -3
- package/lib/types/compaction.d.ts +1 -0
- package/lib/types/compaction.js +30 -14
- package/lib/types/index.d.ts +5 -5
- package/lib/types/index.js +3 -3
- package/lib/types/patch.js +15 -15
- package/lib/types/prompt.js +35 -35
- package/package.json +247 -247
- package/presets/codex-collaboration/agent.cordis.yml +193 -193
- package/presets/codex-collaboration/preset.yml +3 -3
package/README.md
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
# @shuind/dsh-codex-harness
|
|
2
|
-
|
|
3
|
-
为 DSH 提供可自定义提示词与 Codex 工具的编码模式。
|
|
4
|
-
|
|
5
|
-
## 功能
|
|
6
|
-
|
|
7
|
-
- 使用精简codex提示词;对gpt
|
|
8
|
-
- 在 **设置 → 插件 → 插件配置 → Codex Harness** 中查看、编辑或恢复完整提示词。
|
|
9
|
-
- 提供 `exec_command`、`write_stdin`、`apply_patch` 和 `update_plan`。
|
|
10
|
-
- 支持 Fast 请求、GPT 图片与思考强度和上下文容量。
|
|
11
|
-
- 实时显示请求模型、模型回复和上下文压缩状态及耗时。
|
|
12
|
-
- Responses 请求优先使用原生 `apply_patch`、hosted `web_search` 和远程压缩,失败时回退到 DSH 实现。
|
|
13
|
-
|
|
14
|
-
## 安装
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
dsh plugin --profile web add @shuind/dsh-codex-harness@0.2.1
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
重启 Web,在 **Agent 预设** 中选择 **Codex 模式**,再创建会话。
|
|
21
|
-
|
|
22
|
-
## 配置
|
|
23
|
-
|
|
24
|
-
### 模型
|
|
25
|
-
|
|
26
|
-
在 DSH 的 Models 中配置支持 OpenAI Responses 的 provider、endpoint、API key 和 GPT 模型。例如:
|
|
27
|
-
|
|
28
|
-
```yaml
|
|
29
|
-
api: openai-responses
|
|
30
|
-
baseURL: https://your-responses-endpoint.example.com
|
|
31
|
-
apiKeyEnv: OPENAI_API_KEY
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
也可以配合 [dsh-codex-connect](https://github.com/shuind/dsh-codex-connect) 使用 ChatGPT 订阅模型。
|
|
35
|
-
|
|
36
|
-
### 提示词
|
|
37
|
-
|
|
38
|
-
打开 **设置 → 插件 → 插件配置 → Codex Harness**。编辑器展示本插件实际注入的完整提示词;保存后从下一次请求开始生效,点击“恢复默认”可回到随包模板。
|
|
39
|
-
|
|
40
|
-
身份、模型、工作目录、工具说明和 DSH 运行时上下文由对应插件动态提供,不会写死在可编辑模板中。
|
|
41
|
-
|
|
42
|
-
### Fast 与上下文
|
|
43
|
-
|
|
44
|
-
- **Fast**:在 Codex 模式的模型菜单中开启,向 Responses 请求发送 `service_tier: "priority"`。
|
|
45
|
-
- **上下文容量**:点击输入栏旁的上下文用量指示器,可设置 `1K`–`1000K` tokens;下一次请求和自动压缩使用该值。
|
|
46
|
-
|
|
47
|
-
## License
|
|
48
|
-
|
|
49
|
-
MIT
|
|
1
|
+
# @shuind/dsh-codex-harness
|
|
2
|
+
|
|
3
|
+
为 DSH 提供可自定义提示词与 Codex 工具的编码模式。
|
|
4
|
+
|
|
5
|
+
## 功能
|
|
6
|
+
|
|
7
|
+
- 使用精简codex提示词;对gpt过度拉屎做了少量提示词约束。
|
|
8
|
+
- 在 **设置 → 插件 → 插件配置 → Codex Harness** 中查看、编辑或恢复完整提示词。
|
|
9
|
+
- 提供 `exec_command`、`write_stdin`、`apply_patch` 和 `update_plan`。
|
|
10
|
+
- 支持 Fast 请求、GPT 图片与思考强度和上下文容量。
|
|
11
|
+
- 实时显示请求模型、模型回复和上下文压缩状态及耗时。
|
|
12
|
+
- Responses 请求优先使用原生 `apply_patch`、hosted `web_search` 和远程压缩,失败时回退到 DSH 实现。
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
dsh plugin --profile web add @shuind/dsh-codex-harness@0.2.1
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
重启 Web,在 **Agent 预设** 中选择 **Codex 模式**,再创建会话。
|
|
21
|
+
|
|
22
|
+
## 配置
|
|
23
|
+
|
|
24
|
+
### 模型
|
|
25
|
+
|
|
26
|
+
在 DSH 的 Models 中配置支持 OpenAI Responses 的 provider、endpoint、API key 和 GPT 模型。例如:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
api: openai-responses
|
|
30
|
+
baseURL: https://your-responses-endpoint.example.com
|
|
31
|
+
apiKeyEnv: OPENAI_API_KEY
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
也可以配合 [dsh-codex-connect](https://github.com/shuind/dsh-codex-connect) 使用 ChatGPT 订阅模型。
|
|
35
|
+
|
|
36
|
+
### 提示词
|
|
37
|
+
|
|
38
|
+
打开 **设置 → 插件 → 插件配置 → Codex Harness**。编辑器展示本插件实际注入的完整提示词;保存后从下一次请求开始生效,点击“恢复默认”可回到随包模板。
|
|
39
|
+
|
|
40
|
+
身份、模型、工作目录、工具说明和 DSH 运行时上下文由对应插件动态提供,不会写死在可编辑模板中。
|
|
41
|
+
|
|
42
|
+
### Fast 与上下文
|
|
43
|
+
|
|
44
|
+
- **Fast**:在 Codex 模式的模型菜单中开启,向 Responses 请求发送 `service_tier: "priority"`。
|
|
45
|
+
- **上下文容量**:点击输入栏旁的上下文用量指示器,可设置 `1K`–`1000K` tokens;下一次请求和自动压缩使用该值。
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
MIT
|
package/cordis.patch.yml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
- insert:
|
|
2
|
-
# The bundle is host-plane installation only. The Codex tool/prompt row
|
|
3
|
-
# lives in the bundled agent preset, so other presets stay unchanged.
|
|
4
|
-
- id: codex-preset-installer
|
|
5
|
-
name: '@shuind/dsh-codex-harness/installer'
|
|
6
|
-
# Register the browser face as part of the bundle. Without this explicit
|
|
7
|
-
# entry, a profile can load the host installer while the Web client never
|
|
8
|
-
# receives Fast/context controls.
|
|
9
|
-
- id: codex-client
|
|
10
|
-
name: '@shuind/dsh-codex-harness'
|
|
1
|
+
- insert:
|
|
2
|
+
# The bundle is host-plane installation only. The Codex tool/prompt row
|
|
3
|
+
# lives in the bundled agent preset, so other presets stay unchanged.
|
|
4
|
+
- id: codex-preset-installer
|
|
5
|
+
name: '@shuind/dsh-codex-harness/installer'
|
|
6
|
+
# Register the browser face as part of the bundle. Without this explicit
|
|
7
|
+
# entry, a profile can load the host installer while the Web client never
|
|
8
|
+
# receives Fast/context controls.
|
|
9
|
+
- id: codex-client
|
|
10
|
+
name: '@shuind/dsh-codex-harness'
|
package/lib/compaction.js
CHANGED
|
@@ -25,15 +25,19 @@ function requestContextWindow(session, provider, model) {
|
|
|
25
25
|
const value = config.contextWindow;
|
|
26
26
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
28
|
+
/** Resolve the capacity currently in force for an active Codex compaction. */
|
|
29
|
+
function activeContextWindow(ctx, activeSession, provider, model) {
|
|
30
|
+
const session = activeSession.getStore();
|
|
31
|
+
const requestContext = session?.requestContext();
|
|
32
|
+
const configured = isGptModel(model) ? configuredContextWindow(ctx) : { available: false };
|
|
33
|
+
return configured.available ? configured.value : (session === void 0 ? void 0 : requestContextWindow(session, provider, model)) ?? (requestContext?.provider === provider && requestContext.model === model ? requestContext.contextWindow : void 0);
|
|
34
|
+
}
|
|
35
|
+
/** Overlay capacity lookup and auxiliary summary requests for compaction. */
|
|
29
36
|
function withDurableContextCapacity(llm, ctx, activeSession) {
|
|
30
37
|
return new Proxy(llm, { get(target, property) {
|
|
31
38
|
if (property === "resolveModelInfo") return async (provider, model, signal) => {
|
|
32
39
|
const info = await target.resolveModelInfo(provider, model, signal);
|
|
33
|
-
const
|
|
34
|
-
const session = activeSession.getStore();
|
|
35
|
-
const configured = isGptModel(model) ? configuredContextWindow(ctx) : { available: false };
|
|
36
|
-
const contextWindow = configured.available ? configured.value : (session === void 0 ? void 0 : requestContextWindow(session, provider, model)) ?? (requestContext?.provider === provider && requestContext.model === model ? requestContext.contextWindow : void 0);
|
|
40
|
+
const contextWindow = activeContextWindow(ctx, activeSession, provider, model);
|
|
37
41
|
if (contextWindow === void 0) return info;
|
|
38
42
|
return {
|
|
39
43
|
...info,
|
|
@@ -43,6 +47,14 @@ function withDurableContextCapacity(llm, ctx, activeSession) {
|
|
|
43
47
|
}
|
|
44
48
|
};
|
|
45
49
|
};
|
|
50
|
+
if (property === "stream") return (options) => {
|
|
51
|
+
const contextWindow = activeContextWindow(ctx, activeSession, options.provider, options.model);
|
|
52
|
+
if (contextWindow === void 0 || options.contextWindow === contextWindow) return target.stream(options);
|
|
53
|
+
return target.stream({
|
|
54
|
+
...options,
|
|
55
|
+
contextWindow
|
|
56
|
+
});
|
|
57
|
+
};
|
|
46
58
|
const value = Reflect.get(target, property, target);
|
|
47
59
|
return typeof value === "function" ? value.bind(target) : value;
|
|
48
60
|
} });
|
|
@@ -66,6 +78,9 @@ var CodexCompactionEngine = class extends BasicCompactionEngine {
|
|
|
66
78
|
compactIfNeeded(agent, trigger, signal) {
|
|
67
79
|
return this.activeSession.run(agent.session, () => super.compactIfNeeded(agent, trigger, signal));
|
|
68
80
|
}
|
|
81
|
+
compactNow(agent, signal, sourceCommandId) {
|
|
82
|
+
return this.activeSession.run(agent.session, () => super.compactNow(agent, signal, sourceCommandId));
|
|
83
|
+
}
|
|
69
84
|
};
|
|
70
85
|
//#endregion
|
|
71
86
|
export { CodexCompactionEngine as default };
|
package/lib/index.js
CHANGED
|
@@ -1266,9 +1266,9 @@ function hasOpenTurn(session) {
|
|
|
1266
1266
|
* Pair the live Codex capacity with the token-meter context projection.
|
|
1267
1267
|
*
|
|
1268
1268
|
* The core loop records adapter metadata in `request/context`, while Codex's
|
|
1269
|
-
* setting is a
|
|
1270
|
-
*
|
|
1271
|
-
*
|
|
1269
|
+
* setting is a request-scoped LLM capacity. Appending the override after the
|
|
1270
|
+
* loop's metadata event keeps the official ContextMeter and compaction engine
|
|
1271
|
+
* on the same effective capacity.
|
|
1272
1272
|
*/
|
|
1273
1273
|
function syncCodexContextWindow(session, contextWindow) {
|
|
1274
1274
|
if (contextWindow === void 0 || !Number.isSafeInteger(contextWindow) || contextWindow <= 0 || !hasOpenTurn(session)) return;
|
|
@@ -14,5 +14,6 @@ export default class CodexCompactionEngine extends BasicCompactionEngine {
|
|
|
14
14
|
private readonly activeSession;
|
|
15
15
|
constructor(ctx: Context, config?: ConstructorParameters<typeof BasicCompactionEngine>[1]);
|
|
16
16
|
compactIfNeeded(agent: Agent, trigger: CompactionTrigger, signal: AbortSignal): Promise<CompactionResult | null>;
|
|
17
|
+
compactNow(agent: Agent, signal: AbortSignal, sourceCommandId?: Parameters<BasicCompactionEngine['compactNow']>[2]): Promise<CompactionResult | null>;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=compaction.d.ts.map
|
package/lib/types/compaction.js
CHANGED
|
@@ -30,26 +30,30 @@ function requestContextWindow(session, provider, model) {
|
|
|
30
30
|
const value = config.contextWindow;
|
|
31
31
|
return typeof value === 'number' && Number.isSafeInteger(value) && value > 0 ? value : undefined;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
33
|
+
/** Resolve the capacity currently in force for an active Codex compaction. */
|
|
34
|
+
function activeContextWindow(ctx, activeSession, provider, model) {
|
|
35
|
+
const session = activeSession.getStore();
|
|
36
|
+
const requestContext = session?.requestContext();
|
|
37
|
+
const configured = isGptModel(model)
|
|
38
|
+
? configuredContextWindow(ctx)
|
|
39
|
+
: { available: false };
|
|
40
|
+
// A live setting must win before the old request header: automatic pressure
|
|
41
|
+
// runs before the next request rebuilds that header.
|
|
42
|
+
return configured.available
|
|
43
|
+
? configured.value
|
|
44
|
+
: (session === undefined ? undefined : requestContextWindow(session, provider, model))
|
|
45
|
+
?? (requestContext?.provider === provider && requestContext.model === model
|
|
46
|
+
? requestContext.contextWindow
|
|
47
|
+
: undefined);
|
|
48
|
+
}
|
|
49
|
+
/** Overlay capacity lookup and auxiliary summary requests for compaction. */
|
|
34
50
|
function withDurableContextCapacity(llm, ctx, activeSession) {
|
|
35
51
|
return new Proxy(llm, {
|
|
36
52
|
get(target, property) {
|
|
37
53
|
if (property === 'resolveModelInfo') {
|
|
38
54
|
return async (provider, model, signal) => {
|
|
39
55
|
const info = await target.resolveModelInfo(provider, model, signal);
|
|
40
|
-
const
|
|
41
|
-
const session = activeSession.getStore();
|
|
42
|
-
const configured = isGptModel(model)
|
|
43
|
-
? configuredContextWindow(ctx)
|
|
44
|
-
: { available: false };
|
|
45
|
-
// A live setting must win before the old request header: automatic
|
|
46
|
-
// pressure runs before the next request rebuilds that header.
|
|
47
|
-
const contextWindow = configured.available
|
|
48
|
-
? configured.value
|
|
49
|
-
: (session === undefined ? undefined : requestContextWindow(session, provider, model))
|
|
50
|
-
?? (requestContext?.provider === provider && requestContext.model === model
|
|
51
|
-
? requestContext.contextWindow
|
|
52
|
-
: undefined);
|
|
56
|
+
const contextWindow = activeContextWindow(ctx, activeSession, provider, model);
|
|
53
57
|
if (contextWindow === undefined)
|
|
54
58
|
return info;
|
|
55
59
|
return {
|
|
@@ -58,6 +62,15 @@ function withDurableContextCapacity(llm, ctx, activeSession) {
|
|
|
58
62
|
};
|
|
59
63
|
};
|
|
60
64
|
}
|
|
65
|
+
if (property === 'stream') {
|
|
66
|
+
return (options) => {
|
|
67
|
+
const contextWindow = activeContextWindow(ctx, activeSession, options.provider, options.model);
|
|
68
|
+
if (contextWindow === undefined || options.contextWindow === contextWindow) {
|
|
69
|
+
return target.stream(options);
|
|
70
|
+
}
|
|
71
|
+
return target.stream({ ...options, contextWindow });
|
|
72
|
+
};
|
|
73
|
+
}
|
|
61
74
|
const value = Reflect.get(target, property, target);
|
|
62
75
|
return typeof value === 'function' ? value.bind(target) : value;
|
|
63
76
|
},
|
|
@@ -83,5 +96,8 @@ export default class CodexCompactionEngine extends BasicCompactionEngine {
|
|
|
83
96
|
compactIfNeeded(agent, trigger, signal) {
|
|
84
97
|
return this.activeSession.run(agent.session, () => super.compactIfNeeded(agent, trigger, signal));
|
|
85
98
|
}
|
|
99
|
+
compactNow(agent, signal, sourceCommandId) {
|
|
100
|
+
return this.activeSession.run(agent.session, () => super.compactNow(agent, signal, sourceCommandId));
|
|
101
|
+
}
|
|
86
102
|
}
|
|
87
103
|
//# sourceMappingURL=compaction.js.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -29,9 +29,9 @@ export interface Config {
|
|
|
29
29
|
}
|
|
30
30
|
/** Runtime configuration schema for the Codex tool bridge. */
|
|
31
31
|
export declare const Config: z<Config>;
|
|
32
|
-
/**
|
|
32
|
+
/** Codex request envelope with the plugin's provider-facing service-tier field. */
|
|
33
33
|
export interface CodexRequestConfig extends LlmCallConfig {
|
|
34
|
-
/** Codex request context capacity override,
|
|
34
|
+
/** Codex request context capacity override, retained for older DSH hosts. */
|
|
35
35
|
contextWindow?: number;
|
|
36
36
|
/** Provider-facing service tier, for example Responses `priority`. */
|
|
37
37
|
serviceTier?: string;
|
|
@@ -48,9 +48,9 @@ export declare function enrichCodexModel(model: CodexModelProfile): CodexModelPr
|
|
|
48
48
|
* Pair the live Codex capacity with the token-meter context projection.
|
|
49
49
|
*
|
|
50
50
|
* The core loop records adapter metadata in `request/context`, while Codex's
|
|
51
|
-
* setting is a
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* setting is a request-scoped LLM capacity. Appending the override after the
|
|
52
|
+
* loop's metadata event keeps the official ContextMeter and compaction engine
|
|
53
|
+
* on the same effective capacity.
|
|
54
54
|
*/
|
|
55
55
|
export declare function syncCodexContextWindow(session: Session, contextWindow: number | undefined): void;
|
|
56
56
|
/** Apply the live Codex controls to one agent request without leaking them to other routes. */
|
package/lib/types/index.js
CHANGED
|
@@ -140,9 +140,9 @@ function hasOpenTurn(session) {
|
|
|
140
140
|
* Pair the live Codex capacity with the token-meter context projection.
|
|
141
141
|
*
|
|
142
142
|
* The core loop records adapter metadata in `request/context`, while Codex's
|
|
143
|
-
* setting is a
|
|
144
|
-
*
|
|
145
|
-
*
|
|
143
|
+
* setting is a request-scoped LLM capacity. Appending the override after the
|
|
144
|
+
* loop's metadata event keeps the official ContextMeter and compaction engine
|
|
145
|
+
* on the same effective capacity.
|
|
146
146
|
*/
|
|
147
147
|
export function syncCodexContextWindow(session, contextWindow) {
|
|
148
148
|
if (contextWindow === undefined
|
package/lib/types/patch.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/** Parser and line-oriented applicator for Codex's `apply_patch` language. */
|
|
2
2
|
export const APPLY_PATCH_DESCRIPTION = 'Edits files using Codex patch syntax with Begin/End Patch markers and file update directives. In hunk lines, the first character is the operation marker; repeat a source-leading marker when the source line itself starts with one.';
|
|
3
3
|
/** The grammar sent to providers that support OpenAI custom grammar tools. */
|
|
4
|
-
export const APPLY_PATCH_GRAMMAR = String.raw `start: begin_patch hunk+ end_patch
|
|
5
|
-
begin_patch: "*** Begin Patch" LF
|
|
6
|
-
end_patch: "*** End Patch" LF?
|
|
7
|
-
hunk: add_hunk | delete_hunk | update_hunk
|
|
8
|
-
add_hunk: "*** Add File: " filename LF add_line+
|
|
9
|
-
delete_hunk: "*** Delete File: " filename LF
|
|
10
|
-
update_hunk: "*** Update File: " filename LF change_move? change?
|
|
11
|
-
filename: /(.+)/
|
|
12
|
-
add_line: "+" /(.*)/ LF -> line
|
|
13
|
-
change_move: "*** Move to: " filename LF
|
|
14
|
-
change: (change_context | change_line)+ eof_line?
|
|
15
|
-
change_context: ("@@" | "@@ " /(.+)/) LF
|
|
16
|
-
change_line: ("+" | "-" | " ") /(.*)/ LF
|
|
17
|
-
eof_line: "*** End of File" LF
|
|
18
|
-
%import common.LF
|
|
4
|
+
export const APPLY_PATCH_GRAMMAR = String.raw `start: begin_patch hunk+ end_patch
|
|
5
|
+
begin_patch: "*** Begin Patch" LF
|
|
6
|
+
end_patch: "*** End Patch" LF?
|
|
7
|
+
hunk: add_hunk | delete_hunk | update_hunk
|
|
8
|
+
add_hunk: "*** Add File: " filename LF add_line+
|
|
9
|
+
delete_hunk: "*** Delete File: " filename LF
|
|
10
|
+
update_hunk: "*** Update File: " filename LF change_move? change?
|
|
11
|
+
filename: /(.+)/
|
|
12
|
+
add_line: "+" /(.*)/ LF -> line
|
|
13
|
+
change_move: "*** Move to: " filename LF
|
|
14
|
+
change: (change_context | change_line)+ eof_line?
|
|
15
|
+
change_context: ("@@" | "@@ " /(.+)/) LF
|
|
16
|
+
change_line: ("+" | "-" | " ") /(.*)/ LF
|
|
17
|
+
eof_line: "*** End of File" LF
|
|
18
|
+
%import common.LF
|
|
19
19
|
`;
|
|
20
20
|
function invalid(message) {
|
|
21
21
|
throw new Error(`apply_patch: ${message}`);
|
package/lib/types/prompt.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
/** Default plugin-owned Codex operating prompt. */
|
|
2
|
-
export const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw `## General
|
|
3
|
-
|
|
4
|
-
- When searching for text or files, prefer using rg or rg --files respectively because rg is much faster than alternatives like grep. If rg is not available, use the next best alternative.
|
|
5
|
-
|
|
6
|
-
## Editing constraints
|
|
7
|
-
|
|
8
|
-
- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.
|
|
9
|
-
- Add succinct code comments that explain non-obvious code. Do not add comments that merely narrate assignments or control flow.
|
|
10
|
-
- You may be in a dirty git worktree. Never revert existing changes you did not make unless the user explicitly requests it. If unrelated files are changed, leave them alone.
|
|
11
|
-
|
|
12
|
-
## Planning
|
|
13
|
-
|
|
14
|
-
- Use update_plan for work with multiple meaningful steps. Keep the plan current as the task progresses.
|
|
15
|
-
- Do not use a plan for a trivial one-step request.
|
|
16
|
-
|
|
17
|
-
## dsh session
|
|
18
|
-
|
|
19
|
-
- The user and you share one workspace. Inspect the repository and every applicable AGENTS.md before editing.
|
|
20
|
-
|
|
21
|
-
## Task execution
|
|
22
|
-
|
|
23
|
-
- Keep the user informed with concise progress updates and lead with the result.
|
|
24
|
-
|
|
25
|
-
## Presenting your work
|
|
26
|
-
|
|
27
|
-
- Be concise, direct, friendly, and actionable.
|
|
28
|
-
- For substantial work, explain what changed and why, then briefly note how the work was verified and what comes next.
|
|
29
|
-
- Do not dump large files into the conversation; refer to their paths.
|
|
30
|
-
- Use plain text with short sections only when they improve scanability.
|
|
31
|
-
|
|
32
|
-
## Working principles
|
|
33
|
-
|
|
34
|
-
- Ask, align, and clarify first. Gather enough context from the user, then align the approach to achieve the user's goal through the clearest, most effective path.
|
|
35
|
-
- Keep only the essential logic and core actions. Don't explain or test what was removed or why something wasn't done, especially when writing documentation or communicating. Convey enough valuable information with as few words as possible.
|
|
36
|
-
- Solve problems by thinking from first principles and at a higher level.
|
|
2
|
+
export const DEFAULT_CODEX_SYSTEM_PROMPT = String.raw `## General
|
|
3
|
+
|
|
4
|
+
- When searching for text or files, prefer using rg or rg --files respectively because rg is much faster than alternatives like grep. If rg is not available, use the next best alternative.
|
|
5
|
+
|
|
6
|
+
## Editing constraints
|
|
7
|
+
|
|
8
|
+
- Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.
|
|
9
|
+
- Add succinct code comments that explain non-obvious code. Do not add comments that merely narrate assignments or control flow.
|
|
10
|
+
- You may be in a dirty git worktree. Never revert existing changes you did not make unless the user explicitly requests it. If unrelated files are changed, leave them alone.
|
|
11
|
+
|
|
12
|
+
## Planning
|
|
13
|
+
|
|
14
|
+
- Use update_plan for work with multiple meaningful steps. Keep the plan current as the task progresses.
|
|
15
|
+
- Do not use a plan for a trivial one-step request.
|
|
16
|
+
|
|
17
|
+
## dsh session
|
|
18
|
+
|
|
19
|
+
- The user and you share one workspace. Inspect the repository and every applicable AGENTS.md before editing.
|
|
20
|
+
|
|
21
|
+
## Task execution
|
|
22
|
+
|
|
23
|
+
- Keep the user informed with concise progress updates and lead with the result.
|
|
24
|
+
|
|
25
|
+
## Presenting your work
|
|
26
|
+
|
|
27
|
+
- Be concise, direct, friendly, and actionable.
|
|
28
|
+
- For substantial work, explain what changed and why, then briefly note how the work was verified and what comes next.
|
|
29
|
+
- Do not dump large files into the conversation; refer to their paths.
|
|
30
|
+
- Use plain text with short sections only when they improve scanability.
|
|
31
|
+
|
|
32
|
+
## Working principles
|
|
33
|
+
|
|
34
|
+
- Ask, align, and clarify first. Gather enough context from the user, then align the approach to achieve the user's goal through the clearest, most effective path.
|
|
35
|
+
- Keep only the essential logic and core actions. Don't explain or test what was removed or why something wasn't done, especially when writing documentation or communicating. Convey enough valuable information with as few words as possible.
|
|
36
|
+
- Solve problems by thinking from first principles and at a higher level.
|
|
37
37
|
`;
|
|
38
38
|
/** Resolve the full plugin-owned prompt, preserving intentional empty overrides. */
|
|
39
39
|
export function resolveCodexSystemPrompt(systemPrompt) {
|