Skip to content

Commit 50e5fdb

Browse files
feat: update AGENTS.md path to ~/.codex directory and enhance README with default configuration details
1 parent c0ad3e1 commit 50e5fdb

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

registry/coder-labs/modules/codex/README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,32 @@ module "codex" {
8484
## How it Works
8585

8686
- **Install**: The module installs Codex CLI and sets up the environment
87-
- **System Prompt**: If `codex_system_prompt` and `folder` are set, creates the directory (if needed) and writes the prompt to `AGENTS.md`
87+
- **System Prompt**: If `codex_system_prompt` is set, writes the prompt to `AGENTS.md` in the `~/.codex/` directory
8888
- **Start**: Launches Codex CLI in the specified directory, wrapped by AgentAPI
8989
- **Configuration**: Sets `OPENAI_API_KEY` environment variable and passes `--model` flag to Codex CLI (if variables provided)
9090

9191
## Configuration
9292

93+
### **Default Configuration**
94+
95+
When no custom `base_config_toml` is provided, the module uses these secure defaults:
96+
97+
```toml
98+
sandbox_mode = "workspace-write"
99+
approval_policy = "never"
100+
preferred_auth_method = "apikey"
101+
102+
[sandbox_workspace_write]
103+
network_access = true
104+
writable_roots = ["$/path/to/your/folder$", "$HOME/.codex"]
105+
```
106+
107+
The default configuration allows writing to only two specific directories:
108+
- Your specified `folder` (working directory)
109+
- `$HOME/.codex` (for configuration files like AGENTS.md)
110+
111+
This provides secure sandbox boundaries while preventing access to other sensitive directories.
112+
93113
### **Custom Configuration (Optional)**
94114

95115
For custom Codex configuration, use `base_config_toml` and/or `additional_mcp_servers`:

registry/coder-labs/modules/codex/main.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ describe("codex", async () => {
292292
},
293293
});
294294
await execModuleScript(id);
295-
const resp = await readFileContainer(id, "/home/coder/AGENTS.md");
295+
const resp = await readFileContainer(id, "/home/coder/.codex/AGENTS.md");
296296
expect(resp).toContain(prompt);
297297
});
298298

@@ -305,7 +305,7 @@ describe("codex", async () => {
305305
`.trim();
306306
const pre_install_script = dedent`
307307
#!/bin/bash
308-
echo -e "${prompt_3}" >> /home/coder/AGENTS.md
308+
echo -e "${prompt_3}" >> /home/coder/.codex/AGENTS.md
309309
`.trim();
310310

311311
const { id } = await setup({
@@ -315,7 +315,7 @@ describe("codex", async () => {
315315
},
316316
});
317317
await execModuleScript(id);
318-
const resp = await readFileContainer(id, "/home/coder/AGENTS.md");
318+
const resp = await readFileContainer(id, "/home/coder/.codex/AGENTS.md");
319319
expect(resp).toContain(prompt_1);
320320
expect(resp).toContain(prompt_2);
321321

@@ -327,7 +327,7 @@ describe("codex", async () => {
327327
},
328328
});
329329
await execModuleScript(id_2);
330-
const resp_2 = await readFileContainer(id_2, "/home/coder/AGENTS.md");
330+
const resp_2 = await readFileContainer(id_2, "/home/coder/.codex/AGENTS.md");
331331
expect(resp_2).toContain(prompt_1);
332332
const count = (resp_2.match(new RegExp(prompt_1, "g")) || []).length;
333333
expect(count).toBe(1);
@@ -355,7 +355,7 @@ describe("codex", async () => {
355355
const prompt = await execContainer(id, [
356356
"ls",
357357
"-l",
358-
"/home/coder/AGENTS.md",
358+
"/home/coder/.codex/AGENTS.md",
359359
]);
360360
expect(prompt.exitCode).not.toBe(0);
361361
expect(prompt.stderr).toContain("No such file or directory");

0 commit comments

Comments
 (0)