From 0f2aa896ae9e5b5a13cd5e997b4fa5a085414f0c Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Thu, 29 Jan 2026 01:42:04 +0900 Subject: [PATCH] =?UTF-8?q?Execution=20Rules=20=E3=81=AB=20cd=20=E7=A6=81?= =?UTF-8?q?=E6=AD=A2=E3=83=AB=E3=83=BC=E3=83=AB=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit エージェントがBashコマンドで明示的にcdしてmainディレクトリで 作業してしまう問題を解決するため、「cdを使用しないでください」 というルールをmetadataに追加。 --- src/__tests__/instructionBuilder.test.ts | 2 ++ src/workflow/instruction-builder.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/__tests__/instructionBuilder.test.ts b/src/__tests__/instructionBuilder.test.ts index a2fa4f8..64ca3ce 100644 --- a/src/__tests__/instructionBuilder.test.ts +++ b/src/__tests__/instructionBuilder.test.ts @@ -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', () => { diff --git a/src/workflow/instruction-builder.ts b/src/workflow/instruction-builder.ts index 55ea988..e7487c5 100644 --- a/src/workflow/instruction-builder.ts +++ b/src/workflow/instruction-builder.ts @@ -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('');