Execution Rules に cd 禁止ルールを追加

エージェントがBashコマンドで明示的にcdしてmainディレクトリで
作業してしまう問題を解決するため、「cdを使用しないでください」
というルールをmetadataに追加。
This commit is contained in:
nrslib 2026-01-29 01:42:04 +09:00
parent 48e055ac8a
commit 0f2aa896ae
2 changed files with 5 additions and 0 deletions

View File

@ -199,6 +199,7 @@ describe('instruction-builder', () => {
expect(rendered).toContain('- Working Directory: /project');
expect(rendered).toContain('## Execution Rules');
expect(rendered).toContain('Do NOT run git commit');
expect(rendered).toContain('Do NOT use `cd`');
});
it('should end with a trailing empty line', () => {
@ -214,6 +215,7 @@ describe('instruction-builder', () => {
expect(rendered).toContain('- 作業ディレクトリ: /project');
expect(rendered).toContain('## 実行ルール');
expect(rendered).toContain('git commit を実行しないでください');
expect(rendered).toContain('cd` を使用しないでください');
});
it('should include English note only for en, not for ja', () => {

View File

@ -62,6 +62,7 @@ const METADATA_STRINGS = {
workingDirectory: 'Working Directory',
rulesHeading: '## Execution Rules',
noCommit: '**Do NOT run git commit.** Commits are handled automatically by the system after workflow completion.',
noCd: '**Do NOT use `cd` in Bash commands.** Your working directory is already set correctly. Run commands directly without changing directories.',
note: 'Note: This section is metadata. Follow the language used in the rest of the prompt.',
},
ja: {
@ -69,6 +70,7 @@ const METADATA_STRINGS = {
workingDirectory: '作業ディレクトリ',
rulesHeading: '## 実行ルール',
noCommit: '**git commit を実行しないでください。** コミットはワークフロー完了後にシステムが自動で行います。',
noCd: '**Bashコマンドで `cd` を使用しないでください。** 作業ディレクトリは既に正しく設定されています。ディレクトリを変更せずにコマンドを実行してください。',
note: '',
},
} as const;
@ -88,6 +90,7 @@ export function renderExecutionMetadata(metadata: ExecutionMetadata): string {
'',
strings.rulesHeading,
`- ${strings.noCommit}`,
`- ${strings.noCd}`,
];
if (strings.note) {
lines.push('');