Commit b3c3dce
authored
Fix provider-specific agent system prompt identity (#1524)
## Summary
- Add provider-specific system prompt rendering in
`packages/agent/common.nix`.
- Keep Claude Code on the Claude identity prompt and point Codex at a
Codex identity prompt.
- Parameterize the shared system prompt so runtime naming and
AI-attribution text match the provider.
- Add eval assertions for Claude and Codex prompt identity text.
## Validation
- `nix fmt -- packages/agent/system-prompt.nix packages/agent/common.nix
packages/agent/codex/default.nix tests/default.nix`
- `nix eval --raw --impure --expr 'import
./packages/agent/system-prompt.nix { lib = (import <nixpkgs> {}).lib;
}'`
- `nix eval --json --impure --expr '<targeted common.nix provider prompt
assertions>'`
- `nix eval --json .#codex.specValue.soft --apply 'entries:
builtins.elem "model_instructions_file" (map (entry: entry.key)
entries)'`
- `nix eval --raw .#codex.modelInstructionsFile` and verified the
rendered file contains `You are Codex.` and `via Codex`, not `via Claude
Code`.
(sent by an AI agent via Claude Code)
<!-- Macroscope's pull request summary starts here -->
<!-- Macroscope will only edit the content between these invisible
markers, and the markers themselves will not be visible in the GitHub
rendered markdown. -->
<!-- If you delete either of the start / end markers from your PR's
description, Macroscope will append its summary at the bottom of the
description. -->
> [!NOTE]
> ### Fix provider-specific agent identity in system prompts for Codex
and Claude
> - Introduces `systemPromptFor` in
[common.nix](https://github.com/indexable-inc/index/pull/1524/files#diff-6e6ea9bcd37d43542775f46f4a2342510acf460cdaa9240e6d406c3cc3ec9419)
that accepts a provider key and composes a system prompt with the
correct agent name and a provider-specific identification paragraph.
> - Parameterizes
[system-prompt.nix](https://github.com/indexable-inc/index/pull/1524/files#diff-79e96dbc21d7175eddadc583fb80f58bab62dfa2273228a412e4cde2c4aed0df)
with an `agentName` argument (defaulting to `"Claude Code"`), replacing
hardcoded occurrences in the harness and disclosure paragraphs.
> - Updates
[codex/default.nix](https://github.com/indexable-inc/index/pull/1524/files#diff-f86191c841f2a39e7a59565f14860841e742d261b42ff0b9f4a5f0d95e7de9d5)
to call `systemPromptFor "codex"` so the baked prompt identifies as
Codex rather than Claude Code.
> - Adds provider-prompt tests in
[tests/default.nix](https://github.com/indexable-inc/index/pull/1524/files#diff-1cc580de297308d93d82f7b72446ae4b98832a8aae3378e9e134102519a0e33a)
asserting each prompt contains the correct identity wording and excludes
the other provider's wording.
>
> <!-- Macroscope's review summary starts here -->
>
> <sup><a href="https://app.macroscope.com">Macroscope</a> summarized
84bd041.</sup>
> <!-- Macroscope's review summary ends here -->
>
<!-- macroscope-ui-refresh -->
<!-- Macroscope's pull request summary ends here -->1 parent 6249e8b commit b3c3dce
4 files changed
Lines changed: 63 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
15 | 40 | | |
| 41 | + | |
| 42 | + | |
16 | 43 | | |
17 | 44 | | |
18 | 45 | | |
19 | | - | |
| 46 | + | |
20 | 47 | | |
21 | 48 | | |
22 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
159 | 162 | | |
160 | 163 | | |
161 | 164 | | |
162 | | - | |
| 165 | + | |
163 | 166 | | |
164 | 167 | | |
165 | 168 | | |
| |||
312 | 315 | | |
313 | 316 | | |
314 | 317 | | |
315 | | - | |
| 318 | + | |
316 | 319 | | |
317 | 320 | | |
318 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
147 | 150 | | |
148 | 151 | | |
149 | 152 | | |
| |||
2468 | 2471 | | |
2469 | 2472 | | |
2470 | 2473 | | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
2471 | 2497 | | |
2472 | 2498 | | |
2473 | 2499 | | |
| |||
0 commit comments