a↗agentbay.AgentBay を入手
マイアカウント ▾
メニュー
← 実践ガイドへ戻る
実践ガイドの出力

ガードレールを設定・実行する

元のファイルをダウンロード ↓

06 ガードレール

チケットを実装する前にAI Software Toolkitをインストールします。単体テストを強制し、開始用コミットを記録して、その正確なリビジョンを確認します。開始用CRMが返すものは BLOCKです。インポーターがないためインポートテスト群を読み込めませんが、既存の連絡先テスト5件は引き続き合格します。

審査済みのCRM-142実装を適用し、README.mdに記録します。変更を確認してコミットした後、開始用SHAを基準に、新しいコミットへ同じ検証を実行します。完成したプロジェクトが返すものは ALLOWです。全17単体ケースが合格します。両チェックポイント間で、単体テストのポリシーは変えていません。

サンプルプロジェクトに一度インストール

Python 3.11以上、Node.js 24、Gitが必要です。同梱の設定スクリプトはAI Software Toolkit v2.3.3をダウンロードし、リリースのチェックサムと固定したダイジェストを確認してから、ローカルのProofとprepare-safe-changeをインストールします。GitHub Actionsは無効のままです。

python3 setup-guardrails.py --yes
git init
git add .
git commit -m "Record CRM starter with enforced unit tests"
git rev-parse HEAD
PROOF_UNIT_TEST_COMMAND="npm test" python3 .toolkit-cache/ai-toolkit.pyz check --target . --base-ref HEAD --json

上に表示される開始用の完全なSHAを保存してください。自分のGitの作者情報を使います。同梱の.gitignoreは、インストールしたスキル、Toolkitのダウンロード、ランタイム成果物を除外します。

完成したリビジョンを確認

機能を実装し、README.mdを更新してください。コミット前に差分を確認します。

git add index.html style.css src/app.js src/import.js docs README.md
git commit -m "Implement CRM-142 and document the import flow"
PROOF_UNIT_TEST_COMMAND="npm test" python3 .toolkit-cache/ai-toolkit.pyz check --target . --base-ref STARTER_COMMIT --json

STARTER_COMMITを、保存した完全なSHAに置き換えてください。実行記録には、この再実行における実際の変更前後のリビジョンが記録されます。元のアプリケーションファイルと変更不可のテストは、公開されたCRM実行と一致しています。

助言事項も読む

完成時のチェックポイントには変更規模の所見があります。集計した追加549行は予算300行に対し、一つのファイル内の追加305行は予算150行に対します。差分には実装と、そのソース選択の証拠を含みます。差分を確認し、しきい値は変更しないでください。文書、リポジトリ、実態確認は合格し、その他6つの助言項目には報告された結果がありません。

ALLOWは、強制された単体テストゲートの結果を示します。コミット、マージ、デプロイは行いません。ブラウザ検証は、アプリケーションの流れに関する別の証拠です。

元のファイルと出所の詳細

guardrails.md · SHA-256 c1952816fb672c3a7d7e5df106ed6f6ab093dcae2da88b74a5e27824dd4adbc5

# 06 Guardrails

Install AI Software Toolkit before implementing the ticket. Enforce unit tests, record the starter commit, then check that exact revision. The CRM starter returns **BLOCK**: its import suite cannot load the missing importer. Its existing five contact tests still pass.

Apply the reviewed CRM-142 implementation and document it in README.md. Review and commit the changes, then run the same check against that new commit using the starter SHA as the base. The finished project returns **ALLOW**: all 17 unit cases pass. The unit-test policy is unchanged between checkpoints.

## Install once in the sample project

Requires Python 3.11+, Node.js 24 and Git. The included setup script downloads AI Software Toolkit v2.3.3, checks the release checksum and pinned digest, then installs local Proof and prepare-safe-change. GitHub Actions stays off.

```sh
python3 setup-guardrails.py --yes
git init
git add .
git commit -m "Record CRM starter with enforced unit tests"
git rev-parse HEAD
PROOF_UNIT_TEST_COMMAND="npm test" python3 .toolkit-cache/ai-toolkit.pyz check --target . --base-ref HEAD --json
```

Save the full starter SHA printed above. Use your own Git identity. The supplied .gitignore excludes installed skills, toolkit downloads and runtime artifacts.

## Check the finished revision

Implement the feature and update README.md. Review the diff before committing.

```sh
git add index.html style.css src/app.js src/import.js docs README.md
git commit -m "Implement CRM-142 and document the import flow"
PROOF_UNIT_TEST_COMMAND="npm test" python3 .toolkit-cache/ai-toolkit.pyz check --target . --base-ref STARTER_COMMIT --json
```

Replace STARTER_COMMIT with your saved full SHA. The receipt records the actual before and after revisions from this replay. The original application files and immutable tests match the published CRM run.

## Read the advisory too

The finished checkpoint has a change-size finding: 549 counted added lines against a 300-line budget, and 305 added lines in one file against a 150-line budget. The diff includes the implementation and its source-selection evidence. Review the diff; keep the thresholds unchanged. Documentation, repository and ground-truth checks passed. Six other advisory controls have no reported result.

ALLOW reports the enforced unit-test gate. It does not commit, merge or deploy. The browser checks are separate evidence for the application flow.