> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/jp/endpoint-privilege-manager/deployment/deploy-with-macos/agentic-ai-policy-workload-reduction.md).

# エージェント型AIポリシーのワークロード削減

<figure><img src="https://859776093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPL6k1aGsLiFiiJ3Y7zCl%2Fuploads%2Fgit-blob-e39abeefe0a7daa2db40eb42ea46cf07db4eab51%2Fimage%20(496).png?alt=media" alt=""><figcaption></figcaption></figure>

Keeperエンドポイント特権マネージャー (EPM) は、エンドポイントごとに評価されるワークロード数で課金されます。エージェントに到達するプロセス起動、ファイルアクセス、昇格リクエスト、バックグラウンドチェックはすべてワークロードとして計上されるため、過剰な活動の多いアプリケーションが動くエンドポイントは、同じポリシーでも活動の少ないソフトウェア環境より多くのワークロードを消費します。

<figure><img src="https://859776093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPL6k1aGsLiFiiJ3Y7zCl%2Fuploads%2Fgit-blob-7093993e69cf4ee24c7ec8d6ea2a08517abb2f44%2Fimage%20(494).png?alt=media" alt=""><figcaption></figcaption></figure>

ポリシーの適用範囲を弱めずにワークロード消費を抑えるうえで最も効果的なのは、アプリケーション自身の活動を抑えることです。開発ツール、生産性ツール、バックグラウンドツールの多くは、必要以上にファイルシステムをポーリングしたり、キャッシュを更新したり、定期的なハウスキーピングを実行したりします。各アプリケーション自身の設定を調整して不要な活動を減らすと、EPMの評価に到達する前の発生源でワークロードを削減できます。

以下は、既定の動作がノイズとして知られる特定アプリケーションを対象に、管理対象フリート全体へ設定変更を一元配信してワークロード負荷を下げる推奨手順です。

***

### 推奨: `JobUpdate` ポリシーでCursorのポーリング設定を配信する (macOS) <a href="#recommendation-deploy-cursor-polling-settings-via-a-jobupdate-policy-macos" id="recommendation-deploy-cursor-polling-settings-via-a-jobupdate-policy-macos"></a>

#### 症状 <a href="#symptom" id="symptom"></a>

Cursor IDE (および同様のGit/検索機構を共有するVS Code) が動作するmacOSエンドポイントでは、ユーザーがアイドルでも `git` と `rg` (ripgrep) のプロセス起動が連続して発生します。EPMシステム拡張が動作するホストでは、これらのプロセス生成のたびにポリシー評価が介入し、以下のような影響が出ます。

* エンドポイントあたりのワークロード数 (および課金使用量) が増加する
* エンドポイント上でCPUとディスク負荷が持続する
* 監査およびポリシーパイプラインが価値の低いプロセス実行イベントで埋まる
* 負荷が高いと `KEEPER_POLICY_EXEC_TIMEOUT` によるfail-open動作の一因になり得る

#### 原因 <a href="#why-it-happens" id="why-it-happens"></a>

Cursorの既定は、小規模リポジトリでの対話応答性向けに最適化されており、管理対象エンドポイントでの静かな運用向けではありません。初期状態のCursorは以下を行います。

* 短い間隔 (既定ではおおよそ1秒ごと) でGitのauto-fetchとauto-refreshを実行する
* リポジトリを自動検出し、ワークスペース内の `.git` ディレクトリを再帰的にスキャンする
* グローバル検索とQuick Openに `ripgrep` を使い、除外しない限りワークスペース全体を走査する
* ファイルシステムウォッチャーでワークスペース全体を監視する (`node_modules`、ビルド出力、`.git` 内部を含む)

各 `git` / `rg` 呼び出しは個別のプロセス起動であり、EPMシステム拡張がポリシーに照らして評価する必要があります。大規模リポジトリやモノレポでは、この活動は実質的に連続します。

#### 対処: `JobUpdate` ポリシーですべてのユーザーに静かな設定を配信する <a href="#fix-push-quiet-settings-to-every-user-via-a-jobupdate-policy" id="fix-push-quiet-settings-to-every-user-via-a-jobupdate-policy"></a>

開発者ごとに `settings.json` を手編集してもらう代わりに、管理対象macOSエンドポイントへスケジュールジョブをインストールする単一の `JobUpdate` ポリシーをデプロイします。ジョブはEPMサービス (root) として実行され、`/Users` 配下の各ユーザーホームを列挙し、推奨設定を各ユーザーの `~/Library/Application Support/Cursor/User/settings.json` に書き込みます。

ジョブが適用する設定は以下のとおりです。

```json
{
  "git.autofetch": false,
  "git.autorefresh": false,
  "git.autoRepositoryDetection": false,
  "git.repositoryScanMaxDepth": 0,
  "search.useIgnoreFiles": true,
  "search.useGlobalIgnoreFiles": true,
  "search.useParentIgnoreFiles": true,
  "search.followSymlinks": false,
  "search.exclude": {
    "**/node_modules": true,
    "**/dist": true,
    "**/build": true,
    "**/.git": true
  },
  "files.watcherExclude": {
    "**/node_modules/**": true,
    "**/.git/objects/**": true,
    "**/.git/subtree-cache/**": true,
    "**/dist/**": true,
    "**/build/**": true
  }
}
```

ワークロード量への効果は以下のとおりです。

* **Git:** auto-fetch、auto-refresh、リポジトリ自動検出なし。リポジトリスキャン深度は `0` で、再帰的なワークスペーススキャンなし。1秒ごとの安定した `git` 呼び出しベースラインを解消します。
* **検索 (ripgrep):** 各階層の `.gitignore` を尊重し、シンボリックリンクを辿らず、`node_modules`、`dist`、`build`、`.git` をスキップします。グローバル検索とQuick Openがこれらの重いディレクトリを走査しなくなります。
* **ファイルウォッチャー:** 同じディレクトリをワークスペースウォッチャーから除外し、ビルドツールや `git` が書き込むたびに再インデックスが続くのを防ぎます。

#### ポリシーJSON <a href="#policy-json" id="policy-json"></a>

以下は、管理コンソールに貼り付けるポリシーJSONです。外側のフィールドがスコープとインストールのトリガーを定義し、内側の `Extension.JobJson` がジョブ定義です。`ConfigurationPolicyProcessor` は `Extension.JobJson` を読み取り、許可された `SaveJobToDiskAndLkg` パス経由で保存し、ディスクとLast Known Goodの両方を更新します。そのためLKGウォッチャーによる巻き戻しは起きません。

```json
{
  "PolicyName": "Configure Cursor git/ripgrep polling (JobUpdate)",
  "PolicyType": "JobUpdate",
  "PolicyId": "configure-cursor-polling-policy",
  "Status": "enforce",
  "Actions": {
    "OnSuccess": { "Controls": [] },
    "OnFailure": { "Command": "" }
  },
  "NotificationMessage": "A policy has been set to monitor mode.  When this policy is enabled, [mfa, justification, request] will be required to run this process as an administrator.",
  "NotificationRequiresAcknowledge": false,
  "RiskLevel": 50,
  "Operator": "And",
  "Rules": [
    { "RuleName": "UserCheck",        "ErrorMessage": "This user is not included in this policy",        "RuleExpressionType": "BuiltInAction", "Expression": "CheckUser()" },
    { "RuleName": "MachineCheck",     "ErrorMessage": "This Machine is not included in this policy",     "RuleExpressionType": "BuiltInAction", "Expression": "CheckMachine()" },
    { "RuleName": "ApplicationCheck", "ErrorMessage": "This application is not included in this policy", "RuleExpressionType": "BuiltInAction", "Expression": "CheckFile(false)" },
    { "RuleName": "DateCheck",        "ErrorMessage": "Current date is not covered by this policy",      "RuleExpressionType": "BuiltInAction", "Expression": "CheckDate()" },
    { "RuleName": "TimeCheck",        "ErrorMessage": "Current time is not covered by this policy",      "RuleExpressionType": "BuiltInAction", "Expression": "CheckTime()" },
    { "RuleName": "DayCheck",         "ErrorMessage": "Today is not included in this policy",            "RuleExpressionType": "BuiltInAction", "Expression": "CheckDay()" },
    { "RuleName": "CertificateCheck", "ErrorMessage": "Certificate hash is not included in this policy", "RuleExpressionType": "BuiltInAction", "Expression": "CheckCertificate()" }
  ],
  "UserCheck": [ "*" ],
  "MachineCheck": [ "O_w7iACgy53mAwPlniSz4w" ],
  "ApplicationCheck": [ "*" ],
  "DayCheck": [],
  "DateCheck": [],
  "TimeCheck": [],
  "CertificationCheck": [],
  "Extension": {
    "JobId": "configure-cursor-polling",
    "Action": "Add",
    "JobJson": {
      "id": "configure-cursor-polling",
      "name": "Configure Cursor git/ripgrep polling",
      "description": "Writes recommended git/search settings into each user Cursor settings.json via bash (self-contained, no external script)",
      "enabled": true,
      "asUser": false,
      "priority": 5,
      "events": [
        { "eventType": "Custom", "customEvent": "PolicyPreprocessingCompleted" }
      ],
      "schedule": { "intervalMinutes": 30 },
      "parameters": [],
      "tasks": [
        {
          "id": "run-config",
          "name": "Apply Cursor polling settings",
          "command": "/bin/bash",
          "arguments": "-c \"for d in /Users/*/;do [ Shared = $(basename $d) ]&&continue;mkdir -p $d/Library/Application\\ Support/Cursor/User;echo '{\\\"git.autofetch\\\":false,\\\"git.autorefresh\\\":false,\\\"git.autoRepositoryDetection\\\":false,\\\"git.repositoryScanMaxDepth\\\":0,\\\"search.useIgnoreFiles\\\":true,\\\"search.useGlobalIgnoreFiles\\\":true,\\\"search.useParentIgnoreFiles\\\":true,\\\"search.followSymlinks\\\":false,\\\"search.exclude\\\":{\\\"**/node_modules\\\":true,\\\"**/dist\\\":true,\\\"**/build\\\":true,\\\"**/.git\\\":true},\\\"files.watcherExclude\\\":{\\\"**/node_modules/**\\\":true,\\\"**/.git/objects/**\\\":true,\\\"**/.git/subtree-cache/**\\\":true,\\\"**/dist/**\\\":true,\\\"**/build/**\\\":true}}' > $d/Library/Application\\ Support/Cursor/User/settings.json;done\"",
          "executionType": "Service",
          "expectedExitCode": 0,
          "timeoutSeconds": 60,
          "scriptType": "Auto"
        }
      ],
      "mqttTopics": {
        "allowedPublications": [ "KeeperLogger" ],
        "allowedSubscriptions": []
      },
      "osFilter": { "windows": false, "linux": false, "macOS": true }
    }
  }
}
```

デプロイ前に確認すべき主なフィールドは以下のとおりです。

* **`PolicyType: "JobUpdate"`:** ジョブインストール用ポリシーです。`ConfigurationPolicyProcessor` が `Extension` を読み取り、ジョブをインストールします。
* **`Extension.Action: "Add"`:** ジョブをインストールまたは更新します (`"Add"` はupsert。アンインストールは `"Remove"`)。
* **`Extension.JobId`:** `JobJson.id` (`configure-cursor-polling`) と一致させる必要があります。
* **`Status`:** 有効化は `"enforce"`。`"monitor"` はログのみです。
* **`MachineCheck`:** `O_w7iACgy53mAwPlniSz4w` を対象マシンIDに置き換えるか、全マシン向けに `["*"]` を使います。
* **`schedule.intervalMinutes: 30`:** 本番値です。テストでは確認を早めるために `1` でも可。広く展開する前に `30` (またはそれ以上) に戻してください。
* **トリガー:** ジョブは `PolicyPreprocessingCompleted` カスタムイベントとスケジュール間隔の両方で実行されるため、新規インストールのエンドポイントでもポリシー前処理完了後すぐに初回適用されます。

{% hint style="info" icon="pencil-line" %}
`/Library/Keeper/sbin/Jobs/configure-cursor-polling.json` を直接編集してデプロイしないでください。`ConfigurationLkgReconciliation` ファイルシステムウォッチャーが手動編集を巻き戻します (`JOB_WATCHER_RESTORE`)。利用できる経路は管理コンソールの `JobUpdate` ポリシーのみです。
{% endhint %}

#### ユーザーカバレッジ: ローカル、ADモバイル、ネットワークホーム <a href="#user-coverage-local-ad-mobile-and-network-homes" id="user-coverage-local-ad-mobile-and-network-homes"></a>

`/Users/*/` のグロブは、`/Users` 配下にマウントされたすべてのホームディレクトリを対象にします。macOSでは以下を含みます。

* **ローカルユーザー:** 例 `/Users/test`、`/Users/jsmith`
* **Active Directoryモバイルアカウント:** ADプラグインが `/Users/<aduser>` にモバイルアカウントホームを作成します。ローカルキャッシュホームのため、書き込みは高速で安定します。
* **ネットワークホームディレクトリ:** `/Users/<networkuser>` にマウントされたNFS/AFPホームもグロブ対象です。書き込みはネットワーク経由でホームサーバーへ到達します。

`Shared` ディレクトリは意図的にスキップします。ジョブはrootで動くため、ユーザー種別を問わずホームのファイル権限で書き込みは阻害されません。`/Users` 外にマウントされたホーム (例: `/Volumes/homes/<user>`) は既定グロブの対象外です。非標準のホームルートを使う環境ではグロブを拡張してください。

#### エスケープの落とし穴 <a href="#escaping-pitfall" id="escaping-pitfall"></a>

タスクは `/bin/bash -c "<script>"` でbashスクリプトをインライン化します。`Application Support` パスには空白があり、JSON、.NETの `Process.Start` 引数トークナイザ、bashの3層の解析を問題なく通過する必要があります。正しいJSONでは、各 `Application Support` に対して**バックスラッシュを2つ**使います。

```
...mkdir -p $d/Library/Application\\ Support/Cursor/User; ... > $d/Library/Application\\ Support/Cursor/User/settings.json;...
```

* `Application\\ Support` (JSON上2バックスラッシュ) → 引数文字列では1バックスラッシュ → bashが空白をエスケープ扱い → 1語として処理 → 成功
* `Application\\\\ Support` (4バックスラッシュ) → 引数文字列では2バックスラッシュ → bashが `\\` をエスケープされたバックスラッシュと解釈し空白が未エスケープ → 単語分割 → `echo >` のリダイレクト先がディレクトリになる → `Is a directory` → 終了コード1

両方の箇所 (`mkdir` パスと `echo >` リダイレクトパス) で、バックスラッシュは2つにする必要があります。

#### 検証 <a href="#verification" id="verification"></a>

* **成功**時は、`Shared` 以外の各ユーザーホームに新しい `~/Library/Application Support/Cursor/User/settings.json` (root所有、約477バイト) が残ります。成功時の `TASK_COMPLETE` と `JOB_EXECUTION_COMPLETE` は `Debug` / `Info` で記録され、`system.logging.level` が `Warning` のときはフィルタされます。
* **失敗**時は、Warningレベルで `[WRN] [JobExecutor] [JOB_STOPPED] ... Task 'run-config' failed` と `[WRN] [JobService] [JOB_EXECUTION_COMPLETE] ... Success: False` が出ます。これらは既定で可視です。
* 明示的な `ExitCode=0` 行を見るには、一時的に `/Library/Keeper/sbin/appsettings.json` の `system.logging.level` を `Debug` にし、エージェントを再起動 (`keepersudo launchctl kickstart -k system/com.keeper.endpoint-privilege-manager.launcher`) してから、確認後に `Warning` へ戻してください。

#### 注意事項 <a href="#caveats" id="caveats"></a>

* **`settings.json` を丸ごと上書きします。** タスクは `echo > settings.json` を使うため、ファイル全体が置き換わります。Cursor設定のユーザー独自カスタマイズは実行のたびに失われます。既存JSONを読んでポーリング関連キーだけマージして書き戻す方式は今後の改善予定です。
* **冪等性:** ポーリング設定については冪等 (同じJSONの再書き込み) ですが、ユーザーが設定した他のキーに対しては破壊的です (上記参照)。
* **ネットワークホームの性能:** NFS/AFPホームへの書き込みはネットワーク経由です。遅い回線では60秒タイムアウトに近づくことがあります。タイムアウトが出る場合は、遅い・到達不能なネットワークホームを除外するようグロブを絞ってください。
* **`/Users` 以外のホームルート:** 既定では対象外です。カスタムホームパスを使う環境ではグロブを拡張してください (例: `/Users/*/ /Volumes/homes/*/`)。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/endpoint-privilege-manager/deployment/deploy-with-macos/agentic-ai-policy-workload-reduction.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
